lakutata 2.0.77 → 2.0.79
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/com/cacher.cjs +1 -1
- package/com/cacher.mjs +1 -1
- package/com/docker.cjs +2 -2
- package/com/docker.mjs +2 -2
- package/com/logger.cjs +2 -2
- package/com/logger.mjs +2 -2
- package/com/monitor.cjs +1 -1
- package/com/monitor.mjs +1 -1
- package/helper.cjs +1 -1
- package/helper.mjs +1 -1
- package/lakutata.cjs +47 -47
- package/lakutata.mjs +39 -39
- package/package.json +1 -1
- package/src/components/Logger.cjs +2 -2
- package/src/components/Logger.mjs +2 -2
- package/src/components/cacher/Cacher.cjs +1 -1
- package/src/components/cacher/Cacher.mjs +1 -1
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +1 -1
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +1 -1
- package/src/components/docker/ConnectionOptionsBuilder.cjs +2 -2
- package/src/components/docker/ConnectionOptionsBuilder.mjs +2 -2
- package/src/components/docker/Docker.cjs +2 -2
- package/src/components/docker/Docker.mjs +2 -2
- package/src/components/docker/lib/DockerContainer.cjs +2 -2
- package/src/components/docker/lib/DockerContainer.mjs +2 -2
- package/src/components/docker/lib/DockerContainerTTY.cjs +2 -2
- package/src/components/docker/lib/DockerContainerTTY.mjs +2 -2
- package/src/components/monitor/CpuMonitor.cjs +1 -1
- package/src/components/monitor/CpuMonitor.mjs +1 -1
- package/src/components/monitor/HttpRequestMonitor.cjs +1 -1
- package/src/components/monitor/HttpRequestMonitor.mjs +1 -1
- package/src/components/monitor/MemoryMonitor.cjs +1 -1
- package/src/components/monitor/MemoryMonitor.mjs +1 -1
- package/src/lib/base/internal/ControllerEntrypoint.mjs +1 -1
- package/src/lib/core/Application.cjs +333 -98
- package/src/lib/core/Application.mjs +339 -108
- package/src/lib/helpers/Statistics.cjs +1 -1
- package/src/lib/helpers/Statistics.mjs +1 -1
- package/src/lib/helpers/UUID.mjs +1 -1
- package/src/providers/migration/GenerateMigration.cjs +122 -246
- package/src/providers/migration/GenerateMigration.mjs +123 -246
- package/vendor/Package.14.cjs +13702 -1892
- package/vendor/Package.14.mjs +13744 -1852
- package/vendor/Package.15.cjs +1 -14057
- package/vendor/Package.15.mjs +1 -14031
- package/vendor/Package.16.cjs +2247 -1
- package/vendor/Package.16.mjs +2139 -1
- package/vendor/Package.17.cjs +3 -3
- package/vendor/Package.17.mjs +3 -3
- package/vendor/Package.64.mjs +1 -1
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../vendor/Package.1.mjs";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import "../../lib/core/Provider.mjs";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import "../../decorators/di/Configurable.mjs";
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import "../../../vendor/Package.2.mjs";
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import "path";
|
|
10
10
|
|
|
11
|
-
import
|
|
11
|
+
import "../../../vendor/Package.10.mjs";
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import "../../../vendor/Package.102.mjs";
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
export { G as GenerateMigration } from "../../lib/core/Application.mjs";
|
|
16
16
|
|
|
17
|
-
import
|
|
17
|
+
import "../../decorators/di/Lifetime.mjs";
|
|
18
18
|
|
|
19
|
-
import "
|
|
20
|
-
|
|
21
|
-
import b from "fs/promises";
|
|
22
|
-
|
|
23
|
-
import { Transient as y } from "../../decorators/di/Lifetime.mjs";
|
|
19
|
+
import "../../decorators/di/Inject.mjs";
|
|
24
20
|
|
|
25
21
|
import "../../../vendor/Package.3.mjs";
|
|
26
22
|
|
|
@@ -44,6 +40,8 @@ import "../../lib/helpers/As.mjs";
|
|
|
44
40
|
|
|
45
41
|
import "../../../vendor/Package.6.mjs";
|
|
46
42
|
|
|
43
|
+
import "../../../vendor/Package.5.mjs";
|
|
44
|
+
|
|
47
45
|
import "../../../vendor/Package.7.mjs";
|
|
48
46
|
|
|
49
47
|
import "../../lib/base/internal/ThrowWarning.mjs";
|
|
@@ -102,14 +100,16 @@ import "../../lib/ioc/Lifetime.mjs";
|
|
|
102
100
|
|
|
103
101
|
import "../../lib/ioc/ListModules.mjs";
|
|
104
102
|
|
|
103
|
+
import "../../../vendor/Package.8.mjs";
|
|
104
|
+
|
|
105
105
|
import "os";
|
|
106
106
|
|
|
107
107
|
import "stream";
|
|
108
108
|
|
|
109
|
-
import "fs";
|
|
110
|
-
|
|
111
109
|
import "events";
|
|
112
110
|
|
|
111
|
+
import "fs";
|
|
112
|
+
|
|
113
113
|
import "../../lib/ioc/Utils.mjs";
|
|
114
114
|
|
|
115
115
|
import "../../lib/ioc/FunctionTokenizer.mjs";
|
|
@@ -150,6 +150,8 @@ import "../../exceptions/dto/InvalidMethodReturnException.mjs";
|
|
|
150
150
|
|
|
151
151
|
import "../../lib/helpers/IsEmptyObject.mjs";
|
|
152
152
|
|
|
153
|
+
import "../../../vendor/Package.12.mjs";
|
|
154
|
+
|
|
153
155
|
import "../../../vendor/Package.62.mjs";
|
|
154
156
|
|
|
155
157
|
import "../../../vendor/Package.11.mjs";
|
|
@@ -166,6 +168,8 @@ import "../../../vendor/Package.13.mjs";
|
|
|
166
168
|
|
|
167
169
|
import "crypto";
|
|
168
170
|
|
|
171
|
+
import "fs/promises";
|
|
172
|
+
|
|
169
173
|
import "../../../vendor/Package.63.mjs";
|
|
170
174
|
|
|
171
175
|
import "node:url";
|
|
@@ -182,233 +186,106 @@ import "node:stream";
|
|
|
182
186
|
|
|
183
187
|
import "node:string_decoder";
|
|
184
188
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
this.#e = new n.DataSource(this.dataSource);
|
|
289
|
-
this.#e.setOptions({
|
|
290
|
-
synchronize: false,
|
|
291
|
-
migrationsRun: false,
|
|
292
|
-
dropSchema: false,
|
|
293
|
-
logging: false
|
|
294
|
-
});
|
|
295
|
-
this.#e = await this.#e.initialize();
|
|
296
|
-
await this.handle();
|
|
297
|
-
}
|
|
298
|
-
async destroy() {
|
|
299
|
-
await (this.#e?.destroy());
|
|
300
|
-
}
|
|
301
|
-
async handle() {
|
|
302
|
-
try {
|
|
303
|
-
const e = [], t = [];
|
|
304
|
-
try {
|
|
305
|
-
const r = await this.#e.driver.createSchemaBuilder().log();
|
|
306
|
-
if (this.pretty) {
|
|
307
|
-
r.upQueries.forEach((e => {
|
|
308
|
-
e.query = Ie.prettifyQuery(e.query);
|
|
309
|
-
}));
|
|
310
|
-
r.downQueries.forEach((e => {
|
|
311
|
-
e.query = Ie.prettifyQuery(e.query);
|
|
312
|
-
}));
|
|
313
|
-
}
|
|
314
|
-
r.upQueries.forEach((t => {
|
|
315
|
-
e.push(" await queryRunner.query(`" + t.query.replaceAll("`", "\\`") + "`" + Ie.queryParams(t.parameters) + ");");
|
|
316
|
-
}));
|
|
317
|
-
r.downQueries.forEach((e => {
|
|
318
|
-
t.push(" await queryRunner.query(`" + e.query.replaceAll("`", "\\`") + "`" + Ie.queryParams(e.parameters) + ");");
|
|
319
|
-
}));
|
|
320
|
-
} finally {
|
|
321
|
-
await this.#e.destroy();
|
|
322
|
-
}
|
|
323
|
-
if (!e.length) {
|
|
324
|
-
if (this.check) {
|
|
325
|
-
console.log(R.green`No changes in database schema were found`);
|
|
326
|
-
if (this.exitProcess) {
|
|
327
|
-
process.exit(0);
|
|
328
|
-
} else {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
} else {
|
|
332
|
-
console.log(R.yellow`No changes in database schema were found`);
|
|
333
|
-
if (this.exitProcess) {
|
|
334
|
-
process.exit(1);
|
|
335
|
-
} else {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
} else if (!this.path) {
|
|
340
|
-
console.log(R.yellow`Please specify a migration path`);
|
|
341
|
-
process.exit(1);
|
|
342
|
-
}
|
|
343
|
-
const r = this.outputJs ? Ie.getJavascriptTemplate(a.basename(this.path), this.timestamp, e, t.reverse(), this.esm) : Ie.getTemplate(a.basename(this.path), this.timestamp, e, t.reverse());
|
|
344
|
-
if (this.check) {
|
|
345
|
-
console.log(R.yellow`Unexpected changes in database schema were found in check mode:\n\n${R.white(r)}`);
|
|
346
|
-
if (this.exitProcess) {
|
|
347
|
-
process.exit(0);
|
|
348
|
-
} else {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
if (this.dryRun) {
|
|
353
|
-
console.log(R.green(`Migration ${R.blue(this.path + this.extension)} has content:\n\n${R.white(r)}`));
|
|
354
|
-
} else {
|
|
355
|
-
const e = a.isAbsolute(this.path) ? a.join(this.path, this.filename) : a.join(process.cwd(), this.path, this.filename);
|
|
356
|
-
await j.createFile(e, r);
|
|
357
|
-
console.log(R.green`Migration ${R.blue(e)} has been generated successfully.`);
|
|
358
|
-
if (this.exitProcess) {
|
|
359
|
-
process.exit(0);
|
|
360
|
-
} else {
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
} catch (e) {
|
|
365
|
-
p.PlatformTools.logCmdErr("Error during migration generation:", e);
|
|
366
|
-
process.exit(1);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
static queryParams(e) {
|
|
370
|
-
if (!e || !e.length) {
|
|
371
|
-
return "";
|
|
372
|
-
}
|
|
373
|
-
return `, ${JSON.stringify(e)}`;
|
|
374
|
-
}
|
|
375
|
-
static getTemplate(e, t, r, i) {
|
|
376
|
-
const o = `${u(e, true)}${t}`;
|
|
377
|
-
return `import { MigrationInterface, QueryRunner } from "lakutata/orm";\n\nexport class ${o} implements MigrationInterface {\n name = '${o}'\n\n public async up(queryRunner: QueryRunner): Promise<void> {\n${r.join(`\n`)}\n }\n\n public async down(queryRunner: QueryRunner): Promise<void> {\n${i.join(`\n`)}\n }\n\n}\n`;
|
|
378
|
-
}
|
|
379
|
-
static getJavascriptTemplate(e, t, r, i, o) {
|
|
380
|
-
const a = `${u(e, true)}${t}`;
|
|
381
|
-
const n = o ? "export" : "module.exports =";
|
|
382
|
-
return `/**\n * @typedef {import('lakutata/orm').MigrationInterface} MigrationInterface\n * @typedef {import('lakutata/orm').QueryRunner} QueryRunner\n */\n\n/**\n * @class\n * @implements {MigrationInterface}\n */\n${n} class ${a} {\n name = '${a}'\n\n /**\n * @param {QueryRunner} queryRunner\n */\n async up(queryRunner) {\n${r.join(`\n`)}\n }\n\n /**\n * @param {QueryRunner} queryRunner\n */\n async down(queryRunner) {\n${i.join(`\n`)}\n }\n}\n`;
|
|
383
|
-
}
|
|
384
|
-
static prettifyQuery(e) {
|
|
385
|
-
const t = d.format(e, {
|
|
386
|
-
indent: " "
|
|
387
|
-
});
|
|
388
|
-
return "\n" + t.replace(/^/gm, " ") + "\n ";
|
|
389
|
-
}
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
e([ i(o.String().required()), t("design:type", String) ], De.prototype, "path", void 0);
|
|
393
|
-
|
|
394
|
-
e([ i(o.String().allow("").optional().default("")), t("design:type", String) ], De.prototype, "dataSourceName", void 0);
|
|
395
|
-
|
|
396
|
-
e([ i(), t("design:type", Object) ], De.prototype, "dataSource", void 0);
|
|
397
|
-
|
|
398
|
-
e([ i(o.Boolean().optional().default(true)), t("design:type", Boolean) ], De.prototype, "pretty", void 0);
|
|
399
|
-
|
|
400
|
-
e([ i(o.Boolean().optional().default(false)), t("design:type", Boolean) ], De.prototype, "outputJs", void 0);
|
|
401
|
-
|
|
402
|
-
e([ i(o.Boolean().optional().default(false)), t("design:type", Boolean) ], De.prototype, "esm", void 0);
|
|
403
|
-
|
|
404
|
-
e([ i(o.Boolean().optional().default(false)), t("design:type", Boolean) ], De.prototype, "dryRun", void 0);
|
|
405
|
-
|
|
406
|
-
e([ i(o.Boolean().optional().default(false)), t("design:type", Boolean) ], De.prototype, "check", void 0);
|
|
407
|
-
|
|
408
|
-
e([ i(o.Number().optional().default((() => Date.now()))), t("design:type", Number) ], De.prototype, "timestamp", void 0);
|
|
409
|
-
|
|
410
|
-
e([ i(o.Boolean().optional().default(true)), t("design:type", Boolean) ], De.prototype, "exitProcess", void 0);
|
|
411
|
-
|
|
412
|
-
De = Ie = e([ y() ], De);
|
|
413
|
-
|
|
414
|
-
export { De as GenerateMigration };
|
|
189
|
+
import "../../lib/core/Module.mjs";
|
|
190
|
+
|
|
191
|
+
import "../../lib/core/Component.mjs";
|
|
192
|
+
|
|
193
|
+
import "../../lib/base/EventEmitter.mjs";
|
|
194
|
+
|
|
195
|
+
import "../../options/ModuleOptions.mjs";
|
|
196
|
+
|
|
197
|
+
import "../../options/ModuleLoadObjectsOptions.mjs";
|
|
198
|
+
|
|
199
|
+
import "../../options/LoadNamedObjectOptions.mjs";
|
|
200
|
+
|
|
201
|
+
import "../../options/LoadAnonymousObjectOptions.mjs";
|
|
202
|
+
|
|
203
|
+
import "../../options/OverridableNamedObjectOptions.mjs";
|
|
204
|
+
|
|
205
|
+
import "../../options/OverridableObjectOptions.mjs";
|
|
206
|
+
|
|
207
|
+
import "../../lib/base/internal/ModuleConfigLoader.mjs";
|
|
208
|
+
|
|
209
|
+
import "../../exceptions/di/OverridableObjectTargetConfigNotFoundException.mjs";
|
|
210
|
+
|
|
211
|
+
import "../../exceptions/InvalidObjectTypeException.mjs";
|
|
212
|
+
|
|
213
|
+
import "../../lib/helpers/ArrayToSet.mjs";
|
|
214
|
+
|
|
215
|
+
import "../../lib/helpers/SetToArray.mjs";
|
|
216
|
+
|
|
217
|
+
import "../../lib/helpers/NonceStr.mjs";
|
|
218
|
+
|
|
219
|
+
import "../../lib/helpers/RandomString.mjs";
|
|
220
|
+
|
|
221
|
+
import "../../lib/base/internal/ApplicationConfigLoader.mjs";
|
|
222
|
+
|
|
223
|
+
import "../../options/ApplicationOptions.mjs";
|
|
224
|
+
|
|
225
|
+
import "../../lib/core/Alias.mjs";
|
|
226
|
+
|
|
227
|
+
import "../../exceptions/alias/InvalidAliasNameException.mjs";
|
|
228
|
+
|
|
229
|
+
import "../../exceptions/alias/AliasExistsException.mjs";
|
|
230
|
+
|
|
231
|
+
import "../../exceptions/alias/AliasNotFoundException.mjs";
|
|
232
|
+
|
|
233
|
+
import "../../components/entrypoint/Entrypoint.mjs";
|
|
234
|
+
|
|
235
|
+
import "../../lib/base/internal/ControllerEntrypoint.mjs";
|
|
236
|
+
|
|
237
|
+
import "../../lib/helpers/ObjectHash.mjs";
|
|
238
|
+
|
|
239
|
+
import "../../lib/helpers/GetObjectNestingDepth.mjs";
|
|
240
|
+
|
|
241
|
+
import "../../exceptions/InvalidActionPatternDepthException.mjs";
|
|
242
|
+
|
|
243
|
+
import "../../../vendor/Package.64.mjs";
|
|
244
|
+
|
|
245
|
+
import "../../lib/base/internal/StringifyPattern.mjs";
|
|
246
|
+
|
|
247
|
+
import "../../../vendor/Package.65.mjs";
|
|
248
|
+
|
|
249
|
+
import "../../lib/base/internal/PatternManager.mjs";
|
|
250
|
+
|
|
251
|
+
import "../../components/entrypoint/lib/Controller.mjs";
|
|
252
|
+
|
|
253
|
+
import "../../lib/context/CLIContext.mjs";
|
|
254
|
+
|
|
255
|
+
import "../../lib/base/Context.mjs";
|
|
256
|
+
|
|
257
|
+
import "../../lib/context/HTTPContext.mjs";
|
|
258
|
+
|
|
259
|
+
import "node:http";
|
|
260
|
+
|
|
261
|
+
import "../../lib/context/ServiceContext.mjs";
|
|
262
|
+
|
|
263
|
+
import "../../components/entrypoint/exceptions/ControllerActionNotFoundException.mjs";
|
|
264
|
+
|
|
265
|
+
import "../../exceptions/DestroyRuntimeContainerException.mjs";
|
|
266
|
+
|
|
267
|
+
import "../../lib/helpers/GetObjectPropertyPaths.mjs";
|
|
268
|
+
|
|
269
|
+
import "../../lib/helpers/UniqueArray.mjs";
|
|
270
|
+
|
|
271
|
+
import "../../components/entrypoint/exceptions/DuplicateActionNameException.mjs";
|
|
272
|
+
|
|
273
|
+
import "../../components/entrypoint/lib/AccessControl.mjs";
|
|
274
|
+
|
|
275
|
+
import "../../components/entrypoint/exceptions/AccessDenyException.mjs";
|
|
276
|
+
|
|
277
|
+
import "../../components/entrypoint/lib/AccessControlRule.mjs";
|
|
278
|
+
|
|
279
|
+
import "../../components/entrypoint/exceptions/InvalidActionGroupException.mjs";
|
|
280
|
+
|
|
281
|
+
import "../../../vendor/Package.14.mjs";
|
|
282
|
+
|
|
283
|
+
import "worker_threads";
|
|
284
|
+
|
|
285
|
+
import "../../../vendor/Package.15.mjs";
|
|
286
|
+
|
|
287
|
+
import "assert";
|
|
288
|
+
|
|
289
|
+
import "string_decoder";
|
|
290
|
+
|
|
291
|
+
import "../../lib/base/internal/DatabaseSymbol.mjs";
|