@adobe/spacecat-shared-utils 1.71.0 → 1.72.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 +14 -0
- package/package.json +1 -1
- package/src/index.d.ts +2 -2
- package/src/schemas.js +19 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-utils-v1.72.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.72.0...@adobe/spacecat-shared-utils-v1.72.1) (2025-11-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **spacecat-shared-data-access/src/models/site/config.js:** add suppo… ([#1118](https://github.com/adobe/spacecat-shared/issues/1118)) ([7123b3c](https://github.com/adobe/spacecat-shared/commit/7123b3c30abb80ba3f2de040417ea3d86660bcc5))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-utils-v1.72.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.71.0...@adobe/spacecat-shared-utils-v1.72.0) (2025-11-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* added interface correct definition ([#1114](https://github.com/adobe/spacecat-shared/issues/1114)) ([e377dab](https://github.com/adobe/spacecat-shared/commit/e377dabc263200e6c393ebf40c65e8c41fb134cb))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-utils-v1.71.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.70.1...@adobe/spacecat-shared-utils-v1.71.0) (2025-11-11)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -277,12 +277,12 @@ export function isoCalendarWeekMonday(date: Date): Date;
|
|
|
277
277
|
* @param opts - Options object
|
|
278
278
|
* @param opts.opportunity - The opportunity object
|
|
279
279
|
* @param opts.suggestion - The suggestion object
|
|
280
|
-
* @returns
|
|
280
|
+
* @returns A promise that resolves to an array of extracted URLs
|
|
281
281
|
*/
|
|
282
282
|
export function extractUrlsFromSuggestion(opts: {
|
|
283
283
|
opportunity: any;
|
|
284
284
|
suggestion: any;
|
|
285
|
-
}): string[]
|
|
285
|
+
}): Promise<string[]>;
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
288
|
* Extracts URLs from an opportunity based on the opportunity type.
|
package/src/schemas.js
CHANGED
|
@@ -89,6 +89,7 @@ export const llmoConfig = z.object({
|
|
|
89
89
|
entities: z.record(z.uuid(), entity),
|
|
90
90
|
categories: z.record(z.uuid(), category),
|
|
91
91
|
topics: z.record(z.uuid(), topic),
|
|
92
|
+
aiTopics: z.record(z.uuid(), topic).optional(),
|
|
92
93
|
brands: z.object({
|
|
93
94
|
aliases: z.array(
|
|
94
95
|
z.object({
|
|
@@ -148,6 +149,21 @@ export const llmoConfig = z.object({
|
|
|
148
149
|
});
|
|
149
150
|
|
|
150
151
|
// Validate topic prompts regions against their category
|
|
152
|
+
validateTopicPromptRegions(categories, ctx, topics, 'topics');
|
|
153
|
+
|
|
154
|
+
// Validate aiTopics prompts regions against their category
|
|
155
|
+
if (value.aiTopics) {
|
|
156
|
+
validateTopicPromptRegions(categories, ctx, value.aiTopics, 'aiTopics');
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @param {LLMOConfig['categories']} categories
|
|
162
|
+
* @param {z.RefinementCtx} ctx
|
|
163
|
+
* @param {Record<string, z.infer<typeof topic>>} topics
|
|
164
|
+
* @param {string} topicsKey - The key name in the path (e.g., 'topics' or 'aiTopics')
|
|
165
|
+
*/
|
|
166
|
+
function validateTopicPromptRegions(categories, ctx, topics, topicsKey) {
|
|
151
167
|
Object.entries(topics).forEach(([topicId, topicEntity]) => {
|
|
152
168
|
if (topicEntity.prompts && topicEntity.category) {
|
|
153
169
|
// If category is a UUID, validate against the referenced category entity
|
|
@@ -158,14 +174,14 @@ export const llmoConfig = z.object({
|
|
|
158
174
|
ctx,
|
|
159
175
|
topicEntity.category,
|
|
160
176
|
promptItem.regions,
|
|
161
|
-
[
|
|
162
|
-
|
|
177
|
+
[topicsKey, topicId, 'prompts', promptIndex, 'regions'],
|
|
178
|
+
`${topicsKey} prompt`,
|
|
163
179
|
);
|
|
164
180
|
});
|
|
165
181
|
}
|
|
166
182
|
}
|
|
167
183
|
});
|
|
168
|
-
}
|
|
184
|
+
}
|
|
169
185
|
|
|
170
186
|
/**
|
|
171
187
|
* @param {LLMOConfig['categories']} categories
|