@adobe/spacecat-shared-utils 1.64.0 → 1.66.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 +19 -0
- package/package.json +6 -7
- package/src/aem.js +13 -2
- package/src/auth.js +3 -3
- package/src/index.js +1 -1
- package/src/schemas.js +19 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-utils-v1.66.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.65.0...@adobe/spacecat-shared-utils-v1.66.0) (2025-10-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update external fixes ([#1046](https://github.com/adobe/spacecat-shared/issues/1046)) ([bb6e118](https://github.com/adobe/spacecat-shared/commit/bb6e11886b323f73624fcb9e3c2b14d318aa00c9))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* start breaking dependency cycles in `shared` ([#1052](https://github.com/adobe/spacecat-shared/issues/1052)) ([a9ed9e1](https://github.com/adobe/spacecat-shared/commit/a9ed9e1f86bf4049b40bff15122e8f34849e87d7))
|
|
12
|
+
|
|
13
|
+
# [@adobe/spacecat-shared-utils-v1.65.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.64.0...@adobe/spacecat-shared-utils-v1.65.0) (2025-10-24)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* update schemas to make category and region optional for brand aliases ([#1044](https://github.com/adobe/spacecat-shared/issues/1044)) ([d024402](https://github.com/adobe/spacecat-shared/commit/d02440269d557adfb810312badfbfc8ff74cddf3))
|
|
19
|
+
|
|
1
20
|
# [@adobe/spacecat-shared-utils-v1.64.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.63.0...@adobe/spacecat-shared-utils-v1.64.0) (2025-10-24)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.66.0",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@adobe/helix-shared-wrap": "2.0.2",
|
|
45
45
|
"@types/validator": "^13.15.2",
|
|
46
|
-
"chai": "6.0
|
|
46
|
+
"chai": "6.2.0",
|
|
47
47
|
"chai-as-promised": "8.0.2",
|
|
48
48
|
"esmock": "2.7.3",
|
|
49
49
|
"husky": "9.1.7",
|
|
@@ -53,13 +53,12 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@adobe/fetch": "4.2.3",
|
|
56
|
-
"@adobe/spacecat-shared-data-access": "2.45.0",
|
|
57
56
|
"@adobe/spacecat-shared-ims-client": "1.8.3",
|
|
58
|
-
"@aws-sdk/client-s3": "3.
|
|
59
|
-
"@aws-sdk/client-secrets-manager": "3.
|
|
60
|
-
"@aws-sdk/client-sqs": "3.
|
|
57
|
+
"@aws-sdk/client-s3": "3.917.0",
|
|
58
|
+
"@aws-sdk/client-secrets-manager": "3.917.0",
|
|
59
|
+
"@aws-sdk/client-sqs": "3.917.0",
|
|
61
60
|
"@json2csv/plainjs": "7.0.6",
|
|
62
|
-
"aws-xray-sdk": "3.
|
|
61
|
+
"aws-xray-sdk": "3.11.0",
|
|
63
62
|
"cheerio": "1.1.2",
|
|
64
63
|
"date-fns": "4.1.0",
|
|
65
64
|
"franc-min": "6.2.0",
|
package/src/aem.js
CHANGED
|
@@ -13,13 +13,24 @@
|
|
|
13
13
|
/**
|
|
14
14
|
* Delivery types for AEM deployment
|
|
15
15
|
*/
|
|
16
|
-
export const DELIVERY_TYPES = {
|
|
16
|
+
export const DELIVERY_TYPES = /** @type {const} */ ({
|
|
17
17
|
AEM_CS: 'aem_cs',
|
|
18
18
|
AEM_EDGE: 'aem_edge',
|
|
19
19
|
AEM_AMS: 'aem_ams',
|
|
20
20
|
AEM_HEADLESS: 'aem_headless',
|
|
21
21
|
OTHER: 'other',
|
|
22
|
-
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Authoring types for AEM deployment
|
|
26
|
+
*/
|
|
27
|
+
export const AUTHORING_TYPES = /** @type {const} */ ({
|
|
28
|
+
CS_CW: 'cs/crosswalk',
|
|
29
|
+
CS: 'cs',
|
|
30
|
+
SP: 'sharepoint',
|
|
31
|
+
GD: 'googledocs',
|
|
32
|
+
DA: 'documentauthoring',
|
|
33
|
+
});
|
|
23
34
|
|
|
24
35
|
/**
|
|
25
36
|
* Detects the AEM delivery type from HTML source code
|
package/src/auth.js
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
import AWSXray from 'aws-xray-sdk';
|
|
14
14
|
import { GetSecretValueCommand, SecretsManagerClient } from '@aws-sdk/client-secrets-manager';
|
|
15
|
-
import { Site } from '@adobe/spacecat-shared-data-access';
|
|
16
15
|
import { ImsPromiseClient } from '@adobe/spacecat-shared-ims-client';
|
|
17
16
|
import { isString } from './functions.js';
|
|
18
17
|
import { resolveCustomerSecretsName } from './helpers.js';
|
|
18
|
+
import { AUTHORING_TYPES, DELIVERY_TYPES } from './aem.js';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @import {type Site} from "@adobe/spacecat-shared-data-access/src/models/site/index.js"
|
|
@@ -51,10 +51,10 @@ export async function getAccessToken(context, promiseToken) {
|
|
|
51
51
|
* @throws {Error} - If secret is not found or token is missing
|
|
52
52
|
*/
|
|
53
53
|
export async function retrievePageAuthentication(site, context, authOptions = {}) {
|
|
54
|
-
const CS_TYPES = [
|
|
54
|
+
const CS_TYPES = [AUTHORING_TYPES.CS, AUTHORING_TYPES.CS_CW];
|
|
55
55
|
if (site
|
|
56
56
|
&& (CS_TYPES.includes(site.getAuthoringType())
|
|
57
|
-
|| site.getDeliveryType() ===
|
|
57
|
+
|| site.getDeliveryType() === DELIVERY_TYPES.AEM_CS)
|
|
58
58
|
&& authOptions.promiseToken) {
|
|
59
59
|
return getAccessToken(context, authOptions.promiseToken.promise_token);
|
|
60
60
|
}
|
package/src/index.js
CHANGED
|
@@ -99,7 +99,7 @@ export {
|
|
|
99
99
|
isoCalendarWeekMonday,
|
|
100
100
|
} from './calendar-week-helper.js';
|
|
101
101
|
|
|
102
|
-
export { detectAEMVersion, DELIVERY_TYPES } from './aem.js';
|
|
102
|
+
export { detectAEMVersion, DELIVERY_TYPES, AUTHORING_TYPES } from './aem.js';
|
|
103
103
|
|
|
104
104
|
export { determineAEMCSPageId, getPageEditUrl } from './aem-content-api-utils.js';
|
|
105
105
|
|
package/src/schemas.js
CHANGED
|
@@ -76,8 +76,8 @@ export const llmoConfig = z.object({
|
|
|
76
76
|
aliases: z.array(
|
|
77
77
|
z.object({
|
|
78
78
|
aliases: z.array(nonEmptyString),
|
|
79
|
-
category: z.uuid(),
|
|
80
|
-
region: z.union([region, z.array(region)]),
|
|
79
|
+
category: z.uuid().optional(),
|
|
80
|
+
region: z.union([region, z.array(region)]).optional(),
|
|
81
81
|
}),
|
|
82
82
|
),
|
|
83
83
|
}),
|
|
@@ -106,8 +106,23 @@ export const llmoConfig = z.object({
|
|
|
106
106
|
} = value;
|
|
107
107
|
|
|
108
108
|
brands.aliases.forEach((alias, index) => {
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
// Ensure category and region are both provided or both omitted
|
|
110
|
+
if (alias.category && !alias.region) {
|
|
111
|
+
ctx.addIssue({
|
|
112
|
+
code: 'custom',
|
|
113
|
+
path: ['brands', 'aliases', index, 'region'],
|
|
114
|
+
message: 'region is required when category is provided',
|
|
115
|
+
});
|
|
116
|
+
} else if (!alias.category && alias.region) {
|
|
117
|
+
ctx.addIssue({
|
|
118
|
+
code: 'custom',
|
|
119
|
+
path: ['brands', 'aliases', index, 'category'],
|
|
120
|
+
message: 'category is required when region is provided',
|
|
121
|
+
});
|
|
122
|
+
} else if (alias.category && alias.region) {
|
|
123
|
+
ensureCategoryExists(categories, ctx, alias.category, ['brands', 'aliases', index, 'category']);
|
|
124
|
+
ensureRegionCompatibility(categories, ctx, alias.category, alias.region, ['brands', 'aliases', index, 'region'], 'brand alias');
|
|
125
|
+
}
|
|
111
126
|
});
|
|
112
127
|
|
|
113
128
|
competitors.competitors.forEach((competitor, index) => {
|