@wener/utils 1.1.48 → 1.1.49

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 (145) hide show
  1. package/lib/asyncs/Promises.js +9 -1
  2. package/lib/asyncs/Promises.js.map +1 -1
  3. package/lib/asyncs/createLazyPromise.js +52 -51
  4. package/lib/asyncs/createLazyPromise.js.map +1 -1
  5. package/lib/asyncs/firstOfAsyncIterator.js.map +1 -1
  6. package/lib/asyncs/nextOfAsyncIterator.js.map +1 -1
  7. package/lib/asyncs/timeout.js +4 -4
  8. package/lib/asyncs/timeout.js.map +1 -1
  9. package/lib/cn/types.js +3 -0
  10. package/lib/cn/types.js.map +1 -0
  11. package/lib/crypto/getNodeCrypto.js +1 -0
  12. package/lib/crypto/getNodeCrypto.js.map +1 -1
  13. package/lib/fetch/createFetchWith.js.map +1 -1
  14. package/lib/fetch/createFetchWithRetry.js.map +1 -1
  15. package/lib/index.js +2 -0
  16. package/lib/index.js.map +1 -1
  17. package/lib/io/ArrayBuffers.js.map +1 -1
  18. package/lib/io/ByteBuffer.js +233 -34
  19. package/lib/io/ByteBuffer.js.map +1 -1
  20. package/lib/langs/getGlobalStates.js +17 -0
  21. package/lib/langs/getGlobalStates.js.map +1 -0
  22. package/lib/langs/getObjectId.js +18 -0
  23. package/lib/langs/getObjectId.js.map +1 -0
  24. package/lib/langs/isNullish.js +5 -0
  25. package/lib/langs/isNullish.js.map +1 -0
  26. package/lib/logging/slog.js.map +1 -1
  27. package/lib/maths/clamp.js +7 -6
  28. package/lib/maths/clamp.js.map +1 -1
  29. package/lib/schema/typebox/typebox.js.map +1 -1
  30. package/lib/server/fetch/createFetchWithProxyByUndici.js.map +1 -1
  31. package/package.json +3 -3
  32. package/src/asyncs/Promises.ts +12 -2
  33. package/src/asyncs/createLazyPromise.test.ts +52 -13
  34. package/src/asyncs/createLazyPromise.ts +66 -61
  35. package/src/asyncs/firstOfAsyncIterator.ts +1 -1
  36. package/src/asyncs/nextOfAsyncIterator.ts +1 -1
  37. package/src/asyncs/timeout.ts +4 -4
  38. package/src/cn/types.ts +11 -0
  39. package/src/crypto/getNodeCrypto.ts +1 -0
  40. package/src/fetch/createFetchWith.ts +1 -1
  41. package/src/fetch/createFetchWithRetry.ts +1 -1
  42. package/src/index.ts +2 -0
  43. package/src/io/ArrayBuffers.ts +7 -3
  44. package/src/io/ByteBuffer.test.ts +26 -14
  45. package/src/io/ByteBuffer.ts +270 -38
  46. package/src/langs/getGlobalStates.ts +21 -0
  47. package/src/langs/getObjectId.ts +20 -0
  48. package/src/langs/isNullish.ts +3 -0
  49. package/src/langs/mixin.test.ts +4 -0
  50. package/src/logging/slog.ts +1 -1
  51. package/src/maths/clamp.test.ts +5 -1
  52. package/src/maths/clamp.ts +7 -7
  53. package/src/objects/merge/merge.test.ts +1 -1
  54. package/src/schema/typebox/typebox.ts +1 -1
  55. package/src/server/fetch/createFetchWithProxyByUndici.ts +2 -2
  56. package/tsconfig.json +4 -1
  57. package/lib/schema/typebox/gen/codegen/common/encoder.js +0 -94
  58. package/lib/schema/typebox/gen/codegen/common/encoder.js.map +0 -1
  59. package/lib/schema/typebox/gen/codegen/common/formatter.js +0 -33
  60. package/lib/schema/typebox/gen/codegen/common/formatter.js.map +0 -1
  61. package/lib/schema/typebox/gen/codegen/common/index.js +0 -29
  62. package/lib/schema/typebox/gen/codegen/common/index.js.map +0 -1
  63. package/lib/schema/typebox/gen/codegen/common/jsdoc.js +0 -117
  64. package/lib/schema/typebox/gen/codegen/common/jsdoc.js.map +0 -1
  65. package/lib/schema/typebox/gen/codegen/expression/compiler.js +0 -364
  66. package/lib/schema/typebox/gen/codegen/expression/compiler.js.map +0 -1
  67. package/lib/schema/typebox/gen/codegen/expression/errors.js +0 -259
  68. package/lib/schema/typebox/gen/codegen/expression/errors.js.map +0 -1
  69. package/lib/schema/typebox/gen/codegen/expression/evaluator.js +0 -254
  70. package/lib/schema/typebox/gen/codegen/expression/evaluator.js.map +0 -1
  71. package/lib/schema/typebox/gen/codegen/expression/expression.js +0 -381
  72. package/lib/schema/typebox/gen/codegen/expression/expression.js.map +0 -1
  73. package/lib/schema/typebox/gen/codegen/expression/index.js +0 -32
  74. package/lib/schema/typebox/gen/codegen/expression/index.js.map +0 -1
  75. package/lib/schema/typebox/gen/codegen/index.js +0 -29
  76. package/lib/schema/typebox/gen/codegen/index.js.map +0 -1
  77. package/lib/schema/typebox/gen/codegen/model/index.js +0 -40
  78. package/lib/schema/typebox/gen/codegen/model/index.js.map +0 -1
  79. package/lib/schema/typebox/gen/codegen/model/model-to-arktype.js +0 -260
  80. package/lib/schema/typebox/gen/codegen/model/model-to-arktype.js.map +0 -1
  81. package/lib/schema/typebox/gen/codegen/model/model-to-expression.js +0 -383
  82. package/lib/schema/typebox/gen/codegen/model/model-to-expression.js.map +0 -1
  83. package/lib/schema/typebox/gen/codegen/model/model-to-grpc.js +0 -238
  84. package/lib/schema/typebox/gen/codegen/model/model-to-grpc.js.map +0 -1
  85. package/lib/schema/typebox/gen/codegen/model/model-to-io-ts.js +0 -274
  86. package/lib/schema/typebox/gen/codegen/model/model-to-io-ts.js.map +0 -1
  87. package/lib/schema/typebox/gen/codegen/model/model-to-javascript.js +0 -47
  88. package/lib/schema/typebox/gen/codegen/model/model-to-javascript.js.map +0 -1
  89. package/lib/schema/typebox/gen/codegen/model/model-to-json-schema.js +0 -192
  90. package/lib/schema/typebox/gen/codegen/model/model-to-json-schema.js.map +0 -1
  91. package/lib/schema/typebox/gen/codegen/model/model-to-typebox.js +0 -33
  92. package/lib/schema/typebox/gen/codegen/model/model-to-typebox.js.map +0 -1
  93. package/lib/schema/typebox/gen/codegen/model/model-to-typescript.js +0 -188
  94. package/lib/schema/typebox/gen/codegen/model/model-to-typescript.js.map +0 -1
  95. package/lib/schema/typebox/gen/codegen/model/model-to-valibot.js +0 -239
  96. package/lib/schema/typebox/gen/codegen/model/model-to-valibot.js.map +0 -1
  97. package/lib/schema/typebox/gen/codegen/model/model-to-value.js +0 -43
  98. package/lib/schema/typebox/gen/codegen/model/model-to-value.js.map +0 -1
  99. package/lib/schema/typebox/gen/codegen/model/model-to-yrel.js +0 -227
  100. package/lib/schema/typebox/gen/codegen/model/model-to-yrel.js.map +0 -1
  101. package/lib/schema/typebox/gen/codegen/model/model-to-yup.js +0 -225
  102. package/lib/schema/typebox/gen/codegen/model/model-to-yup.js.map +0 -1
  103. package/lib/schema/typebox/gen/codegen/model/model-to-zod.js +0 -248
  104. package/lib/schema/typebox/gen/codegen/model/model-to-zod.js.map +0 -1
  105. package/lib/schema/typebox/gen/codegen/model/model.js +0 -27
  106. package/lib/schema/typebox/gen/codegen/model/model.js.map +0 -1
  107. package/lib/schema/typebox/gen/codegen/typescript/index.js +0 -28
  108. package/lib/schema/typebox/gen/codegen/typescript/index.js.map +0 -1
  109. package/lib/schema/typebox/gen/codegen/typescript/typescript-to-model.js +0 -72
  110. package/lib/schema/typebox/gen/codegen/typescript/typescript-to-model.js.map +0 -1
  111. package/lib/schema/typebox/gen/codegen/typescript/typescript-to-typebox.js +0 -620
  112. package/lib/schema/typebox/gen/codegen/typescript/typescript-to-typebox.js.map +0 -1
  113. package/lib/schema/typebox/gen/index.js +0 -3
  114. package/lib/schema/typebox/gen/index.js.map +0 -1
  115. package/src/schema/typebox/gen/codegen/common/encoder.ts +0 -99
  116. package/src/schema/typebox/gen/codegen/common/formatter.ts +0 -31
  117. package/src/schema/typebox/gen/codegen/common/index.ts +0 -29
  118. package/src/schema/typebox/gen/codegen/common/jsdoc.ts +0 -93
  119. package/src/schema/typebox/gen/codegen/expression/compiler.ts +0 -377
  120. package/src/schema/typebox/gen/codegen/expression/errors.ts +0 -302
  121. package/src/schema/typebox/gen/codegen/expression/evaluator.ts +0 -268
  122. package/src/schema/typebox/gen/codegen/expression/expression.ts +0 -538
  123. package/src/schema/typebox/gen/codegen/expression/index.ts +0 -32
  124. package/src/schema/typebox/gen/codegen/index.ts +0 -29
  125. package/src/schema/typebox/gen/codegen/model/index.ts +0 -40
  126. package/src/schema/typebox/gen/codegen/model/model-to-arktype.ts +0 -266
  127. package/src/schema/typebox/gen/codegen/model/model-to-expression.ts +0 -378
  128. package/src/schema/typebox/gen/codegen/model/model-to-grpc.ts +0 -244
  129. package/src/schema/typebox/gen/codegen/model/model-to-io-ts.ts +0 -294
  130. package/src/schema/typebox/gen/codegen/model/model-to-javascript.ts +0 -42
  131. package/src/schema/typebox/gen/codegen/model/model-to-json-schema.ts +0 -166
  132. package/src/schema/typebox/gen/codegen/model/model-to-typebox.ts +0 -32
  133. package/src/schema/typebox/gen/codegen/model/model-to-typescript.ts +0 -189
  134. package/src/schema/typebox/gen/codegen/model/model-to-valibot.ts +0 -236
  135. package/src/schema/typebox/gen/codegen/model/model-to-value.ts +0 -42
  136. package/src/schema/typebox/gen/codegen/model/model-to-yrel.ts +0 -232
  137. package/src/schema/typebox/gen/codegen/model/model-to-yup.ts +0 -226
  138. package/src/schema/typebox/gen/codegen/model/model-to-zod.ts +0 -251
  139. package/src/schema/typebox/gen/codegen/model/model.ts +0 -33
  140. package/src/schema/typebox/gen/codegen/typescript/index.ts +0 -28
  141. package/src/schema/typebox/gen/codegen/typescript/typescript-to-model.ts +0 -61
  142. package/src/schema/typebox/gen/codegen/typescript/typescript-to-typebox.ts +0 -647
  143. package/src/schema/typebox/gen/gen.test.ts +0 -12
  144. package/src/schema/typebox/gen/index.ts +0 -1
  145. /package/src/schema/{typebox/gen/README.md → README.md} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../src/schema/typebox/gen/codegen/model/model-to-javascript.ts"],"sourcesContent":["/*--------------------------------------------------------------------------\n\n@sinclair/typebox-codegen\n\nThe MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\nimport { TypeCompiler } from '@sinclair/typebox/compiler';\nimport { Formatter } from '../common/formatter';\nimport { TypeBoxModel } from './model';\n\nexport namespace ModelToJavaScript {\n export function Generate(model: TypeBoxModel): string {\n const definitions: string[] = [];\n const header = `// @ts-nocheck`;\n for (const type of model.types) {\n definitions.push(`export const ${type.$id!} = (() => { \n ${TypeCompiler.Code(type, model.types, { language: 'javascript' })} \n })()`);\n }\n const output = [header, ...definitions];\n return output.join('\\n\\n');\n }\n}\n"],"names":["TypeCompiler","ModelToJavaScript","Generate","model","definitions","header","type","types","push","$id","Code","language","output","join"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;2EAwB2E,GAC3E,SAASA,YAAY,QAAQ,6BAA6B;;UAIzCC;IACR,SAASC,SAASC,KAAmB;QAC1C,MAAMC,cAAwB,EAAE;QAChC,MAAMC,SAAS,CAAC,cAAc,CAAC;QAC/B,KAAK,MAAMC,QAAQH,MAAMI,KAAK,CAAE;YAC9BH,YAAYI,IAAI,CAAC,CAAC,aAAa,EAAEF,KAAKG,GAAG,CAAE;QACzC,EAAET,aAAaU,IAAI,CAACJ,MAAMH,MAAMI,KAAK,EAAE;gBAAEI,UAAU;YAAa,GAAG;UACjE,CAAC;QACP;QACA,MAAMC,SAAS;YAACP;eAAWD;SAAY;QACvC,OAAOQ,OAAOC,IAAI,CAAC;IACrB;sBAVgBX,WAAAA;AAWlB,GAZiBD,sBAAAA"}
@@ -1,192 +0,0 @@
1
- /*--------------------------------------------------------------------------
2
-
3
- @sinclair/typebox-codegen
4
-
5
- The MIT License (MIT)
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
-
25
- ---------------------------------------------------------------------------*/ import * as Types from '@sinclair/typebox';
26
- import { Formatter } from '../common/index.js';
27
- export var ModelToJsonSchema;
28
- (function(ModelToJsonSchema) {
29
- function Any(schema) {
30
- return schema;
31
- }
32
- function Array(schema) {
33
- return schema;
34
- }
35
- function BigInt(schema) {
36
- return schema;
37
- }
38
- function Boolean(schema) {
39
- return schema;
40
- }
41
- function Date(schema) {
42
- return schema;
43
- }
44
- function Constructor(schema) {
45
- return schema;
46
- }
47
- function Function(schema) {
48
- const parameters = schema.parameters.map((schema)=>Visit(schema));
49
- const returns = Visit(schema.returns);
50
- return {
51
- ...schema,
52
- parameters,
53
- returns
54
- };
55
- }
56
- function Integer(schema) {
57
- return schema;
58
- }
59
- function Intersect(schema) {
60
- const allOf = schema.allOf.map((schema)=>Visit(schema));
61
- return {
62
- ...schema,
63
- allOf
64
- };
65
- }
66
- function Literal(schema) {
67
- return schema;
68
- }
69
- function Never(schema) {
70
- return schema;
71
- }
72
- function Null(schema) {
73
- return schema;
74
- }
75
- function String(schema) {
76
- return schema;
77
- }
78
- function Number(schema) {
79
- return schema;
80
- }
81
- function Object(schema) {
82
- const properties = globalThis.Object.keys(schema.properties).reduce((acc, key)=>{
83
- return {
84
- ...acc,
85
- [key]: Visit(schema.properties[key])
86
- };
87
- }, {});
88
- return {
89
- ...schema,
90
- properties
91
- };
92
- }
93
- function Promise(schema) {
94
- const item = Visit(schema.item);
95
- return {
96
- ...schema,
97
- item
98
- };
99
- }
100
- function Record(schema) {
101
- const patternProperties = globalThis.Object.keys(schema.patternProperties).reduce((acc, key)=>{
102
- return {
103
- ...acc,
104
- [key]: Visit(schema.patternProperties[key])
105
- };
106
- }, {});
107
- return {
108
- ...schema,
109
- patternProperties
110
- };
111
- }
112
- function Ref(schema) {
113
- return schema;
114
- }
115
- function This(schema) {
116
- return schema;
117
- }
118
- function Tuple(schema) {
119
- if (schema.items === undefined) return schema;
120
- const items = schema.items.map((schema)=>Visit(schema));
121
- return {
122
- ...schema,
123
- items
124
- };
125
- }
126
- function TemplateLiteral(schema) {
127
- return schema;
128
- }
129
- function UInt8Array(schema) {
130
- return schema;
131
- }
132
- function Undefined(schema) {
133
- return schema;
134
- }
135
- function Union(schema) {
136
- const anyOf = schema.anyOf.map((schema)=>Visit(schema));
137
- return {
138
- ...schema,
139
- anyOf
140
- };
141
- }
142
- function Unknown(schema) {
143
- return schema;
144
- }
145
- function Void(schema) {
146
- return schema;
147
- }
148
- function UnsupportedType(schema) {
149
- return schema;
150
- }
151
- function Visit(schema) {
152
- if (Types.TypeGuard.IsAny(schema)) return Any(schema);
153
- if (Types.TypeGuard.IsArray(schema)) return Array(schema);
154
- if (Types.TypeGuard.IsBigInt(schema)) return BigInt(schema);
155
- if (Types.TypeGuard.IsBoolean(schema)) return Boolean(schema);
156
- if (Types.TypeGuard.IsDate(schema)) return Date(schema);
157
- if (Types.TypeGuard.IsConstructor(schema)) return Constructor(schema);
158
- if (Types.TypeGuard.IsFunction(schema)) return Function(schema);
159
- if (Types.TypeGuard.IsInteger(schema)) return Integer(schema);
160
- if (Types.TypeGuard.IsIntersect(schema)) return Intersect(schema);
161
- if (Types.TypeGuard.IsLiteral(schema)) return Literal(schema);
162
- if (Types.TypeGuard.IsNever(schema)) return Never(schema);
163
- if (Types.TypeGuard.IsNull(schema)) return Null(schema);
164
- if (Types.TypeGuard.IsNumber(schema)) return Number(schema);
165
- if (Types.TypeGuard.IsObject(schema)) return Object(schema);
166
- if (Types.TypeGuard.IsPromise(schema)) return Promise(schema);
167
- if (Types.TypeGuard.IsRecord(schema)) return Record(schema);
168
- if (Types.TypeGuard.IsRef(schema)) return Ref(schema);
169
- if (Types.TypeGuard.IsString(schema)) return String(schema);
170
- if (Types.TypeGuard.IsTemplateLiteral(schema)) return TemplateLiteral(schema);
171
- if (Types.TypeGuard.IsThis(schema)) return This(schema);
172
- if (Types.TypeGuard.IsTuple(schema)) return Tuple(schema);
173
- if (Types.TypeGuard.IsUint8Array(schema)) return UInt8Array(schema);
174
- if (Types.TypeGuard.IsUndefined(schema)) return Undefined(schema);
175
- if (Types.TypeGuard.IsUnion(schema)) return Union(schema);
176
- if (Types.TypeGuard.IsUnknown(schema)) return Unknown(schema);
177
- if (Types.TypeGuard.IsVoid(schema)) return Void(schema);
178
- return UnsupportedType(schema);
179
- }
180
- function Generate(model) {
181
- const buffer = [];
182
- for (const type of model.types.filter((type)=>Types.TypeGuard.IsSchema(type))){
183
- const schema = Visit(type);
184
- const encode = JSON.stringify(schema, null, 2);
185
- buffer.push(`export const ${type.$id} = ${encode}`);
186
- }
187
- return Formatter.Format(buffer.join('\n'));
188
- }
189
- ModelToJsonSchema.Generate = Generate;
190
- })(ModelToJsonSchema || (ModelToJsonSchema = {}));
191
-
192
- //# sourceMappingURL=model-to-json-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../src/schema/typebox/gen/codegen/model/model-to-json-schema.ts"],"sourcesContent":["/*--------------------------------------------------------------------------\n\n@sinclair/typebox-codegen\n\nThe MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\nimport * as Types from '@sinclair/typebox';\nimport { Formatter } from '../common/index';\nimport { TypeBoxModel } from './model';\n\n// --------------------------------------------------------------------------\n// ModelToJsonSchema\n// --------------------------------------------------------------------------\nexport namespace ModelToJsonSchema {\n function Any(schema: Types.TAny): Types.TSchema {\n return schema;\n }\n function Array(schema: Types.TArray): Types.TSchema {\n return schema;\n }\n function BigInt(schema: Types.TBigInt): Types.TSchema {\n return schema;\n }\n function Boolean(schema: Types.TBoolean): Types.TSchema {\n return schema;\n }\n function Date(schema: Types.TDate): Types.TSchema {\n return schema;\n }\n function Constructor(schema: Types.TConstructor): Types.TSchema {\n return schema;\n }\n function Function(schema: Types.TFunction): Types.TSchema {\n const parameters = schema.parameters.map((schema) => Visit(schema));\n const returns = Visit(schema.returns);\n return { ...schema, parameters, returns };\n }\n function Integer(schema: Types.TInteger): Types.TSchema {\n return schema;\n }\n function Intersect(schema: Types.TIntersect): Types.TSchema {\n const allOf = schema.allOf.map((schema) => Visit(schema));\n return { ...schema, allOf };\n }\n function Literal(schema: Types.TLiteral): Types.TSchema {\n return schema;\n }\n function Never(schema: Types.TNever): Types.TSchema {\n return schema;\n }\n function Null(schema: Types.TNull): Types.TSchema {\n return schema;\n }\n function String(schema: Types.TString): Types.TSchema {\n return schema;\n }\n function Number(schema: Types.TNumber): Types.TSchema {\n return schema;\n }\n function Object(schema: Types.TObject): Types.TSchema {\n const properties = globalThis.Object.keys(schema.properties).reduce((acc, key) => {\n return { ...acc, [key]: Visit(schema.properties[key]) };\n }, {});\n return { ...schema, properties };\n }\n function Promise(schema: Types.TPromise): Types.TSchema {\n const item = Visit(schema.item);\n return { ...schema, item };\n }\n function Record(schema: Types.TRecord): Types.TSchema {\n const patternProperties = globalThis.Object.keys(schema.patternProperties).reduce((acc, key) => {\n return { ...acc, [key]: Visit(schema.patternProperties[key]) };\n }, {});\n return { ...schema, patternProperties };\n }\n function Ref(schema: Types.TRef): Types.TSchema {\n return schema;\n }\n function This(schema: Types.TThis): Types.TSchema {\n return schema;\n }\n function Tuple(schema: Types.TTuple): Types.TSchema {\n if (schema.items === undefined) return schema;\n const items = schema.items.map((schema) => Visit(schema));\n return { ...schema, items };\n }\n function TemplateLiteral(schema: Types.TTemplateLiteral): Types.TSchema {\n return schema;\n }\n function UInt8Array(schema: Types.TUint8Array): Types.TSchema {\n return schema;\n }\n function Undefined(schema: Types.TUndefined): Types.TSchema {\n return schema;\n }\n function Union(schema: Types.TUnion): Types.TSchema {\n const anyOf = schema.anyOf.map((schema) => Visit(schema));\n return { ...schema, anyOf };\n }\n function Unknown(schema: Types.TUnknown): Types.TSchema {\n return schema;\n }\n function Void(schema: Types.TVoid) {\n return schema;\n }\n function UnsupportedType(schema: Types.TSchema) {\n return schema;\n }\n function Visit(schema: Types.TSchema): Types.TSchema {\n if (Types.TypeGuard.IsAny(schema)) return Any(schema);\n if (Types.TypeGuard.IsArray(schema)) return Array(schema);\n if (Types.TypeGuard.IsBigInt(schema)) return BigInt(schema);\n if (Types.TypeGuard.IsBoolean(schema)) return Boolean(schema);\n if (Types.TypeGuard.IsDate(schema)) return Date(schema);\n if (Types.TypeGuard.IsConstructor(schema)) return Constructor(schema);\n if (Types.TypeGuard.IsFunction(schema)) return Function(schema);\n if (Types.TypeGuard.IsInteger(schema)) return Integer(schema);\n if (Types.TypeGuard.IsIntersect(schema)) return Intersect(schema);\n if (Types.TypeGuard.IsLiteral(schema)) return Literal(schema);\n if (Types.TypeGuard.IsNever(schema)) return Never(schema);\n if (Types.TypeGuard.IsNull(schema)) return Null(schema);\n if (Types.TypeGuard.IsNumber(schema)) return Number(schema);\n if (Types.TypeGuard.IsObject(schema)) return Object(schema);\n if (Types.TypeGuard.IsPromise(schema)) return Promise(schema);\n if (Types.TypeGuard.IsRecord(schema)) return Record(schema);\n if (Types.TypeGuard.IsRef(schema)) return Ref(schema);\n if (Types.TypeGuard.IsString(schema)) return String(schema);\n if (Types.TypeGuard.IsTemplateLiteral(schema)) return TemplateLiteral(schema);\n if (Types.TypeGuard.IsThis(schema)) return This(schema);\n if (Types.TypeGuard.IsTuple(schema)) return Tuple(schema);\n if (Types.TypeGuard.IsUint8Array(schema)) return UInt8Array(schema);\n if (Types.TypeGuard.IsUndefined(schema)) return Undefined(schema);\n if (Types.TypeGuard.IsUnion(schema)) return Union(schema);\n if (Types.TypeGuard.IsUnknown(schema)) return Unknown(schema);\n if (Types.TypeGuard.IsVoid(schema)) return Void(schema);\n return UnsupportedType(schema);\n }\n export function Generate(model: TypeBoxModel): string {\n const buffer: string[] = [];\n for (const type of model.types.filter((type) => Types.TypeGuard.IsSchema(type))) {\n const schema = Visit(type);\n const encode = JSON.stringify(schema, null, 2);\n buffer.push(`export const ${type.$id} = ${encode}`);\n }\n return Formatter.Format(buffer.join('\\n'));\n }\n}\n"],"names":["Types","Formatter","ModelToJsonSchema","Any","schema","Array","BigInt","Boolean","Date","Constructor","Function","parameters","map","Visit","returns","Integer","Intersect","allOf","Literal","Never","Null","String","Number","Object","properties","globalThis","keys","reduce","acc","key","Promise","item","Record","patternProperties","Ref","This","Tuple","items","undefined","TemplateLiteral","UInt8Array","Undefined","Union","anyOf","Unknown","Void","UnsupportedType","TypeGuard","IsAny","IsArray","IsBigInt","IsBoolean","IsDate","IsConstructor","IsFunction","IsInteger","IsIntersect","IsLiteral","IsNever","IsNull","IsNumber","IsObject","IsPromise","IsRecord","IsRef","IsString","IsTemplateLiteral","IsThis","IsTuple","IsUint8Array","IsUndefined","IsUnion","IsUnknown","IsVoid","Generate","model","buffer","type","types","filter","IsSchema","encode","JSON","stringify","push","$id","Format","join"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;2EAwB2E,GAC3E,YAAYA,WAAW,oBAAoB;AAC3C,SAASC,SAAS,QAAQ,kBAAkB;;UAM3BC;IACf,SAASC,IAAIC,MAAkB;QAC7B,OAAOA;IACT;IACA,SAASC,MAAMD,MAAoB;QACjC,OAAOA;IACT;IACA,SAASE,OAAOF,MAAqB;QACnC,OAAOA;IACT;IACA,SAASG,QAAQH,MAAsB;QACr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,CAAChE,SAAS,OAAOgC,MAAMhC;QAClD,IAAIJ,MAAM+C,SAAS,CAACsB,YAAY,CAACjE,SAAS,OAAOoC,WAAWpC;QAC5D,IAAIJ,MAAM+C,SAAS,CAACuB,WAAW,CAAClE,SAAS,OAAOqC,UAAUrC;QAC1D,IAAIJ,MAAM+C,SAAS,CAACwB,OAAO,CAACnE,SAAS,OAAOsC,MAAMtC;QAClD,IAAIJ,MAAM+C,SAAS,CAACyB,SAAS,CAACpE,SAAS,OAAOwC,QAAQxC;QACtD,IAAIJ,MAAM+C,SAAS,CAAC0B,MAAM,CAACrE,SAAS,OAAOyC,KAAKzC;QAChD,OAAO0C,gBAAgB1C;IACzB;IACO,SAASsE,SAASC,KAAmB;QAC1C,MAAMC,SAAmB,EAAE;QAC3B,KAAK,MAAMC,QAAQF,MAAMG,KAAK,CAACC,MAAM,CAAC,CAACF,OAAS7E,MAAM+C,SAAS,CAACiC,QAAQ,CAACH,OAAQ;YAC/E,MAAMzE,SAASS,MAAMgE;YACrB,MAAMI,SAASC,KAAKC,SAAS,CAAC/E,QAAQ,MAAM;YAC5CwE,OAAOQ,IAAI,CAAC,CAAC,aAAa,EAAEP,KAAKQ,GAAG,CAAC,GAAG,EAAEJ,OAAO,CAAC;QACpD;QACA,OAAOhF,UAAUqF,MAAM,CAACV,OAAOW,IAAI,CAAC;IACtC;sBARgBb,WAAAA;AASlB,GArIiBxE,sBAAAA"}
@@ -1,33 +0,0 @@
1
- /*--------------------------------------------------------------------------
2
-
3
- @sinclair/typebox-codegen
4
-
5
- The MIT License (MIT)
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
-
25
- ---------------------------------------------------------------------------*/ export var ModelToTypeBox;
26
- (function(ModelToTypeBox) {
27
- function Generate(model) {
28
- return '// todo';
29
- }
30
- ModelToTypeBox.Generate = Generate;
31
- })(ModelToTypeBox || (ModelToTypeBox = {}));
32
-
33
- //# sourceMappingURL=model-to-typebox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../src/schema/typebox/gen/codegen/model/model-to-typebox.ts"],"sourcesContent":["/*--------------------------------------------------------------------------\n\n@sinclair/typebox-codegen\n\nThe MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\nimport { TypeBoxModel } from './model';\n\nexport namespace ModelToTypeBox {\n export function Generate(model: TypeBoxModel) {\n return '// todo';\n }\n}\n"],"names":["ModelToTypeBox","Generate","model"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;2EAwB2E;UAG1DA;IACR,SAASC,SAASC,KAAmB;QAC1C,OAAO;IACT;mBAFgBD,WAAAA;AAGlB,GAJiBD,mBAAAA"}
@@ -1,188 +0,0 @@
1
- /*--------------------------------------------------------------------------
2
-
3
- @sinclair/typebox-codegen
4
-
5
- The MIT License (MIT)
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
-
25
- ---------------------------------------------------------------------------*/ import * as Types from '@sinclair/typebox';
26
- import { TypeCompiler } from '@sinclair/typebox/compiler';
27
- import { Formatter } from '../common/formatter.js';
28
- export var ModelToTypeScript;
29
- (function(ModelToTypeScript) {
30
- function Any(schema) {
31
- return 'any';
32
- }
33
- function Array(schema) {
34
- const items = Visit(schema.items);
35
- return `Array<${items}>`;
36
- }
37
- function Boolean(schema) {
38
- return 'boolean';
39
- }
40
- function BigInt(schema) {
41
- return 'bigint';
42
- }
43
- function Constructor(schema) {
44
- const params = schema.parameters.map((param)=>Visit(param)).join(', ');
45
- const returns = Visit(schema.returns);
46
- return `(new (${params}) => ${returns})`;
47
- }
48
- function Date(schema) {
49
- return 'Date';
50
- }
51
- function Function(schema) {
52
- const params = schema.parameters.map((param)=>Visit(param)).join(', ');
53
- const returns = Visit(schema.returns);
54
- return `((${params}) => ${returns})`;
55
- }
56
- function Integer(schema) {
57
- return 'number';
58
- }
59
- function Intersect(schema) {
60
- return schema.allOf.map((schema)=>Visit(schema)).join(' & ');
61
- }
62
- function Literal(schema) {
63
- if (typeof schema.const === 'string') {
64
- return `'${schema.const}'`;
65
- } else {
66
- return `${schema.const}`;
67
- }
68
- }
69
- function Never(schema) {
70
- return 'never';
71
- }
72
- function Null(schema) {
73
- return 'null';
74
- }
75
- function String(schema) {
76
- return 'string';
77
- }
78
- function Number(schema) {
79
- return 'number';
80
- }
81
- function Object(schema) {
82
- const properties = globalThis.Object.entries(schema.properties).map(([key, value])=>{
83
- return `${key}: ${Visit(value)}`;
84
- }).join(',\n');
85
- return `{\n${properties}\n}`;
86
- }
87
- function Promise(schema) {
88
- const item = Visit(schema.item);
89
- return `Promise<${item}>`;
90
- }
91
- function Record(schema) {
92
- for (const [key, value] of globalThis.Object.entries(schema.patternProperties)){
93
- const type = Visit(value);
94
- if (key === '^(0|[1-9][0-9]*)$') {
95
- return `Record<number, ${type}>`;
96
- } else {
97
- return `Record<string, ${type}>`;
98
- }
99
- }
100
- throw Error('TypeBoxToTypeScript: Unreachable');
101
- }
102
- function Ref(schema) {
103
- return schema.$ref;
104
- }
105
- function This(schema) {
106
- return schema.$ref;
107
- }
108
- function Tuple(schema) {
109
- if (schema.items === undefined) return `[]`;
110
- const items = schema.items.map((schema)=>Visit(schema)).join(', ');
111
- return `[${items}]`;
112
- }
113
- function UInt8Array(schema) {
114
- return `Uint8Array`;
115
- }
116
- function Undefined(schema) {
117
- return `undefined`;
118
- }
119
- function Union(schema) {
120
- return schema.anyOf.map((schema)=>Visit(schema)).join(' | ');
121
- }
122
- function Unknown(schema) {
123
- return `unknown`;
124
- }
125
- function Void(schema) {
126
- return `void`;
127
- }
128
- function Visit(schema) {
129
- if (reference_map.has(schema.$id)) return schema.$id;
130
- if (schema.$id !== undefined) reference_map.set(schema.$id, schema);
131
- if (Types.TypeGuard.IsAny(schema)) return Any(schema);
132
- if (Types.TypeGuard.IsArray(schema)) return Array(schema);
133
- if (Types.TypeGuard.IsBoolean(schema)) return Boolean(schema);
134
- if (Types.TypeGuard.IsBigInt(schema)) return BigInt(schema);
135
- if (Types.TypeGuard.IsConstructor(schema)) return Constructor(schema);
136
- if (Types.TypeGuard.IsDate(schema)) return Date(schema);
137
- if (Types.TypeGuard.IsFunction(schema)) return Function(schema);
138
- if (Types.TypeGuard.IsInteger(schema)) return Integer(schema);
139
- if (Types.TypeGuard.IsIntersect(schema)) return Intersect(schema);
140
- if (Types.TypeGuard.IsLiteral(schema)) return Literal(schema);
141
- if (Types.TypeGuard.IsNever(schema)) return Never(schema);
142
- if (Types.TypeGuard.IsNull(schema)) return Null(schema);
143
- if (Types.TypeGuard.IsNumber(schema)) return Number(schema);
144
- if (Types.TypeGuard.IsObject(schema)) return Object(schema);
145
- if (Types.TypeGuard.IsPromise(schema)) return Promise(schema);
146
- if (Types.TypeGuard.IsRecord(schema)) return Record(schema);
147
- if (Types.TypeGuard.IsRef(schema)) return Ref(schema);
148
- if (Types.TypeGuard.IsThis(schema)) return This(schema);
149
- if (Types.TypeGuard.IsString(schema)) return String(schema);
150
- if (Types.TypeGuard.IsTuple(schema)) return Tuple(schema);
151
- if (Types.TypeGuard.IsUint8Array(schema)) return UInt8Array(schema);
152
- if (Types.TypeGuard.IsUndefined(schema)) return Undefined(schema);
153
- if (Types.TypeGuard.IsUnion(schema)) return Union(schema);
154
- if (Types.TypeGuard.IsUnknown(schema)) return Unknown(schema);
155
- if (Types.TypeGuard.IsVoid(schema)) return Void(schema);
156
- return 'unknown';
157
- }
158
- function GenerateType(model, $id) {
159
- reference_map.clear();
160
- const type = model.types.find((type)=>type.$id === $id);
161
- if (type === undefined) return `export type ${$id} = unknown`;
162
- return `export type ${type.$id} = ${Visit(type)}`;
163
- }
164
- ModelToTypeScript.GenerateType = GenerateType;
165
- const reference_map = new Map();
166
- function Generate(model) {
167
- reference_map.clear();
168
- const definitions = [];
169
- for (const type of model.types){
170
- const definition = `export type ${type.$id} = ${Visit(type)}`;
171
- const assertion = `export const ${type.$id} = (() => { ${TypeCompiler.Code(type, model.types, {
172
- language: 'typescript'
173
- })} })();`;
174
- const rewritten = assertion.replaceAll(`return function check(value: any): boolean`, `return function check(value: any): value is ${type.$id}`);
175
- definitions.push(`
176
- ${definition}
177
- ${rewritten}
178
- `);
179
- }
180
- const output = [
181
- ...definitions
182
- ];
183
- return Formatter.Format(output.join('\n\n'));
184
- }
185
- ModelToTypeScript.Generate = Generate;
186
- })(ModelToTypeScript || (ModelToTypeScript = {}));
187
-
188
- //# sourceMappingURL=model-to-typescript.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../src/schema/typebox/gen/codegen/model/model-to-typescript.ts"],"sourcesContent":["/*--------------------------------------------------------------------------\n\n@sinclair/typebox-codegen\n\nThe MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\nimport * as Types from '@sinclair/typebox';\nimport { TypeCompiler } from '@sinclair/typebox/compiler';\nimport { Formatter } from '../common/formatter';\nimport { TypeBoxModel } from './model';\n\nexport namespace ModelToTypeScript {\n function Any(schema: Types.TAny) {\n return 'any';\n }\n function Array(schema: Types.TArray) {\n const items = Visit(schema.items);\n return `Array<${items}>`;\n }\n function Boolean(schema: Types.TBoolean) {\n return 'boolean';\n }\n function BigInt(schema: Types.TBigInt) {\n return 'bigint';\n }\n function Constructor(schema: Types.TConstructor) {\n const params = schema.parameters.map((param) => Visit(param)).join(', ');\n const returns = Visit(schema.returns);\n return `(new (${params}) => ${returns})`;\n }\n function Date(schema: Types.TDate) {\n return 'Date';\n }\n function Function(schema: Types.TFunction) {\n const params = schema.parameters.map((param) => Visit(param)).join(', ');\n const returns = Visit(schema.returns);\n return `((${params}) => ${returns})`;\n }\n function Integer(schema: Types.TInteger) {\n return 'number';\n }\n function Intersect(schema: Types.TIntersect) {\n return schema.allOf.map((schema) => Visit(schema)).join(' & ');\n }\n function Literal(schema: Types.TLiteral) {\n if (typeof schema.const === 'string') {\n return `'${schema.const}'`;\n } else {\n return `${schema.const}`;\n }\n }\n function Never(schema: Types.TNever) {\n return 'never';\n }\n function Null(schema: Types.TNull) {\n return 'null';\n }\n function String(schema: Types.TString) {\n return 'string';\n }\n function Number(schema: Types.TNumber) {\n return 'number';\n }\n function Object(schema: Types.TObject) {\n const properties: string = globalThis.Object.entries(schema.properties)\n .map(([key, value]) => {\n return `${key}: ${Visit(value)}`;\n })\n .join(',\\n');\n return `{\\n${properties}\\n}`;\n }\n function Promise(schema: Types.TPromise) {\n const item = Visit(schema.item);\n return `Promise<${item}>`;\n }\n function Record(schema: Types.TRecord) {\n for (const [key, value] of globalThis.Object.entries(schema.patternProperties)) {\n const type = Visit(value);\n if (key === '^(0|[1-9][0-9]*)$') {\n return `Record<number, ${type}>`;\n } else {\n return `Record<string, ${type}>`;\n }\n }\n throw Error('TypeBoxToTypeScript: Unreachable');\n }\n function Ref(schema: Types.TRef) {\n return schema.$ref;\n }\n function This(schema: Types.TThis) {\n return schema.$ref;\n }\n function Tuple(schema: Types.TTuple) {\n if (schema.items === undefined) return `[]`;\n const items = schema.items.map((schema) => Visit(schema)).join(', ');\n return `[${items}]`;\n }\n function UInt8Array(schema: Types.TUint8Array) {\n return `Uint8Array`;\n }\n function Undefined(schema: Types.TUndefined) {\n return `undefined`;\n }\n function Union(schema: Types.TUnion) {\n return schema.anyOf.map((schema) => Visit(schema)).join(' | ');\n }\n function Unknown(schema: Types.TUnknown) {\n return `unknown`;\n }\n function Void(schema: Types.TVoid) {\n return `void`;\n }\n function Visit(schema: Types.TSchema): string {\n if (reference_map.has(schema.$id!)) return schema.$id!;\n if (schema.$id !== undefined) reference_map.set(schema.$id, schema);\n if (Types.TypeGuard.IsAny(schema)) return Any(schema);\n if (Types.TypeGuard.IsArray(schema)) return Array(schema);\n if (Types.TypeGuard.IsBoolean(schema)) return Boolean(schema);\n if (Types.TypeGuard.IsBigInt(schema)) return BigInt(schema);\n if (Types.TypeGuard.IsConstructor(schema)) return Constructor(schema);\n if (Types.TypeGuard.IsDate(schema)) return Date(schema);\n if (Types.TypeGuard.IsFunction(schema)) return Function(schema);\n if (Types.TypeGuard.IsInteger(schema)) return Integer(schema);\n if (Types.TypeGuard.IsIntersect(schema)) return Intersect(schema);\n if (Types.TypeGuard.IsLiteral(schema)) return Literal(schema);\n if (Types.TypeGuard.IsNever(schema)) return Never(schema);\n if (Types.TypeGuard.IsNull(schema)) return Null(schema);\n if (Types.TypeGuard.IsNumber(schema)) return Number(schema);\n if (Types.TypeGuard.IsObject(schema)) return Object(schema);\n if (Types.TypeGuard.IsPromise(schema)) return Promise(schema);\n if (Types.TypeGuard.IsRecord(schema)) return Record(schema);\n if (Types.TypeGuard.IsRef(schema)) return Ref(schema);\n if (Types.TypeGuard.IsThis(schema)) return This(schema);\n if (Types.TypeGuard.IsString(schema)) return String(schema);\n if (Types.TypeGuard.IsTuple(schema)) return Tuple(schema);\n if (Types.TypeGuard.IsUint8Array(schema)) return UInt8Array(schema);\n if (Types.TypeGuard.IsUndefined(schema)) return Undefined(schema);\n if (Types.TypeGuard.IsUnion(schema)) return Union(schema);\n if (Types.TypeGuard.IsUnknown(schema)) return Unknown(schema);\n if (Types.TypeGuard.IsVoid(schema)) return Void(schema);\n return 'unknown';\n }\n export function GenerateType(model: TypeBoxModel, $id: string) {\n reference_map.clear();\n const type = model.types.find((type) => type.$id === $id);\n if (type === undefined) return `export type ${$id} = unknown`;\n return `export type ${type.$id!} = ${Visit(type)}`;\n }\n const reference_map = new Map<string, Types.TSchema>();\n export function Generate(model: TypeBoxModel): string {\n reference_map.clear();\n const definitions: string[] = [];\n for (const type of model.types) {\n const definition = `export type ${type.$id!} = ${Visit(type)}`;\n const assertion = `export const ${type.$id!} = (() => { ${TypeCompiler.Code(type, model.types, {\n language: 'typescript',\n })} })();`;\n const rewritten = assertion.replaceAll(\n `return function check(value: any): boolean`,\n `return function check(value: any): value is ${type.$id!}`,\n );\n definitions.push(`\n ${definition}\n ${rewritten}\n `);\n }\n const output = [...definitions];\n return Formatter.Format(output.join('\\n\\n'));\n }\n}\n"],"names":["Types","TypeCompiler","Formatter","ModelToTypeScript","Any","schema","Array","items","Visit","Boolean","BigInt","Constructor","params","parameters","map","param","join","returns","Date","Function","Integer","Intersect","allOf","Literal","const","Never","Null","String","Number","Object","properties","globalThis","entries","key","value","Promise","item","Record","patternProperties","type","Error","Ref","$ref","This","Tuple","undefined","UInt8Array","Undefined","Union","anyOf","Unknown","Void","reference_map","has","$id","set","TypeGuard","IsAny","IsArray","IsBoolean","IsBigInt","IsConstructor","IsDate","IsFunction","IsInteger","IsIntersect","IsLiteral","IsNever","IsNull","IsNumber","IsObject","IsPromise","IsRecord","IsRef","IsThis","IsString","IsTuple","IsUint8Array","IsUndefined","IsUnion","IsUnknown","IsVoid","GenerateType","model","clear","types","find","Map","Generate","definitions","definition","assertion","Code","language","rewritten","replaceAll","push","output","Format"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;2EAwB2E,GAC3E,YAAYA,WAAW,oBAAoB;AAC3C,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,SAAS,QAAQ,sBAAsB;;UAG/BC;IACf,SAASC,IAAIC,MAAkB;QAC7B,OAAO;IACT;IACA,SAASC,MAAMD,MAAoB;QACjC,MAAME,QAAQC,MAAMH,OAAOE,KAAK;QAChC,OAAO,CAAC,MAAM,EAAEA,MAAM,CAAC,CAAC;IAC1B;IACA,SAASE,QAAQJ,MAAsB;QACrC,OAAO;IACT;IACA,SAASK,OAAOL,MAAqB;QACnC,OAAO;IACT;IACA,SAASM,YAAYN,MAA0B;QAC7C,MAAMO,SAASP,OAAOQ,UAAU,CAACC,GAAG,CAAC,CAACC,QAAUP,MAAMO,QAAQC,IAAI,CAAC;QACnE,MAAMC,UAAUT,MAAM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