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