taon 21.0.53 → 21.0.55
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/icon-menu-taon.svg +15 -15
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/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 +328 -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 +32 -86
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
|
@@ -1,152 +1,217 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
//#region imports
|
|
2
|
+
import { ___NS__isString, Helpers__NS__log, UtilsOs__NS__isRunningInDocker } from 'tnp-core/lib-prod';
|
|
3
|
+
import { EndpointContext } from './endpoint-context';
|
|
4
|
+
/* */
|
|
5
|
+
import { ContextsEndpointStorage } from './endpoint-context-storage';
|
|
6
|
+
//#endregion
|
|
7
|
+
/**
|
|
8
|
+
* @returns function that returns context function.
|
|
9
|
+
* Context function can be used to dynamically
|
|
10
|
+
* create context with specific configuration.
|
|
11
|
+
*/
|
|
12
|
+
export const createContextTemplate = (configFn) => {
|
|
13
|
+
return () => {
|
|
14
|
+
return createContext(configFn);
|
|
15
|
+
};
|
|
8
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* REQURIED PROPERTY:
|
|
19
|
+
* - contextName
|
|
20
|
+
*/
|
|
9
21
|
const createContextFn = (configFn, cloneOptions) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return endpointContextRef;
|
|
56
|
-
},
|
|
57
|
-
/**
|
|
58
|
-
* only for internal use
|
|
59
|
-
* @deprecated
|
|
60
|
-
*/
|
|
61
|
-
get __refSync() {
|
|
62
|
-
return endpointContextRef;
|
|
63
|
-
},
|
|
64
|
-
getClassInstance(ctor) {
|
|
65
|
-
return endpointContextRef.getInstanceBy(ctor);
|
|
66
|
-
},
|
|
67
|
-
getClass(ctor) {
|
|
68
|
-
const classFun = endpointContextRef.getClassFunByClass(ctor);
|
|
69
|
-
return classFun;
|
|
70
|
-
},
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region initialize
|
|
73
|
-
/**
|
|
74
|
-
* - create controller instances for context
|
|
75
|
-
* - init database (if enable) + migation scripts
|
|
76
|
-
*/
|
|
77
|
-
initialize: async (overrideOptions) => {
|
|
78
|
-
return await new Promise(async (resolve, reject) => {
|
|
79
|
-
setTimeout(async () => {
|
|
80
|
-
if (UtilsOs__NS__isRunningInDocker()) {
|
|
81
|
-
const activeContext = config?.activeContext || null;
|
|
82
|
-
if (___NS__isString(activeContext) && activeContext !== "" && activeContext !== config?.contextName) {
|
|
83
|
-
console.warn(
|
|
84
|
-
`[taon] Context ${endpointContextRef.contextName} is not active context, skipping initialization.`
|
|
85
|
-
);
|
|
86
|
-
resolve(endpointContextRef);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
await endpointContextRef.init({
|
|
91
|
-
...overrideOptions
|
|
92
|
-
});
|
|
93
|
-
if (config.abstract) {
|
|
94
|
-
throw new Error(`Abstract context can not be initialized`);
|
|
95
|
-
}
|
|
96
|
-
await endpointContextRef.initEntities();
|
|
97
|
-
await endpointContextRef.initSubscribers();
|
|
98
|
-
await endpointContextRef.initDatabaseConnection();
|
|
99
|
-
await endpointContextRef.dbMigrations.ensureMigrationTableExists();
|
|
100
|
-
await endpointContextRef.initControllers();
|
|
101
|
-
await endpointContextRef.startServer();
|
|
102
|
-
endpointContextRef.writeActiveRoutes();
|
|
103
|
-
await endpointContextRef.initClasses();
|
|
104
|
-
if (endpointContextRef.databaseConfig) {
|
|
105
|
-
if (endpointContextRef.onlyMigrationRun) {
|
|
106
|
-
endpointContextRef.logMigrations && Helpers__NS__log(
|
|
107
|
-
`[taon] Running only migrations (context=${endpointContextRef.contextName}).`
|
|
108
|
-
);
|
|
109
|
-
await endpointContextRef.dbMigrations.runAllNotCompletedMigrations();
|
|
110
|
-
} else if (endpointContextRef.onlyMigrationRevertToTimestamp) {
|
|
111
|
-
endpointContextRef.logMigrations && Helpers__NS__log(
|
|
112
|
-
`[taon] Reverting migrations to timestamp ${endpointContextRef.onlyMigrationRevertToTimestamp} (context=${endpointContextRef.contextName}).`
|
|
113
|
-
);
|
|
114
|
-
await endpointContextRef.dbMigrations.revertMigrationToTimestamp(
|
|
115
|
-
endpointContextRef.onlyMigrationRevertToTimestamp
|
|
116
|
-
);
|
|
117
|
-
} else {
|
|
118
|
-
endpointContextRef.logMigrations && Helpers__NS__log(
|
|
119
|
-
`[taon] Running all not applied migrations (context=${endpointContextRef.contextName}).`
|
|
120
|
-
);
|
|
121
|
-
await endpointContextRef.dbMigrations.runAllNotCompletedMigrations();
|
|
22
|
+
cloneOptions = cloneOptions || {};
|
|
23
|
+
let config = configFn({});
|
|
24
|
+
// console.log(
|
|
25
|
+
// `
|
|
26
|
+
// [Taon] Creating context ${config.contextName}...`,
|
|
27
|
+
// {config},
|
|
28
|
+
// );
|
|
29
|
+
const endpointContextRef = new EndpointContext(config, configFn, cloneOptions);
|
|
30
|
+
const res = {
|
|
31
|
+
//#region contexts
|
|
32
|
+
get contextName() {
|
|
33
|
+
return config.contextName;
|
|
34
|
+
},
|
|
35
|
+
//#endregion
|
|
36
|
+
get appId() {
|
|
37
|
+
return config.appId;
|
|
38
|
+
},
|
|
39
|
+
cloneAsRemote: (cloneOpt) => {
|
|
40
|
+
cloneOpt = cloneOpt || {};
|
|
41
|
+
const opt = {
|
|
42
|
+
...cloneOpt,
|
|
43
|
+
sourceContext: endpointContextRef,
|
|
44
|
+
useAsRemoteContext: true,
|
|
45
|
+
};
|
|
46
|
+
return createContextFn(configFn, opt);
|
|
47
|
+
},
|
|
48
|
+
cloneAsNormal: (cloneOpt) => {
|
|
49
|
+
cloneOpt = cloneOpt || {};
|
|
50
|
+
const opt = {
|
|
51
|
+
...cloneOpt,
|
|
52
|
+
sourceContext: endpointContextRef,
|
|
53
|
+
useAsRemoteContext: false,
|
|
54
|
+
};
|
|
55
|
+
return createContextFn(configFn, opt);
|
|
56
|
+
},
|
|
57
|
+
//#region context
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated
|
|
60
|
+
* - get reference to internal context
|
|
61
|
+
*/
|
|
62
|
+
async __ref() {
|
|
63
|
+
if (!endpointContextRef.inited) {
|
|
64
|
+
await endpointContextRef.init({
|
|
65
|
+
initFromRecrusiveContextResovle: true,
|
|
66
|
+
});
|
|
122
67
|
}
|
|
123
|
-
|
|
124
|
-
ContextsEndpointStorage.Instance.set(endpointContextRef);
|
|
125
|
-
resolve(endpointContextRef);
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
},
|
|
129
|
-
/**
|
|
130
|
-
* realtime communication with server
|
|
131
|
-
* TCP(upgrade) socket.io (or ipc) based.
|
|
132
|
-
*/
|
|
133
|
-
get realtime() {
|
|
134
|
-
return {
|
|
135
|
-
get client() {
|
|
136
|
-
return endpointContextRef.realtimeClient;
|
|
68
|
+
return endpointContextRef;
|
|
137
69
|
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
70
|
+
/**
|
|
71
|
+
* only for internal use
|
|
72
|
+
* @deprecated
|
|
73
|
+
*/
|
|
74
|
+
get __refSync() {
|
|
75
|
+
return endpointContextRef;
|
|
76
|
+
},
|
|
77
|
+
getClassInstance(ctor) {
|
|
78
|
+
return endpointContextRef.getInstanceBy(ctor);
|
|
79
|
+
},
|
|
80
|
+
getClass(ctor) {
|
|
81
|
+
const classFun = endpointContextRef.getClassFunByClass(ctor);
|
|
82
|
+
return classFun;
|
|
83
|
+
//#region old
|
|
84
|
+
// TODO hmmmm for now context for controller inside api service
|
|
85
|
+
// const allContexts = Object.values(classFun[Symbols__NS__orignalClassClonesObj] || {}).map(classFn => {
|
|
86
|
+
// return {
|
|
87
|
+
// ctx: classFn[Symbols__NS__ctxInClassOrClassObj] as EndpointContext,
|
|
88
|
+
// classFn,
|
|
89
|
+
// }
|
|
90
|
+
// })
|
|
91
|
+
// const activeContext = allContexts.find(c => c.ctx.inited);
|
|
92
|
+
// debugger
|
|
93
|
+
// console.log('activeContext', activeContext.ctx.contextName);
|
|
94
|
+
// return activeContext.ctx.getClassFunByClass(ctor) as any;
|
|
95
|
+
//#endregion
|
|
96
|
+
},
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region initialize
|
|
99
|
+
/**
|
|
100
|
+
* - create controller instances for context
|
|
101
|
+
* - init database (if enable) + migation scripts
|
|
102
|
+
*/
|
|
103
|
+
initialize: async (overrideOptions) => {
|
|
104
|
+
return await new Promise(async (resolve, reject) => {
|
|
105
|
+
//#region init in set timeout
|
|
106
|
+
setTimeout(async () => {
|
|
107
|
+
if (UtilsOs__NS__isRunningInDocker()) {
|
|
108
|
+
const activeContext = config?.activeContext || null;
|
|
109
|
+
if (___NS__isString(activeContext) &&
|
|
110
|
+
activeContext !== '' &&
|
|
111
|
+
activeContext !== config?.contextName) {
|
|
112
|
+
console.warn(`[taon] Context ${endpointContextRef.contextName} is not active context, skipping initialization.`);
|
|
113
|
+
resolve(endpointContextRef);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
await endpointContextRef.init({
|
|
118
|
+
...overrideOptions,
|
|
119
|
+
});
|
|
120
|
+
if (config.abstract) {
|
|
121
|
+
throw new Error(`Abstract context can not be initialized`);
|
|
122
|
+
}
|
|
123
|
+
await endpointContextRef.initEntities();
|
|
124
|
+
await endpointContextRef.initSubscribers();
|
|
125
|
+
await endpointContextRef.initDatabaseConnection();
|
|
126
|
+
await endpointContextRef.dbMigrations.ensureMigrationTableExists();
|
|
127
|
+
// console.log(
|
|
128
|
+
// 'connection subscribers',
|
|
129
|
+
// endpointContextRef?.connection?.subscribers,
|
|
130
|
+
// );
|
|
131
|
+
// debugger;
|
|
132
|
+
await endpointContextRef.initControllers();
|
|
133
|
+
await endpointContextRef.startServer();
|
|
134
|
+
//#region @websql
|
|
135
|
+
endpointContextRef.writeActiveRoutes();
|
|
136
|
+
//#endregion
|
|
137
|
+
await endpointContextRef.initClasses();
|
|
138
|
+
if (endpointContextRef.databaseConfig) {
|
|
139
|
+
//#region handle websql reload data
|
|
140
|
+
/* */
|
|
141
|
+
/* */
|
|
142
|
+
/* */
|
|
143
|
+
/* */
|
|
144
|
+
/* */
|
|
145
|
+
/* */
|
|
146
|
+
/* */
|
|
147
|
+
/* */
|
|
148
|
+
/* */
|
|
149
|
+
/* */
|
|
150
|
+
/* */
|
|
151
|
+
/* */
|
|
152
|
+
/* */
|
|
153
|
+
/* */
|
|
154
|
+
/* */
|
|
155
|
+
/* */
|
|
156
|
+
/* */
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region TODO this may be usefull but for now
|
|
159
|
+
// 2 separate contexts are fine
|
|
160
|
+
// const shouldStartRemoteHost = endpointContextRef.mode !== 'remote-backend(tcp+udp)';
|
|
161
|
+
// if(shouldStartRemoteHost) {
|
|
162
|
+
// const endpointContextRemoteHostRef = new EndpointContext(config, configFn);
|
|
163
|
+
// await endpointContextRemoteHostRef.init({
|
|
164
|
+
// overrideRemoteHost: endpointContextRef.host,
|
|
165
|
+
// overrideHost: null,
|
|
166
|
+
// });
|
|
167
|
+
// endpointContextRemoteHostRef.initMetadata();
|
|
168
|
+
// endpointContextRef.__contextForControllerInstanceAccess = endpointContextRemoteHostRef;
|
|
169
|
+
// }
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region run migrations tasks
|
|
172
|
+
if (endpointContextRef.onlyMigrationRun) {
|
|
173
|
+
endpointContextRef.logMigrations &&
|
|
174
|
+
Helpers__NS__log(`[taon] Running only migrations (context=${endpointContextRef.contextName}).`);
|
|
175
|
+
await endpointContextRef.dbMigrations.runAllNotCompletedMigrations();
|
|
176
|
+
}
|
|
177
|
+
else if (endpointContextRef.onlyMigrationRevertToTimestamp) {
|
|
178
|
+
endpointContextRef.logMigrations &&
|
|
179
|
+
Helpers__NS__log(`[taon] Reverting migrations to timestamp ${endpointContextRef.onlyMigrationRevertToTimestamp} (context=${endpointContextRef.contextName}).`);
|
|
180
|
+
await endpointContextRef.dbMigrations.revertMigrationToTimestamp(endpointContextRef.onlyMigrationRevertToTimestamp);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
endpointContextRef.logMigrations &&
|
|
184
|
+
Helpers__NS__log(`[taon] Running all not applied migrations (context=${endpointContextRef.contextName}).`);
|
|
185
|
+
await endpointContextRef.dbMigrations.runAllNotCompletedMigrations();
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
}
|
|
189
|
+
ContextsEndpointStorage.Instance.set(endpointContextRef);
|
|
190
|
+
resolve(endpointContextRef);
|
|
191
|
+
});
|
|
192
|
+
//#endregion
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* realtime communication with server
|
|
197
|
+
* TCP(upgrade) socket.io (or ipc) based.
|
|
198
|
+
*/
|
|
199
|
+
get realtime() {
|
|
200
|
+
return {
|
|
201
|
+
get client() {
|
|
202
|
+
return endpointContextRef.realtimeClient;
|
|
203
|
+
},
|
|
204
|
+
get server() {
|
|
205
|
+
return endpointContextRef.realtimeServer;
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
return res;
|
|
148
211
|
};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
212
|
+
//#endregion
|
|
213
|
+
export const createContext = (configFn) => {
|
|
214
|
+
return createContextFn(configFn, { useAsRemoteContext: false });
|
|
152
215
|
};
|
|
216
|
+
// const AA = createContext(() => ({ contextName: 'aa' }));
|
|
217
|
+
// const BB = AA.cloneAsRemoteContext();
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { ClassHelpers__NS__ensureClassConfig, ClassHelpers__NS__setName } from
|
|
2
|
-
import { Symbols__NS__metadata } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
1
|
+
import { ClassHelpers__NS__ensureClassConfig, ClassHelpers__NS__setName } from '../../helpers/class-helpers';
|
|
2
|
+
import { Symbols__NS__metadata } from '../../symbols';
|
|
3
|
+
/**
|
|
4
|
+
* Controller decorator
|
|
5
|
+
*/
|
|
6
|
+
export function TaonController(options) {
|
|
7
|
+
return function (constructor) {
|
|
8
|
+
ClassHelpers__NS__setName(constructor, options?.className);
|
|
9
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
10
|
+
const cfg = ClassHelpers__NS__ensureClassConfig(constructor);
|
|
11
|
+
options = options || {};
|
|
12
|
+
cfg.className = options.className || constructor.name;
|
|
13
|
+
cfg.path = options.path || '';
|
|
14
|
+
cfg.realtime = options.realtime;
|
|
15
|
+
cfg.middlewares = options.middlewares;
|
|
16
|
+
};
|
|
18
17
|
}
|
|
19
|
-
export {
|
|
20
|
-
TaonController
|
|
21
|
-
};
|
|
@@ -1,49 +1,28 @@
|
|
|
1
|
-
import { Mapping__NS__DefaultModelWithMapping } from
|
|
2
|
-
import { Entity } from
|
|
3
|
-
import { ___NS__merge } from
|
|
4
|
-
import { CLASS } from
|
|
5
|
-
import { ClassHelpers__NS__setName } from
|
|
6
|
-
import { Symbols__NS__metadata } from
|
|
7
|
-
import { DecoratorAbstractOpt } from
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
options?.defaultModelMapping || {},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Reflect.defineMetadata(
|
|
27
|
-
Symbols__NS__metadata.className,
|
|
28
|
-
options?.className || constructor.name,
|
|
29
|
-
constructor
|
|
30
|
-
);
|
|
31
|
-
Entity(options?.className)(constructor);
|
|
32
|
-
CLASS.setName(constructor, options?.className);
|
|
33
|
-
};
|
|
1
|
+
import { Mapping__NS__DefaultModelWithMapping } from 'ng2-rest/lib-prod';
|
|
2
|
+
import { Entity } from 'taon-typeorm/lib-prod';
|
|
3
|
+
import { ___NS__merge } from 'tnp-core/lib-prod';
|
|
4
|
+
import { CLASS } from 'typescript-class-helpers/lib-prod';
|
|
5
|
+
import { ClassHelpers__NS__setName } from '../../helpers/class-helpers';
|
|
6
|
+
import { Symbols__NS__metadata } from '../../symbols';
|
|
7
|
+
import { DecoratorAbstractOpt } from '../decorator-abstract-opt';
|
|
8
|
+
/**
|
|
9
|
+
* Entity decorator
|
|
10
|
+
*/
|
|
11
|
+
export function TaonEntity(options) {
|
|
12
|
+
return function (constructor) {
|
|
13
|
+
options = options || {};
|
|
14
|
+
options.uniqueKeyProp = options.uniqueKeyProp || 'id';
|
|
15
|
+
ClassHelpers__NS__setName(constructor, options?.className);
|
|
16
|
+
Mapping__NS__DefaultModelWithMapping(options?.defaultModelValues || {}, ___NS__merge(options?.defaultModelMapping || {}, (options?.defaultModelMappingDeep || {})))(constructor);
|
|
17
|
+
// TODO when entit metadata generator read use this
|
|
18
|
+
Mapping__NS__DefaultModelWithMapping(void 0, {})(constructor);
|
|
19
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.entity, options, constructor);
|
|
20
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
21
|
+
//#region @websql
|
|
22
|
+
Entity(options?.className)(constructor);
|
|
23
|
+
//#endregion
|
|
24
|
+
CLASS.setName(constructor, options?.className); // TODO QUICK_FIX for ng2-rest
|
|
25
|
+
};
|
|
34
26
|
}
|
|
35
|
-
class TaonEntityOptions extends DecoratorAbstractOpt {
|
|
36
|
-
/**
|
|
37
|
-
* default unique property is "id"
|
|
38
|
-
* for your entity it may be something else
|
|
39
|
-
*/
|
|
40
|
-
uniqueKeyProp;
|
|
41
|
-
createTable;
|
|
42
|
-
defaultModelValues;
|
|
43
|
-
defaultModelMapping;
|
|
44
|
-
defaultModelMappingDeep;
|
|
27
|
+
export class TaonEntityOptions extends DecoratorAbstractOpt {
|
|
45
28
|
}
|
|
46
|
-
export {
|
|
47
|
-
TaonEntity,
|
|
48
|
-
TaonEntityOptions
|
|
49
|
-
};
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ClassHelpers__NS__setName } from
|
|
3
|
-
import { Symbols__NS__metadata } from
|
|
4
|
-
import { DecoratorAbstractOpt } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
options?.className || constructor.name,
|
|
15
|
-
constructor
|
|
16
|
-
);
|
|
17
|
-
ClassHelpers__NS__setName(constructor, options?.className || constructor.name);
|
|
18
|
-
};
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { ClassHelpers__NS__setName } from '../../helpers/class-helpers';
|
|
3
|
+
import { Symbols__NS__metadata } from '../../symbols';
|
|
4
|
+
import { DecoratorAbstractOpt } from '../decorator-abstract-opt';
|
|
5
|
+
/**
|
|
6
|
+
* Provider decorator
|
|
7
|
+
*/
|
|
8
|
+
export function TaonMiddleware(options) {
|
|
9
|
+
return function (constructor) {
|
|
10
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.provider, options, constructor);
|
|
11
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
12
|
+
ClassHelpers__NS__setName(constructor, options?.className || constructor.name);
|
|
13
|
+
};
|
|
19
14
|
}
|
|
20
|
-
class TaonMiddlewareOptions extends DecoratorAbstractOpt {
|
|
21
|
-
// middleware is a singleton for each context
|
|
15
|
+
export class TaonMiddlewareOptions extends DecoratorAbstractOpt {
|
|
22
16
|
}
|
|
23
|
-
export {
|
|
24
|
-
TaonMiddleware,
|
|
25
|
-
TaonMiddlewareOptions
|
|
26
|
-
};
|
|
@@ -1,24 +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
|
+
* Migration decorator
|
|
6
|
+
*/
|
|
7
|
+
export function TaonMigration(options) {
|
|
8
|
+
return function (constructor) {
|
|
9
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.migration, 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 TaonMigrationOptions extends DecoratorAbstractOpt {
|
|
14
|
+
export class TaonMigrationOptions extends DecoratorAbstractOpt {
|
|
20
15
|
}
|
|
21
|
-
export {
|
|
22
|
-
TaonMigration,
|
|
23
|
-
TaonMigrationOptions
|
|
24
|
-
};
|
|
@@ -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 || constructor.name);
|
|
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
|
+
* Provider decorator
|
|
6
|
+
*/
|
|
7
|
+
export function TaonProvider(options) {
|
|
8
|
+
return function (constructor) {
|
|
9
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.provider, options, constructor);
|
|
10
|
+
Reflect.defineMetadata(Symbols__NS__metadata.className, options?.className || constructor.name, constructor);
|
|
11
|
+
ClassHelpers__NS__setName(constructor, options?.className || constructor.name);
|
|
12
|
+
};
|
|
18
13
|
}
|
|
19
|
-
class TaonProviderOptions extends DecoratorAbstractOpt {
|
|
20
|
-
// providers is a singleton for each context
|
|
14
|
+
export class TaonProviderOptions extends DecoratorAbstractOpt {
|
|
21
15
|
}
|
|
22
|
-
export {
|
|
23
|
-
TaonProvider,
|
|
24
|
-
TaonProviderOptions
|
|
25
|
-
};
|
|
@@ -1,24 +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
|
+
* Repository decorator
|
|
6
|
+
*/
|
|
7
|
+
export function TaonRepository(options) {
|
|
8
|
+
return function (constructor) {
|
|
9
|
+
Reflect.defineMetadata(Symbols__NS__metadata.options.repository, 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 TaonRepositoryOptions extends DecoratorAbstractOpt {
|
|
14
|
+
export class TaonRepositoryOptions extends DecoratorAbstractOpt {
|
|
20
15
|
}
|
|
21
|
-
export {
|
|
22
|
-
TaonRepository,
|
|
23
|
-
TaonRepositoryOptions
|
|
24
|
-
};
|