@revisium/endpoint 0.11.0-alpha.1 → 0.11.0-alpha.3
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/dist/endpoint-microservice/graphql/commands/handlers/create-graphql-endpoint.handler.d.ts +1 -0
- package/dist/endpoint-microservice/graphql/commands/handlers/create-graphql-endpoint.handler.js +11 -3
- package/dist/endpoint-microservice/graphql/commands/handlers/create-graphql-endpoint.handler.js.map +1 -1
- package/dist/endpoint-microservice/graphql/graphql-endpoint.service.js +9 -5
- package/dist/endpoint-microservice/graphql/graphql-endpoint.service.js.map +1 -1
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/constants.d.ts +1 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/constants.js +5 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/constants.js.map +1 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/graphql-schema.converter.d.ts +29 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/graphql-schema.converter.js +204 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/graphql-schema.converter.js.map +1 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/types.d.ts +13 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/types.js +26 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/types.js.map +1 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/utils.d.ts +5 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/utils.js +38 -0
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/utils.js.map +1 -0
- package/dist/endpoint-microservice/graphql/graphql.module.js +12 -1
- package/dist/endpoint-microservice/graphql/graphql.module.js.map +1 -1
- package/dist/endpoint-microservice/graphql/queries/handlers/get-graphql-schema.handler.d.ts +5 -14
- package/dist/endpoint-microservice/graphql/queries/handlers/get-graphql-schema.handler.js +21 -211
- package/dist/endpoint-microservice/graphql/queries/handlers/get-graphql-schema.handler.js.map +1 -1
- package/dist/endpoint-microservice/graphql/queries/impl/get-graphql-schema.query.d.ts +8 -0
- package/dist/endpoint-microservice/graphql/queries/impl/get-graphql-schema.query.js.map +1 -1
- package/dist/endpoint-microservice/restapi/commands/handlers/create-restapi-endpoint.handler.d.ts +1 -0
- package/dist/endpoint-microservice/restapi/commands/handlers/create-restapi-endpoint.handler.js +11 -3
- package/dist/endpoint-microservice/restapi/commands/handlers/create-restapi-endpoint.handler.js.map +1 -1
- package/dist/endpoint-microservice/restapi/queries/handlers/get-open-api-schema.handler.js +2 -2
- package/dist/endpoint-microservice/restapi/queries/handlers/get-open-api-schema.handler.js.map +1 -1
- package/dist/endpoint-microservice/shared/converter.d.ts +17 -0
- package/dist/endpoint-microservice/shared/{types/json-schema-type.js → converter.js} +1 -1
- package/dist/endpoint-microservice/shared/converter.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/index.d.ts +5 -0
- package/dist/endpoint-microservice/shared/schema/index.js +22 -0
- package/dist/endpoint-microservice/shared/schema/index.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/lib/createJsonSchemaStore.d.ts +5 -0
- package/dist/endpoint-microservice/shared/schema/lib/createJsonSchemaStore.js +56 -0
- package/dist/endpoint-microservice/shared/schema/lib/createJsonSchemaStore.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/lib/createJsonValueStore.d.ts +5 -0
- package/dist/endpoint-microservice/shared/schema/lib/createJsonValueStore.js +49 -0
- package/dist/endpoint-microservice/shared/schema/lib/createJsonValueStore.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/lib/index.d.ts +5 -0
- package/dist/endpoint-microservice/shared/schema/lib/index.js +22 -0
- package/dist/endpoint-microservice/shared/schema/lib/index.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/lib/resolveRefs.d.ts +3 -0
- package/dist/endpoint-microservice/shared/schema/lib/resolveRefs.js +15 -0
- package/dist/endpoint-microservice/shared/schema/lib/resolveRefs.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/lib/traverseStore.d.ts +2 -0
- package/dist/endpoint-microservice/shared/schema/lib/traverseStore.js +17 -0
- package/dist/endpoint-microservice/shared/schema/lib/traverseStore.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/lib/traverseValue.d.ts +2 -0
- package/dist/endpoint-microservice/shared/schema/lib/traverseValue.js +19 -0
- package/dist/endpoint-microservice/shared/schema/lib/traverseValue.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/index.d.ts +2 -0
- package/dist/endpoint-microservice/shared/schema/model/index.js +19 -0
- package/dist/endpoint-microservice/shared/schema/model/index.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/index.d.ts +6 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/index.js +23 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/index.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-array.store.d.ts +30 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-array.store.js +74 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-array.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-boolean.store.d.ts +19 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-boolean.store.js +44 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-boolean.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-number.store.d.ts +19 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-number.store.js +44 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-number.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-object.store.d.ts +45 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-object.store.js +146 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-object.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-schema.store.d.ts +3 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-schema.store.js +3 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-schema.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-string.store.d.ts +20 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-string.store.js +48 -0
- package/dist/endpoint-microservice/shared/schema/model/schema/json-string.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/value/index.d.ts +7 -0
- package/dist/endpoint-microservice/shared/schema/model/value/index.js +24 -0
- package/dist/endpoint-microservice/shared/schema/model/value/index.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-array-value.store.d.ts +15 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-array-value.store.js +47 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-array-value.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-boolean-value.store.d.ts +11 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-boolean-value.store.js +19 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-boolean-value.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-number-value.store.d.ts +11 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-number-value.store.js +19 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-number-value.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-object-value.store.d.ts +18 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-object-value.store.js +60 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-object-value.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-string-value.store.d.ts +12 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-string-value.store.js +22 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-string-value.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-value.store.d.ts +4 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-value.store.js +3 -0
- package/dist/endpoint-microservice/shared/schema/model/value/json-value.store.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/model/value/value-transformation.d.ts +13 -0
- package/dist/endpoint-microservice/shared/schema/model/value/value-transformation.js +110 -0
- package/dist/endpoint-microservice/shared/schema/model/value/value-transformation.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/plugins/file-schema.d.ts +4 -0
- package/dist/endpoint-microservice/shared/schema/plugins/file-schema.js +62 -0
- package/dist/endpoint-microservice/shared/schema/plugins/file-schema.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/plugins/index.d.ts +1 -0
- package/dist/endpoint-microservice/shared/schema/plugins/index.js +18 -0
- package/dist/endpoint-microservice/shared/schema/plugins/index.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/schema.mocks.d.ts +25 -0
- package/dist/endpoint-microservice/shared/schema/schema.mocks.js +65 -0
- package/dist/endpoint-microservice/shared/schema/schema.mocks.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/types/index.d.ts +3 -0
- package/dist/endpoint-microservice/shared/schema/types/index.js +20 -0
- package/dist/endpoint-microservice/shared/schema/types/index.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/types/json-patch.types.d.ts +21 -0
- package/dist/endpoint-microservice/shared/schema/types/json-patch.types.js +3 -0
- package/dist/endpoint-microservice/shared/schema/types/json-patch.types.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/types/json.types.d.ts +6 -0
- package/dist/endpoint-microservice/shared/schema/types/json.types.js +3 -0
- package/dist/endpoint-microservice/shared/schema/types/json.types.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/types/schema.types.d.ts +38 -0
- package/dist/endpoint-microservice/shared/schema/types/schema.types.js +12 -0
- package/dist/endpoint-microservice/shared/schema/types/schema.types.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema-ids.consts.d.ts +3 -0
- package/dist/endpoint-microservice/shared/schema-ids.consts.js +8 -0
- package/dist/endpoint-microservice/shared/schema-ids.consts.js.map +1 -0
- package/dist/endpoint-microservice/shared/utils/stringUtils.d.ts +3 -0
- package/dist/endpoint-microservice/shared/utils/stringUtils.js +37 -0
- package/dist/endpoint-microservice/shared/utils/stringUtils.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -2
- package/dist/endpoint-microservice/shared/types/json-schema-type.d.ts +0 -24
- package/dist/endpoint-microservice/shared/types/json-schema-type.js.map +0 -1
@@ -0,0 +1,20 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { EventEmitter } from 'node:events';
|
3
|
+
import { JsonSchemaStore, JsonStringValueStore, JsonRefSchema, JsonSchemaTypeName, JsonStringSchema } from '../../../../../endpoint-microservice/shared/schema';
|
4
|
+
export declare class JsonStringStore extends EventEmitter implements JsonStringSchema {
|
5
|
+
readonly nodeId: string;
|
6
|
+
readonly type = JsonSchemaTypeName.String;
|
7
|
+
$ref: string;
|
8
|
+
name: string;
|
9
|
+
parent: JsonSchemaStore | null;
|
10
|
+
default: string;
|
11
|
+
foreignKey?: string;
|
12
|
+
private readonly valuesMap;
|
13
|
+
constructor(nodeId?: string);
|
14
|
+
registerValue(value: JsonStringValueStore): number;
|
15
|
+
getValue(rowId: string, index?: number): JsonStringValueStore | undefined;
|
16
|
+
getPlainSchema(options?: {
|
17
|
+
skip$Ref?: boolean;
|
18
|
+
}): JsonStringSchema | JsonRefSchema;
|
19
|
+
private getOrCreateValues;
|
20
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.JsonStringStore = void 0;
|
4
|
+
const nanoid_1 = require("nanoid");
|
5
|
+
const node_events_1 = require("node:events");
|
6
|
+
const schema_1 = require("../..");
|
7
|
+
class JsonStringStore extends node_events_1.EventEmitter {
|
8
|
+
constructor(nodeId = (0, nanoid_1.nanoid)()) {
|
9
|
+
super();
|
10
|
+
this.nodeId = nodeId;
|
11
|
+
this.type = schema_1.JsonSchemaTypeName.String;
|
12
|
+
this.$ref = '';
|
13
|
+
this.name = '';
|
14
|
+
this.parent = null;
|
15
|
+
this.default = '';
|
16
|
+
this.valuesMap = new Map();
|
17
|
+
}
|
18
|
+
registerValue(value) {
|
19
|
+
const length = this.getOrCreateValues(value.rowId).push(value);
|
20
|
+
return length - 1;
|
21
|
+
}
|
22
|
+
getValue(rowId, index = 0) {
|
23
|
+
return this.getOrCreateValues(rowId)[index];
|
24
|
+
}
|
25
|
+
getPlainSchema(options) {
|
26
|
+
if (this.$ref && options?.skip$Ref !== true) {
|
27
|
+
return { $ref: this.$ref };
|
28
|
+
}
|
29
|
+
const schema = {
|
30
|
+
type: this.type,
|
31
|
+
default: this.default,
|
32
|
+
};
|
33
|
+
if (this.foreignKey) {
|
34
|
+
schema.foreignKey = this.foreignKey;
|
35
|
+
}
|
36
|
+
return schema;
|
37
|
+
}
|
38
|
+
getOrCreateValues(rowId) {
|
39
|
+
let values = this.valuesMap.get(rowId);
|
40
|
+
if (!values) {
|
41
|
+
values = [];
|
42
|
+
this.valuesMap.set(rowId, values);
|
43
|
+
}
|
44
|
+
return values;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
exports.JsonStringStore = JsonStringStore;
|
48
|
+
//# sourceMappingURL=json-string.store.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"json-string.store.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/schema/json-string.store.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,6CAA2C;AAC3C,kCAMiD;AAEjD,MAAa,eAAgB,SAAQ,0BAAY;IAc/C,YAA4B,SAAiB,IAAA,eAAM,GAAE;QACnD,KAAK,EAAE,CAAC;QADkB,WAAM,GAAN,MAAM,CAAmB;QAbrC,SAAI,GAAG,2BAAkB,CAAC,MAAM,CAAC;QAE1C,SAAI,GAAW,EAAE,CAAC;QAClB,SAAI,GAAW,EAAE,CAAC;QAClB,WAAM,GAA2B,IAAI,CAAC;QAEtC,YAAO,GAAW,EAAE,CAAC;QAEX,cAAS,GAAwC,IAAI,GAAG,EAGtE,CAAC;IAIJ,CAAC;IAEM,aAAa,CAAC,KAA2B;QAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,OAAO,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC;IAEM,QAAQ,CACb,KAAa,EACb,QAAgB,CAAC;QAEjB,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAEM,cAAc,CAAC,OAErB;QACC,IAAI,IAAI,CAAC,IAAI,IAAI,OAAO,EAAE,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC5C,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QAC7B,CAAC;QAED,MAAM,MAAM,GAAqB;YAC/B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;QAEF,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACtC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,iBAAiB,CAAC,KAAa;QACrC,IAAI,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,EAAE,CAAC;YACZ,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA3DD,0CA2DC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export * from './json-string-value.store';
|
2
|
+
export * from './json-number-value.store';
|
3
|
+
export * from './json-boolean-value.store';
|
4
|
+
export * from './json-object-value.store';
|
5
|
+
export * from './json-array-value.store';
|
6
|
+
export * from './json-value.store';
|
7
|
+
export * from './value-transformation';
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./json-string-value.store"), exports);
|
18
|
+
__exportStar(require("./json-number-value.store"), exports);
|
19
|
+
__exportStar(require("./json-boolean-value.store"), exports);
|
20
|
+
__exportStar(require("./json-object-value.store"), exports);
|
21
|
+
__exportStar(require("./json-array-value.store"), exports);
|
22
|
+
__exportStar(require("./json-value.store"), exports);
|
23
|
+
__exportStar(require("./value-transformation"), exports);
|
24
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/value/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,4DAA0C;AAC1C,6DAA2C;AAC3C,4DAA0C;AAC1C,2DAAyC;AACzC,qDAAmC;AACnC,yDAAuC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { JsonArrayStore, MigrateItemsEvent, ReplaceItemsEvent, JsonValueStore, JsonValueStoreParent, JsonArray, JsonSchemaTypeName } from '../../../../../endpoint-microservice/shared/schema';
|
2
|
+
export declare class JsonArrayValueStore {
|
3
|
+
readonly schema: JsonArrayStore;
|
4
|
+
readonly rowId: string;
|
5
|
+
value: JsonValueStore[];
|
6
|
+
readonly type = JsonSchemaTypeName.Array;
|
7
|
+
index: number;
|
8
|
+
parent: JsonValueStoreParent | null;
|
9
|
+
constructor(schema: JsonArrayStore, rowId: string, value: JsonValueStore[]);
|
10
|
+
getPlainValue(): JsonArray;
|
11
|
+
migrateItems(event: MigrateItemsEvent): void;
|
12
|
+
replaceItems(event: ReplaceItemsEvent): void;
|
13
|
+
private getReplacedValue;
|
14
|
+
private init;
|
15
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.JsonArrayValueStore = void 0;
|
4
|
+
const schema_1 = require("../..");
|
5
|
+
class JsonArrayValueStore {
|
6
|
+
constructor(schema, rowId, value) {
|
7
|
+
this.schema = schema;
|
8
|
+
this.rowId = rowId;
|
9
|
+
this.value = value;
|
10
|
+
this.type = schema_1.JsonSchemaTypeName.Array;
|
11
|
+
this.parent = null;
|
12
|
+
this.index = this.schema.registerValue(this);
|
13
|
+
this.init();
|
14
|
+
}
|
15
|
+
getPlainValue() {
|
16
|
+
return this.value.map((item) => item.getPlainValue());
|
17
|
+
}
|
18
|
+
migrateItems(event) {
|
19
|
+
const transformation = (0, schema_1.getTransformation)(event.previousItems, event.items);
|
20
|
+
this.value = this.value.map((valueItem) => {
|
21
|
+
const rawValue = transformation
|
22
|
+
? transformation(valueItem.getPlainValue(), event.items.default)
|
23
|
+
: event.items.default;
|
24
|
+
return (0, schema_1.createJsonValueStore)(event.items, this.rowId, rawValue);
|
25
|
+
});
|
26
|
+
}
|
27
|
+
replaceItems(event) {
|
28
|
+
this.value = this.value.map(() => {
|
29
|
+
const rawValue = this.getReplacedValue(event);
|
30
|
+
return (0, schema_1.createJsonValueStore)(event.items, this.rowId, rawValue);
|
31
|
+
});
|
32
|
+
}
|
33
|
+
getReplacedValue(event) {
|
34
|
+
const previousValue = event.items.getValue(this.rowId);
|
35
|
+
if (previousValue) {
|
36
|
+
return previousValue.getPlainValue();
|
37
|
+
}
|
38
|
+
return event.items.default;
|
39
|
+
}
|
40
|
+
init() {
|
41
|
+
for (const value of this.value) {
|
42
|
+
value.parent = this;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
exports.JsonArrayValueStore = JsonArrayValueStore;
|
47
|
+
//# sourceMappingURL=json-array-value.store.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"json-array-value.store.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/value/json-array-value.store.ts"],"names":[],"mappings":";;;AAAA,kCAWiD;AAEjD,MAAa,mBAAmB;IAO9B,YACkB,MAAsB,EACtB,KAAa,EACtB,KAAuB;QAFd,WAAM,GAAN,MAAM,CAAgB;QACtB,UAAK,GAAL,KAAK,CAAQ;QACtB,UAAK,GAAL,KAAK,CAAkB;QAThB,SAAI,GAAG,2BAAkB,CAAC,KAAK,CAAC;QAIzC,WAAM,GAAgC,IAAI,CAAC;QAOhD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAEM,aAAa;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IACxD,CAAC;IAEM,YAAY,CAAC,KAAwB;QAC1C,MAAM,cAAc,GAAG,IAAA,0BAAiB,EAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAE3E,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YACxC,MAAM,QAAQ,GAAG,cAAc;gBAC7B,CAAC,CAAE,cAAc,CACb,SAAS,CAAC,aAAa,EAAE,EACzB,KAAK,CAAC,KAAK,CAAC,OAAO,CACN;gBACjB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;YAExB,OAAO,IAAA,6BAAoB,EAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,YAAY,CAAC,KAAwB;QAC1C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAE9C,OAAO,IAAA,6BAAoB,EAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,gBAAgB,CAAC,KAAwB;QAC/C,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEvD,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,aAAa,CAAC,aAAa,EAAE,CAAC;QACvC,CAAC;QAED,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;IAC7B,CAAC;IAEO,IAAI;QACV,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC/B,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AA1DD,kDA0DC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { JsonBooleanStore, JsonValueStoreParent, JsonSchemaTypeName } from '../../../../../endpoint-microservice/shared/schema';
|
2
|
+
export declare class JsonBooleanValueStore {
|
3
|
+
readonly schema: JsonBooleanStore;
|
4
|
+
readonly rowId: string;
|
5
|
+
value: boolean | null;
|
6
|
+
readonly type = JsonSchemaTypeName.Boolean;
|
7
|
+
readonly index: number;
|
8
|
+
parent: JsonValueStoreParent | null;
|
9
|
+
constructor(schema: JsonBooleanStore, rowId: string, value?: boolean | null);
|
10
|
+
getPlainValue(): boolean;
|
11
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.JsonBooleanValueStore = void 0;
|
4
|
+
const schema_1 = require("../..");
|
5
|
+
class JsonBooleanValueStore {
|
6
|
+
constructor(schema, rowId, value = null) {
|
7
|
+
this.schema = schema;
|
8
|
+
this.rowId = rowId;
|
9
|
+
this.value = value;
|
10
|
+
this.type = schema_1.JsonSchemaTypeName.Boolean;
|
11
|
+
this.parent = null;
|
12
|
+
this.index = this.schema.registerValue(this);
|
13
|
+
}
|
14
|
+
getPlainValue() {
|
15
|
+
return this.value ?? this.schema.default;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
exports.JsonBooleanValueStore = JsonBooleanValueStore;
|
19
|
+
//# sourceMappingURL=json-boolean-value.store.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"json-boolean-value.store.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/value/json-boolean-value.store.ts"],"names":[],"mappings":";;;AAAA,kCAIiD;AAEjD,MAAa,qBAAqB;IAOhC,YACkB,MAAwB,EACxB,KAAa,EACtB,QAAwB,IAAI;QAFnB,WAAM,GAAN,MAAM,CAAkB;QACxB,UAAK,GAAL,KAAK,CAAQ;QACtB,UAAK,GAAL,KAAK,CAAuB;QATrB,SAAI,GAAG,2BAAkB,CAAC,OAAO,CAAC;QAI3C,WAAM,GAAgC,IAAI,CAAC;QAOhD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAEM,aAAa;QAClB,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC3C,CAAC;CACF;AAlBD,sDAkBC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { JsonNumberStore, JsonValueStoreParent, JsonSchemaTypeName } from '../../../../../endpoint-microservice/shared/schema';
|
2
|
+
export declare class JsonNumberValueStore {
|
3
|
+
readonly schema: JsonNumberStore;
|
4
|
+
readonly rowId: string;
|
5
|
+
value: number | null;
|
6
|
+
readonly type = JsonSchemaTypeName.Number;
|
7
|
+
readonly index: number;
|
8
|
+
parent: JsonValueStoreParent | null;
|
9
|
+
constructor(schema: JsonNumberStore, rowId: string, value?: number | null);
|
10
|
+
getPlainValue(): number;
|
11
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.JsonNumberValueStore = void 0;
|
4
|
+
const schema_1 = require("../..");
|
5
|
+
class JsonNumberValueStore {
|
6
|
+
constructor(schema, rowId, value = null) {
|
7
|
+
this.schema = schema;
|
8
|
+
this.rowId = rowId;
|
9
|
+
this.value = value;
|
10
|
+
this.type = schema_1.JsonSchemaTypeName.Number;
|
11
|
+
this.parent = null;
|
12
|
+
this.index = this.schema.registerValue(this);
|
13
|
+
}
|
14
|
+
getPlainValue() {
|
15
|
+
return this.value ?? this.schema.default;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
exports.JsonNumberValueStore = JsonNumberValueStore;
|
19
|
+
//# sourceMappingURL=json-number-value.store.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"json-number-value.store.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/value/json-number-value.store.ts"],"names":[],"mappings":";;;AAAA,kCAIiD;AAEjD,MAAa,oBAAoB;IAO/B,YACkB,MAAuB,EACvB,KAAa,EACtB,QAAuB,IAAI;QAFlB,WAAM,GAAN,MAAM,CAAiB;QACvB,UAAK,GAAL,KAAK,CAAQ;QACtB,UAAK,GAAL,KAAK,CAAsB;QATpB,SAAI,GAAG,2BAAkB,CAAC,MAAM,CAAC;QAI1C,WAAM,GAAgC,IAAI,CAAC;QAOhD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAEM,aAAa;QAClB,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC3C,CAAC;CACF;AAlBD,oDAkBC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { AddedPropertyEvent, ChangeNameEvent, JsonObjectStore, MigratePropertyEvent, RemovedPropertyEvent, JsonValueStore, JsonValueStoreParent, JsonObject, JsonSchemaTypeName } from '../../../../../endpoint-microservice/shared/schema';
|
2
|
+
export declare class JsonObjectValueStore {
|
3
|
+
readonly schema: JsonObjectStore;
|
4
|
+
readonly rowId: string;
|
5
|
+
value: Record<string, JsonValueStore>;
|
6
|
+
readonly type = JsonSchemaTypeName.Object;
|
7
|
+
index: number;
|
8
|
+
parent: JsonValueStoreParent | null;
|
9
|
+
constructor(schema: JsonObjectStore, rowId: string, value: Record<string, JsonValueStore>);
|
10
|
+
getPlainValue(): JsonObject;
|
11
|
+
migrateProperty(event: MigratePropertyEvent): void;
|
12
|
+
addProperty(event: AddedPropertyEvent): void;
|
13
|
+
removeProperty(event: RemovedPropertyEvent): void;
|
14
|
+
changeName(event: ChangeNameEvent): void;
|
15
|
+
private getAddedValue;
|
16
|
+
private getMigratedValue;
|
17
|
+
private init;
|
18
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.JsonObjectValueStore = void 0;
|
4
|
+
const schema_1 = require("../..");
|
5
|
+
class JsonObjectValueStore {
|
6
|
+
constructor(schema, rowId, value) {
|
7
|
+
this.schema = schema;
|
8
|
+
this.rowId = rowId;
|
9
|
+
this.value = value;
|
10
|
+
this.type = schema_1.JsonSchemaTypeName.Object;
|
11
|
+
this.parent = null;
|
12
|
+
this.index = this.schema.registerValue(this);
|
13
|
+
this.init();
|
14
|
+
}
|
15
|
+
getPlainValue() {
|
16
|
+
return Object.entries(this.value).reduce((result, [name, store]) => {
|
17
|
+
result[name] = store.getPlainValue();
|
18
|
+
return result;
|
19
|
+
}, {});
|
20
|
+
}
|
21
|
+
migrateProperty(event) {
|
22
|
+
const rawValue = this.getMigratedValue(event);
|
23
|
+
this.value[event.name] = (0, schema_1.createJsonValueStore)(event.property, this.rowId, rawValue);
|
24
|
+
}
|
25
|
+
addProperty(event) {
|
26
|
+
const rawValue = this.getAddedValue(event);
|
27
|
+
this.value[event.name] = (0, schema_1.createJsonValueStore)(event.property, this.rowId, rawValue);
|
28
|
+
}
|
29
|
+
removeProperty(event) {
|
30
|
+
delete this.value[event.name];
|
31
|
+
}
|
32
|
+
changeName(event) {
|
33
|
+
const itemValue = this.value[event.fromName];
|
34
|
+
if (itemValue !== undefined) {
|
35
|
+
delete this.value[event.fromName];
|
36
|
+
this.value[event.toName] = itemValue;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
getAddedValue(event) {
|
40
|
+
const previousValue = event.property.getValue(this.rowId, this.index);
|
41
|
+
if (previousValue) {
|
42
|
+
return previousValue.getPlainValue();
|
43
|
+
}
|
44
|
+
return event.property.default;
|
45
|
+
}
|
46
|
+
getMigratedValue(event) {
|
47
|
+
const transformation = (0, schema_1.getTransformation)(event.previousProperty, event.property);
|
48
|
+
if (transformation) {
|
49
|
+
return transformation(this.value[event.name].getPlainValue(), event.property.default);
|
50
|
+
}
|
51
|
+
return event.property.default;
|
52
|
+
}
|
53
|
+
init() {
|
54
|
+
for (const value of Object.values(this.value)) {
|
55
|
+
value.parent = this;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
exports.JsonObjectValueStore = JsonObjectValueStore;
|
60
|
+
//# sourceMappingURL=json-object-value.store.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"json-object-value.store.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/value/json-object-value.store.ts"],"names":[],"mappings":";;;AAAA,kCAaiD;AAEjD,MAAa,oBAAoB;IAO/B,YACkB,MAAuB,EACvB,KAAa,EACtB,KAAqC;QAF5B,WAAM,GAAN,MAAM,CAAiB;QACvB,UAAK,GAAL,KAAK,CAAQ;QACtB,UAAK,GAAL,KAAK,CAAgC;QAT9B,SAAI,GAAG,2BAAkB,CAAC,MAAM,CAAC;QAI1C,WAAM,GAAgC,IAAI,CAAC;QAOhD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAEM,aAAa;QAClB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CACtC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;YACxB,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,aAAa,EAAe,CAAC;YAClD,OAAO,MAAM,CAAC;QAChB,CAAC,EACD,EAAE,CACH,CAAC;IACJ,CAAC;IAEM,eAAe,CAAC,KAA2B;QAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAE9C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAA,6BAAoB,EAC3C,KAAK,CAAC,QAAQ,EACd,IAAI,CAAC,KAAK,EACV,QAAQ,CACT,CAAC;IACJ,CAAC;IAEM,WAAW,CAAC,KAAyB;QAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE3C,IAAI,CAA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V,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AA1FD,oDA0FC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { JsonStringStore, JsonValueStoreParent, JsonSchemaTypeName } from '../../../../../endpoint-microservice/shared/schema';
|
2
|
+
export declare class JsonStringValueStore {
|
3
|
+
readonly schema: JsonStringStore;
|
4
|
+
readonly rowId: string;
|
5
|
+
value: string | null;
|
6
|
+
readonly type = JsonSchemaTypeName.String;
|
7
|
+
readonly index: number;
|
8
|
+
parent: JsonValueStoreParent | null;
|
9
|
+
constructor(schema: JsonStringStore, rowId: string, value?: string | null);
|
10
|
+
get foreignKey(): string;
|
11
|
+
getPlainValue(): string;
|
12
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.JsonStringValueStore = void 0;
|
4
|
+
const schema_1 = require("../..");
|
5
|
+
class JsonStringValueStore {
|
6
|
+
constructor(schema, rowId, value = null) {
|
7
|
+
this.schema = schema;
|
8
|
+
this.rowId = rowId;
|
9
|
+
this.value = value;
|
10
|
+
this.type = schema_1.JsonSchemaTypeName.String;
|
11
|
+
this.parent = null;
|
12
|
+
this.index = this.schema.registerValue(this);
|
13
|
+
}
|
14
|
+
get foreignKey() {
|
15
|
+
return this.schema.foreignKey;
|
16
|
+
}
|
17
|
+
getPlainValue() {
|
18
|
+
return this.value ?? this.schema.default;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
exports.JsonStringValueStore = JsonStringValueStore;
|
22
|
+
//# sourceMappingURL=json-string-value.store.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"json-string-value.store.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/value/json-string-value.store.ts"],"names":[],"mappings":";;;AAAA,kCAIiD;AAEjD,MAAa,oBAAoB;IAO/B,YACkB,MAAuB,EACvB,KAAa,EACtB,QAAuB,IAAI;QAFlB,WAAM,GAAN,MAAM,CAAiB;QACvB,UAAK,GAAL,KAAK,CAAQ;QACtB,UAAK,GAAL,KAAK,CAAsB;QATpB,SAAI,GAAG,2BAAkB,CAAC,MAAM,CAAC;QAI1C,WAAM,GAAgC,IAAI,CAAC;QAOhD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IAChC,CAAC;IAEM,aAAa;QAClB,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC3C,CAAC;CACF;AAtBD,oDAsBC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { JsonArrayValueStore, JsonBooleanValueStore, JsonNumberValueStore, JsonObjectValueStore, JsonStringValueStore } from '../../../../../endpoint-microservice/shared/schema';
|
2
|
+
export type JsonValueStorePrimitives = JsonStringValueStore | JsonNumberValueStore | JsonBooleanValueStore;
|
3
|
+
export type JsonValueStoreParent = JsonObjectValueStore | JsonArrayValueStore;
|
4
|
+
export type JsonValueStore = JsonValueStoreParent | JsonValueStorePrimitives;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"json-value.store.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/value/json-value.store.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { JsonSchemaStore } from '../../../../../endpoint-microservice/shared/schema';
|
2
|
+
export declare const equel: (value: unknown) => unknown;
|
3
|
+
export declare const fromNumberToString: (value: number, defaultValue?: string) => string;
|
4
|
+
export declare const fromBooleanToString: (value: boolean, defaultValue?: string) => string;
|
5
|
+
export declare const fromStringToBoolean: (value: string, defaultValue?: boolean) => boolean;
|
6
|
+
export declare const fromStringToNumber: (value: string, defaultValue?: number) => number;
|
7
|
+
export declare const fromBooleanToNumber: (value: boolean) => number;
|
8
|
+
export declare const fromNumberToBoolean: (value: number) => boolean;
|
9
|
+
export declare const toArrayTransformation: (transformation: Transformation) => (value: unknown) => unknown[];
|
10
|
+
export declare const fromArrayTransformation: (transformation: Transformation) => (value: unknown) => unknown;
|
11
|
+
export declare const getTransformation: (from: JsonSchemaStore, to: JsonSchemaStore) => Transformation | undefined;
|
12
|
+
type Transformation = (value: unknown, defaultValue?: unknown) => unknown;
|
13
|
+
export {};
|
@@ -0,0 +1,110 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getTransformation = exports.fromArrayTransformation = exports.toArrayTransformation = exports.fromNumberToBoolean = exports.fromBooleanToNumber = exports.fromStringToNumber = exports.fromStringToBoolean = exports.fromBooleanToString = exports.fromNumberToString = exports.equel = void 0;
|
4
|
+
const schema_1 = require("../..");
|
5
|
+
const schema_types_1 = require("../../types/schema.types");
|
6
|
+
const equel = (value) => value;
|
7
|
+
exports.equel = equel;
|
8
|
+
const fromNumberToString = (value, defaultValue = '') => value.toString() || defaultValue;
|
9
|
+
exports.fromNumberToString = fromNumberToString;
|
10
|
+
const fromBooleanToString = (value, defaultValue = '') => value.toString() || defaultValue;
|
11
|
+
exports.fromBooleanToString = fromBooleanToString;
|
12
|
+
const fromStringToBoolean = (value, defaultValue = false) => {
|
13
|
+
if (!value) {
|
14
|
+
return defaultValue;
|
15
|
+
}
|
16
|
+
if (value.toLowerCase() === 'false') {
|
17
|
+
return false;
|
18
|
+
}
|
19
|
+
return true;
|
20
|
+
};
|
21
|
+
exports.fromStringToBoolean = fromStringToBoolean;
|
22
|
+
const fromStringToNumber = (value, defaultValue = 0) => {
|
23
|
+
const number = parseFloat(value);
|
24
|
+
if (isNaN(number)) {
|
25
|
+
return defaultValue;
|
26
|
+
}
|
27
|
+
return number;
|
28
|
+
};
|
29
|
+
exports.fromStringToNumber = fromStringToNumber;
|
30
|
+
const fromBooleanToNumber = (value) => {
|
31
|
+
return Number(value);
|
32
|
+
};
|
33
|
+
exports.fromBooleanToNumber = fromBooleanToNumber;
|
34
|
+
const fromNumberToBoolean = (value) => {
|
35
|
+
return Boolean(value);
|
36
|
+
};
|
37
|
+
exports.fromNumberToBoolean = fromNumberToBoolean;
|
38
|
+
const toArrayTransformation = (transformation) => (value) => {
|
39
|
+
const result = transformation(value);
|
40
|
+
return [result];
|
41
|
+
};
|
42
|
+
exports.toArrayTransformation = toArrayTransformation;
|
43
|
+
const fromArrayTransformation = (transformation) => (value) => {
|
44
|
+
if (Array.isArray(value) && value.length) {
|
45
|
+
return transformation(value[0]);
|
46
|
+
}
|
47
|
+
return undefined;
|
48
|
+
};
|
49
|
+
exports.fromArrayTransformation = fromArrayTransformation;
|
50
|
+
const replaceTransformationsMapper = [
|
51
|
+
{
|
52
|
+
fromType: schema_types_1.JsonSchemaTypeName.Number,
|
53
|
+
toType: schema_types_1.JsonSchemaTypeName.String,
|
54
|
+
transformation: exports.fromNumberToString,
|
55
|
+
},
|
56
|
+
{
|
57
|
+
fromType: schema_types_1.JsonSchemaTypeName.String,
|
58
|
+
toType: schema_types_1.JsonSchemaTypeName.Number,
|
59
|
+
transformation: exports.fromStringToNumber,
|
60
|
+
},
|
61
|
+
{
|
62
|
+
fromType: schema_types_1.JsonSchemaTypeName.Boolean,
|
63
|
+
toType: schema_types_1.JsonSchemaTypeName.String,
|
64
|
+
transformation: exports.fromBooleanToString,
|
65
|
+
},
|
66
|
+
{
|
67
|
+
fromType: schema_types_1.JsonSchemaTypeName.String,
|
68
|
+
toType: schema_types_1.JsonSchemaTypeName.Boolean,
|
69
|
+
transformation: exports.fromStringToBoolean,
|
70
|
+
},
|
71
|
+
{
|
72
|
+
fromType: schema_types_1.JsonSchemaTypeName.Boolean,
|
73
|
+
toType: schema_types_1.JsonSchemaTypeName.Number,
|
74
|
+
transformation: exports.fromBooleanToNumber,
|
75
|
+
},
|
76
|
+
{
|
77
|
+
fromType: schema_types_1.JsonSchemaTypeName.Number,
|
78
|
+
toType: schema_types_1.JsonSchemaTypeName.Boolean,
|
79
|
+
transformation: exports.fromNumberToBoolean,
|
80
|
+
},
|
81
|
+
];
|
82
|
+
const getTransformation = (from, to) => {
|
83
|
+
if (to instanceof schema_1.JsonArrayStore) {
|
84
|
+
const transformation = findTransformation(from.type, to.items.type);
|
85
|
+
if (!transformation) {
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
return (0, exports.toArrayTransformation)(transformation);
|
89
|
+
}
|
90
|
+
else if (from instanceof schema_1.JsonArrayStore) {
|
91
|
+
const transformation = findTransformation(from.items.type, to.type);
|
92
|
+
if (!transformation) {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
return (0, exports.fromArrayTransformation)(transformation);
|
96
|
+
}
|
97
|
+
return findTransformation(from.type, to.type);
|
98
|
+
};
|
99
|
+
exports.getTransformation = getTransformation;
|
100
|
+
const findTransformation = (from, to) => {
|
101
|
+
if (from === to) {
|
102
|
+
return exports.equel;
|
103
|
+
}
|
104
|
+
for (const item of replaceTransformationsMapper) {
|
105
|
+
if (item.fromType === from && item.toType === to) {
|
106
|
+
return item.transformation;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
};
|
110
|
+
//# sourceMappingURL=value-transformation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"value-transformation.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/value/value-transformation.ts"],"names":[],"mappings":";;;AAAA,kCAGiD;AAEjD,2DAAgG;AAEzF,MAAM,KAAK,GAAG,CAAC,KAAc,EAAW,EAAE,CAAC,KAAK,CAAC;AAA3C,QAAA,KAAK,SAAsC;AAEjD,MAAM,kBAAkB,GAAG,CAChC,KAAa,EACb,eAAuB,EAAE,EACjB,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI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AI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEpE,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,OAAO,IAAA,6BAAqB,EAAC,cAAc,CAAC,CAAC;IAC/C,CAAC;SAAM,IAAI,IAAI,YAAY,uBAAc,EAAE,CAAC;QAC1C,MAAM,cAAc,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QAEpE,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,OAAO,IAAA,+BAAuB,EAAC,cAAc,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC,CAAC;AAvBW,QAAA,iBAAiB,qBAuB5B;AAEF,MAAM,kBAAkB,GAAG,CACzB,IAAwB,EACxB,EAAsB,EACM,EAAE;IAC9B,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QAChB,OAAO,aAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,4BAA4B,EAAE,CAAC;QAChD,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACjD,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ajvFileSchema = exports.fileSchema = void 0;
|
4
|
+
const schema_ids_consts_1 = require("../../schema-ids.consts");
|
5
|
+
const schema_types_1 = require("../types/schema.types");
|
6
|
+
exports.fileSchema = {
|
7
|
+
type: schema_types_1.JsonSchemaTypeName.Object,
|
8
|
+
properties: {
|
9
|
+
status: { type: schema_types_1.JsonSchemaTypeName.String, default: '', readOnly: true },
|
10
|
+
fileId: { type: schema_types_1.JsonSchemaTypeName.String, default: '', readOnly: true },
|
11
|
+
url: { type: schema_types_1.JsonSchemaTypeName.String, default: '', readOnly: true },
|
12
|
+
fileName: { type: schema_types_1.JsonSchemaTypeName.String, default: '' },
|
13
|
+
hash: {
|
14
|
+
type: schema_types_1.JsonSchemaTypeName.String,
|
15
|
+
default: '',
|
16
|
+
readOnly: true,
|
17
|
+
},
|
18
|
+
extension: {
|
19
|
+
type: schema_types_1.JsonSchemaTypeName.String,
|
20
|
+
default: '',
|
21
|
+
readOnly: true,
|
22
|
+
},
|
23
|
+
mimeType: {
|
24
|
+
type: schema_types_1.JsonSchemaTypeName.String,
|
25
|
+
default: '',
|
26
|
+
readOnly: true,
|
27
|
+
},
|
28
|
+
size: {
|
29
|
+
type: schema_types_1.JsonSchemaTypeName.Number,
|
30
|
+
default: 0,
|
31
|
+
readOnly: true,
|
32
|
+
},
|
33
|
+
width: {
|
34
|
+
type: schema_types_1.JsonSchemaTypeName.Number,
|
35
|
+
default: 0,
|
36
|
+
readOnly: true,
|
37
|
+
},
|
38
|
+
height: {
|
39
|
+
type: schema_types_1.JsonSchemaTypeName.Number,
|
40
|
+
default: 0,
|
41
|
+
readOnly: true,
|
42
|
+
},
|
43
|
+
},
|
44
|
+
required: [
|
45
|
+
'status',
|
46
|
+
'fileId',
|
47
|
+
'url',
|
48
|
+
'fileName',
|
49
|
+
'hash',
|
50
|
+
'extension',
|
51
|
+
'mimeType',
|
52
|
+
'size',
|
53
|
+
'width',
|
54
|
+
'height',
|
55
|
+
],
|
56
|
+
additionalProperties: false,
|
57
|
+
};
|
58
|
+
exports.ajvFileSchema = {
|
59
|
+
$id: schema_ids_consts_1.SystemSchemaIds.File,
|
60
|
+
...exports.fileSchema,
|
61
|
+
};
|
62
|
+
//# sourceMappingURL=file-schema.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file-schema.js","sourceRo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ACV,QAAQ,EAAE,IAAI;SACf;KACF;IACD,QAAQ,EAAE;QACR,QAAQ;QACR,QAAQ;QACR,KAAK;QACL,UAAU;QACV,MAAM;QACN,WAAW;QACX,UAAU;QACV,MAAM;QACN,OAAO;QACP,QAAQ;KACT;IACD,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEW,QAAA,aAAa,GAAW;IACnC,GAAG,EAAE,mCAAe,CAAC,IAAI;IACzB,GAAG,kBAAU;CACd,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './file-schema';
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./file-schema"), exports);
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/endpoint-microservice/shared/schema/plugins/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
|