@storyshelf/db-sqlite 0.3.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -3
- package/dist/better-sqlite3.d.mts +29 -0
- package/dist/better-sqlite3.mjs +116 -0
- package/dist/better-sqlite3.mjs.map +1 -0
- package/dist/bun-sqlite.d.mts +30 -0
- package/dist/bun-sqlite.mjs +120 -0
- package/dist/bun-sqlite.mjs.map +1 -0
- package/dist/d1.d.mts +38 -0
- package/dist/d1.mjs +108 -0
- package/dist/d1.mjs.map +1 -0
- package/dist/ddl.d.mts +14 -0
- package/dist/ddl.mjs +342 -0
- package/dist/ddl.mjs.map +1 -0
- package/dist/drizzle-factory.d.mts +19 -0
- package/dist/drizzle-factory.mjs +121 -0
- package/dist/drizzle-factory.mjs.map +1 -0
- package/dist/index.mjs +102 -36
- package/dist/index.mjs.map +1 -1
- package/dist/schema/baseline.d.mts +204 -0
- package/dist/schema/baseline.mjs +23 -0
- package/dist/schema/baseline.mjs.map +1 -0
- package/dist/schema/build.d.mts +405 -0
- package/dist/schema/build.mjs +33 -0
- package/dist/schema/build.mjs.map +1 -0
- package/dist/schema/capture-attempt.d.mts +482 -0
- package/dist/schema/capture-attempt.mjs +40 -0
- package/dist/schema/capture-attempt.mjs.map +1 -0
- package/dist/schema/comment.d.mts +215 -0
- package/dist/schema/comment.mjs +26 -0
- package/dist/schema/comment.mjs.map +1 -0
- package/dist/schema/content-refs.d.mts +95 -0
- package/dist/schema/content-refs.mjs +16 -0
- package/dist/schema/content-refs.mjs.map +1 -0
- package/dist/schema/label.d.mts +288 -0
- package/dist/schema/label.mjs +30 -0
- package/dist/schema/label.mjs.map +1 -0
- package/dist/schema/member.d.mts +140 -0
- package/dist/schema/member.mjs +20 -0
- package/dist/schema/member.mjs.map +1 -0
- package/dist/schema/notification.d.mts +344 -0
- package/dist/schema/notification.mjs +33 -0
- package/dist/schema/notification.mjs.map +1 -0
- package/dist/schema/project-group-mapping.d.mts +119 -0
- package/dist/schema/project-group-mapping.mjs +18 -0
- package/dist/schema/project-group-mapping.mjs.map +1 -0
- package/dist/schema/project.d.mts +358 -0
- package/dist/schema/project.mjs +29 -0
- package/dist/schema/project.mjs.map +1 -0
- package/dist/schema/snapshot.d.mts +487 -0
- package/dist/schema/snapshot.mjs +38 -0
- package/dist/schema/snapshot.mjs.map +1 -0
- package/dist/schema/status-config.d.mts +157 -0
- package/dist/schema/status-config.mjs +20 -0
- package/dist/schema/status-config.mjs.map +1 -0
- package/dist/schema/token.d.mts +157 -0
- package/dist/schema/token.mjs +21 -0
- package/dist/schema/token.mjs.map +1 -0
- package/dist/schema/user-invite.d.mts +137 -0
- package/dist/schema/user-invite.mjs +19 -0
- package/dist/schema/user-invite.mjs.map +1 -0
- package/dist/schema/user.d.mts +238 -0
- package/dist/schema/user.mjs +23 -0
- package/dist/schema/user.mjs.map +1 -0
- package/dist/schema/webhook.d.mts +157 -0
- package/dist/schema/webhook.mjs +20 -0
- package/dist/schema/webhook.mjs.map +1 -0
- package/dist/schema.d.mts +47 -0
- package/dist/schema.mjs +46 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/turso.d.mts +32 -0
- package/dist/turso.mjs +134 -0
- package/dist/turso.mjs.map +1 -0
- package/package.json +66 -10
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { projects } from "./project.mjs";
|
|
5
|
+
import { sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
6
|
+
//#region src/schema/status-config.ts
|
|
7
|
+
/** Narrow `project_status_configs` table definition. */
|
|
8
|
+
const projectStatusConfigs = sqliteTable("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: text("created_at").notNull(),
|
|
15
|
+
updatedAt: text("updated_at").notNull()
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { projectStatusConfigs };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=status-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-config.mjs","names":[],"sources":["../../src/schema/status-config.ts"],"sourcesContent":["import { sqliteTable, text } from \"drizzle-orm/sqlite-core\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `project_status_configs` table definition. */\nexport const projectStatusConfigs = sqliteTable(\"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: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").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,YAAY,0BAA0B;CACxE,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,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;AACxC,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/schema/token.d.ts
|
|
4
|
+
/** Narrow `tokens` table definition. */
|
|
5
|
+
declare const tokens: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
6
|
+
name: "tokens";
|
|
7
|
+
schema: undefined;
|
|
8
|
+
columns: {
|
|
9
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
10
|
+
name: "id";
|
|
11
|
+
tableName: "tokens";
|
|
12
|
+
dataType: "string";
|
|
13
|
+
columnType: "SQLiteText";
|
|
14
|
+
data: string;
|
|
15
|
+
driverParam: string;
|
|
16
|
+
notNull: true;
|
|
17
|
+
hasDefault: false;
|
|
18
|
+
isPrimaryKey: true;
|
|
19
|
+
isAutoincrement: false;
|
|
20
|
+
hasRuntimeDefault: false;
|
|
21
|
+
enumValues: [string, ...string[]];
|
|
22
|
+
baseColumn: never;
|
|
23
|
+
identity: undefined;
|
|
24
|
+
generated: undefined;
|
|
25
|
+
}, {}, {
|
|
26
|
+
length: number | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
projectId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
29
|
+
name: "project_id";
|
|
30
|
+
tableName: "tokens";
|
|
31
|
+
dataType: "string";
|
|
32
|
+
columnType: "SQLiteText";
|
|
33
|
+
data: string;
|
|
34
|
+
driverParam: string;
|
|
35
|
+
notNull: true;
|
|
36
|
+
hasDefault: false;
|
|
37
|
+
isPrimaryKey: false;
|
|
38
|
+
isAutoincrement: false;
|
|
39
|
+
hasRuntimeDefault: false;
|
|
40
|
+
enumValues: [string, ...string[]];
|
|
41
|
+
baseColumn: never;
|
|
42
|
+
identity: undefined;
|
|
43
|
+
generated: undefined;
|
|
44
|
+
}, {}, {
|
|
45
|
+
length: number | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
48
|
+
name: "name";
|
|
49
|
+
tableName: "tokens";
|
|
50
|
+
dataType: "string";
|
|
51
|
+
columnType: "SQLiteText";
|
|
52
|
+
data: string;
|
|
53
|
+
driverParam: string;
|
|
54
|
+
notNull: true;
|
|
55
|
+
hasDefault: false;
|
|
56
|
+
isPrimaryKey: false;
|
|
57
|
+
isAutoincrement: false;
|
|
58
|
+
hasRuntimeDefault: false;
|
|
59
|
+
enumValues: [string, ...string[]];
|
|
60
|
+
baseColumn: never;
|
|
61
|
+
identity: undefined;
|
|
62
|
+
generated: undefined;
|
|
63
|
+
}, {}, {
|
|
64
|
+
length: number | undefined;
|
|
65
|
+
}>;
|
|
66
|
+
hash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
67
|
+
name: "hash";
|
|
68
|
+
tableName: "tokens";
|
|
69
|
+
dataType: "string";
|
|
70
|
+
columnType: "SQLiteText";
|
|
71
|
+
data: string;
|
|
72
|
+
driverParam: string;
|
|
73
|
+
notNull: true;
|
|
74
|
+
hasDefault: false;
|
|
75
|
+
isPrimaryKey: false;
|
|
76
|
+
isAutoincrement: false;
|
|
77
|
+
hasRuntimeDefault: false;
|
|
78
|
+
enumValues: [string, ...string[]];
|
|
79
|
+
baseColumn: never;
|
|
80
|
+
identity: undefined;
|
|
81
|
+
generated: undefined;
|
|
82
|
+
}, {}, {
|
|
83
|
+
length: number | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
userId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
86
|
+
name: "user_id";
|
|
87
|
+
tableName: "tokens";
|
|
88
|
+
dataType: "string";
|
|
89
|
+
columnType: "SQLiteText";
|
|
90
|
+
data: string;
|
|
91
|
+
driverParam: string;
|
|
92
|
+
notNull: false;
|
|
93
|
+
hasDefault: false;
|
|
94
|
+
isPrimaryKey: false;
|
|
95
|
+
isAutoincrement: false;
|
|
96
|
+
hasRuntimeDefault: false;
|
|
97
|
+
enumValues: [string, ...string[]];
|
|
98
|
+
baseColumn: never;
|
|
99
|
+
identity: undefined;
|
|
100
|
+
generated: undefined;
|
|
101
|
+
}, {}, {
|
|
102
|
+
length: number | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
lastUsedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
105
|
+
name: "last_used_at";
|
|
106
|
+
tableName: "tokens";
|
|
107
|
+
dataType: "string";
|
|
108
|
+
columnType: "SQLiteText";
|
|
109
|
+
data: string;
|
|
110
|
+
driverParam: string;
|
|
111
|
+
notNull: false;
|
|
112
|
+
hasDefault: false;
|
|
113
|
+
isPrimaryKey: false;
|
|
114
|
+
isAutoincrement: false;
|
|
115
|
+
hasRuntimeDefault: false;
|
|
116
|
+
enumValues: [string, ...string[]];
|
|
117
|
+
baseColumn: never;
|
|
118
|
+
identity: undefined;
|
|
119
|
+
generated: undefined;
|
|
120
|
+
}, {}, {
|
|
121
|
+
length: number | undefined;
|
|
122
|
+
}>;
|
|
123
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
124
|
+
name: "created_at";
|
|
125
|
+
tableName: "tokens";
|
|
126
|
+
dataType: "string";
|
|
127
|
+
columnType: "SQLiteText";
|
|
128
|
+
data: string;
|
|
129
|
+
driverParam: string;
|
|
130
|
+
notNull: true;
|
|
131
|
+
hasDefault: false;
|
|
132
|
+
isPrimaryKey: false;
|
|
133
|
+
isAutoincrement: false;
|
|
134
|
+
hasRuntimeDefault: false;
|
|
135
|
+
enumValues: [string, ...string[]];
|
|
136
|
+
baseColumn: never;
|
|
137
|
+
identity: undefined;
|
|
138
|
+
generated: undefined;
|
|
139
|
+
}, {}, {
|
|
140
|
+
length: number | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
};
|
|
143
|
+
dialect: 'sqlite';
|
|
144
|
+
}>;
|
|
145
|
+
/** A CI token row (hash only; the secret itself is never stored). */
|
|
146
|
+
interface Token {
|
|
147
|
+
id: string;
|
|
148
|
+
projectId: string;
|
|
149
|
+
name: string;
|
|
150
|
+
hash: string;
|
|
151
|
+
userId: string | null;
|
|
152
|
+
lastUsedAt: string | null;
|
|
153
|
+
createdAt: string;
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
export { Token, tokens };
|
|
157
|
+
//# sourceMappingURL=token.d.mts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { projects } from "./project.mjs";
|
|
5
|
+
import { users } from "./user.mjs";
|
|
6
|
+
import { sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
7
|
+
//#region src/schema/token.ts
|
|
8
|
+
/** Narrow `tokens` table definition. */
|
|
9
|
+
const tokens = sqliteTable("tokens", {
|
|
10
|
+
id: text("id").primaryKey(),
|
|
11
|
+
projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
|
|
12
|
+
name: text("name").notNull(),
|
|
13
|
+
hash: text("hash").notNull(),
|
|
14
|
+
userId: text("user_id").references(() => users.id, { onDelete: "cascade" }),
|
|
15
|
+
lastUsedAt: text("last_used_at"),
|
|
16
|
+
createdAt: text("created_at").notNull()
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { tokens };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=token.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.mjs","names":[],"sources":["../../src/schema/token.ts"],"sourcesContent":["import { sqliteTable, text } from \"drizzle-orm/sqlite-core\";\nimport { projects } from \"./project.ts\";\nimport { users } from \"./user.ts\";\n\n/** Narrow `tokens` table definition. */\nexport const tokens = sqliteTable(\"tokens\", {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n name: text(\"name\").notNull(),\n hash: text(\"hash\").notNull(),\n userId: text(\"user_id\").references(() => users.id, { onDelete: \"cascade\" }),\n lastUsedAt: text(\"last_used_at\"),\n createdAt: text(\"created_at\").notNull(),\n});\n\n/** A CI token row (hash only; the secret itself is never stored). */\nexport interface Token {\n id: string;\n projectId: string;\n name: string;\n hash: string;\n userId: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n}\n"],"mappings":";;;;;;;;AAKA,MAAa,SAAS,YAAY,UAAU;CAC1C,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,QAAQ,KAAK,SAAS,CAAC,CAAC,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CAC1E,YAAY,KAAK,cAAc;CAC/B,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;AACxC,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/schema/user-invite.d.ts
|
|
4
|
+
/** Invite token for local accounts (one-time, hashed at rest). */
|
|
5
|
+
declare const userInviteTokens: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
6
|
+
name: "user_invite_tokens";
|
|
7
|
+
schema: undefined;
|
|
8
|
+
columns: {
|
|
9
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
10
|
+
name: "id";
|
|
11
|
+
tableName: "user_invite_tokens";
|
|
12
|
+
dataType: "string";
|
|
13
|
+
columnType: "SQLiteText";
|
|
14
|
+
data: string;
|
|
15
|
+
driverParam: string;
|
|
16
|
+
notNull: true;
|
|
17
|
+
hasDefault: false;
|
|
18
|
+
isPrimaryKey: true;
|
|
19
|
+
isAutoincrement: false;
|
|
20
|
+
hasRuntimeDefault: false;
|
|
21
|
+
enumValues: [string, ...string[]];
|
|
22
|
+
baseColumn: never;
|
|
23
|
+
identity: undefined;
|
|
24
|
+
generated: undefined;
|
|
25
|
+
}, {}, {
|
|
26
|
+
length: number | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
userId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
29
|
+
name: "user_id";
|
|
30
|
+
tableName: "user_invite_tokens";
|
|
31
|
+
dataType: "string";
|
|
32
|
+
columnType: "SQLiteText";
|
|
33
|
+
data: string;
|
|
34
|
+
driverParam: string;
|
|
35
|
+
notNull: true;
|
|
36
|
+
hasDefault: false;
|
|
37
|
+
isPrimaryKey: false;
|
|
38
|
+
isAutoincrement: false;
|
|
39
|
+
hasRuntimeDefault: false;
|
|
40
|
+
enumValues: [string, ...string[]];
|
|
41
|
+
baseColumn: never;
|
|
42
|
+
identity: undefined;
|
|
43
|
+
generated: undefined;
|
|
44
|
+
}, {}, {
|
|
45
|
+
length: number | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
tokenHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
48
|
+
name: "token_hash";
|
|
49
|
+
tableName: "user_invite_tokens";
|
|
50
|
+
dataType: "string";
|
|
51
|
+
columnType: "SQLiteText";
|
|
52
|
+
data: string;
|
|
53
|
+
driverParam: string;
|
|
54
|
+
notNull: true;
|
|
55
|
+
hasDefault: false;
|
|
56
|
+
isPrimaryKey: false;
|
|
57
|
+
isAutoincrement: false;
|
|
58
|
+
hasRuntimeDefault: false;
|
|
59
|
+
enumValues: [string, ...string[]];
|
|
60
|
+
baseColumn: never;
|
|
61
|
+
identity: undefined;
|
|
62
|
+
generated: undefined;
|
|
63
|
+
}, {}, {
|
|
64
|
+
length: number | undefined;
|
|
65
|
+
}>;
|
|
66
|
+
expiresAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
67
|
+
name: "expires_at";
|
|
68
|
+
tableName: "user_invite_tokens";
|
|
69
|
+
dataType: "string";
|
|
70
|
+
columnType: "SQLiteText";
|
|
71
|
+
data: string;
|
|
72
|
+
driverParam: string;
|
|
73
|
+
notNull: true;
|
|
74
|
+
hasDefault: false;
|
|
75
|
+
isPrimaryKey: false;
|
|
76
|
+
isAutoincrement: false;
|
|
77
|
+
hasRuntimeDefault: false;
|
|
78
|
+
enumValues: [string, ...string[]];
|
|
79
|
+
baseColumn: never;
|
|
80
|
+
identity: undefined;
|
|
81
|
+
generated: undefined;
|
|
82
|
+
}, {}, {
|
|
83
|
+
length: number | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
usedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
86
|
+
name: "used_at";
|
|
87
|
+
tableName: "user_invite_tokens";
|
|
88
|
+
dataType: "string";
|
|
89
|
+
columnType: "SQLiteText";
|
|
90
|
+
data: string;
|
|
91
|
+
driverParam: string;
|
|
92
|
+
notNull: false;
|
|
93
|
+
hasDefault: false;
|
|
94
|
+
isPrimaryKey: false;
|
|
95
|
+
isAutoincrement: false;
|
|
96
|
+
hasRuntimeDefault: false;
|
|
97
|
+
enumValues: [string, ...string[]];
|
|
98
|
+
baseColumn: never;
|
|
99
|
+
identity: undefined;
|
|
100
|
+
generated: undefined;
|
|
101
|
+
}, {}, {
|
|
102
|
+
length: number | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
105
|
+
name: "created_at";
|
|
106
|
+
tableName: "user_invite_tokens";
|
|
107
|
+
dataType: "string";
|
|
108
|
+
columnType: "SQLiteText";
|
|
109
|
+
data: string;
|
|
110
|
+
driverParam: string;
|
|
111
|
+
notNull: true;
|
|
112
|
+
hasDefault: false;
|
|
113
|
+
isPrimaryKey: false;
|
|
114
|
+
isAutoincrement: false;
|
|
115
|
+
hasRuntimeDefault: false;
|
|
116
|
+
enumValues: [string, ...string[]];
|
|
117
|
+
baseColumn: never;
|
|
118
|
+
identity: undefined;
|
|
119
|
+
generated: undefined;
|
|
120
|
+
}, {}, {
|
|
121
|
+
length: number | undefined;
|
|
122
|
+
}>;
|
|
123
|
+
};
|
|
124
|
+
dialect: 'sqlite';
|
|
125
|
+
}>;
|
|
126
|
+
/** A user invite token row. */
|
|
127
|
+
interface UserInviteToken {
|
|
128
|
+
id: string;
|
|
129
|
+
userId: string;
|
|
130
|
+
tokenHash: string;
|
|
131
|
+
expiresAt: string;
|
|
132
|
+
usedAt: string | null;
|
|
133
|
+
createdAt: string;
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
export { UserInviteToken, userInviteTokens };
|
|
137
|
+
//# sourceMappingURL=user-invite.d.mts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { users } from "./user.mjs";
|
|
5
|
+
import { sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
6
|
+
//#region src/schema/user-invite.ts
|
|
7
|
+
/** Invite token for local accounts (one-time, hashed at rest). */
|
|
8
|
+
const userInviteTokens = sqliteTable("user_invite_tokens", {
|
|
9
|
+
id: text("id").primaryKey(),
|
|
10
|
+
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
11
|
+
tokenHash: text("token_hash").notNull().unique(),
|
|
12
|
+
expiresAt: text("expires_at").notNull(),
|
|
13
|
+
usedAt: text("used_at"),
|
|
14
|
+
createdAt: text("created_at").notNull()
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
export { userInviteTokens };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=user-invite.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-invite.mjs","names":[],"sources":["../../src/schema/user-invite.ts"],"sourcesContent":["import { sqliteTable, text } from \"drizzle-orm/sqlite-core\";\nimport { users } from \"./user.ts\";\n\n/** Invite token for local accounts (one-time, hashed at rest). */\nexport const userInviteTokens = sqliteTable(\"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: text(\"expires_at\").notNull(),\n usedAt: text(\"used_at\"),\n createdAt: text(\"created_at\").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":";;;;;;;AAIA,MAAa,mBAAmB,YAAY,sBAAsB;CAChE,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,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,QAAQ,KAAK,SAAS;CACtB,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;AACxC,CAAC"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { SiteRole } from "@storyshelf/core/types";
|
|
4
|
+
//#region src/schema/user.d.ts
|
|
5
|
+
/** Narrow `users` table definition. */
|
|
6
|
+
declare const users: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
7
|
+
name: "users";
|
|
8
|
+
schema: undefined;
|
|
9
|
+
columns: {
|
|
10
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
11
|
+
name: "id";
|
|
12
|
+
tableName: "users";
|
|
13
|
+
dataType: "string";
|
|
14
|
+
columnType: "SQLiteText";
|
|
15
|
+
data: string;
|
|
16
|
+
driverParam: string;
|
|
17
|
+
notNull: true;
|
|
18
|
+
hasDefault: false;
|
|
19
|
+
isPrimaryKey: true;
|
|
20
|
+
isAutoincrement: false;
|
|
21
|
+
hasRuntimeDefault: false;
|
|
22
|
+
enumValues: [string, ...string[]];
|
|
23
|
+
baseColumn: never;
|
|
24
|
+
identity: undefined;
|
|
25
|
+
generated: undefined;
|
|
26
|
+
}, {}, {
|
|
27
|
+
length: number | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
email: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
30
|
+
name: "email";
|
|
31
|
+
tableName: "users";
|
|
32
|
+
dataType: "string";
|
|
33
|
+
columnType: "SQLiteText";
|
|
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
|
+
length: number | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
49
|
+
name: "name";
|
|
50
|
+
tableName: "users";
|
|
51
|
+
dataType: "string";
|
|
52
|
+
columnType: "SQLiteText";
|
|
53
|
+
data: string;
|
|
54
|
+
driverParam: string;
|
|
55
|
+
notNull: true;
|
|
56
|
+
hasDefault: false;
|
|
57
|
+
isPrimaryKey: false;
|
|
58
|
+
isAutoincrement: false;
|
|
59
|
+
hasRuntimeDefault: false;
|
|
60
|
+
enumValues: [string, ...string[]];
|
|
61
|
+
baseColumn: never;
|
|
62
|
+
identity: undefined;
|
|
63
|
+
generated: undefined;
|
|
64
|
+
}, {}, {
|
|
65
|
+
length: number | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
avatarUrl: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
68
|
+
name: "avatar_url";
|
|
69
|
+
tableName: "users";
|
|
70
|
+
dataType: "string";
|
|
71
|
+
columnType: "SQLiteText";
|
|
72
|
+
data: string;
|
|
73
|
+
driverParam: string;
|
|
74
|
+
notNull: false;
|
|
75
|
+
hasDefault: false;
|
|
76
|
+
isPrimaryKey: false;
|
|
77
|
+
isAutoincrement: false;
|
|
78
|
+
hasRuntimeDefault: false;
|
|
79
|
+
enumValues: [string, ...string[]];
|
|
80
|
+
baseColumn: never;
|
|
81
|
+
identity: undefined;
|
|
82
|
+
generated: undefined;
|
|
83
|
+
}, {}, {
|
|
84
|
+
length: number | undefined;
|
|
85
|
+
}>;
|
|
86
|
+
role: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
87
|
+
name: "role";
|
|
88
|
+
tableName: "users";
|
|
89
|
+
dataType: "string";
|
|
90
|
+
columnType: "SQLiteText";
|
|
91
|
+
data: "admin" | "member" | "viewer";
|
|
92
|
+
driverParam: string;
|
|
93
|
+
notNull: true;
|
|
94
|
+
hasDefault: true;
|
|
95
|
+
isPrimaryKey: false;
|
|
96
|
+
isAutoincrement: false;
|
|
97
|
+
hasRuntimeDefault: false;
|
|
98
|
+
enumValues: [string, ...string[]];
|
|
99
|
+
baseColumn: never;
|
|
100
|
+
identity: undefined;
|
|
101
|
+
generated: undefined;
|
|
102
|
+
}, {}, {
|
|
103
|
+
length: number | undefined;
|
|
104
|
+
$type: "admin" | "member" | "viewer";
|
|
105
|
+
}>;
|
|
106
|
+
lastLoginAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
107
|
+
name: "last_login_at";
|
|
108
|
+
tableName: "users";
|
|
109
|
+
dataType: "string";
|
|
110
|
+
columnType: "SQLiteText";
|
|
111
|
+
data: string;
|
|
112
|
+
driverParam: string;
|
|
113
|
+
notNull: false;
|
|
114
|
+
hasDefault: false;
|
|
115
|
+
isPrimaryKey: false;
|
|
116
|
+
isAutoincrement: false;
|
|
117
|
+
hasRuntimeDefault: false;
|
|
118
|
+
enumValues: [string, ...string[]];
|
|
119
|
+
baseColumn: never;
|
|
120
|
+
identity: undefined;
|
|
121
|
+
generated: undefined;
|
|
122
|
+
}, {}, {
|
|
123
|
+
length: number | undefined;
|
|
124
|
+
}>;
|
|
125
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
126
|
+
name: "created_at";
|
|
127
|
+
tableName: "users";
|
|
128
|
+
dataType: "string";
|
|
129
|
+
columnType: "SQLiteText";
|
|
130
|
+
data: string;
|
|
131
|
+
driverParam: string;
|
|
132
|
+
notNull: true;
|
|
133
|
+
hasDefault: false;
|
|
134
|
+
isPrimaryKey: false;
|
|
135
|
+
isAutoincrement: false;
|
|
136
|
+
hasRuntimeDefault: false;
|
|
137
|
+
enumValues: [string, ...string[]];
|
|
138
|
+
baseColumn: never;
|
|
139
|
+
identity: undefined;
|
|
140
|
+
generated: undefined;
|
|
141
|
+
}, {}, {
|
|
142
|
+
length: number | undefined;
|
|
143
|
+
}>;
|
|
144
|
+
passwordHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
145
|
+
name: "password_hash";
|
|
146
|
+
tableName: "users";
|
|
147
|
+
dataType: "string";
|
|
148
|
+
columnType: "SQLiteText";
|
|
149
|
+
data: string;
|
|
150
|
+
driverParam: string;
|
|
151
|
+
notNull: false;
|
|
152
|
+
hasDefault: false;
|
|
153
|
+
isPrimaryKey: false;
|
|
154
|
+
isAutoincrement: false;
|
|
155
|
+
hasRuntimeDefault: false;
|
|
156
|
+
enumValues: [string, ...string[]];
|
|
157
|
+
baseColumn: never;
|
|
158
|
+
identity: undefined;
|
|
159
|
+
generated: undefined;
|
|
160
|
+
}, {}, {
|
|
161
|
+
length: number | undefined;
|
|
162
|
+
}>;
|
|
163
|
+
displayNameOverride: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
164
|
+
name: "display_name_override";
|
|
165
|
+
tableName: "users";
|
|
166
|
+
dataType: "string";
|
|
167
|
+
columnType: "SQLiteText";
|
|
168
|
+
data: string;
|
|
169
|
+
driverParam: string;
|
|
170
|
+
notNull: false;
|
|
171
|
+
hasDefault: false;
|
|
172
|
+
isPrimaryKey: false;
|
|
173
|
+
isAutoincrement: false;
|
|
174
|
+
hasRuntimeDefault: false;
|
|
175
|
+
enumValues: [string, ...string[]];
|
|
176
|
+
baseColumn: never;
|
|
177
|
+
identity: undefined;
|
|
178
|
+
generated: undefined;
|
|
179
|
+
}, {}, {
|
|
180
|
+
length: number | undefined;
|
|
181
|
+
}>;
|
|
182
|
+
authProvider: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
183
|
+
name: "auth_provider";
|
|
184
|
+
tableName: "users";
|
|
185
|
+
dataType: "string";
|
|
186
|
+
columnType: "SQLiteText";
|
|
187
|
+
data: "local" | "oidc" | "shared";
|
|
188
|
+
driverParam: string;
|
|
189
|
+
notNull: true;
|
|
190
|
+
hasDefault: true;
|
|
191
|
+
isPrimaryKey: false;
|
|
192
|
+
isAutoincrement: false;
|
|
193
|
+
hasRuntimeDefault: false;
|
|
194
|
+
enumValues: [string, ...string[]];
|
|
195
|
+
baseColumn: never;
|
|
196
|
+
identity: undefined;
|
|
197
|
+
generated: undefined;
|
|
198
|
+
}, {}, {
|
|
199
|
+
length: number | undefined;
|
|
200
|
+
$type: "local" | "oidc" | "shared";
|
|
201
|
+
}>;
|
|
202
|
+
disabled: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
203
|
+
name: "disabled";
|
|
204
|
+
tableName: "users";
|
|
205
|
+
dataType: "boolean";
|
|
206
|
+
columnType: "SQLiteBoolean";
|
|
207
|
+
data: boolean;
|
|
208
|
+
driverParam: number;
|
|
209
|
+
notNull: true;
|
|
210
|
+
hasDefault: true;
|
|
211
|
+
isPrimaryKey: false;
|
|
212
|
+
isAutoincrement: false;
|
|
213
|
+
hasRuntimeDefault: false;
|
|
214
|
+
enumValues: undefined;
|
|
215
|
+
baseColumn: never;
|
|
216
|
+
identity: undefined;
|
|
217
|
+
generated: undefined;
|
|
218
|
+
}, {}, {}>;
|
|
219
|
+
};
|
|
220
|
+
dialect: 'sqlite';
|
|
221
|
+
}>;
|
|
222
|
+
/** A user row. */
|
|
223
|
+
interface User {
|
|
224
|
+
id: string;
|
|
225
|
+
email: string;
|
|
226
|
+
name: string;
|
|
227
|
+
avatarUrl: string | null;
|
|
228
|
+
role: SiteRole;
|
|
229
|
+
lastLoginAt: string | null;
|
|
230
|
+
createdAt: string;
|
|
231
|
+
passwordHash: string | null;
|
|
232
|
+
displayNameOverride: string | null;
|
|
233
|
+
authProvider: "local" | "oidc" | "shared";
|
|
234
|
+
disabled: boolean;
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
237
|
+
export { User, users };
|
|
238
|
+
//# sourceMappingURL=user.d.mts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
5
|
+
//#region src/schema/user.ts
|
|
6
|
+
/** Narrow `users` table definition. */
|
|
7
|
+
const users = sqliteTable("users", {
|
|
8
|
+
id: text("id").primaryKey(),
|
|
9
|
+
email: text("email").notNull(),
|
|
10
|
+
name: text("name").notNull(),
|
|
11
|
+
avatarUrl: text("avatar_url"),
|
|
12
|
+
role: text("role").$type().notNull().default("member"),
|
|
13
|
+
lastLoginAt: text("last_login_at"),
|
|
14
|
+
createdAt: text("created_at").notNull(),
|
|
15
|
+
passwordHash: text("password_hash"),
|
|
16
|
+
displayNameOverride: text("display_name_override"),
|
|
17
|
+
authProvider: text("auth_provider").$type().notNull().default("oidc"),
|
|
18
|
+
disabled: integer("disabled", { mode: "boolean" }).notNull().default(false)
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { users };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=user.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.mjs","names":[],"sources":["../../src/schema/user.ts"],"sourcesContent":["import type { SiteRole } from \"@storyshelf/core/types\";\nimport { integer, sqliteTable, text } from \"drizzle-orm/sqlite-core\";\n\n/** Narrow `users` table definition. */\nexport const users = sqliteTable(\"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: text(\"last_login_at\"),\n createdAt: text(\"created_at\").notNull(),\n passwordHash: text(\"password_hash\"),\n displayNameOverride: text(\"display_name_override\"),\n authProvider: text(\"auth_provider\")\n .$type<\"local\" | \"oidc\" | \"shared\">()\n .notNull()\n .default(\"oidc\"),\n disabled: integer(\"disabled\", { mode: \"boolean\" }).notNull().default(false),\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 passwordHash: string | null;\n displayNameOverride: string | null;\n authProvider: \"local\" | \"oidc\" | \"shared\";\n disabled: boolean;\n}\n"],"mappings":";;;;;;AAIA,MAAa,QAAQ,YAAY,SAAS;CACxC,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,KAAK,eAAe;CACjC,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,cAAc,KAAK,eAAe;CAClC,qBAAqB,KAAK,uBAAuB;CACjD,cAAc,KAAK,eAAe,CAAC,CAChC,MAAmC,CAAC,CACpC,QAAQ,CAAC,CACT,QAAQ,MAAM;CACjB,UAAU,QAAQ,YAAY,EAAE,MAAM,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK;AAC5E,CAAC"}
|