@alextheman/utility 4.14.1 → 4.16.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 +13 -1
- package/dist/index.d.cts +8 -4
- package/dist/index.d.ts +6 -2
- package/dist/index.js +12 -1
- package/package.json +10 -9
package/dist/index.cjs
CHANGED
|
@@ -306,6 +306,17 @@ var VersionNumber = class VersionNumber {
|
|
|
306
306
|
return VersionNumber.formatString(rawString, options);
|
|
307
307
|
}
|
|
308
308
|
};
|
|
309
|
+
const zodVersionNumber = zod.default.union([
|
|
310
|
+
zod.default.string(),
|
|
311
|
+
zod.default.tuple([
|
|
312
|
+
zod.default.number(),
|
|
313
|
+
zod.default.number(),
|
|
314
|
+
zod.default.number()
|
|
315
|
+
]),
|
|
316
|
+
zod.default.instanceof(VersionNumber)
|
|
317
|
+
]).transform((rawVersionNumber) => {
|
|
318
|
+
return new VersionNumber(rawVersionNumber);
|
|
319
|
+
});
|
|
309
320
|
|
|
310
321
|
//#endregion
|
|
311
322
|
//#region src/functions/parsers/parseIntStrict.ts
|
|
@@ -1777,4 +1788,5 @@ exports.sayHello = sayHello;
|
|
|
1777
1788
|
exports.stringListToArray = stringListToArray;
|
|
1778
1789
|
exports.stringifyDotenv = stringifyDotenv;
|
|
1779
1790
|
exports.truncate = truncate;
|
|
1780
|
-
exports.wait = wait;
|
|
1791
|
+
exports.wait = wait;
|
|
1792
|
+
exports.zodVersionNumber = zodVersionNumber;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import z, { ZodError, ZodType, z as z$1 } from "zod";
|
|
1
2
|
import { DotenvParseOutput } from "dotenv";
|
|
2
|
-
import { ZodError, ZodType, z } from "zod";
|
|
3
3
|
import sodium from "libsodium-wrappers";
|
|
4
4
|
|
|
5
5
|
//#region src/constants/FILE_PATH_REGEX.d.ts
|
|
@@ -334,6 +334,7 @@ declare class VersionNumber {
|
|
|
334
334
|
*/
|
|
335
335
|
toString(options?: VersionNumberToStringOptions): string;
|
|
336
336
|
}
|
|
337
|
+
declare const zodVersionNumber: z.ZodType<VersionNumber>;
|
|
337
338
|
//#endregion
|
|
338
339
|
//#region src/types/ArrayElement.d.ts
|
|
339
340
|
/**
|
|
@@ -386,6 +387,9 @@ type DisallowUndefined<InputType> = undefined extends InputType ? ["Error: Gener
|
|
|
386
387
|
*/
|
|
387
388
|
type IgnoreCase<StringType extends string> = string extends StringType ? string : StringType extends `${infer FirstCharacter}${infer SecondCharacter}${infer Remainder}` ? `${Uppercase<FirstCharacter> | Lowercase<FirstCharacter>}${Uppercase<SecondCharacter> | Lowercase<SecondCharacter>}${IgnoreCase<Remainder>}` : StringType extends `${infer FirstCharacter}${infer Remainder}` ? `${Uppercase<FirstCharacter> | Lowercase<FirstCharacter>}${IgnoreCase<Remainder>}` : "";
|
|
388
389
|
//#endregion
|
|
390
|
+
//#region src/types/IsTypeArgumentString.d.ts
|
|
391
|
+
type IsTypeArgumentString<Argument extends string> = Argument;
|
|
392
|
+
//#endregion
|
|
389
393
|
//#region src/types/NonUndefined.d.ts
|
|
390
394
|
/**
|
|
391
395
|
* Resolves to `never` if the given type may be undefined.
|
|
@@ -747,7 +751,7 @@ declare function parseVersionType(data: unknown): VersionType;
|
|
|
747
751
|
*
|
|
748
752
|
* @returns The parsed data from the Zod schema.
|
|
749
753
|
*/
|
|
750
|
-
declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error>(schema: SchemaType, data: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): z.infer<SchemaType>;
|
|
754
|
+
declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error>(schema: SchemaType, data: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): z$1.infer<SchemaType>;
|
|
751
755
|
//#endregion
|
|
752
756
|
//#region src/functions/parsers/zod/parseZodSchemaAsync.d.ts
|
|
753
757
|
/**
|
|
@@ -766,7 +770,7 @@ declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Er
|
|
|
766
770
|
*
|
|
767
771
|
* @returns The parsed data from the Zod schema.
|
|
768
772
|
*/
|
|
769
|
-
declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType extends Error>(schema: SchemaType, data: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): Promise<z.infer<SchemaType>>;
|
|
773
|
+
declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType extends Error>(schema: SchemaType, data: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): Promise<z$1.infer<SchemaType>>;
|
|
770
774
|
//#endregion
|
|
771
775
|
//#region src/functions/recursive/deepCopy.d.ts
|
|
772
776
|
/**
|
|
@@ -1223,4 +1227,4 @@ interface ParseVersionOptions {
|
|
|
1223
1227
|
*/
|
|
1224
1228
|
declare function parseVersion(input: string, options?: ParseVersionOptions): string;
|
|
1225
1229
|
//#endregion
|
|
1226
|
-
export { APIError, ArrayElement, CallReturnType, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FILE_PATH_REGEX, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, ParseVersionOptions, PublicAndPrivateKey, RecordKey, RemoveUndefined, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getPublicAndPrivateKey, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFilePath, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait };
|
|
1230
|
+
export { APIError, ArrayElement, CallReturnType, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FILE_PATH_REGEX, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IncrementVersionOptions, IsTypeArgumentString, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, ParseVersionOptions, PublicAndPrivateKey, RecordKey, RemoveUndefined, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getPublicAndPrivateKey, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFilePath, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ZodError, ZodType, z as z$1 } from "zod";
|
|
1
|
+
import z, { ZodError, ZodType, z as z$1 } from "zod";
|
|
2
2
|
import sodium from "libsodium-wrappers";
|
|
3
3
|
import { DotenvParseOutput } from "dotenv";
|
|
4
4
|
|
|
@@ -334,6 +334,7 @@ declare class VersionNumber {
|
|
|
334
334
|
*/
|
|
335
335
|
toString(options?: VersionNumberToStringOptions): string;
|
|
336
336
|
}
|
|
337
|
+
declare const zodVersionNumber: z.ZodType<VersionNumber>;
|
|
337
338
|
//#endregion
|
|
338
339
|
//#region src/types/ArrayElement.d.ts
|
|
339
340
|
/**
|
|
@@ -386,6 +387,9 @@ type DisallowUndefined<InputType> = undefined extends InputType ? ["Error: Gener
|
|
|
386
387
|
*/
|
|
387
388
|
type IgnoreCase<StringType extends string> = string extends StringType ? string : StringType extends `${infer FirstCharacter}${infer SecondCharacter}${infer Remainder}` ? `${Uppercase<FirstCharacter> | Lowercase<FirstCharacter>}${Uppercase<SecondCharacter> | Lowercase<SecondCharacter>}${IgnoreCase<Remainder>}` : StringType extends `${infer FirstCharacter}${infer Remainder}` ? `${Uppercase<FirstCharacter> | Lowercase<FirstCharacter>}${IgnoreCase<Remainder>}` : "";
|
|
388
389
|
//#endregion
|
|
390
|
+
//#region src/types/IsTypeArgumentString.d.ts
|
|
391
|
+
type IsTypeArgumentString<Argument extends string> = Argument;
|
|
392
|
+
//#endregion
|
|
389
393
|
//#region src/types/NonUndefined.d.ts
|
|
390
394
|
/**
|
|
391
395
|
* Resolves to `never` if the given type may be undefined.
|
|
@@ -1223,4 +1227,4 @@ interface ParseVersionOptions {
|
|
|
1223
1227
|
*/
|
|
1224
1228
|
declare function parseVersion(input: string, options?: ParseVersionOptions): string;
|
|
1225
1229
|
//#endregion
|
|
1226
|
-
export { APIError, ArrayElement, CallReturnType, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FILE_PATH_REGEX, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, type IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, type ParseVersionOptions, type PublicAndPrivateKey, RecordKey, RemoveUndefined, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getPublicAndPrivateKey, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFilePath, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait };
|
|
1230
|
+
export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IncrementVersionOptions, type IsTypeArgumentString, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type OptionalOnCondition, ParallelTuple, type ParseVersionOptions, type PublicAndPrivateKey, type RecordKey, type RemoveUndefined, type StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, type VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getPublicAndPrivateKey, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFilePath, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
|
package/dist/index.js
CHANGED
|
@@ -275,6 +275,17 @@ var VersionNumber = class VersionNumber {
|
|
|
275
275
|
return VersionNumber.formatString(rawString, options);
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
|
+
const zodVersionNumber = z.union([
|
|
279
|
+
z.string(),
|
|
280
|
+
z.tuple([
|
|
281
|
+
z.number(),
|
|
282
|
+
z.number(),
|
|
283
|
+
z.number()
|
|
284
|
+
]),
|
|
285
|
+
z.instanceof(VersionNumber)
|
|
286
|
+
]).transform((rawVersionNumber) => {
|
|
287
|
+
return new VersionNumber(rawVersionNumber);
|
|
288
|
+
});
|
|
278
289
|
|
|
279
290
|
//#endregion
|
|
280
291
|
//#region src/functions/parsers/parseIntStrict.ts
|
|
@@ -1686,4 +1697,4 @@ function incrementVersion(version, incrementType, options) {
|
|
|
1686
1697
|
}
|
|
1687
1698
|
|
|
1688
1699
|
//#endregion
|
|
1689
|
-
export { APIError, DataError, Env, FILE_PATH_REGEX, NAMESPACE_EXPORT_REGEX, VERSION_NUMBER_REGEX, VersionNumber, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getPublicAndPrivateKey, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFilePath, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait };
|
|
1700
|
+
export { APIError, DataError, Env, FILE_PATH_REGEX, NAMESPACE_EXPORT_REGEX, VERSION_NUMBER_REGEX, VersionNumber, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getPublicAndPrivateKey, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFilePath, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/utility",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.16.0",
|
|
4
4
|
"description": "Helpful utility functions.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,17 +16,16 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"dotenv": "^17.
|
|
19
|
+
"dotenv": "^17.3.1",
|
|
20
20
|
"libsodium-wrappers": "^0.8.2",
|
|
21
21
|
"zod": "^4.3.6"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@alextheman/eslint-plugin": "^5.
|
|
25
|
-
"@types/node": "^25.2.
|
|
26
|
-
"
|
|
27
|
-
"alex-c-line": "^1.23.1",
|
|
24
|
+
"@alextheman/eslint-plugin": "^5.7.0",
|
|
25
|
+
"@types/node": "^25.2.3",
|
|
26
|
+
"alex-c-line": "^1.26.2",
|
|
28
27
|
"dotenv-cli": "^11.0.0",
|
|
29
|
-
"eslint": "^
|
|
28
|
+
"eslint": "^10.0.0",
|
|
30
29
|
"execa": "^9.6.1",
|
|
31
30
|
"globals": "^17.3.0",
|
|
32
31
|
"husky": "^9.1.7",
|
|
@@ -34,9 +33,10 @@
|
|
|
34
33
|
"prettier": "^3.8.1",
|
|
35
34
|
"tempy": "^3.2.0",
|
|
36
35
|
"tsdown": "^0.20.3",
|
|
37
|
-
"
|
|
36
|
+
"tsx": "^4.21.0",
|
|
37
|
+
"typedoc": "^0.28.17",
|
|
38
38
|
"typescript": "^5.9.3",
|
|
39
|
-
"vite-tsconfig-paths": "^6.
|
|
39
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
40
40
|
"vitest": "^4.0.18"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"prepare-live-eslint-plugin": "pnpm uninstall @alextheman/eslint-plugin && pnpm install --save-dev @alextheman/eslint-plugin",
|
|
65
65
|
"prepare-local-eslint-plugin": "dotenv -e .env -- sh -c 'ESLINT_PLUGIN_PATH=${LOCAL_ESLINT_PLUGIN_PATH:-../eslint-plugin}; pnpm --prefix \"$ESLINT_PLUGIN_PATH\" run build && pnpm uninstall @alextheman/eslint-plugin && pnpm install --save-dev file:\"$ESLINT_PLUGIN_PATH\"'",
|
|
66
66
|
"test": "vitest run",
|
|
67
|
+
"test-end-to-end": "RUN_END_TO_END=true vitest run tests/end-to-end",
|
|
67
68
|
"test-watch": "vitest",
|
|
68
69
|
"update-dependencies": "pnpm update --latest && pnpm update",
|
|
69
70
|
"use-live-eslint-plugin": "pnpm run prepare-live-eslint-plugin && pnpm run lint",
|