taon 19.0.47 → 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/README.md +160 -160
- package/bin/start.js +279 -279
- package/bin/taon +6 -6
- package/bin/taon-debug +5 -5
- package/bin/taon-debug-brk +5 -5
- package/browser/README.md +24 -24
- package/browser/fesm2022/taon.mjs +259 -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 +108 -49
- package/lib/endpoint-context.js.map +1 -1
- package/lib/env.d.ts +2 -0
- package/lib/env.js +7 -0
- package/lib/env.js.map +1 -0
- 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/storage.d.ts +1 -0
- package/lib/storage.js +6 -0
- package/lib/storage.js.map +1 -0
- 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/README.md +24 -24
- package/websql/fesm2022/taon.mjs +286 -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
|
|
@@ -573,15 +583,28 @@ class EndpointContext {
|
|
|
573
583
|
}
|
|
574
584
|
if (this.mode === 'backend-frontend(tcp+udp)') {
|
|
575
585
|
return await new Promise(resolve => {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
586
|
+
if (lib_8.UtilsOs.isRunningInDocker()) {
|
|
587
|
+
// this.displayRoutes(this.expressApp);
|
|
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}
|
|
592
|
+
env: ${this.expressApp.settings.env}
|
|
593
|
+
`);
|
|
594
|
+
resolve(void 0);
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
// this.displayRoutes(this.expressApp);
|
|
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}
|
|
581
603
|
env: ${this.expressApp.settings.env}
|
|
582
604
|
`);
|
|
583
|
-
|
|
584
|
-
|
|
605
|
+
resolve(void 0);
|
|
606
|
+
});
|
|
607
|
+
}
|
|
585
608
|
});
|
|
586
609
|
}
|
|
587
610
|
else {
|
|
@@ -993,16 +1016,53 @@ class EndpointContext {
|
|
|
993
1016
|
return url;
|
|
994
1017
|
}
|
|
995
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
|
+
}
|
|
996
1056
|
/**
|
|
997
1057
|
* Port from uri as number
|
|
998
1058
|
* @returns {Number | undefined}
|
|
999
1059
|
*/
|
|
1000
1060
|
get port() {
|
|
1001
|
-
return this.uri?.port ? Number(this.
|
|
1061
|
+
return this.uri?.port ? Number(this.uriPort) : undefined;
|
|
1002
1062
|
}
|
|
1003
1063
|
//#region methods & getters / is https server
|
|
1004
1064
|
get isHttpServer() {
|
|
1005
|
-
return this.
|
|
1065
|
+
return this.uriProtocol === 'https:';
|
|
1006
1066
|
}
|
|
1007
1067
|
//#endregion
|
|
1008
1068
|
//#region methods & getters / public assets
|
|
@@ -1205,7 +1265,7 @@ class EndpointContext {
|
|
|
1205
1265
|
return;
|
|
1206
1266
|
}
|
|
1207
1267
|
const allControllers = this.getClassFunByArr(models_1.Models.ClassType.CONTROLLER);
|
|
1208
|
-
// console.log('allControllers', allControllers)
|
|
1268
|
+
// console.log('allControllers', allControllers);
|
|
1209
1269
|
for (const controllerClassFn of allControllers) {
|
|
1210
1270
|
controllerClassFn[symbols_1.Symbols.classMethodsNames] =
|
|
1211
1271
|
class_helpers_1.ClassHelpers.getMethodsNames(controllerClassFn);
|
|
@@ -1225,15 +1285,17 @@ class EndpointContext {
|
|
|
1225
1285
|
classConfig.calculatedPath = classConfig.path;
|
|
1226
1286
|
}
|
|
1227
1287
|
else {
|
|
1228
|
-
classConfig.calculatedPath =
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
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('/');
|
|
1236
1297
|
}
|
|
1298
|
+
// console.log('calculatedPath', classConfig.calculatedPath);
|
|
1237
1299
|
lib_10._.slice(configs, 1).forEach(bc => {
|
|
1238
1300
|
const alreadyIs = classConfig.methods;
|
|
1239
1301
|
const toMerge = lib_10._.cloneDeep(bc.methods);
|
|
@@ -1261,13 +1323,13 @@ class EndpointContext {
|
|
|
1261
1323
|
const expressPath = methodConfig.global
|
|
1262
1324
|
? `/${methodConfig.path?.replace(/\//, '')}`
|
|
1263
1325
|
: taon_helpers_1.TaonHelpers.getExpressPath(classConfig, methodConfig);
|
|
1264
|
-
// console.log({ expressPath })
|
|
1326
|
+
// console.log({ expressPath });
|
|
1265
1327
|
if (lib_10.Helpers.isNode || lib_10.Helpers.isWebSQL) {
|
|
1266
1328
|
//#region @websql
|
|
1267
|
-
const
|
|
1329
|
+
const route = this.initServer(type, methodConfig, classConfig, expressPath, controllerClassFn);
|
|
1268
1330
|
this.activeRoutes.push({
|
|
1269
|
-
|
|
1270
|
-
method,
|
|
1331
|
+
expressPath: route.expressPath,
|
|
1332
|
+
method: route.method,
|
|
1271
1333
|
});
|
|
1272
1334
|
//#endregion
|
|
1273
1335
|
}
|
|
@@ -1301,21 +1363,21 @@ class EndpointContext {
|
|
|
1301
1363
|
this.skipWritingServerRoutes) {
|
|
1302
1364
|
return;
|
|
1303
1365
|
}
|
|
1304
|
-
const contexts = [this];
|
|
1366
|
+
// const contexts: EndpointContext[] = [this];
|
|
1305
1367
|
//#region @websql
|
|
1306
1368
|
const troutes = lib_8.Utils.uniqArray(this.activeRoutes.map(f => {
|
|
1307
|
-
return `${f.method} ${f.
|
|
1369
|
+
return `${f.method} ${f.expressPath}`;
|
|
1308
1370
|
})).map(f => {
|
|
1309
|
-
const [method,
|
|
1310
|
-
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` +
|
|
1311
1373
|
taon_helpers_1.TaonHelpers.fillUpTo(method.toUpperCase() + ' ', 10) +
|
|
1312
|
-
this.
|
|
1313
|
-
|
|
1374
|
+
this.uriOrigin +
|
|
1375
|
+
expressPath);
|
|
1314
1376
|
// return `${TaonHelpers.string(method.toUpperCase() + ':')
|
|
1315
|
-
// .fillUpTo(10)}${context.
|
|
1377
|
+
// .fillUpTo(10)}${context.uriHref.replace(/\/$/, '')}${expressPath}`
|
|
1316
1378
|
});
|
|
1317
1379
|
const routes = [
|
|
1318
|
-
...['', `# ROUTES FOR HOST ${this.
|
|
1380
|
+
...['', `# ROUTES FOR HOST ${this.uriOrigin} `],
|
|
1319
1381
|
...troutes,
|
|
1320
1382
|
].join('\n');
|
|
1321
1383
|
const fileName = (0, lib_9.crossPlatformPath)([
|
|
@@ -1444,7 +1506,7 @@ class EndpointContext {
|
|
|
1444
1506
|
next();
|
|
1445
1507
|
};
|
|
1446
1508
|
//#endregion
|
|
1447
|
-
const url = this.uri;
|
|
1509
|
+
// const url = this.uri;
|
|
1448
1510
|
//#region get result
|
|
1449
1511
|
const getResult = async (resolvedParams, req, res) => {
|
|
1450
1512
|
const response = methodConfig.descriptor.value.apply(
|
|
@@ -1460,22 +1522,19 @@ class EndpointContext {
|
|
|
1460
1522
|
return result;
|
|
1461
1523
|
};
|
|
1462
1524
|
//#endregion
|
|
1463
|
-
|
|
1464
|
-
expressPath = url.pathname.startsWith('/')
|
|
1465
|
-
? `${url.pathname}${expressPath}`
|
|
1466
|
-
: expressPath;
|
|
1467
|
-
expressPath = expressPath.replace(/\/\//g, '/');
|
|
1468
|
-
// console.log(`BACKEND: expressPath: ${ expressPath } `)
|
|
1525
|
+
// console.log(`BACKEND: expressPath: "${expressPath}" `);
|
|
1469
1526
|
//#endregion
|
|
1470
1527
|
if (lib_10.Helpers.isElectron) {
|
|
1471
1528
|
//#region @backend
|
|
1472
1529
|
const ipcKeyName = taon_helpers_1.TaonHelpers.ipcKeyNameRequest(target, methodConfig, expressPath);
|
|
1473
1530
|
electron_1.ipcMain.on(ipcKeyName, async (event, paramsFromBrowser) => {
|
|
1474
1531
|
const responseJsonData = await getResult(paramsFromBrowser, void 0, void 0);
|
|
1475
|
-
|
|
1532
|
+
const sendToIpsMainOn = taon_helpers_1.TaonHelpers.ipcKeyNameResponse(target, methodConfig, expressPath);
|
|
1533
|
+
// console.log({ sendToIpsMainOn });
|
|
1534
|
+
event.sender.send(sendToIpsMainOn, responseJsonData);
|
|
1476
1535
|
});
|
|
1477
1536
|
return {
|
|
1478
|
-
|
|
1537
|
+
expressPath,
|
|
1479
1538
|
method: methodConfig.type,
|
|
1480
1539
|
};
|
|
1481
1540
|
//#endregion
|
|
@@ -1666,7 +1725,7 @@ class EndpointContext {
|
|
|
1666
1725
|
//#endregion
|
|
1667
1726
|
}
|
|
1668
1727
|
return {
|
|
1669
|
-
|
|
1728
|
+
expressPath: expressPath,
|
|
1670
1729
|
method: methodConfig.type,
|
|
1671
1730
|
};
|
|
1672
1731
|
}
|
|
@@ -1893,37 +1952,37 @@ class EndpointContext {
|
|
|
1893
1952
|
//#region resolve frontend parameters
|
|
1894
1953
|
if (!storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG])
|
|
1895
1954
|
storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG] = {};
|
|
1896
|
-
if (!storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG][ctx.
|
|
1897
|
-
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] = {};
|
|
1898
1957
|
const endpoints = storage[symbols_1.Symbols.old.ENDPOINT_META_CONFIG];
|
|
1899
1958
|
let rest;
|
|
1900
|
-
if (!endpoints[ctx.
|
|
1959
|
+
if (!endpoints[ctx.uriOrigin][expressPath]) {
|
|
1901
1960
|
let headers = {};
|
|
1902
1961
|
if (methodConfig.contentType && !methodConfig.responseType) {
|
|
1903
|
-
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({
|
|
1904
1963
|
'Content-Type': methodConfig.contentType,
|
|
1905
1964
|
Accept: methodConfig.contentType,
|
|
1906
1965
|
}));
|
|
1907
1966
|
}
|
|
1908
1967
|
else if (methodConfig.contentType && methodConfig.responseType) {
|
|
1909
|
-
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({
|
|
1910
1969
|
'Content-Type': methodConfig.contentType,
|
|
1911
1970
|
Accept: methodConfig.contentType,
|
|
1912
1971
|
responsetypeaxios: methodConfig.responseType,
|
|
1913
1972
|
}));
|
|
1914
1973
|
}
|
|
1915
1974
|
else if (!methodConfig.contentType && methodConfig.responseType) {
|
|
1916
|
-
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({
|
|
1917
1976
|
responsetypeaxios: methodConfig.responseType,
|
|
1918
1977
|
}));
|
|
1919
1978
|
}
|
|
1920
1979
|
else {
|
|
1921
|
-
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);
|
|
1922
1981
|
}
|
|
1923
|
-
endpoints[ctx.
|
|
1982
|
+
endpoints[ctx.uriOrigin][expressPath] = rest;
|
|
1924
1983
|
}
|
|
1925
1984
|
else {
|
|
1926
|
-
rest = endpoints[ctx.
|
|
1985
|
+
rest = endpoints[ctx.uriOrigin][expressPath];
|
|
1927
1986
|
}
|
|
1928
1987
|
const method = type.toLowerCase();
|
|
1929
1988
|
const isWithBody = method === 'put' || method === 'post';
|