Spraypaint.js
Graphiti Client / Javascript ORM / JSONAPI
Install / Use
/learn @graphiti-api/Spraypaint.jsREADME
Spraypaint
JS Client for Graphiti similar to ActiveRecord.
Written in Typescript but works in plain old ES5 as well. This library is isomorphic - use it from the browser, or from the server with NodeJS.
Sample Usage
Please see our documentation page for full usage. Below is a Typescript sample:
import { SpraypaintBase, Model, Attr, HasMany } from "spraypaint"
@Model()
class ApplicationRecord extends SpraypaintBase {
static baseUrl = "http://localhost:3000"
static apiNamespace = "/api/v1"
}
@Model()
class Person extends ApplicationRecord {
static jsonapiType = "people"
@Attr() firstName: string
@Attr() lastName: string
@HasMany() pets: Pet[]
get fullName() {
return `${this.firstName} ${this.lastName}`
}
}
@Model()
class Pet extends ApplicationRecord {
static jsonapiType = "pets"
@Attr() name: string
}
let { data } = await Person
.where({ name: 'Joe' })
.page(2).per(10)
.sort('name')
.includes("pets")
.all()
let names = data.map((p) => { return p.fullName })
console.log(names) // ['Joe Blow', 'Joe DiMaggio', ...]
console.log(data[0].pets[0].name) // "Fido"
Related Skills
node-connect
337.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
337.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.3kCommit, push, and open a PR
