bopodev-db 0.1.27 → 0.1.28
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/dist/bootstrap.d.ts +3 -3
- package/dist/client.d.ts +34 -6
- package/dist/index.d.ts +1 -0
- package/dist/migrate.d.ts +1 -0
- package/dist/repositories.d.ts +3 -36
- package/drizzle.config.ts +10 -0
- package/package.json +10 -3
- package/src/bootstrap.ts +9 -595
- package/src/client.ts +499 -9
- package/src/default-paths.ts +1 -1
- package/src/index.ts +1 -0
- package/src/migrate.ts +20 -0
- package/src/migrations/0000_initial.sql +389 -0
- package/src/migrations/meta/_journal.json +13 -0
- package/src/repositories.ts +8 -8
- package/.turbo/turbo-lint.log +0 -4
package/.turbo/turbo-build.log
CHANGED
package/dist/bootstrap.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function bootstrapDatabase(dbPath?: string): Promise<{
|
|
2
|
-
db: import("drizzle-orm/
|
|
3
|
-
$client: import("
|
|
2
|
+
db: import("drizzle-orm/postgres-js").PostgresJsDatabase<typeof import("./schema")> & {
|
|
3
|
+
$client: import("postgres").Sql<{}>;
|
|
4
4
|
};
|
|
5
|
-
client: import("
|
|
5
|
+
client: import("./client").BopoDatabaseClient;
|
|
6
6
|
}>;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { type PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
+
import postgres from "postgres";
|
|
3
3
|
import * as dbSchema from "./schema";
|
|
4
|
-
export type BopoDb =
|
|
4
|
+
export type BopoDb = PostgresJsDatabase<typeof dbSchema>;
|
|
5
|
+
export type BopoDatabaseClient = {
|
|
6
|
+
close: () => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
type DatabaseTarget = {
|
|
9
|
+
connectionString: string;
|
|
10
|
+
dataPath: string | null;
|
|
11
|
+
stop: () => Promise<void>;
|
|
12
|
+
source: "external-postgres" | "embedded-postgres";
|
|
13
|
+
};
|
|
14
|
+
type MigrationVersion = {
|
|
15
|
+
count: number;
|
|
16
|
+
latestTag: string | null;
|
|
17
|
+
};
|
|
5
18
|
export declare function createDb(dbPath?: string): Promise<{
|
|
6
|
-
db:
|
|
7
|
-
$client:
|
|
19
|
+
db: PostgresJsDatabase<typeof dbSchema> & {
|
|
20
|
+
$client: postgres.Sql<{}>;
|
|
8
21
|
};
|
|
9
|
-
client:
|
|
22
|
+
client: BopoDatabaseClient;
|
|
23
|
+
connectionString: string;
|
|
24
|
+
dataPath: string | null;
|
|
25
|
+
source: "external-postgres" | "embedded-postgres";
|
|
10
26
|
}>;
|
|
27
|
+
export declare function applyDatabaseMigrations(connectionString: string, options?: {
|
|
28
|
+
dataPath?: string | null;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
export declare function getExpectedDatabaseSchemaVersion(): MigrationVersion;
|
|
31
|
+
export declare function verifyDatabaseSchema(connectionString: string): Promise<{
|
|
32
|
+
appliedCount: number;
|
|
33
|
+
expectedCount: number;
|
|
34
|
+
latestTag: string | null;
|
|
35
|
+
}>;
|
|
36
|
+
export declare function readAppliedMigrationCount(connectionString: string): Promise<number>;
|
|
37
|
+
export declare function ensureDatabaseTarget(dbPath?: string): Promise<DatabaseTarget>;
|
|
38
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/repositories.d.ts
CHANGED
|
@@ -254,18 +254,7 @@ export declare function createProjectWorkspace(db: BopoDb, input: {
|
|
|
254
254
|
repoUrl?: string | null;
|
|
255
255
|
repoRef?: string | null;
|
|
256
256
|
isPrimary?: boolean;
|
|
257
|
-
}): Promise<
|
|
258
|
-
id: string;
|
|
259
|
-
name: string;
|
|
260
|
-
createdAt: Date;
|
|
261
|
-
companyId: string;
|
|
262
|
-
updatedAt: Date;
|
|
263
|
-
projectId: string;
|
|
264
|
-
cwd: string | null;
|
|
265
|
-
repoUrl: string | null;
|
|
266
|
-
repoRef: string | null;
|
|
267
|
-
isPrimary: boolean;
|
|
268
|
-
} | undefined>;
|
|
257
|
+
}): Promise<any>;
|
|
269
258
|
export declare function updateProjectWorkspace(db: BopoDb, input: {
|
|
270
259
|
companyId: string;
|
|
271
260
|
projectId: string;
|
|
@@ -275,34 +264,12 @@ export declare function updateProjectWorkspace(db: BopoDb, input: {
|
|
|
275
264
|
repoUrl?: string | null;
|
|
276
265
|
repoRef?: string | null;
|
|
277
266
|
isPrimary?: boolean;
|
|
278
|
-
}): Promise<
|
|
279
|
-
id: string;
|
|
280
|
-
companyId: string;
|
|
281
|
-
projectId: string;
|
|
282
|
-
name: string;
|
|
283
|
-
cwd: string | null;
|
|
284
|
-
repoUrl: string | null;
|
|
285
|
-
repoRef: string | null;
|
|
286
|
-
isPrimary: boolean;
|
|
287
|
-
createdAt: Date;
|
|
288
|
-
updatedAt: Date;
|
|
289
|
-
} | null>;
|
|
267
|
+
}): Promise<any>;
|
|
290
268
|
export declare function deleteProjectWorkspace(db: BopoDb, input: {
|
|
291
269
|
companyId: string;
|
|
292
270
|
projectId: string;
|
|
293
271
|
id: string;
|
|
294
|
-
}): Promise<
|
|
295
|
-
id: string;
|
|
296
|
-
name: string;
|
|
297
|
-
createdAt: Date;
|
|
298
|
-
companyId: string;
|
|
299
|
-
updatedAt: Date;
|
|
300
|
-
projectId: string;
|
|
301
|
-
cwd: string | null;
|
|
302
|
-
repoUrl: string | null;
|
|
303
|
-
repoRef: string | null;
|
|
304
|
-
isPrimary: boolean;
|
|
305
|
-
} | null>;
|
|
272
|
+
}): Promise<any>;
|
|
306
273
|
export declare function syncProjectGoals(db: BopoDb, input: {
|
|
307
274
|
companyId: string;
|
|
308
275
|
projectId: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineConfig } from "drizzle-kit";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
schema: "./src/schema.ts",
|
|
5
|
+
out: "./src/migrations",
|
|
6
|
+
dialect: "postgresql",
|
|
7
|
+
dbCredentials: {
|
|
8
|
+
url: process.env.DATABASE_URL ?? "postgres://bopodev:bopodev@127.0.0.1:55432/bopodev"
|
|
9
|
+
}
|
|
10
|
+
});
|
package/package.json
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bopodev-db",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"types": "src/index.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"
|
|
9
|
+
"drizzle-kit": "^0.31.10",
|
|
10
10
|
"drizzle-orm": "^0.44.5",
|
|
11
11
|
"drizzle-zod": "^0.8.2",
|
|
12
|
-
"
|
|
12
|
+
"embedded-postgres": "18.3.0-beta.16",
|
|
13
|
+
"nanoid": "^5.1.5",
|
|
14
|
+
"postgres": "^3.4.8"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"tsx": "^4.20.5"
|
|
13
18
|
},
|
|
14
19
|
"scripts": {
|
|
15
20
|
"build": "tsc -p tsconfig.json --emitDeclarationOnly",
|
|
21
|
+
"generate": "drizzle-kit generate",
|
|
16
22
|
"lint": "tsc -p tsconfig.json --noEmit",
|
|
23
|
+
"migrate": "node --import tsx src/migrate.ts",
|
|
17
24
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
18
25
|
}
|
|
19
26
|
}
|