taon 21.0.34 → 21.0.37
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/browser/package.json +1 -1
- package/browser/types/taon-browser.d.ts +3 -3
- package/browser-prod/fesm2022/taon-browser.mjs +315 -315
- package/browser-prod/fesm2022/taon-browser.mjs.map +1 -1
- package/browser-prod/package.json +1 -1
- package/browser-prod/types/taon-browser.d.ts +145 -145
- package/browser-prod.split-namespaces.json +162 -162
- package/icon-menu-taon.svg +15 -15
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/migrations/index.d.ts +1 -0
- package/lib/migrations/index.js +19 -0
- package/lib/migrations/index.js.map +1 -0
- package/lib/migrations/migrations_index._auto-generated_.d.ts +0 -0
- package/lib/migrations/migrations_index._auto-generated_.js +4 -0
- package/lib/migrations/migrations_index._auto-generated_.js.map +1 -0
- package/lib/package.json +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib-prod/base-classes/base-class.js +1 -1
- package/lib-prod/base-classes/base-class.js.map +1 -1
- package/lib-prod/base-classes/base-context.d.ts +1 -1
- package/lib-prod/base-classes/base-controller.d.ts +5 -5
- package/lib-prod/base-classes/base-controller.js +2 -2
- package/lib-prod/base-classes/base-controller.js.map +1 -1
- package/lib-prod/base-classes/base-crud-controller.d.ts +13 -13
- package/lib-prod/base-classes/base-crud-controller.js +8 -8
- package/lib-prod/base-classes/base-crud-controller.js.map +1 -1
- package/lib-prod/base-classes/base-injector.js +11 -11
- package/lib-prod/base-classes/base-injector.js.map +1 -1
- package/lib-prod/base-classes/base-middleware.d.ts +2 -2
- package/lib-prod/base-classes/base-migration.js +3 -3
- package/lib-prod/base-classes/base-migration.js.map +1 -1
- package/lib-prod/base-classes/base-repository.js +4 -4
- package/lib-prod/base-classes/base-repository.js.map +1 -1
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/config/method-config.d.ts +2 -2
- package/lib-prod/config/param-config.d.ts +2 -2
- package/lib-prod/context-db-migrations.js +12 -12
- package/lib-prod/context-db-migrations.js.map +1 -1
- package/lib-prod/create-context.d.ts +5 -5
- package/lib-prod/create-context.js +3 -3
- package/lib-prod/create-context.js.map +1 -1
- package/lib-prod/decorators/classes/controller-decorator.js +3 -3
- package/lib-prod/decorators/classes/controller-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/entity-decorator.d.ts +3 -3
- package/lib-prod/decorators/classes/entity-decorator.js +5 -5
- package/lib-prod/decorators/classes/entity-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/middleware-decorator.js +3 -3
- package/lib-prod/decorators/classes/middleware-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/migration-decorator.js +3 -3
- package/lib-prod/decorators/classes/migration-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/provider-decorator.js +3 -3
- package/lib-prod/decorators/classes/provider-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/repository-decorator.js +3 -3
- package/lib-prod/decorators/classes/repository-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/subscriber-decorator.js +3 -3
- package/lib-prod/decorators/classes/subscriber-decorator.js.map +1 -1
- package/lib-prod/decorators/http/http-decorators.d.ts +3 -3
- package/lib-prod/decorators/http/http-decorators.js +2 -2
- package/lib-prod/decorators/http/http-decorators.js.map +1 -1
- package/lib-prod/decorators/http/http-methods-decorators.d.ts +5 -5
- package/lib-prod/decorators/http/http-methods-decorators.js +2 -2
- package/lib-prod/decorators/http/http-methods-decorators.js.map +1 -1
- package/lib-prod/decorators/http/http-params-decorators.js +1 -1
- package/lib-prod/decorators/http/http-params-decorators.js.map +1 -1
- package/lib-prod/endpoint-context-storage.js +1 -1
- package/lib-prod/endpoint-context-storage.js.map +1 -1
- package/lib-prod/endpoint-context.d.ts +14 -14
- package/lib-prod/endpoint-context.js +171 -171
- package/lib-prod/endpoint-context.js.map +1 -1
- package/lib-prod/entity-process.js +14 -14
- package/lib-prod/entity-process.js.map +1 -1
- package/lib-prod/formly/fromly.d.ts +2 -2
- package/lib-prod/formly/fromly.js +1 -1
- package/lib-prod/formly/fromly.js.map +1 -1
- package/lib-prod/formly/type-from-entity.js +2 -2
- package/lib-prod/formly/type-from-entity.js.map +1 -1
- package/lib-prod/get-response-value.d.ts +2 -2
- package/lib-prod/get-response-value.js.map +1 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.d.ts +1 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.d.ts +3 -3
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +1 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js.map +1 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.d.ts +1 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +3 -3
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js.map +1 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.d.ts +1 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.d.ts +2 -2
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.d.ts +1 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +2 -2
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js.map +1 -1
- package/lib-prod/helpers/class-helpers.d.ts +14 -14
- package/lib-prod/helpers/class-helpers.js +54 -54
- package/lib-prod/helpers/class-helpers.js.map +1 -1
- package/lib-prod/helpers/taon-helpers.d.ts +11 -11
- package/lib-prod/helpers/taon-helpers.js +26 -26
- package/lib-prod/helpers/taon-helpers.js.map +1 -1
- package/lib-prod/index.d.ts +17 -17
- package/lib-prod/index.js +16 -16
- package/lib-prod/index.js.map +1 -1
- package/lib-prod/inject.js +3 -3
- package/lib-prod/inject.js.map +1 -1
- package/lib-prod/migrations/index.d.ts +1 -0
- package/lib-prod/migrations/index.js +19 -0
- package/lib-prod/migrations/index.js.map +1 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.d.ts +0 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js +4 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js.map +1 -0
- package/lib-prod/models.d.ts +37 -37
- package/lib-prod/models.js +25 -25
- package/lib-prod/models.js.map +1 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.d.ts +2 -2
- package/lib-prod/realtime/realtime-client.js +9 -9
- package/lib-prod/realtime/realtime-client.js.map +1 -1
- package/lib-prod/realtime/realtime-server.js +17 -17
- package/lib-prod/realtime/realtime-server.js.map +1 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +3 -3
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +2 -2
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js.map +1 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +2 -2
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js.map +1 -1
- package/lib-prod/realtime/realtime-subs-manager.d.ts +2 -2
- package/lib-prod/realtime/realtime-subs-manager.js +6 -6
- package/lib-prod/realtime/realtime-subs-manager.js.map +1 -1
- package/lib-prod/realtime/realtime.models.d.ts +3 -3
- package/lib-prod/symbols.d.ts +9 -9
- package/lib-prod/symbols.js +10 -10
- package/lib-prod/symbols.js.map +1 -1
- package/lib-prod/ui/index.d.ts +1 -1
- package/lib-prod/ui/index.js +2 -2
- package/lib-prod/ui/taon-admin-mode-configuration/index.d.ts +1 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib-prod/validators.d.ts +4 -4
- package/lib-prod/validators.js +9 -9
- package/lib-prod/validators.js.map +1 -1
- package/lib-prod.split-namespaces.json +164 -164
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql/types/taon-websql.d.ts +3 -3
- package/websql-prod/fesm2022/taon-websql.mjs +389 -389
- package/websql-prod/fesm2022/taon-websql.mjs.map +1 -1
- package/websql-prod/package.json +1 -1
- package/websql-prod/types/taon-websql.d.ts +146 -146
- package/websql-prod.split-namespaces.json +164 -164
|
@@ -94,18 +94,18 @@ class EndpointContext {
|
|
|
94
94
|
//#endregion
|
|
95
95
|
//#region fields / types from contexts
|
|
96
96
|
injectableTypesfromContexts = [
|
|
97
|
-
models_1.
|
|
98
|
-
models_1.
|
|
99
|
-
models_1.
|
|
100
|
-
models_1.
|
|
101
|
-
models_1.
|
|
102
|
-
models_1.
|
|
97
|
+
models_1.Models__NS__ClassType.CONTROLLER,
|
|
98
|
+
models_1.Models__NS__ClassType.PROVIDER,
|
|
99
|
+
models_1.Models__NS__ClassType.MIDDLEWARE,
|
|
100
|
+
models_1.Models__NS__ClassType.REPOSITORY,
|
|
101
|
+
models_1.Models__NS__ClassType.SUBSCRIBER,
|
|
102
|
+
models_1.Models__NS__ClassType.MIGRATION,
|
|
103
103
|
];
|
|
104
104
|
//#endregion
|
|
105
105
|
//#region fields / all types from contexts
|
|
106
106
|
allTypesfromContexts = [
|
|
107
107
|
...this.injectableTypesfromContexts,
|
|
108
|
-
models_1.
|
|
108
|
+
models_1.Models__NS__ClassType.ENTITY,
|
|
109
109
|
];
|
|
110
110
|
//#endregion
|
|
111
111
|
//#region fields / express app
|
|
@@ -207,7 +207,7 @@ class EndpointContext {
|
|
|
207
207
|
this.configFn = configFn;
|
|
208
208
|
this.cloneOptions = cloneOptions;
|
|
209
209
|
this.cloneOptions = this.cloneOptions || {};
|
|
210
|
-
this.isRunningInsideDocker = (0, lib_prod_10.
|
|
210
|
+
this.isRunningInsideDocker = (0, lib_prod_10.UtilsOs__NS__isRunningInDocker)();
|
|
211
211
|
}
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region methods & getters / init
|
|
@@ -220,7 +220,7 @@ class EndpointContext {
|
|
|
220
220
|
this.onlyMigrationRevertToTimestamp = onlyMigrationRevertToTimestamp;
|
|
221
221
|
this.config = this.configFn({});
|
|
222
222
|
if (lib_prod_12._.isObject(this.config.database)) {
|
|
223
|
-
this.config.database = models_1.
|
|
223
|
+
this.config.database = models_1.Models__NS__DatabaseConfig.from(this.config.database).databaseConfigTypeORM;
|
|
224
224
|
}
|
|
225
225
|
this.config.host = this.host === null ? void 0 : this.host;
|
|
226
226
|
if (this.cloneOptions.overrideHost &&
|
|
@@ -333,31 +333,31 @@ class EndpointContext {
|
|
|
333
333
|
this.config.subscribers = this.config.subscribers || {};
|
|
334
334
|
this.config.migrations = this.config.migrations || {};
|
|
335
335
|
this.config.entities = {
|
|
336
|
-
...(await this.getRecrusiveClassesfromContextsObj(models_1.
|
|
336
|
+
...(await this.getRecrusiveClassesfromContextsObj(models_1.Models__NS__ClassType.ENTITY)),
|
|
337
337
|
...this.config.entities,
|
|
338
338
|
};
|
|
339
339
|
this.config.controllers = {
|
|
340
|
-
...(await this.getRecrusiveClassesfromContextsObj(models_1.
|
|
340
|
+
...(await this.getRecrusiveClassesfromContextsObj(models_1.Models__NS__ClassType.CONTROLLER)),
|
|
341
341
|
...this.config.controllers,
|
|
342
342
|
};
|
|
343
343
|
this.config.providers = {
|
|
344
|
-
...(await this.getRecrusiveClassesfromContextsObj(models_1.
|
|
344
|
+
...(await this.getRecrusiveClassesfromContextsObj(models_1.Models__NS__ClassType.PROVIDER)),
|
|
345
345
|
...this.config.providers,
|
|
346
346
|
};
|
|
347
347
|
this.config.middlewares = {
|
|
348
|
-
...(await this.getRecrusiveClassesfromContextsObj(models_1.
|
|
348
|
+
...(await this.getRecrusiveClassesfromContextsObj(models_1.Models__NS__ClassType.MIDDLEWARE)),
|
|
349
349
|
...this.config.middlewares,
|
|
350
350
|
};
|
|
351
351
|
this.config.subscribers = {
|
|
352
|
-
...(await this.getRecrusiveClassesfromContextsObj(models_1.
|
|
352
|
+
...(await this.getRecrusiveClassesfromContextsObj(models_1.Models__NS__ClassType.SUBSCRIBER)),
|
|
353
353
|
...this.config.subscribers,
|
|
354
354
|
};
|
|
355
355
|
this.config.repositories = {
|
|
356
|
-
...(await this.getRecrusiveClassesfromContextsObj(models_1.
|
|
356
|
+
...(await this.getRecrusiveClassesfromContextsObj(models_1.Models__NS__ClassType.REPOSITORY)),
|
|
357
357
|
...this.config.repositories,
|
|
358
358
|
};
|
|
359
359
|
this.config.migrations = {
|
|
360
|
-
...(await this.getRecrusiveClassesfromContextsObj(models_1.
|
|
360
|
+
...(await this.getRecrusiveClassesfromContextsObj(models_1.Models__NS__ClassType.MIGRATION)),
|
|
361
361
|
...this.config.migrations,
|
|
362
362
|
};
|
|
363
363
|
// console.log(this.config);
|
|
@@ -368,37 +368,37 @@ class EndpointContext {
|
|
|
368
368
|
classesInput: this.config.controllers,
|
|
369
369
|
config: this.config,
|
|
370
370
|
ctx: this,
|
|
371
|
-
classType: models_1.
|
|
371
|
+
classType: models_1.Models__NS__ClassType.CONTROLLER,
|
|
372
372
|
});
|
|
373
373
|
this.config.repositories = this.cloneClassesObjWithNewMetadata({
|
|
374
374
|
classesInput: this.config.repositories,
|
|
375
375
|
config: this.config,
|
|
376
376
|
ctx: this,
|
|
377
|
-
classType: models_1.
|
|
377
|
+
classType: models_1.Models__NS__ClassType.REPOSITORY,
|
|
378
378
|
});
|
|
379
379
|
this.config.providers = this.cloneClassesObjWithNewMetadata({
|
|
380
380
|
classesInput: this.config.providers,
|
|
381
381
|
config: this.config,
|
|
382
382
|
ctx: this,
|
|
383
|
-
classType: models_1.
|
|
383
|
+
classType: models_1.Models__NS__ClassType.PROVIDER,
|
|
384
384
|
});
|
|
385
385
|
this.config.middlewares = this.cloneClassesObjWithNewMetadata({
|
|
386
386
|
classesInput: this.config.middlewares,
|
|
387
387
|
config: this.config,
|
|
388
388
|
ctx: this,
|
|
389
|
-
classType: models_1.
|
|
389
|
+
classType: models_1.Models__NS__ClassType.MIDDLEWARE,
|
|
390
390
|
});
|
|
391
391
|
this.config.subscribers = this.cloneClassesObjWithNewMetadata({
|
|
392
392
|
classesInput: this.config.subscribers,
|
|
393
393
|
config: this.config,
|
|
394
394
|
ctx: this,
|
|
395
|
-
classType: models_1.
|
|
395
|
+
classType: models_1.Models__NS__ClassType.SUBSCRIBER,
|
|
396
396
|
});
|
|
397
397
|
this.config.migrations = this.cloneClassesObjWithNewMetadata({
|
|
398
398
|
classesInput: this.config.migrations,
|
|
399
399
|
config: this.config,
|
|
400
400
|
ctx: this,
|
|
401
|
-
classType: models_1.
|
|
401
|
+
classType: models_1.Models__NS__ClassType.MIGRATION,
|
|
402
402
|
});
|
|
403
403
|
//#endregion
|
|
404
404
|
//#region prepare instances
|
|
@@ -407,7 +407,7 @@ class EndpointContext {
|
|
|
407
407
|
this.objWithClassesInstancesArr[classTypeName] = [];
|
|
408
408
|
}
|
|
409
409
|
for (const classTypeName of this.injectableTypesfromContexts) {
|
|
410
|
-
await this.createInstances(this.config[models_1.
|
|
410
|
+
await this.createInstances(this.config[models_1.Models__NS__ClassTypeKey[classTypeName]], classTypeName);
|
|
411
411
|
}
|
|
412
412
|
//#endregion
|
|
413
413
|
if (!this.isRunOrRevertOnlyMigrationAppStart) {
|
|
@@ -452,7 +452,7 @@ class EndpointContext {
|
|
|
452
452
|
`;
|
|
453
453
|
}
|
|
454
454
|
//#region @backend
|
|
455
|
-
// if (
|
|
455
|
+
// if (UtilsOs__NS__isRunningInCliMode() && !_.isNil(this.config.disabledRealtime)) {
|
|
456
456
|
// // TODO for now...
|
|
457
457
|
// Helpers.logInfo(`Realtime disable on backend for cli mode`);
|
|
458
458
|
// this.disabledRealtime = true;
|
|
@@ -499,13 +499,13 @@ class EndpointContext {
|
|
|
499
499
|
|
|
500
500
|
`);
|
|
501
501
|
//#region @websqlFunc
|
|
502
|
-
let databaseConfig = models_1.
|
|
503
|
-
const tcpUdpDatabaseSqliteRelativeFileLocation = `${models_1.
|
|
502
|
+
let databaseConfig = models_1.Models__NS__DatabaseConfig.from({});
|
|
503
|
+
const tcpUdpDatabaseSqliteRelativeFileLocation = `${models_1.Models__NS__DatabasesFolder}/db-${this.contextName}.sqlite`;
|
|
504
504
|
if (this.isRunningInsideDocker) {
|
|
505
505
|
if (this.USE_MARIADB_MYSQL_IN_DOCKER) {
|
|
506
506
|
// Helpers.info('Running in docker, using in mysql database');
|
|
507
507
|
// // TODO auto resolve database config in docker
|
|
508
|
-
// databaseConfig =
|
|
508
|
+
// databaseConfig = Models__NS__DatabaseConfig.from({
|
|
509
509
|
// database: `db-${this.contextName}.sqlite`,
|
|
510
510
|
// type: 'mysql',
|
|
511
511
|
// recreateMode: 'PRESERVE_DATA+MIGRATIONS',
|
|
@@ -530,7 +530,7 @@ class EndpointContext {
|
|
|
530
530
|
`db-${this.contextName}.sqlite`,
|
|
531
531
|
]);
|
|
532
532
|
//#endregion
|
|
533
|
-
databaseConfig = databaseConfig = models_1.
|
|
533
|
+
databaseConfig = databaseConfig = models_1.Models__NS__DatabaseConfig.from({
|
|
534
534
|
location: tcpUdpDatabaseSqliteRelativeFileLocation,
|
|
535
535
|
type: 'sqljs',
|
|
536
536
|
useLocalForage: false,
|
|
@@ -561,9 +561,9 @@ class EndpointContext {
|
|
|
561
561
|
case 'backend-frontend(ipc-electron)':
|
|
562
562
|
let dbLocationInOs;
|
|
563
563
|
//#region @backend
|
|
564
|
-
if (lib_prod_10.
|
|
564
|
+
if (lib_prod_10.UtilsOs__NS__isElectron) {
|
|
565
565
|
dbLocationInOs = (0, lib_prod_11.crossPlatformPath)([
|
|
566
|
-
(0, lib_prod_10.
|
|
566
|
+
(0, lib_prod_10.UtilsOs__NS__getRealHomeDir)(),
|
|
567
567
|
`.taon/databases-for-electron-apps/${this.appId || lib_prod_12._.snakeCase(process.cwd()).replace(/\_/, '.')}/${this.contextName}.sqlite`,
|
|
568
568
|
]);
|
|
569
569
|
if (!lib_prod_12.Helpers.exists(lib_prod_13.path.dirname(dbLocationInOs))) {
|
|
@@ -571,8 +571,8 @@ class EndpointContext {
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
//#endregion
|
|
574
|
-
databaseConfig = models_1.
|
|
575
|
-
location: lib_prod_10.
|
|
574
|
+
databaseConfig = models_1.Models__NS__DatabaseConfig.from({
|
|
575
|
+
location: lib_prod_10.UtilsOs__NS__isElectron
|
|
576
576
|
? dbLocationInOs
|
|
577
577
|
: `db-${this.contextName}.sqlite`,
|
|
578
578
|
type: 'sqljs',
|
|
@@ -588,7 +588,7 @@ class EndpointContext {
|
|
|
588
588
|
/* */
|
|
589
589
|
/* */
|
|
590
590
|
/* */
|
|
591
|
-
databaseConfig = databaseConfig = models_1.
|
|
591
|
+
databaseConfig = databaseConfig = models_1.Models__NS__DatabaseConfig.from({
|
|
592
592
|
location: `db-${this.contextName}.sqlite`,
|
|
593
593
|
type: 'sqljs',
|
|
594
594
|
useLocalForage: true, // !!window['localforage'], // TODO this need to be checked in runtime
|
|
@@ -601,7 +601,7 @@ class EndpointContext {
|
|
|
601
601
|
//#endregion
|
|
602
602
|
//#region resolve database config for mode backend-frontend(tcp+udp)
|
|
603
603
|
case 'backend-frontend(tcp+udp)':
|
|
604
|
-
databaseConfig = models_1.
|
|
604
|
+
databaseConfig = models_1.Models__NS__DatabaseConfig.from({
|
|
605
605
|
database: `context-db-${this.contextName}`,
|
|
606
606
|
location: tcpUdpDatabaseSqliteRelativeFileLocation,
|
|
607
607
|
type: 'sqljs',
|
|
@@ -703,54 +703,54 @@ class EndpointContext {
|
|
|
703
703
|
cloneClassWithNewMetadata = ({ TaonBaseClass, className, config, ctx, classType, }) => {
|
|
704
704
|
// Return a new class that extends the base class
|
|
705
705
|
const cloneClass = () => {
|
|
706
|
-
if (TaonBaseClass[symbols_1.
|
|
706
|
+
if (TaonBaseClass[symbols_1.Symbols__NS__fullClassNameStaticProperty] ===
|
|
707
707
|
`${ctx.contextName}.${className}`) {
|
|
708
708
|
return TaonBaseClass;
|
|
709
709
|
}
|
|
710
710
|
return class extends TaonBaseClass {
|
|
711
711
|
// static ['_'] = TaonBaseClass['_'];
|
|
712
712
|
// @ts-ignore
|
|
713
|
-
static [symbols_1.
|
|
713
|
+
static [symbols_1.Symbols__NS__orignalClass] = TaonBaseClass;
|
|
714
714
|
// @ts-ignore
|
|
715
|
-
static [symbols_1.
|
|
715
|
+
static [symbols_1.Symbols__NS__fullClassNameStaticProperty] = `${ctx.contextName}.${className}`;
|
|
716
716
|
// @ts-ignore
|
|
717
|
-
static [symbols_1.
|
|
718
|
-
static [symbols_1.
|
|
717
|
+
static [symbols_1.Symbols__NS__classNameStaticProperty] = className;
|
|
718
|
+
static [symbols_1.Symbols__NS__ctxInClassOrClassObj] = ctx;
|
|
719
719
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
720
720
|
static __getFullPathForClass__(arr = []) {
|
|
721
|
-
const name = this[symbols_1.
|
|
721
|
+
const name = this[symbols_1.Symbols__NS__fullClassNameStaticProperty];
|
|
722
722
|
arr.push(name);
|
|
723
723
|
// @ts-ignore
|
|
724
|
-
if (this[symbols_1.
|
|
725
|
-
this[symbols_1.
|
|
724
|
+
if (this[symbols_1.Symbols__NS__orignalClass] && // @ts-ignore
|
|
725
|
+
this[symbols_1.Symbols__NS__orignalClass].__getFullPathForClass__) {
|
|
726
726
|
// @ts-ignore
|
|
727
|
-
this[symbols_1.
|
|
727
|
+
this[symbols_1.Symbols__NS__orignalClass].__getFullPathForClass__(arr);
|
|
728
728
|
}
|
|
729
729
|
return arr.join('/');
|
|
730
730
|
}
|
|
731
731
|
static get fullPathForClass() {
|
|
732
732
|
return this.__getFullPathForClass__();
|
|
733
733
|
}
|
|
734
|
-
[symbols_1.
|
|
734
|
+
[symbols_1.Symbols__NS__ctxInClassOrClassObj] = ctx;
|
|
735
735
|
};
|
|
736
736
|
};
|
|
737
737
|
const cloneClassFunction = cloneClass();
|
|
738
738
|
//#region gather all instances for all contexts
|
|
739
739
|
// TODO this is not needed anymore - for typeorm I use normal entities
|
|
740
740
|
// this thinng belowe is nice for debugging purpose
|
|
741
|
-
// if (_.isUndefined(cloneClassFunction[
|
|
742
|
-
// cloneClassFunction[
|
|
741
|
+
// if (_.isUndefined(cloneClassFunction[Symbols__NS__orignalClassClonesObj])) {
|
|
742
|
+
// cloneClassFunction[Symbols__NS__orignalClassClonesObj] = {};
|
|
743
743
|
// }
|
|
744
|
-
// if (_.isUndefined(TaonBaseClass[
|
|
745
|
-
// TaonBaseClass[
|
|
744
|
+
// if (_.isUndefined(TaonBaseClass[Symbols__NS__orignalClassClonesObj])) {
|
|
745
|
+
// TaonBaseClass[Symbols__NS__orignalClassClonesObj] = {};
|
|
746
746
|
// }
|
|
747
747
|
// const all = {
|
|
748
|
-
// ...TaonBaseClass[
|
|
749
|
-
// ...cloneClassFunction[
|
|
748
|
+
// ...TaonBaseClass[Symbols__NS__orignalClassClonesObj],
|
|
749
|
+
// ...cloneClassFunction[Symbols__NS__orignalClassClonesObj],
|
|
750
750
|
// };
|
|
751
751
|
// all[ctx.contextName] = cloneClassFunction;
|
|
752
|
-
// cloneClassFunction[
|
|
753
|
-
// TaonBaseClass[
|
|
752
|
+
// cloneClassFunction[Symbols__NS__orignalClassClonesObj] = all;
|
|
753
|
+
// TaonBaseClass[Symbols__NS__orignalClassClonesObj] = all;
|
|
754
754
|
//#endregion
|
|
755
755
|
return cloneClassFunction;
|
|
756
756
|
};
|
|
@@ -769,13 +769,13 @@ class EndpointContext {
|
|
|
769
769
|
|
|
770
770
|
`);
|
|
771
771
|
}
|
|
772
|
-
var className = Reflect.getMetadata(symbols_1.
|
|
772
|
+
var className = Reflect.getMetadata(symbols_1.Symbols__NS__metadata.className, TaonBaseClass);
|
|
773
773
|
// console.log('Metadata className', className, TaonBaseClass);
|
|
774
774
|
// if (!className) {
|
|
775
775
|
// console.warn(`Please provide className for ${TaonBaseClass.name} class`);
|
|
776
776
|
// }
|
|
777
777
|
className = className || key;
|
|
778
|
-
TaonBaseClass[symbols_1.
|
|
778
|
+
TaonBaseClass[symbols_1.Symbols__NS__classNameStaticProperty] = className;
|
|
779
779
|
const clonedClass = this.cloneClassWithNewMetadata({
|
|
780
780
|
TaonBaseClass,
|
|
781
781
|
className,
|
|
@@ -792,7 +792,7 @@ class EndpointContext {
|
|
|
792
792
|
async getRecrusiveClassesfromContextsObj(classType) {
|
|
793
793
|
const arr = await this.getRecrusiveClassesfromContexts(classType);
|
|
794
794
|
return arr.reduce((acc, c) => {
|
|
795
|
-
acc[(0, class_helpers_1.
|
|
795
|
+
acc[(0, class_helpers_1.ClassHelpers__NS__getName)(c)] = c;
|
|
796
796
|
return acc;
|
|
797
797
|
}, {});
|
|
798
798
|
}
|
|
@@ -832,9 +832,9 @@ class EndpointContext {
|
|
|
832
832
|
//#endregion
|
|
833
833
|
//#region methods & getters / inject
|
|
834
834
|
inject(ctor, options) {
|
|
835
|
-
const className = (0, class_helpers_1.
|
|
835
|
+
const className = (0, class_helpers_1.ClassHelpers__NS__getName)(ctor);
|
|
836
836
|
const locaInstanceConstructorArgs = options.locaInstanceConstructorArgs || [];
|
|
837
|
-
if (this.isCLassType(models_1.
|
|
837
|
+
if (this.isCLassType(models_1.Models__NS__ClassType.REPOSITORY, ctor)) {
|
|
838
838
|
options.localInstance = true;
|
|
839
839
|
}
|
|
840
840
|
if (options?.localInstance) {
|
|
@@ -844,7 +844,7 @@ class EndpointContext {
|
|
|
844
844
|
// if (className === 'TaonBaseRepository') {
|
|
845
845
|
const entityFn = lib_prod_12._.first(locaInstanceConstructorArgs);
|
|
846
846
|
const entity = entityFn && entityFn();
|
|
847
|
-
entityName = (entity && (0, class_helpers_1.
|
|
847
|
+
entityName = (entity && (0, class_helpers_1.ClassHelpers__NS__getName)(entity)) || '';
|
|
848
848
|
// console.log(`entityName `, entityName);
|
|
849
849
|
// }
|
|
850
850
|
if (!options.contextClassInstance[this.localInstaceObjSymbol]) {
|
|
@@ -854,12 +854,12 @@ class EndpointContext {
|
|
|
854
854
|
const existed = options.contextClassInstance[this.localInstaceObjSymbol][instanceKey];
|
|
855
855
|
if (existed) {
|
|
856
856
|
// console.log(
|
|
857
|
-
// `EXISTED ${
|
|
857
|
+
// `EXISTED ${ClassHelpers__NS__getName(options.parentInstanceThatWillGetInjectedStuff)} Inject ${className} instanceKey "${instanceKey}"`,
|
|
858
858
|
// );
|
|
859
859
|
return existed;
|
|
860
860
|
}
|
|
861
861
|
// console.log(
|
|
862
|
-
// `NEW ${
|
|
862
|
+
// `NEW ${ClassHelpers__NS__getName(options.parentInstanceThatWillGetInjectedStuff)} Inject ${className} instanceKey "${instanceKey}"`,
|
|
863
863
|
// );
|
|
864
864
|
if (!ctxClassFn) {
|
|
865
865
|
throw new Error(`Not able to inject "${className}" inside context "${this.contextName}"
|
|
@@ -885,11 +885,11 @@ class EndpointContext {
|
|
|
885
885
|
*/
|
|
886
886
|
getInstanceBy(ctor) {
|
|
887
887
|
// if (!!this.__contextForControllerInstanceAccess) {
|
|
888
|
-
// const className =
|
|
889
|
-
// const allControllers = this.getClassFunByArr(
|
|
888
|
+
// const className = ClassHelpers__NS__getName(ctor);
|
|
889
|
+
// const allControllers = this.getClassFunByArr(Models__NS__ClassType.CONTROLLER);
|
|
890
890
|
// // TODO QUICK_FIX cache controllers
|
|
891
891
|
// for (const ctrl of allControllers) {
|
|
892
|
-
// if (
|
|
892
|
+
// if (ClassHelpers__NS__getName(ctrl) === className) {
|
|
893
893
|
// // console.log('injecting from contextForControllerInstanceAcesss', className);
|
|
894
894
|
// return this.__contextForControllerInstanceAccess.inject(ctor, {
|
|
895
895
|
// localInstance: false,
|
|
@@ -921,24 +921,24 @@ class EndpointContext {
|
|
|
921
921
|
getClassFunBy(classType) {
|
|
922
922
|
this.checkIfContextInitialized();
|
|
923
923
|
switch (classType) {
|
|
924
|
-
case models_1.
|
|
924
|
+
case models_1.Models__NS__ClassType.CONTROLLER:
|
|
925
925
|
return this.config.controllers;
|
|
926
|
-
case models_1.
|
|
926
|
+
case models_1.Models__NS__ClassType.ENTITY:
|
|
927
927
|
return this.config.entities;
|
|
928
|
-
case models_1.
|
|
928
|
+
case models_1.Models__NS__ClassType.PROVIDER:
|
|
929
929
|
return this.config.providers;
|
|
930
|
-
case models_1.
|
|
930
|
+
case models_1.Models__NS__ClassType.MIDDLEWARE:
|
|
931
931
|
return this.config.middlewares;
|
|
932
|
-
case models_1.
|
|
932
|
+
case models_1.Models__NS__ClassType.REPOSITORY:
|
|
933
933
|
return this.config.repositories;
|
|
934
|
-
case models_1.
|
|
934
|
+
case models_1.Models__NS__ClassType.SUBSCRIBER:
|
|
935
935
|
return this.config.subscribers;
|
|
936
|
-
case models_1.
|
|
936
|
+
case models_1.Models__NS__ClassType.MIGRATION:
|
|
937
937
|
return this.config.migrations;
|
|
938
938
|
}
|
|
939
939
|
}
|
|
940
940
|
isCLassType(classType, classFn) {
|
|
941
|
-
return !!this.getClassFunBy(classType)[(0, class_helpers_1.
|
|
941
|
+
return !!this.getClassFunBy(classType)[(0, class_helpers_1.ClassHelpers__NS__getName)(classFn)];
|
|
942
942
|
}
|
|
943
943
|
/**
|
|
944
944
|
* Only for injectable types
|
|
@@ -946,14 +946,14 @@ class EndpointContext {
|
|
|
946
946
|
*/
|
|
947
947
|
getClassFunByClassName(className) {
|
|
948
948
|
for (const classTypeName of this.allTypesfromContexts) {
|
|
949
|
-
const classesForInjectableType = this.config[models_1.
|
|
949
|
+
const classesForInjectableType = this.config[models_1.Models__NS__ClassTypeKey[classTypeName]];
|
|
950
950
|
if (classesForInjectableType[className]) {
|
|
951
951
|
return classesForInjectableType[className];
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
955
|
getClassFunByClass(classFunction) {
|
|
956
|
-
const className = (0, class_helpers_1.
|
|
956
|
+
const className = (0, class_helpers_1.ClassHelpers__NS__getName)(classFunction);
|
|
957
957
|
return this.getClassFunByClassName(className);
|
|
958
958
|
}
|
|
959
959
|
getClassFunByArr(classType) {
|
|
@@ -972,11 +972,11 @@ class EndpointContext {
|
|
|
972
972
|
]) {
|
|
973
973
|
const instance = di_container_1.DITaonContainer.resolve(classFn);
|
|
974
974
|
const classInstancesByNameObj = this.classInstancesByNameObj[classType];
|
|
975
|
-
const className = (0, class_helpers_1.
|
|
975
|
+
const className = (0, class_helpers_1.ClassHelpers__NS__getName)(classFn);
|
|
976
976
|
// console.log({ classFn, classType, instance, place, className, 'classInstancesByNameObj': this.classInstancesByNameObj });
|
|
977
977
|
classInstancesByNameObj[className] = instance;
|
|
978
978
|
// update config
|
|
979
|
-
this.config[models_1.
|
|
979
|
+
this.config[models_1.Models__NS__ClassTypeKey[classType]][className] = classFn;
|
|
980
980
|
this.objWithClassesInstancesArr[classType].push(instance);
|
|
981
981
|
this.allClassesInstances[className] = instance;
|
|
982
982
|
}
|
|
@@ -988,18 +988,18 @@ class EndpointContext {
|
|
|
988
988
|
return;
|
|
989
989
|
}
|
|
990
990
|
//#region @websql
|
|
991
|
-
for (const classFun of this.getClassFunByArr(models_1.
|
|
992
|
-
const repo = (await this.connection.getRepository((0, class_helpers_1.
|
|
993
|
-
this.repos.set((0, class_helpers_1.
|
|
991
|
+
for (const classFun of this.getClassFunByArr(models_1.Models__NS__ClassType.ENTITY)) {
|
|
992
|
+
const repo = (await this.connection.getRepository((0, class_helpers_1.ClassHelpers__NS__getOrginalClass)(classFun)));
|
|
993
|
+
this.repos.set((0, class_helpers_1.ClassHelpers__NS__getName)(classFun), repo);
|
|
994
994
|
}
|
|
995
995
|
//#endregion
|
|
996
996
|
for (const classTypeName of [
|
|
997
|
-
models_1.
|
|
998
|
-
models_1.
|
|
999
|
-
models_1.
|
|
1000
|
-
models_1.
|
|
1001
|
-
models_1.
|
|
1002
|
-
models_1.
|
|
997
|
+
models_1.Models__NS__ClassType.MIDDLEWARE,
|
|
998
|
+
models_1.Models__NS__ClassType.PROVIDER,
|
|
999
|
+
models_1.Models__NS__ClassType.REPOSITORY,
|
|
1000
|
+
models_1.Models__NS__ClassType.CONTROLLER,
|
|
1001
|
+
models_1.Models__NS__ClassType.ENTITY,
|
|
1002
|
+
models_1.Models__NS__ClassType.MIGRATION,
|
|
1003
1003
|
]) {
|
|
1004
1004
|
//#region init class static _ property
|
|
1005
1005
|
for (const classFun of this.getClassFunByArr(classTypeName)) {
|
|
@@ -1010,11 +1010,11 @@ class EndpointContext {
|
|
|
1010
1010
|
//#endregion
|
|
1011
1011
|
}
|
|
1012
1012
|
for (const classTypeName of [
|
|
1013
|
-
models_1.
|
|
1014
|
-
models_1.
|
|
1015
|
-
models_1.
|
|
1016
|
-
models_1.
|
|
1017
|
-
models_1.
|
|
1013
|
+
models_1.Models__NS__ClassType.MIDDLEWARE,
|
|
1014
|
+
models_1.Models__NS__ClassType.PROVIDER,
|
|
1015
|
+
models_1.Models__NS__ClassType.REPOSITORY,
|
|
1016
|
+
models_1.Models__NS__ClassType.CONTROLLER,
|
|
1017
|
+
models_1.Models__NS__ClassType.MIGRATION,
|
|
1018
1018
|
]) {
|
|
1019
1019
|
//#region init providers, repositories _ property
|
|
1020
1020
|
// Helpers.taskStarted(
|
|
@@ -1034,7 +1034,7 @@ class EndpointContext {
|
|
|
1034
1034
|
//#endregion
|
|
1035
1035
|
//#region methods & getters / is active on
|
|
1036
1036
|
isActiveOn(classInstance) {
|
|
1037
|
-
let contextRef = classInstance[symbols_1.
|
|
1037
|
+
let contextRef = classInstance[symbols_1.Symbols__NS__ctxInClassOrClassObj];
|
|
1038
1038
|
return this === contextRef;
|
|
1039
1039
|
}
|
|
1040
1040
|
//#endregion
|
|
@@ -1205,11 +1205,11 @@ class EndpointContext {
|
|
|
1205
1205
|
if (this.isRemoteHost) {
|
|
1206
1206
|
return;
|
|
1207
1207
|
}
|
|
1208
|
-
const subscriberClasses = this.getClassFunByArr(models_1.
|
|
1208
|
+
const subscriberClasses = this.getClassFunByArr(models_1.Models__NS__ClassType.SUBSCRIBER);
|
|
1209
1209
|
for (const subscriberClassFn of subscriberClasses) {
|
|
1210
|
-
const options = Reflect.getMetadata(symbols_1.
|
|
1210
|
+
const options = Reflect.getMetadata(symbols_1.Symbols__NS__metadata.options.subscriber, subscriberClassFn);
|
|
1211
1211
|
// console.log('subscriber options', options);
|
|
1212
|
-
// const nameForSubscriber =
|
|
1212
|
+
// const nameForSubscriber = ClassHelpers__NS__getName(subscriber);
|
|
1213
1213
|
(0, lib_prod_4.EventSubscriber)()(subscriberClassFn);
|
|
1214
1214
|
}
|
|
1215
1215
|
//#endregion
|
|
@@ -1221,13 +1221,13 @@ class EndpointContext {
|
|
|
1221
1221
|
if (this.isRemoteHost) {
|
|
1222
1222
|
return;
|
|
1223
1223
|
}
|
|
1224
|
-
const entities = this.getClassFunByArr(models_1.
|
|
1224
|
+
const entities = this.getClassFunByArr(models_1.Models__NS__ClassType.ENTITY);
|
|
1225
1225
|
for (const entity of entities) {
|
|
1226
|
-
const options = Reflect.getMetadata(symbols_1.
|
|
1226
|
+
const options = Reflect.getMetadata(symbols_1.Symbols__NS__metadata.options.entity, entity);
|
|
1227
1227
|
const createTable = lib_prod_12._.isUndefined(options.createTable)
|
|
1228
1228
|
? true
|
|
1229
1229
|
: options.createTable;
|
|
1230
|
-
const nameForEntity = (0, class_helpers_1.
|
|
1230
|
+
const nameForEntity = (0, class_helpers_1.ClassHelpers__NS__getName)(entity);
|
|
1231
1231
|
if (createTable) {
|
|
1232
1232
|
this.logDb &&
|
|
1233
1233
|
console.info(`[taon][typeorm] create table for entity "${nameForEntity}" ? '${createTable}'`);
|
|
@@ -1267,10 +1267,10 @@ class EndpointContext {
|
|
|
1267
1267
|
if (this.isRemoteHost || !this.databaseConfig) {
|
|
1268
1268
|
return;
|
|
1269
1269
|
}
|
|
1270
|
-
const entities = this.getClassFunByArr(models_1.
|
|
1271
|
-
return (0, class_helpers_1.
|
|
1270
|
+
const entities = this.getClassFunByArr(models_1.Models__NS__ClassType.ENTITY).map(entityFn => {
|
|
1271
|
+
return (0, class_helpers_1.ClassHelpers__NS__getOrginalClass)(entityFn);
|
|
1272
1272
|
});
|
|
1273
|
-
const subscribers = this.getClassFunByArr(models_1.
|
|
1273
|
+
const subscribers = this.getClassFunByArr(models_1.Models__NS__ClassType.SUBSCRIBER);
|
|
1274
1274
|
let autoSave = false;
|
|
1275
1275
|
if (!lib_prod_12._.isNil(this.databaseConfig.autoSave)) {
|
|
1276
1276
|
autoSave = this.databaseConfig.autoSave;
|
|
@@ -1365,20 +1365,20 @@ class EndpointContext {
|
|
|
1365
1365
|
const parentsCalculatedPath = lib_prod_12._.slice(rawConfigs, 1)
|
|
1366
1366
|
.reverse()
|
|
1367
1367
|
.map(bc => {
|
|
1368
|
-
if ((0, taon_helpers_1.
|
|
1368
|
+
if ((0, taon_helpers_1.TaonHelpers__NS__isGoodPath)(bc.path)) {
|
|
1369
1369
|
return bc.path;
|
|
1370
1370
|
}
|
|
1371
1371
|
return bc.className;
|
|
1372
1372
|
})
|
|
1373
1373
|
.join('/');
|
|
1374
1374
|
const contextNameForCommunication = this.contextNameForCommunication;
|
|
1375
|
-
if ((0, taon_helpers_1.
|
|
1375
|
+
if ((0, taon_helpers_1.TaonHelpers__NS__isGoodPath)(classConfig.path)) {
|
|
1376
1376
|
classConfig.calculatedPath = classConfig.path;
|
|
1377
1377
|
}
|
|
1378
1378
|
else {
|
|
1379
1379
|
classConfig.calculatedPath = (`${this.uriPathnameOrNothingIfRoot}` +
|
|
1380
1380
|
`/${constants_1.apiPrefix}/${contextNameForCommunication}/tcp${parentsCalculatedPath}/` +
|
|
1381
|
-
`${(0, class_helpers_1.
|
|
1381
|
+
`${(0, class_helpers_1.ClassHelpers__NS__getName)(controllerClassFn)}`)
|
|
1382
1382
|
.replace(/\/\//g, '/')
|
|
1383
1383
|
.split('/')
|
|
1384
1384
|
.reduce((acc, bc) => {
|
|
@@ -1411,7 +1411,7 @@ class EndpointContext {
|
|
|
1411
1411
|
if (this.isRunOrRevertOnlyMigrationAppStart) {
|
|
1412
1412
|
return;
|
|
1413
1413
|
}
|
|
1414
|
-
const allControllers = this.getClassFunByArr(models_1.
|
|
1414
|
+
const allControllers = this.getClassFunByArr(models_1.Models__NS__ClassType.CONTROLLER);
|
|
1415
1415
|
for (const controllerClassFn of allControllers) {
|
|
1416
1416
|
const instance = this.getInstanceBy(controllerClassFn);
|
|
1417
1417
|
if (lib_prod_12._.isFunction(instance.afterAllCtxInited)) {
|
|
@@ -1423,21 +1423,21 @@ class EndpointContext {
|
|
|
1423
1423
|
if (this.isRunOrRevertOnlyMigrationAppStart) {
|
|
1424
1424
|
return;
|
|
1425
1425
|
}
|
|
1426
|
-
const allControllers = this.getClassFunByArr(models_1.
|
|
1426
|
+
const allControllers = this.getClassFunByArr(models_1.Models__NS__ClassType.CONTROLLER);
|
|
1427
1427
|
// debugger
|
|
1428
1428
|
// console.log('allControllers', allControllers);
|
|
1429
1429
|
for (const controllerClassFn of allControllers) {
|
|
1430
|
-
// console.log(
|
|
1431
|
-
// const controllerName =
|
|
1430
|
+
// console.log(ClassHelpers__NS__getClassConfig(controllerClassFn));
|
|
1431
|
+
// const controllerName = ClassHelpers__NS__getName(controllerClassFn);
|
|
1432
1432
|
// console.log(
|
|
1433
1433
|
// `for ${controllerName}`,
|
|
1434
|
-
//
|
|
1434
|
+
// ClassHelpers__NS__getClassConfig(controllerClassFn),
|
|
1435
1435
|
// );
|
|
1436
|
-
controllerClassFn[symbols_1.
|
|
1437
|
-
(0, class_helpers_1.
|
|
1438
|
-
const rawConfigs = (0, class_helpers_1.
|
|
1436
|
+
controllerClassFn[symbols_1.Symbols__NS__classMethodsNames] =
|
|
1437
|
+
(0, class_helpers_1.ClassHelpers__NS__getMethodsNames)(controllerClassFn);
|
|
1438
|
+
const rawConfigs = (0, class_helpers_1.ClassHelpers__NS__getControllerConfigs)(controllerClassFn);
|
|
1439
1439
|
// console.log(controllerName, { rawConfigs });
|
|
1440
|
-
// console.log(`Class config for ${
|
|
1440
|
+
// console.log(`Class config for ${ClassHelpers__NS__getName(controllerClassFn)}`, configs)
|
|
1441
1441
|
const classConfig = rawConfigs[0];
|
|
1442
1442
|
this.updateCalculatedPathsForControllers(rawConfigs, classConfig, controllerClassFn);
|
|
1443
1443
|
this.mergeControllerMethodsConfigs(rawConfigs, classConfig, controllerClassFn);
|
|
@@ -1448,7 +1448,7 @@ class EndpointContext {
|
|
|
1448
1448
|
classConfig.calculatedMiddlewaresControllerObj = rc.middlewares({
|
|
1449
1449
|
parentMiddlewares: classConfig.calculatedMiddlewaresControllerObj,
|
|
1450
1450
|
className(middlewareClass) {
|
|
1451
|
-
return (0, class_helpers_1.
|
|
1451
|
+
return (0, class_helpers_1.ClassHelpers__NS__getName)(controllerClassFn);
|
|
1452
1452
|
},
|
|
1453
1453
|
});
|
|
1454
1454
|
}
|
|
@@ -1477,7 +1477,7 @@ class EndpointContext {
|
|
|
1477
1477
|
calculatedMiddlewaresMethodObj = parentMethodConfig.middlewares({
|
|
1478
1478
|
parentMiddlewares: calculatedMiddlewaresMethodObj,
|
|
1479
1479
|
className(middlewareClass) {
|
|
1480
|
-
return (0, class_helpers_1.
|
|
1480
|
+
return (0, class_helpers_1.ClassHelpers__NS__getName)(controllerClassFn);
|
|
1481
1481
|
},
|
|
1482
1482
|
});
|
|
1483
1483
|
}
|
|
@@ -1500,7 +1500,7 @@ class EndpointContext {
|
|
|
1500
1500
|
: '';
|
|
1501
1501
|
const expressPath = methodConfig.global
|
|
1502
1502
|
? `${globalPathPart}/${methodConfig.path?.replace(/\/$/, '')}`.replace(/\/\//, '/')
|
|
1503
|
-
: (0, taon_helpers_1.
|
|
1503
|
+
: (0, taon_helpers_1.TaonHelpers__NS__getExpressPath)(classConfig, methodConfig);
|
|
1504
1504
|
//#endregion
|
|
1505
1505
|
//#region init server
|
|
1506
1506
|
// console.log({ expressPath });
|
|
@@ -1520,7 +1520,7 @@ class EndpointContext {
|
|
|
1520
1520
|
if (shouldInitClient) {
|
|
1521
1521
|
// console.log(
|
|
1522
1522
|
// 'initClient',
|
|
1523
|
-
//
|
|
1523
|
+
// ClassHelpers__NS__getFullInternalName(controllerClassFn),
|
|
1524
1524
|
// type,
|
|
1525
1525
|
// methodConfig,
|
|
1526
1526
|
// expressPath,
|
|
@@ -1549,12 +1549,12 @@ class EndpointContext {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
// const contexts: EndpointContext[] = [this];
|
|
1551
1551
|
//#region @websql
|
|
1552
|
-
const troutes = (0, lib_prod_10.
|
|
1552
|
+
const troutes = (0, lib_prod_10.Utils__NS__uniqArray)(this.activeRoutes.map(f => {
|
|
1553
1553
|
return `${f.method} ${f.expressPath}`;
|
|
1554
1554
|
})).map(f => {
|
|
1555
1555
|
const [method, expressPath] = f.split(' ');
|
|
1556
1556
|
return (`\n### ${lib_prod_12._.startCase(lib_prod_12._.last(expressPath.split('/')))}\n` +
|
|
1557
|
-
(0, taon_helpers_1.
|
|
1557
|
+
(0, taon_helpers_1.TaonHelpers__NS__fillUpTo)(method.toUpperCase() + ' ', 10) +
|
|
1558
1558
|
this.uriOrigin +
|
|
1559
1559
|
expressPath);
|
|
1560
1560
|
// return `${TaonHelpers.string(method.toUpperCase() + ':')
|
|
@@ -1573,7 +1573,7 @@ class EndpointContext {
|
|
|
1573
1573
|
this.logFramework && console.log(`[taon] routes file: ${fileName} `);
|
|
1574
1574
|
this.logRoutes && console.log(routes);
|
|
1575
1575
|
//#region @backend
|
|
1576
|
-
if (!lib_prod_10.
|
|
1576
|
+
if (!lib_prod_10.UtilsOs__NS__isElectron && !this.skipWritingServerRoutes) {
|
|
1577
1577
|
lib_prod_12.Helpers.writeFile(fileName, routes);
|
|
1578
1578
|
}
|
|
1579
1579
|
//#endregion
|
|
@@ -1589,12 +1589,12 @@ class EndpointContext {
|
|
|
1589
1589
|
//#endregion
|
|
1590
1590
|
//#region methods & getters / init middlewares
|
|
1591
1591
|
async initCustomClientMiddlewares() {
|
|
1592
|
-
const middlewares = this.getClassesInstancesArrBy(models_1.
|
|
1592
|
+
const middlewares = this.getClassesInstancesArrBy(models_1.Models__NS__ClassType.MIDDLEWARE)
|
|
1593
1593
|
.map(f => f)
|
|
1594
1594
|
.filter(f => lib_prod_12._.isFunction(f.interceptClient));
|
|
1595
1595
|
middlewares.forEach(middlewareInstanceName => {
|
|
1596
1596
|
const contextName = this.contextName;
|
|
1597
|
-
const interceptorName = `${contextName}-${(0, class_helpers_1.
|
|
1597
|
+
const interceptorName = `${contextName}-${(0, class_helpers_1.ClassHelpers__NS__getName)(middlewareInstanceName)}`;
|
|
1598
1598
|
lib_prod_3.Resource.request.interceptors.set(interceptorName, {
|
|
1599
1599
|
intercept: ({ req, next }) => {
|
|
1600
1600
|
const url = new url_1.URL(req.url);
|
|
@@ -1613,11 +1613,11 @@ class EndpointContext {
|
|
|
1613
1613
|
async initCustomBackendMiddlewares() {
|
|
1614
1614
|
//#region @backend
|
|
1615
1615
|
const app = this.expressApp;
|
|
1616
|
-
const middlewares = this.getClassesInstancesArrBy(models_1.
|
|
1616
|
+
const middlewares = this.getClassesInstancesArrBy(models_1.Models__NS__ClassType.MIDDLEWARE);
|
|
1617
1617
|
for (const middleware of middlewares) {
|
|
1618
1618
|
const middlewareInstance = middleware;
|
|
1619
1619
|
if (lib_prod_12._.isFunction(middlewareInstance.interceptServer)) {
|
|
1620
|
-
const middlewareFn = (0, class_helpers_1.
|
|
1620
|
+
const middlewareFn = (0, class_helpers_1.ClassHelpers__NS__asyncHandler)(async (req, res, next) => {
|
|
1621
1621
|
if (req.originalUrl.startsWith(`${this.uriPathnameOrNothingIfRoot}/${constants_1.apiPrefix}/${this.contextName}/`)) {
|
|
1622
1622
|
await middlewareInstance.interceptServer({
|
|
1623
1623
|
req,
|
|
@@ -1712,10 +1712,10 @@ class EndpointContext {
|
|
|
1712
1712
|
'Content-Type',
|
|
1713
1713
|
'Authorization',
|
|
1714
1714
|
'X-Requested-With',
|
|
1715
|
-
symbols_1.
|
|
1716
|
-
symbols_1.
|
|
1717
|
-
symbols_1.
|
|
1718
|
-
symbols_1.
|
|
1715
|
+
symbols_1.Symbols__NS__old.X_TOTAL_COUNT,
|
|
1716
|
+
symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER,
|
|
1717
|
+
symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY,
|
|
1718
|
+
symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM,
|
|
1719
1719
|
].join(', '));
|
|
1720
1720
|
next();
|
|
1721
1721
|
});
|
|
@@ -1736,7 +1736,7 @@ class EndpointContext {
|
|
|
1736
1736
|
const middlewareInstance = this.getInstanceBy(middlewareClassFun);
|
|
1737
1737
|
if (middlewareInstance &&
|
|
1738
1738
|
lib_prod_12._.isFunction(middlewareInstance.interceptServerMethod)) {
|
|
1739
|
-
const middlewareFn = (0, class_helpers_1.
|
|
1739
|
+
const middlewareFn = (0, class_helpers_1.ClassHelpers__NS__asyncHandler)(async (req, res, next) => {
|
|
1740
1740
|
await middlewareInstance.interceptServerMethod({
|
|
1741
1741
|
req,
|
|
1742
1742
|
res,
|
|
@@ -1771,10 +1771,10 @@ class EndpointContext {
|
|
|
1771
1771
|
//#endregion
|
|
1772
1772
|
if (lib_prod_12.Helpers.isElectron) {
|
|
1773
1773
|
//#region @backend
|
|
1774
|
-
const ipcKeyName = (0, taon_helpers_1.
|
|
1774
|
+
const ipcKeyName = (0, taon_helpers_1.TaonHelpers__NS__ipcKeyNameRequest)(target, methodConfig, expressPath);
|
|
1775
1775
|
electron_1.ipcMain.on(ipcKeyName, async (event, paramsFromBrowser) => {
|
|
1776
1776
|
const responseJsonData = await getResult(paramsFromBrowser, void 0, void 0);
|
|
1777
|
-
const sendToIpsMainOn = (0, taon_helpers_1.
|
|
1777
|
+
const sendToIpsMainOn = (0, taon_helpers_1.TaonHelpers__NS__ipcKeyNameResponse)(target, methodConfig, expressPath);
|
|
1778
1778
|
// console.log({ sendToIpsMainOn });
|
|
1779
1779
|
event.sender.send(sendToIpsMainOn, responseJsonData);
|
|
1780
1780
|
});
|
|
@@ -1805,60 +1805,60 @@ class EndpointContext {
|
|
|
1805
1805
|
let tBody = req.body;
|
|
1806
1806
|
let tParams = req.params;
|
|
1807
1807
|
let tQuery = req.query;
|
|
1808
|
-
if (req.headers[symbols_1.
|
|
1808
|
+
if (req.headers[symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY]) {
|
|
1809
1809
|
try {
|
|
1810
|
-
tBody = JSON.parse(JSON.stringify(tBody), JSON.parse((0, taon_helpers_1.
|
|
1810
|
+
tBody = JSON.parse(JSON.stringify(tBody), JSON.parse((0, taon_helpers_1.TaonHelpers__NS__firstStringOrElemFromArray)(req.headers[symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY])));
|
|
1811
1811
|
}
|
|
1812
1812
|
catch (e) { }
|
|
1813
1813
|
}
|
|
1814
|
-
if (req.headers[symbols_1.
|
|
1814
|
+
if (req.headers[symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM]) {
|
|
1815
1815
|
try {
|
|
1816
|
-
tQuery = JSON.parse(JSON.stringify(tQuery), JSON.parse((0, taon_helpers_1.
|
|
1816
|
+
tQuery = JSON.parse(JSON.stringify(tQuery), JSON.parse((0, taon_helpers_1.TaonHelpers__NS__firstStringOrElemFromArray)(req.headers[symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM])));
|
|
1817
1817
|
}
|
|
1818
1818
|
catch (e) { }
|
|
1819
1819
|
}
|
|
1820
1820
|
// make class instance from body
|
|
1821
1821
|
// console.log('req.headers', req.headers)
|
|
1822
|
-
if (req.headers[symbols_1.
|
|
1822
|
+
if (req.headers[symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS]) {
|
|
1823
1823
|
try {
|
|
1824
|
-
const entity = JSON.parse((0, taon_helpers_1.
|
|
1825
|
-
tBody = (0, lib_prod_3.
|
|
1824
|
+
const entity = JSON.parse((0, taon_helpers_1.TaonHelpers__NS__firstStringOrElemFromArray)(req.headers[symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS]));
|
|
1825
|
+
tBody = (0, lib_prod_3.Mapping__NS__encode)(tBody, entity);
|
|
1826
1826
|
}
|
|
1827
1827
|
catch (e) { }
|
|
1828
1828
|
}
|
|
1829
1829
|
else {
|
|
1830
1830
|
Object.keys(tBody).forEach(paramName => {
|
|
1831
1831
|
try {
|
|
1832
|
-
const entityForParam = JSON.parse((0, taon_helpers_1.
|
|
1833
|
-
tBody[paramName] = (0, lib_prod_3.
|
|
1832
|
+
const entityForParam = JSON.parse((0, taon_helpers_1.TaonHelpers__NS__firstStringOrElemFromArray)(req.headers[`${symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS}${paramName} `]));
|
|
1833
|
+
tBody[paramName] = (0, lib_prod_3.Mapping__NS__encode)(tBody[paramName], entityForParam);
|
|
1834
1834
|
}
|
|
1835
1835
|
catch (e) { }
|
|
1836
1836
|
});
|
|
1837
1837
|
}
|
|
1838
1838
|
// make class instance from query params
|
|
1839
1839
|
// console.log('req.headers', tQuery)
|
|
1840
|
-
if (req.headers[symbols_1.
|
|
1840
|
+
if (req.headers[symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS]) {
|
|
1841
1841
|
try {
|
|
1842
|
-
const entity = JSON.parse((0, taon_helpers_1.
|
|
1843
|
-
tQuery = (0, taon_helpers_1.
|
|
1842
|
+
const entity = JSON.parse((0, taon_helpers_1.TaonHelpers__NS__firstStringOrElemFromArray)(req.headers[symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS]));
|
|
1843
|
+
tQuery = (0, taon_helpers_1.TaonHelpers__NS__parseJSONwithStringJSONs)((0, lib_prod_3.Mapping__NS__encode)(tQuery, entity));
|
|
1844
1844
|
}
|
|
1845
1845
|
catch (e) { }
|
|
1846
1846
|
}
|
|
1847
1847
|
else {
|
|
1848
1848
|
Object.keys(tQuery).forEach(queryParamName => {
|
|
1849
1849
|
try {
|
|
1850
|
-
const entityForParam = JSON.parse((0, taon_helpers_1.
|
|
1850
|
+
const entityForParam = JSON.parse((0, taon_helpers_1.TaonHelpers__NS__firstStringOrElemFromArray)(req.headers[`${symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS}${queryParamName} `]));
|
|
1851
1851
|
let beforeTransofrm = tQuery[queryParamName];
|
|
1852
1852
|
if (lib_prod_12._.isString(beforeTransofrm)) {
|
|
1853
1853
|
try {
|
|
1854
|
-
const paresed = (0, taon_helpers_1.
|
|
1854
|
+
const paresed = (0, taon_helpers_1.TaonHelpers__NS__tryTransformParam)(beforeTransofrm);
|
|
1855
1855
|
beforeTransofrm = paresed;
|
|
1856
1856
|
}
|
|
1857
1857
|
catch (e) { }
|
|
1858
1858
|
}
|
|
1859
|
-
const afterEncoding = (0, lib_prod_3.
|
|
1859
|
+
const afterEncoding = (0, lib_prod_3.Mapping__NS__encode)(beforeTransofrm, entityForParam);
|
|
1860
1860
|
tQuery[queryParamName] =
|
|
1861
|
-
(0, taon_helpers_1.
|
|
1861
|
+
(0, taon_helpers_1.TaonHelpers__NS__parseJSONwithStringJSONs)(afterEncoding);
|
|
1862
1862
|
}
|
|
1863
1863
|
catch (e) { }
|
|
1864
1864
|
});
|
|
@@ -1894,7 +1894,7 @@ class EndpointContext {
|
|
|
1894
1894
|
//#endregion
|
|
1895
1895
|
const resolvedParams = args
|
|
1896
1896
|
.reverse()
|
|
1897
|
-
.map(v => (0, taon_helpers_1.
|
|
1897
|
+
.map(v => (0, taon_helpers_1.TaonHelpers__NS__tryTransformParam)(v));
|
|
1898
1898
|
try {
|
|
1899
1899
|
let result = await getResult(resolvedParams, req, res);
|
|
1900
1900
|
if (methodConfig.responseType)
|
|
@@ -1999,7 +1999,7 @@ class EndpointContext {
|
|
|
1999
1999
|
message,
|
|
2000
2000
|
details,
|
|
2001
2001
|
code,
|
|
2002
|
-
[lib_prod_8.
|
|
2002
|
+
[lib_prod_8.CoreModels__NS__TaonHttpErrorCustomProp]: true,
|
|
2003
2003
|
});
|
|
2004
2004
|
//#endregion
|
|
2005
2005
|
}
|
|
@@ -2020,7 +2020,7 @@ class EndpointContext {
|
|
|
2020
2020
|
.map(f => this.getInstanceBy(f))
|
|
2021
2021
|
.filter(f => lib_prod_12._.isFunction(f.interceptClientMethod));
|
|
2022
2022
|
middlewaresInstances.forEach(instance => {
|
|
2023
|
-
const middlewareName = (0, class_helpers_1.
|
|
2023
|
+
const middlewareName = (0, class_helpers_1.ClassHelpers__NS__getName)(instance);
|
|
2024
2024
|
// middlewareName - only needed for inheritace and uniqness of interceptors
|
|
2025
2025
|
const interceptorKey = `${middlewareName}-${methodConfig.type?.toUpperCase()}-${expressPath}`;
|
|
2026
2026
|
lib_prod_3.Resource.request.methodsInterceptors.set(interceptorKey, {
|
|
@@ -2052,7 +2052,7 @@ class EndpointContext {
|
|
|
2052
2052
|
target.prototype[methodConfig.methodName] = function (...args) {
|
|
2053
2053
|
const received = new Promise(async (resolve, reject) => {
|
|
2054
2054
|
const headers = {};
|
|
2055
|
-
const { request, response } = (0, taon_helpers_1.
|
|
2055
|
+
const { request, response } = (0, taon_helpers_1.TaonHelpers__NS__websqlMocks)(headers);
|
|
2056
2056
|
/* */
|
|
2057
2057
|
/* */
|
|
2058
2058
|
/* */
|
|
@@ -2258,34 +2258,34 @@ class EndpointContext {
|
|
|
2258
2258
|
// console.log('[init method browser] FRONTEND expressPath', expressPath)
|
|
2259
2259
|
// const productionMode = FrameworkContext.isProductionMode;
|
|
2260
2260
|
//#region resolve frontend parameters
|
|
2261
|
-
if (!storage[symbols_1.
|
|
2262
|
-
storage[symbols_1.
|
|
2263
|
-
if (!storage[symbols_1.
|
|
2264
|
-
storage[symbols_1.
|
|
2265
|
-
const endpoints = storage[symbols_1.
|
|
2261
|
+
if (!storage[symbols_1.Symbols__NS__old.ENDPOINT_META_CONFIG])
|
|
2262
|
+
storage[symbols_1.Symbols__NS__old.ENDPOINT_META_CONFIG] = {};
|
|
2263
|
+
if (!storage[symbols_1.Symbols__NS__old.ENDPOINT_META_CONFIG][ctx.uriOrigin])
|
|
2264
|
+
storage[symbols_1.Symbols__NS__old.ENDPOINT_META_CONFIG][ctx.uriOrigin] = {};
|
|
2265
|
+
const endpoints = storage[symbols_1.Symbols__NS__old.ENDPOINT_META_CONFIG];
|
|
2266
2266
|
let rest;
|
|
2267
2267
|
if (!endpoints[ctx.uriOrigin][expressPath]) {
|
|
2268
2268
|
let headers = {};
|
|
2269
2269
|
if (methodConfig.contentType && !methodConfig.responseType) {
|
|
2270
|
-
rest = lib_prod_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.
|
|
2270
|
+
rest = lib_prod_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER, symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY, lib_prod_3.RestHeaders.from({
|
|
2271
2271
|
'Content-Type': methodConfig.contentType,
|
|
2272
2272
|
Accept: methodConfig.contentType,
|
|
2273
2273
|
}));
|
|
2274
2274
|
}
|
|
2275
2275
|
else if (methodConfig.contentType && methodConfig.responseType) {
|
|
2276
|
-
rest = lib_prod_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.
|
|
2276
|
+
rest = lib_prod_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER, symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY, lib_prod_3.RestHeaders.from({
|
|
2277
2277
|
'Content-Type': methodConfig.contentType,
|
|
2278
2278
|
Accept: methodConfig.contentType,
|
|
2279
2279
|
responsetypeaxios: methodConfig.responseType,
|
|
2280
2280
|
}));
|
|
2281
2281
|
}
|
|
2282
2282
|
else if (!methodConfig.contentType && methodConfig.responseType) {
|
|
2283
|
-
rest = lib_prod_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.
|
|
2283
|
+
rest = lib_prod_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER, symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY, lib_prod_3.RestHeaders.from({
|
|
2284
2284
|
responsetypeaxios: methodConfig.responseType,
|
|
2285
2285
|
}));
|
|
2286
2286
|
}
|
|
2287
2287
|
else {
|
|
2288
|
-
rest = lib_prod_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.
|
|
2288
|
+
rest = lib_prod_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER, symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY);
|
|
2289
2289
|
}
|
|
2290
2290
|
endpoints[ctx.uriOrigin][expressPath] = rest;
|
|
2291
2291
|
}
|
|
@@ -2319,23 +2319,23 @@ class EndpointContext {
|
|
|
2319
2319
|
}
|
|
2320
2320
|
if (currentParam.paramType === 'Query') {
|
|
2321
2321
|
if (currentParam.paramName) {
|
|
2322
|
-
const mapping = (0, lib_prod_3.
|
|
2322
|
+
const mapping = (0, lib_prod_3.Mapping__NS__decode)(param, !ctx.isProductionMode);
|
|
2323
2323
|
if (mapping) {
|
|
2324
|
-
rest.headers.set(`${symbols_1.
|
|
2324
|
+
rest.headers.set(`${symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
|
|
2325
2325
|
}
|
|
2326
2326
|
queryParams[currentParam.paramName] = param;
|
|
2327
2327
|
}
|
|
2328
2328
|
else {
|
|
2329
|
-
const mapping = (0, lib_prod_3.
|
|
2329
|
+
const mapping = (0, lib_prod_3.Mapping__NS__decode)(param, !ctx.isProductionMode);
|
|
2330
2330
|
if (mapping) {
|
|
2331
|
-
rest.headers.set(symbols_1.
|
|
2331
|
+
rest.headers.set(symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS, JSON.stringify(mapping));
|
|
2332
2332
|
}
|
|
2333
2333
|
queryParams = lib_prod_12._.cloneDeep(param);
|
|
2334
2334
|
}
|
|
2335
2335
|
}
|
|
2336
2336
|
if (currentParam.paramType === 'Header') {
|
|
2337
2337
|
if (currentParam.paramName) {
|
|
2338
|
-
if (currentParam.paramName === symbols_1.
|
|
2338
|
+
if (currentParam.paramName === symbols_1.Symbols__NS__old.MDC_KEY) {
|
|
2339
2339
|
// parese MDC
|
|
2340
2340
|
rest.headers.set(currentParam.paramName, encodeURIComponent(JSON.stringify(param)));
|
|
2341
2341
|
}
|
|
@@ -2354,7 +2354,7 @@ class EndpointContext {
|
|
|
2354
2354
|
}
|
|
2355
2355
|
if (currentParam.paramType === 'Body') {
|
|
2356
2356
|
if (currentParam.paramName) {
|
|
2357
|
-
if ((0, class_helpers_1.
|
|
2357
|
+
if ((0, class_helpers_1.ClassHelpers__NS__getName)(bodyObject) === 'FormData') {
|
|
2358
2358
|
throw new Error(`[taon - framework] Don use param names when posting / putting FormData.
|
|
2359
2359
|
Use this:
|
|
2360
2360
|
// ...
|
|
@@ -2367,35 +2367,35 @@ instead
|
|
|
2367
2367
|
// ...
|
|
2368
2368
|
`);
|
|
2369
2369
|
}
|
|
2370
|
-
const mapping = (0, lib_prod_3.
|
|
2370
|
+
const mapping = (0, lib_prod_3.Mapping__NS__decode)(param, !ctx.isProductionMode);
|
|
2371
2371
|
if (mapping) {
|
|
2372
|
-
rest.headers.set(`${symbols_1.
|
|
2372
|
+
rest.headers.set(`${symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
|
|
2373
2373
|
}
|
|
2374
2374
|
bodyObject[currentParam.paramName] = param;
|
|
2375
2375
|
}
|
|
2376
2376
|
else {
|
|
2377
|
-
const mapping = (0, lib_prod_3.
|
|
2377
|
+
const mapping = (0, lib_prod_3.Mapping__NS__decode)(param, !ctx.isProductionMode);
|
|
2378
2378
|
if (mapping) {
|
|
2379
|
-
rest.headers.set(symbols_1.
|
|
2379
|
+
rest.headers.set(symbols_1.Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS, JSON.stringify(mapping));
|
|
2380
2380
|
}
|
|
2381
2381
|
bodyObject = param;
|
|
2382
2382
|
}
|
|
2383
2383
|
}
|
|
2384
2384
|
});
|
|
2385
2385
|
if (typeof bodyObject === 'object' &&
|
|
2386
|
-
(0, class_helpers_1.
|
|
2386
|
+
(0, class_helpers_1.ClassHelpers__NS__getName)(bodyObject) !== 'FormData') {
|
|
2387
2387
|
let circuralFromItem = [];
|
|
2388
2388
|
bodyObject = lib_prod_1.JSON10.parse(lib_prod_1.JSON10.stringify(bodyObject, void 0, void 0, circs => {
|
|
2389
2389
|
circuralFromItem = circs;
|
|
2390
2390
|
}));
|
|
2391
|
-
rest.headers.set(symbols_1.
|
|
2391
|
+
rest.headers.set(symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY, lib_prod_1.JSON10.stringify(circuralFromItem));
|
|
2392
2392
|
}
|
|
2393
2393
|
if (typeof queryParams === 'object') {
|
|
2394
2394
|
let circuralFromQueryParams = [];
|
|
2395
2395
|
queryParams = lib_prod_1.JSON10.parse(lib_prod_1.JSON10.stringify(queryParams, void 0, void 0, circs => {
|
|
2396
2396
|
circuralFromQueryParams = circs;
|
|
2397
2397
|
}));
|
|
2398
|
-
rest.headers.set(symbols_1.
|
|
2398
|
+
rest.headers.set(symbols_1.Symbols__NS__old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM, lib_prod_1.JSON10.stringify(circuralFromQueryParams));
|
|
2399
2399
|
}
|
|
2400
2400
|
//#endregion
|
|
2401
2401
|
const httpResultObj = {
|