@naturalcycles/nodejs-lib 15.97.1 → 15.97.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,9 +53,9 @@ export declare const j: {
53
53
  withEnumKeys: typeof withEnumKeys;
54
54
  withRegexKeys: typeof withRegexKeys;
55
55
  };
56
- array<OUT, Opt>(itemSchema: JBuilder<OUT, Opt>): JArray<OUT, Opt>;
57
- tuple<const S extends JBuilder<any, any>[]>(items: S): JTuple<S>;
58
- set<OUT, Opt>(itemSchema: JBuilder<OUT, Opt>): JSet2Builder<OUT, Opt>;
56
+ array<OUT, Opt>(itemSchema: JSchema<OUT, Opt>): JArray<OUT, Opt>;
57
+ tuple<const S extends JSchema<any, any>[]>(items: S): JTuple<S>;
58
+ set<OUT, Opt>(itemSchema: JSchema<OUT, Opt>): JSet2Builder<OUT, Opt>;
59
59
  buffer(): JBuilder<Buffer<ArrayBufferLike>, false>;
60
60
  enum<const T extends any>(input: T, opt?: JsonBuilderRuleOpt | undefined): JEnum<T extends readonly (infer U)[] ? U : T extends StringEnum ? T[keyof T] : T extends NumberEnum ? T[keyof T] : never, false>;
61
61
  /**
@@ -69,7 +69,7 @@ export declare const j: {
69
69
  * Use `anyOf` when schemas may overlap (e.g., AccountId | PartnerId with same format).
70
70
  * Use `oneOf` when schemas are mutually exclusive.
71
71
  */
72
- oneOf<B extends readonly JBuilder<any, boolean>[], OUT = BuilderOutUnion<B>>(items: [...B]): JBuilder<OUT, false>;
72
+ oneOf<B extends readonly JSchema<any, boolean>[], OUT = BuilderOutUnion<B>>(items: [...B]): JBuilder<OUT, false>;
73
73
  /**
74
74
  * Use only with primitive values, otherwise this function will throw to avoid bugs.
75
75
  * To validate objects, use `anyOfBy` or `anyOfThese`.
@@ -81,7 +81,7 @@ export declare const j: {
81
81
  * Use `anyOf` when schemas may overlap (e.g., AccountId | PartnerId with same format).
82
82
  * Use `oneOf` when schemas are mutually exclusive.
83
83
  */
84
- anyOf<B extends readonly JBuilder<any, boolean>[], OUT = BuilderOutUnion<B>>(items: [...B]): JBuilder<OUT, false>;
84
+ anyOf<B extends readonly JSchema<any, boolean>[], OUT = BuilderOutUnion<B>>(items: [...B]): JBuilder<OUT, false>;
85
85
  /**
86
86
  * Pick validation schema for an object based on the value of a specific property.
87
87
  *
@@ -103,7 +103,7 @@ export declare const j: {
103
103
  * const schema = j.anyOfThese([successSchema, errorSchema])
104
104
  * ```
105
105
  */
106
- anyOfThese<B extends readonly JBuilder<any, boolean>[], OUT = BuilderOutUnion<B>>(items: [...B]): JBuilder<OUT, false>;
106
+ anyOfThese<B extends readonly JSchema<any, boolean>[], OUT = BuilderOutUnion<B>>(items: [...B]): JBuilder<OUT, false>;
107
107
  and(): {
108
108
  silentBob: () => never;
109
109
  };
@@ -136,6 +136,18 @@ export declare class JSchema<OUT, Opt> implements StandardSchemaV1<unknown, OUT>
136
136
  private _getBuiltSchema;
137
137
  private _getCompiled;
138
138
  getSchema(): JsonSchema;
139
+ /**
140
+ * @deprecated
141
+ * The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
142
+ */
143
+ castAs<T>(): JSchema<T, Opt>;
144
+ /**
145
+ * A helper function that takes a type parameter and compares it with the type inferred from the schema.
146
+ *
147
+ * When the type inferred from the schema differs from the passed-in type,
148
+ * the schema becomes unusable, by turning its type into `never`.
149
+ */
150
+ isOfType<ExpectedType>(): ExactMatch<ExpectedType, OUT> extends true ? this : never;
139
151
  /**
140
152
  * Produces a "clean schema object" without methods.
141
153
  * Same as if it would be JSON.stringified.
@@ -168,13 +180,6 @@ export declare class JSchema<OUT, Opt> implements StandardSchemaV1<unknown, OUT>
168
180
  }
169
181
  export declare class JBuilder<OUT, Opt> extends JSchema<OUT, Opt> {
170
182
  protected setErrorMessage(ruleName: string, errorMessage: string | undefined): void;
171
- /**
172
- * A helper function that takes a type parameter and compares it with the type inferred from the schema.
173
- *
174
- * When the type inferred from the schema differs from the passed-in type,
175
- * the schema becomes unusable, by turning its type into `never`.
176
- */
177
- isOfType<ExpectedType>(): ExactMatch<ExpectedType, OUT> extends true ? this : never;
178
183
  $schema($schema: string): this;
179
184
  $schemaDraft7(): this;
180
185
  $id($id: string): this;
@@ -197,11 +202,6 @@ export declare class JBuilder<OUT, Opt> extends JSchema<OUT, Opt> {
197
202
  */
198
203
  optional<T extends readonly (string | number | boolean | null)[] | undefined = undefined>(optionalValues?: T): T extends readonly (string | number | boolean | null)[] ? JSchema<OUT | undefined, true> : JBuilder<OUT | undefined, true>;
199
204
  nullable(): JBuilder<OUT | null, Opt>;
200
- /**
201
- * @deprecated
202
- * The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
203
- */
204
- castAs<T>(): JBuilder<T, Opt>;
205
205
  /**
206
206
  * Locks the given schema chain and no other modification can be done to it.
207
207
  */
@@ -331,10 +331,10 @@ export declare class JObject<OUT extends AnyObject, Opt extends boolean = false>
331
331
  * When set, the validation will not strip away properties that are not specified explicitly in the schema.
332
332
  */
333
333
  allowAdditionalProperties(): this;
334
- extend<P extends Record<string, JBuilder<any, any>>>(props: P): JObject<Override<OUT, {
335
- [K in keyof P as P[K] extends JBuilder<any, infer IsOpt> ? IsOpt extends true ? never : K : never]: P[K] extends JBuilder<infer OUT2, any> ? OUT2 : never;
334
+ extend<P extends Record<string, JSchema<any, any>>>(props: P): JObject<Override<OUT, {
335
+ [K in keyof P as P[K] extends JSchema<any, infer IsOpt> ? IsOpt extends true ? never : K : never]: P[K] extends JSchema<infer OUT2, any> ? OUT2 : never;
336
336
  } & {
337
- [K in keyof P as P[K] extends JBuilder<any, infer IsOpt> ? IsOpt extends true ? K : never : never]?: P[K] extends JBuilder<infer OUT2, any> ? OUT2 : never;
337
+ [K in keyof P as P[K] extends JSchema<any, infer IsOpt> ? IsOpt extends true ? K : never : never]?: P[K] extends JSchema<infer OUT2, any> ? OUT2 : never;
338
338
  }>, false>;
339
339
  /**
340
340
  * Concatenates another schema to the current schema.
@@ -349,8 +349,8 @@ export declare class JObject<OUT extends AnyObject, Opt extends boolean = false>
349
349
  */
350
350
  dbEntity(): JObject<Override<OUT, {
351
351
  id: string;
352
- created: any;
353
- updated: any;
352
+ created: UnixTimestamp;
353
+ updated: UnixTimestamp;
354
354
  } & {}>, false>;
355
355
  minProperties(minProperties: number): this;
356
356
  maxProperties(maxProperties: number): this;
@@ -384,7 +384,7 @@ export declare class JObjectInfer<PROPS extends Record<string, JSchema<any, any>
384
384
  }[K] : K extends keyof PROPS ? PROPS[K] : never; }, Opt>;
385
385
  }
386
386
  export declare class JArray<OUT, Opt> extends JBuilder<OUT[], Opt> {
387
- constructor(itemsSchema: JBuilder<OUT, Opt>);
387
+ constructor(itemsSchema: JSchema<OUT, Opt>);
388
388
  minLength(minItems: number): this;
389
389
  maxLength(maxItems: number): this;
390
390
  length(exactLength: number): this;
@@ -393,7 +393,7 @@ export declare class JArray<OUT, Opt> extends JBuilder<OUT[], Opt> {
393
393
  unique(): this;
394
394
  }
395
395
  declare class JSet2Builder<OUT, Opt> extends JBuilder<Set2<OUT>, Opt> {
396
- constructor(itemsSchema: JBuilder<OUT, Opt>);
396
+ constructor(itemsSchema: JSchema<OUT, Opt>);
397
397
  min(minItems: number): this;
398
398
  max(maxItems: number): this;
399
399
  }
@@ -401,7 +401,7 @@ export declare class JEnum<OUT extends string | number | boolean | null, Opt ext
401
401
  constructor(enumValues: readonly OUT[], baseType: EnumBaseType, opt?: JsonBuilderRuleOpt);
402
402
  branded<B extends OUT>(): JEnum<B, Opt>;
403
403
  }
404
- export declare class JTuple<ITEMS extends JBuilder<any, any>[]> extends JBuilder<TupleOut<ITEMS>, false> {
404
+ export declare class JTuple<ITEMS extends JSchema<any, any>[]> extends JBuilder<TupleOut<ITEMS>, false> {
405
405
  constructor(items: ITEMS);
406
406
  }
407
407
  declare function object(props: AnyObject): never;
@@ -425,12 +425,12 @@ declare function objectDbEntity<OUT extends BaseDBEntity, EXTRA_KEYS extends Exc
425
425
  } : {
426
426
  updated: BuilderFor<OUT['updated']>;
427
427
  })): JObject<OUT, false>;
428
- declare function record<KS extends JBuilder<any, any>, VS extends JBuilder<any, any>, Opt extends boolean = SchemaOpt<VS>>(keySchema: KS, valueSchema: VS): JObject<Opt extends true ? Partial<Record<SchemaOut<KS>, SchemaOut<VS>>> : Record<SchemaOut<KS>, SchemaOut<VS>>, false>;
429
- declare function withRegexKeys<S extends JBuilder<any, any>>(keyRegex: RegExp | string, schema: S): JObject<StringMap<SchemaOut<S>>, false>;
428
+ declare function record<KS extends JSchema<any, any>, VS extends JSchema<any, any>, Opt extends boolean = SchemaOpt<VS>>(keySchema: KS, valueSchema: VS): JObject<Opt extends true ? Partial<Record<SchemaOut<KS>, SchemaOut<VS>>> : Record<SchemaOut<KS>, SchemaOut<VS>>, false>;
429
+ declare function withRegexKeys<S extends JSchema<any, any>>(keyRegex: RegExp | string, schema: S): JObject<StringMap<SchemaOut<S>>, false>;
430
430
  /**
431
431
  * Builds the object schema with the indicated `keys` and uses the `schema` for their validation.
432
432
  */
433
- declare function withEnumKeys<const T extends readonly (string | number)[] | StringEnum | NumberEnum, S extends JBuilder<any, any>, K extends string | number = EnumKeyUnion<T>, Opt extends boolean = SchemaOpt<S>>(keys: T, schema: S): JObject<Opt extends true ? {
433
+ declare function withEnumKeys<const T extends readonly (string | number)[] | StringEnum | NumberEnum, S extends JSchema<any, any>, K extends string | number = EnumKeyUnion<T>, Opt extends boolean = SchemaOpt<S>>(keys: T, schema: S): JObject<Opt extends true ? {
434
434
  [P in K]?: SchemaOut<S>;
435
435
  } : {
436
436
  [P in K]: SchemaOut<S>;
@@ -621,13 +621,13 @@ type IsAny<T> = 0 extends 1 & T ? true : false;
621
621
  type IsAssignableRelaxed<A, B> = IsAny<RelaxIndexSignature<A>> extends true ? true : [RelaxIndexSignature<A>] extends [B] ? true : false;
622
622
  type ExactMatchBase<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => (T extends B ? 1 : 2) ? (<T>() => T extends B ? 1 : 2) extends <T>() => (T extends A ? 1 : 2) ? true : false : false;
623
623
  type ExactMatch<A, B> = HasAllowExtraKeys<B> extends true ? IsAssignableRelaxed<B, A> : ExactMatchBase<Expand<A>, Expand<B>> extends true ? true : ExactMatchBase<Expand<StripIndexSignatureDeep<A>>, Expand<StripIndexSignatureDeep<B>>>;
624
- type BuilderOutUnion<B extends readonly JBuilder<any, any>[]> = {
625
- [K in keyof B]: B[K] extends JBuilder<infer O, any> ? O : never;
624
+ type BuilderOutUnion<B extends readonly JSchema<any, any>[]> = {
625
+ [K in keyof B]: B[K] extends JSchema<infer O, any> ? O : never;
626
626
  }[number];
627
627
  type AnyOfByOut<D extends Record<PropertyKey, JSchema<any, any>>> = {
628
628
  [K in keyof D]: D[K] extends JSchema<infer O, any> ? O : never;
629
629
  }[keyof D];
630
- type BuilderFor<T> = JBuilder<T, any>;
630
+ type BuilderFor<T> = JSchema<T, any>;
631
631
  export interface JsonBuilderRuleOpt {
632
632
  /**
633
633
  * Text of error message to return when the validation fails for the given rule:
@@ -643,9 +643,9 @@ export interface JsonBuilderRuleOpt {
643
643
  name?: string;
644
644
  }
645
645
  type EnumKeyUnion<T> = T extends readonly (infer U)[] ? U : T extends StringEnum | NumberEnum ? T[keyof T] : never;
646
- type SchemaOut<S> = S extends JBuilder<infer OUT, any> ? OUT : never;
647
- type SchemaOpt<S> = S extends JBuilder<any, infer Opt> ? (Opt extends true ? true : false) : false;
648
- type TupleOut<T extends readonly JBuilder<any, any>[]> = {
649
- [K in keyof T]: T[K] extends JBuilder<infer O, any> ? O : never;
646
+ type SchemaOut<S> = S extends JSchema<infer OUT, any> ? OUT : never;
647
+ type SchemaOpt<S> = S extends JSchema<any, infer Opt> ? (Opt extends true ? true : false) : false;
648
+ type TupleOut<T extends readonly JSchema<any, any>[]> = {
649
+ [K in keyof T]: T[K] extends JSchema<infer O, any> ? O : never;
650
650
  };
651
651
  export {};
@@ -274,6 +274,22 @@ export class JSchema {
274
274
  getSchema() {
275
275
  return this.schema;
276
276
  }
277
+ /**
278
+ * @deprecated
279
+ * The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
280
+ */
281
+ castAs() {
282
+ return this;
283
+ }
284
+ /**
285
+ * A helper function that takes a type parameter and compares it with the type inferred from the schema.
286
+ *
287
+ * When the type inferred from the schema differs from the passed-in type,
288
+ * the schema becomes unusable, by turning its type into `never`.
289
+ */
290
+ isOfType() {
291
+ return this.cloneAndUpdateSchema({ hasIsOfTypeCheck: true });
292
+ }
277
293
  /**
278
294
  * Produces a "clean schema object" without methods.
279
295
  * Same as if it would be JSON.stringified.
@@ -369,15 +385,6 @@ export class JBuilder extends JSchema {
369
385
  this.schema.errorMessages ||= {};
370
386
  this.schema.errorMessages[ruleName] = errorMessage;
371
387
  }
372
- /**
373
- * A helper function that takes a type parameter and compares it with the type inferred from the schema.
374
- *
375
- * When the type inferred from the schema differs from the passed-in type,
376
- * the schema becomes unusable, by turning its type into `never`.
377
- */
378
- isOfType() {
379
- return this.cloneAndUpdateSchema({ hasIsOfTypeCheck: true });
380
- }
381
388
  $schema($schema) {
382
389
  return this.cloneAndUpdateSchema({ $schema });
383
390
  }
@@ -463,13 +470,6 @@ export class JBuilder extends JSchema {
463
470
  anyOf: [this.build(), { type: 'null' }],
464
471
  });
465
472
  }
466
- /**
467
- * @deprecated
468
- * The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
469
- */
470
- castAs() {
471
- return this;
472
- }
473
473
  /**
474
474
  * Locks the given schema chain and no other modification can be done to it.
475
475
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
3
  "type": "module",
4
- "version": "15.97.1",
4
+ "version": "15.97.3",
5
5
  "dependencies": {
6
6
  "@naturalcycles/js-lib": "^15",
7
7
  "@standard-schema/spec": "^1",
@@ -140,15 +140,15 @@ export const j = {
140
140
  withRegexKeys,
141
141
  }),
142
142
 
143
- array<OUT, Opt>(itemSchema: JBuilder<OUT, Opt>): JArray<OUT, Opt> {
143
+ array<OUT, Opt>(itemSchema: JSchema<OUT, Opt>): JArray<OUT, Opt> {
144
144
  return new JArray(itemSchema)
145
145
  },
146
146
 
147
- tuple<const S extends JBuilder<any, any>[]>(items: S): JTuple<S> {
147
+ tuple<const S extends JSchema<any, any>[]>(items: S): JTuple<S> {
148
148
  return new JTuple<S>(items)
149
149
  },
150
150
 
151
- set<OUT, Opt>(itemSchema: JBuilder<OUT, Opt>): JSet2Builder<OUT, Opt> {
151
+ set<OUT, Opt>(itemSchema: JSchema<OUT, Opt>): JSet2Builder<OUT, Opt> {
152
152
  return new JSet2Builder(itemSchema)
153
153
  },
154
154
 
@@ -206,7 +206,7 @@ export const j = {
206
206
  * Use `anyOf` when schemas may overlap (e.g., AccountId | PartnerId with same format).
207
207
  * Use `oneOf` when schemas are mutually exclusive.
208
208
  */
209
- oneOf<B extends readonly JBuilder<any, boolean>[], OUT = BuilderOutUnion<B>>(
209
+ oneOf<B extends readonly JSchema<any, boolean>[], OUT = BuilderOutUnion<B>>(
210
210
  items: [...B],
211
211
  ): JBuilder<OUT, false> {
212
212
  const schemas = items.map(b => b.build())
@@ -231,7 +231,7 @@ export const j = {
231
231
  * Use `anyOf` when schemas may overlap (e.g., AccountId | PartnerId with same format).
232
232
  * Use `oneOf` when schemas are mutually exclusive.
233
233
  */
234
- anyOf<B extends readonly JBuilder<any, boolean>[], OUT = BuilderOutUnion<B>>(
234
+ anyOf<B extends readonly JSchema<any, boolean>[], OUT = BuilderOutUnion<B>>(
235
235
  items: [...B],
236
236
  ): JBuilder<OUT, false> {
237
237
  const schemas = items.map(b => b.build())
@@ -284,7 +284,7 @@ export const j = {
284
284
  * const schema = j.anyOfThese([successSchema, errorSchema])
285
285
  * ```
286
286
  */
287
- anyOfThese<B extends readonly JBuilder<any, boolean>[], OUT = BuilderOutUnion<B>>(
287
+ anyOfThese<B extends readonly JSchema<any, boolean>[], OUT = BuilderOutUnion<B>>(
288
288
  items: [...B],
289
289
  ): JBuilder<OUT, false> {
290
290
  return new JBuilder<OUT, false>({
@@ -396,6 +396,24 @@ export class JSchema<OUT, Opt>
396
396
  return this.schema
397
397
  }
398
398
 
399
+ /**
400
+ * @deprecated
401
+ * The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
402
+ */
403
+ castAs<T>(): JSchema<T, Opt> {
404
+ return this as unknown as JSchema<T, Opt>
405
+ }
406
+
407
+ /**
408
+ * A helper function that takes a type parameter and compares it with the type inferred from the schema.
409
+ *
410
+ * When the type inferred from the schema differs from the passed-in type,
411
+ * the schema becomes unusable, by turning its type into `never`.
412
+ */
413
+ isOfType<ExpectedType>(): ExactMatch<ExpectedType, OUT> extends true ? this : never {
414
+ return this.cloneAndUpdateSchema({ hasIsOfTypeCheck: true }) as any
415
+ }
416
+
399
417
  /**
400
418
  * Produces a "clean schema object" without methods.
401
419
  * Same as if it would be JSON.stringified.
@@ -521,16 +539,6 @@ export class JBuilder<OUT, Opt> extends JSchema<OUT, Opt> {
521
539
  this.schema.errorMessages[ruleName] = errorMessage
522
540
  }
523
541
 
524
- /**
525
- * A helper function that takes a type parameter and compares it with the type inferred from the schema.
526
- *
527
- * When the type inferred from the schema differs from the passed-in type,
528
- * the schema becomes unusable, by turning its type into `never`.
529
- */
530
- isOfType<ExpectedType>(): ExactMatch<ExpectedType, OUT> extends true ? this : never {
531
- return this.cloneAndUpdateSchema({ hasIsOfTypeCheck: true }) as any
532
- }
533
-
534
542
  $schema($schema: string): this {
535
543
  return this.cloneAndUpdateSchema({ $schema })
536
544
  }
@@ -637,14 +645,6 @@ export class JBuilder<OUT, Opt> extends JSchema<OUT, Opt> {
637
645
  })
638
646
  }
639
647
 
640
- /**
641
- * @deprecated
642
- * The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
643
- */
644
- castAs<T>(): JBuilder<T, Opt> {
645
- return this as unknown as JBuilder<T, Opt>
646
- }
647
-
648
648
  /**
649
649
  * Locks the given schema chain and no other modification can be done to it.
650
650
  */
@@ -1063,25 +1063,25 @@ export class JObject<OUT extends AnyObject, Opt extends boolean = false> extends
1063
1063
  return this.cloneAndUpdateSchema({ additionalProperties: true })
1064
1064
  }
1065
1065
 
1066
- extend<P extends Record<string, JBuilder<any, any>>>(
1066
+ extend<P extends Record<string, JSchema<any, any>>>(
1067
1067
  props: P,
1068
1068
  ): JObject<
1069
1069
  Override<
1070
1070
  OUT,
1071
1071
  {
1072
1072
  // required keys
1073
- [K in keyof P as P[K] extends JBuilder<any, infer IsOpt>
1073
+ [K in keyof P as P[K] extends JSchema<any, infer IsOpt>
1074
1074
  ? IsOpt extends true
1075
1075
  ? never
1076
1076
  : K
1077
- : never]: P[K] extends JBuilder<infer OUT2, any> ? OUT2 : never
1077
+ : never]: P[K] extends JSchema<infer OUT2, any> ? OUT2 : never
1078
1078
  } & {
1079
1079
  // optional keys
1080
- [K in keyof P as P[K] extends JBuilder<any, infer IsOpt>
1080
+ [K in keyof P as P[K] extends JSchema<any, infer IsOpt>
1081
1081
  ? IsOpt extends true
1082
1082
  ? K
1083
1083
  : never
1084
- : never]?: P[K] extends JBuilder<infer OUT2, any> ? OUT2 : never
1084
+ : never]?: P[K] extends JSchema<infer OUT2, any> ? OUT2 : never
1085
1085
  }
1086
1086
  >,
1087
1087
  false
@@ -1232,7 +1232,7 @@ export class JObjectInfer<
1232
1232
  }
1233
1233
 
1234
1234
  export class JArray<OUT, Opt> extends JBuilder<OUT[], Opt> {
1235
- constructor(itemsSchema: JBuilder<OUT, Opt>) {
1235
+ constructor(itemsSchema: JSchema<OUT, Opt>) {
1236
1236
  super({
1237
1237
  type: 'array',
1238
1238
  items: itemsSchema.build(),
@@ -1264,7 +1264,7 @@ export class JArray<OUT, Opt> extends JBuilder<OUT[], Opt> {
1264
1264
  }
1265
1265
 
1266
1266
  class JSet2Builder<OUT, Opt> extends JBuilder<Set2<OUT>, Opt> {
1267
- constructor(itemsSchema: JBuilder<OUT, Opt>) {
1267
+ constructor(itemsSchema: JSchema<OUT, Opt>) {
1268
1268
  super({
1269
1269
  type: ['array', 'object'],
1270
1270
  Set2: itemsSchema.build(),
@@ -1302,7 +1302,7 @@ export class JEnum<
1302
1302
  }
1303
1303
  }
1304
1304
 
1305
- export class JTuple<ITEMS extends JBuilder<any, any>[]> extends JBuilder<TupleOut<ITEMS>, false> {
1305
+ export class JTuple<ITEMS extends JSchema<any, any>[]> extends JBuilder<TupleOut<ITEMS>, false> {
1306
1306
  constructor(items: ITEMS) {
1307
1307
  super({
1308
1308
  type: 'array',
@@ -1366,8 +1366,8 @@ function objectDbEntity(props: AnyObject): any {
1366
1366
  }
1367
1367
 
1368
1368
  function record<
1369
- KS extends JBuilder<any, any>,
1370
- VS extends JBuilder<any, any>,
1369
+ KS extends JSchema<any, any>,
1370
+ VS extends JSchema<any, any>,
1371
1371
  Opt extends boolean = SchemaOpt<VS>,
1372
1372
  >(
1373
1373
  keySchema: KS,
@@ -1402,7 +1402,7 @@ function record<
1402
1402
  })
1403
1403
  }
1404
1404
 
1405
- function withRegexKeys<S extends JBuilder<any, any>>(
1405
+ function withRegexKeys<S extends JSchema<any, any>>(
1406
1406
  keyRegex: RegExp | string,
1407
1407
  schema: S,
1408
1408
  ): JObject<StringMap<SchemaOut<S>>, false> {
@@ -1428,7 +1428,7 @@ function withRegexKeys<S extends JBuilder<any, any>>(
1428
1428
  */
1429
1429
  function withEnumKeys<
1430
1430
  const T extends readonly (string | number)[] | StringEnum | NumberEnum,
1431
- S extends JBuilder<any, any>,
1431
+ S extends JSchema<any, any>,
1432
1432
  K extends string | number = EnumKeyUnion<T>,
1433
1433
  Opt extends boolean = SchemaOpt<S>,
1434
1434
  >(
@@ -2117,15 +2117,15 @@ type ExactMatch<A, B> =
2117
2117
  ? true
2118
2118
  : ExactMatchBase<Expand<StripIndexSignatureDeep<A>>, Expand<StripIndexSignatureDeep<B>>>
2119
2119
 
2120
- type BuilderOutUnion<B extends readonly JBuilder<any, any>[]> = {
2121
- [K in keyof B]: B[K] extends JBuilder<infer O, any> ? O : never
2120
+ type BuilderOutUnion<B extends readonly JSchema<any, any>[]> = {
2121
+ [K in keyof B]: B[K] extends JSchema<infer O, any> ? O : never
2122
2122
  }[number]
2123
2123
 
2124
2124
  type AnyOfByOut<D extends Record<PropertyKey, JSchema<any, any>>> = {
2125
2125
  [K in keyof D]: D[K] extends JSchema<infer O, any> ? O : never
2126
2126
  }[keyof D]
2127
2127
 
2128
- type BuilderFor<T> = JBuilder<T, any>
2128
+ type BuilderFor<T> = JSchema<T, any>
2129
2129
 
2130
2130
  export interface JsonBuilderRuleOpt {
2131
2131
  /**
@@ -2151,9 +2151,9 @@ type EnumKeyUnion<T> =
2151
2151
  ? T[keyof T]
2152
2152
  : never
2153
2153
 
2154
- type SchemaOut<S> = S extends JBuilder<infer OUT, any> ? OUT : never
2155
- type SchemaOpt<S> = S extends JBuilder<any, infer Opt> ? (Opt extends true ? true : false) : false
2154
+ type SchemaOut<S> = S extends JSchema<infer OUT, any> ? OUT : never
2155
+ type SchemaOpt<S> = S extends JSchema<any, infer Opt> ? (Opt extends true ? true : false) : false
2156
2156
 
2157
- type TupleOut<T extends readonly JBuilder<any, any>[]> = {
2158
- [K in keyof T]: T[K] extends JBuilder<infer O, any> ? O : never
2157
+ type TupleOut<T extends readonly JSchema<any, any>[]> = {
2158
+ [K in keyof T]: T[K] extends JSchema<infer O, any> ? O : never
2159
2159
  }