@endora-commerce/contracts 0.108.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.
- package/dist/actor.d.ts +16 -0
- package/dist/actor.d.ts.map +1 -1
- package/dist/addresses.d.ts +35 -0
- package/dist/addresses.d.ts.map +1 -1
- package/dist/addresses.js +8 -1
- package/dist/addresses.js.map +1 -1
- package/dist/admin-actions.d.ts +12 -3
- package/dist/admin-actions.d.ts.map +1 -1
- package/dist/admin-actions.js +34 -3
- package/dist/admin-actions.js.map +1 -1
- package/dist/admin-contributions.d.ts +94 -10
- package/dist/admin-contributions.d.ts.map +1 -1
- package/dist/admin-contributions.js +65 -0
- package/dist/admin-contributions.js.map +1 -1
- package/dist/admin-notifications.d.ts +17 -1
- package/dist/admin-notifications.d.ts.map +1 -1
- package/dist/admin-preferences.d.ts +108 -0
- package/dist/admin-preferences.d.ts.map +1 -0
- package/dist/admin-preferences.js +133 -0
- package/dist/admin-preferences.js.map +1 -0
- package/dist/admin-roles.d.ts +8 -2
- package/dist/admin-roles.d.ts.map +1 -1
- package/dist/admin-roles.js.map +1 -1
- package/dist/admin-users.d.ts +9 -0
- package/dist/admin-users.d.ts.map +1 -1
- package/dist/admin.d.ts +92 -5
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +86 -3
- package/dist/admin.js.map +1 -1
- package/dist/assets-library.d.ts +123 -3
- package/dist/assets-library.d.ts.map +1 -1
- package/dist/assets-library.js +11 -3
- package/dist/assets-library.js.map +1 -1
- package/dist/audit-logs.d.ts +12 -0
- package/dist/audit-logs.d.ts.map +1 -1
- package/dist/audit-logs.js +12 -0
- package/dist/audit-logs.js.map +1 -1
- package/dist/blog.d.ts +431 -14
- package/dist/blog.d.ts.map +1 -1
- package/dist/blog.js +251 -7
- package/dist/blog.js.map +1 -1
- package/dist/carts.d.ts +507 -92
- package/dist/carts.d.ts.map +1 -1
- package/dist/carts.js +197 -21
- package/dist/carts.js.map +1 -1
- package/dist/catalog.d.ts +515 -144
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +356 -68
- package/dist/catalog.js.map +1 -1
- package/dist/cms-brand.d.ts +2233 -0
- package/dist/cms-brand.d.ts.map +1 -0
- package/dist/cms-brand.js +311 -0
- package/dist/cms-brand.js.map +1 -0
- package/dist/cms-contact-form.d.ts +55 -0
- package/dist/cms-contact-form.d.ts.map +1 -0
- package/dist/cms-contact-form.js +100 -0
- package/dist/cms-contact-form.js.map +1 -0
- package/dist/cms.d.ts +576 -17
- package/dist/cms.d.ts.map +1 -1
- package/dist/cms.js +251 -0
- package/dist/cms.js.map +1 -1
- package/dist/common.d.ts +23 -6
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +25 -2
- package/dist/common.js.map +1 -1
- package/dist/comparisons.d.ts +28 -21
- package/dist/comparisons.d.ts.map +1 -1
- package/dist/comparisons.js +2 -1
- package/dist/comparisons.js.map +1 -1
- package/dist/credit-limits.d.ts +1 -0
- package/dist/credit-limits.d.ts.map +1 -1
- package/dist/credit-limits.js +14 -0
- package/dist/credit-limits.js.map +1 -1
- package/dist/crm-rich-text.d.ts +10 -61
- package/dist/crm-rich-text.d.ts.map +1 -1
- package/dist/crm-rich-text.js +10 -300
- package/dist/crm-rich-text.js.map +1 -1
- package/dist/crm.d.ts +173 -115
- package/dist/crm.d.ts.map +1 -1
- package/dist/crm.js +35 -88
- package/dist/crm.js.map +1 -1
- package/dist/custom-fields.d.ts +54 -22
- package/dist/custom-fields.d.ts.map +1 -1
- package/dist/custom-fields.js +21 -1
- package/dist/custom-fields.js.map +1 -1
- package/dist/customer-accounts.d.ts +216 -22
- package/dist/customer-accounts.d.ts.map +1 -1
- package/dist/customer-accounts.js +70 -0
- package/dist/customer-accounts.js.map +1 -1
- package/dist/customers.d.ts +40 -73
- package/dist/customers.d.ts.map +1 -1
- package/dist/customers.js +45 -10
- package/dist/customers.js.map +1 -1
- package/dist/document-templates.d.ts +35 -23
- package/dist/document-templates.d.ts.map +1 -1
- package/dist/document-values.d.ts +8 -0
- package/dist/document-values.d.ts.map +1 -1
- package/dist/document-values.js +24 -6
- package/dist/document-values.js.map +1 -1
- package/dist/email.d.ts +5 -0
- package/dist/email.d.ts.map +1 -1
- package/dist/errors.d.ts +224 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +269 -1
- package/dist/errors.js.map +1 -1
- package/dist/forms-logic.d.ts +79 -0
- package/dist/forms-logic.d.ts.map +1 -0
- package/dist/forms-logic.fixtures.d.ts +52 -0
- package/dist/forms-logic.fixtures.d.ts.map +1 -0
- package/dist/forms-logic.fixtures.js +610 -0
- package/dist/forms-logic.fixtures.js.map +1 -0
- package/dist/forms-logic.js +699 -0
- package/dist/forms-logic.js.map +1 -0
- package/dist/forms.d.ts +9833 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +827 -0
- package/dist/forms.js.map +1 -0
- package/dist/import-export.d.ts +180 -0
- package/dist/import-export.d.ts.map +1 -1
- package/dist/import-export.js +60 -0
- package/dist/import-export.js.map +1 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -1
- package/dist/inventory.d.ts +6 -6
- package/dist/invoice-ledger.d.ts +7 -7
- package/dist/invoices.d.ts +6 -2
- package/dist/invoices.d.ts.map +1 -1
- package/dist/invoices.js +7 -0
- package/dist/invoices.js.map +1 -1
- package/dist/megamenu.d.ts +674 -0
- package/dist/megamenu.d.ts.map +1 -1
- package/dist/megamenu.js +96 -3
- package/dist/megamenu.js.map +1 -1
- package/dist/mfa.d.ts +125 -4
- package/dist/mfa.d.ts.map +1 -1
- package/dist/mfa.js +54 -2
- package/dist/mfa.js.map +1 -1
- package/dist/modules.d.ts +44 -5
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +73 -0
- package/dist/modules.js.map +1 -1
- package/dist/money-decimal.d.ts +54 -0
- package/dist/money-decimal.d.ts.map +1 -1
- package/dist/money-decimal.js +95 -0
- package/dist/money-decimal.js.map +1 -1
- package/dist/newsletter.d.ts +7 -7
- package/dist/orders.d.ts +128 -10
- package/dist/orders.d.ts.map +1 -1
- package/dist/orders.js +74 -4
- package/dist/orders.js.map +1 -1
- package/dist/organization-registry-lookup.d.ts +362 -0
- package/dist/organization-registry-lookup.d.ts.map +1 -0
- package/dist/organization-registry-lookup.js +196 -0
- package/dist/organization-registry-lookup.js.map +1 -0
- package/dist/organization-roles.d.ts +340 -0
- package/dist/organization-roles.d.ts.map +1 -0
- package/dist/organization-roles.js +211 -0
- package/dist/organization-roles.js.map +1 -0
- package/dist/organizations.d.ts +123 -89
- package/dist/organizations.d.ts.map +1 -1
- package/dist/organizations.js +68 -24
- package/dist/organizations.js.map +1 -1
- package/dist/page-builder-props.d.ts +1401 -0
- package/dist/page-builder-props.d.ts.map +1 -0
- package/dist/page-builder-props.js +266 -0
- package/dist/page-builder-props.js.map +1 -0
- package/dist/page-builder-values.d.ts +95 -0
- package/dist/page-builder-values.d.ts.map +1 -0
- package/dist/page-builder-values.js +164 -0
- package/dist/page-builder-values.js.map +1 -0
- package/dist/pim-connector.d.ts +6 -2
- package/dist/pim-connector.d.ts.map +1 -1
- package/dist/pim-connector.js +6 -2
- package/dist/pim-connector.js.map +1 -1
- package/dist/pim-field-path.d.ts +5 -1
- package/dist/pim-field-path.d.ts.map +1 -1
- package/dist/pim-field-path.js +37 -81
- package/dist/pim-field-path.js.map +1 -1
- package/dist/pim-locale-mapping.d.ts +131 -0
- package/dist/pim-locale-mapping.d.ts.map +1 -0
- package/dist/pim-locale-mapping.js +193 -0
- package/dist/pim-locale-mapping.js.map +1 -0
- package/dist/platform-language.d.ts +9 -0
- package/dist/platform-language.d.ts.map +1 -1
- package/dist/platform-language.js +14 -0
- package/dist/platform-language.js.map +1 -1
- package/dist/price-books.d.ts +47 -43
- package/dist/price-books.d.ts.map +1 -1
- package/dist/price-books.js +6 -2
- package/dist/price-books.js.map +1 -1
- package/dist/price-lists.d.ts +48 -14
- package/dist/price-lists.d.ts.map +1 -1
- package/dist/price-lists.js +24 -1
- package/dist/price-lists.js.map +1 -1
- package/dist/product-feeds.d.ts +144 -84
- package/dist/product-feeds.d.ts.map +1 -1
- package/dist/product-feeds.js +23 -0
- package/dist/product-feeds.js.map +1 -1
- package/dist/product-scope-model.d.ts +161 -0
- package/dist/product-scope-model.d.ts.map +1 -0
- package/dist/product-scope-model.js +161 -0
- package/dist/product-scope-model.js.map +1 -0
- package/dist/product-scope-overrides.d.ts +0 -103
- package/dist/product-scope-overrides.d.ts.map +1 -1
- package/dist/product-scope-overrides.js +0 -54
- package/dist/product-scope-overrides.js.map +1 -1
- package/dist/product-scoped-values.d.ts +2610 -0
- package/dist/product-scoped-values.d.ts.map +1 -0
- package/dist/product-scoped-values.js +425 -0
- package/dist/product-scoped-values.js.map +1 -0
- package/dist/product-scopes.d.ts +746 -0
- package/dist/product-scopes.d.ts.map +1 -0
- package/dist/product-scopes.js +436 -0
- package/dist/product-scopes.js.map +1 -0
- package/dist/product-summary-text.d.ts +23 -0
- package/dist/product-summary-text.d.ts.map +1 -0
- package/dist/product-summary-text.js +64 -0
- package/dist/product-summary-text.js.map +1 -0
- package/dist/product-tax-rates.d.ts +38 -0
- package/dist/product-tax-rates.d.ts.map +1 -0
- package/dist/product-tax-rates.js +45 -0
- package/dist/product-tax-rates.js.map +1 -0
- package/dist/product-url-keys.d.ts +210 -0
- package/dist/product-url-keys.d.ts.map +1 -0
- package/dist/product-url-keys.js +200 -0
- package/dist/product-url-keys.js.map +1 -0
- package/dist/product-value-resolver.d.ts +37 -60
- package/dist/product-value-resolver.d.ts.map +1 -1
- package/dist/product-value-resolver.js +36 -96
- package/dist/product-value-resolver.js.map +1 -1
- package/dist/projects.d.ts +2370 -0
- package/dist/projects.d.ts.map +1 -0
- package/dist/projects.js +843 -0
- package/dist/projects.js.map +1 -0
- package/dist/promotions.d.ts +10 -10
- package/dist/prompt-actions.d.ts +19 -1
- package/dist/prompt-actions.d.ts.map +1 -1
- package/dist/prompt-actions.js +31 -2
- package/dist/prompt-actions.js.map +1 -1
- package/dist/pwa.d.ts +2 -2
- package/dist/quick-order.d.ts +150 -7
- package/dist/quick-order.d.ts.map +1 -1
- package/dist/quick-order.js +76 -2
- package/dist/quick-order.js.map +1 -1
- package/dist/quote-requests.d.ts +99 -13
- package/dist/quote-requests.d.ts.map +1 -1
- package/dist/quote-requests.js +66 -1
- package/dist/quote-requests.js.map +1 -1
- package/dist/record-references.d.ts +252 -0
- package/dist/record-references.d.ts.map +1 -0
- package/dist/record-references.js +178 -0
- package/dist/record-references.js.map +1 -0
- package/dist/record-rich-text.d.ts +66 -0
- package/dist/record-rich-text.d.ts.map +1 -0
- package/dist/record-rich-text.js +304 -0
- package/dist/record-rich-text.js.map +1 -0
- package/dist/returns.d.ts +234 -52
- package/dist/returns.d.ts.map +1 -1
- package/dist/returns.js +139 -26
- package/dist/returns.js.map +1 -1
- package/dist/sales-channels.d.ts +51 -7
- package/dist/sales-channels.d.ts.map +1 -1
- package/dist/sales-channels.js +38 -4
- package/dist/sales-channels.js.map +1 -1
- package/dist/saved-list-views.d.ts +56 -0
- package/dist/saved-list-views.d.ts.map +1 -1
- package/dist/saved-list-views.js +27 -1
- package/dist/saved-list-views.js.map +1 -1
- package/dist/scoped-write-encoding.d.ts +100 -0
- package/dist/scoped-write-encoding.d.ts.map +1 -0
- package/dist/scoped-write-encoding.js +135 -0
- package/dist/scoped-write-encoding.js.map +1 -0
- package/dist/search.d.ts +25 -15
- package/dist/search.d.ts.map +1 -1
- package/dist/seo.d.ts +127 -15
- package/dist/seo.d.ts.map +1 -1
- package/dist/seo.js +38 -4
- package/dist/seo.js.map +1 -1
- package/dist/settings.d.ts +161 -3
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +73 -3
- package/dist/settings.js.map +1 -1
- package/dist/shopping-lists.d.ts +24 -3
- package/dist/shopping-lists.d.ts.map +1 -1
- package/dist/shopping-lists.js +20 -0
- package/dist/shopping-lists.js.map +1 -1
- package/dist/storefront-cache-tags.d.ts +41 -0
- package/dist/storefront-cache-tags.d.ts.map +1 -1
- package/dist/storefront-cache-tags.js +36 -0
- package/dist/storefront-cache-tags.js.map +1 -1
- package/dist/storefront-language-path.d.ts +77 -0
- package/dist/storefront-language-path.d.ts.map +1 -0
- package/dist/storefront-language-path.js +123 -0
- package/dist/storefront-language-path.js.map +1 -0
- package/dist/storefront-value-overrides.d.ts +18 -56
- package/dist/storefront-value-overrides.d.ts.map +1 -1
- package/dist/storefront-value-overrides.js +11 -86
- package/dist/storefront-value-overrides.js.map +1 -1
- package/dist/tasks.d.ts +2842 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +901 -0
- package/dist/tasks.js.map +1 -0
- package/dist/transactional-emails.d.ts +14 -11
- package/dist/transactional-emails.d.ts.map +1 -1
- package/dist/transactional-emails.js +13 -0
- package/dist/transactional-emails.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a buyer's rates the way placement resolves an order's
|
|
3
|
+
* (`OrderService.computeMonetaryTotals`): the product's class against the
|
|
4
|
+
* Organization's VAT status and country, a VAT-exempt or reverse-charge
|
|
5
|
+
* Organization at 0, and a deployment holding no rule that applies — the
|
|
6
|
+
* resolver's `none` — at 0. The checkout preview's defaults stand for what a
|
|
7
|
+
* read before checkout cannot know yet: a buyer with no Organization is a VAT
|
|
8
|
+
* payer, and the country is the Organization's registered one, `PL` without
|
|
9
|
+
* one; placement prefers the billing address chosen at checkout.
|
|
10
|
+
*
|
|
11
|
+
* **One rule, two readers.** It was `carts`' own (`cart-tax-rates.ts`, issue
|
|
12
|
+
* #436) until the catalogue needed the same answer for a product's gross price
|
|
13
|
+
* (issue #852). A second copy in `catalog` would be a second chance to answer
|
|
14
|
+
* the same buyer two rates for the same product, so the rule lives here, over
|
|
15
|
+
* the two contract ports both modules already resolve, and each module wires
|
|
16
|
+
* it with its own `lazyPort`s — no module imports the other.
|
|
17
|
+
*
|
|
18
|
+
* No `catch` (issue #84): the only errors that reach here are a failing
|
|
19
|
+
* database and a switched-off owner, and a rate invented for either would be a
|
|
20
|
+
* VAT figure no rule supports. The caller decides what a failure means.
|
|
21
|
+
*/
|
|
22
|
+
export function createProductTaxRateResolver(ports) {
|
|
23
|
+
return async ({ organizationId, productTypes }) => {
|
|
24
|
+
const rates = new Map();
|
|
25
|
+
const types = [...new Set(productTypes)];
|
|
26
|
+
if (types.length === 0)
|
|
27
|
+
return rates;
|
|
28
|
+
const profile = organizationId ? await ports.taxProfiles.taxProfileOf(organizationId) : null;
|
|
29
|
+
const vatStatus = profile?.vatStatus ?? 'vat_payer';
|
|
30
|
+
for (const productType of types) {
|
|
31
|
+
if (vatStatus !== 'vat_payer') {
|
|
32
|
+
rates.set(productType, 0);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const resolved = await ports.taxes.taxRateFor({
|
|
36
|
+
country: profile?.country ?? 'PL',
|
|
37
|
+
productType,
|
|
38
|
+
vatStatus,
|
|
39
|
+
});
|
|
40
|
+
rates.set(productType, resolved.source === 'none' ? 0 : resolved.rate);
|
|
41
|
+
}
|
|
42
|
+
return rates;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=product-tax-rates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-tax-rates.js","sourceRoot":"","sources":["../src/product-tax-rates.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAG5C;IACC,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,EAAE,EAAE;QAChD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAuB,CAAC;QAC7C,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;QACzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACrC,MAAM,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7F,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,WAAW,CAAC;QACpD,KAAK,MAAM,WAAW,IAAI,KAAK,EAAE,CAAC;YAChC,IAAI,SAAS,KAAK,WAAW,EAAE,CAAC;gBAC9B,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;gBAC1B,SAAS;YACX,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC;gBAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,IAAI;gBACjC,WAAW;gBACX,SAAS;aACV,CAAC,CAAC;YACH,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ChannelUrlFacts } from './storefront-language-path.js';
|
|
3
|
+
/**
|
|
4
|
+
* Feature 163, rewritten by feature 174 (`specs/174-product-editor-scope-switcher/contracts/
|
|
5
|
+
* url-keys.md`, research R12) — product URL keys at Global (`products.slug`), Channel and
|
|
6
|
+
* Channel × language, their redirects per (channel, language), and the one helper that composes
|
|
7
|
+
* a product URL.
|
|
8
|
+
*
|
|
9
|
+
* A key text belongs to at most one product per channel across all the channel's languages,
|
|
10
|
+
* orphans included; the same product may repeat it (owner round 7). There is no Language-only
|
|
11
|
+
* key (FR-010).
|
|
12
|
+
*
|
|
13
|
+
* Kept apart from `product-scopes.ts` so the URL-key work edits its own file. This module is a
|
|
14
|
+
* leaf for runtime imports: it imports nothing from the catalogue contracts.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* A product URL key: the grammar of `products.slug` (lower-case kebab case, at most
|
|
18
|
+
* 160 characters — the column width). Global, channel and channel × language keys
|
|
19
|
+
* all share it. Every writer normalises to NFC and lower case first ({@link normaliseUrlKey}).
|
|
20
|
+
*/
|
|
21
|
+
/** The longest URL key or slug (`varchar(160)`). */
|
|
22
|
+
export declare const PRODUCT_URL_KEY_MAX = 160;
|
|
23
|
+
export declare const productSlugSchema: z.ZodString;
|
|
24
|
+
export type ProductSlug = z.infer<typeof productSlugSchema>;
|
|
25
|
+
/** NFC, then lower case — what every key writer does before {@link productSlugSchema} (R12). */
|
|
26
|
+
export declare function normaliseUrlKey(raw: string): string;
|
|
27
|
+
/** The most keys a `confirmTakeover` list names (R21). */
|
|
28
|
+
export declare const URL_KEY_TAKEOVER_MAX = 20;
|
|
29
|
+
/** The most redirects kept per (product, channel); the oldest are dropped (R12). */
|
|
30
|
+
export declare const URL_REDIRECTS_PER_CHANNEL_MAX = 50;
|
|
31
|
+
/** The most new keys one import or connector run reserves; the rest are `limit_reached` (R12). */
|
|
32
|
+
export declare const URL_KEYS_PER_RUN_MAX = 1000;
|
|
33
|
+
export interface ProductPathInput {
|
|
34
|
+
/** The effective key at (channel, language). */
|
|
35
|
+
key: string;
|
|
36
|
+
/** The content language the URL is for — already resolved against the channel. */
|
|
37
|
+
languageCode: string;
|
|
38
|
+
/** The channel's URL-language facts (feature 167): its languages, default and prefix setting. */
|
|
39
|
+
channel: ChannelUrlFacts;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The storefront path of a product page: `/p/<key>` under the language's path prefix
|
|
43
|
+
* (`/en/p/drill`, or `/p/wiertarka` for the default language of a channel that does
|
|
44
|
+
* not prefix it).
|
|
45
|
+
*
|
|
46
|
+
* **This is the only place a product URL is composed.** Every URL the platform
|
|
47
|
+
* emits for a product — the admin's preview link, the resolve answer's redirect
|
|
48
|
+
* target, the PDP's canonical and alternates, the sitemap, the product feeds — is
|
|
49
|
+
* built here by the backend. A key is valid only in its own language (K1), so the
|
|
50
|
+
* language travels with the link as its path prefix
|
|
51
|
+
* (`specs/167-storefront-locale-path/`, which replaced 163's interim `?lang=`).
|
|
52
|
+
*/
|
|
53
|
+
export declare function productPath(input: ProductPathInput): string;
|
|
54
|
+
/** The unprefixed product path — the `x-default` target (`specs/167-storefront-locale-path/` url-shape §8). */
|
|
55
|
+
export declare function productDefaultPath(key: string): string;
|
|
56
|
+
export declare const productUrlKeySourceSchema: z.ZodEnum<{
|
|
57
|
+
global: "global";
|
|
58
|
+
channel: "channel";
|
|
59
|
+
channel_language: "channel_language";
|
|
60
|
+
}>;
|
|
61
|
+
export type ProductUrlKeySource = z.infer<typeof productUrlKeySourceSchema>;
|
|
62
|
+
/** A redirect answers at one (channel, language) (feature 174, `url-keys.md` §4). */
|
|
63
|
+
export declare const productUrlRedirectSchema: z.ZodObject<{
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
channelId: z.ZodString;
|
|
66
|
+
languageCode: z.ZodString;
|
|
67
|
+
key: z.ZodString;
|
|
68
|
+
createdAt: z.ZodString;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type ProductUrlRedirect = z.infer<typeof productUrlRedirectSchema>;
|
|
71
|
+
export declare const productUrlKeysResponseSchema: z.ZodObject<{
|
|
72
|
+
data: z.ZodObject<{
|
|
73
|
+
globalKey: z.ZodString;
|
|
74
|
+
channelKeys: z.ZodArray<z.ZodObject<{
|
|
75
|
+
channelId: z.ZodString;
|
|
76
|
+
languageCode: z.ZodNullable<z.ZodString>;
|
|
77
|
+
key: z.ZodString;
|
|
78
|
+
orphaned: z.ZodBoolean;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
effective: z.ZodArray<z.ZodObject<{
|
|
81
|
+
channelId: z.ZodString;
|
|
82
|
+
languageCode: z.ZodString;
|
|
83
|
+
key: z.ZodString;
|
|
84
|
+
source: z.ZodEnum<{
|
|
85
|
+
global: "global";
|
|
86
|
+
channel: "channel";
|
|
87
|
+
channel_language: "channel_language";
|
|
88
|
+
}>;
|
|
89
|
+
url: z.ZodString;
|
|
90
|
+
}, z.core.$strip>>;
|
|
91
|
+
redirects: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
92
|
+
id: z.ZodString;
|
|
93
|
+
channelId: z.ZodString;
|
|
94
|
+
languageCode: z.ZodString;
|
|
95
|
+
key: z.ZodString;
|
|
96
|
+
createdAt: z.ZodString;
|
|
97
|
+
}, z.core.$strip>>>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export type ProductUrlKeysResponse = z.infer<typeof productUrlKeysResponseSchema>;
|
|
101
|
+
export declare const putProductUrlKeysRequestSchema: z.ZodObject<{
|
|
102
|
+
globalKey: z.ZodOptional<z.ZodString>;
|
|
103
|
+
channelKeys: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
104
|
+
channelId: z.ZodString;
|
|
105
|
+
languageCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
key: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
107
|
+
inherit: z.ZodLiteral<true>;
|
|
108
|
+
}, z.core.$strict>]>;
|
|
109
|
+
}, z.core.$strict>>>;
|
|
110
|
+
confirmTakeover: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
111
|
+
}, z.core.$strict>;
|
|
112
|
+
export type PutProductUrlKeysRequest = z.infer<typeof putProductUrlKeysRequestSchema>;
|
|
113
|
+
/** `409 URL_KEY_TAKEN` details. */
|
|
114
|
+
export declare const urlKeyTakenDetailsSchema: z.ZodObject<{
|
|
115
|
+
conflicts: z.ZodArray<z.ZodObject<{
|
|
116
|
+
key: z.ZodString;
|
|
117
|
+
heldByProductId: z.ZodString;
|
|
118
|
+
heldByProductName: z.ZodString;
|
|
119
|
+
channelId: z.ZodNullable<z.ZodString>;
|
|
120
|
+
languageCode: z.ZodNullable<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export type UrlKeyTakenDetails = z.infer<typeof urlKeyTakenDetailsSchema>;
|
|
124
|
+
/** `409 URL_KEY_REDIRECT_TAKEOVER_REQUIRED` details. */
|
|
125
|
+
export declare const urlKeyRedirectTakeoverRequiredDetailsSchema: z.ZodObject<{
|
|
126
|
+
takeovers: z.ZodArray<z.ZodObject<{
|
|
127
|
+
key: z.ZodString;
|
|
128
|
+
losingProductId: z.ZodString;
|
|
129
|
+
losingProductName: z.ZodString;
|
|
130
|
+
channelId: z.ZodNullable<z.ZodString>;
|
|
131
|
+
languageCode: z.ZodNullable<z.ZodString>;
|
|
132
|
+
}, z.core.$strip>>;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
export type UrlKeyRedirectTakeoverRequiredDetails = z.infer<typeof urlKeyRedirectTakeoverRequiredDetailsSchema>;
|
|
135
|
+
/** `404 URL_REDIRECT_NOT_FOUND` details. */
|
|
136
|
+
export declare const urlRedirectNotFoundDetailsSchema: z.ZodObject<{
|
|
137
|
+
redirectId: z.ZodString;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
export type UrlRedirectNotFoundDetails = z.infer<typeof urlRedirectNotFoundDetailsSchema>;
|
|
140
|
+
export declare const productKeyResolutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
141
|
+
kind: z.ZodLiteral<"product">;
|
|
142
|
+
productId: z.ZodString;
|
|
143
|
+
key: z.ZodString;
|
|
144
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
145
|
+
kind: z.ZodLiteral<"redirect">;
|
|
146
|
+
key: z.ZodString;
|
|
147
|
+
languageCode: z.ZodString;
|
|
148
|
+
path: z.ZodString;
|
|
149
|
+
permanent: z.ZodBoolean;
|
|
150
|
+
}, z.core.$strip>], "kind">;
|
|
151
|
+
export type ProductKeyResolution = z.infer<typeof productKeyResolutionSchema>;
|
|
152
|
+
/**
|
|
153
|
+
* The product page's own URLs, ready-made by catalog with {@link productPath}: the
|
|
154
|
+
* canonical for the request's (channel, language), and one alternate per channel
|
|
155
|
+
* language where the product is available to the **anonymous** audience (FR-074 —
|
|
156
|
+
* `hreflang` advertises only what a crawler may open). The storefront renders them
|
|
157
|
+
* verbatim: it composes no product URL of its own.
|
|
158
|
+
*/
|
|
159
|
+
export declare const productPagePathsSchema: z.ZodObject<{
|
|
160
|
+
canonical: z.ZodString;
|
|
161
|
+
alternates: z.ZodArray<z.ZodObject<{
|
|
162
|
+
languageCode: z.ZodString;
|
|
163
|
+
path: z.ZodString;
|
|
164
|
+
}, z.core.$strip>>;
|
|
165
|
+
xDefault: z.ZodString;
|
|
166
|
+
}, z.core.$strip>;
|
|
167
|
+
export type ProductPagePaths = z.infer<typeof productPagePathsSchema>;
|
|
168
|
+
/**
|
|
169
|
+
* Per `urlKey` cell written through `catalogProductScopeWritePort.applyScopes` or a CSV import:
|
|
170
|
+
* written, or not written with the reason. An integration never takes over a redirect and is
|
|
171
|
+
* never asked to confirm one; the product keeps its previous key at that scope (163 FR-093).
|
|
172
|
+
* `limit_reached` — the run already reserved {@link URL_KEYS_PER_RUN_MAX} new keys (R12).
|
|
173
|
+
*/
|
|
174
|
+
export declare const urlKeyWriteOutcomeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
175
|
+
written: z.ZodLiteral<true>;
|
|
176
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
177
|
+
written: z.ZodLiteral<false>;
|
|
178
|
+
issue: z.ZodObject<{
|
|
179
|
+
key: z.ZodString;
|
|
180
|
+
heldByProductId: z.ZodNullable<z.ZodString>;
|
|
181
|
+
kind: z.ZodEnum<{
|
|
182
|
+
redirect: "redirect";
|
|
183
|
+
current: "current";
|
|
184
|
+
limit_reached: "limit_reached";
|
|
185
|
+
}>;
|
|
186
|
+
channelId: z.ZodNullable<z.ZodString>;
|
|
187
|
+
languageCode: z.ZodNullable<z.ZodString>;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
}, z.core.$strip>]>;
|
|
190
|
+
export type UrlKeyWriteOutcome = z.infer<typeof urlKeyWriteOutcomeSchema>;
|
|
191
|
+
/**
|
|
192
|
+
* Container name: `catalogProductUrlKeyReadPort`. Owner: `catalog`.
|
|
193
|
+
*
|
|
194
|
+
* URL keys for whole-channel readers such as `seo`'s sitemap generator (R28).
|
|
195
|
+
* `catalog` is non-deactivatable, so the port is always present.
|
|
196
|
+
*/
|
|
197
|
+
export interface CatalogProductUrlKeyReadPort {
|
|
198
|
+
/**
|
|
199
|
+
* The effective key per channel language for each product: the product's
|
|
200
|
+
* channel × language key, else its channel key, else its global key. Products the
|
|
201
|
+
* channel does not carry are absent.
|
|
202
|
+
*
|
|
203
|
+
* **Applies no availability beyond membership** (checkpoint C security review, I8):
|
|
204
|
+
* a member product switched off, outside its window or outside its audience still
|
|
205
|
+
* has keys here. A buyer-facing caller narrows the ids with
|
|
206
|
+
* `catalogProductAvailabilityPort.filterAvailable` first and links only what is left.
|
|
207
|
+
*/
|
|
208
|
+
effectiveKeys(productIds: readonly string[], channelId: string): Promise<Map<string, Map<string, string>>>;
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=product-url-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-url-keys.d.ts","sourceRoot":"","sources":["../src/product-url-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEzF;;;;;;;;;;;;GAYG;AAIH;;;;GAIG;AACH,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,eAAO,MAAM,iBAAiB,aAI8B,CAAC;AAC7D,MAAM,MAAM,WAAW,GAAG,CAAC,CAA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;iBASnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,wDAAwD;AACxD,eAAO,MAAM,2CAA2C;;;;;;;;iBAStD,CAAC;AACH,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2CAA2C,CAAC,CAAC;AAEhH,4CAA4C;AAC5C,eAAO,MAAM,gCAAgC;;iBAAuC,CAAC;AACrF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAI1F,eAAO,MAAM,0BAA0B;;;;;;;;;;2BAgBrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAI9E;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB;;;;;;;iBAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAItE;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;mBAYnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;;;;;;OASG;IACH,aAAa,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CAC5G"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { isoDateTimeSchema, uuidSchema } from './common.js';
|
|
3
|
+
import { storefrontPagePath } from './storefront-language-path.js';
|
|
4
|
+
/**
|
|
5
|
+
* Feature 163, rewritten by feature 174 (`specs/174-product-editor-scope-switcher/contracts/
|
|
6
|
+
* url-keys.md`, research R12) — product URL keys at Global (`products.slug`), Channel and
|
|
7
|
+
* Channel × language, their redirects per (channel, language), and the one helper that composes
|
|
8
|
+
* a product URL.
|
|
9
|
+
*
|
|
10
|
+
* A key text belongs to at most one product per channel across all the channel's languages,
|
|
11
|
+
* orphans included; the same product may repeat it (owner round 7). There is no Language-only
|
|
12
|
+
* key (FR-010).
|
|
13
|
+
*
|
|
14
|
+
* Kept apart from `product-scopes.ts` so the URL-key work edits its own file. This module is a
|
|
15
|
+
* leaf for runtime imports: it imports nothing from the catalogue contracts.
|
|
16
|
+
*/
|
|
17
|
+
// --- Key grammar ---------------------------------------------------------------
|
|
18
|
+
/**
|
|
19
|
+
* A product URL key: the grammar of `products.slug` (lower-case kebab case, at most
|
|
20
|
+
* 160 characters — the column width). Global, channel and channel × language keys
|
|
21
|
+
* all share it. Every writer normalises to NFC and lower case first ({@link normaliseUrlKey}).
|
|
22
|
+
*/
|
|
23
|
+
/** The longest URL key or slug (`varchar(160)`). */
|
|
24
|
+
export const PRODUCT_URL_KEY_MAX = 160;
|
|
25
|
+
export const productSlugSchema = z
|
|
26
|
+
.string()
|
|
27
|
+
.min(1)
|
|
28
|
+
.max(PRODUCT_URL_KEY_MAX)
|
|
29
|
+
.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'must be kebab-case');
|
|
30
|
+
const languageCodeSchema = z.string().min(1).max(16);
|
|
31
|
+
/** NFC, then lower case — what every key writer does before {@link productSlugSchema} (R12). */
|
|
32
|
+
export function normaliseUrlKey(raw) {
|
|
33
|
+
return raw.normalize('NFC').toLowerCase();
|
|
34
|
+
}
|
|
35
|
+
/** The most keys a `confirmTakeover` list names (R21). */
|
|
36
|
+
export const URL_KEY_TAKEOVER_MAX = 20;
|
|
37
|
+
/** The most redirects kept per (product, channel); the oldest are dropped (R12). */
|
|
38
|
+
export const URL_REDIRECTS_PER_CHANNEL_MAX = 50;
|
|
39
|
+
/** The most new keys one import or connector run reserves; the rest are `limit_reached` (R12). */
|
|
40
|
+
export const URL_KEYS_PER_RUN_MAX = 1000;
|
|
41
|
+
/**
|
|
42
|
+
* The storefront path of a product page: `/p/<key>` under the language's path prefix
|
|
43
|
+
* (`/en/p/drill`, or `/p/wiertarka` for the default language of a channel that does
|
|
44
|
+
* not prefix it).
|
|
45
|
+
*
|
|
46
|
+
* **This is the only place a product URL is composed.** Every URL the platform
|
|
47
|
+
* emits for a product — the admin's preview link, the resolve answer's redirect
|
|
48
|
+
* target, the PDP's canonical and alternates, the sitemap, the product feeds — is
|
|
49
|
+
* built here by the backend. A key is valid only in its own language (K1), so the
|
|
50
|
+
* language travels with the link as its path prefix
|
|
51
|
+
* (`specs/167-storefront-locale-path/`, which replaced 163's interim `?lang=`).
|
|
52
|
+
*/
|
|
53
|
+
export function productPath(input) {
|
|
54
|
+
return storefrontPagePath({
|
|
55
|
+
path: `/p/${encodeURIComponent(input.key)}`,
|
|
56
|
+
languageCode: input.languageCode,
|
|
57
|
+
channel: input.channel,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** The unprefixed product path — the `x-default` target (`specs/167-storefront-locale-path/` url-shape §8). */
|
|
61
|
+
export function productDefaultPath(key) {
|
|
62
|
+
return `/p/${encodeURIComponent(key)}`;
|
|
63
|
+
}
|
|
64
|
+
// --- Admin read — GET /api/v1/admin/catalog/products/:id/url-keys ----------------
|
|
65
|
+
export const productUrlKeySourceSchema = z.enum(['channel_language', 'channel', 'global']);
|
|
66
|
+
/** A redirect answers at one (channel, language) (feature 174, `url-keys.md` §4). */
|
|
67
|
+
export const productUrlRedirectSchema = z.object({
|
|
68
|
+
id: uuidSchema,
|
|
69
|
+
channelId: uuidSchema,
|
|
70
|
+
languageCode: languageCodeSchema,
|
|
71
|
+
key: z.string(),
|
|
72
|
+
createdAt: isoDateTimeSchema,
|
|
73
|
+
});
|
|
74
|
+
export const productUrlKeysResponseSchema = z.object({
|
|
75
|
+
data: z.object({
|
|
76
|
+
/** `products.slug` — the Global key. */
|
|
77
|
+
globalKey: z.string(),
|
|
78
|
+
/** `languageCode: null` = the Channel key. */
|
|
79
|
+
channelKeys: z.array(z.object({
|
|
80
|
+
channelId: uuidSchema,
|
|
81
|
+
languageCode: languageCodeSchema.nullable(),
|
|
82
|
+
key: z.string(),
|
|
83
|
+
orphaned: z.boolean(),
|
|
84
|
+
})),
|
|
85
|
+
effective: z.array(z.object({
|
|
86
|
+
channelId: uuidSchema,
|
|
87
|
+
languageCode: languageCodeSchema,
|
|
88
|
+
key: z.string(),
|
|
89
|
+
source: productUrlKeySourceSchema,
|
|
90
|
+
/** {@link productPath} for this (channel, language). */
|
|
91
|
+
url: z.string(),
|
|
92
|
+
})),
|
|
93
|
+
/** Omitted when `seo` is not effectively present (Q-C, Constitution XVII). */
|
|
94
|
+
redirects: z.array(productUrlRedirectSchema).optional(),
|
|
95
|
+
}),
|
|
96
|
+
});
|
|
97
|
+
// --- Admin write — PUT /api/v1/admin/catalog/products/:id/url-keys ----------------
|
|
98
|
+
/** The most entries one list of a URL-keys PUT carries (Phase 16 review; the scopes PATCH's bound). */
|
|
99
|
+
const URL_KEY_LIST_MAX = 64;
|
|
100
|
+
/** `{ inherit: true }` — the write encoding's "remove the own key" (`write-encoding.md` §5). */
|
|
101
|
+
const inheritKeySchema = z.object({ inherit: z.literal(true) }).strict();
|
|
102
|
+
export const putProductUrlKeysRequestSchema = z
|
|
103
|
+
.object({
|
|
104
|
+
globalKey: productSlugSchema.optional(),
|
|
105
|
+
/**
|
|
106
|
+
* Keys at Channel (`languageCode` absent or `null`) or Channel × language. `key` is a key or
|
|
107
|
+
* `{ inherit: true }` (deletes the row); `null` is refused — the URL key is required (FR-062).
|
|
108
|
+
*/
|
|
109
|
+
channelKeys: z
|
|
110
|
+
.array(z
|
|
111
|
+
.object({
|
|
112
|
+
channelId: uuidSchema,
|
|
113
|
+
languageCode: languageCodeSchema.nullable().optional(),
|
|
114
|
+
key: z.union([productSlugSchema, inheritKeySchema]),
|
|
115
|
+
})
|
|
116
|
+
.strict())
|
|
117
|
+
.max(URL_KEY_LIST_MAX)
|
|
118
|
+
.optional(),
|
|
119
|
+
/** The operator's confirmation of taking over another product's redirect (163 FR-072). */
|
|
120
|
+
confirmTakeover: z.array(productSlugSchema).max(URL_KEY_TAKEOVER_MAX).optional(),
|
|
121
|
+
})
|
|
122
|
+
.strict();
|
|
123
|
+
/**
|
|
124
|
+
* Where a conflict sits: `channelId` `null` = the Global key (slug); `languageCode` `null` = a
|
|
125
|
+
* Channel key or the slug.
|
|
126
|
+
*/
|
|
127
|
+
const keyAddressSchema = { channelId: uuidSchema.nullable(), languageCode: languageCodeSchema.nullable() };
|
|
128
|
+
/** `409 URL_KEY_TAKEN` details. */
|
|
129
|
+
export const urlKeyTakenDetailsSchema = z.object({
|
|
130
|
+
conflicts: z.array(z.object({
|
|
131
|
+
...keyAddressSchema,
|
|
132
|
+
key: z.string(),
|
|
133
|
+
heldByProductId: uuidSchema,
|
|
134
|
+
heldByProductName: z.string(),
|
|
135
|
+
})),
|
|
136
|
+
});
|
|
137
|
+
/** `409 URL_KEY_REDIRECT_TAKEOVER_REQUIRED` details. */
|
|
138
|
+
export const urlKeyRedirectTakeoverRequiredDetailsSchema = z.object({
|
|
139
|
+
takeovers: z.array(z.object({
|
|
140
|
+
...keyAddressSchema,
|
|
141
|
+
key: z.string(),
|
|
142
|
+
losingProductId: uuidSchema,
|
|
143
|
+
losingProductName: z.string(),
|
|
144
|
+
})),
|
|
145
|
+
});
|
|
146
|
+
/** `404 URL_REDIRECT_NOT_FOUND` details. */
|
|
147
|
+
export const urlRedirectNotFoundDetailsSchema = z.object({ redirectId: uuidSchema });
|
|
148
|
+
// --- Public resolve — GET /api/v1/catalog/products/resolve/:key (§4) ------------
|
|
149
|
+
export const productKeyResolutionSchema = z.discriminatedUnion('kind', [
|
|
150
|
+
/** `key` is the effective key at (channel, language). */
|
|
151
|
+
z.object({ kind: z.literal('product'), productId: uuidSchema, key: z.string() }),
|
|
152
|
+
/**
|
|
153
|
+
* `path` = {@link productPath} built by catalog. `permanent: true` — a former key (163),
|
|
154
|
+
* answered 308; `false` — a current key of the same product in another channel
|
|
155
|
+
* language (feature 167, FR-024), answered 307 because the mapping depends on key data
|
|
156
|
+
* that can change hands.
|
|
157
|
+
*/
|
|
158
|
+
z.object({
|
|
159
|
+
kind: z.literal('redirect'),
|
|
160
|
+
key: z.string(),
|
|
161
|
+
languageCode: languageCodeSchema,
|
|
162
|
+
path: z.string(),
|
|
163
|
+
permanent: z.boolean(),
|
|
164
|
+
}),
|
|
165
|
+
]);
|
|
166
|
+
// --- Storefront product page — the PDP response's `paths` (§6) -----------------
|
|
167
|
+
/**
|
|
168
|
+
* The product page's own URLs, ready-made by catalog with {@link productPath}: the
|
|
169
|
+
* canonical for the request's (channel, language), and one alternate per channel
|
|
170
|
+
* language where the product is available to the **anonymous** audience (FR-074 —
|
|
171
|
+
* `hreflang` advertises only what a crawler may open). The storefront renders them
|
|
172
|
+
* verbatim: it composes no product URL of its own.
|
|
173
|
+
*/
|
|
174
|
+
export const productPagePathsSchema = z.object({
|
|
175
|
+
canonical: z.string(),
|
|
176
|
+
alternates: z.array(z.object({ languageCode: languageCodeSchema, path: z.string() })),
|
|
177
|
+
/** {@link productDefaultPath} of the key at the channel's default language — `hreflang="x-default"`. */
|
|
178
|
+
xDefault: z.string(),
|
|
179
|
+
});
|
|
180
|
+
// --- Connectors and import (§5) ------------------------------------------------
|
|
181
|
+
/**
|
|
182
|
+
* Per `urlKey` cell written through `catalogProductScopeWritePort.applyScopes` or a CSV import:
|
|
183
|
+
* written, or not written with the reason. An integration never takes over a redirect and is
|
|
184
|
+
* never asked to confirm one; the product keeps its previous key at that scope (163 FR-093).
|
|
185
|
+
* `limit_reached` — the run already reserved {@link URL_KEYS_PER_RUN_MAX} new keys (R12).
|
|
186
|
+
*/
|
|
187
|
+
export const urlKeyWriteOutcomeSchema = z.union([
|
|
188
|
+
z.object({ written: z.literal(true) }),
|
|
189
|
+
z.object({
|
|
190
|
+
written: z.literal(false),
|
|
191
|
+
issue: z.object({
|
|
192
|
+
...keyAddressSchema,
|
|
193
|
+
key: z.string(),
|
|
194
|
+
/** `null` for `limit_reached`. */
|
|
195
|
+
heldByProductId: uuidSchema.nullable(),
|
|
196
|
+
kind: z.enum(['current', 'redirect', 'limit_reached']),
|
|
197
|
+
}),
|
|
198
|
+
}),
|
|
199
|
+
]);
|
|
200
|
+
//# sourceMappingURL=product-url-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-url-keys.js","sourceRoot":"","sources":["../src/product-url-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAwB,MAAM,+BAA+B,CAAC;AAEzF;;;;;;;;;;;;GAYG;AAEH,kFAAkF;AAElF;;;;GAIG;AACH,oDAAoD;AACpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,mBAAmB,CAAC;KACxB,KAAK,CAAC,4BAA4B,EAAE,oBAAoB,CAAC,CAAC;AAG7D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAErD,gGAAgG;AAChG,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AAC5C,CAAC;AAED,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC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* Feature 022, rewritten by feature 174 (`specs/174-product-editor-scope-switcher/`, research R1) —
|
|
3
|
+
* the product value resolver over `product_value_overrides` rows.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* admin SPA imports it to compute its "effective-value preview"
|
|
10
|
-
* client-side so switcher toggles do not need a network round-trip.
|
|
5
|
+
* The fallback chain is {@link resolveScoped}'s — C×L → C → G, restricted to the field's scope
|
|
6
|
+
* set, a present row winning whatever it holds and `{ "v": null }` being an empty override
|
|
7
|
+
* (FR-013). This file only adapts the override table's row shape to {@link ScopedRow}; it adds no
|
|
8
|
+
* second chain. There is no Language level and no "primary language" (FR-010, FR-014): the Global
|
|
9
|
+
* value is one value.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
* specs/023-product-scope-editor/contracts/resolver.contract.md §5.
|
|
11
|
+
* Shared by the backend and the admin SPA through `@endora-commerce/contracts`.
|
|
14
12
|
*/
|
|
13
|
+
import { type ScopeLevel, type ScopeRef, type ScopedResolution, type ScopedRow, type ScopedSource } from './product-scope-model.js';
|
|
14
|
+
/**
|
|
15
|
+
* An attribute's scope flag (feature 174, R15): a scopable attribute may carry Channel and — for
|
|
16
|
+
* text — Channel × language overrides. The levels derive from the flag and the value type
|
|
17
|
+
* (`attributeScopeSet`).
|
|
18
|
+
*/
|
|
19
|
+
export type AttributeScope = {
|
|
20
|
+
scopable: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** The context a value is resolved in: no channel → Global; a channel without a language → C. */
|
|
15
23
|
export type ResolverContext = {
|
|
16
|
-
/** `null` = "Global / no channel" — see FR-010 / FR-040. */
|
|
17
24
|
channelId: string | null;
|
|
18
|
-
/** `null` = use `primaryLanguage`. */
|
|
19
25
|
languageCode: string | null;
|
|
20
|
-
/** Platform's primary admin language (e.g. `'pl'`). */
|
|
21
|
-
primaryLanguage: string;
|
|
22
|
-
};
|
|
23
|
-
export type AttributeScope = {
|
|
24
|
-
channelScoped: boolean;
|
|
25
|
-
languageScoped: boolean;
|
|
26
26
|
};
|
|
27
27
|
export type OverrideRow = {
|
|
28
28
|
attributeKey: string;
|
|
29
29
|
channelId: string;
|
|
30
30
|
languageCode: string | null;
|
|
31
|
+
/** `{ v: null }` is an empty override (FR-013). */
|
|
31
32
|
value: {
|
|
32
33
|
v: unknown;
|
|
33
34
|
};
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
-
export type
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
/** Where an effective value comes from — {@link ScopedSource}. */
|
|
37
|
+
export type ResolvedSource = ScopedSource;
|
|
38
|
+
export type Resolved = ScopedResolution<unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a value counts as present: not `undefined` / `null`, and not an empty string, array or
|
|
41
|
+
* object. A helper for Global values read from a JSON column; never used to skip an override row.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isNonEmpty(v: unknown): boolean;
|
|
44
|
+
/** The scope a {@link ResolverContext} names. A language without a channel resolves at Global. */
|
|
45
|
+
export declare function scopeOfContext(ctx: ResolverContext): ScopeRef;
|
|
46
|
+
/** One override row as a {@link ScopedRow}: `{ v: null }` (or a missing `v`) is the empty override. */
|
|
47
|
+
export declare function overrideToScopedRow(row: Pick<OverrideRow, 'channelId' | 'languageCode' | 'value'>): ScopedRow<unknown>;
|
|
42
48
|
export type ResolveAttributeArgs = {
|
|
43
|
-
/**
|
|
44
|
-
* Raw baseline. Either a scalar (global-only attribute) or a
|
|
45
|
-
* `Record<lang, value>` (language-scoped attribute). For system
|
|
46
|
-
* attributes Name and Description this is the JSONB at
|
|
47
|
-
* `products.name` / `products.description`.
|
|
48
|
-
*/
|
|
49
|
+
/** The Global value: `products.name` / `.description`, or `attribute_values[key]`. */
|
|
49
50
|
baseline: unknown;
|
|
50
51
|
/** Overrides pre-filtered to a single product. */
|
|
51
52
|
overrides: readonly OverrideRow[];
|
|
52
53
|
attributeKey: string;
|
|
53
|
-
scope
|
|
54
|
+
/** The field's scope set. */
|
|
55
|
+
levels: readonly ScopeLevel[];
|
|
54
56
|
ctx: ResolverContext;
|
|
55
57
|
};
|
|
56
|
-
/**
|
|
57
|
-
* Whether a value counts as present: not `undefined`/`null`, and not an empty
|
|
58
|
-
* string, array or object. Shared with `storefront-value-overrides`, whose
|
|
59
|
-
* walk stops where the baseline holds a value by this same definition.
|
|
60
|
-
*/
|
|
61
|
-
export declare function isNonEmpty(v: unknown): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Resolve one attribute value for the given context using the four-step
|
|
64
|
-
* fallback chain. The resolver is tolerant of "orphan" override rows
|
|
65
|
-
* left behind when an attribute's scope flags were toggled after writes
|
|
66
|
-
* happened — orphan rows are silently skipped (matrix row 12).
|
|
67
|
-
*/
|
|
58
|
+
/** Resolve one attribute value in `ctx`. Rows of another key, channel or language never match. */
|
|
68
59
|
export declare function resolveAttribute(args: ResolveAttributeArgs): Resolved;
|
|
69
60
|
export type AttributeDef = {
|
|
70
61
|
attributeKey: string;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* For system attributes Name and Description the baseline lives at
|
|
74
|
-
* `products.name` / `products.description`. For user-defined
|
|
75
|
-
* attributes the baseline is `products.attribute_values[attributeKey]`.
|
|
76
|
-
* Resolver consumers populate this field once per (attribute, product)
|
|
77
|
-
* pair to keep this function free of any read coupling.
|
|
78
|
-
*/
|
|
62
|
+
levels: readonly ScopeLevel[];
|
|
79
63
|
baseline: unknown;
|
|
80
64
|
};
|
|
81
65
|
export type ResolveAllResult = {
|
|
82
|
-
/** Effective scalar per attribute key. */
|
|
83
66
|
values: Record<string, unknown>;
|
|
84
|
-
/** Source per attribute key — used by the admin "inherited from X" badge. */
|
|
85
67
|
sources: Record<string, ResolvedSource>;
|
|
86
68
|
};
|
|
87
|
-
/**
|
|
88
|
-
* Bulk resolve every attribute for one product in one (ctx) pass.
|
|
89
|
-
* Loops `attributeDefs` and applies `resolveAttribute` per entry; the
|
|
90
|
-
* `sources` map is for the admin UI and may be ignored by the
|
|
91
|
-
* storefront.
|
|
92
|
-
*/
|
|
69
|
+
/** Resolve every attribute of one product in one context. */
|
|
93
70
|
export declare function resolveAll(attributeDefs: readonly AttributeDef[], overrides: readonly OverrideRow[], ctx: ResolverContext): ResolveAllResult;
|
|
94
71
|
//# sourceMappingURL=product-value-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-value-resolver.d.ts","sourceRoot":"","sources":["../src/product-value-resolver.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"product-value-resolver.d.ts","sourceRoot":"","sources":["../src/product-value-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAElC;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,iGAAiG;AACjG,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,mDAAmD;IACnD,KAAK,EAAE;QAAE,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACvB,CAAC;AAEF,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;AAE1C,MAAM,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,U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