@revisium/schema-toolkit 0.16.2 → 0.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-OY5NX5DZ.cjs → chunk-MAEGAVK4.cjs} +74 -58
- package/dist/chunk-MAEGAVK4.cjs.map +1 -0
- package/dist/{chunk-KLDN3IHB.js → chunk-PGR2S2BR.js} +5 -2
- package/dist/chunk-PGR2S2BR.js.map +1 -0
- package/dist/{chunk-44ZEZUWU.cjs → chunk-VGB4YCGF.cjs} +5 -2
- package/dist/chunk-VGB4YCGF.cjs.map +1 -0
- package/dist/{chunk-VQZNN335.js → chunk-YCJJVI3Z.js} +27 -11
- package/dist/chunk-YCJJVI3Z.js.map +1 -0
- package/dist/core/index.cjs +57 -57
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +95 -95
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/model/index.cjs +39 -39
- package/dist/model/index.d.cts +11 -2
- package/dist/model/index.d.ts +11 -2
- package/dist/model/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-44ZEZUWU.cjs.map +0 -1
- package/dist/chunk-KLDN3IHB.js.map +0 -1
- package/dist/chunk-OY5NX5DZ.cjs.map +0 -1
- package/dist/chunk-VQZNN335.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkVGB4YCGF_cjs = require('./chunk-VGB4YCGF.cjs');
|
|
4
4
|
var nanoid = require('nanoid');
|
|
5
5
|
|
|
6
6
|
var SchemaParser = class {
|
|
@@ -18,7 +18,7 @@ var SchemaParser = class {
|
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
20
|
try {
|
|
21
|
-
const formula = new
|
|
21
|
+
const formula = new chunkVGB4YCGF_cjs.ParsedFormula(tree, pending.nodeId, pending.expression);
|
|
22
22
|
node.setFormula(formula);
|
|
23
23
|
} catch (error) {
|
|
24
24
|
this._parseErrors.push({
|
|
@@ -34,7 +34,7 @@ var SchemaParser = class {
|
|
|
34
34
|
}
|
|
35
35
|
parseNode(schema, name) {
|
|
36
36
|
if ("$ref" in schema) {
|
|
37
|
-
return
|
|
37
|
+
return chunkVGB4YCGF_cjs.createRefNode(nanoid.nanoid(), name, schema.$ref, this.extractMetadata(schema));
|
|
38
38
|
}
|
|
39
39
|
const schemaWithType = schema;
|
|
40
40
|
switch (schemaWithType.type) {
|
|
@@ -60,16 +60,16 @@ var SchemaParser = class {
|
|
|
60
60
|
children.push(this.parseNode(propSchema, propName));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
return
|
|
63
|
+
return chunkVGB4YCGF_cjs.createObjectNode(nanoid.nanoid(), name, children, this.extractMetadata(schema));
|
|
64
64
|
}
|
|
65
65
|
parseArray(schema, name) {
|
|
66
66
|
const items = this.parseNode(schema.items, "items");
|
|
67
|
-
return
|
|
67
|
+
return chunkVGB4YCGF_cjs.createArrayNode(nanoid.nanoid(), name, items, this.extractMetadata(schema));
|
|
68
68
|
}
|
|
69
69
|
parseString(schema, name) {
|
|
70
70
|
const nodeId = nanoid.nanoid();
|
|
71
71
|
this.collectFormula(nodeId, schema["x-formula"]);
|
|
72
|
-
return
|
|
72
|
+
return chunkVGB4YCGF_cjs.createStringNode(nodeId, name, {
|
|
73
73
|
defaultValue: schema.default,
|
|
74
74
|
foreignKey: schema.foreignKey,
|
|
75
75
|
metadata: this.extractMetadata(schema)
|
|
@@ -78,7 +78,7 @@ var SchemaParser = class {
|
|
|
78
78
|
parseNumber(schema, name) {
|
|
79
79
|
const nodeId = nanoid.nanoid();
|
|
80
80
|
this.collectFormula(nodeId, schema["x-formula"]);
|
|
81
|
-
return
|
|
81
|
+
return chunkVGB4YCGF_cjs.createNumberNode(nodeId, name, {
|
|
82
82
|
defaultValue: schema.default,
|
|
83
83
|
metadata: this.extractMetadata(schema)
|
|
84
84
|
});
|
|
@@ -86,7 +86,7 @@ var SchemaParser = class {
|
|
|
86
86
|
parseBoolean(schema, name) {
|
|
87
87
|
const nodeId = nanoid.nanoid();
|
|
88
88
|
this.collectFormula(nodeId, schema["x-formula"]);
|
|
89
|
-
return
|
|
89
|
+
return chunkVGB4YCGF_cjs.createBooleanNode(nodeId, name, {
|
|
90
90
|
defaultValue: schema.default,
|
|
91
91
|
metadata: this.extractMetadata(schema)
|
|
92
92
|
});
|
|
@@ -118,13 +118,13 @@ var NodeFactory = class {
|
|
|
118
118
|
createNode(name, type) {
|
|
119
119
|
switch (type) {
|
|
120
120
|
case "string":
|
|
121
|
-
return
|
|
121
|
+
return chunkVGB4YCGF_cjs.createStringNode(nanoid.nanoid(), name, { defaultValue: "" });
|
|
122
122
|
case "number":
|
|
123
|
-
return
|
|
123
|
+
return chunkVGB4YCGF_cjs.createNumberNode(nanoid.nanoid(), name, { defaultValue: 0 });
|
|
124
124
|
case "boolean":
|
|
125
|
-
return
|
|
125
|
+
return chunkVGB4YCGF_cjs.createBooleanNode(nanoid.nanoid(), name, { defaultValue: false });
|
|
126
126
|
case "object":
|
|
127
|
-
return
|
|
127
|
+
return chunkVGB4YCGF_cjs.createObjectNode(nanoid.nanoid(), name, []);
|
|
128
128
|
case "array":
|
|
129
129
|
return this.createArrayNodeInternal(name);
|
|
130
130
|
default:
|
|
@@ -132,11 +132,11 @@ var NodeFactory = class {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
createArrayNodeInternal(name) {
|
|
135
|
-
const items =
|
|
136
|
-
return
|
|
135
|
+
const items = chunkVGB4YCGF_cjs.createStringNode(nanoid.nanoid(), "items", { defaultValue: "" });
|
|
136
|
+
return chunkVGB4YCGF_cjs.createArrayNode(nanoid.nanoid(), name, items);
|
|
137
137
|
}
|
|
138
138
|
createArrayNodeWithItems(name, items) {
|
|
139
|
-
return
|
|
139
|
+
return chunkVGB4YCGF_cjs.createArrayNode(nanoid.nanoid(), name, items);
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
|
|
@@ -231,24 +231,27 @@ function generateDefaultValue(schema, options = {}) {
|
|
|
231
231
|
var SchemaModelImpl = class {
|
|
232
232
|
_baseTree;
|
|
233
233
|
_currentTree;
|
|
234
|
-
_patchBuilder = new
|
|
235
|
-
_serializer = new
|
|
234
|
+
_patchBuilder = new chunkVGB4YCGF_cjs.PatchBuilder();
|
|
235
|
+
_serializer = new chunkVGB4YCGF_cjs.SchemaSerializer();
|
|
236
236
|
_nodeFactory = new NodeFactory();
|
|
237
|
-
_formulaIndex = new
|
|
237
|
+
_formulaIndex = new chunkVGB4YCGF_cjs.FormulaDependencyIndex();
|
|
238
238
|
_formulaParseErrors = [];
|
|
239
|
-
|
|
239
|
+
_refSchemas;
|
|
240
|
+
constructor(schema, options) {
|
|
240
241
|
const parser = new SchemaParser();
|
|
241
242
|
const rootNode = parser.parse(schema);
|
|
242
|
-
this._currentTree =
|
|
243
|
+
this._currentTree = chunkVGB4YCGF_cjs.createSchemaTree(rootNode);
|
|
243
244
|
parser.parseFormulas(this._currentTree);
|
|
244
245
|
this._formulaParseErrors = parser.parseErrors;
|
|
245
246
|
this._buildFormulaIndex();
|
|
246
247
|
this._baseTree = this._currentTree.clone();
|
|
247
|
-
|
|
248
|
+
this._refSchemas = options?.refSchemas;
|
|
249
|
+
chunkVGB4YCGF_cjs.makeAutoObservable(this, {
|
|
248
250
|
_patchBuilder: false,
|
|
249
251
|
_serializer: false,
|
|
250
252
|
_nodeFactory: false,
|
|
251
253
|
_formulaIndex: false,
|
|
254
|
+
_refSchemas: false,
|
|
252
255
|
_currentTree: "observable.ref",
|
|
253
256
|
_baseTree: "observable.ref",
|
|
254
257
|
_formulaParseErrors: "observable.ref"
|
|
@@ -319,7 +322,7 @@ var SchemaModelImpl = class {
|
|
|
319
322
|
this._formulaIndex.unregisterFormula(nodeId);
|
|
320
323
|
} else {
|
|
321
324
|
try {
|
|
322
|
-
const formula = new
|
|
325
|
+
const formula = new chunkVGB4YCGF_cjs.ParsedFormula(this._currentTree, nodeId, expression);
|
|
323
326
|
node.setFormula(formula);
|
|
324
327
|
this._formulaIndex.registerFormula(nodeId, formula);
|
|
325
328
|
} catch (error) {
|
|
@@ -487,7 +490,7 @@ var SchemaModelImpl = class {
|
|
|
487
490
|
if (!formula) {
|
|
488
491
|
return "";
|
|
489
492
|
}
|
|
490
|
-
return
|
|
493
|
+
return chunkVGB4YCGF_cjs.FormulaSerializer.serializeExpression(
|
|
491
494
|
this._currentTree,
|
|
492
495
|
nodeId,
|
|
493
496
|
formula,
|
|
@@ -495,10 +498,10 @@ var SchemaModelImpl = class {
|
|
|
495
498
|
);
|
|
496
499
|
}
|
|
497
500
|
get validationErrors() {
|
|
498
|
-
return
|
|
501
|
+
return chunkVGB4YCGF_cjs.validateSchema(this._currentTree.root());
|
|
499
502
|
}
|
|
500
503
|
get formulaErrors() {
|
|
501
|
-
return [...this._formulaParseErrors, ...
|
|
504
|
+
return [...this._formulaParseErrors, ...chunkVGB4YCGF_cjs.validateFormulas(this._currentTree)];
|
|
502
505
|
}
|
|
503
506
|
get isDirty() {
|
|
504
507
|
return this.patches.length > 0;
|
|
@@ -524,8 +527,14 @@ var SchemaModelImpl = class {
|
|
|
524
527
|
get nodeCount() {
|
|
525
528
|
return this._currentTree.countNodes();
|
|
526
529
|
}
|
|
530
|
+
get refSchemas() {
|
|
531
|
+
return this._refSchemas;
|
|
532
|
+
}
|
|
527
533
|
generateDefaultValue(options) {
|
|
528
|
-
return generateDefaultValue(this.plainSchema,
|
|
534
|
+
return generateDefaultValue(this.plainSchema, {
|
|
535
|
+
...options,
|
|
536
|
+
refSchemas: this._refSchemas
|
|
537
|
+
});
|
|
529
538
|
}
|
|
530
539
|
_buildFormulaIndex() {
|
|
531
540
|
this._formulaIndex.clear();
|
|
@@ -538,8 +547,8 @@ var SchemaModelImpl = class {
|
|
|
538
547
|
}
|
|
539
548
|
}
|
|
540
549
|
};
|
|
541
|
-
function createSchemaModel(schema) {
|
|
542
|
-
return new SchemaModelImpl(schema);
|
|
550
|
+
function createSchemaModel(schema, options) {
|
|
551
|
+
return new SchemaModelImpl(schema, options);
|
|
543
552
|
}
|
|
544
553
|
|
|
545
554
|
// src/model/table/row/RowModelImpl.ts
|
|
@@ -548,7 +557,7 @@ var RowModelImpl = class {
|
|
|
548
557
|
constructor(_rowId, _tree) {
|
|
549
558
|
this._rowId = _rowId;
|
|
550
559
|
this._tree = _tree;
|
|
551
|
-
|
|
560
|
+
chunkVGB4YCGF_cjs.makeAutoObservable(this, {
|
|
552
561
|
_rowId: false,
|
|
553
562
|
_tree: false,
|
|
554
563
|
_tableModel: "observable.ref"
|
|
@@ -700,7 +709,7 @@ var ArrayValueNode = class extends BaseValueNode {
|
|
|
700
709
|
_nodeFactory = null;
|
|
701
710
|
constructor(id, name, schema, items) {
|
|
702
711
|
super(id, name, schema);
|
|
703
|
-
this._items =
|
|
712
|
+
this._items = chunkVGB4YCGF_cjs.observable.array();
|
|
704
713
|
this._baseItems = [];
|
|
705
714
|
if (items) {
|
|
706
715
|
for (const item of items) {
|
|
@@ -709,7 +718,7 @@ var ArrayValueNode = class extends BaseValueNode {
|
|
|
709
718
|
}
|
|
710
719
|
}
|
|
711
720
|
this._baseItems = [...this._items];
|
|
712
|
-
|
|
721
|
+
chunkVGB4YCGF_cjs.makeObservable(this, {
|
|
713
722
|
_items: "observable",
|
|
714
723
|
_baseItems: "observable",
|
|
715
724
|
value: "computed",
|
|
@@ -864,7 +873,7 @@ var ArrayValueNode = class extends BaseValueNode {
|
|
|
864
873
|
for (const item of this._items) {
|
|
865
874
|
item.parent = null;
|
|
866
875
|
}
|
|
867
|
-
this._items =
|
|
876
|
+
this._items = chunkVGB4YCGF_cjs.observable.array();
|
|
868
877
|
for (const baseItem of this._baseItems) {
|
|
869
878
|
this._items.push(baseItem);
|
|
870
879
|
}
|
|
@@ -907,7 +916,7 @@ var BasePrimitiveValueNode = class extends BaseValueNode {
|
|
|
907
916
|
this._baseValue = initialValue;
|
|
908
917
|
}
|
|
909
918
|
initObservable() {
|
|
910
|
-
|
|
919
|
+
chunkVGB4YCGF_cjs.makeObservable(this, {
|
|
911
920
|
_value: "observable",
|
|
912
921
|
_baseValue: "observable",
|
|
913
922
|
_formulaWarning: "observable",
|
|
@@ -1255,7 +1264,7 @@ var ObjectValueNode = class extends BaseValueNode {
|
|
|
1255
1264
|
_baseChildren;
|
|
1256
1265
|
constructor(id, name, schema, children) {
|
|
1257
1266
|
super(id, name, schema);
|
|
1258
|
-
this._children =
|
|
1267
|
+
this._children = chunkVGB4YCGF_cjs.observable.map();
|
|
1259
1268
|
this._baseChildren = /* @__PURE__ */ new Map();
|
|
1260
1269
|
if (children) {
|
|
1261
1270
|
for (const child of children) {
|
|
@@ -1264,7 +1273,7 @@ var ObjectValueNode = class extends BaseValueNode {
|
|
|
1264
1273
|
}
|
|
1265
1274
|
}
|
|
1266
1275
|
this._baseChildren = new Map(this._children);
|
|
1267
|
-
|
|
1276
|
+
chunkVGB4YCGF_cjs.makeObservable(this, {
|
|
1268
1277
|
_children: "observable",
|
|
1269
1278
|
_baseChildren: "observable",
|
|
1270
1279
|
value: "computed",
|
|
@@ -1340,7 +1349,7 @@ var ObjectValueNode = class extends BaseValueNode {
|
|
|
1340
1349
|
for (const child of this._children.values()) {
|
|
1341
1350
|
child.parent = null;
|
|
1342
1351
|
}
|
|
1343
|
-
this._children =
|
|
1352
|
+
this._children = chunkVGB4YCGF_cjs.observable.map();
|
|
1344
1353
|
for (const [key, value] of this._baseChildren) {
|
|
1345
1354
|
this._children.set(key, value);
|
|
1346
1355
|
}
|
|
@@ -1554,7 +1563,7 @@ var IndexSegment = class {
|
|
|
1554
1563
|
};
|
|
1555
1564
|
|
|
1556
1565
|
// src/core/value-path/ValuePath.ts
|
|
1557
|
-
var ValuePathImpl = class _ValuePathImpl extends
|
|
1566
|
+
var ValuePathImpl = class _ValuePathImpl extends chunkVGB4YCGF_cjs.AbstractBasePath {
|
|
1558
1567
|
asString() {
|
|
1559
1568
|
const parts = [];
|
|
1560
1569
|
for (const seg of this.segs) {
|
|
@@ -1642,7 +1651,7 @@ function parseValuePath(path) {
|
|
|
1642
1651
|
var ValueTree = class {
|
|
1643
1652
|
constructor(_root) {
|
|
1644
1653
|
this._root = _root;
|
|
1645
|
-
|
|
1654
|
+
chunkVGB4YCGF_cjs.makeAutoObservable(this, {
|
|
1646
1655
|
_root: false
|
|
1647
1656
|
});
|
|
1648
1657
|
}
|
|
@@ -1724,23 +1733,26 @@ var TableModelImpl = class {
|
|
|
1724
1733
|
_rows;
|
|
1725
1734
|
_jsonSchema;
|
|
1726
1735
|
_fkResolver;
|
|
1736
|
+
_refSchemas;
|
|
1727
1737
|
constructor(options) {
|
|
1728
1738
|
this._tableId = options.tableId;
|
|
1729
1739
|
this._baseTableId = options.tableId;
|
|
1730
1740
|
this._jsonSchema = options.schema;
|
|
1731
|
-
this._schema = createSchemaModel(options.schema);
|
|
1741
|
+
this._schema = createSchemaModel(options.schema, { refSchemas: options.refSchemas });
|
|
1732
1742
|
this._fkResolver = options.fkResolver;
|
|
1733
|
-
this.
|
|
1743
|
+
this._refSchemas = options.refSchemas;
|
|
1744
|
+
this._rows = chunkVGB4YCGF_cjs.observable.array();
|
|
1734
1745
|
if (options.rows) {
|
|
1735
1746
|
for (const row of options.rows) {
|
|
1736
1747
|
this._rows.push(this.createRowModel(row.rowId, row.data));
|
|
1737
1748
|
}
|
|
1738
1749
|
}
|
|
1739
|
-
|
|
1750
|
+
chunkVGB4YCGF_cjs.makeAutoObservable(this, {
|
|
1740
1751
|
_schema: false,
|
|
1741
1752
|
_rows: false,
|
|
1742
1753
|
_jsonSchema: false,
|
|
1743
|
-
_fkResolver: false
|
|
1754
|
+
_fkResolver: false,
|
|
1755
|
+
_refSchemas: false
|
|
1744
1756
|
});
|
|
1745
1757
|
}
|
|
1746
1758
|
get tableId() {
|
|
@@ -1755,6 +1767,9 @@ var TableModelImpl = class {
|
|
|
1755
1767
|
get fk() {
|
|
1756
1768
|
return this._fkResolver;
|
|
1757
1769
|
}
|
|
1770
|
+
get refSchemas() {
|
|
1771
|
+
return this._refSchemas;
|
|
1772
|
+
}
|
|
1758
1773
|
get schema() {
|
|
1759
1774
|
return this._schema;
|
|
1760
1775
|
}
|
|
@@ -1824,9 +1839,10 @@ var TableModelImpl = class {
|
|
|
1824
1839
|
}
|
|
1825
1840
|
createRowModel(rowId, data) {
|
|
1826
1841
|
const factory = createNodeFactory({
|
|
1827
|
-
fkResolver: this._fkResolver
|
|
1842
|
+
fkResolver: this._fkResolver,
|
|
1843
|
+
refSchemas: this._refSchemas
|
|
1828
1844
|
});
|
|
1829
|
-
const rowData = data ?? generateDefaultValue(this._jsonSchema);
|
|
1845
|
+
const rowData = data ?? generateDefaultValue(this._jsonSchema, { refSchemas: this._refSchemas });
|
|
1830
1846
|
const rootNode = factory.createTree(this._jsonSchema, rowData);
|
|
1831
1847
|
const valueTree = new ValueTree(rootNode);
|
|
1832
1848
|
const rowModel = new RowModelImpl(rowId, valueTree);
|
|
@@ -1852,13 +1868,13 @@ var ForeignKeyResolverImpl = class {
|
|
|
1852
1868
|
constructor(options) {
|
|
1853
1869
|
this.loader = options?.loader;
|
|
1854
1870
|
this._prefetchEnabled = options?.prefetch ?? false;
|
|
1855
|
-
this._schemaCache =
|
|
1856
|
-
this._tableCache =
|
|
1871
|
+
this._schemaCache = chunkVGB4YCGF_cjs.observable.map();
|
|
1872
|
+
this._tableCache = chunkVGB4YCGF_cjs.observable.map();
|
|
1857
1873
|
this._loadingTables = /* @__PURE__ */ new Set();
|
|
1858
1874
|
this._loadingRows = /* @__PURE__ */ new Map();
|
|
1859
1875
|
this._pendingTableLoads = /* @__PURE__ */ new Map();
|
|
1860
1876
|
this._pendingRowLoads = /* @__PURE__ */ new Map();
|
|
1861
|
-
|
|
1877
|
+
chunkVGB4YCGF_cjs.makeAutoObservable(this, {
|
|
1862
1878
|
_schemaCache: false,
|
|
1863
1879
|
_tableCache: false,
|
|
1864
1880
|
_loadingTables: false,
|
|
@@ -1896,7 +1912,7 @@ var ForeignKeyResolverImpl = class {
|
|
|
1896
1912
|
if (this._disposed) {
|
|
1897
1913
|
return;
|
|
1898
1914
|
}
|
|
1899
|
-
|
|
1915
|
+
chunkVGB4YCGF_cjs.runInAction(() => {
|
|
1900
1916
|
this._schemaCache.set(tableId, schema);
|
|
1901
1917
|
});
|
|
1902
1918
|
}
|
|
@@ -1904,12 +1920,12 @@ var ForeignKeyResolverImpl = class {
|
|
|
1904
1920
|
if (this._disposed) {
|
|
1905
1921
|
return;
|
|
1906
1922
|
}
|
|
1907
|
-
const rowMap =
|
|
1923
|
+
const rowMap = chunkVGB4YCGF_cjs.observable.map();
|
|
1908
1924
|
for (const row of rows) {
|
|
1909
1925
|
rowMap.set(row.rowId, row);
|
|
1910
1926
|
}
|
|
1911
1927
|
const cache = { schema, rows: rowMap };
|
|
1912
|
-
|
|
1928
|
+
chunkVGB4YCGF_cjs.runInAction(() => {
|
|
1913
1929
|
this._tableCache.set(tableId, cache);
|
|
1914
1930
|
this._schemaCache.set(tableId, schema);
|
|
1915
1931
|
});
|
|
@@ -1924,7 +1940,7 @@ var ForeignKeyResolverImpl = class {
|
|
|
1924
1940
|
const table = this._tableCache.get(tableId);
|
|
1925
1941
|
if (table) {
|
|
1926
1942
|
const rowData = { rowId, data };
|
|
1927
|
-
|
|
1943
|
+
chunkVGB4YCGF_cjs.runInAction(() => {
|
|
1928
1944
|
table.rows.set(rowId, rowData);
|
|
1929
1945
|
});
|
|
1930
1946
|
if (this._prefetchEnabled) {
|
|
@@ -1938,7 +1954,7 @@ var ForeignKeyResolverImpl = class {
|
|
|
1938
1954
|
}
|
|
1939
1955
|
const schema = this._schemaCache.get(oldTableId);
|
|
1940
1956
|
const tableCache = this._tableCache.get(oldTableId);
|
|
1941
|
-
|
|
1957
|
+
chunkVGB4YCGF_cjs.runInAction(() => {
|
|
1942
1958
|
if (schema) {
|
|
1943
1959
|
this._schemaCache.delete(oldTableId);
|
|
1944
1960
|
this._schemaCache.set(newTableId, schema);
|
|
@@ -2040,9 +2056,9 @@ var ForeignKeyResolverImpl = class {
|
|
|
2040
2056
|
}
|
|
2041
2057
|
ensureTableCache(tableId, schema) {
|
|
2042
2058
|
if (!this._tableCache.has(tableId)) {
|
|
2043
|
-
const rowMap =
|
|
2059
|
+
const rowMap = chunkVGB4YCGF_cjs.observable.map();
|
|
2044
2060
|
const cache = { schema, rows: rowMap };
|
|
2045
|
-
|
|
2061
|
+
chunkVGB4YCGF_cjs.runInAction(() => {
|
|
2046
2062
|
this._tableCache.set(tableId, cache);
|
|
2047
2063
|
});
|
|
2048
2064
|
}
|
|
@@ -2142,7 +2158,7 @@ var DataModelImpl = class {
|
|
|
2142
2158
|
_fk;
|
|
2143
2159
|
_ownsFkResolver;
|
|
2144
2160
|
constructor(options) {
|
|
2145
|
-
this._tables =
|
|
2161
|
+
this._tables = chunkVGB4YCGF_cjs.observable.map();
|
|
2146
2162
|
if (options?.fkResolver) {
|
|
2147
2163
|
this._fk = options.fkResolver;
|
|
2148
2164
|
this._ownsFkResolver = false;
|
|
@@ -2150,7 +2166,7 @@ var DataModelImpl = class {
|
|
|
2150
2166
|
this._fk = createForeignKeyResolver();
|
|
2151
2167
|
this._ownsFkResolver = true;
|
|
2152
2168
|
}
|
|
2153
|
-
|
|
2169
|
+
chunkVGB4YCGF_cjs.makeAutoObservable(this, {
|
|
2154
2170
|
_tables: false,
|
|
2155
2171
|
_fk: false,
|
|
2156
2172
|
_ownsFkResolver: false
|
|
@@ -2260,5 +2276,5 @@ exports.generateDefaultValue = generateDefaultValue;
|
|
|
2260
2276
|
exports.generateNodeId = generateNodeId;
|
|
2261
2277
|
exports.isForeignKeyValueNode = isForeignKeyValueNode;
|
|
2262
2278
|
exports.resetNodeIdCounter = resetNodeIdCounter;
|
|
2263
|
-
//# sourceMappingURL=chunk-
|
|
2264
|
-
//# sourceMappingURL=chunk-
|
|
2279
|
+
//# sourceMappingURL=chunk-MAEGAVK4.cjs.map
|
|
2280
|
+
//# sourceMappingURL=chunk-MAEGAVK4.cjs.map
|