@boltapp/bolt-app-db 0.0.1

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.
@@ -0,0 +1,379 @@
1
+ export declare const appStatusEnum: import("drizzle-orm/pg-core").PgEnum<["draft", "published", "archived"]>;
2
+ export declare const projects: import("drizzle-orm/pg-core").PgTableWithColumns<{
3
+ name: "projects";
4
+ schema: undefined;
5
+ columns: {
6
+ id: import("drizzle-orm/pg-core").PgColumn<{
7
+ name: "id";
8
+ tableName: "projects";
9
+ dataType: "string";
10
+ columnType: "PgText";
11
+ data: string;
12
+ driverParam: string;
13
+ notNull: true;
14
+ hasDefault: true;
15
+ isPrimaryKey: true;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: true;
18
+ enumValues: [string, ...string[]];
19
+ baseColumn: never;
20
+ identity: undefined;
21
+ generated: undefined;
22
+ }, {}, {}>;
23
+ name: import("drizzle-orm/pg-core").PgColumn<{
24
+ name: "name";
25
+ tableName: "projects";
26
+ dataType: "string";
27
+ columnType: "PgText";
28
+ data: string;
29
+ driverParam: string;
30
+ notNull: true;
31
+ hasDefault: false;
32
+ isPrimaryKey: false;
33
+ isAutoincrement: false;
34
+ hasRuntimeDefault: false;
35
+ enumValues: [string, ...string[]];
36
+ baseColumn: never;
37
+ identity: undefined;
38
+ generated: undefined;
39
+ }, {}, {}>;
40
+ description: import("drizzle-orm/pg-core").PgColumn<{
41
+ name: "description";
42
+ tableName: "projects";
43
+ dataType: "string";
44
+ columnType: "PgText";
45
+ data: string;
46
+ driverParam: string;
47
+ notNull: false;
48
+ hasDefault: false;
49
+ isPrimaryKey: false;
50
+ isAutoincrement: false;
51
+ hasRuntimeDefault: false;
52
+ enumValues: [string, ...string[]];
53
+ baseColumn: never;
54
+ identity: undefined;
55
+ generated: undefined;
56
+ }, {}, {}>;
57
+ slug: import("drizzle-orm/pg-core").PgColumn<{
58
+ name: "slug";
59
+ tableName: "projects";
60
+ dataType: "string";
61
+ columnType: "PgText";
62
+ data: string;
63
+ driverParam: string;
64
+ notNull: true;
65
+ hasDefault: false;
66
+ isPrimaryKey: false;
67
+ isAutoincrement: false;
68
+ hasRuntimeDefault: false;
69
+ enumValues: [string, ...string[]];
70
+ baseColumn: never;
71
+ identity: undefined;
72
+ generated: undefined;
73
+ }, {}, {}>;
74
+ settings: import("drizzle-orm/pg-core").PgColumn<{
75
+ name: "settings";
76
+ tableName: "projects";
77
+ dataType: "string";
78
+ columnType: "PgText";
79
+ data: string;
80
+ driverParam: string;
81
+ notNull: false;
82
+ hasDefault: false;
83
+ isPrimaryKey: false;
84
+ isAutoincrement: false;
85
+ hasRuntimeDefault: false;
86
+ enumValues: [string, ...string[]];
87
+ baseColumn: never;
88
+ identity: undefined;
89
+ generated: undefined;
90
+ }, {}, {}>;
91
+ organizationId: import("drizzle-orm/pg-core").PgColumn<{
92
+ name: "organization_id";
93
+ tableName: "projects";
94
+ dataType: "string";
95
+ columnType: "PgText";
96
+ data: string;
97
+ driverParam: string;
98
+ notNull: true;
99
+ hasDefault: false;
100
+ isPrimaryKey: false;
101
+ isAutoincrement: false;
102
+ hasRuntimeDefault: false;
103
+ enumValues: [string, ...string[]];
104
+ baseColumn: never;
105
+ identity: undefined;
106
+ generated: undefined;
107
+ }, {}, {}>;
108
+ createdBy: import("drizzle-orm/pg-core").PgColumn<{
109
+ name: "created_by";
110
+ tableName: "projects";
111
+ dataType: "string";
112
+ columnType: "PgText";
113
+ data: string;
114
+ driverParam: string;
115
+ notNull: false;
116
+ hasDefault: false;
117
+ isPrimaryKey: false;
118
+ isAutoincrement: false;
119
+ hasRuntimeDefault: false;
120
+ enumValues: [string, ...string[]];
121
+ baseColumn: never;
122
+ identity: undefined;
123
+ generated: undefined;
124
+ }, {}, {}>;
125
+ updatedBy: import("drizzle-orm/pg-core").PgColumn<{
126
+ name: "updated_by";
127
+ tableName: "projects";
128
+ dataType: "string";
129
+ columnType: "PgText";
130
+ data: string;
131
+ driverParam: string;
132
+ notNull: false;
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
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
143
+ name: "created_at";
144
+ tableName: "projects";
145
+ dataType: "date";
146
+ columnType: "PgTimestamp";
147
+ data: Date;
148
+ driverParam: string;
149
+ notNull: false;
150
+ hasDefault: true;
151
+ isPrimaryKey: false;
152
+ isAutoincrement: false;
153
+ hasRuntimeDefault: false;
154
+ enumValues: undefined;
155
+ baseColumn: never;
156
+ identity: undefined;
157
+ generated: undefined;
158
+ }, {}, {}>;
159
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
160
+ name: "updated_at";
161
+ tableName: "projects";
162
+ dataType: "date";
163
+ columnType: "PgTimestamp";
164
+ data: Date;
165
+ driverParam: string;
166
+ notNull: false;
167
+ hasDefault: true;
168
+ isPrimaryKey: false;
169
+ isAutoincrement: false;
170
+ hasRuntimeDefault: false;
171
+ enumValues: undefined;
172
+ baseColumn: never;
173
+ identity: undefined;
174
+ generated: undefined;
175
+ }, {}, {}>;
176
+ };
177
+ dialect: "pg";
178
+ }>;
179
+ export declare const apps: import("drizzle-orm/pg-core").PgTableWithColumns<{
180
+ name: "apps";
181
+ schema: undefined;
182
+ columns: {
183
+ id: import("drizzle-orm/pg-core").PgColumn<{
184
+ name: "id";
185
+ tableName: "apps";
186
+ dataType: "string";
187
+ columnType: "PgText";
188
+ data: string;
189
+ driverParam: string;
190
+ notNull: true;
191
+ hasDefault: true;
192
+ isPrimaryKey: true;
193
+ isAutoincrement: false;
194
+ hasRuntimeDefault: true;
195
+ enumValues: [string, ...string[]];
196
+ baseColumn: never;
197
+ identity: undefined;
198
+ generated: undefined;
199
+ }, {}, {}>;
200
+ name: import("drizzle-orm/pg-core").PgColumn<{
201
+ name: "name";
202
+ tableName: "apps";
203
+ dataType: "string";
204
+ columnType: "PgText";
205
+ data: string;
206
+ driverParam: string;
207
+ notNull: true;
208
+ hasDefault: true;
209
+ isPrimaryKey: false;
210
+ isAutoincrement: false;
211
+ hasRuntimeDefault: false;
212
+ enumValues: [string, ...string[]];
213
+ baseColumn: never;
214
+ identity: undefined;
215
+ generated: undefined;
216
+ }, {}, {}>;
217
+ description: import("drizzle-orm/pg-core").PgColumn<{
218
+ name: "description";
219
+ tableName: "apps";
220
+ dataType: "string";
221
+ columnType: "PgText";
222
+ data: string;
223
+ driverParam: string;
224
+ notNull: false;
225
+ hasDefault: false;
226
+ isPrimaryKey: false;
227
+ isAutoincrement: false;
228
+ hasRuntimeDefault: false;
229
+ enumValues: [string, ...string[]];
230
+ baseColumn: never;
231
+ identity: undefined;
232
+ generated: undefined;
233
+ }, {}, {}>;
234
+ status: import("drizzle-orm/pg-core").PgColumn<{
235
+ name: "status";
236
+ tableName: "apps";
237
+ dataType: "string";
238
+ columnType: "PgEnumColumn";
239
+ data: "draft" | "published" | "archived";
240
+ driverParam: string;
241
+ notNull: true;
242
+ hasDefault: true;
243
+ isPrimaryKey: false;
244
+ isAutoincrement: false;
245
+ hasRuntimeDefault: false;
246
+ enumValues: ["draft", "published", "archived"];
247
+ baseColumn: never;
248
+ identity: undefined;
249
+ generated: undefined;
250
+ }, {}, {}>;
251
+ organizationId: import("drizzle-orm/pg-core").PgColumn<{
252
+ name: "organization_id";
253
+ tableName: "apps";
254
+ dataType: "string";
255
+ columnType: "PgText";
256
+ data: string;
257
+ driverParam: string;
258
+ notNull: true;
259
+ hasDefault: false;
260
+ isPrimaryKey: false;
261
+ isAutoincrement: false;
262
+ hasRuntimeDefault: false;
263
+ enumValues: [string, ...string[]];
264
+ baseColumn: never;
265
+ identity: undefined;
266
+ generated: undefined;
267
+ }, {}, {}>;
268
+ projectId: import("drizzle-orm/pg-core").PgColumn<{
269
+ name: "project_id";
270
+ tableName: "apps";
271
+ dataType: "string";
272
+ columnType: "PgText";
273
+ data: string;
274
+ driverParam: string;
275
+ notNull: true;
276
+ hasDefault: false;
277
+ isPrimaryKey: false;
278
+ isAutoincrement: false;
279
+ hasRuntimeDefault: false;
280
+ enumValues: [string, ...string[]];
281
+ baseColumn: never;
282
+ identity: undefined;
283
+ generated: undefined;
284
+ }, {}, {}>;
285
+ slug: import("drizzle-orm/pg-core").PgColumn<{
286
+ name: "slug";
287
+ tableName: "apps";
288
+ dataType: "string";
289
+ columnType: "PgText";
290
+ data: string;
291
+ driverParam: string;
292
+ notNull: false;
293
+ hasDefault: false;
294
+ isPrimaryKey: false;
295
+ isAutoincrement: false;
296
+ hasRuntimeDefault: false;
297
+ enumValues: [string, ...string[]];
298
+ baseColumn: never;
299
+ identity: undefined;
300
+ generated: undefined;
301
+ }, {}, {}>;
302
+ createdBy: import("drizzle-orm/pg-core").PgColumn<{
303
+ name: "created_by";
304
+ tableName: "apps";
305
+ dataType: "string";
306
+ columnType: "PgText";
307
+ data: string;
308
+ driverParam: string;
309
+ notNull: false;
310
+ hasDefault: false;
311
+ isPrimaryKey: false;
312
+ isAutoincrement: false;
313
+ hasRuntimeDefault: false;
314
+ enumValues: [string, ...string[]];
315
+ baseColumn: never;
316
+ identity: undefined;
317
+ generated: undefined;
318
+ }, {}, {}>;
319
+ updatedBy: import("drizzle-orm/pg-core").PgColumn<{
320
+ name: "updated_by";
321
+ tableName: "apps";
322
+ dataType: "string";
323
+ columnType: "PgText";
324
+ data: string;
325
+ driverParam: string;
326
+ notNull: false;
327
+ hasDefault: false;
328
+ isPrimaryKey: false;
329
+ isAutoincrement: false;
330
+ hasRuntimeDefault: false;
331
+ enumValues: [string, ...string[]];
332
+ baseColumn: never;
333
+ identity: undefined;
334
+ generated: undefined;
335
+ }, {}, {}>;
336
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
337
+ name: "created_at";
338
+ tableName: "apps";
339
+ dataType: "date";
340
+ columnType: "PgTimestamp";
341
+ data: Date;
342
+ driverParam: string;
343
+ notNull: false;
344
+ hasDefault: true;
345
+ isPrimaryKey: false;
346
+ isAutoincrement: false;
347
+ hasRuntimeDefault: false;
348
+ enumValues: undefined;
349
+ baseColumn: never;
350
+ identity: undefined;
351
+ generated: undefined;
352
+ }, {}, {}>;
353
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
354
+ name: "updated_at";
355
+ tableName: "apps";
356
+ dataType: "date";
357
+ columnType: "PgTimestamp";
358
+ data: Date;
359
+ driverParam: string;
360
+ notNull: false;
361
+ hasDefault: true;
362
+ isPrimaryKey: false;
363
+ isAutoincrement: false;
364
+ hasRuntimeDefault: false;
365
+ enumValues: undefined;
366
+ baseColumn: never;
367
+ identity: undefined;
368
+ generated: undefined;
369
+ }, {}, {}>;
370
+ };
371
+ dialect: "pg";
372
+ }>;
373
+ export declare const projectsRelations: import("drizzle-orm").Relations<"projects", {
374
+ apps: import("drizzle-orm").Many<"apps">;
375
+ }>;
376
+ export declare const appsRelations: import("drizzle-orm").Relations<"apps", {
377
+ project: import("drizzle-orm").One<"projects", true>;
378
+ }>;
379
+ export type BoltAppCloud = typeof apps.$inferSelect;
@@ -0,0 +1,48 @@
1
+ import { relations } from "drizzle-orm";
2
+ import { index, pgEnum, pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
3
+ import { nanoid } from "nanoid";
4
+ export const appStatusEnum = pgEnum("app_status", ["draft", "published", "archived"]);
5
+ export const projects = pgTable("projects", {
6
+ id: text("id")
7
+ .primaryKey()
8
+ .$defaultFn(() => nanoid()),
9
+ name: text("name").notNull(),
10
+ description: text("description"),
11
+ slug: text("slug").notNull(),
12
+ settings: text("settings"),
13
+ organizationId: text("organization_id").notNull(),
14
+ createdBy: text("created_by"),
15
+ updatedBy: text("updated_by"),
16
+ createdAt: timestamp("created_at").defaultNow(),
17
+ updatedAt: timestamp("updated_at").defaultNow(),
18
+ }, (t) => [uniqueIndex("projects_org_slug_uq").on(t.organizationId, t.slug)]);
19
+ export const apps = pgTable("apps", {
20
+ id: text("id")
21
+ .primaryKey()
22
+ .$defaultFn(() => nanoid()),
23
+ name: text("name").default("Untitled Bolt App").notNull(),
24
+ description: text("description"),
25
+ status: appStatusEnum().notNull().default("draft"),
26
+ organizationId: text("organization_id").notNull(),
27
+ projectId: text("project_id")
28
+ .notNull()
29
+ .references(() => projects.id, { onDelete: "cascade" }),
30
+ slug: text("slug"),
31
+ createdBy: text("created_by"),
32
+ updatedBy: text("updated_by"),
33
+ createdAt: timestamp("created_at").defaultNow(),
34
+ updatedAt: timestamp("updated_at").defaultNow(),
35
+ }, (table) => [
36
+ index("apps_organization_idx").on(table.organizationId),
37
+ index("apps_status_idx").on(table.status),
38
+ index("apps_created_by_idx").on(table.createdBy),
39
+ ]);
40
+ export const projectsRelations = relations(projects, ({ many }) => ({
41
+ apps: many(apps),
42
+ }));
43
+ export const appsRelations = relations(apps, ({ one }) => ({
44
+ project: one(projects, {
45
+ fields: [apps.projectId],
46
+ references: [projects.id],
47
+ }),
48
+ }));
@@ -0,0 +1,2 @@
1
+ export * as clientSchema from "./client/schema";
2
+ export * as cloudAppSchema from "./cloud-app/schema";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * as clientSchema from "./client/schema";
2
+ export * as cloudAppSchema from "./cloud-app/schema";
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@boltapp/bolt-app-db",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "dev": "echo 'Add dev script here'",
13
+ "build": "tsc -p tsconfig.json",
14
+ "prepack": "pnpm build",
15
+ "test": "echo 'Add test script here'",
16
+ "lint": "echo 'Add lint script here'",
17
+ "npm:publish": "npm version patch --no-git-tag-version && npm publish --access public",
18
+ "npm:publish-minor": "npm version minor --no-git-tag-version && npm publish --access public",
19
+ "npm:publish-major": "npm version major --no-git-tag-version && npm publish --access public"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/index.js"
28
+ },
29
+ "./client/schema": {
30
+ "types": "./dist/client/schema/index.d.ts",
31
+ "default": "./dist/client/schema/index.js"
32
+ },
33
+ "./cloud-app/schema": {
34
+ "types": "./dist/cloud-app/schema/index.d.ts",
35
+ "default": "./dist/cloud-app/schema/index.js"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
39
+ "dependencies": {
40
+ "@boltapp/bolt-core": "npm:@boltapp/bolt-core@^0.0.0",
41
+ "drizzle-orm": "^0.44.4",
42
+ "nanoid": "^5.1.5"
43
+ },
44
+ "devDependencies": {
45
+ "@workspace/eslint-config": "workspace:*",
46
+ "@workspace/typescript-config": "workspace:*",
47
+ "typescript": "^5.9.3"
48
+ }
49
+ }