@adobe/spacecat-shared-utils 1.64.0 → 1.65.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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [@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)
2
+
3
+
4
+ ### Features
5
+
6
+ * 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))
7
+
1
8
  # [@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
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-utils",
3
- "version": "1.64.0",
3
+ "version": "1.65.0",
4
4
  "description": "Shared modules of the Spacecat Services - utils",
5
5
  "type": "module",
6
6
  "exports": {
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
- ensureCategoryExists(categories, ctx, alias.category, ['brands', 'aliases', index, 'category']);
110
- ensureRegionCompatibility(categories, ctx, alias.category, alias.region, ['brands', 'aliases', index, 'region'], 'brand alias');
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) => {