@storyshelf/db-postgres 0.7.0 → 0.9.0-next-d2cc082
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/dist/ddl.d.mts +1 -3
- package/dist/ddl.mjs +11 -3
- package/dist/ddl.mjs.map +1 -1
- package/dist/drizzle-factory-pg.mjs +9 -7
- package/dist/drizzle-factory-pg.mjs.map +1 -1
- package/dist/drizzle-factory.mjs +1 -2
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +2 -3
- package/dist/migrate.mjs +37 -2
- package/dist/migrate.mjs.map +1 -1
- package/dist/neon-http.d.mts +0 -2
- package/dist/neon-http.mjs +2 -3
- package/dist/neon.d.mts +0 -2
- package/dist/neon.mjs +2 -3
- package/dist/pg.d.mts +0 -2
- package/dist/pg.mjs +2 -3
- package/dist/pglite.d.mts +0 -2
- package/dist/pglite.mjs +2 -3
- package/dist/schema/baseline.d.mts +32 -16
- package/dist/schema/baseline.mjs +2 -2
- package/dist/schema/baseline.mjs.map +1 -1
- package/dist/schema/build-component.d.mts +9 -11
- package/dist/schema/build-component.mjs +1 -2
- package/dist/schema/build-review.d.mts +7 -9
- package/dist/schema/build-review.mjs +1 -2
- package/dist/schema/build.d.mts +23 -25
- package/dist/schema/build.mjs +1 -2
- package/dist/schema/capture-attempt.d.mts +25 -27
- package/dist/schema/capture-attempt.mjs +1 -2
- package/dist/schema/capture-job.d.mts +0 -2
- package/dist/schema/capture-job.mjs +1 -2
- package/dist/schema/capture-shard.d.mts +15 -17
- package/dist/schema/capture-shard.mjs +1 -2
- package/dist/schema/comment.d.mts +12 -14
- package/dist/schema/comment.mjs +1 -2
- package/dist/schema/connection.d.mts +10 -12
- package/dist/schema/connection.mjs +1 -2
- package/dist/schema/content-refs.d.mts +0 -2
- package/dist/schema/content-refs.mjs +1 -2
- package/dist/schema/design.d.mts +51 -35
- package/dist/schema/design.mjs +2 -2
- package/dist/schema/design.mjs.map +1 -1
- package/dist/schema/insight.d.mts +36 -38
- package/dist/schema/insight.mjs +1 -2
- package/dist/schema/label.d.mts +15 -17
- package/dist/schema/label.mjs +1 -2
- package/dist/schema/member.d.mts +7 -9
- package/dist/schema/member.mjs +1 -2
- package/dist/schema/notification.d.mts +20 -22
- package/dist/schema/notification.mjs +1 -2
- package/dist/schema/project-group-mapping.d.mts +6 -8
- package/dist/schema/project-group-mapping.mjs +1 -2
- package/dist/schema/project.d.mts +0 -2
- package/dist/schema/project.mjs +1 -2
- package/dist/schema/site-setting.d.mts +0 -2
- package/dist/schema/site-setting.mjs +1 -2
- package/dist/schema/snapshot.d.mts +85 -33
- package/dist/schema/snapshot.mjs +4 -2
- package/dist/schema/snapshot.mjs.map +1 -1
- package/dist/schema/token.d.mts +8 -10
- package/dist/schema/token.mjs +1 -2
- package/dist/schema/usage.d.mts +15 -17
- package/dist/schema/usage.mjs +1 -2
- package/dist/schema/user-invite.d.mts +7 -9
- package/dist/schema/user-invite.mjs +1 -2
- package/dist/schema/user.d.mts +74 -2
- package/dist/schema/user.mjs +7 -4
- package/dist/schema/user.mjs.map +1 -1
- package/dist/schema/webhook.d.mts +8 -10
- package/dist/schema/webhook.mjs +1 -2
- package/dist/schema.d.mts +0 -2
- package/dist/schema.mjs +1 -2
- package/dist/vercel.d.mts +0 -2
- package/dist/vercel.mjs +2 -3
- package/package.json +4 -13
|
@@ -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,7 +175,7 @@ declare const comments: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
176
175
|
identity: undefined;
|
|
177
176
|
generated: undefined;
|
|
178
177
|
}, {}, {}>;
|
|
179
|
-
storyId: import("drizzle-orm/pg-core").PgColumn<{
|
|
178
|
+
storyId: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
180
179
|
name: "story_id";
|
|
181
180
|
tableName: "comments";
|
|
182
181
|
dataType: "string";
|
|
@@ -210,6 +209,5 @@ interface Comment {
|
|
|
210
209
|
updatedAt: string;
|
|
211
210
|
storyId: string | null;
|
|
212
211
|
}
|
|
213
|
-
//#endregion
|
|
214
212
|
export { Comment, comments };
|
|
215
213
|
//# sourceMappingURL=comment.d.mts.map
|
package/dist/schema/comment.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { builds } from "./build.mjs";
|
|
|
6
6
|
import { users } from "./user.mjs";
|
|
7
7
|
import { snapshots } from "./snapshot.mjs";
|
|
8
8
|
import { boolean, index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
9
|
-
|
|
9
|
+
// src/schema/comment.ts
|
|
10
10
|
/** Narrow `comments` table definition. */
|
|
11
11
|
const comments = pgTable("comments", {
|
|
12
12
|
id: text("id").primaryKey(),
|
|
@@ -27,7 +27,6 @@ const comments = pgTable("comments", {
|
|
|
27
27
|
}).notNull(),
|
|
28
28
|
storyId: text("story_id")
|
|
29
29
|
}, (t) => [index("comments_build_id_idx").on(t.buildId)]);
|
|
30
|
-
//#endregion
|
|
31
30
|
export { comments };
|
|
32
31
|
|
|
33
32
|
//# sourceMappingURL=comment.mjs.map
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import __tsdown_shims_path from 'node:path';
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
//#region src/schema/connection.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* A user's own OAuth connection to an external service (Figma, later Jira/Linear/…),
|
|
6
5
|
* one per user and service. `tokenEncrypted` is the access token; the refresh token
|
|
7
6
|
* is encrypted too. `status` is `ok` or `expired` (needs reconnecting).
|
|
8
7
|
*/
|
|
9
|
-
declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
8
|
+
declare const userConnections: import("drizzle-orm/pg-core/table.js").PgTableWithColumns<{
|
|
10
9
|
name: "user_connections";
|
|
11
10
|
schema: undefined;
|
|
12
11
|
columns: {
|
|
13
|
-
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
12
|
+
id: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
14
13
|
name: "id";
|
|
15
14
|
tableName: "user_connections";
|
|
16
15
|
dataType: "string";
|
|
@@ -27,7 +26,7 @@ declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<
|
|
|
27
26
|
identity: undefined;
|
|
28
27
|
generated: undefined;
|
|
29
28
|
}, {}, {}>;
|
|
30
|
-
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
29
|
+
userId: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
31
30
|
name: "user_id";
|
|
32
31
|
tableName: "user_connections";
|
|
33
32
|
dataType: "string";
|
|
@@ -44,7 +43,7 @@ declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<
|
|
|
44
43
|
identity: undefined;
|
|
45
44
|
generated: undefined;
|
|
46
45
|
}, {}, {}>;
|
|
47
|
-
service: import("drizzle-orm/pg-core").PgColumn<{
|
|
46
|
+
service: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
48
47
|
name: "service";
|
|
49
48
|
tableName: "user_connections";
|
|
50
49
|
dataType: "string";
|
|
@@ -61,7 +60,7 @@ declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<
|
|
|
61
60
|
identity: undefined;
|
|
62
61
|
generated: undefined;
|
|
63
62
|
}, {}, {}>;
|
|
64
|
-
tokenEncrypted: import("drizzle-orm/pg-core").PgColumn<{
|
|
63
|
+
tokenEncrypted: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
65
64
|
name: "token_encrypted";
|
|
66
65
|
tableName: "user_connections";
|
|
67
66
|
dataType: "string";
|
|
@@ -78,7 +77,7 @@ declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<
|
|
|
78
77
|
identity: undefined;
|
|
79
78
|
generated: undefined;
|
|
80
79
|
}, {}, {}>;
|
|
81
|
-
refreshTokenEncrypted: import("drizzle-orm/pg-core").PgColumn<{
|
|
80
|
+
refreshTokenEncrypted: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
82
81
|
name: "refresh_token_encrypted";
|
|
83
82
|
tableName: "user_connections";
|
|
84
83
|
dataType: "string";
|
|
@@ -95,7 +94,7 @@ declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<
|
|
|
95
94
|
identity: undefined;
|
|
96
95
|
generated: undefined;
|
|
97
96
|
}, {}, {}>;
|
|
98
|
-
expiresAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
97
|
+
expiresAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
99
98
|
name: "expires_at";
|
|
100
99
|
tableName: "user_connections";
|
|
101
100
|
dataType: "string";
|
|
@@ -112,7 +111,7 @@ declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<
|
|
|
112
111
|
identity: undefined;
|
|
113
112
|
generated: undefined;
|
|
114
113
|
}, {}, {}>;
|
|
115
|
-
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
114
|
+
status: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
116
115
|
name: "status";
|
|
117
116
|
tableName: "user_connections";
|
|
118
117
|
dataType: "string";
|
|
@@ -129,7 +128,7 @@ declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<
|
|
|
129
128
|
identity: undefined;
|
|
130
129
|
generated: undefined;
|
|
131
130
|
}, {}, {}>;
|
|
132
|
-
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
131
|
+
createdAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
133
132
|
name: "created_at";
|
|
134
133
|
tableName: "user_connections";
|
|
135
134
|
dataType: "string";
|
|
@@ -146,7 +145,7 @@ declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<
|
|
|
146
145
|
identity: undefined;
|
|
147
146
|
generated: undefined;
|
|
148
147
|
}, {}, {}>;
|
|
149
|
-
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
148
|
+
updatedAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
150
149
|
name: "updated_at";
|
|
151
150
|
tableName: "user_connections";
|
|
152
151
|
dataType: "string";
|
|
@@ -168,6 +167,5 @@ declare const userConnections: import("drizzle-orm/pg-core").PgTableWithColumns<
|
|
|
168
167
|
}>;
|
|
169
168
|
/** Row type of `user_connections`. */
|
|
170
169
|
type UserConnection = typeof userConnections.$inferSelect;
|
|
171
|
-
//#endregion
|
|
172
170
|
export { UserConnection, userConnections };
|
|
173
171
|
//# sourceMappingURL=connection.d.mts.map
|
|
@@ -3,7 +3,7 @@ import "node:url";
|
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { users } from "./user.mjs";
|
|
5
5
|
import { pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
|
6
|
-
|
|
6
|
+
// src/schema/connection.ts
|
|
7
7
|
/**
|
|
8
8
|
* A user's own OAuth connection to an external service (Figma, later Jira/Linear/…),
|
|
9
9
|
* one per user and service. `tokenEncrypted` is the access token; the refresh token
|
|
@@ -29,7 +29,6 @@ const userConnections = pgTable("user_connections", {
|
|
|
29
29
|
mode: "string"
|
|
30
30
|
}).notNull()
|
|
31
31
|
}, (t) => [uniqueIndex("user_connections_user_service_idx").on(t.userId, t.service)]);
|
|
32
|
-
//#endregion
|
|
33
32
|
export { userConnections };
|
|
34
33
|
|
|
35
34
|
//# sourceMappingURL=connection.mjs.map
|
|
@@ -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
|
-
|
|
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
|
package/dist/schema/design.d.mts
CHANGED
|
@@ -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/design.d.ts
|
|
4
3
|
/** Narrow `design_links` table definition. */
|
|
5
|
-
declare const designLinks: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
|
+
declare const designLinks: import("drizzle-orm/pg-core/table.js").PgTableWithColumns<{
|
|
6
5
|
name: "design_links";
|
|
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: "design_links";
|
|
12
11
|
dataType: "string";
|
|
@@ -23,7 +22,7 @@ declare const designLinks: 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: "design_links";
|
|
29
28
|
dataType: "string";
|
|
@@ -40,7 +39,7 @@ declare const designLinks: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
40
39
|
identity: undefined;
|
|
41
40
|
generated: undefined;
|
|
42
41
|
}, {}, {}>;
|
|
43
|
-
importPath: import("drizzle-orm/pg-core").PgColumn<{
|
|
42
|
+
importPath: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
44
43
|
name: "import_path";
|
|
45
44
|
tableName: "design_links";
|
|
46
45
|
dataType: "string";
|
|
@@ -57,7 +56,7 @@ declare const designLinks: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
57
56
|
identity: undefined;
|
|
58
57
|
generated: undefined;
|
|
59
58
|
}, {}, {}>;
|
|
60
|
-
label: import("drizzle-orm/pg-core").PgColumn<{
|
|
59
|
+
label: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
61
60
|
name: "label";
|
|
62
61
|
tableName: "design_links";
|
|
63
62
|
dataType: "string";
|
|
@@ -74,7 +73,7 @@ declare const designLinks: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
74
73
|
identity: undefined;
|
|
75
74
|
generated: undefined;
|
|
76
75
|
}, {}, {}>;
|
|
77
|
-
url: import("drizzle-orm/pg-core").PgColumn<{
|
|
76
|
+
url: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
78
77
|
name: "url";
|
|
79
78
|
tableName: "design_links";
|
|
80
79
|
dataType: "string";
|
|
@@ -91,7 +90,7 @@ declare const designLinks: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
91
90
|
identity: undefined;
|
|
92
91
|
generated: undefined;
|
|
93
92
|
}, {}, {}>;
|
|
94
|
-
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
93
|
+
createdAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
95
94
|
name: "created_at";
|
|
96
95
|
tableName: "design_links";
|
|
97
96
|
dataType: "string";
|
|
@@ -108,7 +107,7 @@ declare const designLinks: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
108
107
|
identity: undefined;
|
|
109
108
|
generated: undefined;
|
|
110
109
|
}, {}, {}>;
|
|
111
|
-
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
110
|
+
updatedAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
112
111
|
name: "updated_at";
|
|
113
112
|
tableName: "design_links";
|
|
114
113
|
dataType: "string";
|
|
@@ -129,11 +128,11 @@ declare const designLinks: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
129
128
|
dialect: 'pg';
|
|
130
129
|
}>;
|
|
131
130
|
/** Narrow `design_credentials` table definition: the project-wide design-provider token. */
|
|
132
|
-
declare const designCredentials: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
131
|
+
declare const designCredentials: import("drizzle-orm/pg-core/table.js").PgTableWithColumns<{
|
|
133
132
|
name: "design_credentials";
|
|
134
133
|
schema: undefined;
|
|
135
134
|
columns: {
|
|
136
|
-
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
135
|
+
id: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
137
136
|
name: "id";
|
|
138
137
|
tableName: "design_credentials";
|
|
139
138
|
dataType: "string";
|
|
@@ -150,7 +149,7 @@ declare const designCredentials: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
150
149
|
identity: undefined;
|
|
151
150
|
generated: undefined;
|
|
152
151
|
}, {}, {}>;
|
|
153
|
-
projectId: import("drizzle-orm/pg-core").PgColumn<{
|
|
152
|
+
projectId: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
154
153
|
name: "project_id";
|
|
155
154
|
tableName: "design_credentials";
|
|
156
155
|
dataType: "string";
|
|
@@ -167,7 +166,7 @@ declare const designCredentials: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
167
166
|
identity: undefined;
|
|
168
167
|
generated: undefined;
|
|
169
168
|
}, {}, {}>;
|
|
170
|
-
provider: import("drizzle-orm/pg-core").PgColumn<{
|
|
169
|
+
provider: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
171
170
|
name: "provider";
|
|
172
171
|
tableName: "design_credentials";
|
|
173
172
|
dataType: "string";
|
|
@@ -184,7 +183,7 @@ declare const designCredentials: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
184
183
|
identity: undefined;
|
|
185
184
|
generated: undefined;
|
|
186
185
|
}, {}, {}>;
|
|
187
|
-
tokenEncrypted: import("drizzle-orm/pg-core").PgColumn<{
|
|
186
|
+
tokenEncrypted: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
188
187
|
name: "token_encrypted";
|
|
189
188
|
tableName: "design_credentials";
|
|
190
189
|
dataType: "string";
|
|
@@ -201,7 +200,7 @@ declare const designCredentials: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
201
200
|
identity: undefined;
|
|
202
201
|
generated: undefined;
|
|
203
202
|
}, {}, {}>;
|
|
204
|
-
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
203
|
+
status: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
205
204
|
name: "status";
|
|
206
205
|
tableName: "design_credentials";
|
|
207
206
|
dataType: "string";
|
|
@@ -218,7 +217,7 @@ declare const designCredentials: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
218
217
|
identity: undefined;
|
|
219
218
|
generated: undefined;
|
|
220
219
|
}, {}, {}>;
|
|
221
|
-
checkedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
220
|
+
checkedAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
222
221
|
name: "checked_at";
|
|
223
222
|
tableName: "design_credentials";
|
|
224
223
|
dataType: "string";
|
|
@@ -235,7 +234,7 @@ declare const designCredentials: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
235
234
|
identity: undefined;
|
|
236
235
|
generated: undefined;
|
|
237
236
|
}, {}, {}>;
|
|
238
|
-
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
237
|
+
createdAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
239
238
|
name: "created_at";
|
|
240
239
|
tableName: "design_credentials";
|
|
241
240
|
dataType: "string";
|
|
@@ -252,7 +251,7 @@ declare const designCredentials: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
252
251
|
identity: undefined;
|
|
253
252
|
generated: undefined;
|
|
254
253
|
}, {}, {}>;
|
|
255
|
-
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
254
|
+
updatedAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
256
255
|
name: "updated_at";
|
|
257
256
|
tableName: "design_credentials";
|
|
258
257
|
dataType: "string";
|
|
@@ -273,11 +272,11 @@ declare const designCredentials: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
273
272
|
dialect: 'pg';
|
|
274
273
|
}>;
|
|
275
274
|
/** Narrow `design_nodes` table definition (design metadata + render cache). */
|
|
276
|
-
declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
275
|
+
declare const designNodes: import("drizzle-orm/pg-core/table.js").PgTableWithColumns<{
|
|
277
276
|
name: "design_nodes";
|
|
278
277
|
schema: undefined;
|
|
279
278
|
columns: {
|
|
280
|
-
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
279
|
+
id: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
281
280
|
name: "id";
|
|
282
281
|
tableName: "design_nodes";
|
|
283
282
|
dataType: "string";
|
|
@@ -294,7 +293,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
294
293
|
identity: undefined;
|
|
295
294
|
generated: undefined;
|
|
296
295
|
}, {}, {}>;
|
|
297
|
-
projectId: import("drizzle-orm/pg-core").PgColumn<{
|
|
296
|
+
projectId: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
298
297
|
name: "project_id";
|
|
299
298
|
tableName: "design_nodes";
|
|
300
299
|
dataType: "string";
|
|
@@ -311,7 +310,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
311
310
|
identity: undefined;
|
|
312
311
|
generated: undefined;
|
|
313
312
|
}, {}, {}>;
|
|
314
|
-
provider: import("drizzle-orm/pg-core").PgColumn<{
|
|
313
|
+
provider: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
315
314
|
name: "provider";
|
|
316
315
|
tableName: "design_nodes";
|
|
317
316
|
dataType: "string";
|
|
@@ -328,7 +327,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
328
327
|
identity: undefined;
|
|
329
328
|
generated: undefined;
|
|
330
329
|
}, {}, {}>;
|
|
331
|
-
viewerId: import("drizzle-orm/pg-core").PgColumn<{
|
|
330
|
+
viewerId: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
332
331
|
name: "viewer_id";
|
|
333
332
|
tableName: "design_nodes";
|
|
334
333
|
dataType: "string";
|
|
@@ -345,7 +344,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
345
344
|
identity: undefined;
|
|
346
345
|
generated: undefined;
|
|
347
346
|
}, {}, {}>;
|
|
348
|
-
fileKey: import("drizzle-orm/pg-core").PgColumn<{
|
|
347
|
+
fileKey: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
349
348
|
name: "file_key";
|
|
350
349
|
tableName: "design_nodes";
|
|
351
350
|
dataType: "string";
|
|
@@ -362,7 +361,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
362
361
|
identity: undefined;
|
|
363
362
|
generated: undefined;
|
|
364
363
|
}, {}, {}>;
|
|
365
|
-
nodeId: import("drizzle-orm/pg-core").PgColumn<{
|
|
364
|
+
nodeId: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
366
365
|
name: "node_id";
|
|
367
366
|
tableName: "design_nodes";
|
|
368
367
|
dataType: "string";
|
|
@@ -379,7 +378,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
379
378
|
identity: undefined;
|
|
380
379
|
generated: undefined;
|
|
381
380
|
}, {}, {}>;
|
|
382
|
-
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
381
|
+
name: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
383
382
|
name: "name";
|
|
384
383
|
tableName: "design_nodes";
|
|
385
384
|
dataType: "string";
|
|
@@ -396,7 +395,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
396
395
|
identity: undefined;
|
|
397
396
|
generated: undefined;
|
|
398
397
|
}, {}, {}>;
|
|
399
|
-
version: import("drizzle-orm/pg-core").PgColumn<{
|
|
398
|
+
version: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
400
399
|
name: "version";
|
|
401
400
|
tableName: "design_nodes";
|
|
402
401
|
dataType: "string";
|
|
@@ -413,7 +412,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
413
412
|
identity: undefined;
|
|
414
413
|
generated: undefined;
|
|
415
414
|
}, {}, {}>;
|
|
416
|
-
lastModified: import("drizzle-orm/pg-core").PgColumn<{
|
|
415
|
+
lastModified: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
417
416
|
name: "last_modified";
|
|
418
417
|
tableName: "design_nodes";
|
|
419
418
|
dataType: "string";
|
|
@@ -430,7 +429,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
430
429
|
identity: undefined;
|
|
431
430
|
generated: undefined;
|
|
432
431
|
}, {}, {}>;
|
|
433
|
-
state: import("drizzle-orm/pg-core").PgColumn<{
|
|
432
|
+
state: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
434
433
|
name: "state";
|
|
435
434
|
tableName: "design_nodes";
|
|
436
435
|
dataType: "string";
|
|
@@ -447,7 +446,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
447
446
|
identity: undefined;
|
|
448
447
|
generated: undefined;
|
|
449
448
|
}, {}, {}>;
|
|
450
|
-
renderPath: import("drizzle-orm/pg-core").PgColumn<{
|
|
449
|
+
renderPath: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
451
450
|
name: "render_path";
|
|
452
451
|
tableName: "design_nodes";
|
|
453
452
|
dataType: "string";
|
|
@@ -464,7 +463,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
464
463
|
identity: undefined;
|
|
465
464
|
generated: undefined;
|
|
466
465
|
}, {}, {}>;
|
|
467
|
-
renderVersion: import("drizzle-orm/pg-core").PgColumn<{
|
|
466
|
+
renderVersion: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
468
467
|
name: "render_version";
|
|
469
468
|
tableName: "design_nodes";
|
|
470
469
|
dataType: "string";
|
|
@@ -481,7 +480,24 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
481
480
|
identity: undefined;
|
|
482
481
|
generated: undefined;
|
|
483
482
|
}, {}, {}>;
|
|
484
|
-
|
|
483
|
+
notifiedVersion: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
484
|
+
name: "notified_version";
|
|
485
|
+
tableName: "design_nodes";
|
|
486
|
+
dataType: "string";
|
|
487
|
+
columnType: "PgText";
|
|
488
|
+
data: string;
|
|
489
|
+
driverParam: string;
|
|
490
|
+
notNull: false;
|
|
491
|
+
hasDefault: false;
|
|
492
|
+
isPrimaryKey: false;
|
|
493
|
+
isAutoincrement: false;
|
|
494
|
+
hasRuntimeDefault: false;
|
|
495
|
+
enumValues: [string, ...string[]];
|
|
496
|
+
baseColumn: never;
|
|
497
|
+
identity: undefined;
|
|
498
|
+
generated: undefined;
|
|
499
|
+
}, {}, {}>;
|
|
500
|
+
fetchedAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
485
501
|
name: "fetched_at";
|
|
486
502
|
tableName: "design_nodes";
|
|
487
503
|
dataType: "string";
|
|
@@ -498,7 +514,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
498
514
|
identity: undefined;
|
|
499
515
|
generated: undefined;
|
|
500
516
|
}, {}, {}>;
|
|
501
|
-
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
517
|
+
createdAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
502
518
|
name: "created_at";
|
|
503
519
|
tableName: "design_nodes";
|
|
504
520
|
dataType: "string";
|
|
@@ -515,7 +531,7 @@ declare const designNodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
515
531
|
identity: undefined;
|
|
516
532
|
generated: undefined;
|
|
517
533
|
}, {}, {}>;
|
|
518
|
-
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
534
|
+
updatedAt: import("drizzle-orm/pg-core/index.js").PgColumn<{
|
|
519
535
|
name: "updated_at";
|
|
520
536
|
tableName: "design_nodes";
|
|
521
537
|
dataType: "string";
|
|
@@ -580,10 +596,10 @@ interface DesignNode {
|
|
|
580
596
|
renderPath: string | null;
|
|
581
597
|
/** File `version` the cached render was taken at. */
|
|
582
598
|
renderVersion: string | null;
|
|
599
|
+
notifiedVersion: string | null;
|
|
583
600
|
fetchedAt: string;
|
|
584
601
|
createdAt: string;
|
|
585
602
|
updatedAt: string;
|
|
586
603
|
}
|
|
587
|
-
//#endregion
|
|
588
604
|
export { DesignCredential, DesignLink, DesignNode, designCredentials, designLinks, designNodes };
|
|
589
605
|
//# sourceMappingURL=design.d.mts.map
|
package/dist/schema/design.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import "node:url";
|
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { projects } from "./project.mjs";
|
|
5
5
|
import { index, pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
|
6
|
-
|
|
6
|
+
// src/schema/design.ts
|
|
7
7
|
/** Narrow `design_links` table definition. */
|
|
8
8
|
const designLinks = pgTable("design_links", {
|
|
9
9
|
id: text("id").primaryKey(),
|
|
@@ -54,6 +54,7 @@ const designNodes = pgTable("design_nodes", {
|
|
|
54
54
|
state: text("state").notNull().default("ok"),
|
|
55
55
|
renderPath: text("render_path"),
|
|
56
56
|
renderVersion: text("render_version"),
|
|
57
|
+
notifiedVersion: text("notified_version"),
|
|
57
58
|
fetchedAt: timestamp("fetched_at", {
|
|
58
59
|
withTimezone: true,
|
|
59
60
|
mode: "string"
|
|
@@ -67,7 +68,6 @@ const designNodes = pgTable("design_nodes", {
|
|
|
67
68
|
mode: "string"
|
|
68
69
|
}).notNull()
|
|
69
70
|
}, (t) => [uniqueIndex("design_nodes_project_file_node_idx").on(t.projectId, t.provider, t.viewerId, t.fileKey, t.nodeId)]);
|
|
70
|
-
//#endregion
|
|
71
71
|
export { designCredentials, designLinks, designNodes };
|
|
72
72
|
|
|
73
73
|
//# sourceMappingURL=design.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design.mjs","names":[],"sources":["../../src/schema/design.ts"],"sourcesContent":["import { index, pgTable, text, timestamp, uniqueIndex } from \"drizzle-orm/pg-core\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `design_links` table definition. */\nexport const designLinks = pgTable(\n \"design_links\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n importPath: text(\"import_path\"),\n label: text(\"label\"),\n url: text(\"url\").notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n },\n (t) => [\n index(\"design_links_project_id_idx\").on(t.projectId),\n // One mapping per story file; project-level links (null import_path) never collide.\n uniqueIndex(\"design_links_project_import_path_idx\").on(t.projectId, t.importPath),\n ],\n);\n\n/** Narrow `design_credentials` table definition: the project-wide design-provider token. */\nexport const designCredentials = pgTable(\n \"design_credentials\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n provider: text(\"provider\").notNull(),\n tokenEncrypted: text(\"token_encrypted\").notNull(),\n status: text(\"status\").notNull().default(\"unknown\"),\n checkedAt: timestamp(\"checked_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) => [uniqueIndex(\"design_credentials_project_provider_idx\").on(t.projectId, t.provider)],\n);\n\n/** Narrow `design_nodes` table definition (design metadata + render cache). */\nexport const designNodes = pgTable(\n \"design_nodes\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n provider: text(\"provider\").notNull(),\n viewerId: text(\"viewer_id\").notNull().default(\"\"),\n fileKey: text(\"file_key\").notNull(),\n nodeId: text(\"node_id\").notNull().default(\"\"),\n name: text(\"name\"),\n version: text(\"version\"),\n lastModified: text(\"last_modified\"),\n state: text(\"state\").notNull().default(\"ok\"),\n renderPath: text(\"render_path\"),\n renderVersion: text(\"render_version\"),\n fetchedAt: timestamp(\"fetched_at\", { withTimezone: true, mode: \"string\" }).notNull(),\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(\"design_nodes_project_file_node_idx\").on(\n t.projectId,\n t.provider,\n t.viewerId,\n t.fileKey,\n t.nodeId,\n ),\n ],\n);\n\n/** A design link: a project-level file link (`importPath` null) or a component mapping override. */\nexport interface DesignLink {\n id: string;\n projectId: string;\n /** Story file the URL is mapped to; null for a project-level design file link. */\n importPath: string | null;\n /** Display label of a project-level link. */\n label: string | null;\n url: string;\n createdAt: string;\n updatedAt: string;\n}\n\n/** The project-wide token of a design provider (an admin pastes it; encrypted at rest). */\nexport interface DesignCredential {\n id: string;\n projectId: string;\n /** Provider `metadata.kind`, e.g. `figma`. */\n provider: string;\n tokenEncrypted: string;\n /** Last API outcome: `unknown` | `ok` | `unauthorized` | `forbidden`. */\n status: string;\n checkedAt: string | null;\n /** When the credential was set or replaced; drives the rotation clock. */\n createdAt: string;\n updatedAt: string;\n}\n\n/** Cached design file/node metadata, keyed by project, provider, viewer, file key and node id. */\nexport interface DesignNode {\n id: string;\n projectId: string;\n provider: string;\n /** Whose access fetched the entry: `\"\"` for the project credential, else a user id. */\n viewerId: string;\n fileKey: string;\n /** Provider node id; empty string for a whole-file link. */\n nodeId: string;\n name: string | null;\n version: string | null;\n lastModified: string | null;\n /** `ok` | `deleted` | `unauthorized` | `forbidden`. */\n state: string;\n /** Storage path of the cached PNG render (node links only). */\n renderPath: string | null;\n /** File `version` the cached render was taken at. */\n renderVersion: string | null;\n fetchedAt: string;\n createdAt: string;\n updatedAt: string;\n}\n"],"m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GA,MAAa,cAAc,QACzB,gBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,UAAU,KAAK,UAAU,CAAC,CAAC,QAAQ;CACnC,UAAU,KAAK,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE;CAChD,SAAS,KAAK,UAAU,CAAC,CAAC,QAAQ;CAClC,QAAQ,KAAK,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE;CAC5C,MAAM,KAAK,MAAM;CACjB,SAAS,KAAK,SAAS;CACvB,cAAc,KAAK,eAAe;CAClC,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,IAAI;CAC3C,YAAY,KAAK,aAAa;CAC9B,eAAe,KAAK,gBAAgB;CACpC,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,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;AACrF,IACC,MAAM,CACL,YAAY,oCAAoC,CAAC,CAAC,GAChD,EAAE,WACF,EAAE,UACF,EAAE,UACF,EAAE,SACF,EAAE,MACJ,CACF,CACF"}
|
|
1
|
+
{"version":3,"file":"design.mjs","names":[],"sources":["../../src/schema/design.ts"],"sourcesContent":["import { index, pgTable, text, timestamp, uniqueIndex } from \"drizzle-orm/pg-core\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `design_links` table definition. */\nexport const designLinks = pgTable(\n \"design_links\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n importPath: text(\"import_path\"),\n label: text(\"label\"),\n url: text(\"url\").notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n },\n (t) => [\n index(\"design_links_project_id_idx\").on(t.projectId),\n // One mapping per story file; project-level links (null import_path) never collide.\n uniqueIndex(\"design_links_project_import_path_idx\").on(t.projectId, t.importPath),\n ],\n);\n\n/** Narrow `design_credentials` table definition: the project-wide design-provider token. */\nexport const designCredentials = pgTable(\n \"design_credentials\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n provider: text(\"provider\").notNull(),\n tokenEncrypted: text(\"token_encrypted\").notNull(),\n status: text(\"status\").notNull().default(\"unknown\"),\n checkedAt: timestamp(\"checked_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) => [uniqueIndex(\"design_credentials_project_provider_idx\").on(t.projectId, t.provider)],\n);\n\n/** Narrow `design_nodes` table definition (design metadata + render cache). */\nexport const designNodes = pgTable(\n \"design_nodes\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n provider: text(\"provider\").notNull(),\n viewerId: text(\"viewer_id\").notNull().default(\"\"),\n fileKey: text(\"file_key\").notNull(),\n nodeId: text(\"node_id\").notNull().default(\"\"),\n name: text(\"name\"),\n version: text(\"version\"),\n lastModified: text(\"last_modified\"),\n state: text(\"state\").notNull().default(\"ok\"),\n renderPath: text(\"render_path\"),\n renderVersion: text(\"render_version\"),\n notifiedVersion: text(\"notified_version\"),\n fetchedAt: timestamp(\"fetched_at\", { withTimezone: true, mode: \"string\" }).notNull(),\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(\"design_nodes_project_file_node_idx\").on(\n t.projectId,\n t.provider,\n t.viewerId,\n t.fileKey,\n t.nodeId,\n ),\n ],\n);\n\n/** A design link: a project-level file link (`importPath` null) or a component mapping override. */\nexport interface DesignLink {\n id: string;\n projectId: string;\n /** Story file the URL is mapped to; null for a project-level design file link. */\n importPath: string | null;\n /** Display label of a project-level link. */\n label: string | null;\n url: string;\n createdAt: string;\n updatedAt: string;\n}\n\n/** The project-wide token of a design provider (an admin pastes it; encrypted at rest). */\nexport interface DesignCredential {\n id: string;\n projectId: string;\n /** Provider `metadata.kind`, e.g. `figma`. */\n provider: string;\n tokenEncrypted: string;\n /** Last API outcome: `unknown` | `ok` | `unauthorized` | `forbidden`. */\n status: string;\n checkedAt: string | null;\n /** When the credential was set or replaced; drives the rotation clock. */\n createdAt: string;\n updatedAt: string;\n}\n\n/** Cached design file/node metadata, keyed by project, provider, viewer, file key and node id. */\nexport interface DesignNode {\n id: string;\n projectId: string;\n provider: string;\n /** Whose access fetched the entry: `\"\"` for the project credential, else a user id. */\n viewerId: string;\n fileKey: string;\n /** Provider node id; empty string for a whole-file link. */\n nodeId: string;\n name: string | null;\n version: string | null;\n lastModified: string | null;\n /** `ok` | `deleted` | `unauthorized` | `forbidden`. */\n state: string;\n /** Storage path of the cached PNG render (node links only). */\n renderPath: string | null;\n /** File `version` the cached render was taken at. */\n renderVersion: string | null;\n notifiedVersion: string | null;\n fetchedAt: string;\n createdAt: string;\n updatedAt: string;\n}\n"],"mappings":";;;;;;;AAIA,MAAa,cAAc,QACzB,gBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,YAAY,KAAK,aA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