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
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import * as coreHelpers from 'tnp-core/browser';
|
|
3
|
-
import { _, Utils, Helpers, UtilsOs } from 'tnp-core/browser';
|
|
3
|
+
import { _, Utils, Helpers, UtilsOs, crossPlatformPath } from 'tnp-core/browser';
|
|
4
4
|
import { __decorate, __metadata, __param } from 'tslib';
|
|
5
5
|
import { walk } from 'lodash-walk-object/browser';
|
|
6
|
-
import { OrignalClassKey, Table } from 'taon-typeorm/browser';
|
|
7
6
|
import { SYMBOL, CLASS } from 'typescript-class-helpers/browser';
|
|
8
|
-
import {
|
|
7
|
+
import { OrignalClassKey, Table } from 'taon-typeorm/browser';
|
|
9
8
|
import * as i0 from '@angular/core';
|
|
10
9
|
import { InjectionToken, inject as inject$1, Injectable } from '@angular/core';
|
|
11
10
|
import axios from 'axios';
|
|
12
11
|
import { JSON10 } from 'json10/browser';
|
|
12
|
+
import { Models as Models$1, Resource, RestHeaders, Mapping } from 'ng2-rest/browser';
|
|
13
13
|
import { Observable, from, Subject } from 'rxjs';
|
|
14
14
|
import * as JSON5 from 'json5';
|
|
15
15
|
import { io } from 'socket.io-client';
|
|
16
16
|
|
|
17
|
+
class DecoratorAbstractOpt {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class TaonControllerOptions extends DecoratorAbstractOpt {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
class ControllerConfig extends TaonControllerOptions {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.methods = {};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
17
30
|
var Symbols;
|
|
18
31
|
(function (Symbols) {
|
|
19
32
|
Symbols.ctxInClassOrClassObj = Symbol();
|
|
@@ -204,127 +217,9 @@ var Validators;
|
|
|
204
217
|
};
|
|
205
218
|
})(Validators || (Validators = {}));
|
|
206
219
|
|
|
207
|
-
|
|
208
|
-
(function (Models) {
|
|
209
|
-
//#region models / class types
|
|
210
|
-
let ClassType;
|
|
211
|
-
(function (ClassType) {
|
|
212
|
-
ClassType["ENTITY"] = "ENTITY";
|
|
213
|
-
ClassType["CONTROLLER"] = "CONTROLLER";
|
|
214
|
-
ClassType["REPOSITORY"] = "REPOSITORY";
|
|
215
|
-
ClassType["PROVIDER"] = "PROVIDER";
|
|
216
|
-
ClassType["SUBSCRIBER"] = "SUBSCRIBER";
|
|
217
|
-
ClassType["MIGRATION"] = "MIGRATION";
|
|
218
|
-
ClassType["MIDDLEWARE"] = "MIDDLEWARE";
|
|
219
|
-
})(ClassType = Models.ClassType || (Models.ClassType = {}));
|
|
220
|
-
Models.ClassTypeKey = {
|
|
221
|
-
[ClassType.ENTITY]: 'entities',
|
|
222
|
-
[ClassType.CONTROLLER]: 'controllers',
|
|
223
|
-
[ClassType.REPOSITORY]: 'repositories',
|
|
224
|
-
[ClassType.PROVIDER]: 'providers',
|
|
225
|
-
[ClassType.SUBSCRIBER]: 'subscribers',
|
|
226
|
-
[ClassType.MIGRATION]: 'migrations',
|
|
227
|
-
[ClassType.MIDDLEWARE]: 'middlewares',
|
|
228
|
-
};
|
|
229
|
-
//#endregion
|
|
230
|
-
//#region models / database connection options
|
|
231
|
-
class DatabaseConfigTypeOrm {
|
|
232
|
-
}
|
|
233
|
-
Models.DatabaseConfigTypeOrm = DatabaseConfigTypeOrm;
|
|
234
|
-
//#endregion
|
|
235
|
-
//#region models / database config
|
|
236
|
-
class DatabaseConfig extends DatabaseConfigTypeOrm {
|
|
237
|
-
static from(databasePartialConfig) {
|
|
238
|
-
return _.merge(new DatabaseConfig(), databasePartialConfig);
|
|
239
|
-
}
|
|
240
|
-
get databaseConfigTypeORM() {
|
|
241
|
-
/* */
|
|
242
|
-
/* */
|
|
243
|
-
/* */
|
|
244
|
-
/* */
|
|
245
|
-
/* */
|
|
246
|
-
/* */
|
|
247
|
-
/* */
|
|
248
|
-
/* */
|
|
249
|
-
/* */
|
|
250
|
-
/* */
|
|
251
|
-
/* */
|
|
252
|
-
/* */
|
|
253
|
-
/* */
|
|
254
|
-
/* */
|
|
255
|
-
return (void 0);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
Models.DatabaseConfig = DatabaseConfig;
|
|
259
|
-
//#endregion
|
|
260
|
-
//#region models / decorator abstract options
|
|
261
|
-
class DecoratorAbstractOpt {
|
|
262
|
-
}
|
|
263
|
-
Models.DecoratorAbstractOpt = DecoratorAbstractOpt;
|
|
264
|
-
//#endregion
|
|
265
|
-
//#region models / param config
|
|
266
|
-
class ParamConfig {
|
|
267
|
-
}
|
|
268
|
-
Models.ParamConfig = ParamConfig;
|
|
269
|
-
//#endregion
|
|
270
|
-
//#region models / method config
|
|
271
|
-
class MethodConfig {
|
|
272
|
-
constructor() {
|
|
273
|
-
/* */
|
|
274
|
-
/* */
|
|
275
|
-
this.parameters = {};
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
Models.MethodConfig = MethodConfig;
|
|
279
|
-
//#endregion
|
|
280
|
-
//#region models / controller config
|
|
281
|
-
class ControllerConfig extends DecoratorAbstractOpt {
|
|
282
|
-
constructor() {
|
|
283
|
-
super(...arguments);
|
|
284
|
-
this.methods = {};
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
Models.ControllerConfig = ControllerConfig;
|
|
288
|
-
//#endregion
|
|
289
|
-
//#region models / runtime controller config
|
|
290
|
-
class RuntimeControllerConfig extends ControllerConfig {
|
|
291
|
-
}
|
|
292
|
-
Models.RuntimeControllerConfig = RuntimeControllerConfig;
|
|
293
|
-
//#endregion
|
|
294
|
-
//#region models / http
|
|
295
|
-
let Http;
|
|
296
|
-
(function (Http) {
|
|
297
|
-
Http.Rest = Models$1;
|
|
298
|
-
class Errors {
|
|
299
|
-
constructor(message, code = 400) {
|
|
300
|
-
this.message = message;
|
|
301
|
-
this.code = code;
|
|
302
|
-
this.toString = () => {
|
|
303
|
-
return this.message;
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
static create(message, code = 400) {
|
|
307
|
-
return new Errors(message, code);
|
|
308
|
-
}
|
|
309
|
-
static entityNotFound(entity) {
|
|
310
|
-
return Errors.create(`Entity ${ClassHelpers.getName(entity)} not found`);
|
|
311
|
-
}
|
|
312
|
-
static custom(message, code = 400) {
|
|
313
|
-
return Errors.create(message, code);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
Http.Errors = Errors;
|
|
317
|
-
/* */
|
|
318
|
-
/* */
|
|
319
|
-
/* */
|
|
320
|
-
/* */
|
|
321
|
-
/* */
|
|
322
|
-
})(Http = Models.Http || (Models.Http = {}));
|
|
323
|
-
//#endregion
|
|
324
|
-
})(Models || (Models = {}));
|
|
325
|
-
|
|
326
|
-
/* */
|
|
220
|
+
//#region imports
|
|
327
221
|
/* */
|
|
222
|
+
//#endregion
|
|
328
223
|
var ClassHelpers;
|
|
329
224
|
(function (ClassHelpers) {
|
|
330
225
|
//#region get class from name
|
|
@@ -429,7 +324,7 @@ var ClassHelpers;
|
|
|
429
324
|
//#region get all metadata for controller
|
|
430
325
|
ClassHelpers.getControllerConfig = (target) => {
|
|
431
326
|
const classMetadataOptions = Reflect.getMetadata(Symbols.metadata.options.controller, target);
|
|
432
|
-
const classMetadata = _.merge(new
|
|
327
|
+
const classMetadata = _.merge(new ControllerConfig(), classMetadataOptions);
|
|
433
328
|
// Iterate over all methods of the class
|
|
434
329
|
const methodNames = ClassHelpers.getMethodsNames(target); // Object.getOwnPropertyNames(target.prototype);
|
|
435
330
|
// console.log(`methodNames for ${ClassHelpers.getName(target)} `, methodNames)
|
|
@@ -467,6 +362,12 @@ var ClassHelpers;
|
|
|
467
362
|
'toLocaleString',
|
|
468
363
|
];
|
|
469
364
|
//#endregion
|
|
365
|
+
/**
|
|
366
|
+
* Express async handler for middleware functions.
|
|
367
|
+
*/
|
|
368
|
+
ClassHelpers.asyncHandler = fn => (req, res, next) => {
|
|
369
|
+
Promise.resolve(fn(req, res, next)).catch(next);
|
|
370
|
+
};
|
|
470
371
|
ClassHelpers.getMethodsNames = (classOrClassInstance, allMethodsNames = []) => {
|
|
471
372
|
if (!classOrClassInstance) {
|
|
472
373
|
return Utils.uniqArray(allMethodsNames);
|
|
@@ -1390,6 +1291,107 @@ var TaonHelpers;
|
|
|
1390
1291
|
//#endregion
|
|
1391
1292
|
})(TaonHelpers || (TaonHelpers = {}));
|
|
1392
1293
|
|
|
1294
|
+
var Models;
|
|
1295
|
+
(function (Models) {
|
|
1296
|
+
//#region models / class types
|
|
1297
|
+
let ClassType;
|
|
1298
|
+
(function (ClassType) {
|
|
1299
|
+
ClassType["ENTITY"] = "ENTITY";
|
|
1300
|
+
ClassType["CONTROLLER"] = "CONTROLLER";
|
|
1301
|
+
ClassType["REPOSITORY"] = "REPOSITORY";
|
|
1302
|
+
ClassType["PROVIDER"] = "PROVIDER";
|
|
1303
|
+
ClassType["SUBSCRIBER"] = "SUBSCRIBER";
|
|
1304
|
+
ClassType["MIGRATION"] = "MIGRATION";
|
|
1305
|
+
ClassType["MIDDLEWARE"] = "MIDDLEWARE";
|
|
1306
|
+
})(ClassType = Models.ClassType || (Models.ClassType = {}));
|
|
1307
|
+
Models.ClassTypeKey = {
|
|
1308
|
+
[ClassType.ENTITY]: 'entities',
|
|
1309
|
+
[ClassType.CONTROLLER]: 'controllers',
|
|
1310
|
+
[ClassType.REPOSITORY]: 'repositories',
|
|
1311
|
+
[ClassType.PROVIDER]: 'providers',
|
|
1312
|
+
[ClassType.SUBSCRIBER]: 'subscribers',
|
|
1313
|
+
[ClassType.MIGRATION]: 'migrations',
|
|
1314
|
+
[ClassType.MIDDLEWARE]: 'middlewares',
|
|
1315
|
+
};
|
|
1316
|
+
//#endregion
|
|
1317
|
+
//#region models / database connection options
|
|
1318
|
+
class DatabaseConfigTypeOrm {
|
|
1319
|
+
}
|
|
1320
|
+
Models.DatabaseConfigTypeOrm = DatabaseConfigTypeOrm;
|
|
1321
|
+
//#endregion
|
|
1322
|
+
//#region models / database config
|
|
1323
|
+
class DatabaseConfig extends DatabaseConfigTypeOrm {
|
|
1324
|
+
static from(databasePartialConfig) {
|
|
1325
|
+
return _.merge(new DatabaseConfig(), databasePartialConfig);
|
|
1326
|
+
}
|
|
1327
|
+
get databaseConfigTypeORM() {
|
|
1328
|
+
/* */
|
|
1329
|
+
/* */
|
|
1330
|
+
/* */
|
|
1331
|
+
/* */
|
|
1332
|
+
/* */
|
|
1333
|
+
/* */
|
|
1334
|
+
/* */
|
|
1335
|
+
/* */
|
|
1336
|
+
/* */
|
|
1337
|
+
/* */
|
|
1338
|
+
/* */
|
|
1339
|
+
/* */
|
|
1340
|
+
/* */
|
|
1341
|
+
/* */
|
|
1342
|
+
return (void 0);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
Models.DatabaseConfig = DatabaseConfig;
|
|
1346
|
+
//#endregion
|
|
1347
|
+
//#region models / param config
|
|
1348
|
+
class ParamConfig {
|
|
1349
|
+
}
|
|
1350
|
+
Models.ParamConfig = ParamConfig;
|
|
1351
|
+
//#endregion
|
|
1352
|
+
//#region models / method config
|
|
1353
|
+
/**
|
|
1354
|
+
* @link './decorators/http/http-methods-decorators.ts' TaonHttpDecoratorOptions
|
|
1355
|
+
*/
|
|
1356
|
+
class MethodConfig {
|
|
1357
|
+
constructor() {
|
|
1358
|
+
this.parameters = {};
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
Models.MethodConfig = MethodConfig;
|
|
1362
|
+
//#endregion
|
|
1363
|
+
//#region models / http
|
|
1364
|
+
let Http;
|
|
1365
|
+
(function (Http) {
|
|
1366
|
+
Http.Rest = Models$1;
|
|
1367
|
+
class Errors {
|
|
1368
|
+
constructor(message, code = 400) {
|
|
1369
|
+
this.message = message;
|
|
1370
|
+
this.code = code;
|
|
1371
|
+
this.toString = () => {
|
|
1372
|
+
return this.message;
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
static create(message, code = 400) {
|
|
1376
|
+
return new Errors(message, code);
|
|
1377
|
+
}
|
|
1378
|
+
static entityNotFound(entity) {
|
|
1379
|
+
return Errors.create(`Entity ${ClassHelpers.getName(entity)} not found`);
|
|
1380
|
+
}
|
|
1381
|
+
static custom(message, code = 400) {
|
|
1382
|
+
return Errors.create(message, code);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
Http.Errors = Errors;
|
|
1386
|
+
/* */
|
|
1387
|
+
/* */
|
|
1388
|
+
/* */
|
|
1389
|
+
/* */
|
|
1390
|
+
/* */
|
|
1391
|
+
})(Http = Models.Http || (Models.Http = {}));
|
|
1392
|
+
//#endregion
|
|
1393
|
+
})(Models || (Models = {}));
|
|
1394
|
+
|
|
1393
1395
|
//#region imports
|
|
1394
1396
|
/* */
|
|
1395
1397
|
/* */
|
|
@@ -3121,7 +3123,8 @@ class EndpointContext {
|
|
|
3121
3123
|
/* */
|
|
3122
3124
|
/* */
|
|
3123
3125
|
/* */
|
|
3124
|
-
|
|
3126
|
+
/* */
|
|
3127
|
+
await this.initCustomClientMiddlewares();
|
|
3125
3128
|
}
|
|
3126
3129
|
//#endregion
|
|
3127
3130
|
//#region prepare realtime
|
|
@@ -3342,7 +3345,6 @@ class EndpointContext {
|
|
|
3342
3345
|
/* */
|
|
3343
3346
|
/* */
|
|
3344
3347
|
/* */
|
|
3345
|
-
/* */
|
|
3346
3348
|
return (void 0);
|
|
3347
3349
|
}
|
|
3348
3350
|
//#endregion
|
|
@@ -3715,6 +3717,9 @@ class EndpointContext {
|
|
|
3715
3717
|
return this.config.contextName;
|
|
3716
3718
|
}
|
|
3717
3719
|
//#endregion
|
|
3720
|
+
get cwd() {
|
|
3721
|
+
return this.config.cwd || process.cwd();
|
|
3722
|
+
}
|
|
3718
3723
|
get activeContext() {
|
|
3719
3724
|
return this.config.activeContext || null;
|
|
3720
3725
|
}
|
|
@@ -3951,6 +3956,7 @@ class EndpointContext {
|
|
|
3951
3956
|
const configs = ClassHelpers.getControllerConfigs(controllerClassFn);
|
|
3952
3957
|
// console.log(`Class config for ${ClassHelpers.getName(controllerClassFn)}`, configs)
|
|
3953
3958
|
const classConfig = configs[0];
|
|
3959
|
+
//#region update class calculate path
|
|
3954
3960
|
const parentscalculatedPath = _.slice(configs, 1)
|
|
3955
3961
|
.reverse()
|
|
3956
3962
|
.map(bc => {
|
|
@@ -3974,6 +3980,7 @@ class EndpointContext {
|
|
|
3974
3980
|
}, [])
|
|
3975
3981
|
.join('/');
|
|
3976
3982
|
}
|
|
3983
|
+
//#endregion
|
|
3977
3984
|
// console.log('calculatedPath', classConfig.calculatedPath);
|
|
3978
3985
|
_.slice(configs, 1).forEach(bc => {
|
|
3979
3986
|
const alreadyIs = classConfig.methods;
|
|
@@ -4097,44 +4104,29 @@ class EndpointContext {
|
|
|
4097
4104
|
}
|
|
4098
4105
|
//#endregion
|
|
4099
4106
|
//#region methods & getters / init middlewares
|
|
4100
|
-
async
|
|
4101
|
-
const middlewares = this.getClassesInstancesArrBy(Models.ClassType.MIDDLEWARE)
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
});
|
|
4122
|
-
})(middlewareInstance, this.contextName, apiPrefix, this.uriPathnameOrNothingIfRoot);
|
|
4123
|
-
}
|
|
4124
|
-
}
|
|
4107
|
+
async initCustomClientMiddlewares() {
|
|
4108
|
+
const middlewares = this.getClassesInstancesArrBy(Models.ClassType.MIDDLEWARE)
|
|
4109
|
+
.map(f => f)
|
|
4110
|
+
.filter(f => _.isFunction(f.interceptClient));
|
|
4111
|
+
middlewares.forEach(instance => {
|
|
4112
|
+
const contextName = this.contextName;
|
|
4113
|
+
const interceptorName = `${contextName}-${ClassHelpers.getName(instance)}`;
|
|
4114
|
+
Resource.request.interceptors.set(interceptorName, {
|
|
4115
|
+
intercept: ({ req, next }) => {
|
|
4116
|
+
const url = new URL(req.url);
|
|
4117
|
+
if (url.pathname.startsWith(`${this.uriPathnameOrNothingIfRoot}/${apiPrefix}/${contextName}/`)) {
|
|
4118
|
+
// console.log('intercepting', url.pathname, req);
|
|
4119
|
+
return instance.interceptClient({
|
|
4120
|
+
req,
|
|
4121
|
+
next,
|
|
4122
|
+
});
|
|
4123
|
+
}
|
|
4124
|
+
return next.handle(req);
|
|
4125
|
+
},
|
|
4126
|
+
});
|
|
4127
|
+
});
|
|
4125
4128
|
}
|
|
4126
|
-
async
|
|
4127
|
-
/* */
|
|
4128
|
-
/* */
|
|
4129
|
-
/* */
|
|
4130
|
-
/* */
|
|
4131
|
-
/* */
|
|
4132
|
-
/* */
|
|
4133
|
-
/* */
|
|
4134
|
-
/* */
|
|
4135
|
-
/* */
|
|
4136
|
-
/* */
|
|
4137
|
-
/* */
|
|
4129
|
+
async initCustomBackendMiddlewares() {
|
|
4138
4130
|
/* */
|
|
4139
4131
|
/* */
|
|
4140
4132
|
/* */
|
|
@@ -4169,6 +4161,8 @@ class EndpointContext {
|
|
|
4169
4161
|
/* */
|
|
4170
4162
|
/* */
|
|
4171
4163
|
/* */
|
|
4164
|
+
}
|
|
4165
|
+
async initBackendMiddlewares() {
|
|
4172
4166
|
/* */
|
|
4173
4167
|
/* */
|
|
4174
4168
|
/* */
|
|
@@ -4278,16 +4272,31 @@ class EndpointContext {
|
|
|
4278
4272
|
//#region methods & getters / init methods node
|
|
4279
4273
|
initServer(
|
|
4280
4274
|
//#region parameters
|
|
4281
|
-
|
|
4275
|
+
httpMethodType, methodConfig, classConfig, expressPath, target) {
|
|
4282
4276
|
//#region resolve variables
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4277
|
+
const middlewareHandlers = (Array.isArray(methodConfig.middlewares) &&
|
|
4278
|
+
methodConfig.middlewares?.length > 0
|
|
4279
|
+
? methodConfig.middlewares
|
|
4280
|
+
: [])
|
|
4281
|
+
.map(middlewareClassFun => {
|
|
4282
|
+
const middlewareInstance = this.getInstanceBy(middlewareClassFun);
|
|
4283
|
+
if (middlewareInstance &&
|
|
4284
|
+
_.isFunction(middlewareInstance.interceptServerMethod)) {
|
|
4285
|
+
const middlewareFn = ClassHelpers.asyncHandler(async (req, res, next) => {
|
|
4286
|
+
await middlewareInstance.interceptServerMethod({
|
|
4287
|
+
req,
|
|
4288
|
+
res,
|
|
4289
|
+
next,
|
|
4290
|
+
}, {
|
|
4291
|
+
methodName: methodConfig.methodName,
|
|
4292
|
+
expressPath,
|
|
4293
|
+
httpRequestType: methodConfig.type,
|
|
4294
|
+
});
|
|
4295
|
+
});
|
|
4296
|
+
return middlewareFn;
|
|
4297
|
+
}
|
|
4298
|
+
})
|
|
4299
|
+
.filter(f => !!f);
|
|
4291
4300
|
// const url = this.uri;
|
|
4292
4301
|
//#region get result
|
|
4293
4302
|
const getResult = async (resolvedParams, req, res) => {
|
|
@@ -4297,7 +4306,7 @@ class EndpointContext {
|
|
|
4297
4306
|
*/
|
|
4298
4307
|
this.getInstanceBy(target),
|
|
4299
4308
|
/**
|
|
4300
|
-
* Params for
|
|
4309
|
+
* Params for method @GET, @PUT etc.
|
|
4301
4310
|
*/
|
|
4302
4311
|
resolvedParams);
|
|
4303
4312
|
let result = await getResponseValue(response, { req, res });
|
|
@@ -4340,6 +4349,7 @@ class EndpointContext {
|
|
|
4340
4349
|
/* */
|
|
4341
4350
|
/* */
|
|
4342
4351
|
/* */
|
|
4352
|
+
/* */
|
|
4343
4353
|
//#endregion
|
|
4344
4354
|
/* */
|
|
4345
4355
|
/* */
|
|
@@ -4555,6 +4565,7 @@ class EndpointContext {
|
|
|
4555
4565
|
/* */
|
|
4556
4566
|
/* */
|
|
4557
4567
|
/* */
|
|
4568
|
+
/* */
|
|
4558
4569
|
}
|
|
4559
4570
|
return {
|
|
4560
4571
|
expressPath: expressPath,
|
|
@@ -4568,10 +4579,31 @@ class EndpointContext {
|
|
|
4568
4579
|
*/
|
|
4569
4580
|
async initClient(
|
|
4570
4581
|
//#region parameters
|
|
4571
|
-
target,
|
|
4582
|
+
target, httpRequestType, methodConfig, // Models.Http.Rest.MethodConfig,
|
|
4583
|
+
expressPath) {
|
|
4572
4584
|
const ctx = this;
|
|
4585
|
+
//#region init middlewares
|
|
4586
|
+
const middlewares = methodConfig.middlewares
|
|
4587
|
+
.map(f => this.getInstanceBy(f))
|
|
4588
|
+
.filter(f => _.isFunction(f.interceptClientMethod));
|
|
4589
|
+
middlewares.forEach(instance => {
|
|
4590
|
+
Resource.request.methodsInterceptors.set(`${methodConfig.type?.toUpperCase()}-${expressPath}`, {
|
|
4591
|
+
intercept: ({ req, next }) => {
|
|
4592
|
+
return instance.interceptClientMethod({
|
|
4593
|
+
req,
|
|
4594
|
+
next,
|
|
4595
|
+
}, {
|
|
4596
|
+
methodName: methodConfig.methodName,
|
|
4597
|
+
expressPath,
|
|
4598
|
+
httpRequestType: httpRequestType,
|
|
4599
|
+
});
|
|
4600
|
+
},
|
|
4601
|
+
});
|
|
4602
|
+
});
|
|
4603
|
+
//#endregion
|
|
4573
4604
|
// : { received: any; /* Rest<any, any> */ }
|
|
4574
|
-
this.logHttp &&
|
|
4605
|
+
this.logHttp &&
|
|
4606
|
+
console.log(`${httpRequestType?.toUpperCase()} ${expressPath} `);
|
|
4575
4607
|
// console.log('INITING', methodConfig); // TODO inject in static
|
|
4576
4608
|
//#region resolve storage
|
|
4577
4609
|
// TODO not a good idea
|
|
@@ -4613,6 +4645,9 @@ class EndpointContext {
|
|
|
4613
4645
|
received['observable'] = from(received);
|
|
4614
4646
|
return {
|
|
4615
4647
|
received,
|
|
4648
|
+
request(axiosConfig) {
|
|
4649
|
+
return received;
|
|
4650
|
+
},
|
|
4616
4651
|
};
|
|
4617
4652
|
};
|
|
4618
4653
|
return;
|
|
@@ -4764,6 +4799,11 @@ class EndpointContext {
|
|
|
4764
4799
|
/* */
|
|
4765
4800
|
/* */
|
|
4766
4801
|
/* */
|
|
4802
|
+
/* */
|
|
4803
|
+
/* */
|
|
4804
|
+
/* */
|
|
4805
|
+
/* */
|
|
4806
|
+
/* */
|
|
4767
4807
|
//#endregion
|
|
4768
4808
|
//#region handle normal request
|
|
4769
4809
|
target.prototype[methodConfig.methodName] = function (...args) {
|
|
@@ -4804,8 +4844,7 @@ class EndpointContext {
|
|
|
4804
4844
|
else {
|
|
4805
4845
|
rest = endpoints[ctx.uriOrigin][expressPath];
|
|
4806
4846
|
}
|
|
4807
|
-
const method =
|
|
4808
|
-
const isWithBody = method === 'put' || method === 'post';
|
|
4847
|
+
const method = httpRequestType.toLowerCase();
|
|
4809
4848
|
const pathPrams = {};
|
|
4810
4849
|
let queryParams = {};
|
|
4811
4850
|
let bodyObject = {};
|
|
@@ -4903,9 +4942,11 @@ instead
|
|
|
4903
4942
|
}
|
|
4904
4943
|
//#endregion
|
|
4905
4944
|
const httpResultObj = {
|
|
4906
|
-
received:
|
|
4907
|
-
|
|
4908
|
-
|
|
4945
|
+
received: rest.model(pathPrams)[method](bodyObject, [queryParams]),
|
|
4946
|
+
request(axiosConfig) {
|
|
4947
|
+
return rest
|
|
4948
|
+
.model(pathPrams)[method](bodyObject, [queryParams], axiosConfig);
|
|
4949
|
+
},
|
|
4909
4950
|
};
|
|
4910
4951
|
return httpResultObj;
|
|
4911
4952
|
};
|
|
@@ -5178,16 +5219,16 @@ const createContext = (configFn) => {
|
|
|
5178
5219
|
};
|
|
5179
5220
|
|
|
5180
5221
|
/**
|
|
5181
|
-
*
|
|
5222
|
+
* Provider decorator
|
|
5182
5223
|
*/
|
|
5183
|
-
function
|
|
5224
|
+
function TaonMiddleware(options) {
|
|
5184
5225
|
return function (constructor) {
|
|
5185
|
-
Reflect.defineMetadata(Symbols.metadata.options.
|
|
5226
|
+
Reflect.defineMetadata(Symbols.metadata.options.provider, options, constructor);
|
|
5186
5227
|
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
5187
|
-
ClassHelpers.setName(constructor, options?.className);
|
|
5228
|
+
ClassHelpers.setName(constructor, options?.className || constructor.name);
|
|
5188
5229
|
};
|
|
5189
5230
|
}
|
|
5190
|
-
class
|
|
5231
|
+
class TaonMiddlewareOptions extends DecoratorAbstractOpt {
|
|
5191
5232
|
}
|
|
5192
5233
|
|
|
5193
5234
|
//#endregion
|
|
@@ -5374,6 +5415,95 @@ class BaseInjector {
|
|
|
5374
5415
|
}
|
|
5375
5416
|
}
|
|
5376
5417
|
|
|
5418
|
+
/**
|
|
5419
|
+
* TODO
|
|
5420
|
+
* - global provider available in all contexts
|
|
5421
|
+
* - provider available in own context
|
|
5422
|
+
*/
|
|
5423
|
+
class BaseMiddleware extends BaseInjector {
|
|
5424
|
+
}
|
|
5425
|
+
|
|
5426
|
+
//#endregion
|
|
5427
|
+
/**
|
|
5428
|
+
* Configurable file upload middleware (multer based)
|
|
5429
|
+
*/
|
|
5430
|
+
let BaseFileUploadMiddleware = class BaseFileUploadMiddleware extends BaseMiddleware {
|
|
5431
|
+
async interceptServerMethod({ req, res, next }, { methodName, expressPath }) {
|
|
5432
|
+
return this.middleware()(req, res, next);
|
|
5433
|
+
}
|
|
5434
|
+
//#region upload Dir
|
|
5435
|
+
uploadDir() {
|
|
5436
|
+
return crossPlatformPath([this.ctx.cwd, 'uploaded-files']);
|
|
5437
|
+
}
|
|
5438
|
+
//#endregion
|
|
5439
|
+
//#region storage
|
|
5440
|
+
storage() {
|
|
5441
|
+
/* */
|
|
5442
|
+
/* */
|
|
5443
|
+
/* */
|
|
5444
|
+
/* */
|
|
5445
|
+
/* */
|
|
5446
|
+
/* */
|
|
5447
|
+
/* */
|
|
5448
|
+
/* */
|
|
5449
|
+
/* */
|
|
5450
|
+
/* */
|
|
5451
|
+
/* */
|
|
5452
|
+
/* */
|
|
5453
|
+
/* */
|
|
5454
|
+
/* */
|
|
5455
|
+
/* */
|
|
5456
|
+
/* */
|
|
5457
|
+
/* */
|
|
5458
|
+
/* */
|
|
5459
|
+
/* */
|
|
5460
|
+
return (void 0);
|
|
5461
|
+
}
|
|
5462
|
+
//#endregion
|
|
5463
|
+
//#region upload
|
|
5464
|
+
upload() {
|
|
5465
|
+
/* */
|
|
5466
|
+
/* */
|
|
5467
|
+
/* */
|
|
5468
|
+
/* */
|
|
5469
|
+
/* */
|
|
5470
|
+
/* */
|
|
5471
|
+
/* */
|
|
5472
|
+
/* */
|
|
5473
|
+
/* */
|
|
5474
|
+
/* */
|
|
5475
|
+
/* */
|
|
5476
|
+
/* */
|
|
5477
|
+
/* */
|
|
5478
|
+
return (void 0);
|
|
5479
|
+
}
|
|
5480
|
+
//#endregion
|
|
5481
|
+
//#region middleware
|
|
5482
|
+
middleware() {
|
|
5483
|
+
/* */
|
|
5484
|
+
/* */
|
|
5485
|
+
return (void 0);
|
|
5486
|
+
}
|
|
5487
|
+
};
|
|
5488
|
+
BaseFileUploadMiddleware = __decorate([
|
|
5489
|
+
TaonMiddleware({
|
|
5490
|
+
className: 'BaseFileUploadMiddleware',
|
|
5491
|
+
})
|
|
5492
|
+
], BaseFileUploadMiddleware);
|
|
5493
|
+
|
|
5494
|
+
/**
|
|
5495
|
+
* Repository decorator
|
|
5496
|
+
*/
|
|
5497
|
+
function TaonRepository(options) {
|
|
5498
|
+
return function (constructor) {
|
|
5499
|
+
Reflect.defineMetadata(Symbols.metadata.options.repository, options, constructor);
|
|
5500
|
+
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
5501
|
+
ClassHelpers.setName(constructor, options?.className);
|
|
5502
|
+
};
|
|
5503
|
+
}
|
|
5504
|
+
class TaonRepositoryOptions extends DecoratorAbstractOpt {
|
|
5505
|
+
}
|
|
5506
|
+
|
|
5377
5507
|
//#endregion
|
|
5378
5508
|
let BaseCustomRepository = class BaseCustomRepository extends BaseInjector {
|
|
5379
5509
|
};
|
|
@@ -5994,6 +6124,9 @@ BaseRepository = __decorate([
|
|
|
5994
6124
|
const BaseContext = createContext(() => ({
|
|
5995
6125
|
contextName: 'BaseContext',
|
|
5996
6126
|
abstract: true,
|
|
6127
|
+
middlewares: {
|
|
6128
|
+
BaseFileUploadMiddleware,
|
|
6129
|
+
},
|
|
5997
6130
|
repositories: {
|
|
5998
6131
|
// @ts-ignore
|
|
5999
6132
|
BaseRepository,
|
|
@@ -6015,14 +6148,6 @@ function TaonController(options) {
|
|
|
6015
6148
|
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
6016
6149
|
};
|
|
6017
6150
|
}
|
|
6018
|
-
class TaonControllerOptions extends Models.DecoratorAbstractOpt {
|
|
6019
|
-
}
|
|
6020
|
-
|
|
6021
|
-
let BaseController = class BaseController extends BaseInjector {
|
|
6022
|
-
};
|
|
6023
|
-
BaseController = __decorate([
|
|
6024
|
-
TaonController({ className: 'BaseController' })
|
|
6025
|
-
], BaseController);
|
|
6026
6151
|
|
|
6027
6152
|
const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal) => {
|
|
6028
6153
|
let options;
|
|
@@ -6035,13 +6160,14 @@ const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, p
|
|
|
6035
6160
|
else {
|
|
6036
6161
|
options = { pathOrOptions, pathIsGlobal };
|
|
6037
6162
|
}
|
|
6038
|
-
const { overrideContentType,
|
|
6163
|
+
const { overrideContentType, overrideResponseType, middlewares } = options;
|
|
6039
6164
|
let methodConfig = Reflect.getMetadata(Symbols.metadata.options.controllerMethod, target.constructor, propertyKey);
|
|
6040
6165
|
if (!methodConfig) {
|
|
6041
6166
|
methodConfig = new Models.MethodConfig();
|
|
6042
6167
|
Reflect.defineMetadata(Symbols.metadata.options.controllerMethod, methodConfig, target.constructor, propertyKey);
|
|
6043
6168
|
}
|
|
6044
6169
|
methodConfig.methodName = propertyKey;
|
|
6170
|
+
methodConfig.middlewares = middlewares || [];
|
|
6045
6171
|
methodConfig.type = method;
|
|
6046
6172
|
if (!path) {
|
|
6047
6173
|
let paramsPathConcatedPath = '';
|
|
@@ -6063,7 +6189,7 @@ const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, p
|
|
|
6063
6189
|
methodConfig.descriptor = descriptor;
|
|
6064
6190
|
methodConfig.global = pathIsGlobal;
|
|
6065
6191
|
methodConfig.contentType = overrideContentType;
|
|
6066
|
-
methodConfig.responseType =
|
|
6192
|
+
methodConfig.responseType = overrideResponseType;
|
|
6067
6193
|
Reflect.defineMetadata(Symbols.metadata.options.controllerMethod, methodConfig, target.constructor, propertyKey);
|
|
6068
6194
|
// console.log('methods updated', methodConfig);
|
|
6069
6195
|
};
|
|
@@ -6142,6 +6268,68 @@ function Body(name) {
|
|
|
6142
6268
|
};
|
|
6143
6269
|
}
|
|
6144
6270
|
|
|
6271
|
+
/* */
|
|
6272
|
+
/* */
|
|
6273
|
+
let BaseController = class BaseController extends BaseInjector {
|
|
6274
|
+
//#region upload form data to server
|
|
6275
|
+
uploadFormDataToServer(formData) {
|
|
6276
|
+
/* */
|
|
6277
|
+
/* */
|
|
6278
|
+
/* */
|
|
6279
|
+
/* */
|
|
6280
|
+
/* */
|
|
6281
|
+
/* */
|
|
6282
|
+
/* */
|
|
6283
|
+
/* */
|
|
6284
|
+
/* */
|
|
6285
|
+
/* */
|
|
6286
|
+
/* */
|
|
6287
|
+
/* */
|
|
6288
|
+
/* */
|
|
6289
|
+
/* */
|
|
6290
|
+
/* */
|
|
6291
|
+
/* */
|
|
6292
|
+
/* */
|
|
6293
|
+
/* */
|
|
6294
|
+
/* */
|
|
6295
|
+
/* */
|
|
6296
|
+
/* */
|
|
6297
|
+
return (void 0);
|
|
6298
|
+
}
|
|
6299
|
+
//#endregion
|
|
6300
|
+
//#region upload local file to server
|
|
6301
|
+
async uploadLocalFileToServer(absFilePath) {
|
|
6302
|
+
/* */
|
|
6303
|
+
/* */
|
|
6304
|
+
/* */
|
|
6305
|
+
/* */
|
|
6306
|
+
/* */
|
|
6307
|
+
/* */
|
|
6308
|
+
/* */
|
|
6309
|
+
/* */
|
|
6310
|
+
/* */
|
|
6311
|
+
/* */
|
|
6312
|
+
/* */
|
|
6313
|
+
/* */
|
|
6314
|
+
return (void 0);
|
|
6315
|
+
}
|
|
6316
|
+
};
|
|
6317
|
+
__decorate([
|
|
6318
|
+
POST({
|
|
6319
|
+
overrideContentType: 'multipart/form-data',
|
|
6320
|
+
middlewares: [BaseFileUploadMiddleware],
|
|
6321
|
+
}),
|
|
6322
|
+
__param(0, Body()),
|
|
6323
|
+
__metadata("design:type", Function),
|
|
6324
|
+
__metadata("design:paramtypes", [FormData]),
|
|
6325
|
+
__metadata("design:returntype", Object)
|
|
6326
|
+
], BaseController.prototype, "uploadFormDataToServer", null);
|
|
6327
|
+
BaseController = __decorate([
|
|
6328
|
+
TaonController({
|
|
6329
|
+
className: 'BaseController',
|
|
6330
|
+
})
|
|
6331
|
+
], BaseController);
|
|
6332
|
+
|
|
6145
6333
|
//#endregion
|
|
6146
6334
|
/**
|
|
6147
6335
|
* Please override property entityClassFn with entity class.
|
|
@@ -6426,14 +6614,6 @@ BaseCrudController = __decorate([
|
|
|
6426
6614
|
TaonController({ className: 'BaseCrudController' })
|
|
6427
6615
|
], BaseCrudController);
|
|
6428
6616
|
|
|
6429
|
-
/**
|
|
6430
|
-
* TODO
|
|
6431
|
-
* - global provider available in all contexts
|
|
6432
|
-
* - provider available in own context
|
|
6433
|
-
*/
|
|
6434
|
-
class BaseMiddleware extends BaseInjector {
|
|
6435
|
-
}
|
|
6436
|
-
|
|
6437
6617
|
class BaseMigration extends BaseInjector {
|
|
6438
6618
|
/**
|
|
6439
6619
|
* by default is READY to run
|
|
@@ -6470,7 +6650,7 @@ function TaonSubscriber(options) {
|
|
|
6470
6650
|
ClassHelpers.setName(constructor, options?.className);
|
|
6471
6651
|
};
|
|
6472
6652
|
}
|
|
6473
|
-
class TaonSubscriberOptions extends
|
|
6653
|
+
class TaonSubscriberOptions extends DecoratorAbstractOpt {
|
|
6474
6654
|
}
|
|
6475
6655
|
|
|
6476
6656
|
let BaseSubscriberForEntity = class BaseSubscriberForEntity extends BaseInjector {
|
|
@@ -6633,8 +6813,6 @@ var Base;
|
|
|
6633
6813
|
Base.Context = BaseContext;
|
|
6634
6814
|
})(Base || (Base = {}));
|
|
6635
6815
|
|
|
6636
|
-
/* */
|
|
6637
|
-
/* */
|
|
6638
6816
|
/**
|
|
6639
6817
|
* Entity decorator
|
|
6640
6818
|
*/
|
|
@@ -6653,20 +6831,7 @@ function TaonEntity(options) {
|
|
|
6653
6831
|
CLASS.setName(constructor, options?.className); // TODO QUICK_FIX for ng2-rest
|
|
6654
6832
|
};
|
|
6655
6833
|
}
|
|
6656
|
-
class TaonEntityOptions extends
|
|
6657
|
-
}
|
|
6658
|
-
|
|
6659
|
-
/**
|
|
6660
|
-
* Provider decorator
|
|
6661
|
-
*/
|
|
6662
|
-
function TaonMiddleware(options) {
|
|
6663
|
-
return function (constructor) {
|
|
6664
|
-
Reflect.defineMetadata(Symbols.metadata.options.provider, options, constructor);
|
|
6665
|
-
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
6666
|
-
ClassHelpers.setName(constructor, options?.className || constructor.name);
|
|
6667
|
-
};
|
|
6668
|
-
}
|
|
6669
|
-
class TaonMiddlewareOptions extends Models.DecoratorAbstractOpt {
|
|
6834
|
+
class TaonEntityOptions extends DecoratorAbstractOpt {
|
|
6670
6835
|
}
|
|
6671
6836
|
|
|
6672
6837
|
/**
|
|
@@ -6679,7 +6844,7 @@ function TaonMigration(options) {
|
|
|
6679
6844
|
ClassHelpers.setName(constructor, options?.className);
|
|
6680
6845
|
};
|
|
6681
6846
|
}
|
|
6682
|
-
class TaonMigrationOptions extends
|
|
6847
|
+
class TaonMigrationOptions extends DecoratorAbstractOpt {
|
|
6683
6848
|
}
|
|
6684
6849
|
|
|
6685
6850
|
/**
|
|
@@ -6692,7 +6857,7 @@ function TaonProvider(options) {
|
|
|
6692
6857
|
ClassHelpers.setName(constructor, options?.className || constructor.name);
|
|
6693
6858
|
};
|
|
6694
6859
|
}
|
|
6695
|
-
class TaonProviderOptions extends
|
|
6860
|
+
class TaonProviderOptions extends DecoratorAbstractOpt {
|
|
6696
6861
|
}
|
|
6697
6862
|
|
|
6698
6863
|
var Http;
|