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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > bopodev-db@0.1.27 build /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopohq/packages/db
3
+ > bopodev-db@0.1.28 build /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopodev/packages/db
4
4
  > tsc -p tsconfig.json --emitDeclarationOnly
5
5
 
@@ -1,4 +1,4 @@
1
1
 
2
- > bopodev-db@0.1.26 typecheck /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopohq/packages/db
2
+ > bopodev-db@0.1.20 typecheck /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopodev/packages/db
3
3
  > tsc -p tsconfig.json --noEmit
4
4
 
@@ -1,6 +1,6 @@
1
1
  export declare function bootstrapDatabase(dbPath?: string): Promise<{
2
- db: import("drizzle-orm/pglite").PgliteDatabase<typeof import("./schema")> & {
3
- $client: import("@electric-sql/pglite").PGlite;
2
+ db: import("drizzle-orm/postgres-js").PostgresJsDatabase<typeof import("./schema")> & {
3
+ $client: import("postgres").Sql<{}>;
4
4
  };
5
- client: import("@electric-sql/pglite").PGlite;
5
+ client: import("./client").BopoDatabaseClient;
6
6
  }>;
package/dist/client.d.ts CHANGED
@@ -1,10 +1,38 @@
1
- import { PGlite } from "@electric-sql/pglite";
2
- import { drizzle } from "drizzle-orm/pglite";
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 = ReturnType<typeof drizzle<typeof dbSchema>>;
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: import("drizzle-orm/pglite").PgliteDatabase<typeof dbSchema> & {
7
- $client: PGlite;
19
+ db: PostgresJsDatabase<typeof dbSchema> & {
20
+ $client: postgres.Sql<{}>;
8
21
  };
9
- client: PGlite;
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
@@ -1,3 +1,4 @@
1
+ export { and, asc, desc, eq, gt, inArray, like, notInArray, sql } from "drizzle-orm";
1
2
  export * from "./bootstrap";
2
3
  export * from "./client";
3
4
  export { resolveDefaultDbPath, resolveBopoInstanceRoot } from "./default-paths";
@@ -0,0 +1 @@
1
+ export {};
@@ -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.27",
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
- "@electric-sql/pglite": "^0.3.7",
9
+ "drizzle-kit": "^0.31.10",
10
10
  "drizzle-orm": "^0.44.5",
11
11
  "drizzle-zod": "^0.8.2",
12
- "nanoid": "^5.1.5"
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
  }