@revisium/schema-toolkit 0.19.2 → 0.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-OMSE2HGD.cjs → chunk-CN74KAMA.cjs} +65 -65
- package/dist/{chunk-OMSE2HGD.cjs.map → chunk-CN74KAMA.cjs.map} +1 -1
- package/dist/{chunk-XL4R6PSM.js → chunk-K7XZT2M4.js} +15 -4
- package/dist/chunk-K7XZT2M4.js.map +1 -0
- package/dist/{chunk-3V7AYFDS.js → chunk-T2JUOWMX.js} +3 -3
- package/dist/{chunk-3V7AYFDS.js.map → chunk-T2JUOWMX.js.map} +1 -1
- package/dist/{chunk-HDZCCAWA.cjs → chunk-X2KLCGJ6.cjs} +15 -4
- package/dist/chunk-X2KLCGJ6.cjs.map +1 -0
- package/dist/core/index.cjs +60 -60
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +102 -102
- package/dist/index.js +2 -2
- package/dist/model/index.cjs +46 -46
- package/dist/model/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-HDZCCAWA.cjs.map +0 -1
- package/dist/chunk-XL4R6PSM.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkX2KLCGJ6_cjs = require('./chunk-X2KLCGJ6.cjs');
|
|
4
4
|
var chunkVGADCIBG_cjs = require('./chunk-VGADCIBG.cjs');
|
|
5
5
|
var nanoid = require('nanoid');
|
|
6
6
|
var formula = require('@revisium/formula');
|
|
@@ -68,7 +68,7 @@ var FormulaPath = class {
|
|
|
68
68
|
resolveRootPath(rootPath) {
|
|
69
69
|
const path = rootPath.startsWith("/") ? rootPath.slice(1) : rootPath;
|
|
70
70
|
if (!path) {
|
|
71
|
-
return
|
|
71
|
+
return chunkX2KLCGJ6_cjs.EMPTY_PATH;
|
|
72
72
|
}
|
|
73
73
|
try {
|
|
74
74
|
return this.parseFormulaPath(path);
|
|
@@ -78,7 +78,7 @@ var FormulaPath = class {
|
|
|
78
78
|
}
|
|
79
79
|
parseFormulaPath(formulaPath) {
|
|
80
80
|
const parts = formulaPath.split(".");
|
|
81
|
-
let result =
|
|
81
|
+
let result = chunkX2KLCGJ6_cjs.EMPTY_PATH;
|
|
82
82
|
for (const part of parts) {
|
|
83
83
|
if (!part) {
|
|
84
84
|
throw new Error(`Invalid path: empty segment`);
|
|
@@ -106,7 +106,7 @@ var ParsedFormula = class {
|
|
|
106
106
|
this.astNode = parseResult.ast;
|
|
107
107
|
const formulaPath = tree.pathOf(formulaNodeId);
|
|
108
108
|
if (formulaPath.isEmpty() && tree.root().id() !== formulaNodeId) {
|
|
109
|
-
throw new
|
|
109
|
+
throw new chunkX2KLCGJ6_cjs.FormulaError("Formula node not found in tree", formulaNodeId);
|
|
110
110
|
}
|
|
111
111
|
const deps = [];
|
|
112
112
|
const astPathToNodeId = /* @__PURE__ */ new Map();
|
|
@@ -117,20 +117,20 @@ var ParsedFormula = class {
|
|
|
117
117
|
depPath
|
|
118
118
|
);
|
|
119
119
|
if (!targetNodeId) {
|
|
120
|
-
throw new
|
|
120
|
+
throw new chunkX2KLCGJ6_cjs.FormulaError(
|
|
121
121
|
`Cannot resolve formula dependency: ${depPath}`,
|
|
122
122
|
formulaNodeId,
|
|
123
123
|
"Path not found in schema"
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
if (targetNodeId === formulaNodeId) {
|
|
127
|
-
throw new
|
|
127
|
+
throw new chunkX2KLCGJ6_cjs.FormulaError(
|
|
128
128
|
"Formula cannot reference itself",
|
|
129
129
|
formulaNodeId,
|
|
130
130
|
"Self-reference detected"
|
|
131
131
|
);
|
|
132
132
|
}
|
|
133
|
-
deps.push(new
|
|
133
|
+
deps.push(new chunkX2KLCGJ6_cjs.ResolvedDependency(targetNodeId));
|
|
134
134
|
astPathToNodeId.set(depPath, targetNodeId);
|
|
135
135
|
}
|
|
136
136
|
this.deps = deps;
|
|
@@ -294,7 +294,7 @@ var FormulaChangeDetector = class {
|
|
|
294
294
|
}
|
|
295
295
|
getSerializedExpression(formula, tree, nodeId) {
|
|
296
296
|
try {
|
|
297
|
-
const xFormula =
|
|
297
|
+
const xFormula = chunkX2KLCGJ6_cjs.FormulaSerializer.toXFormula(tree, nodeId, formula);
|
|
298
298
|
return xFormula.expression;
|
|
299
299
|
} catch {
|
|
300
300
|
return null;
|
|
@@ -341,7 +341,7 @@ var SchemaParser = class {
|
|
|
341
341
|
if (resolvedSchema) {
|
|
342
342
|
return this.parseNode(resolvedSchema, name, refValue);
|
|
343
343
|
}
|
|
344
|
-
return
|
|
344
|
+
return chunkX2KLCGJ6_cjs.createRefNode(nanoid.nanoid(), name, refValue, this.extractMetadata(schema));
|
|
345
345
|
}
|
|
346
346
|
const schemaWithType = schema;
|
|
347
347
|
switch (schemaWithType.type) {
|
|
@@ -367,14 +367,14 @@ var SchemaParser = class {
|
|
|
367
367
|
children.push(this.parseNode(propSchema, propName));
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
return
|
|
370
|
+
return chunkX2KLCGJ6_cjs.createObjectNode(nanoid.nanoid(), name, children, {
|
|
371
371
|
metadata: this.extractMetadata(schema),
|
|
372
372
|
ref: ref2
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
375
|
parseArray(schema, name, ref2) {
|
|
376
376
|
const items = this.parseNode(schema.items, "items");
|
|
377
|
-
return
|
|
377
|
+
return chunkX2KLCGJ6_cjs.createArrayNode(nanoid.nanoid(), name, items, {
|
|
378
378
|
metadata: this.extractMetadata(schema),
|
|
379
379
|
ref: ref2
|
|
380
380
|
});
|
|
@@ -382,7 +382,7 @@ var SchemaParser = class {
|
|
|
382
382
|
parseString(schema, name, ref2) {
|
|
383
383
|
const nodeId = nanoid.nanoid();
|
|
384
384
|
this.collectFormula(nodeId, schema["x-formula"]);
|
|
385
|
-
return
|
|
385
|
+
return chunkX2KLCGJ6_cjs.createStringNode(nodeId, name, {
|
|
386
386
|
defaultValue: schema.default,
|
|
387
387
|
foreignKey: schema.foreignKey,
|
|
388
388
|
metadata: this.extractMetadata(schema),
|
|
@@ -392,7 +392,7 @@ var SchemaParser = class {
|
|
|
392
392
|
parseNumber(schema, name, ref2) {
|
|
393
393
|
const nodeId = nanoid.nanoid();
|
|
394
394
|
this.collectFormula(nodeId, schema["x-formula"]);
|
|
395
|
-
return
|
|
395
|
+
return chunkX2KLCGJ6_cjs.createNumberNode(nodeId, name, {
|
|
396
396
|
defaultValue: schema.default,
|
|
397
397
|
metadata: this.extractMetadata(schema),
|
|
398
398
|
ref: ref2
|
|
@@ -401,7 +401,7 @@ var SchemaParser = class {
|
|
|
401
401
|
parseBoolean(schema, name, ref2) {
|
|
402
402
|
const nodeId = nanoid.nanoid();
|
|
403
403
|
this.collectFormula(nodeId, schema["x-formula"]);
|
|
404
|
-
return
|
|
404
|
+
return chunkX2KLCGJ6_cjs.createBooleanNode(nodeId, name, {
|
|
405
405
|
defaultValue: schema.default,
|
|
406
406
|
metadata: this.extractMetadata(schema),
|
|
407
407
|
ref: ref2
|
|
@@ -434,13 +434,13 @@ var NodeFactory = class {
|
|
|
434
434
|
createNode(name, type) {
|
|
435
435
|
switch (type) {
|
|
436
436
|
case "string":
|
|
437
|
-
return
|
|
437
|
+
return chunkX2KLCGJ6_cjs.createStringNode(nanoid.nanoid(), name, { defaultValue: "" });
|
|
438
438
|
case "number":
|
|
439
|
-
return
|
|
439
|
+
return chunkX2KLCGJ6_cjs.createNumberNode(nanoid.nanoid(), name, { defaultValue: 0 });
|
|
440
440
|
case "boolean":
|
|
441
|
-
return
|
|
441
|
+
return chunkX2KLCGJ6_cjs.createBooleanNode(nanoid.nanoid(), name, { defaultValue: false });
|
|
442
442
|
case "object":
|
|
443
|
-
return
|
|
443
|
+
return chunkX2KLCGJ6_cjs.createObjectNode(nanoid.nanoid(), name, []);
|
|
444
444
|
case "array":
|
|
445
445
|
return this.createArrayNodeInternal(name);
|
|
446
446
|
default:
|
|
@@ -448,11 +448,11 @@ var NodeFactory = class {
|
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
createArrayNodeInternal(name) {
|
|
451
|
-
const items =
|
|
452
|
-
return
|
|
451
|
+
const items = chunkX2KLCGJ6_cjs.createStringNode(nanoid.nanoid(), "items", { defaultValue: "" });
|
|
452
|
+
return chunkX2KLCGJ6_cjs.createArrayNode(nanoid.nanoid(), name, items);
|
|
453
453
|
}
|
|
454
454
|
createArrayNodeWithItems(name, items) {
|
|
455
|
-
return
|
|
455
|
+
return chunkX2KLCGJ6_cjs.createArrayNode(nanoid.nanoid(), name, items);
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
|
|
@@ -551,7 +551,7 @@ var PrimitiveToArrayTransformer = class {
|
|
|
551
551
|
const { sourceNode } = ctx;
|
|
552
552
|
const itemsNode = sourceNode.cloneWithId(nanoid.nanoid());
|
|
553
553
|
itemsNode.setName("items");
|
|
554
|
-
const arrayNode =
|
|
554
|
+
const arrayNode = chunkX2KLCGJ6_cjs.createArrayNode(sourceNode.id(), sourceNode.name(), itemsNode);
|
|
555
555
|
return { node: arrayNode };
|
|
556
556
|
}
|
|
557
557
|
};
|
|
@@ -564,7 +564,7 @@ var ObjectToArrayTransformer = class {
|
|
|
564
564
|
const { sourceNode } = ctx;
|
|
565
565
|
const itemsNode = sourceNode.cloneWithId(nanoid.nanoid());
|
|
566
566
|
itemsNode.setName("items");
|
|
567
|
-
const arrayNode =
|
|
567
|
+
const arrayNode = chunkX2KLCGJ6_cjs.createArrayNode(sourceNode.id(), sourceNode.name(), itemsNode);
|
|
568
568
|
return { node: arrayNode };
|
|
569
569
|
}
|
|
570
570
|
};
|
|
@@ -614,7 +614,7 @@ var RefTransformer = class {
|
|
|
614
614
|
return { node: newNode };
|
|
615
615
|
}
|
|
616
616
|
const metadata = this.extractMetadata(targetSpec);
|
|
617
|
-
const node =
|
|
617
|
+
const node = chunkX2KLCGJ6_cjs.createRefNode(sourceNode.id(), sourceNode.name(), refUri, metadata);
|
|
618
618
|
return { node };
|
|
619
619
|
}
|
|
620
620
|
extractMetadata(spec) {
|
|
@@ -649,23 +649,23 @@ var DefaultTransformer = class {
|
|
|
649
649
|
createNode(id, name, type, spec, metadata) {
|
|
650
650
|
switch (type) {
|
|
651
651
|
case "string":
|
|
652
|
-
return
|
|
652
|
+
return chunkX2KLCGJ6_cjs.createStringNode(id, name, {
|
|
653
653
|
defaultValue: spec.default ?? "",
|
|
654
654
|
foreignKey: spec.foreignKey,
|
|
655
655
|
metadata
|
|
656
656
|
});
|
|
657
657
|
case "number":
|
|
658
|
-
return
|
|
658
|
+
return chunkX2KLCGJ6_cjs.createNumberNode(id, name, {
|
|
659
659
|
defaultValue: spec.default ?? 0,
|
|
660
660
|
metadata
|
|
661
661
|
});
|
|
662
662
|
case "boolean":
|
|
663
|
-
return
|
|
663
|
+
return chunkX2KLCGJ6_cjs.createBooleanNode(id, name, {
|
|
664
664
|
defaultValue: spec.default ?? false,
|
|
665
665
|
metadata
|
|
666
666
|
});
|
|
667
667
|
case "object":
|
|
668
|
-
return
|
|
668
|
+
return chunkX2KLCGJ6_cjs.createObjectNode(id, name, [], { metadata });
|
|
669
669
|
case "array":
|
|
670
670
|
return this.createArrayNode(id, name, metadata);
|
|
671
671
|
default:
|
|
@@ -673,8 +673,8 @@ var DefaultTransformer = class {
|
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
675
|
createArrayNode(id, name, metadata) {
|
|
676
|
-
const items =
|
|
677
|
-
return
|
|
676
|
+
const items = chunkX2KLCGJ6_cjs.createStringNode(nanoid.nanoid(), "items", { defaultValue: "" });
|
|
677
|
+
return chunkX2KLCGJ6_cjs.createArrayNode(id, name, items, { metadata });
|
|
678
678
|
}
|
|
679
679
|
extractMetadata(spec) {
|
|
680
680
|
const meta = {};
|
|
@@ -738,8 +738,8 @@ function createTypeTransformChain(options) {
|
|
|
738
738
|
var SchemaModelImpl = class {
|
|
739
739
|
_baseTree;
|
|
740
740
|
_currentTree;
|
|
741
|
-
_patchBuilder = new
|
|
742
|
-
_serializer = new
|
|
741
|
+
_patchBuilder = new chunkX2KLCGJ6_cjs.PatchBuilder();
|
|
742
|
+
_serializer = new chunkX2KLCGJ6_cjs.SchemaSerializer();
|
|
743
743
|
_nodeFactory = new NodeFactory();
|
|
744
744
|
_formulaIndex = new FormulaDependencyIndex();
|
|
745
745
|
_transformChain;
|
|
@@ -753,12 +753,12 @@ var SchemaModelImpl = class {
|
|
|
753
753
|
});
|
|
754
754
|
const parser = new SchemaParser();
|
|
755
755
|
const rootNode = parser.parse(schema, this._refSchemas);
|
|
756
|
-
this._currentTree =
|
|
756
|
+
this._currentTree = chunkX2KLCGJ6_cjs.createSchemaTree(rootNode);
|
|
757
757
|
parser.parseFormulas(this._currentTree);
|
|
758
758
|
this._formulaParseErrors = parser.parseErrors;
|
|
759
759
|
this._buildFormulaIndex();
|
|
760
760
|
this._baseTree = this._currentTree.clone();
|
|
761
|
-
|
|
761
|
+
chunkX2KLCGJ6_cjs.makeAutoObservable(this, {
|
|
762
762
|
_patchBuilder: false,
|
|
763
763
|
_serializer: false,
|
|
764
764
|
_nodeFactory: false,
|
|
@@ -787,10 +787,10 @@ var SchemaModelImpl = class {
|
|
|
787
787
|
insertFieldAt(parentId, index, name, type) {
|
|
788
788
|
const parent = this._currentTree.nodeById(parentId);
|
|
789
789
|
if (parent.isNull() || !parent.isObject()) {
|
|
790
|
-
return
|
|
790
|
+
return chunkX2KLCGJ6_cjs.NULL_NODE;
|
|
791
791
|
}
|
|
792
792
|
if (index < 0 || index > parent.properties().length) {
|
|
793
|
-
return
|
|
793
|
+
return chunkX2KLCGJ6_cjs.NULL_NODE;
|
|
794
794
|
}
|
|
795
795
|
const node = this._nodeFactory.createNode(name, type);
|
|
796
796
|
this._currentTree.insertChildAt(parentId, index, node);
|
|
@@ -1015,7 +1015,7 @@ var SchemaModelImpl = class {
|
|
|
1015
1015
|
return "";
|
|
1016
1016
|
}
|
|
1017
1017
|
try {
|
|
1018
|
-
return
|
|
1018
|
+
return chunkX2KLCGJ6_cjs.FormulaSerializer.serializeExpression(
|
|
1019
1019
|
this._currentTree,
|
|
1020
1020
|
nodeId,
|
|
1021
1021
|
formula,
|
|
@@ -1026,10 +1026,10 @@ var SchemaModelImpl = class {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
1028
|
get validationErrors() {
|
|
1029
|
-
return
|
|
1029
|
+
return chunkX2KLCGJ6_cjs.validateSchema(this._currentTree.root());
|
|
1030
1030
|
}
|
|
1031
1031
|
get formulaErrors() {
|
|
1032
|
-
return [...this._formulaParseErrors, ...
|
|
1032
|
+
return [...this._formulaParseErrors, ...chunkX2KLCGJ6_cjs.validateFormulas(this._currentTree)];
|
|
1033
1033
|
}
|
|
1034
1034
|
get isDirty() {
|
|
1035
1035
|
return this.patches.length > 0;
|
|
@@ -1085,7 +1085,7 @@ var RowModelImpl = class {
|
|
|
1085
1085
|
constructor(_rowId, _tree) {
|
|
1086
1086
|
this._rowId = _rowId;
|
|
1087
1087
|
this._tree = _tree;
|
|
1088
|
-
|
|
1088
|
+
chunkX2KLCGJ6_cjs.makeAutoObservable(this, {
|
|
1089
1089
|
_rowId: false,
|
|
1090
1090
|
_tree: false,
|
|
1091
1091
|
_tableModel: "observable.ref"
|
|
@@ -1237,7 +1237,7 @@ var ArrayValueNode = class extends BaseValueNode {
|
|
|
1237
1237
|
_nodeFactory = null;
|
|
1238
1238
|
constructor(id, name, schema, items) {
|
|
1239
1239
|
super(id, name, schema);
|
|
1240
|
-
this._items =
|
|
1240
|
+
this._items = chunkX2KLCGJ6_cjs.observable.array();
|
|
1241
1241
|
this._baseItems = [];
|
|
1242
1242
|
if (items) {
|
|
1243
1243
|
for (const item of items) {
|
|
@@ -1246,7 +1246,7 @@ var ArrayValueNode = class extends BaseValueNode {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
}
|
|
1248
1248
|
this._baseItems = [...this._items];
|
|
1249
|
-
|
|
1249
|
+
chunkX2KLCGJ6_cjs.makeObservable(this, {
|
|
1250
1250
|
_items: "observable",
|
|
1251
1251
|
_baseItems: "observable",
|
|
1252
1252
|
value: "computed",
|
|
@@ -1401,7 +1401,7 @@ var ArrayValueNode = class extends BaseValueNode {
|
|
|
1401
1401
|
for (const item of this._items) {
|
|
1402
1402
|
item.parent = null;
|
|
1403
1403
|
}
|
|
1404
|
-
this._items =
|
|
1404
|
+
this._items = chunkX2KLCGJ6_cjs.observable.array();
|
|
1405
1405
|
for (const baseItem of this._baseItems) {
|
|
1406
1406
|
this._items.push(baseItem);
|
|
1407
1407
|
}
|
|
@@ -1444,7 +1444,7 @@ var BasePrimitiveValueNode = class extends BaseValueNode {
|
|
|
1444
1444
|
this._baseValue = initialValue;
|
|
1445
1445
|
}
|
|
1446
1446
|
initObservable() {
|
|
1447
|
-
|
|
1447
|
+
chunkX2KLCGJ6_cjs.makeObservable(this, {
|
|
1448
1448
|
_value: "observable",
|
|
1449
1449
|
_baseValue: "observable",
|
|
1450
1450
|
_formulaWarning: "observable",
|
|
@@ -1792,7 +1792,7 @@ var ObjectValueNode = class extends BaseValueNode {
|
|
|
1792
1792
|
_baseChildren;
|
|
1793
1793
|
constructor(id, name, schema, children) {
|
|
1794
1794
|
super(id, name, schema);
|
|
1795
|
-
this._children =
|
|
1795
|
+
this._children = chunkX2KLCGJ6_cjs.observable.map();
|
|
1796
1796
|
this._baseChildren = /* @__PURE__ */ new Map();
|
|
1797
1797
|
if (children) {
|
|
1798
1798
|
for (const child of children) {
|
|
@@ -1801,7 +1801,7 @@ var ObjectValueNode = class extends BaseValueNode {
|
|
|
1801
1801
|
}
|
|
1802
1802
|
}
|
|
1803
1803
|
this._baseChildren = new Map(this._children);
|
|
1804
|
-
|
|
1804
|
+
chunkX2KLCGJ6_cjs.makeObservable(this, {
|
|
1805
1805
|
_children: "observable",
|
|
1806
1806
|
_baseChildren: "observable",
|
|
1807
1807
|
value: "computed",
|
|
@@ -1877,7 +1877,7 @@ var ObjectValueNode = class extends BaseValueNode {
|
|
|
1877
1877
|
for (const child of this._children.values()) {
|
|
1878
1878
|
child.parent = null;
|
|
1879
1879
|
}
|
|
1880
|
-
this._children =
|
|
1880
|
+
this._children = chunkX2KLCGJ6_cjs.observable.map();
|
|
1881
1881
|
for (const [key, value] of this._baseChildren) {
|
|
1882
1882
|
this._children.set(key, value);
|
|
1883
1883
|
}
|
|
@@ -2091,7 +2091,7 @@ var IndexSegment = class {
|
|
|
2091
2091
|
};
|
|
2092
2092
|
|
|
2093
2093
|
// src/core/value-path/ValuePath.ts
|
|
2094
|
-
var ValuePathImpl = class _ValuePathImpl extends
|
|
2094
|
+
var ValuePathImpl = class _ValuePathImpl extends chunkX2KLCGJ6_cjs.AbstractBasePath {
|
|
2095
2095
|
asString() {
|
|
2096
2096
|
const parts = [];
|
|
2097
2097
|
for (const seg of this.segs) {
|
|
@@ -2179,7 +2179,7 @@ function parseValuePath(path) {
|
|
|
2179
2179
|
var ValueTree = class {
|
|
2180
2180
|
constructor(_root) {
|
|
2181
2181
|
this._root = _root;
|
|
2182
|
-
|
|
2182
|
+
chunkX2KLCGJ6_cjs.makeAutoObservable(this, {
|
|
2183
2183
|
_root: false
|
|
2184
2184
|
});
|
|
2185
2185
|
}
|
|
@@ -2269,13 +2269,13 @@ var TableModelImpl = class {
|
|
|
2269
2269
|
this._schema = createSchemaModel(options.schema, { refSchemas: options.refSchemas });
|
|
2270
2270
|
this._fkResolver = options.fkResolver;
|
|
2271
2271
|
this._refSchemas = options.refSchemas;
|
|
2272
|
-
this._rows =
|
|
2272
|
+
this._rows = chunkX2KLCGJ6_cjs.observable.array();
|
|
2273
2273
|
if (options.rows) {
|
|
2274
2274
|
for (const row of options.rows) {
|
|
2275
2275
|
this._rows.push(this.createRowModel(row.rowId, row.data));
|
|
2276
2276
|
}
|
|
2277
2277
|
}
|
|
2278
|
-
|
|
2278
|
+
chunkX2KLCGJ6_cjs.makeAutoObservable(this, {
|
|
2279
2279
|
_schema: false,
|
|
2280
2280
|
_rows: false,
|
|
2281
2281
|
_jsonSchema: false,
|
|
@@ -2396,13 +2396,13 @@ var ForeignKeyResolverImpl = class {
|
|
|
2396
2396
|
constructor(options) {
|
|
2397
2397
|
this.loader = options?.loader;
|
|
2398
2398
|
this._prefetchEnabled = options?.prefetch ?? false;
|
|
2399
|
-
this._schemaCache =
|
|
2400
|
-
this._tableCache =
|
|
2399
|
+
this._schemaCache = chunkX2KLCGJ6_cjs.observable.map();
|
|
2400
|
+
this._tableCache = chunkX2KLCGJ6_cjs.observable.map();
|
|
2401
2401
|
this._loadingTables = /* @__PURE__ */ new Set();
|
|
2402
2402
|
this._loadingRows = /* @__PURE__ */ new Map();
|
|
2403
2403
|
this._pendingTableLoads = /* @__PURE__ */ new Map();
|
|
2404
2404
|
this._pendingRowLoads = /* @__PURE__ */ new Map();
|
|
2405
|
-
|
|
2405
|
+
chunkX2KLCGJ6_cjs.makeAutoObservable(this, {
|
|
2406
2406
|
_schemaCache: false,
|
|
2407
2407
|
_tableCache: false,
|
|
2408
2408
|
_loadingTables: false,
|
|
@@ -2440,7 +2440,7 @@ var ForeignKeyResolverImpl = class {
|
|
|
2440
2440
|
if (this._disposed) {
|
|
2441
2441
|
return;
|
|
2442
2442
|
}
|
|
2443
|
-
|
|
2443
|
+
chunkX2KLCGJ6_cjs.runInAction(() => {
|
|
2444
2444
|
this._schemaCache.set(tableId, schema);
|
|
2445
2445
|
});
|
|
2446
2446
|
}
|
|
@@ -2448,12 +2448,12 @@ var ForeignKeyResolverImpl = class {
|
|
|
2448
2448
|
if (this._disposed) {
|
|
2449
2449
|
return;
|
|
2450
2450
|
}
|
|
2451
|
-
const rowMap =
|
|
2451
|
+
const rowMap = chunkX2KLCGJ6_cjs.observable.map();
|
|
2452
2452
|
for (const row of rows) {
|
|
2453
2453
|
rowMap.set(row.rowId, row);
|
|
2454
2454
|
}
|
|
2455
2455
|
const cache = { schema, rows: rowMap };
|
|
2456
|
-
|
|
2456
|
+
chunkX2KLCGJ6_cjs.runInAction(() => {
|
|
2457
2457
|
this._tableCache.set(tableId, cache);
|
|
2458
2458
|
this._schemaCache.set(tableId, schema);
|
|
2459
2459
|
});
|
|
@@ -2468,7 +2468,7 @@ var ForeignKeyResolverImpl = class {
|
|
|
2468
2468
|
const table = this._tableCache.get(tableId);
|
|
2469
2469
|
if (table) {
|
|
2470
2470
|
const rowData = { rowId, data };
|
|
2471
|
-
|
|
2471
|
+
chunkX2KLCGJ6_cjs.runInAction(() => {
|
|
2472
2472
|
table.rows.set(rowId, rowData);
|
|
2473
2473
|
});
|
|
2474
2474
|
if (this._prefetchEnabled) {
|
|
@@ -2482,7 +2482,7 @@ var ForeignKeyResolverImpl = class {
|
|
|
2482
2482
|
}
|
|
2483
2483
|
const schema = this._schemaCache.get(oldTableId);
|
|
2484
2484
|
const tableCache = this._tableCache.get(oldTableId);
|
|
2485
|
-
|
|
2485
|
+
chunkX2KLCGJ6_cjs.runInAction(() => {
|
|
2486
2486
|
if (schema) {
|
|
2487
2487
|
this._schemaCache.delete(oldTableId);
|
|
2488
2488
|
this._schemaCache.set(newTableId, schema);
|
|
@@ -2584,9 +2584,9 @@ var ForeignKeyResolverImpl = class {
|
|
|
2584
2584
|
}
|
|
2585
2585
|
ensureTableCache(tableId, schema) {
|
|
2586
2586
|
if (!this._tableCache.has(tableId)) {
|
|
2587
|
-
const rowMap =
|
|
2587
|
+
const rowMap = chunkX2KLCGJ6_cjs.observable.map();
|
|
2588
2588
|
const cache = { schema, rows: rowMap };
|
|
2589
|
-
|
|
2589
|
+
chunkX2KLCGJ6_cjs.runInAction(() => {
|
|
2590
2590
|
this._tableCache.set(tableId, cache);
|
|
2591
2591
|
});
|
|
2592
2592
|
}
|
|
@@ -2686,7 +2686,7 @@ var DataModelImpl = class {
|
|
|
2686
2686
|
_fk;
|
|
2687
2687
|
_ownsFkResolver;
|
|
2688
2688
|
constructor(options) {
|
|
2689
|
-
this._tables =
|
|
2689
|
+
this._tables = chunkX2KLCGJ6_cjs.observable.map();
|
|
2690
2690
|
if (options?.fkResolver) {
|
|
2691
2691
|
this._fk = options.fkResolver;
|
|
2692
2692
|
this._ownsFkResolver = false;
|
|
@@ -2694,7 +2694,7 @@ var DataModelImpl = class {
|
|
|
2694
2694
|
this._fk = createForeignKeyResolver();
|
|
2695
2695
|
this._ownsFkResolver = true;
|
|
2696
2696
|
}
|
|
2697
|
-
|
|
2697
|
+
chunkX2KLCGJ6_cjs.makeAutoObservable(this, {
|
|
2698
2698
|
_tables: false,
|
|
2699
2699
|
_fk: false,
|
|
2700
2700
|
_ownsFkResolver: false
|
|
@@ -2815,5 +2815,5 @@ exports.generateDefaultValue = generateDefaultValue;
|
|
|
2815
2815
|
exports.generateNodeId = generateNodeId;
|
|
2816
2816
|
exports.isForeignKeyValueNode = isForeignKeyValueNode;
|
|
2817
2817
|
exports.resetNodeIdCounter = resetNodeIdCounter;
|
|
2818
|
-
//# sourceMappingURL=chunk-
|
|
2819
|
-
//# sourceMappingURL=chunk-
|
|
2818
|
+
//# sourceMappingURL=chunk-CN74KAMA.cjs.map
|
|
2819
|
+
//# sourceMappingURL=chunk-CN74KAMA.cjs.map
|