@dzeio/schema 0.0.2 → 0.0.3

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.d.mts CHANGED
@@ -121,6 +121,10 @@ type ModelInfer$1<M extends Model> = {
121
121
  [key in keyof M]: SchemaInfer<M[key]>
122
122
  }
123
123
 
124
+ declare class SchemaAny extends SchemaItem {
125
+ isOfType(input: unknown): input is any;
126
+ }
127
+
124
128
  declare class SchemaDate extends SchemaItem<Date> {
125
129
  isOfType(input: unknown): input is Date;
126
130
  }
@@ -285,6 +289,7 @@ declare function parseForm<T extends SchemaObject>(model: T, form: HTMLFormEleme
285
289
  declare function parceable(): (target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => TypedPropertyDescriptor<any>;
286
290
  type SchemaItemStatic = new (...args: Array<any>) => SchemaItem;
287
291
  declare const Types: {
292
+ readonly Any: typeof SchemaAny;
288
293
  readonly Array: typeof SchemaArray;
289
294
  readonly Boolean: typeof SchemaBoolean;
290
295
  readonly Date: typeof SchemaDate;
@@ -300,6 +305,7 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
300
305
  private static registeredModules;
301
306
  static register(module: SchemaItemStatic): void;
302
307
  static getModule(name: string): SchemaItemStatic | undefined;
308
+ static any(): SchemaAny;
303
309
  static array<Type extends SchemaItem>(...inputs: ConstructorParameters<typeof SchemaArray<Type>>): SchemaArray<Type>;
304
310
  static boolean(...inputs: ConstructorParameters<typeof SchemaBoolean>): SchemaBoolean;
305
311
  static date(...inputs: ConstructorParameters<typeof SchemaDate>): SchemaDate;
@@ -340,4 +346,4 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
340
346
  }
341
347
  declare const s: typeof Schema;
342
348
 
343
- export { type Infer, type Model, type ModelInfer$1 as ModelInfer, SchemaArray, SchemaBoolean, SchemaDate, SchemaEnum, type SchemaInfer, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNullable, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUnion, Types, type ValidationError, type ValidationResult, type ValidationResultOld, Schema as default, parceable, parseForm, parseFormData, parseQuery, s };
349
+ export { type Infer, type Model, type ModelInfer$1 as ModelInfer, SchemaAny, SchemaArray, SchemaBoolean, SchemaDate, SchemaEnum, type SchemaInfer, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNullable, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUnion, Types, type ValidationError, type ValidationResult, type ValidationResultOld, Schema as default, parceable, parseForm, parseFormData, parseQuery, s };
package/dist/Schema.d.ts CHANGED
@@ -121,6 +121,10 @@ type ModelInfer$1<M extends Model> = {
121
121
  [key in keyof M]: SchemaInfer<M[key]>
122
122
  }
123
123
 
124
+ declare class SchemaAny extends SchemaItem {
125
+ isOfType(input: unknown): input is any;
126
+ }
127
+
124
128
  declare class SchemaDate extends SchemaItem<Date> {
125
129
  isOfType(input: unknown): input is Date;
126
130
  }
@@ -285,6 +289,7 @@ declare function parseForm<T extends SchemaObject>(model: T, form: HTMLFormEleme
285
289
  declare function parceable(): (target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => TypedPropertyDescriptor<any>;
286
290
  type SchemaItemStatic = new (...args: Array<any>) => SchemaItem;
287
291
  declare const Types: {
292
+ readonly Any: typeof SchemaAny;
288
293
  readonly Array: typeof SchemaArray;
289
294
  readonly Boolean: typeof SchemaBoolean;
290
295
  readonly Date: typeof SchemaDate;
@@ -300,6 +305,7 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
300
305
  private static registeredModules;
301
306
  static register(module: SchemaItemStatic): void;
302
307
  static getModule(name: string): SchemaItemStatic | undefined;
308
+ static any(): SchemaAny;
303
309
  static array<Type extends SchemaItem>(...inputs: ConstructorParameters<typeof SchemaArray<Type>>): SchemaArray<Type>;
304
310
  static boolean(...inputs: ConstructorParameters<typeof SchemaBoolean>): SchemaBoolean;
305
311
  static date(...inputs: ConstructorParameters<typeof SchemaDate>): SchemaDate;
@@ -340,4 +346,4 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
340
346
  }
341
347
  declare const s: typeof Schema;
342
348
 
343
- export { type Infer, type Model, type ModelInfer$1 as ModelInfer, SchemaArray, SchemaBoolean, SchemaDate, SchemaEnum, type SchemaInfer, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNullable, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUnion, Types, type ValidationError, type ValidationResult, type ValidationResultOld, Schema as default, parceable, parseForm, parseFormData, parseQuery, s };
349
+ export { type Infer, type Model, type ModelInfer$1 as ModelInfer, SchemaAny, SchemaArray, SchemaBoolean, SchemaDate, SchemaEnum, type SchemaInfer, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNullable, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUnion, Types, type ValidationError, type ValidationResult, type ValidationResultOld, Schema as default, parceable, parseForm, parseFormData, parseQuery, s };
package/dist/Schema.js CHANGED
@@ -28,6 +28,7 @@ var __decorateClass = (decorators, target, key, kind) => {
28
28
  // src/Schema.ts
29
29
  var Schema_exports = {};
30
30
  __export(Schema_exports, {
31
+ SchemaAny: () => SchemaAny,
31
32
  SchemaArray: () => SchemaArray,
32
33
  SchemaBoolean: () => SchemaBoolean,
33
34
  SchemaDate: () => SchemaDate,
@@ -393,6 +394,14 @@ function parseForm(model, form, opts) {
393
394
  return parseFormData(model, new FormData(form), opts);
394
395
  }
395
396
 
397
+ // src/items/any.ts
398
+ var SchemaAny = class extends SchemaItem {
399
+ // @ts-expect-error input while not used is necessary for the `override to work`
400
+ isOfType(input) {
401
+ return true;
402
+ }
403
+ };
404
+
396
405
  // src/items/date.ts
397
406
  var SchemaDate = class extends SchemaItem {
398
407
  isOfType(input) {
@@ -667,6 +676,7 @@ function parceable() {
667
676
  };
668
677
  }
669
678
  var Types = {
679
+ Any: SchemaAny,
670
680
  Array: SchemaArray,
671
681
  Boolean: SchemaBoolean,
672
682
  Date: SchemaDate,
@@ -685,6 +695,9 @@ var _Schema = class _Schema extends SchemaObject {
685
695
  static getModule(name) {
686
696
  return this.registeredModules.find((it) => it.name === name);
687
697
  }
698
+ static any() {
699
+ return new SchemaAny();
700
+ }
688
701
  static array(...inputs) {
689
702
  return new SchemaArray(...inputs);
690
703
  }
@@ -792,6 +805,7 @@ var Schema = _Schema;
792
805
  var s = Schema;
793
806
  // Annotate the CommonJS export names for ESM import in node:
794
807
  0 && (module.exports = {
808
+ SchemaAny,
795
809
  SchemaArray,
796
810
  SchemaBoolean,
797
811
  SchemaDate,
package/dist/Schema.mjs CHANGED
@@ -352,6 +352,14 @@ function parseForm(model, form, opts) {
352
352
  return parseFormData(model, new FormData(form), opts);
353
353
  }
354
354
 
355
+ // src/items/any.ts
356
+ var SchemaAny = class extends SchemaItem {
357
+ // @ts-expect-error input while not used is necessary for the `override to work`
358
+ isOfType(input) {
359
+ return true;
360
+ }
361
+ };
362
+
355
363
  // src/items/date.ts
356
364
  var SchemaDate = class extends SchemaItem {
357
365
  isOfType(input) {
@@ -626,6 +634,7 @@ function parceable() {
626
634
  };
627
635
  }
628
636
  var Types = {
637
+ Any: SchemaAny,
629
638
  Array: SchemaArray,
630
639
  Boolean: SchemaBoolean,
631
640
  Date: SchemaDate,
@@ -644,6 +653,9 @@ var _Schema = class _Schema extends SchemaObject {
644
653
  static getModule(name) {
645
654
  return this.registeredModules.find((it) => it.name === name);
646
655
  }
656
+ static any() {
657
+ return new SchemaAny();
658
+ }
647
659
  static array(...inputs) {
648
660
  return new SchemaArray(...inputs);
649
661
  }
@@ -750,6 +762,7 @@ _Schema.registeredModules = [
750
762
  var Schema = _Schema;
751
763
  var s = Schema;
752
764
  export {
765
+ SchemaAny,
753
766
  SchemaArray,
754
767
  SchemaBoolean,
755
768
  SchemaDate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzeio/schema",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "dependencies": {
5
5
  "@dzeio/object-util": "^1.8.3"
6
6
  },