purplekit 1.0.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.
- package/README.md +103 -0
- package/bin/dataforge +2 -0
- package/build/src/app.d.ts +2 -0
- package/build/src/app.d.ts.map +1 -0
- package/build/src/app.js +63 -0
- package/build/src/app.js.map +1 -0
- package/build/src/config/constants.d.ts +8 -0
- package/build/src/config/constants.d.ts.map +1 -0
- package/build/src/config/constants.js +16 -0
- package/build/src/config/constants.js.map +1 -0
- package/build/src/config/index.d.ts +4 -0
- package/build/src/config/index.d.ts.map +1 -0
- package/build/src/config/index.js +79 -0
- package/build/src/config/index.js.map +1 -0
- package/build/src/features/createdb.d.ts +21 -0
- package/build/src/features/createdb.d.ts.map +1 -0
- package/build/src/features/createdb.js +80 -0
- package/build/src/features/createdb.js.map +1 -0
- package/build/src/features/dropdb.d.ts +18 -0
- package/build/src/features/dropdb.d.ts.map +1 -0
- package/build/src/features/dropdb.js +70 -0
- package/build/src/features/dropdb.js.map +1 -0
- package/build/src/features/gen.d.ts +84 -0
- package/build/src/features/gen.d.ts.map +1 -0
- package/build/src/features/gen.js +241 -0
- package/build/src/features/gen.js.map +1 -0
- package/build/src/features/index.d.ts +9 -0
- package/build/src/features/index.d.ts.map +1 -0
- package/build/src/features/index.js +20 -0
- package/build/src/features/index.js.map +1 -0
- package/build/src/features/init.d.ts +7 -0
- package/build/src/features/init.d.ts.map +1 -0
- package/build/src/features/init.js +118 -0
- package/build/src/features/init.js.map +1 -0
- package/build/src/features/migrate.d.ts +83 -0
- package/build/src/features/migrate.d.ts.map +1 -0
- package/build/src/features/migrate.js +331 -0
- package/build/src/features/migrate.js.map +1 -0
- package/build/src/features/migration.d.ts +28 -0
- package/build/src/features/migration.d.ts.map +1 -0
- package/build/src/features/migration.js +128 -0
- package/build/src/features/migration.js.map +1 -0
- package/build/src/features/seed.d.ts +9 -0
- package/build/src/features/seed.d.ts.map +1 -0
- package/build/src/features/seed.js +72 -0
- package/build/src/features/seed.js.map +1 -0
- package/build/src/features/status.d.ts +55 -0
- package/build/src/features/status.d.ts.map +1 -0
- package/build/src/features/status.js +229 -0
- package/build/src/features/status.js.map +1 -0
- package/build/src/index.d.ts +4 -0
- package/build/src/index.d.ts.map +1 -0
- package/build/src/index.js +15 -0
- package/build/src/index.js.map +1 -0
- package/build/src/libs/compare-mig.d.ts +27 -0
- package/build/src/libs/compare-mig.d.ts.map +1 -0
- package/build/src/libs/compare-mig.js +215 -0
- package/build/src/libs/compare-mig.js.map +1 -0
- package/build/src/libs/create-ds.d.ts +10 -0
- package/build/src/libs/create-ds.d.ts.map +1 -0
- package/build/src/libs/create-ds.js +56 -0
- package/build/src/libs/create-ds.js.map +1 -0
- package/build/src/libs/get-commands.d.ts +45 -0
- package/build/src/libs/get-commands.d.ts.map +1 -0
- package/build/src/libs/get-commands.js +128 -0
- package/build/src/libs/get-commands.js.map +1 -0
- package/build/src/libs/paths.d.ts +22 -0
- package/build/src/libs/paths.d.ts.map +1 -0
- package/build/src/libs/paths.js +37 -0
- package/build/src/libs/paths.js.map +1 -0
- package/build/src/libs/print.d.ts +5 -0
- package/build/src/libs/print.d.ts.map +1 -0
- package/build/src/libs/print.js +18 -0
- package/build/src/libs/print.js.map +1 -0
- package/build/src/libs/sanitize.d.ts +10 -0
- package/build/src/libs/sanitize.d.ts.map +1 -0
- package/build/src/libs/sanitize.js +19 -0
- package/build/src/libs/sanitize.js.map +1 -0
- package/build/src/libs/seed-entities.d.ts +13 -0
- package/build/src/libs/seed-entities.d.ts.map +1 -0
- package/build/src/libs/seed-entities.js +40 -0
- package/build/src/libs/seed-entities.js.map +1 -0
- package/build/src/types.d.ts +49 -0
- package/build/src/types.d.ts.map +1 -0
- package/build/src/types.js +3 -0
- package/build/src/types.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,241 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.hasSchemaChanges = exports.saveMig = exports.getMetadata = exports.compareMig = exports.genMig = exports.generate = exports.gen = void 0;
|
|
49
|
+
const typeorm_extension_1 = require("typeorm-extension");
|
|
50
|
+
const create_ds_1 = require("../libs/create-ds");
|
|
51
|
+
const print_1 = require("../libs/print");
|
|
52
|
+
const config_1 = require("../config");
|
|
53
|
+
const sanitize_1 = require("../libs/sanitize");
|
|
54
|
+
const compare_mig_1 = require("../libs/compare-mig");
|
|
55
|
+
Object.defineProperty(exports, "compareMig", { enumerable: true, get: function () { return compare_mig_1.compareMig; } });
|
|
56
|
+
const migrate_1 = require("./migrate");
|
|
57
|
+
const paths_1 = require("../libs/paths");
|
|
58
|
+
const prettier_1 = __importDefault(require("prettier"));
|
|
59
|
+
const fs = __importStar(require("fs"));
|
|
60
|
+
const path = __importStar(require("path"));
|
|
61
|
+
/**
|
|
62
|
+
* Detects pending schema changes by diffing entities against the database.
|
|
63
|
+
*
|
|
64
|
+
* @param ds - Initialized TypeORM data source.
|
|
65
|
+
* @returns Whether up or down migration queries would be generated.
|
|
66
|
+
*/
|
|
67
|
+
const hasSchemaChanges = (ds) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
const builder = ds.driver.createSchemaBuilder();
|
|
69
|
+
const sqlInMemory = yield builder.log();
|
|
70
|
+
const val = sqlInMemory.upQueries.length > 0 || sqlInMemory.downQueries.length > 0;
|
|
71
|
+
return val;
|
|
72
|
+
});
|
|
73
|
+
exports.hasSchemaChanges = hasSchemaChanges;
|
|
74
|
+
/**
|
|
75
|
+
* Generates a migration preview from an initialized data source and formats it.
|
|
76
|
+
*
|
|
77
|
+
* @param ds - Initialized TypeORM data source to diff against.
|
|
78
|
+
* @param name - Migration class/name prefix.
|
|
79
|
+
* @param timestamp - Timestamp suffix TypeORM uses in the migration class.
|
|
80
|
+
* @returns Generated source, formatted source, and whether schema changes exist.
|
|
81
|
+
*/
|
|
82
|
+
const genMig = (ds, name, timestamp) => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
+
const hasChanges = yield hasSchemaChanges(ds);
|
|
84
|
+
const result = yield (0, typeorm_extension_1.generateMigration)({
|
|
85
|
+
name,
|
|
86
|
+
timestamp,
|
|
87
|
+
dataSource: ds,
|
|
88
|
+
preview: true,
|
|
89
|
+
});
|
|
90
|
+
const formatted = yield prettier_1.default.format(result.content, {
|
|
91
|
+
parser: 'typescript',
|
|
92
|
+
singleQuote: true,
|
|
93
|
+
trailingComma: 'all',
|
|
94
|
+
tabWidth: 2,
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
content: result.content,
|
|
98
|
+
formatted,
|
|
99
|
+
hasChanges,
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
exports.genMig = genMig;
|
|
103
|
+
/**
|
|
104
|
+
* Persists a generated migration file, creating its parent folder first.
|
|
105
|
+
*
|
|
106
|
+
* @param location - Destination `migration.ts` path.
|
|
107
|
+
* @param content - TypeScript migration source to write.
|
|
108
|
+
*/
|
|
109
|
+
const saveMig = (location, content) => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
+
yield fs.promises.mkdir(path.dirname(location), { recursive: true });
|
|
111
|
+
yield fs.promises.writeFile(location, content);
|
|
112
|
+
return void 0;
|
|
113
|
+
});
|
|
114
|
+
exports.saveMig = saveMig;
|
|
115
|
+
/**
|
|
116
|
+
* Builds the generated migration name and location metadata.
|
|
117
|
+
*
|
|
118
|
+
* @param name - Optional migration name prefix; defaults to `Mig`.
|
|
119
|
+
* @returns Timestamped filename, TypeORM migration name, and target file path.
|
|
120
|
+
*/
|
|
121
|
+
const getMetadata = (name) => {
|
|
122
|
+
const timestamp = Date.now();
|
|
123
|
+
const migrationName = name !== null && name !== void 0 ? name : `Mig`;
|
|
124
|
+
const filename = `${migrationName}${timestamp}`;
|
|
125
|
+
const location = (0, paths_1.getMigrationLocation)(filename);
|
|
126
|
+
return {
|
|
127
|
+
location,
|
|
128
|
+
filename,
|
|
129
|
+
migrationName,
|
|
130
|
+
timestamp,
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
exports.getMetadata = getMetadata;
|
|
134
|
+
/**
|
|
135
|
+
* Generates a migration file from current entity schemas.
|
|
136
|
+
*
|
|
137
|
+
* @param params - Generation options including target database, force flag,
|
|
138
|
+
* migration name prefix, and whether to save the file.
|
|
139
|
+
* @returns Generation outcome including title and whether changes were found.
|
|
140
|
+
*/
|
|
141
|
+
const generate = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (params = {}) {
|
|
142
|
+
var _a;
|
|
143
|
+
let initialized = false;
|
|
144
|
+
const ds = (0, create_ds_1.createDataSource)(params.db ? { database: params.db } : {});
|
|
145
|
+
const metadata = getMetadata(params.name);
|
|
146
|
+
try {
|
|
147
|
+
yield ds.initialize();
|
|
148
|
+
initialized = true;
|
|
149
|
+
const generated = yield genMig(ds, metadata.migrationName, metadata.timestamp);
|
|
150
|
+
if (!generated.hasChanges && !params.force) {
|
|
151
|
+
return {
|
|
152
|
+
generated: false,
|
|
153
|
+
more: {
|
|
154
|
+
reason: 'no-changes',
|
|
155
|
+
timestamp: metadata.timestamp,
|
|
156
|
+
title: metadata.filename,
|
|
157
|
+
saved: false,
|
|
158
|
+
location: metadata.location,
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
const dialect = (0, compare_mig_1.getParserDialect)(config_1.cfg.TYPE);
|
|
163
|
+
const existing = yield (0, migrate_1.getMigrationFiles)();
|
|
164
|
+
const duplicate = yield (0, compare_mig_1.compareMig)(generated.content, existing, dialect);
|
|
165
|
+
if (duplicate) {
|
|
166
|
+
return {
|
|
167
|
+
generated: false,
|
|
168
|
+
more: {
|
|
169
|
+
location: metadata.location,
|
|
170
|
+
reason: 'duplicate-found',
|
|
171
|
+
timestamp: metadata.timestamp,
|
|
172
|
+
saved: false,
|
|
173
|
+
title: metadata.filename,
|
|
174
|
+
duplicateOf: duplicate.name,
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
if (params.save) {
|
|
179
|
+
yield saveMig(metadata.location, generated.formatted);
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
generated: true,
|
|
183
|
+
more: {
|
|
184
|
+
location: metadata.location,
|
|
185
|
+
saved: (_a = params.save) !== null && _a !== void 0 ? _a : false,
|
|
186
|
+
timestamp: metadata.timestamp,
|
|
187
|
+
title: metadata.filename,
|
|
188
|
+
content: generated.formatted,
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
const err = e instanceof Error ? e.message : JSON.stringify(e);
|
|
194
|
+
throw new Error(err);
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
if (initialized) {
|
|
198
|
+
yield ds.destroy();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
exports.generate = generate;
|
|
203
|
+
/**
|
|
204
|
+
* CLI handler for the `gen` command.
|
|
205
|
+
*
|
|
206
|
+
* @param args - CLI options for migration name and force flag.
|
|
207
|
+
*/
|
|
208
|
+
const gen = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
209
|
+
const database = (0, sanitize_1.sanitize)(config_1.cfg.DATABASE_NAME);
|
|
210
|
+
const name = args.name ? (0, sanitize_1.sanitize)(args.name) : undefined;
|
|
211
|
+
try {
|
|
212
|
+
(0, print_1.print)(`Generating migration for ${database}...`);
|
|
213
|
+
const response = yield generate({
|
|
214
|
+
force: args.force,
|
|
215
|
+
db: database,
|
|
216
|
+
name: name,
|
|
217
|
+
save: true,
|
|
218
|
+
});
|
|
219
|
+
if (!response.generated) {
|
|
220
|
+
if (response.more.reason === 'no-changes') {
|
|
221
|
+
(0, print_1.print)('No schema changes detected — skipping migration generation');
|
|
222
|
+
}
|
|
223
|
+
else if (response.more.reason === 'duplicate-found') {
|
|
224
|
+
(0, print_1.printf)(`Duplicate migration found: ${response.more.duplicateOf}`);
|
|
225
|
+
}
|
|
226
|
+
else
|
|
227
|
+
throw new Error('Unknown generated response');
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
(0, print_1.print)(`Migration for ${database} created successfully: ${response.more.title}`);
|
|
231
|
+
}
|
|
232
|
+
process.exit(0);
|
|
233
|
+
}
|
|
234
|
+
catch (e) {
|
|
235
|
+
const err = e instanceof Error ? e.message : JSON.stringify(e);
|
|
236
|
+
(0, print_1.printf)(`Migration generation failed: ${err}`);
|
|
237
|
+
process.exit(1);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
exports.gen = gen;
|
|
241
|
+
//# sourceMappingURL=gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gen.js","sourceRoot":"","sources":["../../../src/features/gen.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAsD;AACtD,gDAAoD;AAEpD,wCAA6C;AAE7C,qCAA+B;AAC/B,8CAA2C;AAC3C,oDAAkE;AAqOhE,2FArOO,wBAAU,OAqOP;AApOZ,uCAA8C;AAC9C,wCAAoD;AACpD,wDAAgC;AAChC,uCAAyB;AACzB,2CAA6B;AAuB7B;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAO,EAAc,EAAE,EAAE;IAChD,MAAM,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,MAA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C,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC/D,IAAA,cAAM,EAAC,gCAAgC,GAAG,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAA,CAAC;AAGA,kBAAG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { gen } from './gen';
|
|
2
|
+
export { init } from './init';
|
|
3
|
+
export { migrate } from './migrate';
|
|
4
|
+
export { migration } from './migration';
|
|
5
|
+
export { seed } from './seed';
|
|
6
|
+
export { status } from './status';
|
|
7
|
+
export { createdb } from './createdb';
|
|
8
|
+
export { dropdb } from './dropdb';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dropdb = exports.createdb = exports.status = exports.seed = exports.migration = exports.migrate = exports.init = exports.gen = void 0;
|
|
4
|
+
var gen_1 = require("./gen");
|
|
5
|
+
Object.defineProperty(exports, "gen", { enumerable: true, get: function () { return gen_1.gen; } });
|
|
6
|
+
var init_1 = require("./init");
|
|
7
|
+
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return init_1.init; } });
|
|
8
|
+
var migrate_1 = require("./migrate");
|
|
9
|
+
Object.defineProperty(exports, "migrate", { enumerable: true, get: function () { return migrate_1.migrate; } });
|
|
10
|
+
var migration_1 = require("./migration");
|
|
11
|
+
Object.defineProperty(exports, "migration", { enumerable: true, get: function () { return migration_1.migration; } });
|
|
12
|
+
var seed_1 = require("./seed");
|
|
13
|
+
Object.defineProperty(exports, "seed", { enumerable: true, get: function () { return seed_1.seed; } });
|
|
14
|
+
var status_1 = require("./status");
|
|
15
|
+
Object.defineProperty(exports, "status", { enumerable: true, get: function () { return status_1.status; } });
|
|
16
|
+
var createdb_1 = require("./createdb");
|
|
17
|
+
Object.defineProperty(exports, "createdb", { enumerable: true, get: function () { return createdb_1.createdb; } });
|
|
18
|
+
var dropdb_1 = require("./dropdb");
|
|
19
|
+
Object.defineProperty(exports, "dropdb", { enumerable: true, get: function () { return dropdb_1.dropdb; } });
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/index.ts"],"names":[],"mappings":";;;AAAA,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/features/init.ts"],"names":[],"mappings":"AAqDA;;;GAGG;AACH,iBAAe,IAAI,kBAYlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.init = init;
|
|
46
|
+
const config_1 = require("../config");
|
|
47
|
+
const constants_1 = require("../config/constants");
|
|
48
|
+
const print_1 = require("../libs/print");
|
|
49
|
+
const fs = __importStar(require("fs/promises"));
|
|
50
|
+
const template = `import type { DATAFORGE_CONFIGURATIONS } from 'dataforge';
|
|
51
|
+
|
|
52
|
+
const config: DATAFORGE_CONFIGURATIONS = {
|
|
53
|
+
ENTITIES: ['src/**/*.schema.ts'],
|
|
54
|
+
SEEDS: [],
|
|
55
|
+
|
|
56
|
+
TYPE: 'postgres',
|
|
57
|
+
SSL_MODE: false,
|
|
58
|
+
SSL_TYPE: 'light',
|
|
59
|
+
DATABASE_CA_CERT: './',
|
|
60
|
+
DATABASE_HOST: 'localhost',
|
|
61
|
+
DATABASE_PORT: 5432,
|
|
62
|
+
DATABASE_USERNAME: 'postgres',
|
|
63
|
+
DATABASE_PASSWORD: '',
|
|
64
|
+
DATABASE_NAME: 'app',
|
|
65
|
+
SYNCHRONIZE: false,
|
|
66
|
+
LOGGING: false,
|
|
67
|
+
INITIAL_DATABASE: 'postgres',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default config;
|
|
71
|
+
`;
|
|
72
|
+
/**
|
|
73
|
+
* Ensures a directory exists without failing when it is already present.
|
|
74
|
+
*
|
|
75
|
+
* @param path - Directory path to create.
|
|
76
|
+
*/
|
|
77
|
+
function ensureDir(path) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
yield fs.mkdir(path, { recursive: true });
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Writes a file only when it does not already exist.
|
|
84
|
+
*
|
|
85
|
+
* @param path - File path to create.
|
|
86
|
+
* @param content - Initial file content.
|
|
87
|
+
*/
|
|
88
|
+
function ensureFile(path_1) {
|
|
89
|
+
return __awaiter(this, arguments, void 0, function* (path, content = '') {
|
|
90
|
+
try {
|
|
91
|
+
yield fs.writeFile(path, content, { flag: 'wx' });
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
const err = e;
|
|
95
|
+
if (err.code === 'EEXIST')
|
|
96
|
+
return;
|
|
97
|
+
throw e;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Creates Dataforge's opinionated project structure and starter config.
|
|
103
|
+
* Existing files are preserved so the command can be rerun safely.
|
|
104
|
+
*/
|
|
105
|
+
function init() {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
(0, print_1.print)('initializing app');
|
|
108
|
+
yield ensureDir(config_1.cfg.ROOT);
|
|
109
|
+
yield ensureDir(config_1.cfg.MIGRATIONS_DIR);
|
|
110
|
+
yield ensureDir(config_1.cfg.SEEDS_DIR);
|
|
111
|
+
yield ensureFile(`${config_1.cfg.ROOT}/.gitkeep`);
|
|
112
|
+
yield ensureFile(`${config_1.cfg.MIGRATIONS_DIR}/.gitkeep`);
|
|
113
|
+
yield ensureFile(`${config_1.cfg.SEEDS_DIR}/.gitkeep`);
|
|
114
|
+
yield ensureFile(constants_1.DATAFORGE_CONFIG_TS, template);
|
|
115
|
+
(0, print_1.print)('initialized');
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/features/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuES,oBAAI;AAvEb,qCAA+B;AAC/B,kDAAyD;AACzD,wCAAqC;AACrC,gDAAkC;AAElC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBhB,CAAC;AAEF;;;;GAIG;AACH,SAAe,SAAS,CAAC,IAAY;;QACnC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;CAAA;AAED;;;;;GAKG;AACH,SAAe,UAAU;yDAAC,IAAY,EAAE,UAAkB,EAAE;QAC1D,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,CAA0B,CAAC;YACvC,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO;YAClC,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;CAAA;AAED;;;GAGG;AACH,SAAe,IAAI;;QACjB,IAAA,aAAK,EAAC,kBAAkB,CAAC,CAAC;QAC1B,MAAM,SAAS,CAAC,YAAG,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,SAAS,CAAC,YAAG,CAAC,cAAc,CAAC,CAAC;QACpC,MAAM,SAAS,CAAC,YAAG,CAAC,SAAS,CAAC,CAAC;QAE/B,MAAM,UAAU,CAAC,GAAG,YAAG,CAAC,IAAI,WAAW,CAAC,CAAC;QACzC,MAAM,UAAU,CAAC,GAAG,YAAG,CAAC,cAAc,WAAW,CAAC,CAAC;QACnD,MAAM,UAAU,CAAC,GAAG,YAAG,CAAC,SAAS,WAAW,CAAC,CAAC;QAE9C,MAAM,UAAU,CAAC,+BAAmB,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAA,aAAK,EAAC,aAAa,CAAC,CAAC;IACvB,CAAC;CAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { MIGRATE } from '../types';
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
3
|
+
type MigrationResult = {
|
|
4
|
+
migrated: boolean;
|
|
5
|
+
status: 'migrated' | 'already-migrated' | 'no-migrations';
|
|
6
|
+
};
|
|
7
|
+
export type MigrationItem = {
|
|
8
|
+
name: string;
|
|
9
|
+
parentPath: string;
|
|
10
|
+
exists: boolean;
|
|
11
|
+
file: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Lists migration directories under the configured migrations directory and whether each
|
|
15
|
+
* contains a `migration.ts` file.
|
|
16
|
+
*
|
|
17
|
+
* @returns An array of {@link MigrationItem} entries, one per migration folder.
|
|
18
|
+
*/
|
|
19
|
+
declare function getMigrationFiles(): Promise<MigrationItem[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Checks whether a migration has already been recorded in the database.
|
|
22
|
+
* Queries the `migrations` table via a dialect-specific command.
|
|
23
|
+
*
|
|
24
|
+
* @param ds - Initialized TypeORM data source.
|
|
25
|
+
* @param name - Migration folder name to look up.
|
|
26
|
+
* @returns Whether the migration name exists in the migrations table.
|
|
27
|
+
*/
|
|
28
|
+
declare function hasMigration(ds: DataSource, name: string): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Resolves which local migrations still need to run against the database.
|
|
31
|
+
* Opens a data source, discovers migration folders (optionally
|
|
32
|
+
* scoped to `name`), and filters out entries that are missing or already recorded.
|
|
33
|
+
*
|
|
34
|
+
* @param name - Optional migration folder name; when omitted, all folders are considered.
|
|
35
|
+
* @param db - Optional database override for the migration lookup.
|
|
36
|
+
* @returns Pending {@link MigrationItem} entries; empty when none apply.
|
|
37
|
+
* @throws When the data source cannot connect or migration lookup fails.
|
|
38
|
+
*/
|
|
39
|
+
declare function getMigrationsToRun(name?: string, db?: string): Promise<MigrationItem[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Runs pending migrations discovered via {@link getMigrationsToRun}.
|
|
42
|
+
* When `name` is omitted, runs every unmigrated folder under the configured migrations directory.
|
|
43
|
+
*
|
|
44
|
+
* @param name - Optional migration folder name to run a single migration.
|
|
45
|
+
* @param db - Optional database override for migration discovery and execution.
|
|
46
|
+
* @returns Outcome with `migrated` flag and status (`migrated` or `no-migrations`).
|
|
47
|
+
* @throws When migration discovery or execution fails.
|
|
48
|
+
*/
|
|
49
|
+
declare function runMigrationByName(name?: string, db?: string): Promise<MigrationResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Runs all migrations registered on the configured TypeORM data source.
|
|
52
|
+
* Initializes the data source, executes pending migrations in a single
|
|
53
|
+
* transaction, then destroys the connection.
|
|
54
|
+
*
|
|
55
|
+
* @param db - Optional database override for the TypeORM data source.
|
|
56
|
+
* @returns Outcome with `migrated` flag and status (`migrated` or `no-migrations`).
|
|
57
|
+
* @throws When initialization or migration execution fails.
|
|
58
|
+
*/
|
|
59
|
+
declare function runMigrationByConfig(db?: string): Promise<MigrationResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Resolves a migration folder name and `migration.ts` path from a CLI path input.
|
|
62
|
+
* Accepts either a migration directory or a direct path to `migration.ts`.
|
|
63
|
+
* Validates that the folder name is class-style and ends with a 13-digit timestamp.
|
|
64
|
+
*
|
|
65
|
+
* @param input - Migration folder or file path from `--file`.
|
|
66
|
+
* @returns The migration name and normalized path to `migration.ts`.
|
|
67
|
+
* @throws When the name is invalid or the migration file does not exist.
|
|
68
|
+
*/
|
|
69
|
+
declare function getMigrationNameFromPath(input: string): {
|
|
70
|
+
name: string;
|
|
71
|
+
path: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* CLI handler for the `migrate` command.
|
|
75
|
+
* Runs pending migrations via {@link runMigrationByName}. When `--file` is
|
|
76
|
+
* provided, resolves the migration name from the path first.
|
|
77
|
+
* Prints the outcome to stdout and exits with code 0 or 1.
|
|
78
|
+
*
|
|
79
|
+
* @param args - CLI options; `--name` scopes to one migration folder, `--file` to a folder or `migration.ts` path.
|
|
80
|
+
*/
|
|
81
|
+
declare function migrate(args: MIGRATE): Promise<void>;
|
|
82
|
+
export { migrate, runMigrationByConfig, runMigrationByName, getMigrationsToRun, hasMigration, getMigrationFiles, getMigrationNameFromPath, };
|
|
83
|
+
//# sourceMappingURL=migrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/features/migrate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAOrC,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,UAAU,GAAG,kBAAkB,GAAG,eAAe,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;GAKG;AACH,iBAAe,iBAAiB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAgB3D;AAED;;;;;;;GAOG;AACH,iBAAe,YAAY,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,oBAmBvD;AAED;;;;;;;;;GASG;AACH,iBAAe,kBAAkB,CAC/B,IAAI,CAAC,EAAE,MAAM,EACb,EAAE,CAAC,EAAE,MAAM,GACV,OAAO,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