taon 19.0.50 → 19.0.52
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 +167 -77
- package/browser/fesm2022/taon.mjs.map +1 -1
- package/browser/lib/base-classes/base-context.d.ts +1 -0
- package/browser/lib/base-classes/base-controller.d.ts +0 -6
- package/browser/lib/base-classes/base-injector.d.ts +4 -5
- package/browser/lib/base-classes/base-middleware.d.ts +17 -0
- package/browser/lib/base-classes/base.d.ts +3 -0
- package/browser/lib/constants.d.ts +1 -1
- package/browser/lib/create-context.d.ts +4 -2
- package/browser/lib/decorators/classes/middleware-decorator.d.ts +8 -0
- package/browser/lib/endpoint-context.d.ts +6 -5
- package/browser/lib/index.d.ts +8 -2
- package/browser/lib/models.d.ts +65 -5
- package/browser/package.json +1 -1
- package/lib/base-classes/base-context.d.ts +1 -0
- package/lib/base-classes/base-controller.d.ts +0 -6
- package/lib/base-classes/base-controller.js +0 -8
- package/lib/base-classes/base-controller.js.map +1 -1
- package/lib/base-classes/base-injector.d.ts +4 -5
- package/lib/base-classes/base-injector.js +6 -7
- package/lib/base-classes/base-injector.js.map +1 -1
- package/lib/base-classes/base-middleware.d.ts +20 -0
- package/lib/base-classes/base-middleware.js +13 -0
- package/lib/base-classes/base-middleware.js.map +1 -0
- package/lib/base-classes/base.d.ts +3 -0
- package/lib/base-classes/base.js +2 -0
- package/lib/base-classes/base.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/constants.d.ts +1 -1
- package/lib/constants.js +2 -3
- package/lib/constants.js.map +1 -1
- package/lib/create-context.d.ts +4 -2
- package/lib/create-context.js +40 -36
- package/lib/create-context.js.map +1 -1
- package/lib/decorators/classes/middleware-decorator.d.ts +7 -0
- package/lib/decorators/classes/middleware-decorator.js +21 -0
- package/lib/decorators/classes/middleware-decorator.js.map +1 -0
- package/lib/decorators/classes/provider-decorator.js +1 -1
- package/lib/decorators/classes/provider-decorator.js.map +1 -1
- package/lib/endpoint-context.d.ts +6 -5
- package/lib/endpoint-context.js +79 -29
- package/lib/endpoint-context.js.map +1 -1
- package/lib/env/env.angular-node-app.d.ts +1 -0
- package/lib/env/env.angular-node-app.js +3 -2
- package/lib/env/env.angular-node-app.js.map +1 -1
- package/lib/env/env.docs-webapp.d.ts +1 -0
- package/lib/env/env.docs-webapp.js +3 -2
- package/lib/env/env.docs-webapp.js.map +1 -1
- package/lib/env/env.electron-app.d.ts +1 -0
- package/lib/env/env.electron-app.js +3 -2
- package/lib/env/env.electron-app.js.map +1 -1
- package/lib/env/env.mobile-app.d.ts +1 -0
- package/lib/env/env.mobile-app.js +3 -2
- package/lib/env/env.mobile-app.js.map +1 -1
- package/lib/env/env.npm-lib-and-cli-tool.d.ts +1 -0
- package/lib/env/env.npm-lib-and-cli-tool.js +3 -2
- package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
- package/lib/env/env.vscode-plugin.d.ts +1 -0
- package/lib/env/env.vscode-plugin.js +3 -2
- package/lib/env/env.vscode-plugin.js.map +1 -1
- package/lib/env.js +1 -5
- package/lib/env.js.map +1 -1
- package/lib/index.d.ts +8 -2
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/models.d.ts +65 -5
- package/lib/models.js +7 -5
- package/lib/models.js.map +1 -1
- package/lib/storage.d.ts +1 -1
- package/lib/storage.js +1 -5
- package/lib/storage.js.map +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/package.json +1 -1
- package/websql/fesm2022/taon.mjs +168 -78
- package/websql/fesm2022/taon.mjs.map +1 -1
- package/websql/lib/base-classes/base-context.d.ts +1 -0
- package/websql/lib/base-classes/base-controller.d.ts +0 -6
- package/websql/lib/base-classes/base-injector.d.ts +4 -5
- package/websql/lib/base-classes/base-middleware.d.ts +21 -0
- package/websql/lib/base-classes/base.d.ts +3 -0
- package/websql/lib/constants.d.ts +1 -1
- package/websql/lib/create-context.d.ts +4 -2
- package/websql/lib/decorators/classes/middleware-decorator.d.ts +8 -0
- package/websql/lib/endpoint-context.d.ts +6 -5
- package/websql/lib/index.d.ts +8 -2
- package/websql/lib/models.d.ts +65 -5
- package/websql/package.json +1 -1
- package/lib/base-classes/base-subscriber.d.ts +0 -4
- package/lib/base-classes/base-subscriber.js +0 -25
- package/lib/base-classes/base-subscriber.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-abstract-mock.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-abstract-mock.js +0 -214
- package/lib/realtime/realtime-strategy/realtime-abstract-mock.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.d.ts +0 -0
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js +0 -5
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +0 -22
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js +0 -139
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +0 -16
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js +0 -68
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js +0 -56
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js +0 -50
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +0 -13
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js +0 -3
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +0 -2
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js +0 -6
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +0 -16
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js +0 -54
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +0 -17
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js +0 -52
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +0 -11
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js +0 -39
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +0 -13
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js +0 -46
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +0 -11
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js +0 -3
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js.map +0 -1
- package/lib/ui/directives/firedev-inject-html.directive.d.ts +0 -6
- package/lib/ui/directives/firedev-long-press.directive.d.ts +0 -22
- package/lib/ui/directives/index.d.ts +0 -3
- package/lib/ui/directives/index.js +0 -5
- package/lib/ui/directives/index.js.map +0 -1
- package/lib/ui/directives/safe.pipe.d.ts +0 -7
- package/lib/ui/directives/taon-inject-html.directive.d.ts +0 -6
- package/lib/ui/directives/taon-long-press.directive.d.ts +0 -22
- package/lib/ui/directives/view-mode.d.ts +0 -5
- package/lib/ui/directives/view-mode.js +0 -10
- package/lib/ui/directives/view-mode.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.d.ts +0 -29
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.d.ts +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/taon-db-admin.component.d.ts +0 -8
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.d.ts +0 -13
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +0 -5
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js +0 -3
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +0 -14
- package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +0 -43
- package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/taon-admin.models.d.ts +0 -5
- package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js +0 -3
- package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js.map +0 -1
- package/lib/ui/taon-full-material.module.d.ts +0 -5
- package/lib/ui/taon-github-fork-me-corner/index.d.ts +0 -2
- package/lib/ui/taon-github-fork-me-corner/index.js +0 -5
- package/lib/ui/taon-github-fork-me-corner/index.js.map +0 -1
- package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.component.d.ts +0 -3
- package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.module.d.ts +0 -2
- package/lib/ui/taon-github-fork-me-ribbon/index.d.ts +0 -2
- package/lib/ui/taon-github-fork-me-ribbon/index.js +0 -5
- package/lib/ui/taon-github-fork-me-ribbon/index.js.map +0 -1
- package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.component.d.ts +0 -3
- package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.module.d.ts +0 -2
- package/lib/ui/taon-notifications/index.d.ts +0 -4
- package/lib/ui/taon-notifications/index.js +0 -24
- package/lib/ui/taon-notifications/index.js.map +0 -1
- package/lib/ui/taon-notifications/taon-notifications.component.d.ts +0 -9
- package/lib/ui/taon-notifications/taon-notifications.models.d.ts +0 -6
- package/lib/ui/taon-notifications/taon-notifications.models.js +0 -5
- package/lib/ui/taon-notifications/taon-notifications.models.js.map +0 -1
- package/lib/ui/taon-notifications/taon-notifications.module.d.ts +0 -2
- package/lib/ui/taon-notifications/taon-notifications.service.d.ts +0 -11
- package/lib/ui/taon-progress-bar/index.d.ts +0 -2
- package/lib/ui/taon-progress-bar/index.js +0 -5
- package/lib/ui/taon-progress-bar/index.js.map +0 -1
- package/lib/ui/taon-progress-bar/taon-progress-bar.component.d.ts +0 -13
- package/lib/ui/taon-progress-bar/taon-progress-bar.module.d.ts +0 -2
- package/lib/ui/taon-session-passcode/index.d.ts +0 -1
- package/lib/ui/taon-session-passcode/index.js +0 -5
- package/lib/ui/taon-session-passcode/index.js.map +0 -1
- package/lib/ui/taon-session-passcode/taon-session-passcode.component.d.ts +0 -35
- package/lib/ui/taon-table/index.d.ts +0 -2
- package/lib/ui/taon-table/index.js +0 -5
- package/lib/ui/taon-table/index.js.map +0 -1
- package/lib/ui/taon-table/taon-table.component.d.ts +0 -34
- package/lib/ui/taon-table/taon-table.module.d.ts +0 -2
- package/lib/ui/taon.models.d.ts +0 -11
- package/lib/ui/taon.models.js +0 -3
- package/lib/ui/taon.models.js.map +0 -1
- package/lib/ui/toan-full-material.module.d.ts +0 -2
- package/tmp-environment.json +0 -43
|
@@ -5,7 +5,7 @@ import { __decorate, __metadata, __param } from 'tslib';
|
|
|
5
5
|
import { walk } from 'lodash-walk-object/browser';
|
|
6
6
|
import { OrignalClassKey, Table } from 'taon-typeorm/browser';
|
|
7
7
|
import { SYMBOL, CLASS } from 'typescript-class-helpers/browser';
|
|
8
|
-
import { Models as Models$1,
|
|
8
|
+
import { Models as Models$1, Resource, RestHeaders, Mapping } from 'ng2-rest/browser';
|
|
9
9
|
import * as i0 from '@angular/core';
|
|
10
10
|
import { InjectionToken, inject as inject$1, Injectable } from '@angular/core';
|
|
11
11
|
import axios from 'axios';
|
|
@@ -215,6 +215,7 @@ var Models;
|
|
|
215
215
|
ClassType["PROVIDER"] = "PROVIDER";
|
|
216
216
|
ClassType["SUBSCRIBER"] = "SUBSCRIBER";
|
|
217
217
|
ClassType["MIGRATION"] = "MIGRATION";
|
|
218
|
+
ClassType["MIDDLEWARE"] = "MIDDLEWARE";
|
|
218
219
|
})(ClassType = Models.ClassType || (Models.ClassType = {}));
|
|
219
220
|
Models.ClassTypeKey = {
|
|
220
221
|
[ClassType.ENTITY]: 'entities',
|
|
@@ -223,6 +224,7 @@ var Models;
|
|
|
223
224
|
[ClassType.PROVIDER]: 'providers',
|
|
224
225
|
[ClassType.SUBSCRIBER]: 'subscribers',
|
|
225
226
|
[ClassType.MIGRATION]: 'migrations',
|
|
227
|
+
[ClassType.MIDDLEWARE]: 'middlewares',
|
|
226
228
|
};
|
|
227
229
|
//#endregion
|
|
228
230
|
//#region models / database connection options
|
|
@@ -608,9 +610,8 @@ const TaonEntityKeysToOmitArr = [
|
|
|
608
610
|
'injectCustomRepo',
|
|
609
611
|
'injectController',
|
|
610
612
|
'injectCtrl',
|
|
611
|
-
'
|
|
612
|
-
'
|
|
613
|
-
'injectContextProvider',
|
|
613
|
+
'injectProvider',
|
|
614
|
+
'injectMiddleware',
|
|
614
615
|
];
|
|
615
616
|
let TAON_CONTEXT;
|
|
616
617
|
//#region @browser
|
|
@@ -2755,6 +2756,7 @@ class EndpointContext {
|
|
|
2755
2756
|
this.injectableTypesfromContexts = [
|
|
2756
2757
|
Models.ClassType.CONTROLLER,
|
|
2757
2758
|
Models.ClassType.PROVIDER,
|
|
2759
|
+
Models.ClassType.MIDDLEWARE,
|
|
2758
2760
|
Models.ClassType.REPOSITORY,
|
|
2759
2761
|
Models.ClassType.SUBSCRIBER,
|
|
2760
2762
|
Models.ClassType.MIGRATION,
|
|
@@ -3021,6 +3023,10 @@ class EndpointContext {
|
|
|
3021
3023
|
...(await this.getRecrusiveClassesfromContextsObj(Models.ClassType.PROVIDER)),
|
|
3022
3024
|
...this.config.providers,
|
|
3023
3025
|
};
|
|
3026
|
+
this.config.middlewares = {
|
|
3027
|
+
...(await this.getRecrusiveClassesfromContextsObj(Models.ClassType.MIDDLEWARE)),
|
|
3028
|
+
...this.config.middlewares,
|
|
3029
|
+
};
|
|
3024
3030
|
this.config.subscribers = {
|
|
3025
3031
|
...(await this.getRecrusiveClassesfromContextsObj(Models.ClassType.SUBSCRIBER)),
|
|
3026
3032
|
...this.config.subscribers,
|
|
@@ -3055,6 +3061,12 @@ class EndpointContext {
|
|
|
3055
3061
|
ctx: this,
|
|
3056
3062
|
classType: Models.ClassType.PROVIDER,
|
|
3057
3063
|
});
|
|
3064
|
+
this.config.middlewares = this.cloneClassesObjWithNewMetadata({
|
|
3065
|
+
classesInput: this.config.middlewares,
|
|
3066
|
+
config: this.config,
|
|
3067
|
+
ctx: this,
|
|
3068
|
+
classType: Models.ClassType.MIDDLEWARE,
|
|
3069
|
+
});
|
|
3058
3070
|
this.config.subscribers = this.cloneClassesObjWithNewMetadata({
|
|
3059
3071
|
classesInput: this.config.subscribers,
|
|
3060
3072
|
config: this.config,
|
|
@@ -3107,6 +3119,7 @@ class EndpointContext {
|
|
|
3107
3119
|
/* */
|
|
3108
3120
|
/* */
|
|
3109
3121
|
/* */
|
|
3122
|
+
await this.initFrontnedMiddlewares();
|
|
3110
3123
|
}
|
|
3111
3124
|
//#endregion
|
|
3112
3125
|
//#region prepare realtime
|
|
@@ -3508,6 +3521,8 @@ class EndpointContext {
|
|
|
3508
3521
|
return this.config.entities;
|
|
3509
3522
|
case Models.ClassType.PROVIDER:
|
|
3510
3523
|
return this.config.providers;
|
|
3524
|
+
case Models.ClassType.MIDDLEWARE:
|
|
3525
|
+
return this.config.middlewares;
|
|
3511
3526
|
case Models.ClassType.REPOSITORY:
|
|
3512
3527
|
return this.config.repositories;
|
|
3513
3528
|
case Models.ClassType.SUBSCRIBER:
|
|
@@ -3521,7 +3536,7 @@ class EndpointContext {
|
|
|
3521
3536
|
}
|
|
3522
3537
|
/**
|
|
3523
3538
|
* Only for injectable types
|
|
3524
|
-
* Only for classType: CONTROLLER, REPOSITORY, PROVIDER
|
|
3539
|
+
* Only for classType: CONTROLLER, REPOSITORY, PROVIDER, MIDDLEWARES
|
|
3525
3540
|
*/
|
|
3526
3541
|
getClassFunByClassName(className) {
|
|
3527
3542
|
for (const classTypeName of this.allTypesfromContexts) {
|
|
@@ -3561,25 +3576,7 @@ class EndpointContext {
|
|
|
3561
3576
|
}
|
|
3562
3577
|
}
|
|
3563
3578
|
//#endregion
|
|
3564
|
-
//#region methods & getters /
|
|
3565
|
-
async reinitControllers() {
|
|
3566
|
-
if (this.remoteHost || Object.keys(this.config.migrations).length > 0) {
|
|
3567
|
-
return;
|
|
3568
|
-
}
|
|
3569
|
-
// Helpers.taskStarted(
|
|
3570
|
-
// `[taon] REINITING CONTROLLERS ${this.contextName} STARTED`,
|
|
3571
|
-
// );
|
|
3572
|
-
const controllers = this.getClassesInstancesArrBy(Models.ClassType.CONTROLLER);
|
|
3573
|
-
// console.log('CONTROLLERS TO REINIT', controllers);
|
|
3574
|
-
for (const ctrl of controllers) {
|
|
3575
|
-
if (_.isFunction(ctrl.initExampleDbData)) {
|
|
3576
|
-
await ctrl.initExampleDbData();
|
|
3577
|
-
}
|
|
3578
|
-
}
|
|
3579
|
-
// Helpers.taskDone(
|
|
3580
|
-
// `[taon] REINITING CONTROLLERS ${this.contextName} DONE`,
|
|
3581
|
-
// );
|
|
3582
|
-
}
|
|
3579
|
+
//#region methods & getters / init classes
|
|
3583
3580
|
async initClasses() {
|
|
3584
3581
|
if (this.remoteHost) {
|
|
3585
3582
|
return;
|
|
@@ -3594,6 +3591,7 @@ class EndpointContext {
|
|
|
3594
3591
|
/* */
|
|
3595
3592
|
/* */
|
|
3596
3593
|
for (const classTypeName of [
|
|
3594
|
+
Models.ClassType.MIDDLEWARE,
|
|
3597
3595
|
Models.ClassType.PROVIDER,
|
|
3598
3596
|
Models.ClassType.REPOSITORY,
|
|
3599
3597
|
Models.ClassType.CONTROLLER,
|
|
@@ -3609,6 +3607,7 @@ class EndpointContext {
|
|
|
3609
3607
|
//#endregion
|
|
3610
3608
|
}
|
|
3611
3609
|
for (const classTypeName of [
|
|
3610
|
+
Models.ClassType.MIDDLEWARE,
|
|
3612
3611
|
Models.ClassType.PROVIDER,
|
|
3613
3612
|
Models.ClassType.REPOSITORY,
|
|
3614
3613
|
Models.ClassType.CONTROLLER,
|
|
@@ -4095,7 +4094,80 @@ class EndpointContext {
|
|
|
4095
4094
|
}
|
|
4096
4095
|
//#endregion
|
|
4097
4096
|
//#region methods & getters / init middlewares
|
|
4098
|
-
|
|
4097
|
+
async initFrontnedMiddlewares() {
|
|
4098
|
+
const middlewares = this.getClassesInstancesArrBy(Models.ClassType.MIDDLEWARE);
|
|
4099
|
+
for (const middleware of middlewares) {
|
|
4100
|
+
const middlewareInstance = middleware;
|
|
4101
|
+
if (_.isFunction(middlewareInstance.intercept)) {
|
|
4102
|
+
((instance, contextName, apiPart, uriPathnameOrNothingIfRoot) => {
|
|
4103
|
+
const interceptorName = `${contextName}-${ClassHelpers.getName(instance)}`;
|
|
4104
|
+
Resource.request.interceptors.set(interceptorName, async (req) => {
|
|
4105
|
+
console.log('request', req);
|
|
4106
|
+
const url = new URL(req.url);
|
|
4107
|
+
if (url.pathname.startsWith(`${uriPathnameOrNothingIfRoot}/${apiPart}/${contextName}/`)) {
|
|
4108
|
+
await instance.intercept({
|
|
4109
|
+
client: {
|
|
4110
|
+
req,
|
|
4111
|
+
},
|
|
4112
|
+
});
|
|
4113
|
+
}
|
|
4114
|
+
else {
|
|
4115
|
+
// console.log('not fit frontend', url.href);
|
|
4116
|
+
}
|
|
4117
|
+
return req;
|
|
4118
|
+
});
|
|
4119
|
+
})(middlewareInstance, this.contextName, apiPrefix, this.uriPathnameOrNothingIfRoot);
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
}
|
|
4123
|
+
async initBackendMiddlewares() {
|
|
4124
|
+
/* */
|
|
4125
|
+
/* */
|
|
4126
|
+
/* */
|
|
4127
|
+
/* */
|
|
4128
|
+
/* */
|
|
4129
|
+
/* */
|
|
4130
|
+
/* */
|
|
4131
|
+
/* */
|
|
4132
|
+
/* */
|
|
4133
|
+
/* */
|
|
4134
|
+
/* */
|
|
4135
|
+
/* */
|
|
4136
|
+
/* */
|
|
4137
|
+
/* */
|
|
4138
|
+
/* */
|
|
4139
|
+
/* */
|
|
4140
|
+
/* */
|
|
4141
|
+
/* */
|
|
4142
|
+
/* */
|
|
4143
|
+
/* */
|
|
4144
|
+
/* */
|
|
4145
|
+
/* */
|
|
4146
|
+
/* */
|
|
4147
|
+
/* */
|
|
4148
|
+
/* */
|
|
4149
|
+
/* */
|
|
4150
|
+
/* */
|
|
4151
|
+
/* */
|
|
4152
|
+
/* */
|
|
4153
|
+
/* */
|
|
4154
|
+
/* */
|
|
4155
|
+
/* */
|
|
4156
|
+
/* */
|
|
4157
|
+
/* */
|
|
4158
|
+
/* */
|
|
4159
|
+
/* */
|
|
4160
|
+
/* */
|
|
4161
|
+
/* */
|
|
4162
|
+
/* */
|
|
4163
|
+
/* */
|
|
4164
|
+
/* */
|
|
4165
|
+
/* */
|
|
4166
|
+
/* */
|
|
4167
|
+
/* */
|
|
4168
|
+
/* */
|
|
4169
|
+
/* */
|
|
4170
|
+
/* */
|
|
4099
4171
|
/* */
|
|
4100
4172
|
/* */
|
|
4101
4173
|
/* */
|
|
@@ -4944,6 +5016,9 @@ const createContext = (configFn) => {
|
|
|
4944
5016
|
get migrations() {
|
|
4945
5017
|
return config.migrations; // TODO QUICK_FIX new typescript generated wrong types
|
|
4946
5018
|
},
|
|
5019
|
+
get middlewares() {
|
|
5020
|
+
return config.middlewares; // TODO QUICK_FIX new typescript generated wrong types
|
|
5021
|
+
},
|
|
4947
5022
|
},
|
|
4948
5023
|
//#endregion
|
|
4949
5024
|
//#region contexts
|
|
@@ -5037,43 +5112,44 @@ const createContext = (configFn) => {
|
|
|
5037
5112
|
/* */
|
|
5038
5113
|
/* */
|
|
5039
5114
|
await endpointContextRef.initClasses();
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
!
|
|
5047
|
-
|
|
5048
|
-
`
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
`
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5115
|
+
if (endpointContextRef.databaseConfig) {
|
|
5116
|
+
let keepWebsqlDbDataAfterReload = false;
|
|
5117
|
+
//#region @browser
|
|
5118
|
+
keepWebsqlDbDataAfterReload =
|
|
5119
|
+
TaonAdminService.Instance?.keepWebsqlDbDataAfterReload;
|
|
5120
|
+
//#endregion
|
|
5121
|
+
if (!Helpers.isNode && keepWebsqlDbDataAfterReload) {
|
|
5122
|
+
!UtilsOs.isRunningInCliMode() &&
|
|
5123
|
+
Helpers.info(`[taon] Keeping websql data after reload ` +
|
|
5124
|
+
`(context=${endpointContextRef.contextName}).`);
|
|
5125
|
+
}
|
|
5126
|
+
else {
|
|
5127
|
+
!UtilsOs.isRunningInCliMode() &&
|
|
5128
|
+
Helpers.info(`[taon] Dropping all tables and data ` +
|
|
5129
|
+
`(context=${endpointContextRef.contextName}).`);
|
|
5130
|
+
}
|
|
5131
|
+
//#region TODO this may be usefull but for now
|
|
5132
|
+
// 2 separate contexts are fine
|
|
5133
|
+
// const shouldStartRemoteHost = endpointContextRef.mode !== 'remote-backend(tcp+udp)';
|
|
5134
|
+
// if(shouldStartRemoteHost) {
|
|
5135
|
+
// const endpointContextRemoteHostRef = new EndpointContext(config, configFn);
|
|
5136
|
+
// await endpointContextRemoteHostRef.init({
|
|
5137
|
+
// overrideRemoteHost: endpointContextRef.host,
|
|
5138
|
+
// overrideHost: null,
|
|
5139
|
+
// });
|
|
5140
|
+
// endpointContextRemoteHostRef.initMetadata();
|
|
5141
|
+
// endpointContextRef.__contextForControllerInstanceAccess = endpointContextRemoteHostRef;
|
|
5142
|
+
// }
|
|
5143
|
+
//#endregion
|
|
5144
|
+
if (endpointContextRef.onlyMigrationRun) {
|
|
5145
|
+
await endpointContextRef.dbMigrations.runAllNotCompletedMigrations();
|
|
5146
|
+
}
|
|
5147
|
+
else if (endpointContextRef.onlyMigrationRevertToTimestamp) {
|
|
5148
|
+
await endpointContextRef.dbMigrations.revertMigrationToTimestamp(endpointContextRef.onlyMigrationRevertToTimestamp);
|
|
5149
|
+
}
|
|
5150
|
+
else {
|
|
5151
|
+
await endpointContextRef.dbMigrations.runAllNotCompletedMigrations();
|
|
5152
|
+
}
|
|
5077
5153
|
}
|
|
5078
5154
|
resolve(endpointContextRef);
|
|
5079
5155
|
});
|
|
@@ -5205,18 +5281,17 @@ class BaseInjector {
|
|
|
5205
5281
|
//#endregion
|
|
5206
5282
|
//#region inject / global provider
|
|
5207
5283
|
/**
|
|
5208
|
-
*
|
|
5284
|
+
* inject middleware for context
|
|
5209
5285
|
*/
|
|
5210
|
-
|
|
5286
|
+
injectMiddleware(ctor) {
|
|
5211
5287
|
return this.__inject(ctor, { localInstance: false });
|
|
5212
5288
|
}
|
|
5213
5289
|
//#endregion
|
|
5214
5290
|
//#region inject / context provider
|
|
5215
5291
|
/**
|
|
5216
|
-
*
|
|
5217
|
-
* TODO
|
|
5292
|
+
* inject provider for context
|
|
5218
5293
|
*/
|
|
5219
|
-
|
|
5294
|
+
injectProvider(ctor) {
|
|
5220
5295
|
return this.__inject(ctor, { localInstance: false });
|
|
5221
5296
|
}
|
|
5222
5297
|
//#endregion
|
|
@@ -5250,7 +5325,7 @@ class BaseInjector {
|
|
|
5250
5325
|
throw new Error(`Not able to inject "${ClassHelpers.getName(ctor) || ctor.name}" inside ` +
|
|
5251
5326
|
`property "${propName?.toString()}" on class "${ClassHelpers.getName(this)}".
|
|
5252
5327
|
|
|
5253
|
-
Please add "${ClassHelpers.getName(ctor) || ctor.name}" to (entites or contorllers or providers or repositories)
|
|
5328
|
+
Please add "${ClassHelpers.getName(ctor) || ctor.name}" to (entites or contorllers or providers or repositories or middlewares)
|
|
5254
5329
|
|
|
5255
5330
|
`);
|
|
5256
5331
|
}
|
|
@@ -5284,7 +5359,7 @@ class BaseInjector {
|
|
|
5284
5359
|
throw new Error(`Not able to inject "${classNameNotResolved}" inside ` +
|
|
5285
5360
|
`property "${propName?.toString()}" on class "${ClassHelpers.getName(this)}".
|
|
5286
5361
|
|
|
5287
|
-
Please add "${ClassHelpers.getName(ctor) || ctor.name}" to (entites or contorllers or providers or repositories)
|
|
5362
|
+
Please add "${ClassHelpers.getName(ctor) || ctor.name}" to (entites or contorllers or providers or repositories or middlewares)
|
|
5288
5363
|
|
|
5289
5364
|
`);
|
|
5290
5365
|
}
|
|
@@ -5941,14 +6016,6 @@ class TaonControllerOptions extends Models.DecoratorAbstractOpt {
|
|
|
5941
6016
|
}
|
|
5942
6017
|
|
|
5943
6018
|
let BaseController = class BaseController extends BaseInjector {
|
|
5944
|
-
/**
|
|
5945
|
-
* @deprecated use migration instead
|
|
5946
|
-
* THIS ONLY WORKS IF NO MIGRATIONS PROVIDED IN CONFIG
|
|
5947
|
-
* Purpose: init example data for db.
|
|
5948
|
-
*/
|
|
5949
|
-
initExampleDbData() {
|
|
5950
|
-
return void 0;
|
|
5951
|
-
}
|
|
5952
6019
|
};
|
|
5953
6020
|
BaseController = __decorate([
|
|
5954
6021
|
TaonController({ className: 'BaseController' })
|
|
@@ -6356,6 +6423,14 @@ BaseCrudController = __decorate([
|
|
|
6356
6423
|
TaonController({ className: 'BaseCrudController' })
|
|
6357
6424
|
], BaseCrudController);
|
|
6358
6425
|
|
|
6426
|
+
/**
|
|
6427
|
+
* TODO
|
|
6428
|
+
* - global provider available in all contexts
|
|
6429
|
+
* - provider available in own context
|
|
6430
|
+
*/
|
|
6431
|
+
class BaseMiddleware extends BaseInjector {
|
|
6432
|
+
}
|
|
6433
|
+
|
|
6359
6434
|
class BaseMigration extends BaseInjector {
|
|
6360
6435
|
/**
|
|
6361
6436
|
* by default is READY to run
|
|
@@ -6550,6 +6625,7 @@ var Base;
|
|
|
6550
6625
|
Base.CustomRepository = BaseCustomRepository;
|
|
6551
6626
|
Base.SubscriberForEntity = BaseSubscriberForEntity;
|
|
6552
6627
|
Base.Migration = BaseMigration;
|
|
6628
|
+
Base.Middleware = BaseMiddleware;
|
|
6553
6629
|
Base.AngularService = BaseAngularsService;
|
|
6554
6630
|
Base.Context = BaseContext;
|
|
6555
6631
|
})(Base || (Base = {}));
|
|
@@ -6577,6 +6653,19 @@ function TaonEntity(options) {
|
|
|
6577
6653
|
class TaonEntityOptions extends Models.DecoratorAbstractOpt {
|
|
6578
6654
|
}
|
|
6579
6655
|
|
|
6656
|
+
/**
|
|
6657
|
+
* Provider decorator
|
|
6658
|
+
*/
|
|
6659
|
+
function TaonMiddleware(options) {
|
|
6660
|
+
return function (constructor) {
|
|
6661
|
+
Reflect.defineMetadata(Symbols.metadata.options.provider, options, constructor);
|
|
6662
|
+
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
6663
|
+
ClassHelpers.setName(constructor, options?.className || constructor.name);
|
|
6664
|
+
};
|
|
6665
|
+
}
|
|
6666
|
+
class TaonMiddlewareOptions extends Models.DecoratorAbstractOpt {
|
|
6667
|
+
}
|
|
6668
|
+
|
|
6580
6669
|
/**
|
|
6581
6670
|
* Migration decorator
|
|
6582
6671
|
*/
|
|
@@ -6635,6 +6724,7 @@ var Taon;
|
|
|
6635
6724
|
Taon.Repository = TaonRepository;
|
|
6636
6725
|
Taon.Subscriber = TaonSubscriber;
|
|
6637
6726
|
Taon.Migration = TaonMigration;
|
|
6727
|
+
Taon.Middleware = TaonMiddleware;
|
|
6638
6728
|
//#endregion
|
|
6639
6729
|
//#region aliases to helpers
|
|
6640
6730
|
Taon.isBrowser = coreHelpers.Helpers.isBrowser;
|