@bonsae/nrg 0.6.0 → 0.6.2

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 (84) hide show
  1. package/README.md +5 -5
  2. package/package.json +14 -75
  3. package/{build/server → server}/index.cjs +1 -1
  4. package/{src/core/client → shims}/components.d.ts +2 -0
  5. package/{src/tsconfig → tsconfig}/client.json +3 -3
  6. package/types/client.d.ts +37 -0
  7. package/types/index.d.ts +211 -0
  8. package/types/server.d.ts +2293 -0
  9. package/types/vite.d.ts +12 -0
  10. package/{build/vite → vite}/index.js +95 -0
  11. package/build/vite/utils.js +0 -56
  12. package/src/core/client/app.vue +0 -185
  13. package/src/core/client/components/node-red-config-input.vue +0 -79
  14. package/src/core/client/components/node-red-editor-input.vue +0 -307
  15. package/src/core/client/components/node-red-input-label.vue +0 -53
  16. package/src/core/client/components/node-red-input.vue +0 -93
  17. package/src/core/client/components/node-red-json-schema-form.vue +0 -444
  18. package/src/core/client/components/node-red-select-input.vue +0 -108
  19. package/src/core/client/components/node-red-toggle.vue +0 -115
  20. package/src/core/client/components/node-red-typed-input.vue +0 -158
  21. package/src/core/client/index.ts +0 -500
  22. package/src/core/client/tsconfig.json +0 -18
  23. package/src/core/constants.ts +0 -18
  24. package/src/core/errors.ts +0 -9
  25. package/src/core/server/api/index.ts +0 -1
  26. package/src/core/server/api/serve-nrg-resources.ts +0 -54
  27. package/src/core/server/index.ts +0 -190
  28. package/src/core/server/nodes/config-node.ts +0 -67
  29. package/src/core/server/nodes/factories.ts +0 -133
  30. package/src/core/server/nodes/index.ts +0 -5
  31. package/src/core/server/nodes/io-node.ts +0 -179
  32. package/src/core/server/nodes/node.ts +0 -259
  33. package/src/core/server/nodes/types/config-node.ts +0 -28
  34. package/src/core/server/nodes/types/factories.ts +0 -115
  35. package/src/core/server/nodes/types/index.ts +0 -4
  36. package/src/core/server/nodes/types/io-node.ts +0 -40
  37. package/src/core/server/nodes/types/node.ts +0 -41
  38. package/src/core/server/nodes/utils.ts +0 -106
  39. package/src/core/server/schemas/base.ts +0 -66
  40. package/src/core/server/schemas/index.ts +0 -3
  41. package/src/core/server/schemas/type.ts +0 -95
  42. package/src/core/server/schemas/types/index.ts +0 -82
  43. package/src/core/server/tsconfig.json +0 -17
  44. package/src/core/server/types/index.ts +0 -220
  45. package/src/core/server/utils.ts +0 -56
  46. package/src/core/server/validator.ts +0 -36
  47. package/src/core/validator.ts +0 -222
  48. package/src/index.ts +0 -2
  49. package/src/types.ts +0 -189
  50. package/src/utils.ts +0 -20
  51. package/src/vite/async-utils.ts +0 -61
  52. package/src/vite/client/build.ts +0 -227
  53. package/src/vite/client/index.ts +0 -1
  54. package/src/vite/client/plugins/html-generator.ts +0 -75
  55. package/src/vite/client/plugins/index.ts +0 -5
  56. package/src/vite/client/plugins/locales-generator.ts +0 -126
  57. package/src/vite/client/plugins/minifier.ts +0 -23
  58. package/src/vite/client/plugins/node-definitions-inliner.ts +0 -275
  59. package/src/vite/client/plugins/static-copy.ts +0 -43
  60. package/src/vite/defaults.ts +0 -77
  61. package/src/vite/errors.ts +0 -37
  62. package/src/vite/index.ts +0 -2
  63. package/src/vite/logger.ts +0 -94
  64. package/src/vite/node-red-launcher.ts +0 -344
  65. package/src/vite/plugin.ts +0 -61
  66. package/src/vite/plugins/build.ts +0 -85
  67. package/src/vite/plugins/index.ts +0 -2
  68. package/src/vite/plugins/server.ts +0 -267
  69. package/src/vite/server/build.ts +0 -124
  70. package/src/vite/server/index.ts +0 -1
  71. package/src/vite/server/plugins/index.ts +0 -3
  72. package/src/vite/server/plugins/output-wrapper.ts +0 -109
  73. package/src/vite/server/plugins/package-json-generator.ts +0 -203
  74. package/src/vite/server/plugins/type-generator.ts +0 -285
  75. package/src/vite/types.ts +0 -174
  76. package/src/vite/utils.ts +0 -72
  77. /package/{build/index.js → index.js} +0 -0
  78. /package/{build/server → server}/resources/nrg-client.js +0 -0
  79. /package/{build/server → server}/resources/vue.esm-browser.js +0 -0
  80. /package/{build/server → server}/resources/vue.esm-browser.prod.js +0 -0
  81. /package/{src/core/client → shims}/globals.d.ts +0 -0
  82. /package/{src/core/client → shims}/shims-vue.d.ts +0 -0
  83. /package/{src/tsconfig → tsconfig}/base.json +0 -0
  84. /package/{src/tsconfig → tsconfig}/server.json +0 -0
@@ -0,0 +1,2293 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { EventEmitter } from 'events';
4
+ import { Http2ServerRequest } from 'http2';
5
+
6
+ declare const TransformKind: unique symbol;
7
+ declare const ReadonlyKind: unique symbol;
8
+ declare const OptionalKind: unique symbol;
9
+ declare const Hint: unique symbol;
10
+ declare const Kind: unique symbol;
11
+ export interface TAny extends TSchema {
12
+ [Kind]: "Any";
13
+ static: any;
14
+ }
15
+ export interface TMappedKey<T extends PropertyKey[] = PropertyKey[]> extends TSchema {
16
+ [Kind]: "MappedKey";
17
+ static: T[number];
18
+ keys: T;
19
+ }
20
+ export interface TMappedResult<T extends TProperties = TProperties> extends TSchema {
21
+ [Kind]: "MappedResult";
22
+ properties: T;
23
+ static: unknown;
24
+ }
25
+ export interface TAsyncIterator<T extends TSchema = TSchema> extends TSchema {
26
+ [Kind]: "AsyncIterator";
27
+ static: AsyncIterableIterator<Static<T, this["params"]>>;
28
+ type: "AsyncIterator";
29
+ items: T;
30
+ }
31
+ export type TRemoveReadonly<T extends TSchema> = T extends TReadonly<infer S> ? S : T;
32
+ export type TAddReadonly<T extends TSchema> = T extends TReadonly<infer S> ? TReadonly<S> : Ensure<TReadonly<T>>;
33
+ export type TReadonlyWithFlag<T extends TSchema, F extends boolean> = F extends false ? TRemoveReadonly<T> : TAddReadonly<T>;
34
+ export type TReadonly<T extends TSchema> = T & {
35
+ [ReadonlyKind]: "Readonly";
36
+ };
37
+ export type TFromProperties<P extends TProperties, F extends boolean> = ({
38
+ [K2 in keyof P]: TReadonlyWithFlag<P[K2], F>;
39
+ });
40
+ export type TFromMappedResult<R extends TMappedResult, F extends boolean> = (TFromProperties<R["properties"], F>);
41
+ export type TReadonlyFromMappedResult<R extends TMappedResult, F extends boolean, P extends TProperties = TFromMappedResult<R, F>> = (TMappedResult<P>);
42
+ export type TReadonlyOptional<T extends TSchema> = TOptional<T> & TReadonly<T>;
43
+ export type StaticReturnType<U extends TSchema, P extends unknown[]> = Static<U, P>;
44
+ export type StaticParameter<T extends TSchema, P extends unknown[]> = T extends TReadonlyOptional<T> ? [
45
+ Readonly<Static<T, P>>?
46
+ ] : T extends TReadonly<T> ? [
47
+ Readonly<Static<T, P>>
48
+ ] : T extends TOptional<T> ? [
49
+ Static<T, P>?
50
+ ] : [
51
+ Static<T, P>
52
+ ];
53
+ export type StaticParameters<T extends TSchema[], P extends unknown[], Acc extends unknown[] = [
54
+ ]> = (T extends [
55
+ infer L extends TSchema,
56
+ ...infer R extends TSchema[]
57
+ ] ? StaticParameters<R, P, [
58
+ ...Acc,
59
+ ...StaticParameter<L, P>
60
+ ]> : Acc);
61
+ export type StaticConstructor<T extends TSchema[], U extends TSchema, P extends unknown[]> = Ensure<new (...param: StaticParameters<T, P>) => StaticReturnType<U, P>>;
62
+ export interface TConstructor<T extends TSchema[] = TSchema[], U extends TSchema = TSchema> extends TSchema {
63
+ [Kind]: "Constructor";
64
+ static: StaticConstructor<T, U, this["params"]>;
65
+ type: "Constructor";
66
+ parameters: T;
67
+ returns: U;
68
+ }
69
+ export type TLiteralValue = boolean | number | string;
70
+ export interface TLiteral<T extends TLiteralValue = TLiteralValue> extends TSchema {
71
+ [Kind]: "Literal";
72
+ static: T;
73
+ const: T;
74
+ }
75
+ export type TEnumRecord = Record<TEnumKey, TEnumValue>;
76
+ export type TEnumValue = string | number;
77
+ export type TEnumKey = string;
78
+ export interface TEnum<T extends Record<string, string | number> = Record<string, string | number>> extends TSchema {
79
+ [Kind]: "Union";
80
+ [Hint]: "Enum";
81
+ static: T[keyof T];
82
+ anyOf: TLiteral<T[keyof T]>[];
83
+ }
84
+ type StaticReturnType$1<U extends TSchema, P extends unknown[]> = Static<U, P>;
85
+ type StaticParameter$1<T extends TSchema, P extends unknown[]> = T extends TReadonlyOptional<T> ? [
86
+ Readonly<Static<T, P>>?
87
+ ] : T extends TReadonly<T> ? [
88
+ Readonly<Static<T, P>>
89
+ ] : T extends TOptional<T> ? [
90
+ Static<T, P>?
91
+ ] : [
92
+ Static<T, P>
93
+ ];
94
+ type StaticParameters$1<T extends TSchema[], P extends unknown[], Acc extends unknown[] = [
95
+ ]> = (T extends [
96
+ infer L extends TSchema,
97
+ ...infer R extends TSchema[]
98
+ ] ? StaticParameters$1<R, P, [
99
+ ...Acc,
100
+ ...StaticParameter$1<L, P>
101
+ ]> : Acc);
102
+ export type StaticFunction<T extends TSchema[], U extends TSchema, P extends unknown[]> = Ensure<(...param: StaticParameters$1<T, P>) => StaticReturnType$1<U, P>>;
103
+ export interface TFunction<T extends TSchema[] = TSchema[], U extends TSchema = TSchema> extends TSchema {
104
+ [Kind]: "Function";
105
+ static: StaticFunction<T, U, this["params"]>;
106
+ type: "Function";
107
+ parameters: T;
108
+ returns: U;
109
+ }
110
+ export interface TComputed<Target extends string = string, Parameters extends TSchema[] = [
111
+ ]> extends TSchema {
112
+ [Kind]: "Computed";
113
+ target: Target;
114
+ parameters: Parameters;
115
+ }
116
+ export interface TNever extends TSchema {
117
+ [Kind]: "Never";
118
+ static: never;
119
+ not: {};
120
+ }
121
+ export type TIntersectStatic<T extends TSchema[], P extends unknown[], Acc extends unknown = unknown> = T extends [
122
+ infer L extends TSchema,
123
+ ...infer R extends TSchema[]
124
+ ] ? TIntersectStatic<R, P, Acc & Static<L, P>> : Acc;
125
+ export type TUnevaluatedProperties = undefined | TSchema | boolean;
126
+ export interface IntersectOptions extends SchemaOptions {
127
+ unevaluatedProperties?: TUnevaluatedProperties;
128
+ }
129
+ export interface TIntersect<T extends TSchema[] = TSchema[]> extends TSchema, IntersectOptions {
130
+ [Kind]: "Intersect";
131
+ static: TIntersectStatic<T, this["params"]>;
132
+ type?: "object";
133
+ allOf: [
134
+ ...T
135
+ ];
136
+ }
137
+ export type TIsIntersectOptional<Types extends TSchema[]> = (Types extends [
138
+ infer Left extends TSchema,
139
+ ...infer Right extends TSchema[]
140
+ ] ? Left extends TOptional<TSchema> ? TIsIntersectOptional<Right> : false : true);
141
+ export type TRemoveOptionalFromType<Type extends TSchema> = (Type extends TReadonly<infer Type extends TSchema> ? TReadonly<TRemoveOptionalFromType<Type>> : Type extends TOptional<infer Type extends TSchema> ? TRemoveOptionalFromType<Type> : Type);
142
+ export type TRemoveOptionalFromRest<Types extends TSchema[], Result extends TSchema[] = [
143
+ ]> = (Types extends [
144
+ infer Left extends TSchema,
145
+ ...infer Right extends TSchema[]
146
+ ] ? Left extends TOptional<infer Type extends TSchema> ? TRemoveOptionalFromRest<Right, [
147
+ ...Result,
148
+ TRemoveOptionalFromType<Type>
149
+ ]> : TRemoveOptionalFromRest<Right, [
150
+ ...Result,
151
+ Left
152
+ ]> : Result);
153
+ export type TResolveIntersect<Types extends TSchema[]> = (TIsIntersectOptional<Types> extends true ? TOptional<TIntersect<TRemoveOptionalFromRest<Types>>> : TIntersect<TRemoveOptionalFromRest<Types>>);
154
+ export type TIntersectEvaluated<Types extends TSchema[]> = (Types extends [
155
+ TSchema
156
+ ] ? Types[0] : Types extends [
157
+ ] ? TNever : TResolveIntersect<Types>);
158
+ export type Intersect<Types extends TSchema[]> = (Types extends [
159
+ TSchema
160
+ ] ? Types[0] : Types extends [
161
+ ] ? TNever : TIntersect<Types>);
162
+ declare function Intersect<Types extends TSchema[]>(types: [
163
+ ...Types
164
+ ], options?: IntersectOptions): Intersect<Types>;
165
+ export type UnionStatic<T extends TSchema[], P extends unknown[]> = {
166
+ [K in keyof T]: T[K] extends TSchema ? Static<T[K], P> : never;
167
+ }[number];
168
+ export interface TUnion<T extends TSchema[] = TSchema[]> extends TSchema {
169
+ [Kind]: "Union";
170
+ static: UnionStatic<T, this["params"]>;
171
+ anyOf: T;
172
+ }
173
+ export type TIsUnionOptional<Types extends TSchema[]> = (Types extends [
174
+ infer Left extends TSchema,
175
+ ...infer Right extends TSchema[]
176
+ ] ? Left extends TOptional<TSchema> ? true : TIsUnionOptional<Right> : false);
177
+ type TRemoveOptionalFromRest$1<Types extends TSchema[], Result extends TSchema[] = [
178
+ ]> = (Types extends [
179
+ infer Left extends TSchema,
180
+ ...infer Right extends TSchema[]
181
+ ] ? Left extends TOptional<infer S extends TSchema> ? TRemoveOptionalFromRest$1<Right, [
182
+ ...Result,
183
+ TRemoveOptionalFromType$1<S>
184
+ ]> : TRemoveOptionalFromRest$1<Right, [
185
+ ...Result,
186
+ Left
187
+ ]> : Result);
188
+ type TRemoveOptionalFromType$1<Type extends TSchema> = (Type extends TReadonly<infer Type extends TSchema> ? TReadonly<TRemoveOptionalFromType$1<Type>> : Type extends TOptional<infer Type extends TSchema> ? TRemoveOptionalFromType$1<Type> : Type);
189
+ export type TResolveUnion<Types extends TSchema[], Result extends TSchema[] = TRemoveOptionalFromRest$1<Types>, IsOptional extends boolean = TIsUnionOptional<Types>> = (IsOptional extends true ? TOptional<TUnion<Result>> : TUnion<Result>);
190
+ export type TUnionEvaluated<Types extends TSchema[]> = (Types extends [
191
+ TSchema
192
+ ] ? Types[0] : Types extends [
193
+ ] ? TNever : TResolveUnion<Types>);
194
+ export type Union<T extends TSchema[]> = (T extends [
195
+ ] ? TNever : T extends [
196
+ TSchema
197
+ ] ? T[0] : TUnion<T>);
198
+ declare function Union<Types extends TSchema[]>(types: [
199
+ ...Types
200
+ ], options?: SchemaOptions): Union<Types>;
201
+ export interface TThis extends TSchema {
202
+ [Kind]: "This";
203
+ static: this["params"][0];
204
+ $ref: string;
205
+ }
206
+ export type RecursiveStatic<T extends TSchema> = Static<T, [
207
+ RecursiveStatic<T>
208
+ ]>;
209
+ export interface TRecursive<T extends TSchema> extends TSchema {
210
+ [Hint]: "Recursive";
211
+ static: RecursiveStatic<T>;
212
+ }
213
+ export interface UnsafeOptions extends SchemaOptions {
214
+ [Kind]?: string;
215
+ }
216
+ export interface TUnsafe<T> extends TSchema {
217
+ [Kind]: string;
218
+ static: T;
219
+ }
220
+ export interface TRef<Ref extends string = string> extends TSchema {
221
+ [Kind]: "Ref";
222
+ static: unknown;
223
+ $ref: Ref;
224
+ }
225
+ export type TRefUnsafe<Type extends TSchema> = TUnsafe<Static<Type>>;
226
+ export type TupleStatic<T extends TSchema[], P extends unknown[], Acc extends unknown[] = [
227
+ ]> = T extends [
228
+ infer L extends TSchema,
229
+ ...infer R extends TSchema[]
230
+ ] ? TupleStatic<R, P, [
231
+ ...Acc,
232
+ Static<L, P>
233
+ ]> : Acc;
234
+ export interface TTuple<T extends TSchema[] = TSchema[]> extends TSchema {
235
+ [Kind]: "Tuple";
236
+ static: TupleStatic<T, this["params"]>;
237
+ type: "array";
238
+ items: T;
239
+ additionalItems?: false;
240
+ minItems: T["length"];
241
+ maxItems: T["length"];
242
+ }
243
+ export type StringFormatOption = "date-time" | "time" | "date" | "email" | "idn-email" | "hostname" | "idn-hostname" | "ipv4" | "ipv6" | "uri" | "uri-reference" | "iri" | "uuid" | "iri-reference" | "uri-template" | "json-pointer" | "relative-json-pointer" | "regex" | ({} & string);
244
+ export type StringContentEncodingOption = "7bit" | "8bit" | "binary" | "quoted-printable" | "base64" | ({} & string);
245
+ export interface StringOptions extends SchemaOptions {
246
+ /** The maximum string length */
247
+ maxLength?: number;
248
+ /** The minimum string length */
249
+ minLength?: number;
250
+ /** A regular expression pattern this string should match */
251
+ pattern?: string;
252
+ /** A format this string should match */
253
+ format?: StringFormatOption;
254
+ /** The content encoding for this string */
255
+ contentEncoding?: StringContentEncodingOption;
256
+ /** The content media type for this string */
257
+ contentMediaType?: string;
258
+ }
259
+ export interface TString extends TSchema, StringOptions {
260
+ [Kind]: "String";
261
+ static: string;
262
+ type: "string";
263
+ }
264
+ export interface TBoolean extends TSchema {
265
+ [Kind]: "Boolean";
266
+ static: boolean;
267
+ type: "boolean";
268
+ }
269
+ export interface NumberOptions extends SchemaOptions {
270
+ exclusiveMaximum?: number;
271
+ exclusiveMinimum?: number;
272
+ maximum?: number;
273
+ minimum?: number;
274
+ multipleOf?: number;
275
+ }
276
+ export interface TNumber extends TSchema, NumberOptions {
277
+ [Kind]: "Number";
278
+ static: number;
279
+ type: "number";
280
+ }
281
+ export interface IntegerOptions extends SchemaOptions {
282
+ exclusiveMaximum?: number;
283
+ exclusiveMinimum?: number;
284
+ maximum?: number;
285
+ minimum?: number;
286
+ multipleOf?: number;
287
+ }
288
+ export interface TInteger extends TSchema, IntegerOptions {
289
+ [Kind]: "Integer";
290
+ static: number;
291
+ type: "integer";
292
+ }
293
+ export interface BigIntOptions extends SchemaOptions {
294
+ exclusiveMaximum?: bigint;
295
+ exclusiveMinimum?: bigint;
296
+ maximum?: bigint;
297
+ minimum?: bigint;
298
+ multipleOf?: bigint;
299
+ }
300
+ export interface TBigInt extends TSchema, BigIntOptions {
301
+ [Kind]: "BigInt";
302
+ static: bigint;
303
+ type: "bigint";
304
+ }
305
+ export type TFromTemplateLiteralKind<T> = T extends TTemplateLiteral<infer U extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<U> : T extends TUnion<infer U extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<U> : T extends TString ? false : T extends TNumber ? false : T extends TInteger ? false : T extends TBigInt ? false : T extends TBoolean ? true : T extends TLiteral ? true : false;
306
+ export type TFromTemplateLiteralKinds<T extends TTemplateLiteralKind[]> = T extends [
307
+ infer L extends TTemplateLiteralKind,
308
+ ...infer R extends TTemplateLiteralKind[]
309
+ ] ? TFromTemplateLiteralKind<L> extends false ? false : TFromTemplateLiteralKinds<R> : true;
310
+ export type TIsTemplateLiteralFinite<T> = T extends TTemplateLiteral<infer U> ? TFromTemplateLiteralKinds<U> : false;
311
+ export type TStringReduceUnary<L extends string, R extends string[], Acc extends string[] = [
312
+ ]> = R extends [
313
+ infer A extends string,
314
+ ...infer B extends string[]
315
+ ] ? TStringReduceUnary<L, B, [
316
+ ...Acc,
317
+ `${L}${A}`
318
+ ]> : Acc;
319
+ export type TStringReduceBinary<L extends string[], R extends string[], Acc extends string[] = [
320
+ ]> = L extends [
321
+ infer A extends string,
322
+ ...infer B extends string[]
323
+ ] ? TStringReduceBinary<B, R, [
324
+ ...Acc,
325
+ ...TStringReduceUnary<A, R>
326
+ ]> : Acc;
327
+ export type TStringReduceMany<T extends string[][]> = T extends [
328
+ infer L extends string[],
329
+ infer R extends string[],
330
+ ...infer Rest extends string[][]
331
+ ] ? TStringReduceMany<[
332
+ TStringReduceBinary<L, R>,
333
+ ...Rest
334
+ ]> : T;
335
+ export type TStringReduce<T extends string[][], O = TStringReduceMany<T>> = 0 extends keyof O ? Assert<O[0], string[]> : [
336
+ ];
337
+ export type TFromTemplateLiteralUnionKinds<T extends TTemplateLiteralKind[]> = T extends [
338
+ infer L extends TLiteral,
339
+ ...infer R extends TLiteral[]
340
+ ] ? [
341
+ `${L["const"]}`,
342
+ ...TFromTemplateLiteralUnionKinds<R>
343
+ ] : [
344
+ ];
345
+ type TFromTemplateLiteralKinds$1<T extends TTemplateLiteralKind[], Acc extends TLiteralValue[][] = [
346
+ ]> = T extends [
347
+ infer L extends TTemplateLiteralKind,
348
+ ...infer R extends TTemplateLiteralKind[]
349
+ ] ? (L extends TTemplateLiteral<infer S extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds$1<[
350
+ ...S,
351
+ ...R
352
+ ], Acc> : L extends TLiteral<infer S extends TLiteralValue> ? TFromTemplateLiteralKinds$1<R, [
353
+ ...Acc,
354
+ [
355
+ S
356
+ ]
357
+ ]> : L extends TUnion<infer S extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds$1<R, [
358
+ ...Acc,
359
+ TFromTemplateLiteralUnionKinds<S>
360
+ ]> : L extends TBoolean ? TFromTemplateLiteralKinds$1<R, [
361
+ ...Acc,
362
+ [
363
+ "true",
364
+ "false"
365
+ ]
366
+ ]> : Acc) : Acc;
367
+ export type TTemplateLiteralGenerate<T extends TTemplateLiteral, F = TIsTemplateLiteralFinite<T>> = F extends true ? (T extends TTemplateLiteral<infer S extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds$1<S> extends infer R extends string[][] ? TStringReduce<R> : [
368
+ ] : [
369
+ ]) : [
370
+ ];
371
+ declare function FromUnion(syntax: string): IterableIterator<TTemplateLiteralKind>;
372
+ declare function FromTerminal(syntax: string): IterableIterator<TTemplateLiteralKind>;
373
+ export type FromUnionLiteral<T extends string> = T extends `${infer L}|${infer R}` ? [
374
+ TLiteral<Trim<L>>,
375
+ ...FromUnionLiteral<R>
376
+ ] : T extends `${infer L}` ? [
377
+ TLiteral<Trim<L>>
378
+ ] : [
379
+ ];
380
+ export type FromUnion<T extends string> = TUnionEvaluated<FromUnionLiteral<T>>;
381
+ export type FromTerminal<T extends string> = T extends "boolean" ? TBoolean : T extends "bigint" ? TBigInt : T extends "number" ? TNumber : T extends "string" ? TString : FromUnion<T>;
382
+ export type FromString<T extends string> = T extends `{${infer L}}${infer R}` ? [
383
+ FromTerminal<L>,
384
+ ...FromString<R>
385
+ ] : T extends `${infer L}$\{${infer R1}\}${infer R2}` ? [
386
+ TLiteral<L>,
387
+ ...FromString<`{${R1}}`>,
388
+ ...FromString<R2>
389
+ ] : T extends `${infer L}$\{${infer R1}\}` ? [
390
+ TLiteral<L>,
391
+ ...FromString<`{${R1}}`>
392
+ ] : T extends `${infer L}` ? [
393
+ TLiteral<L>
394
+ ] : [
395
+ ];
396
+ export type TTemplateLiteralSyntax<T extends string> = (TTemplateLiteral<Assert<FromString<T>, TTemplateLiteralKind[]>>);
397
+ export type TemplateLiteralStaticKind<T, Acc extends string> = T extends TUnion<infer U> ? {
398
+ [K in keyof U]: TemplateLiteralStatic<Assert<[
399
+ U[K]
400
+ ], TTemplateLiteralKind[]>, Acc>;
401
+ }[number] : T extends TTemplateLiteral ? `${Static<T>}` : T extends TLiteral<infer U> ? `${U}` : T extends TString ? `${string}` : T extends TNumber ? `${number}` : T extends TBigInt ? `${bigint}` : T extends TBoolean ? `${boolean}` : never;
402
+ export type TemplateLiteralStatic<T extends TTemplateLiteralKind[], Acc extends string> = T extends [
403
+ infer L,
404
+ ...infer R
405
+ ] ? `${TemplateLiteralStaticKind<L, Acc>}${TemplateLiteralStatic<Assert<R, TTemplateLiteralKind[]>, Acc>}` : Acc;
406
+ export type TTemplateLiteralKind = TTemplateLiteral | TUnion | TLiteral | TInteger | TNumber | TBigInt | TString | TBoolean | TNever;
407
+ export interface TTemplateLiteral<T extends TTemplateLiteralKind[] = TTemplateLiteralKind[]> extends TSchema {
408
+ [Kind]: "TemplateLiteral";
409
+ static: TemplateLiteralStatic<T, EmptyString>;
410
+ type: "string";
411
+ pattern: string;
412
+ }
413
+ export type TTemplateLiteralToUnionLiteralArray<T extends string[], Acc extends TLiteral[] = [
414
+ ]> = (T extends [
415
+ infer L extends string,
416
+ ...infer R extends string[]
417
+ ] ? TTemplateLiteralToUnionLiteralArray<R, [
418
+ ...Acc,
419
+ TLiteral<L>
420
+ ]> : Acc);
421
+ export type TTemplateLiteralToUnion<T extends TTemplateLiteral, U extends string[] = UnionToTuple<Static<T>>> = TUnionEvaluated<TTemplateLiteralToUnionLiteralArray<U>>;
422
+ export type TFromTemplateLiteral<TemplateLiteral extends TTemplateLiteral, Keys extends string[] = TTemplateLiteralGenerate<TemplateLiteral>> = (Keys);
423
+ export type TFromUnion<Types extends TSchema[], Result extends string[] = [
424
+ ]> = (Types extends [
425
+ infer Left extends TSchema,
426
+ ...infer Right extends TSchema[]
427
+ ] ? TFromUnion<Right, [
428
+ ...Result,
429
+ ...TIndexPropertyKeys<Left>
430
+ ]> : Result);
431
+ export type TFromLiteral<LiteralValue extends TLiteralValue> = (LiteralValue extends PropertyKey ? [
432
+ `${LiteralValue}`
433
+ ] : [
434
+ ]);
435
+ export type TIndexPropertyKeys<Type extends TSchema> = (Type extends TTemplateLiteral ? TFromTemplateLiteral<Type> : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion<Types> : Type extends TLiteral<infer Value extends TLiteralValue> ? TFromLiteral<Value> : Type extends TNumber ? [
436
+ "[number]"
437
+ ] : Type extends TInteger ? [
438
+ "[number]"
439
+ ] : [
440
+ ]);
441
+ type TFromProperties$1<Type extends TSchema, Properties extends TProperties> = ({
442
+ [K2 in keyof Properties]: TIndex<Type, TIndexPropertyKeys<Properties[K2]>>;
443
+ });
444
+ type TFromMappedResult$1<Type extends TSchema, MappedResult extends TMappedResult> = (TFromProperties$1<Type, MappedResult["properties"]>);
445
+ export type TIndexFromMappedResult<Type extends TSchema, MappedResult extends TMappedResult, Properties extends TProperties = TFromMappedResult$1<Type, MappedResult>> = (TMappedResult<Properties>);
446
+ export type TFromRest<Types extends TSchema[], Key extends PropertyKey, Result extends TSchema[] = [
447
+ ]> = (Types extends [
448
+ infer Left extends TSchema,
449
+ ...infer Right extends TSchema[]
450
+ ] ? TFromRest<Right, Key, [
451
+ ...Result,
452
+ Assert<TIndexFromPropertyKey<Left, Key>, TSchema>
453
+ ]> : Result);
454
+ export type TFromIntersectRest<Types extends TSchema[], Result extends TSchema[] = [
455
+ ]> = (Types extends [
456
+ infer Left extends TSchema,
457
+ ...infer Right extends TSchema[]
458
+ ] ? Left extends TNever ? TFromIntersectRest<Right, [
459
+ ...Result
460
+ ]> : TFromIntersectRest<Right, [
461
+ ...Result,
462
+ Left
463
+ ]> : Result);
464
+ export type TFromIntersect<Types extends TSchema[], Key extends PropertyKey> = (TIntersectEvaluated<TFromIntersectRest<TFromRest<Types, Key>>>);
465
+ export type TFromUnionRest<Types extends TSchema[], Result extends TSchema[] = [
466
+ ]> = Types extends [
467
+ infer Left extends TSchema,
468
+ ...infer Right extends TSchema[]
469
+ ] ? Left extends TNever ? [
470
+ ] : TFromUnionRest<Right, [
471
+ Left,
472
+ ...Result
473
+ ]> : Result;
474
+ type TFromUnion$1<Types extends TSchema[], Key extends PropertyKey> = (TUnionEvaluated<TFromUnionRest<TFromRest<Types, Key>>>);
475
+ export type TFromTuple<Types extends TSchema[], Key extends PropertyKey> = (Key extends keyof Types ? Types[Key] : Key extends "[number]" ? TUnionEvaluated<Types> : TNever);
476
+ export type TFromArray<Type extends TSchema, Key extends PropertyKey> = (Key extends "[number]" ? Type : TNever);
477
+ export type AssertPropertyKey<T> = Assert<T, string | number>;
478
+ export type TFromProperty<Properties extends TProperties, Key extends PropertyKey> = (Key extends keyof Properties ? Properties[Key] : `${AssertPropertyKey<Key>}` extends `${AssertPropertyKey<keyof Properties>}` ? Properties[AssertPropertyKey<Key>] : TNever);
479
+ export type TIndexFromPropertyKey<Type extends TSchema, Key extends PropertyKey> = (Type extends TRecursive<infer Type extends TSchema> ? TIndexFromPropertyKey<Type, Key> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect<Types, Key> : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion$1<Types, Key> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple<Types, Key> : Type extends TArray<infer Type extends TSchema> ? TFromArray<Type, Key> : Type extends TObject<infer Properties extends TProperties> ? TFromProperty<Properties, Key> : TNever);
480
+ export type TIndexFromPropertyKeys<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TSchema[] = [
481
+ ]> = (PropertyKeys extends [
482
+ infer Left extends PropertyKey,
483
+ ...infer Right extends PropertyKey[]
484
+ ] ? TIndexFromPropertyKeys<Type, Right, [
485
+ ...Result,
486
+ Assert<TIndexFromPropertyKey<Type, Left>, TSchema>
487
+ ]> : Result);
488
+ export type FromSchema<Type extends TSchema, PropertyKeys extends PropertyKey[]> = (TUnionEvaluated<TIndexFromPropertyKeys<Type, PropertyKeys>>);
489
+ declare function FromSchema<Type extends TSchema, PropertyKeys extends PropertyKey[]>(type: Type, propertyKeys: [
490
+ ...PropertyKeys
491
+ ]): FromSchema<Type, PropertyKeys>;
492
+ export type TIndexFromComputed<Type extends TSchema, Key extends TSchema> = (TComputed<"Index", [
493
+ Type,
494
+ Key
495
+ ]>);
496
+ export type TIndex<Type extends TSchema, PropertyKeys extends PropertyKey[]> = (FromSchema<Type, PropertyKeys>);
497
+ export type TMappedIndexPropertyKey<Type extends TSchema, Key extends PropertyKey> = {
498
+ [_ in Key]: TIndex<Type, [
499
+ Key
500
+ ]>;
501
+ };
502
+ export type TMappedIndexPropertyKeys<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TProperties = {}> = (PropertyKeys extends [
503
+ infer Left extends PropertyKey,
504
+ ...infer Right extends PropertyKey[]
505
+ ] ? TMappedIndexPropertyKeys<Type, Right, Result & TMappedIndexPropertyKey<Type, Left>> : Result);
506
+ export type TMappedIndexProperties<Type extends TSchema, MappedKey extends TMappedKey> = Evaluate<TMappedIndexPropertyKeys<Type, MappedKey["keys"]>>;
507
+ export type TIndexFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TMappedIndexProperties<Type, MappedKey>> = (Ensure<TMappedResult<Properties>>);
508
+ export interface TIterator<T extends TSchema = TSchema> extends TSchema {
509
+ [Kind]: "Iterator";
510
+ static: IterableIterator<Static<T, this["params"]>>;
511
+ type: "Iterator";
512
+ items: T;
513
+ }
514
+ export interface TPromise<T extends TSchema = TSchema> extends TSchema {
515
+ [Kind]: "Promise";
516
+ static: Promise<Static<T, this["params"]>>;
517
+ type: "Promise";
518
+ item: TSchema;
519
+ }
520
+ export type TSetIncludes<T extends PropertyKey[], S extends PropertyKey> = (T extends [
521
+ infer L extends PropertyKey,
522
+ ...infer R extends PropertyKey[]
523
+ ] ? S extends L ? true : TSetIncludes<R, S> : false);
524
+ export type TSetDistinct<T extends PropertyKey[], Acc extends PropertyKey[] = [
525
+ ]> = T extends [
526
+ infer L extends PropertyKey,
527
+ ...infer R extends PropertyKey[]
528
+ ] ? TSetIncludes<Acc, L> extends false ? TSetDistinct<R, [
529
+ ...Acc,
530
+ L
531
+ ]> : TSetDistinct<R, [
532
+ ...Acc
533
+ ]> : Acc;
534
+ export type TSetIntersect<T extends PropertyKey[], S extends PropertyKey[], Acc extends PropertyKey[] = [
535
+ ]> = (T extends [
536
+ infer L extends PropertyKey,
537
+ ...infer R extends PropertyKey[]
538
+ ] ? TSetIncludes<S, L> extends true ? TSetIntersect<R, S, [
539
+ ...Acc,
540
+ L
541
+ ]> : TSetIntersect<R, S, [
542
+ ...Acc
543
+ ]> : Acc);
544
+ export type TSetUnion<T extends PropertyKey[], S extends PropertyKey[]> = ([
545
+ ...T,
546
+ ...S
547
+ ]);
548
+ export type TSetIntersectManyResolve<T extends PropertyKey[][], Acc extends PropertyKey[]> = (T extends [
549
+ infer L extends PropertyKey[],
550
+ ...infer R extends PropertyKey[][]
551
+ ] ? TSetIntersectManyResolve<R, TSetIntersect<Acc, L>> : Acc);
552
+ export type TSetIntersectMany<T extends PropertyKey[][]> = (T extends [
553
+ infer L extends PropertyKey[]
554
+ ] ? L : T extends [
555
+ infer L extends PropertyKey[],
556
+ ...infer R extends PropertyKey[][]
557
+ ] ? TSetIntersectManyResolve<R, L> : [
558
+ ]);
559
+ export type TSetUnionMany<T extends PropertyKey[][], Acc extends PropertyKey[] = [
560
+ ]> = (T extends [
561
+ infer L extends PropertyKey[],
562
+ ...infer R extends PropertyKey[][]
563
+ ] ? TSetUnionMany<R, TSetUnion<Acc, L>> : Acc);
564
+ type TFromMappedResult$2<K extends PropertyKey, P extends TProperties> = (K extends keyof P ? FromSchemaType<K, P[K]> : TMappedResult<P>);
565
+ export type TMappedKeyToKnownMappedResultProperties<K extends PropertyKey> = {
566
+ [_ in K]: TLiteral<Assert<K, TLiteralValue>>;
567
+ };
568
+ export type TMappedKeyToUnknownMappedResultProperties<P extends PropertyKey[], Acc extends TProperties = {}> = (P extends [
569
+ infer L extends PropertyKey,
570
+ ...infer R extends PropertyKey[]
571
+ ] ? TMappedKeyToUnknownMappedResultProperties<R, Acc & {
572
+ [_ in L]: TLiteral<Assert<L, TLiteralValue>>;
573
+ }> : Acc);
574
+ export type TMappedKeyToMappedResultProperties<K extends PropertyKey, P extends PropertyKey[]> = (TSetIncludes<P, K> extends true ? TMappedKeyToKnownMappedResultProperties<K> : TMappedKeyToUnknownMappedResultProperties<P>);
575
+ export type TFromMappedKey<K extends PropertyKey, P extends PropertyKey[], R extends TProperties = TMappedKeyToMappedResultProperties<K, P>> = (TFromMappedResult$2<K, R>);
576
+ type TFromRest$1<K extends PropertyKey, T extends TSchema[], Acc extends TSchema[] = [
577
+ ]> = (T extends [
578
+ infer L extends TSchema,
579
+ ...infer R extends TSchema[]
580
+ ] ? TFromRest$1<K, R, [
581
+ ...Acc,
582
+ FromSchemaType<K, L>
583
+ ]> : Acc);
584
+ export type FromProperties<K extends PropertyKey, T extends TProperties, R extends TProperties = Evaluate<{
585
+ [K2 in keyof T]: FromSchemaType<K, T[K2]>;
586
+ }>> = R;
587
+ declare function FromProperties<K extends PropertyKey, T extends TProperties>(K: K, T: T): FromProperties<K, T>;
588
+ export type FromSchemaType<K extends PropertyKey, T extends TSchema> = (T extends TReadonly<infer S extends TSchema> ? TReadonly<FromSchemaType<K, S>> : T extends TOptional<infer S extends TSchema> ? TOptional<FromSchemaType<K, S>> : T extends TMappedResult<infer P extends TProperties> ? TFromMappedResult$2<K, P> : T extends TMappedKey<infer P extends PropertyKey[]> ? TFromMappedKey<K, P> : T extends TConstructor<infer S extends TSchema[], infer R extends TSchema> ? TConstructor<TFromRest$1<K, S>, FromSchemaType<K, R>> : T extends TFunction<infer S extends TSchema[], infer R extends TSchema> ? TFunction<TFromRest$1<K, S>, FromSchemaType<K, R>> : T extends TAsyncIterator<infer S extends TSchema> ? TAsyncIterator<FromSchemaType<K, S>> : T extends TIterator<infer S extends TSchema> ? TIterator<FromSchemaType<K, S>> : T extends TIntersect<infer S extends TSchema[]> ? TIntersect<TFromRest$1<K, S>> : T extends TEnum<infer S extends TEnumRecord> ? TEnum<S> : T extends TUnion<infer S extends TSchema[]> ? TUnion<TFromRest$1<K, S>> : T extends TTuple<infer S extends TSchema[]> ? TTuple<TFromRest$1<K, S>> : T extends TObject<infer S extends TProperties> ? TObject<FromProperties<K, S>> : T extends TArray<infer S extends TSchema> ? TArray<FromSchemaType<K, S>> : T extends TPromise<infer S extends TSchema> ? TPromise<FromSchemaType<K, S>> : T);
589
+ declare function FromSchemaType<K extends PropertyKey, T extends TSchema>(K: K, T: T): FromSchemaType<K, T>;
590
+ export type TMappedFunctionReturnType<K extends PropertyKey[], T extends TSchema, Acc extends TProperties = {}> = (K extends [
591
+ infer L extends PropertyKey,
592
+ ...infer R extends PropertyKey[]
593
+ ] ? TMappedFunctionReturnType<R, T, Acc & {
594
+ [_ in L]: FromSchemaType<L, T>;
595
+ }> : Acc);
596
+ export type TMappedFunction<K extends PropertyKey[], I = TMappedKey<K>> = (T: I) => TSchema;
597
+ export type TMapped<K extends PropertyKey[], F extends TMappedFunction<K>, R extends TProperties = Evaluate<TMappedFunctionReturnType<K, ReturnType<F>>>> = Ensure<TObject<R>>;
598
+ export type TRemoveOptional<T extends TSchema> = T extends TOptional<infer S> ? S : T;
599
+ export type TAddOptional<T extends TSchema> = T extends TOptional<infer S> ? TOptional<S> : Ensure<TOptional<T>>;
600
+ export type TOptionalWithFlag<T extends TSchema, F extends boolean> = F extends false ? TRemoveOptional<T> : TAddOptional<T>;
601
+ export type TOptional<T extends TSchema> = T & {
602
+ [OptionalKind]: "Optional";
603
+ };
604
+ type TFromProperties$2<P extends TProperties, F extends boolean> = ({
605
+ [K2 in keyof P]: TOptionalWithFlag<P[K2], F>;
606
+ });
607
+ type TFromMappedResult$3<R extends TMappedResult, F extends boolean> = (TFromProperties$2<R["properties"], F>);
608
+ export type TOptionalFromMappedResult<R extends TMappedResult, F extends boolean, P extends TProperties = TFromMappedResult$3<R, F>> = (TMappedResult<P>);
609
+ export type TFromComputed<Target extends string, Parameters extends TSchema[]> = Ensure<(TComputed<"Awaited", [
610
+ TComputed<Target, Parameters>
611
+ ]>)>;
612
+ export type TFromRef<Ref extends string> = Ensure<TComputed<"Awaited", [
613
+ TRef<Ref>
614
+ ]>>;
615
+ type TFromRest$2<Types extends TSchema[], Result extends TSchema[] = [
616
+ ]> = (Types extends [
617
+ infer Left extends TSchema,
618
+ ...infer Right extends TSchema[]
619
+ ] ? TFromRest$2<Right, [
620
+ ...Result,
621
+ TAwaited<Left>
622
+ ]> : Result);
623
+ export type TAwaited<Type extends TSchema> = (Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest$2<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest$2<Types>> : Type extends TPromise<infer Type extends TSchema> ? TAwaited<Type> : Type);
624
+ type TFromRest$3<Types extends TSchema[], Result extends PropertyKey[][] = [
625
+ ]> = (Types extends [
626
+ infer L extends TSchema,
627
+ ...infer R extends TSchema[]
628
+ ] ? TFromRest$3<R, [
629
+ ...Result,
630
+ TKeyOfPropertyKeys<L>
631
+ ]> : Result);
632
+ type TFromIntersect$1<Types extends TSchema[], PropertyKeysArray extends PropertyKey[][] = TFromRest$3<Types>, PropertyKeys extends PropertyKey[] = TSetUnionMany<PropertyKeysArray>> = PropertyKeys;
633
+ type TFromUnion$2<Types extends TSchema[], PropertyKeysArray extends PropertyKey[][] = TFromRest$3<Types>, PropertyKeys extends PropertyKey[] = TSetIntersectMany<PropertyKeysArray>> = PropertyKeys;
634
+ type TFromTuple$1<Types extends TSchema[], Indexer extends string = ZeroString, Acc extends PropertyKey[] = [
635
+ ]> = Types extends [
636
+ infer _ extends TSchema,
637
+ ...infer R extends TSchema[]
638
+ ] ? TFromTuple$1<R, TIncrement<Indexer>, [
639
+ ...Acc,
640
+ Indexer
641
+ ]> : Acc;
642
+ type TFromArray$1<_ extends TSchema> = ([
643
+ "[number]"
644
+ ]);
645
+ type TFromProperties$3<Properties extends TProperties> = (UnionToTuple<keyof Properties>);
646
+ export type TKeyOfPropertyKeys<Type extends TSchema> = (Type extends TRecursive<infer Type extends TSchema> ? TKeyOfPropertyKeys<Type> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect$1<Types> : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion$2<Types> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple$1<Types> : Type extends TArray<infer Type extends TSchema> ? TFromArray$1<Type> : Type extends TObject<infer Properties extends TProperties> ? TFromProperties$3<Properties> : [
647
+ ]);
648
+ type TFromComputed$1<Target extends string, Parameters extends TSchema[]> = Ensure<TComputed<"KeyOf", [
649
+ TComputed<Target, Parameters>
650
+ ]>>;
651
+ type TFromRef$1<Ref extends string> = Ensure<TComputed<"KeyOf", [
652
+ TRef<Ref>
653
+ ]>>;
654
+ /** `[Internal]` Used by KeyOfFromMappedResult */
655
+ export type TKeyOfFromType<Type extends TSchema, PropertyKeys extends PropertyKey[] = TKeyOfPropertyKeys<Type>, PropertyKeyTypes extends TSchema[] = TKeyOfPropertyKeysToRest<PropertyKeys>, Result = TUnionEvaluated<PropertyKeyTypes>> = Ensure<Result>;
656
+ export type TKeyOfPropertyKeysToRest<PropertyKeys extends PropertyKey[], Result extends TSchema[] = [
657
+ ]> = (PropertyKeys extends [
658
+ infer L extends PropertyKey,
659
+ ...infer R extends PropertyKey[]
660
+ ] ? L extends "[number]" ? TKeyOfPropertyKeysToRest<R, [
661
+ ...Result,
662
+ TNumber
663
+ ]> : TKeyOfPropertyKeysToRest<R, [
664
+ ...Result,
665
+ TLiteral<Assert<L, TLiteralValue>>
666
+ ]> : Result);
667
+ export type TKeyOf<Type extends TSchema> = (Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed$1<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef$1<Ref> : Type extends TMappedResult ? TKeyOfFromMappedResult<Type> : TKeyOfFromType<Type>);
668
+ type TFromProperties$4<Properties extends TProperties> = ({
669
+ [K2 in keyof Properties]: TKeyOfFromType<Properties[K2]>;
670
+ });
671
+ type TFromMappedResult$4<MappedResult extends TMappedResult> = (Evaluate<TFromProperties$4<MappedResult["properties"]>>);
672
+ export type TKeyOfFromMappedResult<MappedResult extends TMappedResult, Properties extends TProperties = TFromMappedResult$4<MappedResult>> = (Ensure<TMappedResult<Properties>>);
673
+ type TFromProperties$5<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = ({
674
+ [K2 in keyof Properties]: TOmit<Properties[K2], PropertyKeys>;
675
+ });
676
+ type TFromMappedResult$5<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[]> = (Evaluate<TFromProperties$5<MappedResult["properties"], PropertyKeys>>);
677
+ export type TOmitFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[], Properties extends TProperties = TFromMappedResult$5<MappedResult, PropertyKeys>> = (Ensure<TMappedResult<Properties>>);
678
+ type TFromIntersect$2<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = [
679
+ ]> = (Types extends [
680
+ infer L extends TSchema,
681
+ ...infer R extends TSchema[]
682
+ ] ? TFromIntersect$2<R, PropertyKeys, [
683
+ ...Result,
684
+ TOmit<L, PropertyKeys>
685
+ ]> : Result);
686
+ type TFromUnion$3<T extends TSchema[], K extends PropertyKey[], Result extends TSchema[] = [
687
+ ]> = (T extends [
688
+ infer L extends TSchema,
689
+ ...infer R extends TSchema[]
690
+ ] ? TFromUnion$3<R, K, [
691
+ ...Result,
692
+ TOmit<L, K>
693
+ ]> : Result);
694
+ type TFromProperties$6<Properties extends TProperties, PropertyKeys extends PropertyKey[], UnionKey extends PropertyKey = TupleToUnion<PropertyKeys>> = (Evaluate<Omit<Properties, UnionKey>>);
695
+ export type TFromObject<_Type extends TObject, PropertyKeys extends PropertyKey[], Properties extends TProperties, MappedProperties extends TProperties = TFromProperties$6<Properties, PropertyKeys>, Result extends TSchema = TObject<MappedProperties>> = Result;
696
+ export type TUnionFromPropertyKeys<PropertyKeys extends PropertyKey[], Result extends TLiteral[] = [
697
+ ]> = (PropertyKeys extends [
698
+ infer Key extends PropertyKey,
699
+ ...infer Rest extends PropertyKey[]
700
+ ] ? Key extends TLiteralValue ? TUnionFromPropertyKeys<Rest, [
701
+ ...Result,
702
+ TLiteral<Key>
703
+ ]> : TUnionFromPropertyKeys<Rest, [
704
+ ...Result
705
+ ]> : TUnion<Result>);
706
+ export type TOmitResolve<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = (Properties extends TRecursive<infer Types extends TSchema> ? TRecursive<TOmitResolve<Types, PropertyKeys>> : Properties extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromIntersect$2<Types, PropertyKeys>> : Properties extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromUnion$3<Types, PropertyKeys>> : Properties extends TObject<infer Properties extends TProperties> ? TFromObject<TObject, PropertyKeys, Properties> : TObject<{}>);
707
+ export type TResolvePropertyKeys<Key extends TSchema | PropertyKey[]> = Key extends TSchema ? TIndexPropertyKeys<Key> : Key;
708
+ export type TResolveTypeKey<Key extends TSchema | PropertyKey[]> = Key extends PropertyKey[] ? TUnionFromPropertyKeys<Key> : Key;
709
+ export type TOmit<Type extends TSchema, Key extends TSchema | PropertyKey[], IsTypeRef extends boolean = Type extends TRef ? true : false, IsKeyRef extends boolean = Key extends TRef ? true : false> = (Type extends TMappedResult ? TOmitFromMappedResult<Type, TResolvePropertyKeys<Key>> : Key extends TMappedKey ? TOmitFromMappedKey<Type, Key> : [
710
+ IsTypeRef,
711
+ IsKeyRef
712
+ ] extends [
713
+ true,
714
+ true
715
+ ] ? TComputed<"Omit", [
716
+ Type,
717
+ TResolveTypeKey<Key>
718
+ ]> : [
719
+ IsTypeRef,
720
+ IsKeyRef
721
+ ] extends [
722
+ false,
723
+ true
724
+ ] ? TComputed<"Omit", [
725
+ Type,
726
+ TResolveTypeKey<Key>
727
+ ]> : [
728
+ IsTypeRef,
729
+ IsKeyRef
730
+ ] extends [
731
+ true,
732
+ false
733
+ ] ? TComputed<"Omit", [
734
+ Type,
735
+ TResolveTypeKey<Key>
736
+ ]> : TOmitResolve<Type, TResolvePropertyKeys<Key>>);
737
+ export type TFromPropertyKey<Type extends TSchema, Key extends PropertyKey> = {
738
+ [_ in Key]: TOmit<Type, [
739
+ Key
740
+ ]>;
741
+ };
742
+ export type TFromPropertyKeys<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TProperties = {}> = (PropertyKeys extends [
743
+ infer LK extends PropertyKey,
744
+ ...infer RK extends PropertyKey[]
745
+ ] ? TFromPropertyKeys<Type, RK, Result & TFromPropertyKey<Type, LK>> : Result);
746
+ type TFromMappedKey$1<Type extends TSchema, MappedKey extends TMappedKey> = (TFromPropertyKeys<Type, MappedKey["keys"]>);
747
+ export type TOmitFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TFromMappedKey$1<Type, MappedKey>> = (TMappedResult<Properties>);
748
+ type TFromProperties$7<Properties extends TProperties, PropertyKeys extends PropertyKey[]> = ({
749
+ [K2 in keyof Properties]: TPick<Properties[K2], PropertyKeys>;
750
+ });
751
+ type TFromMappedResult$6<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[]> = (Evaluate<TFromProperties$7<MappedResult["properties"], PropertyKeys>>);
752
+ export type TPickFromMappedResult<MappedResult extends TMappedResult, PropertyKeys extends PropertyKey[], Properties extends TProperties = TFromMappedResult$6<MappedResult, PropertyKeys>> = (Ensure<TMappedResult<Properties>>);
753
+ type TFromIntersect$3<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = [
754
+ ]> = Types extends [
755
+ infer L extends TSchema,
756
+ ...infer R extends TSchema[]
757
+ ] ? TFromIntersect$3<R, PropertyKeys, [
758
+ ...Result,
759
+ TPick<L, PropertyKeys>
760
+ ]> : Result;
761
+ type TFromUnion$4<Types extends TSchema[], PropertyKeys extends PropertyKey[], Result extends TSchema[] = [
762
+ ]> = Types extends [
763
+ infer L extends TSchema,
764
+ ...infer R extends TSchema[]
765
+ ] ? TFromUnion$4<R, PropertyKeys, [
766
+ ...Result,
767
+ TPick<L, PropertyKeys>
768
+ ]> : Result;
769
+ type TFromProperties$8<Properties extends TProperties, PropertyKeys extends PropertyKey[], UnionKeys extends PropertyKey = TupleToUnion<PropertyKeys>> = (Evaluate<Pick<Properties, UnionKeys & keyof Properties>>);
770
+ type TFromObject$1<_Type extends TObject, Keys extends PropertyKey[], Properties extends TProperties, MappedProperties extends TProperties = TFromProperties$8<Properties, Keys>, Result extends TSchema = TObject<MappedProperties>> = Result;
771
+ type TUnionFromPropertyKeys$1<PropertyKeys extends PropertyKey[], Result extends TLiteral[] = [
772
+ ]> = (PropertyKeys extends [
773
+ infer Key extends PropertyKey,
774
+ ...infer Rest extends PropertyKey[]
775
+ ] ? Key extends TLiteralValue ? TUnionFromPropertyKeys$1<Rest, [
776
+ ...Result,
777
+ TLiteral<Key>
778
+ ]> : TUnionFromPropertyKeys$1<Rest, [
779
+ ...Result
780
+ ]> : TUnion<Result>);
781
+ export type TPickResolve<Type extends TProperties, PropertyKeys extends PropertyKey[]> = (Type extends TRecursive<infer Types extends TSchema> ? TRecursive<TPickResolve<Types, PropertyKeys>> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromIntersect$3<Types, PropertyKeys>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromUnion$4<Types, PropertyKeys>> : Type extends TObject<infer Properties extends TProperties> ? TFromObject$1<TObject, PropertyKeys, Properties> : TObject<{}>);
782
+ type TResolvePropertyKeys$1<Key extends TSchema | PropertyKey[]> = Key extends TSchema ? TIndexPropertyKeys<Key> : Key;
783
+ type TResolveTypeKey$1<Key extends TSchema | PropertyKey[]> = Key extends PropertyKey[] ? TUnionFromPropertyKeys$1<Key> : Key;
784
+ export type TPick<Type extends TSchema, Key extends TSchema | PropertyKey[], IsTypeRef extends boolean = Type extends TRef ? true : false, IsKeyRef extends boolean = Key extends TRef ? true : false> = (Type extends TMappedResult ? TPickFromMappedResult<Type, TResolvePropertyKeys$1<Key>> : Key extends TMappedKey ? TPickFromMappedKey<Type, Key> : [
785
+ IsTypeRef,
786
+ IsKeyRef
787
+ ] extends [
788
+ true,
789
+ true
790
+ ] ? TComputed<"Pick", [
791
+ Type,
792
+ TResolveTypeKey$1<Key>
793
+ ]> : [
794
+ IsTypeRef,
795
+ IsKeyRef
796
+ ] extends [
797
+ false,
798
+ true
799
+ ] ? TComputed<"Pick", [
800
+ Type,
801
+ TResolveTypeKey$1<Key>
802
+ ]> : [
803
+ IsTypeRef,
804
+ IsKeyRef
805
+ ] extends [
806
+ true,
807
+ false
808
+ ] ? TComputed<"Pick", [
809
+ Type,
810
+ TResolveTypeKey$1<Key>
811
+ ]> : TPickResolve<Type, TResolvePropertyKeys$1<Key>>);
812
+ type TFromPropertyKey$1<Type extends TSchema, Key extends PropertyKey> = {
813
+ [_ in Key]: TPick<Type, [
814
+ Key
815
+ ]>;
816
+ };
817
+ type TFromPropertyKeys$1<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TProperties = {}> = (PropertyKeys extends [
818
+ infer LeftKey extends PropertyKey,
819
+ ...infer RightKeys extends PropertyKey[]
820
+ ] ? TFromPropertyKeys$1<Type, RightKeys, Result & TFromPropertyKey$1<Type, LeftKey>> : Result);
821
+ type TFromMappedKey$2<Type extends TSchema, MappedKey extends TMappedKey> = (TFromPropertyKeys$1<Type, MappedKey["keys"]>);
822
+ export type TPickFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TFromMappedKey$2<Type, MappedKey>> = (TMappedResult<Properties>);
823
+ export interface TNull extends TSchema {
824
+ [Kind]: "Null";
825
+ static: null;
826
+ type: "null";
827
+ }
828
+ export interface TSymbol extends TSchema, SchemaOptions {
829
+ [Kind]: "Symbol";
830
+ static: symbol;
831
+ type: "symbol";
832
+ }
833
+ export interface TUndefined extends TSchema {
834
+ [Kind]: "Undefined";
835
+ static: undefined;
836
+ type: "undefined";
837
+ }
838
+ type TFromComputed$2<Target extends string, Parameters extends TSchema[]> = Ensure<TComputed<"Partial", [
839
+ TComputed<Target, Parameters>
840
+ ]>>;
841
+ type TFromRef$2<Ref extends string> = Ensure<TComputed<"Partial", [
842
+ TRef<Ref>
843
+ ]>>;
844
+ type TFromProperties$9<Properties extends TProperties> = Evaluate<{
845
+ [K in keyof Properties]: Properties[K] extends (TReadonlyOptional<infer S>) ? TReadonlyOptional<S> : Properties[K] extends (TReadonly<infer S>) ? TReadonlyOptional<S> : Properties[K] extends (TOptional<infer S>) ? TOptional<S> : TOptional<Properties[K]>;
846
+ }>;
847
+ type TFromObject$2<_Type extends TObject, Properties extends TProperties, MappedProperties extends TProperties = TFromProperties$9<Properties>, Result extends TSchema = TObject<MappedProperties>> = Result;
848
+ type TFromRest$4<Types extends TSchema[], Result extends TSchema[] = [
849
+ ]> = (Types extends [
850
+ infer L extends TSchema,
851
+ ...infer R extends TSchema[]
852
+ ] ? TFromRest$4<R, [
853
+ ...Result,
854
+ TPartial<L>
855
+ ]> : Result);
856
+ export type TPartial<Type extends TSchema> = (Type extends TRecursive<infer Type extends TSchema> ? TRecursive<TPartial<Type>> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed$2<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef$2<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest$4<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest$4<Types>> : Type extends TObject<infer Properties extends TProperties> ? TFromObject$2<TObject, Properties> : Type extends TBigInt ? Type : Type extends TBoolean ? Type : Type extends TInteger ? Type : Type extends TLiteral ? Type : Type extends TNull ? Type : Type extends TNumber ? Type : Type extends TString ? Type : Type extends TSymbol ? Type : Type extends TUndefined ? Type : TObject<{}>);
857
+ type TFromProperties$10<P extends TProperties> = ({
858
+ [K2 in keyof P]: TPartial<P[K2]>;
859
+ });
860
+ type TFromMappedResult$7<R extends TMappedResult> = (Evaluate<TFromProperties$10<R["properties"]>>);
861
+ export type TPartialFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult$7<R>> = (Ensure<TMappedResult<P>>);
862
+ export interface RegExpOptions extends SchemaOptions {
863
+ /** The maximum length of the string */
864
+ maxLength?: number;
865
+ /** The minimum length of the string */
866
+ minLength?: number;
867
+ }
868
+ export interface TRegExp extends TSchema {
869
+ [Kind]: "RegExp";
870
+ static: `${string}`;
871
+ type: "RegExp";
872
+ source: string;
873
+ flags: string;
874
+ }
875
+ export type TFromTemplateLiteralKeyInfinite<Key extends TTemplateLiteral, Type extends TSchema> = Ensure<TRecord<Key, Type>>;
876
+ export type TFromTemplateLiteralKeyFinite<Key extends TTemplateLiteral, Type extends TSchema, I extends string = Static<Key>> = (Ensure<TObject<Evaluate<{
877
+ [_ in I]: Type;
878
+ }>>>);
879
+ export type TFromTemplateLiteralKey<Key extends TTemplateLiteral, Type extends TSchema> = TIsTemplateLiteralFinite<Key> extends false ? TFromTemplateLiteralKeyInfinite<Key, Type> : TFromTemplateLiteralKeyFinite<Key, Type>;
880
+ export type TFromEnumKey<Key extends Record<string, string | number>, Type extends TSchema> = Ensure<TObject<{
881
+ [_ in Key[keyof Key]]: Type;
882
+ }>>;
883
+ export type TFromUnionKeyLiteralString<Key extends TLiteral<string>, Type extends TSchema> = {
884
+ [_ in Key["const"]]: Type;
885
+ };
886
+ export type TFromUnionKeyLiteralNumber<Key extends TLiteral<number>, Type extends TSchema> = {
887
+ [_ in Key["const"]]: Type;
888
+ };
889
+ export type TFromUnionKeyVariants<Keys extends TSchema[], Type extends TSchema, Result extends TProperties = {}> = Keys extends [
890
+ infer Left extends TSchema,
891
+ ...infer Right extends TSchema[]
892
+ ] ? (Left extends TUnion<infer Types extends TSchema[]> ? TFromUnionKeyVariants<Right, Type, Result & TFromUnionKeyVariants<Types, Type>> : Left extends TLiteral<string> ? TFromUnionKeyVariants<Right, Type, Result & TFromUnionKeyLiteralString<Left, Type>> : Left extends TLiteral<number> ? TFromUnionKeyVariants<Right, Type, Result & TFromUnionKeyLiteralNumber<Left, Type>> : {}) : Result;
893
+ export type TFromUnionKey<Key extends TSchema[], Type extends TSchema, Properties extends TProperties = TFromUnionKeyVariants<Key, Type>> = (Ensure<TObject<Evaluate<Properties>>>);
894
+ export type TFromLiteralKey<Key extends TLiteralValue, Type extends TSchema> = (Ensure<TObject<{
895
+ [_ in Assert<Key, PropertyKey>]: Type;
896
+ }>>);
897
+ export type TFromRegExpKey<_Key extends TRegExp, Type extends TSchema> = (Ensure<TRecord<TRegExp, Type>>);
898
+ export type TFromStringKey<_Key extends TString, Type extends TSchema> = (Ensure<TRecord<TString, Type>>);
899
+ export type TFromAnyKey<_Key extends TAny, Type extends TSchema> = (Ensure<TRecord<TAny, Type>>);
900
+ export type TFromNeverKey<_Key extends TNever, Type extends TSchema> = (Ensure<TRecord<TNever, Type>>);
901
+ export type TFromBooleanKey<_Key extends TBoolean, Type extends TSchema> = (Ensure<TObject<{
902
+ true: Type;
903
+ false: Type;
904
+ }>>);
905
+ export type TFromIntegerKey<_Key extends TSchema, Type extends TSchema> = (Ensure<TRecord<TNumber, Type>>);
906
+ export type TFromNumberKey<_Key extends TSchema, Type extends TSchema> = (Ensure<TRecord<TNumber, Type>>);
907
+ export type RecordStatic<Key extends TSchema, Type extends TSchema, P extends unknown[]> = (Evaluate<{
908
+ [_ in Assert<Static<Key>, PropertyKey>]: Static<Type, P>;
909
+ }>);
910
+ export interface TRecord<Key extends TSchema = TSchema, Type extends TSchema = TSchema> extends TSchema {
911
+ [Kind]: "Record";
912
+ static: RecordStatic<Key, Type, this["params"]>;
913
+ type: "object";
914
+ patternProperties: {
915
+ [pattern: string]: Type;
916
+ };
917
+ additionalProperties: TAdditionalProperties;
918
+ }
919
+ export type TRecordOrObject<Key extends TSchema, Type extends TSchema> = (Key extends TTemplateLiteral ? TFromTemplateLiteralKey<Key, Type> : Key extends TEnum<infer Enum extends TEnumRecord> ? TFromEnumKey<Enum, Type> : Key extends TUnion<infer Types extends TSchema[]> ? TFromUnionKey<Types, Type> : Key extends TLiteral<infer Value extends TLiteralValue> ? TFromLiteralKey<Value, Type> : Key extends TBoolean ? TFromBooleanKey<Key, Type> : Key extends TInteger ? TFromIntegerKey<Key, Type> : Key extends TNumber ? TFromNumberKey<Key, Type> : Key extends TRegExp ? TFromRegExpKey<Key, Type> : Key extends TString ? TFromStringKey<Key, Type> : Key extends TAny ? TFromAnyKey<Key, Type> : Key extends TNever ? TFromNeverKey<Key, Type> : TNever);
920
+ type TFromComputed$3<Target extends string, Parameters extends TSchema[]> = Ensure<TComputed<"Required", [
921
+ TComputed<Target, Parameters>
922
+ ]>>;
923
+ type TFromRef$3<Ref extends string> = Ensure<TComputed<"Required", [
924
+ TRef<Ref>
925
+ ]>>;
926
+ type TFromProperties$11<Properties extends TProperties> = Evaluate<{
927
+ [K in keyof Properties]: Properties[K] extends (TReadonlyOptional<infer S>) ? TReadonly<S> : Properties[K] extends (TReadonly<infer S>) ? TReadonly<S> : Properties[K] extends (TOptional<infer S>) ? S : Properties[K];
928
+ }>;
929
+ type TFromObject$3<_Type extends TObject, Properties extends TProperties, MappedProperties extends TProperties = TFromProperties$11<Properties>, Result extends TSchema = TObject<MappedProperties>> = Result;
930
+ type TFromRest$5<Types extends TSchema[], Result extends TSchema[] = [
931
+ ]> = (Types extends [
932
+ infer L extends TSchema,
933
+ ...infer R extends TSchema[]
934
+ ] ? TFromRest$5<R, [
935
+ ...Result,
936
+ TRequired<L>
937
+ ]> : Result);
938
+ export type TRequired<Type extends TSchema> = (Type extends TRecursive<infer Type extends TSchema> ? TRecursive<TRequired<Type>> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed$3<Target, Parameters> : Type extends TRef<infer Ref extends string> ? TFromRef$3<Ref> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TFromRest$5<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TFromRest$5<Types>> : Type extends TObject<infer Properties extends TProperties> ? TFromObject$3<TObject, Properties> : Type extends TBigInt ? Type : Type extends TBoolean ? Type : Type extends TInteger ? Type : Type extends TLiteral ? Type : Type extends TNull ? Type : Type extends TNumber ? Type : Type extends TString ? Type : Type extends TSymbol ? Type : Type extends TUndefined ? Type : TObject<{}>);
939
+ type TFromProperties$12<P extends TProperties> = ({
940
+ [K2 in keyof P]: TRequired<P[K2]>;
941
+ });
942
+ type TFromMappedResult$8<R extends TMappedResult> = (Evaluate<TFromProperties$12<R["properties"]>>);
943
+ export type TRequiredFromMappedResult<R extends TMappedResult, P extends TProperties = TFromMappedResult$8<R>> = (Ensure<TMappedResult<P>>);
944
+ declare class TransformDecodeBuilder<T extends TSchema> {
945
+ private readonly schema;
946
+ constructor(schema: T);
947
+ Decode<U extends unknown, D extends TransformFunction<StaticDecode<T>, U>>(decode: D): TransformEncodeBuilder<T, D>;
948
+ }
949
+ declare class TransformEncodeBuilder<T extends TSchema, D extends TransformFunction> {
950
+ private readonly schema;
951
+ private readonly decode;
952
+ constructor(schema: T, decode: D);
953
+ private EncodeTransform;
954
+ private EncodeSchema;
955
+ Encode<E extends TransformFunction<ReturnType<D>, StaticDecode<T>>>(encode: E): TTransform<T, ReturnType<D>>;
956
+ }
957
+ export type TransformStatic<T extends TSchema, P extends unknown[] = [
958
+ ]> = T extends TTransform<infer _, infer S> ? S : Static<T, P>;
959
+ export type TransformFunction<T = any, U = any> = (value: T) => U;
960
+ export interface TransformOptions<I extends TSchema = TSchema, O extends unknown = unknown> {
961
+ Decode: TransformFunction<StaticDecode<I>, O>;
962
+ Encode: TransformFunction<O, StaticDecode<I>>;
963
+ }
964
+ export interface TTransform<I extends TSchema = TSchema, O extends unknown = unknown> extends TSchema {
965
+ static: TransformStatic<I, this["params"]>;
966
+ [TransformKind]: TransformOptions<I, O>;
967
+ [key: string]: any;
968
+ }
969
+ export type TDereferenceParameters<ModuleProperties extends TProperties, Types extends TSchema[], Result extends TSchema[] = [
970
+ ]> = (Types extends [
971
+ infer Left extends TSchema,
972
+ ...infer Right extends TSchema[]
973
+ ] ? Left extends TRef<infer Key extends string> ? TDereferenceParameters<ModuleProperties, Right, [
974
+ ...Result,
975
+ TDereference<ModuleProperties, Key>
976
+ ]> : TDereferenceParameters<ModuleProperties, Right, [
977
+ ...Result,
978
+ TFromType<ModuleProperties, Left>
979
+ ]> : Result);
980
+ export type TDereference<ModuleProperties extends TProperties, Ref extends string, Result extends TSchema = (Ref extends keyof ModuleProperties ? ModuleProperties[Ref] extends TRef<infer Ref2 extends string> ? TDereference<ModuleProperties, Ref2> : TFromType<ModuleProperties, ModuleProperties[Ref]> : TNever)> = Result;
981
+ export type TFromAwaited<Parameters extends TSchema[]> = (Parameters extends [
982
+ infer T0 extends TSchema
983
+ ] ? TAwaited<T0> : never);
984
+ export type TFromIndex<Parameters extends TSchema[]> = (Parameters extends [
985
+ infer T0 extends TSchema,
986
+ infer T1 extends TSchema
987
+ ] ? TIndex<T0, TIndexPropertyKeys<T1>> extends infer Result extends TSchema ? Result : never : never);
988
+ export type TFromKeyOf<Parameters extends TSchema[]> = (Parameters extends [
989
+ infer T0 extends TSchema
990
+ ] ? TKeyOf<T0> : never);
991
+ export type TFromPartial<Parameters extends TSchema[]> = (Parameters extends [
992
+ infer T0 extends TSchema
993
+ ] ? TPartial<T0> : never);
994
+ export type TFromOmit<Parameters extends TSchema[]> = (Parameters extends [
995
+ infer T0 extends TSchema,
996
+ infer T1 extends TSchema
997
+ ] ? TOmit<T0, T1> : never);
998
+ export type TFromPick<Parameters extends TSchema[]> = (Parameters extends [
999
+ infer T0 extends TSchema,
1000
+ infer T1 extends TSchema
1001
+ ] ? TPick<T0, T1> : never);
1002
+ export type TFromRequired<Parameters extends TSchema[]> = (Parameters extends [
1003
+ infer T0 extends TSchema
1004
+ ] ? TRequired<T0> : never);
1005
+ type TFromComputed$4<ModuleProperties extends TProperties, Target extends string, Parameters extends TSchema[], Dereferenced extends TSchema[] = TDereferenceParameters<ModuleProperties, Parameters>> = (Target extends "Awaited" ? TFromAwaited<Dereferenced> : Target extends "Index" ? TFromIndex<Dereferenced> : Target extends "KeyOf" ? TFromKeyOf<Dereferenced> : Target extends "Partial" ? TFromPartial<Dereferenced> : Target extends "Omit" ? TFromOmit<Dereferenced> : Target extends "Pick" ? TFromPick<Dereferenced> : Target extends "Required" ? TFromRequired<Dereferenced> : TNever);
1006
+ type TFromArray$2<ModuleProperties extends TProperties, Type extends TSchema> = (Ensure<TArray<TFromType<ModuleProperties, Type>>>);
1007
+ export type TFromAsyncIterator<ModuleProperties extends TProperties, Type extends TSchema> = (TAsyncIterator<TFromType<ModuleProperties, Type>>);
1008
+ export type TFromConstructor<ModuleProperties extends TProperties, Parameters extends TSchema[], InstanceType extends TSchema> = (TConstructor<TFromTypes<ModuleProperties, Parameters>, TFromType<ModuleProperties, InstanceType>>);
1009
+ export type TFromFunction<ModuleProperties extends TProperties, Parameters extends TSchema[], ReturnType extends TSchema> = Ensure<Ensure<TFunction<TFromTypes<ModuleProperties, Parameters>, TFromType<ModuleProperties, ReturnType>>>>;
1010
+ type TFromIntersect$4<ModuleProperties extends TProperties, Types extends TSchema[]> = (Ensure<TIntersectEvaluated<TFromTypes<ModuleProperties, Types>>>);
1011
+ export type TFromIterator<ModuleProperties extends TProperties, Type extends TSchema> = (TIterator<TFromType<ModuleProperties, Type>>);
1012
+ type TFromObject$4<ModuleProperties extends TProperties, Properties extends TProperties> = Ensure<TObject<Evaluate<{
1013
+ [Key in keyof Properties]: TFromType<ModuleProperties, Properties[Key]>;
1014
+ }>>>;
1015
+ export type TFromRecord<ModuleProperties extends TProperties, Key extends TSchema, Value extends TSchema, Result extends TSchema = TRecordOrObject<Key, TFromType<ModuleProperties, Value>>> = Result;
1016
+ export type TFromTransform<ModuleProperties extends TProperties, Input extends TSchema, Output extends unknown, Result extends TSchema = Input extends TRef<infer Key extends string> ? TTransform<TDereference<ModuleProperties, Key>, Output> : TTransform<Input, Output>> = Result;
1017
+ type TFromTuple$2<ModuleProperties extends TProperties, Types extends TSchema[]> = (Ensure<TTuple<TFromTypes<ModuleProperties, Types>>>);
1018
+ type TFromUnion$5<ModuleProperties extends TProperties, Types extends TSchema[]> = (Ensure<TUnionEvaluated<TFromTypes<ModuleProperties, Types>>>);
1019
+ export type TFromTypes<ModuleProperties extends TProperties, Types extends TSchema[], Result extends TSchema[] = [
1020
+ ]> = (Types extends [
1021
+ infer Left extends TSchema,
1022
+ ...infer Right extends TSchema[]
1023
+ ] ? TFromTypes<ModuleProperties, Right, [
1024
+ ...Result,
1025
+ TFromType<ModuleProperties, Left>
1026
+ ]> : Result);
1027
+ export type TFromType<ModuleProperties extends TProperties, Type extends TSchema> = (Type extends TOptional<infer Type extends TSchema> ? TOptional<TFromType<ModuleProperties, Type>> : Type extends TReadonly<infer Type extends TSchema> ? TReadonly<TFromType<ModuleProperties, Type>> : Type extends TTransform<infer Input extends TSchema, infer Output extends unknown> ? TFromTransform<ModuleProperties, Input, Output> : Type extends TArray<infer Type extends TSchema> ? TFromArray$2<ModuleProperties, Type> : Type extends TAsyncIterator<infer Type extends TSchema> ? TFromAsyncIterator<ModuleProperties, Type> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed$4<ModuleProperties, Target, Parameters> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromConstructor<ModuleProperties, Parameters, InstanceType> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromFunction<ModuleProperties, Parameters, ReturnType> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect$4<ModuleProperties, Types> : Type extends TIterator<infer Type extends TSchema> ? TFromIterator<ModuleProperties, Type> : Type extends TObject<infer Properties extends TProperties> ? TFromObject$4<ModuleProperties, Properties> : Type extends TRecord<infer Key extends TSchema, infer Value extends TSchema> ? TFromRecord<ModuleProperties, Key, Value> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple$2<ModuleProperties, Types> : Type extends TEnum<infer _ extends TEnumRecord> ? Type : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion$5<ModuleProperties, Types> : Type);
1028
+ export type TComputeType<ModuleProperties extends TProperties, Key extends PropertyKey> = (Key extends keyof ModuleProperties ? TFromType<ModuleProperties, ModuleProperties[Key]> : TNever);
1029
+ export type TComputeModuleProperties<ModuleProperties extends TProperties> = Evaluate<{
1030
+ [Key in keyof ModuleProperties]: TComputeType<ModuleProperties, Key>;
1031
+ }>;
1032
+ export type TInferArray<ModuleProperties extends TProperties, Type extends TSchema> = (Ensure<Array<TInfer<ModuleProperties, Type>>>);
1033
+ export type TInferAsyncIterator<ModuleProperties extends TProperties, Type extends TSchema> = (Ensure<AsyncIterableIterator<TInfer<ModuleProperties, Type>>>);
1034
+ export type TInferConstructor<ModuleProperties extends TProperties, Parameters extends TSchema[], InstanceType extends TSchema> = Ensure<new (...args: TInferTuple<ModuleProperties, Parameters>) => TInfer<ModuleProperties, InstanceType>>;
1035
+ export type TInferFunction<ModuleProperties extends TProperties, Parameters extends TSchema[], ReturnType extends TSchema> = Ensure<(...args: TInferTuple<ModuleProperties, Parameters>) => TInfer<ModuleProperties, ReturnType>>;
1036
+ export type TInferIterator<ModuleProperties extends TProperties, Type extends TSchema> = (Ensure<IterableIterator<TInfer<ModuleProperties, Type>>>);
1037
+ export type TInferIntersect<ModuleProperties extends TProperties, Types extends TSchema[], Result extends unknown = unknown> = (Types extends [
1038
+ infer Left extends TSchema,
1039
+ ...infer Right extends TSchema[]
1040
+ ] ? TInferIntersect<ModuleProperties, Right, Result & TInfer<ModuleProperties, Left>> : Result);
1041
+ export type ReadonlyOptionalPropertyKeys<Properties extends TProperties> = {
1042
+ [Key in keyof Properties]: Properties[Key] extends TReadonly<TSchema> ? (Properties[Key] extends TOptional<Properties[Key]> ? Key : never) : never;
1043
+ }[keyof Properties];
1044
+ export type ReadonlyPropertyKeys<Source extends TProperties> = {
1045
+ [Key in keyof Source]: Source[Key] extends TReadonly<TSchema> ? (Source[Key] extends TOptional<Source[Key]> ? never : Key) : never;
1046
+ }[keyof Source];
1047
+ export type OptionalPropertyKeys<Source extends TProperties> = {
1048
+ [Key in keyof Source]: Source[Key] extends TOptional<TSchema> ? (Source[Key] extends TReadonly<Source[Key]> ? never : Key) : never;
1049
+ }[keyof Source];
1050
+ export type RequiredPropertyKeys<Source extends TProperties> = keyof Omit<Source, ReadonlyOptionalPropertyKeys<Source> | ReadonlyPropertyKeys<Source> | OptionalPropertyKeys<Source>>;
1051
+ export type InferPropertiesWithModifiers<Properties extends TProperties, Source extends Record<keyof any, unknown>> = Evaluate<(Readonly<Partial<Pick<Source, ReadonlyOptionalPropertyKeys<Properties>>>> & Readonly<Pick<Source, ReadonlyPropertyKeys<Properties>>> & Partial<Pick<Source, OptionalPropertyKeys<Properties>>> & Required<Pick<Source, RequiredPropertyKeys<Properties>>>)>;
1052
+ export type InferProperties<ModuleProperties extends TProperties, Properties extends TProperties> = InferPropertiesWithModifiers<Properties, {
1053
+ [K in keyof Properties]: TInfer<ModuleProperties, Properties[K]>;
1054
+ }>;
1055
+ export type TInferObject<ModuleProperties extends TProperties, Properties extends TProperties> = (InferProperties<ModuleProperties, Properties>);
1056
+ export type TInferTuple<ModuleProperties extends TProperties, Types extends TSchema[], Result extends unknown[] = [
1057
+ ]> = (Types extends [
1058
+ infer L extends TSchema,
1059
+ ...infer R extends TSchema[]
1060
+ ] ? TInferTuple<ModuleProperties, R, [
1061
+ ...Result,
1062
+ TInfer<ModuleProperties, L>
1063
+ ]> : Result);
1064
+ export type TInferRecord<ModuleProperties extends TProperties, Key extends TSchema, Type extends TSchema, InferredKey extends PropertyKey = TInfer<ModuleProperties, Key> extends infer Key extends PropertyKey ? Key : never, InferedType extends unknown = TInfer<ModuleProperties, Type>> = Ensure<{
1065
+ [_ in InferredKey]: InferedType;
1066
+ }>;
1067
+ export type TInferRef<ModuleProperties extends TProperties, Ref extends string> = (Ref extends keyof ModuleProperties ? TInfer<ModuleProperties, ModuleProperties[Ref]> : unknown);
1068
+ export type TInferUnion<ModuleProperties extends TProperties, Types extends TSchema[], Result extends unknown = never> = (Types extends [
1069
+ infer L extends TSchema,
1070
+ ...infer R extends TSchema[]
1071
+ ] ? TInferUnion<ModuleProperties, R, Result | TInfer<ModuleProperties, L>> : Result);
1072
+ export type TInfer<ModuleProperties extends TProperties, Type extends TSchema> = (Type extends TArray<infer Type extends TSchema> ? TInferArray<ModuleProperties, Type> : Type extends TAsyncIterator<infer Type extends TSchema> ? TInferAsyncIterator<ModuleProperties, Type> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TInferConstructor<ModuleProperties, Parameters, InstanceType> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TInferFunction<ModuleProperties, Parameters, ReturnType> : Type extends TIntersect<infer Types extends TSchema[]> ? TInferIntersect<ModuleProperties, Types> : Type extends TIterator<infer Type extends TSchema> ? TInferIterator<ModuleProperties, Type> : Type extends TObject<infer Properties extends TProperties> ? TInferObject<ModuleProperties, Properties> : Type extends TRecord<infer Key extends TSchema, infer Type extends TSchema> ? TInferRecord<ModuleProperties, Key, Type> : Type extends TRef<infer Ref extends string> ? TInferRef<ModuleProperties, Ref> : Type extends TTuple<infer Types extends TSchema[]> ? TInferTuple<ModuleProperties, Types> : Type extends TEnum<infer _ extends TEnumRecord> ? Static<Type> : Type extends TUnion<infer Types extends TSchema[]> ? TInferUnion<ModuleProperties, Types> : Type extends TRecursive<infer Schema extends TSchema> ? TInfer<ModuleProperties, Schema> : Static<Type>);
1073
+ /** Inference Path for Imports. This type is used to compute TImport `static` */
1074
+ export type TInferFromModuleKey<ModuleProperties extends TProperties, Key extends PropertyKey> = (Key extends keyof ModuleProperties ? TInfer<ModuleProperties, ModuleProperties[Key]> : never);
1075
+ export interface TImport<ModuleProperties extends TProperties = {}, Key extends keyof ModuleProperties = keyof ModuleProperties> extends TSchema {
1076
+ [Kind]: "Import";
1077
+ static: TInferFromModuleKey<ModuleProperties, Key>;
1078
+ $defs: ModuleProperties;
1079
+ $ref: Key;
1080
+ }
1081
+ declare class TModule<ModuleProperties extends TProperties, ComputedModuleProperties extends TProperties = TComputeModuleProperties<ModuleProperties>> {
1082
+ private readonly $defs;
1083
+ constructor($defs: ModuleProperties);
1084
+ /** `[Json]` Imports a Type by Key. */
1085
+ Import<Key extends keyof ComputedModuleProperties>(key: Key, options?: SchemaOptions): TImport<ComputedModuleProperties, Key>;
1086
+ private WithIdentifiers;
1087
+ }
1088
+ export interface TNot<T extends TSchema = TSchema> extends TSchema {
1089
+ [Kind]: "Not";
1090
+ static: T extends TNot<infer U> ? Static<U> : unknown;
1091
+ not: T;
1092
+ }
1093
+ export type TDecodeImport<ModuleProperties extends TProperties, Key extends PropertyKey> = (Key extends keyof ModuleProperties ? TDecodeType<ModuleProperties[Key]> extends infer Type extends TSchema ? Type extends TRef<infer Ref extends string> ? TDecodeImport<ModuleProperties, Ref> : Type : TNever : TNever);
1094
+ export type TDecodeProperties<Properties extends TProperties> = {
1095
+ [Key in keyof Properties]: TDecodeType<Properties[Key]>;
1096
+ };
1097
+ export type TDecodeTypes<Types extends TSchema[], Result extends TSchema[] = [
1098
+ ]> = (Types extends [
1099
+ infer Left extends TSchema,
1100
+ ...infer Right extends TSchema[]
1101
+ ] ? TDecodeTypes<Right, [
1102
+ ...Result,
1103
+ TDecodeType<Left>
1104
+ ]> : Result);
1105
+ export type TDecodeType<Type extends TSchema> = (Type extends TOptional<infer Type extends TSchema> ? TOptional<TDecodeType<Type>> : Type extends TReadonly<infer Type extends TSchema> ? TReadonly<TDecodeType<Type>> : Type extends TTransform<infer _Input extends TSchema, infer Output> ? TUnsafe<Output> : Type extends TArray<infer Type extends TSchema> ? TArray<TDecodeType<Type>> : Type extends TAsyncIterator<infer Type extends TSchema> ? TAsyncIterator<TDecodeType<Type>> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TConstructor<TDecodeTypes<Parameters>, TDecodeType<InstanceType>> : Type extends TEnum<infer Values> ? TEnum<Values> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFunction<TDecodeTypes<Parameters>, TDecodeType<ReturnType>> : Type extends TIntersect<infer Types extends TSchema[]> ? TIntersect<TDecodeTypes<Types>> : Type extends TImport<infer ModuleProperties extends TProperties, infer Key> ? TDecodeImport<ModuleProperties, Key> : Type extends TIterator<infer Type extends TSchema> ? TIterator<TDecodeType<Type>> : Type extends TNot<infer Type extends TSchema> ? TNot<TDecodeType<Type>> : Type extends TObject<infer Properties extends TProperties> ? TObject<Evaluate<TDecodeProperties<Properties>>> : Type extends TPromise<infer Type extends TSchema> ? TPromise<TDecodeType<Type>> : Type extends TRecord<infer Key extends TSchema, infer Value extends TSchema> ? TRecord<Key, TDecodeType<Value>> : Type extends TRecursive<infer Type extends TSchema> ? TRecursive<TDecodeType<Type>> : Type extends TRef<infer Ref extends string> ? TRef<Ref> : Type extends TTuple<infer Types extends TSchema[]> ? TTuple<TDecodeTypes<Types>> : Type extends TUnion<infer Types extends TSchema[]> ? TUnion<TDecodeTypes<Types>> : Type);
1106
+ export type StaticDecodeIsAny<Type> = boolean extends (Type extends TSchema ? true : false) ? true : false;
1107
+ /** Creates an decoded static type from a TypeBox type */
1108
+ export type StaticDecode<Type extends TSchema, Params extends unknown[] = [
1109
+ ], Result = StaticDecodeIsAny<Type> extends true ? unknown : Static<TDecodeType<Type>, Params>> = Result;
1110
+ /** Creates a static type from a TypeBox type */
1111
+ export type Static<Type extends TSchema, Params extends unknown[] = [
1112
+ ], Result = (Type & {
1113
+ params: Params;
1114
+ })["static"]> = Result;
1115
+ type ReadonlyOptionalPropertyKeys$1<T extends TProperties> = {
1116
+ [K in keyof T]: T[K] extends TReadonly<TSchema> ? (T[K] extends TOptional<T[K]> ? K : never) : never;
1117
+ }[keyof T];
1118
+ type ReadonlyPropertyKeys$1<T extends TProperties> = {
1119
+ [K in keyof T]: T[K] extends TReadonly<TSchema> ? (T[K] extends TOptional<T[K]> ? never : K) : never;
1120
+ }[keyof T];
1121
+ type OptionalPropertyKeys$1<T extends TProperties> = {
1122
+ [K in keyof T]: T[K] extends TOptional<TSchema> ? (T[K] extends TReadonly<T[K]> ? never : K) : never;
1123
+ }[keyof T];
1124
+ type RequiredPropertyKeys$1<T extends TProperties> = keyof Omit<T, ReadonlyOptionalPropertyKeys$1<T> | ReadonlyPropertyKeys$1<T> | OptionalPropertyKeys$1<T>>;
1125
+ export type ObjectStaticProperties<T extends TProperties, R extends Record<keyof any, unknown>> = Evaluate<(Readonly<Partial<Pick<R, ReadonlyOptionalPropertyKeys$1<T>>>> & Readonly<Pick<R, ReadonlyPropertyKeys$1<T>>> & Partial<Pick<R, OptionalPropertyKeys$1<T>>> & Required<Pick<R, RequiredPropertyKeys$1<T>>>)>;
1126
+ export type ObjectStatic<T extends TProperties, P extends unknown[]> = ObjectStaticProperties<T, {
1127
+ [K in keyof T]: Static<T[K], P>;
1128
+ }>;
1129
+ export type TPropertyKey = string | number;
1130
+ export type TProperties = Record<TPropertyKey, TSchema>;
1131
+ export type TIsLiteralString<Type extends string> = ([
1132
+ Type
1133
+ ] extends [
1134
+ string
1135
+ ] ? [
1136
+ string
1137
+ ] extends [
1138
+ Type
1139
+ ] ? false : true : false);
1140
+ export type IsRequiredArrayLiteralConstant<RequiredTuple extends string[]> = (RequiredTuple extends [
1141
+ infer Left extends string,
1142
+ ...infer _ extends string[]
1143
+ ] ? TIsLiteralString<Left> : false);
1144
+ export type TRequiredArray<Properties extends TProperties, RequiredProperties extends TProperties = {
1145
+ [Key in keyof Properties as Properties[Key] extends TOptional<Properties[Key]> ? never : Key]: Properties[Key];
1146
+ }, RequiredUnion extends string = Extract<keyof RequiredProperties, string>, RequiredTuple extends string[] = UnionToTuple<RequiredUnion>, Result extends string[] | undefined = (IsRequiredArrayLiteralConstant<RequiredTuple> extends true ? RequiredTuple : string[] | undefined)> = Result;
1147
+ export type TAdditionalProperties = undefined | TSchema | boolean;
1148
+ export interface ObjectOptions extends SchemaOptions {
1149
+ /** Additional property constraints for this object */
1150
+ additionalProperties?: TAdditionalProperties;
1151
+ /** The minimum number of properties allowed on this object */
1152
+ minProperties?: number;
1153
+ /** The maximum number of properties allowed on this object */
1154
+ maxProperties?: number;
1155
+ }
1156
+ export interface TObject<T extends TProperties = TProperties> extends TSchema, ObjectOptions {
1157
+ [Kind]: "Object";
1158
+ static: ObjectStatic<T, this["params"]>;
1159
+ additionalProperties?: TAdditionalProperties;
1160
+ type: "object";
1161
+ properties: T;
1162
+ required: TRequiredArray<T>;
1163
+ }
1164
+ export type TupleToUnion<T extends any[]> = {
1165
+ [K in keyof T]: T[K];
1166
+ }[number];
1167
+ export type UnionToIntersect<U> = (U extends unknown ? (arg: U) => 0 : never) extends (arg: infer I) => 0 ? I : never;
1168
+ export type UnionLast<U> = UnionToIntersect<U extends unknown ? (x: U) => 0 : never> extends (x: infer L) => 0 ? L : never;
1169
+ export type UnionToTuple<U, Acc extends unknown[] = [
1170
+ ], R = UnionLast<U>> = [
1171
+ U
1172
+ ] extends [
1173
+ never
1174
+ ] ? Acc : UnionToTuple<Exclude<U, R>, [
1175
+ Extract<U, R>,
1176
+ ...Acc
1177
+ ]>;
1178
+ export type Trim<T> = T extends `${" "}${infer U}` ? Trim<U> : T extends `${infer U}${" "}` ? Trim<U> : T;
1179
+ export type Assert<T, E> = T extends E ? T : never;
1180
+ export type Evaluate<T> = T extends infer O ? {
1181
+ [K in keyof O]: O[K];
1182
+ } : never;
1183
+ export type Ensure<T> = T extends infer U ? U : never;
1184
+ export type EmptyString = "";
1185
+ export type ZeroString = "0";
1186
+ export type IncrementBase = {
1187
+ m: "9";
1188
+ t: "01";
1189
+ "0": "1";
1190
+ "1": "2";
1191
+ "2": "3";
1192
+ "3": "4";
1193
+ "4": "5";
1194
+ "5": "6";
1195
+ "6": "7";
1196
+ "7": "8";
1197
+ "8": "9";
1198
+ "9": "0";
1199
+ };
1200
+ export type IncrementTake<T extends keyof IncrementBase> = IncrementBase[T];
1201
+ export type IncrementStep<T extends string> = T extends IncrementBase["m"] ? IncrementBase["t"] : T extends `${infer L extends keyof IncrementBase}${infer R}` ? L extends IncrementBase["m"] ? `${IncrementTake<L>}${IncrementStep<R>}` : `${IncrementTake<L>}${R}` : never;
1202
+ export type IncrementReverse<T extends string> = T extends `${infer L}${infer R}` ? `${IncrementReverse<R>}${L}` : T;
1203
+ export type TIncrement<T extends string> = IncrementReverse<IncrementStep<IncrementReverse<T>>>;
1204
+ export type AssertRest<T, E extends TSchema[] = TSchema[]> = T extends E ? T : [
1205
+ ];
1206
+ export type AssertType<T, E extends TSchema = TSchema> = T extends E ? T : TNever;
1207
+ export interface ArrayOptions extends SchemaOptions {
1208
+ /** The minimum number of items in this array */
1209
+ minItems?: number;
1210
+ /** The maximum number of items in this array */
1211
+ maxItems?: number;
1212
+ /** Should this schema contain unique items */
1213
+ uniqueItems?: boolean;
1214
+ /** A schema for which some elements should match */
1215
+ contains?: TSchema;
1216
+ /** A minimum number of contains schema matches */
1217
+ minContains?: number;
1218
+ /** A maximum number of contains schema matches */
1219
+ maxContains?: number;
1220
+ }
1221
+ export type ArrayStatic<T extends TSchema, P extends unknown[]> = Ensure<Static<T, P>[]>;
1222
+ export interface TArray<T extends TSchema = TSchema> extends TSchema, ArrayOptions {
1223
+ [Kind]: "Array";
1224
+ static: ArrayStatic<T, this["params"]>;
1225
+ type: "array";
1226
+ items: T;
1227
+ }
1228
+ export interface DateOptions extends SchemaOptions {
1229
+ /** The exclusive maximum timestamp value */
1230
+ exclusiveMaximumTimestamp?: number;
1231
+ /** The exclusive minimum timestamp value */
1232
+ exclusiveMinimumTimestamp?: number;
1233
+ /** The maximum timestamp value */
1234
+ maximumTimestamp?: number;
1235
+ /** The minimum timestamp value */
1236
+ minimumTimestamp?: number;
1237
+ /** The multiple of timestamp value */
1238
+ multipleOfTimestamp?: number;
1239
+ }
1240
+ export interface TDate extends TSchema, DateOptions {
1241
+ [Kind]: "Date";
1242
+ static: Date;
1243
+ type: "date";
1244
+ }
1245
+ export interface Uint8ArrayOptions extends SchemaOptions {
1246
+ maxByteLength?: number;
1247
+ minByteLength?: number;
1248
+ }
1249
+ export interface TUint8Array extends TSchema, Uint8ArrayOptions {
1250
+ [Kind]: "Uint8Array";
1251
+ static: Uint8Array;
1252
+ type: "uint8array";
1253
+ }
1254
+ export interface TUnknown extends TSchema {
1255
+ [Kind]: "Unknown";
1256
+ static: unknown;
1257
+ }
1258
+ export interface TVoid extends TSchema {
1259
+ [Kind]: "Void";
1260
+ static: void;
1261
+ type: "void";
1262
+ }
1263
+ export interface SchemaOptions {
1264
+ $schema?: string;
1265
+ /** Id for this schema */
1266
+ $id?: string;
1267
+ /** Title of this schema */
1268
+ title?: string;
1269
+ /** Description of this schema */
1270
+ description?: string;
1271
+ /** Default value for this schema */
1272
+ default?: any;
1273
+ /** Example values matching this schema */
1274
+ examples?: any;
1275
+ /** Optional annotation for readOnly */
1276
+ readOnly?: boolean;
1277
+ /** Optional annotation for writeOnly */
1278
+ writeOnly?: boolean;
1279
+ [prop: string]: any;
1280
+ }
1281
+ export interface TKind {
1282
+ [Kind]: string;
1283
+ }
1284
+ export interface TSchema extends TKind, SchemaOptions {
1285
+ [ReadonlyKind]?: string;
1286
+ [OptionalKind]?: string;
1287
+ [Hint]?: string;
1288
+ params: unknown[];
1289
+ static: unknown;
1290
+ }
1291
+ export interface TArgument<Index extends number = number> extends TSchema {
1292
+ [Kind]: "Argument";
1293
+ static: unknown;
1294
+ index: Index;
1295
+ }
1296
+ export type TCompositeKeys<T extends TSchema[], Acc extends PropertyKey[] = [
1297
+ ]> = (T extends [
1298
+ infer L extends TSchema,
1299
+ ...infer R extends TSchema[]
1300
+ ] ? TCompositeKeys<R, [
1301
+ ...Acc,
1302
+ ...TKeyOfPropertyKeys<L>
1303
+ ]> : TSetDistinct<Acc>);
1304
+ export type TFilterNever<T extends TSchema[], Acc extends TSchema[] = [
1305
+ ]> = (T extends [
1306
+ infer L extends TSchema,
1307
+ ...infer R extends TSchema[]
1308
+ ] ? L extends TNever ? TFilterNever<R, [
1309
+ ...Acc
1310
+ ]> : TFilterNever<R, [
1311
+ ...Acc,
1312
+ L
1313
+ ]> : Acc);
1314
+ export type TCompositeProperty<T extends TSchema[], K extends PropertyKey, Acc extends TSchema[] = [
1315
+ ]> = (T extends [
1316
+ infer L extends TSchema,
1317
+ ...infer R extends TSchema[]
1318
+ ] ? TCompositeProperty<R, K, [
1319
+ ...Acc,
1320
+ ...TIndexFromPropertyKeys<L, [
1321
+ K
1322
+ ]>
1323
+ ]> : TFilterNever<Acc>);
1324
+ export type TCompositeProperties<T extends TSchema[], K extends PropertyKey[], Acc = {}> = (K extends [
1325
+ infer L extends PropertyKey,
1326
+ ...infer R extends PropertyKey[]
1327
+ ] ? TCompositeProperties<T, R, Acc & {
1328
+ [_ in L]: TIntersectEvaluated<TCompositeProperty<T, L>>;
1329
+ }> : Acc);
1330
+ export type TCompositeEvaluate<T extends TSchema[], K extends PropertyKey[] = TCompositeKeys<T>, P extends TProperties = Evaluate<TCompositeProperties<T, K>>, R extends TSchema = TObject<P>> = R;
1331
+ export type TComposite<T extends TSchema[]> = TCompositeEvaluate<T>;
1332
+ type TFromArray$3<T extends readonly unknown[]> = T extends readonly [
1333
+ infer L extends unknown,
1334
+ ...infer R extends unknown[]
1335
+ ] ? [
1336
+ FromValue<L, false>,
1337
+ ...TFromArray$3<R>
1338
+ ] : T;
1339
+ type TFromProperties$13<T extends Record<PropertyKey, unknown>> = {
1340
+ -readonly [K in keyof T]: FromValue<T[K], false> extends infer R extends TSchema ? TReadonly<R> : TReadonly<TNever>;
1341
+ };
1342
+ export type TConditionalReadonly<T extends TSchema, Root extends boolean> = Root extends true ? T : TReadonly<T>;
1343
+ export type FromValue<T, Root extends boolean> = T extends AsyncIterableIterator<unknown> ? TConditionalReadonly<TAny, Root> : T extends IterableIterator<unknown> ? TConditionalReadonly<TAny, Root> : T extends readonly unknown[] ? TReadonly<TTuple<AssertRest<TFromArray$3<T>>>> : T extends Uint8Array ? TUint8Array : T extends Date ? TDate : T extends Record<PropertyKey, unknown> ? TConditionalReadonly<TObject<Evaluate<TFromProperties$13<T>>>, Root> : T extends Function ? TConditionalReadonly<TFunction<[
1344
+ ], TUnknown>, Root> : T extends undefined ? TUndefined : T extends null ? TNull : T extends symbol ? TSymbol : T extends number ? TLiteral<T> : T extends boolean ? TLiteral<T> : T extends string ? TLiteral<T> : T extends bigint ? TBigInt : TObject<{}>;
1345
+ declare function FromValue<T, Root extends boolean>(value: T, root: Root): FromValue<T, Root>;
1346
+ export type TConst<T> = FromValue<T, true>;
1347
+ export type TConstructorParameters<Type extends TSchema> = (Type extends TConstructor<infer Parameters extends TSchema[], infer _InstanceType extends TSchema> ? TTuple<Parameters> : TNever);
1348
+ export type TExcludeFromTemplateLiteral<L extends TTemplateLiteral, R extends TSchema> = (TExclude<TTemplateLiteralToUnion<L>, R>);
1349
+ export type TExcludeRest<L extends TSchema[], R extends TSchema> = AssertRest<UnionToTuple<{
1350
+ [K in keyof L]: Static<AssertType<L[K]>> extends Static<R> ? never : L[K];
1351
+ }[number]>> extends infer R extends TSchema[] ? TUnionEvaluated<R> : never;
1352
+ export type TExclude<L extends TSchema, R extends TSchema> = (L extends TUnion<infer S> ? TExcludeRest<S, R> : L extends R ? TNever : L);
1353
+ type TFromProperties$14<K extends TProperties, T extends TSchema> = ({
1354
+ [K2 in keyof K]: TExclude<K[K2], T>;
1355
+ });
1356
+ type TFromMappedResult$9<R extends TMappedResult, T extends TSchema> = (TFromProperties$14<R["properties"], T>);
1357
+ export type TExcludeFromMappedResult<R extends TMappedResult, T extends TSchema, P extends TProperties = TFromMappedResult$9<R, T>> = (TMappedResult<P>);
1358
+ type TFromProperties$15<P extends TProperties, Right extends TSchema, False extends TSchema, True extends TSchema> = ({
1359
+ [K2 in keyof P]: TExtends<P[K2], Right, False, True>;
1360
+ });
1361
+ type TFromMappedResult$10<Left extends TMappedResult, Right extends TSchema, True extends TSchema, False extends TSchema> = (TFromProperties$15<Left["properties"], Right, True, False>);
1362
+ export type TExtendsFromMappedResult<Left extends TMappedResult, Right extends TSchema, True extends TSchema, False extends TSchema, P extends TProperties = TFromMappedResult$10<Left, Right, True, False>> = (TMappedResult<P>);
1363
+ export type TExtendsResolve<L extends TSchema, R extends TSchema, T extends TSchema, U extends TSchema> = ((Static<L> extends Static<R> ? T : U) extends infer O extends TSchema ? UnionToTuple<O> extends [
1364
+ infer X extends TSchema,
1365
+ infer Y extends TSchema
1366
+ ] ? TUnion<[
1367
+ X,
1368
+ Y
1369
+ ]> : O : never);
1370
+ export type TExtends<L extends TSchema, R extends TSchema, T extends TSchema, F extends TSchema> = TExtendsResolve<L, R, T, F>;
1371
+ type TFromPropertyKey$2<K extends PropertyKey, U extends TSchema, L extends TSchema, R extends TSchema> = {
1372
+ [_ in K]: TExtends<TLiteral<Assert<K, TLiteralValue>>, U, L, R>;
1373
+ };
1374
+ type TFromPropertyKeys$2<K extends PropertyKey[], U extends TSchema, L extends TSchema, R extends TSchema, Acc extends TProperties = {}> = (K extends [
1375
+ infer LK extends PropertyKey,
1376
+ ...infer RK extends PropertyKey[]
1377
+ ] ? TFromPropertyKeys$2<RK, U, L, R, Acc & TFromPropertyKey$2<LK, U, L, R>> : Acc);
1378
+ type TFromMappedKey$3<K extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema> = (TFromPropertyKeys$2<K["keys"], U, L, R>);
1379
+ export type TExtendsFromMappedKey<T extends TMappedKey, U extends TSchema, L extends TSchema, R extends TSchema, P extends TProperties = TFromMappedKey$3<T, U, L, R>> = (TMappedResult<P>);
1380
+ export type TExtractFromTemplateLiteral<L extends TTemplateLiteral, R extends TSchema> = (TExtract<TTemplateLiteralToUnion<L>, R>);
1381
+ export type TExtractRest<L extends TSchema[], R extends TSchema> = AssertRest<UnionToTuple<{
1382
+ [K in keyof L]: Static<AssertType<L[K]>> extends Static<R> ? L[K] : never;
1383
+ }[number]>> extends infer R extends TSchema[] ? TUnionEvaluated<R> : never;
1384
+ export type TExtract<L extends TSchema, U extends TSchema> = (L extends TUnion<infer S> ? TExtractRest<S, U> : L extends U ? L : TNever);
1385
+ type TFromProperties$16<P extends TProperties, T extends TSchema> = ({
1386
+ [K2 in keyof P]: TExtract<P[K2], T>;
1387
+ });
1388
+ type TFromMappedResult$11<R extends TMappedResult, T extends TSchema> = (TFromProperties$16<R["properties"], T>);
1389
+ export type TExtractFromMappedResult<R extends TMappedResult, T extends TSchema, P extends TProperties = TFromMappedResult$11<R, T>> = (TMappedResult<P>);
1390
+ export type TInstanceType<Type extends TSchema, Result extends TSchema = Type extends TConstructor<infer _Parameters extends TSchema[], infer InstanceType extends TSchema> ? InstanceType : TNever> = Result;
1391
+ type TFromConstructor$1<Args extends TSchema[], Parameters extends TSchema[], InstanceType extends TSchema, Result extends TConstructor = TConstructor<TFromTypes$1<Args, Parameters>, TFromType$1<Args, InstanceType>>> = Result;
1392
+ type TFromFunction$1<Args extends TSchema[], Parameters extends TSchema[], ReturnType extends TSchema, Result extends TFunction = TFunction<TFromTypes$1<Args, Parameters>, TFromType$1<Args, ReturnType>>> = Result;
1393
+ type TFromIntersect$5<Args extends TSchema[], Types extends TSchema[], Result extends TIntersect = TIntersect<TFromTypes$1<Args, Types>>> = Result;
1394
+ type TFromUnion$6<Args extends TSchema[], Types extends TSchema[], Result extends TUnion = TUnion<TFromTypes$1<Args, Types>>> = Result;
1395
+ type TFromTuple$3<Args extends TSchema[], Types extends TSchema[], Result extends TTuple = TTuple<TFromTypes$1<Args, Types>>> = Result;
1396
+ type TFromArray$4<Args extends TSchema[], Type extends TSchema, Result extends TArray = TArray<TFromType$1<Args, Type>>> = Result;
1397
+ type TFromAsyncIterator$1<Args extends TSchema[], Type extends TSchema, Result extends TAsyncIterator = TAsyncIterator<TFromType$1<Args, Type>>> = Result;
1398
+ type TFromIterator$1<Args extends TSchema[], Type extends TSchema, Result extends TIterator = TIterator<TFromType$1<Args, Type>>> = Result;
1399
+ export type TFromPromise<Args extends TSchema[], Type extends TSchema, Result extends TPromise = TPromise<TFromType$1<Args, Type>>> = Result;
1400
+ type TFromObject$5<Args extends TSchema[], Properties extends TProperties, MappedProperties extends TProperties = TFromProperties$17<Args, Properties>, Result extends TSchema = TObject<MappedProperties>> = Result;
1401
+ type TFromRecord$1<Args extends TSchema[], Key extends TSchema, Value extends TSchema, MappedKey extends TSchema = TFromType$1<Args, Key>, MappedValue extends TSchema = TFromType$1<Args, Value>, Result extends TSchema = TRecordOrObject<MappedKey, MappedValue>> = Result;
1402
+ export type TFromArgument<Args extends TSchema[], Index extends number, Result extends TSchema = Index extends keyof Args[Index] ? Args[Index] : TUnknown> = Result;
1403
+ type TFromProperty$1<Args extends TSchema[], Type extends TSchema, IsReadonly extends boolean = Type extends TReadonly<Type> ? true : false, IsOptional extends boolean = Type extends TOptional<Type> ? true : false, Mapped extends TSchema = TFromType$1<Args, Type>, Result extends TSchema = ([
1404
+ IsReadonly,
1405
+ IsOptional
1406
+ ] extends [
1407
+ true,
1408
+ true
1409
+ ] ? TReadonlyOptional<Mapped> : [
1410
+ IsReadonly,
1411
+ IsOptional
1412
+ ] extends [
1413
+ true,
1414
+ false
1415
+ ] ? TReadonly<Mapped> : [
1416
+ IsReadonly,
1417
+ IsOptional
1418
+ ] extends [
1419
+ false,
1420
+ true
1421
+ ] ? TOptional<Mapped> : Mapped)> = Result;
1422
+ type TFromProperties$17<Args extends TSchema[], Properties extends TProperties, Result extends TProperties = {
1423
+ [Key in keyof Properties]: TFromProperty$1<Args, Properties[Key]>;
1424
+ }> = Result;
1425
+ type TFromTypes$1<Args extends TSchema[], Types extends TSchema[], Result extends TSchema[] = [
1426
+ ]> = (Types extends [
1427
+ infer Left extends TSchema,
1428
+ ...infer Right extends TSchema[]
1429
+ ] ? TFromTypes$1<Args, Right, [
1430
+ ...Result,
1431
+ TFromType$1<Args, Left>
1432
+ ]> : Result);
1433
+ type TFromType$1<Args extends TSchema[], Type extends TSchema> = (Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromConstructor$1<Args, Parameters, InstanceType> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromFunction$1<Args, Parameters, ReturnType> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect$5<Args, Types> : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion$6<Args, Types> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple$3<Args, Types> : Type extends TArray<infer Type extends TSchema> ? TFromArray$4<Args, Type> : Type extends TAsyncIterator<infer Type extends TSchema> ? TFromAsyncIterator$1<Args, Type> : Type extends TIterator<infer Type extends TSchema> ? TFromIterator$1<Args, Type> : Type extends TPromise<infer Type extends TSchema> ? TFromPromise<Args, Type> : Type extends TObject<infer Properties extends TProperties> ? TFromObject$5<Args, Properties> : Type extends TRecord<infer Key extends TSchema, infer Value extends TSchema> ? TFromRecord$1<Args, Key, Value> : Type extends TArgument<infer Index extends number> ? TFromArgument<Args, Index> : Type);
1434
+ /** `[JavaScript]` Instantiates a type with the given parameters */
1435
+ export type TInstantiate<Type extends TSchema, Args extends TSchema[], Result extends TSchema = TFromType$1<Args, Type>> = Result;
1436
+ export type TMappedIntrinsicPropertyKey<K extends PropertyKey, M extends IntrinsicMode> = {
1437
+ [_ in K]: TIntrinsic<TLiteral<Assert<K, TLiteralValue>>, M>;
1438
+ };
1439
+ export type TMappedIntrinsicPropertyKeys<K extends PropertyKey[], M extends IntrinsicMode, Acc extends TProperties = {}> = (K extends [
1440
+ infer L extends PropertyKey,
1441
+ ...infer R extends PropertyKey[]
1442
+ ] ? TMappedIntrinsicPropertyKeys<R, M, Acc & TMappedIntrinsicPropertyKey<L, M>> : Acc);
1443
+ export type TMappedIntrinsicProperties<K extends TMappedKey, M extends IntrinsicMode> = (TMappedIntrinsicPropertyKeys<K["keys"], M>);
1444
+ export type TIntrinsicFromMappedKey<K extends TMappedKey, M extends IntrinsicMode, P extends TProperties = TMappedIntrinsicProperties<K, M>> = (TMappedResult<P>);
1445
+ export type IntrinsicMode = "Uppercase" | "Lowercase" | "Capitalize" | "Uncapitalize";
1446
+ type TFromTemplateLiteral$1<T extends TTemplateLiteralKind[], M extends IntrinsicMode> = M extends IntrinsicMode ? T extends [
1447
+ infer L extends TTemplateLiteralKind,
1448
+ ...infer R extends TTemplateLiteralKind[]
1449
+ ] ? [
1450
+ TIntrinsic<L, M>,
1451
+ ...TFromTemplateLiteral$1<R, M>
1452
+ ] : T : T;
1453
+ export type TFromLiteralValue<T, M extends IntrinsicMode> = (T extends string ? M extends "Uncapitalize" ? Uncapitalize<T> : M extends "Capitalize" ? Capitalize<T> : M extends "Uppercase" ? Uppercase<T> : M extends "Lowercase" ? Lowercase<T> : string : T);
1454
+ type TFromRest$6<T extends TSchema[], M extends IntrinsicMode, Acc extends TSchema[] = [
1455
+ ]> = T extends [
1456
+ infer L extends TSchema,
1457
+ ...infer R extends TSchema[]
1458
+ ] ? TFromRest$6<R, M, [
1459
+ ...Acc,
1460
+ TIntrinsic<L, M>
1461
+ ]> : Acc;
1462
+ export type TIntrinsic<T extends TSchema, M extends IntrinsicMode> = T extends TMappedKey ? TIntrinsicFromMappedKey<T, M> : T extends TTemplateLiteral<infer S> ? TTemplateLiteral<TFromTemplateLiteral$1<S, M>> : T extends TUnion<infer S> ? TUnion<TFromRest$6<S, M>> : T extends TLiteral<infer S> ? TLiteral<TFromLiteralValue<S, M>> : T;
1463
+ export type TCapitalize<T extends TSchema> = TIntrinsic<T, "Capitalize">;
1464
+ export type TLowercase<T extends TSchema> = TIntrinsic<T, "Lowercase">;
1465
+ export type TUncapitalize<T extends TSchema> = TIntrinsic<T, "Uncapitalize">;
1466
+ export type TUppercase<T extends TSchema> = TIntrinsic<T, "Uppercase">;
1467
+ export type TParameters<Type extends TSchema> = (Type extends TFunction<infer Parameters extends TSchema[], infer _ReturnType extends TSchema> ? TTuple<Parameters> : TNever);
1468
+ export type TRestResolve<T extends TSchema> = T extends TIntersect<infer S extends TSchema[]> ? S : T extends TUnion<infer S extends TSchema[]> ? S : T extends TTuple<infer S extends TSchema[]> ? S : [
1469
+ ];
1470
+ export type TRest<T extends TSchema> = TRestResolve<T>;
1471
+ export type TReturnType<Type extends TSchema, Result extends TSchema = Type extends TFunction<infer _Parameters extends TSchema[], infer ReturnType extends TSchema> ? ReturnType : TNever> = Result;
1472
+ declare class JsonTypeBuilder {
1473
+ /** `[Json]` Creates a Readonly and Optional property */
1474
+ ReadonlyOptional<Type extends TSchema>(type: Type): TReadonlyOptional<Type>;
1475
+ /** `[Json]` Creates a Readonly property */
1476
+ Readonly<Type extends TMappedResult, Flag extends boolean>(type: Type, enable: Flag): TReadonlyFromMappedResult<Type, Flag>;
1477
+ /** `[Json]` Creates a Readonly property */
1478
+ Readonly<Type extends TSchema, Flag extends boolean>(type: Type, enable: Flag): TReadonlyWithFlag<Type, Flag>;
1479
+ /** `[Json]` Creates a Optional property */
1480
+ Readonly<Type extends TMappedResult>(type: Type): TReadonlyFromMappedResult<Type, true>;
1481
+ /** `[Json]` Creates a Readonly property */
1482
+ Readonly<Type extends TSchema>(type: Type): TReadonlyWithFlag<Type, true>;
1483
+ /** `[Json]` Creates a Optional property */
1484
+ Optional<Type extends TMappedResult, Flag extends boolean>(type: Type, enable: Flag): TOptionalFromMappedResult<Type, Flag>;
1485
+ /** `[Json]` Creates a Optional property */
1486
+ Optional<Type extends TSchema, Flag extends boolean>(type: Type, enable: Flag): TOptionalWithFlag<Type, Flag>;
1487
+ /** `[Json]` Creates a Optional property */
1488
+ Optional<Type extends TMappedResult>(type: Type): TOptionalFromMappedResult<Type, true>;
1489
+ /** `[Json]` Creates a Optional property */
1490
+ Optional<Type extends TSchema>(type: Type): TOptionalWithFlag<Type, true>;
1491
+ /** `[Json]` Creates an Any type */
1492
+ Any(options?: SchemaOptions): TAny;
1493
+ /** `[Json]` Creates an Array type */
1494
+ Array<Type extends TSchema>(items: Type, options?: ArrayOptions): TArray<Type>;
1495
+ /** `[Json]` Creates a Boolean type */
1496
+ Boolean(options?: SchemaOptions): TBoolean;
1497
+ /** `[Json]` Intrinsic function to Capitalize LiteralString types */
1498
+ Capitalize<T extends TSchema>(schema: T, options?: SchemaOptions): TCapitalize<T>;
1499
+ /** `[Json]` Creates a Composite object type */
1500
+ Composite<T extends TSchema[]>(schemas: [
1501
+ ...T
1502
+ ], options?: ObjectOptions): TComposite<T>;
1503
+ /** `[JavaScript]` Creates a readonly const type from the given value. */
1504
+ Const</* const (not supported in 4.0) */ T>(value: T, options?: SchemaOptions): TConst<T>;
1505
+ /** `[Json]` Creates a Enum type */
1506
+ Enum<V extends TEnumValue, T extends Record<TEnumKey, V>>(item: T, options?: SchemaOptions): TEnum<T>;
1507
+ /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */
1508
+ Exclude<L extends TMappedResult, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromMappedResult<L, R>;
1509
+ /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */
1510
+ Exclude<L extends TTemplateLiteral, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromTemplateLiteral<L, R>;
1511
+ /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */
1512
+ Exclude<L extends TSchema, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude<L, R>;
1513
+ /** `[Json]` Creates a Conditional type */
1514
+ Extends<L extends TMappedResult, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedResult<L, R, T, F>;
1515
+ /** `[Json]` Creates a Conditional type */
1516
+ Extends<L extends TMappedKey, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedKey<L, R, T, F>;
1517
+ /** `[Json]` Creates a Conditional type */
1518
+ Extends<L extends TSchema, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtends<L, R, T, F>;
1519
+ /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */
1520
+ Extract<L extends TMappedResult, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtractFromMappedResult<L, R>;
1521
+ /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */
1522
+ Extract<L extends TTemplateLiteral, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtractFromTemplateLiteral<L, R>;
1523
+ /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */
1524
+ Extract<L extends TSchema, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtract<L, R>;
1525
+ /** `[Json]` Returns an Indexed property type for the given keys */
1526
+ Index<Type extends TRef, Key extends TSchema>(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed<Type, Key>;
1527
+ /** `[Json]` Returns an Indexed property type for the given keys */
1528
+ Index<Type extends TSchema, Key extends TRef>(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed<Type, Key>;
1529
+ /** `[Json]` Returns an Indexed property type for the given keys */
1530
+ Index<Type extends TRef, Key extends TRef>(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed<Type, Key>;
1531
+ /** `[Json]` Returns an Indexed property type for the given keys */
1532
+ Index<Type extends TSchema, MappedResult extends TMappedResult>(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TIndexFromMappedResult<Type, MappedResult>;
1533
+ /** `[Json]` Returns an Indexed property type for the given keys */
1534
+ Index<Type extends TSchema, MappedKey extends TMappedKey>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TIndexFromMappedKey<Type, MappedKey>;
1535
+ /** `[Json]` Returns an Indexed property type for the given keys */
1536
+ Index<Type extends TSchema, Key extends TSchema, PropertyKeys extends PropertyKey[] = TIndexPropertyKeys<Key>>(T: Type, K: Key, options?: SchemaOptions): TIndex<Type, PropertyKeys>;
1537
+ /** `[Json]` Returns an Indexed property type for the given keys */
1538
+ Index<Type extends TSchema, PropertyKeys extends PropertyKey[]>(type: Type, propertyKeys: readonly [
1539
+ ...PropertyKeys
1540
+ ], options?: SchemaOptions): TIndex<Type, PropertyKeys>;
1541
+ /** `[Json]` Creates an Integer type */
1542
+ Integer(options?: IntegerOptions): TInteger;
1543
+ /** `[Json]` Creates an Intersect type */
1544
+ Intersect<Types extends TSchema[]>(types: [
1545
+ ...Types
1546
+ ], options?: IntersectOptions): Intersect<Types>;
1547
+ /** `[Json]` Creates a KeyOf type */
1548
+ KeyOf<Type extends TSchema>(type: Type, options?: SchemaOptions): TKeyOf<Type>;
1549
+ /** `[Json]` Creates a Literal type */
1550
+ Literal<LiteralValue extends TLiteralValue>(literalValue: LiteralValue, options?: SchemaOptions): TLiteral<LiteralValue>;
1551
+ /** `[Json]` Intrinsic function to Lowercase LiteralString types */
1552
+ Lowercase<Type extends TSchema>(type: Type, options?: SchemaOptions): TLowercase<Type>;
1553
+ /** `[Json]` Creates a Mapped object type */
1554
+ Mapped<K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>, F extends TMappedFunction<I> = TMappedFunction<I>, R extends TMapped<I, F> = TMapped<I, F>>(key: K, map: F, options?: ObjectOptions): R;
1555
+ /** `[Json]` Creates a Mapped object type */
1556
+ Mapped<K extends PropertyKey[], F extends TMappedFunction<K> = TMappedFunction<K>, R extends TMapped<K, F> = TMapped<K, F>>(key: [
1557
+ ...K
1558
+ ], map: F, options?: ObjectOptions): R;
1559
+ /** `[Json]` Creates a Type Definition Module. */
1560
+ Module<Properties extends TProperties>(properties: Properties): TModule<Properties>;
1561
+ /** `[Json]` Creates a Never type */
1562
+ Never(options?: SchemaOptions): TNever;
1563
+ /** `[Json]` Creates a Not type */
1564
+ Not<T extends TSchema>(type: T, options?: SchemaOptions): TNot<T>;
1565
+ /** `[Json]` Creates a Null type */
1566
+ Null(options?: SchemaOptions): TNull;
1567
+ /** `[Json]` Creates a Number type */
1568
+ Number(options?: NumberOptions): TNumber;
1569
+ /** `[Json]` Creates an Object type */
1570
+ Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
1571
+ /** `[Json]` Constructs a type whose keys are picked from the given type */
1572
+ Omit<Type extends TSchema, Key extends PropertyKey[]>(type: Type, key: readonly [
1573
+ ...Key
1574
+ ], options?: SchemaOptions): TOmit<Type, Key>;
1575
+ /** `[Json]` Constructs a type whose keys are picked from the given type */
1576
+ Omit<Type extends TSchema, Key extends TSchema>(type: Type, key: Key, options?: SchemaOptions): TOmit<Type, Key>;
1577
+ /** `[Json]` Constructs a type where all properties are optional */
1578
+ Partial<MappedResult extends TMappedResult>(type: MappedResult, options?: SchemaOptions): TPartialFromMappedResult<MappedResult>;
1579
+ /** `[Json]` Constructs a type where all properties are optional */
1580
+ Partial<Type extends TSchema>(type: Type, options?: SchemaOptions): TPartial<Type>;
1581
+ /** `[Json]` Constructs a type whose keys are picked from the given type */
1582
+ Pick<Type extends TSchema, Key extends PropertyKey[]>(type: Type, key: readonly [
1583
+ ...Key
1584
+ ], options?: SchemaOptions): TPick<Type, Key>;
1585
+ /** `[Json]` Constructs a type whose keys are picked from the given type */
1586
+ Pick<Type extends TSchema, Key extends TSchema>(type: Type, key: Key, options?: SchemaOptions): TPick<Type, Key>;
1587
+ /** `[Json]` Creates a Record type */
1588
+ Record<Key extends TSchema, Value extends TSchema>(key: Key, value: Value, options?: ObjectOptions): TRecordOrObject<Key, Value>;
1589
+ /** `[Json]` Creates a Recursive type */
1590
+ Recursive<T extends TSchema>(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive<T>;
1591
+ /** `[Json]` Creates a Ref type.*/
1592
+ Ref<Ref extends string>($ref: Ref, options?: SchemaOptions): TRef<Ref>;
1593
+ /**
1594
+ * @deprecated `[Json]` Creates a Ref type. This signature was deprecated in 0.34.0 where Ref requires callers to pass
1595
+ * a `string` value for the reference (and not a schema).
1596
+ *
1597
+ * To adhere to the 0.34.0 signature, Ref implementations should be updated to the following.
1598
+ *
1599
+ * ```typescript
1600
+ * // pre-0.34.0
1601
+ *
1602
+ * const T = Type.String({ $id: 'T' })
1603
+ *
1604
+ * const R = Type.Ref(T)
1605
+ * ```
1606
+ * should be changed to the following
1607
+ *
1608
+ * ```typescript
1609
+ * // post-0.34.0
1610
+ *
1611
+ * const T = Type.String({ $id: 'T' })
1612
+ *
1613
+ * const R = Type.Unsafe<Static<typeof T>>(Type.Ref('T'))
1614
+ * ```
1615
+ * You can also create a generic function to replicate the pre-0.34.0 signature if required
1616
+ *
1617
+ * ```typescript
1618
+ * const LegacyRef = <T extends TSchema>(schema: T) => Type.Unsafe<Static<T>>(Type.Ref(schema.$id!))
1619
+ * ```
1620
+ */
1621
+ Ref<Type extends TSchema>(type: Type, options?: SchemaOptions): TRefUnsafe<Type>;
1622
+ /** `[Json]` Constructs a type where all properties are required */
1623
+ Required<MappedResult extends TMappedResult>(type: MappedResult, options?: SchemaOptions): TRequiredFromMappedResult<MappedResult>;
1624
+ /** `[Json]` Constructs a type where all properties are required */
1625
+ Required<Type extends TSchema>(type: Type, options?: SchemaOptions): TRequired<Type>;
1626
+ /** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */
1627
+ Rest<Type extends TSchema>(type: Type): TRest<Type>;
1628
+ /** `[Json]` Creates a String type */
1629
+ String(options?: StringOptions): TString;
1630
+ /** `[Json]` Creates a TemplateLiteral type from template dsl string */
1631
+ TemplateLiteral<Syntax extends string>(syntax: Syntax, options?: SchemaOptions): TTemplateLiteralSyntax<Syntax>;
1632
+ /** `[Json]` Creates a TemplateLiteral type */
1633
+ TemplateLiteral<Kinds extends TTemplateLiteralKind[]>(kinds: [
1634
+ ...Kinds
1635
+ ], options?: SchemaOptions): TTemplateLiteral<Kinds>;
1636
+ /** `[Json]` Creates a Transform type */
1637
+ Transform<Type extends TSchema>(type: Type): TransformDecodeBuilder<Type>;
1638
+ /** `[Json]` Creates a Tuple type */
1639
+ Tuple<Types extends TSchema[]>(types: [
1640
+ ...Types
1641
+ ], options?: SchemaOptions): TTuple<Types>;
1642
+ /** `[Json]` Intrinsic function to Uncapitalize LiteralString types */
1643
+ Uncapitalize<Type extends TSchema>(type: Type, options?: SchemaOptions): TUncapitalize<Type>;
1644
+ /** `[Json]` Creates a Union type */
1645
+ Union<Types extends TSchema[]>(types: [
1646
+ ...Types
1647
+ ], options?: SchemaOptions): Union<Types>;
1648
+ /** `[Json]` Creates an Unknown type */
1649
+ Unknown(options?: SchemaOptions): TUnknown;
1650
+ /** `[Json]` Creates a Unsafe type that will infers as the generic argument T */
1651
+ Unsafe<T>(options?: UnsafeOptions): TUnsafe<T>;
1652
+ /** `[Json]` Intrinsic function to Uppercase LiteralString types */
1653
+ Uppercase<T extends TSchema>(schema: T, options?: SchemaOptions): TUppercase<T>;
1654
+ }
1655
+ declare class JavaScriptTypeBuilder extends JsonTypeBuilder {
1656
+ /** `[JavaScript]` Creates a Generic Argument Type */
1657
+ Argument<Index extends number>(index: Index): TArgument<Index>;
1658
+ /** `[JavaScript]` Creates a AsyncIterator type */
1659
+ AsyncIterator<Type extends TSchema>(items: Type, options?: SchemaOptions): TAsyncIterator<Type>;
1660
+ /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */
1661
+ Awaited<Type extends TSchema>(schema: Type, options?: SchemaOptions): TAwaited<Type>;
1662
+ /** `[JavaScript]` Creates a BigInt type */
1663
+ BigInt(options?: BigIntOptions): TBigInt;
1664
+ /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */
1665
+ ConstructorParameters<Type extends TSchema>(schema: Type, options?: SchemaOptions): TConstructorParameters<Type>;
1666
+ /** `[JavaScript]` Creates a Constructor type */
1667
+ Constructor<Parameters extends TSchema[], InstanceType extends TSchema>(parameters: [
1668
+ ...Parameters
1669
+ ], instanceType: InstanceType, options?: SchemaOptions): TConstructor<Parameters, InstanceType>;
1670
+ /** `[JavaScript]` Creates a Date type */
1671
+ Date(options?: DateOptions): TDate;
1672
+ /** `[JavaScript]` Creates a Function type */
1673
+ Function<Parameters extends TSchema[], ReturnType extends TSchema>(parameters: [
1674
+ ...Parameters
1675
+ ], returnType: ReturnType, options?: SchemaOptions): TFunction<Parameters, ReturnType>;
1676
+ /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */
1677
+ InstanceType<Type extends TSchema>(schema: Type, options?: SchemaOptions): TInstanceType<Type>;
1678
+ /** `[JavaScript]` Instantiates a type with the given parameters */
1679
+ Instantiate<Type extends TSchema, Parameters extends TSchema[]>(schema: Type, parameters: [
1680
+ ...Parameters
1681
+ ]): TInstantiate<Type, Parameters>;
1682
+ /** `[JavaScript]` Creates an Iterator type */
1683
+ Iterator<Type extends TSchema>(items: Type, options?: SchemaOptions): TIterator<Type>;
1684
+ /** `[JavaScript]` Extracts the Parameters from the given Function type */
1685
+ Parameters<Type extends TSchema>(schema: Type, options?: SchemaOptions): TParameters<Type>;
1686
+ /** `[JavaScript]` Creates a Promise type */
1687
+ Promise<Type extends TSchema>(item: Type, options?: SchemaOptions): TPromise<Type>;
1688
+ /** `[JavaScript]` Creates a RegExp type */
1689
+ RegExp(pattern: string, options?: RegExpOptions): TRegExp;
1690
+ /** `[JavaScript]` Creates a RegExp type */
1691
+ RegExp(regex: RegExp, options?: RegExpOptions): TRegExp;
1692
+ /** `[JavaScript]` Extracts the ReturnType from the given Function type */
1693
+ ReturnType<Type extends TSchema>(type: Type, options?: SchemaOptions): TReturnType<Type>;
1694
+ /** `[JavaScript]` Creates a Symbol type */
1695
+ Symbol(options?: SchemaOptions): TSymbol;
1696
+ /** `[JavaScript]` Creates a Undefined type */
1697
+ Undefined(options?: SchemaOptions): TUndefined;
1698
+ /** `[JavaScript]` Creates a Uint8Array type */
1699
+ Uint8Array(options?: Uint8ArrayOptions): TUint8Array;
1700
+ /** `[JavaScript]` Creates a Void type */
1701
+ Void(options?: SchemaOptions): TVoid;
1702
+ }
1703
+ declare const TYPED_INPUT_TYPES: readonly [
1704
+ "msg",
1705
+ "flow",
1706
+ "global",
1707
+ "str",
1708
+ "num",
1709
+ "bool",
1710
+ "json",
1711
+ "bin",
1712
+ "re",
1713
+ "jsonata",
1714
+ "date",
1715
+ "env",
1716
+ "node",
1717
+ "cred"
1718
+ ];
1719
+ export interface TNodeRef<T = any> extends TSchema {
1720
+ [Kind]: "NodeRef";
1721
+ static: T;
1722
+ type: "string";
1723
+ "x-nrg-node-type"?: string;
1724
+ }
1725
+ export type ResolveNodeRefs<T> = T extends TNodeRef<infer N> ? N : T extends (...args: any[]) => any ? T : T extends Array<infer Item> ? ResolveNodeRefs<Item>[] : T extends object ? {
1726
+ [K in keyof T]: ResolveNodeRefs<T[K]>;
1727
+ } : T;
1728
+ export type Infer<T extends TSchema> = ResolveNodeRefs<Static<T>>;
1729
+ export type TypedInputType = (typeof TYPED_INPUT_TYPES)[number];
1730
+ export interface TTypedInput extends TSchema {
1731
+ [Kind]: "TypedInput";
1732
+ static: {
1733
+ value: string | number | boolean | null;
1734
+ type: TypedInputType;
1735
+ };
1736
+ }
1737
+ export interface NrgFormOptions {
1738
+ icon?: string;
1739
+ typedInputTypes?: string[];
1740
+ editorLanguage?: string;
1741
+ toggle?: boolean;
1742
+ }
1743
+ export interface Schema<T extends TProperties = TProperties> extends TObject<T> {
1744
+ $id: string;
1745
+ }
1746
+ export interface NodeRedRuntimeSettings {
1747
+ userDir?: string;
1748
+ nodesDir?: string | string[];
1749
+ flowFile?: string;
1750
+ flowFilePretty?: boolean;
1751
+ credentialSecret?: string | false;
1752
+ requireHttps?: boolean;
1753
+ https?: {
1754
+ key: string;
1755
+ cert: string;
1756
+ } | (() => Promise<{
1757
+ key: string;
1758
+ cert: string;
1759
+ }> | {
1760
+ key: string;
1761
+ cert: string;
1762
+ });
1763
+ httpsRefreshInterval?: number;
1764
+ httpAdminRoot?: string;
1765
+ httpNodeRoot?: string;
1766
+ httpNodeCors?: {
1767
+ origin: string;
1768
+ methods: string;
1769
+ };
1770
+ httpStatic?: string | {
1771
+ path: string;
1772
+ root: string;
1773
+ }[];
1774
+ httpStaticRoot?: string;
1775
+ httpAdminMiddleware?: (req: unknown, res: unknown, next: () => void) => void;
1776
+ httpNodeMiddleware?: (req: unknown, res: unknown, next: () => void) => void;
1777
+ httpServerOptions?: Record<string, unknown>;
1778
+ adminAuth?: {
1779
+ type?: "credentials" | "strategy";
1780
+ users?: {
1781
+ username: string;
1782
+ password: string;
1783
+ permissions?: string | string[];
1784
+ }[];
1785
+ default?: {
1786
+ permissions?: string | string[];
1787
+ };
1788
+ tokens?: (token: string) => Promise<{
1789
+ user: string;
1790
+ permissions: string | string[];
1791
+ } | null>;
1792
+ tokenHeader: "string";
1793
+ sessionExpiryTime?: number;
1794
+ [key: string]: unknown;
1795
+ };
1796
+ httpNodeAuth?: {
1797
+ user?: string;
1798
+ pass?: string;
1799
+ };
1800
+ httpStaticAuth?: {
1801
+ user?: string;
1802
+ pass?: string;
1803
+ };
1804
+ lang?: "en-US" | "de" | "es-ES" | "fr" | "ko" | "pt-BR" | "ru" | "ja" | "zh-CN" | "zh-TW";
1805
+ diagnostics?: {
1806
+ enabled?: boolean;
1807
+ ui?: boolean;
1808
+ };
1809
+ runtimeState?: {
1810
+ enabled?: boolean;
1811
+ ui?: boolean;
1812
+ };
1813
+ disableEditor?: boolean;
1814
+ editorTheme?: {
1815
+ page?: {
1816
+ title?: string;
1817
+ favicon?: string;
1818
+ css?: string | string[];
1819
+ scripts?: string | string[];
1820
+ };
1821
+ header?: {
1822
+ title?: string;
1823
+ image?: string;
1824
+ url?: string;
1825
+ };
1826
+ deployButton?: {
1827
+ type?: "simple" | "default";
1828
+ label?: string;
1829
+ icon?: string;
1830
+ };
1831
+ menu?: {
1832
+ "menu-item-import-library"?: boolean;
1833
+ "menu-item-export-library"?: boolean;
1834
+ "menu-item-keyboard-shortcuts"?: boolean;
1835
+ "menu-item-help"?: {
1836
+ label?: string;
1837
+ url?: string;
1838
+ };
1839
+ [menuItem: string]: boolean | {
1840
+ label?: string;
1841
+ url?: string;
1842
+ } | undefined;
1843
+ };
1844
+ userMenu?: boolean;
1845
+ login?: {
1846
+ image?: string;
1847
+ };
1848
+ logout?: {
1849
+ redirect?: string;
1850
+ };
1851
+ palette?: {
1852
+ catalogues?: string[];
1853
+ categories?: string[];
1854
+ theme?: {
1855
+ category: string;
1856
+ type: string;
1857
+ color: string;
1858
+ }[];
1859
+ };
1860
+ projects?: {
1861
+ enabled?: boolean;
1862
+ workflow?: {
1863
+ mode: "manual" | "auto";
1864
+ };
1865
+ };
1866
+ codeEditor?: {
1867
+ lib?: "monaco" | "ace";
1868
+ options?: Record<string, unknown>;
1869
+ };
1870
+ mermaid?: {
1871
+ theme?: string;
1872
+ };
1873
+ tours?: boolean;
1874
+ theme?: string;
1875
+ [key: string]: unknown;
1876
+ };
1877
+ contextStorage?: {
1878
+ default?: {
1879
+ module?: "memory" | "localfilesystem" | object;
1880
+ config?: Record<string, unknown>;
1881
+ };
1882
+ [store: string]: {
1883
+ module?: "memory" | "localfilesystem" | object;
1884
+ config?: Record<string, unknown>;
1885
+ } | undefined;
1886
+ };
1887
+ exportGlobalContextKeys?: boolean;
1888
+ logging?: {
1889
+ console?: {
1890
+ level?: "fatal" | "error" | "warn" | "info" | "debug" | "trace" | "off";
1891
+ metrics?: boolean;
1892
+ audit?: boolean;
1893
+ };
1894
+ };
1895
+ fileWorkingDirectory?: string;
1896
+ functionExternalModules?: boolean;
1897
+ functionGlobalContext?: Record<string, unknown>;
1898
+ nodeMessageBufferMaxLength?: number;
1899
+ functionTimeout?: number;
1900
+ externalModules?: {
1901
+ autoInstall?: boolean;
1902
+ autoInstallRetry?: number;
1903
+ palette?: {
1904
+ allowInstall?: boolean;
1905
+ allowUpdate?: boolean;
1906
+ allowUpload?: boolean;
1907
+ allowList?: string[];
1908
+ denyList?: string[];
1909
+ allowUpdateList?: string[];
1910
+ denyUpdateList?: string[];
1911
+ };
1912
+ modules?: {
1913
+ allowInstall?: boolean;
1914
+ allowList?: string[];
1915
+ denyList?: string[];
1916
+ };
1917
+ };
1918
+ execMaxBufferSize?: number;
1919
+ debugMaxLength?: number;
1920
+ debugUseColors?: boolean;
1921
+ httpRequestTimeout?: number;
1922
+ mqttReconnectTime?: number;
1923
+ serialReconnectTime?: number;
1924
+ socketReconnectTime?: number;
1925
+ socketTimeout?: number;
1926
+ tcpMsgQueueSize?: number;
1927
+ inboundWebSocketTimeout?: number;
1928
+ tlsConfigDisableLocalFiles?: boolean;
1929
+ webSocketNodeVerifyClient?: (info: {
1930
+ origin: string;
1931
+ req: Http2ServerRequest;
1932
+ secure: boolean;
1933
+ }) => boolean;
1934
+ apiMaxLength?: string;
1935
+ [key: string]: unknown;
1936
+ }
1937
+ export interface NodeRedLog {
1938
+ info(msg: any): void;
1939
+ warn(msg: any): void;
1940
+ error(msg: any, error?: any): void;
1941
+ debug(msg: any): void;
1942
+ trace(msg: any): void;
1943
+ log(msg: {
1944
+ level: number;
1945
+ msg: string;
1946
+ }): void;
1947
+ metric(): boolean;
1948
+ audit(msg: Record<string, any>, req?: any): void;
1949
+ addHandler(handler: (msg: any) => void): void;
1950
+ removeHandler(handler: (msg: any) => void): void;
1951
+ FATAL: 10;
1952
+ ERROR: 20;
1953
+ WARN: 30;
1954
+ INFO: 40;
1955
+ DEBUG: 50;
1956
+ TRACE: 60;
1957
+ AUDIT: 98;
1958
+ METRIC: 99;
1959
+ }
1960
+ export interface NodeRedNode {
1961
+ id: string;
1962
+ type: string;
1963
+ name?: string;
1964
+ z?: string;
1965
+ x: number;
1966
+ y: number;
1967
+ g?: string;
1968
+ wires: string[][];
1969
+ credentials: any;
1970
+ _node?: any;
1971
+ send(msg: any): void;
1972
+ receive(msg: any): void;
1973
+ status(status: string | {
1974
+ fill?: string;
1975
+ shape?: string;
1976
+ text?: string;
1977
+ }): void;
1978
+ updateWires(wires: string[][]): void;
1979
+ on(event: string, callback: (...args: any[]) => void): void;
1980
+ log(msg: any): void;
1981
+ warn(msg: any): void;
1982
+ error(msg: any, errorMsg?: any): void;
1983
+ context(): NodeRedNodeContext;
1984
+ [key: string]: any;
1985
+ }
1986
+ export interface NodeRedNodeContext extends NodeRedContextStore {
1987
+ flow: NodeRedContextStore;
1988
+ global: NodeRedContextStore;
1989
+ }
1990
+ export interface NodeRedNodes {
1991
+ registerType(type: string, constructor: any, opts?: any): void;
1992
+ getNode(id: string): (NodeRedNode & {
1993
+ _node?: any;
1994
+ }) | undefined;
1995
+ createNode(node: NodeRedNode, config: Record<string, any>): void;
1996
+ getCredentials(id: string): Record<string, any> | undefined;
1997
+ eachNode(callback: (node: any) => void): void;
1998
+ getType(type: string): any;
1999
+ getNodeInfo(type: string): any;
2000
+ getNodeList(filter?: any): any[];
2001
+ getModuleInfo(module: string): any;
2002
+ installModule(module: string, version?: string): Promise<any>;
2003
+ uninstallModule(module: string): Promise<any>;
2004
+ enableNode(id: string): Promise<any>;
2005
+ disableNode(id: string): Promise<any>;
2006
+ }
2007
+ export interface NodeRedUtil {
2008
+ evaluateNodeProperty(value: any, type: string, node: any, msg: Record<string, any> | undefined, callback: (err: Error | null, result: any) => void): void;
2009
+ generateId(): string;
2010
+ cloneMessage<T = any>(msg: T): T;
2011
+ ensureString(o: any): string;
2012
+ ensureBuffer(o: any): Buffer;
2013
+ compareObjects(obj1: any, obj2: any): boolean;
2014
+ getMessageProperty(msg: any, expr: string): any;
2015
+ setMessageProperty(msg: any, prop: string, value: any, createMissing?: boolean): void;
2016
+ getObjectProperty(obj: any, expr: string): any;
2017
+ setObjectProperty(obj: any, prop: string, value: any, createMissing?: boolean): void;
2018
+ normalisePropertyExpression(str: string, msg?: any, toString?: boolean): string[];
2019
+ normaliseNodeTypeName(name: string): string;
2020
+ prepareJSONataExpression(value: string, node: any): any;
2021
+ evaluateJSONataExpression(expr: any, msg: any, callback: (err: Error | null, result: any) => void): void;
2022
+ parseContextStore(key: string): {
2023
+ store: string | undefined;
2024
+ key: string;
2025
+ };
2026
+ getSetting(node: any, name: string, flow?: any): any;
2027
+ encodeObject(obj: any): any;
2028
+ }
2029
+ export interface NodeRedHooks {
2030
+ add(hookId: string, callback: (event: any) => void | Promise<void>): void;
2031
+ remove(hookId: string): void;
2032
+ trigger(hookId: string, event: any, callback?: (err?: Error) => void): void | Promise<void>;
2033
+ has(hookId: string): boolean;
2034
+ clear(): void;
2035
+ }
2036
+ export type NodeRedRequestHandler = (req: any, res: any, next?: () => void) => void;
2037
+ export interface NodeRedExpressApp {
2038
+ get(path: string, ...handlers: NodeRedRequestHandler[]): void;
2039
+ post(path: string, ...handlers: NodeRedRequestHandler[]): void;
2040
+ put(path: string, ...handlers: NodeRedRequestHandler[]): void;
2041
+ delete(path: string, ...handlers: NodeRedRequestHandler[]): void;
2042
+ patch(path: string, ...handlers: NodeRedRequestHandler[]): void;
2043
+ options(path: string, ...handlers: NodeRedRequestHandler[]): void;
2044
+ head(path: string, ...handlers: NodeRedRequestHandler[]): void;
2045
+ use(path: string | NodeRedRequestHandler, ...handlers: NodeRedRequestHandler[]): void;
2046
+ all(path: string, ...handlers: NodeRedRequestHandler[]): void;
2047
+ }
2048
+ export interface RED {
2049
+ /** Internationalization function */
2050
+ _(key: string, substitutions?: Record<string, string>): string;
2051
+ /** Logging API */
2052
+ log: NodeRedLog;
2053
+ /** Node registry and management */
2054
+ nodes: NodeRedNodes;
2055
+ /** Utility functions */
2056
+ util: NodeRedUtil;
2057
+ /** Hook system for message lifecycle and module events */
2058
+ hooks: NodeRedHooks;
2059
+ /** Runtime event emitter */
2060
+ events: EventEmitter;
2061
+ /** Express app for admin HTTP endpoints */
2062
+ httpAdmin: NodeRedExpressApp;
2063
+ /** Express app for node HTTP endpoints */
2064
+ httpNode: NodeRedExpressApp;
2065
+ /** Runtime settings (user-provided settings plus node-registered settings) */
2066
+ settings: NodeRedRuntimeSettings & Record<string, any>;
2067
+ /** Node-RED version string */
2068
+ version(): string;
2069
+ }
2070
+ export interface NodeRedContextStore {
2071
+ get(key: string, store: string | undefined, callback: (err: Error | null, value: any) => void): void;
2072
+ set(key: string, value: any, store: string | undefined, callback: (err: Error | null) => void): void;
2073
+ keys(store: string | undefined, callback: (err: Error | null, keys: string[]) => void): void;
2074
+ }
2075
+ declare const NodeConfigSchema: TObject<{
2076
+ id: TString;
2077
+ type: TString;
2078
+ name: TString;
2079
+ z: TOptional<TString>;
2080
+ }>;
2081
+ declare const ConfigNodeConfigSchema: TObject<{
2082
+ _users: TArray<TString>;
2083
+ id: TString;
2084
+ type: TString;
2085
+ name: TString;
2086
+ z: TOptional<TString>;
2087
+ }>;
2088
+ declare const IONodeConfigSchema: TObject<{
2089
+ wires: TArray<TArray<TString>>;
2090
+ x: TNumber;
2091
+ y: TNumber;
2092
+ g: TOptional<TString>;
2093
+ id: TString;
2094
+ type: TString;
2095
+ name: TString;
2096
+ z: TOptional<TString>;
2097
+ }>;
2098
+ declare function NodeRef<T extends new (...args: any[]) => any>(nodeClass: T, options?: SchemaOptions): TNodeRef<InstanceType<T>>;
2099
+ declare function TypedInput(options?: SchemaOptions): TTypedInput;
2100
+ export declare const SchemaType: JavaScriptTypeBuilder & {
2101
+ NodeRef: typeof NodeRef;
2102
+ TypedInput: typeof TypedInput;
2103
+ };
2104
+ export declare function defineSchema<T extends TProperties>(properties: T, options: ObjectOptions & {
2105
+ $id: string;
2106
+ }): Schema<T>;
2107
+ export type NodeContextScope = "node" | "flow" | "global";
2108
+ export interface NodeContextStore {
2109
+ get<T = any>(key: string): Promise<T>;
2110
+ set<T = any>(key: string, value: T): Promise<void>;
2111
+ keys(): Promise<string[]>;
2112
+ }
2113
+ export type NodeConfig<TConfig = any> = TConfig & Static<typeof NodeConfigSchema>;
2114
+ export type NodeCredentials<TCredentials = any> = TCredentials;
2115
+ type TypedInput$1 = Static<TTypedInput>;
2116
+ export type IONodeContextScope = NodeContextScope;
2117
+ export type IONodeConfig<TConfig = any> = NodeConfig<TConfig> & Static<typeof IONodeConfigSchema> & {
2118
+ validateInput?: boolean;
2119
+ validateOutput?: boolean;
2120
+ };
2121
+ export type IONodeCredentials<TCredentials = any> = NodeCredentials<TCredentials>;
2122
+ export type IONodeStatus = {
2123
+ fill?: "red" | "green";
2124
+ shape?: "dot" | "string";
2125
+ text?: string;
2126
+ } | string;
2127
+ export type IONodeContext = {
2128
+ (scope: IONodeContextScope, store?: string): NodeContextStore;
2129
+ node: NodeContextStore;
2130
+ flow: NodeContextStore;
2131
+ global: NodeContextStore;
2132
+ };
2133
+ export type HexColor = `#${string}`;
2134
+ export type ConfigNodeContextScope = Exclude<NodeContextScope, "flow">;
2135
+ export type ConfigNodeConfig<TConfig = any> = NodeConfig<TConfig> & Static<typeof ConfigNodeConfigSchema>;
2136
+ export type ConfigNodeCredentials<TCredentials = any> = NodeCredentials<TCredentials>;
2137
+ export type ConfigNodeContext = {
2138
+ (scope: ConfigNodeContextScope, store?: string): NodeContextStore;
2139
+ node: NodeContextStore;
2140
+ global: NodeContextStore;
2141
+ };
2142
+ export declare abstract class IONode<TConfig = any, TCredentials = any, TInput = any, TOutput = any, TSettings = any> extends Node$1<TConfig, TCredentials, TSettings> {
2143
+ static readonly align?: "left" | "right";
2144
+ static readonly color: HexColor;
2145
+ static readonly labelStyle?: "node_label" | "node_label_italic" | string;
2146
+ static readonly paletteLabel?: string;
2147
+ static readonly inputs?: number;
2148
+ static readonly outputs?: number;
2149
+ static readonly inputLabels?: string | string[];
2150
+ static readonly outputLabels?: string | string[];
2151
+ static readonly inputSchema?: Schema;
2152
+ static readonly outputsSchema?: Schema | Schema[];
2153
+ static readonly validateInput: boolean;
2154
+ static readonly validateOutput: boolean;
2155
+ private _send;
2156
+ readonly config: IONodeConfig<TConfig>;
2157
+ protected readonly context: IONodeContext;
2158
+ constructor(RED: RED, node: any, config: IONodeConfig<TConfig>, credentials: IONodeCredentials<TCredentials>);
2159
+ abstract input(msg: TInput): void | Promise<void>;
2160
+ send(msg: TOutput): void;
2161
+ status(status: IONodeStatus): void;
2162
+ updateWires(wires: string[][]): void;
2163
+ receive(msg: TInput): void;
2164
+ get x(): number;
2165
+ get y(): number;
2166
+ get g(): string | undefined;
2167
+ get wires(): string[][];
2168
+ get credentials(): IONodeCredentials<TCredentials> | undefined;
2169
+ }
2170
+ export declare abstract class ConfigNode<TConfig = any, TCredentials = any, TSettings = any> extends Node$1<TConfig, TCredentials, TSettings> {
2171
+ static readonly category: string;
2172
+ readonly config: ConfigNodeConfig<TConfig>;
2173
+ protected readonly context: ConfigNodeContext;
2174
+ constructor(RED: RED, node: any, config: ConfigNodeConfig<TConfig>, credentials: ConfigNodeCredentials<TCredentials>);
2175
+ get userIds(): string[];
2176
+ get users(): Node$1[];
2177
+ getUser<T extends Node$1 = Node$1>(index: number): T | undefined;
2178
+ get credentials(): ConfigNodeCredentials<TCredentials> | undefined;
2179
+ }
2180
+ export type InferOr<T, Fallback> = T extends TSchema ? Static<T> : Fallback;
2181
+ export type InferOutputs<T> = T extends readonly TSchema[] ? {
2182
+ [K in keyof T]: T[K] extends TSchema ? Static<T[K]> : never;
2183
+ } : T extends TSchema ? Static<T> : any;
2184
+ export type BoundIONode<TC extends TSchema | undefined, TCr extends TSchema | undefined, TS extends TSchema | undefined, TIn extends TSchema | undefined, TOut extends TSchema | readonly TSchema[] | undefined> = IONode<InferOr<TC, any>, InferOr<TCr, any>, InferOr<TIn, any>, InferOutputs<TOut>, InferOr<TS, any>>;
2185
+ export type BoundConfigNode<TC extends TSchema | undefined, TCr extends TSchema | undefined, TS extends TSchema | undefined> = ConfigNode<InferOr<TC, any>, InferOr<TCr, any>, InferOr<TS, any>>;
2186
+ export interface IONodeDefinition<TConfigSchema extends TSchema | undefined = undefined, TCredsSchema extends TSchema | undefined = undefined, TSettingsSchema extends TSchema | undefined = undefined, TInputSchema extends TSchema | undefined = undefined, TOutputsSchema extends TSchema | readonly TSchema[] | undefined = undefined> {
2187
+ type: string;
2188
+ category?: string;
2189
+ color?: HexColor;
2190
+ inputs?: 0 | 1;
2191
+ outputs?: number;
2192
+ paletteLabel?: string;
2193
+ inputLabels?: string | string[];
2194
+ outputLabels?: string | string[];
2195
+ align?: "left" | "right";
2196
+ labelStyle?: string;
2197
+ configSchema?: TConfigSchema;
2198
+ credentialsSchema?: TCredsSchema;
2199
+ settingsSchema?: TSettingsSchema;
2200
+ inputSchema?: TInputSchema;
2201
+ outputsSchema?: TOutputsSchema;
2202
+ validateInput?: boolean;
2203
+ validateOutput?: boolean;
2204
+ registered?(RED: RED): void | Promise<void>;
2205
+ created?(this: BoundIONode<TConfigSchema, TCredsSchema, TSettingsSchema, TInputSchema, TOutputsSchema>): void | Promise<void>;
2206
+ closed?(this: BoundIONode<TConfigSchema, TCredsSchema, TSettingsSchema, TInputSchema, TOutputsSchema>, removed?: boolean): void | Promise<void>;
2207
+ input?(this: BoundIONode<TConfigSchema, TCredsSchema, TSettingsSchema, TInputSchema, TOutputsSchema>, msg: InferOr<TInputSchema, any>): void | Promise<void>;
2208
+ }
2209
+ export interface ConfigNodeDefinition<TConfigSchema extends TSchema | undefined = undefined, TCredsSchema extends TSchema | undefined = undefined, TSettingsSchema extends TSchema | undefined = undefined> {
2210
+ type: string;
2211
+ configSchema?: TConfigSchema;
2212
+ credentialsSchema?: TCredsSchema;
2213
+ settingsSchema?: TSettingsSchema;
2214
+ registered?(RED: RED): void | Promise<void>;
2215
+ created?(this: BoundConfigNode<TConfigSchema, TCredsSchema, TSettingsSchema>): void | Promise<void>;
2216
+ closed?(this: BoundConfigNode<TConfigSchema, TCredsSchema, TSettingsSchema>, removed?: boolean): void | Promise<void>;
2217
+ }
2218
+ export interface NodeClassBase {
2219
+ readonly type: string;
2220
+ readonly category: string;
2221
+ new (...args: any[]): any;
2222
+ }
2223
+ declare abstract class Node$1<TConfig = any, TCredentials = any, TSettings = any> {
2224
+ static readonly type: string;
2225
+ static readonly category: "config" | string;
2226
+ static readonly configSchema?: Schema;
2227
+ static readonly credentialsSchema?: Schema;
2228
+ static readonly settingsSchema?: Schema;
2229
+ private static _cachedSettings;
2230
+ static registered?(RED: RED): void | Promise<void>;
2231
+ static validateSettings(RED: RED): void;
2232
+ protected readonly RED: RED;
2233
+ protected readonly node: NodeRedNode;
2234
+ protected readonly context: ConfigNodeContext | IONodeContext;
2235
+ readonly config: NodeConfig<TConfig>;
2236
+ private readonly timers;
2237
+ private readonly intervals;
2238
+ constructor(RED: RED, node: NodeRedNode, config: NodeConfig<TConfig>, credentials: NodeCredentials<TCredentials>);
2239
+ i18n(key: string, substitutions?: Record<string, string>): string;
2240
+ setTimeout(fn: () => void, ms: number): NodeJS.Timeout;
2241
+ setInterval(fn: () => void, ms: number): NodeJS.Timeout;
2242
+ clearTimeout(timer: NodeJS.Timeout): void;
2243
+ clearInterval(interval: NodeJS.Timeout): void;
2244
+ created?(): void | Promise<void>;
2245
+ closed?(removed?: boolean): void | Promise<void>;
2246
+ resolveTypedInput<T = any>(typedInput: TypedInput$1, msg?: Record<string, any>): Promise<T>;
2247
+ on(event: string, callback: (...args: any[]) => void): void;
2248
+ log(msg: any): void;
2249
+ warn(message: string): void;
2250
+ error(message: string, msg?: any): void;
2251
+ get id(): string;
2252
+ get name(): string | undefined;
2253
+ get z(): string | undefined;
2254
+ get credentials(): NodeCredentials<TCredentials> | undefined;
2255
+ get settings(): TSettings;
2256
+ }
2257
+ export declare function defineIONode<TConfigSchema extends TSchema | undefined = undefined, TCredsSchema extends TSchema | undefined = undefined, TSettingsSchema extends TSchema | undefined = undefined, TInputSchema extends TSchema | undefined = undefined, TOutputsSchema extends TSchema | readonly TSchema[] | undefined = undefined>(def: IONodeDefinition<TConfigSchema, TCredsSchema, TSettingsSchema, TInputSchema, TOutputsSchema>): NodeClassBase;
2258
+ export declare function defineConfigNode<TConfigSchema extends TSchema | undefined = undefined, TCredsSchema extends TSchema | undefined = undefined, TSettingsSchema extends TSchema | undefined = undefined>(def: ConfigNodeDefinition<TConfigSchema, TCredsSchema, TSettingsSchema>): NodeClassBase;
2259
+ export declare class NrgError extends Error {
2260
+ constructor(message: string);
2261
+ }
2262
+ export type AnyNodeClass = (abstract new (...args: any[]) => Node$1) & Partial<typeof Node$1>;
2263
+ /**
2264
+ * Registers a custom node with Node-RED.
2265
+ *
2266
+ * @param RED - The Node-RED runtime API object
2267
+ * @param NodeClass - A node class extending Node, IONode, or ConfigNode
2268
+ * @throws If NodeClass does not extend Node
2269
+ * @throws If NodeClass.type is not defined
2270
+ */
2271
+ export declare function registerType(RED: RED, NodeClass: AnyNodeClass): Promise<void>;
2272
+ export type RegistrationFunction = ((RED: RED) => Promise<void>) & {
2273
+ nodes: AnyNodeClass[];
2274
+ };
2275
+ /**
2276
+ * Registers multiple node classes with Node-RED.
2277
+ *
2278
+ * Returns a Node-RED package function that Node-RED calls with the RED
2279
+ * runtime object when loading the package.
2280
+ *
2281
+ * @param nodes - Array of node classes to register
2282
+ */
2283
+ export declare function registerTypes(nodes: AnyNodeClass[]): RegistrationFunction;
2284
+ export interface ModuleDefinition {
2285
+ nodes: AnyNodeClass[];
2286
+ }
2287
+ export declare function defineModule(definition: ModuleDefinition): ModuleDefinition;
2288
+
2289
+ export {
2290
+ Node$1 as Node,
2291
+ };
2292
+
2293
+ export {};