taon 19.0.53 → 19.0.54
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/fesm2022/taon.mjs +387 -222
- package/browser/fesm2022/taon.mjs.map +1 -1
- package/browser/lib/base-classes/base-controller.d.ts +11 -0
- package/browser/lib/base-classes/base-file-upload.middleware.d.ts +15 -0
- package/browser/lib/base-classes/base-middleware.d.ts +30 -8
- package/browser/lib/decorators/classes/controller-config.d.ts +10 -0
- package/browser/lib/decorators/classes/controller-decorator.d.ts +2 -12
- package/browser/lib/decorators/classes/controller-options.d.ts +12 -0
- package/browser/lib/decorators/classes/entity-decorator.d.ts +2 -2
- package/browser/lib/decorators/classes/middleware-decorator.d.ts +2 -2
- package/browser/lib/decorators/classes/migration-decorator.d.ts +2 -2
- package/browser/lib/decorators/classes/provider-decorator.d.ts +2 -2
- package/browser/lib/decorators/classes/repository-decorator.d.ts +2 -2
- package/browser/lib/decorators/classes/subscriber-decorator.d.ts +2 -2
- package/browser/lib/decorators/decorator-abstract-opt.d.ts +4 -0
- package/browser/lib/decorators/http/http-methods-decorators.d.ts +8 -5
- package/browser/lib/endpoint-context.d.ts +3 -2
- package/browser/lib/helpers/class-helpers.d.ts +7 -3
- package/browser/lib/helpers/taon-helpers.d.ts +2 -1
- package/browser/lib/index.d.ts +2 -1
- package/browser/lib/models.d.ts +15 -22
- package/browser/package.json +1 -1
- package/lib/base-classes/base-context.js +4 -0
- package/lib/base-classes/base-context.js.map +1 -1
- package/lib/base-classes/base-controller.d.ts +12 -0
- package/lib/base-classes/base-controller.js +56 -1
- package/lib/base-classes/base-controller.js.map +1 -1
- package/lib/base-classes/base-file-upload.middleware.d.ts +14 -0
- package/lib/base-classes/base-file-upload.middleware.js +85 -0
- package/lib/base-classes/base-file-upload.middleware.js.map +1 -0
- package/lib/base-classes/base-middleware.d.ts +30 -12
- package/lib/base-classes/base-middleware.js.map +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/decorators/classes/controller-config.d.ts +9 -0
- package/lib/decorators/classes/controller-config.js +11 -0
- package/lib/decorators/classes/controller-config.js.map +1 -0
- package/lib/decorators/classes/controller-decorator.d.ts +2 -12
- package/lib/decorators/classes/controller-decorator.js +0 -13
- package/lib/decorators/classes/controller-decorator.js.map +1 -1
- package/lib/decorators/classes/controller-options.d.ts +11 -0
- package/lib/decorators/classes/controller-options.js +16 -0
- package/lib/decorators/classes/controller-options.js.map +1 -0
- package/lib/decorators/classes/entity-decorator.d.ts +2 -2
- package/lib/decorators/classes/entity-decorator.js +7 -9
- package/lib/decorators/classes/entity-decorator.js.map +1 -1
- package/lib/decorators/classes/middleware-decorator.d.ts +2 -2
- package/lib/decorators/classes/middleware-decorator.js +2 -2
- package/lib/decorators/classes/middleware-decorator.js.map +1 -1
- package/lib/decorators/classes/migration-decorator.d.ts +2 -2
- package/lib/decorators/classes/migration-decorator.js +2 -2
- package/lib/decorators/classes/migration-decorator.js.map +1 -1
- package/lib/decorators/classes/provider-decorator.d.ts +2 -2
- package/lib/decorators/classes/provider-decorator.js +2 -2
- package/lib/decorators/classes/provider-decorator.js.map +1 -1
- package/lib/decorators/classes/repository-decorator.d.ts +2 -2
- package/lib/decorators/classes/repository-decorator.js +2 -2
- package/lib/decorators/classes/repository-decorator.js.map +1 -1
- package/lib/decorators/classes/subscriber-decorator.d.ts +2 -2
- package/lib/decorators/classes/subscriber-decorator.js +2 -2
- package/lib/decorators/classes/subscriber-decorator.js.map +1 -1
- package/lib/decorators/decorator-abstract-opt.d.ts +3 -0
- package/lib/decorators/decorator-abstract-opt.js +8 -0
- package/lib/decorators/decorator-abstract-opt.js.map +1 -0
- package/lib/decorators/http/http-methods-decorators.d.ts +8 -5
- package/lib/decorators/http/http-methods-decorators.js +3 -2
- package/lib/decorators/http/http-methods-decorators.js.map +1 -1
- package/lib/endpoint-context.d.ts +3 -2
- package/lib/endpoint-context.js +119 -71
- package/lib/endpoint-context.js.map +1 -1
- package/lib/helpers/class-helpers.d.ts +7 -3
- package/lib/helpers/class-helpers.js +12 -6
- package/lib/helpers/class-helpers.js.map +1 -1
- package/lib/helpers/taon-helpers.d.ts +2 -1
- package/lib/helpers/taon-helpers.js +1 -1
- package/lib/helpers/taon-helpers.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js.map +1 -1
- package/lib/models.d.ts +16 -24
- package/lib/models.js +4 -31
- package/lib/models.js.map +1 -1
- package/lib/ui/directives/index.d.ts +3 -0
- package/lib/ui/directives/index.js +5 -0
- package/lib/ui/directives/index.js.map +1 -0
- package/lib/ui/directives/safe.pipe.d.ts +7 -0
- package/lib/ui/directives/taon-inject-html.directive.d.ts +6 -0
- package/lib/ui/directives/taon-long-press.directive.d.ts +22 -0
- package/lib/ui/directives/view-mode.d.ts +5 -0
- package/lib/ui/directives/view-mode.js +10 -0
- package/lib/ui/directives/view-mode.js.map +1 -0
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +43 -0
- package/lib/ui/taon-admin-mode-configuration/taon-admin.models.d.ts +5 -0
- package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js +3 -0
- package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js.map +1 -0
- package/lib/ui/taon-full-material.module.d.ts +5 -0
- package/lib/ui/taon-github-fork-me-corner/index.d.ts +2 -0
- package/lib/ui/taon-github-fork-me-corner/index.js +5 -0
- package/lib/ui/taon-github-fork-me-corner/index.js.map +1 -0
- package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.component.d.ts +3 -0
- package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.module.d.ts +2 -0
- package/lib/ui/taon-github-fork-me-ribbon/index.d.ts +2 -0
- package/lib/ui/taon-github-fork-me-ribbon/index.js +5 -0
- package/lib/ui/taon-github-fork-me-ribbon/index.js.map +1 -0
- package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.component.d.ts +3 -0
- package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.module.d.ts +2 -0
- package/lib/ui/taon-notifications/index.d.ts +4 -0
- package/lib/ui/taon-notifications/index.js +24 -0
- package/lib/ui/taon-notifications/index.js.map +1 -0
- package/lib/ui/taon-notifications/taon-notifications.component.d.ts +9 -0
- package/lib/ui/taon-notifications/taon-notifications.models.d.ts +6 -0
- package/lib/ui/taon-notifications/taon-notifications.models.js +5 -0
- package/lib/ui/taon-notifications/taon-notifications.models.js.map +1 -0
- package/lib/ui/taon-notifications/taon-notifications.module.d.ts +2 -0
- package/lib/ui/taon-notifications/taon-notifications.service.d.ts +11 -0
- package/lib/ui/taon-progress-bar/index.d.ts +2 -0
- package/lib/ui/taon-progress-bar/index.js +5 -0
- package/lib/ui/taon-progress-bar/index.js.map +1 -0
- package/lib/ui/taon-progress-bar/taon-progress-bar.component.d.ts +13 -0
- package/lib/ui/taon-progress-bar/taon-progress-bar.module.d.ts +2 -0
- package/lib/ui/taon-session-passcode/index.d.ts +1 -0
- package/lib/ui/taon-session-passcode/index.js +5 -0
- package/lib/ui/taon-session-passcode/index.js.map +1 -0
- package/lib/ui/taon-session-passcode/taon-session-passcode.component.d.ts +35 -0
- package/lib/ui/taon-table/index.d.ts +2 -0
- package/lib/ui/taon-table/index.js +5 -0
- package/lib/ui/taon-table/index.js.map +1 -0
- package/lib/ui/taon-table/taon-table.component.d.ts +34 -0
- package/lib/ui/taon-table/taon-table.module.d.ts +2 -0
- package/lib/ui/taon.models.d.ts +11 -0
- package/lib/ui/taon.models.js +3 -0
- package/lib/ui/taon.models.js.map +1 -0
- package/package.json +1 -1
- package/tmp-environment.json +39 -0
- package/websql/fesm2022/taon.mjs +384 -217
- package/websql/fesm2022/taon.mjs.map +1 -1
- package/websql/lib/base-classes/base-controller.d.ts +11 -0
- package/websql/lib/base-classes/base-file-upload.middleware.d.ts +15 -0
- package/websql/lib/base-classes/base-middleware.d.ts +30 -12
- package/websql/lib/decorators/classes/controller-config.d.ts +10 -0
- package/websql/lib/decorators/classes/controller-decorator.d.ts +2 -12
- package/websql/lib/decorators/classes/controller-options.d.ts +12 -0
- package/websql/lib/decorators/classes/entity-decorator.d.ts +2 -2
- package/websql/lib/decorators/classes/middleware-decorator.d.ts +2 -2
- package/websql/lib/decorators/classes/migration-decorator.d.ts +2 -2
- package/websql/lib/decorators/classes/provider-decorator.d.ts +2 -2
- package/websql/lib/decorators/classes/repository-decorator.d.ts +2 -2
- package/websql/lib/decorators/classes/subscriber-decorator.d.ts +2 -2
- package/websql/lib/decorators/decorator-abstract-opt.d.ts +4 -0
- package/websql/lib/decorators/http/http-methods-decorators.d.ts +8 -5
- package/websql/lib/endpoint-context.d.ts +3 -2
- package/websql/lib/helpers/class-helpers.d.ts +7 -3
- package/websql/lib/helpers/taon-helpers.d.ts +2 -1
- package/websql/lib/index.d.ts +2 -1
- package/websql/lib/models.d.ts +16 -24
- package/websql/package.json +1 -1
package/websql/fesm2022/taon.mjs
CHANGED
|
@@ -6,11 +6,11 @@ import * as tsorm from 'taon-typeorm/websql';
|
|
|
6
6
|
import { OrignalClassKey, Entity, Table, TableIndex, EventSubscriber, DataSource } from 'taon-typeorm/websql';
|
|
7
7
|
import { walk } from 'lodash-walk-object/websql';
|
|
8
8
|
import { SYMBOL, CLASS } from 'typescript-class-helpers/websql';
|
|
9
|
-
import { Models as Models$1, Resource, RestHeaders, Mapping } from 'ng2-rest/websql';
|
|
10
9
|
import * as i0 from '@angular/core';
|
|
11
10
|
import { InjectionToken, inject as inject$1, Injectable } from '@angular/core';
|
|
12
11
|
import axios from 'axios';
|
|
13
12
|
import { JSON10 } from 'json10/websql';
|
|
13
|
+
import { Models as Models$1, Resource, RestHeaders, Mapping } from 'ng2-rest/websql';
|
|
14
14
|
import { Observable, Subject, from } from 'rxjs';
|
|
15
15
|
import * as JSON5 from 'json5';
|
|
16
16
|
import { io } from 'socket.io-client';
|
|
@@ -122,6 +122,19 @@ var Orm;
|
|
|
122
122
|
})(Orm || (Orm = {}));
|
|
123
123
|
//#endregion
|
|
124
124
|
|
|
125
|
+
class DecoratorAbstractOpt {
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
class TaonControllerOptions extends DecoratorAbstractOpt {
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
class ControllerConfig extends TaonControllerOptions {
|
|
132
|
+
constructor() {
|
|
133
|
+
super(...arguments);
|
|
134
|
+
this.methods = {};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
125
138
|
var Symbols;
|
|
126
139
|
(function (Symbols) {
|
|
127
140
|
Symbols.ctxInClassOrClassObj = Symbol();
|
|
@@ -312,122 +325,9 @@ var Validators;
|
|
|
312
325
|
};
|
|
313
326
|
})(Validators || (Validators = {}));
|
|
314
327
|
|
|
315
|
-
|
|
316
|
-
(function (Models) {
|
|
317
|
-
//#region models / class types
|
|
318
|
-
let ClassType;
|
|
319
|
-
(function (ClassType) {
|
|
320
|
-
ClassType["ENTITY"] = "ENTITY";
|
|
321
|
-
ClassType["CONTROLLER"] = "CONTROLLER";
|
|
322
|
-
ClassType["REPOSITORY"] = "REPOSITORY";
|
|
323
|
-
ClassType["PROVIDER"] = "PROVIDER";
|
|
324
|
-
ClassType["SUBSCRIBER"] = "SUBSCRIBER";
|
|
325
|
-
ClassType["MIGRATION"] = "MIGRATION";
|
|
326
|
-
ClassType["MIDDLEWARE"] = "MIDDLEWARE";
|
|
327
|
-
})(ClassType = Models.ClassType || (Models.ClassType = {}));
|
|
328
|
-
Models.ClassTypeKey = {
|
|
329
|
-
[ClassType.ENTITY]: 'entities',
|
|
330
|
-
[ClassType.CONTROLLER]: 'controllers',
|
|
331
|
-
[ClassType.REPOSITORY]: 'repositories',
|
|
332
|
-
[ClassType.PROVIDER]: 'providers',
|
|
333
|
-
[ClassType.SUBSCRIBER]: 'subscribers',
|
|
334
|
-
[ClassType.MIGRATION]: 'migrations',
|
|
335
|
-
[ClassType.MIDDLEWARE]: 'middlewares',
|
|
336
|
-
};
|
|
337
|
-
//#endregion
|
|
338
|
-
//#region models / database connection options
|
|
339
|
-
class DatabaseConfigTypeOrm {
|
|
340
|
-
}
|
|
341
|
-
Models.DatabaseConfigTypeOrm = DatabaseConfigTypeOrm;
|
|
342
|
-
//#endregion
|
|
343
|
-
//#region models / database config
|
|
344
|
-
class DatabaseConfig extends DatabaseConfigTypeOrm {
|
|
345
|
-
static from(databasePartialConfig) {
|
|
346
|
-
return _.merge(new DatabaseConfig(), databasePartialConfig);
|
|
347
|
-
}
|
|
348
|
-
get databaseConfigTypeORM() {
|
|
349
|
-
//#region @websqlFunc
|
|
350
|
-
const result = _.cloneDeep(this);
|
|
351
|
-
if (result.recreateMode) {
|
|
352
|
-
if (result.recreateMode === 'DROP_DB+MIGRATIONS') {
|
|
353
|
-
result.synchronize = true;
|
|
354
|
-
result.dropSchema = true;
|
|
355
|
-
}
|
|
356
|
-
else if (result.recreateMode === 'PRESERVE_DATA+MIGRATIONS') {
|
|
357
|
-
result.synchronize = false;
|
|
358
|
-
result.dropSchema = false;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
delete result.recreateMode;
|
|
362
|
-
return result;
|
|
363
|
-
//#endregion
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
Models.DatabaseConfig = DatabaseConfig;
|
|
367
|
-
//#endregion
|
|
368
|
-
//#region models / decorator abstract options
|
|
369
|
-
class DecoratorAbstractOpt {
|
|
370
|
-
}
|
|
371
|
-
Models.DecoratorAbstractOpt = DecoratorAbstractOpt;
|
|
372
|
-
//#endregion
|
|
373
|
-
//#region models / param config
|
|
374
|
-
class ParamConfig {
|
|
375
|
-
}
|
|
376
|
-
Models.ParamConfig = ParamConfig;
|
|
377
|
-
//#endregion
|
|
378
|
-
//#region models / method config
|
|
379
|
-
class MethodConfig {
|
|
380
|
-
constructor() {
|
|
381
|
-
//#endregion
|
|
382
|
-
this.parameters = {};
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
Models.MethodConfig = MethodConfig;
|
|
386
|
-
//#endregion
|
|
387
|
-
//#region models / controller config
|
|
388
|
-
class ControllerConfig extends DecoratorAbstractOpt {
|
|
389
|
-
constructor() {
|
|
390
|
-
super(...arguments);
|
|
391
|
-
this.methods = {};
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
Models.ControllerConfig = ControllerConfig;
|
|
395
|
-
//#endregion
|
|
396
|
-
//#region models / runtime controller config
|
|
397
|
-
class RuntimeControllerConfig extends ControllerConfig {
|
|
398
|
-
}
|
|
399
|
-
Models.RuntimeControllerConfig = RuntimeControllerConfig;
|
|
400
|
-
//#endregion
|
|
401
|
-
//#region models / http
|
|
402
|
-
let Http;
|
|
403
|
-
(function (Http) {
|
|
404
|
-
Http.Rest = Models$1;
|
|
405
|
-
class Errors {
|
|
406
|
-
constructor(message, code = 400) {
|
|
407
|
-
this.message = message;
|
|
408
|
-
this.code = code;
|
|
409
|
-
this.toString = () => {
|
|
410
|
-
return this.message;
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
static create(message, code = 400) {
|
|
414
|
-
return new Errors(message, code);
|
|
415
|
-
}
|
|
416
|
-
static entityNotFound(entity) {
|
|
417
|
-
return Errors.create(`Entity ${ClassHelpers.getName(entity)} not found`);
|
|
418
|
-
}
|
|
419
|
-
static custom(message, code = 400) {
|
|
420
|
-
return Errors.create(message, code);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
Http.Errors = Errors;
|
|
424
|
-
//#endregion
|
|
425
|
-
})(Http = Models.Http || (Models.Http = {}));
|
|
426
|
-
//#endregion
|
|
427
|
-
})(Models || (Models = {}));
|
|
428
|
-
|
|
429
|
-
/* */
|
|
328
|
+
//#region imports
|
|
430
329
|
/* */
|
|
330
|
+
//#endregion
|
|
431
331
|
var ClassHelpers;
|
|
432
332
|
(function (ClassHelpers) {
|
|
433
333
|
//#region get class from name
|
|
@@ -532,7 +432,7 @@ var ClassHelpers;
|
|
|
532
432
|
//#region get all metadata for controller
|
|
533
433
|
ClassHelpers.getControllerConfig = (target) => {
|
|
534
434
|
const classMetadataOptions = Reflect.getMetadata(Symbols.metadata.options.controller, target);
|
|
535
|
-
const classMetadata = _.merge(new
|
|
435
|
+
const classMetadata = _.merge(new ControllerConfig(), classMetadataOptions);
|
|
536
436
|
// Iterate over all methods of the class
|
|
537
437
|
const methodNames = ClassHelpers.getMethodsNames(target); // Object.getOwnPropertyNames(target.prototype);
|
|
538
438
|
// console.log(`methodNames for ${ClassHelpers.getName(target)} `, methodNames)
|
|
@@ -570,6 +470,12 @@ var ClassHelpers;
|
|
|
570
470
|
'toLocaleString',
|
|
571
471
|
];
|
|
572
472
|
//#endregion
|
|
473
|
+
/**
|
|
474
|
+
* Express async handler for middleware functions.
|
|
475
|
+
*/
|
|
476
|
+
ClassHelpers.asyncHandler = fn => (req, res, next) => {
|
|
477
|
+
Promise.resolve(fn(req, res, next)).catch(next);
|
|
478
|
+
};
|
|
573
479
|
ClassHelpers.getMethodsNames = (classOrClassInstance, allMethodsNames = []) => {
|
|
574
480
|
if (!classOrClassInstance) {
|
|
575
481
|
return Utils.uniqArray(allMethodsNames);
|
|
@@ -861,6 +767,103 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
861
767
|
type: Injectable
|
|
862
768
|
}], ctorParameters: () => [] });
|
|
863
769
|
|
|
770
|
+
var Models;
|
|
771
|
+
(function (Models) {
|
|
772
|
+
//#region models / class types
|
|
773
|
+
let ClassType;
|
|
774
|
+
(function (ClassType) {
|
|
775
|
+
ClassType["ENTITY"] = "ENTITY";
|
|
776
|
+
ClassType["CONTROLLER"] = "CONTROLLER";
|
|
777
|
+
ClassType["REPOSITORY"] = "REPOSITORY";
|
|
778
|
+
ClassType["PROVIDER"] = "PROVIDER";
|
|
779
|
+
ClassType["SUBSCRIBER"] = "SUBSCRIBER";
|
|
780
|
+
ClassType["MIGRATION"] = "MIGRATION";
|
|
781
|
+
ClassType["MIDDLEWARE"] = "MIDDLEWARE";
|
|
782
|
+
})(ClassType = Models.ClassType || (Models.ClassType = {}));
|
|
783
|
+
Models.ClassTypeKey = {
|
|
784
|
+
[ClassType.ENTITY]: 'entities',
|
|
785
|
+
[ClassType.CONTROLLER]: 'controllers',
|
|
786
|
+
[ClassType.REPOSITORY]: 'repositories',
|
|
787
|
+
[ClassType.PROVIDER]: 'providers',
|
|
788
|
+
[ClassType.SUBSCRIBER]: 'subscribers',
|
|
789
|
+
[ClassType.MIGRATION]: 'migrations',
|
|
790
|
+
[ClassType.MIDDLEWARE]: 'middlewares',
|
|
791
|
+
};
|
|
792
|
+
//#endregion
|
|
793
|
+
//#region models / database connection options
|
|
794
|
+
class DatabaseConfigTypeOrm {
|
|
795
|
+
}
|
|
796
|
+
Models.DatabaseConfigTypeOrm = DatabaseConfigTypeOrm;
|
|
797
|
+
//#endregion
|
|
798
|
+
//#region models / database config
|
|
799
|
+
class DatabaseConfig extends DatabaseConfigTypeOrm {
|
|
800
|
+
static from(databasePartialConfig) {
|
|
801
|
+
return _.merge(new DatabaseConfig(), databasePartialConfig);
|
|
802
|
+
}
|
|
803
|
+
get databaseConfigTypeORM() {
|
|
804
|
+
//#region @websqlFunc
|
|
805
|
+
const result = _.cloneDeep(this);
|
|
806
|
+
if (result.recreateMode) {
|
|
807
|
+
if (result.recreateMode === 'DROP_DB+MIGRATIONS') {
|
|
808
|
+
result.synchronize = true;
|
|
809
|
+
result.dropSchema = true;
|
|
810
|
+
}
|
|
811
|
+
else if (result.recreateMode === 'PRESERVE_DATA+MIGRATIONS') {
|
|
812
|
+
result.synchronize = false;
|
|
813
|
+
result.dropSchema = false;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
delete result.recreateMode;
|
|
817
|
+
return result;
|
|
818
|
+
//#endregion
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
Models.DatabaseConfig = DatabaseConfig;
|
|
822
|
+
//#endregion
|
|
823
|
+
//#region models / param config
|
|
824
|
+
class ParamConfig {
|
|
825
|
+
}
|
|
826
|
+
Models.ParamConfig = ParamConfig;
|
|
827
|
+
//#endregion
|
|
828
|
+
//#region models / method config
|
|
829
|
+
/**
|
|
830
|
+
* @link './decorators/http/http-methods-decorators.ts' TaonHttpDecoratorOptions
|
|
831
|
+
*/
|
|
832
|
+
class MethodConfig {
|
|
833
|
+
constructor() {
|
|
834
|
+
this.parameters = {};
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
Models.MethodConfig = MethodConfig;
|
|
838
|
+
//#endregion
|
|
839
|
+
//#region models / http
|
|
840
|
+
let Http;
|
|
841
|
+
(function (Http) {
|
|
842
|
+
Http.Rest = Models$1;
|
|
843
|
+
class Errors {
|
|
844
|
+
constructor(message, code = 400) {
|
|
845
|
+
this.message = message;
|
|
846
|
+
this.code = code;
|
|
847
|
+
this.toString = () => {
|
|
848
|
+
return this.message;
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
static create(message, code = 400) {
|
|
852
|
+
return new Errors(message, code);
|
|
853
|
+
}
|
|
854
|
+
static entityNotFound(entity) {
|
|
855
|
+
return Errors.create(`Entity ${ClassHelpers.getName(entity)} not found`);
|
|
856
|
+
}
|
|
857
|
+
static custom(message, code = 400) {
|
|
858
|
+
return Errors.create(message, code);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
Http.Errors = Errors;
|
|
862
|
+
//#endregion
|
|
863
|
+
})(Http = Models.Http || (Models.Http = {}));
|
|
864
|
+
//#endregion
|
|
865
|
+
})(Models || (Models = {}));
|
|
866
|
+
|
|
864
867
|
//#region imports
|
|
865
868
|
class ContextDbMigrations {
|
|
866
869
|
//#endregion
|
|
@@ -3074,7 +3077,8 @@ class EndpointContext {
|
|
|
3074
3077
|
/* */
|
|
3075
3078
|
/* */
|
|
3076
3079
|
/* */
|
|
3077
|
-
|
|
3080
|
+
/* */
|
|
3081
|
+
await this.initCustomClientMiddlewares();
|
|
3078
3082
|
}
|
|
3079
3083
|
//#endregion
|
|
3080
3084
|
//#region prepare realtime
|
|
@@ -3285,7 +3289,6 @@ class EndpointContext {
|
|
|
3285
3289
|
/* */
|
|
3286
3290
|
/* */
|
|
3287
3291
|
/* */
|
|
3288
|
-
/* */
|
|
3289
3292
|
return (void 0);
|
|
3290
3293
|
}
|
|
3291
3294
|
//#endregion
|
|
@@ -3655,6 +3658,9 @@ class EndpointContext {
|
|
|
3655
3658
|
return this.config.contextName;
|
|
3656
3659
|
}
|
|
3657
3660
|
//#endregion
|
|
3661
|
+
get cwd() {
|
|
3662
|
+
return this.config.cwd || process.cwd();
|
|
3663
|
+
}
|
|
3658
3664
|
get activeContext() {
|
|
3659
3665
|
return this.config.activeContext || null;
|
|
3660
3666
|
}
|
|
@@ -3858,6 +3864,7 @@ class EndpointContext {
|
|
|
3858
3864
|
const configs = ClassHelpers.getControllerConfigs(controllerClassFn);
|
|
3859
3865
|
// console.log(`Class config for ${ClassHelpers.getName(controllerClassFn)}`, configs)
|
|
3860
3866
|
const classConfig = configs[0];
|
|
3867
|
+
//#region update class calculate path
|
|
3861
3868
|
const parentscalculatedPath = _.slice(configs, 1)
|
|
3862
3869
|
.reverse()
|
|
3863
3870
|
.map(bc => {
|
|
@@ -3881,6 +3888,7 @@ class EndpointContext {
|
|
|
3881
3888
|
}, [])
|
|
3882
3889
|
.join('/');
|
|
3883
3890
|
}
|
|
3891
|
+
//#endregion
|
|
3884
3892
|
// console.log('calculatedPath', classConfig.calculatedPath);
|
|
3885
3893
|
_.slice(configs, 1).forEach(bc => {
|
|
3886
3894
|
const alreadyIs = classConfig.methods;
|
|
@@ -3989,44 +3997,29 @@ class EndpointContext {
|
|
|
3989
3997
|
}
|
|
3990
3998
|
//#endregion
|
|
3991
3999
|
//#region methods & getters / init middlewares
|
|
3992
|
-
async
|
|
3993
|
-
const middlewares = this.getClassesInstancesArrBy(Models.ClassType.MIDDLEWARE)
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
});
|
|
4014
|
-
})(middlewareInstance, this.contextName, apiPrefix, this.uriPathnameOrNothingIfRoot);
|
|
4015
|
-
}
|
|
4016
|
-
}
|
|
4000
|
+
async initCustomClientMiddlewares() {
|
|
4001
|
+
const middlewares = this.getClassesInstancesArrBy(Models.ClassType.MIDDLEWARE)
|
|
4002
|
+
.map(f => f)
|
|
4003
|
+
.filter(f => _.isFunction(f.interceptClient));
|
|
4004
|
+
middlewares.forEach(instance => {
|
|
4005
|
+
const contextName = this.contextName;
|
|
4006
|
+
const interceptorName = `${contextName}-${ClassHelpers.getName(instance)}`;
|
|
4007
|
+
Resource.request.interceptors.set(interceptorName, {
|
|
4008
|
+
intercept: ({ req, next }) => {
|
|
4009
|
+
const url = new URL(req.url);
|
|
4010
|
+
if (url.pathname.startsWith(`${this.uriPathnameOrNothingIfRoot}/${apiPrefix}/${contextName}/`)) {
|
|
4011
|
+
// console.log('intercepting', url.pathname, req);
|
|
4012
|
+
return instance.interceptClient({
|
|
4013
|
+
req,
|
|
4014
|
+
next,
|
|
4015
|
+
});
|
|
4016
|
+
}
|
|
4017
|
+
return next.handle(req);
|
|
4018
|
+
},
|
|
4019
|
+
});
|
|
4020
|
+
});
|
|
4017
4021
|
}
|
|
4018
|
-
async
|
|
4019
|
-
/* */
|
|
4020
|
-
/* */
|
|
4021
|
-
/* */
|
|
4022
|
-
/* */
|
|
4023
|
-
/* */
|
|
4024
|
-
/* */
|
|
4025
|
-
/* */
|
|
4026
|
-
/* */
|
|
4027
|
-
/* */
|
|
4028
|
-
/* */
|
|
4029
|
-
/* */
|
|
4022
|
+
async initCustomBackendMiddlewares() {
|
|
4030
4023
|
/* */
|
|
4031
4024
|
/* */
|
|
4032
4025
|
/* */
|
|
@@ -4061,6 +4054,8 @@ class EndpointContext {
|
|
|
4061
4054
|
/* */
|
|
4062
4055
|
/* */
|
|
4063
4056
|
/* */
|
|
4057
|
+
}
|
|
4058
|
+
async initBackendMiddlewares() {
|
|
4064
4059
|
/* */
|
|
4065
4060
|
/* */
|
|
4066
4061
|
/* */
|
|
@@ -4170,16 +4165,31 @@ class EndpointContext {
|
|
|
4170
4165
|
//#region methods & getters / init methods node
|
|
4171
4166
|
initServer(
|
|
4172
4167
|
//#region parameters
|
|
4173
|
-
|
|
4168
|
+
httpMethodType, methodConfig, classConfig, expressPath, target) {
|
|
4174
4169
|
//#region resolve variables
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4170
|
+
const middlewareHandlers = (Array.isArray(methodConfig.middlewares) &&
|
|
4171
|
+
methodConfig.middlewares?.length > 0
|
|
4172
|
+
? methodConfig.middlewares
|
|
4173
|
+
: [])
|
|
4174
|
+
.map(middlewareClassFun => {
|
|
4175
|
+
const middlewareInstance = this.getInstanceBy(middlewareClassFun);
|
|
4176
|
+
if (middlewareInstance &&
|
|
4177
|
+
_.isFunction(middlewareInstance.interceptServerMethod)) {
|
|
4178
|
+
const middlewareFn = ClassHelpers.asyncHandler(async (req, res, next) => {
|
|
4179
|
+
await middlewareInstance.interceptServerMethod({
|
|
4180
|
+
req,
|
|
4181
|
+
res,
|
|
4182
|
+
next,
|
|
4183
|
+
}, {
|
|
4184
|
+
methodName: methodConfig.methodName,
|
|
4185
|
+
expressPath,
|
|
4186
|
+
httpRequestType: methodConfig.type,
|
|
4187
|
+
});
|
|
4188
|
+
});
|
|
4189
|
+
return middlewareFn;
|
|
4190
|
+
}
|
|
4191
|
+
})
|
|
4192
|
+
.filter(f => !!f);
|
|
4183
4193
|
// const url = this.uri;
|
|
4184
4194
|
//#region get result
|
|
4185
4195
|
const getResult = async (resolvedParams, req, res) => {
|
|
@@ -4189,7 +4199,7 @@ class EndpointContext {
|
|
|
4189
4199
|
*/
|
|
4190
4200
|
this.getInstanceBy(target),
|
|
4191
4201
|
/**
|
|
4192
|
-
* Params for
|
|
4202
|
+
* Params for method @GET, @PUT etc.
|
|
4193
4203
|
*/
|
|
4194
4204
|
resolvedParams);
|
|
4195
4205
|
let result = await getResponseValue(response, { req, res });
|
|
@@ -4228,8 +4238,9 @@ class EndpointContext {
|
|
|
4228
4238
|
//#region apply dummy websql express routers
|
|
4229
4239
|
//#region @websql
|
|
4230
4240
|
if (Helpers.isWebSQL) {
|
|
4231
|
-
if (!this.expressApp[
|
|
4232
|
-
this.expressApp[
|
|
4241
|
+
if (!this.expressApp[httpMethodType.toLowerCase()]) {
|
|
4242
|
+
this.expressApp[httpMethodType.toLowerCase()] = () => { };
|
|
4243
|
+
// TODO add middlewares for WEBSQL and ELECTRON mode
|
|
4233
4244
|
}
|
|
4234
4245
|
}
|
|
4235
4246
|
//#endregion
|
|
@@ -4448,6 +4459,7 @@ class EndpointContext {
|
|
|
4448
4459
|
/* */
|
|
4449
4460
|
/* */
|
|
4450
4461
|
/* */
|
|
4462
|
+
/* */
|
|
4451
4463
|
}
|
|
4452
4464
|
return {
|
|
4453
4465
|
expressPath: expressPath,
|
|
@@ -4461,10 +4473,31 @@ class EndpointContext {
|
|
|
4461
4473
|
*/
|
|
4462
4474
|
async initClient(
|
|
4463
4475
|
//#region parameters
|
|
4464
|
-
target,
|
|
4476
|
+
target, httpRequestType, methodConfig, // Models.Http.Rest.MethodConfig,
|
|
4477
|
+
expressPath) {
|
|
4465
4478
|
const ctx = this;
|
|
4479
|
+
//#region init middlewares
|
|
4480
|
+
const middlewares = methodConfig.middlewares
|
|
4481
|
+
.map(f => this.getInstanceBy(f))
|
|
4482
|
+
.filter(f => _.isFunction(f.interceptClientMethod));
|
|
4483
|
+
middlewares.forEach(instance => {
|
|
4484
|
+
Resource.request.methodsInterceptors.set(`${methodConfig.type?.toUpperCase()}-${expressPath}`, {
|
|
4485
|
+
intercept: ({ req, next }) => {
|
|
4486
|
+
return instance.interceptClientMethod({
|
|
4487
|
+
req,
|
|
4488
|
+
next,
|
|
4489
|
+
}, {
|
|
4490
|
+
methodName: methodConfig.methodName,
|
|
4491
|
+
expressPath,
|
|
4492
|
+
httpRequestType: httpRequestType,
|
|
4493
|
+
});
|
|
4494
|
+
},
|
|
4495
|
+
});
|
|
4496
|
+
});
|
|
4497
|
+
//#endregion
|
|
4466
4498
|
// : { received: any; /* Rest<any, any> */ }
|
|
4467
|
-
this.logHttp &&
|
|
4499
|
+
this.logHttp &&
|
|
4500
|
+
console.log(`${httpRequestType?.toUpperCase()} ${expressPath} `);
|
|
4468
4501
|
// console.log('INITING', methodConfig); // TODO inject in static
|
|
4469
4502
|
//#region resolve storage
|
|
4470
4503
|
// TODO not a good idea
|
|
@@ -4506,6 +4539,9 @@ class EndpointContext {
|
|
|
4506
4539
|
received['observable'] = from(received);
|
|
4507
4540
|
return {
|
|
4508
4541
|
received,
|
|
4542
|
+
request(axiosConfig) {
|
|
4543
|
+
return received;
|
|
4544
|
+
},
|
|
4509
4545
|
};
|
|
4510
4546
|
};
|
|
4511
4547
|
return;
|
|
@@ -4626,11 +4662,16 @@ class EndpointContext {
|
|
|
4626
4662
|
if (Helpers.isWebSQL) {
|
|
4627
4663
|
return {
|
|
4628
4664
|
received,
|
|
4665
|
+
request(axiosConfig) {
|
|
4666
|
+
// console.log('request', axiosConfgi);
|
|
4667
|
+
return received;
|
|
4668
|
+
},
|
|
4629
4669
|
};
|
|
4630
4670
|
}
|
|
4631
4671
|
};
|
|
4632
4672
|
if (Helpers.isWebSQL) {
|
|
4633
|
-
|
|
4673
|
+
// @ts-ignore
|
|
4674
|
+
return undefined;
|
|
4634
4675
|
}
|
|
4635
4676
|
//#endregion
|
|
4636
4677
|
//#endregion
|
|
@@ -4673,8 +4714,7 @@ class EndpointContext {
|
|
|
4673
4714
|
else {
|
|
4674
4715
|
rest = endpoints[ctx.uriOrigin][expressPath];
|
|
4675
4716
|
}
|
|
4676
|
-
const method =
|
|
4677
|
-
const isWithBody = method === 'put' || method === 'post';
|
|
4717
|
+
const method = httpRequestType.toLowerCase();
|
|
4678
4718
|
const pathPrams = {};
|
|
4679
4719
|
let queryParams = {};
|
|
4680
4720
|
let bodyObject = {};
|
|
@@ -4772,9 +4812,11 @@ instead
|
|
|
4772
4812
|
}
|
|
4773
4813
|
//#endregion
|
|
4774
4814
|
const httpResultObj = {
|
|
4775
|
-
received:
|
|
4776
|
-
|
|
4777
|
-
|
|
4815
|
+
received: rest.model(pathPrams)[method](bodyObject, [queryParams]),
|
|
4816
|
+
request(axiosConfig) {
|
|
4817
|
+
return rest
|
|
4818
|
+
.model(pathPrams)[method](bodyObject, [queryParams], axiosConfig);
|
|
4819
|
+
},
|
|
4778
4820
|
};
|
|
4779
4821
|
return httpResultObj;
|
|
4780
4822
|
};
|
|
@@ -5002,16 +5044,16 @@ const createContext = (configFn) => {
|
|
|
5002
5044
|
};
|
|
5003
5045
|
|
|
5004
5046
|
/**
|
|
5005
|
-
*
|
|
5047
|
+
* Provider decorator
|
|
5006
5048
|
*/
|
|
5007
|
-
function
|
|
5049
|
+
function TaonMiddleware(options) {
|
|
5008
5050
|
return function (constructor) {
|
|
5009
|
-
Reflect.defineMetadata(Symbols.metadata.options.
|
|
5051
|
+
Reflect.defineMetadata(Symbols.metadata.options.provider, options, constructor);
|
|
5010
5052
|
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
5011
|
-
ClassHelpers.setName(constructor, options?.className);
|
|
5053
|
+
ClassHelpers.setName(constructor, options?.className || constructor.name);
|
|
5012
5054
|
};
|
|
5013
5055
|
}
|
|
5014
|
-
class
|
|
5056
|
+
class TaonMiddlewareOptions extends DecoratorAbstractOpt {
|
|
5015
5057
|
}
|
|
5016
5058
|
|
|
5017
5059
|
//#endregion
|
|
@@ -5198,6 +5240,95 @@ class BaseInjector {
|
|
|
5198
5240
|
}
|
|
5199
5241
|
}
|
|
5200
5242
|
|
|
5243
|
+
/**
|
|
5244
|
+
* TODO
|
|
5245
|
+
* - global provider available in all contexts
|
|
5246
|
+
* - provider available in own context
|
|
5247
|
+
*/
|
|
5248
|
+
class BaseMiddleware extends BaseInjector {
|
|
5249
|
+
}
|
|
5250
|
+
|
|
5251
|
+
//#endregion
|
|
5252
|
+
/**
|
|
5253
|
+
* Configurable file upload middleware (multer based)
|
|
5254
|
+
*/
|
|
5255
|
+
let BaseFileUploadMiddleware = class BaseFileUploadMiddleware extends BaseMiddleware {
|
|
5256
|
+
async interceptServerMethod({ req, res, next }, { methodName, expressPath }) {
|
|
5257
|
+
return this.middleware()(req, res, next);
|
|
5258
|
+
}
|
|
5259
|
+
//#region upload Dir
|
|
5260
|
+
uploadDir() {
|
|
5261
|
+
return crossPlatformPath([this.ctx.cwd, 'uploaded-files']);
|
|
5262
|
+
}
|
|
5263
|
+
//#endregion
|
|
5264
|
+
//#region storage
|
|
5265
|
+
storage() {
|
|
5266
|
+
/* */
|
|
5267
|
+
/* */
|
|
5268
|
+
/* */
|
|
5269
|
+
/* */
|
|
5270
|
+
/* */
|
|
5271
|
+
/* */
|
|
5272
|
+
/* */
|
|
5273
|
+
/* */
|
|
5274
|
+
/* */
|
|
5275
|
+
/* */
|
|
5276
|
+
/* */
|
|
5277
|
+
/* */
|
|
5278
|
+
/* */
|
|
5279
|
+
/* */
|
|
5280
|
+
/* */
|
|
5281
|
+
/* */
|
|
5282
|
+
/* */
|
|
5283
|
+
/* */
|
|
5284
|
+
/* */
|
|
5285
|
+
return (void 0);
|
|
5286
|
+
}
|
|
5287
|
+
//#endregion
|
|
5288
|
+
//#region upload
|
|
5289
|
+
upload() {
|
|
5290
|
+
/* */
|
|
5291
|
+
/* */
|
|
5292
|
+
/* */
|
|
5293
|
+
/* */
|
|
5294
|
+
/* */
|
|
5295
|
+
/* */
|
|
5296
|
+
/* */
|
|
5297
|
+
/* */
|
|
5298
|
+
/* */
|
|
5299
|
+
/* */
|
|
5300
|
+
/* */
|
|
5301
|
+
/* */
|
|
5302
|
+
/* */
|
|
5303
|
+
return (void 0);
|
|
5304
|
+
}
|
|
5305
|
+
//#endregion
|
|
5306
|
+
//#region middleware
|
|
5307
|
+
middleware() {
|
|
5308
|
+
/* */
|
|
5309
|
+
/* */
|
|
5310
|
+
return (void 0);
|
|
5311
|
+
}
|
|
5312
|
+
};
|
|
5313
|
+
BaseFileUploadMiddleware = __decorate([
|
|
5314
|
+
TaonMiddleware({
|
|
5315
|
+
className: 'BaseFileUploadMiddleware',
|
|
5316
|
+
})
|
|
5317
|
+
], BaseFileUploadMiddleware);
|
|
5318
|
+
|
|
5319
|
+
/**
|
|
5320
|
+
* Repository decorator
|
|
5321
|
+
*/
|
|
5322
|
+
function TaonRepository(options) {
|
|
5323
|
+
return function (constructor) {
|
|
5324
|
+
Reflect.defineMetadata(Symbols.metadata.options.repository, options, constructor);
|
|
5325
|
+
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
5326
|
+
ClassHelpers.setName(constructor, options?.className);
|
|
5327
|
+
};
|
|
5328
|
+
}
|
|
5329
|
+
class TaonRepositoryOptions extends DecoratorAbstractOpt {
|
|
5330
|
+
}
|
|
5331
|
+
|
|
5201
5332
|
//#endregion
|
|
5202
5333
|
let BaseCustomRepository = class BaseCustomRepository extends BaseInjector {
|
|
5203
5334
|
};
|
|
@@ -5792,6 +5923,9 @@ BaseRepository = __decorate([
|
|
|
5792
5923
|
const BaseContext = createContext(() => ({
|
|
5793
5924
|
contextName: 'BaseContext',
|
|
5794
5925
|
abstract: true,
|
|
5926
|
+
middlewares: {
|
|
5927
|
+
BaseFileUploadMiddleware,
|
|
5928
|
+
},
|
|
5795
5929
|
repositories: {
|
|
5796
5930
|
// @ts-ignore
|
|
5797
5931
|
BaseRepository,
|
|
@@ -5813,14 +5947,6 @@ function TaonController(options) {
|
|
|
5813
5947
|
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
5814
5948
|
};
|
|
5815
5949
|
}
|
|
5816
|
-
class TaonControllerOptions extends Models.DecoratorAbstractOpt {
|
|
5817
|
-
}
|
|
5818
|
-
|
|
5819
|
-
let BaseController = class BaseController extends BaseInjector {
|
|
5820
|
-
};
|
|
5821
|
-
BaseController = __decorate([
|
|
5822
|
-
TaonController({ className: 'BaseController' })
|
|
5823
|
-
], BaseController);
|
|
5824
5950
|
|
|
5825
5951
|
const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal) => {
|
|
5826
5952
|
let options;
|
|
@@ -5833,13 +5959,14 @@ const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, p
|
|
|
5833
5959
|
else {
|
|
5834
5960
|
options = { pathOrOptions, pathIsGlobal };
|
|
5835
5961
|
}
|
|
5836
|
-
const { overrideContentType,
|
|
5962
|
+
const { overrideContentType, overrideResponseType, middlewares } = options;
|
|
5837
5963
|
let methodConfig = Reflect.getMetadata(Symbols.metadata.options.controllerMethod, target.constructor, propertyKey);
|
|
5838
5964
|
if (!methodConfig) {
|
|
5839
5965
|
methodConfig = new Models.MethodConfig();
|
|
5840
5966
|
Reflect.defineMetadata(Symbols.metadata.options.controllerMethod, methodConfig, target.constructor, propertyKey);
|
|
5841
5967
|
}
|
|
5842
5968
|
methodConfig.methodName = propertyKey;
|
|
5969
|
+
methodConfig.middlewares = middlewares || [];
|
|
5843
5970
|
methodConfig.type = method;
|
|
5844
5971
|
if (!path) {
|
|
5845
5972
|
let paramsPathConcatedPath = '';
|
|
@@ -5861,7 +5988,7 @@ const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, p
|
|
|
5861
5988
|
methodConfig.descriptor = descriptor;
|
|
5862
5989
|
methodConfig.global = pathIsGlobal;
|
|
5863
5990
|
methodConfig.contentType = overrideContentType;
|
|
5864
|
-
methodConfig.responseType =
|
|
5991
|
+
methodConfig.responseType = overrideResponseType;
|
|
5865
5992
|
Reflect.defineMetadata(Symbols.metadata.options.controllerMethod, methodConfig, target.constructor, propertyKey);
|
|
5866
5993
|
// console.log('methods updated', methodConfig);
|
|
5867
5994
|
};
|
|
@@ -5940,6 +6067,68 @@ function Body(name) {
|
|
|
5940
6067
|
};
|
|
5941
6068
|
}
|
|
5942
6069
|
|
|
6070
|
+
/* */
|
|
6071
|
+
/* */
|
|
6072
|
+
let BaseController = class BaseController extends BaseInjector {
|
|
6073
|
+
//#region upload form data to server
|
|
6074
|
+
uploadFormDataToServer(formData) {
|
|
6075
|
+
/* */
|
|
6076
|
+
/* */
|
|
6077
|
+
/* */
|
|
6078
|
+
/* */
|
|
6079
|
+
/* */
|
|
6080
|
+
/* */
|
|
6081
|
+
/* */
|
|
6082
|
+
/* */
|
|
6083
|
+
/* */
|
|
6084
|
+
/* */
|
|
6085
|
+
/* */
|
|
6086
|
+
/* */
|
|
6087
|
+
/* */
|
|
6088
|
+
/* */
|
|
6089
|
+
/* */
|
|
6090
|
+
/* */
|
|
6091
|
+
/* */
|
|
6092
|
+
/* */
|
|
6093
|
+
/* */
|
|
6094
|
+
/* */
|
|
6095
|
+
/* */
|
|
6096
|
+
return (void 0);
|
|
6097
|
+
}
|
|
6098
|
+
//#endregion
|
|
6099
|
+
//#region upload local file to server
|
|
6100
|
+
async uploadLocalFileToServer(absFilePath) {
|
|
6101
|
+
/* */
|
|
6102
|
+
/* */
|
|
6103
|
+
/* */
|
|
6104
|
+
/* */
|
|
6105
|
+
/* */
|
|
6106
|
+
/* */
|
|
6107
|
+
/* */
|
|
6108
|
+
/* */
|
|
6109
|
+
/* */
|
|
6110
|
+
/* */
|
|
6111
|
+
/* */
|
|
6112
|
+
/* */
|
|
6113
|
+
return (void 0);
|
|
6114
|
+
}
|
|
6115
|
+
};
|
|
6116
|
+
__decorate([
|
|
6117
|
+
POST({
|
|
6118
|
+
overrideContentType: 'multipart/form-data',
|
|
6119
|
+
middlewares: [BaseFileUploadMiddleware],
|
|
6120
|
+
}),
|
|
6121
|
+
__param(0, Body()),
|
|
6122
|
+
__metadata("design:type", Function),
|
|
6123
|
+
__metadata("design:paramtypes", [FormData]),
|
|
6124
|
+
__metadata("design:returntype", Object)
|
|
6125
|
+
], BaseController.prototype, "uploadFormDataToServer", null);
|
|
6126
|
+
BaseController = __decorate([
|
|
6127
|
+
TaonController({
|
|
6128
|
+
className: 'BaseController',
|
|
6129
|
+
})
|
|
6130
|
+
], BaseController);
|
|
6131
|
+
|
|
5943
6132
|
//#endregion
|
|
5944
6133
|
/**
|
|
5945
6134
|
* Please override property entityClassFn with entity class.
|
|
@@ -6216,14 +6405,6 @@ BaseCrudController = __decorate([
|
|
|
6216
6405
|
TaonController({ className: 'BaseCrudController' })
|
|
6217
6406
|
], BaseCrudController);
|
|
6218
6407
|
|
|
6219
|
-
/**
|
|
6220
|
-
* TODO
|
|
6221
|
-
* - global provider available in all contexts
|
|
6222
|
-
* - provider available in own context
|
|
6223
|
-
*/
|
|
6224
|
-
class BaseMiddleware extends BaseInjector {
|
|
6225
|
-
}
|
|
6226
|
-
|
|
6227
6408
|
class BaseMigration extends BaseInjector {
|
|
6228
6409
|
/**
|
|
6229
6410
|
* by default is READY to run
|
|
@@ -6260,7 +6441,7 @@ function TaonSubscriber(options) {
|
|
|
6260
6441
|
ClassHelpers.setName(constructor, options?.className);
|
|
6261
6442
|
};
|
|
6262
6443
|
}
|
|
6263
|
-
class TaonSubscriberOptions extends
|
|
6444
|
+
class TaonSubscriberOptions extends DecoratorAbstractOpt {
|
|
6264
6445
|
}
|
|
6265
6446
|
|
|
6266
6447
|
let BaseSubscriberForEntity = class BaseSubscriberForEntity extends BaseInjector {
|
|
@@ -6423,7 +6604,6 @@ var Base;
|
|
|
6423
6604
|
Base.Context = BaseContext;
|
|
6424
6605
|
})(Base || (Base = {}));
|
|
6425
6606
|
|
|
6426
|
-
//#endregion
|
|
6427
6607
|
/**
|
|
6428
6608
|
* Entity decorator
|
|
6429
6609
|
*/
|
|
@@ -6443,20 +6623,7 @@ function TaonEntity(options) {
|
|
|
6443
6623
|
CLASS.setName(constructor, options?.className); // TODO QUICK_FIX for ng2-rest
|
|
6444
6624
|
};
|
|
6445
6625
|
}
|
|
6446
|
-
class TaonEntityOptions extends
|
|
6447
|
-
}
|
|
6448
|
-
|
|
6449
|
-
/**
|
|
6450
|
-
* Provider decorator
|
|
6451
|
-
*/
|
|
6452
|
-
function TaonMiddleware(options) {
|
|
6453
|
-
return function (constructor) {
|
|
6454
|
-
Reflect.defineMetadata(Symbols.metadata.options.provider, options, constructor);
|
|
6455
|
-
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
6456
|
-
ClassHelpers.setName(constructor, options?.className || constructor.name);
|
|
6457
|
-
};
|
|
6458
|
-
}
|
|
6459
|
-
class TaonMiddlewareOptions extends Models.DecoratorAbstractOpt {
|
|
6626
|
+
class TaonEntityOptions extends DecoratorAbstractOpt {
|
|
6460
6627
|
}
|
|
6461
6628
|
|
|
6462
6629
|
/**
|
|
@@ -6469,7 +6636,7 @@ function TaonMigration(options) {
|
|
|
6469
6636
|
ClassHelpers.setName(constructor, options?.className);
|
|
6470
6637
|
};
|
|
6471
6638
|
}
|
|
6472
|
-
class TaonMigrationOptions extends
|
|
6639
|
+
class TaonMigrationOptions extends DecoratorAbstractOpt {
|
|
6473
6640
|
}
|
|
6474
6641
|
|
|
6475
6642
|
/**
|
|
@@ -6482,7 +6649,7 @@ function TaonProvider(options) {
|
|
|
6482
6649
|
ClassHelpers.setName(constructor, options?.className || constructor.name);
|
|
6483
6650
|
};
|
|
6484
6651
|
}
|
|
6485
|
-
class TaonProviderOptions extends
|
|
6652
|
+
class TaonProviderOptions extends DecoratorAbstractOpt {
|
|
6486
6653
|
}
|
|
6487
6654
|
|
|
6488
6655
|
var Http;
|