@alextheman/utility 5.13.1 → 5.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +271 -235
- package/dist/index.d.cts +175 -156
- package/dist/index.d.ts +174 -155
- package/dist/index.js +271 -236
- package/dist/internal/index.cjs +311 -41
- package/dist/internal/index.js +311 -41
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DotenvParseOutput } from "dotenv";
|
|
2
|
-
import z
|
|
2
|
+
import z, { ZodCoercedDate, ZodCoercedNumber, ZodError, ZodType, z as z$1 } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/root/constants/FILE_PATH_REGEX.d.ts
|
|
5
5
|
declare const FILE_PATH_PATTERN: string;
|
|
@@ -626,7 +626,7 @@ declare class VersionNumber {
|
|
|
626
626
|
*/
|
|
627
627
|
toString(): string;
|
|
628
628
|
}
|
|
629
|
-
declare const zodVersionNumber: z
|
|
629
|
+
declare const zodVersionNumber: z.ZodType<VersionNumber>;
|
|
630
630
|
//#endregion
|
|
631
631
|
//#region src/root/types/ArrayElement.d.ts
|
|
632
632
|
/**
|
|
@@ -806,159 +806,6 @@ type VersionType = CreateEnumType<typeof VersionType>;
|
|
|
806
806
|
*/
|
|
807
807
|
declare function parseVersionType(input: unknown): VersionType;
|
|
808
808
|
//#endregion
|
|
809
|
-
//#region src/v6/CodeError.d.ts
|
|
810
|
-
interface ExpectErrorOptions$1<ErrorCode extends string = string> {
|
|
811
|
-
expectedCode?: ErrorCode;
|
|
812
|
-
}
|
|
813
|
-
/**
|
|
814
|
-
* Represents errors that can be described using a standardised error code, and a human-readable error message.
|
|
815
|
-
*
|
|
816
|
-
* @category Types
|
|
817
|
-
*
|
|
818
|
-
* @template ErrorCode The type of the standardised error code.
|
|
819
|
-
*/
|
|
820
|
-
declare class CodeError<ErrorCode extends string = string> extends Error {
|
|
821
|
-
code: ErrorCode;
|
|
822
|
-
/**
|
|
823
|
-
* @param code - A standardised code (e.g. UNEXPECTED_DATA).
|
|
824
|
-
* @param message - A human-readable error message (e.g. The data provided is invalid).
|
|
825
|
-
* @param options - Extra options to pass to super Error constructor.
|
|
826
|
-
*/
|
|
827
|
-
constructor(code: ErrorCode, message?: string, options?: ErrorOptions);
|
|
828
|
-
/**
|
|
829
|
-
* Checks whether the given input may have been caused by a CodeError.
|
|
830
|
-
*
|
|
831
|
-
* @param input - The input to check.
|
|
832
|
-
*
|
|
833
|
-
* @returns `true` if the input is a CodeError, and `false` otherwise. The type of the input will also be narrowed down to CodeError if `true`.
|
|
834
|
-
*/
|
|
835
|
-
static check(input: unknown): input is CodeError<string>;
|
|
836
|
-
protected static checkCaughtError<ErrorCode extends string = string>(this: typeof CodeError, error: unknown, options?: ExpectErrorOptions$1<ErrorCode>): CodeError;
|
|
837
|
-
/**
|
|
838
|
-
* Gets the thrown `CodeError` from a given function if one was thrown, and re-throws any other errors, or throws a default `CodeError` if no error thrown.
|
|
839
|
-
*
|
|
840
|
-
* @param errorFunction - The function expected to throw the error.
|
|
841
|
-
* @param options - Extra options to apply.
|
|
842
|
-
*
|
|
843
|
-
* @throws {Error} Any other errors thrown by the `errorFunction` that are not a `CodeError`.
|
|
844
|
-
* @throws {Error} If no `CodeError` was thrown by the `errorFunction`
|
|
845
|
-
*
|
|
846
|
-
* @returns The `CodeError` that was thrown by the `errorFunction`
|
|
847
|
-
*/
|
|
848
|
-
static expectError<ErrorCode extends string = string>(this: typeof CodeError, errorFunction: () => unknown, options?: ExpectErrorOptions$1<ErrorCode>): CodeError;
|
|
849
|
-
/**
|
|
850
|
-
* Gets the thrown `CodeError` from a given asynchronous function if one was thrown, and re-throws any other errors, or throws a default `CodeError` if no error thrown.
|
|
851
|
-
*
|
|
852
|
-
* @param errorFunction - The function expected to throw the error.
|
|
853
|
-
* @param options - Extra options to apply.
|
|
854
|
-
*
|
|
855
|
-
* @throws {Error} Any other errors thrown by the `errorFunction` that are not a `CodeError`.
|
|
856
|
-
* @throws {Error} If no `CodeError` was thrown by the `errorFunction`
|
|
857
|
-
*
|
|
858
|
-
* @returns The `CodeError` that was thrown by the `errorFunction`
|
|
859
|
-
*/
|
|
860
|
-
static expectErrorAsync<ErrorCode extends string = string>(this: typeof CodeError, errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions$1<ErrorCode>): Promise<CodeError>;
|
|
861
|
-
}
|
|
862
|
-
//#endregion
|
|
863
|
-
//#region src/v6/DataError.d.ts
|
|
864
|
-
type DefaultDataErrorCode = "INVALID_DATA";
|
|
865
|
-
interface ExpectErrorOptions<ErrorCode extends string = DefaultDataErrorCode> {
|
|
866
|
-
expectedCode?: ErrorCode | DefaultDataErrorCode;
|
|
867
|
-
}
|
|
868
|
-
declare const DataErrorCode: {
|
|
869
|
-
readonly INVALID_DATA: "INVALID_DATA";
|
|
870
|
-
};
|
|
871
|
-
type DataErrorCode = CreateEnumType<typeof DataErrorCode>;
|
|
872
|
-
/**
|
|
873
|
-
* Represents errors you may get that may've been caused by a specific piece of data.
|
|
874
|
-
*
|
|
875
|
-
* @category Types
|
|
876
|
-
*
|
|
877
|
-
* @template DataType - The type of the data that caused the error.
|
|
878
|
-
*/
|
|
879
|
-
declare class DataError$1<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = DataErrorCode> extends CodeError<ErrorCode | DataErrorCode> {
|
|
880
|
-
data: DataType;
|
|
881
|
-
/**
|
|
882
|
-
* @param data - The data that caused the error.
|
|
883
|
-
* @param code - A standardised code (e.g. UNEXPECTED_DATA).
|
|
884
|
-
* @param message - A human-readable error message (e.g. The data provided is invalid).
|
|
885
|
-
* @param options - Extra options to pass to super Error constructor.
|
|
886
|
-
*/
|
|
887
|
-
constructor(data: DataType, code?: ErrorCode | DefaultDataErrorCode, message?: string, options?: ErrorOptions);
|
|
888
|
-
/**
|
|
889
|
-
* Checks whether the given input may have been caused by a DataError.
|
|
890
|
-
*
|
|
891
|
-
* @param input - The input to check.
|
|
892
|
-
*
|
|
893
|
-
* @returns `true` if the input is a DataError, and `false` otherwise. The type of the input will also be narrowed down to DataError if `true`.
|
|
894
|
-
*/
|
|
895
|
-
static check<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = DataErrorCode>(input: unknown): input is DataError$1<DataType, ErrorCode>;
|
|
896
|
-
/**
|
|
897
|
-
* Gets the thrown `DataError` from a given function if one was thrown, and re-throws any other errors, or throws a default `DataError` if no error thrown.
|
|
898
|
-
*
|
|
899
|
-
* @param errorFunction - The function expected to throw the error.
|
|
900
|
-
* @param options - Extra options to apply.
|
|
901
|
-
*
|
|
902
|
-
* @throws {Error} Any other errors thrown by the `errorFunction` that are not a `DataError`.
|
|
903
|
-
* @throws {Error} If no `DataError` was thrown by the `errorFunction`
|
|
904
|
-
*
|
|
905
|
-
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
906
|
-
*/
|
|
907
|
-
static expectError<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = DefaultDataErrorCode>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError$1<DataType, ErrorCode>;
|
|
908
|
-
/**
|
|
909
|
-
* Gets the thrown `DataError` from a given asynchronous function if one was thrown, and re-throws any other errors, or throws a default `DataError` if no error thrown.
|
|
910
|
-
*
|
|
911
|
-
* @param errorFunction - The function expected to throw the error.
|
|
912
|
-
* @param options - Extra options to apply.
|
|
913
|
-
*
|
|
914
|
-
* @throws {Error} Any other errors thrown by the `errorFunction` that are not a `DataError`.
|
|
915
|
-
* @throws {Error} If no `DataError` was thrown by the `errorFunction`
|
|
916
|
-
*
|
|
917
|
-
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
918
|
-
*/
|
|
919
|
-
static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = DefaultDataErrorCode>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError$1<DataType, ErrorCode>>;
|
|
920
|
-
}
|
|
921
|
-
//#endregion
|
|
922
|
-
//#region src/root/functions/parsers/zod/parseZodSchema.d.ts
|
|
923
|
-
/**
|
|
924
|
-
* An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.
|
|
925
|
-
*
|
|
926
|
-
* NOTE: Use `parseZodSchemaAsync` if your schema includes an asynchronous function.
|
|
927
|
-
*
|
|
928
|
-
* @category Parsers
|
|
929
|
-
*
|
|
930
|
-
* @template SchemaType - The Zod schema type.
|
|
931
|
-
* @template ErrorType - The type of error to throw on invalid data.
|
|
932
|
-
*
|
|
933
|
-
* @param schema - The Zod schema to use in parsing.
|
|
934
|
-
* @param input - The data to parse.
|
|
935
|
-
* @param onError - A custom error to throw on invalid data (defaults to `DataError`). May either be the error itself, or a function that returns the error or nothing. If nothing is returned, the default error is thrown instead.
|
|
936
|
-
*
|
|
937
|
-
* @throws {DataErrorCode} If the given data cannot be parsed according to the schema.
|
|
938
|
-
*
|
|
939
|
-
* @returns The parsed data from the Zod schema.
|
|
940
|
-
*/
|
|
941
|
-
declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error = DataError$1>(schema: SchemaType, input: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): z.infer<SchemaType>;
|
|
942
|
-
//#endregion
|
|
943
|
-
//#region src/root/functions/parsers/zod/parseZodSchemaAsync.d.ts
|
|
944
|
-
/**
|
|
945
|
-
* An alternative function to zodSchema.parseAsync() that can be used to strictly parse asynchronous Zod schemas.
|
|
946
|
-
*
|
|
947
|
-
* @category Parsers
|
|
948
|
-
*
|
|
949
|
-
* @template SchemaType - The Zod schema type.
|
|
950
|
-
* @template ErrorType - The type of error to throw on invalid data.
|
|
951
|
-
*
|
|
952
|
-
* @param schema - The Zod schema to use in parsing.
|
|
953
|
-
* @param input - The data to parse.
|
|
954
|
-
* @param onError - A custom error to throw on invalid data (defaults to `DataError`). May either be the error itself, or a function that returns the error or nothing. If nothing is returned, the default error is thrown instead.
|
|
955
|
-
*
|
|
956
|
-
* @throws {DataError} If the given data cannot be parsed according to the schema.
|
|
957
|
-
*
|
|
958
|
-
* @returns The parsed data from the Zod schema.
|
|
959
|
-
*/
|
|
960
|
-
declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType extends Error = DataError$1>(schema: SchemaType, input: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): Promise<z.infer<SchemaType>>;
|
|
961
|
-
//#endregion
|
|
962
809
|
//#region src/root/functions/recursive/deepCopy.d.ts
|
|
963
810
|
/**
|
|
964
811
|
* Deeply copies an object or array such that all child objects/arrays are also copied.
|
|
@@ -1264,4 +1111,176 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
|
|
|
1264
1111
|
*/
|
|
1265
1112
|
declare const normalizeIndents: typeof normaliseIndents;
|
|
1266
1113
|
//#endregion
|
|
1267
|
-
|
|
1114
|
+
//#region src/v6/CodeError.d.ts
|
|
1115
|
+
interface ExpectErrorOptions$1<ErrorCode extends string = string> {
|
|
1116
|
+
expectedCode?: ErrorCode;
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Represents errors that can be described using a standardised error code, and a human-readable error message.
|
|
1120
|
+
*
|
|
1121
|
+
* @category Types
|
|
1122
|
+
*
|
|
1123
|
+
* @template ErrorCode The type of the standardised error code.
|
|
1124
|
+
*/
|
|
1125
|
+
declare class CodeError<ErrorCode extends string = string> extends Error {
|
|
1126
|
+
code: ErrorCode;
|
|
1127
|
+
/**
|
|
1128
|
+
* @param code - A standardised code (e.g. UNEXPECTED_DATA).
|
|
1129
|
+
* @param message - A human-readable error message (e.g. The data provided is invalid).
|
|
1130
|
+
* @param options - Extra options to pass to super Error constructor.
|
|
1131
|
+
*/
|
|
1132
|
+
constructor(code: ErrorCode, message?: string, options?: ErrorOptions);
|
|
1133
|
+
/**
|
|
1134
|
+
* Checks whether the given input may have been caused by a CodeError.
|
|
1135
|
+
*
|
|
1136
|
+
* @param input - The input to check.
|
|
1137
|
+
*
|
|
1138
|
+
* @returns `true` if the input is a CodeError, and `false` otherwise. The type of the input will also be narrowed down to CodeError if `true`.
|
|
1139
|
+
*/
|
|
1140
|
+
static check(input: unknown): input is CodeError<string>;
|
|
1141
|
+
protected static checkCaughtError<ErrorCode extends string = string>(this: typeof CodeError, error: unknown, options?: ExpectErrorOptions$1<ErrorCode>): CodeError;
|
|
1142
|
+
/**
|
|
1143
|
+
* Gets the thrown `CodeError` from a given function if one was thrown, and re-throws any other errors, or throws a default `CodeError` if no error thrown.
|
|
1144
|
+
*
|
|
1145
|
+
* @param errorFunction - The function expected to throw the error.
|
|
1146
|
+
* @param options - Extra options to apply.
|
|
1147
|
+
*
|
|
1148
|
+
* @throws {Error} Any other errors thrown by the `errorFunction` that are not a `CodeError`.
|
|
1149
|
+
* @throws {Error} If no `CodeError` was thrown by the `errorFunction`
|
|
1150
|
+
*
|
|
1151
|
+
* @returns The `CodeError` that was thrown by the `errorFunction`
|
|
1152
|
+
*/
|
|
1153
|
+
static expectError<ErrorCode extends string = string>(this: typeof CodeError, errorFunction: () => unknown, options?: ExpectErrorOptions$1<ErrorCode>): CodeError;
|
|
1154
|
+
/**
|
|
1155
|
+
* Gets the thrown `CodeError` from a given asynchronous function if one was thrown, and re-throws any other errors, or throws a default `CodeError` if no error thrown.
|
|
1156
|
+
*
|
|
1157
|
+
* @param errorFunction - The function expected to throw the error.
|
|
1158
|
+
* @param options - Extra options to apply.
|
|
1159
|
+
*
|
|
1160
|
+
* @throws {Error} Any other errors thrown by the `errorFunction` that are not a `CodeError`.
|
|
1161
|
+
* @throws {Error} If no `CodeError` was thrown by the `errorFunction`
|
|
1162
|
+
*
|
|
1163
|
+
* @returns The `CodeError` that was thrown by the `errorFunction`
|
|
1164
|
+
*/
|
|
1165
|
+
static expectErrorAsync<ErrorCode extends string = string>(this: typeof CodeError, errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions$1<ErrorCode>): Promise<CodeError>;
|
|
1166
|
+
}
|
|
1167
|
+
//#endregion
|
|
1168
|
+
//#region src/v6/DataError.d.ts
|
|
1169
|
+
type DefaultDataErrorCode = "INVALID_DATA";
|
|
1170
|
+
interface ExpectErrorOptions<ErrorCode extends string = DefaultDataErrorCode> {
|
|
1171
|
+
expectedCode?: ErrorCode | DefaultDataErrorCode;
|
|
1172
|
+
}
|
|
1173
|
+
declare const DataErrorCode: {
|
|
1174
|
+
readonly INVALID_DATA: "INVALID_DATA";
|
|
1175
|
+
};
|
|
1176
|
+
type DataErrorCode = CreateEnumType<typeof DataErrorCode>;
|
|
1177
|
+
/**
|
|
1178
|
+
* Represents errors you may get that may've been caused by a specific piece of data.
|
|
1179
|
+
*
|
|
1180
|
+
* @category Types
|
|
1181
|
+
*
|
|
1182
|
+
* @template DataType - The type of the data that caused the error.
|
|
1183
|
+
*/
|
|
1184
|
+
declare class DataError$1<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = DataErrorCode> extends CodeError<ErrorCode | DataErrorCode> {
|
|
1185
|
+
data: DataType;
|
|
1186
|
+
/**
|
|
1187
|
+
* @param data - The data that caused the error.
|
|
1188
|
+
* @param code - A standardised code (e.g. UNEXPECTED_DATA).
|
|
1189
|
+
* @param message - A human-readable error message (e.g. The data provided is invalid).
|
|
1190
|
+
* @param options - Extra options to pass to super Error constructor.
|
|
1191
|
+
*/
|
|
1192
|
+
constructor(data: DataType, code?: ErrorCode | DefaultDataErrorCode, message?: string, options?: ErrorOptions);
|
|
1193
|
+
/**
|
|
1194
|
+
* Checks whether the given input may have been caused by a DataError.
|
|
1195
|
+
*
|
|
1196
|
+
* @param input - The input to check.
|
|
1197
|
+
*
|
|
1198
|
+
* @returns `true` if the input is a DataError, and `false` otherwise. The type of the input will also be narrowed down to DataError if `true`.
|
|
1199
|
+
*/
|
|
1200
|
+
static check<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = DataErrorCode>(input: unknown): input is DataError$1<DataType, ErrorCode>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Gets the thrown `DataError` from a given function if one was thrown, and re-throws any other errors, or throws a default `DataError` if no error thrown.
|
|
1203
|
+
*
|
|
1204
|
+
* @param errorFunction - The function expected to throw the error.
|
|
1205
|
+
* @param options - Extra options to apply.
|
|
1206
|
+
*
|
|
1207
|
+
* @throws {Error} Any other errors thrown by the `errorFunction` that are not a `DataError`.
|
|
1208
|
+
* @throws {Error} If no `DataError` was thrown by the `errorFunction`
|
|
1209
|
+
*
|
|
1210
|
+
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
1211
|
+
*/
|
|
1212
|
+
static expectError<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = DefaultDataErrorCode>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError$1<DataType, ErrorCode>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Gets the thrown `DataError` from a given asynchronous function if one was thrown, and re-throws any other errors, or throws a default `DataError` if no error thrown.
|
|
1215
|
+
*
|
|
1216
|
+
* @param errorFunction - The function expected to throw the error.
|
|
1217
|
+
* @param options - Extra options to apply.
|
|
1218
|
+
*
|
|
1219
|
+
* @throws {Error} Any other errors thrown by the `errorFunction` that are not a `DataError`.
|
|
1220
|
+
* @throws {Error} If no `DataError` was thrown by the `errorFunction`
|
|
1221
|
+
*
|
|
1222
|
+
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
1223
|
+
*/
|
|
1224
|
+
static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = DefaultDataErrorCode>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError$1<DataType, ErrorCode>>;
|
|
1225
|
+
}
|
|
1226
|
+
//#endregion
|
|
1227
|
+
//#region src/root/zod/parseZodSchema.d.ts
|
|
1228
|
+
/**
|
|
1229
|
+
* An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.
|
|
1230
|
+
*
|
|
1231
|
+
* NOTE: Use `parseZodSchemaAsync` if your schema includes an asynchronous function.
|
|
1232
|
+
*
|
|
1233
|
+
* @category Parsers
|
|
1234
|
+
*
|
|
1235
|
+
* @deprecated Please use `az.with(schema).parse(input)` instead.
|
|
1236
|
+
*
|
|
1237
|
+
* @template SchemaType - The Zod schema type.
|
|
1238
|
+
* @template ErrorType - The type of error to throw on invalid data.
|
|
1239
|
+
*
|
|
1240
|
+
* @param schema - The Zod schema to use in parsing.
|
|
1241
|
+
* @param input - The data to parse.
|
|
1242
|
+
* @param onError - A custom error to throw on invalid data (defaults to `DataError`). May either be the error itself, or a function that returns the error or nothing. If nothing is returned, the default error is thrown instead.
|
|
1243
|
+
*
|
|
1244
|
+
* @throws {DataErrorCode} If the given data cannot be parsed according to the schema.
|
|
1245
|
+
*
|
|
1246
|
+
* @returns The parsed data from the Zod schema.
|
|
1247
|
+
*/
|
|
1248
|
+
declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error = DataError$1>(schema: SchemaType, input: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): z$1.infer<SchemaType>;
|
|
1249
|
+
//#endregion
|
|
1250
|
+
//#region src/root/zod/parseZodSchemaAsync.d.ts
|
|
1251
|
+
/**
|
|
1252
|
+
* An alternative function to zodSchema.parseAsync() that can be used to strictly parse asynchronous Zod schemas.
|
|
1253
|
+
*
|
|
1254
|
+
* @category Parsers
|
|
1255
|
+
*
|
|
1256
|
+
* @deprecated Please use `az.with(schema).parseAsync(input)` instead.
|
|
1257
|
+
*
|
|
1258
|
+
* @template SchemaType - The Zod schema type.
|
|
1259
|
+
* @template ErrorType - The type of error to throw on invalid data.
|
|
1260
|
+
*
|
|
1261
|
+
* @param schema - The Zod schema to use in parsing.
|
|
1262
|
+
* @param input - The data to parse.
|
|
1263
|
+
* @param onError - A custom error to throw on invalid data (defaults to `DataError`). May either be the error itself, or a function that returns the error or nothing. If nothing is returned, the default error is thrown instead.
|
|
1264
|
+
*
|
|
1265
|
+
* @throws {DataError} If the given data cannot be parsed according to the schema.
|
|
1266
|
+
*
|
|
1267
|
+
* @returns The parsed data from the Zod schema.
|
|
1268
|
+
*/
|
|
1269
|
+
declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType extends Error = DataError$1>(schema: SchemaType, input: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): Promise<z$1.infer<SchemaType>>;
|
|
1270
|
+
//#endregion
|
|
1271
|
+
//#region src/root/zod/zodFieldWrapper.d.ts
|
|
1272
|
+
declare function zodFieldWrapper<SchemaType extends ZodType<unknown, string | null>>(schema: SchemaType): ZodType<z.infer<SchemaType>, string>;
|
|
1273
|
+
//#endregion
|
|
1274
|
+
//#region src/root/zod/az.d.ts
|
|
1275
|
+
declare const az: {
|
|
1276
|
+
field: typeof zodFieldWrapper;
|
|
1277
|
+
fieldNumber: () => ZodCoercedNumber<string | null>;
|
|
1278
|
+
versionNumber: () => ZodType<VersionNumber, unknown>;
|
|
1279
|
+
fieldDate: () => ZodCoercedDate<string | null>;
|
|
1280
|
+
with: <SchemaType extends ZodType>(schema: SchemaType) => {
|
|
1281
|
+
parse: <ErrorType extends Error = DataError$1<Record<PropertyKey, unknown>, "INVALID_DATA">>(input: unknown, error?: ErrorType | ((zodError: z.ZodError<unknown>) => void | ErrorType)) => ReturnType<typeof parseZodSchema<SchemaType, ErrorType>>;
|
|
1282
|
+
parseAsync: <ErrorType extends Error = DataError$1<Record<PropertyKey, unknown>, "INVALID_DATA">>(input: unknown, error?: ErrorType | ((zodError: z.ZodError<unknown>) => void | ErrorType)) => ReturnType<typeof parseZodSchemaAsync<SchemaType, ErrorType>>;
|
|
1283
|
+
};
|
|
1284
|
+
};
|
|
1285
|
+
//#endregion
|
|
1286
|
+
export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, RecordKey, RemoveUndefined, type StringListToArrayOptions, ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, az, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|