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.
| 5 | name: string, |
| 6 | call: <R>(operation: string, args: unknown[]) => Promise<R>, |
| 7 | ): ColineCollection<T> { |
| 8 | return { |
| 9 | insert: (data, options) => call("storage.records.insert", [name, data, options ?? {}]), |
| 10 | get: (id) => call("storage.records.get", [name, id]), |
| 11 | update: (id, data, options) => call("storage.records.update", [name, id, data, options ?? {}]), |
| 12 | delete: (id, options) => call("storage.records.delete", [name, id, options ?? {}]), |
| 13 | setAccess: (id, access, options) => |
| 14 | call("storage.records.setAccess", [name, id, access, options ?? {}]), |
| 15 | query: (query) => call("storage.records.query", [name, query ?? {}]), |
| 16 | sync: (query, revision) => |
| 17 | call("storage.records.sync", [ |
| 18 | name, |
| 19 | query ?? {}, |
| 20 | ...(revision === undefined ? [] : [revision]), |
| 21 | ]), |
| 22 | count: (where) => call("storage.records.count", [name, where ?? {}]), |
| 23 | aggregate: (input) => call("storage.records.aggregate", [name, input]), |
| 24 | batch: (operations) => call("storage.records.batch", [name, operations]), |
| 25 | insertMany: (rows) => call("storage.records.insertMany", [name, rows]), |
| 26 | updateMany: (input) => call("storage.records.updateMany", [name, input]), |
| 27 | deleteMany: (input) => call("storage.records.deleteMany", [name, input]), |
| 28 | }; |
| 29 | } |
| 30 |