@adobe/spacecat-shared-utils 1.95.0 → 1.96.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.96.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.96.0...@adobe/spacecat-shared-utils-v1.96.1) (2026-02-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Change aggregation levels for several accessibility issue types ([#1347](https://github.com/adobe/spacecat-shared/issues/1347)) ([f07d153](https://github.com/adobe/spacecat-shared/commit/f07d15372c385efce972ac1044b69a4819f39d0e))
7
+
8
+ # [@adobe/spacecat-shared-utils-v1.96.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.95.0...@adobe/spacecat-shared-utils-v1.96.0) (2026-02-12)
9
+
10
+
11
+ ### Features
12
+
13
+ * get llmo config v2 ([#1340](https://github.com/adobe/spacecat-shared/issues/1340)) ([6fcbd51](https://github.com/adobe/spacecat-shared/commit/6fcbd51864daca13736d3813097c485e2189cd68))
14
+
1
15
  # [@adobe/spacecat-shared-utils-v1.95.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.94.0...@adobe/spacecat-shared-utils-v1.95.0) (2026-02-12)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-utils",
3
- "version": "1.95.0",
3
+ "version": "1.96.1",
4
4
  "description": "Shared modules of the Spacecat Services - utils",
5
5
  "type": "module",
6
6
  "exports": {
@@ -116,12 +116,12 @@ export const ISSUE_GRANULARITY_MAP = {
116
116
  'aria-roles': Granularity.PER_PAGE_PER_COMPONENT,
117
117
  'image-alt': Granularity.PER_PAGE_PER_COMPONENT,
118
118
  'link-in-text-block': Granularity.PER_PAGE_PER_COMPONENT,
119
- 'link-name': Granularity.PER_PAGE_PER_COMPONENT,
119
+ 'link-name': Granularity.PER_COMPONENT,
120
120
  'target-size': Granularity.PER_PAGE_PER_COMPONENT,
121
121
  listitem: Granularity.PER_COMPONENT,
122
122
  label: Granularity.PER_PAGE_PER_COMPONENT,
123
123
  'aria-prohibited-attr': Granularity.PER_TYPE,
124
- 'button-name': Granularity.PER_PAGE_PER_COMPONENT,
124
+ 'button-name': Granularity.PER_COMPONENT,
125
125
  'frame-title': Granularity.PER_PAGE_PER_COMPONENT,
126
126
  'aria-valid-attr-value': Granularity.PER_PAGE_PER_COMPONENT,
127
127
  'aria-allowed-attr': Granularity.PER_TYPE,
@@ -135,7 +135,7 @@ export const ISSUE_GRANULARITY_MAP = {
135
135
  'role-img-alt': Granularity.PER_PAGE_PER_COMPONENT,
136
136
  'aria-input-field-name': Granularity.PER_PAGE_PER_COMPONENT,
137
137
  'scrollable-region-focusable': Granularity.PER_PAGE_PER_COMPONENT,
138
- 'select-name': Granularity.PER_PAGE_PER_COMPONENT,
138
+ 'select-name': Granularity.PER_COMPONENT,
139
139
  };
140
140
 
141
141
  /**
@@ -125,3 +125,67 @@ export async function writeConfig(siteId, config, s3Client, options) {
125
125
  }
126
126
  return { version: res.VersionId };
127
127
  }
128
+
129
+ /**
130
+ * Gets the S3 path for a V2 customer configuration.
131
+ * @param {string} organizationId The SpaceCat organization ID.
132
+ * @returns {string} The S3 key path for the V2 customer config.
133
+ */
134
+ export function customerConfigV2Path(organizationId) {
135
+ return `customer-config-v2/${organizationId}/config.json`;
136
+ }
137
+
138
+ /**
139
+ * Reads the V2 customer configuration for an organization from S3.
140
+ * @param {string} organizationId The SpaceCat organization ID.
141
+ * @param {S3Client} s3Client The S3 client to use for reading the configuration.
142
+ * @param {object} [options]
143
+ * @param {string} [options.s3Bucket] Optional S3 bucket name.
144
+ * @returns {Promise<object|null>} The configuration object or null if not found.
145
+ * @throws {Error} If reading the configuration fails for reasons other than it not existing.
146
+ */
147
+ export async function readCustomerConfigV2(organizationId, s3Client, options) {
148
+ const s3Bucket = options?.s3Bucket || process.env.S3_BUCKET_NAME;
149
+
150
+ const getObjectCommand = new GetObjectCommand({
151
+ Bucket: s3Bucket,
152
+ Key: customerConfigV2Path(organizationId),
153
+ });
154
+
155
+ try {
156
+ const res = await s3Client.send(getObjectCommand);
157
+ const body = res.Body;
158
+ if (!body) {
159
+ throw new Error('Customer config V2 body is empty');
160
+ }
161
+ const text = await body.transformToString();
162
+ return JSON.parse(text);
163
+ } catch (e) {
164
+ if (e.name === 'NoSuchKey' || e.name === 'NotFound') {
165
+ return null;
166
+ }
167
+ throw e;
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Writes the V2 customer configuration for an organization to S3.
173
+ * @param {string} organizationId The SpaceCat organization ID.
174
+ * @param {object} config The customer configuration object to write.
175
+ * @param {S3Client} s3Client The S3 client to use for writing the configuration.
176
+ * @param {object} [options]
177
+ * @param {string} [options.s3Bucket] Optional S3 bucket name.
178
+ * @returns {Promise<void>}
179
+ */
180
+ export async function writeCustomerConfigV2(organizationId, config, s3Client, options) {
181
+ const s3Bucket = options?.s3Bucket || process.env.S3_BUCKET_NAME;
182
+
183
+ const putObjectCommand = new PutObjectCommand({
184
+ Bucket: s3Bucket,
185
+ Key: customerConfigV2Path(organizationId),
186
+ Body: JSON.stringify(config, null, 2),
187
+ ContentType: 'application/json',
188
+ });
189
+
190
+ await s3Client.send(putObjectCommand);
191
+ }