@storyshelf/db-sqlite 0.6.2 → 0.8.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.
Files changed (93) hide show
  1. package/README.md +9 -9
  2. package/dist/better-sqlite3.d.mts +0 -2
  3. package/dist/better-sqlite3.mjs +8 -4
  4. package/dist/better-sqlite3.mjs.map +1 -1
  5. package/dist/bun-sqlite.d.mts +0 -2
  6. package/dist/bun-sqlite.mjs +8 -4
  7. package/dist/bun-sqlite.mjs.map +1 -1
  8. package/dist/d1.d.mts +0 -2
  9. package/dist/d1.mjs +6 -5
  10. package/dist/d1.mjs.map +1 -1
  11. package/dist/ddl.d.mts +10 -4
  12. package/dist/ddl.mjs +247 -16
  13. package/dist/ddl.mjs.map +1 -1
  14. package/dist/drizzle-factory.d.mts +0 -2
  15. package/dist/drizzle-factory.mjs +6 -3
  16. package/dist/drizzle-factory.mjs.map +1 -1
  17. package/dist/ensure-db-dir.mjs +2 -4
  18. package/dist/ensure-db-dir.mjs.map +1 -1
  19. package/dist/index.d.mts +4 -3
  20. package/dist/index.mjs +9 -5
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/schema/baseline.d.mts +87 -13
  23. package/dist/schema/baseline.mjs +6 -3
  24. package/dist/schema/baseline.mjs.map +1 -1
  25. package/dist/schema/{status-config.d.mts → build-component.d.mts} +41 -36
  26. package/dist/schema/build-component.mjs +21 -0
  27. package/dist/schema/build-component.mjs.map +1 -0
  28. package/dist/schema/build-review.d.mts +127 -0
  29. package/dist/schema/build-review.mjs +19 -0
  30. package/dist/schema/build-review.mjs.map +1 -0
  31. package/dist/schema/build.d.mts +81 -25
  32. package/dist/schema/build.mjs +5 -2
  33. package/dist/schema/build.mjs.map +1 -1
  34. package/dist/schema/capture-attempt.d.mts +25 -27
  35. package/dist/schema/capture-attempt.mjs +1 -2
  36. package/dist/schema/capture-job.d.mts +357 -0
  37. package/dist/schema/capture-job.mjs +37 -0
  38. package/dist/schema/capture-job.mjs.map +1 -0
  39. package/dist/schema/capture-shard.d.mts +279 -0
  40. package/dist/schema/capture-shard.mjs +27 -0
  41. package/dist/schema/capture-shard.mjs.map +1 -0
  42. package/dist/schema/comment.d.mts +31 -13
  43. package/dist/schema/comment.mjs +4 -4
  44. package/dist/schema/comment.mjs.map +1 -1
  45. package/dist/schema/connection.d.mts +189 -0
  46. package/dist/schema/connection.mjs +25 -0
  47. package/dist/schema/connection.mjs.map +1 -0
  48. package/dist/schema/content-refs.d.mts +0 -2
  49. package/dist/schema/content-refs.mjs +1 -2
  50. package/dist/schema/design.d.mts +647 -0
  51. package/dist/schema/design.mjs +48 -0
  52. package/dist/schema/design.mjs.map +1 -0
  53. package/dist/schema/insight.d.mts +687 -0
  54. package/dist/schema/insight.mjs +52 -0
  55. package/dist/schema/insight.mjs.map +1 -0
  56. package/dist/schema/label.d.mts +15 -17
  57. package/dist/schema/label.mjs +1 -2
  58. package/dist/schema/member.d.mts +7 -9
  59. package/dist/schema/member.mjs +1 -2
  60. package/dist/schema/notification.d.mts +58 -20
  61. package/dist/schema/notification.mjs +3 -2
  62. package/dist/schema/notification.mjs.map +1 -1
  63. package/dist/schema/project-group-mapping.d.mts +6 -8
  64. package/dist/schema/project-group-mapping.mjs +1 -2
  65. package/dist/schema/project.d.mts +132 -2
  66. package/dist/schema/project.mjs +9 -3
  67. package/dist/schema/project.mjs.map +1 -1
  68. package/dist/schema/site-setting.d.mts +107 -0
  69. package/dist/schema/site-setting.mjs +16 -0
  70. package/dist/schema/site-setting.mjs.map +1 -0
  71. package/dist/schema/snapshot.d.mts +203 -27
  72. package/dist/schema/snapshot.mjs +15 -3
  73. package/dist/schema/snapshot.mjs.map +1 -1
  74. package/dist/schema/token.d.mts +8 -10
  75. package/dist/schema/token.mjs +1 -2
  76. package/dist/schema/usage.d.mts +291 -0
  77. package/dist/schema/usage.mjs +29 -0
  78. package/dist/schema/usage.mjs.map +1 -0
  79. package/dist/schema/user-invite.d.mts +7 -9
  80. package/dist/schema/user-invite.mjs +1 -2
  81. package/dist/schema/user.d.mts +0 -2
  82. package/dist/schema/user.mjs +1 -2
  83. package/dist/schema/webhook.d.mts +8 -10
  84. package/dist/schema/webhook.mjs +1 -2
  85. package/dist/schema.d.mts +24 -5
  86. package/dist/schema.mjs +26 -6
  87. package/dist/schema.mjs.map +1 -1
  88. package/dist/turso.d.mts +2 -4
  89. package/dist/turso.mjs +20 -8
  90. package/dist/turso.mjs.map +1 -1
  91. package/package.json +7 -7
  92. package/dist/schema/status-config.mjs +0 -20
  93. package/dist/schema/status-config.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture-shard.mjs","names":[],"sources":["../../src/schema/capture-shard.ts"],"sourcesContent":["import type { CaptureShardKind, CaptureShardStatus } from \"@storyshelf/core/schema\";\nimport { index, integer, sqliteTable, text, uniqueIndex } from \"drizzle-orm/sqlite-core\";\nimport { builds } from \"./build.ts\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `capture_shards` table definition: the stages of a sharded capture and its finalize claim. */\nexport const captureShards = sqliteTable(\n \"capture_shards\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n buildId: text(\"build_id\")\n .notNull()\n .references(() => builds.id, { onDelete: \"cascade\" }),\n kind: text(\"kind\").$type<CaptureShardKind>().notNull(),\n ordinal: integer(\"ordinal\").notNull(),\n status: text(\"status\").$type<CaptureShardStatus>().notNull().default(\"pending\"),\n attemptId: text(\"attempt_id\"),\n payload: text(\"payload\"),\n result: text(\"result\"),\n error: text(\"error\"),\n startedAt: text(\"started_at\"),\n finishedAt: text(\"finished_at\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (t) => [\n uniqueIndex(\"capture_shards_build_kind_ordinal_idx\").on(t.buildId, t.kind, t.ordinal),\n index(\"capture_shards_build_id_idx\").on(t.buildId),\n ],\n);\n"],"mappings":";;;;;;;;AAMA,MAAa,gBAAgB,YAC3B,kBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,SAAS,KAAK,UAAU,CAAC,CACtB,QAAQ,CAAC,CACT,iBAAiB,OAAO,IAAI,EAAE,UAAU,UAAU,CAAC;CACtD,MAAM,KAAK,MAAM,CAAC,CAAC,MAAwB,CAAC,CAAC,QAAQ;CACrD,SAAS,QAAQ,SAAS,CAAC,CAAC,QAAQ;CACpC,QAAQ,KAAK,QAAQ,CAAC,CAAC,MAA0B,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,SAAS;CAC9E,WAAW,KAAK,YAAY;CAC5B,SAAS,KAAK,SAAS;CACvB,QAAQ,KAAK,QAAQ;CACrB,OAAO,KAAK,OAAO;CACnB,WAAW,KAAK,YAAY;CAC5B,YAAY,KAAK,aAAa;CAC9B,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;AACxC,IACC,MAAM,CACL,YAAY,uCAAuC,CAAC,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GACpF,MAAM,6BAA6B,CAAC,CAAC,GAAG,EAAE,OAAO,CACnD,CACF"}
@@ -1,12 +1,11 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
- //#region src/schema/comment.d.ts
4
3
  /** Narrow `comments` table definition. */
5
- declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
4
+ declare const comments: import("drizzle-orm/sqlite-core/table.js").SQLiteTableWithColumns<{
6
5
  name: "comments";
7
6
  schema: undefined;
8
7
  columns: {
9
- id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
8
+ id: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
10
9
  name: "id";
11
10
  tableName: "comments";
12
11
  dataType: "string";
@@ -25,7 +24,7 @@ declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns
25
24
  }, {}, {
26
25
  length: number | undefined;
27
26
  }>;
28
- projectId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
27
+ projectId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
29
28
  name: "project_id";
30
29
  tableName: "comments";
31
30
  dataType: "string";
@@ -44,7 +43,7 @@ declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns
44
43
  }, {}, {
45
44
  length: number | undefined;
46
45
  }>;
47
- buildId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
46
+ buildId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
48
47
  name: "build_id";
49
48
  tableName: "comments";
50
49
  dataType: "string";
@@ -63,7 +62,7 @@ declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns
63
62
  }, {}, {
64
63
  length: number | undefined;
65
64
  }>;
66
- snapshotId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
65
+ snapshotId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
67
66
  name: "snapshot_id";
68
67
  tableName: "comments";
69
68
  dataType: "string";
@@ -82,7 +81,7 @@ declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns
82
81
  }, {}, {
83
82
  length: number | undefined;
84
83
  }>;
85
- userId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
84
+ userId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
86
85
  name: "user_id";
87
86
  tableName: "comments";
88
87
  dataType: "string";
@@ -101,7 +100,7 @@ declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns
101
100
  }, {}, {
102
101
  length: number | undefined;
103
102
  }>;
104
- body: import("drizzle-orm/sqlite-core").SQLiteColumn<{
103
+ body: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
105
104
  name: "body";
106
105
  tableName: "comments";
107
106
  dataType: "string";
@@ -120,7 +119,7 @@ declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns
120
119
  }, {}, {
121
120
  length: number | undefined;
122
121
  }>;
123
- parentId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
122
+ parentId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
124
123
  name: "parent_id";
125
124
  tableName: "comments";
126
125
  dataType: "string";
@@ -139,7 +138,7 @@ declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns
139
138
  }, {}, {
140
139
  length: number | undefined;
141
140
  }>;
142
- resolved: import("drizzle-orm/sqlite-core").SQLiteColumn<{
141
+ resolved: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
143
142
  name: "resolved";
144
143
  tableName: "comments";
145
144
  dataType: "boolean";
@@ -156,7 +155,7 @@ declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns
156
155
  identity: undefined;
157
156
  generated: undefined;
158
157
  }, {}, {}>;
159
- createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
158
+ createdAt: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
160
159
  name: "created_at";
161
160
  tableName: "comments";
162
161
  dataType: "string";
@@ -175,7 +174,7 @@ declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns
175
174
  }, {}, {
176
175
  length: number | undefined;
177
176
  }>;
178
- updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
177
+ updatedAt: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
179
178
  name: "updated_at";
180
179
  tableName: "comments";
181
180
  dataType: "string";
@@ -194,6 +193,25 @@ declare const comments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns
194
193
  }, {}, {
195
194
  length: number | undefined;
196
195
  }>;
196
+ storyId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
197
+ name: "story_id";
198
+ tableName: "comments";
199
+ dataType: "string";
200
+ columnType: "SQLiteText";
201
+ data: string;
202
+ driverParam: string;
203
+ notNull: false;
204
+ hasDefault: false;
205
+ isPrimaryKey: false;
206
+ isAutoincrement: false;
207
+ hasRuntimeDefault: false;
208
+ enumValues: [string, ...string[]];
209
+ baseColumn: never;
210
+ identity: undefined;
211
+ generated: undefined;
212
+ }, {}, {
213
+ length: number | undefined;
214
+ }>;
197
215
  };
198
216
  dialect: 'sqlite';
199
217
  }>;
@@ -209,7 +227,7 @@ interface Comment {
209
227
  resolved: boolean;
210
228
  createdAt: string;
211
229
  updatedAt: string;
230
+ storyId: string | null;
212
231
  }
213
- //#endregion
214
232
  export { Comment, comments };
215
233
  //# sourceMappingURL=comment.d.mts.map
@@ -3,10 +3,10 @@ import "node:url";
3
3
  import.meta.url;
4
4
  import { projects } from "./project.mjs";
5
5
  import { builds } from "./build.mjs";
6
- import { snapshots } from "./snapshot.mjs";
7
6
  import { users } from "./user.mjs";
7
+ import { snapshots } from "./snapshot.mjs";
8
8
  import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
9
- //#region src/schema/comment.ts
9
+ // src/schema/comment.ts
10
10
  /** Narrow `comments` table definition. */
11
11
  const comments = sqliteTable("comments", {
12
12
  id: text("id").primaryKey(),
@@ -18,9 +18,9 @@ const comments = sqliteTable("comments", {
18
18
  parentId: text("parent_id"),
19
19
  resolved: integer("resolved", { mode: "boolean" }).notNull().default(false),
20
20
  createdAt: text("created_at").notNull(),
21
- updatedAt: text("updated_at").notNull()
21
+ updatedAt: text("updated_at").notNull(),
22
+ storyId: text("story_id")
22
23
  }, (t) => [index("comments_build_id_idx").on(t.buildId)]);
23
- //#endregion
24
24
  export { comments };
25
25
 
26
26
  //# sourceMappingURL=comment.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"comment.mjs","names":[],"sources":["../../src/schema/comment.ts"],"sourcesContent":["import { index, integer, sqliteTable, text } from \"drizzle-orm/sqlite-core\";\nimport { builds } from \"./build.ts\";\nimport { projects } from \"./project.ts\";\nimport { snapshots } from \"./snapshot.ts\";\nimport { users } from \"./user.ts\";\n\n/** Narrow `comments` table definition. */\nexport const comments = sqliteTable(\n \"comments\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n buildId: text(\"build_id\")\n .notNull()\n .references(() => builds.id, { onDelete: \"cascade\" }),\n snapshotId: text(\"snapshot_id\").references(() => snapshots.id, { onDelete: \"cascade\" }),\n userId: text(\"user_id\").references(() => users.id, { onDelete: \"cascade\" }),\n body: text(\"body\").notNull(),\n parentId: text(\"parent_id\"),\n resolved: integer(\"resolved\", { mode: \"boolean\" }).notNull().default(false),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (t) => [index(\"comments_build_id_idx\").on(t.buildId)],\n);\n\n/** A comment row. */\nexport interface Comment {\n id: string;\n projectId: string;\n buildId: string;\n snapshotId: string | null;\n userId: string | null;\n body: string;\n parentId: string | null;\n resolved: boolean;\n createdAt: string;\n updatedAt: string;\n}\n"],"mappings":";;;;;;;;;;AAOA,MAAa,WAAW,YACtB,YACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,SAAS,KAAK,UAAU,CAAC,CACtB,QAAQ,CAAC,CACT,iBAAiB,OAAO,IAAI,EAAE,UAAU,UAAU,CAAC;CACtD,YAAY,KAAK,aAAa,CAAC,CAAC,iBAAiB,UAAU,IAAI,EAAE,UAAU,UAAU,CAAC;CACtF,QAAQ,KAAK,SAAS,CAAC,CAAC,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CAC1E,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,UAAU,KAAK,WAAW;CAC1B,UAAU,QAAQ,YAAY,EAAE,MAAM,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK;CAC1E,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;AACxC,IACC,MAAM,CAAC,MAAM,uBAAuB,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CACtD"}
1
+ {"version":3,"file":"comment.mjs","names":[],"sources":["../../src/schema/comment.ts"],"sourcesContent":["import { index, integer, sqliteTable, text } from \"drizzle-orm/sqlite-core\";\nimport { builds } from \"./build.ts\";\nimport { projects } from \"./project.ts\";\nimport { snapshots } from \"./snapshot.ts\";\nimport { users } from \"./user.ts\";\n\n/** Narrow `comments` table definition. */\nexport const comments = sqliteTable(\n \"comments\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n buildId: text(\"build_id\")\n .notNull()\n .references(() => builds.id, { onDelete: \"cascade\" }),\n snapshotId: text(\"snapshot_id\").references(() => snapshots.id, { onDelete: \"cascade\" }),\n userId: text(\"user_id\").references(() => users.id, { onDelete: \"cascade\" }),\n body: text(\"body\").notNull(),\n parentId: text(\"parent_id\"),\n resolved: integer(\"resolved\", { mode: \"boolean\" }).notNull().default(false),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n storyId: text(\"story_id\"),\n },\n (t) => [index(\"comments_build_id_idx\").on(t.buildId)],\n);\n\n/** A comment row. */\nexport interface Comment {\n id: string;\n projectId: string;\n buildId: string;\n snapshotId: string | null;\n userId: string | null;\n body: string;\n parentId: string | null;\n resolved: boolean;\n createdAt: string;\n updatedAt: string;\n storyId: string | null;\n}\n"],"mappings":";;;;;;;;;;AAOA,MAAa,WAAW,YACtB,YACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,SAAS,KAAK,UAAU,CAAC,CACtB,QAAQ,CAAC,CACT,iBAAiB,OAAO,IAAI,EAAE,UAAU,UAAU,CAAC;CACtD,YAAY,KAAK,aAAa,CAAC,CAAC,iBAAiB,UAAU,IAAI,EAAE,UAAU,UAAU,CAAC;CACtF,QAAQ,KAAK,SAAS,CAAC,CAAC,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CAC1E,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,UAAU,KAAK,WAAW;CAC1B,UAAU,QAAQ,YAAY,EAAE,MAAM,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK;CAC1E,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,SAAS,KAAK,UAAU;AAC1B,IACC,MAAM,CAAC,MAAM,uBAAuB,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CACtD"}
@@ -0,0 +1,189 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ /**
4
+ * A user's own OAuth connection to an external service (Figma, later Jira/Linear/…),
5
+ * one per user and service. `tokenEncrypted` is the access token; the refresh token
6
+ * is encrypted too. `status` is `ok` or `expired` (needs reconnecting).
7
+ */
8
+ declare const userConnections: import("drizzle-orm/sqlite-core/table.js").SQLiteTableWithColumns<{
9
+ name: "user_connections";
10
+ schema: undefined;
11
+ columns: {
12
+ id: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
13
+ name: "id";
14
+ tableName: "user_connections";
15
+ dataType: "string";
16
+ columnType: "SQLiteText";
17
+ data: string;
18
+ driverParam: string;
19
+ notNull: true;
20
+ hasDefault: false;
21
+ isPrimaryKey: true;
22
+ isAutoincrement: false;
23
+ hasRuntimeDefault: false;
24
+ enumValues: [string, ...string[]];
25
+ baseColumn: never;
26
+ identity: undefined;
27
+ generated: undefined;
28
+ }, {}, {
29
+ length: number | undefined;
30
+ }>;
31
+ userId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
32
+ name: "user_id";
33
+ tableName: "user_connections";
34
+ dataType: "string";
35
+ columnType: "SQLiteText";
36
+ data: string;
37
+ driverParam: string;
38
+ notNull: true;
39
+ hasDefault: false;
40
+ isPrimaryKey: false;
41
+ isAutoincrement: false;
42
+ hasRuntimeDefault: false;
43
+ enumValues: [string, ...string[]];
44
+ baseColumn: never;
45
+ identity: undefined;
46
+ generated: undefined;
47
+ }, {}, {
48
+ length: number | undefined;
49
+ }>;
50
+ service: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
51
+ name: "service";
52
+ tableName: "user_connections";
53
+ dataType: "string";
54
+ columnType: "SQLiteText";
55
+ data: string;
56
+ driverParam: string;
57
+ notNull: true;
58
+ hasDefault: false;
59
+ isPrimaryKey: false;
60
+ isAutoincrement: false;
61
+ hasRuntimeDefault: false;
62
+ enumValues: [string, ...string[]];
63
+ baseColumn: never;
64
+ identity: undefined;
65
+ generated: undefined;
66
+ }, {}, {
67
+ length: number | undefined;
68
+ }>;
69
+ tokenEncrypted: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
70
+ name: "token_encrypted";
71
+ tableName: "user_connections";
72
+ dataType: "string";
73
+ columnType: "SQLiteText";
74
+ data: string;
75
+ driverParam: string;
76
+ notNull: true;
77
+ hasDefault: false;
78
+ isPrimaryKey: false;
79
+ isAutoincrement: false;
80
+ hasRuntimeDefault: false;
81
+ enumValues: [string, ...string[]];
82
+ baseColumn: never;
83
+ identity: undefined;
84
+ generated: undefined;
85
+ }, {}, {
86
+ length: number | undefined;
87
+ }>;
88
+ refreshTokenEncrypted: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
89
+ name: "refresh_token_encrypted";
90
+ tableName: "user_connections";
91
+ dataType: "string";
92
+ columnType: "SQLiteText";
93
+ data: string;
94
+ driverParam: string;
95
+ notNull: false;
96
+ hasDefault: false;
97
+ isPrimaryKey: false;
98
+ isAutoincrement: false;
99
+ hasRuntimeDefault: false;
100
+ enumValues: [string, ...string[]];
101
+ baseColumn: never;
102
+ identity: undefined;
103
+ generated: undefined;
104
+ }, {}, {
105
+ length: number | undefined;
106
+ }>;
107
+ expiresAt: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
108
+ name: "expires_at";
109
+ tableName: "user_connections";
110
+ dataType: "string";
111
+ columnType: "SQLiteText";
112
+ data: string;
113
+ driverParam: string;
114
+ notNull: false;
115
+ hasDefault: false;
116
+ isPrimaryKey: false;
117
+ isAutoincrement: false;
118
+ hasRuntimeDefault: false;
119
+ enumValues: [string, ...string[]];
120
+ baseColumn: never;
121
+ identity: undefined;
122
+ generated: undefined;
123
+ }, {}, {
124
+ length: number | undefined;
125
+ }>;
126
+ status: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
127
+ name: "status";
128
+ tableName: "user_connections";
129
+ dataType: "string";
130
+ columnType: "SQLiteText";
131
+ data: string;
132
+ driverParam: string;
133
+ notNull: true;
134
+ hasDefault: true;
135
+ isPrimaryKey: false;
136
+ isAutoincrement: false;
137
+ hasRuntimeDefault: false;
138
+ enumValues: [string, ...string[]];
139
+ baseColumn: never;
140
+ identity: undefined;
141
+ generated: undefined;
142
+ }, {}, {
143
+ length: number | undefined;
144
+ }>;
145
+ createdAt: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
146
+ name: "created_at";
147
+ tableName: "user_connections";
148
+ dataType: "string";
149
+ columnType: "SQLiteText";
150
+ data: string;
151
+ driverParam: string;
152
+ notNull: true;
153
+ hasDefault: false;
154
+ isPrimaryKey: false;
155
+ isAutoincrement: false;
156
+ hasRuntimeDefault: false;
157
+ enumValues: [string, ...string[]];
158
+ baseColumn: never;
159
+ identity: undefined;
160
+ generated: undefined;
161
+ }, {}, {
162
+ length: number | undefined;
163
+ }>;
164
+ updatedAt: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
165
+ name: "updated_at";
166
+ tableName: "user_connections";
167
+ dataType: "string";
168
+ columnType: "SQLiteText";
169
+ data: string;
170
+ driverParam: string;
171
+ notNull: true;
172
+ hasDefault: false;
173
+ isPrimaryKey: false;
174
+ isAutoincrement: false;
175
+ hasRuntimeDefault: false;
176
+ enumValues: [string, ...string[]];
177
+ baseColumn: never;
178
+ identity: undefined;
179
+ generated: undefined;
180
+ }, {}, {
181
+ length: number | undefined;
182
+ }>;
183
+ };
184
+ dialect: 'sqlite';
185
+ }>;
186
+ /** Row type of `user_connections`. */
187
+ type UserConnection = typeof userConnections.$inferSelect;
188
+ export { UserConnection, userConnections };
189
+ //# sourceMappingURL=connection.d.mts.map
@@ -0,0 +1,25 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { users } from "./user.mjs";
5
+ import { sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core";
6
+ // src/schema/connection.ts
7
+ /**
8
+ * A user's own OAuth connection to an external service (Figma, later Jira/Linear/…),
9
+ * one per user and service. `tokenEncrypted` is the access token; the refresh token
10
+ * is encrypted too. `status` is `ok` or `expired` (needs reconnecting).
11
+ */
12
+ const userConnections = sqliteTable("user_connections", {
13
+ id: text("id").primaryKey(),
14
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
15
+ service: text("service").notNull(),
16
+ tokenEncrypted: text("token_encrypted").notNull(),
17
+ refreshTokenEncrypted: text("refresh_token_encrypted"),
18
+ expiresAt: text("expires_at"),
19
+ status: text("status").notNull().default("ok"),
20
+ createdAt: text("created_at").notNull(),
21
+ updatedAt: text("updated_at").notNull()
22
+ }, (t) => [uniqueIndex("user_connections_user_service_idx").on(t.userId, t.service)]);
23
+ export { userConnections };
24
+
25
+ //# sourceMappingURL=connection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.mjs","names":[],"sources":["../../src/schema/connection.ts"],"sourcesContent":["import { sqliteTable, text, uniqueIndex } from \"drizzle-orm/sqlite-core\";\nimport { users } from \"./user.ts\";\n\n/**\n * A user's own OAuth connection to an external service (Figma, later Jira/Linear/…),\n * one per user and service. `tokenEncrypted` is the access token; the refresh token\n * is encrypted too. `status` is `ok` or `expired` (needs reconnecting).\n */\nexport const userConnections = sqliteTable(\n \"user_connections\",\n {\n id: text(\"id\").primaryKey(),\n userId: text(\"user_id\")\n .notNull()\n .references(() => users.id, { onDelete: \"cascade\" }),\n service: text(\"service\").notNull(),\n tokenEncrypted: text(\"token_encrypted\").notNull(),\n refreshTokenEncrypted: text(\"refresh_token_encrypted\"),\n expiresAt: text(\"expires_at\"),\n status: text(\"status\").notNull().default(\"ok\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (t) => [uniqueIndex(\"user_connections_user_service_idx\").on(t.userId, t.service)],\n);\n\n/** Row type of `user_connections`. */\nexport type UserConnection = typeof userConnections.$inferSelect;\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,kBAAkB,YAC7B,oBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,QAAQ,KAAK,SAAS,CAAC,CACpB,QAAQ,CAAC,CACT,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CACrD,SAAS,KAAK,SAAS,CAAC,CAAC,QAAQ;CACjC,gBAAgB,KAAK,iBAAiB,CAAC,CAAC,QAAQ;CAChD,uBAAuB,KAAK,yBAAyB;CACrD,WAAW,KAAK,YAAY;CAC5B,QAAQ,KAAK,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,IAAI;CAC7C,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;AACxC,IACC,MAAM,CAAC,YAAY,mCAAmC,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAClF"}
@@ -1,6 +1,5 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
- //#region src/schema/content-refs.d.ts
4
3
  /** Content-addressed storage refs for deduplicated Storybook assets. */
5
4
  declare const contentRefs: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
6
5
  name: "content_refs";
@@ -90,6 +89,5 @@ interface ContentRef {
90
89
  lastSeenAt: string;
91
90
  createdAt: string;
92
91
  }
93
- //#endregion
94
92
  export { ContentRef, contentRefs };
95
93
  //# sourceMappingURL=content-refs.d.mts.map
@@ -2,7 +2,7 @@ import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
4
  import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
5
- //#region src/schema/content-refs.ts
5
+ // src/schema/content-refs.ts
6
6
  /** Content-addressed storage refs for deduplicated Storybook assets. */
7
7
  const contentRefs = sqliteTable("content_refs", {
8
8
  hash: text("hash").primaryKey(),
@@ -10,7 +10,6 @@ const contentRefs = sqliteTable("content_refs", {
10
10
  lastSeenAt: text("last_seen_at").notNull(),
11
11
  createdAt: text("created_at").notNull()
12
12
  });
13
- //#endregion
14
13
  export { contentRefs };
15
14
 
16
15
  //# sourceMappingURL=content-refs.mjs.map