{"id":43866,"library":"spraypaint-machinetools","title":"spraypaint-machinetools","description":"An isomorphic JavaScript/TypeScript ORM client for Graphiti APIs, modeled after ActiveRecord. This fork (v0.10.22-mt-2) is maintained by MachineTools developers. It supports decorator-based model definitions, query building with scoping, pagination, sorting, and includes, and works in both browser and Node.js environments. Unlike generic HTTP clients, it provides a structured, type-safe way to interact with JSON:API-compliant backends. The library ships TypeScript definitions but also works with plain ES5. Release cadence is irregular as it's a fork maintained for specific project needs.","status":"active","version":"0.10.22-mt-2","language":"javascript","source_language":"en","source_url":"https://github.com/MachineTools/spraypaint.js","tags":["javascript","typescript"],"install":[{"cmd":"npm install spraypaint-machinetools","lang":"bash","label":"npm"},{"cmd":"yarn add spraypaint-machinetools","lang":"bash","label":"yarn"},{"cmd":"pnpm add spraypaint-machinetools","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"SpraypaintBase is a named export, not the default.","wrong":"import SpraypaintBase from 'spraypaint'","symbol":"SpraypaintBase","correct":"import { SpraypaintBase } from 'spraypaint'"},{"note":"Model is exported from the main package entry point.","wrong":"import { Model } from 'spraypaint/lib/Model'","symbol":"Model","correct":"import { Model } from 'spraypaint'"},{"note":"The decorator is named Attr, not Attribute.","wrong":"import { Attribute } from 'spraypaint'","symbol":"Attr","correct":"import { Attr } from 'spraypaint'"},{"note":"All decorators are exported from the main package.","wrong":"import { HasMany } from 'spraypaint/decorators'","symbol":"HasMany","correct":"import { HasMany } from 'spraypaint'"}],"quickstart":{"code":"import { SpraypaintBase, Model, Attr, HasMany } from 'spraypaint'\n\n@Model()\nclass ApplicationRecord extends SpraypaintBase {\n  static baseUrl = 'http://localhost:3000'\n  static apiNamespace = '/api/v1'\n}\n\n@Model()\nclass Pet extends ApplicationRecord {\n  static jsonapiType = 'pets'\n  @Attr() name: string\n}\n\nasync function main() {\n  const { data } = await Pet.all()\n  console.log(data.map(p => p.name))\n}\n\nmain().catch(console.error)","lang":"typescript","description":"Defines a Pet model with an attribute and fetches all records from the API."},"warnings":[{"fix":"Set \"experimentalDecorators\": true in tsconfig.json.","message":"Decorators require TypeScript's experimentalDecorators and emitDecoratorMetadata enabled.","severity":"gotcha","affected_versions":">=0.10"},{"fix":"Use @Model() decorator on the class instead of a separate registration call.","message":"Version 0.10 changed the way models are registered. Previously required explicit registration.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Declare static baseUrl = '...' and static apiNamespace = '...' in the base class.","message":"baseUrl and apiNamespace must be static properties, not instance properties.","severity":"gotcha","affected_versions":">=0.10"},{"fix":"Use .include('pets') instead of .includes('pets').","message":"The .includes() method is deprecated in favor of .include().","severity":"deprecated","affected_versions":">=0.10.22"}],"env_vars":null,"search_vec":"'activerecord':14 'also':72 'api':11,63 'api-compli':62 'backend':65 'base':27 'browser':42 'build':31 'cadenc':78 'client':8,49 'compliant':64 'decor':26 'decorator-bas':25 'definit':29,70 'develop':22 'environ':45 'es5':76 'fork':16,85 'generic':47 'graphiti':10 'http':48 'includ':37 'interact':59 'irregular':80 'isomorph':5 'javascript':91 'javascript/typescript':6 'json':61 'librari':67 'machinetool':3,21 'maintain':19,86 'model':12,28 'need':90 'node.js':44 'orm':7 'pagin':34 'plain':75 'project':89 'provid':51 'queri':30 'releas':77 'safe':56 'scope':33 'ship':68 'sort':35 'specif':88 'spraypaint':2 'spraypaint-machinetool':1 'structur':53 'support':24 'type':55 'type-saf':54 'typescript':69,92 'unlik':46 'v0.10.22-mt-2':17 'way':57 'work':39,73","created_at":"2026-06-05T17:01:51.653287+00:00","updated_at":"2026-06-05T17:01:51.653287+00:00","problems":[{"fix":"Import { SpraypaintBase } from 'spraypaint'.","cause":"Missing import for SpraypaintBase.","error":"Cannot find name 'SpraypaintBase'. Did you mean 'SpraypaintBase'?"},{"fix":"Enable 'experimentalDecorators' in tsconfig.json.","cause":"TypeScript decorators are experimental.","error":"Experimental support for decorators is a feature that is subject to change in a future release."},{"fix":"Add static baseUrl = 'http://example.com' to your ApplicationRecord class.","cause":"baseUrl not defined as a static property on the model class.","error":"TypeError: Cannot read properties of undefined (reading 'baseUrl')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/MachineTools/spraypaint.js","github":"https://github.com/MachineTools/spraypaint.js","docs":null,"changelog":null,"pypi":null,"npm":"spraypaint-machinetools","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}