purplekit 1.0.4 → 1.0.6
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/README.md +46 -6
- package/build/src/app.js +48 -12
- package/build/src/app.js.map +1 -1
- package/build/src/config/constants.d.ts +2 -1
- package/build/src/config/constants.d.ts.map +1 -1
- package/build/src/config/constants.js +3 -1
- package/build/src/config/constants.js.map +1 -1
- package/build/src/config/index.d.ts +7 -1
- package/build/src/config/index.d.ts.map +1 -1
- package/build/src/config/index.js +30 -1
- package/build/src/config/index.js.map +1 -1
- package/build/src/features/createdb.d.ts +1 -1
- package/build/src/features/createdb.d.ts.map +1 -1
- package/build/src/features/createdb.js +6 -7
- package/build/src/features/createdb.js.map +1 -1
- package/build/src/features/dropdb.d.ts +1 -1
- package/build/src/features/dropdb.d.ts.map +1 -1
- package/build/src/features/dropdb.js +6 -7
- package/build/src/features/dropdb.js.map +1 -1
- package/build/src/features/gen.d.ts +5 -5
- package/build/src/features/gen.d.ts.map +1 -1
- package/build/src/features/gen.js +17 -15
- package/build/src/features/gen.js.map +1 -1
- package/build/src/features/init.d.ts +1 -1
- package/build/src/features/init.d.ts.map +1 -1
- package/build/src/features/init.js +18 -9
- package/build/src/features/init.js.map +1 -1
- package/build/src/features/migrate.d.ts +3 -2
- package/build/src/features/migrate.d.ts.map +1 -1
- package/build/src/features/migrate.js +28 -39
- package/build/src/features/migrate.js.map +1 -1
- package/build/src/features/migration.d.ts +3 -1
- package/build/src/features/migration.d.ts.map +1 -1
- package/build/src/features/migration.js +13 -8
- package/build/src/features/migration.js.map +1 -1
- package/build/src/features/seed.d.ts +1 -1
- package/build/src/features/seed.d.ts.map +1 -1
- package/build/src/features/seed.js +5 -8
- package/build/src/features/seed.js.map +1 -1
- package/build/src/features/status.d.ts +1 -1
- package/build/src/features/status.d.ts.map +1 -1
- package/build/src/features/status.js +11 -19
- package/build/src/features/status.js.map +1 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js.map +1 -1
- package/build/src/libs/compare-mig.d.ts +2 -2
- package/build/src/libs/compare-mig.d.ts.map +1 -1
- package/build/src/libs/compare-mig.js +12 -11
- package/build/src/libs/compare-mig.js.map +1 -1
- package/build/src/libs/create-ds.d.ts +19 -1
- package/build/src/libs/create-ds.d.ts.map +1 -1
- package/build/src/libs/create-ds.js +35 -8
- package/build/src/libs/create-ds.js.map +1 -1
- package/build/src/libs/format-error.d.ts +12 -0
- package/build/src/libs/format-error.d.ts.map +1 -0
- package/build/src/libs/format-error.js +56 -0
- package/build/src/libs/format-error.js.map +1 -0
- package/build/src/libs/get-commands.d.ts +9 -9
- package/build/src/libs/get-commands.d.ts.map +1 -1
- package/build/src/libs/get-commands.js +10 -35
- package/build/src/libs/get-commands.js.map +1 -1
- package/build/src/libs/print.d.ts +1 -1
- package/build/src/libs/print.js +2 -2
- package/build/src/libs/print.js.map +1 -1
- package/build/src/libs/sanitize.d.ts +8 -4
- package/build/src/libs/sanitize.d.ts.map +1 -1
- package/build/src/libs/sanitize.js +19 -9
- package/build/src/libs/sanitize.js.map +1 -1
- package/build/src/libs/version.d.ts +10 -0
- package/build/src/libs/version.d.ts.map +1 -0
- package/build/src/libs/version.js +64 -0
- package/build/src/libs/version.js.map +1 -0
- package/build/src/types.d.ts +12 -2
- package/build/src/types.d.ts.map +1 -1
- package/package.json +7 -5
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getVersion = getVersion;
|
|
37
|
+
const node_fs_1 = require("node:fs");
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
/**
|
|
40
|
+
* Reads the purplekit version from its own `package.json`.
|
|
41
|
+
* Walks up from this file so it works from both `src/` (dev via tsx) and
|
|
42
|
+
* `build/src/` (published package).
|
|
43
|
+
*
|
|
44
|
+
* @returns The package version, or `'unknown'` if it cannot be found.
|
|
45
|
+
*/
|
|
46
|
+
function getVersion() {
|
|
47
|
+
let dir = __dirname;
|
|
48
|
+
for (let i = 0; i < 5; i++) {
|
|
49
|
+
const file = path.join(dir, 'package.json');
|
|
50
|
+
if ((0, node_fs_1.existsSync)(file)) {
|
|
51
|
+
try {
|
|
52
|
+
const pkg = JSON.parse((0, node_fs_1.readFileSync)(file, 'utf-8'));
|
|
53
|
+
if (pkg.name === 'purplekit' && pkg.version)
|
|
54
|
+
return pkg.version;
|
|
55
|
+
}
|
|
56
|
+
catch (_a) {
|
|
57
|
+
// unreadable package.json; keep walking up
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
dir = path.dirname(dir);
|
|
61
|
+
}
|
|
62
|
+
return 'unknown';
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/libs/version.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BS,gCAAU;AA9BnB,qCAAmD;AACnD,gDAAkC;AAElC;;;;;;GAMG;AACH,SAAS,UAAU;IACjB,IAAI,GAAG,GAAG,SAAS,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QAC5C,IAAI,IAAA,oBAAU,EAAC,IAAI,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAGjD,CAAC;gBACF,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,OAAO;oBAAE,OAAO,GAAG,CAAC,OAAO,CAAC;YAClE,CAAC;YAAC,WAAM,CAAC;gBACP,2CAA2C;YAC7C,CAAC;QACH,CAAC;QACD,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/build/src/types.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { EntitySchema, MixedList, DataSourceOptions } from 'typeorm';
|
|
|
2
2
|
import { Seeder } from 'typeorm-extension';
|
|
3
3
|
export type GENERATE_MIGRATIONS = {
|
|
4
4
|
name?: string;
|
|
5
|
-
force?: boolean;
|
|
6
5
|
};
|
|
7
6
|
export type CREATE_DB = {
|
|
8
7
|
name?: string;
|
|
@@ -24,12 +23,23 @@ export type MIGRATION = {
|
|
|
24
23
|
export type SEED = {
|
|
25
24
|
db?: string;
|
|
26
25
|
};
|
|
26
|
+
/** Database types purplekit supports end to end. */
|
|
27
|
+
export type SupportedType = Extract<DataSourceOptions['type'], 'postgres' | 'mysql' | 'mariadb'>;
|
|
27
28
|
export type PURPLEKIT_CONFIGURATIONS = {
|
|
28
|
-
TYPE:
|
|
29
|
+
TYPE: SupportedType;
|
|
29
30
|
ENTITIES: MixedList<string | Function | EntitySchema<any>>;
|
|
30
31
|
SEEDS: (new () => Seeder)[];
|
|
32
|
+
/**
|
|
33
|
+
* `light` encrypts the connection; `heavy` also supplies
|
|
34
|
+
* `DATABASE_CA_CERT` as the trusted CA.
|
|
35
|
+
*/
|
|
31
36
|
SSL_TYPE: 'light' | 'heavy';
|
|
32
37
|
SSL_MODE: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the driver rejects servers whose certificate does not verify,
|
|
40
|
+
* in both `light` and `heavy` mode. Defaults to `false`.
|
|
41
|
+
*/
|
|
42
|
+
SSL_REJECT_UNAUTHORIZED?: boolean;
|
|
33
43
|
DATABASE_CA_CERT: string;
|
|
34
44
|
DATABASE_HOST: string;
|
|
35
45
|
DATABASE_PORT: number;
|
package/build/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACrE,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CAAC,UAAU,MAAM,CAAC,EAAE,CAAC;IAE5B;;;OAGG;IACH,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,wBAAwB,GAAG;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,SAAS,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC;CAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "purplekit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Opinionated TypeORM database tooling for migrations, status checks, and seeders.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,10 +41,13 @@
|
|
|
41
41
|
"cli",
|
|
42
42
|
"postgres",
|
|
43
43
|
"mysql",
|
|
44
|
-
"
|
|
44
|
+
"mariadb"
|
|
45
45
|
],
|
|
46
46
|
"author": "Daniel Bello",
|
|
47
47
|
"license": "ISC",
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": "^22.13.0 || ^23.5.0 || >=24.0.0"
|
|
50
|
+
},
|
|
48
51
|
"packageManager": "pnpm@10.15.0",
|
|
49
52
|
"devDependencies": {
|
|
50
53
|
"@testcontainers/postgresql": "^12.0.4",
|
|
@@ -59,12 +62,11 @@
|
|
|
59
62
|
"sctree-cli": "^1.1.0",
|
|
60
63
|
"tsc-alias": "^1.8.17",
|
|
61
64
|
"tsconfig-paths": "^4.2.0",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
65
|
+
"typeorm": "^0.3.31",
|
|
66
|
+
"typescript": "^6.0.3"
|
|
64
67
|
},
|
|
65
68
|
"dependencies": {
|
|
66
69
|
"commander": "^15.0.0",
|
|
67
|
-
"execa": "^9.6.1",
|
|
68
70
|
"mysql2": "^3.22.5",
|
|
69
71
|
"node-sql-parser": "^5.4.0",
|
|
70
72
|
"picocolors": "^1.1.1",
|