@stardeck-customer-apps/data-store-sdk 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/SKILL.md +30 -0
  2. package/package.json +1 -1
package/SKILL.md CHANGED
@@ -228,6 +228,36 @@ the schema snapshot is what `@stardeck-customer-apps/testing` applies to its
228
228
  in-process Postgres, so a stale snapshot means tests run against the wrong
229
229
  schema.
230
230
 
231
+ > **Never hand-edit a generated file.** `data-store-types.ts` is a write-only
232
+ > output: it's overwritten in full on every regeneration and contains only the
233
+ > raw table interfaces plus the `DB` type. Any type you append to it is silently
234
+ > wiped the next time the schema changes and you re-run `generate-types`.
235
+
236
+ App-level / derived types — serialized shapes (`Date` → `string` for API
237
+ responses), typed `jsonb` columns, computed/virtual fields, composite view
238
+ models — belong in a **separate hand-written file** that imports from the
239
+ generated one. This keeps regeneration safe and your types permanent:
240
+
241
+ ```typescript
242
+ // src/lib/order-types.ts (hand-written — survives every regeneration)
243
+ import type { Selectable } from "kysely";
244
+ import type { DB } from "@/generated/data-store-types";
245
+
246
+ type OrderRow = Selectable<DB["orders"]>;
247
+
248
+ // API-serialized shape: Dates become strings, jsonb gets a real type,
249
+ // and we add a computed field the table doesn't store.
250
+ export type Order = Omit<OrderRow, "created_at" | "metadata"> & {
251
+ created_at: string;
252
+ metadata: { source: string; tags: string[] };
253
+ is_overdue: boolean;
254
+ };
255
+ ```
256
+
257
+ If you find hand-written types already living inside a generated file, move them
258
+ into a sibling file like this and update the imports across the codebase rather
259
+ than perpetuating the append-and-restore cycle.
260
+
231
261
  ### Initialize
232
262
 
233
263
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stardeck-customer-apps/data-store-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "SDK for accessing Stardeck data stores from deployed projects",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",