@naturalcycles/nodejs-lib 15.89.0 → 15.89.1
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.
|
@@ -254,7 +254,7 @@ export declare class JsonSchemaIsoDateBuilder<Opt extends boolean = false> exten
|
|
|
254
254
|
* When `null` is included in optionalValues, the return type becomes `JsonSchemaTerminal`
|
|
255
255
|
* (no further chaining allowed) because the schema is wrapped in an anyOf structure.
|
|
256
256
|
*/
|
|
257
|
-
optional<T extends readonly null[] | undefined = undefined>(optionalValues?: T): T extends readonly null[] ? JsonSchemaTerminal<string | IsoDate | undefined, IsoDate | undefined, true> :
|
|
257
|
+
optional<T extends readonly null[] | undefined = undefined>(optionalValues?: T): T extends readonly null[] ? JsonSchemaTerminal<string | IsoDate | undefined, IsoDate | undefined, true> : JsonSchemaAnyBuilder<string | IsoDate | undefined, IsoDate | undefined, true>;
|
|
258
258
|
before(date: string): this;
|
|
259
259
|
sameOrBefore(date: string): this;
|
|
260
260
|
after(date: string): this;
|
|
@@ -524,11 +524,9 @@ export class JsonSchemaIsoDateBuilder extends JsonSchemaAnyBuilder {
|
|
|
524
524
|
return super.optional();
|
|
525
525
|
}
|
|
526
526
|
_typeCast(optionalValues);
|
|
527
|
+
const optionalBuilder = this.cloneAndUpdateSchema({ optionalField: true });
|
|
527
528
|
const newBuilder = new JsonSchemaTerminal({
|
|
528
|
-
anyOf: [
|
|
529
|
-
{ type: 'null', optionalValues },
|
|
530
|
-
this.cloneAndUpdateSchema({ optionalField: true }).build(),
|
|
531
|
-
],
|
|
529
|
+
anyOf: [{ type: 'null', optionalValues }, optionalBuilder.build()],
|
|
532
530
|
optionalField: true,
|
|
533
531
|
});
|
|
534
532
|
return newBuilder;
|
package/package.json
CHANGED
|
@@ -718,22 +718,21 @@ export class JsonSchemaIsoDateBuilder<Opt extends boolean = false> extends JsonS
|
|
|
718
718
|
optionalValues?: T,
|
|
719
719
|
): T extends readonly null[]
|
|
720
720
|
? JsonSchemaTerminal<string | IsoDate | undefined, IsoDate | undefined, true>
|
|
721
|
-
:
|
|
721
|
+
: JsonSchemaAnyBuilder<string | IsoDate | undefined, IsoDate | undefined, true> {
|
|
722
722
|
if (!optionalValues) {
|
|
723
723
|
return super.optional() as any
|
|
724
724
|
}
|
|
725
725
|
|
|
726
726
|
_typeCast<null[]>(optionalValues)
|
|
727
727
|
|
|
728
|
+
const optionalBuilder = this.cloneAndUpdateSchema({ optionalField: true })
|
|
729
|
+
|
|
728
730
|
const newBuilder = new JsonSchemaTerminal<
|
|
729
731
|
string | IsoDate | undefined,
|
|
730
732
|
IsoDate | undefined,
|
|
731
733
|
true
|
|
732
734
|
>({
|
|
733
|
-
anyOf: [
|
|
734
|
-
{ type: 'null', optionalValues },
|
|
735
|
-
this.cloneAndUpdateSchema({ optionalField: true }).build(),
|
|
736
|
-
],
|
|
735
|
+
anyOf: [{ type: 'null', optionalValues }, optionalBuilder.build()],
|
|
737
736
|
optionalField: true,
|
|
738
737
|
})
|
|
739
738
|
|