@storyshelf/db-mysql 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/ddl.d.mts +1 -1
- package/dist/ddl.mjs +381 -138
- package/dist/ddl.mjs.map +1 -1
- package/dist/drizzle-factory-mysql.mjs +7 -1
- package/dist/drizzle-factory-mysql.mjs.map +1 -1
- package/dist/foreign-keys.mjs +339 -0
- package/dist/foreign-keys.mjs.map +1 -0
- package/dist/index.mjs +10 -5
- package/dist/index.mjs.map +1 -1
- package/dist/migrate.mjs +300 -72
- package/dist/migrate.mjs.map +1 -1
- package/dist/schema/baseline.d.mts +60 -6
- package/dist/schema/baseline.mjs +6 -2
- package/dist/schema/baseline.mjs.map +1 -1
- package/dist/schema/{status-config.d.mts → build-component.d.mts} +46 -39
- package/dist/schema/build-component.mjs +26 -0
- package/dist/schema/build-component.mjs.map +1 -0
- package/dist/schema/build-review.d.mts +118 -0
- package/dist/schema/build-review.mjs +24 -0
- package/dist/schema/build-review.mjs.map +1 -0
- package/dist/schema/build.d.mts +44 -8
- package/dist/schema/build.mjs +5 -1
- package/dist/schema/build.mjs.map +1 -1
- package/dist/schema/capture-attempt.d.mts +18 -18
- package/dist/schema/capture-attempt.mjs +2 -1
- package/dist/schema/capture-attempt.mjs.map +1 -1
- package/dist/schema/capture-job.d.mts +330 -0
- package/dist/schema/capture-job.mjs +57 -0
- package/dist/schema/capture-job.mjs.map +1 -0
- package/dist/schema/capture-shard.d.mts +257 -0
- package/dist/schema/capture-shard.mjs +41 -0
- package/dist/schema/capture-shard.mjs.map +1 -0
- package/dist/schema/comment.d.mts +24 -6
- package/dist/schema/comment.mjs +5 -3
- package/dist/schema/comment.mjs.map +1 -1
- package/dist/schema/connection.d.mts +173 -0
- package/dist/schema/connection.mjs +36 -0
- package/dist/schema/connection.mjs.map +1 -0
- package/dist/schema/content-refs.d.mts +6 -6
- package/dist/schema/content-refs.mjs +2 -1
- package/dist/schema/content-refs.mjs.map +1 -1
- package/dist/schema/datetime.mjs +47 -0
- package/dist/schema/datetime.mjs.map +1 -0
- package/dist/schema/design.d.mts +589 -0
- package/dist/schema/design.mjs +74 -0
- package/dist/schema/design.mjs.map +1 -0
- package/dist/schema/insight.d.mts +633 -0
- package/dist/schema/insight.mjs +69 -0
- package/dist/schema/insight.mjs.map +1 -0
- package/dist/schema/label.d.mts +6 -6
- package/dist/schema/label.mjs +2 -1
- package/dist/schema/label.mjs.map +1 -1
- package/dist/schema/member.d.mts +3 -3
- package/dist/schema/member.mjs +2 -1
- package/dist/schema/member.mjs.map +1 -1
- package/dist/schema/notification.d.mts +45 -9
- package/dist/schema/notification.mjs +7 -1
- package/dist/schema/notification.mjs.map +1 -1
- package/dist/schema/project-group-mapping.d.mts +3 -3
- package/dist/schema/project-group-mapping.mjs +2 -1
- package/dist/schema/project-group-mapping.mjs.map +1 -1
- package/dist/schema/project.d.mts +132 -6
- package/dist/schema/project.mjs +10 -2
- package/dist/schema/project.mjs.map +1 -1
- package/dist/schema/site-setting.d.mts +99 -0
- package/dist/schema/site-setting.mjs +24 -0
- package/dist/schema/site-setting.mjs.map +1 -0
- package/dist/schema/snapshot.d.mts +117 -9
- package/dist/schema/snapshot.mjs +13 -2
- package/dist/schema/snapshot.mjs.map +1 -1
- package/dist/schema/token.d.mts +6 -6
- package/dist/schema/token.mjs +2 -1
- package/dist/schema/token.mjs.map +1 -1
- package/dist/schema/usage.d.mts +267 -0
- package/dist/schema/usage.mjs +37 -0
- package/dist/schema/usage.mjs.map +1 -0
- package/dist/schema/user-invite.d.mts +9 -9
- package/dist/schema/user-invite.mjs +2 -1
- package/dist/schema/user-invite.mjs.map +1 -1
- package/dist/schema/user.d.mts +6 -6
- package/dist/schema/user.mjs +2 -1
- package/dist/schema/user.mjs.map +1 -1
- package/dist/schema/webhook.d.mts +6 -6
- package/dist/schema/webhook.mjs +2 -1
- package/dist/schema/webhook.mjs.map +1 -1
- package/dist/schema.d.mts +24 -3
- package/dist/schema.mjs +25 -4
- package/dist/schema.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/schema/status-config.mjs +0 -26
- package/dist/schema/status-config.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-invite.mjs","names":[],"sources":["../../src/schema/user-invite.ts"],"sourcesContent":["import { mysqlTable, text
|
|
1
|
+
{"version":3,"file":"user-invite.mjs","names":[],"sources":["../../src/schema/user-invite.ts"],"sourcesContent":["import { mysqlTable, text } from \"drizzle-orm/mysql-core\";\nimport { datetime } from \"./datetime.ts\";\nimport { users } from \"./user.ts\";\n\n/** Invite token for local accounts (one-time, hashed at rest). */\nexport const userInviteTokens = mysqlTable(\"user_invite_tokens\", {\n id: text(\"id\").primaryKey(),\n userId: text(\"user_id\")\n .notNull()\n .references(() => users.id, { onDelete: \"cascade\" }),\n tokenHash: text(\"token_hash\").notNull().unique(),\n expiresAt: datetime(\"expires_at\", { mode: \"string\", fsp: 3 }).notNull(),\n usedAt: datetime(\"used_at\", { mode: \"string\", fsp: 3 }),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n});\n\n/** A user invite token row. */\nexport interface UserInviteToken {\n id: string;\n userId: string;\n tokenHash: string;\n expiresAt: string;\n usedAt: string | null;\n createdAt: string;\n}\n"],"mappings":";;;;;;;;AAKA,MAAa,mBAAmB,WAAW,sBAAsB;CAC/D,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,QAAQ,KAAK,SAAS,CAAC,CACpB,QAAQ,CAAC,CACT,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CACrD,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO;CAC/C,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACtE,QAAQ,SAAS,WAAW;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC;CACtD,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,CAAC"}
|
package/dist/schema/user.d.mts
CHANGED
|
@@ -97,10 +97,10 @@ declare const users: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
97
97
|
lastLoginAt: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
98
98
|
name: "last_login_at";
|
|
99
99
|
tableName: "users";
|
|
100
|
-
dataType: "
|
|
101
|
-
columnType: "
|
|
100
|
+
dataType: "custom";
|
|
101
|
+
columnType: "MySqlCustomColumn";
|
|
102
102
|
data: string;
|
|
103
|
-
driverParam: string
|
|
103
|
+
driverParam: string;
|
|
104
104
|
notNull: false;
|
|
105
105
|
hasDefault: false;
|
|
106
106
|
isPrimaryKey: false;
|
|
@@ -114,10 +114,10 @@ declare const users: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
114
114
|
createdAt: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
115
115
|
name: "created_at";
|
|
116
116
|
tableName: "users";
|
|
117
|
-
dataType: "
|
|
118
|
-
columnType: "
|
|
117
|
+
dataType: "custom";
|
|
118
|
+
columnType: "MySqlCustomColumn";
|
|
119
119
|
data: string;
|
|
120
|
-
driverParam: string
|
|
120
|
+
driverParam: string;
|
|
121
121
|
notNull: true;
|
|
122
122
|
hasDefault: false;
|
|
123
123
|
isPrimaryKey: false;
|
package/dist/schema/user.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
import { datetime
|
|
4
|
+
import { datetime } from "./datetime.mjs";
|
|
5
|
+
import { mysqlTable, text } from "drizzle-orm/mysql-core";
|
|
5
6
|
//#region src/schema/user.ts
|
|
6
7
|
/** Narrow `users` table definition. */
|
|
7
8
|
const users = mysqlTable("users", {
|
package/dist/schema/user.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.mjs","names":[],"sources":["../../src/schema/user.ts"],"sourcesContent":["import type { SiteRole } from \"@storyshelf/core/types\";\nimport { mysqlTable, text
|
|
1
|
+
{"version":3,"file":"user.mjs","names":[],"sources":["../../src/schema/user.ts"],"sourcesContent":["import type { SiteRole } from \"@storyshelf/core/types\";\nimport { mysqlTable, text } from \"drizzle-orm/mysql-core\";\nimport { datetime } from \"./datetime.ts\";\n\n/** Narrow `users` table definition. */\nexport const users = mysqlTable(\"users\", {\n id: text(\"id\").primaryKey(),\n email: text(\"email\").notNull(),\n name: text(\"name\").notNull(),\n avatarUrl: text(\"avatar_url\"),\n role: text(\"role\").$type<SiteRole>().notNull().default(\"member\"),\n lastLoginAt: datetime(\"last_login_at\", { mode: \"string\", fsp: 3 }),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n});\n\n/** A user row. */\nexport interface User {\n id: string;\n email: string;\n name: string;\n avatarUrl: string | null;\n role: SiteRole;\n lastLoginAt: string | null;\n createdAt: string;\n}\n"],"mappings":";;;;;;;AAKA,MAAa,QAAQ,WAAW,SAAS;CACvC,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ;CAC7B,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,WAAW,KAAK,YAAY;CAC5B,MAAM,KAAK,MAAM,CAAC,CAAC,MAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,QAAQ;CAC/D,aAAa,SAAS,iBAAiB;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC;CACjE,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,CAAC"}
|
|
@@ -94,10 +94,10 @@ declare const webhooks: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
94
94
|
createdAt: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
95
95
|
name: "created_at";
|
|
96
96
|
tableName: "webhooks";
|
|
97
|
-
dataType: "
|
|
98
|
-
columnType: "
|
|
97
|
+
dataType: "custom";
|
|
98
|
+
columnType: "MySqlCustomColumn";
|
|
99
99
|
data: string;
|
|
100
|
-
driverParam: string
|
|
100
|
+
driverParam: string;
|
|
101
101
|
notNull: true;
|
|
102
102
|
hasDefault: false;
|
|
103
103
|
isPrimaryKey: false;
|
|
@@ -111,10 +111,10 @@ declare const webhooks: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
|
111
111
|
updatedAt: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
112
112
|
name: "updated_at";
|
|
113
113
|
tableName: "webhooks";
|
|
114
|
-
dataType: "
|
|
115
|
-
columnType: "
|
|
114
|
+
dataType: "custom";
|
|
115
|
+
columnType: "MySqlCustomColumn";
|
|
116
116
|
data: string;
|
|
117
|
-
driverParam: string
|
|
117
|
+
driverParam: string;
|
|
118
118
|
notNull: true;
|
|
119
119
|
hasDefault: false;
|
|
120
120
|
isPrimaryKey: false;
|
package/dist/schema/webhook.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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
|
-
import {
|
|
6
|
+
import { mysqlTable, text } from "drizzle-orm/mysql-core";
|
|
6
7
|
//#region src/schema/webhook.ts
|
|
7
8
|
/** Narrow `webhooks` table definition. */
|
|
8
9
|
const webhooks = mysqlTable("webhooks", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.mjs","names":[],"sources":["../../src/schema/webhook.ts"],"sourcesContent":["import { mysqlTable, text
|
|
1
|
+
{"version":3,"file":"webhook.mjs","names":[],"sources":["../../src/schema/webhook.ts"],"sourcesContent":["import { mysqlTable, text } from \"drizzle-orm/mysql-core\";\nimport { datetime } from \"./datetime.ts\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `webhooks` table definition. */\nexport const webhooks = mysqlTable(\"webhooks\", {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n url: text(\"url\").notNull(),\n secretEncrypted: text(\"secret_encrypted\").notNull(),\n events: text(\"events\"),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n updatedAt: datetime(\"updated_at\", { mode: \"string\", fsp: 3 }).notNull(),\n});\n\n/** A webhook subscription row. */\nexport interface Webhook {\n id: string;\n projectId: string;\n url: string;\n secretEncrypted: string;\n events: string | null;\n createdAt: string;\n updatedAt: string;\n}\n"],"mappings":";;;;;;;;AAKA,MAAa,WAAW,WAAW,YAAY;CAC7C,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,KAAK,KAAK,KAAK,CAAC,CAAC,QAAQ;CACzB,iBAAiB,KAAK,kBAAkB,CAAC,CAAC,QAAQ;CAClD,QAAQ,KAAK,QAAQ;CACrB,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,CAAC"}
|
package/dist/schema.d.mts
CHANGED
|
@@ -2,18 +2,26 @@ import __tsdown_shims_path from 'node:path';
|
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
3
|
import { Build, builds } from "./schema/build.mjs";
|
|
4
4
|
import { CaptureAttempt, CaptureLog, captureAttempts, captureLogs } from "./schema/capture-attempt.mjs";
|
|
5
|
+
import { captureJobs } from "./schema/capture-job.mjs";
|
|
6
|
+
import { buildComponents } from "./schema/build-component.mjs";
|
|
7
|
+
import { buildReviews } from "./schema/build-review.mjs";
|
|
8
|
+
import { siteSettings } from "./schema/site-setting.mjs";
|
|
9
|
+
import { captureShards } from "./schema/capture-shard.mjs";
|
|
5
10
|
import { Baseline, baselines } from "./schema/baseline.mjs";
|
|
6
11
|
import { Comment, comments } from "./schema/comment.mjs";
|
|
7
12
|
import { BuildLabel, LabelType, buildLabels, labelTypes } from "./schema/label.mjs";
|
|
8
13
|
import { ProjectMember, projectMembers } from "./schema/member.mjs";
|
|
14
|
+
import { BuildPackageUsage, ProjectLink, buildPackageUsage, projectLinks } from "./schema/usage.mjs";
|
|
15
|
+
import { UserConnection, userConnections } from "./schema/connection.mjs";
|
|
16
|
+
import { DesignCredential, DesignLink, DesignNode, designCredentials, designLinks, designNodes } from "./schema/design.mjs";
|
|
9
17
|
import { ProjectGroupMapping, projectGroupMappings } from "./schema/project-group-mapping.mjs";
|
|
10
18
|
import { Project, StorybookMeta, projects } from "./schema/project.mjs";
|
|
11
19
|
import { Snapshot, snapshots } from "./schema/snapshot.mjs";
|
|
12
|
-
import { ProjectStatusConfig, projectStatusConfigs } from "./schema/status-config.mjs";
|
|
13
20
|
import { Token, tokens } from "./schema/token.mjs";
|
|
14
21
|
import { UserInviteToken, userInviteTokens } from "./schema/user-invite.mjs";
|
|
15
22
|
import { User, users } from "./schema/user.mjs";
|
|
16
23
|
import { Webhook, webhooks } from "./schema/webhook.mjs";
|
|
24
|
+
import { AiBudgetAlert, AiUsage, Insight, aiBudgetAlerts, aiUsage, insights } from "./schema/insight.mjs";
|
|
17
25
|
import { NotificationChannel, NotificationSubscription, notificationChannels, notificationSubscriptions } from "./schema/notification.mjs";
|
|
18
26
|
import { ContentRef, contentRefs } from "./schema/content-refs.mjs";
|
|
19
27
|
import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
@@ -21,17 +29,30 @@ import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
|
21
29
|
/** Full Drizzle schema object passed to the database client. */
|
|
22
30
|
declare const schema: {
|
|
23
31
|
projects: AnyMySqlTable;
|
|
24
|
-
projectStatusConfigs: AnyMySqlTable;
|
|
25
32
|
builds: AnyMySqlTable;
|
|
26
33
|
captureAttempts: AnyMySqlTable;
|
|
27
34
|
captureLogs: AnyMySqlTable;
|
|
35
|
+
captureShards: AnyMySqlTable;
|
|
36
|
+
captureJobs: AnyMySqlTable;
|
|
37
|
+
buildComponents: AnyMySqlTable;
|
|
38
|
+
buildReviews: AnyMySqlTable;
|
|
39
|
+
siteSettings: AnyMySqlTable;
|
|
28
40
|
snapshots: AnyMySqlTable;
|
|
29
41
|
baselines: AnyMySqlTable;
|
|
30
42
|
comments: AnyMySqlTable;
|
|
31
43
|
labelTypes: AnyMySqlTable;
|
|
32
44
|
buildLabels: AnyMySqlTable;
|
|
45
|
+
projectLinks: AnyMySqlTable;
|
|
46
|
+
designLinks: AnyMySqlTable;
|
|
47
|
+
designCredentials: AnyMySqlTable;
|
|
48
|
+
userConnections: AnyMySqlTable;
|
|
49
|
+
designNodes: AnyMySqlTable;
|
|
50
|
+
buildPackageUsage: AnyMySqlTable;
|
|
33
51
|
tokens: AnyMySqlTable;
|
|
34
52
|
webhooks: AnyMySqlTable;
|
|
53
|
+
insights: AnyMySqlTable;
|
|
54
|
+
aiUsage: AnyMySqlTable;
|
|
55
|
+
aiBudgetAlerts: AnyMySqlTable;
|
|
35
56
|
notificationChannels: AnyMySqlTable;
|
|
36
57
|
notificationSubscriptions: AnyMySqlTable;
|
|
37
58
|
users: AnyMySqlTable;
|
|
@@ -43,5 +64,5 @@ declare const schema: {
|
|
|
43
64
|
/** The full database schema type. */
|
|
44
65
|
type Schema = typeof schema;
|
|
45
66
|
//#endregion
|
|
46
|
-
export { type Baseline, type Build, type BuildLabel, type CaptureAttempt, type CaptureLog, type Comment, type ContentRef, type LabelType, type NotificationChannel, type NotificationSubscription, type Project, type ProjectGroupMapping, type
|
|
67
|
+
export { type AiBudgetAlert, type AiUsage, type Baseline, type Build, type BuildLabel, type BuildPackageUsage, type CaptureAttempt, type CaptureLog, type Comment, type ContentRef, type DesignCredential, type DesignLink, type DesignNode, type Insight, type LabelType, type NotificationChannel, type NotificationSubscription, type Project, type ProjectGroupMapping, type ProjectLink, type ProjectMember, Schema, type Snapshot, type StorybookMeta, type Token, type User, type UserConnection, type UserInviteToken, type Webhook, aiBudgetAlerts, aiUsage, baselines, buildComponents, buildLabels, buildPackageUsage, buildReviews, builds, captureAttempts, captureJobs, captureLogs, captureShards, comments, contentRefs, designCredentials, designLinks, designNodes, insights, labelTypes, notificationChannels, notificationSubscriptions, projectGroupMappings, projectLinks, projectMembers, projects, schema, siteSettings, snapshots, tokens, userConnections, userInviteTokens, users, webhooks };
|
|
47
68
|
//# sourceMappingURL=schema.d.mts.map
|
package/dist/schema.mjs
CHANGED
|
@@ -4,34 +4,55 @@ import.meta.url;
|
|
|
4
4
|
import { projects } from "./schema/project.mjs";
|
|
5
5
|
import { baselines } from "./schema/baseline.mjs";
|
|
6
6
|
import { builds } from "./schema/build.mjs";
|
|
7
|
+
import { buildComponents } from "./schema/build-component.mjs";
|
|
8
|
+
import { users } from "./schema/user.mjs";
|
|
9
|
+
import { buildReviews } from "./schema/build-review.mjs";
|
|
7
10
|
import { captureAttempts, captureLogs } from "./schema/capture-attempt.mjs";
|
|
11
|
+
import { captureJobs } from "./schema/capture-job.mjs";
|
|
12
|
+
import { captureShards } from "./schema/capture-shard.mjs";
|
|
8
13
|
import { snapshots } from "./schema/snapshot.mjs";
|
|
9
|
-
import { users } from "./schema/user.mjs";
|
|
10
14
|
import { comments } from "./schema/comment.mjs";
|
|
15
|
+
import { userConnections } from "./schema/connection.mjs";
|
|
11
16
|
import { contentRefs } from "./schema/content-refs.mjs";
|
|
17
|
+
import { designCredentials, designLinks, designNodes } from "./schema/design.mjs";
|
|
18
|
+
import { aiBudgetAlerts, aiUsage, insights } from "./schema/insight.mjs";
|
|
12
19
|
import { buildLabels, labelTypes } from "./schema/label.mjs";
|
|
13
20
|
import { projectMembers } from "./schema/member.mjs";
|
|
14
21
|
import { notificationChannels, notificationSubscriptions } from "./schema/notification.mjs";
|
|
15
22
|
import { projectGroupMappings } from "./schema/project-group-mapping.mjs";
|
|
16
|
-
import {
|
|
23
|
+
import { siteSettings } from "./schema/site-setting.mjs";
|
|
17
24
|
import { tokens } from "./schema/token.mjs";
|
|
25
|
+
import { buildPackageUsage, projectLinks } from "./schema/usage.mjs";
|
|
18
26
|
import { userInviteTokens } from "./schema/user-invite.mjs";
|
|
19
27
|
import { webhooks } from "./schema/webhook.mjs";
|
|
20
28
|
//#region src/schema/index.ts
|
|
21
29
|
/** Full Drizzle schema object passed to the database client. */
|
|
22
30
|
const schema = {
|
|
23
31
|
projects,
|
|
24
|
-
projectStatusConfigs,
|
|
25
32
|
builds,
|
|
26
33
|
captureAttempts,
|
|
27
34
|
captureLogs,
|
|
35
|
+
captureShards,
|
|
36
|
+
captureJobs,
|
|
37
|
+
buildComponents,
|
|
38
|
+
buildReviews,
|
|
39
|
+
siteSettings,
|
|
28
40
|
snapshots,
|
|
29
41
|
baselines,
|
|
30
42
|
comments,
|
|
31
43
|
labelTypes,
|
|
32
44
|
buildLabels,
|
|
45
|
+
projectLinks,
|
|
46
|
+
designLinks,
|
|
47
|
+
designCredentials,
|
|
48
|
+
userConnections,
|
|
49
|
+
designNodes,
|
|
50
|
+
buildPackageUsage,
|
|
33
51
|
tokens,
|
|
34
52
|
webhooks,
|
|
53
|
+
insights,
|
|
54
|
+
aiUsage,
|
|
55
|
+
aiBudgetAlerts,
|
|
35
56
|
notificationChannels,
|
|
36
57
|
notificationSubscriptions,
|
|
37
58
|
users,
|
|
@@ -41,6 +62,6 @@ const schema = {
|
|
|
41
62
|
contentRefs
|
|
42
63
|
};
|
|
43
64
|
//#endregion
|
|
44
|
-
export { baselines, buildLabels, builds, captureAttempts, captureLogs, comments, contentRefs, labelTypes, notificationChannels, notificationSubscriptions, projectGroupMappings,
|
|
65
|
+
export { aiBudgetAlerts, aiUsage, baselines, buildComponents, buildLabels, buildPackageUsage, buildReviews, builds, captureAttempts, captureJobs, captureLogs, captureShards, comments, contentRefs, designCredentials, designLinks, designNodes, insights, labelTypes, notificationChannels, notificationSubscriptions, projectGroupMappings, projectLinks, projectMembers, projects, schema, siteSettings, snapshots, tokens, userConnections, userInviteTokens, users, webhooks };
|
|
45
66
|
|
|
46
67
|
//# sourceMappingURL=schema.mjs.map
|
package/dist/schema.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.mjs","names":["projectsTable","
|
|
1
|
+
{"version":3,"file":"schema.mjs","names":["projectsTable","buildsTable","captureAttemptsTable","captureLogsTable","captureShardsTable","captureJobsTable","buildComponentsTable","buildReviewsTable","siteSettingsTable","snapshotsTable","baselinesTable","commentsTable","labelTypesTable","buildLabelsTable","projectLinksTable","designLinksTable","designCredentialsTable","userConnectionsTable","designNodesTable","buildPackageUsageTable","tokensTable","webhooksTable","insightsTable","aiUsageTable","aiBudgetAlertsTable","notificationChannelsTable","notificationSubscriptionsTable","usersTable","userInviteTokensTable","projectMembersTable","projectGroupMappingsTable","contentRefsTable"],"sources":["../src/schema/index.ts"],"sourcesContent":["/**\n * Database schema: table handles, row types, and the schema object passed\n * to the database client.\n *\n * Table handles are available on the `schema` object with full type\n * inference (`schema.builds`, …); exact column types live on the narrow\n * per-entity definitions, and the row interfaces are pinned to them by\n * `schema-types.test.ts`.\n */\nimport type { AnyMySqlTable } from \"drizzle-orm/mysql-core\";\nimport { baselines as baselinesTable } from \"./baseline.ts\";\nimport { buildComponents as buildComponentsTable } from \"./build-component.ts\";\nimport { buildReviews as buildReviewsTable } from \"./build-review.ts\";\nimport { builds as buildsTable } from \"./build.ts\";\nimport {\n captureAttempts as captureAttemptsTable,\n captureLogs as captureLogsTable,\n} from \"./capture-attempt.ts\";\nimport { captureJobs as captureJobsTable } from \"./capture-job.ts\";\nimport { captureShards as captureShardsTable } from \"./capture-shard.ts\";\nimport { comments as commentsTable } from \"./comment.ts\";\nimport { userConnections as userConnectionsTable } from \"./connection.ts\";\nimport { contentRefs as contentRefsTable } from \"./content-refs.ts\";\nimport {\n designLinks as designLinksTable,\n designCredentials as designCredentialsTable,\n designNodes as designNodesTable,\n} from \"./design.ts\";\nimport {\n aiBudgetAlerts as aiBudgetAlertsTable,\n aiUsage as aiUsageTable,\n insights as insightsTable,\n} from \"./insight.ts\";\nimport { buildLabels as buildLabelsTable, labelTypes as labelTypesTable } from \"./label.ts\";\nimport { projectMembers as projectMembersTable } from \"./member.ts\";\nimport {\n notificationChannels as notificationChannelsTable,\n notificationSubscriptions as notificationSubscriptionsTable,\n} from \"./notification.ts\";\nimport { projectGroupMappings as projectGroupMappingsTable } from \"./project-group-mapping.ts\";\nimport { projects as projectsTable } from \"./project.ts\";\nimport { siteSettings as siteSettingsTable } from \"./site-setting.ts\";\nimport { snapshots as snapshotsTable } from \"./snapshot.ts\";\nimport { tokens as tokensTable } from \"./token.ts\";\nimport {\n buildPackageUsage as buildPackageUsageTable,\n projectLinks as projectLinksTable,\n} from \"./usage.ts\";\nimport { userInviteTokens as userInviteTokensTable } from \"./user-invite.ts\";\nimport { users as usersTable } from \"./user.ts\";\nimport { webhooks as webhooksTable } from \"./webhook.ts\";\n\nexport { builds } from \"./build.ts\";\nexport { captureAttempts, captureLogs } from \"./capture-attempt.ts\";\nexport { captureJobs } from \"./capture-job.ts\";\nexport { buildComponents } from \"./build-component.ts\";\nexport { buildReviews } from \"./build-review.ts\";\nexport { siteSettings } from \"./site-setting.ts\";\nexport { captureShards } from \"./capture-shard.ts\";\nexport { baselines } from \"./baseline.ts\";\nexport { comments } from \"./comment.ts\";\nexport { buildLabels, labelTypes } from \"./label.ts\";\nexport { projectMembers } from \"./member.ts\";\nexport { buildPackageUsage, projectLinks } from \"./usage.ts\";\nexport { userConnections } from \"./connection.ts\";\nexport { designCredentials, designLinks, designNodes } from \"./design.ts\";\nexport { projectGroupMappings } from \"./project-group-mapping.ts\";\nexport { projects } from \"./project.ts\";\nexport { snapshots } from \"./snapshot.ts\";\nexport { tokens } from \"./token.ts\";\nexport { userInviteTokens } from \"./user-invite.ts\";\nexport { users } from \"./user.ts\";\nexport { webhooks } from \"./webhook.ts\";\nexport { aiBudgetAlerts, aiUsage, insights } from \"./insight.ts\";\nexport { notificationChannels, notificationSubscriptions } from \"./notification.ts\";\nexport { contentRefs } from \"./content-refs.ts\";\n\n/** A capture attempt and its log lines for a single build run. */\nexport type { CaptureAttempt, CaptureLog } from \"./capture-attempt.ts\";\n/** Build row as stored in the `builds` table. */\nexport type { Build } from \"./build.ts\";\n/** Review comment row as stored in the `comments` table. */\nexport type { Comment } from \"./comment.ts\";\n/** Build label and label type rows. */\nexport type { BuildLabel, LabelType } from \"./label.ts\";\n/** A user's OAuth connection to an external service. */\nexport type { UserConnection } from \"./connection.ts\";\n/** Design link, provider credential and cached design node rows. */\nexport type { DesignCredential, DesignLink, DesignNode } from \"./design.ts\";\n/** Project link and per-build package usage rows. */\nexport type { BuildPackageUsage, ProjectLink } from \"./usage.ts\";\n/** Project membership row linking a user to a project role. */\nexport type { ProjectMember } from \"./member.ts\";\n/** Identity-provider group to project-role mapping row. */\nexport type { ProjectGroupMapping } from \"./project-group-mapping.ts\";\n/** Project row and its embedded Storybook metadata. */\nexport type { Project, StorybookMeta } from \"./project.ts\";\n/** Per-project git provider status-check configuration row. */\n/** Snapshot row capturing a single story at one viewport. */\nexport type { Snapshot } from \"./snapshot.ts\";\n/** CI token row (stores only the hash). */\nexport type { Token } from \"./token.ts\";\n/** One-time invite token for local accounts. */\nexport type { UserInviteToken } from \"./user-invite.ts\";\n/** User row for authenticated identities. */\nexport type { User } from \"./user.ts\";\n/** Webhook subscription row. */\nexport type { Webhook } from \"./webhook.ts\";\n/** Insight, AI usage and budget-alert rows. */\nexport type { AiBudgetAlert, AiUsage, Insight } from \"./insight.ts\";\n/** Notification channel and subscription rows. */\nexport type { NotificationChannel, NotificationSubscription } from \"./notification.ts\";\n/** Baseline row. */\nexport type { Baseline } from \"./baseline.ts\";\n/** Content ref row for deduplicated assets. */\nexport type { ContentRef } from \"./content-refs.ts\";\n\n/** Full Drizzle schema object passed to the database client. */\nexport const schema: {\n projects: AnyMySqlTable;\n builds: AnyMySqlTable;\n captureAttempts: AnyMySqlTable;\n captureLogs: AnyMySqlTable;\n captureShards: AnyMySqlTable;\n captureJobs: AnyMySqlTable;\n buildComponents: AnyMySqlTable;\n buildReviews: AnyMySqlTable;\n siteSettings: AnyMySqlTable;\n snapshots: AnyMySqlTable;\n baselines: AnyMySqlTable;\n comments: AnyMySqlTable;\n labelTypes: AnyMySqlTable;\n buildLabels: AnyMySqlTable;\n projectLinks: AnyMySqlTable;\n designLinks: AnyMySqlTable;\n designCredentials: AnyMySqlTable;\n userConnections: AnyMySqlTable;\n designNodes: AnyMySqlTable;\n buildPackageUsage: AnyMySqlTable;\n tokens: AnyMySqlTable;\n webhooks: AnyMySqlTable;\n insights: AnyMySqlTable;\n aiUsage: AnyMySqlTable;\n aiBudgetAlerts: AnyMySqlTable;\n notificationChannels: AnyMySqlTable;\n notificationSubscriptions: AnyMySqlTable;\n users: AnyMySqlTable;\n userInviteTokens: AnyMySqlTable;\n projectMembers: AnyMySqlTable;\n projectGroupMappings: AnyMySqlTable;\n contentRefs: AnyMySqlTable;\n} = {\n projects: projectsTable,\n builds: buildsTable,\n captureAttempts: captureAttemptsTable,\n captureLogs: captureLogsTable,\n captureShards: captureShardsTable,\n captureJobs: captureJobsTable,\n buildComponents: buildComponentsTable,\n buildReviews: buildReviewsTable,\n siteSettings: siteSettingsTable,\n snapshots: snapshotsTable,\n baselines: baselinesTable,\n comments: commentsTable,\n labelTypes: labelTypesTable,\n buildLabels: buildLabelsTable,\n projectLinks: projectLinksTable,\n designLinks: designLinksTable,\n designCredentials: designCredentialsTable,\n userConnections: userConnectionsTable,\n designNodes: designNodesTable,\n buildPackageUsage: buildPackageUsageTable,\n tokens: tokensTable,\n webhooks: webhooksTable,\n insights: insightsTable,\n aiUsage: aiUsageTable,\n aiBudgetAlerts: aiBudgetAlertsTable,\n notificationChannels: notificationChannelsTable,\n notificationSubscriptions: notificationSubscriptionsTable,\n users: usersTable,\n userInviteTokens: userInviteTokensTable,\n projectMembers: projectMembersTable,\n projectGroupMappings: projectGroupMappingsTable,\n contentRefs: contentRefsTable,\n};\n\n/** The full database schema type. */\nexport type Schema = typeof schema;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsHA,MAAa,SAiCT;CACQA;CACFC;CACSC;CACJC;CACEC;CACFC;CACIC;CACHC;CACAC;CACHC;CACAC;CACDC;CACEC;CACCC;CACCC;CACDC;CACMC;CACFC;CACJC;CACMC;CACXC;CACEC;CACAC;CACDC;CACOC;CACMC;CACKC;CACpBC;CACWC;CACFC;CACMC;CACTC;AACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyshelf/db-mysql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "MySQL/MariaDB database adapter for StoryShelf (mysql2 + Drizzle, PlanetScale/TiDB compatible).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"database",
|
|
@@ -27,9 +27,6 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"type": "module",
|
|
30
|
-
"engines": {
|
|
31
|
-
"node": ">=24"
|
|
32
|
-
},
|
|
33
30
|
"sideEffects": false,
|
|
34
31
|
"types": "./dist/index.d.mts",
|
|
35
32
|
"exports": {
|
|
@@ -75,7 +72,7 @@
|
|
|
75
72
|
"prepublishOnly": "nub run build"
|
|
76
73
|
},
|
|
77
74
|
"dependencies": {
|
|
78
|
-
"@storyshelf/core": "0.
|
|
75
|
+
"@storyshelf/core": "0.7.0",
|
|
79
76
|
"drizzle-orm": "^0.44.0",
|
|
80
77
|
"mysql2": "^3.9.0"
|
|
81
78
|
},
|
|
@@ -104,6 +101,9 @@
|
|
|
104
101
|
"optional": true
|
|
105
102
|
}
|
|
106
103
|
},
|
|
104
|
+
"engines": {
|
|
105
|
+
"node": ">=24"
|
|
106
|
+
},
|
|
107
107
|
"jsr": {
|
|
108
108
|
"runtimeCompat": {
|
|
109
109
|
"node": true,
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import "node:path";
|
|
2
|
-
import "node:url";
|
|
3
|
-
import.meta.url;
|
|
4
|
-
import { projects } from "./project.mjs";
|
|
5
|
-
import { datetime, mysqlTable, text } from "drizzle-orm/mysql-core";
|
|
6
|
-
//#region src/schema/status-config.ts
|
|
7
|
-
/** Narrow `project_status_configs` table definition. */
|
|
8
|
-
const projectStatusConfigs = mysqlTable("project_status_configs", {
|
|
9
|
-
id: text("id").primaryKey(),
|
|
10
|
-
projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
|
|
11
|
-
provider: text("provider").notNull(),
|
|
12
|
-
config: text("config").notNull(),
|
|
13
|
-
tokenEncrypted: text("token_encrypted").notNull(),
|
|
14
|
-
createdAt: datetime("created_at", {
|
|
15
|
-
mode: "string",
|
|
16
|
-
fsp: 3
|
|
17
|
-
}).notNull(),
|
|
18
|
-
updatedAt: datetime("updated_at", {
|
|
19
|
-
mode: "string",
|
|
20
|
-
fsp: 3
|
|
21
|
-
}).notNull()
|
|
22
|
-
});
|
|
23
|
-
//#endregion
|
|
24
|
-
export { projectStatusConfigs };
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=status-config.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status-config.mjs","names":[],"sources":["../../src/schema/status-config.ts"],"sourcesContent":["import { mysqlTable, text, datetime } from \"drizzle-orm/mysql-core\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `project_status_configs` table definition. */\nexport const projectStatusConfigs = mysqlTable(\"project_status_configs\", {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n provider: text(\"provider\").notNull(),\n config: text(\"config\").notNull(),\n tokenEncrypted: text(\"token_encrypted\").notNull(),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n updatedAt: datetime(\"updated_at\", { mode: \"string\", fsp: 3 }).notNull(),\n});\n\n/** A project status-config row. */\nexport interface ProjectStatusConfig {\n id: string;\n projectId: string;\n provider: string;\n config: string;\n tokenEncrypted: string;\n createdAt: string;\n updatedAt: string;\n}\n"],"mappings":";;;;;;;AAIA,MAAa,uBAAuB,WAAW,0BAA0B;CACvE,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,QAAQ,KAAK,QAAQ,CAAC,CAAC,QAAQ;CAC/B,gBAAgB,KAAK,iBAAiB,CAAC,CAAC,QAAQ;CAChD,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,CAAC"}
|