@endora-commerce/mod-organizations 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 +62 -0
- package/dist/admin/components/OrganizationSalesRepsTab.d.ts +27 -0
- package/dist/admin/components/OrganizationSalesRepsTab.d.ts.map +1 -0
- package/dist/admin/components/OrganizationSalesRepsTab.js +170 -0
- package/dist/admin/components/OrganizationSalesRepsTab.js.map +1 -0
- package/dist/admin/index.d.ts +30 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +59 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/pages/OrganizationDetail.d.ts +9 -0
- package/dist/admin/pages/OrganizationDetail.d.ts.map +1 -0
- package/dist/admin/pages/OrganizationDetail.js +247 -0
- package/dist/admin/pages/OrganizationDetail.js.map +1 -0
- package/dist/admin/pages/OrganizationsList.d.ts +9 -0
- package/dist/admin/pages/OrganizationsList.d.ts.map +1 -0
- package/dist/admin/pages/OrganizationsList.js +73 -0
- package/dist/admin/pages/OrganizationsList.js.map +1 -0
- package/dist/admin/panels/ApplicablePriceListsPanel.d.ts +12 -0
- package/dist/admin/panels/ApplicablePriceListsPanel.d.ts.map +1 -0
- package/dist/admin/panels/ApplicablePriceListsPanel.js +49 -0
- package/dist/admin/panels/ApplicablePriceListsPanel.js.map +1 -0
- package/dist/admin/panels/FulfilmentStrategyPanel.d.ts +16 -0
- package/dist/admin/panels/FulfilmentStrategyPanel.d.ts.map +1 -0
- package/dist/admin/panels/FulfilmentStrategyPanel.js +29 -0
- package/dist/admin/panels/FulfilmentStrategyPanel.js.map +1 -0
- package/dist/admin/panels/HierarchyPanel.d.ts +15 -0
- package/dist/admin/panels/HierarchyPanel.d.ts.map +1 -0
- package/dist/admin/panels/HierarchyPanel.js +65 -0
- package/dist/admin/panels/HierarchyPanel.js.map +1 -0
- package/dist/admin/panels/ModerationActionsPanel.d.ts +28 -0
- package/dist/admin/panels/ModerationActionsPanel.d.ts.map +1 -0
- package/dist/admin/panels/ModerationActionsPanel.js +111 -0
- package/dist/admin/panels/ModerationActionsPanel.js.map +1 -0
- package/dist/admin/panels/RestrictionsPanel.d.ts +24 -0
- package/dist/admin/panels/RestrictionsPanel.d.ts.map +1 -0
- package/dist/admin/panels/RestrictionsPanel.js +121 -0
- package/dist/admin/panels/RestrictionsPanel.js.map +1 -0
- package/dist/admin/panels/VatValidationPanel.d.ts +28 -0
- package/dist/admin/panels/VatValidationPanel.d.ts.map +1 -0
- package/dist/admin/panels/VatValidationPanel.js +79 -0
- package/dist/admin/panels/VatValidationPanel.js.map +1 -0
- package/dist/backend/commands/move.command.d.ts +11 -0
- package/dist/backend/commands/move.command.d.ts.map +1 -0
- package/dist/backend/commands/move.command.js +11 -0
- package/dist/backend/commands/move.command.js.map +1 -0
- package/dist/backend/commands/set-cart-approval-policy.command.d.ts +31 -0
- package/dist/backend/commands/set-cart-approval-policy.command.d.ts.map +1 -0
- package/dist/backend/commands/set-cart-approval-policy.command.js +56 -0
- package/dist/backend/commands/set-cart-approval-policy.command.js.map +1 -0
- package/dist/backend/commands/set-credit-mode.command.d.ts +16 -0
- package/dist/backend/commands/set-credit-mode.command.d.ts.map +1 -0
- package/dist/backend/commands/set-credit-mode.command.js +25 -0
- package/dist/backend/commands/set-credit-mode.command.js.map +1 -0
- package/dist/backend/commands/set-parent.command.d.ts +26 -0
- package/dist/backend/commands/set-parent.command.d.ts.map +1 -0
- package/dist/backend/commands/set-parent.command.js +51 -0
- package/dist/backend/commands/set-parent.command.js.map +1 -0
- package/dist/backend/demo/reset.d.ts +20 -0
- package/dist/backend/demo/reset.d.ts.map +1 -0
- package/dist/backend/demo/reset.js +11 -0
- package/dist/backend/demo/reset.js.map +1 -0
- package/dist/backend/demo/rows.d.ts +44 -0
- package/dist/backend/demo/rows.d.ts.map +1 -0
- package/dist/backend/demo/rows.js +44 -0
- package/dist/backend/demo/rows.js.map +1 -0
- package/dist/backend/demo/seed.d.ts +20 -0
- package/dist/backend/demo/seed.d.ts.map +1 -0
- package/dist/backend/demo/seed.js +28 -0
- package/dist/backend/demo/seed.js.map +1 -0
- package/dist/backend/email-templates/invitation.d.ts +23 -0
- package/dist/backend/email-templates/invitation.d.ts.map +1 -0
- package/dist/backend/email-templates/invitation.js +35 -0
- package/dist/backend/email-templates/invitation.js.map +1 -0
- package/dist/backend/email-templates/transactional-defaults.d.ts +54 -0
- package/dist/backend/email-templates/transactional-defaults.d.ts.map +1 -0
- package/dist/backend/email-templates/transactional-defaults.js +242 -0
- package/dist/backend/email-templates/transactional-defaults.js.map +1 -0
- package/dist/backend/email-templates/verification.d.ts +14 -0
- package/dist/backend/email-templates/verification.d.ts.map +1 -0
- package/dist/backend/email-templates/verification.js +34 -0
- package/dist/backend/email-templates/verification.js.map +1 -0
- package/dist/backend/entities/email-verification-token.entity.d.ts +17 -0
- package/dist/backend/entities/email-verification-token.entity.d.ts.map +1 -0
- package/dist/backend/entities/email-verification-token.entity.js +60 -0
- package/dist/backend/entities/email-verification-token.entity.js.map +1 -0
- package/dist/backend/entities/organization-delivery-method-link.entity.d.ts +14 -0
- package/dist/backend/entities/organization-delivery-method-link.entity.d.ts.map +1 -0
- package/dist/backend/entities/organization-delivery-method-link.entity.js +41 -0
- package/dist/backend/entities/organization-delivery-method-link.entity.js.map +1 -0
- package/dist/backend/entities/organization-invitation.entity.d.ts +21 -0
- package/dist/backend/entities/organization-invitation.entity.d.ts.map +1 -0
- package/dist/backend/entities/organization-invitation.entity.js +85 -0
- package/dist/backend/entities/organization-invitation.entity.js.map +1 -0
- package/dist/backend/entities/organization-payment-method-link.entity.d.ts +14 -0
- package/dist/backend/entities/organization-payment-method-link.entity.d.ts.map +1 -0
- package/dist/backend/entities/organization-payment-method-link.entity.js +41 -0
- package/dist/backend/entities/organization-payment-method-link.entity.js.map +1 -0
- package/dist/backend/entities/organization-sales-rep-assignment.entity.d.ts +17 -0
- package/dist/backend/entities/organization-sales-rep-assignment.entity.d.ts.map +1 -0
- package/dist/backend/entities/organization-sales-rep-assignment.entity.js +56 -0
- package/dist/backend/entities/organization-sales-rep-assignment.entity.js.map +1 -0
- package/dist/backend/entities/organization-tax-id-validation.entity.d.ts +29 -0
- package/dist/backend/entities/organization-tax-id-validation.entity.d.ts.map +1 -0
- package/dist/backend/entities/organization-tax-id-validation.entity.js +78 -0
- package/dist/backend/entities/organization-tax-id-validation.entity.js.map +1 -0
- package/dist/backend/entities/organization-warehouse-link.entity.d.ts +15 -0
- package/dist/backend/entities/organization-warehouse-link.entity.d.ts.map +1 -0
- package/dist/backend/entities/organization-warehouse-link.entity.js +42 -0
- package/dist/backend/entities/organization-warehouse-link.entity.js.map +1 -0
- package/dist/backend/entities/organization.entity.d.ts +125 -0
- package/dist/backend/entities/organization.entity.d.ts.map +1 -0
- package/dist/backend/entities/organization.entity.js +282 -0
- package/dist/backend/entities/organization.entity.js.map +1 -0
- package/dist/backend/index.d.ts +250 -0
- package/dist/backend/index.d.ts.map +1 -0
- package/dist/backend/index.js +506 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/integrations/ministerstwo-finansow-client.d.ts +22 -0
- package/dist/backend/integrations/ministerstwo-finansow-client.d.ts.map +1 -0
- package/dist/backend/integrations/ministerstwo-finansow-client.js +172 -0
- package/dist/backend/integrations/ministerstwo-finansow-client.js.map +1 -0
- package/dist/backend/integrations/vies-client.d.ts +18 -0
- package/dist/backend/integrations/vies-client.d.ts.map +1 -0
- package/dist/backend/integrations/vies-client.js +133 -0
- package/dist/backend/integrations/vies-client.js.map +1 -0
- package/dist/backend/plugin.d.ts +126 -0
- package/dist/backend/plugin.d.ts.map +1 -0
- package/dist/backend/plugin.js +139 -0
- package/dist/backend/plugin.js.map +1 -0
- package/dist/backend/routes.admin.d.ts +66 -0
- package/dist/backend/routes.admin.d.ts.map +1 -0
- package/dist/backend/routes.admin.js +711 -0
- package/dist/backend/routes.admin.js.map +1 -0
- package/dist/backend/routes.customer.d.ts +33 -0
- package/dist/backend/routes.customer.d.ts.map +1 -0
- package/dist/backend/routes.customer.js +139 -0
- package/dist/backend/routes.customer.js.map +1 -0
- package/dist/backend/routes.members.d.ts +31 -0
- package/dist/backend/routes.members.d.ts.map +1 -0
- package/dist/backend/routes.members.js +109 -0
- package/dist/backend/routes.members.js.map +1 -0
- package/dist/backend/routes.public.d.ts +49 -0
- package/dist/backend/routes.public.d.ts.map +1 -0
- package/dist/backend/routes.public.js +220 -0
- package/dist/backend/routes.public.js.map +1 -0
- package/dist/backend/routes.sales-reps.d.ts +46 -0
- package/dist/backend/routes.sales-reps.d.ts.map +1 -0
- package/dist/backend/routes.sales-reps.js +114 -0
- package/dist/backend/routes.sales-reps.js.map +1 -0
- package/dist/backend/routes.storefront.d.ts +25 -0
- package/dist/backend/routes.storefront.d.ts.map +1 -0
- package/dist/backend/routes.storefront.js +65 -0
- package/dist/backend/routes.storefront.js.map +1 -0
- package/dist/backend/schemas/organization.d.ts +59 -0
- package/dist/backend/schemas/organization.d.ts.map +1 -0
- package/dist/backend/schemas/organization.js +55 -0
- package/dist/backend/schemas/organization.js.map +1 -0
- package/dist/backend/schemas/settings.d.ts +30 -0
- package/dist/backend/schemas/settings.d.ts.map +1 -0
- package/dist/backend/schemas/settings.js +35 -0
- package/dist/backend/schemas/settings.js.map +1 -0
- package/dist/backend/services/email-verification-service.d.ts +45 -0
- package/dist/backend/services/email-verification-service.d.ts.map +1 -0
- package/dist/backend/services/email-verification-service.js +95 -0
- package/dist/backend/services/email-verification-service.js.map +1 -0
- package/dist/backend/services/invitation-service.d.ts +85 -0
- package/dist/backend/services/invitation-service.d.ts.map +1 -0
- package/dist/backend/services/invitation-service.js +266 -0
- package/dist/backend/services/invitation-service.js.map +1 -0
- package/dist/backend/services/normalize-name.d.ts +14 -0
- package/dist/backend/services/normalize-name.d.ts.map +1 -0
- package/dist/backend/services/normalize-name.js +14 -0
- package/dist/backend/services/normalize-name.js.map +1 -0
- package/dist/backend/services/org-registration-notifier.d.ts +36 -0
- package/dist/backend/services/org-registration-notifier.d.ts.map +1 -0
- package/dist/backend/services/org-registration-notifier.js +109 -0
- package/dist/backend/services/org-registration-notifier.js.map +1 -0
- package/dist/backend/services/org-template-email.d.ts +18 -0
- package/dist/backend/services/org-template-email.d.ts.map +1 -0
- package/dist/backend/services/org-template-email.js +16 -0
- package/dist/backend/services/org-template-email.js.map +1 -0
- package/dist/backend/services/organization-context-service.d.ts +52 -0
- package/dist/backend/services/organization-context-service.d.ts.map +1 -0
- package/dist/backend/services/organization-context-service.js +70 -0
- package/dist/backend/services/organization-context-service.js.map +1 -0
- package/dist/backend/services/organization-country-reference.d.ts +11 -0
- package/dist/backend/services/organization-country-reference.d.ts.map +1 -0
- package/dist/backend/services/organization-country-reference.js +24 -0
- package/dist/backend/services/organization-country-reference.js.map +1 -0
- package/dist/backend/services/organization-details-port.d.ts +33 -0
- package/dist/backend/services/organization-details-port.d.ts.map +1 -0
- package/dist/backend/services/organization-details-port.js +95 -0
- package/dist/backend/services/organization-details-port.js.map +1 -0
- package/dist/backend/services/organization-effective-pricelists-service.d.ts +50 -0
- package/dist/backend/services/organization-effective-pricelists-service.d.ts.map +1 -0
- package/dist/backend/services/organization-effective-pricelists-service.js +68 -0
- package/dist/backend/services/organization-effective-pricelists-service.js.map +1 -0
- package/dist/backend/services/organization-inheritance-service.d.ts +73 -0
- package/dist/backend/services/organization-inheritance-service.d.ts.map +1 -0
- package/dist/backend/services/organization-inheritance-service.js +63 -0
- package/dist/backend/services/organization-inheritance-service.js.map +1 -0
- package/dist/backend/services/organization-moderation-service.d.ts +124 -0
- package/dist/backend/services/organization-moderation-service.d.ts.map +1 -0
- package/dist/backend/services/organization-moderation-service.js +337 -0
- package/dist/backend/services/organization-moderation-service.js.map +1 -0
- package/dist/backend/services/organization-restriction-service.d.ts +70 -0
- package/dist/backend/services/organization-restriction-service.d.ts.map +1 -0
- package/dist/backend/services/organization-restriction-service.js +210 -0
- package/dist/backend/services/organization-restriction-service.js.map +1 -0
- package/dist/backend/services/organization-tax-id-validation-service.d.ts +59 -0
- package/dist/backend/services/organization-tax-id-validation-service.d.ts.map +1 -0
- package/dist/backend/services/organization-tax-id-validation-service.js +115 -0
- package/dist/backend/services/organization-tax-id-validation-service.js.map +1 -0
- package/dist/backend/services/organization-tree-service.d.ts +102 -0
- package/dist/backend/services/organization-tree-service.d.ts.map +1 -0
- package/dist/backend/services/organization-tree-service.js +184 -0
- package/dist/backend/services/organization-tree-service.js.map +1 -0
- package/dist/backend/services/personal-organization-service.d.ts +130 -0
- package/dist/backend/services/personal-organization-service.d.ts.map +1 -0
- package/dist/backend/services/personal-organization-service.js +207 -0
- package/dist/backend/services/personal-organization-service.js.map +1 -0
- package/dist/backend/services/registration-service.d.ts +80 -0
- package/dist/backend/services/registration-service.d.ts.map +1 -0
- package/dist/backend/services/registration-service.js +126 -0
- package/dist/backend/services/registration-service.js.map +1 -0
- package/dist/backend/services/sales-rep-assignment-service.d.ts +89 -0
- package/dist/backend/services/sales-rep-assignment-service.d.ts.map +1 -0
- package/dist/backend/services/sales-rep-assignment-service.js +176 -0
- package/dist/backend/services/sales-rep-assignment-service.js.map +1 -0
- package/dist/backend/services/vat-validator-port.d.ts +20 -0
- package/dist/backend/services/vat-validator-port.d.ts.map +1 -0
- package/dist/backend/services/vat-validator-port.js +2 -0
- package/dist/backend/services/vat-validator-port.js.map +1 -0
- package/dist/manifest.d.ts +176 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +503 -0
- package/dist/manifest.js.map +1 -0
- package/dist/migrations/20260424T205317_organizations_init.d.ts +13 -0
- package/dist/migrations/20260424T205317_organizations_init.d.ts.map +1 -0
- package/dist/migrations/20260424T205317_organizations_init.js +100 -0
- package/dist/migrations/20260424T205317_organizations_init.js.map +1 -0
- package/dist/migrations/20260425T051700_organizations_invitations_init.d.ts +13 -0
- package/dist/migrations/20260425T051700_organizations_invitations_init.d.ts.map +1 -0
- package/dist/migrations/20260425T051700_organizations_invitations_init.js +39 -0
- package/dist/migrations/20260425T051700_organizations_invitations_init.js.map +1 -0
- package/dist/migrations/20260611T140349_organizations_consolidation.d.ts +35 -0
- package/dist/migrations/20260611T140349_organizations_consolidation.d.ts.map +1 -0
- package/dist/migrations/20260611T140349_organizations_consolidation.js +180 -0
- package/dist/migrations/20260611T140349_organizations_consolidation.js.map +1 -0
- package/dist/migrations/20260611T140358_organizations_org_order_confirmation_emails.d.ts +10 -0
- package/dist/migrations/20260611T140358_organizations_org_order_confirmation_emails.d.ts.map +1 -0
- package/dist/migrations/20260611T140358_organizations_org_order_confirmation_emails.js +14 -0
- package/dist/migrations/20260611T140358_organizations_org_order_confirmation_emails.js.map +1 -0
- package/dist/migrations/20260611T140402_organizations_org_fulfilment_strategy.d.ts +14 -0
- package/dist/migrations/20260611T140402_organizations_org_fulfilment_strategy.d.ts.map +1 -0
- package/dist/migrations/20260611T140402_organizations_org_fulfilment_strategy.js +20 -0
- package/dist/migrations/20260611T140402_organizations_org_fulfilment_strategy.js.map +1 -0
- package/dist/migrations/20260717T151403_organizations_personal_organizations.d.ts +24 -0
- package/dist/migrations/20260717T151403_organizations_personal_organizations.d.ts.map +1 -0
- package/dist/migrations/20260717T151403_organizations_personal_organizations.js +63 -0
- package/dist/migrations/20260717T151403_organizations_personal_organizations.js.map +1 -0
- package/dist/migrations/20260718T200340_organizations_organization_custom_field_values.d.ts +12 -0
- package/dist/migrations/20260718T200340_organizations_organization_custom_field_values.d.ts.map +1 -0
- package/dist/migrations/20260718T200340_organizations_organization_custom_field_values.js +16 -0
- package/dist/migrations/20260718T200340_organizations_organization_custom_field_values.js.map +1 -0
- package/dist/migrations/20260720T044254_organizations_org_hierarchy.d.ts +23 -0
- package/dist/migrations/20260720T044254_organizations_org_hierarchy.d.ts.map +1 -0
- package/dist/migrations/20260720T044254_organizations_org_hierarchy.js +37 -0
- package/dist/migrations/20260720T044254_organizations_org_hierarchy.js.map +1 -0
- package/dist/migrations/20260912T094646_organizations_sales_channel_organizations.d.ts +27 -0
- package/dist/migrations/20260912T094646_organizations_sales_channel_organizations.d.ts.map +1 -0
- package/dist/migrations/20260912T094646_organizations_sales_channel_organizations.js +44 -0
- package/dist/migrations/20260912T094646_organizations_sales_channel_organizations.js.map +1 -0
- package/dist/migrations/index.d.ts +35 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +45 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/ports/index.d.ts +53 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +2 -0
- package/dist/ports/index.js.map +1 -0
- package/docs/organization-hierarchy.md +117 -0
- package/docs/organizations.md +312 -0
- package/i18n/en.json +17 -0
- package/i18n/pl.json +17 -0
- package/package.json +107 -0
- package/tailwind.css +14 -0
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import { lazyPort } from '@endora-commerce/platform/kernel';
|
|
2
|
+
import { ORGANIZATIONS_SETTING_CODES } from '../manifest.js';
|
|
3
|
+
import { creditInheritanceModeSchema, moderationModeSchema, notificationRecipientsSchema, } from './schemas/settings.js';
|
|
4
|
+
import { OrganizationContextService } from './services/organization-context-service.js';
|
|
5
|
+
import { OrganizationDetailsService, toOrganizationRecord, } from './services/organization-details-port.js';
|
|
6
|
+
import { PersonalOrganizationService } from './services/personal-organization-service.js';
|
|
7
|
+
import { OrganizationRestrictionService } from './services/organization-restriction-service.js';
|
|
8
|
+
import { OrganizationTreeService } from './services/organization-tree-service.js';
|
|
9
|
+
import { OrganizationInheritanceService } from './services/organization-inheritance-service.js';
|
|
10
|
+
import { OrganizationModerationService } from './services/organization-moderation-service.js';
|
|
11
|
+
import { OrganizationEffectivePriceListsService } from './services/organization-effective-pricelists-service.js';
|
|
12
|
+
import { OrganizationTaxIdValidationService } from './services/organization-tax-id-validation-service.js';
|
|
13
|
+
import { SalesRepAssignmentService, } from './services/sales-rep-assignment-service.js';
|
|
14
|
+
import { OrgRegistrationNotifier } from './services/org-registration-notifier.js';
|
|
15
|
+
import { makeSetCartApprovalPolicyCommand } from './commands/set-cart-approval-policy.command.js';
|
|
16
|
+
import { Organization } from './entities/organization.entity.js';
|
|
17
|
+
import { ViesClient } from './integrations/vies-client.js';
|
|
18
|
+
import { MinisterstwoFinansowClient } from './integrations/ministerstwo-finansow-client.js';
|
|
19
|
+
import { organizationsModule } from './plugin.js';
|
|
20
|
+
import { registerOrganizationsSalesRepRoutes } from './routes.sales-reps.js';
|
|
21
|
+
import { EMAIL_VERIFICATION_DEFAULT, NEW_ORG_REGISTRATION_DEFAULT, ORGANIZATION_APPROVED_DEFAULT, ORGANIZATION_INVITATION_DEFAULT, ORGANIZATION_REJECTED_DEFAULT, } from './email-templates/transactional-defaults.js';
|
|
22
|
+
import { registerOrganizationCountryReferences } from './services/organization-country-reference.js';
|
|
23
|
+
import { EmailVerificationToken } from './entities/email-verification-token.entity.js';
|
|
24
|
+
import { OrganizationDeliveryMethodLink } from './entities/organization-delivery-method-link.entity.js';
|
|
25
|
+
import { OrganizationInvitation } from './entities/organization-invitation.entity.js';
|
|
26
|
+
import { OrganizationPaymentMethodLink } from './entities/organization-payment-method-link.entity.js';
|
|
27
|
+
import { OrganizationSalesRepAssignment } from './entities/organization-sales-rep-assignment.entity.js';
|
|
28
|
+
import { OrganizationTaxIdValidation } from './entities/organization-tax-id-validation.entity.js';
|
|
29
|
+
import { OrganizationWarehouseLink } from './entities/organization-warehouse-link.entity.js';
|
|
30
|
+
export function registerModule(ctx) {
|
|
31
|
+
/**
|
|
32
|
+
* Feature 120 (FR-015) — the sales-channel membership bridge this module owns.
|
|
33
|
+
*
|
|
34
|
+
* The platform used to hold a map **total** over
|
|
35
|
+
* `ChannelMemberEntityTypeSchema`, naming this module's bridge table from
|
|
36
|
+
* inside the kernel. That is D-52/D-53's prohibition expressed in a contract
|
|
37
|
+
* instead of an import, and it meant a membership call for 'organization' on an
|
|
38
|
+
* instance that never installed this module executed SQL against a relation
|
|
39
|
+
* that is not there (D-226). The module whose migration creates the table is
|
|
40
|
+
* the one that says where it is; a member nothing registers now refuses at
|
|
41
|
+
* the call instead.
|
|
42
|
+
*
|
|
43
|
+
* A **contribution** hook and deliberately **unprobed** (D-62/D-68): a
|
|
44
|
+
* registration is an inert statement about the schema rather than a
|
|
45
|
+
* capability, the rows outlive an operator switching this module off, and
|
|
46
|
+
* probing would make a runtime activation flip require a restart. It is
|
|
47
|
+
* declared first in this module so any later hook of its own that binds a
|
|
48
|
+
* membership finds the bridge already there.
|
|
49
|
+
*/
|
|
50
|
+
ctx.onBoot(() => {
|
|
51
|
+
const { salesChannelBridgeRegistry } = ctx.cradle();
|
|
52
|
+
for (const bridge of salesChannelBridges)
|
|
53
|
+
salesChannelBridgeRegistry.register(bridge);
|
|
54
|
+
});
|
|
55
|
+
const cradle = () => ctx.cradle();
|
|
56
|
+
/**
|
|
57
|
+
* All three `organizations.*` settings are **platform-wide**: whether a new
|
|
58
|
+
* Organization needs manual moderation, who is notified when one registers,
|
|
59
|
+
* and how a parent's credit limit is inherited are properties of the
|
|
60
|
+
* business, not of a storefront. So the read passes `null` (feature 072,
|
|
61
|
+
* D-41 case c).
|
|
62
|
+
*
|
|
63
|
+
* It used to pass `organizationsSettingsChannelId`, a root-supplied name
|
|
64
|
+
* carrying `ORGANIZATIONS_SETTINGS_CHANNEL_ID` — an undocumented env var
|
|
65
|
+
* whose default was the string `'default'`, a channel **code** against a
|
|
66
|
+
* `uuid` column. D-41 deleted the name rather than fixing its value, because
|
|
67
|
+
* a DI name that carries a sentinel is one no static check can see.
|
|
68
|
+
*
|
|
69
|
+
* The reads degrade to the manifest's own default rather than failing a
|
|
70
|
+
* registration; the `manual` fallback in particular is deliberate, so a
|
|
71
|
+
* brand-new install never grants an unverified Organization transaction
|
|
72
|
+
* rights by accident.
|
|
73
|
+
*/
|
|
74
|
+
const readSetting = async (code, schema, fallback) => {
|
|
75
|
+
try {
|
|
76
|
+
return (await cradle().settingsReadPort.get(code, null, schema));
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return fallback;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The VAT-ID validator, published — feature 076, D-86.
|
|
84
|
+
*
|
|
85
|
+
* `customers` used to build its own `new ViesClient()` from an import of this
|
|
86
|
+
* module's `integrations/` directory, over a contribution point of its own.
|
|
87
|
+
* Its comment claimed the harness got "the same fake the organizations wiring
|
|
88
|
+
* gets… that coupling is now structural rather than a note" while the
|
|
89
|
+
* mechanism was two roots constructing two objects. Resolving one port makes
|
|
90
|
+
* it structural for real, and it is one contribution point fewer for a root
|
|
91
|
+
* to keep in step.
|
|
92
|
+
*
|
|
93
|
+
* It hands out whatever `organizationsTaxIdClients.vies` is, which is the
|
|
94
|
+
* contribution point the harness already overrides — so the fake reaches both
|
|
95
|
+
* consumers by construction rather than by two roots agreeing to pass it.
|
|
96
|
+
*
|
|
97
|
+
* The gate is unreachable, and that is fine: this module is
|
|
98
|
+
* `nonDeactivatable`, so the port reads `OWNER LOCKED`. The ruling fixes the
|
|
99
|
+
* ownership statement; the gate is not what was wrong.
|
|
100
|
+
*/
|
|
101
|
+
ctx.di.providePort('vatValidatorPort', ctx
|
|
102
|
+
.asFunction(({ organizationsTaxIdClients }) => organizationsTaxIdClients.vies)
|
|
103
|
+
.singleton());
|
|
104
|
+
ctx.di.register({
|
|
105
|
+
// Production contributes nothing and reaches the real registries.
|
|
106
|
+
organizationsTaxIdClients: ctx
|
|
107
|
+
.asFunction(() => ({
|
|
108
|
+
vies: new ViesClient(),
|
|
109
|
+
mfPl: new MinisterstwoFinansowClient(),
|
|
110
|
+
}))
|
|
111
|
+
.singleton(),
|
|
112
|
+
// Default: a login does nothing beyond logging in.
|
|
113
|
+
organizationsLoginHook: ctx
|
|
114
|
+
.asFunction(() => async () => ({}))
|
|
115
|
+
.singleton(),
|
|
116
|
+
organizationModerationService: ctx
|
|
117
|
+
.asFunction(({ emFactory, auditLogService, eventBus }) => new OrganizationModerationService(emFactory, auditLogService, eventBus,
|
|
118
|
+
// Every one of these three is another module's gated service and is
|
|
119
|
+
// *stored* by the constructor, so a plain cradle read would freeze
|
|
120
|
+
// a transient gate inside a singleton — it would keep answering
|
|
121
|
+
// after `email` was switched off, and Awilix's strict mode refuses
|
|
122
|
+
// it outright.
|
|
123
|
+
lazyPort(ctx, 'emailMailer'),
|
|
124
|
+
// Feature 075 (D-87) — who the moderation mail goes to. The
|
|
125
|
+
// recipient lookup was raw SQL against `customer_accounts`' table,
|
|
126
|
+
// which names no import specifier and so crossed the boundary
|
|
127
|
+
// invisibly to the import predicate.
|
|
128
|
+
lazyPort(ctx, 'customerAccountReadPort'), () => readSetting(ORGANIZATIONS_SETTING_CODES.MODERATION_MODE, moderationModeSchema, 'manual'),
|
|
129
|
+
// Where the approval and rejection messages get their language
|
|
130
|
+
// (`specs/093-backend-delivered-prose/` § the seam-B carve-out).
|
|
131
|
+
// Until this argument existed both were composed as hard-coded
|
|
132
|
+
// Polish prose and handed to `emailMailer` directly, so a buyer on
|
|
133
|
+
// an English sales channel received Polish unconditionally.
|
|
134
|
+
lazyPort(ctx, 'templateEmailPort')))
|
|
135
|
+
.singleton(),
|
|
136
|
+
organizationRegistrationNotifier: ctx
|
|
137
|
+
.asFunction(({ emFactory }) => new OrgRegistrationNotifier({
|
|
138
|
+
emFactory,
|
|
139
|
+
adminNotificationService: lazyPort(ctx, 'adminNotificationRecordPort'),
|
|
140
|
+
mailer: lazyPort(ctx, 'emailMailer'),
|
|
141
|
+
resolveRecipients: () => readSetting(ORGANIZATIONS_SETTING_CODES.NEW_REGISTRATION_RECIPIENTS, notificationRecipientsSchema, []),
|
|
142
|
+
templateEmail: lazyPort(ctx, 'templateEmailPort'),
|
|
143
|
+
}))
|
|
144
|
+
.singleton(),
|
|
145
|
+
organizations: ctx
|
|
146
|
+
.asFunction(({ emFactory, eventBus, commandBus, auditLogService }) => organizationsModule({
|
|
147
|
+
emFactory,
|
|
148
|
+
eventBus,
|
|
149
|
+
commandBus,
|
|
150
|
+
auditLogService,
|
|
151
|
+
// Feature 075, Phase C (issue #195) — the record-mapping adapter,
|
|
152
|
+
// not the `addressService` class registration beside it: `Address`
|
|
153
|
+
// is structurally assignable to `AddressRecord`, so the old name
|
|
154
|
+
// compiled while the entity crossed. Same reasoning as the two
|
|
155
|
+
// `customer_accounts` ports below.
|
|
156
|
+
addressService: lazyPort(ctx, 'addressServicePort'),
|
|
157
|
+
// Every one of these is another module's **gated** port, and this
|
|
158
|
+
// registration is a singleton: reading one here would put a
|
|
159
|
+
// transient gate inside a longer-lived object, which Awilix's
|
|
160
|
+
// strict mode refuses outright — `Dependency has a shorter lifetime
|
|
161
|
+
// than its ancestor`. `lazyPort` resolves per method call, so the
|
|
162
|
+
// gate stays live and the lifetimes stay honest.
|
|
163
|
+
// Feature 075, Phase C — `customerAuthPort` / `customerRolePort`
|
|
164
|
+
// rather than the two same-named services beside them. Those hand
|
|
165
|
+
// back `customer_accounts`' entity; these hand back the published
|
|
166
|
+
// record, which is what stops the entity crossing.
|
|
167
|
+
customerAuthService: lazyPort(ctx, 'customerAuthPort'),
|
|
168
|
+
passwordResetService: lazyPort(ctx, 'passwordResetService'),
|
|
169
|
+
customerRoleService: lazyPort(ctx, 'customerRolePort'),
|
|
170
|
+
customerAccountRead: lazyPort(ctx, 'customerAccountReadPort'),
|
|
171
|
+
customerAccountWrite: lazyPort(ctx, 'customerAccountMemberWritePort'),
|
|
172
|
+
customFieldValues: lazyPort(ctx, 'customFieldValueService'),
|
|
173
|
+
// Passed for the first time by any composition — see the note above
|
|
174
|
+
// on `validateCountry`.
|
|
175
|
+
dictionaryValidator: lazyPort(ctx, 'dictionaryValidator'),
|
|
176
|
+
mailer: lazyPort(ctx, 'emailMailer'),
|
|
177
|
+
templateEmail: lazyPort(ctx, 'templateEmailPort'),
|
|
178
|
+
storefrontBaseUrl: cradle().storefrontBaseUrl,
|
|
179
|
+
exposeTestProbe: cradle().organizationsExposeTestProbe,
|
|
180
|
+
requireAdmin: (permission) => async (req, reply) => cradle().requireAdmin(permission)(req, reply),
|
|
181
|
+
requireAdminAny: (permissions) => async (req, reply) => cradle().requireAdminAny(permissions)(req, reply),
|
|
182
|
+
requireCustomer: (req, reply) => cradle().requireCustomer(req, reply),
|
|
183
|
+
resolveCustomerContext: (req) => cradle().customerContextResolver(req),
|
|
184
|
+
onLogin: (input) => cradle().organizationsLoginHook(input),
|
|
185
|
+
// Registered unconditionally. Before T138 each of these four was an
|
|
186
|
+
// optional argument, and an omitted one silently removed a route
|
|
187
|
+
// surface: no `restrictionService` meant no storefront preflight,
|
|
188
|
+
// no `moderationService` meant approve/reject/block did not exist.
|
|
189
|
+
// Which endpoints a deployment serves is not a function of which
|
|
190
|
+
// arguments a root remembered to pass.
|
|
191
|
+
moderationService: cradle().organizationModerationService,
|
|
192
|
+
restrictionService: lazyPort(ctx, 'organizationRestrictionPort'),
|
|
193
|
+
effectivePriceListsService: new OrganizationEffectivePriceListsService({
|
|
194
|
+
emFactory,
|
|
195
|
+
// D-48 — this was `?? 'default'`, a channel *code* landing in
|
|
196
|
+
// `ResolutionContext.salesChannelId`, which the price-list
|
|
197
|
+
// evaluator compares against channel **uuids**. On the fallback
|
|
198
|
+
// branch every `salesChannel` criterion therefore evaluated false
|
|
199
|
+
// and the panel reported channel-scoped lists as not applying.
|
|
200
|
+
// The branch cannot be taken, so the fallback goes with it.
|
|
201
|
+
resolveDefaultSalesChannelId: async () => (await cradle().salesChannelResolutionPort.getSystemDefault()).id,
|
|
202
|
+
// Feature 075, Phase C — `price_lists`' own `listActive`, where
|
|
203
|
+
// this service used to run `em.find(PriceList, …)` against that
|
|
204
|
+
// module's table and spell the status filter itself.
|
|
205
|
+
priceListRead: lazyPort(ctx, 'priceListReadPort'),
|
|
206
|
+
}),
|
|
207
|
+
taxIdValidationService: new OrganizationTaxIdValidationService({
|
|
208
|
+
emFactory,
|
|
209
|
+
auditLog: auditLogService,
|
|
210
|
+
...cradle().organizationsTaxIdClients,
|
|
211
|
+
}),
|
|
212
|
+
}))
|
|
213
|
+
.singleton(),
|
|
214
|
+
});
|
|
215
|
+
// The four gated ports this module owns. Every one of them was a
|
|
216
|
+
// `HOST_REGISTERED_PORTS` entry — a table row asserting an owner that never
|
|
217
|
+
// registered anything. `organizationReadPort` is the starkest: the kernel has
|
|
218
|
+
// declared its shape since D-32 and no composition ever provided it, so the
|
|
219
|
+
// name existed only in a test fixture.
|
|
220
|
+
ctx.di.providePort('organizationReadPort', ctx
|
|
221
|
+
.asFunction(({ emFactory }) => new OrganizationContextService(emFactory))
|
|
222
|
+
.singleton());
|
|
223
|
+
/**
|
|
224
|
+
* Feature 075, Phase P — the row-level read model.
|
|
225
|
+
*
|
|
226
|
+
* A **second** port beside `organizationReadPort` above, not a replacement:
|
|
227
|
+
* that one is the tenancy projection D-55 settled at `{ id, status }`, and
|
|
228
|
+
* `organizationTaxProfilePort` already declined to widen it for the same
|
|
229
|
+
* reason. Eleven modules read the row itself, and between them they touch
|
|
230
|
+
* nearly every column; that is this port.
|
|
231
|
+
*/
|
|
232
|
+
ctx.di.providePort('organizationDetailsPort', ctx
|
|
233
|
+
.asFunction(({ emFactory }) => new OrganizationDetailsService(emFactory))
|
|
234
|
+
.singleton());
|
|
235
|
+
/**
|
|
236
|
+
* Feature 075, Phase P — the personal-organization provisioner `customers`
|
|
237
|
+
* calls on registration. It built its own `PersonalOrganizationService` in
|
|
238
|
+
* `plugin.ts`; this is the one the module owns, and it takes the account id
|
|
239
|
+
* rather than the entity.
|
|
240
|
+
*/
|
|
241
|
+
ctx.di.providePort('personalOrganizationPort', ctx
|
|
242
|
+
.asFunction(({ emFactory, auditLogService }) => {
|
|
243
|
+
const service = new PersonalOrganizationService(emFactory, {
|
|
244
|
+
// Feature 075, Phase C — `lazyPort` rather than a captured value:
|
|
245
|
+
// the gates stay live inside this singleton, and the service reads
|
|
246
|
+
// them per call.
|
|
247
|
+
read: lazyPort(ctx, 'customerAccountReadPort'),
|
|
248
|
+
write: lazyPort(ctx, 'customerAccountMemberWritePort'),
|
|
249
|
+
}, auditLogService);
|
|
250
|
+
return {
|
|
251
|
+
ensureForCustomerAccount: async (customerAccountId) => toOrganizationRecord(await service.ensureForCustomerAccountId(customerAccountId)),
|
|
252
|
+
provisionPersonalOrganization: async (customerAccountId) => toOrganizationRecord(await service.provisionPersonalOrganizationFor(customerAccountId)),
|
|
253
|
+
anonymizeIfOrphaned: async (customerAccountId) => {
|
|
254
|
+
const org = await service.anonymizeIfOrphaned(customerAccountId);
|
|
255
|
+
return org ? toOrganizationRecord(org) : null;
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
})
|
|
259
|
+
.singleton());
|
|
260
|
+
/**
|
|
261
|
+
* D-178 — the co-transactional half of the same provisioning, for the module
|
|
262
|
+
* that owns the account row.
|
|
263
|
+
*
|
|
264
|
+
* A second registration rather than a method on `personalOrganizationPort`
|
|
265
|
+
* because its signature carries the caller's `EntityManager`, which
|
|
266
|
+
* `@endora-commerce/contracts` may not name (FR-034). It is declared in this
|
|
267
|
+
* module's own `ports/` directory, in the shape `credit_limits` and
|
|
268
|
+
* `promotions` already publish for the same reason, and what holds it
|
|
269
|
+
* co-transactional is `customer_accounts_organization_fk` — see that file.
|
|
270
|
+
*
|
|
271
|
+
* It reads and writes nothing on `customer_accounts`, so unlike the port above
|
|
272
|
+
* it needs neither of that module's two ports.
|
|
273
|
+
*/
|
|
274
|
+
ctx.di.providePort('personalOrganizationProvisionApi', ctx
|
|
275
|
+
.asFunction(({ emFactory, auditLogService }) => {
|
|
276
|
+
const service = new PersonalOrganizationService(emFactory, {
|
|
277
|
+
read: lazyPort(ctx, 'customerAccountReadPort'),
|
|
278
|
+
write: lazyPort(ctx, 'customerAccountMemberWritePort'),
|
|
279
|
+
}, auditLogService);
|
|
280
|
+
return {
|
|
281
|
+
provisionFor: async (em, input) => {
|
|
282
|
+
const org = await service.provisionFor(em, input);
|
|
283
|
+
return { id: org.id };
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
})
|
|
287
|
+
.singleton());
|
|
288
|
+
/**
|
|
289
|
+
* Issue #175 — the cart-approval policy write.
|
|
290
|
+
*
|
|
291
|
+
* `carts` drives both surfaces that flip `requires_cart_approval` but the
|
|
292
|
+
* column is this module's, and it was writing it by holding this module's
|
|
293
|
+
* entity — the last entry in that module's cross-module import ledger. D-78
|
|
294
|
+
* step 1 puts the operation with the owner, and publishing it settled the
|
|
295
|
+
* question the direct write had been ducking: the flip had no audit row on
|
|
296
|
+
* this side, and Constitution XIII says it must have one. Hence a Command,
|
|
297
|
+
* whose actor the bus derives from the caller's ambient context.
|
|
298
|
+
*
|
|
299
|
+
* The cascade over `carts`' own rows stays with `carts`, keyed off `changed`.
|
|
300
|
+
*/
|
|
301
|
+
ctx.di.providePort('organizationCartApprovalWritePort', ctx
|
|
302
|
+
.asFunction(({ commandBus }) => ({
|
|
303
|
+
setCartApprovalPolicy: (organizationId, requiresCartApproval) => commandBus.run(makeSetCartApprovalPolicyCommand({ organizationId, requiresCartApproval })),
|
|
304
|
+
}))
|
|
305
|
+
.singleton());
|
|
306
|
+
ctx.di.providePort('organizationRestrictionPort', ctx
|
|
307
|
+
.asFunction(({ emFactory, auditLogService }) => new OrganizationRestrictionService(emFactory, auditLogService))
|
|
308
|
+
.singleton());
|
|
309
|
+
// One instance per composition. Production shared one; the harness built four
|
|
310
|
+
// separate ones for four consumers, which is issue #44's shape.
|
|
311
|
+
ctx.di.providePort('organizationTreeService', ctx
|
|
312
|
+
.asFunction(({ emFactory }) => new OrganizationTreeService(emFactory))
|
|
313
|
+
.singleton());
|
|
314
|
+
/**
|
|
315
|
+
* The two Organization facts a VAT rate depends on (T143c).
|
|
316
|
+
*
|
|
317
|
+
* Both roots spelled the same `em.findOne(Organization, …)` inside the Quote
|
|
318
|
+
* Requests tax closure — a root loading this module's entity, and doing it
|
|
319
|
+
* ungated, so the quote was priced from an Organization row with
|
|
320
|
+
* `organizations` switched off. Refusing is the right answer there: the
|
|
321
|
+
* closure deliberately carries no `catch` (issue #84), because quoting 0 % on
|
|
322
|
+
* an operator's behalf is worse than failing.
|
|
323
|
+
*
|
|
324
|
+
* Deliberately not a widening of the kernel's `OrganizationSnapshot`. That
|
|
325
|
+
* shape is the tenancy projection every module reads; a tax profile is one
|
|
326
|
+
* consumer's question, and D-55 settled the snapshot at what its callers
|
|
327
|
+
* actually use.
|
|
328
|
+
*/
|
|
329
|
+
ctx.di.providePort('organizationTaxProfilePort', ctx
|
|
330
|
+
.asFunction(({ emFactory }) => ({
|
|
331
|
+
taxProfileOf: async (organizationId) => {
|
|
332
|
+
const org = await emFactory().findOne(Organization, { id: organizationId });
|
|
333
|
+
if (!org)
|
|
334
|
+
return null;
|
|
335
|
+
return { vatStatus: org.vatStatus, country: org.registeredAddress?.country ?? null };
|
|
336
|
+
},
|
|
337
|
+
}))
|
|
338
|
+
.singleton());
|
|
339
|
+
ctx.di.providePort('organizationInheritancePort', ctx
|
|
340
|
+
.asFunction(({ emFactory }) => new OrganizationInheritanceService(emFactory,
|
|
341
|
+
// Its own port, and gated all the same — a singleton may not hold
|
|
342
|
+
// the gate.
|
|
343
|
+
lazyPort(ctx, 'organizationTreeService'),
|
|
344
|
+
// `credit_limits`' membership read (feature 077, D-87). Lazily for
|
|
345
|
+
// the same reason and one more: it is another module's gate, so a
|
|
346
|
+
// captured reference would keep answering after an operator
|
|
347
|
+
// switched credit limits off. The edge is mutual — that module
|
|
348
|
+
// declares this one — so it is an `acknowledgedDependencies` entry
|
|
349
|
+
// in this manifest rather than a `dependencies` one.
|
|
350
|
+
lazyPort(ctx, 'creditLimitReadPort'), () => readSetting(ORGANIZATIONS_SETTING_CODES.CREDIT_INHERITANCE_MODE, creditInheritanceModeSchema, 'shared_pool')))
|
|
351
|
+
.singleton());
|
|
352
|
+
/**
|
|
353
|
+
* The visibility scope both roots used to build for themselves (T143a).
|
|
354
|
+
*
|
|
355
|
+
* A **port**, not a contribution point (D-39): it decides what an admin may
|
|
356
|
+
* see, reading two tables and a capability to do it. A caller that reaches it
|
|
357
|
+
* while the module is absent must get the 503 rather than an empty array,
|
|
358
|
+
* because an empty array here reads as "this rep is assigned nothing" — a
|
|
359
|
+
* plausible answer, and the wrong one.
|
|
360
|
+
*
|
|
361
|
+
* Both collaborators are read through `lazyPort`: the tree is this module's
|
|
362
|
+
* own gated port and the permission check is `admin_roles`', and a singleton
|
|
363
|
+
* may hold neither gate.
|
|
364
|
+
*
|
|
365
|
+
* Issue #108 widened it from one method to five. `customers` built its own
|
|
366
|
+
* `SalesRepAssignmentService` **without** the subtree deps, so the roll-up was
|
|
367
|
+
* skipped for every staff-authority decision, and `quote_requests` spelled the
|
|
368
|
+
* same wiring out again. What kept them off this port was the methods it
|
|
369
|
+
* did not carry — the visibility predicate, the per-organization rep list, and
|
|
370
|
+
* the two writes this module's own admin routes make (routes `quote_requests`
|
|
371
|
+
* hosts, because they count Quote Requests and moving them here would close a
|
|
372
|
+
* manifest dependency cycle). So the port grew and the copies went.
|
|
373
|
+
*/
|
|
374
|
+
ctx.di.providePort('organizationSalesRepScopePort', ctx
|
|
375
|
+
.asFunction(({ emFactory, auditLogService }) => {
|
|
376
|
+
const assignments = new SalesRepAssignmentService(emFactory, auditLogService, {
|
|
377
|
+
treeService: lazyPort(ctx, 'organizationTreeService'),
|
|
378
|
+
hasRollupCapability: (adminUserId) =>
|
|
379
|
+
// `organizations:rollup` is a core `PERMISSION_CATALOGUE` code
|
|
380
|
+
// rather than another module's private string, so naming it here
|
|
381
|
+
// crosses no boundary — the same call `quote_requests` makes.
|
|
382
|
+
lazyPort(ctx, 'permissionService').hasPermission(adminUserId, 'organizations:rollup'),
|
|
383
|
+
});
|
|
384
|
+
return {
|
|
385
|
+
canSeeOrganization: (adminUserId, organizationId) => assignments.canSeeOrganization(adminUserId, organizationId),
|
|
386
|
+
listAssignedOrganizationIds: (adminUserId) => assignments.listAssignedOrganizationIds(adminUserId),
|
|
387
|
+
listForOrganization: (organizationId) => assignments.listForOrganization(organizationId),
|
|
388
|
+
assign: (input) => assignments.assign(input),
|
|
389
|
+
unassign: (input) => assignments.unassign(input),
|
|
390
|
+
};
|
|
391
|
+
})
|
|
392
|
+
.singleton());
|
|
393
|
+
ctx.routes(async (app) => {
|
|
394
|
+
await cradle().organizations(app);
|
|
395
|
+
});
|
|
396
|
+
/**
|
|
397
|
+
* The three sales-rep assignment endpoints, registered by their owner (D-166).
|
|
398
|
+
*
|
|
399
|
+
* They used to be registered by `quote_requests`, which dynamically imported
|
|
400
|
+
* this module's route file and built its `deps` — so the screen that assigns a
|
|
401
|
+
* sales representative to an organisation was gated by *quote requests'*
|
|
402
|
+
* effective state, and this module had no seam through which to hand that file
|
|
403
|
+
* a port its own container resolved. Both halves are gone: the registration is
|
|
404
|
+
* here, and `adminUserReadPort` is resolved here, which retires this module's
|
|
405
|
+
* two `routes.sales-reps.ts` ledger entries.
|
|
406
|
+
*
|
|
407
|
+
* `lazyPort` rather than a captured resolution, for the usual reason — a
|
|
408
|
+
* captured gate keeps answering after its owner is switched off. `admin_users`
|
|
409
|
+
* is declared in this manifest's `dependencies`, and directly since D-179.3:
|
|
410
|
+
* it used to be satisfied transitively through `admin_notifications`, which is
|
|
411
|
+
* a non-binding edge now. The edge closes no cycle either way.
|
|
412
|
+
*/
|
|
413
|
+
ctx.routes(async (app) => {
|
|
414
|
+
await registerOrganizationsSalesRepRoutes(app, {
|
|
415
|
+
emFactory: cradle().emFactory,
|
|
416
|
+
requireAdmin: (permission) => async (req, reply) => cradle().requireAdmin(permission)(req, reply),
|
|
417
|
+
salesRepAssignment: lazyPort(ctx, 'organizationSalesRepScopePort'),
|
|
418
|
+
adminUsers: lazyPort(ctx, 'adminUserReadPort'),
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
// Both reactors used to be bare `eventBus.on` calls in each root, so they ran
|
|
422
|
+
// whether or not the module was present. Failures inside either one never
|
|
423
|
+
// poison the registration itself — the EventBus catches handler throws.
|
|
424
|
+
ctx.subscribe('organization.registered.v1', async (payload) => {
|
|
425
|
+
const { organizationId } = payload;
|
|
426
|
+
await cradle().organizationRegistrationNotifier.handleRegistered(organizationId);
|
|
427
|
+
});
|
|
428
|
+
ctx.subscribe('organization.registered.v1', async (payload) => {
|
|
429
|
+
const { organizationId } = payload;
|
|
430
|
+
await cradle().organizationModerationService.handleNewlyRegistered(organizationId);
|
|
431
|
+
});
|
|
432
|
+
/**
|
|
433
|
+
* The default subject and content for the 3 transactional emails this
|
|
434
|
+
* module declares in its manifest (T143a).
|
|
435
|
+
*
|
|
436
|
+
* These were fourteen `emailDefaultsRegistry.register(...)` calls in
|
|
437
|
+
* `composition.ts`, each importing a template constant out of the module that
|
|
438
|
+
* owns it — a root reaching into seven modules to hand their own content to
|
|
439
|
+
* an eighth. Each module registers its own now.
|
|
440
|
+
*
|
|
441
|
+
* `ctx.onBoot` rather than a registration: the registry is *read* once, by
|
|
442
|
+
* `transactional_emails`' boot reconciler inside its plugin body. Boot hooks
|
|
443
|
+
* run during composition and plugin bodies only when the Fastify app is
|
|
444
|
+
* built, so this always lands first — by construction, not by ordering luck.
|
|
445
|
+
*/
|
|
446
|
+
ctx.onBoot(async () => {
|
|
447
|
+
const defaults = lazyPort(ctx, 'emailDefaultsPort');
|
|
448
|
+
defaults.register('email_verification', EMAIL_VERIFICATION_DEFAULT, 'organizations');
|
|
449
|
+
defaults.register('organization_invitation', ORGANIZATION_INVITATION_DEFAULT, 'organizations');
|
|
450
|
+
defaults.register('new_org_registration', NEW_ORG_REGISTRATION_DEFAULT, 'organizations');
|
|
451
|
+
defaults.register('organization_approved', ORGANIZATION_APPROVED_DEFAULT, 'organizations');
|
|
452
|
+
defaults.register('organization_rejected', ORGANIZATION_REJECTED_DEFAULT, 'organizations');
|
|
453
|
+
});
|
|
454
|
+
/**
|
|
455
|
+
* This module's rows carry a country code, so it answers "who still points at
|
|
456
|
+
* this country?" about its own tables (feature 077, D-87), where the owner used
|
|
457
|
+
* to count them with SQL naming this module's tables.
|
|
458
|
+
*
|
|
459
|
+
* A **contribution** hook: it pushes an inert descriptor into `countryReferenceRegistry`,
|
|
460
|
+
* an ungated registry, and carries no presence probe (D-62/D-68). Probing
|
|
461
|
+
* would be wrong in the dangerous direction — a switched-off module still owns
|
|
462
|
+
* the rows, so its country must still refuse the delete, which is the
|
|
463
|
+
* enumeration policy the registry states.
|
|
464
|
+
*/
|
|
465
|
+
ctx.onBoot(() => {
|
|
466
|
+
registerOrganizationCountryReferences(lazyPort(ctx, 'countryReferenceRegistry'), ctx.cradle().emFactory);
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* The module's persisted entity classes, on the `./backend` subpath, as one
|
|
471
|
+
* array and **no named class export** (D-168).
|
|
472
|
+
*
|
|
473
|
+
* This is the shape the platform reads when the package is *installed*: the
|
|
474
|
+
* boot-time loader (`src/packages/package-runtime.ts`, `exported['entities']`)
|
|
475
|
+
* and the static declaration reader (`scripts/lib/package-declarations.ts`),
|
|
476
|
+
* which is the third source of `check:module-boundary`'s `table->owner` map and
|
|
477
|
+
* the package pass of `check-entity-tenant-classification`. A missing array is
|
|
478
|
+
* answered with `[]` — zero entities registered, no error anywhere.
|
|
479
|
+
*
|
|
480
|
+
* The order is the one `db/entities-registry.generated.ts` declared before this
|
|
481
|
+
* module became a package, so the registered set is the same list in the same
|
|
482
|
+
* sequence.
|
|
483
|
+
*/
|
|
484
|
+
export const entities = [
|
|
485
|
+
EmailVerificationToken,
|
|
486
|
+
OrganizationDeliveryMethodLink,
|
|
487
|
+
OrganizationInvitation,
|
|
488
|
+
OrganizationPaymentMethodLink,
|
|
489
|
+
OrganizationSalesRepAssignment,
|
|
490
|
+
OrganizationTaxIdValidation,
|
|
491
|
+
OrganizationWarehouseLink,
|
|
492
|
+
Organization,
|
|
493
|
+
];
|
|
494
|
+
/**
|
|
495
|
+
* The sales-channel membership bridge this module owns (feature 120, FR-015).
|
|
496
|
+
*
|
|
497
|
+
* Exported as well as registered because the owning module is the only honest
|
|
498
|
+
* source for it: a caller that composes no platform — the bare-database test
|
|
499
|
+
* harness, which constructs the kernel's membership service directly — declares
|
|
500
|
+
* these from here rather than from a list of nine it keeps itself, which is
|
|
501
|
+
* exactly the total map this feature deleted.
|
|
502
|
+
*/
|
|
503
|
+
export const salesChannelBridges = [
|
|
504
|
+
{ entityType: 'organization', table: 'sales_channel_organizations', entityIdColumn: 'organization_id' },
|
|
505
|
+
];
|
|
506
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/backend/index.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAQ5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAE1F,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,sCAAsC,EAAE,MAAM,yDAAyD,CAAC;AACjH,OAAO,EAAE,kCAAkC,EAAE,MAAM,sDAAsD,CAAC;AAC1G,OAAO,EACL,yBAAyB,GAE1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,MAA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AG,EAAE;QACd,qCAAqC,CACnC,QAAQ,CAAkC,GAAG,EAAE,0BAA0B,CAAC,EAC1E,GAAG,CAAC,MAAM,EAAuB,CAAC,SAAS,CAC5C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,sBAAsB;IACtB,8BAA8B;IAC9B,sBAAsB;IACtB,6BAA6B;IAC7B,8BAA8B;IAC9B,2BAA2B;IAC3B,yBAAyB;IACzB,YAAY;CACb,CAAC;AAYF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAI3B;IACH,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,6BAA6B,EAAE,cAAc,EAAE,iBAAiB,EAAE;CACxG,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { VatValidationResult, VatValidator } from '../services/vat-validator-port.js';
|
|
2
|
+
export interface MinisterstwoFinansowClientOptions {
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
fetchImpl?: typeof globalThis.fetch;
|
|
6
|
+
/** Minimum ms between successive requests. Defaults to 100ms (10 rps). */
|
|
7
|
+
minIntervalMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class MinisterstwoFinansowClient implements VatValidator {
|
|
10
|
+
readonly provider: "mf_pl";
|
|
11
|
+
private readonly baseUrl;
|
|
12
|
+
private readonly timeoutMs;
|
|
13
|
+
private readonly fetchImpl;
|
|
14
|
+
private readonly minIntervalMs;
|
|
15
|
+
private lastRequestAt;
|
|
16
|
+
constructor(options?: MinisterstwoFinansowClientOptions);
|
|
17
|
+
validate(input: {
|
|
18
|
+
taxId: string;
|
|
19
|
+
}): Promise<VatValidationResult>;
|
|
20
|
+
private throttle;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ministerstwo-finansow-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ministerstwo-finansow-client.d.ts","sourceRoot":"","sources":["../../../src/backend/integrations/ministerstwo-finansow-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,mCAAmC,CAAC;AAoC3C,MAAM,WAAW,iCAAiC;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACpC,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,0BAA2B,YAAW,YAAY;IAC7D,QAAQ,CAAC,QAAQ,EAAG,OAAO,CAAU;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0B;IACpD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,aAAa,CAAK;gBAEd,OAAO,GAAE,iCAAsC;IAOrD,QAAQ,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;YA+GxD,QAAQ;CAQvB"}
|