@adobe/spacecat-shared-utils 1.49.0 → 1.50.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/CHANGELOG.md +7 -0
- package/package.json +4 -2
- package/src/functions.js +11 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-utils-v1.50.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.49.0...@adobe/spacecat-shared-utils-v1.50.0) (2025-08-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add email validation function using validator package ([#938](https://github.com/adobe/spacecat-shared/issues/938)) ([5ec8aec](https://github.com/adobe/spacecat-shared/commit/5ec8aec460abbf19fc0756a05da5f50ff7fed79a))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-utils-v1.49.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.48.0...@adobe/spacecat-shared-utils-v1.49.0) (2025-08-26)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.50.0",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@adobe/helix-shared-wrap": "2.0.2",
|
|
38
|
+
"@types/validator": "^13.15.2",
|
|
38
39
|
"chai": "5.2.1",
|
|
39
40
|
"chai-as-promised": "8.0.1",
|
|
40
41
|
"esmock": "2.7.1",
|
|
@@ -52,7 +53,8 @@
|
|
|
52
53
|
"@aws-sdk/client-sqs": "3.864.0",
|
|
53
54
|
"@json2csv/plainjs": "7.0.6",
|
|
54
55
|
"aws-xray-sdk": "3.10.3",
|
|
56
|
+
"date-fns": "2.30.0",
|
|
55
57
|
"uuid": "11.1.0",
|
|
56
|
-
"
|
|
58
|
+
"validator": "^13.15.15"
|
|
57
59
|
}
|
|
58
60
|
}
|
package/src/functions.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { validate as uuidValidate } from 'uuid';
|
|
14
|
+
import isEmail from 'validator/lib/isEmail.js';
|
|
14
15
|
|
|
15
16
|
// Precompile regular expressions
|
|
16
17
|
const REGEX_ISO_DATE = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;
|
|
@@ -261,6 +262,15 @@ function isValidIMSOrgId(imsOrgId) {
|
|
|
261
262
|
return IMS_ORG_ID_REGEX.test(imsOrgId);
|
|
262
263
|
}
|
|
263
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Validates whether the given string is a valid email address.
|
|
267
|
+
* @param {string} email - The string to validate.
|
|
268
|
+
* @returns {boolean} True if the given string is a valid email address, false otherwise.
|
|
269
|
+
*/
|
|
270
|
+
function isValidEmail(email) {
|
|
271
|
+
return typeof email === 'string' && isEmail(email);
|
|
272
|
+
}
|
|
273
|
+
|
|
264
274
|
/**
|
|
265
275
|
* Validates whether the given string is a valid Helix preview URL.
|
|
266
276
|
* Preview URLs have the format: https://ref--site--owner.domain
|
|
@@ -323,6 +333,7 @@ export {
|
|
|
323
333
|
isObject,
|
|
324
334
|
isString,
|
|
325
335
|
isValidDate,
|
|
336
|
+
isValidEmail,
|
|
326
337
|
isValidUrl,
|
|
327
338
|
isValidUUID,
|
|
328
339
|
isValidIMSOrgId,
|
package/src/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export function isInteger(value: unknown): boolean;
|
|
|
23
23
|
|
|
24
24
|
export function isValidDate(value: unknown): boolean;
|
|
25
25
|
|
|
26
|
+
export function isValidEmail(email: string): boolean;
|
|
27
|
+
|
|
26
28
|
export function isIsoDate(str: string): boolean;
|
|
27
29
|
|
|
28
30
|
export function isIsoTimeOffsetsDate(str: string): boolean;
|