The Coline App SDK: apps, tools, file types and surfaces that run inside Coline workspaces, and public websites with Coline Sites. TypeScript, with an in-memory test workspace. MIT.
| 4 | name: string, |
| 5 | call: <R>(operation: string, args: unknown[]) => Promise<R>, |
| 6 | ): ColineCollection<T> { |
| 7 | return { |
| 8 | insert: (data, options) => call("storage.records.insert", [name, data, options ?? {}]), |
| 9 | get: (id) => call("storage.records.get", [name, id]), |
| 10 | update: (id, data, options) => call("storage.records.update", [name, id, data, options ?? {}]), |
| 11 | delete: (id, options) => call("storage.records.delete", [name, id, options ?? {}]), |
| 12 | setAccess: (id, access, options) => |
| 13 | call("storage.records.setAccess", [name, id, access, options ?? {}]), |
| 14 | query: (query) => call("storage.records.query", [name, query ?? {}]), |
| 15 | sync: (query, revision) => |
| 16 | call("storage.records.sync", [ |
| 17 | name, |
| 18 | query ?? {}, |
| 19 | ...(revision === undefined ? [] : [revision]), |
| 20 | ]), |
| 21 | }; |
| 22 | } |
| 23 |