@storyshelf/db-postgres 0.0.0-stage → 0.5.3

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 (81) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -2
  3. package/dist/ddl.d.mts +8 -0
  4. package/dist/ddl.mjs +321 -0
  5. package/dist/ddl.mjs.map +1 -0
  6. package/dist/drizzle-factory-pg.mjs +77 -0
  7. package/dist/drizzle-factory-pg.mjs.map +1 -0
  8. package/dist/drizzle-factory.mjs +42 -0
  9. package/dist/drizzle-factory.mjs.map +1 -0
  10. package/dist/index.d.mts +50 -0
  11. package/dist/index.mjs +51 -0
  12. package/dist/index.mjs.map +1 -0
  13. package/dist/migrate.mjs +91 -0
  14. package/dist/migrate.mjs.map +1 -0
  15. package/dist/neon-http.d.mts +27 -0
  16. package/dist/neon-http.mjs +66 -0
  17. package/dist/neon-http.mjs.map +1 -0
  18. package/dist/neon.d.mts +29 -0
  19. package/dist/neon.mjs +59 -0
  20. package/dist/neon.mjs.map +1 -0
  21. package/dist/pg.d.mts +33 -0
  22. package/dist/pg.mjs +56 -0
  23. package/dist/pg.mjs.map +1 -0
  24. package/dist/pglite.d.mts +28 -0
  25. package/dist/pglite.mjs +54 -0
  26. package/dist/pglite.mjs.map +1 -0
  27. package/dist/schema/baseline.d.mts +197 -0
  28. package/dist/schema/baseline.mjs +29 -0
  29. package/dist/schema/baseline.mjs.map +1 -0
  30. package/dist/schema/build.d.mts +380 -0
  31. package/dist/schema/build.mjs +39 -0
  32. package/dist/schema/build.mjs.map +1 -0
  33. package/dist/schema/capture-attempt.d.mts +445 -0
  34. package/dist/schema/capture-attempt.mjs +58 -0
  35. package/dist/schema/capture-attempt.mjs.map +1 -0
  36. package/dist/schema/comment.d.mts +197 -0
  37. package/dist/schema/comment.mjs +32 -0
  38. package/dist/schema/comment.mjs.map +1 -0
  39. package/dist/schema/content-refs.d.mts +89 -0
  40. package/dist/schema/content-refs.mjs +22 -0
  41. package/dist/schema/content-refs.mjs.map +1 -0
  42. package/dist/schema/label.d.mts +262 -0
  43. package/dist/schema/label.mjs +36 -0
  44. package/dist/schema/label.mjs.map +1 -0
  45. package/dist/schema/member.d.mts +129 -0
  46. package/dist/schema/member.mjs +23 -0
  47. package/dist/schema/member.mjs.map +1 -0
  48. package/dist/schema/notification.d.mts +316 -0
  49. package/dist/schema/notification.mjs +42 -0
  50. package/dist/schema/notification.mjs.map +1 -0
  51. package/dist/schema/project-group-mapping.d.mts +110 -0
  52. package/dist/schema/project-group-mapping.mjs +21 -0
  53. package/dist/schema/project-group-mapping.mjs.map +1 -0
  54. package/dist/schema/project.d.mts +337 -0
  55. package/dist/schema/project.mjs +35 -0
  56. package/dist/schema/project.mjs.map +1 -0
  57. package/dist/schema/snapshot.d.mts +452 -0
  58. package/dist/schema/snapshot.mjs +47 -0
  59. package/dist/schema/snapshot.mjs.map +1 -0
  60. package/dist/schema/status-config.d.mts +143 -0
  61. package/dist/schema/status-config.mjs +26 -0
  62. package/dist/schema/status-config.mjs.map +1 -0
  63. package/dist/schema/token.d.mts +143 -0
  64. package/dist/schema/token.mjs +27 -0
  65. package/dist/schema/token.mjs.map +1 -0
  66. package/dist/schema/user-invite.d.mts +125 -0
  67. package/dist/schema/user-invite.mjs +28 -0
  68. package/dist/schema/user-invite.mjs.map +1 -0
  69. package/dist/schema/user.d.mts +146 -0
  70. package/dist/schema/user.mjs +25 -0
  71. package/dist/schema/user.mjs.map +1 -0
  72. package/dist/schema/webhook.d.mts +143 -0
  73. package/dist/schema/webhook.mjs +26 -0
  74. package/dist/schema/webhook.mjs.map +1 -0
  75. package/dist/schema.d.mts +47 -0
  76. package/dist/schema.mjs +46 -0
  77. package/dist/schema.mjs.map +1 -0
  78. package/dist/vercel.d.mts +26 -0
  79. package/dist/vercel.mjs +48 -0
  80. package/dist/vercel.mjs.map +1 -0
  81. package/package.json +134 -4
@@ -0,0 +1,129 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { ProjectRole } from "@storyshelf/core/types";
4
+ //#region src/schema/member.d.ts
5
+ /** Narrow `project_members` table definition. */
6
+ declare const projectMembers: import("drizzle-orm/pg-core").PgTableWithColumns<{
7
+ name: "project_members";
8
+ schema: undefined;
9
+ columns: {
10
+ id: import("drizzle-orm/pg-core").PgColumn<{
11
+ name: "id";
12
+ tableName: "project_members";
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: "project_members";
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
+ userId: import("drizzle-orm/pg-core").PgColumn<{
45
+ name: "user_id";
46
+ tableName: "project_members";
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
+ role: import("drizzle-orm/pg-core").PgColumn<{
62
+ name: "role";
63
+ tableName: "project_members";
64
+ dataType: "string";
65
+ columnType: "PgText";
66
+ data: "admin" | "approver" | "developer" | "viewer";
67
+ driverParam: string;
68
+ notNull: true;
69
+ hasDefault: true;
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: "admin" | "approver" | "developer" | "viewer";
79
+ }>;
80
+ source: import("drizzle-orm/pg-core").PgColumn<{
81
+ name: "source";
82
+ tableName: "project_members";
83
+ dataType: "string";
84
+ columnType: "PgText";
85
+ data: string;
86
+ driverParam: string;
87
+ notNull: true;
88
+ hasDefault: true;
89
+ isPrimaryKey: false;
90
+ isAutoincrement: false;
91
+ hasRuntimeDefault: false;
92
+ enumValues: [string, ...string[]];
93
+ baseColumn: never;
94
+ identity: undefined;
95
+ generated: undefined;
96
+ }, {}, {}>;
97
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
98
+ name: "created_at";
99
+ tableName: "project_members";
100
+ dataType: "string";
101
+ columnType: "PgTimestampString";
102
+ data: string;
103
+ driverParam: string;
104
+ notNull: true;
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
+ };
115
+ dialect: 'pg';
116
+ }>;
117
+ /** A project-membership row. */
118
+ interface ProjectMember {
119
+ id: string;
120
+ projectId: string;
121
+ userId: string;
122
+ role: ProjectRole;
123
+ /** Provenance: `manual` grants vs `oidc:<group>` synced grants. */
124
+ source: string;
125
+ createdAt: string;
126
+ }
127
+ //#endregion
128
+ export { ProjectMember, projectMembers };
129
+ //# sourceMappingURL=member.d.mts.map
@@ -0,0 +1,23 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { projects } from "./project.mjs";
5
+ import { users } from "./user.mjs";
6
+ import { pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
7
+ //#region src/schema/member.ts
8
+ /** Narrow `project_members` table definition. */
9
+ const projectMembers = pgTable("project_members", {
10
+ id: text("id").primaryKey(),
11
+ projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
12
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
13
+ role: text("role").$type().notNull().default("viewer"),
14
+ source: text("source").notNull().default("manual"),
15
+ createdAt: timestamp("created_at", {
16
+ withTimezone: true,
17
+ mode: "string"
18
+ }).notNull()
19
+ }, (t) => [uniqueIndex("project_members_project_user_idx").on(t.projectId, t.userId)]);
20
+ //#endregion
21
+ export { projectMembers };
22
+
23
+ //# sourceMappingURL=member.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"member.mjs","names":[],"sources":["../../src/schema/member.ts"],"sourcesContent":["import type { ProjectRole } from \"@storyshelf/core/types\";\nimport { pgTable, text, timestamp, uniqueIndex } from \"drizzle-orm/pg-core\";\nimport { projects } from \"./project.ts\";\nimport { users } from \"./user.ts\";\n\n/** Narrow `project_members` table definition. */\nexport const projectMembers = pgTable(\n \"project_members\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n userId: text(\"user_id\")\n .notNull()\n .references(() => users.id, { onDelete: \"cascade\" }),\n role: text(\"role\").$type<ProjectRole>().notNull().default(\"viewer\"),\n source: text(\"source\").notNull().default(\"manual\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n },\n (t) => [uniqueIndex(\"project_members_project_user_idx\").on(t.projectId, t.userId)],\n);\n\n/** A project-membership row. */\nexport interface ProjectMember {\n id: string;\n projectId: string;\n userId: string;\n role: ProjectRole;\n /** Provenance: `manual` grants vs `oidc:<group>` synced grants. */\n source: string;\n createdAt: string;\n}\n"],"mappings":";;;;;;;;AAMA,MAAa,iBAAiB,QAC5B,mBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,QAAQ,KAAK,SAAS,CAAC,CACpB,QAAQ,CAAC,CACT,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CACrD,MAAM,KAAK,MAAM,CAAC,CAAC,MAAmB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,QAAQ;CAClE,QAAQ,KAAK,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,QAAQ;CACjD,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;AACrF,IACC,MAAM,CAAC,YAAY,kCAAkC,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,CACnF"}
@@ -0,0 +1,316 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region src/schema/notification.d.ts
4
+ /** Narrow `notification_channels` table definition. */
5
+ declare const notificationChannels: import("drizzle-orm/pg-core").PgTableWithColumns<{
6
+ name: "notification_channels";
7
+ schema: undefined;
8
+ columns: {
9
+ id: import("drizzle-orm/pg-core").PgColumn<{
10
+ name: "id";
11
+ tableName: "notification_channels";
12
+ dataType: "string";
13
+ columnType: "PgText";
14
+ data: string;
15
+ driverParam: string;
16
+ notNull: true;
17
+ hasDefault: false;
18
+ isPrimaryKey: true;
19
+ isAutoincrement: false;
20
+ hasRuntimeDefault: false;
21
+ enumValues: [string, ...string[]];
22
+ baseColumn: never;
23
+ identity: undefined;
24
+ generated: undefined;
25
+ }, {}, {}>;
26
+ projectId: import("drizzle-orm/pg-core").PgColumn<{
27
+ name: "project_id";
28
+ tableName: "notification_channels";
29
+ dataType: "string";
30
+ columnType: "PgText";
31
+ data: string;
32
+ driverParam: string;
33
+ notNull: false;
34
+ hasDefault: false;
35
+ isPrimaryKey: false;
36
+ isAutoincrement: false;
37
+ hasRuntimeDefault: false;
38
+ enumValues: [string, ...string[]];
39
+ baseColumn: never;
40
+ identity: undefined;
41
+ generated: undefined;
42
+ }, {}, {}>;
43
+ provider: import("drizzle-orm/pg-core").PgColumn<{
44
+ name: "provider";
45
+ tableName: "notification_channels";
46
+ dataType: "string";
47
+ columnType: "PgText";
48
+ data: string;
49
+ driverParam: string;
50
+ notNull: true;
51
+ hasDefault: false;
52
+ isPrimaryKey: false;
53
+ isAutoincrement: false;
54
+ hasRuntimeDefault: false;
55
+ enumValues: [string, ...string[]];
56
+ baseColumn: never;
57
+ identity: undefined;
58
+ generated: undefined;
59
+ }, {}, {}>;
60
+ config: import("drizzle-orm/pg-core").PgColumn<{
61
+ name: "config";
62
+ tableName: "notification_channels";
63
+ dataType: "string";
64
+ columnType: "PgText";
65
+ data: string;
66
+ driverParam: string;
67
+ notNull: true;
68
+ hasDefault: false;
69
+ isPrimaryKey: false;
70
+ isAutoincrement: false;
71
+ hasRuntimeDefault: false;
72
+ enumValues: [string, ...string[]];
73
+ baseColumn: never;
74
+ identity: undefined;
75
+ generated: undefined;
76
+ }, {}, {}>;
77
+ secretEncrypted: import("drizzle-orm/pg-core").PgColumn<{
78
+ name: "secret_encrypted";
79
+ tableName: "notification_channels";
80
+ dataType: "string";
81
+ columnType: "PgText";
82
+ data: string;
83
+ driverParam: string;
84
+ notNull: false;
85
+ hasDefault: false;
86
+ isPrimaryKey: false;
87
+ isAutoincrement: false;
88
+ hasRuntimeDefault: false;
89
+ enumValues: [string, ...string[]];
90
+ baseColumn: never;
91
+ identity: undefined;
92
+ generated: undefined;
93
+ }, {}, {}>;
94
+ events: import("drizzle-orm/pg-core").PgColumn<{
95
+ name: "events";
96
+ tableName: "notification_channels";
97
+ dataType: "string";
98
+ columnType: "PgText";
99
+ data: string;
100
+ driverParam: string;
101
+ notNull: false;
102
+ hasDefault: false;
103
+ isPrimaryKey: false;
104
+ isAutoincrement: false;
105
+ hasRuntimeDefault: false;
106
+ enumValues: [string, ...string[]];
107
+ baseColumn: never;
108
+ identity: undefined;
109
+ generated: undefined;
110
+ }, {}, {}>;
111
+ enabled: import("drizzle-orm/pg-core").PgColumn<{
112
+ name: "enabled";
113
+ tableName: "notification_channels";
114
+ dataType: "boolean";
115
+ columnType: "PgBoolean";
116
+ data: boolean;
117
+ driverParam: boolean;
118
+ notNull: true;
119
+ hasDefault: true;
120
+ isPrimaryKey: false;
121
+ isAutoincrement: false;
122
+ hasRuntimeDefault: false;
123
+ enumValues: undefined;
124
+ baseColumn: never;
125
+ identity: undefined;
126
+ generated: undefined;
127
+ }, {}, {}>;
128
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
129
+ name: "created_at";
130
+ tableName: "notification_channels";
131
+ dataType: "string";
132
+ columnType: "PgTimestampString";
133
+ data: string;
134
+ driverParam: string;
135
+ notNull: true;
136
+ hasDefault: false;
137
+ isPrimaryKey: false;
138
+ isAutoincrement: false;
139
+ hasRuntimeDefault: false;
140
+ enumValues: undefined;
141
+ baseColumn: never;
142
+ identity: undefined;
143
+ generated: undefined;
144
+ }, {}, {}>;
145
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
146
+ name: "updated_at";
147
+ tableName: "notification_channels";
148
+ dataType: "string";
149
+ columnType: "PgTimestampString";
150
+ data: string;
151
+ driverParam: string;
152
+ notNull: true;
153
+ hasDefault: false;
154
+ isPrimaryKey: false;
155
+ isAutoincrement: false;
156
+ hasRuntimeDefault: false;
157
+ enumValues: undefined;
158
+ baseColumn: never;
159
+ identity: undefined;
160
+ generated: undefined;
161
+ }, {}, {}>;
162
+ };
163
+ dialect: 'pg';
164
+ }>;
165
+ /** Narrow `notification_subscriptions` table definition. */
166
+ declare const notificationSubscriptions: import("drizzle-orm/pg-core").PgTableWithColumns<{
167
+ name: "notification_subscriptions";
168
+ schema: undefined;
169
+ columns: {
170
+ id: import("drizzle-orm/pg-core").PgColumn<{
171
+ name: "id";
172
+ tableName: "notification_subscriptions";
173
+ dataType: "string";
174
+ columnType: "PgText";
175
+ data: string;
176
+ driverParam: string;
177
+ notNull: true;
178
+ hasDefault: false;
179
+ isPrimaryKey: true;
180
+ isAutoincrement: false;
181
+ hasRuntimeDefault: false;
182
+ enumValues: [string, ...string[]];
183
+ baseColumn: never;
184
+ identity: undefined;
185
+ generated: undefined;
186
+ }, {}, {}>;
187
+ projectId: import("drizzle-orm/pg-core").PgColumn<{
188
+ name: "project_id";
189
+ tableName: "notification_subscriptions";
190
+ dataType: "string";
191
+ columnType: "PgText";
192
+ data: string;
193
+ driverParam: string;
194
+ notNull: true;
195
+ hasDefault: false;
196
+ isPrimaryKey: false;
197
+ isAutoincrement: false;
198
+ hasRuntimeDefault: false;
199
+ enumValues: [string, ...string[]];
200
+ baseColumn: never;
201
+ identity: undefined;
202
+ generated: undefined;
203
+ }, {}, {}>;
204
+ userId: import("drizzle-orm/pg-core").PgColumn<{
205
+ name: "user_id";
206
+ tableName: "notification_subscriptions";
207
+ dataType: "string";
208
+ columnType: "PgText";
209
+ data: string;
210
+ driverParam: string;
211
+ notNull: true;
212
+ hasDefault: false;
213
+ isPrimaryKey: false;
214
+ isAutoincrement: false;
215
+ hasRuntimeDefault: false;
216
+ enumValues: [string, ...string[]];
217
+ baseColumn: never;
218
+ identity: undefined;
219
+ generated: undefined;
220
+ }, {}, {}>;
221
+ events: import("drizzle-orm/pg-core").PgColumn<{
222
+ name: "events";
223
+ tableName: "notification_subscriptions";
224
+ dataType: "string";
225
+ columnType: "PgText";
226
+ data: string;
227
+ driverParam: string;
228
+ notNull: false;
229
+ hasDefault: false;
230
+ isPrimaryKey: false;
231
+ isAutoincrement: false;
232
+ hasRuntimeDefault: false;
233
+ enumValues: [string, ...string[]];
234
+ baseColumn: never;
235
+ identity: undefined;
236
+ generated: undefined;
237
+ }, {}, {}>;
238
+ via: import("drizzle-orm/pg-core").PgColumn<{
239
+ name: "via";
240
+ tableName: "notification_subscriptions";
241
+ dataType: "string";
242
+ columnType: "PgText";
243
+ data: string;
244
+ driverParam: string;
245
+ notNull: false;
246
+ hasDefault: false;
247
+ isPrimaryKey: false;
248
+ isAutoincrement: false;
249
+ hasRuntimeDefault: false;
250
+ enumValues: [string, ...string[]];
251
+ baseColumn: never;
252
+ identity: undefined;
253
+ generated: undefined;
254
+ }, {}, {}>;
255
+ enabled: import("drizzle-orm/pg-core").PgColumn<{
256
+ name: "enabled";
257
+ tableName: "notification_subscriptions";
258
+ dataType: "boolean";
259
+ columnType: "PgBoolean";
260
+ data: boolean;
261
+ driverParam: boolean;
262
+ notNull: true;
263
+ hasDefault: true;
264
+ isPrimaryKey: false;
265
+ isAutoincrement: false;
266
+ hasRuntimeDefault: false;
267
+ enumValues: undefined;
268
+ baseColumn: never;
269
+ identity: undefined;
270
+ generated: undefined;
271
+ }, {}, {}>;
272
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
273
+ name: "created_at";
274
+ tableName: "notification_subscriptions";
275
+ dataType: "string";
276
+ columnType: "PgTimestampString";
277
+ data: string;
278
+ driverParam: string;
279
+ notNull: true;
280
+ hasDefault: false;
281
+ isPrimaryKey: false;
282
+ isAutoincrement: false;
283
+ hasRuntimeDefault: false;
284
+ enumValues: undefined;
285
+ baseColumn: never;
286
+ identity: undefined;
287
+ generated: undefined;
288
+ }, {}, {}>;
289
+ };
290
+ dialect: 'pg';
291
+ }>;
292
+ /** A notification channel row. */
293
+ interface NotificationChannel {
294
+ id: string;
295
+ projectId: string | null;
296
+ provider: string;
297
+ config: string;
298
+ secretEncrypted: string | null;
299
+ events: string | null;
300
+ enabled: boolean;
301
+ createdAt: string;
302
+ updatedAt: string;
303
+ }
304
+ /** A per-user notification subscription row. */
305
+ interface NotificationSubscription {
306
+ id: string;
307
+ projectId: string;
308
+ userId: string;
309
+ events: string | null;
310
+ via: string | null;
311
+ enabled: boolean;
312
+ createdAt: string;
313
+ }
314
+ //#endregion
315
+ export { NotificationChannel, NotificationSubscription, notificationChannels, notificationSubscriptions };
316
+ //# sourceMappingURL=notification.d.mts.map
@@ -0,0 +1,42 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { projects } from "./project.mjs";
5
+ import { users } from "./user.mjs";
6
+ import { boolean, pgTable, text, timestamp } from "drizzle-orm/pg-core";
7
+ //#region src/schema/notification.ts
8
+ /** Narrow `notification_channels` table definition. */
9
+ const notificationChannels = pgTable("notification_channels", {
10
+ id: text("id").primaryKey(),
11
+ projectId: text("project_id").references(() => projects.id, { onDelete: "cascade" }),
12
+ provider: text("provider").notNull(),
13
+ config: text("config").notNull(),
14
+ secretEncrypted: text("secret_encrypted"),
15
+ events: text("events"),
16
+ enabled: boolean("enabled").notNull().default(true),
17
+ createdAt: timestamp("created_at", {
18
+ withTimezone: true,
19
+ mode: "string"
20
+ }).notNull(),
21
+ updatedAt: timestamp("updated_at", {
22
+ withTimezone: true,
23
+ mode: "string"
24
+ }).notNull()
25
+ });
26
+ /** Narrow `notification_subscriptions` table definition. */
27
+ const notificationSubscriptions = pgTable("notification_subscriptions", {
28
+ id: text("id").primaryKey(),
29
+ projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
30
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
31
+ events: text("events"),
32
+ via: text("via"),
33
+ enabled: boolean("enabled").notNull().default(true),
34
+ createdAt: timestamp("created_at", {
35
+ withTimezone: true,
36
+ mode: "string"
37
+ }).notNull()
38
+ });
39
+ //#endregion
40
+ export { notificationChannels, notificationSubscriptions };
41
+
42
+ //# sourceMappingURL=notification.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.mjs","names":[],"sources":["../../src/schema/notification.ts"],"sourcesContent":["import { boolean, pgTable, text, timestamp } from \"drizzle-orm/pg-core\";\nimport { projects } from \"./project.ts\";\nimport { users } from \"./user.ts\";\n\n/** Narrow `notification_channels` table definition. */\nexport const notificationChannels = pgTable(\"notification_channels\", {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\").references(() => projects.id, { onDelete: \"cascade\" }),\n provider: text(\"provider\").notNull(),\n config: text(\"config\").notNull(),\n secretEncrypted: text(\"secret_encrypted\"),\n events: text(\"events\"),\n enabled: boolean(\"enabled\").notNull().default(true),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n});\n\n/** Narrow `notification_subscriptions` table definition. */\nexport const notificationSubscriptions = pgTable(\"notification_subscriptions\", {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n userId: text(\"user_id\")\n .notNull()\n .references(() => users.id, { onDelete: \"cascade\" }),\n events: text(\"events\"),\n via: text(\"via\"),\n enabled: boolean(\"enabled\").notNull().default(true),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n});\n\n/** A notification channel row. */\nexport interface NotificationChannel {\n id: string;\n projectId: string | null;\n provider: string;\n config: string;\n secretEncrypted: string | null;\n events: string | null;\n enabled: boolean;\n createdAt: string;\n updatedAt: string;\n}\n\n/** A per-user notification subscription row. */\nexport interface NotificationSubscription {\n id: string;\n projectId: string;\n userId: string;\n events: string | null;\n via: string | null;\n enabled: boolean;\n createdAt: string;\n}\n"],"mappings":";;;;;;;;AAKA,MAAa,uBAAuB,QAAQ,yBAAyB;CACnE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAAC,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACnF,UAAU,KAAK,UAAU,CAAC,CAAC,QAAQ;CACnC,QAAQ,KAAK,QAAQ,CAAC,CAAC,QAAQ;CAC/B,iBAAiB,KAAK,kBAAkB;CACxC,QAAQ,KAAK,QAAQ;CACrB,SAAS,QAAQ,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,IAAI;CAClD,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,CAAC;;AAGD,MAAa,4BAA4B,QAAQ,8BAA8B;CAC7E,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,QAAQ,KAAK,SAAS,CAAC,CACpB,QAAQ,CAAC,CACT,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CACrD,QAAQ,KAAK,QAAQ;CACrB,KAAK,KAAK,KAAK;CACf,SAAS,QAAQ,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,IAAI;CAClD,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;AACrF,CAAC"}
@@ -0,0 +1,110 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { ProjectRole } from "@storyshelf/core/types";
4
+ //#region src/schema/project-group-mapping.d.ts
5
+ /** Narrow `project_group_mappings` table definition. */
6
+ declare const projectGroupMappings: import("drizzle-orm/pg-core").PgTableWithColumns<{
7
+ name: "project_group_mappings";
8
+ schema: undefined;
9
+ columns: {
10
+ id: import("drizzle-orm/pg-core").PgColumn<{
11
+ name: "id";
12
+ tableName: "project_group_mappings";
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: "project_group_mappings";
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
+ groupName: import("drizzle-orm/pg-core").PgColumn<{
45
+ name: "group_name";
46
+ tableName: "project_group_mappings";
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
+ role: import("drizzle-orm/pg-core").PgColumn<{
62
+ name: "role";
63
+ tableName: "project_group_mappings";
64
+ dataType: "string";
65
+ columnType: "PgText";
66
+ data: "admin" | "approver" | "developer" | "viewer";
67
+ driverParam: string;
68
+ notNull: true;
69
+ hasDefault: true;
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: "admin" | "approver" | "developer" | "viewer";
79
+ }>;
80
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
81
+ name: "created_at";
82
+ tableName: "project_group_mappings";
83
+ dataType: "string";
84
+ columnType: "PgTimestampString";
85
+ data: string;
86
+ driverParam: string;
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
+ };
98
+ dialect: 'pg';
99
+ }>;
100
+ /** An identity-provider group to project-role mapping row. */
101
+ interface ProjectGroupMapping {
102
+ id: string;
103
+ projectId: string;
104
+ groupName: string;
105
+ role: ProjectRole;
106
+ createdAt: string;
107
+ }
108
+ //#endregion
109
+ export { ProjectGroupMapping, projectGroupMappings };
110
+ //# sourceMappingURL=project-group-mapping.d.mts.map
@@ -0,0 +1,21 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { projects } from "./project.mjs";
5
+ import { pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
6
+ //#region src/schema/project-group-mapping.ts
7
+ /** Narrow `project_group_mappings` table definition. */
8
+ const projectGroupMappings = pgTable("project_group_mappings", {
9
+ id: text("id").primaryKey(),
10
+ projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
11
+ groupName: text("group_name").notNull(),
12
+ role: text("role").$type().notNull().default("viewer"),
13
+ createdAt: timestamp("created_at", {
14
+ withTimezone: true,
15
+ mode: "string"
16
+ }).notNull()
17
+ }, (t) => [uniqueIndex("project_group_mappings_project_group_idx").on(t.projectId, t.groupName)]);
18
+ //#endregion
19
+ export { projectGroupMappings };
20
+
21
+ //# sourceMappingURL=project-group-mapping.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-group-mapping.mjs","names":[],"sources":["../../src/schema/project-group-mapping.ts"],"sourcesContent":["import type { ProjectRole } from \"@storyshelf/core/types\";\nimport { pgTable, text, timestamp, uniqueIndex } from \"drizzle-orm/pg-core\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `project_group_mappings` table definition. */\nexport const projectGroupMappings = pgTable(\n \"project_group_mappings\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n groupName: text(\"group_name\").notNull(),\n role: text(\"role\").$type<ProjectRole>().notNull().default(\"viewer\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n },\n (t) => [uniqueIndex(\"project_group_mappings_project_group_idx\").on(t.projectId, t.groupName)],\n);\n\n/** An identity-provider group to project-role mapping row. */\nexport interface ProjectGroupMapping {\n id: string;\n projectId: string;\n groupName: string;\n role: ProjectRole;\n createdAt: string;\n}\n"],"mappings":";;;;;;;AAKA,MAAa,uBAAuB,QAClC,0BACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAmB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,QAAQ;CAClE,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;AACrF,IACC,MAAM,CAAC,YAAY,0CAA0C,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,CAC9F"}