@stardeck-customer-apps/data-store-sdk 0.1.0-preview.5 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +13 -1
- package/dist/server/index.js +3 -18
- package/dist/server/index.mjs +3 -18
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Data Store SDK - AI Agent Skill Guide
|
|
2
2
|
|
|
3
|
-
This guide
|
|
3
|
+
This guide documents the **runtime SDK** that the customer's deployed app uses to read and write data store data at request time. It's for code that runs inside the customer's app — API routes, server actions, edge functions.
|
|
4
|
+
|
|
5
|
+
> **IMPORTANT — agent vs runtime distinction:**
|
|
6
|
+
>
|
|
7
|
+
> If you (the agent) need to create tables, add columns, change column types, or insert/update/delete rows during planning, use your **dedicated data store tools** instead of writing app code that calls this SDK:
|
|
8
|
+
>
|
|
9
|
+
> - `createDataStoreTable`, `addDataStoreColumn`, `renameDataStoreColumn`, `changeDataStoreColumnType`, `deleteDataStoreColumn`, `deleteDataStoreTable` — schema management
|
|
10
|
+
> - `insertDataStoreRow`, `updateDataStoreRow`, `deleteDataStoreRow` — row mutations (use these for seeding data)
|
|
11
|
+
> - `queryDataStore`, `getDataStoreSchema`, `listDataStores` — reads
|
|
12
|
+
>
|
|
13
|
+
> Those tools operate on the same branch the customer's deployed app reads/writes via `DATA_STORE_*_URL`, so they stay in sync.
|
|
14
|
+
>
|
|
15
|
+
> **Only write code that imports `@stardeck-customer-apps/data-store-sdk` when** the customer's app needs to perform data store operations at request time — for example, a CRUD UI, a multi-tenant app that creates per-customer tables on signup, or a background job. Do NOT use the SDK to seed initial data or set up schema during build/planning — use the agent tools above.
|
|
4
16
|
|
|
5
17
|
## Quick Reference
|
|
6
18
|
|
package/dist/server/index.js
CHANGED
|
@@ -257,24 +257,9 @@ async function createDataStore(options) {
|
|
|
257
257
|
const { Kysely: KyselyClass } = await import("kysely");
|
|
258
258
|
const { NeonDialect } = await import("kysely-neon");
|
|
259
259
|
const { neon, types } = await import("@neondatabase/serverless");
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
if (oid === 1700) return (val) => parseFloat(val);
|
|
264
|
-
return types.getTypeParser(oid, format);
|
|
265
|
-
})
|
|
266
|
-
};
|
|
267
|
-
const baseSql = neon(connectionString);
|
|
268
|
-
const wrappedSql = {
|
|
269
|
-
query: (queryWithPlaceholders, params, queryOpts) => (
|
|
270
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
271
|
-
baseSql.query(queryWithPlaceholders, params, {
|
|
272
|
-
...queryOpts,
|
|
273
|
-
types: customTypes
|
|
274
|
-
})
|
|
275
|
-
)
|
|
276
|
-
};
|
|
277
|
-
const dialect = new NeonDialect({ neon: wrappedSql });
|
|
260
|
+
types.setTypeParser(1700, (val) => parseFloat(val));
|
|
261
|
+
const sql = neon(connectionString);
|
|
262
|
+
const dialect = new NeonDialect({ neon: sql });
|
|
278
263
|
return new KyselyClass({
|
|
279
264
|
dialect,
|
|
280
265
|
...options?.kyselyConfig
|
package/dist/server/index.mjs
CHANGED
|
@@ -206,24 +206,9 @@ async function createDataStore(options) {
|
|
|
206
206
|
const { Kysely: KyselyClass } = await import("kysely");
|
|
207
207
|
const { NeonDialect } = await import("kysely-neon");
|
|
208
208
|
const { neon, types } = await import("@neondatabase/serverless");
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (oid === 1700) return (val) => parseFloat(val);
|
|
213
|
-
return types.getTypeParser(oid, format);
|
|
214
|
-
})
|
|
215
|
-
};
|
|
216
|
-
const baseSql = neon(connectionString);
|
|
217
|
-
const wrappedSql = {
|
|
218
|
-
query: (queryWithPlaceholders, params, queryOpts) => (
|
|
219
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
220
|
-
baseSql.query(queryWithPlaceholders, params, {
|
|
221
|
-
...queryOpts,
|
|
222
|
-
types: customTypes
|
|
223
|
-
})
|
|
224
|
-
)
|
|
225
|
-
};
|
|
226
|
-
const dialect = new NeonDialect({ neon: wrappedSql });
|
|
209
|
+
types.setTypeParser(1700, (val) => parseFloat(val));
|
|
210
|
+
const sql = neon(connectionString);
|
|
211
|
+
const dialect = new NeonDialect({ neon: sql });
|
|
227
212
|
return new KyselyClass({
|
|
228
213
|
dialect,
|
|
229
214
|
...options?.kyselyConfig
|
package/package.json
CHANGED