@arex95/vue-core 1.1.43 → 3.0.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.
- package/README.md +90 -57
- package/dist/composables/auth/useAuth.d.ts +20 -6
- package/dist/composables/axios/axiosFetch.d.ts +7 -5
- package/dist/composables/axios/index.d.ts +0 -1
- package/dist/composables/axios/useFetch.d.ts +14 -5
- package/dist/composables/breakpoints/useBreakpoint.d.ts +11 -2
- package/dist/composables/filters/useFilter.d.ts +13 -8
- package/dist/composables/monitoring/useApiActivity.d.ts +17 -6
- package/dist/composables/monitoring/useUserActivity.d.ts +20 -5
- package/dist/composables/paginators/usePaginator.d.ts +13 -5
- package/dist/composables/sorters/useSorter.d.ts +13 -7
- package/dist/config/auth/authFetcher.d.ts +30 -0
- package/dist/config/auth/index.d.ts +1 -0
- package/dist/config/axios/axiosConfig.d.ts +30 -0
- package/dist/config/axios/axiosInstance.d.ts +15 -1
- package/dist/config/global/endpointsConfig.d.ts +9 -13
- package/dist/config/global/keyConfig.d.ts +7 -10
- package/dist/config/global/sessionConfig.d.ts +15 -17
- package/dist/config/global/tokenPathsConfig.d.ts +17 -18
- package/dist/config/global/tokensConfig.d.ts +9 -9
- package/dist/config/index.d.ts +1 -0
- package/dist/enums/breakpointsEnums.d.ts +7 -4
- package/dist/enums/errorsEnums.d.ts +26 -19
- package/dist/enums/fileTypesEnums.d.ts +33 -1
- package/dist/enums/httpExceptionsEnums.d.ts +3 -1
- package/dist/enums/keyCodesEnums.d.ts +2 -4
- package/dist/enums/storageEnums.d.ts +4 -4
- package/dist/errors/AuthError.d.ts +10 -0
- package/dist/errors/BaseError.d.ts +16 -0
- package/dist/errors/NetworkError.d.ts +9 -0
- package/dist/errors/ServerError.d.ts +10 -0
- package/dist/errors/ValidationError.d.ts +14 -0
- package/dist/errors/index.d.ts +5 -0
- package/dist/fetchers/axios.d.ts +22 -0
- package/dist/fetchers/index.d.ts +2 -0
- package/dist/fetchers/ofetch.d.ts +33 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.mjs +1631 -875
- package/dist/rest/RestStd.d.ts +146 -102
- package/dist/services/credentials.d.ts +24 -29
- package/dist/services/extractTokens.d.ts +7 -6
- package/dist/services/refreshTokens.d.ts +11 -12
- package/dist/services/storeTokens.d.ts +8 -6
- package/dist/types/AppKeyConfig.d.ts +7 -0
- package/dist/types/ArexVueCoreOptions.d.ts +20 -0
- package/dist/types/Auth.d.ts +15 -0
- package/dist/types/AxiosOptionsParameter.d.ts +14 -7
- package/dist/types/AxiosServiceOptions.d.ts +9 -0
- package/dist/types/DecodedJwtPayload.d.ts +12 -0
- package/dist/types/EndpointsConfig.d.ts +7 -0
- package/dist/types/ErrorType.d.ts +4 -2
- package/dist/types/ExtendedQueryOptions.d.ts +10 -0
- package/dist/types/Fetcher.d.ts +24 -0
- package/dist/types/RestStdOptions.d.ts +62 -0
- package/dist/types/SessionConfig.d.ts +25 -1
- package/dist/types/TokenConfig.d.ts +7 -0
- package/dist/types/TokenValidationResult.d.ts +7 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/utils/browser.d.ts +20 -14
- package/dist/utils/dates.d.ts +47 -34
- package/dist/utils/debounces.d.ts +54 -32
- package/dist/utils/encryption.d.ts +28 -24
- package/dist/utils/errors.d.ts +27 -8
- package/dist/utils/exports.d.ts +24 -19
- package/dist/utils/files.d.ts +33 -25
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/io.d.ts +70 -54
- package/dist/utils/objects.d.ts +78 -60
- package/dist/utils/retry.d.ts +8 -0
- package/dist/utils/ssr.d.ts +27 -0
- package/dist/utils/storage.d.ts +20 -14
- package/dist/utils/strings.d.ts +42 -31
- package/dist/utils/validations.d.ts +76 -57
- package/package.json +7 -16
package/dist/utils/strings.d.ts
CHANGED
|
@@ -1,63 +1,74 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Capitalizes the first
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
2
|
+
* Capitalizes the first letter of a string.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} s - The input string.
|
|
5
|
+
* @returns {string} The string with the first letter capitalized.
|
|
5
6
|
*/
|
|
6
7
|
export declare function upperFirst(s: string): string;
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
9
|
+
* Converts the first letter of a string to lowercase.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} s - The input string.
|
|
12
|
+
* @returns {string} The string with the first letter in lowercase.
|
|
11
13
|
*/
|
|
12
14
|
export declare function lowerFirst(s: string): string;
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* Normalizes a string by converting it to lowercase, trimming whitespace, replacing spaces with hyphens,
|
|
17
|
+
* and removing diacritical marks (accents).
|
|
18
|
+
*
|
|
19
|
+
* @param {string} input - The string to normalize.
|
|
20
|
+
* @returns {string} The URL-friendly, normalized string.
|
|
17
21
|
*/
|
|
18
22
|
export declare function removeAccent(input: string): string;
|
|
19
23
|
/**
|
|
20
|
-
* Reverses a string.
|
|
21
|
-
*
|
|
24
|
+
* Reverses the characters of a string.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} str - The input string.
|
|
22
27
|
* @returns {string} The reversed string.
|
|
23
28
|
*/
|
|
24
29
|
export declare function reverseString(str: string): string;
|
|
25
30
|
/**
|
|
26
|
-
* Counts the number of words in a string.
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
31
|
+
* Counts the number of words in a string, based on whitespace separation.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} str - The input string.
|
|
34
|
+
* @returns {number} The number of words in the string.
|
|
29
35
|
*/
|
|
30
36
|
export declare function countWords(str: string): number;
|
|
31
37
|
/**
|
|
32
|
-
* Truncates a string to
|
|
33
|
-
*
|
|
34
|
-
* @param {
|
|
38
|
+
* Truncates a string to a specified maximum length, appending '...' if the string is cut.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} str - The input string.
|
|
41
|
+
* @param {number} maxLength - The maximum desired length of the string.
|
|
35
42
|
* @returns {string} The truncated string.
|
|
36
43
|
*/
|
|
37
44
|
export declare function truncateString(str: string, maxLength: number): string;
|
|
38
45
|
/**
|
|
39
|
-
* Converts a string
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
46
|
+
* Converts a string from various cases (e.g., snake_case, kebab-case, space separated) into camelCase.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} str - The input string.
|
|
49
|
+
* @returns {string} The camelCase version of the string.
|
|
42
50
|
*/
|
|
43
51
|
export declare function toCamelCase(str: string): string;
|
|
44
52
|
/**
|
|
45
|
-
* Converts a string
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
53
|
+
* Converts a string from various cases (e.g., camelCase, PascalCase, space separated) into kebab-case.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} str - The input string.
|
|
56
|
+
* @returns {string} The kebab-case version of the string.
|
|
48
57
|
*/
|
|
49
58
|
export declare function toKebabCase(str: string): string;
|
|
50
59
|
/**
|
|
51
|
-
* Replaces all
|
|
52
|
-
*
|
|
53
|
-
* @param {string}
|
|
54
|
-
* @param {string}
|
|
55
|
-
* @
|
|
60
|
+
* Replaces all occurrences of a substring with a new substring.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} str - The original string.
|
|
63
|
+
* @param {string} find - The substring to find and replace.
|
|
64
|
+
* @param {string} replace - The substring to replace with.
|
|
65
|
+
* @returns {string} A new string with all replacements made.
|
|
56
66
|
*/
|
|
57
67
|
export declare function replaceAll(str: string, find: string, replace: string): string;
|
|
58
68
|
/**
|
|
59
|
-
* Generates a random string of a
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
69
|
+
* Generates a random alphanumeric string of a specified length.
|
|
70
|
+
*
|
|
71
|
+
* @param {number} length - The desired length of the random string.
|
|
72
|
+
* @returns {string} The generated random string.
|
|
62
73
|
*/
|
|
63
74
|
export declare function generateRandomString(length: number): string;
|
|
@@ -1,114 +1,133 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
2
|
+
* An event handler that prevents a `KeyboardEvent`'s default action if the key pressed is not a letter or a specific special character.
|
|
3
|
+
*
|
|
4
|
+
* @param {KeyboardEvent} e - The `KeyboardEvent` object.
|
|
5
|
+
* @returns {boolean} `true` if the key is valid, `false` otherwise.
|
|
5
6
|
*/
|
|
6
7
|
export declare function validateLetters(e: KeyboardEvent): boolean;
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
9
|
+
* An event handler that prevents a `KeyboardEvent`'s default action if the key pressed is not an alphanumeric character.
|
|
10
|
+
*
|
|
11
|
+
* @param {KeyboardEvent} e - The `KeyboardEvent` object.
|
|
12
|
+
* @returns {boolean} `true` if the key is valid, `false` otherwise.
|
|
11
13
|
*/
|
|
12
14
|
export declare function validateAlphanumeric(e: KeyboardEvent): boolean;
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @
|
|
16
|
+
* An event handler that prevents a `KeyboardEvent`'s default action if the key pressed is not a number.
|
|
17
|
+
*
|
|
18
|
+
* @param {KeyboardEvent} e - The `KeyboardEvent` object.
|
|
19
|
+
* @returns {boolean} `true` if the key is a number, otherwise `false`.
|
|
17
20
|
*/
|
|
18
21
|
export declare function validateNumbers(e: KeyboardEvent): boolean;
|
|
19
22
|
/**
|
|
20
|
-
* Validates
|
|
21
|
-
*
|
|
22
|
-
* @
|
|
23
|
+
* Validates a phone number against a regex for 10-digit numbers.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} phoneNumber - The phone number to validate.
|
|
26
|
+
* @returns {boolean} `true` if the phone number is valid, otherwise `false`.
|
|
23
27
|
*/
|
|
24
28
|
export declare function isValidPhoneNumber(phoneNumber: string): boolean;
|
|
25
29
|
/**
|
|
26
|
-
* Validates
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
30
|
+
* Validates an email address against a standard regex pattern.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} email - The email address to validate.
|
|
33
|
+
* @returns {boolean} `true` if the email is valid, otherwise `false`.
|
|
29
34
|
*/
|
|
30
35
|
export declare function isValidEmail(email: string): boolean;
|
|
31
36
|
/**
|
|
32
|
-
* Validates
|
|
33
|
-
*
|
|
34
|
-
* @
|
|
37
|
+
* Validates a string to see if it is a well-formed URL.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} url - The URL string to validate.
|
|
40
|
+
* @returns {boolean} `true` if the URL is valid, otherwise `false`.
|
|
35
41
|
*/
|
|
36
42
|
export declare function isValidURL(url: string): boolean;
|
|
37
43
|
/**
|
|
38
|
-
* Validates
|
|
39
|
-
*
|
|
40
|
-
* @
|
|
44
|
+
* Validates a string to ensure it is a valid date in 'YYYY-MM-DD' format.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} date - The date string to validate.
|
|
47
|
+
* @returns {boolean} `true` if the date is valid, otherwise `false`.
|
|
41
48
|
*/
|
|
42
49
|
export declare function isValidDate(date: string): boolean;
|
|
43
50
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* @
|
|
51
|
+
* Checks if a password meets a set of strength requirements (minimum length, uppercase, lowercase, numbers, special characters).
|
|
52
|
+
*
|
|
53
|
+
* @param {string} password - The password to validate.
|
|
54
|
+
* @returns {boolean} `true` if the password is strong, otherwise `false`.
|
|
47
55
|
*/
|
|
48
56
|
export declare function isStrongPassword(password: string): boolean;
|
|
49
57
|
/**
|
|
50
|
-
* Validates a credit card number using the Luhn algorithm.
|
|
51
|
-
*
|
|
52
|
-
* @
|
|
58
|
+
* Validates a credit card number using the Luhn algorithm (mod-10 check).
|
|
59
|
+
*
|
|
60
|
+
* @param {string} cardNumber - The credit card number to validate.
|
|
61
|
+
* @returns {boolean} `true` if the credit card number is valid, otherwise `false`.
|
|
53
62
|
*/
|
|
54
63
|
export declare function isValidCreditCard(cardNumber: string): boolean;
|
|
55
64
|
/**
|
|
56
|
-
* Validates
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
65
|
+
* Validates a string to check if it's a valid 3- or 6-digit hexadecimal color code.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} color - The hex color string to validate.
|
|
68
|
+
* @returns {boolean} `true` if the color code is valid, otherwise `false`.
|
|
59
69
|
*/
|
|
60
70
|
export declare function isValidHexColor(color: string): boolean;
|
|
61
71
|
/**
|
|
62
|
-
* Validates
|
|
63
|
-
*
|
|
64
|
-
* @
|
|
72
|
+
* Validates a string to ensure it represents a valid time in 24-hour HH:MM format.
|
|
73
|
+
*
|
|
74
|
+
* @param {string} time - The time string to validate.
|
|
75
|
+
* @returns {boolean} `true` if the time is valid, otherwise `false`.
|
|
65
76
|
*/
|
|
66
77
|
export declare function isValidTime(time: string): boolean;
|
|
67
78
|
/**
|
|
68
|
-
* Validates
|
|
69
|
-
*
|
|
70
|
-
* @
|
|
79
|
+
* Validates a string to check if it is a valid IPv4 address.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} ip - The IP address string to validate.
|
|
82
|
+
* @returns {boolean} `true` if the IP address is valid, otherwise `false`.
|
|
71
83
|
*/
|
|
72
84
|
export declare function isValidIP(ip: string): boolean;
|
|
73
85
|
/**
|
|
74
|
-
* Validates
|
|
75
|
-
*
|
|
76
|
-
* @
|
|
86
|
+
* Validates a string to check if it matches the format of a U.S. Social Security Number (SSN).
|
|
87
|
+
*
|
|
88
|
+
* @param {string} ssn - The SSN string to validate.
|
|
89
|
+
* @returns {boolean} `true` if the SSN format is valid, otherwise `false`.
|
|
77
90
|
*/
|
|
78
91
|
export declare function isValidSSN(ssn: string): boolean;
|
|
79
92
|
/**
|
|
80
|
-
* Validates
|
|
81
|
-
*
|
|
82
|
-
* @
|
|
93
|
+
* Validates a string to check if it is a valid 5-digit or 9-digit (ZIP+4) U.S. ZIP code.
|
|
94
|
+
*
|
|
95
|
+
* @param {string} zip - The ZIP code string to validate.
|
|
96
|
+
* @returns {boolean} `true` if the ZIP code is valid, otherwise `false`.
|
|
83
97
|
*/
|
|
84
98
|
export declare function isValidZIP(zip: string): boolean;
|
|
85
99
|
/**
|
|
86
|
-
* Validates
|
|
87
|
-
*
|
|
88
|
-
* @
|
|
100
|
+
* Validates a credit card expiry date string (MM/YY format) to ensure it is a valid, non-expired date.
|
|
101
|
+
*
|
|
102
|
+
* @param {string} expiryDate - The expiry date to validate.
|
|
103
|
+
* @returns {boolean} `true` if the expiry date is valid and not in the past, otherwise `false`.
|
|
89
104
|
*/
|
|
90
105
|
export declare function isValidExpiryDate(expiryDate: string): boolean;
|
|
91
106
|
/**
|
|
92
|
-
* Validates
|
|
93
|
-
*
|
|
94
|
-
* @
|
|
107
|
+
* Validates a string to check if it's a valid 8-digit hexadecimal color code (with alpha channel).
|
|
108
|
+
*
|
|
109
|
+
* @param {string} color - The hex color string to validate.
|
|
110
|
+
* @returns {boolean} `true` if the color code is valid, otherwise `false`.
|
|
95
111
|
*/
|
|
96
112
|
export declare function isValidHexColorAlpha(color: string): boolean;
|
|
97
113
|
/**
|
|
98
|
-
* Validates
|
|
99
|
-
*
|
|
100
|
-
* @
|
|
114
|
+
* Validates a username to ensure it contains only alphanumeric characters and underscores, with a length between 3 and 16 characters.
|
|
115
|
+
*
|
|
116
|
+
* @param {string} username - The username to validate.
|
|
117
|
+
* @returns {boolean} `true` if the username is valid, otherwise `false`.
|
|
101
118
|
*/
|
|
102
119
|
export declare function isValidUsername(username: string): boolean;
|
|
103
120
|
/**
|
|
104
|
-
* Validates
|
|
105
|
-
*
|
|
106
|
-
* @
|
|
121
|
+
* Validates a string to ensure it represents a plausible human age (0-120).
|
|
122
|
+
*
|
|
123
|
+
* @param {string} age - The age string to validate.
|
|
124
|
+
* @returns {boolean} `true` if the age is valid, otherwise `false`.
|
|
107
125
|
*/
|
|
108
126
|
export declare function isValidAge(age: string): boolean;
|
|
109
127
|
/**
|
|
110
|
-
* Validates
|
|
111
|
-
*
|
|
112
|
-
* @
|
|
128
|
+
* Validates a string to check if it contains only valid hexadecimal characters.
|
|
129
|
+
*
|
|
130
|
+
* @param {string} hex - The string to validate.
|
|
131
|
+
* @returns {boolean} `true` if the string is a valid hexadecimal number, otherwise `false`.
|
|
113
132
|
*/
|
|
114
133
|
export declare function isValidHexNumber(hex: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arex95/vue-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Opinionated Vue Core",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,9 +20,8 @@
|
|
|
20
20
|
"build": "rollup -c",
|
|
21
21
|
"changelog": "conventional-changelog -p angular -o CHANGELOG.md -r 0",
|
|
22
22
|
"release": "npm version patch && npm run changelog && git add CHANGELOG.md package.json pnpm-lock.yaml && git commit -m \"chore(release): update changelog\" && git push && npm publish --access public",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"test:ui": "vitest --ui"
|
|
23
|
+
"release:major": "npm version major && npm run changelog && git add CHANGELOG.md package.json pnpm-lock.yaml && git commit -m \"chore(release): update changelog\" && git push && npm publish --access public",
|
|
24
|
+
"release:minor": "npm version minor && npm run changelog && git add CHANGELOG.md package.json pnpm-lock.yaml && git commit -m \"chore(release): update changelog\" && git push && npm publish --access public"
|
|
26
25
|
},
|
|
27
26
|
"repository": {
|
|
28
27
|
"type": "git",
|
|
@@ -37,13 +36,12 @@
|
|
|
37
36
|
"author": "Arturo Rafael Serrano Girón",
|
|
38
37
|
"license": "MIT",
|
|
39
38
|
"peerDependencies": {
|
|
40
|
-
"@tanstack/vue-query": ">=5.0.0",
|
|
41
39
|
"@vueuse/core": ">=12.8.2",
|
|
42
40
|
"axios": ">=1.6.0",
|
|
43
41
|
"jwt-decode": "^4.0.0",
|
|
42
|
+
"ofetch": ">=1.0.0",
|
|
44
43
|
"uuid": ">=11.1.0",
|
|
45
|
-
"vue": ">=3.0.0"
|
|
46
|
-
"vue-router": ">=4.5.0"
|
|
44
|
+
"vue": ">=3.0.0"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
47
|
"@eslint/js": "^9.23.0",
|
|
@@ -53,28 +51,21 @@
|
|
|
53
51
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
54
52
|
"@types/crypto-js": "^4.2.2",
|
|
55
53
|
"@types/node": "^22.13.10",
|
|
56
|
-
"@vitest/spy": "^3.2.3",
|
|
57
|
-
"@vitest/ui": "^3.2.3",
|
|
58
|
-
"@vue/test-utils": "^2.4.6",
|
|
59
54
|
"conventional-changelog-cli": "^5.0.0",
|
|
60
55
|
"eslint": "^9.23.0",
|
|
61
56
|
"eslint-plugin-vue": "^10.0.0",
|
|
62
57
|
"globals": "^16.0.0",
|
|
63
|
-
"jsdom": "^26.1.0",
|
|
64
58
|
"rollup": "^4.35.0",
|
|
65
59
|
"ts-node": "^10.9.2",
|
|
66
60
|
"tslib": "^2.8.1",
|
|
67
61
|
"typescript": "^5.8.2",
|
|
68
|
-
"typescript-eslint": "^8.28.0"
|
|
69
|
-
"vitest": "^3.2.3"
|
|
62
|
+
"typescript-eslint": "^8.28.0"
|
|
70
63
|
},
|
|
71
64
|
"dependencies": {
|
|
72
|
-
"@tanstack/vue-query": ">=5.0.0",
|
|
73
65
|
"@vueuse/core": ">=12.8.2",
|
|
74
66
|
"axios": ">=1.6.0",
|
|
75
67
|
"jwt-decode": "^4.0.0",
|
|
76
68
|
"uuid": ">=11.1.0",
|
|
77
|
-
"vue": ">=3.0.0"
|
|
78
|
-
"vue-router": ">=4.5.0"
|
|
69
|
+
"vue": ">=3.0.0"
|
|
79
70
|
}
|
|
80
71
|
}
|