@storyshelf/db-postgres 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 (97) hide show
  1. package/README.md +56 -0
  2. package/dist/ddl.d.mts +1 -3
  3. package/dist/ddl.mjs +219 -16
  4. package/dist/ddl.mjs.map +1 -1
  5. package/dist/drizzle-factory-pg.mjs +9 -7
  6. package/dist/drizzle-factory-pg.mjs.map +1 -1
  7. package/dist/drizzle-factory.mjs +1 -2
  8. package/dist/index.d.mts +0 -2
  9. package/dist/index.mjs +2 -3
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/migrate.mjs +115 -5
  12. package/dist/migrate.mjs.map +1 -1
  13. package/dist/neon-http.d.mts +0 -2
  14. package/dist/neon-http.mjs +2 -3
  15. package/dist/neon-http.mjs.map +1 -1
  16. package/dist/neon.d.mts +0 -2
  17. package/dist/neon.mjs +2 -3
  18. package/dist/neon.mjs.map +1 -1
  19. package/dist/pg.d.mts +0 -2
  20. package/dist/pg.mjs +2 -3
  21. package/dist/pg.mjs.map +1 -1
  22. package/dist/pglite.d.mts +0 -2
  23. package/dist/pglite.mjs +3 -4
  24. package/dist/pglite.mjs.map +1 -1
  25. package/dist/schema/baseline.d.mts +83 -13
  26. package/dist/schema/baseline.mjs +6 -3
  27. package/dist/schema/baseline.mjs.map +1 -1
  28. package/dist/schema/{status-config.d.mts → build-component.d.mts} +43 -38
  29. package/dist/schema/build-component.mjs +24 -0
  30. package/dist/schema/build-component.mjs.map +1 -0
  31. package/dist/schema/build-review.d.mts +116 -0
  32. package/dist/schema/build-review.mjs +22 -0
  33. package/dist/schema/build-review.mjs.map +1 -0
  34. package/dist/schema/build.d.mts +59 -25
  35. package/dist/schema/build.mjs +4 -2
  36. package/dist/schema/build.mjs.map +1 -1
  37. package/dist/schema/capture-attempt.d.mts +25 -27
  38. package/dist/schema/capture-attempt.mjs +1 -2
  39. package/dist/schema/capture-job.d.mts +328 -0
  40. package/dist/schema/capture-job.mjs +55 -0
  41. package/dist/schema/capture-job.mjs.map +1 -0
  42. package/dist/schema/capture-shard.d.mts +255 -0
  43. package/dist/schema/capture-shard.mjs +39 -0
  44. package/dist/schema/capture-shard.mjs.map +1 -0
  45. package/dist/schema/comment.d.mts +29 -13
  46. package/dist/schema/comment.mjs +4 -4
  47. package/dist/schema/comment.mjs.map +1 -1
  48. package/dist/schema/connection.d.mts +171 -0
  49. package/dist/schema/connection.mjs +34 -0
  50. package/dist/schema/connection.mjs.map +1 -0
  51. package/dist/schema/content-refs.d.mts +0 -2
  52. package/dist/schema/content-refs.mjs +1 -2
  53. package/dist/schema/design.d.mts +587 -0
  54. package/dist/schema/design.mjs +72 -0
  55. package/dist/schema/design.mjs.map +1 -0
  56. package/dist/schema/insight.d.mts +631 -0
  57. package/dist/schema/insight.mjs +67 -0
  58. package/dist/schema/insight.mjs.map +1 -0
  59. package/dist/schema/label.d.mts +15 -17
  60. package/dist/schema/label.mjs +1 -2
  61. package/dist/schema/member.d.mts +7 -9
  62. package/dist/schema/member.mjs +1 -2
  63. package/dist/schema/notification.d.mts +54 -20
  64. package/dist/schema/notification.mjs +6 -2
  65. package/dist/schema/notification.mjs.map +1 -1
  66. package/dist/schema/project-group-mapping.d.mts +6 -8
  67. package/dist/schema/project-group-mapping.mjs +1 -2
  68. package/dist/schema/project.d.mts +126 -2
  69. package/dist/schema/project.mjs +9 -3
  70. package/dist/schema/project.mjs.map +1 -1
  71. package/dist/schema/site-setting.d.mts +97 -0
  72. package/dist/schema/site-setting.mjs +22 -0
  73. package/dist/schema/site-setting.mjs.map +1 -0
  74. package/dist/schema/snapshot.d.mts +187 -27
  75. package/dist/schema/snapshot.mjs +15 -3
  76. package/dist/schema/snapshot.mjs.map +1 -1
  77. package/dist/schema/token.d.mts +8 -10
  78. package/dist/schema/token.mjs +1 -2
  79. package/dist/schema/usage.d.mts +265 -0
  80. package/dist/schema/usage.mjs +35 -0
  81. package/dist/schema/usage.mjs.map +1 -0
  82. package/dist/schema/user-invite.d.mts +7 -9
  83. package/dist/schema/user-invite.mjs +1 -2
  84. package/dist/schema/user.d.mts +74 -2
  85. package/dist/schema/user.mjs +7 -4
  86. package/dist/schema/user.mjs.map +1 -1
  87. package/dist/schema/webhook.d.mts +8 -10
  88. package/dist/schema/webhook.mjs +1 -2
  89. package/dist/schema.d.mts +24 -5
  90. package/dist/schema.mjs +26 -6
  91. package/dist/schema.mjs.map +1 -1
  92. package/dist/vercel.d.mts +0 -2
  93. package/dist/vercel.mjs +2 -3
  94. package/dist/vercel.mjs.map +1 -1
  95. package/package.json +7 -7
  96. package/dist/schema/status-config.mjs +0 -26
  97. package/dist/schema/status-config.mjs.map +0 -1
@@ -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/pg-core").PgTableWithColumns<{
4
+ declare const comments: import("drizzle-orm/pg-core/table.js").PgTableWithColumns<{
6
5
  name: "comments";
7
6
  schema: undefined;
8
7
  columns: {
9
- id: import("drizzle-orm/pg-core").PgColumn<{
8
+ id: import("drizzle-orm/pg-core/index.js").PgColumn<{
10
9
  name: "id";
11
10
  tableName: "comments";
12
11
  dataType: "string";
@@ -23,7 +22,7 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
23
22
  identity: undefined;
24
23
  generated: undefined;
25
24
  }, {}, {}>;
26
- projectId: import("drizzle-orm/pg-core").PgColumn<{
25
+ projectId: import("drizzle-orm/pg-core/index.js").PgColumn<{
27
26
  name: "project_id";
28
27
  tableName: "comments";
29
28
  dataType: "string";
@@ -40,7 +39,7 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
40
39
  identity: undefined;
41
40
  generated: undefined;
42
41
  }, {}, {}>;
43
- buildId: import("drizzle-orm/pg-core").PgColumn<{
42
+ buildId: import("drizzle-orm/pg-core/index.js").PgColumn<{
44
43
  name: "build_id";
45
44
  tableName: "comments";
46
45
  dataType: "string";
@@ -57,7 +56,7 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
57
56
  identity: undefined;
58
57
  generated: undefined;
59
58
  }, {}, {}>;
60
- snapshotId: import("drizzle-orm/pg-core").PgColumn<{
59
+ snapshotId: import("drizzle-orm/pg-core/index.js").PgColumn<{
61
60
  name: "snapshot_id";
62
61
  tableName: "comments";
63
62
  dataType: "string";
@@ -74,7 +73,7 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
74
73
  identity: undefined;
75
74
  generated: undefined;
76
75
  }, {}, {}>;
77
- userId: import("drizzle-orm/pg-core").PgColumn<{
76
+ userId: import("drizzle-orm/pg-core/index.js").PgColumn<{
78
77
  name: "user_id";
79
78
  tableName: "comments";
80
79
  dataType: "string";
@@ -91,7 +90,7 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
91
90
  identity: undefined;
92
91
  generated: undefined;
93
92
  }, {}, {}>;
94
- body: import("drizzle-orm/pg-core").PgColumn<{
93
+ body: import("drizzle-orm/pg-core/index.js").PgColumn<{
95
94
  name: "body";
96
95
  tableName: "comments";
97
96
  dataType: "string";
@@ -108,7 +107,7 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
108
107
  identity: undefined;
109
108
  generated: undefined;
110
109
  }, {}, {}>;
111
- parentId: import("drizzle-orm/pg-core").PgColumn<{
110
+ parentId: import("drizzle-orm/pg-core/index.js").PgColumn<{
112
111
  name: "parent_id";
113
112
  tableName: "comments";
114
113
  dataType: "string";
@@ -125,7 +124,7 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
125
124
  identity: undefined;
126
125
  generated: undefined;
127
126
  }, {}, {}>;
128
- resolved: import("drizzle-orm/pg-core").PgColumn<{
127
+ resolved: import("drizzle-orm/pg-core/index.js").PgColumn<{
129
128
  name: "resolved";
130
129
  tableName: "comments";
131
130
  dataType: "boolean";
@@ -142,7 +141,7 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
142
141
  identity: undefined;
143
142
  generated: undefined;
144
143
  }, {}, {}>;
145
- createdAt: import("drizzle-orm/pg-core").PgColumn<{
144
+ createdAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
146
145
  name: "created_at";
147
146
  tableName: "comments";
148
147
  dataType: "string";
@@ -159,7 +158,7 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
159
158
  identity: undefined;
160
159
  generated: undefined;
161
160
  }, {}, {}>;
162
- updatedAt: import("drizzle-orm/pg-core").PgColumn<{
161
+ updatedAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
163
162
  name: "updated_at";
164
163
  tableName: "comments";
165
164
  dataType: "string";
@@ -176,6 +175,23 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
176
175
  identity: undefined;
177
176
  generated: undefined;
178
177
  }, {}, {}>;
178
+ storyId: import("drizzle-orm/pg-core/index.js").PgColumn<{
179
+ name: "story_id";
180
+ tableName: "comments";
181
+ dataType: "string";
182
+ columnType: "PgText";
183
+ data: string;
184
+ driverParam: string;
185
+ notNull: false;
186
+ hasDefault: false;
187
+ isPrimaryKey: false;
188
+ isAutoincrement: false;
189
+ hasRuntimeDefault: false;
190
+ enumValues: [string, ...string[]];
191
+ baseColumn: never;
192
+ identity: undefined;
193
+ generated: undefined;
194
+ }, {}, {}>;
179
195
  };
180
196
  dialect: 'pg';
181
197
  }>;
@@ -191,7 +207,7 @@ interface Comment {
191
207
  resolved: boolean;
192
208
  createdAt: string;
193
209
  updatedAt: string;
210
+ storyId: string | null;
194
211
  }
195
- //#endregion
196
212
  export { Comment, comments };
197
213
  //# 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 { boolean, index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
9
- //#region src/schema/comment.ts
9
+ // src/schema/comment.ts
10
10
  /** Narrow `comments` table definition. */
11
11
  const comments = pgTable("comments", {
12
12
  id: text("id").primaryKey(),
@@ -24,9 +24,9 @@ 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
- //#endregion
30
30
  export { comments };
31
31
 
32
32
  //# sourceMappingURL=comment.mjs.map
@@ -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,171 @@
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/pg-core/table.js").PgTableWithColumns<{
9
+ name: "user_connections";
10
+ schema: undefined;
11
+ columns: {
12
+ id: import("drizzle-orm/pg-core/index.js").PgColumn<{
13
+ name: "id";
14
+ tableName: "user_connections";
15
+ dataType: "string";
16
+ columnType: "PgText";
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
+ userId: import("drizzle-orm/pg-core/index.js").PgColumn<{
30
+ name: "user_id";
31
+ tableName: "user_connections";
32
+ dataType: "string";
33
+ columnType: "PgText";
34
+ data: string;
35
+ driverParam: string;
36
+ notNull: true;
37
+ hasDefault: false;
38
+ isPrimaryKey: false;
39
+ isAutoincrement: false;
40
+ hasRuntimeDefault: false;
41
+ enumValues: [string, ...string[]];
42
+ baseColumn: never;
43
+ identity: undefined;
44
+ generated: undefined;
45
+ }, {}, {}>;
46
+ service: import("drizzle-orm/pg-core/index.js").PgColumn<{
47
+ name: "service";
48
+ tableName: "user_connections";
49
+ dataType: "string";
50
+ columnType: "PgText";
51
+ data: string;
52
+ driverParam: string;
53
+ notNull: true;
54
+ hasDefault: false;
55
+ isPrimaryKey: false;
56
+ isAutoincrement: false;
57
+ hasRuntimeDefault: false;
58
+ enumValues: [string, ...string[]];
59
+ baseColumn: never;
60
+ identity: undefined;
61
+ generated: undefined;
62
+ }, {}, {}>;
63
+ tokenEncrypted: import("drizzle-orm/pg-core/index.js").PgColumn<{
64
+ name: "token_encrypted";
65
+ tableName: "user_connections";
66
+ dataType: "string";
67
+ columnType: "PgText";
68
+ data: string;
69
+ driverParam: string;
70
+ notNull: true;
71
+ hasDefault: false;
72
+ isPrimaryKey: false;
73
+ isAutoincrement: false;
74
+ hasRuntimeDefault: false;
75
+ enumValues: [string, ...string[]];
76
+ baseColumn: never;
77
+ identity: undefined;
78
+ generated: undefined;
79
+ }, {}, {}>;
80
+ refreshTokenEncrypted: import("drizzle-orm/pg-core/index.js").PgColumn<{
81
+ name: "refresh_token_encrypted";
82
+ tableName: "user_connections";
83
+ dataType: "string";
84
+ columnType: "PgText";
85
+ data: string;
86
+ driverParam: string;
87
+ notNull: false;
88
+ hasDefault: false;
89
+ isPrimaryKey: false;
90
+ isAutoincrement: false;
91
+ hasRuntimeDefault: false;
92
+ enumValues: [string, ...string[]];
93
+ baseColumn: never;
94
+ identity: undefined;
95
+ generated: undefined;
96
+ }, {}, {}>;
97
+ expiresAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
98
+ name: "expires_at";
99
+ tableName: "user_connections";
100
+ dataType: "string";
101
+ columnType: "PgTimestampString";
102
+ data: string;
103
+ driverParam: string;
104
+ notNull: false;
105
+ hasDefault: false;
106
+ isPrimaryKey: false;
107
+ isAutoincrement: false;
108
+ hasRuntimeDefault: false;
109
+ enumValues: undefined;
110
+ baseColumn: never;
111
+ identity: undefined;
112
+ generated: undefined;
113
+ }, {}, {}>;
114
+ status: import("drizzle-orm/pg-core/index.js").PgColumn<{
115
+ name: "status";
116
+ tableName: "user_connections";
117
+ dataType: "string";
118
+ columnType: "PgText";
119
+ data: string;
120
+ driverParam: string;
121
+ notNull: true;
122
+ hasDefault: true;
123
+ isPrimaryKey: false;
124
+ isAutoincrement: false;
125
+ hasRuntimeDefault: false;
126
+ enumValues: [string, ...string[]];
127
+ baseColumn: never;
128
+ identity: undefined;
129
+ generated: undefined;
130
+ }, {}, {}>;
131
+ createdAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
132
+ name: "created_at";
133
+ tableName: "user_connections";
134
+ dataType: "string";
135
+ columnType: "PgTimestampString";
136
+ data: string;
137
+ driverParam: string;
138
+ notNull: true;
139
+ hasDefault: false;
140
+ isPrimaryKey: false;
141
+ isAutoincrement: false;
142
+ hasRuntimeDefault: false;
143
+ enumValues: undefined;
144
+ baseColumn: never;
145
+ identity: undefined;
146
+ generated: undefined;
147
+ }, {}, {}>;
148
+ updatedAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
149
+ name: "updated_at";
150
+ tableName: "user_connections";
151
+ dataType: "string";
152
+ columnType: "PgTimestampString";
153
+ data: string;
154
+ driverParam: string;
155
+ notNull: true;
156
+ hasDefault: false;
157
+ isPrimaryKey: false;
158
+ isAutoincrement: false;
159
+ hasRuntimeDefault: false;
160
+ enumValues: undefined;
161
+ baseColumn: never;
162
+ identity: undefined;
163
+ generated: undefined;
164
+ }, {}, {}>;
165
+ };
166
+ dialect: 'pg';
167
+ }>;
168
+ /** Row type of `user_connections`. */
169
+ type UserConnection = typeof userConnections.$inferSelect;
170
+ export { UserConnection, userConnections };
171
+ //# sourceMappingURL=connection.d.mts.map
@@ -0,0 +1,34 @@
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
+ // 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
+ export { userConnections };
33
+
34
+ //# 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"}
@@ -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/pg-core").PgTableWithColumns<{
6
5
  name: "content_refs";
@@ -84,6 +83,5 @@ interface ContentRef {
84
83
  lastSeenAt: string;
85
84
  createdAt: string;
86
85
  }
87
- //#endregion
88
86
  export { ContentRef, contentRefs };
89
87
  //# 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, pgTable, text, timestamp } from "drizzle-orm/pg-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 = pgTable("content_refs", {
8
8
  hash: text("hash").primaryKey(),
@@ -16,7 +16,6 @@ const contentRefs = pgTable("content_refs", {
16
16
  mode: "string"
17
17
  }).notNull()
18
18
  });
19
- //#endregion
20
19
  export { contentRefs };
21
20
 
22
21
  //# sourceMappingURL=content-refs.mjs.map