@revisium/schema-toolkit 0.16.5 → 0.18.0
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/{chunk-7XIWS4W6.js → chunk-5FFJ2R3L.js} +57 -2
- package/dist/chunk-5FFJ2R3L.js.map +1 -0
- package/dist/{chunk-I6ZH7HZ7.cjs → chunk-DGWSDEVQ.cjs} +277 -64
- package/dist/chunk-DGWSDEVQ.cjs.map +1 -0
- package/dist/chunk-G6ZKEVVU.cjs +4 -0
- package/dist/chunk-G6ZKEVVU.cjs.map +1 -0
- package/dist/chunk-NY3H6C7K.js +3 -0
- package/dist/chunk-NY3H6C7K.js.map +1 -0
- package/dist/{chunk-YGTMLR3D.js → chunk-R4CFU33U.js} +2 -2
- package/dist/{chunk-YGTMLR3D.js.map → chunk-R4CFU33U.js.map} +1 -1
- package/dist/{chunk-HLGT7PCU.cjs → chunk-UQ63QBOS.cjs} +57 -2
- package/dist/chunk-UQ63QBOS.cjs.map +1 -0
- package/dist/{chunk-JJ2KGTZX.cjs → chunk-VGADCIBG.cjs} +2 -2
- package/dist/{chunk-JJ2KGTZX.cjs.map → chunk-VGADCIBG.cjs.map} +1 -1
- package/dist/{chunk-JHMO5NLL.js → chunk-YMJ262MJ.js} +224 -18
- package/dist/chunk-YMJ262MJ.js.map +1 -0
- package/dist/core/index.cjs +57 -57
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +189 -160
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/mocks/index.cjs +18 -17
- package/dist/mocks/index.js +2 -1
- package/dist/model/index.cjs +68 -39
- package/dist/model/index.d.cts +79 -4
- package/dist/model/index.d.ts +79 -4
- package/dist/model/index.js +3 -2
- package/dist/{types-bBnnfNxC.d.ts → types-BJyVALqI.d.ts} +3 -0
- package/dist/{types-BUiNI0oL.d.cts → types-DZ-vVxf7.d.cts} +3 -0
- package/package.json +1 -1
- package/dist/chunk-7XIWS4W6.js.map +0 -1
- package/dist/chunk-HLGT7PCU.cjs.map +0 -1
- package/dist/chunk-I6ZH7HZ7.cjs.map +0 -1
- package/dist/chunk-JHMO5NLL.js.map +0 -1
|
@@ -59,12 +59,17 @@ var NullNodeImpl = class {
|
|
|
59
59
|
clone() {
|
|
60
60
|
return this;
|
|
61
61
|
}
|
|
62
|
+
cloneWithId(_newId) {
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
62
65
|
setName(_name) {
|
|
63
66
|
}
|
|
64
67
|
setMetadata(_metadata) {
|
|
65
68
|
}
|
|
66
69
|
addChild(_node) {
|
|
67
70
|
}
|
|
71
|
+
insertChild(_index, _node) {
|
|
72
|
+
}
|
|
68
73
|
removeChild(_name) {
|
|
69
74
|
return false;
|
|
70
75
|
}
|
|
@@ -255,6 +260,8 @@ var BaseNode = class {
|
|
|
255
260
|
}
|
|
256
261
|
addChild(_node) {
|
|
257
262
|
}
|
|
263
|
+
insertChild(_index, _node) {
|
|
264
|
+
}
|
|
258
265
|
removeChild(_name) {
|
|
259
266
|
return false;
|
|
260
267
|
}
|
|
@@ -298,6 +305,7 @@ var ObjectNode = class _ObjectNode extends BaseNode {
|
|
|
298
305
|
makeObservable(this, {
|
|
299
306
|
_children: "observable.shallow",
|
|
300
307
|
addChild: "action",
|
|
308
|
+
insertChild: "action",
|
|
301
309
|
removeChild: "action",
|
|
302
310
|
replaceChild: "action"
|
|
303
311
|
});
|
|
@@ -322,9 +330,23 @@ var ObjectNode = class _ObjectNode extends BaseNode {
|
|
|
322
330
|
{ metadata: this.metadata(), ref: this._ref }
|
|
323
331
|
);
|
|
324
332
|
}
|
|
333
|
+
cloneWithId(newId) {
|
|
334
|
+
return new _ObjectNode(
|
|
335
|
+
newId,
|
|
336
|
+
this.name(),
|
|
337
|
+
this._children.map((child) => child.clone()),
|
|
338
|
+
{ metadata: this.metadata(), ref: this._ref }
|
|
339
|
+
);
|
|
340
|
+
}
|
|
325
341
|
addChild(node) {
|
|
326
342
|
this._children.push(node);
|
|
327
343
|
}
|
|
344
|
+
insertChild(index, node) {
|
|
345
|
+
if (index < 0 || index > this._children.length) {
|
|
346
|
+
throw new Error(`Index out of bounds: ${index}`);
|
|
347
|
+
}
|
|
348
|
+
this._children.splice(index, 0, node);
|
|
349
|
+
}
|
|
328
350
|
removeChild(name) {
|
|
329
351
|
const index = this._children.findIndex((child) => child.name() === name);
|
|
330
352
|
if (index === -1) {
|
|
@@ -377,6 +399,12 @@ var ArrayNode = class _ArrayNode extends BaseNode {
|
|
|
377
399
|
ref: this._ref
|
|
378
400
|
});
|
|
379
401
|
}
|
|
402
|
+
cloneWithId(newId) {
|
|
403
|
+
return new _ArrayNode(newId, this.name(), this._items.clone(), {
|
|
404
|
+
metadata: this.metadata(),
|
|
405
|
+
ref: this._ref
|
|
406
|
+
});
|
|
407
|
+
}
|
|
380
408
|
setItems(node) {
|
|
381
409
|
this._items = node;
|
|
382
410
|
}
|
|
@@ -460,6 +488,9 @@ var StringNode = class _StringNode extends PrimitiveNode {
|
|
|
460
488
|
clone() {
|
|
461
489
|
return new _StringNode(this.id(), this.name(), this.cloneOptions());
|
|
462
490
|
}
|
|
491
|
+
cloneWithId(newId) {
|
|
492
|
+
return new _StringNode(newId, this.name(), this.cloneOptions());
|
|
493
|
+
}
|
|
463
494
|
cloneOptions() {
|
|
464
495
|
return {
|
|
465
496
|
defaultValue: this._defaultValue,
|
|
@@ -487,6 +518,9 @@ var NumberNode = class _NumberNode extends PrimitiveNode {
|
|
|
487
518
|
clone() {
|
|
488
519
|
return new _NumberNode(this.id(), this.name(), this.cloneOptions());
|
|
489
520
|
}
|
|
521
|
+
cloneWithId(newId) {
|
|
522
|
+
return new _NumberNode(newId, this.name(), this.cloneOptions());
|
|
523
|
+
}
|
|
490
524
|
cloneOptions() {
|
|
491
525
|
return {
|
|
492
526
|
defaultValue: this._defaultValue,
|
|
@@ -512,6 +546,9 @@ var BooleanNode = class _BooleanNode extends PrimitiveNode {
|
|
|
512
546
|
clone() {
|
|
513
547
|
return new _BooleanNode(this.id(), this.name(), this.cloneOptions());
|
|
514
548
|
}
|
|
549
|
+
cloneWithId(newId) {
|
|
550
|
+
return new _BooleanNode(newId, this.name(), this.cloneOptions());
|
|
551
|
+
}
|
|
515
552
|
cloneOptions() {
|
|
516
553
|
return {
|
|
517
554
|
defaultValue: this._defaultValue,
|
|
@@ -544,6 +581,13 @@ var RefNode = class _RefNode extends BaseNode {
|
|
|
544
581
|
}
|
|
545
582
|
return new _RefNode(this.id(), this.name(), ref, this.metadata());
|
|
546
583
|
}
|
|
584
|
+
cloneWithId(newId) {
|
|
585
|
+
const ref = this.ref();
|
|
586
|
+
if (!ref) {
|
|
587
|
+
throw new Error("RefNode must have a ref value");
|
|
588
|
+
}
|
|
589
|
+
return new _RefNode(newId, this.name(), ref, this.metadata());
|
|
590
|
+
}
|
|
547
591
|
};
|
|
548
592
|
function createRefNode(id, name, ref, metadata = EMPTY_METADATA) {
|
|
549
593
|
return new RefNode(id, name, ref, metadata);
|
|
@@ -818,6 +862,17 @@ var SchemaTreeImpl = class _SchemaTreeImpl {
|
|
|
818
862
|
parent.addChild(node);
|
|
819
863
|
this.rebuildIndex();
|
|
820
864
|
}
|
|
865
|
+
insertChildAt(parentId, index, node) {
|
|
866
|
+
const parent = this.nodeById(parentId);
|
|
867
|
+
if (parent.isNull()) {
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
if (parent.isArray()) {
|
|
871
|
+
throw new Error("Cannot add child to array node. Use setItems instead.");
|
|
872
|
+
}
|
|
873
|
+
parent.insertChild(index, node);
|
|
874
|
+
this.rebuildIndex();
|
|
875
|
+
}
|
|
821
876
|
removeNodeAt(path) {
|
|
822
877
|
if (path.isEmpty()) {
|
|
823
878
|
return false;
|
|
@@ -2900,5 +2955,5 @@ function buildArrayItemsPath(parentPath) {
|
|
|
2900
2955
|
}
|
|
2901
2956
|
|
|
2902
2957
|
export { AbstractBasePath, ChangeCoalescer, ChangeCollector, CompositeRule, EMPTY_METADATA, EMPTY_PATH, EnumValidator, FIELD_NAME_ERROR_MESSAGE, ForeignKeyValidator, FormulaChangeDetector, FormulaDependencyIndex, FormulaPath, FormulaPathBuilder, FormulaSerializer, ItemsSegment, MaxLengthValidator, MaximumValidator, MinLengthValidator, MinimumValidator, NULL_NODE, NodePathIndex, ParsedFormula, 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 };
|
|
2903
|
-
//# sourceMappingURL=chunk-
|
|
2904
|
-
//# sourceMappingURL=chunk-
|
|
2958
|
+
//# sourceMappingURL=chunk-5FFJ2R3L.js.map
|
|
2959
|
+
//# sourceMappingURL=chunk-5FFJ2R3L.js.map
|