@revisium/schema-toolkit 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +184 -0
- package/dist/consts/index.cjs +26 -0
- package/dist/consts/index.cjs.map +1 -0
- package/dist/consts/index.d.cts +17 -0
- package/dist/consts/index.d.ts +17 -0
- package/dist/consts/index.js +23 -0
- package/dist/consts/index.js.map +1 -0
- package/dist/index.cjs +1874 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +1787 -0
- package/dist/index.js.map +1 -0
- package/dist/json-patch.types-DiJBqfxV.d.ts +28 -0
- package/dist/json-patch.types-lByaF-OL.d.cts +28 -0
- package/dist/json-string.store-O1J0j-a1.d.cts +228 -0
- package/dist/json-string.store-S9FXT39Q.d.ts +228 -0
- package/dist/json.types-46Cq-WxU.d.cts +8 -0
- package/dist/json.types-46Cq-WxU.d.ts +8 -0
- package/dist/lib/index.cjs +1346 -0
- package/dist/lib/index.cjs.map +1 -0
- package/dist/lib/index.d.cts +91 -0
- package/dist/lib/index.d.ts +91 -0
- package/dist/lib/index.js +1315 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/mocks/index.cjs +92 -0
- package/dist/mocks/index.cjs.map +1 -0
- package/dist/mocks/index.d.cts +26 -0
- package/dist/mocks/index.d.ts +26 -0
- package/dist/mocks/index.js +81 -0
- package/dist/mocks/index.js.map +1 -0
- package/dist/model/index.cjs +718 -0
- package/dist/model/index.cjs.map +1 -0
- package/dist/model/index.d.cts +19 -0
- package/dist/model/index.d.ts +19 -0
- package/dist/model/index.js +697 -0
- package/dist/model/index.js.map +1 -0
- package/dist/plugins/index.cjs +122 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.cts +21 -0
- package/dist/plugins/index.d.ts +21 -0
- package/dist/plugins/index.js +112 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/schema.types-Q3MYTp8z.d.cts +68 -0
- package/dist/schema.types-Q3MYTp8z.d.ts +68 -0
- package/dist/types/index.cjs +15 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +56 -0
- package/dist/types/index.d.ts +56 -0
- package/dist/types/index.js +13 -0
- package/dist/types/index.js.map +1 -0
- package/dist/validation-schemas/index.cjs +380 -0
- package/dist/validation-schemas/index.cjs.map +1 -0
- package/dist/validation-schemas/index.d.cts +32 -0
- package/dist/validation-schemas/index.d.ts +32 -0
- package/dist/validation-schemas/index.js +365 -0
- package/dist/validation-schemas/index.js.map +1 -0
- package/package.json +169 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { d as JsonBooleanSchema, J as JsonSchemaTypeName, h as JsonRefSchema, c as JsonNumberSchema, f as JsonObjectSchema, g as JsonArraySchema, b as JsonStringSchema } from './schema.types-Q3MYTp8z.js';
|
|
3
|
+
import { J as JsonObject, b as JsonArray } from './json.types-46Cq-WxU.js';
|
|
4
|
+
|
|
5
|
+
declare class JsonBooleanStore extends EventEmitter implements JsonBooleanSchema {
|
|
6
|
+
readonly nodeId: string;
|
|
7
|
+
readonly type = JsonSchemaTypeName.Boolean;
|
|
8
|
+
$ref: string;
|
|
9
|
+
name: string;
|
|
10
|
+
parent: JsonSchemaStore | null;
|
|
11
|
+
default: boolean;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
title?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
deprecated?: boolean;
|
|
16
|
+
private readonly valuesMap;
|
|
17
|
+
constructor(nodeId?: string);
|
|
18
|
+
registerValue(value: JsonBooleanValueStore): number;
|
|
19
|
+
getValue(rowId: string, index?: number): JsonBooleanValueStore | undefined;
|
|
20
|
+
getPlainSchema(options?: {
|
|
21
|
+
skip$Ref?: boolean;
|
|
22
|
+
}): JsonBooleanSchema | JsonRefSchema;
|
|
23
|
+
private getOrCreateValues;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare class JsonBooleanValueStore {
|
|
27
|
+
readonly schema: JsonBooleanStore;
|
|
28
|
+
readonly rowId: string;
|
|
29
|
+
value: boolean | null;
|
|
30
|
+
readonly type = JsonSchemaTypeName.Boolean;
|
|
31
|
+
readonly index: number;
|
|
32
|
+
parent: JsonValueStoreParent | null;
|
|
33
|
+
constructor(schema: JsonBooleanStore, rowId: string, value?: boolean | null);
|
|
34
|
+
getPlainValue(): boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare class JsonNumberStore extends EventEmitter implements JsonNumberSchema {
|
|
38
|
+
readonly nodeId: string;
|
|
39
|
+
readonly type = JsonSchemaTypeName.Number;
|
|
40
|
+
$ref: string;
|
|
41
|
+
name: string;
|
|
42
|
+
parent: JsonSchemaStore | null;
|
|
43
|
+
default: number;
|
|
44
|
+
readOnly?: boolean;
|
|
45
|
+
title?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
deprecated?: boolean;
|
|
48
|
+
private readonly valuesMap;
|
|
49
|
+
constructor(nodeId?: string);
|
|
50
|
+
registerValue(value: JsonNumberValueStore): number;
|
|
51
|
+
getValue(rowId: string, index?: number): JsonNumberValueStore | undefined;
|
|
52
|
+
getPlainSchema(options?: {
|
|
53
|
+
skip$Ref?: boolean;
|
|
54
|
+
}): JsonNumberSchema | JsonRefSchema;
|
|
55
|
+
private getOrCreateValues;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare class JsonNumberValueStore {
|
|
59
|
+
readonly schema: JsonNumberStore;
|
|
60
|
+
readonly rowId: string;
|
|
61
|
+
value: number | null;
|
|
62
|
+
readonly type = JsonSchemaTypeName.Number;
|
|
63
|
+
readonly index: number;
|
|
64
|
+
parent: JsonValueStoreParent | null;
|
|
65
|
+
constructor(schema: JsonNumberStore, rowId: string, value?: number | null);
|
|
66
|
+
getPlainValue(): number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type AddedPropertyEvent = {
|
|
70
|
+
name: string;
|
|
71
|
+
property: JsonSchemaStore;
|
|
72
|
+
};
|
|
73
|
+
type MigratePropertyEvent = {
|
|
74
|
+
name: string;
|
|
75
|
+
property: JsonSchemaStore;
|
|
76
|
+
previousProperty: JsonSchemaStore;
|
|
77
|
+
};
|
|
78
|
+
type RemovedPropertyEvent = {
|
|
79
|
+
name: string;
|
|
80
|
+
property: JsonSchemaStore;
|
|
81
|
+
};
|
|
82
|
+
type ChangeNameEvent = {
|
|
83
|
+
fromName: string;
|
|
84
|
+
toName: string;
|
|
85
|
+
property: JsonSchemaStore;
|
|
86
|
+
};
|
|
87
|
+
declare class JsonObjectStore implements JsonObjectSchema {
|
|
88
|
+
readonly nodeId: string;
|
|
89
|
+
readonly type = JsonSchemaTypeName.Object;
|
|
90
|
+
$ref: string;
|
|
91
|
+
name: string;
|
|
92
|
+
parent: JsonSchemaStore | null;
|
|
93
|
+
default: JsonObject;
|
|
94
|
+
title?: string;
|
|
95
|
+
description?: string;
|
|
96
|
+
deprecated?: boolean;
|
|
97
|
+
readonly additionalProperties = false;
|
|
98
|
+
readonly required: string[];
|
|
99
|
+
readonly properties: Record<string, JsonSchemaStore>;
|
|
100
|
+
private readonly valuesMap;
|
|
101
|
+
constructor(nodeId?: string);
|
|
102
|
+
get empty(): boolean;
|
|
103
|
+
registerValue(value: JsonObjectValueStore): number;
|
|
104
|
+
getValue(rowId: string, index?: number): JsonObjectValueStore | undefined;
|
|
105
|
+
addPropertyWithStore(name: string, store: JsonSchemaStore): JsonSchemaStore;
|
|
106
|
+
migratePropertyWithStore(name: string, store: JsonSchemaStore): JsonSchemaStore;
|
|
107
|
+
changeName(fromName: string, toName: string): void;
|
|
108
|
+
removeProperty(name: string): void;
|
|
109
|
+
getProperty(name: string): JsonSchemaStore | undefined;
|
|
110
|
+
getPlainSchema(options?: {
|
|
111
|
+
skip$Ref?: boolean;
|
|
112
|
+
}): JsonObjectSchema | JsonRefSchema;
|
|
113
|
+
private getOrCreateValues;
|
|
114
|
+
private iterValues;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
declare class JsonObjectValueStore {
|
|
118
|
+
readonly schema: JsonObjectStore;
|
|
119
|
+
readonly rowId: string;
|
|
120
|
+
value: Record<string, JsonValueStore>;
|
|
121
|
+
readonly type = JsonSchemaTypeName.Object;
|
|
122
|
+
index: number;
|
|
123
|
+
parent: JsonValueStoreParent | null;
|
|
124
|
+
constructor(schema: JsonObjectStore, rowId: string, value: Record<string, JsonValueStore>);
|
|
125
|
+
getPlainValue(): JsonObject;
|
|
126
|
+
migrateProperty(event: MigratePropertyEvent): void;
|
|
127
|
+
addProperty(event: AddedPropertyEvent): void;
|
|
128
|
+
removeProperty(event: RemovedPropertyEvent): void;
|
|
129
|
+
changeName(event: ChangeNameEvent): void;
|
|
130
|
+
private getAddedValue;
|
|
131
|
+
private getMigratedValue;
|
|
132
|
+
private init;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
declare class JsonStringValueStore {
|
|
136
|
+
readonly schema: JsonStringStore;
|
|
137
|
+
readonly rowId: string;
|
|
138
|
+
value: string | null;
|
|
139
|
+
readonly type = JsonSchemaTypeName.String;
|
|
140
|
+
readonly index: number;
|
|
141
|
+
parent: JsonValueStoreParent | null;
|
|
142
|
+
constructor(schema: JsonStringStore, rowId: string, value?: string | null);
|
|
143
|
+
get foreignKey(): string | undefined;
|
|
144
|
+
getPlainValue(): string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
type JsonValueStorePrimitives = JsonStringValueStore | JsonNumberValueStore | JsonBooleanValueStore;
|
|
148
|
+
type JsonValueStoreParent = JsonObjectValueStore | JsonArrayValueStore;
|
|
149
|
+
type JsonValueStore = JsonValueStoreParent | JsonValueStorePrimitives;
|
|
150
|
+
|
|
151
|
+
declare class JsonArrayValueStore {
|
|
152
|
+
readonly schema: JsonArrayStore;
|
|
153
|
+
readonly rowId: string;
|
|
154
|
+
value: JsonValueStore[];
|
|
155
|
+
readonly type = JsonSchemaTypeName.Array;
|
|
156
|
+
index: number;
|
|
157
|
+
parent: JsonValueStoreParent | null;
|
|
158
|
+
constructor(schema: JsonArrayStore, rowId: string, value: JsonValueStore[]);
|
|
159
|
+
getPlainValue(): JsonArray;
|
|
160
|
+
migrateItems(event: MigrateItemsEvent): void;
|
|
161
|
+
replaceItems(event: ReplaceItemsEvent): void;
|
|
162
|
+
private getReplacedValue;
|
|
163
|
+
private init;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
type MigrateItemsEvent = {
|
|
167
|
+
items: JsonSchemaStore;
|
|
168
|
+
previousItems: JsonSchemaStore;
|
|
169
|
+
};
|
|
170
|
+
type ReplaceItemsEvent = {
|
|
171
|
+
items: JsonSchemaStore;
|
|
172
|
+
previousItems: JsonSchemaStore;
|
|
173
|
+
};
|
|
174
|
+
declare class JsonArrayStore implements JsonArraySchema {
|
|
175
|
+
private _items;
|
|
176
|
+
readonly nodeId: string;
|
|
177
|
+
readonly type = JsonSchemaTypeName.Array;
|
|
178
|
+
$ref: string;
|
|
179
|
+
name: string;
|
|
180
|
+
parent: JsonSchemaStore | null;
|
|
181
|
+
default: JsonArray[];
|
|
182
|
+
title?: string;
|
|
183
|
+
description?: string;
|
|
184
|
+
deprecated?: boolean;
|
|
185
|
+
private readonly valuesMap;
|
|
186
|
+
constructor(_items: JsonSchemaStore, nodeId?: string);
|
|
187
|
+
get items(): JsonSchemaStore;
|
|
188
|
+
registerValue(value: JsonArrayValueStore): number;
|
|
189
|
+
getValue(rowId: string, index?: number): JsonArrayValueStore | undefined;
|
|
190
|
+
migrateItems(items: JsonSchemaStore): void;
|
|
191
|
+
replaceItems(items: JsonSchemaStore): void;
|
|
192
|
+
getPlainSchema(options?: {
|
|
193
|
+
skip$Ref?: boolean;
|
|
194
|
+
}): JsonArraySchema | JsonRefSchema;
|
|
195
|
+
private getOrCreateValues;
|
|
196
|
+
private iterValues;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
type JsonSchemaStorePrimitives = JsonStringStore | JsonNumberStore | JsonBooleanStore;
|
|
200
|
+
type JsonSchemaStore = JsonObjectStore | JsonArrayStore | JsonSchemaStorePrimitives;
|
|
201
|
+
|
|
202
|
+
declare class JsonStringStore extends EventEmitter implements JsonStringSchema {
|
|
203
|
+
readonly nodeId: string;
|
|
204
|
+
readonly type = JsonSchemaTypeName.String;
|
|
205
|
+
$ref: string;
|
|
206
|
+
name: string;
|
|
207
|
+
parent: JsonSchemaStore | null;
|
|
208
|
+
default: string;
|
|
209
|
+
readOnly?: boolean;
|
|
210
|
+
title?: string;
|
|
211
|
+
description?: string;
|
|
212
|
+
deprecated?: boolean;
|
|
213
|
+
foreignKey?: string;
|
|
214
|
+
pattern?: string;
|
|
215
|
+
enum?: string[];
|
|
216
|
+
format?: JsonStringSchema['format'];
|
|
217
|
+
contentMediaType?: JsonStringSchema['contentMediaType'];
|
|
218
|
+
private readonly valuesMap;
|
|
219
|
+
constructor(nodeId?: string);
|
|
220
|
+
registerValue(value: JsonStringValueStore): number;
|
|
221
|
+
getValue(rowId: string, index?: number): JsonStringValueStore | undefined;
|
|
222
|
+
getPlainSchema(options?: {
|
|
223
|
+
skip$Ref?: boolean;
|
|
224
|
+
}): JsonStringSchema | JsonRefSchema;
|
|
225
|
+
private getOrCreateValues;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export { type AddedPropertyEvent as A, type ChangeNameEvent as C, JsonStringStore as J, type MigratePropertyEvent as M, type RemovedPropertyEvent as R, JsonNumberStore as a, JsonBooleanStore as b, JsonObjectStore as c, type MigrateItemsEvent as d, type ReplaceItemsEvent as e, JsonArrayStore as f, type JsonSchemaStorePrimitives as g, type JsonSchemaStore as h, JsonStringValueStore as i, JsonNumberValueStore as j, JsonBooleanValueStore as k, JsonObjectValueStore as l, JsonArrayValueStore as m, type JsonValueStorePrimitives as n, type JsonValueStoreParent as o, type JsonValueStore as p };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type JsonObject = {
|
|
2
|
+
[Key in string]?: JsonValue;
|
|
3
|
+
};
|
|
4
|
+
type JsonPrimitives = string | number | boolean;
|
|
5
|
+
type JsonArray = Array<JsonValue>;
|
|
6
|
+
type JsonValue = JsonPrimitives | JsonObject | JsonArray | null;
|
|
7
|
+
|
|
8
|
+
export type { JsonObject as J, JsonPrimitives as a, JsonArray as b, JsonValue as c };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type JsonObject = {
|
|
2
|
+
[Key in string]?: JsonValue;
|
|
3
|
+
};
|
|
4
|
+
type JsonPrimitives = string | number | boolean;
|
|
5
|
+
type JsonArray = Array<JsonValue>;
|
|
6
|
+
type JsonValue = JsonPrimitives | JsonObject | JsonArray | null;
|
|
7
|
+
|
|
8
|
+
export type { JsonObject as J, JsonPrimitives as a, JsonArray as b, JsonValue as c };
|