@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.
Files changed (83) hide show
  1. package/dist/{chunk-IWRV6QAD.cjs → chunk-44ZEZUWU.cjs} +419 -86
  2. package/dist/chunk-44ZEZUWU.cjs.map +1 -0
  3. package/dist/{chunk-HY4VE7H2.js → chunk-55AMH44G.js} +3 -3
  4. package/dist/chunk-55AMH44G.js.map +1 -0
  5. package/dist/{chunk-TMWPWGUN.cjs → chunk-B3T6YB2D.cjs} +6 -6
  6. package/dist/chunk-B3T6YB2D.cjs.map +1 -0
  7. package/dist/{chunk-GAPLSVZN.cjs → chunk-J6SCHJKG.cjs} +2 -2
  8. package/dist/chunk-J6SCHJKG.cjs.map +1 -0
  9. package/dist/chunk-JJ2KGTZX.cjs +105 -0
  10. package/dist/chunk-JJ2KGTZX.cjs.map +1 -0
  11. package/dist/{chunk-S7GEDTSL.js → chunk-KLDN3IHB.js} +408 -88
  12. package/dist/chunk-KLDN3IHB.js.map +1 -0
  13. package/dist/chunk-MLNKM67U.cjs +4 -0
  14. package/dist/chunk-MLNKM67U.cjs.map +1 -0
  15. package/dist/{chunk-CYTPQYVM.js → chunk-MPF6VCB5.js} +2 -2
  16. package/dist/chunk-MPF6VCB5.js.map +1 -0
  17. package/dist/{chunk-KQWWRWGB.cjs → chunk-OY5NX5DZ.cjs} +216 -279
  18. package/dist/chunk-OY5NX5DZ.cjs.map +1 -0
  19. package/dist/{chunk-2NRQPOQY.js → chunk-QEV4Q4TR.js} +3 -3
  20. package/dist/{chunk-2NRQPOQY.js.map → chunk-QEV4Q4TR.js.map} +1 -1
  21. package/dist/{chunk-XS47N22X.cjs → chunk-V6JTSET2.cjs} +13 -13
  22. package/dist/{chunk-XS47N22X.cjs.map → chunk-V6JTSET2.cjs.map} +1 -1
  23. package/dist/{chunk-KTCH6INZ.js → chunk-VQZNN335.js} +200 -263
  24. package/dist/chunk-VQZNN335.js.map +1 -0
  25. package/dist/chunk-Y2GYABV7.js +3 -0
  26. package/dist/chunk-Y2GYABV7.js.map +1 -0
  27. package/dist/chunk-YGTMLR3D.js +88 -0
  28. package/dist/chunk-YGTMLR3D.js.map +1 -0
  29. package/dist/core/index.cjs +84 -70
  30. package/dist/core/index.cjs.map +1 -1
  31. package/dist/core/index.d.cts +69 -7
  32. package/dist/core/index.d.ts +69 -7
  33. package/dist/core/index.js +3 -24
  34. package/dist/core/index.js.map +1 -1
  35. package/dist/formula/index.d.cts +1 -1
  36. package/dist/formula/index.d.ts +1 -1
  37. package/dist/index.cjs +373 -112
  38. package/dist/index.d.cts +10 -10
  39. package/dist/index.d.ts +10 -10
  40. package/dist/index.js +7 -6
  41. package/dist/{json-patch.types-eltVqnWC.d.cts → json-patch.types-Cu0Medki.d.cts} +1 -1
  42. package/dist/{json-patch.types-DTUHS9SV.d.ts → json-patch.types-DY7k9hxy.d.ts} +1 -1
  43. package/dist/{json-string.store-DKlkc1u_.d.cts → json-string.store-DOZn38CI.d.cts} +2 -2
  44. package/dist/{json-string.store-DMrHPJ3v.d.ts → json-string.store-DRmQFKrp.d.ts} +2 -2
  45. package/dist/lib/index.cjs +40 -40
  46. package/dist/lib/index.d.cts +4 -4
  47. package/dist/lib/index.d.ts +4 -4
  48. package/dist/lib/index.js +3 -3
  49. package/dist/mocks/index.cjs +36 -12
  50. package/dist/mocks/index.d.cts +28 -9
  51. package/dist/mocks/index.d.ts +28 -9
  52. package/dist/mocks/index.js +2 -2
  53. package/dist/model/index.cjs +86 -58
  54. package/dist/model/index.d.cts +108 -40
  55. package/dist/model/index.d.ts +108 -40
  56. package/dist/model/index.js +4 -4
  57. package/dist/plugins/index.cjs +1 -1
  58. package/dist/plugins/index.d.cts +9 -9
  59. package/dist/plugins/index.d.ts +9 -9
  60. package/dist/plugins/index.js +1 -1
  61. package/dist/{schema.types-ZX5fUW1X.d.cts → schema.types-B5OgKLpV.d.cts} +3 -2
  62. package/dist/{schema.types-ZX5fUW1X.d.ts → schema.types-B5OgKLpV.d.ts} +3 -2
  63. package/dist/types/index.cjs +2 -2
  64. package/dist/types/index.d.cts +4 -4
  65. package/dist/types/index.d.ts +4 -4
  66. package/dist/types/index.js +1 -1
  67. package/dist/{types-DmsYGLDX.d.ts → types-BUiNI0oL.d.cts} +18 -23
  68. package/dist/{types-BWeurwlH.d.cts → types-bBnnfNxC.d.ts} +18 -23
  69. package/package.json +3 -1
  70. package/dist/FormulaValidator-Bl6lav9r.d.ts +0 -10
  71. package/dist/FormulaValidator-DTT8T1OM.d.cts +0 -10
  72. package/dist/chunk-AORPUIKD.js +0 -81
  73. package/dist/chunk-AORPUIKD.js.map +0 -1
  74. package/dist/chunk-CYTPQYVM.js.map +0 -1
  75. package/dist/chunk-EJYILFAK.cjs +0 -92
  76. package/dist/chunk-EJYILFAK.cjs.map +0 -1
  77. package/dist/chunk-GAPLSVZN.cjs.map +0 -1
  78. package/dist/chunk-HY4VE7H2.js.map +0 -1
  79. package/dist/chunk-IWRV6QAD.cjs.map +0 -1
  80. package/dist/chunk-KQWWRWGB.cjs.map +0 -1
  81. package/dist/chunk-KTCH6INZ.js.map +0 -1
  82. package/dist/chunk-S7GEDTSL.js.map +0 -1
  83. package/dist/chunk-TMWPWGUN.cjs.map +0 -1
@@ -1,22 +1,14 @@
1
1
  import { ASTNode } from '@revisium/formula';
2
- import { i as JsonSchema } from './schema.types-ZX5fUW1X.js';
3
-
4
- type AnnotationType = 'observable' | 'observable.ref' | 'computed' | 'action';
5
- type AnnotationsMap<T> = {
6
- [K in keyof T]?: AnnotationType;
7
- };
8
-
9
- interface ReactivityAdapter {
10
- makeObservable<T extends object>(target: T, annotations: AnnotationsMap<T>): void;
11
- observableArray<T>(): T[];
12
- observableMap<K, V>(): Map<K, V>;
13
- reaction<T>(expression: () => T, effect: (value: T) => void): () => void;
14
- runInAction<T>(fn: () => T): T;
15
- }
2
+ import { h as JsonPatch } from './json-patch.types-Cu0Medki.cjs';
16
3
 
17
4
  interface FormulaDependency {
18
5
  targetNodeId(): string;
19
6
  }
7
+ declare class ResolvedDependency implements FormulaDependency {
8
+ private readonly nodeId;
9
+ constructor(nodeId: string);
10
+ targetNodeId(): string;
11
+ }
20
12
 
21
13
  interface Formula$1 {
22
14
  version(): number;
@@ -53,6 +45,7 @@ interface SchemaNode {
53
45
  hasFormula(): boolean;
54
46
  defaultValue(): unknown;
55
47
  foreignKey(): string | undefined;
48
+ contentMediaType(): string | undefined;
56
49
  clone(): SchemaNode;
57
50
  setName(name: string): void;
58
51
  setMetadata(metadata: NodeMetadata): void;
@@ -63,6 +56,7 @@ interface SchemaNode {
63
56
  setDefaultValue(value: unknown): void;
64
57
  setFormula(formula: Formula | undefined): void;
65
58
  setForeignKey(key: string | undefined): void;
59
+ setContentMediaType(mediaType: string | undefined): void;
66
60
  }
67
61
 
68
62
  interface BasePathSegment {
@@ -108,16 +102,12 @@ interface SchemaTree {
108
102
  replaceRoot(newRoot: SchemaNode): void;
109
103
  }
110
104
 
111
- interface JsonPatch {
112
- op: 'add' | 'remove' | 'replace' | 'move';
113
- path: string;
114
- from?: string;
115
- value?: JsonSchema;
116
- }
117
105
  type DefaultValueType = string | number | boolean | undefined;
106
+ type MetadataChangeType = 'formula' | 'description' | 'deprecated' | 'foreignKey' | 'default' | 'enum' | 'format' | 'contentMediaType';
118
107
  interface SchemaPatch {
119
108
  patch: JsonPatch;
120
109
  fieldName: string;
110
+ metadataChanges: MetadataChangeType[];
121
111
  typeChange?: {
122
112
  fromType: string;
123
113
  toType: string;
@@ -144,17 +134,22 @@ interface SchemaPatch {
144
134
  fromForeignKey: string | undefined;
145
135
  toForeignKey: string | undefined;
146
136
  };
137
+ contentMediaTypeChange?: {
138
+ fromContentMediaType: string | undefined;
139
+ toContentMediaType: string | undefined;
140
+ };
147
141
  isRename?: boolean;
142
+ movesIntoArray?: boolean;
148
143
  }
149
144
 
150
- type SchemaValidationErrorType = 'empty-name' | 'duplicate-name' | 'invalid-name';
145
+ type SchemaValidationErrorType = 'empty-name' | 'duplicate-name' | 'invalid-name' | 'empty-foreign-key';
151
146
  interface SchemaValidationError {
152
147
  nodeId: string;
153
148
  type: SchemaValidationErrorType;
154
149
  message: string;
155
150
  }
156
151
 
157
- interface FormulaValidationError {
152
+ interface TreeFormulaValidationError {
158
153
  nodeId: string;
159
154
  message: string;
160
155
  fieldPath?: string;
@@ -195,4 +190,4 @@ interface ValidatorRule {
195
190
  }
196
191
  type ValidatorFactoryFn = () => Validator;
197
192
 
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 };
193
+ export { type Diagnostic as D, EMPTY_METADATA as E, type FormulaDependency as F, type MetadataChangeType as M, type NodeType as N, type Path as P, ResolvedDependency as R, type SchemaLike as S, type TreeFormulaValidationError as T, type ValidationContext as V, type PathSegment as a, type DiagnosticSeverity as b, type Validator as c, type ValidatorRule as d, type ValidatorFactoryFn as e, type SchemaValidationError as f, type SchemaValidationErrorType as g, type NodeMetadata as h, type Formula as i, type SchemaNode as j, type SchemaTree as k, type SchemaPatch as l, type DefaultValueType as m, type Formula$1 as n };
@@ -1,22 +1,14 @@
1
1
  import { ASTNode } from '@revisium/formula';
2
- import { i as JsonSchema } from './schema.types-ZX5fUW1X.cjs';
3
-
4
- type AnnotationType = 'observable' | 'observable.ref' | 'computed' | 'action';
5
- type AnnotationsMap<T> = {
6
- [K in keyof T]?: AnnotationType;
7
- };
8
-
9
- interface ReactivityAdapter {
10
- makeObservable<T extends object>(target: T, annotations: AnnotationsMap<T>): void;
11
- observableArray<T>(): T[];
12
- observableMap<K, V>(): Map<K, V>;
13
- reaction<T>(expression: () => T, effect: (value: T) => void): () => void;
14
- runInAction<T>(fn: () => T): T;
15
- }
2
+ import { h as JsonPatch } from './json-patch.types-DY7k9hxy.js';
16
3
 
17
4
  interface FormulaDependency {
18
5
  targetNodeId(): string;
19
6
  }
7
+ declare class ResolvedDependency implements FormulaDependency {
8
+ private readonly nodeId;
9
+ constructor(nodeId: string);
10
+ targetNodeId(): string;
11
+ }
20
12
 
21
13
  interface Formula$1 {
22
14
  version(): number;
@@ -53,6 +45,7 @@ interface SchemaNode {
53
45
  hasFormula(): boolean;
54
46
  defaultValue(): unknown;
55
47
  foreignKey(): string | undefined;
48
+ contentMediaType(): string | undefined;
56
49
  clone(): SchemaNode;
57
50
  setName(name: string): void;
58
51
  setMetadata(metadata: NodeMetadata): void;
@@ -63,6 +56,7 @@ interface SchemaNode {
63
56
  setDefaultValue(value: unknown): void;
64
57
  setFormula(formula: Formula | undefined): void;
65
58
  setForeignKey(key: string | undefined): void;
59
+ setContentMediaType(mediaType: string | undefined): void;
66
60
  }
67
61
 
68
62
  interface BasePathSegment {
@@ -108,16 +102,12 @@ interface SchemaTree {
108
102
  replaceRoot(newRoot: SchemaNode): void;
109
103
  }
110
104
 
111
- interface JsonPatch {
112
- op: 'add' | 'remove' | 'replace' | 'move';
113
- path: string;
114
- from?: string;
115
- value?: JsonSchema;
116
- }
117
105
  type DefaultValueType = string | number | boolean | undefined;
106
+ type MetadataChangeType = 'formula' | 'description' | 'deprecated' | 'foreignKey' | 'default' | 'enum' | 'format' | 'contentMediaType';
118
107
  interface SchemaPatch {
119
108
  patch: JsonPatch;
120
109
  fieldName: string;
110
+ metadataChanges: MetadataChangeType[];
121
111
  typeChange?: {
122
112
  fromType: string;
123
113
  toType: string;
@@ -144,17 +134,22 @@ interface SchemaPatch {
144
134
  fromForeignKey: string | undefined;
145
135
  toForeignKey: string | undefined;
146
136
  };
137
+ contentMediaTypeChange?: {
138
+ fromContentMediaType: string | undefined;
139
+ toContentMediaType: string | undefined;
140
+ };
147
141
  isRename?: boolean;
142
+ movesIntoArray?: boolean;
148
143
  }
149
144
 
150
- type SchemaValidationErrorType = 'empty-name' | 'duplicate-name' | 'invalid-name';
145
+ type SchemaValidationErrorType = 'empty-name' | 'duplicate-name' | 'invalid-name' | 'empty-foreign-key';
151
146
  interface SchemaValidationError {
152
147
  nodeId: string;
153
148
  type: SchemaValidationErrorType;
154
149
  message: string;
155
150
  }
156
151
 
157
- interface FormulaValidationError {
152
+ interface TreeFormulaValidationError {
158
153
  nodeId: string;
159
154
  message: string;
160
155
  fieldPath?: string;
@@ -195,4 +190,4 @@ interface ValidatorRule {
195
190
  }
196
191
  type ValidatorFactoryFn = () => Validator;
197
192
 
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 };
193
+ export { type Diagnostic as D, EMPTY_METADATA as E, type FormulaDependency as F, type MetadataChangeType as M, type NodeType as N, type Path as P, ResolvedDependency as R, type SchemaLike as S, type TreeFormulaValidationError as T, type ValidationContext as V, type PathSegment as a, type DiagnosticSeverity as b, type Validator as c, type ValidatorRule as d, type ValidatorFactoryFn as e, type SchemaValidationError as f, type SchemaValidationErrorType as g, type NodeMetadata as h, type Formula as i, type SchemaNode as j, type SchemaTree as k, type SchemaPatch as l, type DefaultValueType as m, type Formula$1 as n };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revisium/schema-toolkit",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Universal schema toolkit with TypeScript types and utilities for JSON Schema manipulation",
5
5
  "keywords": [
6
6
  "json-schema",
@@ -180,12 +180,14 @@
180
180
  "mobx": "^6.15.0",
181
181
  "prettier": "^3.4.2",
182
182
  "ts-jest": "^29.2.5",
183
+ "tslib": "^2.8.1",
183
184
  "tsup": "^8.3.5",
184
185
  "typescript": "^5.7.2",
185
186
  "typescript-eslint": "^8.15.0"
186
187
  },
187
188
  "dependencies": {
188
189
  "@revisium/formula": "^0.10.0",
190
+ "eventemitter3": "^5.0.4",
189
191
  "nanoid": "^3.3.7"
190
192
  },
191
193
  "engines": {
@@ -1,10 +0,0 @@
1
- import { b as SchemaNode, S as SchemaValidationError, c as SchemaTree, F as FormulaValidationError } from './types-DmsYGLDX.js';
2
-
3
- declare function validateSchema(root: SchemaNode): SchemaValidationError[];
4
-
5
- declare const FIELD_NAME_ERROR_MESSAGE = "Must start with a letter or underscore, cannot start with __, and can only include letters, numbers, hyphens, and underscores (max 64 chars)";
6
- declare function isValidFieldName(name: string): boolean;
7
-
8
- declare function validateFormulas(tree: SchemaTree): FormulaValidationError[];
9
-
10
- export { FIELD_NAME_ERROR_MESSAGE as F, validateFormulas as a, isValidFieldName as i, validateSchema as v };
@@ -1,10 +0,0 @@
1
- import { b as SchemaNode, S as SchemaValidationError, c as SchemaTree, F as FormulaValidationError } from './types-BWeurwlH.cjs';
2
-
3
- declare function validateSchema(root: SchemaNode): SchemaValidationError[];
4
-
5
- declare const FIELD_NAME_ERROR_MESSAGE = "Must start with a letter or underscore, cannot start with __, and can only include letters, numbers, hyphens, and underscores (max 64 chars)";
6
- declare function isValidFieldName(name: string): boolean;
7
-
8
- declare function validateFormulas(tree: SchemaTree): FormulaValidationError[];
9
-
10
- export { FIELD_NAME_ERROR_MESSAGE as F, validateFormulas as a, isValidFieldName as i, validateSchema as v };
@@ -1,81 +0,0 @@
1
- // src/mocks/schema.mocks.ts
2
- var getReplacePatch = ({
3
- path,
4
- value
5
- }) => ({
6
- op: "replace",
7
- path,
8
- value
9
- });
10
- var getRemovePatch = ({
11
- path
12
- }) => ({
13
- op: "remove",
14
- path
15
- });
16
- var getAddPatch = ({
17
- path,
18
- value
19
- }) => ({
20
- op: "add",
21
- path,
22
- value
23
- });
24
- var getMovePatch = ({
25
- from,
26
- path
27
- }) => ({
28
- op: "move",
29
- from,
30
- path
31
- });
32
- var getStringSchema = (params = {}) => {
33
- const schema = {
34
- type: "string" /* String */,
35
- default: params.default ?? ""
36
- };
37
- if (params.foreignKey) {
38
- schema.foreignKey = params.foreignKey;
39
- }
40
- if (params.readOnly) {
41
- schema.readOnly = params.readOnly;
42
- }
43
- return schema;
44
- };
45
- var getNumberSchema = (defaultValue = 0, readOnly) => {
46
- const schema = {
47
- type: "number" /* Number */,
48
- default: defaultValue
49
- };
50
- if (readOnly) {
51
- schema.readOnly = readOnly;
52
- }
53
- return schema;
54
- };
55
- var getBooleanSchema = (defaultValue = false, readOnly) => {
56
- const schema = {
57
- type: "boolean" /* Boolean */,
58
- default: defaultValue
59
- };
60
- if (readOnly) {
61
- schema.readOnly = readOnly;
62
- }
63
- return schema;
64
- };
65
- var getObjectSchema = (properties) => ({
66
- type: "object" /* Object */,
67
- additionalProperties: false,
68
- required: Object.keys(properties).sort((a, b) => a.localeCompare(b)),
69
- properties
70
- });
71
- var getArraySchema = (items) => ({
72
- type: "array" /* Array */,
73
- items
74
- });
75
- var getRefSchema = ($ref) => ({
76
- $ref
77
- });
78
-
79
- export { getAddPatch, getArraySchema, getBooleanSchema, getMovePatch, getNumberSchema, getObjectSchema, getRefSchema, getRemovePatch, getReplacePatch, getStringSchema };
80
- //# sourceMappingURL=chunk-AORPUIKD.js.map
81
- //# sourceMappingURL=chunk-AORPUIKD.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/mocks/schema.mocks.ts"],"names":[],"mappings":";AAiBO,IAAM,kBAAkB,CAAC;AAAA,EAC9B,IAAA;AAAA,EACA;AACF,CAAA,MAGyB;AAAA,EACvB,EAAA,EAAI,SAAA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,EAAA,SAAA;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAEA,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,MAAA,CAAO,QAAA,GAAW,QAAA;AAAA,EACpB;AAEA,EAAA,OAAO,MAAA;AACT;AAEO,IAAM,eAAA,GAAkB,CAC7B,UAAA,MACsB;AAAA,EACtB,IAAA,EAAA,QAAA;AAAA,EACA,oBAAA,EAAsB,KAAA;AAAA,EACtB,QAAA,EAAU,MAAA,CAAO,IAAA,CAAK,UAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,KAAM,CAAA,CAAE,aAAA,CAAc,CAAC,CAAC,CAAA;AAAA,EACnE;AACF,CAAA;AAEO,IAAM,cAAA,GAAiB,CAAC,KAAA,MAAwC;AAAA,EACrE,IAAA,EAAA,OAAA;AAAA,EACA;AACF,CAAA;AAEO,IAAM,YAAA,GAAe,CAAC,IAAA,MAAiC;AAAA,EAC5D;AACF,CAAA","file":"chunk-AORPUIKD.js","sourcesContent":["import {\n JsonArraySchema,\n JsonBooleanSchema,\n JsonNumberSchema,\n JsonObjectSchema,\n JsonRefSchema,\n JsonSchema,\n JsonSchemaTypeName,\n JsonStringSchema,\n} from '../types/schema.types.js';\nimport {\n JsonPatchAdd,\n JsonPatchMove,\n JsonPatchRemove,\n JsonPatchReplace,\n} from '../types/json-patch.types.js';\n\nexport const getReplacePatch = ({\n path,\n value,\n}: {\n path: string;\n value: JsonSchema;\n}): JsonPatchReplace => ({\n op: 'replace',\n path,\n value,\n});\n\nexport const getRemovePatch = ({\n path,\n}: {\n path: string;\n}): JsonPatchRemove => ({\n op: 'remove',\n path,\n});\n\nexport const getAddPatch = ({\n path,\n value,\n}: {\n path: string;\n value: JsonSchema;\n}): JsonPatchAdd => ({\n op: 'add',\n path,\n value,\n});\n\nexport const getMovePatch = ({\n from,\n path,\n}: {\n from: string;\n path: string;\n}): JsonPatchMove => ({\n op: 'move',\n from,\n path,\n});\n\nexport const getStringSchema = (\n params: Partial<JsonStringSchema> = {},\n): JsonStringSchema => {\n const schema: JsonStringSchema = {\n type: JsonSchemaTypeName.String,\n default: params.default ?? '',\n };\n\n if (params.foreignKey) {\n schema.foreignKey = params.foreignKey;\n }\n\n if (params.readOnly) {\n schema.readOnly = params.readOnly;\n }\n\n return schema;\n};\n\nexport const getNumberSchema = (\n defaultValue: number = 0,\n readOnly?: boolean,\n): JsonNumberSchema => {\n const schema: JsonNumberSchema = {\n type: JsonSchemaTypeName.Number,\n default: defaultValue,\n };\n\n if (readOnly) {\n schema.readOnly = readOnly;\n }\n\n return schema;\n};\n\nexport const getBooleanSchema = (\n defaultValue: boolean = false,\n readOnly?: boolean,\n): JsonBooleanSchema => {\n const schema: JsonBooleanSchema = {\n type: JsonSchemaTypeName.Boolean,\n default: defaultValue,\n };\n\n if (readOnly) {\n schema.readOnly = readOnly;\n }\n\n return schema;\n};\n\nexport const getObjectSchema = (\n properties: Record<string, JsonSchema>,\n): JsonObjectSchema => ({\n type: JsonSchemaTypeName.Object,\n additionalProperties: false,\n required: Object.keys(properties).sort((a, b) => a.localeCompare(b)),\n properties,\n});\n\nexport const getArraySchema = (items: JsonSchema): JsonArraySchema => ({\n type: JsonSchemaTypeName.Array,\n items,\n});\n\nexport const getRefSchema = ($ref: string): JsonRefSchema => ({\n $ref,\n});\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types/schema.types.ts"],"names":["JsonSchemaTypeName"],"mappings":";AAAO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,OAAA,CAAA,GAAQ,OAAA;AALE,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA","file":"chunk-CYTPQYVM.js","sourcesContent":["export enum JsonSchemaTypeName {\n String = 'string',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\n}\n\nexport type XFormula = {\n version: 1;\n expression: string;\n};\n\nexport type JsonSchemaSharedFields = {\n deprecated?: boolean;\n description?: string;\n title?: string;\n};\n\nexport type JsonStringSchema = {\n type: JsonSchemaTypeName.String;\n default: string;\n foreignKey?: string;\n readOnly?: boolean;\n required?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n pattern?: string;\n format?: 'date-time' | 'date' | 'time' | 'email' | 'regex';\n contentMediaType?:\n | 'text/plain'\n | 'text/markdown'\n | 'text/html'\n | 'application/json'\n | 'application/schema+json'\n | 'application/yaml';\n minLength?: number;\n maxLength?: number;\n enum?: string[];\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonNumberSchema = {\n type: JsonSchemaTypeName.Number;\n default: number;\n readOnly?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n minimum?: number;\n maximum?: number;\n enum?: number[];\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonBooleanSchema = {\n type: JsonSchemaTypeName.Boolean;\n default: boolean;\n readOnly?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonSchemaPrimitives =\n | JsonStringSchema\n | JsonNumberSchema\n | JsonBooleanSchema;\n\nexport type JsonObjectSchema = {\n type: JsonSchemaTypeName.Object;\n additionalProperties: false;\n required: string[];\n properties: Record<string, JsonSchema>;\n title?: string;\n description?: string;\n deprecated?: boolean;\n} & JsonSchemaSharedFields;\n\nexport type JsonArraySchema = {\n type: JsonSchemaTypeName.Array;\n items: JsonSchema;\n title?: string;\n description?: string;\n deprecated?: boolean;\n} & JsonSchemaSharedFields;\n\nexport type JsonRefSchema = {\n $ref: string;\n title?: string;\n description?: string;\n deprecated?: boolean;\n};\n\nexport type JsonSchema =\n | JsonObjectSchema\n | JsonArraySchema\n | JsonSchemaPrimitives\n | JsonRefSchema;\n\nexport type JsonSchemaWithoutRef =\n | JsonObjectSchema\n | JsonArraySchema\n | JsonSchemaPrimitives;\n"]}
@@ -1,92 +0,0 @@
1
- 'use strict';
2
-
3
- // src/mocks/schema.mocks.ts
4
- var getReplacePatch = ({
5
- path,
6
- value
7
- }) => ({
8
- op: "replace",
9
- path,
10
- value
11
- });
12
- var getRemovePatch = ({
13
- path
14
- }) => ({
15
- op: "remove",
16
- path
17
- });
18
- var getAddPatch = ({
19
- path,
20
- value
21
- }) => ({
22
- op: "add",
23
- path,
24
- value
25
- });
26
- var getMovePatch = ({
27
- from,
28
- path
29
- }) => ({
30
- op: "move",
31
- from,
32
- path
33
- });
34
- var getStringSchema = (params = {}) => {
35
- const schema = {
36
- type: "string" /* String */,
37
- default: params.default ?? ""
38
- };
39
- if (params.foreignKey) {
40
- schema.foreignKey = params.foreignKey;
41
- }
42
- if (params.readOnly) {
43
- schema.readOnly = params.readOnly;
44
- }
45
- return schema;
46
- };
47
- var getNumberSchema = (defaultValue = 0, readOnly) => {
48
- const schema = {
49
- type: "number" /* Number */,
50
- default: defaultValue
51
- };
52
- if (readOnly) {
53
- schema.readOnly = readOnly;
54
- }
55
- return schema;
56
- };
57
- var getBooleanSchema = (defaultValue = false, readOnly) => {
58
- const schema = {
59
- type: "boolean" /* Boolean */,
60
- default: defaultValue
61
- };
62
- if (readOnly) {
63
- schema.readOnly = readOnly;
64
- }
65
- return schema;
66
- };
67
- var getObjectSchema = (properties) => ({
68
- type: "object" /* Object */,
69
- additionalProperties: false,
70
- required: Object.keys(properties).sort((a, b) => a.localeCompare(b)),
71
- properties
72
- });
73
- var getArraySchema = (items) => ({
74
- type: "array" /* Array */,
75
- items
76
- });
77
- var getRefSchema = ($ref) => ({
78
- $ref
79
- });
80
-
81
- exports.getAddPatch = getAddPatch;
82
- exports.getArraySchema = getArraySchema;
83
- exports.getBooleanSchema = getBooleanSchema;
84
- exports.getMovePatch = getMovePatch;
85
- exports.getNumberSchema = getNumberSchema;
86
- exports.getObjectSchema = getObjectSchema;
87
- exports.getRefSchema = getRefSchema;
88
- exports.getRemovePatch = getRemovePatch;
89
- exports.getReplacePatch = getReplacePatch;
90
- exports.getStringSchema = getStringSchema;
91
- //# sourceMappingURL=chunk-EJYILFAK.cjs.map
92
- //# sourceMappingURL=chunk-EJYILFAK.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/mocks/schema.mocks.ts"],"names":[],"mappings":";;;AAiBO,IAAM,kBAAkB,CAAC;AAAA,EAC9B,IAAA;AAAA,EACA;AACF,CAAA,MAGyB;AAAA,EACvB,EAAA,EAAI,SAAA;AAAA,EACJ,IAAA;AAAA,EACA;AACF,CAAA;AAEO,IAAM,iBAAiB,CAAC;AAAA,EAC7B;AACF,CAAA,MAEwB;AAAA,EACtB,EAAA,EAAI,QAAA;AAAA,EACJ;AACF,CAAA;AAEO,IAAM,cAAc,CAAC;AAAA,EAC1B,IAAA;AAAA,EACA;AACF,CAAA,MAGqB;AAAA,EACnB,EAAA,EAAI,KAAA;AAAA,EACJ,IAAA;AAAA,EACA;AACF,CAAA;AAEO,IAAM,eAAe,CAAC;AAAA,EAC3B,IAAA;AAAA,EACA;AACF,CAAA,MAGsB;AAAA,EACpB,EAAA,EAAI,MAAA;AAAA,EACJ,IAAA;AAAA,EACA;AACF,CAAA;AAEO,IAAM,eAAA,GAAkB,CAC7B,MAAA,GAAoC,EAAC,KAChB;AACrB,EAAA,MAAM,MAAA,GAA2B;AAAA,IAC/B,IAAA,EAAA,QAAA;AAAA,IACA,OAAA,EAAS,OAAO,OAAA,IAAW;AAAA,GAC7B;AAEA,EAAA,IAAI,OAAO,UAAA,EAAY;AACrB,IAAA,MAAA,CAAO,aAAa,MAAA,CAAO,UAAA;AAAA,EAC7B;AAEA,EAAA,IAAI,OAAO,QAAA,EAAU;AACnB,IAAA,MAAA,CAAO,WAAW,MAAA,CAAO,QAAA;AAAA,EAC3B;AAEA,EAAA,OAAO,MAAA;AACT;AAEO,IAAM,eAAA,GAAkB,CAC7B,YAAA,GAAuB,CAAA,EACvB,QAAA,KACqB;AACrB,EAAA,MAAM,MAAA,GAA2B;AAAA,IAC/B,IAAA,EAAA,QAAA;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAEA,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,MAAA,CAAO,QAAA,GAAW,QAAA;AAAA,EACpB;AAEA,EAAA,OAAO,MAAA;AACT;AAEO,IAAM,gBAAA,GAAmB,CAC9B,YAAA,GAAwB,KAAA,EACxB,QAAA,KACsB;AACtB,EAAA,MAAM,MAAA,GAA4B;AAAA,IAChC,IAAA,EAAA,SAAA;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAEA,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,MAAA,CAAO,QAAA,GAAW,QAAA;AAAA,EACpB;AAEA,EAAA,OAAO,MAAA;AACT;AAEO,IAAM,eAAA,GAAkB,CAC7B,UAAA,MACsB;AAAA,EACtB,IAAA,EAAA,QAAA;AAAA,EACA,oBAAA,EAAsB,KAAA;AAAA,EACtB,QAAA,EAAU,MAAA,CAAO,IAAA,CAAK,UAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,KAAM,CAAA,CAAE,aAAA,CAAc,CAAC,CAAC,CAAA;AAAA,EACnE;AACF,CAAA;AAEO,IAAM,cAAA,GAAiB,CAAC,KAAA,MAAwC;AAAA,EACrE,IAAA,EAAA,OAAA;AAAA,EACA;AACF,CAAA;AAEO,IAAM,YAAA,GAAe,CAAC,IAAA,MAAiC;AAAA,EAC5D;AACF,CAAA","file":"chunk-EJYILFAK.cjs","sourcesContent":["import {\n JsonArraySchema,\n JsonBooleanSchema,\n JsonNumberSchema,\n JsonObjectSchema,\n JsonRefSchema,\n JsonSchema,\n JsonSchemaTypeName,\n JsonStringSchema,\n} from '../types/schema.types.js';\nimport {\n JsonPatchAdd,\n JsonPatchMove,\n JsonPatchRemove,\n JsonPatchReplace,\n} from '../types/json-patch.types.js';\n\nexport const getReplacePatch = ({\n path,\n value,\n}: {\n path: string;\n value: JsonSchema;\n}): JsonPatchReplace => ({\n op: 'replace',\n path,\n value,\n});\n\nexport const getRemovePatch = ({\n path,\n}: {\n path: string;\n}): JsonPatchRemove => ({\n op: 'remove',\n path,\n});\n\nexport const getAddPatch = ({\n path,\n value,\n}: {\n path: string;\n value: JsonSchema;\n}): JsonPatchAdd => ({\n op: 'add',\n path,\n value,\n});\n\nexport const getMovePatch = ({\n from,\n path,\n}: {\n from: string;\n path: string;\n}): JsonPatchMove => ({\n op: 'move',\n from,\n path,\n});\n\nexport const getStringSchema = (\n params: Partial<JsonStringSchema> = {},\n): JsonStringSchema => {\n const schema: JsonStringSchema = {\n type: JsonSchemaTypeName.String,\n default: params.default ?? '',\n };\n\n if (params.foreignKey) {\n schema.foreignKey = params.foreignKey;\n }\n\n if (params.readOnly) {\n schema.readOnly = params.readOnly;\n }\n\n return schema;\n};\n\nexport const getNumberSchema = (\n defaultValue: number = 0,\n readOnly?: boolean,\n): JsonNumberSchema => {\n const schema: JsonNumberSchema = {\n type: JsonSchemaTypeName.Number,\n default: defaultValue,\n };\n\n if (readOnly) {\n schema.readOnly = readOnly;\n }\n\n return schema;\n};\n\nexport const getBooleanSchema = (\n defaultValue: boolean = false,\n readOnly?: boolean,\n): JsonBooleanSchema => {\n const schema: JsonBooleanSchema = {\n type: JsonSchemaTypeName.Boolean,\n default: defaultValue,\n };\n\n if (readOnly) {\n schema.readOnly = readOnly;\n }\n\n return schema;\n};\n\nexport const getObjectSchema = (\n properties: Record<string, JsonSchema>,\n): JsonObjectSchema => ({\n type: JsonSchemaTypeName.Object,\n additionalProperties: false,\n required: Object.keys(properties).sort((a, b) => a.localeCompare(b)),\n properties,\n});\n\nexport const getArraySchema = (items: JsonSchema): JsonArraySchema => ({\n type: JsonSchemaTypeName.Array,\n items,\n});\n\nexport const getRefSchema = ($ref: string): JsonRefSchema => ({\n $ref,\n});\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types/schema.types.ts"],"names":["JsonSchemaTypeName"],"mappings":";;;AAAO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,OAAA,CAAA,GAAQ,OAAA;AALE,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA","file":"chunk-GAPLSVZN.cjs","sourcesContent":["export enum JsonSchemaTypeName {\n String = 'string',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\n}\n\nexport type XFormula = {\n version: 1;\n expression: string;\n};\n\nexport type JsonSchemaSharedFields = {\n deprecated?: boolean;\n description?: string;\n title?: string;\n};\n\nexport type JsonStringSchema = {\n type: JsonSchemaTypeName.String;\n default: string;\n foreignKey?: string;\n readOnly?: boolean;\n required?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n pattern?: string;\n format?: 'date-time' | 'date' | 'time' | 'email' | 'regex';\n contentMediaType?:\n | 'text/plain'\n | 'text/markdown'\n | 'text/html'\n | 'application/json'\n | 'application/schema+json'\n | 'application/yaml';\n minLength?: number;\n maxLength?: number;\n enum?: string[];\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonNumberSchema = {\n type: JsonSchemaTypeName.Number;\n default: number;\n readOnly?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n minimum?: number;\n maximum?: number;\n enum?: number[];\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonBooleanSchema = {\n type: JsonSchemaTypeName.Boolean;\n default: boolean;\n readOnly?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonSchemaPrimitives =\n | JsonStringSchema\n | JsonNumberSchema\n | JsonBooleanSchema;\n\nexport type JsonObjectSchema = {\n type: JsonSchemaTypeName.Object;\n additionalProperties: false;\n required: string[];\n properties: Record<string, JsonSchema>;\n title?: string;\n description?: string;\n deprecated?: boolean;\n} & JsonSchemaSharedFields;\n\nexport type JsonArraySchema = {\n type: JsonSchemaTypeName.Array;\n items: JsonSchema;\n title?: string;\n description?: string;\n deprecated?: boolean;\n} & JsonSchemaSharedFields;\n\nexport type JsonRefSchema = {\n $ref: string;\n title?: string;\n description?: string;\n deprecated?: boolean;\n};\n\nexport type JsonSchema =\n | JsonObjectSchema\n | JsonArraySchema\n | JsonSchemaPrimitives\n | JsonRefSchema;\n\nexport type JsonSchemaWithoutRef =\n | JsonObjectSchema\n | JsonArraySchema\n | JsonSchemaPrimitives;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/addSharedFieldsFromStore.ts","../src/model/schema/json-string.store.ts","../src/model/schema/json-number.store.ts","../src/model/schema/json-boolean.store.ts","../src/model/schema/json-object.store.ts","../src/model/schema/json-array.store.ts","../src/model/value/json-string-value.store.ts","../src/model/value/json-number-value.store.ts","../src/model/value/json-boolean-value.store.ts","../src/model/value/value-transformation.ts","../src/model/value/json-object-value.store.ts","../src/lib/createJsonValueStore.ts","../src/model/value/json-array-value.store.ts"],"names":["EventEmitter","nanoid","value"],"mappings":";;;;AAEO,IAAM,wBAAA,GAA2B,CACtC,MAAA,EACA,KAAA,KACM;AACN,EAAA,IAAI,MAAM,KAAA,EAAO;AACf,IAAA,MAAA,CAAO,QAAQ,KAAA,CAAM,KAAA;AAAA,EACvB;AAEA,EAAA,IAAI,MAAM,WAAA,EAAa;AACrB,IAAA,MAAA,CAAO,cAAc,KAAA,CAAM,WAAA;AAAA,EAC7B;AAEA,EAAA,IAAI,MAAM,UAA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CAAM,GAAA,CAAI,CAAC,SAAA,KAAc;AACzC,MAAA,MAAM,WAAW,cAAA,GACZ,cAAA;AAAA,QACC,UAAU,aAAA,EAAc;AAAA,QACxB,MAAM,KAAA,CAAM;AAAA,OACd,GACA,MAAM,KAAA,CAAM,OAAA;AAEhB,MAAA,OAAO,oBAAA,CAAqB,KAAA,CAAM,KAAA,EAAO,IAAA,CAAK,OAAO,QAAQ,CAAA;AAAA,IAC/D,CAAC,CAAA;AAAA,EACH;AAAA,EAEO,aAAa,KAAA,EAA0B;AAC5C,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,MAAM;AAChC,MAAA,MAAM,QAAA,GAAW,IAAA,CAAK,gBAAA,CAAiB,KAAK,CAAA;AAE5C,MAAA,OAAO,oBAAA,CAAqB,KAAA,CAAM,KAAA,EAAO,IAAA,CAAK,OAAO,QAAQ,CAAA;AAAA,IAC/D,CAAC,CAAA;AAAA,EACH;AAAA,EAEQ,iBAAiB,KAAA,EAAqC;AAC5D,IAAA,MAAM,aAAA,GAAgB,KAAA,CAAM,KAAA,CAAM,QAAA,CAAS,KAAK,KAAK,CAAA;AAErD,IAAA,IAAI,aAAA,EAAe;AACjB,MAAA,OAAO,cAAc,aAAA,EAAc;AAAA,IACrC;AAEA,IAAA,OAAO,MAAM,KAAA,CAAM,OAAA;AAAA,EACrB;AAAA,EAEQ,IAAA,GAAO;AACb,IAAA,KAAA,MAAW,KAAA,IAAS,KAAK,KAAA,EAAO;AAC9B,MAAA,KAAA,CAAM,MAAA,GAAS,IAAA;AAAA,IACjB;AAAA,EACF;AACF","file":"chunk-HY4VE7H2.js","sourcesContent":["import { JsonSchema } from '../types/schema.types.js';\n\nexport const addSharedFieldsFromState = <T extends JsonSchema = JsonSchema>(\n schema: T,\n state: { title?: string; description?: string; deprecated?: boolean },\n): T => {\n if (state.title) {\n schema.title = state.title;\n }\n\n if (state.description) {\n schema.description = state.description;\n }\n\n if (state.deprecated) {\n schema.deprecated = state.deprecated;\n }\n\n return schema;\n};\n","import { nanoid } from 'nanoid';\nimport { EventEmitter } from 'node:events';\nimport {\n JsonRefSchema,\n JsonSchemaTypeName,\n JsonStringSchema,\n XFormula,\n} from '../../types/schema.types.js';\nimport { JsonSchemaStore } from './json-schema.store.js';\nimport { JsonStringValueStore } from '../value/json-string-value.store.js';\nimport { addSharedFieldsFromState } from '../../lib/addSharedFieldsFromStore.js';\n\nexport class JsonStringStore extends EventEmitter implements JsonStringSchema {\n public readonly type = JsonSchemaTypeName.String;\n\n public $ref: string = '';\n public name: string = '';\n public parent: JsonSchemaStore | null = null;\n\n public default: string = '';\n public readOnly?: boolean;\n public title?: string;\n public description?: string;\n public deprecated?: boolean;\n public foreignKey?: string;\n public pattern?: string;\n public enum?: string[];\n public format?: JsonStringSchema['format'];\n public contentMediaType?: JsonStringSchema['contentMediaType'];\n public 'x-formula'?: XFormula;\n\n private readonly valuesMap: Map<string, JsonStringValueStore[]> = new Map<\n string,\n JsonStringValueStore[]\n >();\n\n constructor(public readonly nodeId: string = nanoid()) {\n super();\n }\n\n public registerValue(value: JsonStringValueStore): number {\n const length = this.getOrCreateValues(value.rowId).push(value);\n return length - 1;\n }\n\n public getValue(\n rowId: string,\n index: number = 0,\n ): JsonStringValueStore | undefined {\n return this.getOrCreateValues(rowId)[index];\n }\n\n public getPlainSchema(options?: {\n skip$Ref?: boolean;\n }): JsonStringSchema | JsonRefSchema {\n if (this.$ref && options?.skip$Ref !== true) {\n return addSharedFieldsFromState({ $ref: this.$ref }, this);\n }\n\n return addSharedFieldsFromState(\n {\n type: this.type,\n default: this.default,\n ...(this.foreignKey ? { foreignKey: this.foreignKey } : {}),\n ...(this.readOnly ? { readOnly: this.readOnly } : {}),\n ...(this.pattern ? { pattern: this.pattern } : {}),\n ...(this.enum ? { enum: this.enum } : {}),\n ...(this.format ? { format: this.format } : {}),\n ...(this.contentMediaType\n ? { contentMediaType: this.contentMediaType }\n : {}),\n ...(this['x-formula'] ? { 'x-formula': this['x-formula'] } : {}),\n },\n this,\n );\n }\n\n private getOrCreateValues(rowId: string): JsonStringValueStore[] {\n let values = this.valuesMap.get(rowId);\n\n if (!values) {\n values = [];\n this.valuesMap.set(rowId, values);\n }\n\n return values;\n }\n}\n","import { nanoid } from 'nanoid';\nimport { EventEmitter } from 'node:events';\nimport {\n JsonNumberSchema,\n JsonRefSchema,\n JsonSchemaTypeName,\n XFormula,\n} from '../../types/schema.types.js';\nimport { JsonSchemaStore } from './json-schema.store.js';\nimport { JsonNumberValueStore } from '../value/json-number-value.store.js';\nimport { addSharedFieldsFromState } from '../../lib/addSharedFieldsFromStore.js';\n\nexport class JsonNumberStore extends EventEmitter implements JsonNumberSchema {\n public readonly type = JsonSchemaTypeName.Number;\n\n public $ref: string = '';\n public name: string = '';\n public parent: JsonSchemaStore | null = null;\n\n public default: number = 0;\n public readOnly?: boolean;\n public title?: string;\n public description?: string;\n public deprecated?: boolean;\n public 'x-formula'?: XFormula;\n\n private readonly valuesMap: Map<string, JsonNumberValueStore[]> = new Map<\n string,\n JsonNumberValueStore[]\n >();\n\n constructor(public readonly nodeId: string = nanoid()) {\n super();\n }\n\n public registerValue(value: JsonNumberValueStore): number {\n const length = this.getOrCreateValues(value.rowId).push(value);\n return length - 1;\n }\n\n public getValue(\n rowId: string,\n index: number = 0,\n ): JsonNumberValueStore | undefined {\n return this.getOrCreateValues(rowId)[index];\n }\n\n public getPlainSchema(options?: {\n skip$Ref?: boolean;\n }): JsonNumberSchema | JsonRefSchema {\n if (this.$ref && options?.skip$Ref !== true) {\n return addSharedFieldsFromState({ $ref: this.$ref }, this);\n }\n\n return addSharedFieldsFromState(\n {\n type: this.type,\n default: this.default,\n ...(this.readOnly ? { readOnly: this.readOnly } : {}),\n ...(this['x-formula'] ? { 'x-formula': this['x-formula'] } : {}),\n },\n this,\n );\n }\n\n private getOrCreateValues(rowId: string): JsonNumberValueStore[] {\n let values = this.valuesMap.get(rowId);\n\n if (!values) {\n values = [];\n this.valuesMap.set(rowId, values);\n }\n\n return values;\n }\n}\n","import { nanoid } from 'nanoid';\nimport { EventEmitter } from 'node:events';\nimport {\n JsonBooleanSchema,\n JsonRefSchema,\n JsonSchemaTypeName,\n XFormula,\n} from '../../types/schema.types.js';\nimport { JsonSchemaStore } from './json-schema.store.js';\nimport { JsonBooleanValueStore } from '../value/json-boolean-value.store.js';\nimport { addSharedFieldsFromState } from '../../lib/addSharedFieldsFromStore.js';\n\nexport class JsonBooleanStore\n extends EventEmitter\n implements JsonBooleanSchema\n{\n public readonly type = JsonSchemaTypeName.Boolean;\n\n public $ref: string = '';\n public name: string = '';\n public parent: JsonSchemaStore | null = null;\n\n public default: boolean = false;\n public readOnly?: boolean;\n public title?: string;\n public description?: string;\n public deprecated?: boolean;\n public 'x-formula'?: XFormula;\n\n private readonly valuesMap: Map<string, JsonBooleanValueStore[]> = new Map<\n string,\n JsonBooleanValueStore[]\n >();\n\n constructor(public readonly nodeId: string = nanoid()) {\n super();\n }\n\n public registerValue(value: JsonBooleanValueStore): number {\n const length = this.getOrCreateValues(value.rowId).push(value);\n return length - 1;\n }\n\n public getValue(\n rowId: string,\n index: number = 0,\n ): JsonBooleanValueStore | undefined {\n return this.getOrCreateValues(rowId)[index];\n }\n\n public getPlainSchema(options?: {\n skip$Ref?: boolean;\n }): JsonBooleanSchema | JsonRefSchema {\n if (this.$ref && options?.skip$Ref !== true) {\n return addSharedFieldsFromState({ $ref: this.$ref }, this);\n }\n\n return addSharedFieldsFromState(\n {\n type: this.type,\n default: this.default,\n ...(this.readOnly ? { readOnly: this.readOnly } : {}),\n ...(this['x-formula'] ? { 'x-formula': this['x-formula'] } : {}),\n },\n this,\n );\n }\n\n private getOrCreateValues(rowId: string): JsonBooleanValueStore[] {\n let values = this.valuesMap.get(rowId);\n\n if (!values) {\n values = [];\n this.valuesMap.set(rowId, values);\n }\n\n return values;\n }\n}\n","import { nanoid } from 'nanoid';\nimport { JsonObject } from '../../types/json.types.js';\nimport {\n JsonObjectSchema,\n JsonRefSchema,\n JsonSchema,\n JsonSchemaTypeName,\n} from '../../types/schema.types.js';\nimport { JsonSchemaStore } from './json-schema.store.js';\nimport { JsonObjectValueStore } from '../value/json-object-value.store.js';\nimport { addSharedFieldsFromState } from '../../lib/addSharedFieldsFromStore.js';\n\nexport type AddedPropertyEvent = { name: string; property: JsonSchemaStore };\nexport type MigratePropertyEvent = {\n name: string;\n property: JsonSchemaStore;\n previousProperty: JsonSchemaStore;\n};\nexport type RemovedPropertyEvent = { name: string; property: JsonSchemaStore };\nexport type ChangeNameEvent = {\n fromName: string;\n toName: string;\n property: JsonSchemaStore;\n};\n\nexport class JsonObjectStore implements JsonObjectSchema {\n public readonly type = JsonSchemaTypeName.Object;\n\n public $ref: string = '';\n public name: string = '';\n public parent: JsonSchemaStore | null = null;\n public default: JsonObject = {};\n\n public title?: string;\n public description?: string;\n public deprecated?: boolean;\n\n public readonly additionalProperties = false;\n public readonly required: string[] = [];\n public readonly properties: Record<string, JsonSchemaStore> = {};\n\n private readonly valuesMap: Map<string, JsonObjectValueStore[]> = new Map<\n string,\n JsonObjectValueStore[]\n >();\n\n constructor(public readonly nodeId: string = nanoid()) {}\n\n public get empty(): boolean {\n return Object.keys(this.properties).length === 0;\n }\n\n public registerValue(value: JsonObjectValueStore): number {\n const length = this.getOrCreateValues(value.rowId).push(value);\n return length - 1;\n }\n\n public getValue(\n rowId: string,\n index: number = 0,\n ): JsonObjectValueStore | undefined {\n return this.getOrCreateValues(rowId)[index];\n }\n\n public addPropertyWithStore(name: string, store: JsonSchemaStore) {\n if (this.properties[name] || this.required.includes(name)) {\n throw new Error('this name already exists');\n }\n\n store.parent = this;\n store.name = name;\n\n this.required.push(name);\n this.required.sort((a, b) => a.localeCompare(b));\n\n this.properties[name] = store;\n this.default[name] = store.default;\n\n const event: AddedPropertyEvent = { name, property: store };\n\n for (const value of this.iterValues()) {\n value.addProperty(event);\n }\n\n return store;\n }\n\n public migratePropertyWithStore(name: string, store: JsonSchemaStore) {\n const item = this.properties[name];\n\n if (!item) {\n throw new Error('this name does not exist');\n }\n\n item.parent = null;\n\n store.parent = this;\n store.name = name;\n\n this.properties[name] = store;\n this.default[name] = store.default;\n\n const event: MigratePropertyEvent = {\n name,\n property: store,\n previousProperty: item,\n };\n\n for (const value of this.iterValues()) {\n value.migrateProperty(event);\n }\n\n return store;\n }\n\n public changeName(fromName: string, toName: string) {\n const item = this.properties[fromName];\n\n if (!item) {\n throw new Error('this fromName does not exist');\n }\n\n // remove\n delete this.properties[fromName];\n delete this.default[fromName];\n\n const foundRequiredIndex = this.required.findIndex(\n (required) => required === fromName,\n );\n\n if (foundRequiredIndex !== -1) {\n this.required.splice(foundRequiredIndex, 1);\n }\n\n // add\n if (!this.required.includes(toName)) {\n this.required.push(toName);\n this.required.sort((a, b) => a.localeCompare(b));\n }\n\n this.properties[toName] = item;\n this.default[toName] = item.default;\n\n const event: ChangeNameEvent = {\n fromName,\n toName,\n property: item,\n };\n\n for (const value of this.iterValues()) {\n value.changeName(event);\n }\n }\n\n public removeProperty(name: string) {\n const item = this.properties[name];\n\n if (!item) {\n throw new Error('this name does not exist');\n }\n\n item.parent = null;\n item.name = '';\n\n delete this.properties[name];\n delete this.default[name];\n\n const foundRequiredIndex = this.required.findIndex(\n (required) => required === name,\n );\n\n if (foundRequiredIndex !== -1) {\n this.required.splice(foundRequiredIndex, 1);\n }\n\n const event: RemovedPropertyEvent = {\n name,\n property: item,\n };\n\n for (const value of this.iterValues()) {\n value.removeProperty(event);\n }\n }\n\n public getProperty(name: string): JsonSchemaStore | undefined {\n return this.properties[name];\n }\n\n public getPlainSchema(options?: {\n skip$Ref?: boolean;\n }): JsonObjectSchema | JsonRefSchema {\n if (this.$ref && options?.skip$Ref !== true) {\n return addSharedFieldsFromState({ $ref: this.$ref }, this);\n }\n\n return addSharedFieldsFromState(\n {\n type: this.type,\n additionalProperties: this.additionalProperties,\n required: this.required,\n properties: Object.entries<JsonSchemaStore>(this.properties).reduce<\n Record<string, JsonSchema>\n >((result, [name, store]) => {\n result[name] = store.getPlainSchema(options);\n return result;\n }, {}),\n },\n this,\n );\n }\n\n private getOrCreateValues(rowId: string): JsonObjectValueStore[] {\n let values = this.valuesMap.get(rowId);\n\n if (!values) {\n values = [];\n this.valuesMap.set(rowId, values);\n }\n\n return values;\n }\n\n private *iterValues(): Generator<JsonObjectValueStore> {\n for (const values of this.valuesMap.values()) {\n for (const value of values) {\n yield value;\n }\n }\n }\n}\n","import { nanoid } from 'nanoid';\nimport { JsonArray } from '../../types/json.types.js';\nimport {\n JsonArraySchema,\n JsonRefSchema,\n JsonSchemaTypeName,\n} from '../../types/schema.types.js';\nimport { JsonSchemaStore } from './json-schema.store.js';\nimport { JsonArrayValueStore } from '../value/json-array-value.store.js';\nimport { addSharedFieldsFromState } from '../../lib/addSharedFieldsFromStore.js';\n\nexport type MigrateItemsEvent = {\n items: JsonSchemaStore;\n previousItems: JsonSchemaStore;\n};\n\nexport type ReplaceItemsEvent = {\n items: JsonSchemaStore;\n previousItems: JsonSchemaStore;\n};\n\nexport class JsonArrayStore implements JsonArraySchema {\n public readonly type = JsonSchemaTypeName.Array;\n\n public $ref: string = '';\n public name: string = '';\n public parent: JsonSchemaStore | null = null;\n public default: JsonArray[] = [];\n\n public title?: string;\n public description?: string;\n public deprecated?: boolean;\n\n private readonly valuesMap: Map<string, JsonArrayValueStore[]> = new Map<\n string,\n JsonArrayValueStore[]\n >();\n\n constructor(\n private _items: JsonSchemaStore,\n public readonly nodeId: string = nanoid(),\n ) {\n this.items.parent = this;\n }\n\n public get items() {\n return this._items;\n }\n\n public registerValue(value: JsonArrayValueStore): number {\n const length = this.getOrCreateValues(value.rowId).push(value);\n return length - 1;\n }\n\n public getValue(\n rowId: string,\n index: number = 0,\n ): JsonArrayValueStore | undefined {\n return this.getOrCreateValues(rowId)[index];\n }\n\n public migrateItems(items: JsonSchemaStore) {\n const previousItems = this._items;\n previousItems.parent = null;\n this._items = items;\n this._items.parent = this;\n\n const event: MigrateItemsEvent = { items, previousItems };\n\n for (const value of this.iterValues()) {\n value.migrateItems(event);\n }\n }\n\n public replaceItems(items: JsonSchemaStore) {\n const previousItems = this._items;\n previousItems.parent = null;\n this._items = items;\n this._items.parent = this;\n\n const event: ReplaceItemsEvent = { items, previousItems };\n\n for (const value of this.iterValues()) {\n value.replaceItems(event);\n }\n }\n\n public getPlainSchema(options?: {\n skip$Ref?: boolean;\n }): JsonArraySchema | JsonRefSchema {\n if (this.$ref && options?.skip$Ref !== true) {\n return addSharedFieldsFromState({ $ref: this.$ref }, this);\n }\n\n return addSharedFieldsFromState(\n {\n type: this.type,\n items: this.items.getPlainSchema(options),\n },\n this,\n );\n }\n\n private getOrCreateValues(rowId: string): JsonArrayValueStore[] {\n let values = this.valuesMap.get(rowId);\n\n if (!values) {\n values = [];\n this.valuesMap.set(rowId, values);\n }\n\n return values;\n }\n\n private *iterValues(): Generator<JsonArrayValueStore> {\n for (const values of this.valuesMap.values()) {\n for (const value of values) {\n yield value;\n }\n }\n }\n}\n","import { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport { JsonStringStore } from '../schema/json-string.store.js';\nimport { JsonValueStoreParent } from './json-value.store.js';\n\nexport class JsonStringValueStore {\n public readonly type = JsonSchemaTypeName.String;\n\n public readonly index: number;\n\n public parent: JsonValueStoreParent | null = null;\n\n constructor(\n public readonly schema: JsonStringStore,\n public readonly rowId: string,\n public value: string | null = null,\n ) {\n this.index = this.schema.registerValue(this);\n }\n\n public get foreignKey() {\n return this.schema.foreignKey;\n }\n\n public getPlainValue() {\n return this.value ?? this.schema.default;\n }\n}\n","import { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport { JsonNumberStore } from '../schema/json-number.store.js';\nimport { JsonValueStoreParent } from './json-value.store.js';\n\nexport class JsonNumberValueStore {\n public readonly type = JsonSchemaTypeName.Number;\n\n public readonly index: number;\n\n public parent: JsonValueStoreParent | null = null;\n\n constructor(\n public readonly schema: JsonNumberStore,\n public readonly rowId: string,\n public value: number | null = null,\n ) {\n this.index = this.schema.registerValue(this);\n }\n\n public getPlainValue() {\n return this.value ?? this.schema.default;\n }\n}\n","import { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport { JsonBooleanStore } from '../schema/json-boolean.store.js';\nimport { JsonValueStoreParent } from './json-value.store.js';\n\nexport class JsonBooleanValueStore {\n public readonly type = JsonSchemaTypeName.Boolean;\n\n public readonly index: number;\n\n public parent: JsonValueStoreParent | null = null;\n\n constructor(\n public readonly schema: JsonBooleanStore,\n public readonly rowId: string,\n public value: boolean | null = null,\n ) {\n this.index = this.schema.registerValue(this);\n }\n\n public getPlainValue() {\n return this.value ?? this.schema.default;\n }\n}\n","import { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport { JsonArrayStore } from '../schema/json-array.store.js';\nimport { JsonSchemaStore } from '../schema/json-schema.store.js';\nimport { JsonObjectStore } from '../schema/json-object.store.js';\n\nexport const equal = (value: unknown): unknown => value;\n\nexport const fromNumberToString = (\n value: number,\n defaultValue: string = '',\n): string => value.toString() || defaultValue;\n\nexport const fromBooleanToString = (\n value: boolean,\n defaultValue: string = '',\n): string => value.toString() || defaultValue;\n\nexport const fromStringToBoolean = (\n value: string,\n defaultValue: boolean = false,\n): boolean => {\n if (!value) {\n return defaultValue;\n }\n\n if (value.toLowerCase() === 'false') {\n return false;\n }\n\n return true;\n};\n\nexport const fromStringToNumber = (\n value: string,\n defaultValue: number = 0,\n): number => {\n const number = Number.parseFloat(value);\n\n if (Number.isNaN(number)) {\n return defaultValue;\n }\n\n return number;\n};\n\nexport const fromBooleanToNumber = (value: boolean): number => {\n return Number(value);\n};\n\nexport const fromNumberToBoolean = (value: number): boolean => {\n return Boolean(value);\n};\n\nexport const toArrayTransformation =\n (transformation: Transformation) => (value: unknown) => {\n const result = transformation(value);\n return [result];\n };\n\nexport const fromArrayTransformation =\n (transformation: Transformation) => (value: unknown) => {\n if (Array.isArray(value) && value.length) {\n return transformation(value[0]);\n }\n return undefined;\n };\n\nexport const fromObjectToPrimitive = (\n _value: unknown,\n defaultValue: unknown,\n): unknown => {\n return defaultValue;\n};\n\nexport const fromPrimitiveToObject = (\n _value: unknown,\n defaultValue: unknown,\n): unknown => {\n return defaultValue;\n};\n\nexport const fromObjectToArray = (\n _value: unknown,\n defaultValue: unknown,\n): unknown => {\n return defaultValue;\n};\n\nexport const fromArrayToObject = (\n _value: unknown,\n defaultValue: unknown,\n): unknown => {\n return defaultValue;\n};\n\nconst replaceTransformationsMapper: ReplaceTransformationsMapper = [\n {\n fromType: JsonSchemaTypeName.Number,\n toType: JsonSchemaTypeName.String,\n transformation: fromNumberToString as Transformation,\n },\n {\n fromType: JsonSchemaTypeName.String,\n toType: JsonSchemaTypeName.Number,\n transformation: fromStringToNumber as Transformation,\n },\n {\n fromType: JsonSchemaTypeName.Boolean,\n toType: JsonSchemaTypeName.String,\n transformation: fromBooleanToString as Transformation,\n },\n {\n fromType: JsonSchemaTypeName.String,\n toType: JsonSchemaTypeName.Boolean,\n transformation: fromStringToBoolean as Transformation,\n },\n {\n fromType: JsonSchemaTypeName.Boolean,\n toType: JsonSchemaTypeName.Number,\n transformation: fromBooleanToNumber as Transformation,\n },\n {\n fromType: JsonSchemaTypeName.Number,\n toType: JsonSchemaTypeName.Boolean,\n transformation: fromNumberToBoolean as Transformation,\n },\n];\nexport const getTransformation = (\n from: JsonSchemaStore,\n to: JsonSchemaStore,\n): Transformation | undefined => {\n if (\n from instanceof JsonObjectStore &&\n !(to instanceof JsonObjectStore) &&\n !(to instanceof JsonArrayStore)\n ) {\n return fromObjectToPrimitive;\n }\n\n if (\n !(from instanceof JsonObjectStore) &&\n !(from instanceof JsonArrayStore) &&\n to instanceof JsonObjectStore\n ) {\n return fromPrimitiveToObject;\n }\n\n if (from instanceof JsonObjectStore && to instanceof JsonArrayStore) {\n return fromObjectToArray;\n }\n\n if (from instanceof JsonArrayStore && to instanceof JsonObjectStore) {\n return fromArrayToObject;\n }\n\n if (from instanceof JsonArrayStore && to instanceof JsonArrayStore) {\n const itemTransformation = findTransformation(\n from.items.type,\n to.items.type,\n );\n\n if (itemTransformation && itemTransformation !== equal) {\n return (value: unknown, defaultValue?: unknown) => {\n if (!Array.isArray(value)) {\n return defaultValue;\n }\n\n return value.map((item) => {\n const result = itemTransformation(item, to.items.default);\n return result !== undefined ? result : to.items.default;\n });\n };\n }\n\n if (from.items.type !== to.items.type) {\n return (_value: unknown, defaultValue?: unknown) => defaultValue;\n }\n\n return equal;\n }\n\n if (to instanceof JsonArrayStore) {\n const transformation = findTransformation(from.type, to.items.type);\n\n if (!transformation) {\n return;\n }\n\n return toArrayTransformation(transformation);\n }\n\n if (from instanceof JsonArrayStore) {\n const transformation = findTransformation(from.items.type, to.type);\n\n if (!transformation) {\n return;\n }\n\n return fromArrayTransformation(transformation);\n }\n\n return findTransformation(from.type, to.type);\n};\n\nconst findTransformation = (\n from: JsonSchemaTypeName,\n to: JsonSchemaTypeName,\n): Transformation | undefined => {\n if (from === to) {\n return equal;\n }\n\n for (const item of replaceTransformationsMapper) {\n if (item.fromType === from && item.toType === to) {\n return item.transformation;\n }\n }\n\n return undefined;\n};\n\ntype Transformation = (value: unknown, defaultValue?: unknown) => unknown;\ntype ReplaceTransformationsMapper = {\n fromType: JsonSchemaTypeName;\n toType: JsonSchemaTypeName;\n transformation: Transformation;\n}[];\n","import { createJsonValueStore } from '../../lib/createJsonValueStore.js';\nimport { JsonSchemaStore } from '../../model/schema';\nimport { JsonObject, JsonValue } from '../../types/json.types.js';\nimport { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport {\n AddedPropertyEvent,\n ChangeNameEvent,\n JsonObjectStore,\n MigratePropertyEvent,\n RemovedPropertyEvent,\n} from '../schema/json-object.store.js';\nimport { JsonValueStore, JsonValueStoreParent } from './json-value.store.js';\nimport { getTransformation } from './value-transformation.js';\n\nexport class JsonObjectValueStore {\n public readonly type = JsonSchemaTypeName.Object;\n\n public index: number;\n\n public parent: JsonValueStoreParent | null = null;\n\n constructor(\n public readonly schema: JsonObjectStore,\n public readonly rowId: string,\n public value: Record<string, JsonValueStore>,\n ) {\n this.index = this.schema.registerValue(this);\n this.init();\n }\n\n public getPlainValue(): JsonObject {\n return Object.entries(this.value).reduce<Record<string, JsonValue>>(\n (result, [name, store]) => {\n result[name] = store.getPlainValue() as JsonValue;\n return result;\n },\n {},\n );\n }\n\n public migrateProperty(event: MigratePropertyEvent) {\n const rawValue = this.getMigratedValue(event);\n\n this.value[event.name] = createJsonValueStore(\n event.property,\n this.rowId,\n rawValue,\n );\n }\n\n public addProperty(event: AddedPropertyEvent) {\n const rawValue = this.getAddedValue(event);\n\n this.value[event.name] = createJsonValueStore(\n event.property,\n this.rowId,\n rawValue,\n );\n }\n\n public removeProperty(event: RemovedPropertyEvent) {\n delete this.value[event.name];\n }\n\n public changeName(event: ChangeNameEvent) {\n const itemValue = this.value[event.fromName];\n\n if (itemValue !== undefined) {\n delete this.value[event.fromName];\n this.value[event.toName] = itemValue;\n }\n }\n\n private getAddedValue(event: AddedPropertyEvent): JsonValue {\n const ancestorValue = this.findValueAtSchemaLevel(event.property);\n if (ancestorValue !== undefined) {\n return ancestorValue;\n }\n\n const previousValue = event.property.getValue(this.rowId, this.index);\n if (previousValue) {\n return previousValue.getPlainValue();\n }\n\n return event.property.default;\n }\n\n private findValueAtSchemaLevel(\n targetSchema: JsonSchemaStore,\n ): JsonValue | undefined {\n let current: JsonValueStore | null = this.parent;\n\n while (current) {\n if (current.type === JsonSchemaTypeName.Object) {\n for (const [, fieldValue] of Object.entries(current.value)) {\n if (fieldValue.schema === targetSchema) {\n return fieldValue.getPlainValue();\n }\n }\n }\n\n current = current.parent;\n }\n\n return undefined;\n }\n\n private getMigratedValue(event: MigratePropertyEvent): JsonValue {\n const transformation = getTransformation(\n event.previousProperty,\n event.property,\n );\n\n const valueStore = this.value[event.name];\n if (transformation && valueStore) {\n return transformation(\n valueStore.getPlainValue(),\n event.property.default,\n ) as JsonValue;\n }\n\n return event.property.default;\n }\n\n private init() {\n for (const value of Object.values(this.value)) {\n value.parent = this;\n }\n }\n}\n","import {\n JsonArray,\n JsonObject,\n JsonPrimitives,\n JsonValue,\n} from '../types/json.types.js';\nimport { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonArrayStore } from '../model/schema/json-array.store.js';\nimport { JsonObjectStore } from '../model/schema/json-object.store.js';\nimport {\n JsonSchemaStore,\n JsonSchemaStorePrimitives,\n} from '../model/schema/json-schema.store.js';\nimport { JsonArrayValueStore } from '../model/value/json-array-value.store.js';\nimport { JsonBooleanValueStore } from '../model/value/json-boolean-value.store.js';\nimport { JsonNumberValueStore } from '../model/value/json-number-value.store.js';\nimport { JsonObjectValueStore } from '../model/value/json-object-value.store.js';\nimport { JsonStringValueStore } from '../model/value/json-string-value.store.js';\nimport {\n JsonValueStore,\n JsonValueStorePrimitives,\n} from '../model/value/json-value.store.js';\n\nexport const createJsonValueStore = (\n schema: JsonSchemaStore,\n rowId: string,\n rawValue: JsonValue,\n): JsonValueStore => {\n if (schema.type === JsonSchemaTypeName.Object) {\n return createJsonObjectValueStore(schema, rowId, rawValue as JsonObject);\n } else if (schema.type === JsonSchemaTypeName.Array) {\n return createJsonArrayValueStore(schema, rowId, rawValue as JsonArray);\n } else {\n return createPrimitiveValueStore(schema, rowId, rawValue as JsonPrimitives);\n }\n};\n\nexport const createJsonObjectValueStore = (\n schema: JsonObjectStore,\n rowId: string,\n rawValue: JsonObject,\n): JsonObjectValueStore => {\n const value = Object.entries(rawValue).reduce<Record<string, JsonValueStore>>(\n (reduceValue, [key, itemValue]) => {\n const itemSchema = schema.getProperty(key);\n\n if (itemSchema === undefined || itemValue === undefined) {\n throw new Error('Invalid item');\n }\n\n reduceValue[key] = createJsonValueStore(itemSchema, rowId, itemValue);\n\n return reduceValue;\n },\n {},\n );\n\n return new JsonObjectValueStore(schema, rowId, value);\n};\n\nexport const createJsonArrayValueStore = (\n schema: JsonArrayStore,\n rowId: string,\n rawValue: JsonArray,\n): JsonArrayValueStore => {\n const value = rawValue.map((value) =>\n createJsonValueStore(schema.items, rowId, value),\n );\n\n return new JsonArrayValueStore(schema, rowId, value);\n};\n\nexport const createPrimitiveValueStore = (\n schema: JsonSchemaStorePrimitives,\n rowId: string,\n rawValue: JsonPrimitives,\n): JsonValueStorePrimitives => {\n if (schema.type === JsonSchemaTypeName.String) {\n return new JsonStringValueStore(schema, rowId, rawValue as string | null);\n } else if (schema.type === JsonSchemaTypeName.Number) {\n return new JsonNumberValueStore(schema, rowId, rawValue as number | null);\n } else if (schema.type === JsonSchemaTypeName.Boolean) {\n return new JsonBooleanValueStore(schema, rowId, rawValue as boolean | null);\n } else {\n throw new Error('this type is not allowed');\n }\n};\n","import { JsonArray, JsonValue } from '../../types/json.types.js';\nimport { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport {\n JsonArrayStore,\n MigrateItemsEvent,\n ReplaceItemsEvent,\n} from '../schema/json-array.store.js';\nimport { createJsonValueStore } from '../../lib/createJsonValueStore.js';\nimport { JsonValueStore, JsonValueStoreParent } from './json-value.store.js';\nimport { getTransformation } from './value-transformation.js';\n\nexport class JsonArrayValueStore {\n public readonly type = JsonSchemaTypeName.Array;\n\n public index: number;\n\n public parent: JsonValueStoreParent | null = null;\n\n constructor(\n public readonly schema: JsonArrayStore,\n public readonly rowId: string,\n public value: JsonValueStore[],\n ) {\n this.index = this.schema.registerValue(this);\n this.init();\n }\n\n public getPlainValue(): JsonArray {\n return this.value.map((item) => item.getPlainValue());\n }\n\n public migrateItems(event: MigrateItemsEvent) {\n const transformation = getTransformation(event.previousItems, event.items);\n\n this.value = this.value.map((valueItem) => {\n const rawValue = transformation\n ? (transformation(\n valueItem.getPlainValue(),\n event.items.default,\n ) as JsonValue)\n : event.items.default;\n\n return createJsonValueStore(event.items, this.rowId, rawValue);\n });\n }\n\n public replaceItems(event: ReplaceItemsEvent) {\n this.value = this.value.map(() => {\n const rawValue = this.getReplacedValue(event);\n\n return createJsonValueStore(event.items, this.rowId, rawValue);\n });\n }\n\n private getReplacedValue(event: ReplaceItemsEvent): JsonValue {\n const previousValue = event.items.getValue(this.rowId);\n\n if (previousValue) {\n return previousValue.getPlainValue();\n }\n\n return event.items.default;\n }\n\n private init() {\n for (const value of this.value) {\n value.parent = this;\n }\n }\n}\n"]}