@stardeck-customer-apps/data-store-sdk 0.1.0-preview.3 → 0.1.0-preview.5
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 +8 -8
- package/dist/server/index.js +19 -3
- package/dist/server/index.mjs +19 -3
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -278,14 +278,14 @@ try {
|
|
|
278
278
|
|
|
279
279
|
## When to Use Which Pattern
|
|
280
280
|
|
|
281
|
-
| Scenario | Pattern
|
|
282
|
-
| ----------------------------------------- |
|
|
283
|
-
| Application CRUD with known schema | Kysely (recommended)
|
|
284
|
-
| Complex queries (joins, CTEs, subqueries) | Kysely
|
|
285
|
-
| Edge functions / serverless | Kysely
|
|
286
|
-
| Agent building features dynamically | DataStoreClient
|
|
287
|
-
| Schema management (create/alter tables) | DataStoreClient
|
|
288
|
-
| Storage file operations | DataStoreClient
|
|
281
|
+
| Scenario | Pattern |
|
|
282
|
+
| ----------------------------------------- | -------------------- |
|
|
283
|
+
| Application CRUD with known schema | Kysely (recommended) |
|
|
284
|
+
| Complex queries (joins, CTEs, subqueries) | Kysely |
|
|
285
|
+
| Edge functions / serverless | Kysely |
|
|
286
|
+
| Agent building features dynamically | DataStoreClient |
|
|
287
|
+
| Schema management (create/alter tables) | DataStoreClient |
|
|
288
|
+
| Storage file operations | DataStoreClient |
|
|
289
289
|
|
|
290
290
|
## Important Notes
|
|
291
291
|
|
package/dist/server/index.js
CHANGED
|
@@ -256,9 +256,25 @@ async function createDataStore(options) {
|
|
|
256
256
|
}
|
|
257
257
|
const { Kysely: KyselyClass } = await import("kysely");
|
|
258
258
|
const { NeonDialect } = await import("kysely-neon");
|
|
259
|
-
const { neon } = await import("@neondatabase/serverless");
|
|
260
|
-
const
|
|
261
|
-
|
|
259
|
+
const { neon, types } = await import("@neondatabase/serverless");
|
|
260
|
+
const customTypes = {
|
|
261
|
+
...types,
|
|
262
|
+
getTypeParser: ((oid, format) => {
|
|
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 });
|
|
262
278
|
return new KyselyClass({
|
|
263
279
|
dialect,
|
|
264
280
|
...options?.kyselyConfig
|
package/dist/server/index.mjs
CHANGED
|
@@ -205,9 +205,25 @@ async function createDataStore(options) {
|
|
|
205
205
|
}
|
|
206
206
|
const { Kysely: KyselyClass } = await import("kysely");
|
|
207
207
|
const { NeonDialect } = await import("kysely-neon");
|
|
208
|
-
const { neon } = await import("@neondatabase/serverless");
|
|
209
|
-
const
|
|
210
|
-
|
|
208
|
+
const { neon, types } = await import("@neondatabase/serverless");
|
|
209
|
+
const customTypes = {
|
|
210
|
+
...types,
|
|
211
|
+
getTypeParser: ((oid, format) => {
|
|
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 });
|
|
211
227
|
return new KyselyClass({
|
|
212
228
|
dialect,
|
|
213
229
|
...options?.kyselyConfig
|
package/package.json
CHANGED