taon 21.0.63 → 21.0.71
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-browser.mjs +142 -69
- package/browser/fesm2022/taon-browser.mjs.map +1 -1
- package/browser/package.json +1 -1
- package/browser/types/taon-browser.d.ts +13 -16
- package/browser-prod/fesm2022/taon-browser.mjs +147 -74
- package/browser-prod/fesm2022/taon-browser.mjs.map +1 -1
- package/browser-prod/package.json +1 -1
- package/browser-prod/types/taon-browser.d.ts +15 -18
- package/browser-prod.split-namespaces.json +2 -4
- package/cli.js +1 -1
- package/cli.js.map +1 -1
- package/icon-menu-taon.svg +15 -15
- package/lib/base-classes/base-controller.d.ts +2 -3
- package/lib/base-classes/base-controller.js.map +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/decorators/classes/entity-decorator.d.ts +3 -6
- package/lib/decorators/classes/entity-decorator.js +16 -7
- package/lib/decorators/classes/entity-decorator.js.map +1 -1
- package/lib/decorators/http/http-decorators.d.ts +1 -3
- package/lib/decorators/http/http-decorators.js +4 -2
- package/lib/decorators/http/http-decorators.js.map +1 -1
- package/lib/decorators/http/http-methods-decorators.d.ts +2 -2
- package/lib/endpoint-context.js +104 -48
- package/lib/endpoint-context.js.map +1 -1
- package/lib/entity-process.d.ts +0 -1
- package/lib/entity-process.js +39 -41
- package/lib/entity-process.js.map +1 -1
- package/lib/formly/fromly.js +2 -2
- package/lib/formly/fromly.js.map +1 -1
- package/lib/helpers/class-helpers.d.ts +1 -1
- package/lib/helpers/class-helpers.js +9 -6
- package/lib/helpers/class-helpers.js.map +1 -1
- package/lib/models.d.ts +7 -3
- package/lib/models.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/realtime/realtime-client.js +1 -1
- package/lib/realtime/realtime-client.js.map +1 -1
- package/lib/symbols.d.ts +0 -2
- package/lib/symbols.js +3 -7
- package/lib/symbols.js.map +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-controller.d.ts +2 -3
- package/lib-prod/base-classes/base-controller.js.map +1 -1
- package/lib-prod/base-classes/base-crud-controller.js.map +1 -1
- package/lib-prod/base-classes/base-injector.js.map +1 -1
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/context-db-migrations.js.map +1 -1
- package/lib-prod/create-context.js.map +1 -1
- package/lib-prod/decorators/classes/controller-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/entity-decorator.d.ts +3 -6
- package/lib-prod/decorators/classes/entity-decorator.js +17 -8
- package/lib-prod/decorators/classes/entity-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/middleware-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/migration-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/provider-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/repository-decorator.js.map +1 -1
- package/lib-prod/decorators/classes/subscriber-decorator.js.map +1 -1
- package/lib-prod/decorators/http/http-decorators.d.ts +1 -3
- package/lib-prod/decorators/http/http-decorators.js +4 -3
- package/lib-prod/decorators/http/http-decorators.js.map +1 -1
- package/lib-prod/decorators/http/http-methods-decorators.d.ts +2 -2
- package/lib-prod/decorators/http/http-methods-decorators.js.map +1 -1
- package/lib-prod/endpoint-context-storage.js.map +1 -1
- package/lib-prod/endpoint-context.js +108 -52
- package/lib-prod/endpoint-context.js.map +1 -1
- package/lib-prod/entity-process.d.ts +0 -1
- package/lib-prod/entity-process.js +9 -11
- package/lib-prod/entity-process.js.map +1 -1
- package/lib-prod/formly/fromly.js +5 -5
- package/lib-prod/formly/fromly.js.map +1 -1
- package/lib-prod/helpers/class-helpers.d.ts +1 -1
- package/lib-prod/helpers/class-helpers.js +13 -10
- package/lib-prod/helpers/class-helpers.js.map +1 -1
- package/lib-prod/inject.js.map +1 -1
- package/lib-prod/models.d.ts +7 -3
- package/lib-prod/models.js.map +1 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.js +2 -2
- package/lib-prod/realtime/realtime-client.js.map +1 -1
- package/lib-prod/realtime/realtime-server.js.map +1 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js.map +1 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js.map +1 -1
- package/lib-prod/realtime/realtime-subs-manager.js.map +1 -1
- package/lib-prod/symbols.d.ts +0 -2
- package/lib-prod/symbols.js +0 -4
- package/lib-prod/symbols.js.map +1 -1
- package/lib-prod/ui/index.d.ts +1 -1
- package/lib-prod/ui/index.js +1 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.d.ts +1 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +1 -1
- package/lib-prod.split-namespaces.json +2 -4
- package/package.json +1 -1
- package/websql/fesm2022/taon-websql.mjs +147 -78
- package/websql/fesm2022/taon-websql.mjs.map +1 -1
- package/websql/package.json +1 -1
- package/websql/types/taon-websql.d.ts +13 -16
- package/websql-prod/fesm2022/taon-websql.mjs +152 -83
- package/websql-prod/fesm2022/taon-websql.mjs.map +1 -1
- package/websql-prod/package.json +1 -1
- package/websql-prod/types/taon-websql.d.ts +15 -18
- package/websql-prod.split-namespaces.json +2 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResponseTypeAxios } from 'ng2-rest/lib-prod';
|
|
2
2
|
import { CoreModels__NS__ContentType } from 'tnp-core/lib-prod';
|
|
3
3
|
import { TaonBaseMiddleware } from '../../base-classes/base-middleware';
|
|
4
4
|
export type TaonMiddlewareInheritanceObj = {
|
|
@@ -30,7 +30,7 @@ export interface TaonHttpDecoratorOptions {
|
|
|
30
30
|
*/
|
|
31
31
|
pathIsGlobal?: boolean;
|
|
32
32
|
overrideContentType?: CoreModels__NS__ContentType;
|
|
33
|
-
overrideResponseType?:
|
|
33
|
+
overrideResponseType?: ResponseTypeAxios;
|
|
34
34
|
/**
|
|
35
35
|
* Express will send response as HTML string with proper headers
|
|
36
36
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-methods-decorators.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AACA,OAAO,EAAmxE,eAAe,
|
|
1
|
+
{"version":3,"file":"http-methods-decorators.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AACA,OAAO,EAAmxE,eAAe,EAAoiJ,MAAM,mBAAmB,CAAC;AAGv2N,OAAO,EAAuE,oCAAoC,EAAyY,MAAM,6BAA6B,CAAC;AAI/hB,MAAM,OAAO,GAAG,CACd,MAAkC,EAClC,IAAY,EACZ,MAAgB,EAChB,WAAmB,EACnB,UAA8B,EAC9B,aAAgD,EAChD,YAAqB,EACrB,EAAE;IACF,MAAM,YAAY,GAAG,oCAAoC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAE/E,IAAI,OAAiC,CAAC;IACtC,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,GAAG,aAAa,CAAC;QACxB,aAAa,GAAG,OAAO,CAAC,IAAW,CAAC;QACpC,YAAY,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;QACtC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,EAAE,aAAa,EAAE,YAAY,EAAS,CAAC;IACnD,CAAC;IAED,MAAM,EACJ,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,WAAW,GACZ,GAAG,OAAO,CAAC;IAEZ,YAAY,CAAC,UAAU,GAAG,WAAW,CAAC;IACtC,YAAY,CAAC,WAAW,GAAG,WAAW,CAAC;IACvC,YAAY,CAAC,IAAI,GAAG,MAAM,CAAC;IAC3B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,sBAAsB,GAAG,EAAE,CAAC;QAChC,KAAK,MAAM,GAAG,IAAI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pB,OAAO,UACL,MAAW,EACX,WAAmB,EACnB,UAA8B;QAE9B,OAAO,CACL,QAAQ,EACR,aAAuB,EACvB,MAAM,EACN,WAAW,EACX,UAAU,EACV,aAAa,EACb,YAAY,CACb,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-context-storage.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"endpoint-context-storage.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA,OAAO,EAAwoD,yCAAyC,EAAoP,MAAM,mBAAmB,CAAC;AAIt8D,MAAM,OAAO,uBAAuB;IAClC,yBAAyB,GAAG,yCAAyC,CAAC;IAC9D,oBAAoB,GAAG,IAAI,GAAG,EAA2B,CAAC;IAElE,mBAAmB;IACX,MAAM,CAAC,QAAQ,CAA0B;IAEjD;QACE,sDAAsD;IACxD,CAAC;IAEM,MAAM,KAAK,QAAQ;QACxB,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,CAAC;YACtC,uBAAuB,CAAC,QAAQ,GAAG,IAAI,uBAAuB,EAAE,CAAC;QACnE,CAAC;QACD,OAAO,uBAAuB,CAAC,QAAQ,CAAC;IAC1C,CAAC;IACD,YAAY;IAEZ,GAAG,CAAC,OAAwB;QAC1B,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACxD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAED,IAAI,GAAG;QACL,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAC1D,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,QAAQ,CAChC,CAAC;IACJ,CAAC;IAED,KAAK,CACH,OAA0C;QAE1C,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAQ,CAAC;QACvD,CAAC;QACD,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAQ,CAAC;IACnE,CAAC;CACF;AAED,oEAAoE;AACpE,UAAU,CAAC,+BAA+B,CAAC,GAAG,uBAAuB,CAAC,QAAQ,CAAC"}
|
|
@@ -2,14 +2,14 @@ import { URL } from 'url'; // @backend
|
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import { JSON10 } from 'json10/lib-prod';
|
|
4
4
|
import { walk } from 'lodash-walk-object/lib-prod';
|
|
5
|
-
import {
|
|
5
|
+
import { decodeMappingForHeaderJson, encodeMapping, RestHeaders, Resource__NS__Cookies, Resource__NS__create, Resource__NS__globalInterceptors, Resource__NS__methodsInterceptors } from 'ng2-rest/lib-prod';
|
|
6
6
|
import { from } from 'rxjs';
|
|
7
7
|
import { EventSubscriber } from 'taon-typeorm/lib-prod'; // @websql
|
|
8
8
|
import { Entity as TypeormEntity } from 'taon-typeorm/lib-prod'; // @websql
|
|
9
9
|
import { DataSource, } from 'taon-typeorm/lib-prod';
|
|
10
10
|
import { path, requireDefault } from 'tnp-core/lib-prod';
|
|
11
11
|
import { config } from 'tnp-core/lib-prod';
|
|
12
|
-
import { CoreModels__NS__TaonHttpErrorCustomProp } from 'tnp-core/lib-prod';
|
|
12
|
+
import { CoreModels__NS__ClassNameStaticProperty, CoreModels__NS__OrignalClassKey, CoreModels__NS__TaonHttpErrorCustomProp } from 'tnp-core/lib-prod';
|
|
13
13
|
import { fse, http, https } from 'tnp-core/lib-prod'; // @backend
|
|
14
14
|
import { Utils__NS__uniqArray, UtilsOs__NS__getRealHomeDir, UtilsOs__NS__isBrowser, UtilsOs__NS__isElectron, UtilsOs__NS__isNode, UtilsOs__NS__isRunningInCliMode, UtilsOs__NS__isRunningInDocker, UtilsOs__NS__isWebSQL } from 'tnp-core/lib-prod';
|
|
15
15
|
import { crossPlatformPath } from 'tnp-core/lib-prod';
|
|
@@ -23,7 +23,7 @@ import { ClassHelpers__NS__asyncHandler, ClassHelpers__NS__getControllerConfigs,
|
|
|
23
23
|
import { TaonHelpers__NS__fillUpTo, TaonHelpers__NS__firstStringOrElemFromArray, TaonHelpers__NS__getExpressPath, TaonHelpers__NS__ipcKeyNameRequest, TaonHelpers__NS__ipcKeyNameResponse, TaonHelpers__NS__isGoodPath, TaonHelpers__NS__parseJSONwithStringJSONs, TaonHelpers__NS__tryTransformParam, TaonHelpers__NS__websqlMocks } from './helpers/taon-helpers';
|
|
24
24
|
import { Models__NS__ClassType, Models__NS__ClassTypeKey, Models__NS__DatabaseConfig, Models__NS__DatabasesFolder } from './models';
|
|
25
25
|
import { RealtimeCore } from './realtime/realtime-core';
|
|
26
|
-
import { Symbols__NS__classMethodsNames,
|
|
26
|
+
import { Symbols__NS__classMethodsNames, Symbols__NS__ctxInClassOrClassObj, Symbols__NS__fullClassNameStaticProperty, Symbols__NS__metadata, Symbols__NS__old } from './symbols';
|
|
27
27
|
/* */
|
|
28
28
|
//#endregion
|
|
29
29
|
let bodyParser;
|
|
@@ -711,22 +711,17 @@ export class EndpointContext {
|
|
|
711
711
|
}
|
|
712
712
|
return class extends TaonBaseClass {
|
|
713
713
|
// static ['_'] = TaonBaseClass['_'];
|
|
714
|
-
|
|
715
|
-
static [Symbols__NS__orignalClass] = TaonBaseClass;
|
|
716
|
-
// @ts-ignore
|
|
714
|
+
static [CoreModels__NS__OrignalClassKey] = TaonBaseClass;
|
|
717
715
|
static [Symbols__NS__fullClassNameStaticProperty] = `${ctx.contextName}.${className}`;
|
|
718
|
-
|
|
719
|
-
static [Symbols__NS__classNameStaticProperty] = className;
|
|
716
|
+
static [CoreModels__NS__ClassNameStaticProperty] = className;
|
|
720
717
|
static [Symbols__NS__ctxInClassOrClassObj] = ctx;
|
|
721
718
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
722
719
|
static __getFullPathForClass__(arr = []) {
|
|
723
720
|
const name = this[Symbols__NS__fullClassNameStaticProperty];
|
|
724
721
|
arr.push(name);
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
this[
|
|
728
|
-
// @ts-ignore
|
|
729
|
-
this[Symbols__NS__orignalClass].__getFullPathForClass__(arr);
|
|
722
|
+
if (this[CoreModels__NS__OrignalClassKey] &&
|
|
723
|
+
this[CoreModels__NS__OrignalClassKey].__getFullPathForClass__) {
|
|
724
|
+
this[CoreModels__NS__OrignalClassKey].__getFullPathForClass__(arr);
|
|
730
725
|
}
|
|
731
726
|
return arr.join('/');
|
|
732
727
|
}
|
|
@@ -777,7 +772,7 @@ export class EndpointContext {
|
|
|
777
772
|
// console.warn(`Please provide className for ${TaonBaseClass.name} class`);
|
|
778
773
|
// }
|
|
779
774
|
className = className || key;
|
|
780
|
-
TaonBaseClass[
|
|
775
|
+
TaonBaseClass[CoreModels__NS__ClassNameStaticProperty] = className;
|
|
781
776
|
const clonedClass = this.cloneClassWithNewMetadata({
|
|
782
777
|
TaonBaseClass,
|
|
783
778
|
className,
|
|
@@ -1556,7 +1551,8 @@ export class EndpointContext {
|
|
|
1556
1551
|
})).map(f => {
|
|
1557
1552
|
const [method, expressPath] = f.split(' ');
|
|
1558
1553
|
if (method.toUpperCase() === 'GET' && this.isRunningInsideDocker) {
|
|
1559
|
-
this.logRoutes &&
|
|
1554
|
+
this.logRoutes &&
|
|
1555
|
+
console.log(`apk add curl && curl http://localhost:${this.uriPort}${expressPath}`);
|
|
1560
1556
|
}
|
|
1561
1557
|
return (`\n### ${___NS__startCase(___NS__last(expressPath.split('/')))}\n` +
|
|
1562
1558
|
TaonHelpers__NS__fillUpTo(method.toUpperCase() + ' ', 10) +
|
|
@@ -1600,7 +1596,7 @@ export class EndpointContext {
|
|
|
1600
1596
|
middlewares.forEach(middlewareInstanceName => {
|
|
1601
1597
|
const contextName = this.contextName;
|
|
1602
1598
|
const interceptorName = `${contextName}-${ClassHelpers__NS__getName(middlewareInstanceName)}`;
|
|
1603
|
-
|
|
1599
|
+
Resource__NS__globalInterceptors.set(interceptorName, {
|
|
1604
1600
|
intercept: ({ req, next }) => {
|
|
1605
1601
|
const url = new URL(req.url);
|
|
1606
1602
|
if (url.pathname.startsWith(`${this.uriPathnameOrNothingIfRoot}/${apiPrefix}/${contextName}/`)) {
|
|
@@ -1812,45 +1808,58 @@ export class EndpointContext {
|
|
|
1812
1808
|
let tParams = req.params;
|
|
1813
1809
|
let tQuery = req.query;
|
|
1814
1810
|
if (req.headers[Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY]) {
|
|
1811
|
+
//#region handle circural item in body params
|
|
1815
1812
|
try {
|
|
1816
1813
|
tBody = JSON.parse(JSON.stringify(tBody), JSON.parse(TaonHelpers__NS__firstStringOrElemFromArray(req.headers[Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY])));
|
|
1817
1814
|
}
|
|
1818
1815
|
catch (e) { }
|
|
1816
|
+
//#endregion
|
|
1819
1817
|
}
|
|
1820
1818
|
if (req.headers[Symbols__NS__old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM]) {
|
|
1819
|
+
//#region handle circular items in query params
|
|
1821
1820
|
try {
|
|
1822
1821
|
tQuery = JSON.parse(JSON.stringify(tQuery), JSON.parse(TaonHelpers__NS__firstStringOrElemFromArray(req.headers[Symbols__NS__old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM])));
|
|
1823
1822
|
}
|
|
1824
1823
|
catch (e) { }
|
|
1824
|
+
//#endregion
|
|
1825
1825
|
}
|
|
1826
1826
|
// make class instance from body
|
|
1827
1827
|
// console.log('req.headers', req.headers)
|
|
1828
1828
|
if (req.headers[Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS]) {
|
|
1829
|
+
//#region encode entity or enties in body from header mapping
|
|
1829
1830
|
try {
|
|
1830
|
-
const
|
|
1831
|
-
tBody =
|
|
1831
|
+
const mappinForEntityBody = JSON.parse(TaonHelpers__NS__firstStringOrElemFromArray(req.headers[Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS]));
|
|
1832
|
+
tBody = encodeMapping(tBody, mappinForEntityBody);
|
|
1832
1833
|
}
|
|
1833
1834
|
catch (e) { }
|
|
1835
|
+
//#endregion
|
|
1834
1836
|
}
|
|
1835
1837
|
else {
|
|
1838
|
+
// TODO why do i need this ????
|
|
1839
|
+
//#region encode entity or enties in body from header mapping
|
|
1836
1840
|
Object.keys(tBody).forEach(paramName => {
|
|
1837
1841
|
try {
|
|
1838
|
-
const
|
|
1839
|
-
tBody[paramName] =
|
|
1842
|
+
const mappingForEntityBodyForParam = JSON.parse(TaonHelpers__NS__firstStringOrElemFromArray(req.headers[`${Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS}${paramName} `]));
|
|
1843
|
+
tBody[paramName] = encodeMapping(tBody[paramName], mappingForEntityBodyForParam);
|
|
1840
1844
|
}
|
|
1841
1845
|
catch (e) { }
|
|
1842
1846
|
});
|
|
1847
|
+
//#endregion
|
|
1843
1848
|
}
|
|
1844
1849
|
// make class instance from query params
|
|
1845
1850
|
// console.log('req.headers', tQuery)
|
|
1846
1851
|
if (req.headers[Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS]) {
|
|
1852
|
+
//#region encode entity or enties in query parms from header mapping
|
|
1847
1853
|
try {
|
|
1848
1854
|
const entity = JSON.parse(TaonHelpers__NS__firstStringOrElemFromArray(req.headers[Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS]));
|
|
1849
|
-
tQuery = TaonHelpers__NS__parseJSONwithStringJSONs(
|
|
1855
|
+
tQuery = TaonHelpers__NS__parseJSONwithStringJSONs(encodeMapping(tQuery, entity));
|
|
1850
1856
|
}
|
|
1851
1857
|
catch (e) { }
|
|
1858
|
+
//#endregion
|
|
1852
1859
|
}
|
|
1853
1860
|
else {
|
|
1861
|
+
// TODO why do i need this ????
|
|
1862
|
+
//#region encode entity or enties in query parms from header mapping
|
|
1854
1863
|
Object.keys(tQuery).forEach(queryParamName => {
|
|
1855
1864
|
try {
|
|
1856
1865
|
const entityForParam = JSON.parse(TaonHelpers__NS__firstStringOrElemFromArray(req.headers[`${Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS}${queryParamName} `]));
|
|
@@ -1862,13 +1871,15 @@ export class EndpointContext {
|
|
|
1862
1871
|
}
|
|
1863
1872
|
catch (e) { }
|
|
1864
1873
|
}
|
|
1865
|
-
const afterEncoding =
|
|
1874
|
+
const afterEncoding = encodeMapping(beforeTransofrm, entityForParam);
|
|
1866
1875
|
tQuery[queryParamName] =
|
|
1867
1876
|
TaonHelpers__NS__parseJSONwithStringJSONs(afterEncoding);
|
|
1868
1877
|
}
|
|
1869
1878
|
catch (e) { }
|
|
1870
1879
|
});
|
|
1880
|
+
//#endregion
|
|
1871
1881
|
}
|
|
1882
|
+
//#region set proper arguments for backend function
|
|
1872
1883
|
Object.keys(methodConfig.parameters).forEach(paramName => {
|
|
1873
1884
|
let p = methodConfig.parameters[paramName];
|
|
1874
1885
|
if (p.paramType === 'Path' && tParams) {
|
|
@@ -1898,6 +1909,7 @@ export class EndpointContext {
|
|
|
1898
1909
|
}
|
|
1899
1910
|
});
|
|
1900
1911
|
//#endregion
|
|
1912
|
+
//#endregion
|
|
1901
1913
|
const resolvedParams = args
|
|
1902
1914
|
.reverse()
|
|
1903
1915
|
.map(v => TaonHelpers__NS__tryTransformParam(v));
|
|
@@ -1914,8 +1926,7 @@ export class EndpointContext {
|
|
|
1914
1926
|
return;
|
|
1915
1927
|
}
|
|
1916
1928
|
if (result instanceof Blob &&
|
|
1917
|
-
methodConfig.responseType ===
|
|
1918
|
-
'blob') {
|
|
1929
|
+
methodConfig.responseType === 'blob') {
|
|
1919
1930
|
// console.log('INSTANCE OF BLOB')
|
|
1920
1931
|
//#region processs blob result type
|
|
1921
1932
|
const blob = result;
|
|
@@ -1928,8 +1939,7 @@ export class EndpointContext {
|
|
|
1928
1939
|
//#endregion
|
|
1929
1940
|
}
|
|
1930
1941
|
else if (___NS__isString(result) &&
|
|
1931
|
-
methodConfig.responseType ===
|
|
1932
|
-
'blob') {
|
|
1942
|
+
methodConfig.responseType === 'blob') {
|
|
1933
1943
|
// console.log('BASE64')
|
|
1934
1944
|
//#region process string buffer TODO refacetor
|
|
1935
1945
|
const img_base64 = result;
|
|
@@ -1948,7 +1958,7 @@ export class EndpointContext {
|
|
|
1948
1958
|
}
|
|
1949
1959
|
else {
|
|
1950
1960
|
//#region process json request
|
|
1951
|
-
await EntityProcess
|
|
1961
|
+
await new EntityProcess(result, res).run();
|
|
1952
1962
|
//#endregion
|
|
1953
1963
|
}
|
|
1954
1964
|
}
|
|
@@ -2029,7 +2039,7 @@ export class EndpointContext {
|
|
|
2029
2039
|
const middlewareName = ClassHelpers__NS__getName(instance);
|
|
2030
2040
|
// middlewareName - only needed for inheritace and uniqness of interceptors
|
|
2031
2041
|
const interceptorKey = `${middlewareName}-${methodConfig.type?.toUpperCase()}-${expressPath}`;
|
|
2032
|
-
|
|
2042
|
+
Resource__NS__methodsInterceptors.set(interceptorKey, {
|
|
2033
2043
|
intercept: ({ req, next }) => {
|
|
2034
2044
|
return instance.interceptClientMethod({
|
|
2035
2045
|
req,
|
|
@@ -2095,6 +2105,9 @@ export class EndpointContext {
|
|
|
2095
2105
|
/* */
|
|
2096
2106
|
/* */
|
|
2097
2107
|
/* */
|
|
2108
|
+
/* */
|
|
2109
|
+
/* */
|
|
2110
|
+
/* */
|
|
2098
2111
|
});
|
|
2099
2112
|
received['observable'] = from(received);
|
|
2100
2113
|
return {
|
|
@@ -2270,28 +2283,51 @@ export class EndpointContext {
|
|
|
2270
2283
|
storage[Symbols__NS__old.ENDPOINT_META_CONFIG][ctx.uriOrigin] = {};
|
|
2271
2284
|
const endpoints = storage[Symbols__NS__old.ENDPOINT_META_CONFIG];
|
|
2272
2285
|
let rest;
|
|
2286
|
+
const requestHeaders = RestHeaders.from({});
|
|
2273
2287
|
if (!endpoints[ctx.uriOrigin][expressPath]) {
|
|
2274
|
-
let headers = {};
|
|
2275
2288
|
if (methodConfig.contentType && !methodConfig.responseType) {
|
|
2276
|
-
rest =
|
|
2289
|
+
rest = Resource__NS__create(ctx.uriOrigin, expressPath, {
|
|
2290
|
+
responseMapping: {
|
|
2291
|
+
entity: Symbols__NS__old.MAPPING_CONFIG_HEADER,
|
|
2292
|
+
circular: Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY,
|
|
2293
|
+
},
|
|
2294
|
+
});
|
|
2295
|
+
requestHeaders.apply({
|
|
2277
2296
|
'Content-Type': methodConfig.contentType,
|
|
2278
2297
|
Accept: methodConfig.contentType,
|
|
2279
|
-
})
|
|
2298
|
+
});
|
|
2280
2299
|
}
|
|
2281
2300
|
else if (methodConfig.contentType && methodConfig.responseType) {
|
|
2282
|
-
rest =
|
|
2301
|
+
rest = Resource__NS__create(ctx.uriOrigin, expressPath, {
|
|
2302
|
+
responseMapping: {
|
|
2303
|
+
entity: Symbols__NS__old.MAPPING_CONFIG_HEADER,
|
|
2304
|
+
circular: Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY,
|
|
2305
|
+
},
|
|
2306
|
+
});
|
|
2307
|
+
requestHeaders.apply({
|
|
2283
2308
|
'Content-Type': methodConfig.contentType,
|
|
2284
2309
|
Accept: methodConfig.contentType,
|
|
2285
2310
|
responsetypeaxios: methodConfig.responseType,
|
|
2286
|
-
})
|
|
2311
|
+
});
|
|
2287
2312
|
}
|
|
2288
2313
|
else if (!methodConfig.contentType && methodConfig.responseType) {
|
|
2289
|
-
rest =
|
|
2314
|
+
rest = Resource__NS__create(ctx.uriOrigin, expressPath, {
|
|
2315
|
+
responseMapping: {
|
|
2316
|
+
entity: Symbols__NS__old.MAPPING_CONFIG_HEADER,
|
|
2317
|
+
circular: Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY,
|
|
2318
|
+
},
|
|
2319
|
+
});
|
|
2320
|
+
requestHeaders.apply({
|
|
2290
2321
|
responsetypeaxios: methodConfig.responseType,
|
|
2291
|
-
})
|
|
2322
|
+
});
|
|
2292
2323
|
}
|
|
2293
2324
|
else {
|
|
2294
|
-
rest =
|
|
2325
|
+
rest = Resource__NS__create(ctx.uriOrigin, expressPath, {
|
|
2326
|
+
responseMapping: {
|
|
2327
|
+
entity: Symbols__NS__old.MAPPING_CONFIG_HEADER,
|
|
2328
|
+
circular: Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY,
|
|
2329
|
+
},
|
|
2330
|
+
});
|
|
2295
2331
|
}
|
|
2296
2332
|
endpoints[ctx.uriOrigin][expressPath] = rest;
|
|
2297
2333
|
}
|
|
@@ -2320,47 +2356,60 @@ export class EndpointContext {
|
|
|
2320
2356
|
//#endregion
|
|
2321
2357
|
throw new Error(errorMessage);
|
|
2322
2358
|
}
|
|
2359
|
+
const optionsDecodeHeader = {
|
|
2360
|
+
useFirstArrayItemClassNameForAllElements: true,
|
|
2361
|
+
};
|
|
2323
2362
|
if (currentParam.paramType === 'Path') {
|
|
2363
|
+
//#region handle path params
|
|
2324
2364
|
pathPrams[currentParam.paramName] = param;
|
|
2365
|
+
//#endregion
|
|
2325
2366
|
}
|
|
2326
2367
|
if (currentParam.paramType === 'Query') {
|
|
2368
|
+
//#region handle query params
|
|
2327
2369
|
if (currentParam.paramName) {
|
|
2328
|
-
const mapping =
|
|
2370
|
+
const mapping = decodeMappingForHeaderJson(param, optionsDecodeHeader);
|
|
2329
2371
|
if (mapping) {
|
|
2330
|
-
|
|
2372
|
+
requestHeaders.set(`${Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
|
|
2331
2373
|
}
|
|
2332
2374
|
queryParams[currentParam.paramName] = param;
|
|
2333
2375
|
}
|
|
2334
2376
|
else {
|
|
2335
|
-
const mapping =
|
|
2377
|
+
const mapping = decodeMappingForHeaderJson(param, optionsDecodeHeader);
|
|
2336
2378
|
if (mapping) {
|
|
2337
|
-
|
|
2379
|
+
requestHeaders.set(Symbols__NS__old.MAPPING_CONFIG_HEADER_QUERY_PARAMS, JSON.stringify(mapping));
|
|
2338
2380
|
}
|
|
2339
2381
|
queryParams = ___NS__cloneDeep(param);
|
|
2340
2382
|
}
|
|
2383
|
+
//#endregion
|
|
2341
2384
|
}
|
|
2342
2385
|
if (currentParam.paramType === 'Header') {
|
|
2386
|
+
//#region handler header params
|
|
2343
2387
|
if (currentParam.paramName) {
|
|
2344
2388
|
if (currentParam.paramName === Symbols__NS__old.MDC_KEY) {
|
|
2345
2389
|
// parese MDC
|
|
2346
|
-
|
|
2390
|
+
requestHeaders.set(currentParam.paramName, encodeURIComponent(JSON.stringify(param)));
|
|
2347
2391
|
}
|
|
2348
2392
|
else {
|
|
2349
|
-
|
|
2393
|
+
requestHeaders.set(currentParam.paramName, param);
|
|
2350
2394
|
}
|
|
2351
2395
|
}
|
|
2352
2396
|
else {
|
|
2353
2397
|
for (let header in param) {
|
|
2354
|
-
|
|
2398
|
+
requestHeaders.set(header, param[header]);
|
|
2355
2399
|
}
|
|
2356
2400
|
}
|
|
2401
|
+
//#endregion
|
|
2357
2402
|
}
|
|
2358
2403
|
if (currentParam.paramType === 'Cookie') {
|
|
2359
|
-
|
|
2404
|
+
//#region handle cookie params
|
|
2405
|
+
Resource__NS__Cookies.write(currentParam.paramName, param, currentParam.expireInSeconds);
|
|
2406
|
+
//#endregion
|
|
2360
2407
|
}
|
|
2361
2408
|
if (currentParam.paramType === 'Body') {
|
|
2409
|
+
//#region handle body params
|
|
2362
2410
|
if (currentParam.paramName) {
|
|
2363
2411
|
if (ClassHelpers__NS__getName(bodyObject) === 'FormData') {
|
|
2412
|
+
//#region prevent posting/putting not full body as FormData
|
|
2364
2413
|
throw new Error(`[taon - framework] Don use param names when posting / putting FormData.
|
|
2365
2414
|
Use this:
|
|
2366
2415
|
// ...
|
|
@@ -2372,45 +2421,52 @@ instead
|
|
|
2372
2421
|
(@Taon.Http.Param.Body('${currentParam.paramName}') formData: FormData) ...
|
|
2373
2422
|
// ...
|
|
2374
2423
|
`);
|
|
2424
|
+
//#endregion
|
|
2375
2425
|
}
|
|
2376
|
-
const mapping =
|
|
2426
|
+
const mapping = decodeMappingForHeaderJson(param, optionsDecodeHeader);
|
|
2377
2427
|
if (mapping) {
|
|
2378
|
-
|
|
2428
|
+
requestHeaders.set(`${Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
|
|
2379
2429
|
}
|
|
2380
2430
|
bodyObject[currentParam.paramName] = param;
|
|
2381
2431
|
}
|
|
2382
2432
|
else {
|
|
2383
|
-
const mapping =
|
|
2433
|
+
const mapping = decodeMappingForHeaderJson(param, optionsDecodeHeader);
|
|
2384
2434
|
if (mapping) {
|
|
2385
|
-
|
|
2435
|
+
requestHeaders.set(Symbols__NS__old.MAPPING_CONFIG_HEADER_BODY_PARAMS, JSON.stringify(mapping));
|
|
2386
2436
|
}
|
|
2387
2437
|
bodyObject = param;
|
|
2388
2438
|
}
|
|
2439
|
+
//#endregion
|
|
2389
2440
|
}
|
|
2390
2441
|
});
|
|
2391
2442
|
if (typeof bodyObject === 'object' &&
|
|
2392
2443
|
ClassHelpers__NS__getName(bodyObject) !== 'FormData') {
|
|
2444
|
+
//#region handle circular objects in body params
|
|
2393
2445
|
let circuralFromItem = [];
|
|
2394
2446
|
bodyObject = JSON10.parse(JSON10.stringify(bodyObject, void 0, void 0, circs => {
|
|
2395
2447
|
circuralFromItem = circs;
|
|
2396
2448
|
}));
|
|
2397
|
-
|
|
2449
|
+
requestHeaders.set(Symbols__NS__old.CIRCURAL_OBJECTS_MAP_BODY, JSON10.stringify(circuralFromItem));
|
|
2450
|
+
//#endregion
|
|
2398
2451
|
}
|
|
2399
2452
|
if (typeof queryParams === 'object') {
|
|
2453
|
+
//#region handle circular objects in query params
|
|
2400
2454
|
let circuralFromQueryParams = [];
|
|
2401
2455
|
queryParams = JSON10.parse(JSON10.stringify(queryParams, void 0, void 0, circs => {
|
|
2402
2456
|
circuralFromQueryParams = circs;
|
|
2403
2457
|
}));
|
|
2404
|
-
|
|
2458
|
+
requestHeaders.set(Symbols__NS__old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM, JSON10.stringify(circuralFromQueryParams));
|
|
2459
|
+
//#endregion
|
|
2405
2460
|
}
|
|
2406
2461
|
//#endregion
|
|
2407
2462
|
const httpResultObj = {
|
|
2408
2463
|
get received() {
|
|
2409
|
-
return rest
|
|
2464
|
+
return rest
|
|
2465
|
+
.model(pathPrams, { headers: requestHeaders })[method](bodyObject, [queryParams]);
|
|
2410
2466
|
},
|
|
2411
2467
|
request(axiosConfig) {
|
|
2412
2468
|
return rest
|
|
2413
|
-
.model(pathPrams)[method](bodyObject, [queryParams], axiosConfig);
|
|
2469
|
+
.model(pathPrams, { headers: requestHeaders })[method](bodyObject, [queryParams], axiosConfig);
|
|
2414
2470
|
},
|
|
2415
2471
|
};
|
|
2416
2472
|
return httpResultObj;
|