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.
Files changed (50) hide show
  1. package/com/cacher.cjs +1 -1
  2. package/com/cacher.mjs +1 -1
  3. package/com/docker.cjs +2 -2
  4. package/com/docker.mjs +2 -2
  5. package/com/logger.cjs +2 -2
  6. package/com/logger.mjs +2 -2
  7. package/com/monitor.cjs +1 -1
  8. package/com/monitor.mjs +1 -1
  9. package/helper.cjs +1 -1
  10. package/helper.mjs +1 -1
  11. package/lakutata.cjs +47 -47
  12. package/lakutata.mjs +39 -39
  13. package/package.json +1 -1
  14. package/src/components/Logger.cjs +2 -2
  15. package/src/components/Logger.mjs +2 -2
  16. package/src/components/cacher/Cacher.cjs +1 -1
  17. package/src/components/cacher/Cacher.mjs +1 -1
  18. package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +1 -1
  19. package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +1 -1
  20. package/src/components/docker/ConnectionOptionsBuilder.cjs +2 -2
  21. package/src/components/docker/ConnectionOptionsBuilder.mjs +2 -2
  22. package/src/components/docker/Docker.cjs +2 -2
  23. package/src/components/docker/Docker.mjs +2 -2
  24. package/src/components/docker/lib/DockerContainer.cjs +2 -2
  25. package/src/components/docker/lib/DockerContainer.mjs +2 -2
  26. package/src/components/docker/lib/DockerContainerTTY.cjs +2 -2
  27. package/src/components/docker/lib/DockerContainerTTY.mjs +2 -2
  28. package/src/components/monitor/CpuMonitor.cjs +1 -1
  29. package/src/components/monitor/CpuMonitor.mjs +1 -1
  30. package/src/components/monitor/HttpRequestMonitor.cjs +1 -1
  31. package/src/components/monitor/HttpRequestMonitor.mjs +1 -1
  32. package/src/components/monitor/MemoryMonitor.cjs +1 -1
  33. package/src/components/monitor/MemoryMonitor.mjs +1 -1
  34. package/src/lib/base/internal/ControllerEntrypoint.mjs +1 -1
  35. package/src/lib/core/Application.cjs +333 -98
  36. package/src/lib/core/Application.mjs +339 -108
  37. package/src/lib/helpers/Statistics.cjs +1 -1
  38. package/src/lib/helpers/Statistics.mjs +1 -1
  39. package/src/lib/helpers/UUID.mjs +1 -1
  40. package/src/providers/migration/GenerateMigration.cjs +122 -246
  41. package/src/providers/migration/GenerateMigration.mjs +123 -246
  42. package/vendor/Package.14.cjs +13702 -1892
  43. package/vendor/Package.14.mjs +13744 -1852
  44. package/vendor/Package.15.cjs +1 -14057
  45. package/vendor/Package.15.mjs +1 -14031
  46. package/vendor/Package.16.cjs +2247 -1
  47. package/vendor/Package.16.mjs +2139 -1
  48. package/vendor/Package.17.cjs +3 -3
  49. package/vendor/Package.17.mjs +3 -3
  50. package/vendor/Package.64.mjs +1 -1
@@ -1,26 +1,22 @@
1
- import { _ as e, a as t } from "../../../vendor/Package.1.mjs";
1
+ import "../../../vendor/Package.1.mjs";
2
2
 
3
- import { Provider as r } from "../../lib/core/Provider.mjs";
3
+ import "../../lib/core/Provider.mjs";
4
4
 
5
- import { Configurable as i } from "../../decorators/di/Configurable.mjs";
5
+ import "../../decorators/di/Configurable.mjs";
6
6
 
7
- import { D as o } from "../../../vendor/Package.2.mjs";
7
+ import "../../../vendor/Package.2.mjs";
8
8
 
9
- import a from "path";
9
+ import "path";
10
10
 
11
- import { D as n } from "../../../vendor/Package.10.mjs";
11
+ import "../../../vendor/Package.10.mjs";
12
12
 
13
- import { e as s, I as m, a as c, b as l, P as p, c as u, s as d } from "../../../vendor/Package.102.mjs";
13
+ import "../../../vendor/Package.102.mjs";
14
14
 
15
- import { g } from "../../../vendor/Package.5.mjs";
15
+ export { G as GenerateMigration } from "../../lib/core/Application.mjs";
16
16
 
17
- import { r as h } from "../../../vendor/Package.12.mjs";
17
+ import "../../decorators/di/Lifetime.mjs";
18
18
 
19
- import "../../../vendor/Package.8.mjs";
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
- var f = {};
186
-
187
- "use strict";
188
-
189
- Object.defineProperty(f, "__esModule", {
190
- value: true
191
- });
192
-
193
- var j = f.CommandUtils = void 0;
194
-
195
- const v = h;
196
-
197
- const w = v.__importDefault(b);
198
-
199
- const x = v.__importDefault(a);
200
-
201
- const P = s;
202
-
203
- const k = m;
204
-
205
- const B = c();
206
-
207
- class CommandUtils {
208
- static async loadDataSource(e) {
209
- let t;
210
- try {
211
- [t] = await (0, B.importOrRequireFile)(e);
212
- } catch (t) {
213
- throw new Error(`Unable to open file: "${e}". ${t.message}`);
214
- }
215
- if (!t || typeof t !== "object") {
216
- throw new Error(`Given data source file must contain export of a DataSource instance`);
217
- }
218
- if (k.InstanceChecker.isDataSource(t)) {
219
- return t;
220
- }
221
- const r = [];
222
- for (const e in t) {
223
- const i = t[e];
224
- const o = await i;
225
- if (k.InstanceChecker.isDataSource(o)) {
226
- r.push(o);
227
- }
228
- }
229
- if (r.length === 0) {
230
- throw new Error(`Given data source file must contain export of a DataSource instance`);
231
- }
232
- if (r.length > 1) {
233
- throw new Error(`Given data source file must contain only one export of DataSource instance`);
234
- }
235
- return r[0];
236
- }
237
- static async createDirectories(e) {
238
- await w.default.mkdir(e, {
239
- recursive: true
240
- });
241
- }
242
- static async createFile(e, t, r = true) {
243
- await CommandUtils.createDirectories(x.default.dirname(e));
244
- if (r === false && await CommandUtils.fileExists(e)) {
245
- return;
246
- }
247
- await w.default.writeFile(e, t);
248
- }
249
- static async readFile(e) {
250
- const t = await w.default.readFile(e);
251
- return t.toString();
252
- }
253
- static async fileExists(e) {
254
- try {
255
- await w.default.access(e, w.default.constants.F_OK);
256
- return true;
257
- } catch {
258
- return false;
259
- }
260
- }
261
- static getTimestamp(e) {
262
- if (e && (isNaN(e) || e < 0)) {
263
- throw new P.TypeORMError(`timestamp option should be a non-negative number. received: ${e}`);
264
- }
265
- return e ? new Date(Number(e)).getTime() : Date.now();
266
- }
267
- }
268
-
269
- j = f.CommandUtils = CommandUtils;
270
-
271
- var S = l();
272
-
273
- const R = g(S);
274
-
275
- const {Ansis: C, ansi256: I, fg: D, bgAnsi256: E, bg: M, rgb: q, bgRgb: $, hex: O, bgHex: N, reset: Q, inverse: T, hidden: A, visible: L, bold: F, dim: U, italic: _, underline: G, strikethrough: J, strike: V, black: W, red: z, green: K, yellow: H, blue: Y, magenta: X, cyan: Z, white: ee, grey: te, gray: re, blackBright: ie, redBright: oe, greenBright: ae, yellowBright: ne, blueBright: se, magentaBright: me, cyanBright: ce, whiteBright: le, bgBlack: pe, bgRed: ue, bgGreen: de, bgYellow: ge, bgBlue: he, bgMagenta: be, bgCyan: ye, bgWhite: fe, bgGrey: je, bgGray: ve, bgBlackBright: we, bgRedBright: xe, bgGreenBright: Pe, bgYellowBright: ke, bgBlueBright: Be, bgMagentaBright: Se, bgCyanBright: Re, bgWhiteBright: Ce} = R;
276
-
277
- var Ie;
278
-
279
- let De = Ie = class GenerateMigration extends r {
280
- get extension() {
281
- return this.outputJs ? ".js" : ".ts";
282
- }
283
- get filename() {
284
- return this.timestamp + "-" + (this.dataSourceName ? this.dataSourceName : a.basename(this.path)) + this.extension;
285
- }
286
- #e;
287
- async init() {
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";