@adobe/spacecat-shared-utils 1.49.0 → 1.50.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@adobe/spacecat-shared-utils-v1.50.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.50.0...@adobe/spacecat-shared-utils-v1.50.1) (2025-09-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update external fixes ([#920](https://github.com/adobe/spacecat-shared/issues/920)) ([1a6b1e1](https://github.com/adobe/spacecat-shared/commit/1a6b1e1ac9531a41c86406ada4bd4ab903307fdc))
7
+
8
+ # [@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)
9
+
10
+
11
+ ### Features
12
+
13
+ * 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))
14
+
1
15
  # [@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
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-utils",
3
- "version": "1.49.0",
3
+ "version": "1.50.1",
4
4
  "description": "Shared modules of the Spacecat Services - utils",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,24 +35,26 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@adobe/helix-shared-wrap": "2.0.2",
38
- "chai": "5.2.1",
39
- "chai-as-promised": "8.0.1",
40
- "esmock": "2.7.1",
38
+ "@types/validator": "^13.15.2",
39
+ "chai": "5.3.3",
40
+ "chai-as-promised": "8.0.2",
41
+ "esmock": "2.7.2",
41
42
  "husky": "9.1.7",
42
- "nock": "14.0.9",
43
+ "nock": "14.0.10",
43
44
  "sinon": "20.0.0",
44
- "sinon-chai": "4.0.0"
45
+ "sinon-chai": "4.0.1"
45
46
  },
46
47
  "dependencies": {
47
48
  "@adobe/fetch": "4.2.2",
48
49
  "@adobe/spacecat-shared-data-access": "2.45.0",
49
50
  "@adobe/spacecat-shared-ims-client": "1.8.3",
50
- "@aws-sdk/client-s3": "3.864.0",
51
- "@aws-sdk/client-secrets-manager": "3.864.0",
52
- "@aws-sdk/client-sqs": "3.864.0",
51
+ "@aws-sdk/client-s3": "3.883.0",
52
+ "@aws-sdk/client-secrets-manager": "3.883.0",
53
+ "@aws-sdk/client-sqs": "3.883.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
- "date-fns": "2.30.0"
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;
package/src/index.js CHANGED
@@ -26,6 +26,7 @@ export {
26
26
  isObject,
27
27
  isString,
28
28
  isValidDate,
29
+ isValidEmail,
29
30
  isValidUrl,
30
31
  isValidUUID,
31
32
  isValidIMSOrgId,