taon 19.0.48 → 19.0.49
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 +247 -192
- package/browser/fesm2022/taon.mjs.map +1 -1
- package/browser/lib/constants.d.ts +2 -1
- package/browser/lib/endpoint-context.d.ts +22 -1
- package/browser/lib/helpers/class-helpers.d.ts +0 -1
- package/browser/lib/realtime/realtime-core.d.ts +2 -2
- package/browser/lib/realtime/realtime-server.d.ts +2 -2
- package/browser/package.json +1 -1
- package/lib/build-info._auto-generated_.d.ts +2 -1
- package/lib/build-info._auto-generated_.js +3 -2
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +2 -1
- package/lib/constants.js.map +1 -1
- package/lib/endpoint-context.d.ts +22 -1
- package/lib/endpoint-context.js +96 -50
- package/lib/endpoint-context.js.map +1 -1
- package/lib/helpers/class-helpers.d.ts +0 -1
- package/lib/helpers/class-helpers.js +13 -14
- package/lib/helpers/class-helpers.js.map +1 -1
- package/lib/realtime/realtime-core.d.ts +2 -2
- package/lib/realtime/realtime-core.js +6 -5
- package/lib/realtime/realtime-core.js.map +1 -1
- package/lib/realtime/realtime-server.d.ts +2 -2
- package/lib/realtime/realtime-server.js +22 -22
- package/lib/realtime/realtime-server.js.map +1 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock.js +2 -2
- package/lib/realtime/realtime-strategy/realtime-strategy-mock.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 +274 -223
- package/websql/fesm2022/taon.mjs.map +1 -1
- package/websql/lib/constants.d.ts +2 -1
- package/websql/lib/endpoint-context.d.ts +22 -1
- package/websql/lib/helpers/class-helpers.d.ts +0 -1
- package/websql/lib/realtime/realtime-core.d.ts +2 -2
- package/websql/lib/realtime/realtime-server.d.ts +2 -2
- package/websql/package.json +1 -1
|
@@ -5,4 +5,5 @@ import { InjectionToken } from '@angular/core';
|
|
|
5
5
|
import type { TaonContext } from './create-context';
|
|
6
6
|
declare let TAON_CONTEXT: InjectionToken<TaonContext>;
|
|
7
7
|
declare let CURRENT_HOST_BACKEND_PORT: InjectionToken<number>;
|
|
8
|
-
export { TAON_CONTEXT, CURRENT_HOST_BACKEND_PORT };
|
|
8
|
+
export { TAON_CONTEXT, CURRENT_HOST_BACKEND_PORT };
|
|
9
|
+
export declare const apiPrefix = "api";
|
|
@@ -31,7 +31,7 @@ export declare class EndpointContext {
|
|
|
31
31
|
private readonly classInstancesByNameObj;
|
|
32
32
|
private readonly objWithClassesInstancesArr;
|
|
33
33
|
readonly activeRoutes: {
|
|
34
|
-
|
|
34
|
+
expressPath: string;
|
|
35
35
|
method: Models.Http.Rest.HttpMethod;
|
|
36
36
|
}[];
|
|
37
37
|
readonly skipWritingServerRoutes: boolean;
|
|
@@ -103,6 +103,27 @@ export declare class EndpointContext {
|
|
|
103
103
|
initClasses(): Promise<void>;
|
|
104
104
|
isActiveOn(classInstance: object): boolean;
|
|
105
105
|
get uri(): URL;
|
|
106
|
+
get uriPort(): string | undefined;
|
|
107
|
+
get uriProtocol(): string | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Examples
|
|
110
|
+
* http://localhost:3000
|
|
111
|
+
* https://localhost (from localhost:80) *
|
|
112
|
+
*/
|
|
113
|
+
get uriOrigin(): string | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Exampels
|
|
116
|
+
* http://localhost:3000/path/to/somewhere
|
|
117
|
+
* https://localhost/path/to/somewhere (from localhost:80)
|
|
118
|
+
*/
|
|
119
|
+
get uriPathname(): string | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Examples
|
|
122
|
+
* http://localhost:3000/path/to/somewhere -> '/path/to/somewhere'
|
|
123
|
+
* http://localhost:3000 -> '' #
|
|
124
|
+
* https://localhost/path/to/ -> '/path/to/somewhere' # remove last slash
|
|
125
|
+
*/
|
|
126
|
+
get uriPathnameOrNothingIfRoot(): string;
|
|
106
127
|
/**
|
|
107
128
|
* Port from uri as number
|
|
108
129
|
* @returns {Number | undefined}
|
|
@@ -15,5 +15,4 @@ export declare namespace ClassHelpers {
|
|
|
15
15
|
const getControllerConfig: (target: Function) => Models.ControllerConfig | undefined;
|
|
16
16
|
const getMethodsNames: (classOrClassInstance: any, allMethodsNames?: any[]) => string[];
|
|
17
17
|
const getControllerConfigs: (target: Function, configs?: Models.ControllerConfig[], callerTarget?: Function) => Models.RuntimeControllerConfig[];
|
|
18
|
-
const getCalculatedPathFor: (target: Function) => string;
|
|
19
18
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
+
import { Server } from 'socket.io';
|
|
3
|
+
import { DefaultEventsMap } from 'socket.io/dist/typed-events';
|
|
2
4
|
import { Socket as SocketClient } from 'socket.io-client';
|
|
3
5
|
import type { EndpointContext } from '../endpoint-context';
|
|
4
6
|
import { RealtimeClient } from './realtime-client';
|
|
5
7
|
import { RealtimeServer } from './realtime-server';
|
|
6
8
|
import type { RealtimeStrategy } from './realtime-strategy';
|
|
7
|
-
import { DefaultEventsMap } from 'socket.io/dist/typed-events';
|
|
8
|
-
import { Server } from 'socket.io';
|
|
9
9
|
/**
|
|
10
10
|
* Realtime class
|
|
11
11
|
* - mock (when browser-browser)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { RealtimeCore } from './realtime-core';
|
|
3
|
-
import type { BaseEntity } from '../base-classes/base-entity';
|
|
4
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import type { BaseEntity } from '../base-classes/base-entity';
|
|
4
|
+
import { RealtimeCore } from './realtime-core';
|
|
5
5
|
export declare class RealtimeServer {
|
|
6
6
|
private core;
|
|
7
7
|
constructor(core: RealtimeCore);
|
package/browser/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const BUILD_FRAMEWORK_CLI_NAME = "tnp";
|
|
2
2
|
export declare const APP_ID = "dev.taon.app";
|
|
3
|
+
export declare const BUILD_BASE_HREF = "";
|
|
3
4
|
export declare const PROJECT_NPM_NAME = "taon";
|
|
4
|
-
export declare const CURRENT_PACKAGE_VERSION = "19.0.
|
|
5
|
+
export declare const CURRENT_PACKAGE_VERSION = "19.0.49";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CURRENT_PACKAGE_VERSION = exports.PROJECT_NPM_NAME = exports.APP_ID = exports.BUILD_FRAMEWORK_CLI_NAME = void 0;
|
|
3
|
+
exports.CURRENT_PACKAGE_VERSION = exports.PROJECT_NPM_NAME = exports.BUILD_BASE_HREF = exports.APP_ID = exports.BUILD_FRAMEWORK_CLI_NAME = void 0;
|
|
4
4
|
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
5
5
|
exports.BUILD_FRAMEWORK_CLI_NAME = 'tnp';
|
|
6
6
|
exports.APP_ID = 'dev.taon.app';
|
|
7
|
+
exports.BUILD_BASE_HREF = '';
|
|
7
8
|
exports.PROJECT_NPM_NAME = 'taon';
|
|
8
|
-
exports.CURRENT_PACKAGE_VERSION = '19.0.
|
|
9
|
+
exports.CURRENT_PACKAGE_VERSION = '19.0.49';
|
|
9
10
|
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
10
11
|
//# sourceMappingURL=build-info._auto-generated_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-info._auto-generated_.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAAA,yCAAyC;AAC5B,QAAA,wBAAwB,GAAG,KAAK,CAAC;AACjC,QAAA,MAAM,GAAG,cAAc,CAAC;AACxB,QAAA,gBAAgB,GAAG,MAAM,CAAC;AAC1B,QAAA,uBAAuB,GAAG,SAAS,CAAC;AACjD,yCAAyC"}
|
|
1
|
+
{"version":3,"file":"build-info._auto-generated_.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAAA,yCAAyC;AAC5B,QAAA,wBAAwB,GAAG,KAAK,CAAC;AACjC,QAAA,MAAM,GAAG,cAAc,CAAC;AACxB,QAAA,eAAe,GAAG,EAAE,CAAC;AACrB,QAAA,gBAAgB,GAAG,MAAM,CAAC;AAC1B,QAAA,uBAAuB,GAAG,SAAS,CAAC;AACjD,yCAAyC"}
|
package/lib/constants.d.ts
CHANGED
package/lib/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CURRENT_HOST_BACKEND_PORT = exports.TAON_CONTEXT = exports.TaonEntityKeysToOmitArr = void 0;
|
|
3
|
+
exports.apiPrefix = exports.CURRENT_HOST_BACKEND_PORT = exports.TAON_CONTEXT = exports.TaonEntityKeysToOmitArr = void 0;
|
|
4
4
|
exports.TaonEntityKeysToOmitArr = [
|
|
5
5
|
'ctrl',
|
|
6
6
|
'clone',
|
|
@@ -24,4 +24,5 @@ let TAON_CONTEXT;
|
|
|
24
24
|
/* */
|
|
25
25
|
/* */
|
|
26
26
|
let CURRENT_HOST_BACKEND_PORT;
|
|
27
|
+
exports.apiPrefix = 'api';
|
|
27
28
|
//# sourceMappingURL=constants.js.map
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAmBa,QAAA,uBAAuB,GAA2B;IAC7D,MAAM;IACN,OAAO;IACP,sBAAsB;IACtB,KAAK;IACL,QAAQ;IACR,GAAG;IACH,UAAU;IACV,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,wBAAwB;IACxB,kBAAkB;IAClB,kBAAkB;IAClB,YAAY;IACZ,sBAAsB;IACtB,qBAAqB;IACrB,uBAAuB;CACxB,CAAC;AAMF,IAAI,YAAyC,CAAC;AAC9C,KAAK;AACL,KAAK;AAGL,IAAI,yBAAiD,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAmBa,QAAA,uBAAuB,GAA2B;IAC7D,MAAM;IACN,OAAO;IACP,sBAAsB;IACtB,KAAK;IACL,QAAQ;IACR,GAAG;IACH,UAAU;IACV,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,wBAAwB;IACxB,kBAAkB;IAClB,kBAAkB;IAClB,YAAY;IACZ,sBAAsB;IACtB,qBAAqB;IACrB,uBAAuB;CACxB,CAAC;AAMF,IAAI,YAAyC,CAAC;AAC9C,KAAK;AACL,KAAK;AAGL,IAAI,yBAAiD,CAAC;AASzC,QAAA,SAAS,GAAG,KAAK,CAAC"}
|
|
@@ -32,7 +32,7 @@ export declare class EndpointContext {
|
|
|
32
32
|
private readonly classInstancesByNameObj;
|
|
33
33
|
private readonly objWithClassesInstancesArr;
|
|
34
34
|
readonly activeRoutes: {
|
|
35
|
-
|
|
35
|
+
expressPath: string;
|
|
36
36
|
method: Models.Http.Rest.HttpMethod;
|
|
37
37
|
}[];
|
|
38
38
|
repos: Map<string, Repository<any>>;
|
|
@@ -105,6 +105,27 @@ export declare class EndpointContext {
|
|
|
105
105
|
initClasses(): Promise<void>;
|
|
106
106
|
isActiveOn(classInstance: object): boolean;
|
|
107
107
|
get uri(): URL;
|
|
108
|
+
get uriPort(): string | undefined;
|
|
109
|
+
get uriProtocol(): string | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Examples
|
|
112
|
+
* http://localhost:3000
|
|
113
|
+
* https://localhost (from localhost:80) *
|
|
114
|
+
*/
|
|
115
|
+
get uriOrigin(): string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Exampels
|
|
118
|
+
* http://localhost:3000/path/to/somewhere
|
|
119
|
+
* https://localhost/path/to/somewhere (from localhost:80)
|
|
120
|
+
*/
|
|
121
|
+
get uriPathname(): string | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Examples
|
|
124
|
+
* http://localhost:3000/path/to/somewhere -> '/path/to/somewhere'
|
|
125
|
+
* http://localhost:3000 -> '' #
|
|
126
|
+
* https://localhost/path/to/ -> '/path/to/somewhere' # remove last slash
|
|
127
|
+
*/
|
|
128
|
+
get uriPathnameOrNothingIfRoot(): string;
|
|
108
129
|
/**
|
|
109
130
|
* Port from uri as number
|
|
110
131
|
* @returns {Number | undefined}
|
package/lib/endpoint-context.js
CHANGED
|
@@ -24,6 +24,7 @@ const lib_8 = require("tnp-core/lib");
|
|
|
24
24
|
const lib_9 = require("tnp-core/lib");
|
|
25
25
|
const lib_10 = require("tnp-core/lib");
|
|
26
26
|
const lib_11 = require("tnp-core/lib");
|
|
27
|
+
const constants_1 = require("./constants");
|
|
27
28
|
const context_db_migrations_1 = require("./context-db-migrations");
|
|
28
29
|
const di_container_1 = require("./dependency-injection/di-container");
|
|
29
30
|
const entity_process_1 = require("./entity-process");
|
|
@@ -243,6 +244,10 @@ class EndpointContext {
|
|
|
243
244
|
}
|
|
244
245
|
this.mode = 'remote-backend(tcp+udp)';
|
|
245
246
|
}
|
|
247
|
+
// console.log(`
|
|
248
|
+
// useIpcWhenElectron: ${this.config.useIpcWhenElectron}
|
|
249
|
+
// Helpers.isElectron: ${Helpers.isElectron}
|
|
250
|
+
// `)
|
|
246
251
|
if (this.config.useIpcWhenElectron && lib_10.Helpers.isElectron) {
|
|
247
252
|
if (lib_10.Helpers.isWebSQL) {
|
|
248
253
|
this.mode = 'backend-frontend(websql-electron)';
|
|
@@ -251,6 +256,11 @@ class EndpointContext {
|
|
|
251
256
|
this.mode = 'backend-frontend(ipc-electron)';
|
|
252
257
|
}
|
|
253
258
|
}
|
|
259
|
+
// mode === undefined for BaseContext => ok behavior
|
|
260
|
+
// console.log(`Mode for BE/FE communication: ${this.mode}`);
|
|
261
|
+
// if(!this.mode) {
|
|
262
|
+
// console.log(this.config)
|
|
263
|
+
// }
|
|
254
264
|
if (!this.mode && !this.config.abstract) {
|
|
255
265
|
lib_10.Helpers.error(`[taon] Context "${this.contextName}": You need to provide host or remoteHost or useIpcWhenElectron`, false, true);
|
|
256
266
|
//#region @backend
|
|
@@ -575,10 +585,10 @@ class EndpointContext {
|
|
|
575
585
|
return await new Promise(resolve => {
|
|
576
586
|
if (lib_8.UtilsOs.isRunningInDocker()) {
|
|
577
587
|
// this.displayRoutes(this.expressApp);
|
|
578
|
-
this.serverTcpUdp.listen(Number(this.
|
|
579
|
-
lib_10.Helpers.log(`Express server (inside docker) started 0.0.0.0:${this.
|
|
580
|
-
lib_10.Helpers.log(`[taon][express-server]listening on port: ${this.
|
|
581
|
-
address: ${this.
|
|
588
|
+
this.serverTcpUdp.listen(Number(this.uriPort), '0.0.0.0', () => {
|
|
589
|
+
lib_10.Helpers.log(`Express server (inside docker) started 0.0.0.0:${this.uriPort}`);
|
|
590
|
+
lib_10.Helpers.log(`[taon][express-server]listening on port: ${this.uriPort}, hostname: ${this.uriPathname},
|
|
591
|
+
address: ${this.uriProtocol}//localhost:${this.uriPort}${this.uriPathname}
|
|
582
592
|
env: ${this.expressApp.settings.env}
|
|
583
593
|
`);
|
|
584
594
|
resolve(void 0);
|
|
@@ -586,10 +596,10 @@ class EndpointContext {
|
|
|
586
596
|
}
|
|
587
597
|
else {
|
|
588
598
|
// this.displayRoutes(this.expressApp);
|
|
589
|
-
this.serverTcpUdp.listen(Number(this.
|
|
590
|
-
lib_10.Helpers.log(`Express server (inside nodejs app) started on localhost:${this.
|
|
591
|
-
lib_10.Helpers.log(`[taon][express-server]listening on port: ${this.
|
|
592
|
-
address: ${this.
|
|
599
|
+
this.serverTcpUdp.listen(Number(this.uriPort), () => {
|
|
600
|
+
lib_10.Helpers.log(`Express server (inside nodejs app) started on localhost:${this.uriPort}`);
|
|
601
|
+
lib_10.Helpers.log(`[taon][express-server]listening on port: ${this.uriPort}, hostname: ${this.uriPathname},
|
|
602
|
+
address: ${this.uriProtocol}//localhost:${this.uriPort}${this.uriPathname}
|
|
593
603
|
env: ${this.expressApp.settings.env}
|
|
594
604
|
`);
|
|
595
605
|
resolve(void 0);
|
|
@@ -1006,16 +1016,53 @@ class EndpointContext {
|
|
|
1006
1016
|
return url;
|
|
1007
1017
|
}
|
|
1008
1018
|
//#endregion
|
|
1019
|
+
get uriPort() {
|
|
1020
|
+
return this.uri?.port;
|
|
1021
|
+
}
|
|
1022
|
+
get uriProtocol() {
|
|
1023
|
+
return this.uri?.protocol;
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Examples
|
|
1027
|
+
* http://localhost:3000
|
|
1028
|
+
* https://localhost (from localhost:80) *
|
|
1029
|
+
*/
|
|
1030
|
+
get uriOrigin() {
|
|
1031
|
+
return this.uri?.origin;
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Exampels
|
|
1035
|
+
* http://localhost:3000/path/to/somewhere
|
|
1036
|
+
* https://localhost/path/to/somewhere (from localhost:80)
|
|
1037
|
+
*/
|
|
1038
|
+
// get uriOriginWithPathname(): string | undefined {
|
|
1039
|
+
// return this.uri?.origin
|
|
1040
|
+
// ? this.uri?.origin + this.uriPathnameOrNothingIfRoot.replace(/\/$/, '')
|
|
1041
|
+
// : undefined;
|
|
1042
|
+
// }
|
|
1043
|
+
get uriPathname() {
|
|
1044
|
+
return this.uri?.pathname;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Examples
|
|
1048
|
+
* http://localhost:3000/path/to/somewhere -> '/path/to/somewhere'
|
|
1049
|
+
* http://localhost:3000 -> '' #
|
|
1050
|
+
* https://localhost/path/to/ -> '/path/to/somewhere' # remove last slash
|
|
1051
|
+
*/
|
|
1052
|
+
get uriPathnameOrNothingIfRoot() {
|
|
1053
|
+
const isNonRootProperPathName = this.uri?.pathname && this.uri.pathname !== '/';
|
|
1054
|
+
return isNonRootProperPathName ? this.uri.pathname.replace(/\/$/, '') : '';
|
|
1055
|
+
}
|
|
1009
1056
|
/**
|
|
1010
1057
|
* Port from uri as number
|
|
1011
1058
|
* @returns {Number | undefined}
|
|
1012
1059
|
*/
|
|
1013
1060
|
get port() {
|
|
1014
|
-
return this.uri?.port ? Number(this.
|
|
1061
|
+
return this.uri?.port ? Number(this.uriPort) : undefined;
|
|
1015
1062
|
}
|
|
1016
1063
|
//#region methods & getters / is https server
|
|
1017
1064
|
get isHttpServer() {
|
|
1018
|
-
return this.
|
|
1065
|
+
return this.uriProtocol === 'https:';
|
|
1019
1066
|
}
|
|
1020
1067
|
//#endregion
|
|
1021
1068
|
//#region methods & getters / public assets
|
|
@@ -1218,7 +1265,7 @@ class EndpointContext {
|
|
|
1218
1265
|
return;
|
|
1219
1266
|
}
|
|
1220
1267
|
const allControllers = this.getClassFunByArr(models_1.Models.ClassType.CONTROLLER);
|
|
1221
|
-
// console.log('allControllers', allControllers)
|
|
1268
|
+
// console.log('allControllers', allControllers);
|
|
1222
1269
|
for (const controllerClassFn of allControllers) {
|
|
1223
1270
|
controllerClassFn[symbols_1.Symbols.classMethodsNames] =
|
|
1224
1271
|
class_helpers_1.ClassHelpers.getMethodsNames(controllerClassFn);
|
|
@@ -1238,15 +1285,17 @@ class EndpointContext {
|
|
|
1238
1285
|
classConfig.calculatedPath = classConfig.path;
|
|
1239
1286
|
}
|
|
1240
1287
|
else {
|
|
1241
|
-
classConfig.calculatedPath =
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1288
|
+
classConfig.calculatedPath = (`${this.uriPathnameOrNothingIfRoot}` +
|
|
1289
|
+
`/${constants_1.apiPrefix}/${this.contextName}/tcp${parentscalculatedPath}/` +
|
|
1290
|
+
`${class_helpers_1.ClassHelpers.getName(controllerClassFn)}`)
|
|
1291
|
+
.replace(/\/\//g, '/')
|
|
1292
|
+
.split('/')
|
|
1293
|
+
.reduce((acc, bc) => {
|
|
1294
|
+
return lib_10._.last(acc) === bc ? acc : [...acc, bc];
|
|
1295
|
+
}, [])
|
|
1296
|
+
.join('/');
|
|
1249
1297
|
}
|
|
1298
|
+
// console.log('calculatedPath', classConfig.calculatedPath);
|
|
1250
1299
|
lib_10._.slice(configs, 1).forEach(bc => {
|
|
1251
1300
|
const alreadyIs = classConfig.methods;
|
|
1252
1301
|
const toMerge = lib_10._.cloneDeep(bc.methods);
|
|
@@ -1274,13 +1323,13 @@ class EndpointContext {
|
|
|
1274
1323
|
const expressPath = methodConfig.global
|
|
1275
1324
|
? `/${methodConfig.path?.replace(/\//, '')}`
|
|
1276
1325
|
: taon_helpers_1.TaonHelpers.getExpressPath(classConfig, methodConfig);
|
|
1277
|
-
// console.log({ expressPath })
|
|
1326
|
+
// console.log({ expressPath });
|
|
1278
1327
|
if (lib_10.Helpers.isNode || lib_10.Helpers.isWebSQL) {
|
|
1279
1328
|
//#region @websql
|
|
1280
|
-
const
|
|
1329
|
+
const route = this.initServer(type, methodConfig, classConfig, expressPath, controllerClassFn);
|
|
1281
1330
|
this.activeRoutes.push({
|
|
1282
|
-
|
|
1283
|
-
method,
|
|
1331
|
+
expressPath: route.expressPath,
|
|
1332
|
+
method: route.method,
|
|
1284
1333
|
});
|
|
1285
1334
|
//#endregion
|
|
1286
1335
|
}
|
|
@@ -1314,21 +1363,21 @@ class EndpointContext {
|
|
|
1314
1363
|
this.skipWritingServerRoutes) {
|
|
1315
1364
|
return;
|
|
1316
1365
|
}
|
|
1317
|
-
const contexts = [this];
|
|
1366
|
+
// const contexts: EndpointContext[] = [this];
|
|
1318
1367
|
//#region @websql
|
|
1319
1368
|
const troutes = lib_8.Utils.uniqArray(this.activeRoutes.map(f => {
|
|
1320
|
-
return `${f.method} ${f.
|
|
1369
|
+
return `${f.method} ${f.expressPath}`;
|
|
1321
1370
|
})).map(f => {
|
|
1322
|
-
const [method,
|
|
1323
|
-
return (`\n### ${lib_10._.startCase(lib_10._.last(
|
|
1371
|
+
const [method, expressPath] = f.split(' ');
|
|
1372
|
+
return (`\n### ${lib_10._.startCase(lib_10._.last(expressPath.split('/')))}\n` +
|
|
1324
1373
|
taon_helpers_1.TaonHelpers.fillUpTo(method.toUpperCase() + ' ', 10) +
|
|
1325
|
-
this.
|
|
1326
|
-
|
|
1374
|
+
this.uriOrigin +
|
|
1375
|
+
expressPath);
|
|
1327
1376
|
// return `${TaonHelpers.string(method.toUpperCase() + ':')
|
|
1328
|
-
// .fillUpTo(10)}${context.
|
|
1377
|
+
// .fillUpTo(10)}${context.uriHref.replace(/\/$/, '')}${expressPath}`
|
|
1329
1378
|
});
|
|
1330
1379
|
const routes = [
|
|
1331
|
-
...['', `# ROUTES FOR HOST ${this.
|
|
1380
|
+
...['', `# ROUTES FOR HOST ${this.uriOrigin} `],
|
|
1332
1381
|
...troutes,
|
|
1333
1382
|
].join('\n');
|
|
1334
1383
|
const fileName = (0, lib_9.crossPlatformPath)([
|
|
@@ -1457,7 +1506,7 @@ class EndpointContext {
|
|
|
1457
1506
|
next();
|
|
1458
1507
|
};
|
|
1459
1508
|
//#endregion
|
|
1460
|
-
const url = this.uri;
|
|
1509
|
+
// const url = this.uri;
|
|
1461
1510
|
//#region get result
|
|
1462
1511
|
const getResult = async (resolvedParams, req, res) => {
|
|
1463
1512
|
const response = methodConfig.descriptor.value.apply(
|
|
@@ -1473,22 +1522,19 @@ class EndpointContext {
|
|
|
1473
1522
|
return result;
|
|
1474
1523
|
};
|
|
1475
1524
|
//#endregion
|
|
1476
|
-
|
|
1477
|
-
expressPath = url.pathname.startsWith('/')
|
|
1478
|
-
? `${url.pathname}${expressPath}`
|
|
1479
|
-
: expressPath;
|
|
1480
|
-
expressPath = expressPath.replace(/\/\//g, '/');
|
|
1481
|
-
// console.log(`BACKEND: expressPath: ${ expressPath } `)
|
|
1525
|
+
// console.log(`BACKEND: expressPath: "${expressPath}" `);
|
|
1482
1526
|
//#endregion
|
|
1483
1527
|
if (lib_10.Helpers.isElectron) {
|
|
1484
1528
|
//#region @backend
|
|
1485
1529
|
const ipcKeyName = taon_helpers_1.TaonHelpers.ipcKeyNameRequest(target, methodConfig, expressPath);
|
|
1486
1530
|
electron_1.ipcMain.on(ipcKeyName, async (event, paramsFromBrowser) => {
|
|
1487
1531
|
const responseJsonData = await getResult(paramsFromBrowser, void 0, void 0);
|
|
1488
|
-
|
|
1532
|
+
const sendToIpsMainOn = taon_helpers_1.TaonHelpers.ipcKeyNameResponse(target, methodConfig, expressPath);
|
|
1533
|
+
// console.log({ sendToIpsMainOn });
|
|
1534
|
+
event.sender.send(sendToIpsMainOn, responseJsonData);
|
|
1489
1535
|
});
|
|
1490
1536
|
return {
|
|
1491
|
-
|
|
1537
|
+
expressPath,
|
|
1492
1538
|
method: methodConfig.type,
|
|
1493
1539
|
};
|
|
1494
1540
|
//#endregion
|
|
@@ -1679,7 +1725,7 @@ class EndpointContext {
|
|
|
1679
1725
|
//#endregion
|
|
1680
1726
|
}
|
|
1681
1727
|
return {
|
|
1682
|
-
|
|
1728
|
+
expressPath: expressPath,
|
|
1683
1729
|
method: methodConfig.type,
|
|
1684
1730
|
};
|
|
1685
1731
|
}
|
|
@@ -1906,37 +1952,37 @@ class EndpointContext {
|
|
|
1906
1952
|
//#region resolve frontend parameters
|
|
1907
1953
|
if (!storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG])
|
|
1908
1954
|
storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG] = {};
|
|
1909
|
-
if (!storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG][ctx.
|
|
1910
|
-
storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG][ctx.
|
|
1955
|
+
if (!storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG][ctx.uriOrigin])
|
|
1956
|
+
storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG][ctx.uriOrigin] = {};
|
|
1911
1957
|
const endpoints = storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG];
|
|
1912
1958
|
let rest;
|
|
1913
|
-
if (!endpoints[ctx.
|
|
1959
|
+
if (!endpoints[ctx.uriOrigin][expressPath]) {
|
|
1914
1960
|
let headers = {};
|
|
1915
1961
|
if (methodConfig.contentType && !methodConfig.responseType) {
|
|
1916
|
-
rest = lib_3.Resource.create(ctx.
|
|
1962
|
+
rest = lib_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_3.RestHeaders.from({
|
|
1917
1963
|
'Content-Type': methodConfig.contentType,
|
|
1918
1964
|
Accept: methodConfig.contentType,
|
|
1919
1965
|
}));
|
|
1920
1966
|
}
|
|
1921
1967
|
else if (methodConfig.contentType && methodConfig.responseType) {
|
|
1922
|
-
rest = lib_3.Resource.create(ctx.
|
|
1968
|
+
rest = lib_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_3.RestHeaders.from({
|
|
1923
1969
|
'Content-Type': methodConfig.contentType,
|
|
1924
1970
|
Accept: methodConfig.contentType,
|
|
1925
1971
|
responsetypeaxios: methodConfig.responseType,
|
|
1926
1972
|
}));
|
|
1927
1973
|
}
|
|
1928
1974
|
else if (!methodConfig.contentType && methodConfig.responseType) {
|
|
1929
|
-
rest = lib_3.Resource.create(ctx.
|
|
1975
|
+
rest = lib_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, lib_3.RestHeaders.from({
|
|
1930
1976
|
responsetypeaxios: methodConfig.responseType,
|
|
1931
1977
|
}));
|
|
1932
1978
|
}
|
|
1933
1979
|
else {
|
|
1934
|
-
rest = lib_3.Resource.create(ctx.
|
|
1980
|
+
rest = lib_3.Resource.create(ctx.uriOrigin, expressPath, symbols_1.Symbols.old.MAPPING_CONFIG_HEADER, symbols_1.Symbols.old.CIRCURAL_OBJECTS_MAP_BODY);
|
|
1935
1981
|
}
|
|
1936
|
-
endpoints[ctx.
|
|
1982
|
+
endpoints[ctx.uriOrigin][expressPath] = rest;
|
|
1937
1983
|
}
|
|
1938
1984
|
else {
|
|
1939
|
-
rest = endpoints[ctx.
|
|
1985
|
+
rest = endpoints[ctx.uriOrigin][expressPath];
|
|
1940
1986
|
}
|
|
1941
1987
|
const method = type.toLowerCase();
|
|
1942
1988
|
const isWithBody = method === 'put' || method === 'post';
|