@endora-commerce/contracts 0.100.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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/actor.d.ts +79 -0
- package/dist/actor.d.ts.map +1 -0
- package/dist/actor.js +41 -0
- package/dist/actor.js.map +1 -0
- package/dist/addresses.d.ts +134 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +16 -0
- package/dist/addresses.js.map +1 -0
- package/dist/admin-actions.d.ts +367 -0
- package/dist/admin-actions.d.ts.map +1 -0
- package/dist/admin-actions.js +287 -0
- package/dist/admin-actions.js.map +1 -0
- package/dist/admin-contributions.d.ts +518 -0
- package/dist/admin-contributions.d.ts.map +1 -0
- package/dist/admin-contributions.js +495 -0
- package/dist/admin-contributions.js.map +1 -0
- package/dist/admin-i18n.d.ts +135 -0
- package/dist/admin-i18n.d.ts.map +1 -0
- package/dist/admin-i18n.js +72 -0
- package/dist/admin-i18n.js.map +1 -0
- package/dist/admin-notifications.d.ts +55 -0
- package/dist/admin-notifications.d.ts.map +1 -0
- package/dist/admin-notifications.js +16 -0
- package/dist/admin-notifications.js.map +1 -0
- package/dist/admin-roles.d.ts +125 -0
- package/dist/admin-roles.d.ts.map +1 -0
- package/dist/admin-roles.js +2 -0
- package/dist/admin-roles.js.map +1 -0
- package/dist/admin-users.d.ts +178 -0
- package/dist/admin-users.d.ts.map +1 -0
- package/dist/admin-users.js +14 -0
- package/dist/admin-users.js.map +1 -0
- package/dist/admin.d.ts +243 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +246 -0
- package/dist/admin.js.map +1 -0
- package/dist/analytics.d.ts +123 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.js +68 -0
- package/dist/analytics.js.map +1 -0
- package/dist/api-keys.d.ts +97 -0
- package/dist/api-keys.d.ts.map +1 -0
- package/dist/api-keys.js +64 -0
- package/dist/api-keys.js.map +1 -0
- package/dist/assets-library.d.ts +684 -0
- package/dist/assets-library.d.ts.map +1 -0
- package/dist/assets-library.js +181 -0
- package/dist/assets-library.js.map +1 -0
- package/dist/audit-logs.d.ts +141 -0
- package/dist/audit-logs.d.ts.map +1 -0
- package/dist/audit-logs.js +31 -0
- package/dist/audit-logs.js.map +1 -0
- package/dist/auth.d.ts +174 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +27 -0
- package/dist/auth.js.map +1 -0
- package/dist/blog.d.ts +669 -0
- package/dist/blog.d.ts.map +1 -0
- package/dist/blog.js +360 -0
- package/dist/blog.js.map +1 -0
- package/dist/capabilities.d.ts +40 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +38 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/carts.d.ts +1367 -0
- package/dist/carts.d.ts.map +1 -0
- package/dist/carts.js +405 -0
- package/dist/carts.js.map +1 -0
- package/dist/catalog.d.ts +2855 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +1543 -0
- package/dist/catalog.js.map +1 -0
- package/dist/cms.d.ts +872 -0
- package/dist/cms.d.ts.map +1 -0
- package/dist/cms.js +468 -0
- package/dist/cms.js.map +1 -0
- package/dist/common.d.ts +82 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +72 -0
- package/dist/common.js.map +1 -0
- package/dist/comparisons.d.ts +487 -0
- package/dist/comparisons.d.ts.map +1 -0
- package/dist/comparisons.js +221 -0
- package/dist/comparisons.js.map +1 -0
- package/dist/credentials.d.ts +292 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +142 -0
- package/dist/credentials.js.map +1 -0
- package/dist/credit-limits.d.ts +111 -0
- package/dist/credit-limits.d.ts.map +1 -0
- package/dist/credit-limits.js +35 -0
- package/dist/credit-limits.js.map +1 -0
- package/dist/currencies.d.ts +127 -0
- package/dist/currencies.d.ts.map +1 -0
- package/dist/currencies.js +20 -0
- package/dist/currencies.js.map +1 -0
- package/dist/custom-fields.d.ts +345 -0
- package/dist/custom-fields.d.ts.map +1 -0
- package/dist/custom-fields.js +185 -0
- package/dist/custom-fields.js.map +1 -0
- package/dist/customer-accounts.d.ts +690 -0
- package/dist/customer-accounts.d.ts.map +1 -0
- package/dist/customer-accounts.js +41 -0
- package/dist/customer-accounts.js.map +1 -0
- package/dist/customers.d.ts +305 -0
- package/dist/customers.d.ts.map +1 -0
- package/dist/customers.js +158 -0
- package/dist/customers.js.map +1 -0
- package/dist/dictionary.d.ts +580 -0
- package/dist/dictionary.d.ts.map +1 -0
- package/dist/dictionary.js +297 -0
- package/dist/dictionary.js.map +1 -0
- package/dist/email-address.d.ts +62 -0
- package/dist/email-address.d.ts.map +1 -0
- package/dist/email-address.js +64 -0
- package/dist/email-address.js.map +1 -0
- package/dist/email.d.ts +175 -0
- package/dist/email.d.ts.map +1 -0
- package/dist/email.js +45 -0
- package/dist/email.js.map +1 -0
- package/dist/envelopes.d.ts +15 -0
- package/dist/envelopes.d.ts.map +1 -0
- package/dist/envelopes.js +16 -0
- package/dist/envelopes.js.map +1 -0
- package/dist/environment-inputs.d.ts +306 -0
- package/dist/environment-inputs.d.ts.map +1 -0
- package/dist/environment-inputs.js +277 -0
- package/dist/environment-inputs.js.map +1 -0
- package/dist/erp-connector.d.ts +52 -0
- package/dist/erp-connector.d.ts.map +1 -0
- package/dist/erp-connector.js +34 -0
- package/dist/erp-connector.js.map +1 -0
- package/dist/errors.d.ts +455 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +532 -0
- package/dist/errors.js.map +1 -0
- package/dist/google-analytics.d.ts +181 -0
- package/dist/google-analytics.d.ts.map +1 -0
- package/dist/google-analytics.js +176 -0
- package/dist/google-analytics.js.map +1 -0
- package/dist/google-tag-manager.d.ts +111 -0
- package/dist/google-tag-manager.d.ts.map +1 -0
- package/dist/google-tag-manager.js +129 -0
- package/dist/google-tag-manager.js.map +1 -0
- package/dist/i18n.d.ts +69 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +59 -0
- package/dist/i18n.js.map +1 -0
- package/dist/import-export.d.ts +63 -0
- package/dist/import-export.d.ts.map +1 -0
- package/dist/import-export.js +37 -0
- package/dist/import-export.js.map +1 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +126 -0
- package/dist/index.js.map +1 -0
- package/dist/inventory.d.ts +673 -0
- package/dist/inventory.d.ts.map +1 -0
- package/dist/inventory.js +412 -0
- package/dist/inventory.js.map +1 -0
- package/dist/invoice-ledger.d.ts +366 -0
- package/dist/invoice-ledger.d.ts.map +1 -0
- package/dist/invoice-ledger.js +114 -0
- package/dist/invoice-ledger.js.map +1 -0
- package/dist/invoices.d.ts +845 -0
- package/dist/invoices.d.ts.map +1 -0
- package/dist/invoices.js +314 -0
- package/dist/invoices.js.map +1 -0
- package/dist/kernel.d.ts +49 -0
- package/dist/kernel.d.ts.map +1 -0
- package/dist/kernel.js +19 -0
- package/dist/kernel.js.map +1 -0
- package/dist/languages.d.ts +122 -0
- package/dist/languages.d.ts.map +1 -0
- package/dist/languages.js +24 -0
- package/dist/languages.js.map +1 -0
- package/dist/linkedin-ads.d.ts +167 -0
- package/dist/linkedin-ads.d.ts.map +1 -0
- package/dist/linkedin-ads.js +156 -0
- package/dist/linkedin-ads.js.map +1 -0
- package/dist/megamenu.d.ts +556 -0
- package/dist/megamenu.d.ts.map +1 -0
- package/dist/megamenu.js +186 -0
- package/dist/megamenu.js.map +1 -0
- package/dist/meta-ads.d.ts +126 -0
- package/dist/meta-ads.d.ts.map +1 -0
- package/dist/meta-ads.js +112 -0
- package/dist/meta-ads.js.map +1 -0
- package/dist/mfa.d.ts +274 -0
- package/dist/mfa.d.ts.map +1 -0
- package/dist/mfa.js +187 -0
- package/dist/mfa.js.map +1 -0
- package/dist/modules.d.ts +1706 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +1390 -0
- package/dist/modules.js.map +1 -0
- package/dist/newsletter.d.ts +611 -0
- package/dist/newsletter.d.ts.map +1 -0
- package/dist/newsletter.js +345 -0
- package/dist/newsletter.js.map +1 -0
- package/dist/orders.d.ts +1175 -0
- package/dist/orders.d.ts.map +1 -0
- package/dist/orders.js +630 -0
- package/dist/orders.js.map +1 -0
- package/dist/organizations.d.ts +938 -0
- package/dist/organizations.d.ts.map +1 -0
- package/dist/organizations.js +418 -0
- package/dist/organizations.js.map +1 -0
- package/dist/pagination.d.ts +21 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +22 -0
- package/dist/pagination.js.map +1 -0
- package/dist/payment-methods.d.ts +472 -0
- package/dist/payment-methods.d.ts.map +1 -0
- package/dist/payment-methods.js +175 -0
- package/dist/payment-methods.js.map +1 -0
- package/dist/payment-return-url.d.ts +53 -0
- package/dist/payment-return-url.d.ts.map +1 -0
- package/dist/payment-return-url.js +35 -0
- package/dist/payment-return-url.js.map +1 -0
- package/dist/payments.d.ts +386 -0
- package/dist/payments.d.ts.map +1 -0
- package/dist/payments.js +84 -0
- package/dist/payments.js.map +1 -0
- package/dist/pim-connector.d.ts +60 -0
- package/dist/pim-connector.d.ts.map +1 -0
- package/dist/pim-connector.js +43 -0
- package/dist/pim-connector.js.map +1 -0
- package/dist/pim-field-path.d.ts +6 -0
- package/dist/pim-field-path.d.ts.map +1 -0
- package/dist/pim-field-path.js +101 -0
- package/dist/pim-field-path.js.map +1 -0
- package/dist/platform-language.d.ts +20 -0
- package/dist/platform-language.d.ts.map +1 -0
- package/dist/platform-language.js +22 -0
- package/dist/platform-language.js.map +1 -0
- package/dist/price-lists.d.ts +685 -0
- package/dist/price-lists.d.ts.map +1 -0
- package/dist/price-lists.js +330 -0
- package/dist/price-lists.js.map +1 -0
- package/dist/product-feeds.d.ts +2837 -0
- package/dist/product-feeds.d.ts.map +1 -0
- package/dist/product-feeds.js +1504 -0
- package/dist/product-feeds.js.map +1 -0
- package/dist/product-scope-overrides.d.ts +134 -0
- package/dist/product-scope-overrides.d.ts.map +1 -0
- package/dist/product-scope-overrides.js +82 -0
- package/dist/product-scope-overrides.js.map +1 -0
- package/dist/product-value-resolver.d.ts +88 -0
- package/dist/product-value-resolver.d.ts.map +1 -0
- package/dist/product-value-resolver.js +128 -0
- package/dist/product-value-resolver.js.map +1 -0
- package/dist/promotions.d.ts +678 -0
- package/dist/promotions.d.ts.map +1 -0
- package/dist/promotions.js +479 -0
- package/dist/promotions.js.map +1 -0
- package/dist/prompt-actions.d.ts +582 -0
- package/dist/prompt-actions.d.ts.map +1 -0
- package/dist/prompt-actions.js +221 -0
- package/dist/prompt-actions.js.map +1 -0
- package/dist/pwa.d.ts +293 -0
- package/dist/pwa.d.ts.map +1 -0
- package/dist/pwa.js +204 -0
- package/dist/pwa.js.map +1 -0
- package/dist/quick-order.d.ts +340 -0
- package/dist/quick-order.d.ts.map +1 -0
- package/dist/quick-order.js +177 -0
- package/dist/quick-order.js.map +1 -0
- package/dist/quote-requests.d.ts +538 -0
- package/dist/quote-requests.d.ts.map +1 -0
- package/dist/quote-requests.js +308 -0
- package/dist/quote-requests.js.map +1 -0
- package/dist/returns.d.ts +774 -0
- package/dist/returns.d.ts.map +1 -0
- package/dist/returns.js +389 -0
- package/dist/returns.js.map +1 -0
- package/dist/sales-channels.d.ts +392 -0
- package/dist/sales-channels.d.ts.map +1 -0
- package/dist/sales-channels.js +285 -0
- package/dist/sales-channels.js.map +1 -0
- package/dist/scope-notice.d.ts +60 -0
- package/dist/scope-notice.d.ts.map +1 -0
- package/dist/scope-notice.js +56 -0
- package/dist/scope-notice.js.map +1 -0
- package/dist/search.d.ts +321 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +160 -0
- package/dist/search.js.map +1 -0
- package/dist/seo.d.ts +113 -0
- package/dist/seo.d.ts.map +1 -0
- package/dist/seo.js +63 -0
- package/dist/seo.js.map +1 -0
- package/dist/settings.d.ts +453 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +337 -0
- package/dist/settings.js.map +1 -0
- package/dist/shipments.d.ts +140 -0
- package/dist/shipments.d.ts.map +1 -0
- package/dist/shipments.js +14 -0
- package/dist/shipments.js.map +1 -0
- package/dist/shipping-methods.d.ts +350 -0
- package/dist/shipping-methods.d.ts.map +1 -0
- package/dist/shipping-methods.js +99 -0
- package/dist/shipping-methods.js.map +1 -0
- package/dist/shopping-lists.d.ts +122 -0
- package/dist/shopping-lists.d.ts.map +1 -0
- package/dist/shopping-lists.js +92 -0
- package/dist/shopping-lists.js.map +1 -0
- package/dist/taxes.d.ts +106 -0
- package/dist/taxes.d.ts.map +1 -0
- package/dist/taxes.js +80 -0
- package/dist/taxes.js.map +1 -0
- package/dist/text-normalization.d.ts +199 -0
- package/dist/text-normalization.d.ts.map +1 -0
- package/dist/text-normalization.js +205 -0
- package/dist/text-normalization.js.map +1 -0
- package/dist/transactional-emails.d.ts +459 -0
- package/dist/transactional-emails.d.ts.map +1 -0
- package/dist/transactional-emails.js +212 -0
- package/dist/transactional-emails.js.map +1 -0
- package/dist/webhooks.d.ts +69 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +53 -0
- package/dist/webhooks.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;GAYG;AAEH,8EAA8E;AAC9E,oDAAoD;AACpD,8EAA8E;AAE9E,6BAA6B;AAC7B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AACzF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAG9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,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Limit module contracts (US6) — see
|
|
4
|
+
* specs/001-b2b-platform-foundation/contracts/credit_limits.contract.md.
|
|
5
|
+
*/
|
|
6
|
+
export declare const creditLimitReservationStatusSchema: z.ZodEnum<{
|
|
7
|
+
active: "active";
|
|
8
|
+
released: "released";
|
|
9
|
+
}>;
|
|
10
|
+
export type CreditLimitReservationStatus = z.infer<typeof creditLimitReservationStatusSchema>;
|
|
11
|
+
export declare const creditLimitReservationReleaseReasonSchema: z.ZodEnum<{
|
|
12
|
+
invoice_paid: "invoice_paid";
|
|
13
|
+
order_cancelled: "order_cancelled";
|
|
14
|
+
admin_revocation: "admin_revocation";
|
|
15
|
+
}>;
|
|
16
|
+
export type CreditLimitReservationReleaseReason = z.infer<typeof creditLimitReservationReleaseReasonSchema>;
|
|
17
|
+
export declare const creditLimitViewSchema: z.ZodObject<{
|
|
18
|
+
organizationId: z.ZodString;
|
|
19
|
+
grantedAmount: z.ZodNumber;
|
|
20
|
+
availableAmount: z.ZodNumber;
|
|
21
|
+
currency: z.ZodString;
|
|
22
|
+
activeReservations: z.ZodArray<z.ZodObject<{
|
|
23
|
+
orderId: z.ZodString;
|
|
24
|
+
amount: z.ZodNumber;
|
|
25
|
+
createdAt: z.ZodString;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
grantedAt: z.ZodString;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type CreditLimitView = z.infer<typeof creditLimitViewSchema>;
|
|
30
|
+
export declare const grantCreditLimitRequestSchema: z.ZodObject<{
|
|
31
|
+
grantedAmount: z.ZodNumber;
|
|
32
|
+
currency: z.ZodString;
|
|
33
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type GrantCreditLimitRequest = z.infer<typeof grantCreditLimitRequestSchema>;
|
|
36
|
+
export declare const adjustCreditLimitRequestSchema: z.ZodObject<{
|
|
37
|
+
grantedAmount: z.ZodNumber;
|
|
38
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
39
|
+
allowOverAllocation: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type AdjustCreditLimitRequest = z.infer<typeof adjustCreditLimitRequestSchema>;
|
|
42
|
+
/**
|
|
43
|
+
* Container name: `creditLimitReadPort`. Owner: `credit_limits`.
|
|
44
|
+
*
|
|
45
|
+
* One question, asked by one consumer: `organizations` walks an ancestor chain
|
|
46
|
+
* to decide whose credit limit applies to a descendant, and the only fact it
|
|
47
|
+
* needs from this module is which links in that chain hold a row at all.
|
|
48
|
+
*
|
|
49
|
+
* It used to read the table itself — `select "organization_id" from
|
|
50
|
+
* "credit_limits" where "organization_id" in (…)`, a statement naming no import
|
|
51
|
+
* specifier, so the boundary it crossed compiled and was gated by nothing
|
|
52
|
+
* (feature 077, D-87). The signature is ids in, ids out, which is what puts it
|
|
53
|
+
* here rather than on the package's `./ports` subpath: nothing about it needs a
|
|
54
|
+
* MikroORM `EntityManager`, and D-171's test for that subpath is whether the
|
|
55
|
+
* signature stops the interface living in this package.
|
|
56
|
+
*
|
|
57
|
+
* **Owner off:** the seam fails closed — resolving this port throws
|
|
58
|
+
* `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`. That is the
|
|
59
|
+
* right answer and not a degradation to soften: an empty set here reads as
|
|
60
|
+
* "nobody in this chain has a limit", which is a plausible answer, and on a
|
|
61
|
+
* credit-check path the wrong one — it is the difference between refusing and
|
|
62
|
+
* quoting unlimited credit. Whether `credit_limits` has an off state at all is
|
|
63
|
+
* its manifest's `activation` to say, not this line's.
|
|
64
|
+
*/
|
|
65
|
+
export interface CreditLimitReadPort {
|
|
66
|
+
/**
|
|
67
|
+
* Which of `organizationIds` hold a credit-limit row, in no particular
|
|
68
|
+
* order. The caller supplies the chain and decides which hit is nearest.
|
|
69
|
+
*
|
|
70
|
+
* The read crosses organisation scope deliberately: the holder is by
|
|
71
|
+
* definition an ancestor outside the caller's tenant filter, so an
|
|
72
|
+
* implementation that let `@OrgScoped` narrow it would answer the empty set
|
|
73
|
+
* and inheritance would stop working with nothing to show for it.
|
|
74
|
+
*
|
|
75
|
+
* Plain ids, never the module's rows — a `CreditLimit` handed across this
|
|
76
|
+
* seam would be a managed entity the consumer could mutate and flush outside
|
|
77
|
+
* the transaction that loaded it.
|
|
78
|
+
*/
|
|
79
|
+
organizationsWithLimit(organizationIds: readonly string[]): Promise<string[]>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Container name: `creditLimitService`. Owner: `credit_limits`.
|
|
83
|
+
*
|
|
84
|
+
* The narrow grant/adjust seam over `credit_limits`' own registration, for a
|
|
85
|
+
* module that imports contractor credit limits from an external system: grant
|
|
86
|
+
* on first sight, adjust thereafter. `orders` resolves the same registration
|
|
87
|
+
* under its own `CreditLimitPort` (D-94.5).
|
|
88
|
+
*
|
|
89
|
+
* It was filed in the Comarch XL vendor contract module, which was its first
|
|
90
|
+
* consumer, until that module left `@endora-commerce/contracts` (feature 134,
|
|
91
|
+
* E5). The name is `credit_limits`' to publish, not a vendor's, so it stays
|
|
92
|
+
* here with the owner's other contract types.
|
|
93
|
+
*/
|
|
94
|
+
export interface ContractorCreditLimitPort {
|
|
95
|
+
getForOrganization(organizationId: string): Promise<{
|
|
96
|
+
grantedAmount: string;
|
|
97
|
+
} | null>;
|
|
98
|
+
grant(input: {
|
|
99
|
+
organizationId: string;
|
|
100
|
+
grantedAmount: number;
|
|
101
|
+
currency: string;
|
|
102
|
+
}): Promise<unknown>;
|
|
103
|
+
adjust(input: {
|
|
104
|
+
organizationId: string;
|
|
105
|
+
grantedAmount: number;
|
|
106
|
+
allowOverAllocation?: boolean;
|
|
107
|
+
}): Promise<{
|
|
108
|
+
ok: boolean;
|
|
109
|
+
}>;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=credit-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit-limits.d.ts","sourceRoot":"","sources":["../src/credit-limits.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AAC;IACrB,MAAM,CAAC,KAAK,EAAE;QACZ,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;QACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC9B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { isoDateTimeSchema, uuidSchema } from './common.js';
|
|
3
|
+
/**
|
|
4
|
+
* Credit Limit module contracts (US6) — see
|
|
5
|
+
* specs/001-b2b-platform-foundation/contracts/credit_limits.contract.md.
|
|
6
|
+
*/
|
|
7
|
+
export const creditLimitReservationStatusSchema = z.enum(['active', 'released']);
|
|
8
|
+
export const creditLimitReservationReleaseReasonSchema = z.enum([
|
|
9
|
+
'invoice_paid',
|
|
10
|
+
'order_cancelled',
|
|
11
|
+
'admin_revocation',
|
|
12
|
+
]);
|
|
13
|
+
export const creditLimitViewSchema = z.object({
|
|
14
|
+
organizationId: uuidSchema,
|
|
15
|
+
grantedAmount: z.number().finite().nonnegative(),
|
|
16
|
+
availableAmount: z.number().finite(),
|
|
17
|
+
currency: z.string().length(3),
|
|
18
|
+
activeReservations: z.array(z.object({
|
|
19
|
+
orderId: uuidSchema,
|
|
20
|
+
amount: z.number().finite(),
|
|
21
|
+
createdAt: isoDateTimeSchema,
|
|
22
|
+
})),
|
|
23
|
+
grantedAt: isoDateTimeSchema,
|
|
24
|
+
});
|
|
25
|
+
export const grantCreditLimitRequestSchema = z.object({
|
|
26
|
+
grantedAmount: z.number().finite().positive(),
|
|
27
|
+
currency: z.string().length(3),
|
|
28
|
+
reason: z.string().max(2000).optional(),
|
|
29
|
+
});
|
|
30
|
+
export const adjustCreditLimitRequestSchema = z.object({
|
|
31
|
+
grantedAmount: z.number().finite().nonnegative(),
|
|
32
|
+
reason: z.string().max(2000).optional(),
|
|
33
|
+
allowOverAllocation: z.boolean().opt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MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;IAChD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;IACvC,mBAAmB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `currencies` module contracts — the in-process port surface (feature 075,
|
|
3
|
+
* Phase P).
|
|
4
|
+
*
|
|
5
|
+
* The delivery-side twin of `languages.ts`, and for the same reason:
|
|
6
|
+
* `dictionaries` hosts the admin screen over this table, so the write path
|
|
7
|
+
* crosses a boundary by design. Fifteen import sites, six of them
|
|
8
|
+
* `dictionaries` reading the `Currency` entity to resolve a label or validate
|
|
9
|
+
* a code, four of them `pim_ergonode` mapping an import's price currencies.
|
|
10
|
+
*
|
|
11
|
+
* Plain TypeScript rather than Zod: these describe in-process calls.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The EventBus name `currencies` announces on after any write.
|
|
15
|
+
*
|
|
16
|
+
* A **constant, not a port** (FR-013). Whoever caches currency data
|
|
17
|
+
* subscribes; `currencies` must not know who does.
|
|
18
|
+
*/
|
|
19
|
+
export declare const CURRENCY_CHANGED_EVENT = "currencies.changed";
|
|
20
|
+
/**
|
|
21
|
+
* A currency as it crosses a module boundary — a plain shape, never the ORM
|
|
22
|
+
* entity (FR-011). The primary key is the ISO code.
|
|
23
|
+
*/
|
|
24
|
+
export interface CurrencyRecord {
|
|
25
|
+
/** ISO 4217 code. The primary key. */
|
|
26
|
+
code: string;
|
|
27
|
+
label: string;
|
|
28
|
+
symbol: string;
|
|
29
|
+
symbolPosition: 'prefix' | 'suffix';
|
|
30
|
+
decimalPlaces: number;
|
|
31
|
+
isDefault: boolean;
|
|
32
|
+
isActive: boolean;
|
|
33
|
+
sortOrder: number;
|
|
34
|
+
createdAt: Date;
|
|
35
|
+
updatedAt: Date;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Container name: `currencyReadPort`. Owner: `currencies`.
|
|
39
|
+
*
|
|
40
|
+
* When `currencies` is off every method fails closed. A price with no currency
|
|
41
|
+
* is not a price, so there is nothing for a caller to degrade to — and
|
|
42
|
+
* defaulting to one would silently reprice a catalogue.
|
|
43
|
+
*
|
|
44
|
+
* Whether `currencies` has an off state at all is its manifest's `activation` to
|
|
45
|
+
* say, not this line's: a module declaring `nonDeactivatable` never enters one.
|
|
46
|
+
*/
|
|
47
|
+
export interface CurrencyReadPort {
|
|
48
|
+
list(): Promise<CurrencyRecord[]>;
|
|
49
|
+
/** Only `isActive`, ordered by sort order then code. */
|
|
50
|
+
listActive(): Promise<CurrencyRecord[]>;
|
|
51
|
+
/** Exactly one currency is the default; `null` only before the first seed. */
|
|
52
|
+
getDefault(): Promise<CurrencyRecord | null>;
|
|
53
|
+
findByCode(code: string): Promise<CurrencyRecord | null>;
|
|
54
|
+
}
|
|
55
|
+
export interface CreateCurrencyInput {
|
|
56
|
+
code: string;
|
|
57
|
+
label: string;
|
|
58
|
+
symbol: string;
|
|
59
|
+
symbolPosition?: 'prefix' | 'suffix';
|
|
60
|
+
decimalPlaces?: number;
|
|
61
|
+
isActive?: boolean;
|
|
62
|
+
sortOrder?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface UpsertCurrencyInput {
|
|
65
|
+
code: string;
|
|
66
|
+
label: string;
|
|
67
|
+
symbol: string;
|
|
68
|
+
isActive?: boolean;
|
|
69
|
+
sortOrder?: number;
|
|
70
|
+
}
|
|
71
|
+
export interface UpdateCurrencyInput {
|
|
72
|
+
label?: string;
|
|
73
|
+
symbol?: string;
|
|
74
|
+
symbolPosition?: 'prefix' | 'suffix';
|
|
75
|
+
decimalPlaces?: number;
|
|
76
|
+
isActive?: boolean;
|
|
77
|
+
sortOrder?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Container name: `currencyAdminPort`. Owner: `currencies`.
|
|
81
|
+
*
|
|
82
|
+
* `upsert` is separate from `create` because `pim_ergonode` reaches it during
|
|
83
|
+
* an import: a feed naming a currency the platform does not have should add
|
|
84
|
+
* it, not fail the run. `create` refuses a duplicate, and both refuse to
|
|
85
|
+
* deactivate the default.
|
|
86
|
+
*/
|
|
87
|
+
export interface CurrencyAdminPort {
|
|
88
|
+
create(input: CreateCurrencyInput): Promise<CurrencyRecord>;
|
|
89
|
+
upsert(input: UpsertCurrencyInput): Promise<CurrencyRecord>;
|
|
90
|
+
update(code: string, input: UpdateCurrencyInput): Promise<CurrencyRecord>;
|
|
91
|
+
setDefault(code: string): Promise<CurrencyRecord>;
|
|
92
|
+
remove(code: string): Promise<void>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* One currency the platform ships a definition for, as it crosses the boundary
|
|
96
|
+
* into {@link CurrencySeedPort}.
|
|
97
|
+
*
|
|
98
|
+
* The catalogue itself is `dictionaries`' — it exists so that
|
|
99
|
+
* `countries.default_currency_code` is satisfiable on a fresh install — while
|
|
100
|
+
* the table it lands in is this module's. That split is why the seam is a port
|
|
101
|
+
* and not a shared file.
|
|
102
|
+
*/
|
|
103
|
+
export interface CurrencySeedRow {
|
|
104
|
+
code: string;
|
|
105
|
+
label: string;
|
|
106
|
+
symbol: string;
|
|
107
|
+
symbolPosition?: 'prefix' | 'suffix';
|
|
108
|
+
decimalPlaces?: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Container name: `currencySeedPort`. Owner: `currencies`.
|
|
112
|
+
*
|
|
113
|
+
* The seam `dictionaries`' boot reconciler used to be a raw
|
|
114
|
+
* `insert into "currencies"` — this module's table, written by another module,
|
|
115
|
+
* invisible to every import-level boundary check (D-87).
|
|
116
|
+
*
|
|
117
|
+
* Deliberately **not** `CurrencyAdminPort.create`: 53 rows land on a fresh
|
|
118
|
+
* install, and routing them through the admin write path would record 53 audit
|
|
119
|
+
* entries for something no operator did and flush once per row. Seeding is
|
|
120
|
+
* idempotent by contract — a code that already exists is left exactly as it is,
|
|
121
|
+
* operator edits included.
|
|
122
|
+
*/
|
|
123
|
+
export interface CurrencySeedPort {
|
|
124
|
+
/** Inserts every row whose `code` is missing. Returns how many it inserted. */
|
|
125
|
+
ensureSeeded(rows: readonly CurrencySeedRow[]): Promise<number>;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=currencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencies.d.ts","sourceRoot":"","sources":["../src/currencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAE3D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAClC,wDAAwD;IACxD,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC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MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAClD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,YAAY,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACjE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `currencies` module contracts — the in-process port surface (feature 075,
|
|
3
|
+
* Phase P).
|
|
4
|
+
*
|
|
5
|
+
* The delivery-side twin of `languages.ts`, and for the same reason:
|
|
6
|
+
* `dictionaries` hosts the admin screen over this table, so the write path
|
|
7
|
+
* crosses a boundary by design. Fifteen import sites, six of them
|
|
8
|
+
* `dictionaries` reading the `Currency` entity to resolve a label or validate
|
|
9
|
+
* a code, four of them `pim_ergonode` mapping an import's price currencies.
|
|
10
|
+
*
|
|
11
|
+
* Plain TypeScript rather than Zod: these describe in-process calls.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The EventBus name `currencies` announces on after any write.
|
|
15
|
+
*
|
|
16
|
+
* A **constant, not a port** (FR-013). Whoever caches currency data
|
|
17
|
+
* subscribes; `currencies` must not know who does.
|
|
18
|
+
*/
|
|
19
|
+
export const CURRENCY_CHANGED_EVENT = 'currencies.changed';
|
|
20
|
+
//# sourceMappingURL=currencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencies.js","sourceRoot":"","sources":["../src/currencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Custom Fields Layer (feature 055) — entity-agnostic runtime custom fields
|
|
4
|
+
* on core entities (Category, Order, Organization, Customer, QuoteRequest).
|
|
5
|
+
*
|
|
6
|
+
* These are the source-of-truth boundary schemas (Principle V). The per-value
|
|
7
|
+
* validator applied to host records is DERIVED at runtime from a stored
|
|
8
|
+
* definition (see backend `custom-field-value.service.ts`); the schemas here
|
|
9
|
+
* cover the definition/option admin API and the value-bag envelope.
|
|
10
|
+
*/
|
|
11
|
+
/** The host entity types custom fields may attach to at launch. Extensible via the backend registry. */
|
|
12
|
+
export declare const supportedEntityTypeSchema: z.ZodEnum<{
|
|
13
|
+
customer: "customer";
|
|
14
|
+
category: "category";
|
|
15
|
+
order: "order";
|
|
16
|
+
product: "product";
|
|
17
|
+
organization: "organization";
|
|
18
|
+
quote_request: "quote_request";
|
|
19
|
+
}>;
|
|
20
|
+
export type SupportedEntityType = z.infer<typeof supportedEntityTypeSchema>;
|
|
21
|
+
/** The set of runtime value types. `text` is stored as a string; `select` stores one option value; `multiselect` an array. */
|
|
22
|
+
export declare const customFieldValueTypeSchema: z.ZodEnum<{
|
|
23
|
+
number: "number";
|
|
24
|
+
boolean: "boolean";
|
|
25
|
+
date: "date";
|
|
26
|
+
text: "text";
|
|
27
|
+
select: "select";
|
|
28
|
+
multiselect: "multiselect";
|
|
29
|
+
}>;
|
|
30
|
+
export type CustomFieldValueType = z.infer<typeof customFieldValueTypeSchema>;
|
|
31
|
+
/** Per-locale label map (BCP-47-keyed). Empty is allowed when only `labelDefault` is filled. */
|
|
32
|
+
export declare const localizedLabelSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
33
|
+
export type LocalizedLabel = z.infer<typeof localizedLabelSchema>;
|
|
34
|
+
/** A select/multiselect option. `id` absent on create. */
|
|
35
|
+
export declare const customFieldOptionSchema: z.ZodObject<{
|
|
36
|
+
id: z.ZodOptional<z.ZodString>;
|
|
37
|
+
value: z.ZodString;
|
|
38
|
+
label: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
39
|
+
labelDefault: z.ZodString;
|
|
40
|
+
isDefault: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export type CustomFieldOptionDto = z.infer<typeof customFieldOptionSchema>;
|
|
44
|
+
/** A full custom-field definition, options embedded. */
|
|
45
|
+
export declare const customFieldDefinitionSchema: z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
entityType: z.ZodEnum<{
|
|
48
|
+
customer: "customer";
|
|
49
|
+
category: "category";
|
|
50
|
+
order: "order";
|
|
51
|
+
product: "product";
|
|
52
|
+
organization: "organization";
|
|
53
|
+
quote_request: "quote_request";
|
|
54
|
+
}>;
|
|
55
|
+
key: z.ZodString;
|
|
56
|
+
label: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
57
|
+
labelDefault: z.ZodString;
|
|
58
|
+
valueType: z.ZodEnum<{
|
|
59
|
+
number: "number";
|
|
60
|
+
boolean: "boolean";
|
|
61
|
+
date: "date";
|
|
62
|
+
text: "text";
|
|
63
|
+
select: "select";
|
|
64
|
+
multiselect: "multiselect";
|
|
65
|
+
}>;
|
|
66
|
+
required: z.ZodBoolean;
|
|
67
|
+
sortOrder: z.ZodNumber;
|
|
68
|
+
config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
69
|
+
options: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
70
|
+
id: z.ZodOptional<z.ZodString>;
|
|
71
|
+
value: z.ZodString;
|
|
72
|
+
label: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
73
|
+
labelDefault: z.ZodString;
|
|
74
|
+
isDefault: z.ZodDefault<z.ZodBoolean>;
|
|
75
|
+
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
76
|
+
}, z.core.$strip>>>;
|
|
77
|
+
createdAt: z.ZodString;
|
|
78
|
+
updatedAt: z.ZodString;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
export type CustomFieldDefinitionDto = z.infer<typeof customFieldDefinitionSchema>;
|
|
81
|
+
/** Create a definition. `entityType` + `key` are immutable after create. */
|
|
82
|
+
export declare const createCustomFieldDefinitionSchema: z.ZodObject<{
|
|
83
|
+
label: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
84
|
+
key: z.ZodString;
|
|
85
|
+
valueType: z.ZodEnum<{
|
|
86
|
+
number: "number";
|
|
87
|
+
boolean: "boolean";
|
|
88
|
+
date: "date";
|
|
89
|
+
text: "text";
|
|
90
|
+
select: "select";
|
|
91
|
+
multiselect: "multiselect";
|
|
92
|
+
}>;
|
|
93
|
+
required: z.ZodBoolean;
|
|
94
|
+
options: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
95
|
+
id: z.ZodOptional<z.ZodString>;
|
|
96
|
+
value: z.ZodString;
|
|
97
|
+
label: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
98
|
+
labelDefault: z.ZodString;
|
|
99
|
+
isDefault: z.ZodDefault<z.ZodBoolean>;
|
|
100
|
+
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
101
|
+
}, z.core.$strip>>>;
|
|
102
|
+
sortOrder: z.ZodNumber;
|
|
103
|
+
config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
104
|
+
labelDefault: z.ZodString;
|
|
105
|
+
entityType: z.ZodEnum<{
|
|
106
|
+
customer: "customer";
|
|
107
|
+
category: "category";
|
|
108
|
+
order: "order";
|
|
109
|
+
product: "product";
|
|
110
|
+
organization: "organization";
|
|
111
|
+
quote_request: "quote_request";
|
|
112
|
+
}>;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
export type CreateCustomFieldDefinitionRequest = z.infer<typeof createCustomFieldDefinitionSchema>;
|
|
115
|
+
/** Patch a definition. `entityType` and `key` cannot change once records may hold values. */
|
|
116
|
+
export declare const updateCustomFieldDefinitionSchema: z.ZodObject<{
|
|
117
|
+
label: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
118
|
+
valueType: z.ZodOptional<z.ZodEnum<{
|
|
119
|
+
number: "number";
|
|
120
|
+
boolean: "boolean";
|
|
121
|
+
date: "date";
|
|
122
|
+
text: "text";
|
|
123
|
+
select: "select";
|
|
124
|
+
multiselect: "multiselect";
|
|
125
|
+
}>>;
|
|
126
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
options: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
128
|
+
id: z.ZodOptional<z.ZodString>;
|
|
129
|
+
value: z.ZodString;
|
|
130
|
+
label: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
131
|
+
labelDefault: z.ZodString;
|
|
132
|
+
isDefault: z.ZodDefault<z.ZodBoolean>;
|
|
133
|
+
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
134
|
+
}, z.core.$strip>>>>;
|
|
135
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
136
|
+
config: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
137
|
+
labelDefault: z.ZodOptional<z.ZodString>;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
export type UpdateCustomFieldDefinitionRequest = z.infer<typeof updateCustomFieldDefinitionSchema>;
|
|
140
|
+
/**
|
|
141
|
+
* One supported host entity type as served by the admin entity-types listing
|
|
142
|
+
* (feature 061 T037). `managedBy` is present only for host-managed types
|
|
143
|
+
* (e.g. `product` → catalog attributes): the generic admin UI renders those
|
|
144
|
+
* read-only and links to `managedBy.route`. Label fields are i18n keys
|
|
145
|
+
* resolved against the `custom_fields` module bundle.
|
|
146
|
+
*/
|
|
147
|
+
export declare const customFieldEntityTypeInfoSchema: z.ZodObject<{
|
|
148
|
+
entityType: z.ZodEnum<{
|
|
149
|
+
customer: "customer";
|
|
150
|
+
category: "category";
|
|
151
|
+
order: "order";
|
|
152
|
+
product: "product";
|
|
153
|
+
organization: "organization";
|
|
154
|
+
quote_request: "quote_request";
|
|
155
|
+
}>;
|
|
156
|
+
labelKey: z.ZodString;
|
|
157
|
+
managedBy: z.ZodOptional<z.ZodObject<{
|
|
158
|
+
moduleId: z.ZodString;
|
|
159
|
+
labelKey: z.ZodString;
|
|
160
|
+
route: z.ZodString;
|
|
161
|
+
}, z.core.$strip>>;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
export type CustomFieldEntityTypeInfo = z.infer<typeof customFieldEntityTypeInfoSchema>;
|
|
164
|
+
/** A validated value bag keyed by definition `key`. Values are typed by their definition's `valueType`. */
|
|
165
|
+
export declare const customFieldValuesSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
166
|
+
export type CustomFieldValues = z.infer<typeof customFieldValuesSchema>;
|
|
167
|
+
/** One per-field validation failure returned to the admin for per-field rendering (FR-004). */
|
|
168
|
+
export declare const customFieldValidationErrorSchema: z.ZodObject<{
|
|
169
|
+
field: z.ZodString;
|
|
170
|
+
code: z.ZodEnum<{
|
|
171
|
+
wrong_type: "wrong_type";
|
|
172
|
+
missing_required: "missing_required";
|
|
173
|
+
unknown_option: "unknown_option";
|
|
174
|
+
out_of_range: "out_of_range";
|
|
175
|
+
duplicate_option: "duplicate_option";
|
|
176
|
+
}>;
|
|
177
|
+
message: z.ZodString;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
export type CustomFieldValidationError = z.infer<typeof customFieldValidationErrorSchema>;
|
|
180
|
+
/**
|
|
181
|
+
* What `CustomFieldValuePort.validateAndMerge` throws, as a **shape** rather
|
|
182
|
+
* than a constructor (feature 075, Phase C).
|
|
183
|
+
*
|
|
184
|
+
* Five host modules catch it to turn it into the 422 envelope, and each of them
|
|
185
|
+
* did it with `err instanceof CustomFieldValidationError` — which imports
|
|
186
|
+
* `custom_fields`' class and is the last thing several of their cuts would
|
|
187
|
+
* otherwise be left holding. This is D-77's remedy for
|
|
188
|
+
* `CustomFieldDefinitionError` applied to its sibling: narrow structurally, so
|
|
189
|
+
* the host names a published shape instead of a foreign constructor.
|
|
190
|
+
*
|
|
191
|
+
* The guard tests `name` and the `errors` array rather than the prototype
|
|
192
|
+
* chain, which is also what makes it survive the error crossing a package
|
|
193
|
+
* boundary once each module is its own npm package (F4).
|
|
194
|
+
*/
|
|
195
|
+
export interface CustomFieldValidationFailure extends Error {
|
|
196
|
+
readonly errors: readonly CustomFieldValidationError[];
|
|
197
|
+
}
|
|
198
|
+
export declare function isCustomFieldValidationFailure(error: unknown): error is CustomFieldValidationFailure;
|
|
199
|
+
/**
|
|
200
|
+
* How a definition or option write can be refused (feature 061).
|
|
201
|
+
*
|
|
202
|
+
* Published as a union rather than a class so a host narrows the failure
|
|
203
|
+
* **structurally**. `catalog` mapped these onto its own HTTP surface by
|
|
204
|
+
* `err instanceof CustomFieldDefinitionError`, which meant importing a
|
|
205
|
+
* constructor out of another module to read a string field off it.
|
|
206
|
+
*/
|
|
207
|
+
export declare const CUSTOM_FIELD_DEFINITION_ERROR_CODES: readonly ["not_found", "duplicate_key", "options_required", "options_forbidden", "entity_type_unknown", "value_type_locked", "option_in_use"];
|
|
208
|
+
export type CustomFieldDefinitionErrorCode = (typeof CUSTOM_FIELD_DEFINITION_ERROR_CODES)[number];
|
|
209
|
+
/** A refused definition or option write, as a host outside `custom_fields` sees it. */
|
|
210
|
+
export interface CustomFieldDefinitionFailure {
|
|
211
|
+
readonly name: 'CustomFieldDefinitionError';
|
|
212
|
+
readonly code: CustomFieldDefinitionErrorCode;
|
|
213
|
+
readonly message: string;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Whether `error` is a refused definition write, narrowed by shape.
|
|
217
|
+
*
|
|
218
|
+
* `name` and `code` together, not `name` alone: the name is what the class sets
|
|
219
|
+
* on itself and the code is what the caller branches on, so a shape carrying one
|
|
220
|
+
* without the other is not something a host can act on.
|
|
221
|
+
*/
|
|
222
|
+
export declare function isCustomFieldDefinitionFailure(error: unknown): error is CustomFieldDefinitionFailure;
|
|
223
|
+
/** One custom-field definition, as a module outside `custom_fields` sees it. */
|
|
224
|
+
export interface CustomFieldDefinitionRecord {
|
|
225
|
+
id: string;
|
|
226
|
+
entityType: SupportedEntityType;
|
|
227
|
+
key: string;
|
|
228
|
+
label: Record<string, string>;
|
|
229
|
+
labelDefault: string;
|
|
230
|
+
valueType: CustomFieldValueType;
|
|
231
|
+
required: boolean;
|
|
232
|
+
sortOrder: number;
|
|
233
|
+
config: Record<string, unknown>;
|
|
234
|
+
createdAt: Date;
|
|
235
|
+
updatedAt: Date;
|
|
236
|
+
}
|
|
237
|
+
/** One selectable option of a `select` / `multiselect` definition. */
|
|
238
|
+
export interface CustomFieldOptionRecord {
|
|
239
|
+
id: string;
|
|
240
|
+
definitionId: string;
|
|
241
|
+
value: string;
|
|
242
|
+
label: Record<string, string>;
|
|
243
|
+
labelDefault: string;
|
|
244
|
+
isDefault: boolean;
|
|
245
|
+
sortOrder: number;
|
|
246
|
+
createdAt: Date;
|
|
247
|
+
updatedAt: Date;
|
|
248
|
+
}
|
|
249
|
+
/** A definition with its options — the unit the per-entity cache holds. */
|
|
250
|
+
export interface CustomFieldDefinitionWithOptions {
|
|
251
|
+
readonly definition: CustomFieldDefinitionRecord;
|
|
252
|
+
readonly options: CustomFieldOptionRecord[];
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Container name: `customFieldDefinitionReadPort`. Owner: `custom_fields`.
|
|
256
|
+
*
|
|
257
|
+
* `catalog`'s composed attribute read model is the heaviest consumer: since
|
|
258
|
+
* feature 061 the definition half of a product attribute *is* a custom-field
|
|
259
|
+
* definition, and it reads them through this one question. `product_feeds`
|
|
260
|
+
* asks the same thing of its own host.
|
|
261
|
+
*
|
|
262
|
+
* Reads ride the per-entity in-process cache (invalidated by every committed
|
|
263
|
+
* definition Command, with a 5 s TTL fallback), so this is cheap enough to
|
|
264
|
+
* call on a hot path — which is what the existing `DefinitionSource` interface
|
|
265
|
+
* was extracted for.
|
|
266
|
+
*
|
|
267
|
+
* **Owner off:** the seam fails closed — resolving this port throws
|
|
268
|
+
* `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
|
|
269
|
+
* half-executes. Whether `custom_fields` has an off state at all is its manifest's
|
|
270
|
+
* `activation` to say, not this line's: a module declaring
|
|
271
|
+
* `nonDeactivatable` never enters one.
|
|
272
|
+
*/
|
|
273
|
+
export interface CustomFieldDefinitionReadPort {
|
|
274
|
+
listForEntity(entityType: SupportedEntityType): Promise<CustomFieldDefinitionWithOptions[]>;
|
|
275
|
+
/**
|
|
276
|
+
* The same list, bypassing the per-entity cache and refreshing it for every
|
|
277
|
+
* process.
|
|
278
|
+
*
|
|
279
|
+
* A consumer composing its own rows against these definitions can observe a
|
|
280
|
+
* benign inconsistency: a just-committed definition Command may dispatch its
|
|
281
|
+
* domain event before the post-commit invalidation runs, and the invalidation
|
|
282
|
+
* is a Redis fan-out with a TTL fallback, so a second process holds a stale
|
|
283
|
+
* entry no in-process sequencing can reach. Only the consumer can *detect*
|
|
284
|
+
* that — it is the one that knows what its own rows say — and only this
|
|
285
|
+
* module may *resolve* it, because the cache is its own. So the port answers
|
|
286
|
+
* the question the consumer actually has ("give me definitions I can trust")
|
|
287
|
+
* rather than exposing an instruction about somebody else's internals.
|
|
288
|
+
*
|
|
289
|
+
* **Required, not optional**, and D-97.3 makes that a rule for every port:
|
|
290
|
+
* `lazyPort`'s proxy answers every property with a function, so
|
|
291
|
+
* `if (port.maybe)` is always true and feature detection through a port is
|
|
292
|
+
* impossible by construction. The one optional method that existed —
|
|
293
|
+
* `catalog`'s `publishInvalidate?` widening — fired its recovery branch
|
|
294
|
+
* unconditionally and turned a self-healing window into a 500.
|
|
295
|
+
*/
|
|
296
|
+
listForEntityFresh(entityType: SupportedEntityType): Promise<CustomFieldDefinitionWithOptions[]>;
|
|
297
|
+
/**
|
|
298
|
+
* One definition by id, with its options, or `null`.
|
|
299
|
+
*
|
|
300
|
+
* The **committed** state, deliberately: `catalog`'s attribute Commands read
|
|
301
|
+
* it to capture an audit "before" snapshot and to feed the guards a
|
|
302
|
+
* definition change has to satisfy, and both questions are about the row as
|
|
303
|
+
* it stands rather than about anything the caller's open transaction has
|
|
304
|
+
* written. That is what makes it a read rather than a seventh member of the
|
|
305
|
+
* apply seam — handing a read an `EntityManager` re-opens a write seam to
|
|
306
|
+
* serve it (D-169).
|
|
307
|
+
*
|
|
308
|
+
* It is published here, rather than left on the apply seam it used to sit
|
|
309
|
+
* beside, because the definition service answers it with its two **managed
|
|
310
|
+
* ORM entities** while the one consumer typed the result as a record.
|
|
311
|
+
* Nothing mutated them, so the leak was latent — but that is precisely the
|
|
312
|
+
* ability D-77's first narrowing took away from every other apply-seam
|
|
313
|
+
* return, and a consumer holding a managed entity can persist a change to it
|
|
314
|
+
* on whatever transaction it happens to be holding.
|
|
315
|
+
*/
|
|
316
|
+
getById(id: string): Promise<CustomFieldDefinitionWithOptions | null>;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Container name: `customFieldValueService`. Owner: `custom_fields`.
|
|
320
|
+
*
|
|
321
|
+
* Five host modules — `orders`, `organizations`, `customers`, `quote_requests`
|
|
322
|
+
* and `catalog` — validate their own custom-field bag through this before
|
|
323
|
+
* persisting it.
|
|
324
|
+
*
|
|
325
|
+
* It performs **no** database write and **no** audit: the host persists its own
|
|
326
|
+
* record and audits its own write (Principle XIII). This port only validates
|
|
327
|
+
* the incoming values and returns the merged bag, which is what keeps the
|
|
328
|
+
* module boundary intact (Principle I) and avoids a double audit.
|
|
329
|
+
*
|
|
330
|
+
* `validateAndMerge` throws `CustomFieldValidationError` — serialised as HTTP
|
|
331
|
+
* 422 — with the per-field errors (feature 055 FR-004). Unknown patch keys are
|
|
332
|
+
* ignored; dormant keys already in the bag are retained (FR-010).
|
|
333
|
+
*
|
|
334
|
+
* **Owner off:** the seam fails closed — resolving this port throws
|
|
335
|
+
* `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
|
|
336
|
+
* half-executes. Whether `custom_fields` has an off state at all is its manifest's
|
|
337
|
+
* `activation` to say, not this line's: a module declaring
|
|
338
|
+
* `nonDeactivatable` never enters one.
|
|
339
|
+
*/
|
|
340
|
+
export interface CustomFieldValuePort {
|
|
341
|
+
validateAndMerge(entityType: SupportedEntityType, currentBag: Record<string, unknown>, patch: Record<string, unknown> | undefined): Promise<Record<string, unknown>>;
|
|
342
|
+
/** The bag as a caller should render it: dormant keys stripped. */
|
|
343
|
+
project(entityType: SupportedEntityType, bag: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
344
|
+
}
|
|
345
|
+
//# sourceMappingURL=custom-fields.d.ts.map
|