@revisium/schema-toolkit 0.16.1 → 0.16.2
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-IWRV6QAD.cjs → chunk-44ZEZUWU.cjs} +419 -86
- package/dist/chunk-44ZEZUWU.cjs.map +1 -0
- package/dist/{chunk-HY4VE7H2.js → chunk-55AMH44G.js} +3 -3
- package/dist/chunk-55AMH44G.js.map +1 -0
- package/dist/{chunk-TMWPWGUN.cjs → chunk-B3T6YB2D.cjs} +6 -6
- package/dist/chunk-B3T6YB2D.cjs.map +1 -0
- package/dist/{chunk-GAPLSVZN.cjs → chunk-J6SCHJKG.cjs} +2 -2
- package/dist/chunk-J6SCHJKG.cjs.map +1 -0
- package/dist/chunk-JJ2KGTZX.cjs +105 -0
- package/dist/chunk-JJ2KGTZX.cjs.map +1 -0
- package/dist/{chunk-S7GEDTSL.js → chunk-KLDN3IHB.js} +408 -88
- package/dist/chunk-KLDN3IHB.js.map +1 -0
- package/dist/chunk-MLNKM67U.cjs +4 -0
- package/dist/chunk-MLNKM67U.cjs.map +1 -0
- package/dist/{chunk-CYTPQYVM.js → chunk-MPF6VCB5.js} +2 -2
- package/dist/chunk-MPF6VCB5.js.map +1 -0
- package/dist/{chunk-KQWWRWGB.cjs → chunk-OY5NX5DZ.cjs} +216 -279
- package/dist/chunk-OY5NX5DZ.cjs.map +1 -0
- package/dist/{chunk-2NRQPOQY.js → chunk-QEV4Q4TR.js} +3 -3
- package/dist/{chunk-2NRQPOQY.js.map → chunk-QEV4Q4TR.js.map} +1 -1
- package/dist/{chunk-XS47N22X.cjs → chunk-V6JTSET2.cjs} +13 -13
- package/dist/{chunk-XS47N22X.cjs.map → chunk-V6JTSET2.cjs.map} +1 -1
- package/dist/{chunk-KTCH6INZ.js → chunk-VQZNN335.js} +200 -263
- package/dist/chunk-VQZNN335.js.map +1 -0
- package/dist/chunk-Y2GYABV7.js +3 -0
- package/dist/chunk-Y2GYABV7.js.map +1 -0
- package/dist/chunk-YGTMLR3D.js +88 -0
- package/dist/chunk-YGTMLR3D.js.map +1 -0
- package/dist/core/index.cjs +84 -70
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +69 -7
- package/dist/core/index.d.ts +69 -7
- package/dist/core/index.js +3 -24
- package/dist/core/index.js.map +1 -1
- package/dist/formula/index.d.cts +1 -1
- package/dist/formula/index.d.ts +1 -1
- package/dist/index.cjs +373 -112
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +7 -6
- package/dist/{json-patch.types-eltVqnWC.d.cts → json-patch.types-Cu0Medki.d.cts} +1 -1
- package/dist/{json-patch.types-DTUHS9SV.d.ts → json-patch.types-DY7k9hxy.d.ts} +1 -1
- package/dist/{json-string.store-DKlkc1u_.d.cts → json-string.store-DOZn38CI.d.cts} +2 -2
- package/dist/{json-string.store-DMrHPJ3v.d.ts → json-string.store-DRmQFKrp.d.ts} +2 -2
- package/dist/lib/index.cjs +40 -40
- package/dist/lib/index.d.cts +4 -4
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +3 -3
- package/dist/mocks/index.cjs +36 -12
- package/dist/mocks/index.d.cts +28 -9
- package/dist/mocks/index.d.ts +28 -9
- package/dist/mocks/index.js +2 -2
- package/dist/model/index.cjs +86 -58
- package/dist/model/index.d.cts +108 -40
- package/dist/model/index.d.ts +108 -40
- package/dist/model/index.js +4 -4
- package/dist/plugins/index.cjs +1 -1
- package/dist/plugins/index.d.cts +9 -9
- package/dist/plugins/index.d.ts +9 -9
- package/dist/plugins/index.js +1 -1
- package/dist/{schema.types-ZX5fUW1X.d.cts → schema.types-B5OgKLpV.d.cts} +3 -2
- package/dist/{schema.types-ZX5fUW1X.d.ts → schema.types-B5OgKLpV.d.ts} +3 -2
- package/dist/types/index.cjs +2 -2
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.js +1 -1
- package/dist/{types-DmsYGLDX.d.ts → types-BUiNI0oL.d.cts} +18 -23
- package/dist/{types-BWeurwlH.d.cts → types-bBnnfNxC.d.ts} +18 -23
- package/package.json +3 -1
- package/dist/FormulaValidator-Bl6lav9r.d.ts +0 -10
- package/dist/FormulaValidator-DTT8T1OM.d.cts +0 -10
- package/dist/chunk-AORPUIKD.js +0 -81
- package/dist/chunk-AORPUIKD.js.map +0 -1
- package/dist/chunk-CYTPQYVM.js.map +0 -1
- package/dist/chunk-EJYILFAK.cjs +0 -92
- package/dist/chunk-EJYILFAK.cjs.map +0 -1
- package/dist/chunk-GAPLSVZN.cjs.map +0 -1
- package/dist/chunk-HY4VE7H2.js.map +0 -1
- package/dist/chunk-IWRV6QAD.cjs.map +0 -1
- package/dist/chunk-KQWWRWGB.cjs.map +0 -1
- package/dist/chunk-KTCH6INZ.js.map +0 -1
- package/dist/chunk-S7GEDTSL.js.map +0 -1
- package/dist/chunk-TMWPWGUN.cjs.map +0 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { AbstractBasePath, ParsedFormula, createRefNode, createObjectNode, createArrayNode, createStringNode, createNumberNode, createBooleanNode, PatchBuilder, SchemaSerializer, FormulaDependencyIndex, createSchemaTree, validateSchema, validateFormulas } from './chunk-
|
|
1
|
+
import { AbstractBasePath, ParsedFormula, createRefNode, createObjectNode, createArrayNode, createStringNode, createNumberNode, createBooleanNode, makeAutoObservable, observable, makeObservable, runInAction, PatchBuilder, SchemaSerializer, FormulaDependencyIndex, createSchemaTree, FormulaSerializer, validateSchema, validateFormulas } from './chunk-KLDN3IHB.js';
|
|
2
2
|
import { nanoid } from 'nanoid';
|
|
3
3
|
|
|
4
4
|
var SchemaParser = class {
|
|
5
5
|
pendingFormulas = [];
|
|
6
|
+
_parseErrors = [];
|
|
6
7
|
parse(schema) {
|
|
7
8
|
this.pendingFormulas = [];
|
|
9
|
+
this._parseErrors = [];
|
|
8
10
|
return this.parseNode(schema, "root");
|
|
9
11
|
}
|
|
10
12
|
parseFormulas(tree) {
|
|
@@ -13,19 +15,24 @@ var SchemaParser = class {
|
|
|
13
15
|
if (node.isNull()) {
|
|
14
16
|
continue;
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
try {
|
|
19
|
+
const formula = new ParsedFormula(tree, pending.nodeId, pending.expression);
|
|
20
|
+
node.setFormula(formula);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
this._parseErrors.push({
|
|
23
|
+
nodeId: pending.nodeId,
|
|
24
|
+
message: error.message
|
|
25
|
+
});
|
|
26
|
+
}
|
|
18
27
|
}
|
|
19
28
|
this.pendingFormulas = [];
|
|
20
29
|
}
|
|
30
|
+
get parseErrors() {
|
|
31
|
+
return this._parseErrors;
|
|
32
|
+
}
|
|
21
33
|
parseNode(schema, name) {
|
|
22
34
|
if ("$ref" in schema) {
|
|
23
|
-
return createRefNode(
|
|
24
|
-
nanoid(),
|
|
25
|
-
name,
|
|
26
|
-
schema.$ref,
|
|
27
|
-
this.extractMetadata(schema)
|
|
28
|
-
);
|
|
35
|
+
return createRefNode(nanoid(), name, schema.$ref, this.extractMetadata(schema));
|
|
29
36
|
}
|
|
30
37
|
const schemaWithType = schema;
|
|
31
38
|
switch (schemaWithType.type) {
|
|
@@ -51,21 +58,11 @@ var SchemaParser = class {
|
|
|
51
58
|
children.push(this.parseNode(propSchema, propName));
|
|
52
59
|
}
|
|
53
60
|
}
|
|
54
|
-
return createObjectNode(
|
|
55
|
-
nanoid(),
|
|
56
|
-
name,
|
|
57
|
-
children,
|
|
58
|
-
this.extractMetadata(schema)
|
|
59
|
-
);
|
|
61
|
+
return createObjectNode(nanoid(), name, children, this.extractMetadata(schema));
|
|
60
62
|
}
|
|
61
63
|
parseArray(schema, name) {
|
|
62
64
|
const items = this.parseNode(schema.items, "items");
|
|
63
|
-
return createArrayNode(
|
|
64
|
-
nanoid(),
|
|
65
|
-
name,
|
|
66
|
-
items,
|
|
67
|
-
this.extractMetadata(schema)
|
|
68
|
-
);
|
|
65
|
+
return createArrayNode(nanoid(), name, items, this.extractMetadata(schema));
|
|
69
66
|
}
|
|
70
67
|
parseString(schema, name) {
|
|
71
68
|
const nodeId = nanoid();
|
|
@@ -127,12 +124,12 @@ var NodeFactory = class {
|
|
|
127
124
|
case "object":
|
|
128
125
|
return createObjectNode(nanoid(), name, []);
|
|
129
126
|
case "array":
|
|
130
|
-
return this.
|
|
127
|
+
return this.createArrayNodeInternal(name);
|
|
131
128
|
default:
|
|
132
129
|
throw new Error(`Unknown field type: ${type}`);
|
|
133
130
|
}
|
|
134
131
|
}
|
|
135
|
-
|
|
132
|
+
createArrayNodeInternal(name) {
|
|
136
133
|
const items = createStringNode(nanoid(), "items", { defaultValue: "" });
|
|
137
134
|
return createArrayNode(nanoid(), name, items);
|
|
138
135
|
}
|
|
@@ -232,47 +229,28 @@ function generateDefaultValue(schema, options = {}) {
|
|
|
232
229
|
var SchemaModelImpl = class {
|
|
233
230
|
_baseTree;
|
|
234
231
|
_currentTree;
|
|
235
|
-
_reactivity;
|
|
236
232
|
_patchBuilder = new PatchBuilder();
|
|
237
233
|
_serializer = new SchemaSerializer();
|
|
238
234
|
_nodeFactory = new NodeFactory();
|
|
239
235
|
_formulaIndex = new FormulaDependencyIndex();
|
|
240
|
-
|
|
236
|
+
_formulaParseErrors = [];
|
|
237
|
+
constructor(schema) {
|
|
241
238
|
const parser = new SchemaParser();
|
|
242
239
|
const rootNode = parser.parse(schema);
|
|
243
240
|
this._currentTree = createSchemaTree(rootNode);
|
|
244
241
|
parser.parseFormulas(this._currentTree);
|
|
242
|
+
this._formulaParseErrors = parser.parseErrors;
|
|
245
243
|
this._buildFormulaIndex();
|
|
246
244
|
this._baseTree = this._currentTree.clone();
|
|
247
|
-
this
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
jsonPatches: "computed",
|
|
257
|
-
plainSchema: "computed",
|
|
258
|
-
validationErrors: "computed",
|
|
259
|
-
formulaErrors: "computed",
|
|
260
|
-
nodeCount: "computed",
|
|
261
|
-
addField: "action",
|
|
262
|
-
removeField: "action",
|
|
263
|
-
renameField: "action",
|
|
264
|
-
changeFieldType: "action",
|
|
265
|
-
updateMetadata: "action",
|
|
266
|
-
updateFormula: "action",
|
|
267
|
-
updateForeignKey: "action",
|
|
268
|
-
updateDefaultValue: "action",
|
|
269
|
-
wrapInArray: "action",
|
|
270
|
-
wrapRootInArray: "action",
|
|
271
|
-
replaceRoot: "action",
|
|
272
|
-
markAsSaved: "action",
|
|
273
|
-
revert: "action"
|
|
274
|
-
});
|
|
275
|
-
}
|
|
245
|
+
makeAutoObservable(this, {
|
|
246
|
+
_patchBuilder: false,
|
|
247
|
+
_serializer: false,
|
|
248
|
+
_nodeFactory: false,
|
|
249
|
+
_formulaIndex: false,
|
|
250
|
+
_currentTree: "observable.ref",
|
|
251
|
+
_baseTree: "observable.ref",
|
|
252
|
+
_formulaParseErrors: "observable.ref"
|
|
253
|
+
});
|
|
276
254
|
}
|
|
277
255
|
get root() {
|
|
278
256
|
return this._currentTree.root();
|
|
@@ -333,13 +311,21 @@ var SchemaModelImpl = class {
|
|
|
333
311
|
if (node.isNull()) {
|
|
334
312
|
return;
|
|
335
313
|
}
|
|
314
|
+
this._formulaParseErrors = this._formulaParseErrors.filter((e) => e.nodeId !== nodeId);
|
|
336
315
|
if (expression === void 0) {
|
|
337
316
|
node.setFormula(void 0);
|
|
338
317
|
this._formulaIndex.unregisterFormula(nodeId);
|
|
339
318
|
} else {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
319
|
+
try {
|
|
320
|
+
const formula = new ParsedFormula(this._currentTree, nodeId, expression);
|
|
321
|
+
node.setFormula(formula);
|
|
322
|
+
this._formulaIndex.registerFormula(nodeId, formula);
|
|
323
|
+
} catch (error) {
|
|
324
|
+
this._formulaParseErrors = [
|
|
325
|
+
...this._formulaParseErrors,
|
|
326
|
+
{ nodeId, message: error.message }
|
|
327
|
+
];
|
|
328
|
+
}
|
|
343
329
|
}
|
|
344
330
|
}
|
|
345
331
|
updateForeignKey(nodeId, foreignKey) {
|
|
@@ -431,8 +417,37 @@ var SchemaModelImpl = class {
|
|
|
431
417
|
if (targetPath.equals(nodeParentPath)) {
|
|
432
418
|
return false;
|
|
433
419
|
}
|
|
420
|
+
if (this.isMovingOutOfArray(nodePath, targetPath)) {
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
434
423
|
return true;
|
|
435
424
|
}
|
|
425
|
+
isMovingOutOfArray(fromPath, toPath) {
|
|
426
|
+
const fromSegments = fromPath.segments();
|
|
427
|
+
const toSegments = toPath.segments();
|
|
428
|
+
for (let i = 0; i < fromSegments.length; i++) {
|
|
429
|
+
const fromSeg = fromSegments[i];
|
|
430
|
+
if (fromSeg?.isItems()) {
|
|
431
|
+
if (!toSegments[i]?.isItems()) {
|
|
432
|
+
return true;
|
|
433
|
+
}
|
|
434
|
+
if (this.hasPathPrefixMismatch(fromSegments, toSegments, i)) {
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
hasPathPrefixMismatch(fromSegments, toSegments, endIndex) {
|
|
442
|
+
for (let j = 0; j < endIndex; j++) {
|
|
443
|
+
const fromSeg = fromSegments[j];
|
|
444
|
+
const toSeg = toSegments[j];
|
|
445
|
+
if (!fromSeg || !toSeg || !fromSeg.equals(toSeg)) {
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
436
451
|
hasValidDropTarget(nodeId) {
|
|
437
452
|
const node = this._currentTree.nodeById(nodeId);
|
|
438
453
|
if (node.isNull()) {
|
|
@@ -449,17 +464,39 @@ var SchemaModelImpl = class {
|
|
|
449
464
|
}
|
|
450
465
|
return false;
|
|
451
466
|
}
|
|
467
|
+
moveNode(nodeId, targetParentId) {
|
|
468
|
+
if (!this.canMoveNode(nodeId, targetParentId)) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
this._currentTree.moveNode(nodeId, targetParentId);
|
|
472
|
+
}
|
|
452
473
|
getFormulaDependents(nodeId) {
|
|
453
474
|
return this._formulaIndex.getDependents(nodeId);
|
|
454
475
|
}
|
|
455
476
|
hasFormulaDependents(nodeId) {
|
|
456
477
|
return this._formulaIndex.hasDependents(nodeId);
|
|
457
478
|
}
|
|
479
|
+
serializeFormula(nodeId) {
|
|
480
|
+
const node = this._currentTree.nodeById(nodeId);
|
|
481
|
+
if (node.isNull()) {
|
|
482
|
+
return "";
|
|
483
|
+
}
|
|
484
|
+
const formula = node.formula();
|
|
485
|
+
if (!formula) {
|
|
486
|
+
return "";
|
|
487
|
+
}
|
|
488
|
+
return FormulaSerializer.serializeExpression(
|
|
489
|
+
this._currentTree,
|
|
490
|
+
nodeId,
|
|
491
|
+
formula,
|
|
492
|
+
{ strict: false }
|
|
493
|
+
);
|
|
494
|
+
}
|
|
458
495
|
get validationErrors() {
|
|
459
496
|
return validateSchema(this._currentTree.root());
|
|
460
497
|
}
|
|
461
498
|
get formulaErrors() {
|
|
462
|
-
return validateFormulas(this._currentTree);
|
|
499
|
+
return [...this._formulaParseErrors, ...validateFormulas(this._currentTree)];
|
|
463
500
|
}
|
|
464
501
|
get isDirty() {
|
|
465
502
|
return this.patches.length > 0;
|
|
@@ -499,31 +536,23 @@ var SchemaModelImpl = class {
|
|
|
499
536
|
}
|
|
500
537
|
}
|
|
501
538
|
};
|
|
502
|
-
function createSchemaModel(schema
|
|
503
|
-
return new SchemaModelImpl(schema
|
|
539
|
+
function createSchemaModel(schema) {
|
|
540
|
+
return new SchemaModelImpl(schema);
|
|
504
541
|
}
|
|
505
542
|
|
|
506
543
|
// src/model/table/row/RowModelImpl.ts
|
|
507
544
|
var UNSET_INDEX = -1;
|
|
508
545
|
var RowModelImpl = class {
|
|
509
|
-
constructor(_rowId, _tree
|
|
546
|
+
constructor(_rowId, _tree) {
|
|
510
547
|
this._rowId = _rowId;
|
|
511
548
|
this._tree = _tree;
|
|
512
|
-
this
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
initObservable() {
|
|
517
|
-
this._reactivity?.makeObservable(this, {
|
|
518
|
-
_tableModel: "observable.ref",
|
|
519
|
-
index: "computed",
|
|
520
|
-
prev: "computed",
|
|
521
|
-
next: "computed",
|
|
522
|
-
isDirty: "computed",
|
|
523
|
-
isValid: "computed",
|
|
524
|
-
errors: "computed"
|
|
549
|
+
makeAutoObservable(this, {
|
|
550
|
+
_rowId: false,
|
|
551
|
+
_tree: false,
|
|
552
|
+
_tableModel: "observable.ref"
|
|
525
553
|
});
|
|
526
554
|
}
|
|
555
|
+
_tableModel = null;
|
|
527
556
|
get rowId() {
|
|
528
557
|
return this._rowId;
|
|
529
558
|
}
|
|
@@ -663,10 +692,13 @@ function extractFormulaDefinition(schema) {
|
|
|
663
692
|
|
|
664
693
|
// src/model/value-node/ArrayValueNode.ts
|
|
665
694
|
var ArrayValueNode = class extends BaseValueNode {
|
|
666
|
-
|
|
695
|
+
type = "array" /* Array */;
|
|
696
|
+
_items;
|
|
697
|
+
_baseItems;
|
|
698
|
+
_nodeFactory = null;
|
|
699
|
+
constructor(id, name, schema, items) {
|
|
667
700
|
super(id, name, schema);
|
|
668
|
-
this.
|
|
669
|
-
this._items = reactivity?.observableArray() ?? [];
|
|
701
|
+
this._items = observable.array();
|
|
670
702
|
this._baseItems = [];
|
|
671
703
|
if (items) {
|
|
672
704
|
for (const item of items) {
|
|
@@ -675,17 +707,7 @@ var ArrayValueNode = class extends BaseValueNode {
|
|
|
675
707
|
}
|
|
676
708
|
}
|
|
677
709
|
this._baseItems = [...this._items];
|
|
678
|
-
this
|
|
679
|
-
}
|
|
680
|
-
type = "array" /* Array */;
|
|
681
|
-
_items;
|
|
682
|
-
_baseItems;
|
|
683
|
-
_nodeFactory = null;
|
|
684
|
-
initObservable() {
|
|
685
|
-
if (!this.reactivity) {
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
this.reactivity.makeObservable(this, {
|
|
710
|
+
makeObservable(this, {
|
|
689
711
|
_items: "observable",
|
|
690
712
|
_baseItems: "observable",
|
|
691
713
|
value: "computed",
|
|
@@ -840,7 +862,7 @@ var ArrayValueNode = class extends BaseValueNode {
|
|
|
840
862
|
for (const item of this._items) {
|
|
841
863
|
item.parent = null;
|
|
842
864
|
}
|
|
843
|
-
this._items =
|
|
865
|
+
this._items = observable.array();
|
|
844
866
|
for (const baseItem of this._baseItems) {
|
|
845
867
|
this._items.push(baseItem);
|
|
846
868
|
}
|
|
@@ -872,22 +894,18 @@ var ArrayValueNode = class extends BaseValueNode {
|
|
|
872
894
|
|
|
873
895
|
// src/model/value-node/BasePrimitiveValueNode.ts
|
|
874
896
|
var BasePrimitiveValueNode = class extends BaseValueNode {
|
|
875
|
-
|
|
897
|
+
_value;
|
|
898
|
+
_baseValue;
|
|
899
|
+
_formulaWarning = null;
|
|
900
|
+
constructor(id, name, schema, value, defaultValue) {
|
|
876
901
|
super(id, name, schema);
|
|
877
|
-
this.reactivity = reactivity;
|
|
878
902
|
const schemaDefault = "default" in schema ? schema.default : void 0;
|
|
879
903
|
const initialValue = value ?? schemaDefault ?? defaultValue;
|
|
880
904
|
this._value = initialValue;
|
|
881
905
|
this._baseValue = initialValue;
|
|
882
906
|
}
|
|
883
|
-
_value;
|
|
884
|
-
_baseValue;
|
|
885
|
-
_formulaWarning = null;
|
|
886
907
|
initObservable() {
|
|
887
|
-
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
this.reactivity.makeObservable(this, {
|
|
908
|
+
makeObservable(this, {
|
|
891
909
|
_value: "observable",
|
|
892
910
|
_baseValue: "observable",
|
|
893
911
|
_formulaWarning: "observable",
|
|
@@ -976,8 +994,8 @@ var BasePrimitiveValueNode = class extends BaseValueNode {
|
|
|
976
994
|
// src/model/value-node/BooleanValueNode.ts
|
|
977
995
|
var BooleanValueNode = class extends BasePrimitiveValueNode {
|
|
978
996
|
type = "boolean" /* Boolean */;
|
|
979
|
-
constructor(id, name, schema, value
|
|
980
|
-
super(id, name, schema, value, false
|
|
997
|
+
constructor(id, name, schema, value) {
|
|
998
|
+
super(id, name, schema, value, false);
|
|
981
999
|
this.initObservable();
|
|
982
1000
|
}
|
|
983
1001
|
get defaultValue() {
|
|
@@ -1011,8 +1029,8 @@ var ForeignKeyResolverNotConfiguredError = class extends Error {
|
|
|
1011
1029
|
// src/model/value-node/StringValueNode.ts
|
|
1012
1030
|
var StringValueNode = class extends BasePrimitiveValueNode {
|
|
1013
1031
|
type = "string" /* String */;
|
|
1014
|
-
constructor(id, name, schema, value
|
|
1015
|
-
super(id, name, schema, value, ""
|
|
1032
|
+
constructor(id, name, schema, value) {
|
|
1033
|
+
super(id, name, schema, value, "");
|
|
1016
1034
|
this.initObservable();
|
|
1017
1035
|
}
|
|
1018
1036
|
get defaultValue() {
|
|
@@ -1136,8 +1154,8 @@ function isForeignKeyValueNode(node) {
|
|
|
1136
1154
|
return node instanceof ForeignKeyValueNodeImpl || "foreignKey" in node && typeof node.foreignKey === "string";
|
|
1137
1155
|
}
|
|
1138
1156
|
var ForeignKeyValueNodeImpl = class extends StringValueNode {
|
|
1139
|
-
constructor(id, name, schema, value,
|
|
1140
|
-
super(id, name, schema, value
|
|
1157
|
+
constructor(id, name, schema, value, fkResolver) {
|
|
1158
|
+
super(id, name, schema, value);
|
|
1141
1159
|
this.fkResolver = fkResolver;
|
|
1142
1160
|
const schemaFk = "foreignKey" in schema && typeof schema.foreignKey === "string" ? schema.foreignKey : void 0;
|
|
1143
1161
|
if (!schemaFk) {
|
|
@@ -1175,8 +1193,8 @@ var ForeignKeyValueNodeImpl = class extends StringValueNode {
|
|
|
1175
1193
|
// src/model/value-node/NumberValueNode.ts
|
|
1176
1194
|
var NumberValueNode = class extends BasePrimitiveValueNode {
|
|
1177
1195
|
type = "number" /* Number */;
|
|
1178
|
-
constructor(id, name, schema, value
|
|
1179
|
-
super(id, name, schema, value, 0
|
|
1196
|
+
constructor(id, name, schema, value) {
|
|
1197
|
+
super(id, name, schema, value, 0);
|
|
1180
1198
|
this.initObservable();
|
|
1181
1199
|
}
|
|
1182
1200
|
get defaultValue() {
|
|
@@ -1230,10 +1248,12 @@ var NumberValueNode = class extends BasePrimitiveValueNode {
|
|
|
1230
1248
|
|
|
1231
1249
|
// src/model/value-node/ObjectValueNode.ts
|
|
1232
1250
|
var ObjectValueNode = class extends BaseValueNode {
|
|
1233
|
-
|
|
1251
|
+
type = "object" /* Object */;
|
|
1252
|
+
_children;
|
|
1253
|
+
_baseChildren;
|
|
1254
|
+
constructor(id, name, schema, children) {
|
|
1234
1255
|
super(id, name, schema);
|
|
1235
|
-
this.
|
|
1236
|
-
this._children = reactivity?.observableMap() ?? /* @__PURE__ */ new Map();
|
|
1256
|
+
this._children = observable.map();
|
|
1237
1257
|
this._baseChildren = /* @__PURE__ */ new Map();
|
|
1238
1258
|
if (children) {
|
|
1239
1259
|
for (const child of children) {
|
|
@@ -1242,16 +1262,7 @@ var ObjectValueNode = class extends BaseValueNode {
|
|
|
1242
1262
|
}
|
|
1243
1263
|
}
|
|
1244
1264
|
this._baseChildren = new Map(this._children);
|
|
1245
|
-
this
|
|
1246
|
-
}
|
|
1247
|
-
type = "object" /* Object */;
|
|
1248
|
-
_children;
|
|
1249
|
-
_baseChildren;
|
|
1250
|
-
initObservable() {
|
|
1251
|
-
if (!this.reactivity) {
|
|
1252
|
-
return;
|
|
1253
|
-
}
|
|
1254
|
-
this.reactivity.makeObservable(this, {
|
|
1265
|
+
makeObservable(this, {
|
|
1255
1266
|
_children: "observable",
|
|
1256
1267
|
_baseChildren: "observable",
|
|
1257
1268
|
value: "computed",
|
|
@@ -1327,7 +1338,7 @@ var ObjectValueNode = class extends BaseValueNode {
|
|
|
1327
1338
|
for (const child of this._children.values()) {
|
|
1328
1339
|
child.parent = null;
|
|
1329
1340
|
}
|
|
1330
|
-
this._children =
|
|
1341
|
+
this._children = observable.map();
|
|
1331
1342
|
for (const [key, value] of this._baseChildren) {
|
|
1332
1343
|
this._children.set(key, value);
|
|
1333
1344
|
}
|
|
@@ -1413,7 +1424,7 @@ var NodeFactory2 = class {
|
|
|
1413
1424
|
};
|
|
1414
1425
|
}
|
|
1415
1426
|
};
|
|
1416
|
-
function createStringFactory(
|
|
1427
|
+
function createStringFactory(fkResolver) {
|
|
1417
1428
|
return (name, schema, value, id) => {
|
|
1418
1429
|
const stringSchema = schema;
|
|
1419
1430
|
if (stringSchema.foreignKey) {
|
|
@@ -1422,7 +1433,6 @@ function createStringFactory(reactivity, fkResolver) {
|
|
|
1422
1433
|
name,
|
|
1423
1434
|
schema,
|
|
1424
1435
|
value,
|
|
1425
|
-
reactivity,
|
|
1426
1436
|
fkResolver
|
|
1427
1437
|
);
|
|
1428
1438
|
}
|
|
@@ -1430,34 +1440,31 @@ function createStringFactory(reactivity, fkResolver) {
|
|
|
1430
1440
|
id,
|
|
1431
1441
|
name,
|
|
1432
1442
|
schema,
|
|
1433
|
-
value
|
|
1434
|
-
reactivity
|
|
1443
|
+
value
|
|
1435
1444
|
);
|
|
1436
1445
|
};
|
|
1437
1446
|
}
|
|
1438
|
-
function createNumberFactory(
|
|
1447
|
+
function createNumberFactory() {
|
|
1439
1448
|
return (name, schema, value, id) => {
|
|
1440
1449
|
return new NumberValueNode(
|
|
1441
1450
|
id,
|
|
1442
1451
|
name,
|
|
1443
1452
|
schema,
|
|
1444
|
-
value
|
|
1445
|
-
reactivity
|
|
1453
|
+
value
|
|
1446
1454
|
);
|
|
1447
1455
|
};
|
|
1448
1456
|
}
|
|
1449
|
-
function createBooleanFactory(
|
|
1457
|
+
function createBooleanFactory() {
|
|
1450
1458
|
return (name, schema, value, id) => {
|
|
1451
1459
|
return new BooleanValueNode(
|
|
1452
1460
|
id,
|
|
1453
1461
|
name,
|
|
1454
1462
|
schema,
|
|
1455
|
-
value
|
|
1456
|
-
reactivity
|
|
1463
|
+
value
|
|
1457
1464
|
);
|
|
1458
1465
|
};
|
|
1459
1466
|
}
|
|
1460
|
-
function createObjectFactory(nodeFactory
|
|
1467
|
+
function createObjectFactory(nodeFactory) {
|
|
1461
1468
|
return (name, schema, value, id) => {
|
|
1462
1469
|
const objValue = value ?? {};
|
|
1463
1470
|
const children = [];
|
|
@@ -1468,10 +1475,10 @@ function createObjectFactory(nodeFactory, reactivity) {
|
|
|
1468
1475
|
const childNode = nodeFactory.create(propName, propSchema, propValue);
|
|
1469
1476
|
children.push(childNode);
|
|
1470
1477
|
}
|
|
1471
|
-
return new ObjectValueNode(id, name, schema, children
|
|
1478
|
+
return new ObjectValueNode(id, name, schema, children);
|
|
1472
1479
|
};
|
|
1473
1480
|
}
|
|
1474
|
-
function createArrayFactory(nodeFactory
|
|
1481
|
+
function createArrayFactory(nodeFactory) {
|
|
1475
1482
|
return (name, schema, value, id) => {
|
|
1476
1483
|
const arrValue = value ?? [];
|
|
1477
1484
|
const arraySchema = schema;
|
|
@@ -1482,23 +1489,23 @@ function createArrayFactory(nodeFactory, reactivity) {
|
|
|
1482
1489
|
const itemNode = nodeFactory.create(String(i), itemSchema, itemValue);
|
|
1483
1490
|
items.push(itemNode);
|
|
1484
1491
|
}
|
|
1485
|
-
const arrayNode = new ArrayValueNode(id, name, schema, items
|
|
1492
|
+
const arrayNode = new ArrayValueNode(id, name, schema, items);
|
|
1486
1493
|
arrayNode.setNodeFactory(nodeFactory);
|
|
1487
1494
|
return arrayNode;
|
|
1488
1495
|
};
|
|
1489
1496
|
}
|
|
1490
|
-
function createDefaultRegistry(
|
|
1497
|
+
function createDefaultRegistry(fkResolver) {
|
|
1491
1498
|
const registry = new NodeFactoryRegistry();
|
|
1492
|
-
registry.register("string", createStringFactory(
|
|
1493
|
-
registry.register("number", createNumberFactory(
|
|
1494
|
-
registry.register("boolean", createBooleanFactory(
|
|
1499
|
+
registry.register("string", createStringFactory(fkResolver));
|
|
1500
|
+
registry.register("number", createNumberFactory());
|
|
1501
|
+
registry.register("boolean", createBooleanFactory());
|
|
1495
1502
|
return registry;
|
|
1496
1503
|
}
|
|
1497
1504
|
function createNodeFactory(options) {
|
|
1498
|
-
const registry = createDefaultRegistry(options?.
|
|
1505
|
+
const registry = createDefaultRegistry(options?.fkResolver);
|
|
1499
1506
|
const factory = new NodeFactory2(registry, options);
|
|
1500
|
-
registry.register("object", createObjectFactory(factory
|
|
1501
|
-
registry.register("array", createArrayFactory(factory
|
|
1507
|
+
registry.register("object", createObjectFactory(factory));
|
|
1508
|
+
registry.register("array", createArrayFactory(factory));
|
|
1502
1509
|
return factory;
|
|
1503
1510
|
}
|
|
1504
1511
|
|
|
@@ -1631,18 +1638,10 @@ function parseValuePath(path) {
|
|
|
1631
1638
|
|
|
1632
1639
|
// src/model/value-tree/ValueTree.ts
|
|
1633
1640
|
var ValueTree = class {
|
|
1634
|
-
constructor(_root
|
|
1641
|
+
constructor(_root) {
|
|
1635
1642
|
this._root = _root;
|
|
1636
|
-
this
|
|
1637
|
-
|
|
1638
|
-
}
|
|
1639
|
-
initObservable() {
|
|
1640
|
-
this._reactivity?.makeObservable(this, {
|
|
1641
|
-
isDirty: "computed",
|
|
1642
|
-
isValid: "computed",
|
|
1643
|
-
errors: "computed",
|
|
1644
|
-
commit: "action",
|
|
1645
|
-
revert: "action"
|
|
1643
|
+
makeAutoObservable(this, {
|
|
1644
|
+
_root: false
|
|
1646
1645
|
});
|
|
1647
1646
|
}
|
|
1648
1647
|
get root() {
|
|
@@ -1722,38 +1721,24 @@ var TableModelImpl = class {
|
|
|
1722
1721
|
_schema;
|
|
1723
1722
|
_rows;
|
|
1724
1723
|
_jsonSchema;
|
|
1725
|
-
_reactivity;
|
|
1726
1724
|
_fkResolver;
|
|
1727
|
-
constructor(options
|
|
1725
|
+
constructor(options) {
|
|
1728
1726
|
this._tableId = options.tableId;
|
|
1729
1727
|
this._baseTableId = options.tableId;
|
|
1730
1728
|
this._jsonSchema = options.schema;
|
|
1731
|
-
this._schema = createSchemaModel(options.schema
|
|
1732
|
-
this._reactivity = reactivity;
|
|
1729
|
+
this._schema = createSchemaModel(options.schema);
|
|
1733
1730
|
this._fkResolver = options.fkResolver;
|
|
1734
|
-
this._rows =
|
|
1731
|
+
this._rows = observable.array();
|
|
1735
1732
|
if (options.rows) {
|
|
1736
1733
|
for (const row of options.rows) {
|
|
1737
1734
|
this._rows.push(this.createRowModel(row.rowId, row.data));
|
|
1738
1735
|
}
|
|
1739
1736
|
}
|
|
1740
|
-
this
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
_baseTableId: "observable",
|
|
1746
|
-
tableId: "computed",
|
|
1747
|
-
baseTableId: "computed",
|
|
1748
|
-
isRenamed: "computed",
|
|
1749
|
-
rows: "computed",
|
|
1750
|
-
rowCount: "computed",
|
|
1751
|
-
isDirty: "computed",
|
|
1752
|
-
rename: "action",
|
|
1753
|
-
addRow: "action",
|
|
1754
|
-
removeRow: "action",
|
|
1755
|
-
commit: "action",
|
|
1756
|
-
revert: "action"
|
|
1737
|
+
makeAutoObservable(this, {
|
|
1738
|
+
_schema: false,
|
|
1739
|
+
_rows: false,
|
|
1740
|
+
_jsonSchema: false,
|
|
1741
|
+
_fkResolver: false
|
|
1757
1742
|
});
|
|
1758
1743
|
}
|
|
1759
1744
|
get tableId() {
|
|
@@ -1837,19 +1822,18 @@ var TableModelImpl = class {
|
|
|
1837
1822
|
}
|
|
1838
1823
|
createRowModel(rowId, data) {
|
|
1839
1824
|
const factory = createNodeFactory({
|
|
1840
|
-
reactivity: this._reactivity,
|
|
1841
1825
|
fkResolver: this._fkResolver
|
|
1842
1826
|
});
|
|
1843
1827
|
const rowData = data ?? generateDefaultValue(this._jsonSchema);
|
|
1844
1828
|
const rootNode = factory.createTree(this._jsonSchema, rowData);
|
|
1845
|
-
const valueTree = new ValueTree(rootNode
|
|
1846
|
-
const rowModel = new RowModelImpl(rowId, valueTree
|
|
1829
|
+
const valueTree = new ValueTree(rootNode);
|
|
1830
|
+
const rowModel = new RowModelImpl(rowId, valueTree);
|
|
1847
1831
|
rowModel.setTableModel(this);
|
|
1848
1832
|
return rowModel;
|
|
1849
1833
|
}
|
|
1850
1834
|
};
|
|
1851
|
-
function createTableModel(options
|
|
1852
|
-
return new TableModelImpl(options
|
|
1835
|
+
function createTableModel(options) {
|
|
1836
|
+
return new TableModelImpl(options);
|
|
1853
1837
|
}
|
|
1854
1838
|
|
|
1855
1839
|
// src/model/foreign-key-resolver/ForeignKeyResolverImpl.ts
|
|
@@ -1863,29 +1847,24 @@ var ForeignKeyResolverImpl = class {
|
|
|
1863
1847
|
_prefetchEnabled;
|
|
1864
1848
|
_disposed = false;
|
|
1865
1849
|
loader;
|
|
1866
|
-
reactivity;
|
|
1867
1850
|
constructor(options) {
|
|
1868
1851
|
this.loader = options?.loader;
|
|
1869
|
-
this.reactivity = options?.reactivity;
|
|
1870
1852
|
this._prefetchEnabled = options?.prefetch ?? false;
|
|
1871
|
-
this._schemaCache =
|
|
1872
|
-
this._tableCache =
|
|
1853
|
+
this._schemaCache = observable.map();
|
|
1854
|
+
this._tableCache = observable.map();
|
|
1873
1855
|
this._loadingTables = /* @__PURE__ */ new Set();
|
|
1874
1856
|
this._loadingRows = /* @__PURE__ */ new Map();
|
|
1875
1857
|
this._pendingTableLoads = /* @__PURE__ */ new Map();
|
|
1876
1858
|
this._pendingRowLoads = /* @__PURE__ */ new Map();
|
|
1877
|
-
this
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
addTable: "action",
|
|
1887
|
-
addRow: "action",
|
|
1888
|
-
setPrefetch: "action"
|
|
1859
|
+
makeAutoObservable(this, {
|
|
1860
|
+
_schemaCache: false,
|
|
1861
|
+
_tableCache: false,
|
|
1862
|
+
_loadingTables: false,
|
|
1863
|
+
_loadingRows: false,
|
|
1864
|
+
_pendingTableLoads: false,
|
|
1865
|
+
_pendingRowLoads: false,
|
|
1866
|
+
_disposed: false,
|
|
1867
|
+
loader: false
|
|
1889
1868
|
});
|
|
1890
1869
|
}
|
|
1891
1870
|
get isPrefetchEnabled() {
|
|
@@ -1915,32 +1894,23 @@ var ForeignKeyResolverImpl = class {
|
|
|
1915
1894
|
if (this._disposed) {
|
|
1916
1895
|
return;
|
|
1917
1896
|
}
|
|
1918
|
-
|
|
1919
|
-
this.reactivity.runInAction(() => {
|
|
1920
|
-
this._schemaCache.set(tableId, schema);
|
|
1921
|
-
});
|
|
1922
|
-
} else {
|
|
1897
|
+
runInAction(() => {
|
|
1923
1898
|
this._schemaCache.set(tableId, schema);
|
|
1924
|
-
}
|
|
1899
|
+
});
|
|
1925
1900
|
}
|
|
1926
1901
|
addTable(tableId, schema, rows) {
|
|
1927
1902
|
if (this._disposed) {
|
|
1928
1903
|
return;
|
|
1929
1904
|
}
|
|
1930
|
-
const rowMap =
|
|
1905
|
+
const rowMap = observable.map();
|
|
1931
1906
|
for (const row of rows) {
|
|
1932
1907
|
rowMap.set(row.rowId, row);
|
|
1933
1908
|
}
|
|
1934
1909
|
const cache = { schema, rows: rowMap };
|
|
1935
|
-
|
|
1936
|
-
this.reactivity.runInAction(() => {
|
|
1937
|
-
this._tableCache.set(tableId, cache);
|
|
1938
|
-
this._schemaCache.set(tableId, schema);
|
|
1939
|
-
});
|
|
1940
|
-
} else {
|
|
1910
|
+
runInAction(() => {
|
|
1941
1911
|
this._tableCache.set(tableId, cache);
|
|
1942
1912
|
this._schemaCache.set(tableId, schema);
|
|
1943
|
-
}
|
|
1913
|
+
});
|
|
1944
1914
|
if (this._prefetchEnabled) {
|
|
1945
1915
|
this.prefetchForeignKeysFromTable(tableId, schema, rows);
|
|
1946
1916
|
}
|
|
@@ -1952,13 +1922,9 @@ var ForeignKeyResolverImpl = class {
|
|
|
1952
1922
|
const table = this._tableCache.get(tableId);
|
|
1953
1923
|
if (table) {
|
|
1954
1924
|
const rowData = { rowId, data };
|
|
1955
|
-
|
|
1956
|
-
this.reactivity.runInAction(() => {
|
|
1957
|
-
table.rows.set(rowId, rowData);
|
|
1958
|
-
});
|
|
1959
|
-
} else {
|
|
1925
|
+
runInAction(() => {
|
|
1960
1926
|
table.rows.set(rowId, rowData);
|
|
1961
|
-
}
|
|
1927
|
+
});
|
|
1962
1928
|
if (this._prefetchEnabled) {
|
|
1963
1929
|
this.prefetchForeignKeysFromRow(tableId, table.schema, data);
|
|
1964
1930
|
}
|
|
@@ -1970,18 +1936,7 @@ var ForeignKeyResolverImpl = class {
|
|
|
1970
1936
|
}
|
|
1971
1937
|
const schema = this._schemaCache.get(oldTableId);
|
|
1972
1938
|
const tableCache = this._tableCache.get(oldTableId);
|
|
1973
|
-
|
|
1974
|
-
this.reactivity.runInAction(() => {
|
|
1975
|
-
if (schema) {
|
|
1976
|
-
this._schemaCache.delete(oldTableId);
|
|
1977
|
-
this._schemaCache.set(newTableId, schema);
|
|
1978
|
-
}
|
|
1979
|
-
if (tableCache) {
|
|
1980
|
-
this._tableCache.delete(oldTableId);
|
|
1981
|
-
this._tableCache.set(newTableId, tableCache);
|
|
1982
|
-
}
|
|
1983
|
-
});
|
|
1984
|
-
} else {
|
|
1939
|
+
runInAction(() => {
|
|
1985
1940
|
if (schema) {
|
|
1986
1941
|
this._schemaCache.delete(oldTableId);
|
|
1987
1942
|
this._schemaCache.set(newTableId, schema);
|
|
@@ -1990,7 +1945,7 @@ var ForeignKeyResolverImpl = class {
|
|
|
1990
1945
|
this._tableCache.delete(oldTableId);
|
|
1991
1946
|
this._tableCache.set(newTableId, tableCache);
|
|
1992
1947
|
}
|
|
1993
|
-
}
|
|
1948
|
+
});
|
|
1994
1949
|
}
|
|
1995
1950
|
async getSchema(tableId) {
|
|
1996
1951
|
const cachedSchema = this._schemaCache.get(tableId);
|
|
@@ -2083,15 +2038,11 @@ var ForeignKeyResolverImpl = class {
|
|
|
2083
2038
|
}
|
|
2084
2039
|
ensureTableCache(tableId, schema) {
|
|
2085
2040
|
if (!this._tableCache.has(tableId)) {
|
|
2086
|
-
const rowMap =
|
|
2041
|
+
const rowMap = observable.map();
|
|
2087
2042
|
const cache = { schema, rows: rowMap };
|
|
2088
|
-
|
|
2089
|
-
this.reactivity.runInAction(() => {
|
|
2090
|
-
this._tableCache.set(tableId, cache);
|
|
2091
|
-
});
|
|
2092
|
-
} else {
|
|
2043
|
+
runInAction(() => {
|
|
2093
2044
|
this._tableCache.set(tableId, cache);
|
|
2094
|
-
}
|
|
2045
|
+
});
|
|
2095
2046
|
}
|
|
2096
2047
|
}
|
|
2097
2048
|
markRowAsLoading(tableId, rowId) {
|
|
@@ -2188,30 +2139,19 @@ var DataModelImpl = class {
|
|
|
2188
2139
|
_tables;
|
|
2189
2140
|
_fk;
|
|
2190
2141
|
_ownsFkResolver;
|
|
2191
|
-
_reactivity;
|
|
2192
2142
|
constructor(options) {
|
|
2193
|
-
this.
|
|
2194
|
-
this._tables = this._reactivity?.observableMap() ?? /* @__PURE__ */ new Map();
|
|
2143
|
+
this._tables = observable.map();
|
|
2195
2144
|
if (options?.fkResolver) {
|
|
2196
2145
|
this._fk = options.fkResolver;
|
|
2197
2146
|
this._ownsFkResolver = false;
|
|
2198
2147
|
} else {
|
|
2199
|
-
this._fk = createForeignKeyResolver(
|
|
2148
|
+
this._fk = createForeignKeyResolver();
|
|
2200
2149
|
this._ownsFkResolver = true;
|
|
2201
2150
|
}
|
|
2202
|
-
this
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
_tables: "observable",
|
|
2207
|
-
tables: "computed",
|
|
2208
|
-
tableIds: "computed",
|
|
2209
|
-
isDirty: "computed",
|
|
2210
|
-
addTable: "action",
|
|
2211
|
-
removeTable: "action",
|
|
2212
|
-
renameTable: "action",
|
|
2213
|
-
commit: "action",
|
|
2214
|
-
revert: "action"
|
|
2151
|
+
makeAutoObservable(this, {
|
|
2152
|
+
_tables: false,
|
|
2153
|
+
_fk: false,
|
|
2154
|
+
_ownsFkResolver: false
|
|
2215
2155
|
});
|
|
2216
2156
|
}
|
|
2217
2157
|
get fk() {
|
|
@@ -2238,15 +2178,12 @@ var DataModelImpl = class {
|
|
|
2238
2178
|
return this._tables.get(tableId);
|
|
2239
2179
|
}
|
|
2240
2180
|
addTable(tableId, schema, rows) {
|
|
2241
|
-
const tableModel = createTableModel(
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
},
|
|
2248
|
-
this._reactivity
|
|
2249
|
-
);
|
|
2181
|
+
const tableModel = createTableModel({
|
|
2182
|
+
tableId,
|
|
2183
|
+
schema,
|
|
2184
|
+
rows,
|
|
2185
|
+
fkResolver: this._fk
|
|
2186
|
+
});
|
|
2250
2187
|
this._tables.set(tableId, tableModel);
|
|
2251
2188
|
this._fk.addSchema(tableId, schema);
|
|
2252
2189
|
if (rows && rows.length > 0) {
|
|
@@ -2292,5 +2229,5 @@ function createDataModel(options) {
|
|
|
2292
2229
|
}
|
|
2293
2230
|
|
|
2294
2231
|
export { ArrayValueNode, BasePrimitiveValueNode, BaseValueNode, BooleanValueNode, DataModelImpl, ForeignKeyNotFoundError, ForeignKeyResolverImpl, ForeignKeyResolverNotConfiguredError, ForeignKeyValueNodeImpl, NodeFactory, NodeFactory2, NodeFactoryRegistry, NumberValueNode, ObjectValueNode, RowModelImpl, SchemaParser, StringValueNode, TableModelImpl, ValueType, createDataModel, createDefaultRegistry, createForeignKeyResolver, createNodeFactory, createSchemaModel, createTableModel, extractFormulaDefinition, generateDefaultValue, generateNodeId, isForeignKeyValueNode, resetNodeIdCounter };
|
|
2295
|
-
//# sourceMappingURL=chunk-
|
|
2296
|
-
//# sourceMappingURL=chunk-
|
|
2232
|
+
//# sourceMappingURL=chunk-VQZNN335.js.map
|
|
2233
|
+
//# sourceMappingURL=chunk-VQZNN335.js.map
|