@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,56 @@
|
|
|
1
|
+
import { c as JsonValue } from '../json.types-46Cq-WxU.js';
|
|
2
|
+
export { b as JsonArray, J as JsonObject, a as JsonPrimitives } from '../json.types-46Cq-WxU.js';
|
|
3
|
+
import { h as JsonPatch } from '../json-patch.types-DiJBqfxV.js';
|
|
4
|
+
export { g as JsonPatchAdd, c as JsonPatchAddOperation, d as JsonPatchMove, J as JsonPatchMoveOperation, f as JsonPatchRemove, b as JsonPatchRemoveOperation, e as JsonPatchReplace, a as JsonPatchReplaceOperation } from '../json-patch.types-DiJBqfxV.js';
|
|
5
|
+
import { i as JsonSchema } from '../schema.types-Q3MYTp8z.js';
|
|
6
|
+
export { g as JsonArraySchema, d as JsonBooleanSchema, c as JsonNumberSchema, f as JsonObjectSchema, h as JsonRefSchema, e as JsonSchemaPrimitives, a as JsonSchemaSharedFields, J as JsonSchemaTypeName, j as JsonSchemaWithoutRef, b as JsonStringSchema } from '../schema.types-Q3MYTp8z.js';
|
|
7
|
+
|
|
8
|
+
type JsonValuePatchMove = {
|
|
9
|
+
op: 'move';
|
|
10
|
+
from: string;
|
|
11
|
+
path: string;
|
|
12
|
+
};
|
|
13
|
+
type JsonValuePatchReplace = {
|
|
14
|
+
op: 'replace';
|
|
15
|
+
path: string;
|
|
16
|
+
value: JsonValue;
|
|
17
|
+
};
|
|
18
|
+
type JsonValuePatchRemove = {
|
|
19
|
+
op: 'remove';
|
|
20
|
+
path: string;
|
|
21
|
+
};
|
|
22
|
+
type JsonValuePatchAdd = {
|
|
23
|
+
op: 'add';
|
|
24
|
+
path: string;
|
|
25
|
+
value: JsonValue;
|
|
26
|
+
};
|
|
27
|
+
type JsonValuePatch = JsonValuePatchMove | JsonValuePatchReplace | JsonValuePatchRemove | JsonValuePatchAdd;
|
|
28
|
+
|
|
29
|
+
type UpdateMigration = {
|
|
30
|
+
changeType: 'update';
|
|
31
|
+
tableId: string;
|
|
32
|
+
hash: string;
|
|
33
|
+
id: string;
|
|
34
|
+
patches: JsonPatch[];
|
|
35
|
+
};
|
|
36
|
+
type RenameMigration = {
|
|
37
|
+
changeType: 'rename';
|
|
38
|
+
id: string;
|
|
39
|
+
tableId: string;
|
|
40
|
+
nextTableId: string;
|
|
41
|
+
};
|
|
42
|
+
type RemoveMigration = {
|
|
43
|
+
changeType: 'remove';
|
|
44
|
+
tableId: string;
|
|
45
|
+
id: string;
|
|
46
|
+
};
|
|
47
|
+
type InitMigration = {
|
|
48
|
+
changeType: 'init';
|
|
49
|
+
tableId: string;
|
|
50
|
+
hash: string;
|
|
51
|
+
id: string;
|
|
52
|
+
schema: JsonSchema;
|
|
53
|
+
};
|
|
54
|
+
type Migration = InitMigration | UpdateMigration | RenameMigration | RemoveMigration;
|
|
55
|
+
|
|
56
|
+
export { type InitMigration, JsonPatch, JsonSchema, JsonValue, type JsonValuePatch, type JsonValuePatchAdd, type JsonValuePatchMove, type JsonValuePatchRemove, type JsonValuePatchReplace, type Migration, type RemoveMigration, type RenameMigration, type UpdateMigration };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/types/schema.types.ts
|
|
2
|
+
var JsonSchemaTypeName = /* @__PURE__ */ ((JsonSchemaTypeName2) => {
|
|
3
|
+
JsonSchemaTypeName2["String"] = "string";
|
|
4
|
+
JsonSchemaTypeName2["Number"] = "number";
|
|
5
|
+
JsonSchemaTypeName2["Boolean"] = "boolean";
|
|
6
|
+
JsonSchemaTypeName2["Object"] = "object";
|
|
7
|
+
JsonSchemaTypeName2["Array"] = "array";
|
|
8
|
+
return JsonSchemaTypeName2;
|
|
9
|
+
})(JsonSchemaTypeName || {});
|
|
10
|
+
|
|
11
|
+
export { JsonSchemaTypeName };
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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":"index.js","sourcesContent":["export enum JsonSchemaTypeName {\n String = 'string',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\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 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 enum?: string[];\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} & 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} & 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"]}
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/validation-schemas/shared-fields.ts
|
|
4
|
+
var sharedFields = {
|
|
5
|
+
deprecated: {
|
|
6
|
+
type: "boolean"
|
|
7
|
+
},
|
|
8
|
+
title: {
|
|
9
|
+
type: "string"
|
|
10
|
+
},
|
|
11
|
+
description: {
|
|
12
|
+
type: "string"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// src/validation-schemas/meta-schema.ts
|
|
17
|
+
var refMetaSchema = {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {
|
|
20
|
+
...sharedFields,
|
|
21
|
+
$ref: {
|
|
22
|
+
type: "string"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
additionalProperties: false,
|
|
26
|
+
required: ["$ref"]
|
|
27
|
+
};
|
|
28
|
+
var baseStringFields = {
|
|
29
|
+
type: {
|
|
30
|
+
const: "string"
|
|
31
|
+
},
|
|
32
|
+
default: {
|
|
33
|
+
type: "string"
|
|
34
|
+
},
|
|
35
|
+
readOnly: {
|
|
36
|
+
type: "boolean"
|
|
37
|
+
},
|
|
38
|
+
pattern: {
|
|
39
|
+
type: "string",
|
|
40
|
+
format: "regex"
|
|
41
|
+
},
|
|
42
|
+
enum: {
|
|
43
|
+
type: "array",
|
|
44
|
+
items: { type: "string" },
|
|
45
|
+
minItems: 1,
|
|
46
|
+
uniqueItems: true
|
|
47
|
+
},
|
|
48
|
+
format: {
|
|
49
|
+
type: "string",
|
|
50
|
+
enum: ["date-time", "date", "time", "email", "regex"]
|
|
51
|
+
},
|
|
52
|
+
contentMediaType: {
|
|
53
|
+
type: "string",
|
|
54
|
+
enum: [
|
|
55
|
+
"text/plain",
|
|
56
|
+
"text/markdown",
|
|
57
|
+
"text/html",
|
|
58
|
+
"application/json",
|
|
59
|
+
"application/schema+json",
|
|
60
|
+
"application/yaml"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
...sharedFields
|
|
64
|
+
};
|
|
65
|
+
var stringMetaSchema = {
|
|
66
|
+
type: "object",
|
|
67
|
+
properties: {
|
|
68
|
+
...baseStringFields,
|
|
69
|
+
foreignKey: {
|
|
70
|
+
type: "string"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
additionalProperties: false,
|
|
74
|
+
required: ["type", "default"]
|
|
75
|
+
};
|
|
76
|
+
var noForeignKeyStringMetaSchema = {
|
|
77
|
+
type: "object",
|
|
78
|
+
properties: {
|
|
79
|
+
...baseStringFields
|
|
80
|
+
},
|
|
81
|
+
additionalProperties: false,
|
|
82
|
+
required: ["type", "default"]
|
|
83
|
+
};
|
|
84
|
+
var numberMetaSchema = {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {
|
|
87
|
+
type: {
|
|
88
|
+
const: "number"
|
|
89
|
+
},
|
|
90
|
+
default: {
|
|
91
|
+
type: "number"
|
|
92
|
+
},
|
|
93
|
+
readOnly: {
|
|
94
|
+
type: "boolean"
|
|
95
|
+
},
|
|
96
|
+
...sharedFields
|
|
97
|
+
},
|
|
98
|
+
additionalProperties: false,
|
|
99
|
+
required: ["type", "default"]
|
|
100
|
+
};
|
|
101
|
+
var booleanMetaSchema = {
|
|
102
|
+
type: "object",
|
|
103
|
+
properties: {
|
|
104
|
+
type: {
|
|
105
|
+
const: "boolean"
|
|
106
|
+
},
|
|
107
|
+
default: {
|
|
108
|
+
type: "boolean"
|
|
109
|
+
},
|
|
110
|
+
readOnly: {
|
|
111
|
+
type: "boolean"
|
|
112
|
+
},
|
|
113
|
+
...sharedFields
|
|
114
|
+
},
|
|
115
|
+
additionalProperties: false,
|
|
116
|
+
required: ["type", "default"]
|
|
117
|
+
};
|
|
118
|
+
var objectMetaSchema = {
|
|
119
|
+
type: "object",
|
|
120
|
+
properties: {
|
|
121
|
+
type: {
|
|
122
|
+
const: "object"
|
|
123
|
+
},
|
|
124
|
+
...sharedFields,
|
|
125
|
+
properties: {
|
|
126
|
+
type: "object",
|
|
127
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
128
|
+
default: {}
|
|
129
|
+
},
|
|
130
|
+
additionalProperties: { const: false },
|
|
131
|
+
required: { $ref: "#/$defs/stringArray" }
|
|
132
|
+
},
|
|
133
|
+
additionalProperties: false,
|
|
134
|
+
required: ["type", "properties", "additionalProperties", "required"]
|
|
135
|
+
};
|
|
136
|
+
var arrayMetaSchema = {
|
|
137
|
+
type: "object",
|
|
138
|
+
properties: {
|
|
139
|
+
type: {
|
|
140
|
+
const: "array"
|
|
141
|
+
},
|
|
142
|
+
...sharedFields,
|
|
143
|
+
items: {
|
|
144
|
+
oneOf: [
|
|
145
|
+
{ $ref: "#/$defs/refSchema" },
|
|
146
|
+
{ $ref: "#/$defs/objectSchema" },
|
|
147
|
+
{ $ref: "#/$defs/arraySchema" },
|
|
148
|
+
{ $ref: "#/$defs/stringSchema" },
|
|
149
|
+
{ $ref: "#/$defs/numberSchema" },
|
|
150
|
+
{ $ref: "#/$defs/booleanSchema" }
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
additionalProperties: false,
|
|
155
|
+
required: ["type", "items"]
|
|
156
|
+
};
|
|
157
|
+
var metaSchema = {
|
|
158
|
+
$id: "meta-schema.json",
|
|
159
|
+
type: "object",
|
|
160
|
+
$dynamicAnchor: "meta",
|
|
161
|
+
oneOf: [
|
|
162
|
+
{ $ref: "#/$defs/refSchema" },
|
|
163
|
+
{ $ref: "#/$defs/objectSchema" },
|
|
164
|
+
{ $ref: "#/$defs/arraySchema" },
|
|
165
|
+
{ $ref: "#/$defs/stringSchema" },
|
|
166
|
+
{ $ref: "#/$defs/numberSchema" },
|
|
167
|
+
{ $ref: "#/$defs/booleanSchema" }
|
|
168
|
+
],
|
|
169
|
+
$defs: {
|
|
170
|
+
stringArray: {
|
|
171
|
+
type: "array",
|
|
172
|
+
items: { type: "string" },
|
|
173
|
+
uniqueItems: true,
|
|
174
|
+
default: []
|
|
175
|
+
},
|
|
176
|
+
refSchema: refMetaSchema,
|
|
177
|
+
objectSchema: objectMetaSchema,
|
|
178
|
+
stringSchema: stringMetaSchema,
|
|
179
|
+
numberSchema: numberMetaSchema,
|
|
180
|
+
booleanSchema: booleanMetaSchema,
|
|
181
|
+
arraySchema: arrayMetaSchema
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
var notForeignKeyMetaSchema = {
|
|
185
|
+
type: "object",
|
|
186
|
+
$dynamicAnchor: "meta",
|
|
187
|
+
oneOf: [
|
|
188
|
+
{ $ref: "#/$defs/refSchema" },
|
|
189
|
+
{ $ref: "#/$defs/objectSchema" },
|
|
190
|
+
{ $ref: "#/$defs/arraySchema" },
|
|
191
|
+
{ $ref: "#/$defs/stringSchema" },
|
|
192
|
+
{ $ref: "#/$defs/numberSchema" },
|
|
193
|
+
{ $ref: "#/$defs/booleanSchema" }
|
|
194
|
+
],
|
|
195
|
+
$defs: {
|
|
196
|
+
stringArray: {
|
|
197
|
+
type: "array",
|
|
198
|
+
items: { type: "string" },
|
|
199
|
+
uniqueItems: true,
|
|
200
|
+
default: []
|
|
201
|
+
},
|
|
202
|
+
refSchema: refMetaSchema,
|
|
203
|
+
objectSchema: objectMetaSchema,
|
|
204
|
+
stringSchema: noForeignKeyStringMetaSchema,
|
|
205
|
+
numberSchema: numberMetaSchema,
|
|
206
|
+
booleanSchema: booleanMetaSchema,
|
|
207
|
+
arraySchema: arrayMetaSchema
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// src/validation-schemas/json-patch-schema.ts
|
|
212
|
+
var jsonPatchSchema = {
|
|
213
|
+
$id: "json-patch-schema.json",
|
|
214
|
+
definitions: {
|
|
215
|
+
path: {
|
|
216
|
+
description: "A JSON Pointer path.",
|
|
217
|
+
type: "string"
|
|
218
|
+
},
|
|
219
|
+
objectSchema: objectMetaSchema,
|
|
220
|
+
stringSchema: stringMetaSchema,
|
|
221
|
+
numberSchema: numberMetaSchema,
|
|
222
|
+
booleanSchema: booleanMetaSchema,
|
|
223
|
+
arraySchema: arrayMetaSchema
|
|
224
|
+
},
|
|
225
|
+
minItems: 1,
|
|
226
|
+
items: {
|
|
227
|
+
oneOf: [
|
|
228
|
+
{
|
|
229
|
+
type: "object",
|
|
230
|
+
additionalProperties: false,
|
|
231
|
+
required: ["value", "op", "path"],
|
|
232
|
+
properties: {
|
|
233
|
+
path: {
|
|
234
|
+
$ref: "#/definitions/path"
|
|
235
|
+
},
|
|
236
|
+
op: {
|
|
237
|
+
description: "The operation to perform.",
|
|
238
|
+
type: "string",
|
|
239
|
+
enum: ["add", "replace"]
|
|
240
|
+
},
|
|
241
|
+
value: {
|
|
242
|
+
$ref: "meta-schema.json",
|
|
243
|
+
description: "The value to add, replace or test."
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: "object",
|
|
249
|
+
additionalProperties: false,
|
|
250
|
+
required: ["op", "path"],
|
|
251
|
+
properties: {
|
|
252
|
+
path: {
|
|
253
|
+
$ref: "#/definitions/path"
|
|
254
|
+
},
|
|
255
|
+
op: {
|
|
256
|
+
description: "The operation to perform.",
|
|
257
|
+
type: "string",
|
|
258
|
+
enum: ["remove"]
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
type: "object",
|
|
264
|
+
additionalProperties: false,
|
|
265
|
+
required: ["from", "op", "path"],
|
|
266
|
+
properties: {
|
|
267
|
+
path: {
|
|
268
|
+
$ref: "#/definitions/path"
|
|
269
|
+
},
|
|
270
|
+
op: {
|
|
271
|
+
description: "The operation to perform.",
|
|
272
|
+
type: "string",
|
|
273
|
+
enum: ["move", "copy"]
|
|
274
|
+
},
|
|
275
|
+
from: {
|
|
276
|
+
$ref: "#/definitions/path",
|
|
277
|
+
description: "A JSON Pointer path pointing to the location to move/copy from."
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
},
|
|
283
|
+
title: "JSON schema for JSONPatch files",
|
|
284
|
+
type: "array"
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
// src/validation-schemas/history-patches-schema.ts
|
|
288
|
+
var historyPatchesSchema = {
|
|
289
|
+
$id: "history-patches-schema.json",
|
|
290
|
+
type: "array",
|
|
291
|
+
minItems: 1,
|
|
292
|
+
items: {
|
|
293
|
+
type: "object",
|
|
294
|
+
properties: {
|
|
295
|
+
patches: {
|
|
296
|
+
$ref: "json-patch-schema.json"
|
|
297
|
+
},
|
|
298
|
+
hash: {
|
|
299
|
+
type: "string"
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
required: ["patches", "hash"]
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// src/validation-schemas/table-migrations-schema.ts
|
|
307
|
+
var tableMigrationsSchema = {
|
|
308
|
+
$id: "table-migrations-schema.json",
|
|
309
|
+
oneOf: [
|
|
310
|
+
{ $ref: "#/definitions/InitMigration" },
|
|
311
|
+
{ $ref: "#/definitions/UpdateMigration" },
|
|
312
|
+
{ $ref: "#/definitions/RenameMigration" },
|
|
313
|
+
{ $ref: "#/definitions/RemoveMigration" }
|
|
314
|
+
],
|
|
315
|
+
definitions: {
|
|
316
|
+
InitMigration: {
|
|
317
|
+
type: "object",
|
|
318
|
+
additionalProperties: false,
|
|
319
|
+
required: ["changeType", "tableId", "hash", "id", "schema"],
|
|
320
|
+
properties: {
|
|
321
|
+
changeType: { type: "string", const: "init" },
|
|
322
|
+
tableId: { type: "string" },
|
|
323
|
+
hash: { type: "string" },
|
|
324
|
+
id: { type: "string" },
|
|
325
|
+
schema: { $ref: "meta-schema.json" }
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
UpdateMigration: {
|
|
329
|
+
type: "object",
|
|
330
|
+
additionalProperties: false,
|
|
331
|
+
required: ["changeType", "tableId", "hash", "id", "patches"],
|
|
332
|
+
properties: {
|
|
333
|
+
changeType: { type: "string", const: "update" },
|
|
334
|
+
tableId: { type: "string" },
|
|
335
|
+
hash: { type: "string" },
|
|
336
|
+
id: { type: "string" },
|
|
337
|
+
patches: { $ref: "json-patch-schema.json" }
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
RenameMigration: {
|
|
341
|
+
type: "object",
|
|
342
|
+
additionalProperties: false,
|
|
343
|
+
required: ["changeType", "id", "tableId", "nextTableId"],
|
|
344
|
+
properties: {
|
|
345
|
+
changeType: { type: "string", const: "rename" },
|
|
346
|
+
id: { type: "string" },
|
|
347
|
+
tableId: { type: "string" },
|
|
348
|
+
nextTableId: { type: "string" }
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
RemoveMigration: {
|
|
352
|
+
type: "object",
|
|
353
|
+
additionalProperties: false,
|
|
354
|
+
required: ["changeType", "id", "tableId"],
|
|
355
|
+
properties: {
|
|
356
|
+
changeType: { type: "string", const: "remove" },
|
|
357
|
+
id: { type: "string" },
|
|
358
|
+
tableId: { type: "string" }
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
title: "JSON Schema for a Single Migration"
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
exports.arrayMetaSchema = arrayMetaSchema;
|
|
366
|
+
exports.baseStringFields = baseStringFields;
|
|
367
|
+
exports.booleanMetaSchema = booleanMetaSchema;
|
|
368
|
+
exports.historyPatchesSchema = historyPatchesSchema;
|
|
369
|
+
exports.jsonPatchSchema = jsonPatchSchema;
|
|
370
|
+
exports.metaSchema = metaSchema;
|
|
371
|
+
exports.noForeignKeyStringMetaSchema = noForeignKeyStringMetaSchema;
|
|
372
|
+
exports.notForeignKeyMetaSchema = notForeignKeyMetaSchema;
|
|
373
|
+
exports.numberMetaSchema = numberMetaSchema;
|
|
374
|
+
exports.objectMetaSchema = objectMetaSchema;
|
|
375
|
+
exports.refMetaSchema = refMetaSchema;
|
|
376
|
+
exports.sharedFields = sharedFields;
|
|
377
|
+
exports.stringMetaSchema = stringMetaSchema;
|
|
378
|
+
exports.tableMigrationsSchema = tableMigrationsSchema;
|
|
379
|
+
//# sourceMappingURL=index.cjs.map
|
|
380
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/validation-schemas/shared-fields.ts","../../src/validation-schemas/meta-schema.ts","../../src/validation-schemas/json-patch-schema.ts","../../src/validation-schemas/history-patches-schema.ts","../../src/validation-schemas/table-migrations-schema.ts"],"names":[],"mappings":";;;AAAO,IAAM,YAAA,GAAe;AAAA,EAC1B,UAAA,EAAY;AAAA,IACV,IAAA,EAAM;AAAA,GACR;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAA,EAAM;AAAA,GACR;AAAA,EACA,WAAA,EAAa;AAAA,IACX,IAAA,EAAM;AAAA;AAEV;;;ACLO,IAAM,aAAA,GAAwB;AAA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QAAA,EAAU,CAAC,YAAA,EAAc,IAAA,EAAM,SAAS,CAAA;AAAA,MACxC,UAAA,EAAY;AAAA,QACV,UAAA,EAAY,EAAE,IAAA,EAAM,QAAA,EAAU,OAAO,QAAA,EAAS;AAAA,QAC9C,EAAA,EAAI,EAAE,IAAA,EAAM,QAAA,EAAS;AAAA,QACrB,OAAA,EAAS,EAAE,IAAA,EAAM,QAAA;AAAS;AAC5B;AACF,GACF;AAAA,EACA,KAAA,EAAO;AACT","file":"index.cjs","sourcesContent":["export const sharedFields = {\n deprecated: {\n type: 'boolean',\n },\n title: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n};\n","import { Schema } from 'ajv/dist/2020';\nimport { sharedFields } from './shared-fields.js';\n\n// https://json-schema.org/specification#single-vocabulary-meta-schemas\n\nexport const refMetaSchema: Schema = {\n type: 'object',\n properties: {\n ...sharedFields,\n $ref: {\n type: 'string',\n },\n },\n additionalProperties: false,\n required: ['$ref'],\n};\n\nexport const baseStringFields: Schema = {\n type: {\n const: 'string',\n },\n default: {\n type: 'string',\n },\n readOnly: {\n type: 'boolean',\n },\n pattern: {\n type: 'string',\n format: 'regex',\n },\n enum: {\n type: 'array',\n items: { type: 'string' },\n minItems: 1,\n uniqueItems: true,\n },\n format: {\n type: 'string',\n enum: ['date-time', 'date', 'time', 'email', 'regex'],\n },\n contentMediaType: {\n type: 'string',\n enum: [\n 'text/plain',\n 'text/markdown',\n 'text/html',\n 'application/json',\n 'application/schema+json',\n 'application/yaml',\n ],\n },\n ...sharedFields,\n};\n\nexport const stringMetaSchema: Schema = {\n type: 'object',\n properties: {\n ...baseStringFields,\n foreignKey: {\n type: 'string',\n },\n },\n additionalProperties: false,\n required: ['type', 'default'],\n};\n\nexport const noForeignKeyStringMetaSchema: Schema = {\n type: 'object',\n properties: {\n ...baseStringFields,\n },\n additionalProperties: false,\n required: ['type', 'default'],\n};\n\nexport const numberMetaSchema: Schema = {\n type: 'object',\n properties: {\n type: {\n const: 'number',\n },\n default: {\n type: 'number',\n },\n readOnly: {\n type: 'boolean',\n },\n ...sharedFields,\n },\n additionalProperties: false,\n required: ['type', 'default'],\n};\n\nexport const booleanMetaSchema: Schema = {\n type: 'object',\n properties: {\n type: {\n const: 'boolean',\n },\n default: {\n type: 'boolean',\n },\n readOnly: {\n type: 'boolean',\n },\n ...sharedFields,\n },\n additionalProperties: false,\n required: ['type', 'default'],\n};\n\nexport const objectMetaSchema: Schema = {\n type: 'object',\n properties: {\n type: {\n const: 'object',\n },\n ...sharedFields,\n properties: {\n type: 'object',\n additionalProperties: { $dynamicRef: '#meta' },\n default: {},\n },\n additionalProperties: { const: false },\n required: { $ref: '#/$defs/stringArray' },\n },\n additionalProperties: false,\n required: ['type', 'properties', 'additionalProperties', 'required'],\n};\n\nexport const arrayMetaSchema: Schema = {\n type: 'object',\n properties: {\n type: {\n const: 'array',\n },\n ...sharedFields,\n items: {\n oneOf: [\n { $ref: '#/$defs/refSchema' },\n { $ref: '#/$defs/objectSchema' },\n { $ref: '#/$defs/arraySchema' },\n { $ref: '#/$defs/stringSchema' },\n { $ref: '#/$defs/numberSchema' },\n { $ref: '#/$defs/booleanSchema' },\n ],\n },\n },\n additionalProperties: false,\n required: ['type', 'items'],\n};\n\nexport const metaSchema: Schema = {\n $id: 'meta-schema.json',\n type: 'object',\n $dynamicAnchor: 'meta',\n oneOf: [\n { $ref: '#/$defs/refSchema' },\n { $ref: '#/$defs/objectSchema' },\n { $ref: '#/$defs/arraySchema' },\n { $ref: '#/$defs/stringSchema' },\n { $ref: '#/$defs/numberSchema' },\n { $ref: '#/$defs/booleanSchema' },\n ],\n $defs: {\n stringArray: {\n type: 'array',\n items: { type: 'string' },\n uniqueItems: true,\n default: [],\n },\n refSchema: refMetaSchema,\n objectSchema: objectMetaSchema,\n stringSchema: stringMetaSchema,\n numberSchema: numberMetaSchema,\n booleanSchema: booleanMetaSchema,\n arraySchema: arrayMetaSchema,\n },\n};\n\nexport const notForeignKeyMetaSchema: Schema = {\n type: 'object',\n $dynamicAnchor: 'meta',\n oneOf: [\n { $ref: '#/$defs/refSchema' },\n { $ref: '#/$defs/objectSchema' },\n { $ref: '#/$defs/arraySchema' },\n { $ref: '#/$defs/stringSchema' },\n { $ref: '#/$defs/numberSchema' },\n { $ref: '#/$defs/booleanSchema' },\n ],\n $defs: {\n stringArray: {\n type: 'array',\n items: { type: 'string' },\n uniqueItems: true,\n default: [],\n },\n refSchema: refMetaSchema,\n objectSchema: objectMetaSchema,\n stringSchema: noForeignKeyStringMetaSchema,\n numberSchema: numberMetaSchema,\n booleanSchema: booleanMetaSchema,\n arraySchema: arrayMetaSchema,\n },\n};\n","import { Schema } from 'ajv/dist/2020';\nimport {\n arrayMetaSchema,\n booleanMetaSchema,\n numberMetaSchema,\n objectMetaSchema,\n stringMetaSchema,\n} from './meta-schema.js';\n\n// copied and modified from https://json.schemastore.org/json-patch\n\nexport const jsonPatchSchema: Schema = {\n $id: 'json-patch-schema.json',\n definitions: {\n path: {\n description: 'A JSON Pointer path.',\n type: 'string',\n },\n objectSchema: objectMetaSchema,\n stringSchema: stringMetaSchema,\n numberSchema: numberMetaSchema,\n booleanSchema: booleanMetaSchema,\n arraySchema: arrayMetaSchema,\n },\n minItems: 1,\n items: {\n oneOf: [\n {\n type: 'object',\n additionalProperties: false,\n required: ['value', 'op', 'path'],\n properties: {\n path: {\n $ref: '#/definitions/path',\n },\n op: {\n description: 'The operation to perform.',\n type: 'string',\n enum: ['add', 'replace'],\n },\n value: {\n $ref: 'meta-schema.json',\n description: 'The value to add, replace or test.',\n },\n },\n },\n {\n type: 'object',\n additionalProperties: false,\n required: ['op', 'path'],\n properties: {\n path: {\n $ref: '#/definitions/path',\n },\n op: {\n description: 'The operation to perform.',\n type: 'string',\n enum: ['remove'],\n },\n },\n },\n {\n type: 'object',\n additionalProperties: false,\n required: ['from', 'op', 'path'],\n properties: {\n path: {\n $ref: '#/definitions/path',\n },\n op: {\n description: 'The operation to perform.',\n type: 'string',\n enum: ['move', 'copy'],\n },\n from: {\n $ref: '#/definitions/path',\n description:\n 'A JSON Pointer path pointing to the location to move/copy from.',\n },\n },\n },\n ],\n },\n title: 'JSON schema for JSONPatch files',\n type: 'array',\n};\n","import { Schema } from 'ajv/dist/2020';\n\nexport const historyPatchesSchema: Schema = {\n $id: 'history-patches-schema.json',\n type: 'array',\n minItems: 1,\n items: {\n type: 'object',\n properties: {\n patches: {\n $ref: 'json-patch-schema.json',\n },\n hash: {\n type: 'string',\n },\n },\n required: ['patches', 'hash'],\n },\n};\n","import { Schema } from 'ajv/dist/2020';\n\nexport const tableMigrationsSchema: Schema = {\n $id: 'table-migrations-schema.json',\n oneOf: [\n { $ref: '#/definitions/InitMigration' },\n { $ref: '#/definitions/UpdateMigration' },\n { $ref: '#/definitions/RenameMigration' },\n { $ref: '#/definitions/RemoveMigration' },\n ],\n definitions: {\n InitMigration: {\n type: 'object',\n additionalProperties: false,\n required: ['changeType', 'tableId', 'hash', 'id', 'schema'],\n properties: {\n changeType: { type: 'string', const: 'init' },\n tableId: { type: 'string' },\n hash: { type: 'string' },\n id: { type: 'string' },\n schema: { $ref: 'meta-schema.json' },\n },\n },\n UpdateMigration: {\n type: 'object',\n additionalProperties: false,\n required: ['changeType', 'tableId', 'hash', 'id', 'patches'],\n properties: {\n changeType: { type: 'string', const: 'update' },\n tableId: { type: 'string' },\n hash: { type: 'string' },\n id: { type: 'string' },\n patches: { $ref: 'json-patch-schema.json' },\n },\n },\n RenameMigration: {\n type: 'object',\n additionalProperties: false,\n required: ['changeType', 'id', 'tableId', 'nextTableId'],\n properties: {\n changeType: { type: 'string', const: 'rename' },\n id: { type: 'string' },\n tableId: { type: 'string' },\n nextTableId: { type: 'string' },\n },\n },\n RemoveMigration: {\n type: 'object',\n additionalProperties: false,\n required: ['changeType', 'id', 'tableId'],\n properties: {\n changeType: { type: 'string', const: 'remove' },\n id: { type: 'string' },\n tableId: { type: 'string' },\n },\n },\n },\n title: 'JSON Schema for a Single Migration',\n};\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Schema } from 'ajv/dist/2020';
|
|
2
|
+
|
|
3
|
+
declare const refMetaSchema: Schema;
|
|
4
|
+
declare const baseStringFields: Schema;
|
|
5
|
+
declare const stringMetaSchema: Schema;
|
|
6
|
+
declare const noForeignKeyStringMetaSchema: Schema;
|
|
7
|
+
declare const numberMetaSchema: Schema;
|
|
8
|
+
declare const booleanMetaSchema: Schema;
|
|
9
|
+
declare const objectMetaSchema: Schema;
|
|
10
|
+
declare const arrayMetaSchema: Schema;
|
|
11
|
+
declare const metaSchema: Schema;
|
|
12
|
+
declare const notForeignKeyMetaSchema: Schema;
|
|
13
|
+
|
|
14
|
+
declare const jsonPatchSchema: Schema;
|
|
15
|
+
|
|
16
|
+
declare const historyPatchesSchema: Schema;
|
|
17
|
+
|
|
18
|
+
declare const tableMigrationsSchema: Schema;
|
|
19
|
+
|
|
20
|
+
declare const sharedFields: {
|
|
21
|
+
deprecated: {
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
title: {
|
|
25
|
+
type: string;
|
|
26
|
+
};
|
|
27
|
+
description: {
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { arrayMetaSchema, baseStringFields, booleanMetaSchema, historyPatchesSchema, jsonPatchSchema, metaSchema, noForeignKeyStringMetaSchema, notForeignKeyMetaSchema, numberMetaSchema, objectMetaSchema, refMetaSchema, sharedFields, stringMetaSchema, tableMigrationsSchema };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Schema } from 'ajv/dist/2020';
|
|
2
|
+
|
|
3
|
+
declare const refMetaSchema: Schema;
|
|
4
|
+
declare const baseStringFields: Schema;
|
|
5
|
+
declare const stringMetaSchema: Schema;
|
|
6
|
+
declare const noForeignKeyStringMetaSchema: Schema;
|
|
7
|
+
declare const numberMetaSchema: Schema;
|
|
8
|
+
declare const booleanMetaSchema: Schema;
|
|
9
|
+
declare const objectMetaSchema: Schema;
|
|
10
|
+
declare const arrayMetaSchema: Schema;
|
|
11
|
+
declare const metaSchema: Schema;
|
|
12
|
+
declare const notForeignKeyMetaSchema: Schema;
|
|
13
|
+
|
|
14
|
+
declare const jsonPatchSchema: Schema;
|
|
15
|
+
|
|
16
|
+
declare const historyPatchesSchema: Schema;
|
|
17
|
+
|
|
18
|
+
declare const tableMigrationsSchema: Schema;
|
|
19
|
+
|
|
20
|
+
declare const sharedFields: {
|
|
21
|
+
deprecated: {
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
title: {
|
|
25
|
+
type: string;
|
|
26
|
+
};
|
|
27
|
+
description: {
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { arrayMetaSchema, baseStringFields, booleanMetaSchema, historyPatchesSchema, jsonPatchSchema, metaSchema, noForeignKeyStringMetaSchema, notForeignKeyMetaSchema, numberMetaSchema, objectMetaSchema, refMetaSchema, sharedFields, stringMetaSchema, tableMigrationsSchema };
|