@sudobility/types 1.9.52 → 1.9.54
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 +10 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/types/blockchain/index.cjs +30 -0
- package/dist/types/blockchain/index.d.ts +14 -0
- package/dist/types/blockchain/index.d.ts.map +1 -0
- package/dist/types/blockchain/index.js +30 -0
- package/dist/types/blockchain/index.js.map +1 -0
- package/dist/types/blockchain/validation.cjs +57 -1
- package/dist/types/blockchain/validation.d.ts +57 -1
- package/dist/types/blockchain/validation.d.ts.map +1 -1
- package/dist/types/blockchain/validation.js +57 -1
- package/dist/types/blockchain/validation.js.map +1 -1
- package/dist/types/business/enums.cjs +110 -25
- package/dist/types/business/enums.d.ts +110 -2
- package/dist/types/business/enums.d.ts.map +1 -1
- package/dist/types/business/enums.js +110 -25
- package/dist/types/business/enums.js.map +1 -1
- package/dist/types/common.cjs +7 -1
- package/dist/types/common.d.ts +134 -20
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +7 -1
- package/dist/types/common.js.map +1 -1
- package/dist/types/subscription/entitlements.cjs +14 -0
- package/dist/types/subscription/entitlements.d.ts +11 -0
- package/dist/types/subscription/entitlements.d.ts.map +1 -0
- package/dist/types/subscription/entitlements.js +14 -0
- package/dist/types/subscription/entitlements.js.map +1 -0
- package/dist/types/subscription/period.cjs +29 -0
- package/dist/types/subscription/period.d.ts +18 -0
- package/dist/types/subscription/period.d.ts.map +1 -0
- package/dist/types/subscription/period.js +29 -0
- package/dist/types/subscription/period.js.map +1 -0
- package/dist/utils/async-helpers.cjs +124 -10
- package/dist/utils/async-helpers.d.ts +129 -8
- package/dist/utils/async-helpers.d.ts.map +1 -1
- package/dist/utils/async-helpers.js +124 -10
- package/dist/utils/async-helpers.js.map +1 -1
- package/dist/utils/formatting/currency.cjs +5 -2
- package/dist/utils/formatting/currency.d.ts +5 -1
- package/dist/utils/formatting/currency.d.ts.map +1 -1
- package/dist/utils/formatting/currency.js +5 -2
- package/dist/utils/formatting/currency.js.map +1 -1
- package/dist/utils/formatting/date.cjs +67 -8
- package/dist/utils/formatting/date.d.ts +67 -8
- package/dist/utils/formatting/date.d.ts.map +1 -1
- package/dist/utils/formatting/date.js +67 -8
- package/dist/utils/formatting/date.js.map +1 -1
- package/dist/utils/formatting/string.cjs +150 -17
- package/dist/utils/formatting/string.d.ts +150 -17
- package/dist/utils/formatting/string.d.ts.map +1 -1
- package/dist/utils/formatting/string.js +150 -17
- package/dist/utils/formatting/string.js.map +1 -1
- package/dist/utils/validation/type-validation.cjs +94 -11
- package/dist/utils/validation/type-validation.d.ts +94 -11
- package/dist/utils/validation/type-validation.d.ts.map +1 -1
- package/dist/utils/validation/type-validation.js +94 -11
- package/dist/utils/validation/type-validation.js.map +1 -1
- package/package.json +6 -1
|
@@ -8,7 +8,21 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.parseJson = exports.createAssertion = exports.isUrl = exports.isEmail = exports.isValidDate = exports.isErrorResponse = exports.isSuccessResponse = exports.isApiResponse = exports.optional = exports.validateArray = exports.hasRequiredProperties = exports.isNullish = exports.isArray = exports.isObject = exports.isBoolean = exports.isNumber = exports.isString = exports.createValidator = void 0;
|
|
10
10
|
/**
|
|
11
|
-
* Creates a validation function that safely checks if a value matches
|
|
11
|
+
* Creates a validation function that safely checks if a value matches
|
|
12
|
+
* the expected type. Returns a {@link ValidationResult}.
|
|
13
|
+
*
|
|
14
|
+
* @template T - The validated type
|
|
15
|
+
* @param validationFn - Type guard function
|
|
16
|
+
* @param typeName - Name used in error messages
|
|
17
|
+
* @returns A function returning `ValidationResult<T>`
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const validateString = createValidator(isString, 'string');
|
|
23
|
+
* validateString('hi'); // { isValid: true, data: 'hi' }
|
|
24
|
+
* validateString(42); // { isValid: false, error: 'Invalid string' }
|
|
25
|
+
* ```
|
|
12
26
|
*/
|
|
13
27
|
const createValidator = (validationFn, typeName) => {
|
|
14
28
|
return (data) => {
|
|
@@ -29,22 +43,49 @@ const createValidator = (validationFn, typeName) => {
|
|
|
29
43
|
};
|
|
30
44
|
exports.createValidator = createValidator;
|
|
31
45
|
/**
|
|
32
|
-
*
|
|
46
|
+
* Runtime type guard: checks if value is a `string`.
|
|
47
|
+
* @since 1.0.0
|
|
33
48
|
*/
|
|
34
49
|
const isString = (value) => typeof value === 'string';
|
|
35
50
|
exports.isString = isString;
|
|
51
|
+
/**
|
|
52
|
+
* Runtime type guard: checks if value is a finite `number` (excludes NaN).
|
|
53
|
+
* @since 1.0.0
|
|
54
|
+
*/
|
|
36
55
|
const isNumber = (value) => typeof value === 'number' && !isNaN(value);
|
|
37
56
|
exports.isNumber = isNumber;
|
|
57
|
+
/**
|
|
58
|
+
* Runtime type guard: checks if value is a `boolean`.
|
|
59
|
+
* @since 1.0.0
|
|
60
|
+
*/
|
|
38
61
|
const isBoolean = (value) => typeof value === 'boolean';
|
|
39
62
|
exports.isBoolean = isBoolean;
|
|
63
|
+
/**
|
|
64
|
+
* Runtime type guard: checks if value is a non-null, non-array object.
|
|
65
|
+
* @since 1.0.0
|
|
66
|
+
*/
|
|
40
67
|
const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
41
68
|
exports.isObject = isObject;
|
|
69
|
+
/**
|
|
70
|
+
* Runtime type guard: checks if value is an array.
|
|
71
|
+
* @since 1.0.0
|
|
72
|
+
*/
|
|
42
73
|
const isArray = (value) => Array.isArray(value);
|
|
43
74
|
exports.isArray = isArray;
|
|
75
|
+
/**
|
|
76
|
+
* Runtime type guard: checks if value is `null` or `undefined`.
|
|
77
|
+
* @since 1.0.0
|
|
78
|
+
*/
|
|
44
79
|
const isNullish = (value) => value === null || value === undefined;
|
|
45
80
|
exports.isNullish = isNullish;
|
|
46
81
|
/**
|
|
47
|
-
* Validates that an object has required properties
|
|
82
|
+
* Validates that an object has all required properties present.
|
|
83
|
+
*
|
|
84
|
+
* @template T - Expected object shape
|
|
85
|
+
* @param obj - Value to check
|
|
86
|
+
* @param requiredProps - Array of required property keys
|
|
87
|
+
* @returns True if obj has all required properties
|
|
88
|
+
* @since 1.0.0
|
|
48
89
|
*/
|
|
49
90
|
const hasRequiredProperties = (obj, requiredProps) => {
|
|
50
91
|
if (!(0, exports.isObject)(obj))
|
|
@@ -53,7 +94,13 @@ const hasRequiredProperties = (obj, requiredProps) => {
|
|
|
53
94
|
};
|
|
54
95
|
exports.hasRequiredProperties = hasRequiredProperties;
|
|
55
96
|
/**
|
|
56
|
-
* Validates array
|
|
97
|
+
* Validates that a value is an array where every item passes a validator.
|
|
98
|
+
*
|
|
99
|
+
* @template T - Expected item type
|
|
100
|
+
* @param data - Value to check
|
|
101
|
+
* @param itemValidator - Type guard for individual items
|
|
102
|
+
* @returns True if data is an array of T
|
|
103
|
+
* @since 1.0.0
|
|
57
104
|
*/
|
|
58
105
|
const validateArray = (data, itemValidator) => {
|
|
59
106
|
if (!(0, exports.isArray)(data))
|
|
@@ -62,14 +109,20 @@ const validateArray = (data, itemValidator) => {
|
|
|
62
109
|
};
|
|
63
110
|
exports.validateArray = validateArray;
|
|
64
111
|
/**
|
|
65
|
-
*
|
|
112
|
+
* Wraps a validator to also accept `undefined`.
|
|
113
|
+
*
|
|
114
|
+
* @template T - The validated type
|
|
115
|
+
* @param validator - Base type guard
|
|
116
|
+
* @returns Type guard that also accepts `undefined`
|
|
117
|
+
* @since 1.0.0
|
|
66
118
|
*/
|
|
67
119
|
const optional = (validator) => (value) => {
|
|
68
120
|
return value === undefined || validator(value);
|
|
69
121
|
};
|
|
70
122
|
exports.optional = optional;
|
|
71
123
|
/**
|
|
72
|
-
*
|
|
124
|
+
* Check if data looks like an API response (has `success` boolean).
|
|
125
|
+
* @since 1.0.0
|
|
73
126
|
*/
|
|
74
127
|
const isApiResponse = (data) => {
|
|
75
128
|
return (0, exports.isObject)(data) && (0, exports.isBoolean)(data.success);
|
|
@@ -92,7 +145,8 @@ const isErrorResponse = (data) => {
|
|
|
92
145
|
};
|
|
93
146
|
exports.isErrorResponse = isErrorResponse;
|
|
94
147
|
/**
|
|
95
|
-
*
|
|
148
|
+
* Check if a value is a string that parses to a valid date.
|
|
149
|
+
* @since 1.0.0
|
|
96
150
|
*/
|
|
97
151
|
const isValidDate = (value) => {
|
|
98
152
|
if (!(0, exports.isString)(value))
|
|
@@ -102,7 +156,8 @@ const isValidDate = (value) => {
|
|
|
102
156
|
};
|
|
103
157
|
exports.isValidDate = isValidDate;
|
|
104
158
|
/**
|
|
105
|
-
*
|
|
159
|
+
* Basic email format validation.
|
|
160
|
+
* @since 1.0.0
|
|
106
161
|
*/
|
|
107
162
|
const isEmail = (value) => {
|
|
108
163
|
if (!(0, exports.isString)(value))
|
|
@@ -112,7 +167,8 @@ const isEmail = (value) => {
|
|
|
112
167
|
};
|
|
113
168
|
exports.isEmail = isEmail;
|
|
114
169
|
/**
|
|
115
|
-
* URL validation
|
|
170
|
+
* Basic URL validation using the `URL` constructor.
|
|
171
|
+
* @since 1.0.0
|
|
116
172
|
*/
|
|
117
173
|
const isUrl = (value) => {
|
|
118
174
|
if (!(0, exports.isString)(value))
|
|
@@ -127,7 +183,21 @@ const isUrl = (value) => {
|
|
|
127
183
|
};
|
|
128
184
|
exports.isUrl = isUrl;
|
|
129
185
|
/**
|
|
130
|
-
* Creates a type assertion function that throws on
|
|
186
|
+
* Creates a type assertion function that throws `TypeError` on
|
|
187
|
+
* invalid data. Use with `createValidator` for the non-throwing variant.
|
|
188
|
+
*
|
|
189
|
+
* @template T - The asserted type
|
|
190
|
+
* @param validator - Type guard function
|
|
191
|
+
* @param typeName - Name used in error messages
|
|
192
|
+
* @returns An assertion function
|
|
193
|
+
* @since 1.0.0
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const assertString = createAssertion(isString, 'string');
|
|
198
|
+
* assertString('hello'); // passes
|
|
199
|
+
* assertString(42); // throws TypeError
|
|
200
|
+
* ```
|
|
131
201
|
*/
|
|
132
202
|
const createAssertion = (validator, typeName) => {
|
|
133
203
|
return (data, context = typeName) => {
|
|
@@ -138,7 +208,20 @@ const createAssertion = (validator, typeName) => {
|
|
|
138
208
|
};
|
|
139
209
|
exports.createAssertion = createAssertion;
|
|
140
210
|
/**
|
|
141
|
-
*
|
|
211
|
+
* Safely parse a JSON string, optionally validating the result.
|
|
212
|
+
* Returns a {@link ValidationResult} instead of throwing.
|
|
213
|
+
*
|
|
214
|
+
* @template T - Expected parsed type
|
|
215
|
+
* @param jsonString - JSON string to parse
|
|
216
|
+
* @param validator - Optional type guard to validate the parsed result
|
|
217
|
+
* @returns Validation result with parsed data or error
|
|
218
|
+
* @since 1.0.0
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* const result = parseJson('{"name":"Alice"}');
|
|
223
|
+
* if (result.isValid) console.log(result.data);
|
|
224
|
+
* ```
|
|
142
225
|
*/
|
|
143
226
|
const parseJson = (jsonString, validator) => {
|
|
144
227
|
try {
|
|
@@ -7,32 +7,85 @@
|
|
|
7
7
|
import type { ValidationResult, Optional } from '../../types/common';
|
|
8
8
|
export type { ValidationResult };
|
|
9
9
|
/**
|
|
10
|
-
* Creates a validation function that safely checks if a value matches
|
|
10
|
+
* Creates a validation function that safely checks if a value matches
|
|
11
|
+
* the expected type. Returns a {@link ValidationResult}.
|
|
12
|
+
*
|
|
13
|
+
* @template T - The validated type
|
|
14
|
+
* @param validationFn - Type guard function
|
|
15
|
+
* @param typeName - Name used in error messages
|
|
16
|
+
* @returns A function returning `ValidationResult<T>`
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const validateString = createValidator(isString, 'string');
|
|
22
|
+
* validateString('hi'); // { isValid: true, data: 'hi' }
|
|
23
|
+
* validateString(42); // { isValid: false, error: 'Invalid string' }
|
|
24
|
+
* ```
|
|
11
25
|
*/
|
|
12
26
|
export declare const createValidator: <T>(validationFn: (data: unknown) => data is T, typeName: string) => (data: unknown) => ValidationResult<T>;
|
|
13
27
|
/**
|
|
14
|
-
*
|
|
28
|
+
* Runtime type guard: checks if value is a `string`.
|
|
29
|
+
* @since 1.0.0
|
|
15
30
|
*/
|
|
16
31
|
export declare const isString: (value: unknown) => value is string;
|
|
32
|
+
/**
|
|
33
|
+
* Runtime type guard: checks if value is a finite `number` (excludes NaN).
|
|
34
|
+
* @since 1.0.0
|
|
35
|
+
*/
|
|
17
36
|
export declare const isNumber: (value: unknown) => value is number;
|
|
37
|
+
/**
|
|
38
|
+
* Runtime type guard: checks if value is a `boolean`.
|
|
39
|
+
* @since 1.0.0
|
|
40
|
+
*/
|
|
18
41
|
export declare const isBoolean: (value: unknown) => value is boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Runtime type guard: checks if value is a non-null, non-array object.
|
|
44
|
+
* @since 1.0.0
|
|
45
|
+
*/
|
|
19
46
|
export declare const isObject: (value: unknown) => value is Record<string, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* Runtime type guard: checks if value is an array.
|
|
49
|
+
* @since 1.0.0
|
|
50
|
+
*/
|
|
20
51
|
export declare const isArray: (value: unknown) => value is unknown[];
|
|
52
|
+
/**
|
|
53
|
+
* Runtime type guard: checks if value is `null` or `undefined`.
|
|
54
|
+
* @since 1.0.0
|
|
55
|
+
*/
|
|
21
56
|
export declare const isNullish: (value: unknown) => value is null | undefined;
|
|
22
57
|
/**
|
|
23
|
-
* Validates that an object has required properties
|
|
58
|
+
* Validates that an object has all required properties present.
|
|
59
|
+
*
|
|
60
|
+
* @template T - Expected object shape
|
|
61
|
+
* @param obj - Value to check
|
|
62
|
+
* @param requiredProps - Array of required property keys
|
|
63
|
+
* @returns True if obj has all required properties
|
|
64
|
+
* @since 1.0.0
|
|
24
65
|
*/
|
|
25
66
|
export declare const hasRequiredProperties: <T extends Record<string, unknown>>(obj: unknown, requiredProps: (keyof T)[]) => obj is T;
|
|
26
67
|
/**
|
|
27
|
-
* Validates array
|
|
68
|
+
* Validates that a value is an array where every item passes a validator.
|
|
69
|
+
*
|
|
70
|
+
* @template T - Expected item type
|
|
71
|
+
* @param data - Value to check
|
|
72
|
+
* @param itemValidator - Type guard for individual items
|
|
73
|
+
* @returns True if data is an array of T
|
|
74
|
+
* @since 1.0.0
|
|
28
75
|
*/
|
|
29
76
|
export declare const validateArray: <T>(data: unknown, itemValidator: (item: unknown) => item is T) => data is T[];
|
|
30
77
|
/**
|
|
31
|
-
*
|
|
78
|
+
* Wraps a validator to also accept `undefined`.
|
|
79
|
+
*
|
|
80
|
+
* @template T - The validated type
|
|
81
|
+
* @param validator - Base type guard
|
|
82
|
+
* @returns Type guard that also accepts `undefined`
|
|
83
|
+
* @since 1.0.0
|
|
32
84
|
*/
|
|
33
85
|
export declare const optional: <T>(validator: (value: unknown) => value is T) => (value: unknown) => value is T | undefined;
|
|
34
86
|
/**
|
|
35
|
-
*
|
|
87
|
+
* Check if data looks like an API response (has `success` boolean).
|
|
88
|
+
* @since 1.0.0
|
|
36
89
|
*/
|
|
37
90
|
export declare const isApiResponse: (data: unknown) => data is {
|
|
38
91
|
success: boolean;
|
|
@@ -46,23 +99,53 @@ export declare const isErrorResponse: (data: unknown) => data is {
|
|
|
46
99
|
error: string;
|
|
47
100
|
};
|
|
48
101
|
/**
|
|
49
|
-
*
|
|
102
|
+
* Check if a value is a string that parses to a valid date.
|
|
103
|
+
* @since 1.0.0
|
|
50
104
|
*/
|
|
51
105
|
export declare const isValidDate: (value: unknown) => value is string;
|
|
52
106
|
/**
|
|
53
|
-
*
|
|
107
|
+
* Basic email format validation.
|
|
108
|
+
* @since 1.0.0
|
|
54
109
|
*/
|
|
55
110
|
export declare const isEmail: (value: unknown) => value is string;
|
|
56
111
|
/**
|
|
57
|
-
* URL validation
|
|
112
|
+
* Basic URL validation using the `URL` constructor.
|
|
113
|
+
* @since 1.0.0
|
|
58
114
|
*/
|
|
59
115
|
export declare const isUrl: (value: unknown) => value is string;
|
|
60
116
|
/**
|
|
61
|
-
* Creates a type assertion function that throws on
|
|
117
|
+
* Creates a type assertion function that throws `TypeError` on
|
|
118
|
+
* invalid data. Use with `createValidator` for the non-throwing variant.
|
|
119
|
+
*
|
|
120
|
+
* @template T - The asserted type
|
|
121
|
+
* @param validator - Type guard function
|
|
122
|
+
* @param typeName - Name used in error messages
|
|
123
|
+
* @returns An assertion function
|
|
124
|
+
* @since 1.0.0
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const assertString = createAssertion(isString, 'string');
|
|
129
|
+
* assertString('hello'); // passes
|
|
130
|
+
* assertString(42); // throws TypeError
|
|
131
|
+
* ```
|
|
62
132
|
*/
|
|
63
133
|
export declare const createAssertion: <T>(validator: (data: unknown) => data is T, typeName: string) => (data: unknown, context?: string) => asserts data is T;
|
|
64
134
|
/**
|
|
65
|
-
*
|
|
135
|
+
* Safely parse a JSON string, optionally validating the result.
|
|
136
|
+
* Returns a {@link ValidationResult} instead of throwing.
|
|
137
|
+
*
|
|
138
|
+
* @template T - Expected parsed type
|
|
139
|
+
* @param jsonString - JSON string to parse
|
|
140
|
+
* @param validator - Optional type guard to validate the parsed result
|
|
141
|
+
* @returns Validation result with parsed data or error
|
|
142
|
+
* @since 1.0.0
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* const result = parseJson('{"name":"Alice"}');
|
|
147
|
+
* if (result.isValid) console.log(result.data);
|
|
148
|
+
* ```
|
|
66
149
|
*/
|
|
67
150
|
export declare const parseJson: <T>(jsonString: string, validator?: Optional<(data: unknown) => data is T>) => ValidationResult<T>;
|
|
68
151
|
//# sourceMappingURL=type-validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation/type-validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGrE,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC
|
|
1
|
+
{"version":3,"file":"type-validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation/type-validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGrE,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAC/B,cAAc,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,CAAC,EAC1C,UAAU,MAAM,MAER,MAAM,OAAO,KAAG,gBAAgB,CAAC,CAAC,CAc3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACxB,CAAC;AAE5B;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACP,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OACxB,CAAC;AAE7B;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACH,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OAAO,EACnC,CAAC;AAEvB;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,IAAI,GAAG,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AAM,KAAK,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAQ/C,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAC/B,WAAW,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,CAAC,EACvC,UAAU,MAAM,MAER,MAAM,OAAO,EAAE,gBAAkB,KAAG,QAAQ,IAAI,IAAI,CAK7D,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EACzB,YAAY,MAAM,EAClB,YAAY,QAAQ,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,KACjD,gBAAgB,CAAC,CAAC,CAqBpB,CAAC"}
|
|
@@ -8,7 +8,21 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.parseJson = exports.createAssertion = exports.isUrl = exports.isEmail = exports.isValidDate = exports.isErrorResponse = exports.isSuccessResponse = exports.isApiResponse = exports.optional = exports.validateArray = exports.hasRequiredProperties = exports.isNullish = exports.isArray = exports.isObject = exports.isBoolean = exports.isNumber = exports.isString = exports.createValidator = void 0;
|
|
10
10
|
/**
|
|
11
|
-
* Creates a validation function that safely checks if a value matches
|
|
11
|
+
* Creates a validation function that safely checks if a value matches
|
|
12
|
+
* the expected type. Returns a {@link ValidationResult}.
|
|
13
|
+
*
|
|
14
|
+
* @template T - The validated type
|
|
15
|
+
* @param validationFn - Type guard function
|
|
16
|
+
* @param typeName - Name used in error messages
|
|
17
|
+
* @returns A function returning `ValidationResult<T>`
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const validateString = createValidator(isString, 'string');
|
|
23
|
+
* validateString('hi'); // { isValid: true, data: 'hi' }
|
|
24
|
+
* validateString(42); // { isValid: false, error: 'Invalid string' }
|
|
25
|
+
* ```
|
|
12
26
|
*/
|
|
13
27
|
const createValidator = (validationFn, typeName) => {
|
|
14
28
|
return (data) => {
|
|
@@ -29,22 +43,49 @@ const createValidator = (validationFn, typeName) => {
|
|
|
29
43
|
};
|
|
30
44
|
exports.createValidator = createValidator;
|
|
31
45
|
/**
|
|
32
|
-
*
|
|
46
|
+
* Runtime type guard: checks if value is a `string`.
|
|
47
|
+
* @since 1.0.0
|
|
33
48
|
*/
|
|
34
49
|
const isString = (value) => typeof value === 'string';
|
|
35
50
|
exports.isString = isString;
|
|
51
|
+
/**
|
|
52
|
+
* Runtime type guard: checks if value is a finite `number` (excludes NaN).
|
|
53
|
+
* @since 1.0.0
|
|
54
|
+
*/
|
|
36
55
|
const isNumber = (value) => typeof value === 'number' && !isNaN(value);
|
|
37
56
|
exports.isNumber = isNumber;
|
|
57
|
+
/**
|
|
58
|
+
* Runtime type guard: checks if value is a `boolean`.
|
|
59
|
+
* @since 1.0.0
|
|
60
|
+
*/
|
|
38
61
|
const isBoolean = (value) => typeof value === 'boolean';
|
|
39
62
|
exports.isBoolean = isBoolean;
|
|
63
|
+
/**
|
|
64
|
+
* Runtime type guard: checks if value is a non-null, non-array object.
|
|
65
|
+
* @since 1.0.0
|
|
66
|
+
*/
|
|
40
67
|
const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
41
68
|
exports.isObject = isObject;
|
|
69
|
+
/**
|
|
70
|
+
* Runtime type guard: checks if value is an array.
|
|
71
|
+
* @since 1.0.0
|
|
72
|
+
*/
|
|
42
73
|
const isArray = (value) => Array.isArray(value);
|
|
43
74
|
exports.isArray = isArray;
|
|
75
|
+
/**
|
|
76
|
+
* Runtime type guard: checks if value is `null` or `undefined`.
|
|
77
|
+
* @since 1.0.0
|
|
78
|
+
*/
|
|
44
79
|
const isNullish = (value) => value === null || value === undefined;
|
|
45
80
|
exports.isNullish = isNullish;
|
|
46
81
|
/**
|
|
47
|
-
* Validates that an object has required properties
|
|
82
|
+
* Validates that an object has all required properties present.
|
|
83
|
+
*
|
|
84
|
+
* @template T - Expected object shape
|
|
85
|
+
* @param obj - Value to check
|
|
86
|
+
* @param requiredProps - Array of required property keys
|
|
87
|
+
* @returns True if obj has all required properties
|
|
88
|
+
* @since 1.0.0
|
|
48
89
|
*/
|
|
49
90
|
const hasRequiredProperties = (obj, requiredProps) => {
|
|
50
91
|
if (!(0, exports.isObject)(obj))
|
|
@@ -53,7 +94,13 @@ const hasRequiredProperties = (obj, requiredProps) => {
|
|
|
53
94
|
};
|
|
54
95
|
exports.hasRequiredProperties = hasRequiredProperties;
|
|
55
96
|
/**
|
|
56
|
-
* Validates array
|
|
97
|
+
* Validates that a value is an array where every item passes a validator.
|
|
98
|
+
*
|
|
99
|
+
* @template T - Expected item type
|
|
100
|
+
* @param data - Value to check
|
|
101
|
+
* @param itemValidator - Type guard for individual items
|
|
102
|
+
* @returns True if data is an array of T
|
|
103
|
+
* @since 1.0.0
|
|
57
104
|
*/
|
|
58
105
|
const validateArray = (data, itemValidator) => {
|
|
59
106
|
if (!(0, exports.isArray)(data))
|
|
@@ -62,14 +109,20 @@ const validateArray = (data, itemValidator) => {
|
|
|
62
109
|
};
|
|
63
110
|
exports.validateArray = validateArray;
|
|
64
111
|
/**
|
|
65
|
-
*
|
|
112
|
+
* Wraps a validator to also accept `undefined`.
|
|
113
|
+
*
|
|
114
|
+
* @template T - The validated type
|
|
115
|
+
* @param validator - Base type guard
|
|
116
|
+
* @returns Type guard that also accepts `undefined`
|
|
117
|
+
* @since 1.0.0
|
|
66
118
|
*/
|
|
67
119
|
const optional = (validator) => (value) => {
|
|
68
120
|
return value === undefined || validator(value);
|
|
69
121
|
};
|
|
70
122
|
exports.optional = optional;
|
|
71
123
|
/**
|
|
72
|
-
*
|
|
124
|
+
* Check if data looks like an API response (has `success` boolean).
|
|
125
|
+
* @since 1.0.0
|
|
73
126
|
*/
|
|
74
127
|
const isApiResponse = (data) => {
|
|
75
128
|
return (0, exports.isObject)(data) && (0, exports.isBoolean)(data.success);
|
|
@@ -92,7 +145,8 @@ const isErrorResponse = (data) => {
|
|
|
92
145
|
};
|
|
93
146
|
exports.isErrorResponse = isErrorResponse;
|
|
94
147
|
/**
|
|
95
|
-
*
|
|
148
|
+
* Check if a value is a string that parses to a valid date.
|
|
149
|
+
* @since 1.0.0
|
|
96
150
|
*/
|
|
97
151
|
const isValidDate = (value) => {
|
|
98
152
|
if (!(0, exports.isString)(value))
|
|
@@ -102,7 +156,8 @@ const isValidDate = (value) => {
|
|
|
102
156
|
};
|
|
103
157
|
exports.isValidDate = isValidDate;
|
|
104
158
|
/**
|
|
105
|
-
*
|
|
159
|
+
* Basic email format validation.
|
|
160
|
+
* @since 1.0.0
|
|
106
161
|
*/
|
|
107
162
|
const isEmail = (value) => {
|
|
108
163
|
if (!(0, exports.isString)(value))
|
|
@@ -112,7 +167,8 @@ const isEmail = (value) => {
|
|
|
112
167
|
};
|
|
113
168
|
exports.isEmail = isEmail;
|
|
114
169
|
/**
|
|
115
|
-
* URL validation
|
|
170
|
+
* Basic URL validation using the `URL` constructor.
|
|
171
|
+
* @since 1.0.0
|
|
116
172
|
*/
|
|
117
173
|
const isUrl = (value) => {
|
|
118
174
|
if (!(0, exports.isString)(value))
|
|
@@ -127,7 +183,21 @@ const isUrl = (value) => {
|
|
|
127
183
|
};
|
|
128
184
|
exports.isUrl = isUrl;
|
|
129
185
|
/**
|
|
130
|
-
* Creates a type assertion function that throws on
|
|
186
|
+
* Creates a type assertion function that throws `TypeError` on
|
|
187
|
+
* invalid data. Use with `createValidator` for the non-throwing variant.
|
|
188
|
+
*
|
|
189
|
+
* @template T - The asserted type
|
|
190
|
+
* @param validator - Type guard function
|
|
191
|
+
* @param typeName - Name used in error messages
|
|
192
|
+
* @returns An assertion function
|
|
193
|
+
* @since 1.0.0
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const assertString = createAssertion(isString, 'string');
|
|
198
|
+
* assertString('hello'); // passes
|
|
199
|
+
* assertString(42); // throws TypeError
|
|
200
|
+
* ```
|
|
131
201
|
*/
|
|
132
202
|
const createAssertion = (validator, typeName) => {
|
|
133
203
|
return (data, context = typeName) => {
|
|
@@ -138,7 +208,20 @@ const createAssertion = (validator, typeName) => {
|
|
|
138
208
|
};
|
|
139
209
|
exports.createAssertion = createAssertion;
|
|
140
210
|
/**
|
|
141
|
-
*
|
|
211
|
+
* Safely parse a JSON string, optionally validating the result.
|
|
212
|
+
* Returns a {@link ValidationResult} instead of throwing.
|
|
213
|
+
*
|
|
214
|
+
* @template T - Expected parsed type
|
|
215
|
+
* @param jsonString - JSON string to parse
|
|
216
|
+
* @param validator - Optional type guard to validate the parsed result
|
|
217
|
+
* @returns Validation result with parsed data or error
|
|
218
|
+
* @since 1.0.0
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* const result = parseJson('{"name":"Alice"}');
|
|
223
|
+
* if (result.isValid) console.log(result.data);
|
|
224
|
+
* ```
|
|
142
225
|
*/
|
|
143
226
|
const parseJson = (jsonString, validator) => {
|
|
144
227
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-validation.js","sourceRoot":"","sources":["../../../src/utils/validation/type-validation.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAOH
|
|
1
|
+
{"version":3,"file":"type-validation.js","sourceRoot":"","sources":["../../../src/utils/validation/type-validation.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAOH;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,eAAe,GAAG,CAC7B,YAA0C,EAC1C,QAAgB,EAChB,EAAE;IACF,OAAO,CAAC,IAAa,EAAuB,EAAE;QAC5C,IAAI,CAAC;YACH,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YACjC,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,K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|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/types",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.54",
|
|
4
4
|
"description": "Comprehensive TypeScript types, interfaces, and utilities for Web3 email applications - optimized for AI-assisted development",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"import": "./dist/types/business/enums.js",
|
|
21
21
|
"require": "./dist/types/business/enums.cjs",
|
|
22
22
|
"types": "./dist/types/business/enums.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./blockchain": {
|
|
25
|
+
"import": "./dist/types/blockchain/index.js",
|
|
26
|
+
"require": "./dist/types/blockchain/index.cjs",
|
|
27
|
+
"types": "./dist/types/blockchain/index.d.ts"
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
30
|
"scripts": {
|