@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,340 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Actor } from './actor.js';
|
|
3
|
+
/**
|
|
4
|
+
* Organization roles and organization permissions — the buyer's side of
|
|
5
|
+
* "who may do what" (`specs/170-organization-roles/`).
|
|
6
|
+
*
|
|
7
|
+
* An Organization holds two predefined roles — *Administrator* (every present
|
|
8
|
+
* permission, immutable) and *Member* (editable) — and up to fifty custom ones.
|
|
9
|
+
* Each member holds exactly one. A role is a set of **organization permission**
|
|
10
|
+
* codes (`<module>.<action>`), declared by the module whose buyer action each
|
|
11
|
+
* gates in its manifest's `organizationPermissions` field (`./modules.ts`).
|
|
12
|
+
* The operator vocabulary (`<area>:<action>`, `/admin-roles`) is a different
|
|
13
|
+
* one and the two never meet (FR-020, research R-2).
|
|
14
|
+
*
|
|
15
|
+
* Normative: `specs/170-organization-roles/contracts/organization-permission-port.md`
|
|
16
|
+
* and `contracts/storefront-api.md` §2. They replaced the legacy two-value role
|
|
17
|
+
* enum, removed with its columns by the feature's legacy-removal package
|
|
18
|
+
* (research R-23).
|
|
19
|
+
*/
|
|
20
|
+
export declare const organizationRoleKindSchema: z.ZodEnum<{
|
|
21
|
+
custom: "custom";
|
|
22
|
+
administrator: "administrator";
|
|
23
|
+
member: "member";
|
|
24
|
+
}>;
|
|
25
|
+
export type OrganizationRoleKind = z.infer<typeof organizationRoleKindSchema>;
|
|
26
|
+
/**
|
|
27
|
+
* The role as every response shows it (FR-008, FR-056, FR-073). `name` is the
|
|
28
|
+
* translated label for `administrator` / `member` in the response language and
|
|
29
|
+
* the stored name for `custom`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const organizationRoleRefSchema: z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
kind: z.ZodEnum<{
|
|
35
|
+
custom: "custom";
|
|
36
|
+
administrator: "administrator";
|
|
37
|
+
member: "member";
|
|
38
|
+
}>;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
export type OrganizationRoleRef = z.infer<typeof organizationRoleRefSchema>;
|
|
41
|
+
/**
|
|
42
|
+
* One role on the role-management screens, storefront and Admin UI alike
|
|
43
|
+
* (`contracts/storefront-api.md` §2). `permissions` are the stored grants of
|
|
44
|
+
* **present** codes only — a grant of a switched-off module's code is kept
|
|
45
|
+
* server-side and never round-trips through the editor (FR-025); for the
|
|
46
|
+
* administrator it is every present code. `pendingInvitationCount` counts
|
|
47
|
+
* invitations neither accepted, revoked nor expired (FR-010a).
|
|
48
|
+
*/
|
|
49
|
+
export declare const organizationRoleViewSchema: z.ZodObject<{
|
|
50
|
+
id: z.ZodString;
|
|
51
|
+
kind: z.ZodEnum<{
|
|
52
|
+
custom: "custom";
|
|
53
|
+
administrator: "administrator";
|
|
54
|
+
member: "member";
|
|
55
|
+
}>;
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
description: z.ZodNullable<z.ZodString>;
|
|
58
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
59
|
+
memberCount: z.ZodNumber;
|
|
60
|
+
pendingInvitationCount: z.ZodNumber;
|
|
61
|
+
version: z.ZodNumber;
|
|
62
|
+
updatedAt: z.ZodString;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type OrganizationRoleView = z.infer<typeof organizationRoleViewSchema>;
|
|
65
|
+
export declare const organizationRoleListResponseSchema: z.ZodObject<{
|
|
66
|
+
data: z.ZodArray<z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
kind: z.ZodEnum<{
|
|
69
|
+
custom: "custom";
|
|
70
|
+
administrator: "administrator";
|
|
71
|
+
member: "member";
|
|
72
|
+
}>;
|
|
73
|
+
name: z.ZodString;
|
|
74
|
+
description: z.ZodNullable<z.ZodString>;
|
|
75
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
76
|
+
memberCount: z.ZodNumber;
|
|
77
|
+
pendingInvitationCount: z.ZodNumber;
|
|
78
|
+
version: z.ZodNumber;
|
|
79
|
+
updatedAt: z.ZodString;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
export type OrganizationRoleListResponse = z.infer<typeof organizationRoleListResponseSchema>;
|
|
83
|
+
export declare const organizationRoleResponseSchema: z.ZodObject<{
|
|
84
|
+
data: z.ZodObject<{
|
|
85
|
+
id: z.ZodString;
|
|
86
|
+
kind: z.ZodEnum<{
|
|
87
|
+
custom: "custom";
|
|
88
|
+
administrator: "administrator";
|
|
89
|
+
member: "member";
|
|
90
|
+
}>;
|
|
91
|
+
name: z.ZodString;
|
|
92
|
+
description: z.ZodNullable<z.ZodString>;
|
|
93
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
94
|
+
memberCount: z.ZodNumber;
|
|
95
|
+
pendingInvitationCount: z.ZodNumber;
|
|
96
|
+
version: z.ZodNumber;
|
|
97
|
+
updatedAt: z.ZodString;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export type OrganizationRoleResponse = z.infer<typeof organizationRoleResponseSchema>;
|
|
101
|
+
/** One grantable code, translated in the request language (R-31). */
|
|
102
|
+
export declare const organizationPermissionCatalogueEntrySchema: z.ZodObject<{
|
|
103
|
+
code: z.ZodString;
|
|
104
|
+
label: z.ZodString;
|
|
105
|
+
description: z.ZodString;
|
|
106
|
+
memberDefault: z.ZodBoolean;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
export type OrganizationPermissionCatalogueEntry = z.infer<typeof organizationPermissionCatalogueEntrySchema>;
|
|
109
|
+
/** `GET …/permission-catalogue` — present codes only, grouped by declaring module. */
|
|
110
|
+
export declare const organizationPermissionCatalogueResponseSchema: z.ZodObject<{
|
|
111
|
+
data: z.ZodObject<{
|
|
112
|
+
groups: z.ZodArray<z.ZodObject<{
|
|
113
|
+
moduleId: z.ZodString;
|
|
114
|
+
moduleLabel: z.ZodString;
|
|
115
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
116
|
+
code: z.ZodString;
|
|
117
|
+
label: z.ZodString;
|
|
118
|
+
description: z.ZodString;
|
|
119
|
+
memberDefault: z.ZodBoolean;
|
|
120
|
+
}, z.core.$strip>>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
export type OrganizationPermissionCatalogueResponse = z.infer<typeof organizationPermissionCatalogueResponseSchema>;
|
|
125
|
+
/** `GET /api/v1/organizations/mine/role` — the member's own role (FR-058). */
|
|
126
|
+
export declare const organizationOwnRoleResponseSchema: z.ZodObject<{
|
|
127
|
+
data: z.ZodObject<{
|
|
128
|
+
role: z.ZodObject<{
|
|
129
|
+
id: z.ZodString;
|
|
130
|
+
name: z.ZodString;
|
|
131
|
+
kind: z.ZodEnum<{
|
|
132
|
+
custom: "custom";
|
|
133
|
+
administrator: "administrator";
|
|
134
|
+
member: "member";
|
|
135
|
+
}>;
|
|
136
|
+
}, z.core.$strict>;
|
|
137
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
138
|
+
code: z.ZodString;
|
|
139
|
+
label: z.ZodString;
|
|
140
|
+
description: z.ZodString;
|
|
141
|
+
}, z.core.$strip>>;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
export type OrganizationOwnRoleResponse = z.infer<typeof organizationOwnRoleResponseSchema>;
|
|
145
|
+
/** `DELETE …/roles/:id` — what moved to the replacement role (FR-024). */
|
|
146
|
+
export declare const deleteOrganizationRoleResponseSchema: z.ZodObject<{
|
|
147
|
+
data: z.ZodObject<{
|
|
148
|
+
reassignedMembers: z.ZodNumber;
|
|
149
|
+
reassignedInvitations: z.ZodNumber;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
}, z.core.$strip>;
|
|
152
|
+
export type DeleteOrganizationRoleResponse = z.infer<typeof deleteOrganizationRoleResponseSchema>;
|
|
153
|
+
/** `POST …/roles` — a custom role. */
|
|
154
|
+
export declare const createOrganizationRoleRequestSchema: z.ZodObject<{
|
|
155
|
+
name: z.ZodString;
|
|
156
|
+
description: z.ZodOptional<z.ZodString>;
|
|
157
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
158
|
+
}, z.core.$strict>;
|
|
159
|
+
export type CreateOrganizationRoleRequest = z.infer<typeof createOrganizationRoleRequestSchema>;
|
|
160
|
+
/**
|
|
161
|
+
* `PATCH …/roles/:id`. `expectedVersion` is the version the editor read
|
|
162
|
+
* (`ORGANIZATION_ROLE_STALE` on mismatch, R-29); `name` and `description` are
|
|
163
|
+
* refused for the *Member* role by the Command, not by the schema.
|
|
164
|
+
*/
|
|
165
|
+
export declare const updateOrganizationRoleRequestSchema: z.ZodObject<{
|
|
166
|
+
expectedVersion: z.ZodNumber;
|
|
167
|
+
name: z.ZodOptional<z.ZodString>;
|
|
168
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
169
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
export type UpdateOrganizationRoleRequest = z.infer<typeof updateOrganizationRoleRequestSchema>;
|
|
172
|
+
/** `DELETE …/roles/:id`. A held role needs a replacement (FR-024). */
|
|
173
|
+
export declare const deleteOrganizationRoleRequestSchema: z.ZodObject<{
|
|
174
|
+
expectedVersion: z.ZodNumber;
|
|
175
|
+
replacementRoleId: z.ZodOptional<z.ZodString>;
|
|
176
|
+
}, z.core.$strict>;
|
|
177
|
+
export type DeleteOrganizationRoleRequest = z.infer<typeof deleteOrganizationRoleRequestSchema>;
|
|
178
|
+
/**
|
|
179
|
+
* `PATCH /api/v1/organizations/mine/members/:id/role` — replaces the legacy
|
|
180
|
+
* `changeMemberRoleRequestSchema` (`{ role }`).
|
|
181
|
+
*/
|
|
182
|
+
export declare const assignMemberRoleRequestSchema: z.ZodObject<{
|
|
183
|
+
roleId: z.ZodString;
|
|
184
|
+
}, z.core.$strict>;
|
|
185
|
+
export type AssignMemberRoleRequest = z.infer<typeof assignMemberRoleRequestSchema>;
|
|
186
|
+
/**
|
|
187
|
+
* Inviting a member, on the storefront and in the Admin UI
|
|
188
|
+
* (`POST …/mine/invitations`, `POST /api/v1/admin/organizations/:id/members/invite`)
|
|
189
|
+
* — replaces the legacy `inviteMemberRequestSchema` (`{ email, role? }`). An
|
|
190
|
+
* absent `roleId` is the Organization's *Member* role, resolved server-side.
|
|
191
|
+
*/
|
|
192
|
+
export declare const inviteMemberToRoleRequestSchema: z.ZodObject<{
|
|
193
|
+
email: z.ZodString;
|
|
194
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
195
|
+
}, z.core.$strict>;
|
|
196
|
+
export type InviteMemberToRoleRequest = z.infer<typeof inviteMemberToRoleRequestSchema>;
|
|
197
|
+
/**
|
|
198
|
+
* Platform admin — `POST /api/v1/admin/organizations/:id/members` (direct
|
|
199
|
+
* create). Replaces the legacy `adminDirectMemberRequestSchema`'s `role?`.
|
|
200
|
+
*/
|
|
201
|
+
export declare const adminDirectMemberToRoleRequestSchema: z.ZodObject<{
|
|
202
|
+
email: z.ZodString;
|
|
203
|
+
firstName: z.ZodString;
|
|
204
|
+
lastName: z.ZodString;
|
|
205
|
+
password: z.ZodString;
|
|
206
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
207
|
+
}, z.core.$strict>;
|
|
208
|
+
export type AdminDirectMemberToRoleRequest = z.infer<typeof adminDirectMemberToRoleRequestSchema>;
|
|
209
|
+
/**
|
|
210
|
+
* Platform admin — `PATCH /api/v1/admin/organizations/:id/members/:customerAccountId/role`.
|
|
211
|
+
* Replaces the legacy `adminPatchMemberRoleRequestSchema` (`{ role, expectedUpdatedAt? }`).
|
|
212
|
+
*/
|
|
213
|
+
export declare const adminAssignMemberRoleRequestSchema: z.ZodObject<{
|
|
214
|
+
roleId: z.ZodString;
|
|
215
|
+
expectedUpdatedAt: z.ZodOptional<z.ZodString>;
|
|
216
|
+
}, z.core.$strict>;
|
|
217
|
+
export type AdminAssignMemberRoleRequest = z.infer<typeof adminAssignMemberRoleRequestSchema>;
|
|
218
|
+
/** Who is being judged. `organizationRoleId` is the actor's when known (R-15). */
|
|
219
|
+
export interface OrganizationPermissionSubject {
|
|
220
|
+
readonly customerAccountId: string;
|
|
221
|
+
readonly organizationId: string;
|
|
222
|
+
readonly organizationRoleId?: string | null;
|
|
223
|
+
}
|
|
224
|
+
export interface OrganizationEffectivePermissions {
|
|
225
|
+
readonly role: {
|
|
226
|
+
readonly id: string;
|
|
227
|
+
readonly kind: OrganizationRoleKind;
|
|
228
|
+
};
|
|
229
|
+
/** Sorted; present codes only (FR-007). */
|
|
230
|
+
readonly permissions: readonly string[];
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Container name: `organizationPermissionPort`. Owner: `organizations`.
|
|
234
|
+
*
|
|
235
|
+
* Reached with `lazyPort<OrganizationPermissionPort>(ctx, 'organizationPermissionPort')`
|
|
236
|
+
* and never captured into a singleton. A subject whose role cannot be found in
|
|
237
|
+
* its Organization fails **closed**: `can` and `isAdministrator` answer `false`,
|
|
238
|
+
* `effective` an empty set. A code outside the vocabulary is a programming
|
|
239
|
+
* error: `can` answers `false`, `assert` throws `500 INTERNAL` (the permission
|
|
240
|
+
* inventory refuses such a call statically as well).
|
|
241
|
+
*/
|
|
242
|
+
export interface OrganizationPermissionPort {
|
|
243
|
+
can(subject: OrganizationPermissionSubject, code: string): Promise<boolean>;
|
|
244
|
+
/**
|
|
245
|
+
* Throws `403 ORGANIZATION_PERMISSION_REQUIRED` with
|
|
246
|
+
* `details: { permission, permissionLabel }`. `language` selects the label.
|
|
247
|
+
*/
|
|
248
|
+
assert(subject: OrganizationPermissionSubject, code: string, options?: {
|
|
249
|
+
language?: string;
|
|
250
|
+
}): Promise<void>;
|
|
251
|
+
isAdministrator(subject: OrganizationPermissionSubject): Promise<boolean>;
|
|
252
|
+
effective(subject: OrganizationPermissionSubject): Promise<OrganizationEffectivePermissions>;
|
|
253
|
+
/** Role ids of `organizationId` whose effective set holds `code` — administrator included. */
|
|
254
|
+
rolesHolding(organizationId: string, code: string): Promise<readonly string[]>;
|
|
255
|
+
}
|
|
256
|
+
/** Container name: `organizationRoleReadPort`. Owner: `organizations`. */
|
|
257
|
+
export interface OrganizationRoleReadPort {
|
|
258
|
+
/**
|
|
259
|
+
* The id of the Organization's predefined role of `kind`, read through the
|
|
260
|
+
* role cache from **committed** rows. A caller that has just created the
|
|
261
|
+
* Organization in its own open transaction takes the id from the provisioning
|
|
262
|
+
* answer instead (research R-34).
|
|
263
|
+
*/
|
|
264
|
+
predefinedRoleId(organizationId: string, kind: 'administrator' | 'member'): Promise<string>;
|
|
265
|
+
/**
|
|
266
|
+
* The role `roleId` **of `organizationId`**, or `null` when that Organization
|
|
267
|
+
* has no such role — another Organization's role id included (FR-005). Read
|
|
268
|
+
* through the role cache from committed rows, like {@link predefinedRoleId}.
|
|
269
|
+
* `name` is `null` for the two predefined roles, whose label is translated
|
|
270
|
+
* (FR-003). Added for `customer_account.change_role` (WP-02b), which assigns a
|
|
271
|
+
* role the caller named and must refuse one it cannot see.
|
|
272
|
+
*/
|
|
273
|
+
findRole(organizationId: string, roleId: string): Promise<OrganizationRoleSummary | null>;
|
|
274
|
+
/**
|
|
275
|
+
* The role `roleId` **of `organizationId`** as every response names it
|
|
276
|
+
* (FR-008, FR-056): a predefined role's label translated into `language`
|
|
277
|
+
* (English when absent or unsupported), a custom role's own name verbatim;
|
|
278
|
+
* `null` when that Organization has no such role (FR-005). Read through the
|
|
279
|
+
* role cache like {@link findRole}. Added for the session views and the
|
|
280
|
+
* operator's impersonation answer (WP-03), which other modules serve.
|
|
281
|
+
*/
|
|
282
|
+
roleRef(organizationId: string, roleId: string, language?: string): Promise<OrganizationRoleRef | null>;
|
|
283
|
+
}
|
|
284
|
+
/** A role as {@link OrganizationRoleReadPort.findRole} answers it. */
|
|
285
|
+
export interface OrganizationRoleSummary {
|
|
286
|
+
readonly id: string;
|
|
287
|
+
readonly kind: OrganizationRoleKind;
|
|
288
|
+
/** The custom role's name; `null` for `administrator` and `member`. */
|
|
289
|
+
readonly name: string | null;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* The refusal {@link organizationPermissionPreHandler} raises for a request
|
|
293
|
+
* that carries no customer: `401 UNAUTHORIZED`, the answer `requireCustomer`
|
|
294
|
+
* gives.
|
|
295
|
+
*
|
|
296
|
+
* It is a class of this package rather than the platform's `HttpError`
|
|
297
|
+
* because the guard is a plain function here and this package depends on
|
|
298
|
+
* nothing but `zod` — it cannot construct the platform's error. The platform's
|
|
299
|
+
* error envelope renders it exactly as it renders `requireCustomer`'s refusal.
|
|
300
|
+
* The guard is declared **after** `requireCustomer`, so in a correctly
|
|
301
|
+
* declared route this is a second line and never the first.
|
|
302
|
+
*/
|
|
303
|
+
export declare class CustomerSessionRequiredError extends Error {
|
|
304
|
+
readonly statusCode = 401;
|
|
305
|
+
readonly code: "UNAUTHORIZED";
|
|
306
|
+
constructor();
|
|
307
|
+
}
|
|
308
|
+
/** What {@link organizationPermissionPreHandler} reads off a request. */
|
|
309
|
+
export interface OrganizationPermissionGuardRequest {
|
|
310
|
+
readonly actor: Actor;
|
|
311
|
+
/** The platform's `request.responseLanguage()`, when the error envelope installed it. */
|
|
312
|
+
readonly responseLanguage?: () => Promise<string>;
|
|
313
|
+
}
|
|
314
|
+
export interface OrganizationPermissionGuardOptions {
|
|
315
|
+
/**
|
|
316
|
+
* `'refuse'` (the default): a non-customer actor is refused with
|
|
317
|
+
* {@link CustomerSessionRequiredError}. `'pass'`: a non-customer actor — an
|
|
318
|
+
* anonymous visitor with a guest basket — passes **unjudged** to the route's
|
|
319
|
+
* own handling. Only for routes that admit a guest today (owner ruling PR-4,
|
|
320
|
+
* research R-35); every other guard stays fail-closed.
|
|
321
|
+
*/
|
|
322
|
+
readonly guests?: 'refuse' | 'pass';
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* The route guard every gating module declares (research R-20, R-35):
|
|
326
|
+
*
|
|
327
|
+
* ```ts
|
|
328
|
+
* preHandler: [requireCustomer, organizationPermissionPreHandler(() => permissions, 'carts.create')]
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* A plain function — no Fastify import — so it lives beside the port it calls.
|
|
332
|
+
* `getPort` is a thunk resolved on **every** request, never at registration:
|
|
333
|
+
* a captured port is the third fail-open shape of `module-composition.md` item
|
|
334
|
+
* 4a. A customer actor — impersonation included — is judged by `assert` with
|
|
335
|
+
* the subject built from the actor and the response language; the port's
|
|
336
|
+
* refusal propagates unchanged. Composite actions are two guards, never a
|
|
337
|
+
* combined code; the refusal names the first missing one.
|
|
338
|
+
*/
|
|
339
|
+
export declare function organizationPermissionPreHandler(getPort: () => OrganizationPermissionPort, code: string, options?: OrganizationPermissionGuardOptions): (request: OrganizationPermissionGuardRequest) => Promise<void>;
|
|
340
|
+
//# sourceMappingURL=organization-roles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization-roles.d.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Schema } from './common.js';
|
|
3
|
+
import { ERROR_CODES } from './errors.js';
|
|
4
|
+
/**
|
|
5
|
+
* Organization roles and organization permissions — the buyer's side of
|
|
6
|
+
* "who may do what" (`specs/170-organization-roles/`).
|
|
7
|
+
*
|
|
8
|
+
* An Organization holds two predefined roles — *Administrator* (every present
|
|
9
|
+
* permission, immutable) and *Member* (editable) — and up to fifty custom ones.
|
|
10
|
+
* Each member holds exactly one. A role is a set of **organization permission**
|
|
11
|
+
* codes (`<module>.<action>`), declared by the module whose buyer action each
|
|
12
|
+
* gates in its manifest's `organizationPermissions` field (`./modules.ts`).
|
|
13
|
+
* The operator vocabulary (`<area>:<action>`, `/admin-roles`) is a different
|
|
14
|
+
* one and the two never meet (FR-020, research R-2).
|
|
15
|
+
*
|
|
16
|
+
* Normative: `specs/170-organization-roles/contracts/organization-permission-port.md`
|
|
17
|
+
* and `contracts/storefront-api.md` §2. They replaced the legacy two-value role
|
|
18
|
+
* enum, removed with its columns by the feature's legacy-removal package
|
|
19
|
+
* (research R-23).
|
|
20
|
+
*/
|
|
21
|
+
// --- Kinds and references ----------------------------------------------------
|
|
22
|
+
export const organizationRoleKindSchema = z.enum(['administrator', 'member', 'custom']);
|
|
23
|
+
/**
|
|
24
|
+
* The role as every response shows it (FR-008, FR-056, FR-073). `name` is the
|
|
25
|
+
* translated label for `administrator` / `member` in the response language and
|
|
26
|
+
* the stored name for `custom`.
|
|
27
|
+
*/
|
|
28
|
+
export const organizationRoleRefSchema = z
|
|
29
|
+
.object({ id: uuidSchema, name: z.string(), kind: organizationRoleKindSchema })
|
|
30
|
+
.strict();
|
|
31
|
+
/**
|
|
32
|
+
* One role on the role-management screens, storefront and Admin UI alike
|
|
33
|
+
* (`contracts/storefront-api.md` §2). `permissions` are the stored grants of
|
|
34
|
+
* **present** codes only — a grant of a switched-off module's code is kept
|
|
35
|
+
* server-side and never round-trips through the editor (FR-025); for the
|
|
36
|
+
* administrator it is every present code. `pendingInvitationCount` counts
|
|
37
|
+
* invitations neither accepted, revoked nor expired (FR-010a).
|
|
38
|
+
*/
|
|
39
|
+
export const organizationRoleViewSchema = z.object({
|
|
40
|
+
id: uuidSchema,
|
|
41
|
+
kind: organizationRoleKindSchema,
|
|
42
|
+
name: z.string(),
|
|
43
|
+
description: z.string().nullable(),
|
|
44
|
+
permissions: z.array(z.string()),
|
|
45
|
+
memberCount: z.number().int().min(0),
|
|
46
|
+
pendingInvitationCount: z.number().int().min(0),
|
|
47
|
+
version: z.number().int().min(1),
|
|
48
|
+
updatedAt: isoDateTimeSchema,
|
|
49
|
+
});
|
|
50
|
+
export const organizationRoleListResponseSchema = z.object({ data: z.array(organizationRoleViewSchema) });
|
|
51
|
+
export const organizationRoleResponseSchema = z.object({ data: organizationRoleViewSchema });
|
|
52
|
+
/** One grantable code, translated in the request language (R-31). */
|
|
53
|
+
export const organizationPermissionCatalogueEntrySchema = z.object({
|
|
54
|
+
code: z.string(),
|
|
55
|
+
label: z.string(),
|
|
56
|
+
description: z.string(),
|
|
57
|
+
memberDefault: z.boolean(),
|
|
58
|
+
});
|
|
59
|
+
/** `GET …/permission-catalogue` — present codes only, grouped by declaring module. */
|
|
60
|
+
export const organizationPermissionCatalogueResponseSchema = z.object({
|
|
61
|
+
data: z.object({
|
|
62
|
+
groups: z.array(z.object({
|
|
63
|
+
moduleId: z.string(),
|
|
64
|
+
moduleLabel: z.string(),
|
|
65
|
+
permissions: z.array(organizationPermissionCatalogueEntrySchema),
|
|
66
|
+
})),
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
/** `GET /api/v1/organizations/mine/role` — the member's own role (FR-058). */
|
|
70
|
+
export const organizationOwnRoleResponseSchema = z.object({
|
|
71
|
+
data: z.object({
|
|
72
|
+
role: organizationRoleRefSchema,
|
|
73
|
+
permissions: z.array(z.object({ code: z.string(), label: z.string(), description: z.string() })),
|
|
74
|
+
}),
|
|
75
|
+
});
|
|
76
|
+
/** `DELETE …/roles/:id` — what moved to the replacement role (FR-024). */
|
|
77
|
+
export const deleteOrganizationRoleResponseSchema = z.object({
|
|
78
|
+
data: z.object({
|
|
79
|
+
reassignedMembers: z.number().int().min(0),
|
|
80
|
+
reassignedInvitations: z.number().int().min(0),
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
// --- Requests -----------------------------------------------------------------
|
|
84
|
+
//
|
|
85
|
+
// Every request schema here is `.strict()`, and that is load-bearing (FR-073,
|
|
86
|
+
// research R-24): Zod's default `.object` strips an unknown key silently, so a
|
|
87
|
+
// client still sending the legacy `role` would be answered as though it had
|
|
88
|
+
// asked for the default role. Strict refuses it with `400 VALIDATION_FAILED`
|
|
89
|
+
// naming the key.
|
|
90
|
+
const roleNameSchema = z.string().trim().min(1).max(80);
|
|
91
|
+
const roleDescriptionSchema = z.string().trim().max(500);
|
|
92
|
+
const permissionCodesSchema = z.array(z.string().min(1));
|
|
93
|
+
/** `POST …/roles` — a custom role. */
|
|
94
|
+
export const createOrganizationRoleRequestSchema = z
|
|
95
|
+
.object({
|
|
96
|
+
name: roleNameSchema,
|
|
97
|
+
description: roleDescriptionSchema.optional(),
|
|
98
|
+
permissions: permissionCodesSchema,
|
|
99
|
+
})
|
|
100
|
+
.strict();
|
|
101
|
+
/**
|
|
102
|
+
* `PATCH …/roles/:id`. `expectedVersion` is the version the editor read
|
|
103
|
+
* (`ORGANIZATION_ROLE_STALE` on mismatch, R-29); `name` and `description` are
|
|
104
|
+
* refused for the *Member* role by the Command, not by the schema.
|
|
105
|
+
*/
|
|
106
|
+
export const updateOrganizationRoleRequestSchema = z
|
|
107
|
+
.object({
|
|
108
|
+
expectedVersion: z.number().int().min(1),
|
|
109
|
+
name: roleNameSchema.optional(),
|
|
110
|
+
description: roleDescriptionSchema.nullable().optional(),
|
|
111
|
+
permissions: permissionCodesSchema.optional(),
|
|
112
|
+
})
|
|
113
|
+
.strict();
|
|
114
|
+
/** `DELETE …/roles/:id`. A held role needs a replacement (FR-024). */
|
|
115
|
+
export const deleteOrganizationRoleRequestSchema = z
|
|
116
|
+
.object({
|
|
117
|
+
expectedVersion: z.number().int().min(1),
|
|
118
|
+
replacementRoleId: uuidSchema.optional(),
|
|
119
|
+
})
|
|
120
|
+
.strict();
|
|
121
|
+
/**
|
|
122
|
+
* `PATCH /api/v1/organizations/mine/members/:id/role` — replaces the legacy
|
|
123
|
+
* `changeMemberRoleRequestSchema` (`{ role }`).
|
|
124
|
+
*/
|
|
125
|
+
export const assignMemberRoleRequestSchema = z.object({ roleId: uuidSchema }).strict();
|
|
126
|
+
/**
|
|
127
|
+
* Inviting a member, on the storefront and in the Admin UI
|
|
128
|
+
* (`POST …/mine/invitations`, `POST /api/v1/admin/organizations/:id/members/invite`)
|
|
129
|
+
* — replaces the legacy `inviteMemberRequestSchema` (`{ email, role? }`). An
|
|
130
|
+
* absent `roleId` is the Organization's *Member* role, resolved server-side.
|
|
131
|
+
*/
|
|
132
|
+
export const inviteMemberToRoleRequestSchema = z
|
|
133
|
+
.object({ email: z.string().email(), roleId: uuidSchema.optional() })
|
|
134
|
+
.strict();
|
|
135
|
+
/**
|
|
136
|
+
* Platform admin — `POST /api/v1/admin/organizations/:id/members` (direct
|
|
137
|
+
* create). Replaces the legacy `adminDirectMemberRequestSchema`'s `role?`.
|
|
138
|
+
*/
|
|
139
|
+
export const adminDirectMemberToRoleRequestSchema = z
|
|
140
|
+
.object({
|
|
141
|
+
email: z.string().email(),
|
|
142
|
+
firstName: z.string().min(1).max(120),
|
|
143
|
+
lastName: z.string().min(1).max(120),
|
|
144
|
+
password: z.string().min(12).max(256),
|
|
145
|
+
roleId: uuidSchema.optional(),
|
|
146
|
+
})
|
|
147
|
+
.strict();
|
|
148
|
+
/**
|
|
149
|
+
* Platform admin — `PATCH /api/v1/admin/organizations/:id/members/:customerAccountId/role`.
|
|
150
|
+
* Replaces the legacy `adminPatchMemberRoleRequestSchema` (`{ role, expectedUpdatedAt? }`).
|
|
151
|
+
*/
|
|
152
|
+
export const adminAssignMemberRoleRequestSchema = z
|
|
153
|
+
.object({ roleId: uuidSchema, expectedUpdatedAt: z.string().optional() })
|
|
154
|
+
.strict();
|
|
155
|
+
// --- The route guard -------------------------------------------------------------
|
|
156
|
+
/**
|
|
157
|
+
* The refusal {@link organizationPermissionPreHandler} raises for a request
|
|
158
|
+
* that carries no customer: `401 UNAUTHORIZED`, the answer `requireCustomer`
|
|
159
|
+
* gives.
|
|
160
|
+
*
|
|
161
|
+
* It is a class of this package rather than the platform's `HttpError`
|
|
162
|
+
* because the guard is a plain function here and this package depends on
|
|
163
|
+
* nothing but `zod` — it cannot construct the platform's error. The platform's
|
|
164
|
+
* error envelope renders it exactly as it renders `requireCustomer`'s refusal.
|
|
165
|
+
* The guard is declared **after** `requireCustomer`, so in a correctly
|
|
166
|
+
* declared route this is a second line and never the first.
|
|
167
|
+
*/
|
|
168
|
+
export class CustomerSessionRequiredError extends Error {
|
|
169
|
+
statusCode = 401;
|
|
170
|
+
code = ERROR_CODES.UNAUTHORIZED;
|
|
171
|
+
constructor() {
|
|
172
|
+
super('Customer session required.');
|
|
173
|
+
this.name = 'CustomerSessionRequiredError';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The route guard every gating module declares (research R-20, R-35):
|
|
178
|
+
*
|
|
179
|
+
* ```ts
|
|
180
|
+
* preHandler: [requireCustomer, organizationPermissionPreHandler(() => permissions, 'carts.create')]
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* A plain function — no Fastify import — so it lives beside the port it calls.
|
|
184
|
+
* `getPort` is a thunk resolved on **every** request, never at registration:
|
|
185
|
+
* a captured port is the third fail-open shape of `module-composition.md` item
|
|
186
|
+
* 4a. A customer actor — impersonation included — is judged by `assert` with
|
|
187
|
+
* the subject built from the actor and the response language; the port's
|
|
188
|
+
* refusal propagates unchanged. Composite actions are two guards, never a
|
|
189
|
+
* combined code; the refusal names the first missing one.
|
|
190
|
+
*/
|
|
191
|
+
export function organizationPermissionPreHandler(getPort, code, options = {}) {
|
|
192
|
+
const guests = options.guests ?? 'refuse';
|
|
193
|
+
return async (request) => {
|
|
194
|
+
const actor = request.actor;
|
|
195
|
+
if (actor.kind !== 'customer') {
|
|
196
|
+
if (guests === 'pass')
|
|
197
|
+
return;
|
|
198
|
+
throw new CustomerSessionRequiredError();
|
|
199
|
+
}
|
|
200
|
+
const subject = {
|
|
201
|
+
customerAccountId: actor.customerAccountId,
|
|
202
|
+
// `''` is what the auth hook stamps when no resolver is wired; the port
|
|
203
|
+
// finds no role in it and fails closed.
|
|
204
|
+
organizationId: actor.organizationId ?? '',
|
|
205
|
+
organizationRoleId: actor.organizationRoleId ?? null,
|
|
206
|
+
};
|
|
207
|
+
const language = request.responseLanguage ? await request.responseLanguage() : undefined;
|
|
208
|
+
await getPort().assert(subject, code, language === undefined ? {} : { language });
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=organization-roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization-roles.js","sourceRoot":"","sources":["../src/organization-roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;;;;;GAgBG;AAEH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGxF;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACvC,MAAM,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC;KAC9E,MAAM,EAAE,CAAC;AAGZ;;;;;;;GAOG;AACH,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