sqerge 2.0.2 → 3.1.3

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/dist/bootstrap.js CHANGED
@@ -15,14 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.default = bootstrap;
26
37
  const node_path_1 = require("node:path");
27
38
  const postgres_1 = __importStar(require("postgres"));
28
39
  const index_1 = __importStar(require("./index"));
@@ -61,7 +72,6 @@ async function bootstrap() {
61
72
  process.exit(1);
62
73
  }
63
74
  }
64
- exports.default = bootstrap;
65
75
  function isNodeError(value, errorType) {
66
76
  return value instanceof errorType;
67
77
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Sql } from 'postgres';
2
- export default function migrate(sql: Sql<{}>, fileDir: string, options?: {
2
+ export default function migrate(sql: Sql, fileDir: string, options?: {
3
3
  role?: string;
4
4
  log?: typeof console.log;
5
5
  }): Promise<void>;
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SqergeError = void 0;
4
+ exports.default = migrate;
4
5
  const fs_1 = require("fs");
5
6
  const node_path_1 = require("node:path");
6
7
  const node_util_1 = require("node:util");
@@ -11,7 +12,9 @@ async function migrate(sql, fileDir, options) {
11
12
  log && log('%O file(s) found in %O', fileList.length, fileDir);
12
13
  if (fileList.length === 0)
13
14
  return;
14
- await sql.begin(async (sql) => {
15
+ await sql.begin(async (trx) => {
16
+ // TypeScript workaround for https://github.com/porsager/postgres/issues/1143
17
+ const sql = trx;
15
18
  if (typeof options?.role === 'string') {
16
19
  await sql `set role ${sql(options.role)};`;
17
20
  }
@@ -56,7 +59,6 @@ async function migrate(sql, fileDir, options) {
56
59
  }
57
60
  });
58
61
  }
59
- exports.default = migrate;
60
62
  class SqergeError extends Error {
61
63
  constructor(code, message, ...args) {
62
64
  super((0, node_util_1.formatWithOptions)({ colors: true }, message, ...args));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sqerge",
3
- "version": "2.0.2",
3
+ "version": "3.1.3",
4
4
  "description": "A forward only PostgreSQL migration tool.",
5
5
  "keywords": [
6
6
  "postgres",
@@ -22,16 +22,18 @@
22
22
  "author": "Eric Zingeler <eezing@gmail.com>",
23
23
  "main": "dist/index.js",
24
24
  "types": "dist/index.d.ts",
25
- "bin": "bin.js",
25
+ "bin": {
26
+ "sqerge": "bin.js"
27
+ },
26
28
  "scripts": {
27
29
  "build": "rm -rf dist && tsc --build",
28
30
  "dev": "tsc -w",
29
31
  "dev:postgres": "PGHOST=localhost PGPORT=5438 PGUSER=jonathan PGPASSWORD=iliketurtles PGDATABASE=dev NAME=sqerge RESET=true TAG=14 pglocal",
30
- "prepare": "husky install",
31
32
  "test": "npm run test:prettier && npm run test:jest",
32
33
  "test:jest": "jest",
33
34
  "test:jest:watch": "jest --watch",
34
- "test:prettier": "prettier -c ."
35
+ "test:prettier": "prettier -c .",
36
+ "prepare": "husky"
35
37
  },
36
38
  "prettier": {
37
39
  "bracketSpacing": true,
@@ -51,12 +53,12 @@
51
53
  "devDependencies": {
52
54
  "@eezing/pglocal": "^1.0.8",
53
55
  "@types/jest": "^29.1.2",
54
- "@types/node": "^16.11.59",
55
- "husky": "^8.0.0",
56
+ "@types/node": "^24.10.9",
57
+ "husky": "^9.0.11",
56
58
  "jest": "^29.1.2",
57
- "prettier": "^2.7.1",
59
+ "prettier": "^3.2.5",
58
60
  "ts-jest": "^29.0.3",
59
- "typescript": "^4.8.4"
61
+ "typescript": "^5.4.5"
60
62
  },
61
63
  "peerDependencies": {
62
64
  "postgres": "^3.x"
@@ -67,6 +69,6 @@
67
69
  }
68
70
  },
69
71
  "engines": {
70
- "node": ">=14 <=18"
72
+ "node": ">=18"
71
73
  }
72
74
  }