@nmtjs/type 0.1.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 (70) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +9 -0
  3. package/dist/compiler.js +57 -0
  4. package/dist/compiler.js.map +1 -0
  5. package/dist/formats.js +127 -0
  6. package/dist/formats.js.map +1 -0
  7. package/dist/index.js +38 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/schemas/native-enum.js +14 -0
  10. package/dist/schemas/native-enum.js.map +1 -0
  11. package/dist/schemas/nullable.js +5 -0
  12. package/dist/schemas/nullable.js.map +1 -0
  13. package/dist/schemas/union-enum.js +13 -0
  14. package/dist/schemas/union-enum.js.map +1 -0
  15. package/dist/temporal.js +15 -0
  16. package/dist/temporal.js.map +1 -0
  17. package/dist/types/any.js +16 -0
  18. package/dist/types/any.js.map +1 -0
  19. package/dist/types/array.js +42 -0
  20. package/dist/types/array.js.map +1 -0
  21. package/dist/types/base.js +77 -0
  22. package/dist/types/base.js.map +1 -0
  23. package/dist/types/boolean.js +16 -0
  24. package/dist/types/boolean.js.map +1 -0
  25. package/dist/types/custom.js +23 -0
  26. package/dist/types/custom.js.map +1 -0
  27. package/dist/types/datetime.js +34 -0
  28. package/dist/types/datetime.js.map +1 -0
  29. package/dist/types/enum.js +41 -0
  30. package/dist/types/enum.js.map +1 -0
  31. package/dist/types/literal.js +21 -0
  32. package/dist/types/literal.js.map +1 -0
  33. package/dist/types/never.js +16 -0
  34. package/dist/types/never.js.map +1 -0
  35. package/dist/types/number.js +94 -0
  36. package/dist/types/number.js.map +1 -0
  37. package/dist/types/object.js +49 -0
  38. package/dist/types/object.js.map +1 -0
  39. package/dist/types/string.js +55 -0
  40. package/dist/types/string.js.map +1 -0
  41. package/dist/types/temporal.js +144 -0
  42. package/dist/types/temporal.js.map +1 -0
  43. package/dist/types/union.js +40 -0
  44. package/dist/types/union.js.map +1 -0
  45. package/dist/utils.js +1 -0
  46. package/dist/utils.js.map +1 -0
  47. package/package.json +43 -0
  48. package/src/compiler.ts +68 -0
  49. package/src/formats.ts +182 -0
  50. package/src/index.ts +79 -0
  51. package/src/schemas/native-enum.ts +29 -0
  52. package/src/schemas/nullable.ts +13 -0
  53. package/src/schemas/union-enum.ts +43 -0
  54. package/src/temporal.ts +34 -0
  55. package/src/types/any.ts +27 -0
  56. package/src/types/array.ts +66 -0
  57. package/src/types/base.ts +158 -0
  58. package/src/types/boolean.ts +27 -0
  59. package/src/types/custom.ts +36 -0
  60. package/src/types/datetime.ts +60 -0
  61. package/src/types/enum.ts +62 -0
  62. package/src/types/literal.ts +31 -0
  63. package/src/types/never.ts +30 -0
  64. package/src/types/number.ts +124 -0
  65. package/src/types/object.ts +83 -0
  66. package/src/types/string.ts +87 -0
  67. package/src/types/temporal.ts +227 -0
  68. package/src/types/union.ts +79 -0
  69. package/src/utils.ts +16 -0
  70. package/tsconfig.json +3 -0
@@ -0,0 +1,34 @@
1
+ import { Type } from '@sinclair/typebox';
2
+ import { BaseType } from "./base.js";
3
+ export class DateType extends BaseType {
4
+ constructor(schema = Type.Transform(Type.String({
5
+ format: 'date'
6
+ })).Decode((value)=>new Date(value)).Encode((value)=>value.toJSON()), nullable = false, optional = false){
7
+ super(schema, nullable, optional);
8
+ }
9
+ nullable() {
10
+ return new DateType(...this._nullable());
11
+ }
12
+ optional() {
13
+ return new DateType(...this._optional());
14
+ }
15
+ nullish() {
16
+ return new DateType(...this._nullish());
17
+ }
18
+ }
19
+ export class DateTimeType extends BaseType {
20
+ constructor(schema = Type.Transform(Type.String({
21
+ format: 'date-time'
22
+ })).Decode((value)=>new Date(value)).Encode((value)=>value.toJSON()), nullable = false, optional = false){
23
+ super(schema, nullable, optional);
24
+ }
25
+ nullable() {
26
+ return new DateTimeType(...this._nullable());
27
+ }
28
+ optional() {
29
+ return new DateTimeType(...this._optional());
30
+ }
31
+ nullish() {
32
+ return new DateTimeType(...this._nullish());
33
+ }
34
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/datetime.ts"],"sourcesContent":["import { type TString, type TTransform, Type } from '@sinclair/typebox'\nimport { BaseType } from './base.ts'\n\nexport class DateType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TTransform<TString, Date>, N, O> {\n constructor(\n schema: TTransform<TString, Date> = Type.Transform(\n Type.String({ format: 'date' }),\n )\n .Decode((value) => new Date(value))\n .Encode((value) => value.toJSON()),\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(schema, nullable, optional)\n }\n\n nullable() {\n return new DateType(...this._nullable())\n }\n\n optional() {\n return new DateType(...this._optional())\n }\n\n nullish() {\n return new DateType(...this._nullish())\n }\n}\n\nexport class DateTimeType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TTransform<TString, Date>, N, O> {\n constructor(\n schema: TTransform<TString, Date> = Type.Transform(\n Type.String({ format: 'date-time' }),\n )\n .Decode((value) => new Date(value))\n .Encode((value) => value.toJSON()),\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(schema, nullable, optional)\n }\n\n nullable() {\n return new DateTimeType(...this._nullable())\n }\n\n optional() {\n return new DateTimeType(...this._optional())\n }\n\n nullish() {\n return new DateTimeType(...this._nullish())\n }\n}\n"],"names":["Type","BaseType","DateType","constructor","schema","Transform","String","format","Decode","value","Date","Encode","toJSON","nullable","optional","_nullable","_optional","nullish","_nullish","DateTimeType"],"mappings":"AAAA,SAAwCA,IAAI,QAAQ,oBAAmB;AACvE,SAASC,QAAQ,QAAQ,YAAW;AAEpC,OAAO,MAAMC,iBAGHD;IACRE,YACEC,SAAoCJ,KAAKK,SAAS,CAChDL,KAAKM,MAAM,CAAC;QAAEC,QAAQ;IAAO,IAE5BC,MAAM,CAAC,CAACC,QAAU,IAAIC,KAAKD,QAC3BE,MAAM,CAAC,CAACF,QAAUA,MAAMG,MAAM,GAAG,EACpCC,WAAc,KAAU,EACxBC,WAAc,KAAU,CACxB;QACA,KAAK,CAACV,QAAQS,UAAUC;IAC1B;IAEAD,WAAW;QACT,OAAO,IAAIX,YAAY,IAAI,CAACa,SAAS;IACvC;IAEAD,WAAW;QACT,OAAO,IAAIZ,YAAY,IAAI,CAACc,SAAS;IACvC;IAEAC,UAAU;QACR,OAAO,IAAIf,YAAY,IAAI,CAACgB,QAAQ;IACtC;AACF;AAEA,OAAO,MAAMC,qBAGHlB;IACRE,YACEC,SAAoCJ,KAAKK,SAAS,CAChDL,KAAKM,MAAM,CAAC;QAAEC,QAAQ;IAAY,IAEjCC,MAAM,CAAC,CAACC,QAAU,IAAIC,KAAKD,QAC3BE,MAAM,CAAC,CAACF,QAAUA,MAAMG,MAAM,GAAG,EACpCC,WAAc,KAAU,EACxBC,WAAc,KAAU,CACxB;QACA,KAAK,CAACV,QAAQS,UAAUC;IAC1B;IAEAD,WAAW;QACT,OAAO,IAAIM,gBAAgB,IAAI,CAACJ,SAAS;IAC3C;IAEAD,WAAW;QACT,OAAO,IAAIK,gBAAgB,IAAI,CAACH,SAAS;IAC3C;IAEAC,UAAU;QACR,OAAO,IAAIE,gBAAgB,IAAI,CAACD,QAAQ;IAC1C;AACF"}
@@ -0,0 +1,41 @@
1
+ import { NativeEnum } from "../schemas/native-enum.js";
2
+ import { UnionEnum } from "../schemas/union-enum.js";
3
+ import { BaseType } from "./base.js";
4
+ export class NativeEnumType extends BaseType {
5
+ values;
6
+ constructor(values, nullable = false, optional = false){
7
+ super(NativeEnum(values), nullable, optional);
8
+ this.values = values;
9
+ }
10
+ nullable() {
11
+ const [_, ...args] = this._nullable();
12
+ return new NativeEnumType(this.values, ...args);
13
+ }
14
+ optional() {
15
+ const [_, ...args] = this._optional();
16
+ return new NativeEnumType(this.values, ...args);
17
+ }
18
+ nullish() {
19
+ const [_, ...args] = this._nullish();
20
+ return new NativeEnumType(this.values, ...args);
21
+ }
22
+ }
23
+ export class EnumType extends BaseType {
24
+ values;
25
+ constructor(values, nullable = false, optional = false){
26
+ super(UnionEnum(values), nullable, optional);
27
+ this.values = values;
28
+ }
29
+ nullable() {
30
+ const [_, ...args] = this._nullable();
31
+ return new EnumType(this.values, ...args);
32
+ }
33
+ optional() {
34
+ const [_, ...args] = this._optional();
35
+ return new EnumType(this.values, ...args);
36
+ }
37
+ nullish() {
38
+ const [_, ...args] = this._nullish();
39
+ return new EnumType(this.values, ...args);
40
+ }
41
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/enum.ts"],"sourcesContent":["import type { TNativeEnum } from '../schemas/native-enum.ts'\nimport { NativeEnum } from '../schemas/native-enum.ts'\nimport { type TUnionEnum, UnionEnum } from '../schemas/union-enum.ts'\nimport { BaseType } from './base.ts'\n\nexport class NativeEnumType<\n T extends { [K in string]: K } = { [K in string]: K },\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TNativeEnum<T>, N, O> {\n constructor(\n readonly values: T,\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(NativeEnum(values), nullable, optional)\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new NativeEnumType(this.values, ...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new NativeEnumType(this.values, ...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new NativeEnumType(this.values, ...args)\n }\n}\n\nexport class EnumType<\n T extends (string | number)[],\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TUnionEnum<T>, N, O> {\n constructor(\n readonly values: [...T],\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(UnionEnum(values), nullable, optional)\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new EnumType(this.values, ...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new EnumType(this.values, ...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new EnumType(this.values, ...args)\n }\n}\n"],"names":["NativeEnum","UnionEnum","BaseType","NativeEnumType","constructor","values","nullable","optional","_","args","_nullable","_optional","nullish","_nullish","EnumType"],"mappings":"AACA,SAASA,UAAU,QA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clair/typebox';
2
+ import { BaseType } from "./base.js";
3
+ export class LiteralType extends BaseType {
4
+ value;
5
+ constructor(value, nullable = false, optional = false){
6
+ super(Type.Literal(value), nullable, optional);
7
+ this.value = value;
8
+ }
9
+ nullable() {
10
+ const [_, ...args] = this._nullable();
11
+ return new LiteralType(this.value, ...args);
12
+ }
13
+ optional() {
14
+ const [_, ...args] = this._optional();
15
+ return new LiteralType(this.value, ...args);
16
+ }
17
+ nullish() {
18
+ const [_, ...args] = this._nullish();
19
+ return new LiteralType(this.value, ...args);
20
+ }
21
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/literal.ts"],"sourcesContent":["import { type TLiteral, type TLiteralValue, Type } from '@sinclair/typebox'\nimport { BaseType } from './base.ts'\n\nexport class LiteralType<\n T extends TLiteralValue = TLiteralValue,\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TLiteral<T>, N, O> {\n constructor(\n readonly value: T,\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(Type.Literal(value), nullable, optional)\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new LiteralType(this.value, ...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new LiteralType(this.value, ...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new LiteralType(this.value, ...args)\n }\n}\n"],"names":["Type","BaseType","LiteralType","constructor","value","nullable","optional","Literal","_","args","_nullable","_optional","nullish","_nullish"],"mappings":"AAAA,SAA4CA,IAAI,QAAQ,oBAAmB;AAC3E,SAASC,QAAQ,QAAQ,YAAW;AAEpC,OAAO,MAAMC,oBAIHD;;IACRE,YACE,AAASC,KAAQ,EACjBC,WAAc,KAAU,EACxBC,WAAc,KAAU,CACxB;QACA,KAAK,CAACN,KAAKO,OAAO,CAACH,QAAQC,UAAUC;aAJ5BF,QAAAA;IAKX;IAEAC,WAAW;QACT,MAAM,CAACG,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACC,SAAS;QACnC,OAAO,IAAIR,YAAY,IAAI,CAACE,KAAK,KAAKK;IACxC;IAEAH,WAAW;QACT,MAAM,CAACE,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACE,SAAS;QACnC,OAAO,IAAIT,YAAY,IAAI,CAACE,KAAK,KAAKK;IACxC;IAEAG,UAAU;QACR,MAAM,CAACJ,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACI,QAAQ;QAClC,OAAO,IAAIX,YAAY,IAAI,CAACE,KAAK,KAAKK;IACxC;AACF"}
@@ -0,0 +1,16 @@
1
+ import { Type } from '@sinclair/typebox';
2
+ import { BaseType } from "./base.js";
3
+ export class NeverType extends BaseType {
4
+ constructor(schema = Type.Never(), nullable = false, optional = false){
5
+ super(schema, nullable, optional);
6
+ }
7
+ nullable() {
8
+ throw new Error('NeverType cannot be nullable');
9
+ }
10
+ optional() {
11
+ throw new Error('NeverType cannot be optional');
12
+ }
13
+ nullish() {
14
+ throw new Error('NeverType cannot be nullish');
15
+ }
16
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/never.ts"],"sourcesContent":["import { type TNever, Type } from '@sinclair/typebox'\nimport { BaseType } from './base.ts'\n\nexport class NeverType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TNever, N, O> {\n constructor(\n schema = Type.Never(),\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(schema, nullable, optional)\n }\n\n // @ts-expect-error\n nullable() {\n throw new Error('NeverType cannot be nullable')\n }\n\n // @ts-expect-error\n optional() {\n throw new Error('NeverType cannot be optional')\n }\n\n // @ts-expect-error\n nullish() {\n throw new Error('NeverType cannot be nullish')\n }\n}\n"],"names":["Type","BaseType","NeverType","constructor","schema","Never","nullable","optional","Error","nullish"],"mappings":"AAAA,SAAsBA,IAAI,QAAQ,oBAAmB;AACrD,SAASC,QAAQ,QAAQ,YAAW;AAEpC,OAAO,MAAMC,kBAGHD;IACRE,YACEC,SAASJ,KAAKK,KAAK,EAAE,EACrBC,WAAc,KAAU,EACxBC,WAAc,KAAU,CACxB;QACA,KAAK,CAACH,QAAQE,UAAUC;IAC1B;IAGAD,WAAW;QACT,MAAM,IAAIE,MAAM;IAClB;IAGAD,WAAW;QACT,MAAM,IAAIC,MAAM;IAClB;IAGAC,UAAU;QACR,MAAM,IAAID,MAAM;IAClB;AACF"}
@@ -0,0 +1,94 @@
1
+ import { Type } from '@sinclair/typebox';
2
+ import { BaseType } from "./base.js";
3
+ export class NumberType extends BaseType {
4
+ constructor(schema = Type.Number(), nullable = false, optional = false){
5
+ super(schema, nullable, optional);
6
+ }
7
+ positive() {
8
+ return new NumberType(Type.Number({
9
+ ...this._schema,
10
+ minimum: 0,
11
+ exclusiveMinimum: 0
12
+ }), ...this._isNullableOptional);
13
+ }
14
+ negative() {
15
+ return new NumberType(Type.Number({
16
+ ...this._schema,
17
+ maximum: 0,
18
+ exclusiveMaximum: 0
19
+ }), ...this._isNullableOptional);
20
+ }
21
+ max(value, exclusive) {
22
+ return new NumberType(Type.Number({
23
+ ...this._schema,
24
+ maximum: value,
25
+ ...exclusive ? {} : {
26
+ exclusiveMaximum: value
27
+ }
28
+ }), ...this._isNullableOptional);
29
+ }
30
+ min(value, exclusive) {
31
+ return new NumberType(Type.Number({
32
+ ...this._schema,
33
+ minimum: value,
34
+ ...exclusive ? {} : {
35
+ exclusiveMinimum: value
36
+ }
37
+ }), ...this._isNullableOptional);
38
+ }
39
+ nullable() {
40
+ return new NumberType(...this._nullable());
41
+ }
42
+ optional() {
43
+ return new NumberType(...this._optional());
44
+ }
45
+ nullish() {
46
+ return new NumberType(...this._nullish());
47
+ }
48
+ }
49
+ export class IntegerType extends BaseType {
50
+ constructor(schema = Type.Integer(), nullable = false, optional = false){
51
+ super(schema, nullable, optional);
52
+ }
53
+ positive() {
54
+ return new IntegerType(Type.Integer({
55
+ ...this._schema,
56
+ minimum: 0,
57
+ exclusiveMinimum: 0
58
+ }), ...this._isNullableOptional);
59
+ }
60
+ negative() {
61
+ return new IntegerType(Type.Integer({
62
+ ...this._schema,
63
+ maximum: 0,
64
+ exclusiveMaximum: 0
65
+ }), ...this._isNullableOptional);
66
+ }
67
+ max(value, exclusive) {
68
+ return new IntegerType(Type.Integer({
69
+ ...this._schema,
70
+ maximum: value,
71
+ ...exclusive ? {} : {
72
+ exclusiveMaximum: value
73
+ }
74
+ }), ...this._isNullableOptional);
75
+ }
76
+ min(value, exclusive) {
77
+ return new IntegerType(Type.Integer({
78
+ ...this._schema,
79
+ minimum: value,
80
+ ...exclusive ? {} : {
81
+ exclusiveMinimum: value
82
+ }
83
+ }), ...this._isNullableOptional);
84
+ }
85
+ nullable() {
86
+ return new IntegerType(...this._nullable());
87
+ }
88
+ optional() {
89
+ return new IntegerType(...this._optional());
90
+ }
91
+ nullish() {
92
+ return new IntegerType(...this._nullish());
93
+ }
94
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/number.ts"],"sourcesContent":["import { type TInteger, type TNumber, Type } from '@sinclair/typebox'\nimport { BaseType } from './base.ts'\n\nexport class NumberType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TNumber, N, O> {\n constructor(\n schema: TNumber = Type.Number(),\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(schema, nullable, optional)\n }\n\n positive() {\n return new NumberType(\n Type.Number({ ...this._schema, minimum: 0, exclusiveMinimum: 0 }),\n ...this._isNullableOptional,\n )\n }\n\n negative() {\n return new NumberType(\n Type.Number({ ...this._schema, maximum: 0, exclusiveMaximum: 0 }),\n ...this._isNullableOptional,\n )\n }\n\n max(value: number, exclusive?: true) {\n return new NumberType(\n Type.Number({\n ...this._schema,\n maximum: value,\n ...(exclusive ? {} : { exclusiveMaximum: value }),\n }),\n ...this._isNullableOptional,\n )\n }\n\n min(value: number, exclusive?: true) {\n return new NumberType(\n Type.Number({\n ...this._schema,\n minimum: value,\n ...(exclusive ? {} : { exclusiveMinimum: value }),\n }),\n ...this._isNullableOptional,\n )\n }\n\n nullable() {\n return new NumberType(...this._nullable())\n }\n\n optional() {\n return new NumberType(...this._optional())\n }\n\n nullish() {\n return new NumberType(...this._nullish())\n }\n}\n\nexport class IntegerType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TInteger, N, O> {\n constructor(\n schema: TInteger = Type.Integer(),\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(schema, nullable, optional)\n }\n\n positive() {\n return new IntegerType(\n Type.Integer({ ...this._schema, minimum: 0, exclusiveMinimum: 0 }),\n ...this._isNullableOptional,\n )\n }\n\n negative() {\n return new IntegerType(\n Type.Integer({ ...this._schema, maximum: 0, exclusiveMaximum: 0 }),\n ...this._isNullableOptional,\n )\n }\n\n max(value: number, exclusive?: true) {\n return new IntegerType(\n Type.Integer({\n ...this._schema,\n maximum: value,\n ...(exclusive ? {} : { exclusiveMaximum: value }),\n }),\n ...this._isNullableOptional,\n )\n }\n\n min(value: number, exclusive?: true) {\n return new IntegerType(\n Type.Integer({\n ...this._schema,\n minimum: value,\n ...(exclusive ? {} : { exclusiveMinimum: value }),\n }),\n ...this._isNullableOptional,\n )\n }\n\n nullable() {\n return new IntegerType(...this._nullable())\n }\n\n optional() {\n return new IntegerType(...this._optional())\n }\n\n nullish() {\n return new IntegerType(...this._nullish())\n }\n}\n"],"names":["Type","BaseType","NumberType","constructor","schema","Number","nullable","optional","positive","_schema","minimum","exclusiveMinimum","_isNullableOptional","negative","maximum","exclusiveMaximum","max","value","exclusive","min","_nullable","_optional","nullish","_nullish","IntegerType","Integer"],"mappings":"AAAA,SAAsCA,IAAI,QAAQ,oBAAmB;AACrE,SAASC,QAAQ,QAAQ,YAAW;AAEpC,OAAO,MAAMC,mBAGHD;IACRE,YACEC,SAAkBJ,KAAKK,MAAM,EAAE,EAC/BC,WAAc,KAAU,EACxBC,WAAc,KAAU,CACxB;QACA,KAAK,CAACH,QAAQE,UAAUC;IAC1B;IAEAC,WAAW;QACT,OAAO,IAAIN,WACTF,KAAKK,MAAM,CAAC;YAAE,GAAG,IAAI,CAAC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ACTxB,KAAKyB,OAAO,CAAC;YAAE,GAAG,IAAI,CAAChB,OAAO;YAAEK,SAAS;YAAGC,kBAAkB;QAAE,OAC7D,IAAI,CAACH,mBAAmB;IAE/B;IAEAI,IAAIC,KAAa,EAAEC,SAAgB,EAAE;QACnC,OAAO,IAAIM,YACTxB,KAAKyB,OAAO,CAAC;YACX,GAAG,IAAI,CAAChB,OAAO;YACfK,SAASG;YACT,GAAIC,YAAY,CAAC,IAAI;gBAAEH,kBAAkBE;YAAM,CAAC;QAClD,OACG,IAAI,CAACL,mBAAmB;IAE/B;IAEAO,IAAIF,KAAa,EAAEC,SAAgB,EAAE;QACnC,OAAO,IAAIM,YACTxB,KAAKyB,OAAO,CAAC;YACX,GAAG,IAAI,CAAChB,OAAO;YACfC,SAASO;YACT,GAAIC,YAAY,CAAC,IAAI;gBAAEP,kBAAkBM;YAAM,CAAC;QAClD,OACG,IAAI,CAACL,mBAAmB;IAE/B;IAEAN,WAAW;QACT,OAAO,IAAIkB,eAAe,IAAI,CAACJ,SAAS;IAC1C;IAEAb,WAAW;QACT,OAAO,IAAIiB,eAAe,IAAI,CAACH,SAAS;IAC1C;IAEAC,UAAU;QACR,OAAO,IAAIE,eAAe,IAAI,CAACD,QAAQ;IACzC;AACF"}
@@ -0,0 +1,49 @@
1
+ import { Type } from '@sinclair/typebox';
2
+ import { BaseType, typeFinalSchema } from "./base.js";
3
+ import { EnumType } from "./enum.js";
4
+ export class ObjectType extends BaseType {
5
+ properties;
6
+ constructor(properties = {}, nullable = false, optional = false){
7
+ const schemaProperties = Object.fromEntries(Object.entries(properties).map(([key, value])=>[
8
+ key,
9
+ value[typeFinalSchema]
10
+ ]));
11
+ super(Type.Object(schemaProperties), nullable, optional);
12
+ this.properties = properties;
13
+ }
14
+ nullable() {
15
+ const [_, ...args] = this._nullable();
16
+ return new ObjectType(this.properties, ...args);
17
+ }
18
+ optional() {
19
+ const [_, ...args] = this._optional();
20
+ return new ObjectType(this.properties, ...args);
21
+ }
22
+ nullish() {
23
+ const [_, ...args] = this._nullish();
24
+ return new ObjectType(this.properties, ...args);
25
+ }
26
+ pick(pick) {
27
+ const properties = Object.fromEntries(Object.entries(this.properties).filter(([key])=>pick[key]));
28
+ return new ObjectType(properties, ...this._isNullableOptional);
29
+ }
30
+ omit(omit) {
31
+ const properties = Object.fromEntries(Object.entries(this.properties).filter(([key])=>!omit[key]));
32
+ return new ObjectType(properties, ...this._isNullableOptional);
33
+ }
34
+ extend(properties) {
35
+ return new ObjectType({
36
+ ...this.properties,
37
+ ...properties
38
+ }, ...this._isNullableOptional);
39
+ }
40
+ merge(object) {
41
+ return new ObjectType({
42
+ ...this.properties,
43
+ ...object.properties
44
+ }, ...this._isNullableOptional);
45
+ }
46
+ keyof() {
47
+ return new EnumType(Object.keys(this.properties));
48
+ }
49
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/object.ts"],"sourcesContent":["import { type TObject, Type } from '@sinclair/typebox'\nimport type { UnionToTupleString } from '../utils.ts'\nimport { BaseType, typeFinalSchema } from './base.ts'\nimport { EnumType } from './enum.ts'\n\nexport class ObjectType<\n T extends Record<string, BaseType> = Record<string, BaseType>,\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TObject<{ [K in keyof T]: T[K][typeFinalSchema] }>, N, O> {\n constructor(\n readonly properties: T = {} as T,\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n const schemaProperties = Object.fromEntries(\n Object.entries(properties).map(([key, value]) => [\n key,\n value[typeFinalSchema],\n ]),\n )\n super(\n Type.Object(\n schemaProperties as { [K in keyof T]: T[K][typeFinalSchema] },\n ),\n nullable,\n optional,\n )\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new ObjectType(this.properties, ...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new ObjectType(this.properties, ...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new ObjectType(this.properties, ...args)\n }\n\n pick<P extends { [K in keyof T]?: true }>(pick: P) {\n const properties = Object.fromEntries(\n Object.entries(this.properties).filter(([key]) => pick[key]),\n )\n return new ObjectType(\n properties as Pick<T, Extract<keyof P, keyof T>>,\n ...this._isNullableOptional,\n )\n }\n\n omit<P extends { [K in keyof T]?: true }>(omit: P) {\n const properties = Object.fromEntries(\n Object.entries(this.properties).filter(([key]) => !omit[key]),\n )\n return new ObjectType(\n properties as Omit<T, Extract<keyof P, keyof T>>,\n ...this._isNullableOptional,\n )\n }\n\n extend<P extends Record<string, BaseType>>(properties: P) {\n return new ObjectType(\n { ...this.properties, ...properties },\n ...this._isNullableOptional,\n )\n }\n\n merge<T extends ObjectType>(object: T) {\n return new ObjectType(\n { ...this.properties, ...object.properties },\n ...this._isNullableOptional,\n )\n }\n\n keyof(): EnumType<UnionToTupleString<keyof T>> {\n return new EnumType(Object.keys(this.properties) as any)\n }\n}\n"],"names":["Type","BaseType","typeFinalSchema","EnumType","ObjectType","constructor","properties","nullable","optional","schemaProperties","Object","fromEntries","entries","map","key","value","_","args","_nullable","_optional","nullish","_nullish","pick","filter","_isNullableOptional","omit","extend","merge","object","keyof","keys"],"mappings":"AAAA,SAAuBA,IAAI,QAAQ,oBAAmB;AAEtD,SAASC,QAAQ,EAAEC,eAAe,QAAQ,YAAW;AACrD,SAASC,QAAQ,QAAQ,YAAW;AAEpC,OAAO,MAAMC,mBAIHH;;IACRI,YACE,AAASC,aAAgB,CAAC,CAAM,EAChCC,WAAc,KAAU,EACxBC,WAAc,KAAU,CACxB;QACA,MAAMC,mBAAmBC,OAAOC,WAAW,CACzCD,OAAOE,OAAO,CAACN,YAAYO,GAAG,CAAC,CAAC,CAACC,KAAKC,MAAM,GAAK;gBAC/CD;gBACAC,KAAK,CAACb,gBAAgB;aACvB;QAEH,KAAK,CACHF,KAAKU,MAAM,CACTD,mBAEFF,UACAC;aAfOF,aAAAA;IAiBX;IAEAC,WAAW;QACT,MAAM,CAACS,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACC,SAAS;QACnC,OAAO,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./base.js";
3
+ export class StringType extends BaseType {
4
+ constructor(schema = Type.String(), nullable = false, optional = false){
5
+ super(schema, nullable, optional);
6
+ }
7
+ nullable() {
8
+ return new StringType(...this._nullable());
9
+ }
10
+ optional() {
11
+ return new StringType(...this._optional());
12
+ }
13
+ nullish() {
14
+ return new StringType(...this._nullish());
15
+ }
16
+ format(format) {
17
+ return new StringType({
18
+ ...this._schema,
19
+ format
20
+ }, ...this._isNullableOptional);
21
+ }
22
+ max(value) {
23
+ return new StringType({
24
+ ...this._schema,
25
+ maxLength: value
26
+ }, ...this._isNullableOptional);
27
+ }
28
+ min(value) {
29
+ return new StringType({
30
+ ...this._schema,
31
+ minLength: value
32
+ }, ...this._isNullableOptional);
33
+ }
34
+ pattern(pattern) {
35
+ return new StringType({
36
+ ...this._schema,
37
+ pattern
38
+ }, ...this._isNullableOptional);
39
+ }
40
+ email() {
41
+ return this.format('email');
42
+ }
43
+ url() {
44
+ return this.format('uri');
45
+ }
46
+ ipv4() {
47
+ return this.format('ipv4');
48
+ }
49
+ ipv6() {
50
+ return this.format('ipv6');
51
+ }
52
+ uuid() {
53
+ return this.format('uuid');
54
+ }
55
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/string.ts"],"sourcesContent":["import { type TString, Type } from '@sinclair/typebox'\nimport { BaseType } from './base.ts'\n\nexport class StringType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TString, N, O> {\n constructor(\n schema = Type.String(),\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(schema, nullable, optional)\n }\n\n nullable() {\n return new StringType(...this._nullable())\n }\n\n optional() {\n return new StringType(...this._optional())\n }\n\n nullish() {\n return new StringType(...this._nullish())\n }\n\n format(format: TString['format']) {\n return new StringType(\n {\n ...this._schema,\n format,\n },\n ...this._isNullableOptional,\n )\n }\n\n max(value: number) {\n return new StringType(\n {\n ...this._schema,\n maxLength: value,\n },\n ...this._isNullableOptional,\n )\n }\n\n min(value: number) {\n return new StringType(\n {\n ...this._schema,\n minLength: value,\n },\n ...this._isNullableOptional,\n )\n }\n\n pattern(pattern: string) {\n return new StringType(\n {\n ...this._schema,\n pattern,\n },\n ...this._isNullableOptional,\n )\n }\n\n email() {\n return this.format('email')\n }\n\n url() {\n return this.format('uri')\n }\n\n ipv4() {\n return this.format('ipv4')\n }\n\n ipv6() {\n return this.format('ipv6')\n }\n\n uuid() {\n return this.format('uuid')\n }\n}\n"],"names":["Type","BaseType","StringType","constructor","schema","String","nullable","optional","_nullable","_optional","nullish","_nullish","format","_schema","_isNullableOptional","max","value","maxLength","min","minLength","pattern","email","url","ipv4","ipv6","uuid"],"mappings":"AAAA,SAAuBA,IAAI,QAAQ,oBAAmB;AACtD,SAASC,QAAQ,QAAQ,YAAW;AAEpC,OAAO,MAAMC,mBAGHD;IACRE,YACEC,SAASJ,KAAKK,MAAM,EAAE,EACtBC,WAAc,KAAU,EACxBC,WAAc,KAAU,CACxB;QACA,KAAK,CAACH,QAAQE,UAAUC;IAC1B;IAEAD,WAAW;QACT,OAAO,IAAIJ,cAAc,IAAI,CAACM,SAAS;IACzC;IAEAD,WAAW;QACT,OAAO,IAAIL,cAAc,IAAI,CAACO,SAAS;IACzC;IAEAC,UAAU;QACR,OAAO,IAAIR,cAAc,IAAI,CAACS,QAAQ;IACxC;IAEAC,OAAOA,MAAyB,EAAE;QAChC,OAAO,IAAIV,WACT;YACE,GAAG,IAAI,CAACW,OAAO;YACfD;QACF,MACG,IAAI,CAACE,mBAAmB;IAE/B;IAEAC,IAAIC,KAAa,EAAE;QACjB,OAAO,IAAId,WACT;YACE,GAAG,IAAI,CAACW,OAAO;YACfI,WAAWD;QACb,MACG,IAAI,CAACF,mBAAmB;IAE/B;IAEAI,IAAIF,KAAa,EAAE;QACjB,OAAO,IAAId,WACT;YACE,GAAG,IAAI,CAACW,OAAO;YACfM,WAAWH;QACb,MACG,IAAI,CAACF,mBAAmB;IAE/B;IAEAM,QAAQA,OAAe,EAAE;QACvB,OAAO,IAAIlB,WACT;YACE,GAAG,IAAI,CAACW,OAAO;YACfO;QACF,MACG,IAAI,CAACN,mBAAmB;IAE/B;IAEAO,QAAQ;QACN,OAAO,IAAI,CAACT,MAAM,CAAC;IACrB;IAEAU,MAAM;QACJ,OAAO,IAAI,CAACV,MAAM,CAAC;IACrB;IAEAW,OAAO;QACL,OAAO,IAAI,CAACX,MAAM,CAAC;IACrB;IAEAY,OAAO;QACL,OAAO,IAAI,CAACZ,MAAM,CAAC;IACrB;IAEAa,OAAO;QACL,OAAO,IAAI,CAACb,MAAM,CAAC;IACrB;AACF"}
@@ -0,0 +1,144 @@
1
+ import { Type } from '@sinclair/typebox';
2
+ import { Temporal } from 'temporal-polyfill';
3
+ import { BaseType } from "./base.js";
4
+ export class PlainDateType extends BaseType {
5
+ constructor(nullable = false, optional = false){
6
+ super(Type.Transform(Type.String({
7
+ format: 'iso-date'
8
+ })).Decode((value)=>Temporal.PlainDate.from(value)).Encode((value)=>value.toString({
9
+ calendarName: 'never'
10
+ })), nullable, optional);
11
+ }
12
+ nullable() {
13
+ const [_, ...args] = this._nullable();
14
+ return new PlainDateType(...args);
15
+ }
16
+ optional() {
17
+ const [_, ...args] = this._optional();
18
+ return new PlainDateType(...args);
19
+ }
20
+ nullish() {
21
+ const [_, ...args] = this._nullish();
22
+ return new PlainDateType(...args);
23
+ }
24
+ }
25
+ export class PlainDateTimeType extends BaseType {
26
+ constructor(nullable = false, optional = false){
27
+ super(Type.Transform(Type.String({
28
+ format: 'iso-date-time'
29
+ })).Decode((value)=>Temporal.PlainDateTime.from(value)).Encode((value)=>value.toString({
30
+ calendarName: 'never'
31
+ })), nullable, optional);
32
+ }
33
+ nullable() {
34
+ const [_, ...args] = this._nullable();
35
+ return new PlainDateTimeType(...args);
36
+ }
37
+ optional() {
38
+ const [_, ...args] = this._optional();
39
+ return new PlainDateTimeType(...args);
40
+ }
41
+ nullish() {
42
+ const [_, ...args] = this._nullish();
43
+ return new PlainDateTimeType(...args);
44
+ }
45
+ }
46
+ export class ZonedDateTimeType extends BaseType {
47
+ constructor(nullable = false, optional = false){
48
+ super(Type.Transform(Type.String({
49
+ format: 'date-time'
50
+ })).Decode((value)=>Temporal.Instant.from(value).toZonedDateTimeISO('UTC')).Encode((value)=>value.toString({
51
+ calendarName: 'never'
52
+ })), nullable, optional);
53
+ }
54
+ nullable() {
55
+ const [_, ...args] = this._nullable();
56
+ return new ZonedDateTimeType(...args);
57
+ }
58
+ optional() {
59
+ const [_, ...args] = this._optional();
60
+ return new ZonedDateTimeType(...args);
61
+ }
62
+ nullish() {
63
+ const [_, ...args] = this._nullish();
64
+ return new ZonedDateTimeType(...args);
65
+ }
66
+ }
67
+ export class PlainTimeType extends BaseType {
68
+ constructor(nullable = false, optional = false){
69
+ super(Type.Transform(Type.String({
70
+ format: 'time'
71
+ })).Decode((value)=>Temporal.PlainTime.from(value)).Encode((value)=>value.toString({
72
+ smallestUnit: 'microsecond'
73
+ })), nullable, optional);
74
+ }
75
+ nullable() {
76
+ const [_, ...args] = this._nullable();
77
+ return new PlainTimeType(...args);
78
+ }
79
+ optional() {
80
+ const [_, ...args] = this._optional();
81
+ return new PlainTimeType(...args);
82
+ }
83
+ nullish() {
84
+ const [_, ...args] = this._nullish();
85
+ return new PlainTimeType(...args);
86
+ }
87
+ }
88
+ export class DurationType extends BaseType {
89
+ constructor(nullable = false, optional = false){
90
+ super(Type.Transform(Type.String({})).Decode((value)=>Temporal.Duration.from(value)).Encode((value)=>value.toString({
91
+ smallestUnit: 'microsecond'
92
+ })), nullable, optional);
93
+ }
94
+ nullable() {
95
+ const [_, ...args] = this._nullable();
96
+ return new DurationType(...args);
97
+ }
98
+ optional() {
99
+ const [_, ...args] = this._optional();
100
+ return new DurationType(...args);
101
+ }
102
+ nullish() {
103
+ const [_, ...args] = this._nullish();
104
+ return new DurationType(...args);
105
+ }
106
+ }
107
+ export class PlainYearMonthType extends BaseType {
108
+ constructor(nullable = false, optional = false){
109
+ super(Type.Transform(Type.String({})).Decode((value)=>Temporal.PlainYearMonth.from(value)).Encode((value)=>value.toString({
110
+ calendarName: 'never'
111
+ })), nullable, optional);
112
+ }
113
+ nullable() {
114
+ const [_, ...args] = this._nullable();
115
+ return new PlainYearMonthType(...args);
116
+ }
117
+ optional() {
118
+ const [_, ...args] = this._optional();
119
+ return new PlainYearMonthType(...args);
120
+ }
121
+ nullish() {
122
+ const [_, ...args] = this._nullish();
123
+ return new PlainYearMonthType(...args);
124
+ }
125
+ }
126
+ export class PlainMonthDayType extends BaseType {
127
+ constructor(nullable = false, optional = false){
128
+ super(Type.Transform(Type.String({})).Decode((value)=>Temporal.PlainMonthDay.from(value)).Encode((value)=>value.toString({
129
+ calendarName: 'never'
130
+ })), nullable, optional);
131
+ }
132
+ nullable() {
133
+ const [_, ...args] = this._nullable();
134
+ return new PlainMonthDayType(...args);
135
+ }
136
+ optional() {
137
+ const [_, ...args] = this._optional();
138
+ return new PlainMonthDayType(...args);
139
+ }
140
+ nullish() {
141
+ const [_, ...args] = this._nullish();
142
+ return new PlainMonthDayType(...args);
143
+ }
144
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/temporal.ts"],"sourcesContent":["import { type TString, type TTransform, Type } from '@sinclair/typebox'\nimport { Temporal } from 'temporal-polyfill'\nimport { BaseType } from './base.ts'\n\nexport class PlainDateType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TTransform<TString, Temporal.PlainDate>, N, O> {\n constructor(nullable: N = false as N, optional: O = false as O) {\n super(\n Type.Transform(Type.String({ format: 'iso-date' }))\n .Decode((value) => Temporal.PlainDate.from(value))\n .Encode((value) => value.toString({ calendarName: 'never' })),\n nullable,\n optional,\n )\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new PlainDateType(...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new PlainDateType(...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new PlainDateType(...args)\n }\n}\n\nexport class PlainDateTimeType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TTransform<TString, Temporal.PlainDateTime>, N, O> {\n constructor(nullable: N = false as N, optional: O = false as O) {\n super(\n Type.Transform(Type.String({ format: 'iso-date-time' }))\n .Decode((value) => Temporal.PlainDateTime.from(value))\n .Encode((value) => value.toString({ calendarName: 'never' })),\n nullable,\n optional,\n )\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new PlainDateTimeType(...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new PlainDateTimeType(...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new PlainDateTimeType(...args)\n }\n}\n\nexport class ZonedDateTimeType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TTransform<TString, Temporal.ZonedDateTime>, N, O> {\n constructor(nullable: N = false as N, optional: O = false as O) {\n super(\n Type.Transform(Type.String({ format: 'date-time' }))\n .Decode((value) =>\n Temporal.Instant.from(value).toZonedDateTimeISO('UTC'),\n )\n .Encode((value) => value.toString({ calendarName: 'never' })),\n nullable,\n optional,\n )\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new ZonedDateTimeType(...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new ZonedDateTimeType(...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new ZonedDateTimeType(...args)\n }\n}\n\nexport class PlainTimeType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TTransform<TString, Temporal.PlainTime>, N, O> {\n constructor(nullable: N = false as N, optional: O = false as O) {\n super(\n Type.Transform(Type.String({ format: 'time' }))\n .Decode((value) => Temporal.PlainTime.from(value))\n .Encode((value) => value.toString({ smallestUnit: 'microsecond' })),\n nullable,\n optional,\n )\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new PlainTimeType(...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new PlainTimeType(...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new PlainTimeType(...args)\n }\n}\n\nexport class DurationType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TTransform<TString, Temporal.Duration>, N, O> {\n constructor(nullable: N = false as N, optional: O = false as O) {\n super(\n Type.Transform(\n Type.String({\n /* TODO: duration format, or regex? */\n }),\n )\n .Decode((value) => Temporal.Duration.from(value))\n .Encode((value) => value.toString({ smallestUnit: 'microsecond' })),\n nullable,\n optional,\n )\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new DurationType(...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new DurationType(...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new DurationType(...args)\n }\n}\n\nexport class PlainYearMonthType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TTransform<TString, Temporal.PlainYearMonth>, N, O> {\n constructor(nullable: N = false as N, optional: O = false as O) {\n super(\n Type.Transform(\n Type.String({\n /* TODO: duration format, or regex? */\n }),\n )\n .Decode((value) => Temporal.PlainYearMonth.from(value))\n .Encode((value) => value.toString({ calendarName: 'never' })),\n nullable,\n optional,\n )\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new PlainYearMonthType(...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new PlainYearMonthType(...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new PlainYearMonthType(...args)\n }\n}\n\nexport class PlainMonthDayType<\n N extends boolean = false,\n O extends boolean = false,\n> extends BaseType<TTransform<TString, Temporal.PlainMonthDay>, N, O> {\n constructor(nullable: N = false as N, optional: O = false as O) {\n super(\n Type.Transform(\n Type.String({\n /* TODO: duration format, or regex? */\n }),\n )\n .Decode((value) => Temporal.PlainMonthDay.from(value))\n .Encode((value) => value.toString({ calendarName: 'never' })),\n nullable,\n optional,\n )\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new PlainMonthDayType(...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new PlainMonthDayType(...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new PlainMonthDayType(...args)\n }\n}\n"],"names":["Type","Temporal","BaseType","PlainDateType","constructor","nullable","optional","Transform","String","format","Decode","value","PlainDate","from","Encode","toString","calendarName","_","args","_nullable","_optional","nullish","_nullish","PlainDateTimeType","PlainDateTime","ZonedDateTimeType","Instant","toZonedDateTimeISO","PlainTimeType","PlainTime","smallestUnit","DurationType","Duration","PlainYearMonthType","PlainYearMonth","PlainMonthDayType","PlainMonthDay"],"mappings":"AAAA,SAAwCA,IAAI,QAAQ,oBAAmB;AACvE,SAASC,QAAQ,QAAQ,oBAAmB;AAC5C,SAASC,QAAQ,QAAQ,YAAW;AAEpC,OAAO,MAAMC,sBAGHD;IACRE,YAAYC,WAAc,KAAU,EAAEC,WAAc,KAAU,CAAE;QAC9D,KAAK,CACHN,KAAKO,SAAS,CAACP,KAAKQ,MAAM,CAAC;YAAEC,QAAQ;QAAW,IAC7CC,MAAM,CAAC,CAACC,QAAUV,SAASW,SAAS,CAACC,IAAI,CAACF,QAC1CG,MAAM,CAAC,CAACH,QAAUA,MAAMI,QAAQ,CAAC;gBAAEC,cAAc;YAAQ,KAC5DX,UACAC;IAEJ;IAEAD,WAAW;QACT,MAAM,CAACY,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACC,SAAS;QACnC,OAAO,IAAIhB,iBAAiBe;IAC9B;IAEAZ,WAAW;QACT,MAAM,CAACW,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACE,SAAS;QACnC,OAAO,IAAIjB,iBAAiBe;IAC9B;IAEAG,UAAU;QACR,MAAM,CAACJ,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACI,QAAQ;QAClC,OAAO,IAAInB,iBAAiBe;IAC9B;AACF;AAEA,OAAO,MAAMK,0BAGHrB;IACRE,YAAYC,WAAc,KAAU,EAAEC,WAAc,KAAU,CAAE;QAC9D,KAAK,CACHN,KAAKO,SAAS,CAACP,KAAKQ,MAAM,CAAC;YAAEC,QAAQ;QAAgB,IAClDC,MAAM,CAAC,CAACC,QAAUV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O,IAAIa,qBAAqBjB;IAClC;AACF"}
@@ -0,0 +1,40 @@
1
+ import { Type } from '@sinclair/typebox';
2
+ import { BaseType, typeFinalSchema } from "./base.js";
3
+ export class UnionType extends BaseType {
4
+ types;
5
+ constructor(types, nullable = false, optional = false){
6
+ super(Type.Union(types.map((t)=>t[typeFinalSchema])), nullable, optional);
7
+ this.types = types;
8
+ }
9
+ nullable() {
10
+ const [_, ...args] = this._nullable();
11
+ return new UnionType(this.types, ...args);
12
+ }
13
+ optional() {
14
+ const [_, ...args] = this._optional();
15
+ return new UnionType(this.types, ...args);
16
+ }
17
+ nullish() {
18
+ const [_, ...args] = this._nullish();
19
+ return new UnionType(this.types, ...args);
20
+ }
21
+ }
22
+ export class IntersactionType extends BaseType {
23
+ types;
24
+ constructor(types, nullable = false, optional = false){
25
+ super(Type.Intersect(types.map((t)=>t[typeFinalSchema])), nullable, optional);
26
+ this.types = types;
27
+ }
28
+ nullable() {
29
+ const [_, ...args] = this._nullable();
30
+ return new IntersactionType(this.types, ...args);
31
+ }
32
+ optional() {
33
+ const [_, ...args] = this._optional();
34
+ return new IntersactionType(this.types, ...args);
35
+ }
36
+ nullish() {
37
+ const [_, ...args] = this._nullish();
38
+ return new IntersactionType(this.types, ...args);
39
+ }
40
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/union.ts"],"sourcesContent":["import { type TIntersect, type TUnion, Type } from '@sinclair/typebox'\nimport type { UnionToTuple } from '../utils.ts'\nimport { BaseType, typeFinalSchema } from './base.ts'\n\nexport class UnionType<\n T extends [BaseType, BaseType, ...BaseType[]] = [\n BaseType,\n BaseType,\n ...BaseType[],\n ],\n N extends boolean = false,\n O extends boolean = false,\n // @ts-expect-error\n> extends BaseType<TUnion<UnionToTuple<T[number][typeFinal]>>, N, O> {\n constructor(\n readonly types: T,\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(\n Type.Union(types.map((t) => t[typeFinalSchema])) as any,\n nullable,\n optional,\n )\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new UnionType(this.types, ...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new UnionType(this.types, ...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new UnionType(this.types, ...args)\n }\n}\n\nexport class IntersactionType<\n T extends [BaseType, BaseType, ...BaseType[]] = [\n BaseType,\n BaseType,\n ...BaseType[],\n ],\n N extends boolean = false,\n O extends boolean = false,\n // @ts-expect-error\n> extends BaseType<TIntersect<UnionToTuple<T[number][typeFinal]>>, N, O> {\n constructor(\n readonly types: T,\n nullable: N = false as N,\n optional: O = false as O,\n ) {\n super(\n Type.Intersect(types.map((t) => t[typeFinalSchema])) as any,\n nullable,\n optional,\n )\n }\n\n nullable() {\n const [_, ...args] = this._nullable()\n return new IntersactionType(this.types, ...args)\n }\n\n optional() {\n const [_, ...args] = this._optional()\n return new IntersactionType(this.types, ...args)\n }\n\n nullish() {\n const [_, ...args] = this._nullish()\n return new IntersactionType(this.types, ...args)\n }\n}\n"],"names":["Type","BaseType","typeFinalSchema","UnionType","constructor","types","nullable","optional","Union","map","t","_","args","_nullable","_optional","nullish","_nullish","IntersactionType","Intersect"],"mappings":"AAAA,SAAuCA,IAAI,QAAQ,oBAAmB;AAEtE,SAASC,QAAQ,EAAEC,eAAe,QAAQ,YAAW;AAErD,OAAO,MAAMC,kBASHF;;IACRG,YACE,AAASC,KAAQ,EACjBC,WAAc,KAAU,EACxBC,WAAc,KAAU,CACxB;QACA,KAAK,CACHP,KAAKQ,KAAK,CAACH,MAAMI,GAAG,CAAC,CAACC,IAAMA,CAAC,CAACR,gBAAgB,IAC9CI,UACAC;aAPOF,QAAAA;IASX;IAEAC,WAAW;QACT,MAAM,CAACK,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACC,SAAS;QACnC,OAAO,IAAIV,UAAU,IAAI,CAACE,KAAK,KAAKO;IACtC;IAEAL,WAAW;QACT,MAAM,CAACI,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACE,SAAS;QACnC,OAAO,IAAIX,UAAU,IAAI,CAACE,KAAK,KAAKO;IACtC;IAEAG,UAAU;QACR,MAAM,CAACJ,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACI,QAAQ;QAClC,OAAO,IAAIb,UAAU,IAAI,CAACE,KAAK,KAAKO;IACtC;AACF;AAEA,OAAO,MAAMK,yBASHhB;;IACRG,YACE,AAASC,KAAQ,EACjBC,WAAc,KAAU,EACxBC,WAAc,KAAU,CACxB;QACA,KAAK,CACHP,KAAKkB,SAAS,CAACb,MAAMI,GAAG,CAAC,CAACC,IAAMA,CAAC,CAACR,gBAAgB,IAClDI,UACAC;aAPOF,QAAAA;IASX;IAEAC,WAAW;QACT,MAAM,CAACK,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACC,SAAS;QACnC,OAAO,IAAII,iBAAiB,IAAI,CAACZ,KAAK,KAAKO;IAC7C;IAEAL,WAAW;QACT,MAAM,CAACI,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACE,SAAS;QACnC,OAAO,IAAIG,iBAAiB,IAAI,CAACZ,KAAK,KAAKO;IAC7C;IAEAG,UAAU;QACR,MAAM,CAACJ,GAAG,GAAGC,KAAK,GAAG,IAAI,CAACI,QAAQ;QAClC,OAAO,IAAIC,iBAAiB,IAAI,CAACZ,KAAK,KAAKO;IAC7C;AACF"}
package/dist/utils.js ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils.ts"],"sourcesContent":["export type UnionToIntersectionFn<T> = (\n T extends unknown\n ? (k: () => T) => void\n : never\n) extends (k: infer Intersection) => void\n ? Intersection\n : never\nexport type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last\n ? Last\n : never\nexport type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never]\n ? Tuple\n : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>\nexport type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never\n\nexport type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>\n"],"names":[],"mappings":"AAeA,WAAsE"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@nmtjs/type",
3
+ "type": "module",
4
+ "exports": {
5
+ ".": {
6
+ "bun": "./src/index.ts",
7
+ "default": "./dist/index.js",
8
+ "types": "./src/index.ts"
9
+ },
10
+ "./compiler": {
11
+ "bun": "./src/compiler.ts",
12
+ "default": "./dist/compiler.js",
13
+ "types": "./src/compiler.ts"
14
+ },
15
+ "./temporal": {
16
+ "bun": "./src/temporal.ts",
17
+ "default": "./dist/temporal.js",
18
+ "types": "./src/temporal.ts"
19
+ }
20
+ },
21
+ "peerDependencies": {
22
+ "@sinclair/typebox": "^0.33.7",
23
+ "temporal-polyfill": "^0.2.5",
24
+ "@nmtjs/common": "0.1.0"
25
+ },
26
+ "devDependencies": {
27
+ "@sinclair/typebox": "^0.33.7",
28
+ "temporal-polyfill": "^0.2.5",
29
+ "@nmtjs/common": "0.1.0"
30
+ },
31
+ "files": [
32
+ "src",
33
+ "dist",
34
+ "tsconfig.json",
35
+ "LICENSE.md",
36
+ "README.md"
37
+ ],
38
+ "version": "0.1.0",
39
+ "scripts": {
40
+ "build": "neemata-build -p neutral --root=./src './**/*.ts'",
41
+ "type-check": "tsc --noEmit"
42
+ }
43
+ }