taon 21.0.53 → 21.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/bin/taon +5 -5
- package/bin/taon-debug +5 -5
- package/bin/taon-debug-brk +4 -4
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib-prod/base-classes/base-abstract-entity.js +17 -31
- package/lib-prod/base-classes/base-angular-service.js +83 -55
- package/lib-prod/base-classes/base-class.js +33 -35
- package/lib-prod/base-classes/base-context.js +17 -19
- package/lib-prod/base-classes/base-controller.js +146 -154
- package/lib-prod/base-classes/base-crud-controller.js +250 -221
- package/lib-prod/base-classes/base-custom-repository.js +7 -18
- package/lib-prod/base-classes/base-electron-service.js +49 -0
- package/lib-prod/base-classes/base-entity.js +20 -30
- package/lib-prod/base-classes/base-file-upload.middleware.js +72 -75
- package/lib-prod/base-classes/base-injector.js +176 -194
- package/lib-prod/base-classes/base-middleware.js +8 -5
- package/lib-prod/base-classes/base-migration.js +19 -22
- package/lib-prod/base-classes/base-provider.js +7 -5
- package/lib-prod/base-classes/base-repository.js +601 -573
- package/lib-prod/base-classes/base-subscriber-for-entity.js +143 -152
- package/lib-prod/base-classes/base.js +18 -0
- package/lib-prod/build-info._auto-generated_.js +26 -14
- package/lib-prod/config/controller-config.js +24 -24
- package/lib-prod/config/controller-options.js +2 -5
- package/lib-prod/config/method-config.js +6 -8
- package/lib-prod/config/param-config.js +2 -8
- package/lib-prod/constants.js +29 -25
- package/lib-prod/context-db-migrations.js +327 -324
- package/lib-prod/create-context.js +211 -146
- package/lib-prod/decorators/classes/controller-decorator.js +16 -20
- package/lib-prod/decorators/classes/entity-decorator.js +26 -47
- package/lib-prod/decorators/classes/middleware-decorator.js +14 -24
- package/lib-prod/decorators/classes/migration-decorator.js +13 -22
- package/lib-prod/decorators/classes/provider-decorator.js +13 -23
- package/lib-prod/decorators/classes/repository-decorator.js +13 -22
- package/lib-prod/decorators/classes/subscriber-decorator.js +13 -23
- package/lib-prod/decorators/decorator-abstract-opt.js +1 -4
- package/lib-prod/decorators/http/http-decorators.js +20 -5
- package/lib-prod/decorators/http/http-methods-decorators.js +91 -133
- package/lib-prod/decorators/http/http-params-decorators.js +36 -62
- package/lib-prod/dependency-injection/di-container.js +28 -29
- package/lib-prod/endpoint-context-storage.js +27 -32
- package/lib-prod/endpoint-context.js +2294 -1930
- package/lib-prod/entity-process.js +209 -198
- package/lib-prod/env/env.angular-node-app.js +66 -130
- package/lib-prod/env/env.docs-webapp.js +66 -130
- package/lib-prod/env/env.electron-app.js +66 -130
- package/lib-prod/env/env.mobile-app.js +66 -130
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +66 -130
- package/lib-prod/env/env.vscode-plugin.js +66 -130
- package/lib-prod/env/index.js +6 -6
- package/lib-prod/express-types.js +1 -0
- package/lib-prod/formly/formly.models.js +1 -0
- package/lib-prod/formly/fromly.js +196 -175
- package/lib-prod/formly/type-from-entity.js +45 -52
- package/lib-prod/get-response-value.js +21 -18
- package/lib-prod/global-state/taon-global-state/index.js +6 -5
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +18 -19
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +6 -9
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +40 -46
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +33 -46
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +10 -20
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +43 -33
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +10 -20
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +43 -44
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +20 -27
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +10 -10
- package/lib-prod/global-state/taon-transaction-registry/index.js +11 -10
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +20 -21
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +4 -7
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +34 -39
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +34 -54
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +10 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +7 -10
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +10 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +29 -34
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +20 -27
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +4 -5
- package/lib-prod/helpers/class-helpers.js +210 -177
- package/lib-prod/helpers/clone-obj.js +16 -20
- package/lib-prod/helpers/taon-helpers.js +132 -114
- package/lib-prod/index._auto-generated_.js +5 -0
- package/lib-prod/index.js +248 -227
- package/lib-prod/inject.js +88 -33
- package/lib-prod/migrations/index.js +2 -1
- package/lib-prod/migrations/migrations_index._auto-generated_.js +3 -0
- package/lib-prod/models.js +72 -103
- package/lib-prod/orm/columns.js +58 -118
- package/lib-prod/orm/index.js +56 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.js +188 -186
- package/lib-prod/realtime/realtime-core.js +77 -78
- package/lib-prod/realtime/realtime-server.js +225 -240
- package/lib-prod/realtime/realtime-strategy/index.js +4 -4
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +273 -219
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +267 -240
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +26 -20
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +10 -13
- package/lib-prod/realtime/realtime-subs-manager.js +82 -90
- package/lib-prod/realtime/realtime.models.js +2 -0
- package/lib-prod/symbols.js +104 -105
- package/lib-prod/ui/index.js +1 -5
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +1 -5
- package/lib-prod/validators.js +43 -37
- package/lib-prod.split-namespaces.json +31 -91
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
import { ClassHelpers__NS__setName } from
|
|
2
|
-
import { Symbols__NS__metadata } from
|
|
3
|
-
import { DecoratorAbstractOpt } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
options?.className || constructor.name,
|
|
14
|
-
constructor
|
|
15
|
-
);
|
|
16
|
-
ClassHelpers__NS__setName(constructor, options?.className);
|
|
17
|
-
};
|
|
1
|
+
import { ClassHelpers__NS__setName } from '../../helpers/class-helpers';
|
|
2
|
+
import { Symbols__NS__metadata } from '../../symbols';
|
|
3
|
+
import { DecoratorAbstractOpt } from '../decorator-abstract-opt';
|
|
4
|
+
/**
|
|
5
|
+
* Subscriber decorator
|
|
6
|
+
*/
|
|
7
|
+
export function TaonSubscriber(options) {
|
|
8
|
+
return function (constructor) {
|
|
9
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.subscriber, options, constructor);
|
|
10
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
11
|
+
ClassHelpers__NS__setName(constructor, options?.className);
|
|
12
|
+
};
|
|
18
13
|
}
|
|
19
|
-
class TaonSubscriberOptions extends DecoratorAbstractOpt {
|
|
20
|
-
allowedEvents;
|
|
14
|
+
export class TaonSubscriberOptions extends DecoratorAbstractOpt {
|
|
21
15
|
}
|
|
22
|
-
export {
|
|
23
|
-
TaonSubscriber,
|
|
24
|
-
TaonSubscriberOptions
|
|
25
|
-
};
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const HttpResponse =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Models } from 'ng2-rest/lib-prod';
|
|
2
|
+
export const HttpResponse = Models.HttpResponse;
|
|
3
|
+
// TODO new 5.8 typescript is not allowing this
|
|
4
|
+
// export namespace Http {
|
|
5
|
+
// export import GET = methods.GET;
|
|
6
|
+
// export import POST = methods.POST;
|
|
7
|
+
// export import PUT = methods.PUT;
|
|
8
|
+
// export import DELETE = methods.DELETE;
|
|
9
|
+
// export import PATCH = methods.PATCH;
|
|
10
|
+
// export import HEAD = methods.HEAD;
|
|
11
|
+
// export import HTML = methods.HTML;
|
|
12
|
+
// export import Response = Models.HttpResponse;
|
|
13
|
+
// export namespace Param {
|
|
14
|
+
// export import Query = params.Query;
|
|
15
|
+
// export import Path = params.Path;
|
|
16
|
+
// export import Body = params.Body;
|
|
17
|
+
// export import Cookie = params.Cookie;
|
|
18
|
+
// export import Header = params.Header;
|
|
19
|
+
// }
|
|
20
|
+
// }
|
|
@@ -1,144 +1,102 @@
|
|
|
1
|
-
import { ___NS__isString } from
|
|
2
|
-
import { ClassHelpers__NS__ensureMethodConfig } from
|
|
1
|
+
import { ___NS__isString } from 'tnp-core/lib-prod';
|
|
2
|
+
import { ClassHelpers__NS__ensureMethodConfig } from '../../helpers/class-helpers';
|
|
3
3
|
const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
overrideContentType,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
const methodConfig = ClassHelpers__NS__ensureMethodConfig(target, propertyKey);
|
|
5
|
+
let options;
|
|
6
|
+
if (typeof pathOrOptions === 'object') {
|
|
7
|
+
options = pathOrOptions;
|
|
8
|
+
pathOrOptions = options.path;
|
|
9
|
+
pathIsGlobal = !!options.pathIsGlobal;
|
|
10
|
+
path = options.path;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
options = { pathOrOptions, pathIsGlobal };
|
|
14
|
+
}
|
|
15
|
+
const { overrideContentType, overrideResponseType, overrideExpressSendAsHtml, middlewares, } = options;
|
|
16
|
+
methodConfig.methodName = propertyKey;
|
|
17
|
+
methodConfig.middlewares = middlewares;
|
|
18
|
+
methodConfig.type = method;
|
|
19
|
+
if (!path) {
|
|
20
|
+
let paramsPathConcatedPath = '';
|
|
21
|
+
for (const key in methodConfig.parameters) {
|
|
22
|
+
if (methodConfig.parameters.hasOwnProperty(key)) {
|
|
23
|
+
const element = methodConfig.parameters[key];
|
|
24
|
+
if (element.paramType === 'Path' &&
|
|
25
|
+
___NS__isString(element.paramName) &&
|
|
26
|
+
element.paramName.trim().length > 0) {
|
|
27
|
+
paramsPathConcatedPath += `/${element.paramName}/:${element.paramName}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
methodConfig.path = `/${propertyKey}${paramsPathConcatedPath}`;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
methodConfig.overrideExpressSendAsHtml = overrideExpressSendAsHtml;
|
|
33
|
+
else {
|
|
34
|
+
methodConfig.path = path;
|
|
35
|
+
}
|
|
36
|
+
methodConfig.descriptor = descriptor;
|
|
37
|
+
methodConfig.global = pathIsGlobal;
|
|
38
|
+
methodConfig.contentType = overrideContentType;
|
|
39
|
+
methodConfig.responseType = overrideResponseType;
|
|
40
|
+
methodConfig.overrideExpressSendAsHtml = overrideExpressSendAsHtml;
|
|
42
41
|
};
|
|
43
|
-
function GET(pathOrOptions, pathIsGlobal = false) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
pathOrOptions,
|
|
48
|
-
target,
|
|
49
|
-
propertyKey,
|
|
50
|
-
descriptor,
|
|
51
|
-
pathOrOptions,
|
|
52
|
-
pathIsGlobal
|
|
53
|
-
);
|
|
54
|
-
};
|
|
42
|
+
export function GET(pathOrOptions, pathIsGlobal = false) {
|
|
43
|
+
return function (target, propertyKey, descriptor) {
|
|
44
|
+
metaReq('get', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
45
|
+
};
|
|
55
46
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Method for sending html website from text
|
|
49
|
+
* Example
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* ...
|
|
53
|
+
* // in your taon controller
|
|
54
|
+
* ..Taon.Http.HTML()
|
|
55
|
+
* sendHtmlDummyWebsite(): Taon.ResponseHtml {
|
|
56
|
+
* return `
|
|
57
|
+
<html>
|
|
58
|
+
<head>
|
|
59
|
+
<title>Dummy website</title>
|
|
60
|
+
</head>
|
|
61
|
+
<body>
|
|
62
|
+
<h1>This is dummy website</h1>
|
|
63
|
+
<p>Served as HTML string from Taon controller method</p>
|
|
64
|
+
</body>
|
|
65
|
+
</html>
|
|
66
|
+
* `; *
|
|
67
|
+
* }
|
|
68
|
+
* ...
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export function HTML(pathOrOptions) {
|
|
72
|
+
return function (target, propertyKey, descriptor) {
|
|
73
|
+
const opt = pathOrOptions;
|
|
74
|
+
opt.overrideExpressSendAsHtml = true;
|
|
75
|
+
metaReq('get', opt, target, propertyKey, descriptor, pathOrOptions, opt.pathIsGlobal);
|
|
76
|
+
};
|
|
70
77
|
}
|
|
71
|
-
function HEAD(pathOrOptions, pathIsGlobal = false) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
pathOrOptions,
|
|
76
|
-
target,
|
|
77
|
-
propertyKey,
|
|
78
|
-
descriptor,
|
|
79
|
-
pathOrOptions,
|
|
80
|
-
pathIsGlobal
|
|
81
|
-
);
|
|
82
|
-
};
|
|
78
|
+
export function HEAD(pathOrOptions, pathIsGlobal = false) {
|
|
79
|
+
return function (target, propertyKey, descriptor) {
|
|
80
|
+
metaReq('head', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
81
|
+
};
|
|
83
82
|
}
|
|
84
|
-
function POST(pathOrOptions, pathIsGlobal = false) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
pathOrOptions,
|
|
89
|
-
target,
|
|
90
|
-
propertyKey,
|
|
91
|
-
descriptor,
|
|
92
|
-
pathOrOptions,
|
|
93
|
-
pathIsGlobal
|
|
94
|
-
);
|
|
95
|
-
};
|
|
83
|
+
export function POST(pathOrOptions, pathIsGlobal = false) {
|
|
84
|
+
return function (target, propertyKey, descriptor) {
|
|
85
|
+
metaReq('post', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
86
|
+
};
|
|
96
87
|
}
|
|
97
|
-
function PUT(pathOrOptions, pathIsGlobal = false) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
pathOrOptions,
|
|
102
|
-
target,
|
|
103
|
-
propertyKey,
|
|
104
|
-
descriptor,
|
|
105
|
-
pathOrOptions,
|
|
106
|
-
pathIsGlobal
|
|
107
|
-
);
|
|
108
|
-
};
|
|
88
|
+
export function PUT(pathOrOptions, pathIsGlobal = false) {
|
|
89
|
+
return function (target, propertyKey, descriptor) {
|
|
90
|
+
metaReq('put', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
91
|
+
};
|
|
109
92
|
}
|
|
110
|
-
function PATCH(pathOrOptions, pathIsGlobal = false) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
pathOrOptions,
|
|
115
|
-
target,
|
|
116
|
-
propertyKey,
|
|
117
|
-
descriptor,
|
|
118
|
-
pathOrOptions,
|
|
119
|
-
pathIsGlobal
|
|
120
|
-
);
|
|
121
|
-
};
|
|
93
|
+
export function PATCH(pathOrOptions, pathIsGlobal = false) {
|
|
94
|
+
return function (target, propertyKey, descriptor) {
|
|
95
|
+
metaReq('patch', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
96
|
+
};
|
|
122
97
|
}
|
|
123
|
-
function DELETE(pathOrOptions, pathIsGlobal = false) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
pathOrOptions,
|
|
128
|
-
target,
|
|
129
|
-
propertyKey,
|
|
130
|
-
descriptor,
|
|
131
|
-
pathOrOptions,
|
|
132
|
-
pathIsGlobal
|
|
133
|
-
);
|
|
134
|
-
};
|
|
98
|
+
export function DELETE(pathOrOptions, pathIsGlobal = false) {
|
|
99
|
+
return function (target, propertyKey, descriptor) {
|
|
100
|
+
metaReq('delete', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
101
|
+
};
|
|
135
102
|
}
|
|
136
|
-
export {
|
|
137
|
-
DELETE,
|
|
138
|
-
GET,
|
|
139
|
-
HEAD,
|
|
140
|
-
HTML,
|
|
141
|
-
PATCH,
|
|
142
|
-
POST,
|
|
143
|
-
PUT
|
|
144
|
-
};
|
|
@@ -1,68 +1,42 @@
|
|
|
1
|
-
import { ClassHelpers__NS__ensureMethodConfig } from
|
|
2
|
-
function metaParam(param, name, expire, defaultValue =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { ClassHelpers__NS__ensureMethodConfig } from '../../helpers/class-helpers';
|
|
2
|
+
function metaParam(param, name, expire, defaultValue = undefined, target, propertyKey, parameterIndex) {
|
|
3
|
+
const methodCfg = ClassHelpers__NS__ensureMethodConfig(target, propertyKey);
|
|
4
|
+
const nameKey = name ? name : param;
|
|
5
|
+
// const key = name || `${param}_${parameterIndex}`;
|
|
6
|
+
methodCfg.parameters[nameKey] = {
|
|
7
|
+
index: parameterIndex,
|
|
8
|
+
paramName: name,
|
|
9
|
+
paramType: param,
|
|
10
|
+
defaultType: defaultValue,
|
|
11
|
+
expireInSeconds: expire,
|
|
12
|
+
};
|
|
13
|
+
// console.log('params updated', methodConfig);
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated use Taon.Http.Param.Path (is more safe and cleaner)
|
|
17
|
+
*/
|
|
18
|
+
export function Path(name) {
|
|
19
|
+
return function (target, propertyKey, parameterIndex) {
|
|
20
|
+
metaParam('Path', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
21
|
+
};
|
|
17
22
|
}
|
|
18
|
-
function Query(name) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
name,
|
|
23
|
-
void 0,
|
|
24
|
-
{},
|
|
25
|
-
target,
|
|
26
|
-
propertyKey,
|
|
27
|
-
parameterIndex
|
|
28
|
-
);
|
|
29
|
-
};
|
|
23
|
+
export function Query(name) {
|
|
24
|
+
return function (target, propertyKey, parameterIndex) {
|
|
25
|
+
metaParam('Query', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
26
|
+
};
|
|
30
27
|
}
|
|
31
|
-
function Cookie(name, expireInSecond = 3600) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
name,
|
|
36
|
-
expireInSecond,
|
|
37
|
-
{},
|
|
38
|
-
target,
|
|
39
|
-
propertyKey,
|
|
40
|
-
parameterIndex
|
|
41
|
-
);
|
|
42
|
-
};
|
|
28
|
+
export function Cookie(name, expireInSecond = 3600) {
|
|
29
|
+
return function (target, propertyKey, parameterIndex) {
|
|
30
|
+
metaParam('Cookie', name, expireInSecond, {}, target, propertyKey, parameterIndex);
|
|
31
|
+
};
|
|
43
32
|
}
|
|
44
|
-
function Header(name) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
name,
|
|
49
|
-
void 0,
|
|
50
|
-
{},
|
|
51
|
-
target,
|
|
52
|
-
propertyKey,
|
|
53
|
-
parameterIndex
|
|
54
|
-
);
|
|
55
|
-
};
|
|
33
|
+
export function Header(name) {
|
|
34
|
+
return function (target, propertyKey, parameterIndex) {
|
|
35
|
+
metaParam('Header', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
36
|
+
};
|
|
56
37
|
}
|
|
57
|
-
function Body(name) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
38
|
+
export function Body(name) {
|
|
39
|
+
return function (target, propertyKey, parameterIndex) {
|
|
40
|
+
metaParam('Body', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
41
|
+
};
|
|
61
42
|
}
|
|
62
|
-
export {
|
|
63
|
-
Body,
|
|
64
|
-
Cookie,
|
|
65
|
-
Header,
|
|
66
|
-
Path,
|
|
67
|
-
Query
|
|
68
|
-
};
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
class DITaonContainer {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
const injections = [];
|
|
8
|
-
const instance = new target(...injections);
|
|
9
|
-
DITaonContainer.instances.set(target, instance);
|
|
10
|
-
return instance;
|
|
11
|
-
}
|
|
12
|
-
static inject(target) {
|
|
13
|
-
return new Proxy(
|
|
14
|
-
{},
|
|
15
|
-
{
|
|
16
|
-
get: (_, propName) => {
|
|
17
|
-
let instance = DITaonContainer.instances.get(target) || DITaonContainer.resolve(target);
|
|
18
|
-
return typeof instance[propName] === "function" ? instance[propName].bind(instance) : instance[propName];
|
|
19
|
-
},
|
|
20
|
-
set: (_, propName, value) => {
|
|
21
|
-
let instance = DITaonContainer.instances.get(target) || DITaonContainer.resolve(target);
|
|
22
|
-
instance[propName] = value;
|
|
23
|
-
return true;
|
|
1
|
+
export class DITaonContainer {
|
|
2
|
+
static { this.instances = new Map(); }
|
|
3
|
+
static resolve(target) {
|
|
4
|
+
if (DITaonContainer.instances.has(target)) {
|
|
5
|
+
return DITaonContainer.instances.get(target);
|
|
24
6
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
// const tokens = Reflect.getMetadata('design:paramtypes', target) || [];
|
|
8
|
+
const injections = []; // tokens.map(token => Container.inject<any>(token));
|
|
9
|
+
const instance = new target(...injections);
|
|
10
|
+
DITaonContainer.instances.set(target, instance);
|
|
11
|
+
return instance;
|
|
12
|
+
}
|
|
13
|
+
static inject(target) {
|
|
14
|
+
return new Proxy({}, {
|
|
15
|
+
get: (_, propName) => {
|
|
16
|
+
let instance = DITaonContainer.instances.get(target) ||
|
|
17
|
+
DITaonContainer.resolve(target);
|
|
18
|
+
return typeof instance[propName] === 'function'
|
|
19
|
+
? instance[propName].bind(instance)
|
|
20
|
+
: instance[propName];
|
|
21
|
+
},
|
|
22
|
+
set: (_, propName, value) => {
|
|
23
|
+
let instance = DITaonContainer.instances.get(target) ||
|
|
24
|
+
DITaonContainer.resolve(target);
|
|
25
|
+
instance[propName] = value;
|
|
26
|
+
return true;
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
|
-
export {
|
|
30
|
-
DITaonContainer
|
|
31
|
-
};
|
|
@@ -1,36 +1,31 @@
|
|
|
1
|
-
import { CoreModels__NS__SPECIAL_APP_READY_MESSAGE } from
|
|
2
|
-
class ContextsEndpointStorage {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
constructor() {
|
|
8
|
-
}
|
|
9
|
-
static get Instance() {
|
|
10
|
-
if (!ContextsEndpointStorage.instance) {
|
|
11
|
-
ContextsEndpointStorage.instance = new ContextsEndpointStorage();
|
|
1
|
+
import { CoreModels__NS__SPECIAL_APP_READY_MESSAGE } from 'tnp-core/lib-prod';
|
|
2
|
+
export class ContextsEndpointStorage {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.SPECIAL_APP_READY_MESSAGE = CoreModels__NS__SPECIAL_APP_READY_MESSAGE;
|
|
5
|
+
this.taonEndpointContexts = new Map();
|
|
6
|
+
// Private constructor to prevent direct instantiation
|
|
12
7
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.taonEndpointContexts.set(context.contextName, context);
|
|
8
|
+
static get Instance() {
|
|
9
|
+
if (!ContextsEndpointStorage.instance) {
|
|
10
|
+
ContextsEndpointStorage.instance = new ContextsEndpointStorage();
|
|
11
|
+
}
|
|
12
|
+
return ContextsEndpointStorage.instance;
|
|
19
13
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
//#endregion
|
|
15
|
+
set(context) {
|
|
16
|
+
if (!this.taonEndpointContexts.has(context.contextName)) {
|
|
17
|
+
this.taonEndpointContexts.set(context.contextName, context);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
get arr() {
|
|
21
|
+
return Array.from(this.taonEndpointContexts.values()).filter(f => f.contextType === 'normal');
|
|
22
|
+
}
|
|
23
|
+
getBy(context) {
|
|
24
|
+
if (typeof context === 'string') {
|
|
25
|
+
return this.taonEndpointContexts.get(context);
|
|
26
|
+
}
|
|
27
|
+
return this.taonEndpointContexts.get(context.contextName);
|
|
29
28
|
}
|
|
30
|
-
return this.taonEndpointContexts.get(context.contextName);
|
|
31
|
-
}
|
|
32
29
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
ContextsEndpointStorage
|
|
36
|
-
};
|
|
30
|
+
// TODO QUICK_FIX @LAST encapsulate this => move to separate package
|
|
31
|
+
globalThis['$$$ContextsEndpointStorage$$$'] = ContextsEndpointStorage.Instance;
|