@storyshelf/db-mysql 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.
- package/README.md +36 -0
- package/dist/ddl.d.mts +1 -3
- package/dist/ddl.mjs +391 -141
- package/dist/ddl.mjs.map +1 -1
- package/dist/drizzle-factory-mysql.mjs +15 -8
- package/dist/drizzle-factory-mysql.mjs.map +1 -1
- package/dist/drizzle-factory.mjs +1 -2
- package/dist/foreign-keys.mjs +338 -0
- package/dist/foreign-keys.mjs.map +1 -0
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +11 -7
- package/dist/index.mjs.map +1 -1
- package/dist/migrate.mjs +349 -73
- package/dist/migrate.mjs.map +1 -1
- package/dist/planetscale.d.mts +0 -2
- package/dist/planetscale.mjs +1 -2
- package/dist/schema/baseline.d.mts +89 -19
- package/dist/schema/baseline.mjs +8 -4
- package/dist/schema/baseline.mjs.map +1 -1
- package/dist/schema/{status-config.d.mts → build-component.d.mts} +47 -42
- package/dist/schema/build-component.mjs +25 -0
- package/dist/schema/build-component.mjs.map +1 -0
- package/dist/schema/build-review.d.mts +116 -0
- package/dist/schema/build-review.mjs +23 -0
- package/dist/schema/build-review.mjs.map +1 -0
- package/dist/schema/build.d.mts +65 -31
- package/dist/schema/build.mjs +6 -3
- package/dist/schema/build.mjs.map +1 -1
- package/dist/schema/capture-attempt.d.mts +43 -45
- package/dist/schema/capture-attempt.mjs +3 -3
- package/dist/schema/capture-attempt.mjs.map +1 -1
- package/dist/schema/capture-job.d.mts +328 -0
- package/dist/schema/capture-job.mjs +56 -0
- package/dist/schema/capture-job.mjs.map +1 -0
- package/dist/schema/capture-shard.d.mts +255 -0
- package/dist/schema/capture-shard.mjs +40 -0
- package/dist/schema/capture-shard.mjs.map +1 -0
- package/dist/schema/comment.d.mts +35 -19
- package/dist/schema/comment.mjs +6 -5
- package/dist/schema/comment.mjs.map +1 -1
- package/dist/schema/connection.d.mts +171 -0
- package/dist/schema/connection.mjs +35 -0
- package/dist/schema/connection.mjs.map +1 -0
- package/dist/schema/content-refs.d.mts +11 -13
- package/dist/schema/content-refs.mjs +3 -3
- package/dist/schema/content-refs.mjs.map +1 -1
- package/dist/schema/datetime.mjs +46 -0
- package/dist/schema/datetime.mjs.map +1 -0
- package/dist/schema/design.d.mts +587 -0
- package/dist/schema/design.mjs +73 -0
- package/dist/schema/design.mjs.map +1 -0
- package/dist/schema/insight.d.mts +631 -0
- package/dist/schema/insight.mjs +68 -0
- package/dist/schema/insight.mjs.map +1 -0
- package/dist/schema/label.d.mts +21 -23
- package/dist/schema/label.mjs +3 -3
- package/dist/schema/label.mjs.map +1 -1
- package/dist/schema/member.d.mts +10 -12
- package/dist/schema/member.mjs +3 -3
- package/dist/schema/member.mjs.map +1 -1
- package/dist/schema/notification.d.mts +63 -29
- package/dist/schema/notification.mjs +8 -3
- package/dist/schema/notification.mjs.map +1 -1
- package/dist/schema/project-group-mapping.d.mts +9 -11
- package/dist/schema/project-group-mapping.mjs +3 -3
- package/dist/schema/project-group-mapping.mjs.map +1 -1
- package/dist/schema/project.d.mts +149 -25
- package/dist/schema/project.mjs +11 -4
- package/dist/schema/project.mjs.map +1 -1
- package/dist/schema/site-setting.d.mts +97 -0
- package/dist/schema/site-setting.mjs +23 -0
- package/dist/schema/site-setting.mjs.map +1 -0
- package/dist/schema/snapshot.d.mts +195 -35
- package/dist/schema/snapshot.mjs +17 -4
- package/dist/schema/snapshot.mjs.map +1 -1
- package/dist/schema/token.d.mts +14 -16
- package/dist/schema/token.mjs +3 -3
- package/dist/schema/token.mjs.map +1 -1
- package/dist/schema/usage.d.mts +265 -0
- package/dist/schema/usage.mjs +36 -0
- package/dist/schema/usage.mjs.map +1 -0
- package/dist/schema/user-invite.d.mts +16 -18
- package/dist/schema/user-invite.mjs +3 -3
- package/dist/schema/user-invite.mjs.map +1 -1
- package/dist/schema/user.d.mts +88 -16
- package/dist/schema/user.mjs +8 -4
- package/dist/schema/user.mjs.map +1 -1
- package/dist/schema/webhook.d.mts +14 -16
- package/dist/schema/webhook.mjs +3 -3
- package/dist/schema/webhook.mjs.map +1 -1
- package/dist/schema.d.mts +24 -5
- package/dist/schema.mjs +26 -6
- package/dist/schema.mjs.map +1 -1
- package/dist/tidb.d.mts +0 -2
- package/dist/tidb.mjs +1 -2
- package/package.json +7 -7
- package/dist/schema/status-config.mjs +0 -26
- 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/mysql-core").MySqlTableWithColumns<{
|
|
4
|
+
declare const comments: import("drizzle-orm/mysql-core/table.js").MySqlTableWithColumns<{
|
|
6
5
|
name: "comments";
|
|
7
6
|
schema: undefined;
|
|
8
7
|
columns: {
|
|
9
|
-
id: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
8
|
+
id: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
10
9
|
name: "id";
|
|
11
10
|
tableName: "comments";
|
|
12
11
|
dataType: "string";
|
|
@@ -23,7 +22,7 @@ declare const comments: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
23
22
|
identity: undefined;
|
|
24
23
|
generated: undefined;
|
|
25
24
|
}, {}, {}>;
|
|
26
|
-
projectId: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
25
|
+
projectId: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
27
26
|
name: "project_id";
|
|
28
27
|
tableName: "comments";
|
|
29
28
|
dataType: "string";
|
|
@@ -40,7 +39,7 @@ declare const comments: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
40
39
|
identity: undefined;
|
|
41
40
|
generated: undefined;
|
|
42
41
|
}, {}, {}>;
|
|
43
|
-
buildId: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
42
|
+
buildId: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
44
43
|
name: "build_id";
|
|
45
44
|
tableName: "comments";
|
|
46
45
|
dataType: "string";
|
|
@@ -57,7 +56,7 @@ declare const comments: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
57
56
|
identity: undefined;
|
|
58
57
|
generated: undefined;
|
|
59
58
|
}, {}, {}>;
|
|
60
|
-
snapshotId: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
59
|
+
snapshotId: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
61
60
|
name: "snapshot_id";
|
|
62
61
|
tableName: "comments";
|
|
63
62
|
dataType: "string";
|
|
@@ -74,7 +73,7 @@ declare const comments: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
74
73
|
identity: undefined;
|
|
75
74
|
generated: undefined;
|
|
76
75
|
}, {}, {}>;
|
|
77
|
-
userId: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
76
|
+
userId: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
78
77
|
name: "user_id";
|
|
79
78
|
tableName: "comments";
|
|
80
79
|
dataType: "string";
|
|
@@ -91,7 +90,7 @@ declare const comments: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
91
90
|
identity: undefined;
|
|
92
91
|
generated: undefined;
|
|
93
92
|
}, {}, {}>;
|
|
94
|
-
body: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
93
|
+
body: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
95
94
|
name: "body";
|
|
96
95
|
tableName: "comments";
|
|
97
96
|
dataType: "string";
|
|
@@ -108,7 +107,7 @@ declare const comments: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
108
107
|
identity: undefined;
|
|
109
108
|
generated: undefined;
|
|
110
109
|
}, {}, {}>;
|
|
111
|
-
parentId: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
110
|
+
parentId: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
112
111
|
name: "parent_id";
|
|
113
112
|
tableName: "comments";
|
|
114
113
|
dataType: "string";
|
|
@@ -125,7 +124,7 @@ declare const comments: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
125
124
|
identity: undefined;
|
|
126
125
|
generated: undefined;
|
|
127
126
|
}, {}, {}>;
|
|
128
|
-
resolved: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
127
|
+
resolved: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
129
128
|
name: "resolved";
|
|
130
129
|
tableName: "comments";
|
|
131
130
|
dataType: "boolean";
|
|
@@ -142,13 +141,13 @@ declare const comments: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
142
141
|
identity: undefined;
|
|
143
142
|
generated: undefined;
|
|
144
143
|
}, {}, {}>;
|
|
145
|
-
createdAt: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
144
|
+
createdAt: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
146
145
|
name: "created_at";
|
|
147
146
|
tableName: "comments";
|
|
148
|
-
dataType: "
|
|
149
|
-
columnType: "
|
|
147
|
+
dataType: "custom";
|
|
148
|
+
columnType: "MySqlCustomColumn";
|
|
150
149
|
data: string;
|
|
151
|
-
driverParam: string
|
|
150
|
+
driverParam: string;
|
|
152
151
|
notNull: true;
|
|
153
152
|
hasDefault: false;
|
|
154
153
|
isPrimaryKey: false;
|
|
@@ -159,13 +158,13 @@ declare const comments: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
159
158
|
identity: undefined;
|
|
160
159
|
generated: undefined;
|
|
161
160
|
}, {}, {}>;
|
|
162
|
-
updatedAt: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
161
|
+
updatedAt: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
163
162
|
name: "updated_at";
|
|
164
163
|
tableName: "comments";
|
|
165
|
-
dataType: "
|
|
166
|
-
columnType: "
|
|
164
|
+
dataType: "custom";
|
|
165
|
+
columnType: "MySqlCustomColumn";
|
|
167
166
|
data: string;
|
|
168
|
-
driverParam: string
|
|
167
|
+
driverParam: string;
|
|
169
168
|
notNull: true;
|
|
170
169
|
hasDefault: false;
|
|
171
170
|
isPrimaryKey: false;
|
|
@@ -176,6 +175,23 @@ declare const comments: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
176
175
|
identity: undefined;
|
|
177
176
|
generated: undefined;
|
|
178
177
|
}, {}, {}>;
|
|
178
|
+
storyId: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
179
|
+
name: "story_id";
|
|
180
|
+
tableName: "comments";
|
|
181
|
+
dataType: "string";
|
|
182
|
+
columnType: "MySqlText";
|
|
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: 'mysql';
|
|
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
|
package/dist/schema/comment.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
+
import { datetime } from "./datetime.mjs";
|
|
4
5
|
import { projects } from "./project.mjs";
|
|
5
6
|
import { builds } from "./build.mjs";
|
|
6
|
-
import { snapshots } from "./snapshot.mjs";
|
|
7
7
|
import { users } from "./user.mjs";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import { snapshots } from "./snapshot.mjs";
|
|
9
|
+
import { boolean, index, mysqlTable, text } from "drizzle-orm/mysql-core";
|
|
10
|
+
// src/schema/comment.ts
|
|
10
11
|
/** Narrow `comments` table definition. */
|
|
11
12
|
const comments = mysqlTable("comments", {
|
|
12
13
|
id: text("id").primaryKey(),
|
|
@@ -24,9 +25,9 @@ const comments = mysqlTable("comments", {
|
|
|
24
25
|
updatedAt: datetime("updated_at", {
|
|
25
26
|
mode: "string",
|
|
26
27
|
fsp: 3
|
|
27
|
-
}).notNull()
|
|
28
|
+
}).notNull(),
|
|
29
|
+
storyId: text("story_id")
|
|
28
30
|
}, (t) => [index("comments_build_id_idx").on(t.buildId)]);
|
|
29
|
-
//#endregion
|
|
30
31
|
export { comments };
|
|
31
32
|
|
|
32
33
|
//# sourceMappingURL=comment.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.mjs","names":[],"sources":["../../src/schema/comment.ts"],"sourcesContent":["import { boolean, index, mysqlTable, text
|
|
1
|
+
{"version":3,"file":"comment.mjs","names":[],"sources":["../../src/schema/comment.ts"],"sourcesContent":["import { boolean, index, mysqlTable, text } from \"drizzle-orm/mysql-core\";\nimport { builds } from \"./build.ts\";\nimport { datetime } from \"./datetime.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 = mysqlTable(\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: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n updatedAt: datetime(\"updated_at\", { mode: \"string\", fsp: 3 }).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":";;;;;;;;;;;AAQA,MAAa,WAAW,WACtB,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,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACtE,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACtE,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/mysql-core/table.js").MySqlTableWithColumns<{
|
|
9
|
+
name: "user_connections";
|
|
10
|
+
schema: undefined;
|
|
11
|
+
columns: {
|
|
12
|
+
id: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
13
|
+
name: "id";
|
|
14
|
+
tableName: "user_connections";
|
|
15
|
+
dataType: "string";
|
|
16
|
+
columnType: "MySqlText";
|
|
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/mysql-core/index.js").MySqlColumn<{
|
|
30
|
+
name: "user_id";
|
|
31
|
+
tableName: "user_connections";
|
|
32
|
+
dataType: "string";
|
|
33
|
+
columnType: "MySqlText";
|
|
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/mysql-core/index.js").MySqlColumn<{
|
|
47
|
+
name: "service";
|
|
48
|
+
tableName: "user_connections";
|
|
49
|
+
dataType: "string";
|
|
50
|
+
columnType: "MySqlText";
|
|
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/mysql-core/index.js").MySqlColumn<{
|
|
64
|
+
name: "token_encrypted";
|
|
65
|
+
tableName: "user_connections";
|
|
66
|
+
dataType: "string";
|
|
67
|
+
columnType: "MySqlText";
|
|
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/mysql-core/index.js").MySqlColumn<{
|
|
81
|
+
name: "refresh_token_encrypted";
|
|
82
|
+
tableName: "user_connections";
|
|
83
|
+
dataType: "string";
|
|
84
|
+
columnType: "MySqlText";
|
|
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/mysql-core/index.js").MySqlColumn<{
|
|
98
|
+
name: "expires_at";
|
|
99
|
+
tableName: "user_connections";
|
|
100
|
+
dataType: "custom";
|
|
101
|
+
columnType: "MySqlCustomColumn";
|
|
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/mysql-core/index.js").MySqlColumn<{
|
|
115
|
+
name: "status";
|
|
116
|
+
tableName: "user_connections";
|
|
117
|
+
dataType: "string";
|
|
118
|
+
columnType: "MySqlText";
|
|
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/mysql-core/index.js").MySqlColumn<{
|
|
132
|
+
name: "created_at";
|
|
133
|
+
tableName: "user_connections";
|
|
134
|
+
dataType: "custom";
|
|
135
|
+
columnType: "MySqlCustomColumn";
|
|
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/mysql-core/index.js").MySqlColumn<{
|
|
149
|
+
name: "updated_at";
|
|
150
|
+
tableName: "user_connections";
|
|
151
|
+
dataType: "custom";
|
|
152
|
+
columnType: "MySqlCustomColumn";
|
|
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: 'mysql';
|
|
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,35 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { datetime } from "./datetime.mjs";
|
|
5
|
+
import { users } from "./user.mjs";
|
|
6
|
+
import { mysqlTable, text, uniqueIndex } from "drizzle-orm/mysql-core";
|
|
7
|
+
// src/schema/connection.ts
|
|
8
|
+
/**
|
|
9
|
+
* A user's own OAuth connection to an external service (Figma, later Jira/Linear/…),
|
|
10
|
+
* one per user and service. `tokenEncrypted` is the access token; the refresh token
|
|
11
|
+
* is encrypted too. `status` is `ok` or `expired` (needs reconnecting).
|
|
12
|
+
*/
|
|
13
|
+
const userConnections = mysqlTable("user_connections", {
|
|
14
|
+
id: text("id").primaryKey(),
|
|
15
|
+
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
16
|
+
service: text("service").notNull(),
|
|
17
|
+
tokenEncrypted: text("token_encrypted").notNull(),
|
|
18
|
+
refreshTokenEncrypted: text("refresh_token_encrypted"),
|
|
19
|
+
expiresAt: datetime("expires_at", {
|
|
20
|
+
mode: "string",
|
|
21
|
+
fsp: 3
|
|
22
|
+
}),
|
|
23
|
+
status: text("status").notNull().default("ok"),
|
|
24
|
+
createdAt: datetime("created_at", {
|
|
25
|
+
mode: "string",
|
|
26
|
+
fsp: 3
|
|
27
|
+
}).notNull(),
|
|
28
|
+
updatedAt: datetime("updated_at", {
|
|
29
|
+
mode: "string",
|
|
30
|
+
fsp: 3
|
|
31
|
+
}).notNull()
|
|
32
|
+
}, (t) => [uniqueIndex("user_connections_user_service_idx").on(t.userId, t.service)]);
|
|
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 { mysqlTable, text, uniqueIndex } from \"drizzle-orm/mysql-core\";\nimport { datetime } from \"./datetime.ts\";\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 = mysqlTable(\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: datetime(\"expires_at\", { mode: \"string\", fsp: 3 }),\n status: text(\"status\").notNull().default(\"ok\"),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n updatedAt: datetime(\"updated_at\", { mode: \"string\", fsp: 3 }).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":";;;;;;;;;;;;AASA,MAAa,kBAAkB,WAC7B,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,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC;CAC5D,QAAQ,KAAK,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,IAAI;CAC7C,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACtE,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,IACC,MAAM,CAAC,YAAY,mCAAmC,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAClF"}
|
|
@@ -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/content-refs.d.ts
|
|
4
3
|
/** Content-addressed storage refs for deduplicated Storybook assets. */
|
|
5
|
-
declare const contentRefs: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
4
|
+
declare const contentRefs: import("drizzle-orm/mysql-core/table.js").MySqlTableWithColumns<{
|
|
6
5
|
name: "content_refs";
|
|
7
6
|
schema: undefined;
|
|
8
7
|
columns: {
|
|
9
|
-
hash: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
8
|
+
hash: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
10
9
|
name: "hash";
|
|
11
10
|
tableName: "content_refs";
|
|
12
11
|
dataType: "string";
|
|
@@ -23,7 +22,7 @@ declare const contentRefs: import("drizzle-orm/mysql-core").MySqlTableWithColumn
|
|
|
23
22
|
identity: undefined;
|
|
24
23
|
generated: undefined;
|
|
25
24
|
}, {}, {}>;
|
|
26
|
-
refCount: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
25
|
+
refCount: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
27
26
|
name: "ref_count";
|
|
28
27
|
tableName: "content_refs";
|
|
29
28
|
dataType: "number";
|
|
@@ -40,13 +39,13 @@ declare const contentRefs: import("drizzle-orm/mysql-core").MySqlTableWithColumn
|
|
|
40
39
|
identity: undefined;
|
|
41
40
|
generated: undefined;
|
|
42
41
|
}, {}, {}>;
|
|
43
|
-
lastSeenAt: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
42
|
+
lastSeenAt: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
44
43
|
name: "last_seen_at";
|
|
45
44
|
tableName: "content_refs";
|
|
46
|
-
dataType: "
|
|
47
|
-
columnType: "
|
|
45
|
+
dataType: "custom";
|
|
46
|
+
columnType: "MySqlCustomColumn";
|
|
48
47
|
data: string;
|
|
49
|
-
driverParam: string
|
|
48
|
+
driverParam: string;
|
|
50
49
|
notNull: true;
|
|
51
50
|
hasDefault: false;
|
|
52
51
|
isPrimaryKey: false;
|
|
@@ -57,13 +56,13 @@ declare const contentRefs: import("drizzle-orm/mysql-core").MySqlTableWithColumn
|
|
|
57
56
|
identity: undefined;
|
|
58
57
|
generated: undefined;
|
|
59
58
|
}, {}, {}>;
|
|
60
|
-
createdAt: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
59
|
+
createdAt: import("drizzle-orm/mysql-core/index.js").MySqlColumn<{
|
|
61
60
|
name: "created_at";
|
|
62
61
|
tableName: "content_refs";
|
|
63
|
-
dataType: "
|
|
64
|
-
columnType: "
|
|
62
|
+
dataType: "custom";
|
|
63
|
+
columnType: "MySqlCustomColumn";
|
|
65
64
|
data: string;
|
|
66
|
-
driverParam: string
|
|
65
|
+
driverParam: string;
|
|
67
66
|
notNull: true;
|
|
68
67
|
hasDefault: false;
|
|
69
68
|
isPrimaryKey: false;
|
|
@@ -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
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
import { datetime
|
|
5
|
-
|
|
4
|
+
import { datetime } from "./datetime.mjs";
|
|
5
|
+
import { int, mysqlTable, text } from "drizzle-orm/mysql-core";
|
|
6
|
+
// src/schema/content-refs.ts
|
|
6
7
|
/** Content-addressed storage refs for deduplicated Storybook assets. */
|
|
7
8
|
const contentRefs = mysqlTable("content_refs", {
|
|
8
9
|
hash: text("hash").primaryKey(),
|
|
@@ -16,7 +17,6 @@ const contentRefs = mysqlTable("content_refs", {
|
|
|
16
17
|
fsp: 3
|
|
17
18
|
}).notNull()
|
|
18
19
|
});
|
|
19
|
-
//#endregion
|
|
20
20
|
export { contentRefs };
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=content-refs.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-refs.mjs","names":[],"sources":["../../src/schema/content-refs.ts"],"sourcesContent":["import { int, mysqlTable, text
|
|
1
|
+
{"version":3,"file":"content-refs.mjs","names":[],"sources":["../../src/schema/content-refs.ts"],"sourcesContent":["import { int, mysqlTable, text } from \"drizzle-orm/mysql-core\";\nimport { datetime } from \"./datetime.ts\";\n\n/** Content-addressed storage refs for deduplicated Storybook assets. */\nexport const contentRefs = mysqlTable(\"content_refs\", {\n hash: text(\"hash\").primaryKey(),\n refCount: int(\"ref_count\").notNull().default(1),\n lastSeenAt: datetime(\"last_seen_at\", { mode: \"string\", fsp: 3 }).notNull(),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n});\n\n/** Content ref row. */\nexport interface ContentRef {\n hash: string;\n refCount: number;\n lastSeenAt: string;\n createdAt: string;\n}\n"],"mappings":";;;;;;;AAIA,MAAa,cAAc,WAAW,gBAAgB;CACpD,MAAM,KAAK,MAAM,CAAC,CAAC,WAAW;CAC9B,UAAU,IAAI,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAC9C,YAAY,SAAS,gBAAgB;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACzE,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { customType } from "drizzle-orm/mysql-core";
|
|
5
|
+
// src/schema/datetime.ts
|
|
6
|
+
/**
|
|
7
|
+
* MySQL DATETIME(3) column that keeps StoryShelf's ISO-8601 timestamps.
|
|
8
|
+
*
|
|
9
|
+
* MySQL does not accept `2026-10-24T10:34:17.691Z`; the adapter stores UTC
|
|
10
|
+
* values as `2026-10-24 10:34:17.691` and converts them back on read. Keeping
|
|
11
|
+
* the conversion on the column means inserts, updates and every comparison
|
|
12
|
+
* (queue leases, retention cut-offs) use the same form.
|
|
13
|
+
*/
|
|
14
|
+
const datetime = customType({
|
|
15
|
+
dataType(config) {
|
|
16
|
+
return `datetime(${config?.fsp ?? 3})`;
|
|
17
|
+
},
|
|
18
|
+
toDriver(value) {
|
|
19
|
+
return toMySqlDateTime(value);
|
|
20
|
+
},
|
|
21
|
+
fromDriver(value) {
|
|
22
|
+
return fromMySqlDateTime(value);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function toMySqlDateTime(iso) {
|
|
26
|
+
const time = new Date(iso).getTime();
|
|
27
|
+
if (Number.isNaN(time)) return iso;
|
|
28
|
+
return new Date(time).toISOString().slice(0, 23).replace("T", " ");
|
|
29
|
+
}
|
|
30
|
+
function fromMySqlDateTime(value) {
|
|
31
|
+
if (value instanceof Date) return wallClockIso(value);
|
|
32
|
+
if (value.includes("T")) return value;
|
|
33
|
+
const [date, time] = value.split(" ");
|
|
34
|
+
if (!date || !time) return value;
|
|
35
|
+
const parsed = /* @__PURE__ */ new Date(`${date}T${time}Z`);
|
|
36
|
+
return Number.isNaN(parsed.getTime()) ? value : parsed.toISOString();
|
|
37
|
+
}
|
|
38
|
+
function wallClockIso(date) {
|
|
39
|
+
return `${`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`}T${`${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`}.${pad(date.getMilliseconds(), 3)}Z`;
|
|
40
|
+
}
|
|
41
|
+
function pad(value, width = 2) {
|
|
42
|
+
return String(value).padStart(width, "0");
|
|
43
|
+
}
|
|
44
|
+
export { datetime, fromMySqlDateTime, toMySqlDateTime };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=datetime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datetime.mjs","names":[],"sources":["../../src/schema/datetime.ts"],"sourcesContent":["/**\n * MySQL DATETIME(3) column that keeps StoryShelf's ISO-8601 timestamps.\n *\n * MySQL does not accept `2026-10-24T10:34:17.691Z`; the adapter stores UTC\n * values as `2026-10-24 10:34:17.691` and converts them back on read. Keeping\n * the conversion on the column means inserts, updates and every comparison\n * (queue leases, retention cut-offs) use the same form.\n */\nimport { customType } from \"drizzle-orm/mysql-core\";\n\ninterface DateTimeConfig {\n mode?: \"string\";\n fsp?: number;\n}\n\nexport const datetime = customType<{\n data: string;\n driverData: string;\n config: DateTimeConfig;\n}>({\n dataType(config) {\n return `datetime(${config?.fsp ?? 3})`;\n },\n toDriver(value: string): string {\n return toMySqlDateTime(value);\n },\n fromDriver(value: string): string {\n return fromMySqlDateTime(value);\n },\n});\n\nexport function toMySqlDateTime(iso: string): string {\n const time = new Date(iso).getTime();\n if (Number.isNaN(time)) {\n return iso;\n }\n return new Date(time).toISOString().slice(0, 23).replace(\"T\", \" \");\n}\n\nexport function fromMySqlDateTime(value: string | Date): string {\n if (value instanceof Date) {\n return wallClockIso(value);\n }\n if (value.includes(\"T\")) {\n return value;\n }\n const [date, time] = value.split(\" \");\n if (!date || !time) {\n return value;\n }\n const parsed = new Date(`${date}T${time}Z`);\n return Number.isNaN(parsed.getTime()) ? value : parsed.toISOString();\n}\n\nfunction wallClockIso(date: Date): string {\n const day = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n const time = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;\n return `${day}T${time}.${pad(date.getMilliseconds(), 3)}Z`;\n}\n\nfunction pad(value: number, width = 2): string {\n return String(value).padStart(width, \"0\");\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAa,WAAW,WAIrB;CACD,SAAS,QAAQ;EACf,OAAO,YAAY,QAAQ,OAAO,EAAE;CACtC;CACA,SAAS,OAAuB;EAC9B,OAAO,gBAAgB,KAAK;CAC9B;CACA,WAAW,OAAuB;EAChC,OAAO,kBAAkB,KAAK;CAChC;AACF,CAAC;AAED,SAAgB,gBAAgB,KAAqB;CACnD,MAAM,OAAO,IAAI,KAAK,GAAG,CAAC,CAAC,QAAQ;CACnC,IAAI,OAAO,MAAM,IAAI,GACnB,OAAO;CAET,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,QAAQ,KAAK,GAAG;AACnE;AAEA,SAAgB,kBAAkB,OAA8B;CAC9D,IAAI,iBAAiB,MACnB,OAAO,aAAa,KAAK;CAE3B,IAAI,MAAM,SAAS,GAAG,GACpB,OAAO;CAET,MAAM,CAAC,MAAM,QAAQ,MAAM,MAAM,GAAG;CACpC,IAAI,CAAC,QAAQ,CAAC,MACZ,OAAO;CAET,MAAM,yBAAS,IAAI,KAAK,GAAG,KAAK,GAAG,KAAK,EAAE;CAC1C,OAAO,OAAO,MAAM,OAAO,QAAQ,CAAC,IAAI,QAAQ,OAAO,YAAY;AACrE;AAEA,SAAS,aAAa,MAAoB;CAGxC,OAAO,GAAG,GAFK,KAAK,YAAY,EAAE,GAAG,IAAI,KAAK,SAAS,IAAI,CAAC,EAAE,GAAG,IAAI,KAAK,QAAQ,CAAC,IAErE,GAAG,GADD,IAAI,KAAK,SAAS,CAAC,EAAE,GAAG,IAAI,KAAK,WAAW,CAAC,EAAE,GAAG,IAAI,KAAK,WAAW,CAAC,IACjE,GAAG,IAAI,KAAK,gBAAgB,GAAG,CAAC,EAAE;AAC1D;AAEA,SAAS,IAAI,OAAe,QAAQ,GAAW;CAC7C,OAAO,OAAO,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG;AAC1C"}
|