schemair 0.1.0 → 0.3.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.
Files changed (83) hide show
  1. package/README.md +542 -32
  2. package/dist/authoring/index.cjs +13 -350
  3. package/dist/authoring/index.d.cts +2 -90
  4. package/dist/authoring/index.d.ts +2 -90
  5. package/dist/authoring/index.js +2 -304
  6. package/dist/authoring-Dnrg5TXm.cjs +389 -0
  7. package/dist/authoring-DyJNYs5o.js +362 -0
  8. package/dist/chunk-bFfwrPtJ.js +18 -0
  9. package/dist/compatibility/index.cjs +43 -0
  10. package/dist/compatibility/index.d.cts +2 -0
  11. package/dist/compatibility/index.d.ts +2 -0
  12. package/dist/compatibility/index.js +42 -0
  13. package/dist/definition/index.cjs +10 -2
  14. package/dist/definition/index.d.cts +3 -21
  15. package/dist/definition/index.d.ts +3 -21
  16. package/dist/definition/index.js +2 -2
  17. package/dist/definition-BH_LzXGc.js +1115 -0
  18. package/dist/definition-BLLBpLKv.cjs +1187 -0
  19. package/dist/index-1sDuqu05.d.ts +373 -0
  20. package/dist/index-BFSMT_2d.d.ts +53 -0
  21. package/dist/index-BGz7L_Fq.d.cts +73 -0
  22. package/dist/index-BTtdqi_M.d.ts +418 -0
  23. package/dist/index-BfbClf6R.d.cts +20 -0
  24. package/dist/index-CK7Is7vy.d.cts +420 -0
  25. package/dist/index-CUGhtuwA.d.cts +53 -0
  26. package/dist/index-CV8EZQy8.d.ts +92 -0
  27. package/dist/index-CzNxjqVg.d.cts +47 -0
  28. package/dist/index-DGHMUZ5m.d.cts +92 -0
  29. package/dist/{index-eK2Xgrwp.d.ts → index-DxvfPmw6.d.ts} +13 -9
  30. package/dist/index-T6nFhvGQ.d.ts +20 -0
  31. package/dist/{index-TACcK_mi.d.cts → index-ba_52Yu9.d.cts} +13 -9
  32. package/dist/index-hrcM9oJe.d.ts +47 -0
  33. package/dist/index-i7Au-FQ6.d.cts +373 -0
  34. package/dist/index-mu1znI1F.d.ts +73 -0
  35. package/dist/index.cjs +70 -58
  36. package/dist/index.d.cts +9 -7
  37. package/dist/index.d.ts +9 -7
  38. package/dist/index.js +10 -6
  39. package/dist/integrations/json-schema/index.cjs +328 -0
  40. package/dist/integrations/json-schema/index.d.cts +53 -0
  41. package/dist/integrations/json-schema/index.d.ts +53 -0
  42. package/dist/integrations/json-schema/index.js +324 -0
  43. package/dist/integrations/standard-schema/index.cjs +32 -0
  44. package/dist/integrations/standard-schema/index.d.cts +22 -0
  45. package/dist/integrations/standard-schema/index.d.ts +22 -0
  46. package/dist/integrations/standard-schema/index.js +32 -0
  47. package/dist/payload/index.cjs +45 -82
  48. package/dist/payload/index.d.cts +2 -56
  49. package/dist/payload/index.d.ts +2 -56
  50. package/dist/payload/index.js +45 -81
  51. package/dist/relations/index.cjs +3 -4
  52. package/dist/relations/index.d.cts +2 -2
  53. package/dist/relations/index.d.ts +2 -2
  54. package/dist/relations/index.js +2 -2
  55. package/dist/{relations-CMz_0nf4.cjs → relations-NUVJkAG8.cjs} +143 -211
  56. package/dist/{relations-By0bK3UK.js → relations-QtnCRW9x.js} +140 -202
  57. package/dist/resolve/index.cjs +308 -0
  58. package/dist/resolve/index.d.cts +2 -0
  59. package/dist/resolve/index.d.ts +2 -0
  60. package/dist/resolve/index.js +305 -0
  61. package/dist/schema-ref-key-BHVFVfj1.cjs +26 -0
  62. package/dist/schema-ref-key-DR__tPr-.js +14 -0
  63. package/dist/spec/index.cjs +9 -0
  64. package/dist/spec/index.d.cts +2 -2
  65. package/dist/spec/index.d.ts +2 -2
  66. package/dist/spec/index.js +3 -1
  67. package/dist/standard/index.cjs +810 -0
  68. package/dist/standard/index.d.cts +3 -0
  69. package/dist/standard/index.d.ts +3 -0
  70. package/dist/standard/index.js +777 -0
  71. package/dist/standard-BGMgbbEQ.js +471 -0
  72. package/dist/standard-etPFZDJI.cjs +513 -0
  73. package/dist/type-interpreter/index.cjs +3 -7
  74. package/dist/type-interpreter/index.d.cts +2 -99
  75. package/dist/type-interpreter/index.d.ts +2 -99
  76. package/dist/type-interpreter/index.js +2 -2
  77. package/dist/{type-interpreter-Ck0VDhzn.js → type-interpreter-BA8gcLUU.js} +58 -560
  78. package/dist/{type-interpreter-DAIBUqKf.cjs → type-interpreter-D8xETgq1.cjs} +63 -589
  79. package/package.json +60 -5
  80. package/dist/definition-BXj3T94L.js +0 -467
  81. package/dist/definition-DSZZTz4e.cjs +0 -473
  82. package/dist/index-CEzHfht2.d.ts +0 -269
  83. package/dist/index-rzkFjgrt.d.cts +0 -269
@@ -1,305 +1,3 @@
1
- //#region src/authoring/schema.ts
2
- function primitive(name, metadata) {
3
- if (metadata === void 0) return {
4
- kind: "primitive",
5
- name
6
- };
7
- return {
8
- kind: "primitive",
9
- name,
10
- ...metadata
11
- };
12
- }
13
- const string = (metadata) => primitive("string", metadata);
14
- const number = (metadata) => primitive("number", metadata);
15
- const boolean = () => primitive("boolean");
16
- const nullValue = () => primitive("null");
17
- function literal(value) {
18
- return {
19
- kind: "literal",
20
- literal: value
21
- };
22
- }
23
- function field(key, schema, options) {
24
- return options === void 0 ? {
25
- key,
26
- schema
27
- } : {
28
- key,
29
- schema,
30
- ...options
31
- };
32
- }
33
- function requiredField(key, schema, description) {
34
- return description === void 0 ? {
35
- key,
36
- schema,
37
- required: true
38
- } : {
39
- key,
40
- schema,
41
- required: true,
42
- description
43
- };
44
- }
45
- function optionalField(key, schema, description) {
46
- return description === void 0 ? {
47
- key,
48
- schema
49
- } : {
50
- key,
51
- schema,
52
- description
53
- };
54
- }
55
- function record(fields, options) {
56
- return options === void 0 ? {
57
- kind: "record",
58
- fields
59
- } : {
60
- kind: "record",
61
- fields,
62
- ...options
63
- };
64
- }
65
- function array(elementSchema, options) {
66
- return options === void 0 ? {
67
- kind: "array",
68
- elementSchema
69
- } : {
70
- kind: "array",
71
- elementSchema,
72
- ...options
73
- };
74
- }
75
- function tuple(elementSchemas) {
76
- return {
77
- kind: "tuple",
78
- elementSchemas
79
- };
80
- }
81
- function literalUnion(values) {
82
- return {
83
- kind: "literalUnion",
84
- values
85
- };
86
- }
87
- function nullable(value) {
88
- return {
89
- kind: "nullable",
90
- value
91
- };
92
- }
93
- function variant(key, schema, options) {
94
- return options === void 0 ? {
95
- key,
96
- schema
97
- } : {
98
- key,
99
- schema,
100
- ...options
101
- };
102
- }
103
- function taggedUnion(discriminator, variants) {
104
- return {
105
- kind: "taggedUnion",
106
- discriminator,
107
- variants
108
- };
109
- }
110
- function ref(refPath) {
111
- return {
112
- kind: "ref",
113
- refPath
114
- };
115
- }
116
- function selfRef() {
117
- return { kind: "selfRef" };
118
- }
1
+ import { n as schema_exports, t as expression_exports } from "../authoring-DyJNYs5o.js";
119
2
 
120
- //#endregion
121
- //#region src/authoring/expression.ts
122
- function typeVar(name, upperBound) {
123
- return upperBound === void 0 ? {
124
- kind: "typeVar",
125
- name
126
- } : {
127
- kind: "typeVar",
128
- name,
129
- extends: upperBound
130
- };
131
- }
132
- function opaqueHostType(hostPath) {
133
- return {
134
- kind: "opaqueHostType",
135
- hostPath
136
- };
137
- }
138
- function absent() {
139
- return { kind: "absent" };
140
- }
141
- function never() {
142
- return { kind: "never" };
143
- }
144
- function unknown() {
145
- return { kind: "unknown" };
146
- }
147
- function maybeAbsent(value) {
148
- return {
149
- kind: "maybeAbsent",
150
- value
151
- };
152
- }
153
- function arrayOf(element, constraints) {
154
- return constraints === void 0 ? {
155
- kind: "arrayOf",
156
- element
157
- } : {
158
- kind: "arrayOf",
159
- element,
160
- constraints
161
- };
162
- }
163
- function tupleOf(elements) {
164
- return {
165
- kind: "tupleOf",
166
- elements
167
- };
168
- }
169
- function recordOf(fields, options) {
170
- return options === void 0 ? {
171
- kind: "recordOf",
172
- fields
173
- } : {
174
- kind: "recordOf",
175
- fields,
176
- ...options
177
- };
178
- }
179
- function nullableOf(value) {
180
- return {
181
- kind: "nullableOf",
182
- value
183
- };
184
- }
185
- function taggedUnionOf(discriminator, variants) {
186
- return {
187
- kind: "taggedUnionOf",
188
- discriminator,
189
- variants
190
- };
191
- }
192
- function elementOf(source) {
193
- return {
194
- kind: "elementOf",
195
- source
196
- };
197
- }
198
- function valueOf(source) {
199
- return {
200
- kind: "valueOf",
201
- source
202
- };
203
- }
204
- function elementAt(source, index) {
205
- return {
206
- kind: "elementAt",
207
- source,
208
- index
209
- };
210
- }
211
- function fieldOf(source, key) {
212
- return {
213
- kind: "fieldOf",
214
- source,
215
- key
216
- };
217
- }
218
- function keyOf(source) {
219
- return {
220
- kind: "keyOf",
221
- source
222
- };
223
- }
224
- function allFields() {
225
- return { kind: "all" };
226
- }
227
- function selectKeys(keys, onMissing = "error") {
228
- return {
229
- kind: "keys",
230
- keys,
231
- onMissing
232
- };
233
- }
234
- function fieldsOf(source, fields) {
235
- return {
236
- kind: "fieldsOf",
237
- source,
238
- fields
239
- };
240
- }
241
- function pickFields(source, fields) {
242
- return {
243
- kind: "pickFields",
244
- source,
245
- fields
246
- };
247
- }
248
- function omitFields(source, fields) {
249
- return {
250
- kind: "omitFields",
251
- source,
252
- fields
253
- };
254
- }
255
- function partialFields(source, fields) {
256
- return {
257
- kind: "partialFields",
258
- source,
259
- fields
260
- };
261
- }
262
- function requiredFields(source, fields) {
263
- return {
264
- kind: "requiredFields",
265
- source,
266
- fields
267
- };
268
- }
269
- function mergeRecords(sources, conflict) {
270
- return {
271
- kind: "mergeRecords",
272
- sources,
273
- conflict
274
- };
275
- }
276
- function intersect(sources) {
277
- return {
278
- kind: "intersect",
279
- sources
280
- };
281
- }
282
- function refine(source, fields) {
283
- return {
284
- kind: "refine",
285
- source,
286
- fields
287
- };
288
- }
289
- function excludeVariants(source, variants) {
290
- return {
291
- kind: "excludeVariants",
292
- source,
293
- variants
294
- };
295
- }
296
- function extractVariants(source, variants) {
297
- return {
298
- kind: "extractVariants",
299
- source,
300
- variants
301
- };
302
- }
303
-
304
- //#endregion
305
- export { absent, allFields, array, arrayOf, boolean, elementAt, elementOf, excludeVariants, extractVariants, field, fieldOf, fieldsOf, intersect, keyOf, literal, literalUnion, maybeAbsent, mergeRecords, never, nullValue, nullable, nullableOf, number, omitFields, opaqueHostType, optionalField, partialFields, pickFields, primitive, record, recordOf, ref, refine, requiredField, requiredFields, selectKeys, selfRef, string, taggedUnion, taggedUnionOf, tuple, tupleOf, typeVar, unknown, valueOf, variant };
3
+ export { expression_exports as expression, schema_exports as schema };
@@ -0,0 +1,389 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+
19
+ //#region src/authoring/schema.ts
20
+ var schema_exports = /* @__PURE__ */ __exportAll({
21
+ array: () => array,
22
+ boolean: () => boolean,
23
+ defineSchemaRegistry: () => defineSchemaRegistry,
24
+ field: () => field,
25
+ literal: () => literal,
26
+ literalUnion: () => literalUnion,
27
+ nullValue: () => nullValue,
28
+ nullable: () => nullable,
29
+ number: () => number,
30
+ optionalField: () => optionalField,
31
+ primitive: () => primitive,
32
+ record: () => record,
33
+ ref: () => ref,
34
+ requiredField: () => requiredField,
35
+ selfRef: () => selfRef,
36
+ string: () => string,
37
+ taggedUnion: () => taggedUnion,
38
+ tuple: () => tuple,
39
+ variant: () => variant
40
+ });
41
+ function primitive(name, metadata) {
42
+ if (metadata === void 0) return {
43
+ kind: "primitive",
44
+ name
45
+ };
46
+ return {
47
+ kind: "primitive",
48
+ name,
49
+ ...metadata
50
+ };
51
+ }
52
+ const string = (metadata) => primitive("string", metadata);
53
+ const number = (metadata) => primitive("number", metadata);
54
+ const boolean = () => primitive("boolean");
55
+ const nullValue = () => primitive("null");
56
+ function literal(value) {
57
+ return {
58
+ kind: "literal",
59
+ literal: value
60
+ };
61
+ }
62
+ function field(key, schema, options) {
63
+ return options === void 0 ? {
64
+ key,
65
+ schema
66
+ } : {
67
+ key,
68
+ schema,
69
+ ...options
70
+ };
71
+ }
72
+ function requiredField(key, schema, description) {
73
+ return description === void 0 ? {
74
+ key,
75
+ schema,
76
+ required: true
77
+ } : {
78
+ key,
79
+ schema,
80
+ required: true,
81
+ description
82
+ };
83
+ }
84
+ function optionalField(key, schema, description) {
85
+ return description === void 0 ? {
86
+ key,
87
+ schema
88
+ } : {
89
+ key,
90
+ schema,
91
+ description
92
+ };
93
+ }
94
+ function record(fields, options) {
95
+ return options === void 0 ? {
96
+ kind: "record",
97
+ fields: [...fields]
98
+ } : {
99
+ kind: "record",
100
+ fields: [...fields],
101
+ ...options
102
+ };
103
+ }
104
+ function array(elementSchema, options) {
105
+ return options === void 0 ? {
106
+ kind: "array",
107
+ elementSchema
108
+ } : {
109
+ kind: "array",
110
+ elementSchema,
111
+ ...options
112
+ };
113
+ }
114
+ function tuple(elementSchemas) {
115
+ return {
116
+ kind: "tuple",
117
+ elementSchemas
118
+ };
119
+ }
120
+ function literalUnion(values) {
121
+ return {
122
+ kind: "literalUnion",
123
+ values
124
+ };
125
+ }
126
+ function nullable(value) {
127
+ return {
128
+ kind: "nullable",
129
+ value
130
+ };
131
+ }
132
+ function variant(key, schema, options) {
133
+ return options === void 0 ? {
134
+ key,
135
+ schema
136
+ } : {
137
+ key,
138
+ schema,
139
+ ...options
140
+ };
141
+ }
142
+ function taggedUnion(discriminator, variants) {
143
+ return {
144
+ kind: "taggedUnion",
145
+ discriminator,
146
+ variants
147
+ };
148
+ }
149
+ function ref(refPath) {
150
+ return {
151
+ kind: "ref",
152
+ refPath
153
+ };
154
+ }
155
+ function selfRef() {
156
+ return { kind: "selfRef" };
157
+ }
158
+ /** Preserve a statically authored registry as ordinary declaration data. */
159
+ function defineSchemaRegistry(entries) {
160
+ return entries;
161
+ }
162
+
163
+ //#endregion
164
+ //#region src/authoring/expression.ts
165
+ var expression_exports = /* @__PURE__ */ __exportAll({
166
+ absent: () => absent,
167
+ allFields: () => allFields,
168
+ arrayOf: () => arrayOf,
169
+ elementAt: () => elementAt,
170
+ elementOf: () => elementOf,
171
+ excludeVariants: () => excludeVariants,
172
+ extractVariants: () => extractVariants,
173
+ fieldOf: () => fieldOf,
174
+ fieldsOf: () => fieldsOf,
175
+ intersect: () => intersect,
176
+ keyOf: () => keyOf,
177
+ maybeAbsent: () => maybeAbsent,
178
+ mergeRecords: () => mergeRecords,
179
+ never: () => never,
180
+ nullableOf: () => nullableOf,
181
+ omitFields: () => omitFields,
182
+ opaqueHostType: () => opaqueHostType,
183
+ partialFields: () => partialFields,
184
+ pickFields: () => pickFields,
185
+ recordOf: () => recordOf,
186
+ refine: () => refine,
187
+ requiredFields: () => requiredFields,
188
+ selectKeys: () => selectKeys,
189
+ taggedUnionOf: () => taggedUnionOf,
190
+ tupleOf: () => tupleOf,
191
+ typeVar: () => typeVar,
192
+ unknown: () => unknown,
193
+ valueOf: () => valueOf
194
+ });
195
+ function typeVar(name, upperBound) {
196
+ return upperBound === void 0 ? {
197
+ kind: "typeVar",
198
+ name
199
+ } : {
200
+ kind: "typeVar",
201
+ name,
202
+ extends: upperBound
203
+ };
204
+ }
205
+ function opaqueHostType(hostPath) {
206
+ return {
207
+ kind: "opaqueHostType",
208
+ hostPath
209
+ };
210
+ }
211
+ function absent() {
212
+ return { kind: "absent" };
213
+ }
214
+ function never() {
215
+ return { kind: "never" };
216
+ }
217
+ function unknown() {
218
+ return { kind: "unknown" };
219
+ }
220
+ function maybeAbsent(value) {
221
+ return {
222
+ kind: "maybeAbsent",
223
+ value
224
+ };
225
+ }
226
+ function arrayOf(element, constraints) {
227
+ return constraints === void 0 ? {
228
+ kind: "arrayOf",
229
+ element
230
+ } : {
231
+ kind: "arrayOf",
232
+ element,
233
+ constraints
234
+ };
235
+ }
236
+ function tupleOf(elements) {
237
+ return {
238
+ kind: "tupleOf",
239
+ elements
240
+ };
241
+ }
242
+ function recordOf(fields, options) {
243
+ return options === void 0 ? {
244
+ kind: "recordOf",
245
+ fields
246
+ } : {
247
+ kind: "recordOf",
248
+ fields,
249
+ ...options
250
+ };
251
+ }
252
+ function nullableOf(value) {
253
+ return {
254
+ kind: "nullableOf",
255
+ value
256
+ };
257
+ }
258
+ function taggedUnionOf(discriminator, variants) {
259
+ return {
260
+ kind: "taggedUnionOf",
261
+ discriminator,
262
+ variants
263
+ };
264
+ }
265
+ function elementOf(source) {
266
+ return {
267
+ kind: "elementOf",
268
+ source
269
+ };
270
+ }
271
+ function valueOf(source) {
272
+ return {
273
+ kind: "valueOf",
274
+ source
275
+ };
276
+ }
277
+ function elementAt(source, index) {
278
+ return {
279
+ kind: "elementAt",
280
+ source,
281
+ index
282
+ };
283
+ }
284
+ function fieldOf(source, key) {
285
+ return {
286
+ kind: "fieldOf",
287
+ source,
288
+ key
289
+ };
290
+ }
291
+ function keyOf(source) {
292
+ return {
293
+ kind: "keyOf",
294
+ source
295
+ };
296
+ }
297
+ function allFields() {
298
+ return { kind: "all" };
299
+ }
300
+ function selectKeys(keys, onMissing = "error") {
301
+ return {
302
+ kind: "keys",
303
+ keys,
304
+ onMissing
305
+ };
306
+ }
307
+ function fieldsOf(source, fields) {
308
+ return {
309
+ kind: "fieldsOf",
310
+ source,
311
+ fields
312
+ };
313
+ }
314
+ function pickFields(source, fields) {
315
+ return {
316
+ kind: "pickFields",
317
+ source,
318
+ fields
319
+ };
320
+ }
321
+ function omitFields(source, fields) {
322
+ return {
323
+ kind: "omitFields",
324
+ source,
325
+ fields
326
+ };
327
+ }
328
+ function partialFields(source, fields) {
329
+ return {
330
+ kind: "partialFields",
331
+ source,
332
+ fields
333
+ };
334
+ }
335
+ function requiredFields(source, fields) {
336
+ return {
337
+ kind: "requiredFields",
338
+ source,
339
+ fields
340
+ };
341
+ }
342
+ function mergeRecords(sources, conflict) {
343
+ return {
344
+ kind: "mergeRecords",
345
+ sources,
346
+ conflict
347
+ };
348
+ }
349
+ function intersect(sources) {
350
+ return {
351
+ kind: "intersect",
352
+ sources
353
+ };
354
+ }
355
+ function refine(source, fields) {
356
+ return {
357
+ kind: "refine",
358
+ source,
359
+ fields
360
+ };
361
+ }
362
+ function excludeVariants(source, variants) {
363
+ return {
364
+ kind: "excludeVariants",
365
+ source,
366
+ variants
367
+ };
368
+ }
369
+ function extractVariants(source, variants) {
370
+ return {
371
+ kind: "extractVariants",
372
+ source,
373
+ variants
374
+ };
375
+ }
376
+
377
+ //#endregion
378
+ Object.defineProperty(exports, 'expression_exports', {
379
+ enumerable: true,
380
+ get: function () {
381
+ return expression_exports;
382
+ }
383
+ });
384
+ Object.defineProperty(exports, 'schema_exports', {
385
+ enumerable: true,
386
+ get: function () {
387
+ return schema_exports;
388
+ }
389
+ });