@mshowes/brackets-manager 1.8.9 → 1.8.10

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,12 +1,13 @@
1
- import { type PostgresJsDatabase } from 'drizzle-orm/postgres-js';
1
+ import { type NodePgDatabase } from 'drizzle-orm/node-postgres';
2
+ import { type PoolConfig } from 'pg';
2
3
  import * as schema from './schema';
3
- export type DrizzleDatabase = PostgresJsDatabase<typeof schema>;
4
+ export type DrizzleDatabase = NodePgDatabase<typeof schema>;
4
5
  /**
5
- * Creates a Drizzle database instance connected to PostgreSQL.
6
+ * Creates a Drizzle database instance connected to PostgreSQL using node-postgres (pg).
6
7
  *
7
- * @param connectionString - PostgreSQL connection string
8
+ * @param config - PostgreSQL connection string or PoolConfig object
8
9
  * @returns Drizzle database instance with schema
9
10
  */
10
- export declare function createDatabase(connectionString: string): DrizzleDatabase;
11
+ export declare function createDatabase(config: string | PoolConfig): DrizzleDatabase;
11
12
  export { schema };
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/drizzle/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC,OAAO,MAAM,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,gBAAgB,EAAE,MAAM,GAAG,eAAe,CAGxE;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/drizzle/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,eAAe,CAK3E;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -1,15 +1,15 @@
1
- import { drizzle } from 'drizzle-orm/postgres-js';
2
- import postgres from 'postgres';
1
+ import { drizzle } from 'drizzle-orm/node-postgres';
2
+ import { Pool } from 'pg';
3
3
  import * as schema from './schema';
4
4
  /**
5
- * Creates a Drizzle database instance connected to PostgreSQL.
5
+ * Creates a Drizzle database instance connected to PostgreSQL using node-postgres (pg).
6
6
  *
7
- * @param connectionString - PostgreSQL connection string
7
+ * @param config - PostgreSQL connection string or PoolConfig object
8
8
  * @returns Drizzle database instance with schema
9
9
  */
10
- export function createDatabase(connectionString) {
11
- const client = postgres(connectionString);
12
- return drizzle(client, { schema });
10
+ export function createDatabase(config) {
11
+ const pool = new Pool(typeof config === 'string' ? { connectionString: config } : config);
12
+ return drizzle(pool, { schema });
13
13
  }
14
14
  export { schema };
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/storage/drizzle/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,MAAM,yBAAyB,CAAC;AAC3E,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAInC;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,gBAAwB;IACnD,MAAM,MAAM,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC1C,OAAO,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/storage/drizzle/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuB,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,IAAI,EAAmB,MAAM,IAAI,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAInC;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAA2B;IACtD,MAAM,IAAI,GAAG,IAAI,IAAI,CACjB,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CACrE,CAAC;IACF,OAAO,OAAO,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AACrC,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mshowes/brackets-manager",
3
- "version": "1.8.9",
3
+ "version": "1.8.10",
4
4
  "description": "A simple library to manage tournament brackets (based on brackets-manager.js)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,11 +19,12 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "drizzle-orm": "^0.38.4",
22
- "postgres": "^3.4.7",
22
+ "pg": "^8.13.1",
23
23
  "uuid": "^9.0.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "18.11.9",
27
+ "@types/pg": "^8.11.10",
27
28
  "@types/uuid": "^9.0.2",
28
29
  "@typescript-eslint/eslint-plugin": "^5.42.0",
29
30
  "@typescript-eslint/parser": "^5.42.0",