@storyshelf/db-postgres 0.6.2 → 0.7.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 (69) hide show
  1. package/README.md +56 -0
  2. package/dist/ddl.d.mts +1 -1
  3. package/dist/ddl.mjs +209 -13
  4. package/dist/ddl.mjs.map +1 -1
  5. package/dist/index.mjs +1 -1
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/migrate.mjs +83 -3
  8. package/dist/migrate.mjs.map +1 -1
  9. package/dist/neon-http.mjs +1 -1
  10. package/dist/neon-http.mjs.map +1 -1
  11. package/dist/neon.mjs +1 -1
  12. package/dist/neon.mjs.map +1 -1
  13. package/dist/pg.mjs +1 -1
  14. package/dist/pg.mjs.map +1 -1
  15. package/dist/pglite.mjs +2 -2
  16. package/dist/pglite.mjs.map +1 -1
  17. package/dist/schema/baseline.d.mts +54 -0
  18. package/dist/schema/baseline.mjs +4 -1
  19. package/dist/schema/baseline.mjs.map +1 -1
  20. package/dist/schema/{status-config.d.mts → build-component.d.mts} +42 -35
  21. package/dist/schema/build-component.mjs +25 -0
  22. package/dist/schema/build-component.mjs.map +1 -0
  23. package/dist/schema/build-review.d.mts +118 -0
  24. package/dist/schema/build-review.mjs +23 -0
  25. package/dist/schema/build-review.mjs.map +1 -0
  26. package/dist/schema/build.d.mts +38 -2
  27. package/dist/schema/build.mjs +3 -0
  28. package/dist/schema/build.mjs.map +1 -1
  29. package/dist/schema/capture-job.d.mts +330 -0
  30. package/dist/schema/capture-job.mjs +56 -0
  31. package/dist/schema/capture-job.mjs.map +1 -0
  32. package/dist/schema/capture-shard.d.mts +257 -0
  33. package/dist/schema/capture-shard.mjs +40 -0
  34. package/dist/schema/capture-shard.mjs.map +1 -0
  35. package/dist/schema/comment.d.mts +18 -0
  36. package/dist/schema/comment.mjs +3 -2
  37. package/dist/schema/comment.mjs.map +1 -1
  38. package/dist/schema/connection.d.mts +173 -0
  39. package/dist/schema/connection.mjs +35 -0
  40. package/dist/schema/connection.mjs.map +1 -0
  41. package/dist/schema/design.d.mts +589 -0
  42. package/dist/schema/design.mjs +73 -0
  43. package/dist/schema/design.mjs.map +1 -0
  44. package/dist/schema/insight.d.mts +633 -0
  45. package/dist/schema/insight.mjs +68 -0
  46. package/dist/schema/insight.mjs.map +1 -0
  47. package/dist/schema/notification.d.mts +36 -0
  48. package/dist/schema/notification.mjs +5 -0
  49. package/dist/schema/notification.mjs.map +1 -1
  50. package/dist/schema/project.d.mts +126 -0
  51. package/dist/schema/project.mjs +8 -1
  52. package/dist/schema/project.mjs.map +1 -1
  53. package/dist/schema/site-setting.d.mts +99 -0
  54. package/dist/schema/site-setting.mjs +23 -0
  55. package/dist/schema/site-setting.mjs.map +1 -0
  56. package/dist/schema/snapshot.d.mts +108 -0
  57. package/dist/schema/snapshot.mjs +11 -1
  58. package/dist/schema/snapshot.mjs.map +1 -1
  59. package/dist/schema/usage.d.mts +267 -0
  60. package/dist/schema/usage.mjs +36 -0
  61. package/dist/schema/usage.mjs.map +1 -0
  62. package/dist/schema.d.mts +24 -3
  63. package/dist/schema.mjs +25 -4
  64. package/dist/schema.mjs.map +1 -1
  65. package/dist/vercel.mjs +1 -1
  66. package/dist/vercel.mjs.map +1 -1
  67. package/package.json +5 -5
  68. package/dist/schema/status-config.mjs +0 -26
  69. package/dist/schema/status-config.mjs.map +0 -1
@@ -0,0 +1,257 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { CaptureShardKind, CaptureShardStatus } from "@storyshelf/core/schema";
4
+ //#region src/schema/capture-shard.d.ts
5
+ /** Narrow `capture_shards` table definition: the stages of a sharded capture and its finalize claim. */
6
+ declare const captureShards: import("drizzle-orm/pg-core").PgTableWithColumns<{
7
+ name: "capture_shards";
8
+ schema: undefined;
9
+ columns: {
10
+ id: import("drizzle-orm/pg-core").PgColumn<{
11
+ name: "id";
12
+ tableName: "capture_shards";
13
+ dataType: "string";
14
+ columnType: "PgText";
15
+ data: string;
16
+ driverParam: string;
17
+ notNull: true;
18
+ hasDefault: false;
19
+ isPrimaryKey: true;
20
+ isAutoincrement: false;
21
+ hasRuntimeDefault: false;
22
+ enumValues: [string, ...string[]];
23
+ baseColumn: never;
24
+ identity: undefined;
25
+ generated: undefined;
26
+ }, {}, {}>;
27
+ projectId: import("drizzle-orm/pg-core").PgColumn<{
28
+ name: "project_id";
29
+ tableName: "capture_shards";
30
+ dataType: "string";
31
+ columnType: "PgText";
32
+ data: string;
33
+ driverParam: string;
34
+ notNull: true;
35
+ hasDefault: false;
36
+ isPrimaryKey: false;
37
+ isAutoincrement: false;
38
+ hasRuntimeDefault: false;
39
+ enumValues: [string, ...string[]];
40
+ baseColumn: never;
41
+ identity: undefined;
42
+ generated: undefined;
43
+ }, {}, {}>;
44
+ buildId: import("drizzle-orm/pg-core").PgColumn<{
45
+ name: "build_id";
46
+ tableName: "capture_shards";
47
+ dataType: "string";
48
+ columnType: "PgText";
49
+ data: string;
50
+ driverParam: string;
51
+ notNull: true;
52
+ hasDefault: false;
53
+ isPrimaryKey: false;
54
+ isAutoincrement: false;
55
+ hasRuntimeDefault: false;
56
+ enumValues: [string, ...string[]];
57
+ baseColumn: never;
58
+ identity: undefined;
59
+ generated: undefined;
60
+ }, {}, {}>;
61
+ kind: import("drizzle-orm/pg-core").PgColumn<{
62
+ name: "kind";
63
+ tableName: "capture_shards";
64
+ dataType: "string";
65
+ columnType: "PgText";
66
+ data: CaptureShardKind;
67
+ driverParam: string;
68
+ notNull: true;
69
+ hasDefault: false;
70
+ isPrimaryKey: false;
71
+ isAutoincrement: false;
72
+ hasRuntimeDefault: false;
73
+ enumValues: [string, ...string[]];
74
+ baseColumn: never;
75
+ identity: undefined;
76
+ generated: undefined;
77
+ }, {}, {
78
+ $type: CaptureShardKind;
79
+ }>;
80
+ ordinal: import("drizzle-orm/pg-core").PgColumn<{
81
+ name: "ordinal";
82
+ tableName: "capture_shards";
83
+ dataType: "number";
84
+ columnType: "PgInteger";
85
+ data: number;
86
+ driverParam: string | number;
87
+ notNull: true;
88
+ hasDefault: false;
89
+ isPrimaryKey: false;
90
+ isAutoincrement: false;
91
+ hasRuntimeDefault: false;
92
+ enumValues: undefined;
93
+ baseColumn: never;
94
+ identity: undefined;
95
+ generated: undefined;
96
+ }, {}, {}>;
97
+ status: import("drizzle-orm/pg-core").PgColumn<{
98
+ name: "status";
99
+ tableName: "capture_shards";
100
+ dataType: "string";
101
+ columnType: "PgText";
102
+ data: CaptureShardStatus;
103
+ driverParam: string;
104
+ notNull: true;
105
+ hasDefault: true;
106
+ isPrimaryKey: false;
107
+ isAutoincrement: false;
108
+ hasRuntimeDefault: false;
109
+ enumValues: [string, ...string[]];
110
+ baseColumn: never;
111
+ identity: undefined;
112
+ generated: undefined;
113
+ }, {}, {
114
+ $type: CaptureShardStatus;
115
+ }>;
116
+ attemptId: import("drizzle-orm/pg-core").PgColumn<{
117
+ name: "attempt_id";
118
+ tableName: "capture_shards";
119
+ dataType: "string";
120
+ columnType: "PgText";
121
+ data: string;
122
+ driverParam: string;
123
+ notNull: false;
124
+ hasDefault: false;
125
+ isPrimaryKey: false;
126
+ isAutoincrement: false;
127
+ hasRuntimeDefault: false;
128
+ enumValues: [string, ...string[]];
129
+ baseColumn: never;
130
+ identity: undefined;
131
+ generated: undefined;
132
+ }, {}, {}>;
133
+ payload: import("drizzle-orm/pg-core").PgColumn<{
134
+ name: "payload";
135
+ tableName: "capture_shards";
136
+ dataType: "string";
137
+ columnType: "PgText";
138
+ data: string;
139
+ driverParam: string;
140
+ notNull: false;
141
+ hasDefault: false;
142
+ isPrimaryKey: false;
143
+ isAutoincrement: false;
144
+ hasRuntimeDefault: false;
145
+ enumValues: [string, ...string[]];
146
+ baseColumn: never;
147
+ identity: undefined;
148
+ generated: undefined;
149
+ }, {}, {}>;
150
+ result: import("drizzle-orm/pg-core").PgColumn<{
151
+ name: "result";
152
+ tableName: "capture_shards";
153
+ dataType: "string";
154
+ columnType: "PgText";
155
+ data: string;
156
+ driverParam: string;
157
+ notNull: false;
158
+ hasDefault: false;
159
+ isPrimaryKey: false;
160
+ isAutoincrement: false;
161
+ hasRuntimeDefault: false;
162
+ enumValues: [string, ...string[]];
163
+ baseColumn: never;
164
+ identity: undefined;
165
+ generated: undefined;
166
+ }, {}, {}>;
167
+ error: import("drizzle-orm/pg-core").PgColumn<{
168
+ name: "error";
169
+ tableName: "capture_shards";
170
+ dataType: "string";
171
+ columnType: "PgText";
172
+ data: string;
173
+ driverParam: string;
174
+ notNull: false;
175
+ hasDefault: false;
176
+ isPrimaryKey: false;
177
+ isAutoincrement: false;
178
+ hasRuntimeDefault: false;
179
+ enumValues: [string, ...string[]];
180
+ baseColumn: never;
181
+ identity: undefined;
182
+ generated: undefined;
183
+ }, {}, {}>;
184
+ startedAt: import("drizzle-orm/pg-core").PgColumn<{
185
+ name: "started_at";
186
+ tableName: "capture_shards";
187
+ dataType: "string";
188
+ columnType: "PgTimestampString";
189
+ data: string;
190
+ driverParam: string;
191
+ notNull: false;
192
+ hasDefault: false;
193
+ isPrimaryKey: false;
194
+ isAutoincrement: false;
195
+ hasRuntimeDefault: false;
196
+ enumValues: undefined;
197
+ baseColumn: never;
198
+ identity: undefined;
199
+ generated: undefined;
200
+ }, {}, {}>;
201
+ finishedAt: import("drizzle-orm/pg-core").PgColumn<{
202
+ name: "finished_at";
203
+ tableName: "capture_shards";
204
+ dataType: "string";
205
+ columnType: "PgTimestampString";
206
+ data: string;
207
+ driverParam: string;
208
+ notNull: false;
209
+ hasDefault: false;
210
+ isPrimaryKey: false;
211
+ isAutoincrement: false;
212
+ hasRuntimeDefault: false;
213
+ enumValues: undefined;
214
+ baseColumn: never;
215
+ identity: undefined;
216
+ generated: undefined;
217
+ }, {}, {}>;
218
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
219
+ name: "created_at";
220
+ tableName: "capture_shards";
221
+ dataType: "string";
222
+ columnType: "PgTimestampString";
223
+ data: string;
224
+ driverParam: string;
225
+ notNull: true;
226
+ hasDefault: false;
227
+ isPrimaryKey: false;
228
+ isAutoincrement: false;
229
+ hasRuntimeDefault: false;
230
+ enumValues: undefined;
231
+ baseColumn: never;
232
+ identity: undefined;
233
+ generated: undefined;
234
+ }, {}, {}>;
235
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
236
+ name: "updated_at";
237
+ tableName: "capture_shards";
238
+ dataType: "string";
239
+ columnType: "PgTimestampString";
240
+ data: string;
241
+ driverParam: string;
242
+ notNull: true;
243
+ hasDefault: false;
244
+ isPrimaryKey: false;
245
+ isAutoincrement: false;
246
+ hasRuntimeDefault: false;
247
+ enumValues: undefined;
248
+ baseColumn: never;
249
+ identity: undefined;
250
+ generated: undefined;
251
+ }, {}, {}>;
252
+ };
253
+ dialect: 'pg';
254
+ }>;
255
+ //#endregion
256
+ export { captureShards };
257
+ //# sourceMappingURL=capture-shard.d.mts.map
@@ -0,0 +1,40 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { projects } from "./project.mjs";
5
+ import { builds } from "./build.mjs";
6
+ import { index, integer, pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
7
+ //#region src/schema/capture-shard.ts
8
+ /** Narrow `capture_shards` table definition: the stages of a sharded capture and its finalize claim. */
9
+ const captureShards = pgTable("capture_shards", {
10
+ id: text("id").primaryKey(),
11
+ projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
12
+ buildId: text("build_id").notNull().references(() => builds.id, { onDelete: "cascade" }),
13
+ kind: text("kind").$type().notNull(),
14
+ ordinal: integer("ordinal").notNull(),
15
+ status: text("status").$type().notNull().default("pending"),
16
+ attemptId: text("attempt_id"),
17
+ payload: text("payload"),
18
+ result: text("result"),
19
+ error: text("error"),
20
+ startedAt: timestamp("started_at", {
21
+ withTimezone: true,
22
+ mode: "string"
23
+ }),
24
+ finishedAt: timestamp("finished_at", {
25
+ withTimezone: true,
26
+ mode: "string"
27
+ }),
28
+ createdAt: timestamp("created_at", {
29
+ withTimezone: true,
30
+ mode: "string"
31
+ }).notNull(),
32
+ updatedAt: timestamp("updated_at", {
33
+ withTimezone: true,
34
+ mode: "string"
35
+ }).notNull()
36
+ }, (t) => [uniqueIndex("capture_shards_build_kind_ordinal_idx").on(t.buildId, t.kind, t.ordinal), index("capture_shards_build_id_idx").on(t.buildId)]);
37
+ //#endregion
38
+ export { captureShards };
39
+
40
+ //# sourceMappingURL=capture-shard.mjs.map
@@ -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, pgTable, text, timestamp, uniqueIndex } from \"drizzle-orm/pg-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 = pgTable(\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: timestamp(\"started_at\", { withTimezone: true, mode: \"string\" }),\n finishedAt: timestamp(\"finished_at\", { withTimezone: true, mode: \"string\" }),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true, mode: \"string\" }).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,QAC3B,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,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC;CACzE,YAAY,UAAU,eAAe;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC;CAC3E,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;CACnF,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;AACrF,IACC,MAAM,CACL,YAAY,uCAAuC,CAAC,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GACpF,MAAM,6BAA6B,CAAC,CAAC,GAAG,EAAE,OAAO,CACnD,CACF"}
@@ -176,6 +176,23 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
176
176
  identity: undefined;
177
177
  generated: undefined;
178
178
  }, {}, {}>;
179
+ storyId: import("drizzle-orm/pg-core").PgColumn<{
180
+ name: "story_id";
181
+ tableName: "comments";
182
+ dataType: "string";
183
+ columnType: "PgText";
184
+ data: string;
185
+ driverParam: string;
186
+ notNull: false;
187
+ hasDefault: false;
188
+ isPrimaryKey: false;
189
+ isAutoincrement: false;
190
+ hasRuntimeDefault: false;
191
+ enumValues: [string, ...string[]];
192
+ baseColumn: never;
193
+ identity: undefined;
194
+ generated: undefined;
195
+ }, {}, {}>;
179
196
  };
180
197
  dialect: 'pg';
181
198
  }>;
@@ -191,6 +208,7 @@ interface Comment {
191
208
  resolved: boolean;
192
209
  createdAt: string;
193
210
  updatedAt: string;
211
+ storyId: string | null;
194
212
  }
195
213
  //#endregion
196
214
  export { Comment, comments };
@@ -3,8 +3,8 @@ 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 { boolean, index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
9
9
  //#region src/schema/comment.ts
10
10
  /** Narrow `comments` table definition. */
@@ -24,7 +24,8 @@ const comments = pgTable("comments", {
24
24
  updatedAt: timestamp("updated_at", {
25
25
  withTimezone: true,
26
26
  mode: "string"
27
- }).notNull()
27
+ }).notNull(),
28
+ storyId: text("story_id")
28
29
  }, (t) => [index("comments_build_id_idx").on(t.buildId)]);
29
30
  //#endregion
30
31
  export { comments };
@@ -1 +1 @@
1
- {"version":3,"file":"comment.mjs","names":[],"sources":["../../src/schema/comment.ts"],"sourcesContent":["import { boolean, index, pgTable, text, timestamp } from \"drizzle-orm/pg-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 = pgTable(\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: boolean(\"resolved\").notNull().default(false),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true, mode: \"string\" }).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,QACtB,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,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK;CACrD,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;CACnF,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;AACrF,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 { boolean, index, pgTable, text, timestamp } from \"drizzle-orm/pg-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 = pgTable(\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: boolean(\"resolved\").notNull().default(false),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true, mode: \"string\" }).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,QACtB,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,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK;CACrD,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;CACnF,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;CACnF,SAAS,KAAK,UAAU;AAC1B,IACC,MAAM,CAAC,MAAM,uBAAuB,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CACtD"}
@@ -0,0 +1,173 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region src/schema/connection.d.ts
4
+ /**
5
+ * A user's own OAuth connection to an external service (Figma, later Jira/Linear/…),
6
+ * one per user and service. `tokenEncrypted` is the access token; the refresh token
7
+ * is encrypted too. `status` is `ok` or `expired` (needs reconnecting).
8
+ */
9
+ declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<{
10
+ name: "user_connections";
11
+ schema: undefined;
12
+ columns: {
13
+ id: import("drizzle-orm/pg-core").PgColumn<{
14
+ name: "id";
15
+ tableName: "user_connections";
16
+ dataType: "string";
17
+ columnType: "PgText";
18
+ data: string;
19
+ driverParam: string;
20
+ notNull: true;
21
+ hasDefault: false;
22
+ isPrimaryKey: true;
23
+ isAutoincrement: false;
24
+ hasRuntimeDefault: false;
25
+ enumValues: [string, ...string[]];
26
+ baseColumn: never;
27
+ identity: undefined;
28
+ generated: undefined;
29
+ }, {}, {}>;
30
+ userId: import("drizzle-orm/pg-core").PgColumn<{
31
+ name: "user_id";
32
+ tableName: "user_connections";
33
+ dataType: "string";
34
+ columnType: "PgText";
35
+ data: string;
36
+ driverParam: string;
37
+ notNull: true;
38
+ hasDefault: false;
39
+ isPrimaryKey: false;
40
+ isAutoincrement: false;
41
+ hasRuntimeDefault: false;
42
+ enumValues: [string, ...string[]];
43
+ baseColumn: never;
44
+ identity: undefined;
45
+ generated: undefined;
46
+ }, {}, {}>;
47
+ service: import("drizzle-orm/pg-core").PgColumn<{
48
+ name: "service";
49
+ tableName: "user_connections";
50
+ dataType: "string";
51
+ columnType: "PgText";
52
+ data: string;
53
+ driverParam: string;
54
+ notNull: true;
55
+ hasDefault: false;
56
+ isPrimaryKey: false;
57
+ isAutoincrement: false;
58
+ hasRuntimeDefault: false;
59
+ enumValues: [string, ...string[]];
60
+ baseColumn: never;
61
+ identity: undefined;
62
+ generated: undefined;
63
+ }, {}, {}>;
64
+ tokenEncrypted: import("drizzle-orm/pg-core").PgColumn<{
65
+ name: "token_encrypted";
66
+ tableName: "user_connections";
67
+ dataType: "string";
68
+ columnType: "PgText";
69
+ data: string;
70
+ driverParam: string;
71
+ notNull: true;
72
+ hasDefault: false;
73
+ isPrimaryKey: false;
74
+ isAutoincrement: false;
75
+ hasRuntimeDefault: false;
76
+ enumValues: [string, ...string[]];
77
+ baseColumn: never;
78
+ identity: undefined;
79
+ generated: undefined;
80
+ }, {}, {}>;
81
+ refreshTokenEncrypted: import("drizzle-orm/pg-core").PgColumn<{
82
+ name: "refresh_token_encrypted";
83
+ tableName: "user_connections";
84
+ dataType: "string";
85
+ columnType: "PgText";
86
+ data: string;
87
+ driverParam: string;
88
+ notNull: false;
89
+ hasDefault: false;
90
+ isPrimaryKey: false;
91
+ isAutoincrement: false;
92
+ hasRuntimeDefault: false;
93
+ enumValues: [string, ...string[]];
94
+ baseColumn: never;
95
+ identity: undefined;
96
+ generated: undefined;
97
+ }, {}, {}>;
98
+ expiresAt: import("drizzle-orm/pg-core").PgColumn<{
99
+ name: "expires_at";
100
+ tableName: "user_connections";
101
+ dataType: "string";
102
+ columnType: "PgTimestampString";
103
+ data: string;
104
+ driverParam: string;
105
+ notNull: false;
106
+ hasDefault: false;
107
+ isPrimaryKey: false;
108
+ isAutoincrement: false;
109
+ hasRuntimeDefault: false;
110
+ enumValues: undefined;
111
+ baseColumn: never;
112
+ identity: undefined;
113
+ generated: undefined;
114
+ }, {}, {}>;
115
+ status: import("drizzle-orm/pg-core").PgColumn<{
116
+ name: "status";
117
+ tableName: "user_connections";
118
+ dataType: "string";
119
+ columnType: "PgText";
120
+ data: string;
121
+ driverParam: string;
122
+ notNull: true;
123
+ hasDefault: true;
124
+ isPrimaryKey: false;
125
+ isAutoincrement: false;
126
+ hasRuntimeDefault: false;
127
+ enumValues: [string, ...string[]];
128
+ baseColumn: never;
129
+ identity: undefined;
130
+ generated: undefined;
131
+ }, {}, {}>;
132
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
133
+ name: "created_at";
134
+ tableName: "user_connections";
135
+ dataType: "string";
136
+ columnType: "PgTimestampString";
137
+ data: string;
138
+ driverParam: string;
139
+ notNull: true;
140
+ hasDefault: false;
141
+ isPrimaryKey: false;
142
+ isAutoincrement: false;
143
+ hasRuntimeDefault: false;
144
+ enumValues: undefined;
145
+ baseColumn: never;
146
+ identity: undefined;
147
+ generated: undefined;
148
+ }, {}, {}>;
149
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
150
+ name: "updated_at";
151
+ tableName: "user_connections";
152
+ dataType: "string";
153
+ columnType: "PgTimestampString";
154
+ data: string;
155
+ driverParam: string;
156
+ notNull: true;
157
+ hasDefault: false;
158
+ isPrimaryKey: false;
159
+ isAutoincrement: false;
160
+ hasRuntimeDefault: false;
161
+ enumValues: undefined;
162
+ baseColumn: never;
163
+ identity: undefined;
164
+ generated: undefined;
165
+ }, {}, {}>;
166
+ };
167
+ dialect: 'pg';
168
+ }>;
169
+ /** Row type of `user_connections`. */
170
+ type UserConnection = typeof userConnections.$inferSelect;
171
+ //#endregion
172
+ export { UserConnection, userConnections };
173
+ //# sourceMappingURL=connection.d.mts.map
@@ -0,0 +1,35 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { users } from "./user.mjs";
5
+ import { pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
6
+ //#region 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 = pgTable("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: timestamp("expires_at", {
19
+ withTimezone: true,
20
+ mode: "string"
21
+ }),
22
+ status: text("status").notNull().default("ok"),
23
+ createdAt: timestamp("created_at", {
24
+ withTimezone: true,
25
+ mode: "string"
26
+ }).notNull(),
27
+ updatedAt: timestamp("updated_at", {
28
+ withTimezone: true,
29
+ mode: "string"
30
+ }).notNull()
31
+ }, (t) => [uniqueIndex("user_connections_user_service_idx").on(t.userId, t.service)]);
32
+ //#endregion
33
+ export { userConnections };
34
+
35
+ //# sourceMappingURL=connection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.mjs","names":[],"sources":["../../src/schema/connection.ts"],"sourcesContent":["import { pgTable, text, timestamp, uniqueIndex } from \"drizzle-orm/pg-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 = pgTable(\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: timestamp(\"expires_at\", { withTimezone: true, mode: \"string\" }),\n status: text(\"status\").notNull().default(\"ok\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true, mode: \"string\" }).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,QAC7B,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,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC;CACzE,QAAQ,KAAK,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,IAAI;CAC7C,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;CACnF,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;AACrF,IACC,MAAM,CAAC,YAAY,mCAAmC,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAClF"}