@revisium/schema-toolkit 0.20.2 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +216 -0
- package/dist/FormulaPathBuilder-BUJRR0Am.d.cts +48 -0
- package/dist/FormulaPathBuilder-QR0htn-e.d.ts +48 -0
- package/dist/{chunk-VGADCIBG.cjs → chunk-2PIMJSWJ.cjs} +12 -8
- package/dist/chunk-3MJP73IJ.js +1 -0
- package/dist/{chunk-LLHQWDAR.js → chunk-4U2RZHMX.js} +19 -21
- package/dist/{chunk-Q2UOTIMG.js → chunk-5DUMJHCA.js} +0 -2
- package/dist/{chunk-V6JTSET2.cjs → chunk-7JWCZZPJ.cjs} +49 -51
- package/dist/{chunk-YFWOURZL.js → chunk-7PEC6ZYY.js} +0 -2
- package/dist/chunk-AV5EZUMZ.cjs +2 -0
- package/dist/{chunk-3JZKQWQH.js → chunk-AWFMSOHM.js} +5 -7
- package/dist/{chunk-X2VRR7V7.cjs → chunk-ERW5XVED.cjs} +0 -2
- package/dist/{chunk-XNFSFT7T.cjs → chunk-EVD5ZI55.cjs} +0 -2
- package/dist/{chunk-ZRNFSUOV.cjs → chunk-FL6PWPVJ.cjs} +0 -2
- package/dist/{chunk-55AMH44G.js → chunk-FTBRJODD.js} +28 -30
- package/dist/{chunk-R3MS2N4A.js → chunk-GJM63Q4K.js} +0 -2
- package/dist/{chunk-U5YDA3LA.js → chunk-HFMZITNE.js} +238 -31
- package/dist/{chunk-EGC32GPY.cjs → chunk-ITYABUR5.cjs} +19 -21
- package/dist/{chunk-R4CFU33U.js → chunk-IZMBM36H.js} +10 -9
- package/dist/chunk-J4RVO37K.cjs +2 -0
- package/dist/{chunk-QEV4Q4TR.js → chunk-JLXX3SGF.js} +30 -32
- package/dist/{chunk-MPF6VCB5.js → chunk-NO655UI5.js} +0 -2
- package/dist/chunk-OAUVP6CU.js +1 -0
- package/dist/{chunk-B3T6YB2D.cjs → chunk-ONW2OVNQ.cjs} +28 -30
- package/dist/{chunk-32FZHFIO.cjs → chunk-QKA7DJDN.cjs} +0 -2
- package/dist/{chunk-46ME2TAU.cjs → chunk-RCCBUOGY.cjs} +5 -7
- package/dist/{chunk-IPL2CGVA.cjs → chunk-RQBW7ATZ.cjs} +0 -2
- package/dist/{chunk-FZ2MS4Q5.cjs → chunk-S5SRXND6.cjs} +307 -97
- package/dist/{chunk-WSPFHUHU.cjs → chunk-T3QQSHAC.cjs} +0 -2
- package/dist/{chunk-J6SCHJKG.cjs → chunk-VMELKZXD.cjs} +0 -2
- package/dist/{chunk-5VDDLW7U.js → chunk-WE4OLW5U.js} +0 -2
- package/dist/{chunk-JUOGJFTL.js → chunk-XKWWCXGB.js} +0 -2
- package/dist/{chunk-ZBPUTF3Q.js → chunk-ZPRBA4AQ.js} +0 -2
- package/dist/consts/index.cjs +4 -6
- package/dist/consts/index.js +2 -4
- package/dist/core/index.cjs +65 -69
- package/dist/core/index.d.cts +6 -4
- package/dist/core/index.d.ts +6 -4
- package/dist/core/index.js +4 -8
- package/dist/formula/index.cjs +7 -9
- package/dist/formula/index.d.cts +1 -1
- package/dist/formula/index.d.ts +1 -1
- package/dist/formula/index.js +1 -3
- package/dist/index.cjs +269 -248
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +15 -18
- package/dist/{json-patch.types-DY7k9hxy.d.ts → json-patch.types-BpVnp08Z.d.ts} +1 -1
- package/dist/{json-patch.types-Cu0Medki.d.cts → json-patch.types-eM6pYC2P.d.cts} +1 -1
- package/dist/{json-string.store-C58zbl31.d.ts → json-string.store-DfdLcgnM.d.ts} +11 -11
- package/dist/{json-string.store-DuI--IL2.d.cts → json-string.store-cAOADo23.d.cts} +11 -11
- package/dist/lib/index.cjs +51 -54
- package/dist/lib/index.d.cts +3 -3
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +7 -10
- package/dist/mocks/index.cjs +30 -21
- package/dist/mocks/index.d.cts +22 -8
- package/dist/mocks/index.d.ts +22 -8
- package/dist/mocks/index.js +2 -5
- package/dist/model/index.cjs +85 -78
- package/dist/model/index.d.cts +171 -346
- package/dist/model/index.d.ts +171 -346
- package/dist/model/index.js +4 -9
- package/dist/plugins/index.cjs +20 -23
- package/dist/plugins/index.d.cts +10 -10
- package/dist/plugins/index.d.ts +10 -10
- package/dist/plugins/index.js +2 -5
- package/dist/{schema.types-B5OgKLpV.d.cts → schema.types-On_VGw2m.d.cts} +7 -6
- package/dist/{schema.types-B5OgKLpV.d.ts → schema.types-On_VGw2m.d.ts} +7 -6
- package/dist/typed-BRZhUqGG.d.ts +502 -0
- package/dist/typed-Cri0IYAn.d.cts +502 -0
- package/dist/types/index.cjs +6 -9
- package/dist/types/index.d.cts +7 -5
- package/dist/types/index.d.ts +7 -5
- package/dist/types/index.js +2 -5
- package/dist/{FormulaPathBuilder-DwlKOvVB.d.ts → types-BIvIURgy.d.cts} +37 -82
- package/dist/{FormulaPathBuilder-D9LkBcSv.d.cts → types-C_pTFtSY.d.ts} +37 -82
- package/dist/validation-schemas/index.cjs +18 -20
- package/dist/validation-schemas/index.js +1 -3
- package/package.json +1 -1
- package/dist/chunk-32FZHFIO.cjs.map +0 -1
- package/dist/chunk-3FJZMVWA.js +0 -3
- package/dist/chunk-3FJZMVWA.js.map +0 -1
- package/dist/chunk-3IKI64T2.js +0 -3
- package/dist/chunk-3IKI64T2.js.map +0 -1
- package/dist/chunk-3JZKQWQH.js.map +0 -1
- package/dist/chunk-46ME2TAU.cjs.map +0 -1
- package/dist/chunk-55AMH44G.js.map +0 -1
- package/dist/chunk-5VDDLW7U.js.map +0 -1
- package/dist/chunk-B3T6YB2D.cjs.map +0 -1
- package/dist/chunk-EGC32GPY.cjs.map +0 -1
- package/dist/chunk-FZ2MS4Q5.cjs.map +0 -1
- package/dist/chunk-G6ZKEVVU.cjs +0 -4
- package/dist/chunk-G6ZKEVVU.cjs.map +0 -1
- package/dist/chunk-IPL2CGVA.cjs.map +0 -1
- package/dist/chunk-J6SCHJKG.cjs.map +0 -1
- package/dist/chunk-JUOGJFTL.js.map +0 -1
- package/dist/chunk-L6HE7QPU.cjs +0 -4
- package/dist/chunk-L6HE7QPU.cjs.map +0 -1
- package/dist/chunk-LLHQWDAR.js.map +0 -1
- package/dist/chunk-MPF6VCB5.js.map +0 -1
- package/dist/chunk-NY3H6C7K.js +0 -3
- package/dist/chunk-NY3H6C7K.js.map +0 -1
- package/dist/chunk-Q2UOTIMG.js.map +0 -1
- package/dist/chunk-QEV4Q4TR.js.map +0 -1
- package/dist/chunk-R3MS2N4A.js.map +0 -1
- package/dist/chunk-R4CFU33U.js.map +0 -1
- package/dist/chunk-TBFTADML.cjs +0 -4
- package/dist/chunk-TBFTADML.cjs.map +0 -1
- package/dist/chunk-U5YDA3LA.js.map +0 -1
- package/dist/chunk-V6JTSET2.cjs.map +0 -1
- package/dist/chunk-VGADCIBG.cjs.map +0 -1
- package/dist/chunk-WSPFHUHU.cjs.map +0 -1
- package/dist/chunk-X2VRR7V7.cjs.map +0 -1
- package/dist/chunk-XNFSFT7T.cjs.map +0 -1
- package/dist/chunk-YFWOURZL.js.map +0 -1
- package/dist/chunk-ZBPUTF3Q.js.map +0 -1
- package/dist/chunk-ZRNFSUOV.cjs.map +0 -1
- package/dist/consts/index.cjs.map +0 -1
- package/dist/consts/index.js.map +0 -1
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/formula/index.cjs.map +0 -1
- package/dist/formula/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json-value-patch.types-CgiEpchp.d.ts +0 -24
- package/dist/json-value-patch.types-LEJxcIWR.d.cts +0 -24
- package/dist/lib/index.cjs.map +0 -1
- package/dist/lib/index.js.map +0 -1
- package/dist/mocks/index.cjs.map +0 -1
- package/dist/mocks/index.js.map +0 -1
- package/dist/model/index.cjs.map +0 -1
- package/dist/model/index.js.map +0 -1
- package/dist/plugins/index.cjs.map +0 -1
- package/dist/plugins/index.js.map +0 -1
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/validation-schemas/index.cjs.map +0 -1
- package/dist/validation-schemas/index.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkITYABUR5_cjs = require('./chunk-ITYABUR5.cjs');
|
|
4
|
+
var chunkONW2OVNQ_cjs = require('./chunk-ONW2OVNQ.cjs');
|
|
5
5
|
|
|
6
6
|
// src/lib/createJsonSchemaStore.ts
|
|
7
7
|
var createJsonSchemaStore = (schema, refs = {}) => {
|
|
@@ -14,13 +14,13 @@ var createJsonSchemaStore = (schema, refs = {}) => {
|
|
|
14
14
|
saveSharedFields(refStore, schema);
|
|
15
15
|
refStore.$ref = schema.$ref;
|
|
16
16
|
return refStore;
|
|
17
|
-
} else if (schema.type === "object"
|
|
17
|
+
} else if (schema.type === "object") {
|
|
18
18
|
const objectStore = createJsonObjectSchemaStore(schema, refs);
|
|
19
19
|
saveSharedFields(objectStore, schema);
|
|
20
20
|
return objectStore;
|
|
21
|
-
} else if (schema.type === "array"
|
|
21
|
+
} else if (schema.type === "array") {
|
|
22
22
|
const itemsStore = createJsonSchemaStore(schema.items, refs);
|
|
23
|
-
const arrayStore = new
|
|
23
|
+
const arrayStore = new chunkONW2OVNQ_cjs.JsonArrayStore(itemsStore);
|
|
24
24
|
saveSharedFields(arrayStore, schema);
|
|
25
25
|
return arrayStore;
|
|
26
26
|
} else {
|
|
@@ -31,7 +31,7 @@ var createJsonSchemaStore = (schema, refs = {}) => {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
var createJsonObjectSchemaStore = (value, refs) => {
|
|
34
|
-
const store = new
|
|
34
|
+
const store = new chunkONW2OVNQ_cjs.JsonObjectStore();
|
|
35
35
|
for (const requiredField of value.required) {
|
|
36
36
|
if (!value.properties[requiredField]) {
|
|
37
37
|
throw new Error(
|
|
@@ -45,8 +45,8 @@ var createJsonObjectSchemaStore = (value, refs) => {
|
|
|
45
45
|
return store;
|
|
46
46
|
};
|
|
47
47
|
var createPrimitiveStoreBySchema = (schema) => {
|
|
48
|
-
if (schema.type === "string"
|
|
49
|
-
const stringStore = new
|
|
48
|
+
if (schema.type === "string") {
|
|
49
|
+
const stringStore = new chunkONW2OVNQ_cjs.JsonStringStore();
|
|
50
50
|
stringStore.foreignKey = schema.foreignKey;
|
|
51
51
|
stringStore.format = schema.format;
|
|
52
52
|
stringStore.enum = schema.enum;
|
|
@@ -54,12 +54,12 @@ var createPrimitiveStoreBySchema = (schema) => {
|
|
|
54
54
|
stringStore.pattern = schema.pattern;
|
|
55
55
|
stringStore["x-formula"] = schema["x-formula"];
|
|
56
56
|
return stringStore;
|
|
57
|
-
} else if (schema.type === "number"
|
|
58
|
-
const numberStore = new
|
|
57
|
+
} else if (schema.type === "number") {
|
|
58
|
+
const numberStore = new chunkONW2OVNQ_cjs.JsonNumberStore();
|
|
59
59
|
numberStore["x-formula"] = schema["x-formula"];
|
|
60
60
|
return numberStore;
|
|
61
|
-
} else if (schema.type === "boolean"
|
|
62
|
-
const booleanStore = new
|
|
61
|
+
} else if (schema.type === "boolean") {
|
|
62
|
+
const booleanStore = new chunkONW2OVNQ_cjs.JsonBooleanStore();
|
|
63
63
|
booleanStore["x-formula"] = schema["x-formula"];
|
|
64
64
|
return booleanStore;
|
|
65
65
|
} else {
|
|
@@ -88,7 +88,7 @@ var getJsonSchemaStoreByPath = (store, path) => {
|
|
|
88
88
|
let currentToken = tokens.shift();
|
|
89
89
|
let currentPath = "";
|
|
90
90
|
while (currentToken) {
|
|
91
|
-
if (currentStore.type === "object"
|
|
91
|
+
if (currentStore.type === "object") {
|
|
92
92
|
if (currentToken !== "properties") {
|
|
93
93
|
throw new Error(
|
|
94
94
|
`Expected "${currentPath}/properties/*" instead of ${currentPath}/${currentToken}/*`
|
|
@@ -106,7 +106,7 @@ var getJsonSchemaStoreByPath = (store, path) => {
|
|
|
106
106
|
currentStore = foundCurrentStore;
|
|
107
107
|
currentPath = `${currentPath}/${currentToken}`;
|
|
108
108
|
currentToken = tokens.shift();
|
|
109
|
-
} else if (currentStore.type === "array"
|
|
109
|
+
} else if (currentStore.type === "array") {
|
|
110
110
|
if (currentToken !== "items") {
|
|
111
111
|
throw new Error(
|
|
112
112
|
`Expected "${currentPath}/items/*" instead of ${currentPath}/${currentToken}/*`
|
|
@@ -178,9 +178,9 @@ var applyReplacePatch = (store, patch, refs = {}) => {
|
|
|
178
178
|
if (!parent) {
|
|
179
179
|
return patchStore;
|
|
180
180
|
}
|
|
181
|
-
if (parent.type === "object"
|
|
181
|
+
if (parent.type === "object") {
|
|
182
182
|
parent.migratePropertyWithStore(foundStore.name, patchStore);
|
|
183
|
-
} else if (parent.type === "array"
|
|
183
|
+
} else if (parent.type === "array") {
|
|
184
184
|
parent.migrateItems(patchStore);
|
|
185
185
|
} else {
|
|
186
186
|
throw new Error("Invalid parent");
|
|
@@ -193,7 +193,7 @@ var applyRemovePatch = (rootStore, patch) => {
|
|
|
193
193
|
if (!parent) {
|
|
194
194
|
throw new Error("Parent does not exist");
|
|
195
195
|
}
|
|
196
|
-
if (parent.type !== "object"
|
|
196
|
+
if (parent.type !== "object") {
|
|
197
197
|
throw new Error("Cannot remove from non-object");
|
|
198
198
|
}
|
|
199
199
|
parent.removeProperty(foundStore.name);
|
|
@@ -205,7 +205,7 @@ var applyAddPatch = (rootStore, patch, refs = {}) => {
|
|
|
205
205
|
if (!foundParent) {
|
|
206
206
|
throw new Error("Parent does not exist");
|
|
207
207
|
}
|
|
208
|
-
if (foundParent.type !== "object"
|
|
208
|
+
if (foundParent.type !== "object") {
|
|
209
209
|
throw new Error("Cannot add to non-object");
|
|
210
210
|
}
|
|
211
211
|
if (foundParent.getProperty(field)) {
|
|
@@ -231,15 +231,15 @@ var applyMovePatch = (store, patch) => {
|
|
|
231
231
|
if (!foundFromParent || !foundToParent) {
|
|
232
232
|
throw new Error("Cannot move from or to non-existent parent");
|
|
233
233
|
}
|
|
234
|
-
if (foundFromParent.type !== "object"
|
|
234
|
+
if (foundFromParent.type !== "object") {
|
|
235
235
|
throw new Error("Cannot move from non-object parent");
|
|
236
236
|
}
|
|
237
237
|
const foundFromField = getJsonSchemaStoreByPath(store, patch.from);
|
|
238
|
-
const isMovedPropertyInSameParentPatch = foundFromParent === foundToParent && foundFromParent.type === "object"
|
|
238
|
+
const isMovedPropertyInSameParentPatch = foundFromParent === foundToParent && foundFromParent.type === "object" && foundFromParent.getProperty(fromField);
|
|
239
239
|
if (isMovedPropertyInSameParentPatch) {
|
|
240
240
|
return foundFromParent.changeName(fromField, toField);
|
|
241
241
|
}
|
|
242
|
-
if (foundToParent.type === "object"
|
|
242
|
+
if (foundToParent.type === "object") {
|
|
243
243
|
if (foundToParent.getProperty(toField)) {
|
|
244
244
|
foundToParent.removeProperty(toField);
|
|
245
245
|
}
|
|
@@ -247,7 +247,7 @@ var applyMovePatch = (store, patch) => {
|
|
|
247
247
|
foundFromParent.removeProperty(fromField);
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
|
-
if (foundToParent.type === "array"
|
|
250
|
+
if (foundToParent.type === "array") {
|
|
251
251
|
foundFromParent.removeProperty(fromField);
|
|
252
252
|
foundToParent.replaceItems(foundFromField);
|
|
253
253
|
return;
|
|
@@ -260,9 +260,9 @@ var getDBJsonPathByJsonSchemaStore = (store) => {
|
|
|
260
260
|
let node = store;
|
|
261
261
|
let path = "";
|
|
262
262
|
while (node.parent) {
|
|
263
|
-
if (node.parent.type === "object"
|
|
263
|
+
if (node.parent.type === "object") {
|
|
264
264
|
path = `.${node.name}${path}`;
|
|
265
|
-
} else if (node.parent.type === "array"
|
|
265
|
+
} else if (node.parent.type === "array") {
|
|
266
266
|
path = `[*]${path}`;
|
|
267
267
|
}
|
|
268
268
|
node = node.parent;
|
|
@@ -278,9 +278,9 @@ var getPathByStore = (store) => {
|
|
|
278
278
|
let node = store;
|
|
279
279
|
let path = "";
|
|
280
280
|
while (node.parent) {
|
|
281
|
-
if (node.parent.type === "object"
|
|
281
|
+
if (node.parent.type === "object") {
|
|
282
282
|
path = `/properties/${node.name}${path}`;
|
|
283
|
-
} else if (node.parent.type === "array"
|
|
283
|
+
} else if (node.parent.type === "array") {
|
|
284
284
|
path = `/items${path}`;
|
|
285
285
|
}
|
|
286
286
|
node = node.parent;
|
|
@@ -294,11 +294,11 @@ var getPathByStore = (store) => {
|
|
|
294
294
|
// src/lib/traverseStore.ts
|
|
295
295
|
var traverseStore = (store, callback) => {
|
|
296
296
|
callback(store);
|
|
297
|
-
if (store.type === "object"
|
|
297
|
+
if (store.type === "object") {
|
|
298
298
|
Object.values(store.properties).forEach((item) => {
|
|
299
299
|
traverseStore(item, callback);
|
|
300
300
|
});
|
|
301
|
-
} else if (store.type === "array"
|
|
301
|
+
} else if (store.type === "array") {
|
|
302
302
|
traverseStore(store.items, callback);
|
|
303
303
|
}
|
|
304
304
|
};
|
|
@@ -307,7 +307,7 @@ var traverseStore = (store, callback) => {
|
|
|
307
307
|
var getForeignKeyPatchesFromSchema = (store, options) => {
|
|
308
308
|
const stores = [];
|
|
309
309
|
traverseStore(store, (item) => {
|
|
310
|
-
if (item.type === "string"
|
|
310
|
+
if (item.type === "string" && item.foreignKey === options.tableId) {
|
|
311
311
|
item.foreignKey = options.nextTableId;
|
|
312
312
|
const patch = {
|
|
313
313
|
op: "replace",
|
|
@@ -324,7 +324,7 @@ var getForeignKeyPatchesFromSchema = (store, options) => {
|
|
|
324
324
|
var getForeignKeysFromSchema = (store) => {
|
|
325
325
|
const foreignKeys = /* @__PURE__ */ new Set();
|
|
326
326
|
traverseStore(store, (item) => {
|
|
327
|
-
if (item.type === "string"
|
|
327
|
+
if (item.type === "string" && item.foreignKey) {
|
|
328
328
|
foreignKeys.add(item.foreignKey);
|
|
329
329
|
}
|
|
330
330
|
});
|
|
@@ -334,11 +334,11 @@ var getForeignKeysFromSchema = (store) => {
|
|
|
334
334
|
// src/lib/traverseValue.ts
|
|
335
335
|
var traverseValue = (store, callback) => {
|
|
336
336
|
callback(store);
|
|
337
|
-
if (store.type === "object"
|
|
337
|
+
if (store.type === "object") {
|
|
338
338
|
Object.values(store.value).forEach((item) => {
|
|
339
339
|
traverseValue(item, callback);
|
|
340
340
|
});
|
|
341
|
-
} else if (store.type === "array"
|
|
341
|
+
} else if (store.type === "array") {
|
|
342
342
|
store.value.forEach((itemValue) => {
|
|
343
343
|
traverseValue(itemValue, callback);
|
|
344
344
|
});
|
|
@@ -349,7 +349,7 @@ var traverseValue = (store, callback) => {
|
|
|
349
349
|
var getForeignKeysFromValue = (value) => {
|
|
350
350
|
const foreignKeys = /* @__PURE__ */ new Map();
|
|
351
351
|
traverseValue(value, (item) => {
|
|
352
|
-
if (item.type === "string"
|
|
352
|
+
if (item.type === "string" && item.foreignKey) {
|
|
353
353
|
let tableForeignKey = foreignKeys.get(item.foreignKey);
|
|
354
354
|
if (!tableForeignKey) {
|
|
355
355
|
tableForeignKey = /* @__PURE__ */ new Set();
|
|
@@ -369,7 +369,7 @@ var getInvalidFieldNamesInSchema = (schema, refs = {}) => {
|
|
|
369
369
|
const schemaStore = createJsonSchemaStore(schema, refs);
|
|
370
370
|
const invalidFields = [];
|
|
371
371
|
traverseStore(schemaStore, (item) => {
|
|
372
|
-
if (item.parent?.type === "object"
|
|
372
|
+
if (item.parent?.type === "object") {
|
|
373
373
|
if (!validateJsonFieldName(item.name)) {
|
|
374
374
|
invalidFields.push(item);
|
|
375
375
|
}
|
|
@@ -610,13 +610,13 @@ var getJsonValueStoreByPath = (root, path) => {
|
|
|
610
610
|
const segments = parsePath(path);
|
|
611
611
|
let current = root;
|
|
612
612
|
for (const seg of segments) {
|
|
613
|
-
if (current instanceof
|
|
613
|
+
if (current instanceof chunkONW2OVNQ_cjs.JsonObjectValueStore) {
|
|
614
614
|
const next = current.value[String(seg)];
|
|
615
615
|
if (!next) {
|
|
616
616
|
throw new Error(`Path not found at segment "${seg}"`);
|
|
617
617
|
}
|
|
618
618
|
current = next;
|
|
619
|
-
} else if (current instanceof
|
|
619
|
+
} else if (current instanceof chunkONW2OVNQ_cjs.JsonArrayValueStore) {
|
|
620
620
|
if (typeof seg !== "number") {
|
|
621
621
|
throw new Error(`Invalid array index "${seg}"`);
|
|
622
622
|
}
|
|
@@ -636,7 +636,7 @@ var getJsonValueStoreByPath = (root, path) => {
|
|
|
636
636
|
var replaceForeignKeyValue = (options) => {
|
|
637
637
|
let wasUpdated = false;
|
|
638
638
|
traverseValue(options.valueStore, (item) => {
|
|
639
|
-
if (item.type === "string"
|
|
639
|
+
if (item.type === "string" && item.foreignKey === options.foreignKey && item.value === options.value) {
|
|
640
640
|
item.value = options.nextValue;
|
|
641
641
|
wasUpdated = true;
|
|
642
642
|
}
|
|
@@ -646,15 +646,15 @@ var replaceForeignKeyValue = (options) => {
|
|
|
646
646
|
|
|
647
647
|
// src/lib/resolveRefs.ts
|
|
648
648
|
var pluginRefs = {
|
|
649
|
-
["urn:jsonschema:io:revisium:row-id-schema:1.0.0" /* RowId */]:
|
|
650
|
-
["urn:jsonschema:io:revisium:row-version-id-schema:1.0.0" /* RowVersionId */]:
|
|
651
|
-
["urn:jsonschema:io:revisium:row-created-id-schema:1.0.0" /* RowCreatedId */]:
|
|
652
|
-
["urn:jsonschema:io:revisium:row-created-at-schema:1.0.0" /* RowCreatedAt */]:
|
|
653
|
-
["urn:jsonschema:io:revisium:row-published-at-schema:1.0.0" /* RowPublishedAt */]:
|
|
654
|
-
["urn:jsonschema:io:revisium:row-updated-at-schema:1.0.0" /* RowUpdatedAt */]:
|
|
655
|
-
["urn:jsonschema:io:revisium:row-hash-schema:1.0.0" /* RowHash */]:
|
|
656
|
-
["urn:jsonschema:io:revisium:row-schema-hash-schema:1.0.0" /* RowSchemaHash */]:
|
|
657
|
-
["urn:jsonschema:io:revisium:file-schema:1.0.0" /* File */]:
|
|
649
|
+
["urn:jsonschema:io:revisium:row-id-schema:1.0.0" /* RowId */]: chunkITYABUR5_cjs.rowIdSchema,
|
|
650
|
+
["urn:jsonschema:io:revisium:row-version-id-schema:1.0.0" /* RowVersionId */]: chunkITYABUR5_cjs.rowVersionIdSchema,
|
|
651
|
+
["urn:jsonschema:io:revisium:row-created-id-schema:1.0.0" /* RowCreatedId */]: chunkITYABUR5_cjs.rowCreatedIdSchema,
|
|
652
|
+
["urn:jsonschema:io:revisium:row-created-at-schema:1.0.0" /* RowCreatedAt */]: chunkITYABUR5_cjs.rowCreatedAtSchema,
|
|
653
|
+
["urn:jsonschema:io:revisium:row-published-at-schema:1.0.0" /* RowPublishedAt */]: chunkITYABUR5_cjs.rowPublishedAtSchema,
|
|
654
|
+
["urn:jsonschema:io:revisium:row-updated-at-schema:1.0.0" /* RowUpdatedAt */]: chunkITYABUR5_cjs.rowUpdatedAtSchema,
|
|
655
|
+
["urn:jsonschema:io:revisium:row-hash-schema:1.0.0" /* RowHash */]: chunkITYABUR5_cjs.rowHashSchema,
|
|
656
|
+
["urn:jsonschema:io:revisium:row-schema-hash-schema:1.0.0" /* RowSchemaHash */]: chunkITYABUR5_cjs.rowSchemaHashSchema,
|
|
657
|
+
["urn:jsonschema:io:revisium:file-schema:1.0.0" /* File */]: chunkITYABUR5_cjs.fileSchema
|
|
658
658
|
};
|
|
659
659
|
var resolveRefs = (schema) => {
|
|
660
660
|
const store = createJsonSchemaStore(schema, pluginRefs);
|
|
@@ -700,7 +700,7 @@ var SchemaTable = class {
|
|
|
700
700
|
return this.store.getPlainSchema();
|
|
701
701
|
}
|
|
702
702
|
addRow(rowId, data) {
|
|
703
|
-
const row =
|
|
703
|
+
const row = chunkONW2OVNQ_cjs.createJsonValueStore(this.store, rowId, data);
|
|
704
704
|
this.rows.set(rowId, row);
|
|
705
705
|
}
|
|
706
706
|
getRow(id) {
|
|
@@ -717,14 +717,14 @@ var SchemaTable = class {
|
|
|
717
717
|
}));
|
|
718
718
|
}
|
|
719
719
|
migrateRows(nextStore) {
|
|
720
|
-
const transformation =
|
|
720
|
+
const transformation = chunkONW2OVNQ_cjs.getTransformation(this.store, nextStore);
|
|
721
721
|
if (transformation) {
|
|
722
722
|
for (const [rowId, row] of this.rows) {
|
|
723
723
|
const rawNextValue = transformation(
|
|
724
724
|
row.getPlainValue(),
|
|
725
725
|
nextStore.default
|
|
726
726
|
);
|
|
727
|
-
const nextRow =
|
|
727
|
+
const nextRow = chunkONW2OVNQ_cjs.createJsonValueStore(nextStore, rowId, rawNextValue);
|
|
728
728
|
this.rows.set(rowId, nextRow);
|
|
729
729
|
}
|
|
730
730
|
}
|
|
@@ -764,5 +764,3 @@ exports.setValueByPath = setValueByPath;
|
|
|
764
764
|
exports.traverseStore = traverseStore;
|
|
765
765
|
exports.traverseValue = traverseValue;
|
|
766
766
|
exports.validateJsonFieldName = validateJsonFieldName;
|
|
767
|
-
//# sourceMappingURL=chunk-V6JTSET2.cjs.map
|
|
768
|
-
//# sourceMappingURL=chunk-V6JTSET2.cjs.map
|
|
@@ -1566,7 +1566,7 @@ var SchemaSerializer = class {
|
|
|
1566
1566
|
required.push(child.name());
|
|
1567
1567
|
}
|
|
1568
1568
|
const result = {
|
|
1569
|
-
type: "object"
|
|
1569
|
+
type: "object",
|
|
1570
1570
|
properties,
|
|
1571
1571
|
additionalProperties: false,
|
|
1572
1572
|
required
|
|
@@ -1579,7 +1579,7 @@ var SchemaSerializer = class {
|
|
|
1579
1579
|
throw new Error("Array node must have items");
|
|
1580
1580
|
}
|
|
1581
1581
|
const result = {
|
|
1582
|
-
type: "array"
|
|
1582
|
+
type: "array",
|
|
1583
1583
|
items: this.serialize(items)
|
|
1584
1584
|
};
|
|
1585
1585
|
return this.addMetadata(result, node);
|
|
@@ -1605,7 +1605,7 @@ var SchemaSerializer = class {
|
|
|
1605
1605
|
}
|
|
1606
1606
|
serializeString(node) {
|
|
1607
1607
|
const result = {
|
|
1608
|
-
type: "string"
|
|
1608
|
+
type: "string",
|
|
1609
1609
|
default: node.defaultValue() ?? ""
|
|
1610
1610
|
};
|
|
1611
1611
|
const foreignKey = node.foreignKey();
|
|
@@ -1625,7 +1625,7 @@ var SchemaSerializer = class {
|
|
|
1625
1625
|
}
|
|
1626
1626
|
serializeNumber(node) {
|
|
1627
1627
|
const result = {
|
|
1628
|
-
type: "number"
|
|
1628
|
+
type: "number",
|
|
1629
1629
|
default: node.defaultValue() ?? 0
|
|
1630
1630
|
};
|
|
1631
1631
|
const formula = node.formula();
|
|
@@ -1637,7 +1637,7 @@ var SchemaSerializer = class {
|
|
|
1637
1637
|
}
|
|
1638
1638
|
serializeBoolean(node) {
|
|
1639
1639
|
const result = {
|
|
1640
|
-
type: "boolean"
|
|
1640
|
+
type: "boolean",
|
|
1641
1641
|
default: node.defaultValue() ?? false
|
|
1642
1642
|
};
|
|
1643
1643
|
const formula = node.formula();
|
|
@@ -2679,5 +2679,3 @@ function buildArrayItemsPath(parentPath) {
|
|
|
2679
2679
|
}
|
|
2680
2680
|
|
|
2681
2681
|
export { AbstractBasePath, ChangeCoalescer, ChangeCollector, CompositeRule, EMPTY_METADATA, EMPTY_PATH, EnumValidator, FIELD_NAME_ERROR_MESSAGE, ForeignKeyValidator, FormulaError, FormulaPathBuilder, FormulaSerializer, ItemsSegment, MaxLengthValidator, MaximumValidator, MinLengthValidator, MinimumValidator, NULL_NODE, NodePathIndex, PatchBuilder, PatchEnricher, PatchGenerator, PatternValidator, PropertySegment, RequiredValidator, ResolvedDependency, SchemaDiff, SchemaPropertyRule, SchemaSerializer, SchemaTruthyRule, ValidationEngine, ValidatorRegistry, ValidatorResolver, areNodesContentEqual, areNodesEqual, coalesceChanges, collectChanges, createArrayNode, createBooleanNode, createDefaultValidatorRegistry, createMobxProvider, createNumberNode, createObjectNode, createPath, createRefNode, createSchemaTree, createStringNode, createValidationEngine, isValidFieldName, jsonPointerToPath, jsonPointerToSegments, jsonPointerToSimplePath, makeAutoObservable, makeObservable, observable, reaction, resetReactivityProvider, runInAction, setReactivityProvider, validateFormulas, validateSchema };
|
|
2682
|
-
//# sourceMappingURL=chunk-3JZKQWQH.js.map
|
|
2683
|
-
//# sourceMappingURL=chunk-3JZKQWQH.js.map
|
|
@@ -678,5 +678,3 @@ exports.evaluateFormulas = evaluateFormulas;
|
|
|
678
678
|
exports.extractSchemaFormulas = extractSchemaFormulas;
|
|
679
679
|
exports.validateFormulaAgainstSchema = validateFormulaAgainstSchema;
|
|
680
680
|
exports.validateSchemaFormulas = validateSchemaFormulas;
|
|
681
|
-
//# sourceMappingURL=chunk-X2VRR7V7.cjs.map
|
|
682
|
-
//# sourceMappingURL=chunk-X2VRR7V7.cjs.map
|
|
@@ -19,7 +19,7 @@ var JsonStringStore = class extends EventEmitter {
|
|
|
19
19
|
super();
|
|
20
20
|
this.nodeId = nodeId;
|
|
21
21
|
}
|
|
22
|
-
type = "string"
|
|
22
|
+
type = "string";
|
|
23
23
|
$ref = "";
|
|
24
24
|
name = "";
|
|
25
25
|
parent = null;
|
|
@@ -75,7 +75,7 @@ var JsonNumberStore = class extends EventEmitter {
|
|
|
75
75
|
super();
|
|
76
76
|
this.nodeId = nodeId;
|
|
77
77
|
}
|
|
78
|
-
type = "number"
|
|
78
|
+
type = "number";
|
|
79
79
|
$ref = "";
|
|
80
80
|
name = "";
|
|
81
81
|
parent = null;
|
|
@@ -121,7 +121,7 @@ var JsonBooleanStore = class extends EventEmitter {
|
|
|
121
121
|
super();
|
|
122
122
|
this.nodeId = nodeId;
|
|
123
123
|
}
|
|
124
|
-
type = "boolean"
|
|
124
|
+
type = "boolean";
|
|
125
125
|
$ref = "";
|
|
126
126
|
name = "";
|
|
127
127
|
parent = null;
|
|
@@ -166,7 +166,7 @@ var JsonObjectStore = class {
|
|
|
166
166
|
constructor(nodeId = nanoid()) {
|
|
167
167
|
this.nodeId = nodeId;
|
|
168
168
|
}
|
|
169
|
-
type = "object"
|
|
169
|
+
type = "object";
|
|
170
170
|
$ref = "";
|
|
171
171
|
name = "";
|
|
172
172
|
parent = null;
|
|
@@ -317,7 +317,7 @@ var JsonArrayStore = class {
|
|
|
317
317
|
this.nodeId = nodeId;
|
|
318
318
|
this.items.parent = this;
|
|
319
319
|
}
|
|
320
|
-
type = "array"
|
|
320
|
+
type = "array";
|
|
321
321
|
$ref = "";
|
|
322
322
|
name = "";
|
|
323
323
|
parent = null;
|
|
@@ -393,7 +393,7 @@ var JsonStringValueStore = class {
|
|
|
393
393
|
this.value = value;
|
|
394
394
|
this.index = this.schema.registerValue(this);
|
|
395
395
|
}
|
|
396
|
-
type = "string"
|
|
396
|
+
type = "string";
|
|
397
397
|
index;
|
|
398
398
|
parent = null;
|
|
399
399
|
get foreignKey() {
|
|
@@ -412,7 +412,7 @@ var JsonNumberValueStore = class {
|
|
|
412
412
|
this.value = value;
|
|
413
413
|
this.index = this.schema.registerValue(this);
|
|
414
414
|
}
|
|
415
|
-
type = "number"
|
|
415
|
+
type = "number";
|
|
416
416
|
index;
|
|
417
417
|
parent = null;
|
|
418
418
|
getPlainValue() {
|
|
@@ -428,7 +428,7 @@ var JsonBooleanValueStore = class {
|
|
|
428
428
|
this.value = value;
|
|
429
429
|
this.index = this.schema.registerValue(this);
|
|
430
430
|
}
|
|
431
|
-
type = "boolean"
|
|
431
|
+
type = "boolean";
|
|
432
432
|
index;
|
|
433
433
|
parent = null;
|
|
434
434
|
getPlainValue() {
|
|
@@ -486,33 +486,33 @@ var fromArrayToObject = (_value, defaultValue) => {
|
|
|
486
486
|
};
|
|
487
487
|
var replaceTransformationsMapper = [
|
|
488
488
|
{
|
|
489
|
-
fromType: "number"
|
|
490
|
-
toType: "string"
|
|
489
|
+
fromType: "number",
|
|
490
|
+
toType: "string",
|
|
491
491
|
transformation: fromNumberToString
|
|
492
492
|
},
|
|
493
493
|
{
|
|
494
|
-
fromType: "string"
|
|
495
|
-
toType: "number"
|
|
494
|
+
fromType: "string",
|
|
495
|
+
toType: "number",
|
|
496
496
|
transformation: fromStringToNumber
|
|
497
497
|
},
|
|
498
498
|
{
|
|
499
|
-
fromType: "boolean"
|
|
500
|
-
toType: "string"
|
|
499
|
+
fromType: "boolean",
|
|
500
|
+
toType: "string",
|
|
501
501
|
transformation: fromBooleanToString
|
|
502
502
|
},
|
|
503
503
|
{
|
|
504
|
-
fromType: "string"
|
|
505
|
-
toType: "boolean"
|
|
504
|
+
fromType: "string",
|
|
505
|
+
toType: "boolean",
|
|
506
506
|
transformation: fromStringToBoolean
|
|
507
507
|
},
|
|
508
508
|
{
|
|
509
|
-
fromType: "boolean"
|
|
510
|
-
toType: "number"
|
|
509
|
+
fromType: "boolean",
|
|
510
|
+
toType: "number",
|
|
511
511
|
transformation: fromBooleanToNumber
|
|
512
512
|
},
|
|
513
513
|
{
|
|
514
|
-
fromType: "number"
|
|
515
|
-
toType: "boolean"
|
|
514
|
+
fromType: "number",
|
|
515
|
+
toType: "boolean",
|
|
516
516
|
transformation: fromNumberToBoolean
|
|
517
517
|
}
|
|
518
518
|
];
|
|
@@ -587,7 +587,7 @@ var JsonObjectValueStore = class {
|
|
|
587
587
|
this.index = this.schema.registerValue(this);
|
|
588
588
|
this.init();
|
|
589
589
|
}
|
|
590
|
-
type = "object"
|
|
590
|
+
type = "object";
|
|
591
591
|
index;
|
|
592
592
|
parent = null;
|
|
593
593
|
getPlainValue() {
|
|
@@ -639,7 +639,7 @@ var JsonObjectValueStore = class {
|
|
|
639
639
|
findValueAtSchemaLevel(targetSchema) {
|
|
640
640
|
let current = this.parent;
|
|
641
641
|
while (current) {
|
|
642
|
-
if (current.type === "object"
|
|
642
|
+
if (current.type === "object") {
|
|
643
643
|
for (const [, fieldValue] of Object.entries(current.value)) {
|
|
644
644
|
if (fieldValue.schema === targetSchema) {
|
|
645
645
|
return fieldValue.getPlainValue();
|
|
@@ -673,9 +673,9 @@ var JsonObjectValueStore = class {
|
|
|
673
673
|
|
|
674
674
|
// src/lib/createJsonValueStore.ts
|
|
675
675
|
var createJsonValueStore = (schema, rowId, rawValue) => {
|
|
676
|
-
if (schema.type === "object"
|
|
676
|
+
if (schema.type === "object") {
|
|
677
677
|
return createJsonObjectValueStore(schema, rowId, rawValue);
|
|
678
|
-
} else if (schema.type === "array"
|
|
678
|
+
} else if (schema.type === "array") {
|
|
679
679
|
return createJsonArrayValueStore(schema, rowId, rawValue);
|
|
680
680
|
} else {
|
|
681
681
|
return createPrimitiveValueStore(schema, rowId, rawValue);
|
|
@@ -702,11 +702,11 @@ var createJsonArrayValueStore = (schema, rowId, rawValue) => {
|
|
|
702
702
|
return new JsonArrayValueStore(schema, rowId, value);
|
|
703
703
|
};
|
|
704
704
|
var createPrimitiveValueStore = (schema, rowId, rawValue) => {
|
|
705
|
-
if (schema.type === "string"
|
|
705
|
+
if (schema.type === "string") {
|
|
706
706
|
return new JsonStringValueStore(schema, rowId, rawValue);
|
|
707
|
-
} else if (schema.type === "number"
|
|
707
|
+
} else if (schema.type === "number") {
|
|
708
708
|
return new JsonNumberValueStore(schema, rowId, rawValue);
|
|
709
|
-
} else if (schema.type === "boolean"
|
|
709
|
+
} else if (schema.type === "boolean") {
|
|
710
710
|
return new JsonBooleanValueStore(schema, rowId, rawValue);
|
|
711
711
|
} else {
|
|
712
712
|
throw new Error("this type is not allowed");
|
|
@@ -722,7 +722,7 @@ var JsonArrayValueStore = class {
|
|
|
722
722
|
this.index = this.schema.registerValue(this);
|
|
723
723
|
this.init();
|
|
724
724
|
}
|
|
725
|
-
type = "array"
|
|
725
|
+
type = "array";
|
|
726
726
|
index;
|
|
727
727
|
parent = null;
|
|
728
728
|
getPlainValue() {
|
|
@@ -759,5 +759,3 @@ var JsonArrayValueStore = class {
|
|
|
759
759
|
};
|
|
760
760
|
|
|
761
761
|
export { JsonArrayStore, JsonArrayValueStore, JsonBooleanStore, JsonBooleanValueStore, JsonNumberStore, JsonNumberValueStore, JsonObjectStore, JsonObjectValueStore, JsonStringStore, JsonStringValueStore, addSharedFieldsFromState, createJsonArrayValueStore, createJsonObjectValueStore, createJsonValueStore, createPrimitiveValueStore, equal, fromArrayToObject, fromArrayTransformation, fromBooleanToNumber, fromBooleanToString, fromNumberToBoolean, fromNumberToString, fromObjectToArray, fromObjectToPrimitive, fromPrimitiveToObject, fromStringToBoolean, fromStringToNumber, getTransformation, toArrayTransformation };
|
|
762
|
-
//# sourceMappingURL=chunk-55AMH44G.js.map
|
|
763
|
-
//# sourceMappingURL=chunk-55AMH44G.js.map
|
|
@@ -668,5 +668,3 @@ function setValueByPath(obj, path, value) {
|
|
|
668
668
|
}
|
|
669
669
|
|
|
670
670
|
export { collectFormulaNodes, evaluateFormulas, extractSchemaFormulas, validateFormulaAgainstSchema, validateSchemaFormulas };
|
|
671
|
-
//# sourceMappingURL=chunk-R3MS2N4A.js.map
|
|
672
|
-
//# sourceMappingURL=chunk-R3MS2N4A.js.map
|