@take-out/postgres 0.0.99 → 0.1.0

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.
@@ -23,7 +23,7 @@ __export(createServerHelpers_exports, {
23
23
  createServerHelpers: () => createServerHelpers
24
24
  });
25
25
  module.exports = __toCommonJS(createServerHelpers_exports);
26
- var import_getDBClient = require("./getDBClient.cjs"),
26
+ var import_getDBClient = require("./helpers/getDBClient.cjs"),
27
27
  import_sql = require("./sql.cjs");
28
28
  function createServerHelpers(pool) {
29
29
  const sql = (0, import_sql.createSql)(pool);
@@ -17,7 +17,7 @@ __export(createServerHelpers_exports, {
17
17
  createServerHelpers: () => createServerHelpers
18
18
  });
19
19
  module.exports = __toCommonJS(createServerHelpers_exports);
20
- var import_getDBClient = require("./getDBClient"), import_sql = require("./sql");
20
+ var import_getDBClient = require("./helpers/getDBClient"), import_sql = require("./sql");
21
21
  function createServerHelpers(pool) {
22
22
  const sql = (0, import_sql.createSql)(pool);
23
23
  return (0, import_sql.setDefaultPool)(pool), {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/createServerHelpers.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAqD,0BACrD,aAA0C;AAWnC,SAAS,oBAAoB,MAA2B;AAC7D,QAAM,UAAM,sBAAU,IAAI;AAC1B,wCAAe,IAAI,GAEZ;AAAA,IACL;AAAA,IACA,aAAa,CAAC,UAAU,CAAC,UAAM,gCAAY,EAAE,MAAM,GAAG,QAAQ,CAAC;AAAA,EACjE;AACF;",
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAqD,kCACrD,aAA0C;AAWnC,SAAS,oBAAoB,MAA2B;AAC7D,QAAM,UAAM,sBAAU,IAAI;AAC1B,wCAAe,IAAI,GAEZ;AAAA,IACL;AAAA,IACA,aAAa,CAAC,UAAU,CAAC,UAAM,gCAAY,EAAE,MAAM,GAAG,QAAQ,CAAC;AAAA,EACjE;AACF;",
5
5
  "names": []
6
6
  }
@@ -1,7 +1,9 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all) __defProp(target, name, {
7
9
  get: all[name],
@@ -15,12 +17,22 @@ var __export = (target, all) => {
15
17
  });
16
18
  return to;
17
19
  };
18
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
20
- }), mod);
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
21
32
  var index_exports = {};
22
33
  __export(index_exports, {
23
- createDb: () => import_createDb.createDb,
34
+ createDb: () => createDb,
35
+ createPool: () => createPool,
24
36
  createServerHelpers: () => import_createServerHelpers.createServerHelpers,
25
37
  createSql: () => import_sql.createSql,
26
38
  getDBClient: () => import_getDBClient.getDBClient,
@@ -29,8 +41,19 @@ __export(index_exports, {
29
41
  updateInChunks: () => import_chunkedQuery.updateInChunks
30
42
  });
31
43
  module.exports = __toCommonJS(index_exports);
32
- var import_sql = require("./sql.cjs"),
44
+ var import_node_postgres = require("drizzle-orm/node-postgres"),
45
+ import_pg = __toESM(require("pg"), 1),
46
+ import_sql = require("./sql.cjs"),
33
47
  import_createServerHelpers = require("./createServerHelpers.cjs"),
34
- import_getDBClient = require("./getDBClient.cjs"),
35
- import_chunkedQuery = require("./chunkedQuery.cjs"),
36
- import_createDb = require("./createDb.cjs");
48
+ import_getDBClient = require("./helpers/getDBClient.cjs"),
49
+ import_chunkedQuery = require("./helpers/chunkedQuery.cjs");
50
+ const createPool = connectionString => new import_pg.default.Pool({
51
+ connectionString
52
+ }),
53
+ createDb = (connectionString, schema) => {
54
+ const pool = createPool(connectionString);
55
+ return (0, import_node_postgres.drizzle)(pool, {
56
+ schema,
57
+ logger: !1
58
+ });
59
+ };
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __export = (target, all) => {
6
7
  for (var name in all)
7
8
  __defProp(target, name, { get: all[name], enumerable: !0 });
@@ -11,10 +12,18 @@ var __export = (target, all) => {
11
12
  !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
13
  return to;
13
14
  };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
23
  var index_exports = {};
16
24
  __export(index_exports, {
17
- createDb: () => import_createDb.createDb,
25
+ createDb: () => createDb,
26
+ createPool: () => createPool,
18
27
  createServerHelpers: () => import_createServerHelpers.createServerHelpers,
19
28
  createSql: () => import_sql.createSql,
20
29
  getDBClient: () => import_getDBClient.getDBClient,
@@ -23,5 +32,14 @@ __export(index_exports, {
23
32
  updateInChunks: () => import_chunkedQuery.updateInChunks
24
33
  });
25
34
  module.exports = __toCommonJS(index_exports);
26
- var import_sql = require("./sql"), import_createServerHelpers = require("./createServerHelpers"), import_getDBClient = require("./getDBClient"), import_chunkedQuery = require("./chunkedQuery"), import_createDb = require("./createDb");
35
+ var import_node_postgres = require("drizzle-orm/node-postgres"), import_pg = __toESM(require("pg"), 1), import_sql = require("./sql"), import_createServerHelpers = require("./createServerHelpers"), import_getDBClient = require("./helpers/getDBClient"), import_chunkedQuery = require("./helpers/chunkedQuery");
36
+ const createPool = (connectionString) => new import_pg.default.Pool({
37
+ connectionString
38
+ }), createDb = (connectionString, schema) => {
39
+ const pool = createPool(connectionString);
40
+ return (0, import_node_postgres.drizzle)(pool, {
41
+ schema,
42
+ logger: !1
43
+ });
44
+ };
27
45
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAyC,kBACzC,6BAAwD,kCACxD,qBAA8D,0BAC9D,sBAAgD,2BAChD,kBAAyB;",
5
- "names": []
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAwB,sCACxB,YAAe,2BAyBf,aAAyC,kBAEzC,6BAAwD,kCAExD,qBAA8D,kCAE9D,sBAAgD;AA1BzC,MAAM,aAAa,CAAC,qBAClB,IAAI,UAAAA,QAAG,KAAK;AAAA,EACjB;AACF,CAAC,GAGU,WAAW,CACtB,kBACA,WAC4B;AAC5B,QAAM,OAAO,WAAW,gBAAgB;AACxC,aAAO,8BAAQ,MAAM;AAAA,IACnB;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AACH;",
5
+ "names": ["pg"]
6
6
  }
@@ -24,7 +24,7 @@ __export(migrate_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(migrate_exports);
26
26
  var import_node_path = require("node:path"),
27
- import_getDBClient = require("./getDBClient.cjs");
27
+ import_getDBClient = require("./helpers/getDBClient.cjs");
28
28
  const isServerless = !!(process.env.AWS_LAMBDA_FUNCTION_NAME || process.env.AWS_LAMBDA_RUNTIME_API || process.env.LAMBDA_RUNTIME_DIR || process.env.IS_SERVERLESS);
29
29
  async function migrate(options) {
30
30
  const {
@@ -17,7 +17,7 @@ __export(migrate_exports, {
17
17
  migrate: () => migrate
18
18
  });
19
19
  module.exports = __toCommonJS(migrate_exports);
20
- var import_node_path = require("node:path"), import_getDBClient = require("./getDBClient");
20
+ var import_node_path = require("node:path"), import_getDBClient = require("./helpers/getDBClient");
21
21
  const isServerless = !!(process.env.AWS_LAMBDA_FUNCTION_NAME || process.env.AWS_LAMBDA_RUNTIME_API || process.env.LAMBDA_RUNTIME_DIR || process.env.IS_SERVERLESS);
22
22
  async function migrate(options) {
23
23
  const {
@@ -1,4 +1,4 @@
1
- import { getDBClient } from "./getDBClient";
1
+ import { getDBClient } from "./helpers/getDBClient";
2
2
  import { createSql, setDefaultPool } from "./sql";
3
3
  function createServerHelpers(pool) {
4
4
  const sql = createSql(pool);
@@ -1,4 +1,4 @@
1
- import { getDBClient } from "./getDBClient.mjs";
1
+ import { getDBClient } from "./helpers/getDBClient.mjs";
2
2
  import { createSql, setDefaultPool } from "./sql.mjs";
3
3
  function createServerHelpers(pool) {
4
4
  const sql = createSql(pool);
package/dist/esm/index.js CHANGED
@@ -1,10 +1,21 @@
1
+ import { drizzle } from "drizzle-orm/node-postgres";
2
+ import pg from "pg";
1
3
  import { createSql } from "./sql";
2
4
  import { createServerHelpers } from "./createServerHelpers";
3
- import { getDBClient, queryDb } from "./getDBClient";
4
- import { processInChunks, updateInChunks } from "./chunkedQuery";
5
- import { createDb } from "./createDb";
5
+ import { getDBClient, queryDb } from "./helpers/getDBClient";
6
+ import { processInChunks, updateInChunks } from "./helpers/chunkedQuery";
7
+ const createPool = (connectionString) => new pg.Pool({
8
+ connectionString
9
+ }), createDb = (connectionString, schema) => {
10
+ const pool = createPool(connectionString);
11
+ return drizzle(pool, {
12
+ schema,
13
+ logger: !1
14
+ });
15
+ };
6
16
  export {
7
17
  createDb,
18
+ createPool,
8
19
  createServerHelpers,
9
20
  createSql,
10
21
  getDBClient,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": "AAAA,SAAS,iBAAgC;AACzC,SAAS,2BAA+C;AACxD,SAAS,aAAa,eAAwC;AAC9D,SAAS,iBAAiB,sBAAsB;AAChD,SAAS,gBAAgB;",
4
+ "mappings": "AAAA,SAAS,eAAe;AACxB,OAAO,QAAQ;AAyBf,SAAS,iBAAgC;AAEzC,SAAS,2BAA+C;AAExD,SAAS,aAAa,eAAwC;AAE9D,SAAS,iBAAiB,sBAAsB;AA1BzC,MAAM,aAAa,CAAC,qBAClB,IAAI,GAAG,KAAK;AAAA,EACjB;AACF,CAAC,GAGU,WAAW,CACtB,kBACA,WAC4B;AAC5B,QAAM,OAAO,WAAW,gBAAgB;AACxC,SAAO,QAAQ,MAAM;AAAA,IACnB;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AACH;",
5
5
  "names": []
6
6
  }
@@ -1,7 +1,18 @@
1
+ import { drizzle } from "drizzle-orm/node-postgres";
2
+ import pg from "pg";
1
3
  import { createSql } from "./sql.mjs";
2
4
  import { createServerHelpers } from "./createServerHelpers.mjs";
3
- import { getDBClient, queryDb } from "./getDBClient.mjs";
4
- import { processInChunks, updateInChunks } from "./chunkedQuery.mjs";
5
- import { createDb } from "./createDb.mjs";
6
- export { createDb, createServerHelpers, createSql, getDBClient, processInChunks, queryDb, updateInChunks };
5
+ import { getDBClient, queryDb } from "./helpers/getDBClient.mjs";
6
+ import { processInChunks, updateInChunks } from "./helpers/chunkedQuery.mjs";
7
+ const createPool = connectionString => new pg.Pool({
8
+ connectionString
9
+ }),
10
+ createDb = (connectionString, schema) => {
11
+ const pool = createPool(connectionString);
12
+ return drizzle(pool, {
13
+ schema,
14
+ logger: !1
15
+ });
16
+ };
17
+ export { createDb, createPool, createServerHelpers, createSql, getDBClient, processInChunks, queryDb, updateInChunks };
7
18
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["createSql","createServerHelpers","getDBClient","queryDb","processInChunks","updateInChunks","createDb"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,SAAA,QAAgC;AACzC,SAASC,mBAAA,QAA+C;AACxD,SAASC,WAAA,EAAaC,OAAA,QAAwC;AAC9D,SAASC,eAAA,EAAiBC,cAAA,QAAsB;AAChD,SAASC,QAAA,QAAgB","ignoreList":[]}
1
+ {"version":3,"names":["drizzle","pg","createSql","createServerHelpers","getDBClient","queryDb","processInChunks","updateInChunks","createPool","connectionString","Pool","createDb","schema","pool","logger"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,OAAA,QAAe;AACxB,OAAOC,EAAA,MAAQ;AAyBf,SAASC,SAAA,QAAgC;AAEzC,SAASC,mBAAA,QAA+C;AAExD,SAASC,WAAA,EAAaC,OAAA,QAAwC;AAE9D,SAASC,eAAA,EAAiBC,cAAA,QAAsB;AA1BzC,MAAMC,UAAA,GAAcC,gBAAA,IAClB,IAAIR,EAAA,CAAGS,IAAA,CAAK;IACjBD;EACF,CAAC;EAGUE,QAAA,GAAWA,CACtBF,gBAAA,EACAG,MAAA,KAC4B;IAC5B,MAAMC,IAAA,GAAOL,UAAA,CAAWC,gBAAgB;IACxC,OAAOT,OAAA,CAAQa,IAAA,EAAM;MACnBD,MAAA;MACAE,MAAA,EAAQ;IACV,CAAC;EACH","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { basename } from "node:path";
2
- import { getDBClient } from "./getDBClient";
2
+ import { getDBClient } from "./helpers/getDBClient";
3
3
  const isServerless = !!(process.env.AWS_LAMBDA_FUNCTION_NAME || process.env.AWS_LAMBDA_RUNTIME_API || process.env.LAMBDA_RUNTIME_DIR || process.env.IS_SERVERLESS);
4
4
  async function migrate(options) {
5
5
  const {
@@ -1,5 +1,5 @@
1
1
  import { basename } from "node:path";
2
- import { getDBClient } from "./getDBClient.mjs";
2
+ import { getDBClient } from "./helpers/getDBClient.mjs";
3
3
  const isServerless = !!(process.env.AWS_LAMBDA_FUNCTION_NAME || process.env.AWS_LAMBDA_RUNTIME_API || process.env.LAMBDA_RUNTIME_DIR || process.env.IS_SERVERLESS);
4
4
  async function migrate(options) {
5
5
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@take-out/postgres",
3
- "version": "0.0.99",
3
+ "version": "0.1.0",
4
4
  "sideEffects": false,
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/cjs",
@@ -36,14 +36,24 @@
36
36
  "require": "./dist/cjs/index.cjs",
37
37
  "default": "./dist/esm/index.mjs"
38
38
  },
39
- "./*": {
40
- "types": "./types/*.d.ts",
41
- "import": "./dist/esm/*.mjs",
42
- "require": "./dist/cjs/*.cjs"
39
+ "./migrate": {
40
+ "types": "./types/migrate.d.ts",
41
+ "import": "./dist/esm/migrate.mjs",
42
+ "require": "./dist/cjs/migrate.cjs"
43
+ },
44
+ "./build": {
45
+ "types": "./types/build.d.ts",
46
+ "import": "./dist/esm/build.mjs",
47
+ "require": "./dist/cjs/build.cjs"
48
+ },
49
+ "./scripts/*": {
50
+ "types": "./types/scripts/*.d.ts",
51
+ "import": "./dist/esm/scripts/*.mjs",
52
+ "require": "./dist/cjs/scripts/*.cjs"
43
53
  }
44
54
  },
45
55
  "dependencies": {
46
- "@take-out/helpers": "0.0.99",
56
+ "@take-out/helpers": "0.1.0",
47
57
  "async-retry": "^1.3.3",
48
58
  "citty": "^0.1.6"
49
59
  },
@@ -1,4 +1,4 @@
1
- import { getDBClient, type GetDBClientOptions } from './getDBClient'
1
+ import { getDBClient, type GetDBClientOptions } from './helpers/getDBClient'
2
2
  import { createSql, setDefaultPool } from './sql'
3
3
 
4
4
  import type { Pool } from 'pg'
package/src/index.ts CHANGED
@@ -1,5 +1,33 @@
1
+ import { drizzle } from 'drizzle-orm/node-postgres'
2
+ import pg from 'pg'
3
+
4
+ import type { NodePgDatabase } from 'drizzle-orm/node-postgres'
5
+ import type { Pool } from 'pg'
6
+
7
+ export const createPool = (connectionString: string): Pool => {
8
+ return new pg.Pool({
9
+ connectionString,
10
+ })
11
+ }
12
+
13
+ export const createDb = <TSchema extends Record<string, unknown>>(
14
+ connectionString: string,
15
+ schema: TSchema
16
+ ): NodePgDatabase<TSchema> => {
17
+ const pool = createPool(connectionString)
18
+ return drizzle(pool, {
19
+ schema,
20
+ logger: false,
21
+ }) as NodePgDatabase<TSchema>
22
+ }
23
+
24
+ export type { NodePgDatabase }
25
+
26
+ // re-export for convenience
1
27
  export { createSql, type SqlQuery } from './sql'
28
+
2
29
  export { createServerHelpers, type ServerHelpers } from './createServerHelpers'
3
- export { getDBClient, queryDb, type GetDBClientOptions } from './getDBClient'
4
- export { processInChunks, updateInChunks } from './chunkedQuery'
5
- export { createDb } from './createDb'
30
+
31
+ export { getDBClient, queryDb, type GetDBClientOptions } from './helpers/getDBClient'
32
+
33
+ export { processInChunks, updateInChunks } from './helpers/chunkedQuery'
package/src/migrate.ts CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  import { basename } from 'node:path'
12
12
 
13
- import { getDBClient } from './getDBClient'
13
+ import { getDBClient } from './helpers/getDBClient'
14
14
 
15
15
  import type { PoolClient } from 'pg'
16
16
 
@@ -1,4 +1,4 @@
1
- import { getDBClient, type GetDBClientOptions } from './getDBClient';
1
+ import { getDBClient, type GetDBClientOptions } from './helpers/getDBClient';
2
2
  import { createSql } from './sql';
3
3
  import type { Pool } from 'pg';
4
4
  export type ServerHelpers = {
@@ -1 +1 @@
1
- {"version":3,"file":"createServerHelpers.d.ts","sourceRoot":"","sources":["../src/createServerHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACpE,OAAO,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAA;AAEjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AAE9B,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAA;IACjC,WAAW,EAAE,CACX,OAAO,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,kBAAkB,CAAC,KAC5D,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA;CACpC,CAAA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,CAQ7D"}
1
+ {"version":3,"file":"createServerHelpers.d.ts","sourceRoot":"","sources":["../src/createServerHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAA;AAEjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AAE9B,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAA;IACjC,WAAW,EAAE,CACX,OAAO,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,kBAAkB,CAAC,KAC5D,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA;CACpC,CAAA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,CAQ7D"}
package/types/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
+ import type { NodePgDatabase } from 'drizzle-orm/node-postgres';
2
+ import type { Pool } from 'pg';
3
+ export declare const createPool: (connectionString: string) => Pool;
4
+ export declare const createDb: <TSchema extends Record<string, unknown>>(connectionString: string, schema: TSchema) => NodePgDatabase<TSchema>;
5
+ export type { NodePgDatabase };
1
6
  export { createSql, type SqlQuery } from './sql';
2
7
  export { createServerHelpers, type ServerHelpers } from './createServerHelpers';
3
- export { getDBClient, queryDb, type GetDBClientOptions } from './getDBClient';
4
- export { processInChunks, updateInChunks } from './chunkedQuery';
5
- export { createDb } from './createDb';
8
+ export { getDBClient, queryDb, type GetDBClientOptions } from './helpers/getDBClient';
9
+ export { processInChunks, updateInChunks } from './helpers/chunkedQuery';
6
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC/E,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AAE9B,eAAO,MAAM,UAAU,GAAI,kBAAkB,MAAM,KAAG,IAIrD,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,kBAAkB,MAAM,EACxB,QAAQ,OAAO,KACd,cAAc,CAAC,OAAO,CAMxB,CAAA;AAED,YAAY,EAAE,cAAc,EAAE,CAAA;AAG9B,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE/E,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAErF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA"}
package/src/createDb.ts DELETED
@@ -1,14 +0,0 @@
1
- import { type NodePgDatabase, drizzle } from 'drizzle-orm/node-postgres'
2
-
3
- import { createPool } from './createPool'
4
-
5
- export const createDb = <TSchema extends Record<string, unknown>>(
6
- connectionString: string,
7
- schema: TSchema
8
- ): NodePgDatabase<TSchema> => {
9
- const pool = createPool(connectionString)
10
- return drizzle(pool, {
11
- schema,
12
- logger: false,
13
- }) as NodePgDatabase<TSchema>
14
- }
package/src/createPool.ts DELETED
@@ -1,7 +0,0 @@
1
- import pg, { type Pool } from 'pg'
2
-
3
- export const createPool = (connectionString: string): Pool => {
4
- return new pg.Pool({
5
- connectionString,
6
- })
7
- }
File without changes