@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,5 +1,5 @@
|
|
|
1
|
-
import { fileSchema, rowSchemaHashSchema, rowHashSchema, rowUpdatedAtSchema, rowPublishedAtSchema, rowCreatedAtSchema, rowCreatedIdSchema, rowVersionIdSchema, rowIdSchema } from './chunk-
|
|
2
|
-
import { JsonArrayStore, JsonObjectStore, JsonStringStore, JsonNumberStore, JsonBooleanStore, JsonObjectValueStore, JsonArrayValueStore, createJsonValueStore, getTransformation } from './chunk-
|
|
1
|
+
import { fileSchema, rowSchemaHashSchema, rowHashSchema, rowUpdatedAtSchema, rowPublishedAtSchema, rowCreatedAtSchema, rowCreatedIdSchema, rowVersionIdSchema, rowIdSchema } from './chunk-4U2RZHMX.js';
|
|
2
|
+
import { JsonArrayStore, JsonObjectStore, JsonStringStore, JsonNumberStore, JsonBooleanStore, JsonObjectValueStore, JsonArrayValueStore, createJsonValueStore, getTransformation } from './chunk-FTBRJODD.js';
|
|
3
3
|
|
|
4
4
|
// src/lib/createJsonSchemaStore.ts
|
|
5
5
|
var createJsonSchemaStore = (schema, refs = {}) => {
|
|
@@ -12,11 +12,11 @@ var createJsonSchemaStore = (schema, refs = {}) => {
|
|
|
12
12
|
saveSharedFields(refStore, schema);
|
|
13
13
|
refStore.$ref = schema.$ref;
|
|
14
14
|
return refStore;
|
|
15
|
-
} else if (schema.type === "object"
|
|
15
|
+
} else if (schema.type === "object") {
|
|
16
16
|
const objectStore = createJsonObjectSchemaStore(schema, refs);
|
|
17
17
|
saveSharedFields(objectStore, schema);
|
|
18
18
|
return objectStore;
|
|
19
|
-
} else if (schema.type === "array"
|
|
19
|
+
} else if (schema.type === "array") {
|
|
20
20
|
const itemsStore = createJsonSchemaStore(schema.items, refs);
|
|
21
21
|
const arrayStore = new JsonArrayStore(itemsStore);
|
|
22
22
|
saveSharedFields(arrayStore, schema);
|
|
@@ -43,7 +43,7 @@ var createJsonObjectSchemaStore = (value, refs) => {
|
|
|
43
43
|
return store;
|
|
44
44
|
};
|
|
45
45
|
var createPrimitiveStoreBySchema = (schema) => {
|
|
46
|
-
if (schema.type === "string"
|
|
46
|
+
if (schema.type === "string") {
|
|
47
47
|
const stringStore = new JsonStringStore();
|
|
48
48
|
stringStore.foreignKey = schema.foreignKey;
|
|
49
49
|
stringStore.format = schema.format;
|
|
@@ -52,11 +52,11 @@ var createPrimitiveStoreBySchema = (schema) => {
|
|
|
52
52
|
stringStore.pattern = schema.pattern;
|
|
53
53
|
stringStore["x-formula"] = schema["x-formula"];
|
|
54
54
|
return stringStore;
|
|
55
|
-
} else if (schema.type === "number"
|
|
55
|
+
} else if (schema.type === "number") {
|
|
56
56
|
const numberStore = new JsonNumberStore();
|
|
57
57
|
numberStore["x-formula"] = schema["x-formula"];
|
|
58
58
|
return numberStore;
|
|
59
|
-
} else if (schema.type === "boolean"
|
|
59
|
+
} else if (schema.type === "boolean") {
|
|
60
60
|
const booleanStore = new JsonBooleanStore();
|
|
61
61
|
booleanStore["x-formula"] = schema["x-formula"];
|
|
62
62
|
return booleanStore;
|
|
@@ -86,7 +86,7 @@ var getJsonSchemaStoreByPath = (store, path) => {
|
|
|
86
86
|
let currentToken = tokens.shift();
|
|
87
87
|
let currentPath = "";
|
|
88
88
|
while (currentToken) {
|
|
89
|
-
if (currentStore.type === "object"
|
|
89
|
+
if (currentStore.type === "object") {
|
|
90
90
|
if (currentToken !== "properties") {
|
|
91
91
|
throw new Error(
|
|
92
92
|
`Expected "${currentPath}/properties/*" instead of ${currentPath}/${currentToken}/*`
|
|
@@ -104,7 +104,7 @@ var getJsonSchemaStoreByPath = (store, path) => {
|
|
|
104
104
|
currentStore = foundCurrentStore;
|
|
105
105
|
currentPath = `${currentPath}/${currentToken}`;
|
|
106
106
|
currentToken = tokens.shift();
|
|
107
|
-
} else if (currentStore.type === "array"
|
|
107
|
+
} else if (currentStore.type === "array") {
|
|
108
108
|
if (currentToken !== "items") {
|
|
109
109
|
throw new Error(
|
|
110
110
|
`Expected "${currentPath}/items/*" instead of ${currentPath}/${currentToken}/*`
|
|
@@ -176,9 +176,9 @@ var applyReplacePatch = (store, patch, refs = {}) => {
|
|
|
176
176
|
if (!parent) {
|
|
177
177
|
return patchStore;
|
|
178
178
|
}
|
|
179
|
-
if (parent.type === "object"
|
|
179
|
+
if (parent.type === "object") {
|
|
180
180
|
parent.migratePropertyWithStore(foundStore.name, patchStore);
|
|
181
|
-
} else if (parent.type === "array"
|
|
181
|
+
} else if (parent.type === "array") {
|
|
182
182
|
parent.migrateItems(patchStore);
|
|
183
183
|
} else {
|
|
184
184
|
throw new Error("Invalid parent");
|
|
@@ -191,7 +191,7 @@ var applyRemovePatch = (rootStore, patch) => {
|
|
|
191
191
|
if (!parent) {
|
|
192
192
|
throw new Error("Parent does not exist");
|
|
193
193
|
}
|
|
194
|
-
if (parent.type !== "object"
|
|
194
|
+
if (parent.type !== "object") {
|
|
195
195
|
throw new Error("Cannot remove from non-object");
|
|
196
196
|
}
|
|
197
197
|
parent.removeProperty(foundStore.name);
|
|
@@ -203,7 +203,7 @@ var applyAddPatch = (rootStore, patch, refs = {}) => {
|
|
|
203
203
|
if (!foundParent) {
|
|
204
204
|
throw new Error("Parent does not exist");
|
|
205
205
|
}
|
|
206
|
-
if (foundParent.type !== "object"
|
|
206
|
+
if (foundParent.type !== "object") {
|
|
207
207
|
throw new Error("Cannot add to non-object");
|
|
208
208
|
}
|
|
209
209
|
if (foundParent.getProperty(field)) {
|
|
@@ -229,15 +229,15 @@ var applyMovePatch = (store, patch) => {
|
|
|
229
229
|
if (!foundFromParent || !foundToParent) {
|
|
230
230
|
throw new Error("Cannot move from or to non-existent parent");
|
|
231
231
|
}
|
|
232
|
-
if (foundFromParent.type !== "object"
|
|
232
|
+
if (foundFromParent.type !== "object") {
|
|
233
233
|
throw new Error("Cannot move from non-object parent");
|
|
234
234
|
}
|
|
235
235
|
const foundFromField = getJsonSchemaStoreByPath(store, patch.from);
|
|
236
|
-
const isMovedPropertyInSameParentPatch = foundFromParent === foundToParent && foundFromParent.type === "object"
|
|
236
|
+
const isMovedPropertyInSameParentPatch = foundFromParent === foundToParent && foundFromParent.type === "object" && foundFromParent.getProperty(fromField);
|
|
237
237
|
if (isMovedPropertyInSameParentPatch) {
|
|
238
238
|
return foundFromParent.changeName(fromField, toField);
|
|
239
239
|
}
|
|
240
|
-
if (foundToParent.type === "object"
|
|
240
|
+
if (foundToParent.type === "object") {
|
|
241
241
|
if (foundToParent.getProperty(toField)) {
|
|
242
242
|
foundToParent.removeProperty(toField);
|
|
243
243
|
}
|
|
@@ -245,7 +245,7 @@ var applyMovePatch = (store, patch) => {
|
|
|
245
245
|
foundFromParent.removeProperty(fromField);
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
|
-
if (foundToParent.type === "array"
|
|
248
|
+
if (foundToParent.type === "array") {
|
|
249
249
|
foundFromParent.removeProperty(fromField);
|
|
250
250
|
foundToParent.replaceItems(foundFromField);
|
|
251
251
|
return;
|
|
@@ -258,9 +258,9 @@ var getDBJsonPathByJsonSchemaStore = (store) => {
|
|
|
258
258
|
let node = store;
|
|
259
259
|
let path = "";
|
|
260
260
|
while (node.parent) {
|
|
261
|
-
if (node.parent.type === "object"
|
|
261
|
+
if (node.parent.type === "object") {
|
|
262
262
|
path = `.${node.name}${path}`;
|
|
263
|
-
} else if (node.parent.type === "array"
|
|
263
|
+
} else if (node.parent.type === "array") {
|
|
264
264
|
path = `[*]${path}`;
|
|
265
265
|
}
|
|
266
266
|
node = node.parent;
|
|
@@ -276,9 +276,9 @@ var getPathByStore = (store) => {
|
|
|
276
276
|
let node = store;
|
|
277
277
|
let path = "";
|
|
278
278
|
while (node.parent) {
|
|
279
|
-
if (node.parent.type === "object"
|
|
279
|
+
if (node.parent.type === "object") {
|
|
280
280
|
path = `/properties/${node.name}${path}`;
|
|
281
|
-
} else if (node.parent.type === "array"
|
|
281
|
+
} else if (node.parent.type === "array") {
|
|
282
282
|
path = `/items${path}`;
|
|
283
283
|
}
|
|
284
284
|
node = node.parent;
|
|
@@ -292,11 +292,11 @@ var getPathByStore = (store) => {
|
|
|
292
292
|
// src/lib/traverseStore.ts
|
|
293
293
|
var traverseStore = (store, callback) => {
|
|
294
294
|
callback(store);
|
|
295
|
-
if (store.type === "object"
|
|
295
|
+
if (store.type === "object") {
|
|
296
296
|
Object.values(store.properties).forEach((item) => {
|
|
297
297
|
traverseStore(item, callback);
|
|
298
298
|
});
|
|
299
|
-
} else if (store.type === "array"
|
|
299
|
+
} else if (store.type === "array") {
|
|
300
300
|
traverseStore(store.items, callback);
|
|
301
301
|
}
|
|
302
302
|
};
|
|
@@ -305,7 +305,7 @@ var traverseStore = (store, callback) => {
|
|
|
305
305
|
var getForeignKeyPatchesFromSchema = (store, options) => {
|
|
306
306
|
const stores = [];
|
|
307
307
|
traverseStore(store, (item) => {
|
|
308
|
-
if (item.type === "string"
|
|
308
|
+
if (item.type === "string" && item.foreignKey === options.tableId) {
|
|
309
309
|
item.foreignKey = options.nextTableId;
|
|
310
310
|
const patch = {
|
|
311
311
|
op: "replace",
|
|
@@ -322,7 +322,7 @@ var getForeignKeyPatchesFromSchema = (store, options) => {
|
|
|
322
322
|
var getForeignKeysFromSchema = (store) => {
|
|
323
323
|
const foreignKeys = /* @__PURE__ */ new Set();
|
|
324
324
|
traverseStore(store, (item) => {
|
|
325
|
-
if (item.type === "string"
|
|
325
|
+
if (item.type === "string" && item.foreignKey) {
|
|
326
326
|
foreignKeys.add(item.foreignKey);
|
|
327
327
|
}
|
|
328
328
|
});
|
|
@@ -332,11 +332,11 @@ var getForeignKeysFromSchema = (store) => {
|
|
|
332
332
|
// src/lib/traverseValue.ts
|
|
333
333
|
var traverseValue = (store, callback) => {
|
|
334
334
|
callback(store);
|
|
335
|
-
if (store.type === "object"
|
|
335
|
+
if (store.type === "object") {
|
|
336
336
|
Object.values(store.value).forEach((item) => {
|
|
337
337
|
traverseValue(item, callback);
|
|
338
338
|
});
|
|
339
|
-
} else if (store.type === "array"
|
|
339
|
+
} else if (store.type === "array") {
|
|
340
340
|
store.value.forEach((itemValue) => {
|
|
341
341
|
traverseValue(itemValue, callback);
|
|
342
342
|
});
|
|
@@ -347,7 +347,7 @@ var traverseValue = (store, callback) => {
|
|
|
347
347
|
var getForeignKeysFromValue = (value) => {
|
|
348
348
|
const foreignKeys = /* @__PURE__ */ new Map();
|
|
349
349
|
traverseValue(value, (item) => {
|
|
350
|
-
if (item.type === "string"
|
|
350
|
+
if (item.type === "string" && item.foreignKey) {
|
|
351
351
|
let tableForeignKey = foreignKeys.get(item.foreignKey);
|
|
352
352
|
if (!tableForeignKey) {
|
|
353
353
|
tableForeignKey = /* @__PURE__ */ new Set();
|
|
@@ -367,7 +367,7 @@ var getInvalidFieldNamesInSchema = (schema, refs = {}) => {
|
|
|
367
367
|
const schemaStore = createJsonSchemaStore(schema, refs);
|
|
368
368
|
const invalidFields = [];
|
|
369
369
|
traverseStore(schemaStore, (item) => {
|
|
370
|
-
if (item.parent?.type === "object"
|
|
370
|
+
if (item.parent?.type === "object") {
|
|
371
371
|
if (!validateJsonFieldName(item.name)) {
|
|
372
372
|
invalidFields.push(item);
|
|
373
373
|
}
|
|
@@ -634,7 +634,7 @@ var getJsonValueStoreByPath = (root, path) => {
|
|
|
634
634
|
var replaceForeignKeyValue = (options) => {
|
|
635
635
|
let wasUpdated = false;
|
|
636
636
|
traverseValue(options.valueStore, (item) => {
|
|
637
|
-
if (item.type === "string"
|
|
637
|
+
if (item.type === "string" && item.foreignKey === options.foreignKey && item.value === options.value) {
|
|
638
638
|
item.value = options.nextValue;
|
|
639
639
|
wasUpdated = true;
|
|
640
640
|
}
|
|
@@ -731,5 +731,3 @@ var SchemaTable = class {
|
|
|
731
731
|
};
|
|
732
732
|
|
|
733
733
|
export { SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, convertSchemaPathToJsonPath, createJsonObjectSchemaStore, createJsonSchemaStore, createPrimitiveStoreBySchema, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName };
|
|
734
|
-
//# sourceMappingURL=chunk-QEV4Q4TR.js.map
|
|
735
|
-
//# sourceMappingURL=chunk-QEV4Q4TR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -21,7 +21,7 @@ var JsonStringStore = class extends eventemitter3.EventEmitter {
|
|
|
21
21
|
super();
|
|
22
22
|
this.nodeId = nodeId;
|
|
23
23
|
}
|
|
24
|
-
type = "string"
|
|
24
|
+
type = "string";
|
|
25
25
|
$ref = "";
|
|
26
26
|
name = "";
|
|
27
27
|
parent = null;
|
|
@@ -77,7 +77,7 @@ var JsonNumberStore = class extends eventemitter3.EventEmitter {
|
|
|
77
77
|
super();
|
|
78
78
|
this.nodeId = nodeId;
|
|
79
79
|
}
|
|
80
|
-
type = "number"
|
|
80
|
+
type = "number";
|
|
81
81
|
$ref = "";
|
|
82
82
|
name = "";
|
|
83
83
|
parent = null;
|
|
@@ -123,7 +123,7 @@ var JsonBooleanStore = class extends eventemitter3.EventEmitter {
|
|
|
123
123
|
super();
|
|
124
124
|
this.nodeId = nodeId;
|
|
125
125
|
}
|
|
126
|
-
type = "boolean"
|
|
126
|
+
type = "boolean";
|
|
127
127
|
$ref = "";
|
|
128
128
|
name = "";
|
|
129
129
|
parent = null;
|
|
@@ -168,7 +168,7 @@ var JsonObjectStore = class {
|
|
|
168
168
|
constructor(nodeId = nanoid.nanoid()) {
|
|
169
169
|
this.nodeId = nodeId;
|
|
170
170
|
}
|
|
171
|
-
type = "object"
|
|
171
|
+
type = "object";
|
|
172
172
|
$ref = "";
|
|
173
173
|
name = "";
|
|
174
174
|
parent = null;
|
|
@@ -319,7 +319,7 @@ var JsonArrayStore = class {
|
|
|
319
319
|
this.nodeId = nodeId;
|
|
320
320
|
this.items.parent = this;
|
|
321
321
|
}
|
|
322
|
-
type = "array"
|
|
322
|
+
type = "array";
|
|
323
323
|
$ref = "";
|
|
324
324
|
name = "";
|
|
325
325
|
parent = null;
|
|
@@ -395,7 +395,7 @@ var JsonStringValueStore = class {
|
|
|
395
395
|
this.value = value;
|
|
396
396
|
this.index = this.schema.registerValue(this);
|
|
397
397
|
}
|
|
398
|
-
type = "string"
|
|
398
|
+
type = "string";
|
|
399
399
|
index;
|
|
400
400
|
parent = null;
|
|
401
401
|
get foreignKey() {
|
|
@@ -414,7 +414,7 @@ var JsonNumberValueStore = class {
|
|
|
414
414
|
this.value = value;
|
|
415
415
|
this.index = this.schema.registerValue(this);
|
|
416
416
|
}
|
|
417
|
-
type = "number"
|
|
417
|
+
type = "number";
|
|
418
418
|
index;
|
|
419
419
|
parent = null;
|
|
420
420
|
getPlainValue() {
|
|
@@ -430,7 +430,7 @@ var JsonBooleanValueStore = class {
|
|
|
430
430
|
this.value = value;
|
|
431
431
|
this.index = this.schema.registerValue(this);
|
|
432
432
|
}
|
|
433
|
-
type = "boolean"
|
|
433
|
+
type = "boolean";
|
|
434
434
|
index;
|
|
435
435
|
parent = null;
|
|
436
436
|
getPlainValue() {
|
|
@@ -488,33 +488,33 @@ var fromArrayToObject = (_value, defaultValue) => {
|
|
|
488
488
|
};
|
|
489
489
|
var replaceTransformationsMapper = [
|
|
490
490
|
{
|
|
491
|
-
fromType: "number"
|
|
492
|
-
toType: "string"
|
|
491
|
+
fromType: "number",
|
|
492
|
+
toType: "string",
|
|
493
493
|
transformation: fromNumberToString
|
|
494
494
|
},
|
|
495
495
|
{
|
|
496
|
-
fromType: "string"
|
|
497
|
-
toType: "number"
|
|
496
|
+
fromType: "string",
|
|
497
|
+
toType: "number",
|
|
498
498
|
transformation: fromStringToNumber
|
|
499
499
|
},
|
|
500
500
|
{
|
|
501
|
-
fromType: "boolean"
|
|
502
|
-
toType: "string"
|
|
501
|
+
fromType: "boolean",
|
|
502
|
+
toType: "string",
|
|
503
503
|
transformation: fromBooleanToString
|
|
504
504
|
},
|
|
505
505
|
{
|
|
506
|
-
fromType: "string"
|
|
507
|
-
toType: "boolean"
|
|
506
|
+
fromType: "string",
|
|
507
|
+
toType: "boolean",
|
|
508
508
|
transformation: fromStringToBoolean
|
|
509
509
|
},
|
|
510
510
|
{
|
|
511
|
-
fromType: "boolean"
|
|
512
|
-
toType: "number"
|
|
511
|
+
fromType: "boolean",
|
|
512
|
+
toType: "number",
|
|
513
513
|
transformation: fromBooleanToNumber
|
|
514
514
|
},
|
|
515
515
|
{
|
|
516
|
-
fromType: "number"
|
|
517
|
-
toType: "boolean"
|
|
516
|
+
fromType: "number",
|
|
517
|
+
toType: "boolean",
|
|
518
518
|
transformation: fromNumberToBoolean
|
|
519
519
|
}
|
|
520
520
|
];
|
|
@@ -589,7 +589,7 @@ var JsonObjectValueStore = class {
|
|
|
589
589
|
this.index = this.schema.registerValue(this);
|
|
590
590
|
this.init();
|
|
591
591
|
}
|
|
592
|
-
type = "object"
|
|
592
|
+
type = "object";
|
|
593
593
|
index;
|
|
594
594
|
parent = null;
|
|
595
595
|
getPlainValue() {
|
|
@@ -641,7 +641,7 @@ var JsonObjectValueStore = class {
|
|
|
641
641
|
findValueAtSchemaLevel(targetSchema) {
|
|
642
642
|
let current = this.parent;
|
|
643
643
|
while (current) {
|
|
644
|
-
if (current.type === "object"
|
|
644
|
+
if (current.type === "object") {
|
|
645
645
|
for (const [, fieldValue] of Object.entries(current.value)) {
|
|
646
646
|
if (fieldValue.schema === targetSchema) {
|
|
647
647
|
return fieldValue.getPlainValue();
|
|
@@ -675,9 +675,9 @@ var JsonObjectValueStore = class {
|
|
|
675
675
|
|
|
676
676
|
// src/lib/createJsonValueStore.ts
|
|
677
677
|
var createJsonValueStore = (schema, rowId, rawValue) => {
|
|
678
|
-
if (schema.type === "object"
|
|
678
|
+
if (schema.type === "object") {
|
|
679
679
|
return createJsonObjectValueStore(schema, rowId, rawValue);
|
|
680
|
-
} else if (schema.type === "array"
|
|
680
|
+
} else if (schema.type === "array") {
|
|
681
681
|
return createJsonArrayValueStore(schema, rowId, rawValue);
|
|
682
682
|
} else {
|
|
683
683
|
return createPrimitiveValueStore(schema, rowId, rawValue);
|
|
@@ -704,11 +704,11 @@ var createJsonArrayValueStore = (schema, rowId, rawValue) => {
|
|
|
704
704
|
return new JsonArrayValueStore(schema, rowId, value);
|
|
705
705
|
};
|
|
706
706
|
var createPrimitiveValueStore = (schema, rowId, rawValue) => {
|
|
707
|
-
if (schema.type === "string"
|
|
707
|
+
if (schema.type === "string") {
|
|
708
708
|
return new JsonStringValueStore(schema, rowId, rawValue);
|
|
709
|
-
} else if (schema.type === "number"
|
|
709
|
+
} else if (schema.type === "number") {
|
|
710
710
|
return new JsonNumberValueStore(schema, rowId, rawValue);
|
|
711
|
-
} else if (schema.type === "boolean"
|
|
711
|
+
} else if (schema.type === "boolean") {
|
|
712
712
|
return new JsonBooleanValueStore(schema, rowId, rawValue);
|
|
713
713
|
} else {
|
|
714
714
|
throw new Error("this type is not allowed");
|
|
@@ -724,7 +724,7 @@ var JsonArrayValueStore = class {
|
|
|
724
724
|
this.index = this.schema.registerValue(this);
|
|
725
725
|
this.init();
|
|
726
726
|
}
|
|
727
|
-
type = "array"
|
|
727
|
+
type = "array";
|
|
728
728
|
index;
|
|
729
729
|
parent = null;
|
|
730
730
|
getPlainValue() {
|
|
@@ -789,5 +789,3 @@ exports.fromStringToBoolean = fromStringToBoolean;
|
|
|
789
789
|
exports.fromStringToNumber = fromStringToNumber;
|
|
790
790
|
exports.getTransformation = getTransformation;
|
|
791
791
|
exports.toArrayTransformation = toArrayTransformation;
|
|
792
|
-
//# sourceMappingURL=chunk-B3T6YB2D.cjs.map
|
|
793
|
-
//# sourceMappingURL=chunk-B3T6YB2D.cjs.map
|
|
@@ -414,5 +414,3 @@ exports.stringMetaSchema = stringMetaSchema;
|
|
|
414
414
|
exports.tableMigrationsSchema = tableMigrationsSchema;
|
|
415
415
|
exports.xFormulaRequiresReadOnly = xFormulaRequiresReadOnly;
|
|
416
416
|
exports.xFormulaSchema = xFormulaSchema;
|
|
417
|
-
//# sourceMappingURL=chunk-32FZHFIO.cjs.map
|
|
418
|
-
//# sourceMappingURL=chunk-32FZHFIO.cjs.map
|
|
@@ -1568,7 +1568,7 @@ var SchemaSerializer = class {
|
|
|
1568
1568
|
required.push(child.name());
|
|
1569
1569
|
}
|
|
1570
1570
|
const result = {
|
|
1571
|
-
type: "object"
|
|
1571
|
+
type: "object",
|
|
1572
1572
|
properties,
|
|
1573
1573
|
additionalProperties: false,
|
|
1574
1574
|
required
|
|
@@ -1581,7 +1581,7 @@ var SchemaSerializer = class {
|
|
|
1581
1581
|
throw new Error("Array node must have items");
|
|
1582
1582
|
}
|
|
1583
1583
|
const result = {
|
|
1584
|
-
type: "array"
|
|
1584
|
+
type: "array",
|
|
1585
1585
|
items: this.serialize(items)
|
|
1586
1586
|
};
|
|
1587
1587
|
return this.addMetadata(result, node);
|
|
@@ -1607,7 +1607,7 @@ var SchemaSerializer = class {
|
|
|
1607
1607
|
}
|
|
1608
1608
|
serializeString(node) {
|
|
1609
1609
|
const result = {
|
|
1610
|
-
type: "string"
|
|
1610
|
+
type: "string",
|
|
1611
1611
|
default: node.defaultValue() ?? ""
|
|
1612
1612
|
};
|
|
1613
1613
|
const foreignKey = node.foreignKey();
|
|
@@ -1627,7 +1627,7 @@ var SchemaSerializer = class {
|
|
|
1627
1627
|
}
|
|
1628
1628
|
serializeNumber(node) {
|
|
1629
1629
|
const result = {
|
|
1630
|
-
type: "number"
|
|
1630
|
+
type: "number",
|
|
1631
1631
|
default: node.defaultValue() ?? 0
|
|
1632
1632
|
};
|
|
1633
1633
|
const formula = node.formula();
|
|
@@ -1639,7 +1639,7 @@ var SchemaSerializer = class {
|
|
|
1639
1639
|
}
|
|
1640
1640
|
serializeBoolean(node) {
|
|
1641
1641
|
const result = {
|
|
1642
|
-
type: "boolean"
|
|
1642
|
+
type: "boolean",
|
|
1643
1643
|
default: node.defaultValue() ?? false
|
|
1644
1644
|
};
|
|
1645
1645
|
const formula = node.formula();
|
|
@@ -2741,5 +2741,3 @@ exports.runInAction = runInAction;
|
|
|
2741
2741
|
exports.setReactivityProvider = setReactivityProvider;
|
|
2742
2742
|
exports.validateFormulas = validateFormulas;
|
|
2743
2743
|
exports.validateSchema = validateSchema;
|
|
2744
|
-
//# sourceMappingURL=chunk-46ME2TAU.cjs.map
|
|
2745
|
-
//# sourceMappingURL=chunk-46ME2TAU.cjs.map
|