@dzeio/schema 0.9.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,220 +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
- __decorateClass([
234
- parsable()
235
- ], _SchemaItem.prototype, "setInvalidError", 1);
236
- var SchemaItem = _SchemaItem;
237
-
238
- // src/items/array.ts
239
- var SchemaArray = class extends SchemaItem {
240
- constructor(values) {
241
- super([values]);
242
- this.values = values;
243
- }
244
- unique() {
245
- this.postProcess.push((input) => input.filter((it, idx) => input.indexOf(it) === idx));
246
- return this;
247
- }
248
- clean() {
249
- this.postProcess.push((input) => input.filter((it) => !isNull(it)));
250
- return this;
251
- }
252
- split(separator = ",") {
253
- this.addPreProcess((it) => typeof it === "string" ? it.split(separator) : it);
254
- return this;
255
- }
256
- unwrap() {
257
- return this.values;
258
- }
259
- isOfType(input) {
260
- return Array.isArray(input) && input.every((entry) => this.values.isOfType(entry));
261
- }
262
- getSubInputs(input) {
263
- return Array.isArray(input) ? input.map((entry, index) => ({ item: this.values, value: entry, path: index.toString() })) : [];
264
- }
265
- };
266
- SchemaArray.id = "array";
267
- __decorateClass([
268
- parsable()
269
- ], SchemaArray.prototype, "unique", 1);
270
- __decorateClass([
271
- parsable()
272
- ], SchemaArray.prototype, "clean", 1);
273
- __decorateClass([
274
- parsable()
275
- ], SchemaArray.prototype, "split", 1);
276
-
277
- // src/items/boolean.ts
278
- var SchemaBoolean = class extends SchemaItem {
279
- parseString(trueValue = "true", falseValue = "false") {
280
- this.addPreProcess((input) => {
281
- if (typeof input !== "string") {
282
- return input;
283
- }
284
- if (input === trueValue) {
285
- return true;
286
- }
287
- if (input === falseValue) {
288
- return false;
289
- }
290
- return input;
291
- });
292
- return this;
293
- }
294
- isOfType(input) {
295
- return typeof input === "boolean";
296
- }
297
- };
298
- SchemaBoolean.id = "boolean";
299
- __decorateClass([
300
- parsable()
301
- ], SchemaBoolean.prototype, "parseString", 1);
302
-
303
- // src/items/nullable.ts
304
- var SchemaNullable = class extends SchemaItem {
305
- constructor(child) {
306
- super([child]);
307
- this.child = child;
308
- }
309
- falsyAsNull() {
310
- this.addPreProcess((it) => !it ? void 0 : it);
311
- return this;
312
- }
313
- emptyAsNull() {
314
- this.addPreProcess((it) => it === "" ? void 0 : it);
315
- return this;
316
- }
317
- emptyFileAsNull() {
318
- this.addPreProcess((it) => it instanceof File && it.size === 0 ? void 0 : it);
319
- return this;
320
- }
321
- unwrap() {
322
- return this.child;
323
- }
324
- isOfType(input) {
325
- return typeof input === "undefined" || this.child.isOfType(input);
326
- }
327
- getSubInputs(input) {
328
- return [{ value: input, item: this.child, path: void 0 }];
329
- }
330
- parseSubItems(input, options) {
331
- if (isNull(input)) {
332
- 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 }));
333
313
  }
334
- return super.parseSubItems(input, options);
314
+ return item;
335
315
  }
336
316
  };
337
- SchemaNullable.id = "nullable";
338
317
  __decorateClass([
339
318
  parsable()
340
- ], SchemaNullable.prototype, "falsyAsNull", 1);
319
+ ], _SchemaItem.prototype, "setInvalidError", 1);
341
320
  __decorateClass([
342
321
  parsable()
343
- ], SchemaNullable.prototype, "emptyAsNull", 1);
322
+ ], _SchemaItem.prototype, "parseJSON", 1);
344
323
  __decorateClass([
345
324
  parsable()
346
- ], SchemaNullable.prototype, "emptyFileAsNull", 1);
347
-
348
- // src/items/object.ts
349
- import { isObject as isObject2, objectFind, objectMap } from "@dzeio/object-util";
350
- var SchemaObject = class extends SchemaItem {
351
- constructor(model) {
352
- super([model]);
353
- this.model = model;
354
- }
355
- isOfType(input) {
356
- return isObject2(input) && !objectFind(this.model, (item, key) => !item.isOfType(input[key]));
357
- }
358
- getSubInputs(input) {
359
- return isObject2(input) ? objectMap(this.model, (schema, key) => ({ item: schema, value: input[key], path: key.toString() })) : [];
360
- }
361
- };
362
- SchemaObject.id = "object";
363
-
364
- // src/helpers.ts
365
- function isNull(value) {
366
- return typeof value === "undefined" || value === null;
367
- }
368
- function parseQuery(schema, query, opts) {
369
- const record = {};
370
- for (const [key, value] of query) {
371
- const keys = key.split(".").map((it) => /^\d+$/g.test(it) ? Number.parseInt(it, 10) : it);
372
- const schemaItem = getSchemaItemAtPath(schema, keys);
373
- const allValues = query.getAll(key);
374
- const finalValue = schemaItem && schemaItem.parse(allValues).valid ? allValues : value;
375
- objectSet2(record, keys, finalValue);
376
- }
377
- return schema.parse(record, opts);
378
- }
379
- function parseFormData(schema, data, opts) {
380
- const record = {};
381
- for (const [key, value] of data) {
382
- const keys = key.split(".").map((it) => /^\d+$/g.test(it) ? Number.parseInt(it, 10) : it);
383
- const schemaItem = getSchemaItemAtPath(schema, keys);
384
- const allValues = data.getAll(key);
385
- const finalValue = schemaItem && schemaItem.parse(allValues).valid ? allValues : value;
386
- objectSet2(record, keys, finalValue);
387
- }
388
- const handleBoolean = (value, keys) => {
389
- var _a;
390
- if (value instanceof SchemaNullable) {
391
- handleBoolean(value.unwrap(), keys);
392
- }
393
- if (value instanceof SchemaArray) {
394
- const elements = objectGet(record, keys);
395
- for (let it = 0; it < ((_a = elements == null ? void 0 : elements.length) != null ? _a : 0); it++) {
396
- handleBoolean(value.unwrap(), [...keys, it]);
397
- }
398
- }
399
- if (value instanceof SchemaObject) {
400
- handleSchemaForBoolean(value.model, keys);
401
- }
402
- if (value instanceof SchemaBoolean && typeof objectGet(record, keys) === "undefined") {
403
- objectSet2(record, keys, false);
404
- }
405
- };
406
- const handleSchemaForBoolean = (model, keys = []) => {
407
- objectLoop(model, (value, key) => {
408
- handleBoolean(value, [...keys, key]);
409
- });
410
- };
411
- if (schema instanceof SchemaObject) {
412
- handleSchemaForBoolean(schema.model);
413
- }
414
- return schema.parse(record, opts);
415
- }
416
- function parseForm(model, form, opts) {
417
- return parseFormData(model, new FormData(form), opts);
418
- }
419
- function getSchemaItemAtPath(schema, path) {
420
- let current = schema;
421
- const internalPath = objectClone(path);
422
- for (const key of path) {
423
- if (!current) {
424
- return void 0;
425
- }
426
- internalPath.shift();
427
- while (current instanceof SchemaNullable || current instanceof SchemaDefault) {
428
- current = current.unwrap();
429
- }
430
- if (current instanceof SchemaObject) {
431
- current = current.model[key];
432
- current = getSchemaItemAtPath(current, internalPath);
433
- }
434
- }
435
- while (current instanceof SchemaNullable || current instanceof SchemaDefault) {
436
- current = current.unwrap();
437
- }
438
- return current;
439
- }
325
+ ], _SchemaItem.prototype, "in", 1);
326
+ var SchemaItem = _SchemaItem;
440
327
 
441
328
  // src/items/any.ts
442
329
  var SchemaAny = class extends SchemaItem {
@@ -477,7 +364,7 @@ var SchemaDate = class extends SchemaItem {
477
364
  break;
478
365
  }
479
366
  }
480
- if (!date || isNaN(date.getDate())) {
367
+ if (!date || Number.isNaN(date.getDate())) {
481
368
  return input;
482
369
  }
483
370
  return date;
@@ -494,19 +381,25 @@ __decorateClass([
494
381
  ], SchemaDate.prototype, "parseString", 1);
495
382
 
496
383
  // src/items/record.ts
497
- import { isObject as isObject3, objectLoop as objectLoop2 } from "@dzeio/object-util";
384
+ import { isObject as isObject2, objectLoop as objectLoop2 } from "@dzeio/object-util";
498
385
  var SchemaRecord = class extends SchemaItem {
499
386
  constructor(keys, values) {
500
387
  super([keys, values]);
501
388
  this.keys = keys;
502
389
  this.values = values;
503
390
  }
391
+ unwrap() {
392
+ return this.values;
393
+ }
394
+ isKeyOfType(key) {
395
+ return this.keys.parse(key).valid;
396
+ }
504
397
  isOfType(input) {
505
- return isObject3(input) && Object.prototype.toString.call(input) === "[object Object]";
398
+ return isObject2(input) && Object.prototype.toString.call(input) === "[object Object]";
506
399
  }
507
400
  parseSubItems(input, options) {
508
401
  const result = { input, errors: [] };
509
- if (isObject3(input)) {
402
+ if (isObject2(input)) {
510
403
  const clone = {};
511
404
  objectLoop2(input, (value, key) => {
512
405
  var _a, _b;
@@ -529,6 +422,71 @@ var SchemaRecord = class extends SchemaItem {
529
422
  };
530
423
  SchemaRecord.id = "record";
531
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
+
532
490
  // src/items/enum.ts
533
491
  var SchemaEnum = class extends SchemaItem {
534
492
  constructor(templateEnum) {
@@ -563,6 +521,51 @@ var SchemaLiteral = class extends SchemaItem {
563
521
  };
564
522
  SchemaLiteral.id = "literal";
565
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
+
566
569
  // src/items/number.ts
567
570
  var SchemaNumber = class extends SchemaItem {
568
571
  lte(value, message) {
@@ -632,6 +635,22 @@ __decorateClass([
632
635
  parsable()
633
636
  ], SchemaNumber.prototype, "parseString", 1);
634
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
+
635
654
  // src/items/string.ts
636
655
  var SchemaString = class extends SchemaItem {
637
656
  min(value, message) {
@@ -657,6 +676,15 @@ var SchemaString = class extends SchemaItem {
657
676
  });
658
677
  return this;
659
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
+ }
660
688
  notEmpty(message) {
661
689
  this.addValidation({
662
690
  fn(input) {
@@ -704,6 +732,9 @@ __decorateClass([
704
732
  __decorateClass([
705
733
  parsable()
706
734
  ], SchemaString.prototype, "max", 1);
735
+ __decorateClass([
736
+ parsable()
737
+ ], SchemaString.prototype, "trim", 1);
707
738
  __decorateClass([
708
739
  parsable()
709
740
  ], SchemaString.prototype, "notEmpty", 1);
@@ -720,6 +751,9 @@ var SchemaUnion = class extends SchemaItem {
720
751
  super(schemas);
721
752
  this.schemas = schemas;
722
753
  }
754
+ unwrap() {
755
+ return this.schemas;
756
+ }
723
757
  isOfType(input) {
724
758
  return this.schemas.some((it) => it.isOfType(input));
725
759
  }
@@ -745,6 +779,9 @@ var SchemaIntersection = class extends SchemaItem {
745
779
  super(schemas);
746
780
  this.schemas = schemas;
747
781
  }
782
+ unwrap() {
783
+ return this.schemas;
784
+ }
748
785
  isOfType(input) {
749
786
  return this.schemas.every((it) => it.isOfType(input));
750
787
  }
@@ -819,6 +856,9 @@ var SchemaTuple = class extends SchemaItem {
819
856
  super(children);
820
857
  this.children = children;
821
858
  }
859
+ unwrap() {
860
+ return this.children;
861
+ }
822
862
  isOfType(input) {
823
863
  if (!Array.isArray(input) || input.length > this.items.length) {
824
864
  return false;
@@ -839,7 +879,7 @@ SchemaTuple.id = "tuple";
839
879
  // src/items/nullish.ts
840
880
  var SchemaUndefined = class extends SchemaItem {
841
881
  isOfType(input) {
842
- return typeof input === "undefined";
882
+ return input === void 0;
843
883
  }
844
884
  };
845
885
  SchemaUndefined.id = "undefined";
@@ -851,7 +891,7 @@ var SchemaNull = class extends SchemaItem {
851
891
  SchemaNull.id = "null";
852
892
  var SchemaVoid = class extends SchemaItem {
853
893
  isOfType(input) {
854
- return typeof input === "undefined";
894
+ return input === void 0;
855
895
  }
856
896
  };
857
897
  SchemaVoid.id = "void";
@@ -1066,10 +1106,12 @@ export {
1066
1106
  SchemaObject,
1067
1107
  SchemaRecord,
1068
1108
  SchemaString,
1109
+ SchemaTuple,
1069
1110
  SchemaUndefined,
1070
1111
  SchemaUnion,
1071
1112
  SchemaVoid,
1072
1113
  Schema as default,
1114
+ getSchemaItemAtPath,
1073
1115
  isNull,
1074
1116
  parsable,
1075
1117
  parseForm,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzeio/schema",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "dependencies": {
5
5
  "@dzeio/object-util": "^1.9.2"
6
6
  },