@revisium/schema-toolkit 0.15.0 → 0.16.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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk5WZ4YPH5_cjs = require('../chunk-5WZ4YPH5.cjs');
4
- require('../chunk-A4E524UU.cjs');
3
+ var chunkKQWWRWGB_cjs = require('../chunk-KQWWRWGB.cjs');
4
+ require('../chunk-IWRV6QAD.cjs');
5
5
  require('../chunk-TBFTADML.cjs');
6
6
  var chunkTMWPWGUN_cjs = require('../chunk-TMWPWGUN.cjs');
7
7
  require('../chunk-ZRNFSUOV.cjs');
@@ -11,123 +11,123 @@ require('../chunk-GAPLSVZN.cjs');
11
11
 
12
12
  Object.defineProperty(exports, "ArrayValueNode", {
13
13
  enumerable: true,
14
- get: function () { return chunk5WZ4YPH5_cjs.ArrayValueNode; }
14
+ get: function () { return chunkKQWWRWGB_cjs.ArrayValueNode; }
15
15
  });
16
16
  Object.defineProperty(exports, "BasePrimitiveValueNode", {
17
17
  enumerable: true,
18
- get: function () { return chunk5WZ4YPH5_cjs.BasePrimitiveValueNode; }
18
+ get: function () { return chunkKQWWRWGB_cjs.BasePrimitiveValueNode; }
19
19
  });
20
20
  Object.defineProperty(exports, "BaseValueNode", {
21
21
  enumerable: true,
22
- get: function () { return chunk5WZ4YPH5_cjs.BaseValueNode; }
22
+ get: function () { return chunkKQWWRWGB_cjs.BaseValueNode; }
23
23
  });
24
24
  Object.defineProperty(exports, "BooleanValueNode", {
25
25
  enumerable: true,
26
- get: function () { return chunk5WZ4YPH5_cjs.BooleanValueNode; }
26
+ get: function () { return chunkKQWWRWGB_cjs.BooleanValueNode; }
27
27
  });
28
28
  Object.defineProperty(exports, "DataModelImpl", {
29
29
  enumerable: true,
30
- get: function () { return chunk5WZ4YPH5_cjs.DataModelImpl; }
30
+ get: function () { return chunkKQWWRWGB_cjs.DataModelImpl; }
31
31
  });
32
32
  Object.defineProperty(exports, "ForeignKeyNotFoundError", {
33
33
  enumerable: true,
34
- get: function () { return chunk5WZ4YPH5_cjs.ForeignKeyNotFoundError; }
34
+ get: function () { return chunkKQWWRWGB_cjs.ForeignKeyNotFoundError; }
35
35
  });
36
36
  Object.defineProperty(exports, "ForeignKeyResolverImpl", {
37
37
  enumerable: true,
38
- get: function () { return chunk5WZ4YPH5_cjs.ForeignKeyResolverImpl; }
38
+ get: function () { return chunkKQWWRWGB_cjs.ForeignKeyResolverImpl; }
39
39
  });
40
40
  Object.defineProperty(exports, "ForeignKeyResolverNotConfiguredError", {
41
41
  enumerable: true,
42
- get: function () { return chunk5WZ4YPH5_cjs.ForeignKeyResolverNotConfiguredError; }
42
+ get: function () { return chunkKQWWRWGB_cjs.ForeignKeyResolverNotConfiguredError; }
43
43
  });
44
44
  Object.defineProperty(exports, "ForeignKeyValueNodeImpl", {
45
45
  enumerable: true,
46
- get: function () { return chunk5WZ4YPH5_cjs.ForeignKeyValueNodeImpl; }
46
+ get: function () { return chunkKQWWRWGB_cjs.ForeignKeyValueNodeImpl; }
47
47
  });
48
48
  Object.defineProperty(exports, "NodeFactory", {
49
49
  enumerable: true,
50
- get: function () { return chunk5WZ4YPH5_cjs.NodeFactory; }
50
+ get: function () { return chunkKQWWRWGB_cjs.NodeFactory; }
51
51
  });
52
52
  Object.defineProperty(exports, "NodeFactoryRegistry", {
53
53
  enumerable: true,
54
- get: function () { return chunk5WZ4YPH5_cjs.NodeFactoryRegistry; }
54
+ get: function () { return chunkKQWWRWGB_cjs.NodeFactoryRegistry; }
55
55
  });
56
56
  Object.defineProperty(exports, "NumberValueNode", {
57
57
  enumerable: true,
58
- get: function () { return chunk5WZ4YPH5_cjs.NumberValueNode; }
58
+ get: function () { return chunkKQWWRWGB_cjs.NumberValueNode; }
59
59
  });
60
60
  Object.defineProperty(exports, "ObjectValueNode", {
61
61
  enumerable: true,
62
- get: function () { return chunk5WZ4YPH5_cjs.ObjectValueNode; }
62
+ get: function () { return chunkKQWWRWGB_cjs.ObjectValueNode; }
63
63
  });
64
64
  Object.defineProperty(exports, "RowModelImpl", {
65
65
  enumerable: true,
66
- get: function () { return chunk5WZ4YPH5_cjs.RowModelImpl; }
66
+ get: function () { return chunkKQWWRWGB_cjs.RowModelImpl; }
67
67
  });
68
68
  Object.defineProperty(exports, "SchemaParser", {
69
69
  enumerable: true,
70
- get: function () { return chunk5WZ4YPH5_cjs.SchemaParser; }
70
+ get: function () { return chunkKQWWRWGB_cjs.SchemaParser; }
71
71
  });
72
72
  Object.defineProperty(exports, "StringValueNode", {
73
73
  enumerable: true,
74
- get: function () { return chunk5WZ4YPH5_cjs.StringValueNode; }
74
+ get: function () { return chunkKQWWRWGB_cjs.StringValueNode; }
75
75
  });
76
76
  Object.defineProperty(exports, "TableModelImpl", {
77
77
  enumerable: true,
78
- get: function () { return chunk5WZ4YPH5_cjs.TableModelImpl; }
78
+ get: function () { return chunkKQWWRWGB_cjs.TableModelImpl; }
79
79
  });
80
80
  Object.defineProperty(exports, "ValueNodeFactory", {
81
81
  enumerable: true,
82
- get: function () { return chunk5WZ4YPH5_cjs.NodeFactory2; }
82
+ get: function () { return chunkKQWWRWGB_cjs.NodeFactory2; }
83
83
  });
84
84
  Object.defineProperty(exports, "ValueType", {
85
85
  enumerable: true,
86
- get: function () { return chunk5WZ4YPH5_cjs.ValueType; }
86
+ get: function () { return chunkKQWWRWGB_cjs.ValueType; }
87
87
  });
88
88
  Object.defineProperty(exports, "createDataModel", {
89
89
  enumerable: true,
90
- get: function () { return chunk5WZ4YPH5_cjs.createDataModel; }
90
+ get: function () { return chunkKQWWRWGB_cjs.createDataModel; }
91
91
  });
92
92
  Object.defineProperty(exports, "createDefaultRegistry", {
93
93
  enumerable: true,
94
- get: function () { return chunk5WZ4YPH5_cjs.createDefaultRegistry; }
94
+ get: function () { return chunkKQWWRWGB_cjs.createDefaultRegistry; }
95
95
  });
96
96
  Object.defineProperty(exports, "createForeignKeyResolver", {
97
97
  enumerable: true,
98
- get: function () { return chunk5WZ4YPH5_cjs.createForeignKeyResolver; }
98
+ get: function () { return chunkKQWWRWGB_cjs.createForeignKeyResolver; }
99
99
  });
100
100
  Object.defineProperty(exports, "createNodeFactory", {
101
101
  enumerable: true,
102
- get: function () { return chunk5WZ4YPH5_cjs.createNodeFactory; }
102
+ get: function () { return chunkKQWWRWGB_cjs.createNodeFactory; }
103
103
  });
104
104
  Object.defineProperty(exports, "createSchemaModel", {
105
105
  enumerable: true,
106
- get: function () { return chunk5WZ4YPH5_cjs.createSchemaModel; }
106
+ get: function () { return chunkKQWWRWGB_cjs.createSchemaModel; }
107
107
  });
108
108
  Object.defineProperty(exports, "createTableModel", {
109
109
  enumerable: true,
110
- get: function () { return chunk5WZ4YPH5_cjs.createTableModel; }
110
+ get: function () { return chunkKQWWRWGB_cjs.createTableModel; }
111
111
  });
112
112
  Object.defineProperty(exports, "extractFormulaDefinition", {
113
113
  enumerable: true,
114
- get: function () { return chunk5WZ4YPH5_cjs.extractFormulaDefinition; }
114
+ get: function () { return chunkKQWWRWGB_cjs.extractFormulaDefinition; }
115
115
  });
116
116
  Object.defineProperty(exports, "generateDefaultValue", {
117
117
  enumerable: true,
118
- get: function () { return chunk5WZ4YPH5_cjs.generateDefaultValue; }
118
+ get: function () { return chunkKQWWRWGB_cjs.generateDefaultValue; }
119
119
  });
120
120
  Object.defineProperty(exports, "generateNodeId", {
121
121
  enumerable: true,
122
- get: function () { return chunk5WZ4YPH5_cjs.generateNodeId; }
122
+ get: function () { return chunkKQWWRWGB_cjs.generateNodeId; }
123
123
  });
124
124
  Object.defineProperty(exports, "isForeignKeyValueNode", {
125
125
  enumerable: true,
126
- get: function () { return chunk5WZ4YPH5_cjs.isForeignKeyValueNode; }
126
+ get: function () { return chunkKQWWRWGB_cjs.isForeignKeyValueNode; }
127
127
  });
128
128
  Object.defineProperty(exports, "resetNodeIdCounter", {
129
129
  enumerable: true,
130
- get: function () { return chunk5WZ4YPH5_cjs.resetNodeIdCounter; }
130
+ get: function () { return chunkKQWWRWGB_cjs.resetNodeIdCounter; }
131
131
  });
132
132
  Object.defineProperty(exports, "JsonArrayStore", {
133
133
  enumerable: true,
@@ -1,6 +1,6 @@
1
1
  import { h as JsonSchemaStore } from '../json-string.store-DKlkc1u_.cjs';
2
2
  export { A as AddedPropertyEvent, C as ChangeNameEvent, f as JsonArrayStore, m as JsonArrayValueStore, b as JsonBooleanStore, k as JsonBooleanValueStore, a as JsonNumberStore, j as JsonNumberValueStore, c as JsonObjectStore, l as JsonObjectValueStore, g as JsonSchemaStorePrimitives, J as JsonStringStore, i as JsonStringValueStore, p as JsonValueStore, o as JsonValueStoreParent, n as JsonValueStorePrimitives, d as MigrateItemsEvent, M as MigratePropertyEvent, R as RemovedPropertyEvent, e as ReplaceItemsEvent } from '../json-string.store-DKlkc1u_.cjs';
3
- import { S as SchemaNode, P as Path, N as NodeMetadata, c as SchemaPatch, J as JsonPatch, R as ReactivityAdapter, b as SchemaTree, D as Diagnostic } from '../types-CwJ2OWO_.cjs';
3
+ import { b as SchemaNode, P as Path, N as NodeMetadata, S as SchemaValidationError, F as FormulaValidationError, f as SchemaPatch, J as JsonPatch, R as ReactivityAdapter, c as SchemaTree, D as Diagnostic } from '../types-BWeurwlH.cjs';
4
4
  import { f as JsonObjectSchema, i as JsonSchema } from '../schema.types-ZX5fUW1X.cjs';
5
5
  import { d as JsonValuePatch } from '../json-value-patch.types-CjBpq5VF.cjs';
6
6
  import 'node:events';
@@ -27,8 +27,12 @@ interface ReactivityOptions {
27
27
  reactivity?: ReactivityAdapter;
28
28
  }
29
29
  type FieldType = 'string' | 'number' | 'boolean' | 'object' | 'array';
30
+ interface ReplaceResult {
31
+ replacedNodeId: string;
32
+ newNodeId: string;
33
+ }
30
34
  interface SchemaModel {
31
- root(): SchemaNode;
35
+ readonly root: SchemaNode;
32
36
  nodeById(id: string): SchemaNode;
33
37
  pathOf(id: string): Path;
34
38
  addField(parentId: string, name: string, type: FieldType): SchemaNode;
@@ -39,13 +43,23 @@ interface SchemaModel {
39
43
  updateFormula(nodeId: string, expression: string | undefined): void;
40
44
  updateForeignKey(nodeId: string, foreignKey: string | undefined): void;
41
45
  updateDefaultValue(nodeId: string, value: unknown): void;
42
- isDirty(): boolean;
43
- isValid(): boolean;
44
- getPatches(): SchemaPatch[];
45
- getJsonPatches(): JsonPatch[];
46
+ wrapInArray(nodeId: string): ReplaceResult | null;
47
+ wrapRootInArray(): ReplaceResult | null;
48
+ replaceRoot(newType: FieldType): ReplaceResult | null;
49
+ canMoveNode(nodeId: string, targetParentId: string): boolean;
50
+ hasValidDropTarget(nodeId: string): boolean;
51
+ getFormulaDependents(nodeId: string): readonly string[];
52
+ hasFormulaDependents(nodeId: string): boolean;
53
+ readonly validationErrors: SchemaValidationError[];
54
+ readonly formulaErrors: FormulaValidationError[];
55
+ readonly isDirty: boolean;
56
+ readonly isValid: boolean;
57
+ readonly patches: SchemaPatch[];
58
+ readonly jsonPatches: JsonPatch[];
46
59
  markAsSaved(): void;
47
60
  revert(): void;
48
- getPlainSchema(): JsonObjectSchema;
61
+ readonly plainSchema: JsonObjectSchema;
62
+ readonly nodeCount: number;
49
63
  generateDefaultValue(options?: {
50
64
  arrayItemCount?: number;
51
65
  }): unknown;
@@ -70,6 +84,7 @@ declare class SchemaParser {
70
84
  declare class NodeFactory$1 {
71
85
  createNode(name: string, type: FieldType): SchemaNode;
72
86
  private createArrayNode;
87
+ createArrayNodeWithItems(name: string, items: SchemaNode): SchemaNode;
73
88
  }
74
89
 
75
90
  interface RowData {
@@ -598,4 +613,4 @@ declare class ForeignKeyValueNodeImpl extends StringValueNode implements Foreign
598
613
  getSchema(): Promise<JsonObjectSchema>;
599
614
  }
600
615
 
601
- export { type ArrayNodeOptions, ArrayValueNode, type ArrayValueNode$1 as ArrayValueNodeInterface, BasePrimitiveValueNode, BaseValueNode, BooleanValueNode, type DataModel, DataModelImpl, type DataModelOptions, type DirtyTrackable, type FieldType, type ForeignKeyLoader, type ForeignKeyLoaderResult, ForeignKeyNotFoundError, type ForeignKeyResolver, ForeignKeyResolverImpl, ForeignKeyResolverNotConfiguredError, type ForeignKeyResolverOptions, type ForeignKeyRowLoaderResult, type ForeignKeyValueNode, ForeignKeyValueNodeImpl, type FormulaDefinition, type FormulaWarning, type GenerateDefaultValueOptions, JsonSchemaStore, NodeFactory$1 as NodeFactory, type NodeFactoryFn, type NodeFactoryOptions, NodeFactoryRegistry, NumberValueNode, type ObjectNodeOptions, ObjectValueNode, type ObjectValueNode$1 as ObjectValueNodeInterface, type PrimitiveNodeOptions, type PrimitiveValueNode, type ReactivityOptions, type RefSchemas, type RowData, type RowModel, RowModelImpl, type SchemaModel, SchemaParser, StringValueNode, type TableModel, TableModelImpl, type TableModelLike, type TableModelOptions, type ValueNode, NodeFactory as ValueNodeFactory, type ValueNodeOptions, type ValueTreeLike, ValueType, createDataModel, createDefaultRegistry, createForeignKeyResolver, createNodeFactory, createSchemaModel, createTableModel, equal, extractFormulaDefinition, fromArrayToObject, fromArrayTransformation, fromBooleanToNumber, fromBooleanToString, fromNumberToBoolean, fromNumberToString, fromObjectToArray, fromObjectToPrimitive, fromPrimitiveToObject, fromStringToBoolean, fromStringToNumber, generateDefaultValue, generateNodeId, getTransformation, isForeignKeyValueNode, resetNodeIdCounter, toArrayTransformation };
616
+ export { type ArrayNodeOptions, ArrayValueNode, type ArrayValueNode$1 as ArrayValueNodeInterface, BasePrimitiveValueNode, BaseValueNode, BooleanValueNode, type DataModel, DataModelImpl, type DataModelOptions, type DirtyTrackable, type FieldType, type ForeignKeyLoader, type ForeignKeyLoaderResult, ForeignKeyNotFoundError, type ForeignKeyResolver, ForeignKeyResolverImpl, ForeignKeyResolverNotConfiguredError, type ForeignKeyResolverOptions, type ForeignKeyRowLoaderResult, type ForeignKeyValueNode, ForeignKeyValueNodeImpl, type FormulaDefinition, type FormulaWarning, type GenerateDefaultValueOptions, JsonSchemaStore, NodeFactory$1 as NodeFactory, type NodeFactoryFn, type NodeFactoryOptions, NodeFactoryRegistry, NumberValueNode, type ObjectNodeOptions, ObjectValueNode, type ObjectValueNode$1 as ObjectValueNodeInterface, type PrimitiveNodeOptions, type PrimitiveValueNode, type ReactivityOptions, type RefSchemas, type ReplaceResult, type RowData, type RowModel, RowModelImpl, type SchemaModel, SchemaParser, StringValueNode, type TableModel, TableModelImpl, type TableModelLike, type TableModelOptions, type ValueNode, NodeFactory as ValueNodeFactory, type ValueNodeOptions, type ValueTreeLike, ValueType, createDataModel, createDefaultRegistry, createForeignKeyResolver, createNodeFactory, createSchemaModel, createTableModel, equal, extractFormulaDefinition, fromArrayToObject, fromArrayTransformation, fromBooleanToNumber, fromBooleanToString, fromNumberToBoolean, fromNumberToString, fromObjectToArray, fromObjectToPrimitive, fromPrimitiveToObject, fromStringToBoolean, fromStringToNumber, generateDefaultValue, generateNodeId, getTransformation, isForeignKeyValueNode, resetNodeIdCounter, toArrayTransformation };
@@ -1,6 +1,6 @@
1
1
  import { h as JsonSchemaStore } from '../json-string.store-DMrHPJ3v.js';
2
2
  export { A as AddedPropertyEvent, C as ChangeNameEvent, f as JsonArrayStore, m as JsonArrayValueStore, b as JsonBooleanStore, k as JsonBooleanValueStore, a as JsonNumberStore, j as JsonNumberValueStore, c as JsonObjectStore, l as JsonObjectValueStore, g as JsonSchemaStorePrimitives, J as JsonStringStore, i as JsonStringValueStore, p as JsonValueStore, o as JsonValueStoreParent, n as JsonValueStorePrimitives, d as MigrateItemsEvent, M as MigratePropertyEvent, R as RemovedPropertyEvent, e as ReplaceItemsEvent } from '../json-string.store-DMrHPJ3v.js';
3
- import { S as SchemaNode, P as Path, N as NodeMetadata, c as SchemaPatch, J as JsonPatch, R as ReactivityAdapter, b as SchemaTree, D as Diagnostic } from '../types-XDWz0V1v.js';
3
+ import { b as SchemaNode, P as Path, N as NodeMetadata, S as SchemaValidationError, F as FormulaValidationError, f as SchemaPatch, J as JsonPatch, R as ReactivityAdapter, c as SchemaTree, D as Diagnostic } from '../types-DmsYGLDX.js';
4
4
  import { f as JsonObjectSchema, i as JsonSchema } from '../schema.types-ZX5fUW1X.js';
5
5
  import { d as JsonValuePatch } from '../json-value-patch.types-U2y_ugm1.js';
6
6
  import 'node:events';
@@ -27,8 +27,12 @@ interface ReactivityOptions {
27
27
  reactivity?: ReactivityAdapter;
28
28
  }
29
29
  type FieldType = 'string' | 'number' | 'boolean' | 'object' | 'array';
30
+ interface ReplaceResult {
31
+ replacedNodeId: string;
32
+ newNodeId: string;
33
+ }
30
34
  interface SchemaModel {
31
- root(): SchemaNode;
35
+ readonly root: SchemaNode;
32
36
  nodeById(id: string): SchemaNode;
33
37
  pathOf(id: string): Path;
34
38
  addField(parentId: string, name: string, type: FieldType): SchemaNode;
@@ -39,13 +43,23 @@ interface SchemaModel {
39
43
  updateFormula(nodeId: string, expression: string | undefined): void;
40
44
  updateForeignKey(nodeId: string, foreignKey: string | undefined): void;
41
45
  updateDefaultValue(nodeId: string, value: unknown): void;
42
- isDirty(): boolean;
43
- isValid(): boolean;
44
- getPatches(): SchemaPatch[];
45
- getJsonPatches(): JsonPatch[];
46
+ wrapInArray(nodeId: string): ReplaceResult | null;
47
+ wrapRootInArray(): ReplaceResult | null;
48
+ replaceRoot(newType: FieldType): ReplaceResult | null;
49
+ canMoveNode(nodeId: string, targetParentId: string): boolean;
50
+ hasValidDropTarget(nodeId: string): boolean;
51
+ getFormulaDependents(nodeId: string): readonly string[];
52
+ hasFormulaDependents(nodeId: string): boolean;
53
+ readonly validationErrors: SchemaValidationError[];
54
+ readonly formulaErrors: FormulaValidationError[];
55
+ readonly isDirty: boolean;
56
+ readonly isValid: boolean;
57
+ readonly patches: SchemaPatch[];
58
+ readonly jsonPatches: JsonPatch[];
46
59
  markAsSaved(): void;
47
60
  revert(): void;
48
- getPlainSchema(): JsonObjectSchema;
61
+ readonly plainSchema: JsonObjectSchema;
62
+ readonly nodeCount: number;
49
63
  generateDefaultValue(options?: {
50
64
  arrayItemCount?: number;
51
65
  }): unknown;
@@ -70,6 +84,7 @@ declare class SchemaParser {
70
84
  declare class NodeFactory$1 {
71
85
  createNode(name: string, type: FieldType): SchemaNode;
72
86
  private createArrayNode;
87
+ createArrayNodeWithItems(name: string, items: SchemaNode): SchemaNode;
73
88
  }
74
89
 
75
90
  interface RowData {
@@ -598,4 +613,4 @@ declare class ForeignKeyValueNodeImpl extends StringValueNode implements Foreign
598
613
  getSchema(): Promise<JsonObjectSchema>;
599
614
  }
600
615
 
601
- export { type ArrayNodeOptions, ArrayValueNode, type ArrayValueNode$1 as ArrayValueNodeInterface, BasePrimitiveValueNode, BaseValueNode, BooleanValueNode, type DataModel, DataModelImpl, type DataModelOptions, type DirtyTrackable, type FieldType, type ForeignKeyLoader, type ForeignKeyLoaderResult, ForeignKeyNotFoundError, type ForeignKeyResolver, ForeignKeyResolverImpl, ForeignKeyResolverNotConfiguredError, type ForeignKeyResolverOptions, type ForeignKeyRowLoaderResult, type ForeignKeyValueNode, ForeignKeyValueNodeImpl, type FormulaDefinition, type FormulaWarning, type GenerateDefaultValueOptions, JsonSchemaStore, NodeFactory$1 as NodeFactory, type NodeFactoryFn, type NodeFactoryOptions, NodeFactoryRegistry, NumberValueNode, type ObjectNodeOptions, ObjectValueNode, type ObjectValueNode$1 as ObjectValueNodeInterface, type PrimitiveNodeOptions, type PrimitiveValueNode, type ReactivityOptions, type RefSchemas, type RowData, type RowModel, RowModelImpl, type SchemaModel, SchemaParser, StringValueNode, type TableModel, TableModelImpl, type TableModelLike, type TableModelOptions, type ValueNode, NodeFactory as ValueNodeFactory, type ValueNodeOptions, type ValueTreeLike, ValueType, createDataModel, createDefaultRegistry, createForeignKeyResolver, createNodeFactory, createSchemaModel, createTableModel, equal, extractFormulaDefinition, fromArrayToObject, fromArrayTransformation, fromBooleanToNumber, fromBooleanToString, fromNumberToBoolean, fromNumberToString, fromObjectToArray, fromObjectToPrimitive, fromPrimitiveToObject, fromStringToBoolean, fromStringToNumber, generateDefaultValue, generateNodeId, getTransformation, isForeignKeyValueNode, resetNodeIdCounter, toArrayTransformation };
616
+ export { type ArrayNodeOptions, ArrayValueNode, type ArrayValueNode$1 as ArrayValueNodeInterface, BasePrimitiveValueNode, BaseValueNode, BooleanValueNode, type DataModel, DataModelImpl, type DataModelOptions, type DirtyTrackable, type FieldType, type ForeignKeyLoader, type ForeignKeyLoaderResult, ForeignKeyNotFoundError, type ForeignKeyResolver, ForeignKeyResolverImpl, ForeignKeyResolverNotConfiguredError, type ForeignKeyResolverOptions, type ForeignKeyRowLoaderResult, type ForeignKeyValueNode, ForeignKeyValueNodeImpl, type FormulaDefinition, type FormulaWarning, type GenerateDefaultValueOptions, JsonSchemaStore, NodeFactory$1 as NodeFactory, type NodeFactoryFn, type NodeFactoryOptions, NodeFactoryRegistry, NumberValueNode, type ObjectNodeOptions, ObjectValueNode, type ObjectValueNode$1 as ObjectValueNodeInterface, type PrimitiveNodeOptions, type PrimitiveValueNode, type ReactivityOptions, type RefSchemas, type ReplaceResult, type RowData, type RowModel, RowModelImpl, type SchemaModel, SchemaParser, StringValueNode, type TableModel, TableModelImpl, type TableModelLike, type TableModelOptions, type ValueNode, NodeFactory as ValueNodeFactory, type ValueNodeOptions, type ValueTreeLike, ValueType, createDataModel, createDefaultRegistry, createForeignKeyResolver, createNodeFactory, createSchemaModel, createTableModel, equal, extractFormulaDefinition, fromArrayToObject, fromArrayTransformation, fromBooleanToNumber, fromBooleanToString, fromNumberToBoolean, fromNumberToString, fromObjectToArray, fromObjectToPrimitive, fromPrimitiveToObject, fromStringToBoolean, fromStringToNumber, generateDefaultValue, generateNodeId, getTransformation, isForeignKeyValueNode, resetNodeIdCounter, toArrayTransformation };
@@ -1,5 +1,5 @@
1
- export { ArrayValueNode, BasePrimitiveValueNode, BaseValueNode, BooleanValueNode, DataModelImpl, ForeignKeyNotFoundError, ForeignKeyResolverImpl, ForeignKeyResolverNotConfiguredError, ForeignKeyValueNodeImpl, NodeFactory, NodeFactoryRegistry, NumberValueNode, ObjectValueNode, RowModelImpl, SchemaParser, StringValueNode, TableModelImpl, NodeFactory2 as ValueNodeFactory, ValueType, createDataModel, createDefaultRegistry, createForeignKeyResolver, createNodeFactory, createSchemaModel, createTableModel, extractFormulaDefinition, generateDefaultValue, generateNodeId, isForeignKeyValueNode, resetNodeIdCounter } from '../chunk-OP35BPMU.js';
2
- import '../chunk-F4UBBZAL.js';
1
+ export { ArrayValueNode, BasePrimitiveValueNode, BaseValueNode, BooleanValueNode, DataModelImpl, ForeignKeyNotFoundError, ForeignKeyResolverImpl, ForeignKeyResolverNotConfiguredError, ForeignKeyValueNodeImpl, NodeFactory, NodeFactoryRegistry, NumberValueNode, ObjectValueNode, RowModelImpl, SchemaParser, StringValueNode, TableModelImpl, NodeFactory2 as ValueNodeFactory, ValueType, createDataModel, createDefaultRegistry, createForeignKeyResolver, createNodeFactory, createSchemaModel, createTableModel, extractFormulaDefinition, generateDefaultValue, generateNodeId, isForeignKeyValueNode, resetNodeIdCounter } from '../chunk-KTCH6INZ.js';
2
+ import '../chunk-S7GEDTSL.js';
3
3
  import '../chunk-3IKI64T2.js';
4
4
  export { JsonArrayStore, JsonArrayValueStore, JsonBooleanStore, JsonBooleanValueStore, JsonNumberStore, JsonNumberValueStore, JsonObjectStore, JsonObjectValueStore, JsonStringStore, JsonStringValueStore, equal, fromArrayToObject, fromArrayTransformation, fromBooleanToNumber, fromBooleanToString, fromNumberToBoolean, fromNumberToString, fromObjectToArray, fromObjectToPrimitive, fromPrimitiveToObject, fromStringToBoolean, fromStringToNumber, getTransformation, toArrayTransformation } from '../chunk-HY4VE7H2.js';
5
5
  import '../chunk-ZBPUTF3Q.js';
@@ -58,6 +58,7 @@ interface SchemaNode {
58
58
  setMetadata(metadata: NodeMetadata): void;
59
59
  addChild(node: SchemaNode): void;
60
60
  removeChild(name: string): boolean;
61
+ replaceChild(name: string, node: SchemaNode): boolean;
61
62
  setItems(node: SchemaNode): void;
62
63
  setDefaultValue(value: unknown): void;
63
64
  setFormula(formula: Formula | undefined): void;
@@ -104,6 +105,7 @@ interface SchemaTree {
104
105
  renameNode(nodeId: string, newName: string): void;
105
106
  moveNode(nodeId: string, newParentId: string): void;
106
107
  setNodeAt(path: Path, node: SchemaNode): void;
108
+ replaceRoot(newRoot: SchemaNode): void;
107
109
  }
108
110
 
109
111
  interface JsonPatch {
@@ -145,6 +147,19 @@ interface SchemaPatch {
145
147
  isRename?: boolean;
146
148
  }
147
149
 
150
+ type SchemaValidationErrorType = 'empty-name' | 'duplicate-name' | 'invalid-name';
151
+ interface SchemaValidationError {
152
+ nodeId: string;
153
+ type: SchemaValidationErrorType;
154
+ message: string;
155
+ }
156
+
157
+ interface FormulaValidationError {
158
+ nodeId: string;
159
+ message: string;
160
+ fieldPath?: string;
161
+ }
162
+
148
163
  type DiagnosticSeverity = 'error' | 'warning';
149
164
  interface Diagnostic {
150
165
  readonly severity: DiagnosticSeverity;
@@ -180,4 +195,4 @@ interface ValidatorRule {
180
195
  }
181
196
  type ValidatorFactoryFn = () => Validator;
182
197
 
183
- export { type AnnotationType as A, type Diagnostic as D, EMPTY_METADATA as E, type Formula as F, type JsonPatch as J, type NodeMetadata as N, type Path as P, type ReactivityAdapter as R, type SchemaNode as S, type ValidatorFactoryFn as V, type PathSegment as a, type SchemaTree as b, type SchemaPatch as c, type ValidatorRule as d, type Validator as e, type ValidationContext as f, type SchemaLike as g, type AnnotationsMap as h, type DiagnosticSeverity as i, type NodeType as j, type DefaultValueType as k };
198
+ export { type AnnotationType as A, type Diagnostic as D, EMPTY_METADATA as E, type FormulaValidationError as F, type JsonPatch as J, type NodeMetadata as N, type Path as P, type ReactivityAdapter as R, type SchemaValidationError as S, type ValidatorFactoryFn as V, type SchemaValidationErrorType as a, type SchemaNode as b, type SchemaTree as c, type Formula as d, type PathSegment as e, type SchemaPatch as f, type ValidatorRule as g, type Validator as h, type ValidationContext as i, type SchemaLike as j, type AnnotationsMap as k, type DiagnosticSeverity as l, type NodeType as m, type DefaultValueType as n };
@@ -58,6 +58,7 @@ interface SchemaNode {
58
58
  setMetadata(metadata: NodeMetadata): void;
59
59
  addChild(node: SchemaNode): void;
60
60
  removeChild(name: string): boolean;
61
+ replaceChild(name: string, node: SchemaNode): boolean;
61
62
  setItems(node: SchemaNode): void;
62
63
  setDefaultValue(value: unknown): void;
63
64
  setFormula(formula: Formula | undefined): void;
@@ -104,6 +105,7 @@ interface SchemaTree {
104
105
  renameNode(nodeId: string, newName: string): void;
105
106
  moveNode(nodeId: string, newParentId: string): void;
106
107
  setNodeAt(path: Path, node: SchemaNode): void;
108
+ replaceRoot(newRoot: SchemaNode): void;
107
109
  }
108
110
 
109
111
  interface JsonPatch {
@@ -145,6 +147,19 @@ interface SchemaPatch {
145
147
  isRename?: boolean;
146
148
  }
147
149
 
150
+ type SchemaValidationErrorType = 'empty-name' | 'duplicate-name' | 'invalid-name';
151
+ interface SchemaValidationError {
152
+ nodeId: string;
153
+ type: SchemaValidationErrorType;
154
+ message: string;
155
+ }
156
+
157
+ interface FormulaValidationError {
158
+ nodeId: string;
159
+ message: string;
160
+ fieldPath?: string;
161
+ }
162
+
148
163
  type DiagnosticSeverity = 'error' | 'warning';
149
164
  interface Diagnostic {
150
165
  readonly severity: DiagnosticSeverity;
@@ -180,4 +195,4 @@ interface ValidatorRule {
180
195
  }
181
196
  type ValidatorFactoryFn = () => Validator;
182
197
 
183
- export { type AnnotationType as A, type Diagnostic as D, EMPTY_METADATA as E, type Formula as F, type JsonPatch as J, type NodeMetadata as N, type Path as P, type ReactivityAdapter as R, type SchemaNode as S, type ValidatorFactoryFn as V, type PathSegment as a, type SchemaTree as b, type SchemaPatch as c, type ValidatorRule as d, type Validator as e, type ValidationContext as f, type SchemaLike as g, type AnnotationsMap as h, type DiagnosticSeverity as i, type NodeType as j, type DefaultValueType as k };
198
+ export { type AnnotationType as A, type Diagnostic as D, EMPTY_METADATA as E, type FormulaValidationError as F, type JsonPatch as J, type NodeMetadata as N, type Path as P, type ReactivityAdapter as R, type SchemaValidationError as S, type ValidatorFactoryFn as V, type SchemaValidationErrorType as a, type SchemaNode as b, type SchemaTree as c, type Formula as d, type PathSegment as e, type SchemaPatch as f, type ValidatorRule as g, type Validator as h, type ValidationContext as i, type SchemaLike as j, type AnnotationsMap as k, type DiagnosticSeverity as l, type NodeType as m, type DefaultValueType as n };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revisium/schema-toolkit",
3
- "version": "0.15.0",
3
+ "version": "0.16.1",
4
4
  "description": "Universal schema toolkit with TypeScript types and utilities for JSON Schema manipulation",
5
5
  "keywords": [
6
6
  "json-schema",
@@ -177,6 +177,7 @@
177
177
  "eslint": "^9.15.0",
178
178
  "globals": "^15.12.0",
179
179
  "jest": "^29.7.0",
180
+ "mobx": "^6.15.0",
180
181
  "prettier": "^3.4.2",
181
182
  "ts-jest": "^29.2.5",
182
183
  "tsup": "^8.3.5",