@endora-commerce/contracts 0.109.0 → 0.110.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.
Files changed (241) hide show
  1. package/dist/actor.d.ts +16 -0
  2. package/dist/actor.d.ts.map +1 -1
  3. package/dist/addresses.d.ts +35 -0
  4. package/dist/addresses.d.ts.map +1 -1
  5. package/dist/addresses.js +8 -1
  6. package/dist/addresses.js.map +1 -1
  7. package/dist/admin-contributions.d.ts +62 -7
  8. package/dist/admin-contributions.d.ts.map +1 -1
  9. package/dist/admin-contributions.js +27 -8
  10. package/dist/admin-contributions.js.map +1 -1
  11. package/dist/admin-roles.d.ts +8 -2
  12. package/dist/admin-roles.d.ts.map +1 -1
  13. package/dist/admin-roles.js.map +1 -1
  14. package/dist/admin-users.d.ts +9 -0
  15. package/dist/admin-users.d.ts.map +1 -1
  16. package/dist/admin.d.ts +77 -4
  17. package/dist/admin.d.ts.map +1 -1
  18. package/dist/admin.js +79 -3
  19. package/dist/admin.js.map +1 -1
  20. package/dist/assets-library.d.ts +26 -0
  21. package/dist/assets-library.d.ts.map +1 -1
  22. package/dist/assets-library.js +6 -3
  23. package/dist/assets-library.js.map +1 -1
  24. package/dist/audit-logs.d.ts +12 -0
  25. package/dist/audit-logs.d.ts.map +1 -1
  26. package/dist/audit-logs.js +12 -0
  27. package/dist/audit-logs.js.map +1 -1
  28. package/dist/blog.d.ts +382 -22
  29. package/dist/blog.d.ts.map +1 -1
  30. package/dist/blog.js +199 -17
  31. package/dist/blog.js.map +1 -1
  32. package/dist/carts.d.ts +394 -36
  33. package/dist/carts.d.ts.map +1 -1
  34. package/dist/carts.js +131 -8
  35. package/dist/carts.js.map +1 -1
  36. package/dist/catalog.d.ts +351 -219
  37. package/dist/catalog.d.ts.map +1 -1
  38. package/dist/catalog.js +209 -157
  39. package/dist/catalog.js.map +1 -1
  40. package/dist/cms-brand.d.ts +14 -14
  41. package/dist/cms.d.ts +41 -16
  42. package/dist/cms.d.ts.map +1 -1
  43. package/dist/cms.js.map +1 -1
  44. package/dist/common.d.ts +23 -6
  45. package/dist/common.d.ts.map +1 -1
  46. package/dist/common.js +25 -2
  47. package/dist/common.js.map +1 -1
  48. package/dist/comparisons.d.ts +28 -21
  49. package/dist/comparisons.d.ts.map +1 -1
  50. package/dist/comparisons.js +2 -1
  51. package/dist/comparisons.js.map +1 -1
  52. package/dist/credit-limits.d.ts +1 -0
  53. package/dist/credit-limits.d.ts.map +1 -1
  54. package/dist/credit-limits.js +14 -0
  55. package/dist/credit-limits.js.map +1 -1
  56. package/dist/crm.d.ts +79 -49
  57. package/dist/crm.d.ts.map +1 -1
  58. package/dist/crm.js +6 -0
  59. package/dist/crm.js.map +1 -1
  60. package/dist/custom-fields.d.ts +27 -13
  61. package/dist/custom-fields.d.ts.map +1 -1
  62. package/dist/custom-fields.js +15 -1
  63. package/dist/custom-fields.js.map +1 -1
  64. package/dist/customer-accounts.d.ts +186 -22
  65. package/dist/customer-accounts.d.ts.map +1 -1
  66. package/dist/customer-accounts.js +39 -0
  67. package/dist/customer-accounts.js.map +1 -1
  68. package/dist/customers.d.ts +40 -73
  69. package/dist/customers.d.ts.map +1 -1
  70. package/dist/customers.js +45 -10
  71. package/dist/customers.js.map +1 -1
  72. package/dist/document-templates.d.ts +12 -12
  73. package/dist/errors.d.ts +119 -1
  74. package/dist/errors.d.ts.map +1 -1
  75. package/dist/errors.js +146 -1
  76. package/dist/errors.js.map +1 -1
  77. package/dist/forms-logic.d.ts +79 -0
  78. package/dist/forms-logic.d.ts.map +1 -0
  79. package/dist/forms-logic.fixtures.d.ts +52 -0
  80. package/dist/forms-logic.fixtures.d.ts.map +1 -0
  81. package/dist/forms-logic.fixtures.js +610 -0
  82. package/dist/forms-logic.fixtures.js.map +1 -0
  83. package/dist/forms-logic.js +699 -0
  84. package/dist/forms-logic.js.map +1 -0
  85. package/dist/forms.d.ts +9833 -0
  86. package/dist/forms.d.ts.map +1 -0
  87. package/dist/forms.js +827 -0
  88. package/dist/forms.js.map +1 -0
  89. package/dist/import-export.d.ts +180 -0
  90. package/dist/import-export.d.ts.map +1 -1
  91. package/dist/import-export.js +60 -0
  92. package/dist/import-export.js.map +1 -1
  93. package/dist/index.d.ts +10 -1
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +18 -0
  96. package/dist/index.js.map +1 -1
  97. package/dist/inventory.d.ts +9 -9
  98. package/dist/invoice-ledger.d.ts +7 -7
  99. package/dist/invoices.d.ts.map +1 -1
  100. package/dist/invoices.js +4 -0
  101. package/dist/invoices.js.map +1 -1
  102. package/dist/mfa.d.ts +124 -4
  103. package/dist/mfa.d.ts.map +1 -1
  104. package/dist/mfa.js +46 -0
  105. package/dist/mfa.js.map +1 -1
  106. package/dist/modules.d.ts +36 -4
  107. package/dist/modules.d.ts.map +1 -1
  108. package/dist/modules.js +68 -0
  109. package/dist/modules.js.map +1 -1
  110. package/dist/money-decimal.d.ts +54 -0
  111. package/dist/money-decimal.d.ts.map +1 -1
  112. package/dist/money-decimal.js +95 -0
  113. package/dist/money-decimal.js.map +1 -1
  114. package/dist/newsletter.d.ts +4 -4
  115. package/dist/orders.d.ts +105 -12
  116. package/dist/orders.d.ts.map +1 -1
  117. package/dist/orders.js +60 -4
  118. package/dist/orders.js.map +1 -1
  119. package/dist/organization-registry-lookup.d.ts +362 -0
  120. package/dist/organization-registry-lookup.d.ts.map +1 -0
  121. package/dist/organization-registry-lookup.js +196 -0
  122. package/dist/organization-registry-lookup.js.map +1 -0
  123. package/dist/organization-roles.d.ts +340 -0
  124. package/dist/organization-roles.d.ts.map +1 -0
  125. package/dist/organization-roles.js +211 -0
  126. package/dist/organization-roles.js.map +1 -0
  127. package/dist/organizations.d.ts +123 -89
  128. package/dist/organizations.d.ts.map +1 -1
  129. package/dist/organizations.js +68 -24
  130. package/dist/organizations.js.map +1 -1
  131. package/dist/page-builder-props.d.ts +56 -56
  132. package/dist/pim-connector.d.ts +7 -3
  133. package/dist/pim-connector.d.ts.map +1 -1
  134. package/dist/pim-connector.js +6 -2
  135. package/dist/pim-connector.js.map +1 -1
  136. package/dist/pim-field-path.d.ts +5 -1
  137. package/dist/pim-field-path.d.ts.map +1 -1
  138. package/dist/pim-field-path.js +37 -81
  139. package/dist/pim-field-path.js.map +1 -1
  140. package/dist/pim-locale-mapping.d.ts +131 -0
  141. package/dist/pim-locale-mapping.d.ts.map +1 -0
  142. package/dist/pim-locale-mapping.js +193 -0
  143. package/dist/pim-locale-mapping.js.map +1 -0
  144. package/dist/price-books.d.ts +67 -63
  145. package/dist/price-books.d.ts.map +1 -1
  146. package/dist/price-books.js +6 -2
  147. package/dist/price-books.js.map +1 -1
  148. package/dist/price-lists.d.ts +8 -8
  149. package/dist/product-feeds.d.ts +94 -94
  150. package/dist/product-feeds.d.ts.map +1 -1
  151. package/dist/product-feeds.js +5 -0
  152. package/dist/product-feeds.js.map +1 -1
  153. package/dist/product-scope-model.d.ts +161 -0
  154. package/dist/product-scope-model.d.ts.map +1 -0
  155. package/dist/product-scope-model.js +161 -0
  156. package/dist/product-scope-model.js.map +1 -0
  157. package/dist/product-scope-overrides.d.ts +0 -103
  158. package/dist/product-scope-overrides.d.ts.map +1 -1
  159. package/dist/product-scope-overrides.js +0 -54
  160. package/dist/product-scope-overrides.js.map +1 -1
  161. package/dist/product-scoped-values.d.ts +2610 -0
  162. package/dist/product-scoped-values.d.ts.map +1 -0
  163. package/dist/product-scoped-values.js +425 -0
  164. package/dist/product-scoped-values.js.map +1 -0
  165. package/dist/product-scopes.d.ts +182 -64
  166. package/dist/product-scopes.d.ts.map +1 -1
  167. package/dist/product-scopes.js +89 -18
  168. package/dist/product-scopes.js.map +1 -1
  169. package/dist/product-tax-rates.d.ts +38 -0
  170. package/dist/product-tax-rates.d.ts.map +1 -0
  171. package/dist/product-tax-rates.js +45 -0
  172. package/dist/product-tax-rates.js.map +1 -0
  173. package/dist/product-url-keys.d.ts +51 -45
  174. package/dist/product-url-keys.d.ts.map +1 -1
  175. package/dist/product-url-keys.js +73 -39
  176. package/dist/product-url-keys.js.map +1 -1
  177. package/dist/product-value-resolver.d.ts +37 -60
  178. package/dist/product-value-resolver.d.ts.map +1 -1
  179. package/dist/product-value-resolver.js +36 -96
  180. package/dist/product-value-resolver.js.map +1 -1
  181. package/dist/projects.d.ts +15 -0
  182. package/dist/projects.d.ts.map +1 -1
  183. package/dist/projects.js +6 -0
  184. package/dist/projects.js.map +1 -1
  185. package/dist/promotions.d.ts +10 -10
  186. package/dist/pwa.d.ts +2 -2
  187. package/dist/quick-order.d.ts +150 -6
  188. package/dist/quick-order.d.ts.map +1 -1
  189. package/dist/quick-order.js +75 -1
  190. package/dist/quick-order.js.map +1 -1
  191. package/dist/quote-requests.d.ts +63 -12
  192. package/dist/quote-requests.d.ts.map +1 -1
  193. package/dist/quote-requests.js +42 -1
  194. package/dist/quote-requests.js.map +1 -1
  195. package/dist/record-references.d.ts.map +1 -1
  196. package/dist/record-references.js +2 -3
  197. package/dist/record-references.js.map +1 -1
  198. package/dist/record-rich-text.d.ts.map +1 -1
  199. package/dist/record-rich-text.js +2 -1
  200. package/dist/record-rich-text.js.map +1 -1
  201. package/dist/returns.d.ts +208 -52
  202. package/dist/returns.d.ts.map +1 -1
  203. package/dist/returns.js +139 -26
  204. package/dist/returns.js.map +1 -1
  205. package/dist/saved-list-views.d.ts +28 -0
  206. package/dist/saved-list-views.d.ts.map +1 -1
  207. package/dist/saved-list-views.js +14 -1
  208. package/dist/saved-list-views.js.map +1 -1
  209. package/dist/scoped-write-encoding.d.ts +100 -0
  210. package/dist/scoped-write-encoding.d.ts.map +1 -0
  211. package/dist/scoped-write-encoding.js +135 -0
  212. package/dist/scoped-write-encoding.js.map +1 -0
  213. package/dist/search.d.ts +18 -16
  214. package/dist/search.d.ts.map +1 -1
  215. package/dist/seo.d.ts +81 -28
  216. package/dist/seo.d.ts.map +1 -1
  217. package/dist/seo.js +8 -1
  218. package/dist/seo.js.map +1 -1
  219. package/dist/settings.d.ts +129 -0
  220. package/dist/settings.d.ts.map +1 -1
  221. package/dist/settings.js +36 -0
  222. package/dist/settings.js.map +1 -1
  223. package/dist/shopping-lists.d.ts +24 -3
  224. package/dist/shopping-lists.d.ts.map +1 -1
  225. package/dist/shopping-lists.js +20 -0
  226. package/dist/shopping-lists.js.map +1 -1
  227. package/dist/storefront-cache-tags.d.ts +12 -0
  228. package/dist/storefront-cache-tags.d.ts.map +1 -1
  229. package/dist/storefront-cache-tags.js +12 -0
  230. package/dist/storefront-cache-tags.js.map +1 -1
  231. package/dist/storefront-value-overrides.d.ts +18 -56
  232. package/dist/storefront-value-overrides.d.ts.map +1 -1
  233. package/dist/storefront-value-overrides.js +11 -86
  234. package/dist/storefront-value-overrides.js.map +1 -1
  235. package/dist/tasks.d.ts +6 -6
  236. package/dist/transactional-emails.d.ts +9 -9
  237. package/package.json +2 -2
  238. package/dist/scoped-translations.d.ts +0 -48
  239. package/dist/scoped-translations.d.ts.map +0 -1
  240. package/dist/scoped-translations.js +0 -78
  241. package/dist/scoped-translations.js.map +0 -1
@@ -1,98 +1,54 @@
1
+ /**
2
+ * Owner: `pim_connector`. Canonical form of a shared field-protection path. Feature 174
3
+ * (`specs/174-product-editor-scope-switcher/contracts/pim-locale-mapping.md` §3, FR-046): a path
4
+ * names a whole field; the locale and channel segments of the 089 grammar are invalid, because
5
+ * protection removes every scope of the field.
6
+ */
7
+ import { isUuidShape } from './common.js';
1
8
  import { pimFieldPathSchema } from './pim-connector.js';
2
- const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3
9
  const ATTRIBUTE_KEY_PATTERN = /^[a-z][a-z0-9_]*$/;
4
10
  const CURRENCY_PATTERN = /^[A-Za-z]{3}$/;
5
- function normaliseLocaleSegment(raw) {
6
- const match = /^([a-z]{2})(?:_([a-z]{2}))?$/i.exec(raw);
7
- if (match === null)
8
- return null;
9
- const primary = match[1].toLowerCase();
10
- const region = match[2];
11
- return region === undefined ? primary : `${primary}_${region.toUpperCase()}`;
12
- }
11
+ const SEO_FIELDS = new Set(['metaTitle', 'metaDescription', 'metaKeywords']);
13
12
  function normaliseUuid(raw) {
14
- return UUID_PATTERN.test(raw) ? raw.toLowerCase() : null;
13
+ return isUuidShape(raw) ? raw.toLowerCase() : null;
15
14
  }
16
- function canonicaliseAttributeBranch(segments) {
17
- if (segments.length < 2 || segments.length > 4)
18
- return null;
19
- const key = segments[1];
20
- if (!ATTRIBUTE_KEY_PATTERN.test(key))
21
- return null;
22
- if (segments.length === 2) {
23
- return `attribute.${key}`;
24
- }
25
- if (segments.length === 3) {
26
- const third = segments[2];
27
- const locale = normaliseLocaleSegment(third);
28
- if (locale !== null) {
29
- return `attribute.${key}.${locale}`;
15
+ function canonicalise(segments) {
16
+ const [head, second, third] = segments;
17
+ switch (head) {
18
+ case 'name':
19
+ case 'description':
20
+ return segments.length === 1 ? head : null;
21
+ case 'attribute':
22
+ return segments.length === 2 && ATTRIBUTE_KEY_PATTERN.test(second) ? `attribute.${second}` : null;
23
+ case 'seo':
24
+ return segments.length === 2 && SEO_FIELDS.has(second) ? `seo.${second}` : null;
25
+ case 'gallery':
26
+ return segments.length === 2 && /^\d+$/.test(second) ? `gallery.${second}` : null;
27
+ case 'attachment':
28
+ case 'category': {
29
+ const id = segments.length === 2 ? normaliseUuid(second) : null;
30
+ return id === null ? null : `${head}.${id}`;
30
31
  }
31
- const channelId = normaliseUuid(third);
32
- if (channelId !== null) {
33
- return `attribute.${key}.${channelId}`;
32
+ case 'price': {
33
+ if (segments.length !== 3)
34
+ return null;
35
+ const priceListId = normaliseUuid(second);
36
+ if (priceListId === null || !CURRENCY_PATTERN.test(third))
37
+ return null;
38
+ return `price.${priceListId}.${third.toUpperCase()}`;
34
39
  }
35
- return null;
40
+ default:
41
+ return null;
36
42
  }
37
- const channelId = normaliseUuid(segments[2]);
38
- const locale = normaliseLocaleSegment(segments[3]);
39
- if (channelId === null || locale === null)
40
- return null;
41
- return `attribute.${key}.${channelId}.${locale}`;
42
43
  }
43
- /**
44
- * Canonical form of a shared field-protection path, or `null` when outside the grammar.
45
- */
44
+ /** Canonical form of a shared field-protection path, or `null` when outside the grammar. */
46
45
  export function canonicalisePimFieldPath(raw) {
47
46
  const value = raw.trim();
48
47
  if (value === '' || value.length > 256)
49
48
  return null;
50
- const segments = value.split('.');
51
- let canonical = null;
52
- if (segments[0] === 'attribute') {
53
- canonical = canonicaliseAttributeBranch(segments);
54
- }
55
- else if (segments[0] === 'seo' && segments.length === 3) {
56
- const field = segments[1];
57
- const locale = normaliseLocaleSegment(segments[2]);
58
- if (locale !== null &&
59
- (field === 'metaTitle' || field === 'metaDescription' || field === 'metaKeywords')) {
60
- canonical = `seo.${field}.${locale}`;
61
- }
62
- }
63
- else if (segments[0] === 'gallery' && segments.length === 2 && /^\d+$/.test(segments[1])) {
64
- canonical = `gallery.${segments[1]}`;
65
- }
66
- else if (segments[0] === 'attachment' && segments.length === 2) {
67
- const assetId = normaliseUuid(segments[1]);
68
- if (assetId !== null)
69
- canonical = `attachment.${assetId}`;
70
- }
71
- else if (segments[0] === 'price' && segments.length === 3) {
72
- const priceListId = normaliseUuid(segments[1]);
73
- const currency = segments[2];
74
- if (priceListId !== null && CURRENCY_PATTERN.test(currency)) {
75
- canonical = `price.${priceListId}.${currency.toUpperCase()}`;
76
- }
77
- }
78
- else if (segments[0] === 'category' && segments.length === 2) {
79
- const categoryId = normaliseUuid(segments[1]);
80
- if (categoryId !== null)
81
- canonical = `category.${categoryId}`;
82
- }
83
- else if (segments[0] === 'name' || segments[0] === 'description') {
84
- if (segments.length === 1) {
85
- canonical = segments[0];
86
- }
87
- else if (segments.length === 2) {
88
- const locale = normaliseLocaleSegment(segments[1]);
89
- if (locale !== null)
90
- canonical = `${segments[0]}.${locale}`;
91
- }
92
- }
93
- if (canonical === null || !pimFieldPathSchema.safeParse(canonical).success) {
49
+ const canonical = canonicalise(value.split('.'));
50
+ if (canonical === null || !pimFieldPathSchema.safeParse(canonical).success)
94
51
  return null;
95
- }
96
52
  return canonical;
97
53
  }
98
54
  export function isValidPimFieldPath(raw) {
@@ -1 +1 @@
1
- {"version":3,"file":"pim-field-path.js","sourceRoot":"","sources":["../src/pim-field-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,YAAY,GAChB,iEAAiE,CAAC;AACpE,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AAClD,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEzC,SAAS,sBAAsB,CAAC,GAAW;IACzC,MAAM,KAAK,GAAG,+BAA+B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,CAAC;IACxC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;AAC/E,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAED,SAAS,2BAA2B,CAAC,QAAkB;IACrD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5D,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;IACzB,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAElD,IAAI,QAAQ,CAAC,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K,IAAI,CAAC;AAChD,CAAC"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Owner: `pim_connector` — the PIM locale mapping contract shared by every PIM connector and by
3
+ * `import_export`'s import profiles. Feature 174 (`specs/174-product-editor-scope-switcher/
4
+ * contracts/pim-locale-mapping.md`; research R13; FR-040…FR-047).
5
+ *
6
+ * A connector (or a CSV profile) states which source locale — optionally from which source
7
+ * channel — feeds which Endora (channel, language) scopes, and which source locale writes Global.
8
+ * The planner turns per-locale source values into scoped writes; values of a locale nothing maps
9
+ * are written nowhere (FR-041). The connectors themselves live outside this repository and
10
+ * configure the mapping in their own screens (FR-045).
11
+ */
12
+ import { z } from 'zod';
13
+ import type { PimFieldPath } from './pim-connector.js';
14
+ import { type FieldPath, type ScopeLevel, type ScopeRef } from './product-scope-model.js';
15
+ import type { ScopedWriteOp } from './scoped-write-encoding.js';
16
+ /** A source locale tag in a PIM's or BCP-47 spelling: `pl_PL`, `pl-PL`, `pl`. */
17
+ export declare const pimLocaleTagSchema: z.ZodString;
18
+ /** An Endora channel content language as a target names it (BCP-47, case-insensitive). */
19
+ export declare const pimTargetLanguageSchema: z.ZodString;
20
+ /** Whether two source locale tags are the same locale: case-insensitive, `_` ≡ `-`. */
21
+ export declare function sameSourceLocale(a: string, b: string): boolean;
22
+ export declare const pimLocaleMappingTargetSchema: z.ZodObject<{
23
+ channelId: z.ZodString;
24
+ languageCode: z.ZodString;
25
+ }, z.core.$strict>;
26
+ export declare const pimLocaleMappingEntrySchema: z.ZodObject<{
27
+ sourceLocale: z.ZodString;
28
+ sourceChannel: z.ZodNullable<z.ZodString>;
29
+ targets: z.ZodArray<z.ZodObject<{
30
+ channelId: z.ZodString;
31
+ languageCode: z.ZodString;
32
+ }, z.core.$strict>>;
33
+ }, z.core.$strict>;
34
+ export type PimLocaleMappingEntry = z.infer<typeof pimLocaleMappingEntrySchema>;
35
+ export declare const pimLocaleMappingEntriesSchema: z.ZodArray<z.ZodObject<{
36
+ sourceLocale: z.ZodString;
37
+ sourceChannel: z.ZodNullable<z.ZodString>;
38
+ targets: z.ZodArray<z.ZodObject<{
39
+ channelId: z.ZodString;
40
+ languageCode: z.ZodString;
41
+ }, z.core.$strict>>;
42
+ }, z.core.$strict>>;
43
+ export declare const pimLocaleMappingSchema: z.ZodObject<{
44
+ sourceLanguageForGlobal: z.ZodNullable<z.ZodString>;
45
+ entries: z.ZodArray<z.ZodObject<{
46
+ sourceLocale: z.ZodString;
47
+ sourceChannel: z.ZodNullable<z.ZodString>;
48
+ targets: z.ZodArray<z.ZodObject<{
49
+ channelId: z.ZodString;
50
+ languageCode: z.ZodString;
51
+ }, z.core.$strict>>;
52
+ }, z.core.$strict>>;
53
+ }, z.core.$strict>;
54
+ export type PimLocaleMapping = z.infer<typeof pimLocaleMappingSchema>;
55
+ /**
56
+ * A source value, always an explicit op (`{ op: 'set', value }`, `{ op: 'empty' }`,
57
+ * `{ op: 'inherit' }`). The planner never inspects a value's shape: a custom-field value that
58
+ * happens to look like an op stays a value of a `set` (S2 block 2 review).
59
+ */
60
+ export type PimSourceValue = ScopedWriteOp<unknown>;
61
+ export interface PimSourceValues {
62
+ /** Non-localizable attributes and fields — always written to Global (FR-047). */
63
+ global: Partial<Record<FieldPath, PimSourceValue>>;
64
+ /** Localizable values per source locale (and optional source channel). */
65
+ perLocale: Array<{
66
+ locale: string;
67
+ sourceChannel: string | null;
68
+ values: Partial<Record<FieldPath, PimSourceValue>>;
69
+ }>;
70
+ }
71
+ export interface PlannedWrite {
72
+ scope: ScopeRef;
73
+ field: FieldPath;
74
+ op: ScopedWriteOp<unknown>;
75
+ }
76
+ export interface LocaleWritePlan {
77
+ writes: PlannedWrite[];
78
+ /** Run warning (FR-041): source groups nothing maps, written nowhere. */
79
+ unmapped: Array<{
80
+ locale: string;
81
+ sourceChannel: string | null;
82
+ }>;
83
+ /** Per product (FR-042): mapped targets the product is not valid for. */
84
+ skipped: Array<{
85
+ scope: ScopeRef;
86
+ reason: 'not_a_member' | 'language_not_offered';
87
+ }>;
88
+ }
89
+ /**
90
+ * Plan the scoped writes of one product's source values (`pim-locale-mapping.md` §2):
91
+ *
92
+ * 1. `global` → Global.
93
+ * 2. The group of `sourceLanguageForGlobal` → Global, **and** its mapped targets if any.
94
+ * 3. A group matched by an entry → each target as C×L. An entry with a source channel matches only
95
+ * that source channel and wins over an entry with `null` for the same locale.
96
+ * 4. A group nothing matches (and not the Global source) → `unmapped`, written nowhere.
97
+ * 5. A target outside `validScopes` → `skipped`; the other targets are still written.
98
+ * 6. A field whose scope set lacks C×L is written at the target's channel, never at C×L.
99
+ * 7. Two groups on one (field, scope): the one matched by a specific entry wins, then the one whose
100
+ * entry comes first in mapping order. `global` wins over every group at Global.
101
+ *
102
+ * `fieldLevels` answers a field's scope set; attributes need it (their set is the definition's).
103
+ * When it answers `undefined`, the family's row of `PRODUCT_FIELD_SCOPE_SETS` applies, else every
104
+ * level (the writer then refuses the cell, `FIELD_NOT_AT_SCOPE`).
105
+ */
106
+ export declare function planLocaleWrites(input: {
107
+ source: PimSourceValues;
108
+ mapping: PimLocaleMapping;
109
+ validScopes: {
110
+ channels: ReadonlyArray<{
111
+ channelId: string;
112
+ languages: readonly string[];
113
+ }>;
114
+ };
115
+ fieldLevels?: (field: FieldPath) => readonly ScopeLevel[] | undefined;
116
+ }): LocaleWritePlan;
117
+ /** The protection path a scoped field path is protected by, or `null` when no path addresses it. */
118
+ export declare function protectionPathOf(field: string): PimFieldPath | null;
119
+ /**
120
+ * Drop every write whose field a protected path names (FR-046): protection is whole-field, so
121
+ * every scope of the field goes. `toPath` maps a field to its protection path (default
122
+ * {@link protectionPathOf}; a connector that addresses gallery or attachment fields by its own
123
+ * identifiers passes its own).
124
+ */
125
+ export declare function filterProtectedWrites<W extends {
126
+ field: string;
127
+ }>(writes: readonly W[], protectedPaths: readonly PimFieldPath[], toPath?: (field: string) => string | null): {
128
+ kept: W[];
129
+ protected: number;
130
+ };
131
+ //# sourceMappingURL=pim-locale-mapping.d.ts.map
@@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,CAAC,EAAE,EACpB,cAAc,EAAE,SAAS,YAAY,EAAE,EACvC,MAAM,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAuB,GAC1D;IAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAUlC"}
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Owner: `pim_connector` — the PIM locale mapping contract shared by every PIM connector and by
3
+ * `import_export`'s import profiles. Feature 174 (`specs/174-product-editor-scope-switcher/
4
+ * contracts/pim-locale-mapping.md`; research R13; FR-040…FR-047).
5
+ *
6
+ * A connector (or a CSV profile) states which source locale — optionally from which source
7
+ * channel — feeds which Endora (channel, language) scopes, and which source locale writes Global.
8
+ * The planner turns per-locale source values into scoped writes; values of a locale nothing maps
9
+ * are written nowhere (FR-041). The connectors themselves live outside this repository and
10
+ * configure the mapping in their own screens (FR-045).
11
+ */
12
+ import { z } from 'zod';
13
+ import { uuidSchema } from './common.js';
14
+ import { fieldScopeSpec } from './product-scope-model.js';
15
+ /** A source locale tag in a PIM's or BCP-47 spelling: `pl_PL`, `pl-PL`, `pl`. */
16
+ export const pimLocaleTagSchema = z.string().regex(/^[a-z]{2,3}([_-][A-Za-z]{2})?$/, 'locale tag');
17
+ /** An Endora channel content language as a target names it (BCP-47, case-insensitive). */
18
+ export const pimTargetLanguageSchema = z.string().max(16).regex(/^[a-z]{2,3}(-[a-z]{2})?$/i, 'BCP-47 language tag');
19
+ /** Whether two source locale tags are the same locale: case-insensitive, `_` ≡ `-`. */
20
+ export function sameSourceLocale(a, b) {
21
+ return a.replace('_', '-').toLowerCase() === b.replace('_', '-').toLowerCase();
22
+ }
23
+ export const pimLocaleMappingTargetSchema = z.object({ channelId: uuidSchema, languageCode: pimTargetLanguageSchema }).strict();
24
+ export const pimLocaleMappingEntrySchema = z
25
+ .object({
26
+ sourceLocale: pimLocaleTagSchema,
27
+ /** The PIM's channel / scope code; `null` = any source channel. */
28
+ sourceChannel: z.string().min(1).max(100).nullable(),
29
+ targets: z.array(pimLocaleMappingTargetSchema).min(1).max(64),
30
+ })
31
+ .strict();
32
+ function hasNoDuplicateEntry(entries) {
33
+ const seen = new Set();
34
+ for (const entry of entries) {
35
+ const key = `${entry.sourceLocale.replace('_', '-').toLowerCase()}|${entry.sourceChannel ?? ''}`;
36
+ if (seen.has(key))
37
+ return false;
38
+ seen.add(key);
39
+ }
40
+ return true;
41
+ }
42
+ export const pimLocaleMappingEntriesSchema = z
43
+ .array(pimLocaleMappingEntrySchema)
44
+ .max(500)
45
+ .refine(hasNoDuplicateEntry, { message: 'Two entries map the same source locale and source channel.' });
46
+ export const pimLocaleMappingSchema = z
47
+ .object({
48
+ /** The source locale whose localizable values are written to Global (FR-047); `null` = none. */
49
+ sourceLanguageForGlobal: pimLocaleTagSchema.nullable(),
50
+ entries: pimLocaleMappingEntriesSchema,
51
+ })
52
+ .strict();
53
+ function toOp(raw) {
54
+ return raw;
55
+ }
56
+ function baseOf(tag) {
57
+ return tag.toLowerCase().split('-')[0];
58
+ }
59
+ /**
60
+ * The channel's own spelling of `languageCode`: an exact case-insensitive match, else the one
61
+ * channel language sharing its base language (`pl` → `pl-PL`); `null` when the channel does not
62
+ * offer it (or the base is ambiguous).
63
+ */
64
+ function channelSpelling(languages, languageCode) {
65
+ const exact = languages.find((language) => language.toLowerCase() === languageCode.toLowerCase());
66
+ if (exact !== undefined)
67
+ return exact;
68
+ const sameBase = languages.filter((language) => baseOf(language) === baseOf(languageCode));
69
+ return sameBase.length === 1 ? sameBase[0] : null;
70
+ }
71
+ function scopeKey(field, scope) {
72
+ if (scope.level === 'global')
73
+ return `${field}@G`;
74
+ if (scope.level === 'channel')
75
+ return `${field}@${scope.channelId}`;
76
+ return `${field}@${scope.channelId}/${scope.languageCode.toLowerCase()}`;
77
+ }
78
+ /**
79
+ * Plan the scoped writes of one product's source values (`pim-locale-mapping.md` §2):
80
+ *
81
+ * 1. `global` → Global.
82
+ * 2. The group of `sourceLanguageForGlobal` → Global, **and** its mapped targets if any.
83
+ * 3. A group matched by an entry → each target as C×L. An entry with a source channel matches only
84
+ * that source channel and wins over an entry with `null` for the same locale.
85
+ * 4. A group nothing matches (and not the Global source) → `unmapped`, written nowhere.
86
+ * 5. A target outside `validScopes` → `skipped`; the other targets are still written.
87
+ * 6. A field whose scope set lacks C×L is written at the target's channel, never at C×L.
88
+ * 7. Two groups on one (field, scope): the one matched by a specific entry wins, then the one whose
89
+ * entry comes first in mapping order. `global` wins over every group at Global.
90
+ *
91
+ * `fieldLevels` answers a field's scope set; attributes need it (their set is the definition's).
92
+ * When it answers `undefined`, the family's row of `PRODUCT_FIELD_SCOPE_SETS` applies, else every
93
+ * level (the writer then refuses the cell, `FIELD_NOT_AT_SCOPE`).
94
+ */
95
+ export function planLocaleWrites(input) {
96
+ const { source, mapping, validScopes } = input;
97
+ const levelsOf = (field) => input.fieldLevels?.(field) ?? fieldScopeSpec(field)?.levels ?? ['G', 'C', 'CL'];
98
+ // Winner per (field, scope): rank = [specific ? 0 : 1, entry index]; lower wins.
99
+ const chosen = new Map();
100
+ let order = 0;
101
+ const offer = (write, rank) => {
102
+ const key = scopeKey(write.field, write.scope);
103
+ const current = chosen.get(key);
104
+ if (current === undefined) {
105
+ chosen.set(key, { write, rank, order: order++ });
106
+ return;
107
+ }
108
+ const better = rank[0] < current.rank[0] || (rank[0] === current.rank[0] && rank[1] < current.rank[1]);
109
+ if (better)
110
+ chosen.set(key, { write, rank, order: current.order });
111
+ };
112
+ for (const [field, raw] of Object.entries(source.global)) {
113
+ if (raw === undefined)
114
+ continue;
115
+ offer({ scope: { level: 'global' }, field, op: toOp(raw) }, [-1, -1]);
116
+ }
117
+ const unmapped = [];
118
+ const skipped = [];
119
+ const skippedKeys = new Set();
120
+ for (const group of source.perLocale) {
121
+ const isGlobalSource = mapping.sourceLanguageForGlobal !== null && sameSourceLocale(mapping.sourceLanguageForGlobal, group.locale);
122
+ const candidates = mapping.entries
123
+ .map((entry, index) => ({ entry, index }))
124
+ .filter(({ entry }) => sameSourceLocale(entry.sourceLocale, group.locale))
125
+ .filter(({ entry }) => entry.sourceChannel === null || entry.sourceChannel === group.sourceChannel);
126
+ const specific = candidates.find(({ entry }) => entry.sourceChannel !== null);
127
+ const match = specific ?? candidates[0];
128
+ if (isGlobalSource) {
129
+ for (const [field, raw] of Object.entries(group.values)) {
130
+ if (raw === undefined)
131
+ continue;
132
+ offer({ scope: { level: 'global' }, field, op: toOp(raw) }, [0, -1]);
133
+ }
134
+ }
135
+ if (match === undefined) {
136
+ if (!isGlobalSource)
137
+ unmapped.push({ locale: group.locale, sourceChannel: group.sourceChannel });
138
+ continue;
139
+ }
140
+ const rank = [match.entry.sourceChannel !== null ? 0 : 1, match.index];
141
+ for (const target of match.entry.targets) {
142
+ const channel = validScopes.channels.find((c) => c.channelId === target.channelId);
143
+ const spelled = channel === undefined ? null : channelSpelling(channel.languages, target.languageCode);
144
+ if (channel === undefined || spelled === null) {
145
+ const scope = { level: 'channel_language', channelId: target.channelId, languageCode: target.languageCode };
146
+ const key = scopeKey('', scope);
147
+ if (!skippedKeys.has(key)) {
148
+ skippedKeys.add(key);
149
+ skipped.push({ scope, reason: channel === undefined ? 'not_a_member' : 'language_not_offered' });
150
+ }
151
+ continue;
152
+ }
153
+ for (const [field, raw] of Object.entries(group.values)) {
154
+ if (raw === undefined)
155
+ continue;
156
+ const scope = levelsOf(field).includes('CL')
157
+ ? { level: 'channel_language', channelId: channel.channelId, languageCode: spelled }
158
+ : { level: 'channel', channelId: channel.channelId };
159
+ offer({ scope, field, op: toOp(raw) }, rank);
160
+ }
161
+ }
162
+ }
163
+ const writes = [...chosen.values()].sort((a, b) => a.order - b.order).map((entry) => entry.write);
164
+ return { writes, unmapped, skipped };
165
+ }
166
+ /** The protection path a scoped field path is protected by, or `null` when no path addresses it. */
167
+ export function protectionPathOf(field) {
168
+ if (field === 'name' || field === 'description')
169
+ return field;
170
+ if (field.startsWith('attribute:'))
171
+ return `attribute.${field.slice('attribute:'.length)}`;
172
+ return null;
173
+ }
174
+ /**
175
+ * Drop every write whose field a protected path names (FR-046): protection is whole-field, so
176
+ * every scope of the field goes. `toPath` maps a field to its protection path (default
177
+ * {@link protectionPathOf}; a connector that addresses gallery or attachment fields by its own
178
+ * identifiers passes its own).
179
+ */
180
+ export function filterProtectedWrites(writes, protectedPaths, toPath = protectionPathOf) {
181
+ const blocked = new Set(protectedPaths);
182
+ const kept = [];
183
+ let count = 0;
184
+ for (const write of writes) {
185
+ const path = toPath(write.field);
186
+ if (path !== null && blocked.has(path))
187
+ count += 1;
188
+ else
189
+ kept.push(write);
190
+ }
191
+ return { kept, protected: count };
192
+ }
193
+ //# sourceMappingURL=pim-locale-mapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pim-locale-mapping.js","sourceRoot":"","sources":["../src/pim-locale-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAkD,MAAM,0BAA0B,CAAC;AAG1G,iFAAiF;AACjF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gCAAgC,EAAE,YAAY,CAAC,CAAC;AAEnG,0FAA0F;AAC1F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,2BAA2B,EAAE,qBAAqB,CAAC,CAAC;AAEpH,uFAAuF;AACvF,MAAM,UAAU,gBAAgB,CAAC,CAAS,EAAE,CAAS;IACnD,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,E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