@revisium/endpoint 0.11.0-alpha.2 → 0.11.0-alpha.4
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/core-api/generated/api.d.ts +83 -68
- package/dist/endpoint-microservice/core-api/generated/api.js +489 -466
- package/dist/endpoint-microservice/core-api/generated/api.js.map +1 -1
- package/dist/endpoint-microservice/core-api/internal-core-api.service.js +1 -1
- package/dist/endpoint-microservice/core-api/internal-core-api.service.js.map +1 -1
- package/dist/endpoint-microservice/core-api/utils/transformFromPrismaToRowModel.js +2 -0
- package/dist/endpoint-microservice/core-api/utils/transformFromPrismaToRowModel.js.map +1 -1
- 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-schema-converter/graphql-schema.converter.js +13 -8
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/graphql-schema.converter.js.map +1 -1
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/utils.d.ts +2 -1
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/utils.js +8 -1
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/utils.js.map +1 -1
- package/dist/endpoint-microservice/graphql/queries/handlers/get-graphql-schema.handler.d.ts +1 -1
- package/dist/endpoint-microservice/graphql/queries/handlers/get-graphql-schema.handler.js +3 -2
- package/dist/endpoint-microservice/graphql/queries/handlers/get-graphql-schema.handler.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 +7 -6
- package/dist/endpoint-microservice/restapi/queries/handlers/get-open-api-schema.handler.js.map +1 -1
- package/dist/endpoint-microservice/restapi/restapi-endpoint.service.js +7 -7
- package/dist/endpoint-microservice/restapi/restapi-endpoint.service.js.map +1 -1
- package/dist/endpoint-microservice/shared/converter.d.ts +1 -1
- 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/{types/schema.types.js → schema/model/value/json-value.store.js} +1 -1
- 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/{__tests__ → endpoint-microservice/shared/schema}/schema.mocks.d.ts +2 -2
- package/dist/{__tests__ → endpoint-microservice/shared/schema}/schema.mocks.js +11 -6
- 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/{types → schema/types}/json-patch.types.d.ts +1 -1
- package/dist/endpoint-microservice/shared/schema/types/json-patch.types.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/types/json.types.js.map +1 -0
- package/dist/endpoint-microservice/shared/{types → schema/types}/schema.types.d.ts +16 -6
- 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/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/dist/__tests__/schema.mocks.js.map +0 -1
- package/dist/endpoint-microservice/shared/types/json-patch.types.js.map +0 -1
- package/dist/endpoint-microservice/shared/types/json.types.js.map +0 -1
- package/dist/endpoint-microservice/shared/types/schema.types.js.map +0 -1
- /package/dist/endpoint-microservice/shared/{types → schema/types}/json-patch.types.js +0 -0
- /package/dist/endpoint-microservice/shared/{types → schema/types}/json.types.d.ts +0 -0
- /package/dist/endpoint-microservice/shared/{types → schema/types}/json.types.js +0 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.JsonNumberStore = void 0;
|
4
|
+
const nanoid_1 = require("nanoid");
|
5
|
+
const node_events_1 = require("node:events");
|
6
|
+
const schema_1 = require("../..");
|
7
|
+
class JsonNumberStore extends node_events_1.EventEmitter {
|
8
|
+
constructor(nodeId = (0, nanoid_1.nanoid)()) {
|
9
|
+
super();
|
10
|
+
this.nodeId = nodeId;
|
11
|
+
this.type = schema_1.JsonSchemaTypeName.Number;
|
12
|
+
this.$ref = '';
|
13
|
+
this.name = '';
|
14
|
+
this.parent = null;
|
15
|
+
this.default = 0;
|
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
|
+
return {
|
30
|
+
type: this.type,
|
31
|
+
default: this.default,
|
32
|
+
};
|
33
|
+
}
|
34
|
+
getOrCreateValues(rowId) {
|
35
|
+
let values = this.valuesMap.get(rowId);
|
36
|
+
if (!values) {
|
37
|
+
values = [];
|
38
|
+
this.valuesMap.set(rowId, values);
|
39
|
+
}
|
40
|
+
return values;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
exports.JsonNumberStore = JsonNumberStore;
|
44
|
+
//# sourceMappingURL=json-number.store.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"json-number.store.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/schema/json-number.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,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jectSchema, JsonRefSchema, JsonSchemaTypeName } from '../../../../../endpoint-microservice/shared/schema';
|
2
|
+
export type AddedPropertyEvent = {
|
3
|
+
name: string;
|
4
|
+
property: JsonSchemaStore;
|
5
|
+
};
|
6
|
+
export type MigratePropertyEvent = {
|
7
|
+
name: string;
|
8
|
+
property: JsonSchemaStore;
|
9
|
+
previousProperty: JsonSchemaStore;
|
10
|
+
};
|
11
|
+
export type RemovedPropertyEvent = {
|
12
|
+
name: string;
|
13
|
+
property: JsonSchemaStore;
|
14
|
+
};
|
15
|
+
export type ChangeNameEvent = {
|
16
|
+
fromName: string;
|
17
|
+
toName: string;
|
18
|
+
property: JsonSchemaStore;
|
19
|
+
};
|
20
|
+
export declare class JsonObjectStore implements JsonObjectSchema {
|
21
|
+
readonly nodeId: string;
|
22
|
+
readonly type = JsonSchemaTypeName.Object;
|
23
|
+
$ref: string;
|
24
|
+
name: string;
|
25
|
+
parent: JsonSchemaStore | null;
|
26
|
+
default: JsonObject;
|
27
|
+
readonly additionalProperties = false;
|
28
|
+
readonly required: string[];
|
29
|
+
readonly properties: Record<string, JsonSchemaStore>;
|
30
|
+
private readonly valuesMap;
|
31
|
+
constructor(nodeId?: string);
|
32
|
+
get empty(): boolean;
|
33
|
+
registerValue(value: JsonObjectValueStore): number;
|
34
|
+
getValue(rowId: string, index?: number): JsonObjectValueStore | undefined;
|
35
|
+
addPropertyWithStore(name: string, store: JsonSchemaStore): JsonSchemaStore;
|
36
|
+
migratePropertyWithStore(name: string, store: JsonSchemaStore): JsonSchemaStore;
|
37
|
+
changeName(fromName: string, toName: string): void;
|
38
|
+
removeProperty(name: string): void;
|
39
|
+
getProperty(name: string): JsonSchemaStore | undefined;
|
40
|
+
getPlainSchema(options?: {
|
41
|
+
skip$Ref?: boolean;
|
42
|
+
}): JsonObjectSchema | JsonRefSchema;
|
43
|
+
private getOrCreateValues;
|
44
|
+
private iterValues;
|
45
|
+
}
|
@@ -0,0 +1,146 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.JsonObjectStore = void 0;
|
4
|
+
const nanoid_1 = require("nanoid");
|
5
|
+
const schema_1 = require("../..");
|
6
|
+
class JsonObjectStore {
|
7
|
+
constructor(nodeId = (0, nanoid_1.nanoid)()) {
|
8
|
+
this.nodeId = nodeId;
|
9
|
+
this.type = schema_1.JsonSchemaTypeName.Object;
|
10
|
+
this.$ref = '';
|
11
|
+
this.name = '';
|
12
|
+
this.parent = null;
|
13
|
+
this.default = {};
|
14
|
+
this.additionalProperties = false;
|
15
|
+
this.required = [];
|
16
|
+
this.properties = {};
|
17
|
+
this.valuesMap = new Map();
|
18
|
+
}
|
19
|
+
get empty() {
|
20
|
+
return Object.keys(this.properties).length === 0;
|
21
|
+
}
|
22
|
+
registerValue(value) {
|
23
|
+
const length = this.getOrCreateValues(value.rowId).push(value);
|
24
|
+
return length - 1;
|
25
|
+
}
|
26
|
+
getValue(rowId, index = 0) {
|
27
|
+
return this.getOrCreateValues(rowId)[index];
|
28
|
+
}
|
29
|
+
addPropertyWithStore(name, store) {
|
30
|
+
if (this.properties[name] || this.required.includes(name)) {
|
31
|
+
throw new Error('this name already exists');
|
32
|
+
}
|
33
|
+
store.parent = this;
|
34
|
+
store.name = name;
|
35
|
+
this.required.push(name);
|
36
|
+
this.required.sort((a, b) => a.localeCompare(b));
|
37
|
+
this.properties[name] = store;
|
38
|
+
this.default[name] = store.default;
|
39
|
+
const event = { name, property: store };
|
40
|
+
for (const value of this.iterValues()) {
|
41
|
+
value.addProperty(event);
|
42
|
+
}
|
43
|
+
return store;
|
44
|
+
}
|
45
|
+
migratePropertyWithStore(name, store) {
|
46
|
+
const item = this.properties[name];
|
47
|
+
if (!item) {
|
48
|
+
throw new Error('this name does not exist');
|
49
|
+
}
|
50
|
+
item.parent = null;
|
51
|
+
store.parent = this;
|
52
|
+
store.name = name;
|
53
|
+
this.properties[name] = store;
|
54
|
+
this.default[name] = store.default;
|
55
|
+
const event = {
|
56
|
+
name,
|
57
|
+
property: store,
|
58
|
+
previousProperty: item,
|
59
|
+
};
|
60
|
+
for (const value of this.iterValues()) {
|
61
|
+
value.migrateProperty(event);
|
62
|
+
}
|
63
|
+
return store;
|
64
|
+
}
|
65
|
+
changeName(fromName, toName) {
|
66
|
+
const item = this.properties[fromName];
|
67
|
+
if (!item) {
|
68
|
+
throw new Error('this fromName does not exist');
|
69
|
+
}
|
70
|
+
delete this.properties[fromName];
|
71
|
+
delete this.default[fromName];
|
72
|
+
const foundRequiredIndex = this.required.findIndex((required) => required === fromName);
|
73
|
+
if (foundRequiredIndex !== -1) {
|
74
|
+
this.required.splice(foundRequiredIndex, 1);
|
75
|
+
}
|
76
|
+
if (!this.required.includes(toName)) {
|
77
|
+
this.required.push(toName);
|
78
|
+
this.required.sort((a, b) => a.localeCompare(b));
|
79
|
+
}
|
80
|
+
this.properties[toName] = item;
|
81
|
+
this.default[toName] = item.default;
|
82
|
+
const event = {
|
83
|
+
fromName,
|
84
|
+
toName,
|
85
|
+
property: item,
|
86
|
+
};
|
87
|
+
for (const value of this.iterValues()) {
|
88
|
+
value.changeName(event);
|
89
|
+
}
|
90
|
+
}
|
91
|
+
removeProperty(name) {
|
92
|
+
const item = this.properties[name];
|
93
|
+
if (!item) {
|
94
|
+
throw new Error('this name does not exist');
|
95
|
+
}
|
96
|
+
item.parent = null;
|
97
|
+
item.name = '';
|
98
|
+
delete this.properties[name];
|
99
|
+
delete this.default[name];
|
100
|
+
const foundRequiredIndex = this.required.findIndex((required) => required === name);
|
101
|
+
if (foundRequiredIndex !== -1) {
|
102
|
+
this.required.splice(foundRequiredIndex, 1);
|
103
|
+
}
|
104
|
+
const event = {
|
105
|
+
name,
|
106
|
+
property: item,
|
107
|
+
};
|
108
|
+
for (const value of this.iterValues()) {
|
109
|
+
value.removeProperty(event);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
getProperty(name) {
|
113
|
+
return this.properties[name];
|
114
|
+
}
|
115
|
+
getPlainSchema(options) {
|
116
|
+
if (this.$ref && options?.skip$Ref !== true) {
|
117
|
+
return { $ref: this.$ref };
|
118
|
+
}
|
119
|
+
return {
|
120
|
+
type: this.type,
|
121
|
+
additionalProperties: this.additionalProperties,
|
122
|
+
required: this.required,
|
123
|
+
properties: Object.entries(this.properties).reduce((result, [name, store]) => {
|
124
|
+
result[name] = store.getPlainSchema(options);
|
125
|
+
return result;
|
126
|
+
}, {}),
|
127
|
+
};
|
128
|
+
}
|
129
|
+
getOrCreateValues(rowId) {
|
130
|
+
let values = this.valuesMap.get(rowId);
|
131
|
+
if (!values) {
|
132
|
+
values = [];
|
133
|
+
this.valuesMap.set(rowId, values);
|
134
|
+
}
|
135
|
+
return values;
|
136
|
+
}
|
137
|
+
*iterValues() {
|
138
|
+
for (const values of this.valuesMap.values()) {
|
139
|
+
for (const value of values) {
|
140
|
+
yield value;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
exports.JsonObjectStore = JsonObjectStore;
|
146
|
+
//# sourceMappingURL=json-object.store.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"json-object.store.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/schema/json-object.store.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,kCAQiD;AAejD,MAAa,eAAe;IAiB1B,YAA4B,SAAiB,IAAA,eAAM,GAAE;QAAzB,WAAM,GAAN,MAAM,CAAmB;QAhBrC,SAAI,GAAG,2BAAkB,CAAC,MAAM,CAAC;QAE1C,SAAI,GAAW,EAAE,CAAC;QAClB,SAAI,GAAW,EAAE,CAAC;QAClB,WAAM,GAA2B,IAAI,CAAC;QACtC,YAAO,GAAe,EAAE,CAAC;QAEhB,yBAAoB,GAAG,KAAK,CAAC;QAC7B,aAAQ,GAAa,EAAE,CAAC;QACxB,eAAU,GAAoC,EAAE,CAAC;QAEhD,cAAS,GAAwC,IAAI,GAAG,EAGtE,CAAC;IAEoD,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K,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;IAEO,CAAC,UAAU;QACjB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAtMD,0CAsMC"}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { JsonArrayStore, JsonBooleanStore, JsonNumberStore, JsonObjectStore, JsonStringStore } from '../../../../../endpoint-microservice/shared/schema';
|
2
|
+
export type JsonSchemaStorePrimitives = JsonStringStore | JsonNumberStore | JsonBooleanStore;
|
3
|
+
export type JsonSchemaStore = JsonObjectStore | JsonArrayStore | JsonSchemaStorePrimitives;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"json-schema.store.js","sourceRoot":"","sources":["../../../../../../src/endpoint-microservice/shared/schema/model/schema/json-schema.store.ts"],"names":[],"mappings":""}
|
@@ -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,C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E,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,CA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AAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAEtE,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,aAAa,CAAC,aAAa,EAAE,CAAC;QACvC,CAAC;QAED,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;IAChC,CAAC;IAEO,gBAAgB,CAAC,KAA2B;QAClD,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,KAAK,CAAC,gBAAgB,EACtB,KAAK,CAAC,QAAQ,CACf,CAAC;QAEF,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,cAAc,CACnB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,EACtC,KAAK,CAAC,QAAQ,CAAC,OAAO,CACV,CAAC;QACjB,CAAC;QAED,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;IAChC,CAAC;IAEO,IAAI;QACV,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
|