@dzeio/schema 0.8.0 → 0.10.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/dist/Schema.mjs CHANGED
@@ -10,12 +10,104 @@ var __decorateClass = (decorators, target, key, kind) => {
10
10
  };
11
11
 
12
12
  // src/helpers.ts
13
- import { objectClone, objectGet, objectLoop, objectSet as objectSet2 } from "@dzeio/object-util";
13
+ import { objectGet, objectLoop, objectSet } from "@dzeio/object-util";
14
+ function isNull(value) {
15
+ return value === void 0 || value === null;
16
+ }
17
+ function parseQuery(schema, query, opts) {
18
+ const record = {};
19
+ for (const [key, value] of query) {
20
+ const keys = key.split(".").map((it) => /^\d+$/g.test(it) ? Number.parseInt(it, 10) : it);
21
+ const schemaItem = getSchemaItemAtPath(schema, keys);
22
+ const allValues = query.getAll(key);
23
+ const finalValue = (schemaItem == null ? void 0 : schemaItem.parse(allValues).valid) ? allValues : value;
24
+ objectSet(record, keys, finalValue);
25
+ }
26
+ return schema.parse(record, opts);
27
+ }
28
+ function parseFormData(schema, data, opts) {
29
+ const record = {};
30
+ for (const [key, value] of data) {
31
+ const keys = key.split(".").map((it) => /^\d+$/g.test(it) ? Number.parseInt(it, 10) : it);
32
+ const schemaItem = getSchemaItemAtPath(schema, keys);
33
+ const allValues = data.getAll(key);
34
+ const finalValue = (schemaItem == null ? void 0 : schemaItem.parse(allValues).valid) ? allValues : value;
35
+ objectSet(record, keys, finalValue);
36
+ }
37
+ const handleBoolean = (value, keys) => {
38
+ var _a;
39
+ if (value instanceof SchemaNullable) {
40
+ handleBoolean(value.unwrap(), keys);
41
+ }
42
+ if (value instanceof SchemaArray) {
43
+ const elements = objectGet(record, keys);
44
+ for (let it = 0; it < ((_a = elements == null ? void 0 : elements.length) != null ? _a : 0); it++) {
45
+ handleBoolean(value.unwrap(), [...keys, it]);
46
+ }
47
+ }
48
+ if (value instanceof SchemaObject) {
49
+ handleSchemaForBoolean(value.model, keys);
50
+ }
51
+ if (value instanceof SchemaBoolean && typeof objectGet(record, keys) === "undefined") {
52
+ objectSet(record, keys, false);
53
+ }
54
+ };
55
+ const handleSchemaForBoolean = (model, keys = []) => {
56
+ objectLoop(model, (value, key) => {
57
+ handleBoolean(value, [...keys, key]);
58
+ });
59
+ };
60
+ if (schema instanceof SchemaObject) {
61
+ handleSchemaForBoolean(schema.model);
62
+ }
63
+ return schema.parse(record, opts);
64
+ }
65
+ function parseForm(model, form, opts) {
66
+ return parseFormData(model, new FormData(form), opts);
67
+ }
68
+ function getSchemaItemAtPath(schema, path) {
69
+ while (schema instanceof SchemaNullable || schema instanceof SchemaDefault) {
70
+ schema = schema.unwrap();
71
+ }
72
+ if (path.length === 0 || !schema) {
73
+ return schema;
74
+ }
75
+ if (schema instanceof SchemaUnion || schema instanceof SchemaIntersection) {
76
+ for (const child of schema.unwrap()) {
77
+ try {
78
+ const result = getSchemaItemAtPath(child, path);
79
+ if (!result) {
80
+ continue;
81
+ }
82
+ return result;
83
+ } catch {
84
+ continue;
85
+ }
86
+ }
87
+ return void 0;
88
+ }
89
+ const key = path[0];
90
+ const next = path.slice(1);
91
+ if (schema instanceof SchemaArray && typeof key === "number") {
92
+ return getSchemaItemAtPath(schema.unwrap(), next);
93
+ }
94
+ if (schema instanceof SchemaTuple && typeof key === "number") {
95
+ return getSchemaItemAtPath(schema.unwrap()[key], next);
96
+ }
97
+ if (schema instanceof SchemaObject && typeof key === "string") {
98
+ return getSchemaItemAtPath(schema.model[key], next);
99
+ }
100
+ if (schema instanceof SchemaRecord && schema.isKeyOfType(key)) {
101
+ return getSchemaItemAtPath(schema.unwrap(), next);
102
+ }
103
+ return void 0;
104
+ }
14
105
 
15
106
  // src/SchemaItem.ts
16
- import { isObject, objectClean, objectRemap, objectSet } from "@dzeio/object-util";
107
+ import { isObject, objectClean, objectRemap, objectSet as objectSet2 } from "@dzeio/object-util";
17
108
  var _SchemaItem = class _SchemaItem {
18
109
  constructor(items) {
110
+ this.id = this.constructor.id;
19
111
  // standard Schema V1 spec
20
112
  this["~standard"] = {
21
113
  vendor: "aptatio",
@@ -52,7 +144,6 @@ var _SchemaItem = class _SchemaItem {
52
144
  *
53
145
  * note: The type of the final Pre-Process MUST be valid
54
146
  */
55
- // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
56
147
  this.preProcess = [];
57
148
  /**
58
149
  * post process the variable after it being validated
@@ -69,6 +160,10 @@ var _SchemaItem = class _SchemaItem {
69
160
  this.items = Array.isArray(items) ? items : Array.from(items);
70
161
  }
71
162
  }
163
+ setInvalidError(err) {
164
+ this.invalidError = err;
165
+ return this;
166
+ }
72
167
  parseJSON() {
73
168
  this.addPreProcess((input) => {
74
169
  try {
@@ -90,10 +185,6 @@ var _SchemaItem = class _SchemaItem {
90
185
  attr(...attributes) {
91
186
  return this.attrs(...attributes);
92
187
  }
93
- setInvalidError(err) {
94
- this.invalidError = err;
95
- return this;
96
- }
97
188
  clone() {
98
189
  return Schema.fromJSON(this.toJSON());
99
190
  }
@@ -169,21 +260,10 @@ var _SchemaItem = class _SchemaItem {
169
260
  objectClean(res, { deep: false });
170
261
  return res;
171
262
  }
172
- deepSerializeItem(item) {
173
- if (item instanceof _SchemaItem) {
174
- return item.toJSON();
175
- } else if (Array.isArray(item)) {
176
- return item.map((it) => this.deepSerializeItem(it));
177
- } else if (isObject(item)) {
178
- return objectRemap(item, (value, key) => ({ value: this.deepSerializeItem(value), key }));
179
- }
180
- return item;
181
- }
182
263
  addValidation(fn, error) {
183
264
  this.validations.push(typeof fn === "function" ? { fn, error } : fn);
184
265
  return this;
185
266
  }
186
- // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
187
267
  addPreProcess(fn) {
188
268
  this.preProcess.push(fn);
189
269
  return this;
@@ -199,7 +279,7 @@ var _SchemaItem = class _SchemaItem {
199
279
  /** Sets the "part" of the input that this sub schema handles. Overrides the input with the result */
200
280
  updateSubItemInput(path, input, value) {
201
281
  if (path && isObject(input)) {
202
- objectSet(input, path.split("."), value);
282
+ objectSet2(input, path.split("."), value);
203
283
  return input;
204
284
  } else {
205
285
  return value;
@@ -223,217 +303,27 @@ var _SchemaItem = class _SchemaItem {
223
303
  }
224
304
  return result;
225
305
  }
226
- };
227
- __decorateClass([
228
- parsable()
229
- ], _SchemaItem.prototype, "parseJSON", 1);
230
- __decorateClass([
231
- parsable()
232
- ], _SchemaItem.prototype, "in", 1);
233
- var SchemaItem = _SchemaItem;
234
-
235
- // src/items/array.ts
236
- var SchemaArray = class extends SchemaItem {
237
- constructor(values) {
238
- super([values]);
239
- this.values = values;
240
- }
241
- unique() {
242
- this.postProcess.push((input) => input.filter((it, idx) => input.indexOf(it) === idx));
243
- return this;
244
- }
245
- clean() {
246
- this.postProcess.push((input) => input.filter((it) => !isNull(it)));
247
- return this;
248
- }
249
- split(separator = ",") {
250
- this.addPreProcess((it) => typeof it === "string" ? it.split(separator) : it);
251
- return this;
252
- }
253
- unwrap() {
254
- return this.values;
255
- }
256
- isOfType(input) {
257
- return Array.isArray(input) && input.every((entry) => this.values.isOfType(entry));
258
- }
259
- getSubInputs(input) {
260
- return Array.isArray(input) ? input.map((entry, index) => ({ item: this.values, value: entry, path: index.toString() })) : [];
261
- }
262
- };
263
- SchemaArray.id = "array";
264
- __decorateClass([
265
- parsable()
266
- ], SchemaArray.prototype, "unique", 1);
267
- __decorateClass([
268
- parsable()
269
- ], SchemaArray.prototype, "clean", 1);
270
- __decorateClass([
271
- parsable()
272
- ], SchemaArray.prototype, "split", 1);
273
-
274
- // src/items/boolean.ts
275
- var SchemaBoolean = class extends SchemaItem {
276
- parseString(trueValue = "true", falseValue = "false") {
277
- this.addPreProcess((input) => {
278
- if (typeof input !== "string") {
279
- return input;
280
- }
281
- if (input === trueValue) {
282
- return true;
283
- }
284
- if (input === falseValue) {
285
- return false;
286
- }
287
- return input;
288
- });
289
- return this;
290
- }
291
- isOfType(input) {
292
- return typeof input === "boolean";
293
- }
294
- };
295
- SchemaBoolean.id = "boolean";
296
- __decorateClass([
297
- parsable()
298
- ], SchemaBoolean.prototype, "parseString", 1);
299
-
300
- // src/items/nullable.ts
301
- var SchemaNullable = class extends SchemaItem {
302
- constructor(child) {
303
- super([child]);
304
- this.child = child;
305
- }
306
- falsyAsNull() {
307
- this.addPreProcess((it) => !it ? void 0 : it);
308
- return this;
309
- }
310
- emptyAsNull() {
311
- this.addPreProcess((it) => it === "" ? void 0 : it);
312
- return this;
313
- }
314
- emptyFileAsNull() {
315
- this.addPreProcess((it) => it instanceof File && it.size === 0 ? void 0 : it);
316
- return this;
317
- }
318
- unwrap() {
319
- return this.child;
320
- }
321
- isOfType(input) {
322
- return typeof input === "undefined" || this.child.isOfType(input);
323
- }
324
- getSubInputs(input) {
325
- return [{ value: input, item: this.child, path: void 0 }];
326
- }
327
- parseSubItems(input, options) {
328
- if (isNull(input)) {
329
- return { input: void 0 };
306
+ deepSerializeItem(item) {
307
+ if (item instanceof _SchemaItem) {
308
+ return item.toJSON();
309
+ } else if (Array.isArray(item)) {
310
+ return item.map((it) => this.deepSerializeItem(it));
311
+ } else if (isObject(item)) {
312
+ return objectRemap(item, (value, key) => ({ value: this.deepSerializeItem(value), key }));
330
313
  }
331
- return super.parseSubItems(input, options);
314
+ return item;
332
315
  }
333
316
  };
334
- SchemaNullable.id = "nullable";
335
317
  __decorateClass([
336
318
  parsable()
337
- ], SchemaNullable.prototype, "falsyAsNull", 1);
319
+ ], _SchemaItem.prototype, "setInvalidError", 1);
338
320
  __decorateClass([
339
321
  parsable()
340
- ], SchemaNullable.prototype, "emptyAsNull", 1);
322
+ ], _SchemaItem.prototype, "parseJSON", 1);
341
323
  __decorateClass([
342
324
  parsable()
343
- ], SchemaNullable.prototype, "emptyFileAsNull", 1);
344
-
345
- // src/items/object.ts
346
- import { isObject as isObject2, objectFind, objectMap } from "@dzeio/object-util";
347
- var SchemaObject = class extends SchemaItem {
348
- constructor(model) {
349
- super([model]);
350
- this.model = model;
351
- }
352
- isOfType(input) {
353
- return isObject2(input) && !objectFind(this.model, (item, key) => !item.isOfType(input[key]));
354
- }
355
- getSubInputs(input) {
356
- return isObject2(input) ? objectMap(this.model, (schema, key) => ({ item: schema, value: input[key], path: key.toString() })) : [];
357
- }
358
- };
359
- SchemaObject.id = "object";
360
-
361
- // src/helpers.ts
362
- function isNull(value) {
363
- return typeof value === "undefined" || value === null;
364
- }
365
- function parseQuery(schema, query, opts) {
366
- const record = {};
367
- for (const [key, value] of query) {
368
- const keys = key.split(".").map((it) => /^\d+$/g.test(it) ? Number.parseInt(it, 10) : it);
369
- const schemaItem = getSchemaItemAtPath(schema, keys);
370
- const allValues = query.getAll(key);
371
- const finalValue = schemaItem && schemaItem.parse(allValues).valid ? allValues : value;
372
- objectSet2(record, keys, finalValue);
373
- }
374
- return schema.parse(record, opts);
375
- }
376
- function parseFormData(schema, data, opts) {
377
- const record = {};
378
- for (const [key, value] of data) {
379
- const keys = key.split(".").map((it) => /^\d+$/g.test(it) ? Number.parseInt(it, 10) : it);
380
- const schemaItem = getSchemaItemAtPath(schema, keys);
381
- const allValues = data.getAll(key);
382
- const finalValue = schemaItem && schemaItem.parse(allValues).valid ? allValues : value;
383
- objectSet2(record, keys, finalValue);
384
- }
385
- const handleBoolean = (value, keys) => {
386
- var _a;
387
- if (value instanceof SchemaNullable) {
388
- handleBoolean(value.unwrap(), keys);
389
- }
390
- if (value instanceof SchemaArray) {
391
- const elements = objectGet(record, keys);
392
- for (let it = 0; it < ((_a = elements == null ? void 0 : elements.length) != null ? _a : 0); it++) {
393
- handleBoolean(value.unwrap(), [...keys, it]);
394
- }
395
- }
396
- if (value instanceof SchemaObject) {
397
- handleSchemaForBoolean(value.model, keys);
398
- }
399
- if (value instanceof SchemaBoolean) {
400
- objectSet2(record, keys, !!data.get(keys.join(".")));
401
- }
402
- };
403
- const handleSchemaForBoolean = (model, keys = []) => {
404
- objectLoop(model, (value, key) => {
405
- handleBoolean(value, [...keys, key]);
406
- });
407
- };
408
- if (schema instanceof SchemaObject) {
409
- handleSchemaForBoolean(schema.model);
410
- }
411
- return schema.parse(record, opts);
412
- }
413
- function parseForm(model, form, opts) {
414
- return parseFormData(model, new FormData(form), opts);
415
- }
416
- function getSchemaItemAtPath(schema, path) {
417
- let current = schema;
418
- const internalPath = objectClone(path);
419
- for (const key of path) {
420
- if (!current) {
421
- return void 0;
422
- }
423
- internalPath.shift();
424
- while (current instanceof SchemaNullable || current instanceof SchemaDefault) {
425
- current = current.unwrap();
426
- }
427
- if (current instanceof SchemaObject) {
428
- current = current.model[key];
429
- current = getSchemaItemAtPath(current, internalPath);
430
- }
431
- }
432
- while (current instanceof SchemaNullable || current instanceof SchemaDefault) {
433
- current = current.unwrap();
434
- }
435
- return current;
436
- }
325
+ ], _SchemaItem.prototype, "in", 1);
326
+ var SchemaItem = _SchemaItem;
437
327
 
438
328
  // src/items/any.ts
439
329
  var SchemaAny = class extends SchemaItem {
@@ -474,7 +364,7 @@ var SchemaDate = class extends SchemaItem {
474
364
  break;
475
365
  }
476
366
  }
477
- if (!date || isNaN(date.getDate())) {
367
+ if (!date || Number.isNaN(date.getDate())) {
478
368
  return input;
479
369
  }
480
370
  return date;
@@ -491,19 +381,25 @@ __decorateClass([
491
381
  ], SchemaDate.prototype, "parseString", 1);
492
382
 
493
383
  // src/items/record.ts
494
- import { isObject as isObject3, objectLoop as objectLoop2 } from "@dzeio/object-util";
384
+ import { isObject as isObject2, objectLoop as objectLoop2 } from "@dzeio/object-util";
495
385
  var SchemaRecord = class extends SchemaItem {
496
386
  constructor(keys, values) {
497
387
  super([keys, values]);
498
388
  this.keys = keys;
499
389
  this.values = values;
500
390
  }
391
+ unwrap() {
392
+ return this.values;
393
+ }
394
+ isKeyOfType(key) {
395
+ return this.keys.parse(key).valid;
396
+ }
501
397
  isOfType(input) {
502
- return isObject3(input) && Object.prototype.toString.call(input) === "[object Object]";
398
+ return isObject2(input) && Object.prototype.toString.call(input) === "[object Object]";
503
399
  }
504
400
  parseSubItems(input, options) {
505
401
  const result = { input, errors: [] };
506
- if (isObject3(input)) {
402
+ if (isObject2(input)) {
507
403
  const clone = {};
508
404
  objectLoop2(input, (value, key) => {
509
405
  var _a, _b;
@@ -526,6 +422,71 @@ var SchemaRecord = class extends SchemaItem {
526
422
  };
527
423
  SchemaRecord.id = "record";
528
424
 
425
+ // src/items/array.ts
426
+ var SchemaArray = class extends SchemaItem {
427
+ constructor(values) {
428
+ super([values]);
429
+ this.values = values;
430
+ }
431
+ unique() {
432
+ this.postProcess.push((input) => input.filter((it, idx) => input.indexOf(it) === idx));
433
+ return this;
434
+ }
435
+ clean() {
436
+ this.postProcess.push((input) => input.filter((it) => !isNull(it)));
437
+ return this;
438
+ }
439
+ split(separator = ",") {
440
+ this.addPreProcess((it) => typeof it === "string" ? it.split(separator) : it);
441
+ return this;
442
+ }
443
+ unwrap() {
444
+ return this.values;
445
+ }
446
+ isOfType(input) {
447
+ return Array.isArray(input) && input.every((entry) => this.values.isOfType(entry));
448
+ }
449
+ getSubInputs(input) {
450
+ return Array.isArray(input) ? input.map((entry, index) => ({ item: this.values, value: entry, path: index.toString() })) : [];
451
+ }
452
+ };
453
+ SchemaArray.id = "array";
454
+ __decorateClass([
455
+ parsable()
456
+ ], SchemaArray.prototype, "unique", 1);
457
+ __decorateClass([
458
+ parsable()
459
+ ], SchemaArray.prototype, "clean", 1);
460
+ __decorateClass([
461
+ parsable()
462
+ ], SchemaArray.prototype, "split", 1);
463
+
464
+ // src/items/boolean.ts
465
+ var SchemaBoolean = class extends SchemaItem {
466
+ parseString(trueValue = "true", falseValue = "false") {
467
+ this.addPreProcess((input) => {
468
+ if (typeof input !== "string") {
469
+ return input;
470
+ }
471
+ if (input === trueValue) {
472
+ return true;
473
+ }
474
+ if (input === falseValue) {
475
+ return false;
476
+ }
477
+ return input;
478
+ });
479
+ return this;
480
+ }
481
+ isOfType(input) {
482
+ return typeof input === "boolean";
483
+ }
484
+ };
485
+ SchemaBoolean.id = "boolean";
486
+ __decorateClass([
487
+ parsable()
488
+ ], SchemaBoolean.prototype, "parseString", 1);
489
+
529
490
  // src/items/enum.ts
530
491
  var SchemaEnum = class extends SchemaItem {
531
492
  constructor(templateEnum) {
@@ -560,6 +521,51 @@ var SchemaLiteral = class extends SchemaItem {
560
521
  };
561
522
  SchemaLiteral.id = "literal";
562
523
 
524
+ // src/items/nullable.ts
525
+ var SchemaNullable = class extends SchemaItem {
526
+ constructor(child) {
527
+ super([child]);
528
+ this.child = child;
529
+ }
530
+ falsyAsNull() {
531
+ this.addPreProcess((it) => !it ? void 0 : it);
532
+ return this;
533
+ }
534
+ emptyAsNull() {
535
+ this.addPreProcess((it) => it === "" ? void 0 : it);
536
+ return this;
537
+ }
538
+ emptyFileAsNull() {
539
+ this.addPreProcess((it) => it instanceof File && it.size === 0 ? void 0 : it);
540
+ return this;
541
+ }
542
+ unwrap() {
543
+ return this.child;
544
+ }
545
+ isOfType(input) {
546
+ return input === void 0 || this.child.isOfType(input);
547
+ }
548
+ getSubInputs(input) {
549
+ return [{ value: input, item: this.child, path: void 0 }];
550
+ }
551
+ parseSubItems(input, options) {
552
+ if (isNull(input)) {
553
+ return { input: void 0 };
554
+ }
555
+ return super.parseSubItems(input, options);
556
+ }
557
+ };
558
+ SchemaNullable.id = "nullable";
559
+ __decorateClass([
560
+ parsable()
561
+ ], SchemaNullable.prototype, "falsyAsNull", 1);
562
+ __decorateClass([
563
+ parsable()
564
+ ], SchemaNullable.prototype, "emptyAsNull", 1);
565
+ __decorateClass([
566
+ parsable()
567
+ ], SchemaNullable.prototype, "emptyFileAsNull", 1);
568
+
563
569
  // src/items/number.ts
564
570
  var SchemaNumber = class extends SchemaItem {
565
571
  lte(value, message) {
@@ -629,6 +635,22 @@ __decorateClass([
629
635
  parsable()
630
636
  ], SchemaNumber.prototype, "parseString", 1);
631
637
 
638
+ // src/items/object.ts
639
+ import { isObject as isObject3, objectFind, objectMap } from "@dzeio/object-util";
640
+ var SchemaObject = class extends SchemaItem {
641
+ constructor(model) {
642
+ super([model]);
643
+ this.model = model;
644
+ }
645
+ isOfType(input) {
646
+ return isObject3(input) && !objectFind(this.model, (item, key) => !item.isOfType(input[key]));
647
+ }
648
+ getSubInputs(input) {
649
+ return isObject3(input) ? objectMap(this.model, (schema, key) => ({ item: schema, value: input[key], path: key.toString() })) : [];
650
+ }
651
+ };
652
+ SchemaObject.id = "object";
653
+
632
654
  // src/items/string.ts
633
655
  var SchemaString = class extends SchemaItem {
634
656
  min(value, message) {
@@ -654,6 +676,15 @@ var SchemaString = class extends SchemaItem {
654
676
  });
655
677
  return this;
656
678
  }
679
+ trim() {
680
+ this.addPreProcess((input) => {
681
+ if (typeof input !== "string") {
682
+ return input;
683
+ }
684
+ return input.trim();
685
+ });
686
+ return this;
687
+ }
657
688
  notEmpty(message) {
658
689
  this.addValidation({
659
690
  fn(input) {
@@ -701,6 +732,9 @@ __decorateClass([
701
732
  __decorateClass([
702
733
  parsable()
703
734
  ], SchemaString.prototype, "max", 1);
735
+ __decorateClass([
736
+ parsable()
737
+ ], SchemaString.prototype, "trim", 1);
704
738
  __decorateClass([
705
739
  parsable()
706
740
  ], SchemaString.prototype, "notEmpty", 1);
@@ -717,6 +751,9 @@ var SchemaUnion = class extends SchemaItem {
717
751
  super(schemas);
718
752
  this.schemas = schemas;
719
753
  }
754
+ unwrap() {
755
+ return this.schemas;
756
+ }
720
757
  isOfType(input) {
721
758
  return this.schemas.some((it) => it.isOfType(input));
722
759
  }
@@ -742,6 +779,9 @@ var SchemaIntersection = class extends SchemaItem {
742
779
  super(schemas);
743
780
  this.schemas = schemas;
744
781
  }
782
+ unwrap() {
783
+ return this.schemas;
784
+ }
745
785
  isOfType(input) {
746
786
  return this.schemas.every((it) => it.isOfType(input));
747
787
  }
@@ -816,6 +856,9 @@ var SchemaTuple = class extends SchemaItem {
816
856
  super(children);
817
857
  this.children = children;
818
858
  }
859
+ unwrap() {
860
+ return this.children;
861
+ }
819
862
  isOfType(input) {
820
863
  if (!Array.isArray(input) || input.length > this.items.length) {
821
864
  return false;
@@ -836,7 +879,7 @@ SchemaTuple.id = "tuple";
836
879
  // src/items/nullish.ts
837
880
  var SchemaUndefined = class extends SchemaItem {
838
881
  isOfType(input) {
839
- return typeof input === "undefined";
882
+ return input === void 0;
840
883
  }
841
884
  };
842
885
  SchemaUndefined.id = "undefined";
@@ -848,7 +891,7 @@ var SchemaNull = class extends SchemaItem {
848
891
  SchemaNull.id = "null";
849
892
  var SchemaVoid = class extends SchemaItem {
850
893
  isOfType(input) {
851
- return typeof input === "undefined";
894
+ return input === void 0;
852
895
  }
853
896
  };
854
897
  SchemaVoid.id = "void";
@@ -1063,10 +1106,12 @@ export {
1063
1106
  SchemaObject,
1064
1107
  SchemaRecord,
1065
1108
  SchemaString,
1109
+ SchemaTuple,
1066
1110
  SchemaUndefined,
1067
1111
  SchemaUnion,
1068
1112
  SchemaVoid,
1069
1113
  Schema as default,
1114
+ getSchemaItemAtPath,
1070
1115
  isNull,
1071
1116
  parsable,
1072
1117
  parseForm,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzeio/schema",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "dependencies": {
5
5
  "@dzeio/object-util": "^1.9.2"
6
6
  },