@open-mercato/core 0.8.1-develop.7296.1.2111d779db → 0.8.1-develop.7441.1.b42958b98c
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/.turbo/turbo-build.log +2 -2
- package/AGENTS.md +4 -5
- package/dist/generated/entities/availability_policy/index.js +41 -0
- package/dist/generated/entities/availability_policy/index.js.map +7 -0
- package/dist/generated/entities/communication_channel/index.js +3 -1
- package/dist/generated/entities/communication_channel/index.js.map +2 -2
- package/dist/generated/entities/customer_email_conversation_share/index.js +21 -0
- package/dist/generated/entities/customer_email_conversation_share/index.js.map +7 -0
- package/dist/generated/entities/customer_group/index.js +33 -0
- package/dist/generated/entities/customer_group/index.js.map +7 -0
- package/dist/generated/entities/customer_group_membership/index.js +29 -0
- package/dist/generated/entities/customer_group_membership/index.js.map +7 -0
- package/dist/generated/entities/customer_group_terms/index.js +33 -0
- package/dist/generated/entities/customer_group_terms/index.js.map +7 -0
- package/dist/generated/entities/customer_interaction/index.js +2 -0
- package/dist/generated/entities/customer_interaction/index.js.map +2 -2
- package/dist/generated/entities/form/index.js +35 -0
- package/dist/generated/entities/form/index.js.map +7 -0
- package/dist/generated/entities/form_access_audit/index.js +21 -0
- package/dist/generated/entities/form_access_audit/index.js.map +7 -0
- package/dist/generated/entities/form_attachment/index.js +29 -0
- package/dist/generated/entities/form_attachment/index.js.map +7 -0
- package/dist/generated/entities/form_consent_record/index.js +37 -0
- package/dist/generated/entities/form_consent_record/index.js.map +7 -0
- package/dist/generated/entities/form_distribution/index.js +47 -0
- package/dist/generated/entities/form_distribution/index.js.map +7 -0
- package/dist/generated/entities/form_invitation/index.js +49 -0
- package/dist/generated/entities/form_invitation/index.js.map +7 -0
- package/dist/generated/entities/form_submission/index.js +39 -0
- package/dist/generated/entities/form_submission/index.js.map +7 -0
- package/dist/generated/entities/form_submission_actor/index.js +23 -0
- package/dist/generated/entities/form_submission_actor/index.js.map +7 -0
- package/dist/generated/entities/form_submission_revision/index.js +29 -0
- package/dist/generated/entities/form_submission_revision/index.js.map +7 -0
- package/dist/generated/entities/form_version/index.js +37 -0
- package/dist/generated/entities/form_version/index.js.map +7 -0
- package/dist/generated/entities/forms_encryption_key/index.js +15 -0
- package/dist/generated/entities/forms_encryption_key/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +27 -2
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +269 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/communicationChannelsFixtures.js +16 -0
- package/dist/helpers/integration/communicationChannelsFixtures.js.map +2 -2
- package/dist/helpers/integration/customerGroupsFixtures.js +88 -0
- package/dist/helpers/integration/customerGroupsFixtures.js.map +7 -0
- package/dist/helpers/integration/formsFixtures.js +448 -0
- package/dist/helpers/integration/formsFixtures.js.map +7 -0
- package/dist/modules/api_docs/api/get/version.js +19 -7
- package/dist/modules/api_docs/api/get/version.js.map +2 -2
- package/dist/modules/api_keys/api/keys/route.js +74 -169
- package/dist/modules/api_keys/api/keys/route.js.map +2 -2
- package/dist/modules/api_keys/backend/api-keys/create/page.js +1 -1
- package/dist/modules/api_keys/backend/api-keys/create/page.js.map +2 -2
- package/dist/modules/api_keys/commands/keys.js +140 -0
- package/dist/modules/api_keys/commands/keys.js.map +7 -0
- package/dist/modules/api_keys/services/apiKeyService.js +72 -43
- package/dist/modules/api_keys/services/apiKeyService.js.map +2 -2
- package/dist/modules/attachments/api/file/[id]/route.js +9 -2
- package/dist/modules/attachments/api/file/[id]/route.js.map +2 -2
- package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js +6 -2
- package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js.map +2 -2
- package/dist/modules/attachments/api/route.js +10 -4
- package/dist/modules/attachments/api/route.js.map +2 -2
- package/dist/modules/attachments/components/AttachmentLibrary.js +16 -6
- package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
- package/dist/modules/attachments/lib/access.js +1 -3
- package/dist/modules/attachments/lib/access.js.map +2 -2
- package/dist/modules/attachments/lib/requestScope.js +13 -4
- package/dist/modules/attachments/lib/requestScope.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/export/route.js +6 -1
- package/dist/modules/audit_logs/api/audit-logs/actions/export/route.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js +36 -6
- package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js.map +3 -3
- package/dist/modules/audit_logs/api/audit-logs/actions/route.js +6 -1
- package/dist/modules/audit_logs/api/audit-logs/actions/route.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/undo/route.js +34 -4
- package/dist/modules/audit_logs/api/audit-logs/actions/undo/route.js.map +2 -2
- package/dist/modules/audit_logs/data/validators.js +1 -0
- package/dist/modules/audit_logs/data/validators.js.map +2 -2
- package/dist/modules/audit_logs/lib/actorSubject.js +65 -0
- package/dist/modules/audit_logs/lib/actorSubject.js.map +7 -0
- package/dist/modules/audit_logs/lib/replayAuthorization.js +41 -0
- package/dist/modules/audit_logs/lib/replayAuthorization.js.map +7 -0
- package/dist/modules/audit_logs/services/actionLogService.js +162 -39
- package/dist/modules/audit_logs/services/actionLogService.js.map +3 -3
- package/dist/modules/auth/api/features.js +1 -1
- package/dist/modules/auth/api/features.js.map +2 -2
- package/dist/modules/auth/cli.js +29 -17
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/commands/acl.js +25 -36
- package/dist/modules/auth/commands/acl.js.map +2 -2
- package/dist/modules/auth/commands/interceptors.js +22 -0
- package/dist/modules/auth/commands/interceptors.js.map +7 -0
- package/dist/modules/auth/commands/roles.js +421 -147
- package/dist/modules/auth/commands/roles.js.map +2 -2
- package/dist/modules/auth/commands/users.js +543 -69
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/lib/authorizationStateLocks.js +249 -0
- package/dist/modules/auth/lib/authorizationStateLocks.js.map +7 -0
- package/dist/modules/auth/lib/commandReplay.js +144 -0
- package/dist/modules/auth/lib/commandReplay.js.map +7 -0
- package/dist/modules/auth/lib/executionPrincipal.js +32 -25
- package/dist/modules/auth/lib/executionPrincipal.js.map +2 -2
- package/dist/modules/auth/lib/grantChecks.js +7 -2
- package/dist/modules/auth/lib/grantChecks.js.map +2 -2
- package/dist/modules/auth/lib/setup-app.js +85 -49
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/auth/lib/tokenHash.js +13 -1
- package/dist/modules/auth/lib/tokenHash.js.map +2 -2
- package/dist/modules/auth/services/rbacService.js +386 -5
- package/dist/modules/auth/services/rbacService.js.map +3 -3
- package/dist/modules/availability/acl.js +16 -0
- package/dist/modules/availability/acl.js.map +7 -0
- package/dist/modules/availability/api/check/route.js +115 -0
- package/dist/modules/availability/api/check/route.js.map +7 -0
- package/dist/modules/availability/api/openapi.js +27 -0
- package/dist/modules/availability/api/openapi.js.map +7 -0
- package/dist/modules/availability/api/policies/resolve-preview/route.js +72 -0
- package/dist/modules/availability/api/policies/resolve-preview/route.js.map +7 -0
- package/dist/modules/availability/api/policies/route.js +203 -0
- package/dist/modules/availability/api/policies/route.js.map +7 -0
- package/dist/modules/availability/backend/availability/check/page.js +185 -0
- package/dist/modules/availability/backend/availability/check/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/check/page.meta.js +16 -0
- package/dist/modules/availability/backend/availability/check/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/ResolutionPreviewPanel.js +83 -0
- package/dist/modules/availability/backend/availability/policies/ResolutionPreviewPanel.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/ScopeFields.js +53 -0
- package/dist/modules/availability/backend/availability/policies/ScopeFields.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/StockManagedField.js +32 -0
- package/dist/modules/availability/backend/availability/policies/StockManagedField.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.js +168 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.meta.js +12 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/create/page.js +119 -0
- package/dist/modules/availability/backend/availability/policies/create/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/create/page.meta.js +12 -0
- package/dist/modules/availability/backend/availability/policies/create/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/formGroups.js +77 -0
- package/dist/modules/availability/backend/availability/policies/formGroups.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/page.js +207 -0
- package/dist/modules/availability/backend/availability/policies/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/page.meta.js +16 -0
- package/dist/modules/availability/backend/availability/policies/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/policyPayload.js +28 -0
- package/dist/modules/availability/backend/availability/policies/policyPayload.js.map +7 -0
- package/dist/modules/availability/commands/policies.js +364 -0
- package/dist/modules/availability/commands/policies.js.map +7 -0
- package/dist/modules/availability/commands/scope.js +19 -0
- package/dist/modules/availability/commands/scope.js.map +7 -0
- package/dist/modules/availability/data/entities.js +94 -0
- package/dist/modules/availability/data/entities.js.map +7 -0
- package/dist/modules/availability/data/validators.js +59 -0
- package/dist/modules/availability/data/validators.js.map +7 -0
- package/dist/modules/availability/di.js +50 -0
- package/dist/modules/availability/di.js.map +7 -0
- package/dist/modules/availability/events.js +18 -0
- package/dist/modules/availability/events.js.map +7 -0
- package/dist/modules/availability/index.js +15 -0
- package/dist/modules/availability/index.js.map +7 -0
- package/dist/modules/availability/lib/catalogTarget.js +42 -0
- package/dist/modules/availability/lib/catalogTarget.js.map +7 -0
- package/dist/modules/availability/lib/organizationScope.js +10 -0
- package/dist/modules/availability/lib/organizationScope.js.map +7 -0
- package/dist/modules/availability/lib/policyResolution.js +150 -0
- package/dist/modules/availability/lib/policyResolution.js.map +7 -0
- package/dist/modules/availability/lib/tryResolve.js +11 -0
- package/dist/modules/availability/lib/tryResolve.js.map +7 -0
- package/dist/modules/availability/migrations/Migration20260922095844_availability.js +16 -0
- package/dist/modules/availability/migrations/Migration20260922095844_availability.js.map +7 -0
- package/dist/modules/availability/migrations/Migration20260930120000_availability.js +20 -0
- package/dist/modules/availability/migrations/Migration20260930120000_availability.js.map +7 -0
- package/dist/modules/availability/setup.js +12 -0
- package/dist/modules/availability/setup.js.map +7 -0
- package/dist/modules/catalog/api/categories/bulk-create/route.js +110 -0
- package/dist/modules/catalog/api/categories/bulk-create/route.js.map +7 -0
- package/dist/modules/catalog/api/categories/route.js +56 -8
- package/dist/modules/catalog/api/categories/route.js.map +2 -2
- package/dist/modules/catalog/api/products/bulk-create/route.js +110 -0
- package/dist/modules/catalog/api/products/bulk-create/route.js.map +7 -0
- package/dist/modules/catalog/api/products/route.js +55 -31
- package/dist/modules/catalog/api/products/route.js.map +3 -3
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +2 -6
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/create/page.js +12 -4
- package/dist/modules/catalog/backend/catalog/products/create/page.js.map +2 -2
- package/dist/modules/catalog/commands/categories.js +1 -0
- package/dist/modules/catalog/commands/categories.js.map +2 -2
- package/dist/modules/catalog/commands/productDeleteChildren.js +389 -0
- package/dist/modules/catalog/commands/productDeleteChildren.js.map +7 -0
- package/dist/modules/catalog/commands/products.js +57 -19
- package/dist/modules/catalog/commands/products.js.map +2 -2
- package/dist/modules/catalog/components/PriceKindSettings.js +5 -19
- package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductUomSection.js +26 -29
- package/dist/modules/catalog/components/products/ProductUomSection.js.map +2 -2
- package/dist/modules/catalog/components/products/productForm.js +3 -2
- package/dist/modules/catalog/components/products/productForm.js.map +2 -2
- package/dist/modules/catalog/data/validators.js +15 -0
- package/dist/modules/catalog/data/validators.js.map +2 -2
- package/dist/modules/catalog/di.js +3 -2
- package/dist/modules/catalog/di.js.map +2 -2
- package/dist/modules/catalog/events.js +9 -3
- package/dist/modules/catalog/events.js.map +2 -2
- package/dist/modules/catalog/lib/bulkCreateCategories.js +237 -0
- package/dist/modules/catalog/lib/bulkCreateCategories.js.map +7 -0
- package/dist/modules/catalog/lib/bulkCreateCheckpoint.js +82 -0
- package/dist/modules/catalog/lib/bulkCreateCheckpoint.js.map +7 -0
- package/dist/modules/catalog/lib/bulkCreateMutationGuards.js +39 -0
- package/dist/modules/catalog/lib/bulkCreateMutationGuards.js.map +7 -0
- package/dist/modules/catalog/lib/bulkCreateProducts.js +241 -0
- package/dist/modules/catalog/lib/bulkCreateProducts.js.map +7 -0
- package/dist/modules/catalog/lib/bulkDelete.js +10 -11
- package/dist/modules/catalog/lib/bulkDelete.js.map +2 -2
- package/dist/modules/catalog/lib/catalogQueue.js +14 -0
- package/dist/modules/catalog/lib/catalogQueue.js.map +7 -0
- package/dist/modules/catalog/lib/currencyOptions.js +25 -0
- package/dist/modules/catalog/lib/currencyOptions.js.map +7 -0
- package/dist/modules/catalog/lib/productSearch.js +8 -0
- package/dist/modules/catalog/lib/productSearch.js.map +7 -0
- package/dist/modules/catalog/lib/seeds.js +2 -42
- package/dist/modules/catalog/lib/seeds.js.map +2 -2
- package/dist/modules/catalog/lib/unitLabels.js +53 -0
- package/dist/modules/catalog/lib/unitLabels.js.map +7 -0
- package/dist/modules/catalog/migrations/Migration20260914120000.js +29 -0
- package/dist/modules/catalog/migrations/Migration20260914120000.js.map +7 -0
- package/dist/modules/catalog/migrations/Migration20260914120100.js +28 -0
- package/dist/modules/catalog/migrations/Migration20260914120100.js.map +7 -0
- package/dist/modules/catalog/workers/catalog-category-bulk-create.js +40 -0
- package/dist/modules/catalog/workers/catalog-category-bulk-create.js.map +7 -0
- package/dist/modules/catalog/workers/catalog-product-bulk-create.js +40 -0
- package/dist/modules/catalog/workers/catalog-product-bulk-create.js.map +7 -0
- package/dist/modules/communication_channels/acl.js +8 -0
- package/dist/modules/communication_channels/acl.js.map +2 -2
- package/dist/modules/communication_channels/api/get/me/channels/route.js +4 -0
- package/dist/modules/communication_channels/api/get/me/channels/route.js.map +2 -2
- package/dist/modules/communication_channels/api/get/oauth/[provider]/callback/route.js +22 -0
- package/dist/modules/communication_channels/api/get/oauth/[provider]/callback/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/channels/[id]/import-history/route.js +4 -4
- package/dist/modules/communication_channels/api/post/channels/[id]/import-history/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js +2 -1
- package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/channels/connect/credentials/route.js +4 -6
- package/dist/modules/communication_channels/api/post/channels/connect/credentials/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/channels/connect/tenant-credentials/route.js +4 -6
- package/dist/modules/communication_channels/api/post/channels/connect/tenant-credentials/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/test-seed/route.js +90 -20
- package/dist/modules/communication_channels/api/post/test-seed/route.js.map +3 -3
- package/dist/modules/communication_channels/api/put/channels/[id]/visibility/route.js +137 -0
- package/dist/modules/communication_channels/api/put/channels/[id]/visibility/route.js.map +7 -0
- package/dist/modules/communication_channels/backend/profile/communication-channels/page.js +175 -107
- package/dist/modules/communication_channels/backend/profile/communication-channels/page.js.map +2 -2
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js +2 -1
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js.map +2 -2
- package/dist/modules/communication_channels/commands/set-channel-visibility.js +88 -0
- package/dist/modules/communication_channels/commands/set-channel-visibility.js.map +7 -0
- package/dist/modules/communication_channels/data/enrichers.js +18 -9
- package/dist/modules/communication_channels/data/enrichers.js.map +2 -2
- package/dist/modules/communication_channels/data/entities.js +4 -0
- package/dist/modules/communication_channels/data/entities.js.map +2 -2
- package/dist/modules/communication_channels/di.js +9 -1
- package/dist/modules/communication_channels/di.js.map +2 -2
- package/dist/modules/communication_channels/events.js +7 -0
- package/dist/modules/communication_channels/events.js.map +2 -2
- package/dist/modules/communication_channels/index.js +1 -1
- package/dist/modules/communication_channels/index.js.map +1 -1
- package/dist/modules/communication_channels/lib/access-control.js +2 -1
- package/dist/modules/communication_channels/lib/access-control.js.map +2 -2
- package/dist/modules/communication_channels/lib/channel-thread-access.js +60 -0
- package/dist/modules/communication_channels/lib/channel-thread-access.js.map +7 -0
- package/dist/modules/communication_channels/lib/credential-refresh.js +11 -2
- package/dist/modules/communication_channels/lib/credential-refresh.js.map +2 -2
- package/dist/modules/communication_channels/lib/inbound-message-origin.js +18 -0
- package/dist/modules/communication_channels/lib/inbound-message-origin.js.map +7 -0
- package/dist/modules/communication_channels/lib/oauth-state.js +37 -0
- package/dist/modules/communication_channels/lib/oauth-state.js.map +2 -2
- package/dist/modules/communication_channels/lib/outbound-delivery-intent.js +12 -0
- package/dist/modules/communication_channels/lib/outbound-delivery-intent.js.map +7 -0
- package/dist/modules/communication_channels/lib/send-as-user.js +1 -1
- package/dist/modules/communication_channels/lib/send-as-user.js.map +2 -2
- package/dist/modules/communication_channels/migrations/Migration20260825141000_communication_channels.js +14 -0
- package/dist/modules/communication_channels/migrations/Migration20260825141000_communication_channels.js.map +7 -0
- package/dist/modules/communication_channels/setup.js +6 -2
- package/dist/modules/communication_channels/setup.js.map +2 -2
- package/dist/modules/communication_channels/subscribers/outbound-bridge.js +8 -2
- package/dist/modules/communication_channels/subscribers/outbound-bridge.js.map +2 -2
- package/dist/modules/communication_channels/workers/gmail-history-sync.js +1 -1
- package/dist/modules/communication_channels/workers/gmail-history-sync.js.map +2 -2
- package/dist/modules/communication_channels/workers/poll-channel.js +1 -1
- package/dist/modules/communication_channels/workers/poll-channel.js.map +2 -2
- package/dist/modules/communication_channels/workers/reaction-processor.js +2 -2
- package/dist/modules/communication_channels/workers/reaction-processor.js.map +2 -2
- package/dist/modules/configs/api/upgrade-actions/route.js +2 -1
- package/dist/modules/configs/api/upgrade-actions/route.js.map +2 -2
- package/dist/modules/configs/cli.js +2 -2
- package/dist/modules/configs/cli.js.map +2 -2
- package/dist/modules/configs/lib/upgrade-actions.js +28 -6
- package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
- package/dist/modules/configs/services/upgradeActionsService.js +44 -30
- package/dist/modules/configs/services/upgradeActionsService.js.map +2 -2
- package/dist/modules/currencies/api/currencies/route.js +11 -5
- package/dist/modules/currencies/api/currencies/route.js.map +2 -2
- package/dist/modules/currencies/api/exchange-rates/route.js +11 -5
- package/dist/modules/currencies/api/exchange-rates/route.js.map +2 -2
- package/dist/modules/customer_groups/acl.js +14 -0
- package/dist/modules/customer_groups/acl.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/[id]/terms/route.js +266 -0
- package/dist/modules/customer_groups/api/customer-groups/[id]/terms/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/crud.js +473 -0
- package/dist/modules/customer_groups/api/customer-groups/crud.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/explain-terms/route.js +143 -0
- package/dist/modules/customer_groups/api/customer-groups/explain-terms/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/memberships/crud.js +383 -0
- package/dist/modules/customer_groups/api/customer-groups/memberships/crud.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/memberships/route.js +66 -0
- package/dist/modules/customer_groups/api/customer-groups/memberships/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/reconcile/adopt/route.js +133 -0
- package/dist/modules/customer_groups/api/customer-groups/reconcile/adopt/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/reconcile/route.js +80 -0
- package/dist/modules/customer_groups/api/customer-groups/reconcile/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/reorder/route.js +127 -0
- package/dist/modules/customer_groups/api/customer-groups/reorder/route.js.map +7 -0
- package/dist/modules/customer_groups/api/customer-groups/route.js +62 -0
- package/dist/modules/customer_groups/api/customer-groups/route.js.map +7 -0
- package/dist/modules/customer_groups/api/openapi.js +27 -0
- package/dist/modules/customer_groups/api/openapi.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/[id]/edit/page.js +328 -0
- package/dist/modules/customer_groups/backend/customer-groups/[id]/edit/page.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/[id]/edit/page.meta.js +16 -0
- package/dist/modules/customer_groups/backend/customer-groups/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/create/page.js +249 -0
- package/dist/modules/customer_groups/backend/customer-groups/create/page.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/create/page.meta.js +27 -0
- package/dist/modules/customer_groups/backend/customer-groups/create/page.meta.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/orphans/page.js +139 -0
- package/dist/modules/customer_groups/backend/customer-groups/orphans/page.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/orphans/page.meta.js +16 -0
- package/dist/modules/customer_groups/backend/customer-groups/orphans/page.meta.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/page.js +364 -0
- package/dist/modules/customer_groups/backend/customer-groups/page.js.map +7 -0
- package/dist/modules/customer_groups/backend/customer-groups/page.meta.js +15 -0
- package/dist/modules/customer_groups/backend/customer-groups/page.meta.js.map +7 -0
- package/dist/modules/customer_groups/cli.js +72 -0
- package/dist/modules/customer_groups/cli.js.map +7 -0
- package/dist/modules/customer_groups/commands/reorderGroups.js +96 -0
- package/dist/modules/customer_groups/commands/reorderGroups.js.map +7 -0
- package/dist/modules/customer_groups/components/CustomerGroupDefaultField.js +41 -0
- package/dist/modules/customer_groups/components/CustomerGroupDefaultField.js.map +7 -0
- package/dist/modules/customer_groups/components/CustomerGroupParentField.js +156 -0
- package/dist/modules/customer_groups/components/CustomerGroupParentField.js.map +7 -0
- package/dist/modules/customer_groups/components/CustomerGroupTermsPriceKindField.js +94 -0
- package/dist/modules/customer_groups/components/CustomerGroupTermsPriceKindField.js.map +7 -0
- package/dist/modules/customer_groups/components/CustomerGroupTermsSection.js +197 -0
- package/dist/modules/customer_groups/components/CustomerGroupTermsSection.js.map +7 -0
- package/dist/modules/customer_groups/components/GroupPickerField.js +116 -0
- package/dist/modules/customer_groups/components/GroupPickerField.js.map +7 -0
- package/dist/modules/customer_groups/components/OrphanBanner.js +75 -0
- package/dist/modules/customer_groups/components/OrphanBanner.js.map +7 -0
- package/dist/modules/customer_groups/components/customerGroupTree.js +57 -0
- package/dist/modules/customer_groups/components/customerGroupTree.js.map +7 -0
- package/dist/modules/customer_groups/data/entities.js +226 -0
- package/dist/modules/customer_groups/data/entities.js.map +7 -0
- package/dist/modules/customer_groups/data/validators.js +153 -0
- package/dist/modules/customer_groups/data/validators.js.map +7 -0
- package/dist/modules/customer_groups/di.js +20 -0
- package/dist/modules/customer_groups/di.js.map +7 -0
- package/dist/modules/customer_groups/events.js +22 -0
- package/dist/modules/customer_groups/events.js.map +7 -0
- package/dist/modules/customer_groups/index.js +15 -0
- package/dist/modules/customer_groups/index.js.map +7 -0
- package/dist/modules/customer_groups/lib/createConflictRecheck.js +29 -0
- package/dist/modules/customer_groups/lib/createConflictRecheck.js.map +7 -0
- package/dist/modules/customer_groups/lib/customerScope.js +81 -0
- package/dist/modules/customer_groups/lib/customerScope.js.map +7 -0
- package/dist/modules/customer_groups/lib/groupEvents.js +31 -0
- package/dist/modules/customer_groups/lib/groupEvents.js.map +7 -0
- package/dist/modules/customer_groups/lib/priceKindScope.js +16 -0
- package/dist/modules/customer_groups/lib/priceKindScope.js.map +7 -0
- package/dist/modules/customer_groups/lib/reconcile.js +161 -0
- package/dist/modules/customer_groups/lib/reconcile.js.map +7 -0
- package/dist/modules/customer_groups/migrations/Migration20260922095316_customer_groups.js +27 -0
- package/dist/modules/customer_groups/migrations/Migration20260922095316_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/migrations/Migration20260922103033_customer_groups.js +19 -0
- package/dist/modules/customer_groups/migrations/Migration20260922103033_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/migrations/Migration20260922105444_customer_groups.js +19 -0
- package/dist/modules/customer_groups/migrations/Migration20260922105444_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/migrations/Migration20260923193330_customer_groups.js +19 -0
- package/dist/modules/customer_groups/migrations/Migration20260923193330_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/migrations/Migration20260929083000_customer_groups.js +20 -0
- package/dist/modules/customer_groups/migrations/Migration20260929083000_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/services/customerGroupsService.js +190 -0
- package/dist/modules/customer_groups/services/customerGroupsService.js.map +7 -0
- package/dist/modules/customer_groups/setup.js +13 -0
- package/dist/modules/customer_groups/setup.js.map +7 -0
- package/dist/modules/customer_groups/widgets/injection/group-picker-field/widget.js +31 -0
- package/dist/modules/customer_groups/widgets/injection/group-picker-field/widget.js.map +7 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-explain-terms.js +166 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-explain-terms.js.map +7 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-tab/widget.js +17 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-tab/widget.js.map +7 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-tab.js +457 -0
- package/dist/modules/customer_groups/widgets/injection/person-groups-tab.js.map +7 -0
- package/dist/modules/customer_groups/widgets/injection-table.js +33 -0
- package/dist/modules/customer_groups/widgets/injection-table.js.map +7 -0
- package/dist/modules/customers/acl.js +13 -0
- package/dist/modules/customers/acl.js.map +2 -2
- package/dist/modules/customers/api/activities/route.js +9 -1
- package/dist/modules/customers/api/activities/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/people/route.js +2 -1
- package/dist/modules/customers/api/companies/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/route.js +19 -7
- package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/companies/route.js +2 -1
- package/dist/modules/customers/api/deals/[id]/companies/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/people/route.js +60 -6
- package/dist/modules/customers/api/deals/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/deals/map/route.js +7 -2
- package/dist/modules/customers/api/deals/map/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/context.js +2 -1
- package/dist/modules/customers/api/dictionaries/context.js.map +2 -2
- package/dist/modules/customers/api/entity-roles-factory.js +3 -2
- package/dist/modules/customers/api/entity-roles-factory.js.map +2 -2
- package/dist/modules/customers/api/interactions/[id]/visibility/route.js +2 -1
- package/dist/modules/customers/api/interactions/[id]/visibility/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/cancel/route.js +2 -1
- package/dist/modules/customers/api/interactions/cancel/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/complete/route.js +2 -1
- package/dist/modules/customers/api/interactions/complete/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/conflicts/route.js +10 -6
- package/dist/modules/customers/api/interactions/conflicts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/counts/route.js +24 -4
- package/dist/modules/customers/api/interactions/counts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/route.js +31 -8
- package/dist/modules/customers/api/interactions/route.js.map +2 -2
- package/dist/modules/customers/api/labels/assign/route.js +2 -1
- package/dist/modules/customers/api/labels/assign/route.js.map +2 -2
- package/dist/modules/customers/api/labels/route.js +3 -2
- package/dist/modules/customers/api/labels/route.js.map +2 -2
- package/dist/modules/customers/api/labels/unassign/route.js +2 -1
- package/dist/modules/customers/api/labels/unassign/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/context.js +7 -2
- package/dist/modules/customers/api/people/[id]/companies/context.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/email-share/route.js +218 -0
- package/dist/modules/customers/api/people/[id]/email-share/route.js.map +7 -0
- package/dist/modules/customers/api/people/[id]/email-threads/route.js +11 -2
- package/dist/modules/customers/api/people/[id]/email-threads/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/emails/route.js +2 -1
- package/dist/modules/customers/api/people/[id]/emails/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/route.js +20 -19
- package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/people/check-phone/route.js +2 -1
- package/dist/modules/customers/api/people/check-phone/route.js.map +2 -2
- package/dist/modules/customers/api/pipeline-stages/reorder/route.js +3 -2
- package/dist/modules/customers/api/pipeline-stages/reorder/route.js.map +2 -2
- package/dist/modules/customers/api/pipeline-stages/route.js +3 -3
- package/dist/modules/customers/api/pipeline-stages/route.js.map +2 -2
- package/dist/modules/customers/api/pipelines/route.js +3 -3
- package/dist/modules/customers/api/pipelines/route.js.map +2 -2
- package/dist/modules/customers/api/settings/address-format/route.js +2 -1
- package/dist/modules/customers/api/settings/address-format/route.js.map +2 -2
- package/dist/modules/customers/api/settings/dictionary-sort-modes/route.js +2 -1
- package/dist/modules/customers/api/settings/dictionary-sort-modes/route.js.map +2 -2
- package/dist/modules/customers/api/settings/stuck-threshold/route.js +2 -1
- package/dist/modules/customers/api/settings/stuck-threshold/route.js.map +2 -2
- package/dist/modules/customers/api/tags/assign/route.js +2 -1
- package/dist/modules/customers/api/tags/assign/route.js.map +2 -2
- package/dist/modules/customers/api/tags/unassign/route.js +2 -1
- package/dist/modules/customers/api/tags/unassign/route.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/[id]/page.js +4 -2
- package/dist/modules/customers/backend/customers/companies/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealAssociations.js +6 -25
- package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealAssociations.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/page.js +21 -18
- package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/components/ReassignOwnerDialog.js +93 -0
- package/dist/modules/customers/backend/customers/deals/components/ReassignOwnerDialog.js.map +7 -0
- package/dist/modules/customers/backend/customers/deals/page.js +111 -1
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js +4 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js.map +2 -2
- package/dist/modules/customers/commands/addresses.js +83 -15
- package/dist/modules/customers/commands/addresses.js.map +2 -2
- package/dist/modules/customers/commands/companies.js +10 -4
- package/dist/modules/customers/commands/companies.js.map +2 -2
- package/dist/modules/customers/commands/emailConversationShares.js +177 -0
- package/dist/modules/customers/commands/emailConversationShares.js.map +7 -0
- package/dist/modules/customers/commands/index.js +1 -0
- package/dist/modules/customers/commands/index.js.map +2 -2
- package/dist/modules/customers/commands/interactions.js +48 -23
- package/dist/modules/customers/commands/interactions.js.map +3 -3
- package/dist/modules/customers/commands/people.js +3 -2
- package/dist/modules/customers/commands/people.js.map +2 -2
- package/dist/modules/customers/commands/shared.js +4 -0
- package/dist/modules/customers/commands/shared.js.map +2 -2
- package/dist/modules/customers/components/calendar/types.js.map +1 -1
- package/dist/modules/customers/components/detail/CompanyPeopleSection.js +81 -354
- package/dist/modules/customers/components/detail/CompanyPeopleSection.js.map +2 -2
- package/dist/modules/customers/components/detail/CreatePersonDialog.js +12 -11
- package/dist/modules/customers/components/detail/CreatePersonDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/DealForm.js +73 -5
- package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
- package/dist/modules/customers/components/detail/DealOwnerSelect.js +96 -0
- package/dist/modules/customers/components/detail/DealOwnerSelect.js.map +7 -0
- package/dist/modules/customers/components/detail/DealPeopleSection.js +206 -0
- package/dist/modules/customers/components/detail/DealPeopleSection.js.map +7 -0
- package/dist/modules/customers/components/detail/DealsSection.js +8 -14
- package/dist/modules/customers/components/detail/DealsSection.js.map +2 -2
- package/dist/modules/customers/components/detail/LinkedPeopleSection.js +342 -0
- package/dist/modules/customers/components/detail/LinkedPeopleSection.js.map +7 -0
- package/dist/modules/customers/components/detail/PersonCard.js +5 -2
- package/dist/modules/customers/components/detail/PersonCard.js.map +2 -2
- package/dist/modules/customers/components/detail/PersonEmailShareControl.js +190 -0
- package/dist/modules/customers/components/detail/PersonEmailShareControl.js.map +7 -0
- package/dist/modules/customers/components/detail/PersonEmailThreadsTab.js +17 -0
- package/dist/modules/customers/components/detail/PersonEmailThreadsTab.js.map +2 -2
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js +5 -2
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/create/CreateDealForm.js +19 -0
- package/dist/modules/customers/components/detail/create/CreateDealForm.js.map +2 -2
- package/dist/modules/customers/components/detail/create/DealDetailsFields.js +11 -0
- package/dist/modules/customers/components/detail/create/DealDetailsFields.js.map +2 -2
- package/dist/modules/customers/components/detail/create/DealSectionCard.js +2 -2
- package/dist/modules/customers/components/detail/create/DealSectionCard.js.map +2 -2
- package/dist/modules/customers/components/detail/create/dealFormTypes.js +1 -0
- package/dist/modules/customers/components/detail/create/dealFormTypes.js.map +2 -2
- package/dist/modules/customers/components/detail/schedule/useScheduleFormState.js +1 -1
- package/dist/modules/customers/components/detail/schedule/useScheduleFormState.js.map +2 -2
- package/dist/modules/customers/components/formConfig.js +2 -0
- package/dist/modules/customers/components/formConfig.js.map +2 -2
- package/dist/modules/customers/components/linking/LinkEntityDialog.js +8 -0
- package/dist/modules/customers/components/linking/LinkEntityDialog.js.map +2 -2
- package/dist/modules/customers/components/linking/adapters/personAdapter.js +3 -0
- package/dist/modules/customers/components/linking/adapters/personAdapter.js.map +2 -2
- package/dist/modules/customers/data/enrichers.js +40 -2
- package/dist/modules/customers/data/enrichers.js.map +2 -2
- package/dist/modules/customers/data/entities.js +56 -0
- package/dist/modules/customers/data/entities.js.map +2 -2
- package/dist/modules/customers/data/validators.js +11 -0
- package/dist/modules/customers/data/validators.js.map +2 -2
- package/dist/modules/customers/events.js +6 -1
- package/dist/modules/customers/events.js.map +2 -2
- package/dist/modules/customers/lib/assignableStaff.js +14 -0
- package/dist/modules/customers/lib/assignableStaff.js.map +2 -2
- package/dist/modules/customers/lib/calendar/editorPayload.js +17 -13
- package/dist/modules/customers/lib/calendar/editorPayload.js.map +2 -2
- package/dist/modules/customers/lib/calendar/mapItem.js +1 -0
- package/dist/modules/customers/lib/calendar/mapItem.js.map +2 -2
- package/dist/modules/customers/lib/conversationShares.js +126 -0
- package/dist/modules/customers/lib/conversationShares.js.map +7 -0
- package/dist/modules/customers/lib/dealsOrganizationScope.js +5 -3
- package/dist/modules/customers/lib/dealsOrganizationScope.js.map +2 -2
- package/dist/modules/customers/lib/interactionRequestContext.js +2 -1
- package/dist/modules/customers/lib/interactionRequestContext.js.map +2 -2
- package/dist/modules/customers/lib/link-channel-message-handler.js +19 -9
- package/dist/modules/customers/lib/link-channel-message-handler.js.map +2 -2
- package/dist/modules/customers/lib/personDetailCacheTags.js +32 -0
- package/dist/modules/customers/lib/personDetailCacheTags.js.map +7 -0
- package/dist/modules/customers/lib/personEmailThreads.js +26 -5
- package/dist/modules/customers/lib/personEmailThreads.js.map +2 -2
- package/dist/modules/customers/lib/reassignDealOwner.js +25 -0
- package/dist/modules/customers/lib/reassignDealOwner.js.map +7 -0
- package/dist/modules/customers/lib/userNames.js +26 -0
- package/dist/modules/customers/lib/userNames.js.map +7 -0
- package/dist/modules/customers/lib/visibilityFilter.js +70 -2
- package/dist/modules/customers/lib/visibilityFilter.js.map +2 -2
- package/dist/modules/customers/migrations/Migration20260825120000_customers.js +18 -0
- package/dist/modules/customers/migrations/Migration20260825120000_customers.js.map +7 -0
- package/dist/modules/customers/migrations/Migration20260825140000_customers.js +27 -0
- package/dist/modules/customers/migrations/Migration20260825140000_customers.js.map +7 -0
- package/dist/modules/customers/setup.js +1 -0
- package/dist/modules/customers/setup.js.map +2 -2
- package/dist/modules/customers/subscribers/channel-visibility-changed.js +16 -0
- package/dist/modules/customers/subscribers/channel-visibility-changed.js.map +7 -0
- package/dist/modules/dashboards/api/widgets/data/batch/route.js +3 -8
- package/dist/modules/dashboards/api/widgets/data/batch/route.js.map +2 -2
- package/dist/modules/dashboards/api/widgets/data/route.js +10 -15
- package/dist/modules/dashboards/api/widgets/data/route.js.map +2 -2
- package/dist/modules/dashboards/lib/aggregations.js +1 -1
- package/dist/modules/dashboards/lib/aggregations.js.map +2 -2
- package/dist/modules/dashboards/lib/widgetScope.js +2 -7
- package/dist/modules/dashboards/lib/widgetScope.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/cancel.js +4 -1
- package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +497 -329
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js +248 -113
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js.map +3 -3
- package/dist/modules/data_sync/components/useDataSyncRunAccess.js +17 -0
- package/dist/modules/data_sync/components/useDataSyncRunAccess.js.map +7 -0
- package/dist/modules/data_sync/lib/resume-point.js +21 -0
- package/dist/modules/data_sync/lib/resume-point.js.map +7 -0
- package/dist/modules/data_sync/lib/start-run.js +52 -2
- package/dist/modules/data_sync/lib/start-run.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-run-service.js +22 -33
- package/dist/modules/data_sync/lib/sync-run-service.js.map +3 -3
- package/dist/modules/devices/api/[id]/route.js +3 -2
- package/dist/modules/devices/api/[id]/route.js.map +2 -2
- package/dist/modules/devices/api/admin/devices/route.js +2 -1
- package/dist/modules/devices/api/admin/devices/route.js.map +2 -2
- package/dist/modules/devices/api/route.js +2 -1
- package/dist/modules/devices/api/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/route.js.map +2 -2
- package/dist/modules/dictionaries/api/context.js +2 -1
- package/dist/modules/dictionaries/api/context.js.map +2 -2
- package/dist/modules/dictionaries/api/route.js +4 -0
- package/dist/modules/dictionaries/api/route.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionariesManager.js +4 -3
- package/dist/modules/dictionaries/components/DictionariesManager.js.map +2 -2
- package/dist/modules/dictionaries/data/validators.js +3 -1
- package/dist/modules/dictionaries/data/validators.js.map +2 -2
- package/dist/modules/directory/api/organization-branding/route.js +10 -1
- package/dist/modules/directory/api/organization-branding/route.js.map +2 -2
- package/dist/modules/directory/api/organizations/route.js +1 -1
- package/dist/modules/directory/api/organizations/route.js.map +1 -1
- package/dist/modules/directory/backend/directory/branding/page.js +17 -4
- package/dist/modules/directory/backend/directory/branding/page.js.map +3 -3
- package/dist/modules/directory/commands/organizations.js +136 -74
- package/dist/modules/directory/commands/organizations.js.map +2 -2
- package/dist/modules/directory/lib/hierarchy.js +19 -1
- package/dist/modules/directory/lib/hierarchy.js.map +2 -2
- package/dist/modules/directory/utils/organizationScope.js +66 -12
- package/dist/modules/directory/utils/organizationScope.js.map +2 -2
- package/dist/modules/directory/utils/organizationScopeFilter.js +7 -4
- package/dist/modules/directory/utils/organizationScopeFilter.js.map +2 -2
- package/dist/modules/directory/utils/organizationScopeGuard.js +6 -2
- package/dist/modules/directory/utils/organizationScopeGuard.js.map +2 -2
- package/dist/modules/entities/api/encryption.js +68 -25
- package/dist/modules/entities/api/encryption.js.map +2 -2
- package/dist/modules/entities/api/records.js +9 -8
- package/dist/modules/entities/api/records.js.map +2 -2
- package/dist/modules/entities/cli.js +33 -22
- package/dist/modules/entities/cli.js.map +2 -2
- package/dist/modules/entities/data/entities.js +8 -0
- package/dist/modules/entities/data/entities.js.map +2 -2
- package/dist/modules/entities/lib/definition-scope.js +3 -1
- package/dist/modules/entities/lib/definition-scope.js.map +2 -2
- package/dist/modules/entities/lib/encryption-maps.js +117 -0
- package/dist/modules/entities/lib/encryption-maps.js.map +7 -0
- package/dist/modules/entities/lib/helpers.js +30 -6
- package/dist/modules/entities/lib/helpers.js.map +2 -2
- package/dist/modules/entities/migrations/Migration20260910120000.js +17 -0
- package/dist/modules/entities/migrations/Migration20260910120000.js.map +7 -0
- package/dist/modules/entities/migrations/Migration20261004120000_encryption_map_scope_uniqueness.js +130 -0
- package/dist/modules/entities/migrations/Migration20261004120000_encryption_map_scope_uniqueness.js.map +7 -0
- package/dist/modules/eudr/api/dashboard/widgets/compliance-overview/route.js +2 -1
- package/dist/modules/eudr/api/dashboard/widgets/compliance-overview/route.js.map +2 -2
- package/dist/modules/eudr/api/plots/import/route.js +2 -1
- package/dist/modules/eudr/api/plots/import/route.js.map +2 -2
- package/dist/modules/eudr/api/product-mappings/suggestions/apply/route.js +2 -1
- package/dist/modules/eudr/api/product-mappings/suggestions/apply/route.js.map +2 -2
- package/dist/modules/eudr/api/product-mappings/suggestions/route.js +2 -1
- package/dist/modules/eudr/api/product-mappings/suggestions/route.js.map +2 -2
- package/dist/modules/eudr/api/reports/annual/route.js +2 -1
- package/dist/modules/eudr/api/reports/annual/route.js.map +2 -2
- package/dist/modules/eudr/api/statements/[id]/export/route.js +2 -1
- package/dist/modules/eudr/api/statements/[id]/export/route.js.map +2 -2
- package/dist/modules/eudr/api/statements/[id]/readiness/route.js +2 -1
- package/dist/modules/eudr/api/statements/[id]/readiness/route.js.map +2 -2
- package/dist/modules/eudr/api/suppliers/compliance/route.js +2 -1
- package/dist/modules/eudr/api/suppliers/compliance/route.js.map +2 -2
- package/dist/modules/feature_toggles/commands/global.js +13 -13
- package/dist/modules/feature_toggles/commands/global.js.map +2 -2
- package/dist/modules/feature_toggles/lib/feature-flag-check.js +8 -2
- package/dist/modules/feature_toggles/lib/feature-flag-check.js.map +2 -2
- package/dist/modules/forms/acl.js +14 -0
- package/dist/modules/forms/acl.js.map +7 -0
- package/dist/modules/forms/api/[id]/analytics/route.js +113 -0
- package/dist/modules/forms/api/[id]/analytics/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/distributions/route.js +176 -0
- package/dist/modules/forms/api/[id]/distributions/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/route.js +225 -0
- package/dist/modules/forms/api/[id]/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/run/context/route.js +115 -0
- package/dist/modules/forms/api/[id]/run/context/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/run/submissions/route.js +109 -0
- package/dist/modules/forms/api/[id]/run/submissions/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/submissions/route.js +83 -0
- package/dist/modules/forms/api/[id]/submissions/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/theme-logo/route.js +117 -0
- package/dist/modules/forms/api/[id]/theme-logo/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/diff/route.js +125 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/diff/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/publish/route.js +99 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/publish/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/route.js +176 -0
- package/dist/modules/forms/api/[id]/versions/[versionId]/route.js.map +7 -0
- package/dist/modules/forms/api/[id]/versions/fork/route.js +92 -0
- package/dist/modules/forms/api/[id]/versions/fork/route.js.map +7 -0
- package/dist/modules/forms/api/attachment-helpers.js +111 -0
- package/dist/modules/forms/api/attachment-helpers.js.map +7 -0
- package/dist/modules/forms/api/by-key/[key]/active/route.js +140 -0
- package/dist/modules/forms/api/by-key/[key]/active/route.js.map +7 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/route.js +84 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/route.js.map +7 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/send/route.js +88 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/send/route.js.map +7 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/route.js +183 -0
- package/dist/modules/forms/api/distributions/[distributionId]/invitations/route.js.map +7 -0
- package/dist/modules/forms/api/distributions/[distributionId]/route.js +191 -0
- package/dist/modules/forms/api/distributions/[distributionId]/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/[id]/attachments/route.js +91 -0
- package/dist/modules/forms/api/form-submissions/[id]/attachments/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/[id]/resume-token/route.js +110 -0
- package/dist/modules/forms/api/form-submissions/[id]/resume-token/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/[id]/route.js +146 -0
- package/dist/modules/forms/api/form-submissions/[id]/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/[id]/submit/route.js +74 -0
- package/dist/modules/forms/api/form-submissions/[id]/submit/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/by-subject/[subject_type]/[subject_id]/route.js +76 -0
- package/dist/modules/forms/api/form-submissions/by-subject/[subject_type]/[subject_id]/route.js.map +7 -0
- package/dist/modules/forms/api/form-submissions/route.js +113 -0
- package/dist/modules/forms/api/form-submissions/route.js.map +7 -0
- package/dist/modules/forms/api/helpers.js +124 -0
- package/dist/modules/forms/api/helpers.js.map +7 -0
- package/dist/modules/forms/api/public/distributions/[slug]/embed-policy/route.js +47 -0
- package/dist/modules/forms/api/public/distributions/[slug]/embed-policy/route.js.map +7 -0
- package/dist/modules/forms/api/public/distributions/[slug]/route.js +81 -0
- package/dist/modules/forms/api/public/distributions/[slug]/route.js.map +7 -0
- package/dist/modules/forms/api/public/embed-loader/route.js +116 -0
- package/dist/modules/forms/api/public/embed-loader/route.js.map +7 -0
- package/dist/modules/forms/api/public/invitations/[token]/route.js +87 -0
- package/dist/modules/forms/api/public/invitations/[token]/route.js.map +7 -0
- package/dist/modules/forms/api/public/rate-limit.js +54 -0
- package/dist/modules/forms/api/public/rate-limit.js.map +7 -0
- package/dist/modules/forms/api/public/start/route.js +142 -0
- package/dist/modules/forms/api/public/start/route.js.map +7 -0
- package/dist/modules/forms/api/public/submissions/[id]/attachments/[attachmentId]/route.js +67 -0
- package/dist/modules/forms/api/public/submissions/[id]/attachments/[attachmentId]/route.js.map +7 -0
- package/dist/modules/forms/api/public/submissions/[id]/attachments/route.js +85 -0
- package/dist/modules/forms/api/public/submissions/[id]/attachments/route.js.map +7 -0
- package/dist/modules/forms/api/public/submissions/[id]/pdf/route.js +72 -0
- package/dist/modules/forms/api/public/submissions/[id]/pdf/route.js.map +7 -0
- package/dist/modules/forms/api/public/submissions/[id]/route.js +154 -0
- package/dist/modules/forms/api/public/submissions/[id]/route.js.map +7 -0
- package/dist/modules/forms/api/public/submissions/[id]/submit/route.js +127 -0
- package/dist/modules/forms/api/public/submissions/[id]/submit/route.js.map +7 -0
- package/dist/modules/forms/api/route.js +216 -0
- package/dist/modules/forms/api/route.js.map +7 -0
- package/dist/modules/forms/api/runtime-helpers.js +149 -0
- package/dist/modules/forms/api/runtime-helpers.js.map +7 -0
- package/dist/modules/forms/api/subjects/[subjectType]/[subjectId]/consents/route.js +137 -0
- package/dist/modules/forms/api/subjects/[subjectType]/[subjectId]/consents/route.js.map +7 -0
- package/dist/modules/forms/api/subjects/[subjectType]/[subjectId]/export/route.js +101 -0
- package/dist/modules/forms/api/subjects/[subjectType]/[subjectId]/export/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/access-audit/route.js +76 -0
- package/dist/modules/forms/api/submissions/[submissionId]/access-audit/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/actors/[actorId]/route.js +56 -0
- package/dist/modules/forms/api/submissions/[submissionId]/actors/[actorId]/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/actors/route.js +76 -0
- package/dist/modules/forms/api/submissions/[submissionId]/actors/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/anonymize/route.js +107 -0
- package/dist/modules/forms/api/submissions/[submissionId]/anonymize/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/attachments/[attachmentId]/route.js +73 -0
- package/dist/modules/forms/api/submissions/[submissionId]/attachments/[attachmentId]/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/export/route.js +90 -0
- package/dist/modules/forms/api/submissions/[submissionId]/export/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/pdf/route.js +91 -0
- package/dist/modules/forms/api/submissions/[submissionId]/pdf/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/reopen/route.js +55 -0
- package/dist/modules/forms/api/submissions/[submissionId]/reopen/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/revisions/route.js +61 -0
- package/dist/modules/forms/api/submissions/[submissionId]/revisions/route.js.map +7 -0
- package/dist/modules/forms/api/submissions/[submissionId]/route.js +75 -0
- package/dist/modules/forms/api/submissions/[submissionId]/route.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/FormStudio.js +2811 -0
- package/dist/modules/forms/backend/forms/[id]/FormStudio.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/analytics/page.js +214 -0
- package/dist/modules/forms/backend/forms/[id]/analytics/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/analytics/page.meta.js +19 -0
- package/dist/modules/forms/backend/forms/[id]/analytics/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/distributions/page.js +12 -0
- package/dist/modules/forms/backend/forms/[id]/distributions/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/distributions/page.meta.js +19 -0
- package/dist/modules/forms/backend/forms/[id]/distributions/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/history/page.js +152 -0
- package/dist/modules/forms/backend/forms/[id]/history/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/history/page.meta.js +15 -0
- package/dist/modules/forms/backend/forms/[id]/history/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/page.js +13 -0
- package/dist/modules/forms/backend/forms/[id]/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/page.meta.js +15 -0
- package/dist/modules/forms/backend/forms/[id]/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/YesNoRow.js +51 -0
- package/dist/modules/forms/backend/forms/[id]/studio/YesNoRow.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/autosave-guard.js +21 -0
- package/dist/modules/forms/backend/forms/[id]/studio/autosave-guard.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/DragOverlayCard.js +18 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/DragOverlayCard.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/DropIndicator.js +41 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/DropIndicator.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/FieldRow.js +277 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/FieldRow.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/FormCanvas.js +196 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/FormCanvas.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/GridSlot.js +151 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/GridSlot.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/SectionContainer.js +340 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/SectionContainer.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/grid-collision.js +24 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/grid-collision.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/keyboard-coordinates.js +91 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/keyboard-coordinates.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/overlay-size.js +11 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/overlay-size.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/resize-math.js +27 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/resize-math.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/row-layout.js +80 -0
- package/dist/modules/forms/backend/forms/[id]/studio/canvas/row-layout.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/ConditionBuilder.js +210 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/ConditionBuilder.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/HiddenFieldsPanel.js +91 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/HiddenFieldsPanel.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/JumpsEditor.js +201 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/JumpsEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/RecallTokenPicker.js +66 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/RecallTokenPicker.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/VariablesPanel.js +223 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/VariablesPanel.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/condition-model.js +151 -0
- package/dist/modules/forms/backend/forms/[id]/studio/logic/condition-model.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/lucide-icons.js +88 -0
- package/dist/modules/forms/backend/forms/[id]/studio/lucide-icons.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/FormAppearancePanel.js +493 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/FormAppearancePanel.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/FormPalettePanel.js +44 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/FormPalettePanel.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/InputParametersTab.js +350 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/InputParametersTab.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/PaletteCard.js +40 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/PaletteCard.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/RolesEditor.js +202 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/RolesEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/entries.js +66 -0
- package/dist/modules/forms/backend/forms/[id]/studio/palette/entries.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/preview/PreviewSurface.js +1200 -0
- package/dist/modules/forms/backend/forms/[id]/studio/preview/PreviewSurface.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/preview/ViewportFrame.js +34 -0
- package/dist/modules/forms/backend/forms/[id]/studio/preview/ViewportFrame.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/recall.js +76 -0
- package/dist/modules/forms/backend/forms/[id]/studio/recall.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/schema-helpers.js +1693 -0
- package/dist/modules/forms/backend/forms/[id]/studio/schema-helpers.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/BackgroundControl.js +127 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/BackgroundControl.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/ColorControl.js +181 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/ColorControl.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/contrast.js +75 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/contrast.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/presets.js +91 -0
- package/dist/modules/forms/backend/forms/[id]/studio/style/presets.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/type-label.js +11 -0
- package/dist/modules/forms/backend/forms/[id]/studio/type-label.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/types.js +1 -0
- package/dist/modules/forms/backend/forms/[id]/studio/types.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/undo-controller.js +43 -0
- package/dist/modules/forms/backend/forms/[id]/studio/undo-controller.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/FileConstraintsEditor.js +74 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/FileConstraintsEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/GroupConfigEditor.js +134 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/GroupConfigEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/LengthRangeEditor.js +61 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/LengthRangeEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MatrixColumnsEditor.js +149 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MatrixColumnsEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MatrixRowsEditor.js +168 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MatrixRowsEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MessageOverridesEditor.js +64 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/MessageOverridesEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/NpsAnchorsEditor.js +52 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/NpsAnchorsEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/NumberRangeEditor.js +59 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/NumberRangeEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/OpinionIconSelect.js +31 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/OpinionIconSelect.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/PatternEditor.js +105 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/PatternEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/RankingExhaustiveSwitch.js +15 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/RankingExhaustiveSwitch.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/SignatureConfigEditor.js +75 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/SignatureConfigEditor.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/ValidationPanel.js +293 -0
- package/dist/modules/forms/backend/forms/[id]/studio/validation/ValidationPanel.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/components/RowBadges.js +42 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/components/RowBadges.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/components/SubmissionDrawer.js +473 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/components/SubmissionDrawer.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/page.js +208 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/page.meta.js +12 -0
- package/dist/modules/forms/backend/forms/[id]/submissions/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/create/page.js +101 -0
- package/dist/modules/forms/backend/forms/create/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/create/page.meta.js +15 -0
- package/dist/modules/forms/backend/forms/create/page.meta.js.map +7 -0
- package/dist/modules/forms/backend/forms/page.js +227 -0
- package/dist/modules/forms/backend/forms/page.js.map +7 -0
- package/dist/modules/forms/backend/forms/page.meta.js +33 -0
- package/dist/modules/forms/backend/forms/page.meta.js.map +7 -0
- package/dist/modules/forms/commands/distribution.js +417 -0
- package/dist/modules/forms/commands/distribution.js.map +7 -0
- package/dist/modules/forms/commands/form-version.js +640 -0
- package/dist/modules/forms/commands/form-version.js.map +7 -0
- package/dist/modules/forms/commands/form.js +406 -0
- package/dist/modules/forms/commands/form.js.map +7 -0
- package/dist/modules/forms/commands/index.js +11 -0
- package/dist/modules/forms/commands/index.js.map +7 -0
- package/dist/modules/forms/commands/invitation.js +329 -0
- package/dist/modules/forms/commands/invitation.js.map +7 -0
- package/dist/modules/forms/commands/shared.js +151 -0
- package/dist/modules/forms/commands/shared.js.map +7 -0
- package/dist/modules/forms/commands/submission.js +132 -0
- package/dist/modules/forms/commands/submission.js.map +7 -0
- package/dist/modules/forms/data/entities.js +654 -0
- package/dist/modules/forms/data/entities.js.map +7 -0
- package/dist/modules/forms/data/validators.js +254 -0
- package/dist/modules/forms/data/validators.js.map +7 -0
- package/dist/modules/forms/di.js +199 -0
- package/dist/modules/forms/di.js.map +7 -0
- package/dist/modules/forms/encryption.js +15 -0
- package/dist/modules/forms/encryption.js.map +7 -0
- package/dist/modules/forms/events-payloads.js +81 -0
- package/dist/modules/forms/events-payloads.js.map +7 -0
- package/dist/modules/forms/events.js +33 -0
- package/dist/modules/forms/events.js.map +7 -0
- package/dist/modules/forms/extension-points.js +36 -0
- package/dist/modules/forms/extension-points.js.map +7 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.js +33 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.js.map +7 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.meta.js +11 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.meta.js.map +7 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.js +41 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.js.map +7 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.meta.js +11 -0
- package/dist/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.meta.js.map +7 -0
- package/dist/modules/forms/frontend/embed/[slug]/page.js +105 -0
- package/dist/modules/forms/frontend/embed/[slug]/page.js.map +7 -0
- package/dist/modules/forms/frontend/embed/[slug]/page.meta.js +11 -0
- package/dist/modules/forms/frontend/embed/[slug]/page.meta.js.map +7 -0
- package/dist/modules/forms/frontend/f/[slug]/page.js +12 -0
- package/dist/modules/forms/frontend/f/[slug]/page.js.map +7 -0
- package/dist/modules/forms/frontend/f/[slug]/page.meta.js +11 -0
- package/dist/modules/forms/frontend/f/[slug]/page.meta.js.map +7 -0
- package/dist/modules/forms/frontend/forms/[id]/run/page.js +62 -0
- package/dist/modules/forms/frontend/forms/[id]/run/page.js.map +7 -0
- package/dist/modules/forms/frontend/forms/[id]/run/page.meta.js +11 -0
- package/dist/modules/forms/frontend/forms/[id]/run/page.meta.js.map +7 -0
- package/dist/modules/forms/frontend/i/[token]/page.js +12 -0
- package/dist/modules/forms/frontend/i/[token]/page.js.map +7 -0
- package/dist/modules/forms/frontend/i/[token]/page.meta.js +11 -0
- package/dist/modules/forms/frontend/i/[token]/page.meta.js.map +7 -0
- package/dist/modules/forms/index.js +20 -0
- package/dist/modules/forms/index.js.map +7 -0
- package/dist/modules/forms/lib/embed-frame-policy.js +68 -0
- package/dist/modules/forms/lib/embed-frame-policy.js.map +7 -0
- package/dist/modules/forms/lib/form-definition-slicing.js +38 -0
- package/dist/modules/forms/lib/form-definition-slicing.js.map +7 -0
- package/dist/modules/forms/lib/log-redaction.js +38 -0
- package/dist/modules/forms/lib/log-redaction.js.map +7 -0
- package/dist/modules/forms/lib/navigable-url.js +24 -0
- package/dist/modules/forms/lib/navigable-url.js.map +7 -0
- package/dist/modules/forms/lib/retention.js +20 -0
- package/dist/modules/forms/lib/retention.js.map +7 -0
- package/dist/modules/forms/lib/runtime-principal.js +59 -0
- package/dist/modules/forms/lib/runtime-principal.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260508135459_forms.js +17 -0
- package/dist/modules/forms/migrations/Migration20260508135459_forms.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260508140932_forms.js +23 -0
- package/dist/modules/forms/migrations/Migration20260508140932_forms.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260508155737_forms.js +15 -0
- package/dist/modules/forms/migrations/Migration20260508155737_forms.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260520120000_forms.js +23 -0
- package/dist/modules/forms/migrations/Migration20260520120000_forms.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260521090000_forms.js +13 -0
- package/dist/modules/forms/migrations/Migration20260521090000_forms.js.map +7 -0
- package/dist/modules/forms/migrations/Migration20260521120000_forms.js +17 -0
- package/dist/modules/forms/migrations/Migration20260521120000_forms.js.map +7 -0
- package/dist/modules/forms/runner/FormRunner.js +786 -0
- package/dist/modules/forms/runner/FormRunner.js.map +7 -0
- package/dist/modules/forms/runner/MatrixField.js +150 -0
- package/dist/modules/forms/runner/MatrixField.js.map +7 -0
- package/dist/modules/forms/runner/RankingField.js +131 -0
- package/dist/modules/forms/runner/RankingField.js.map +7 -0
- package/dist/modules/forms/runner/ScaleField.js +78 -0
- package/dist/modules/forms/runner/ScaleField.js.map +7 -0
- package/dist/modules/forms/runner/SignatureField.js +132 -0
- package/dist/modules/forms/runner/SignatureField.js.map +7 -0
- package/dist/modules/forms/runner/tamper-check.js +85 -0
- package/dist/modules/forms/runner/tamper-check.js.map +7 -0
- package/dist/modules/forms/schema/address-countries.js +43 -0
- package/dist/modules/forms/schema/address-countries.js.map +7 -0
- package/dist/modules/forms/schema/field-type-patterns.js +15 -0
- package/dist/modules/forms/schema/field-type-patterns.js.map +7 -0
- package/dist/modules/forms/schema/field-type-registry-advanced.js +32 -0
- package/dist/modules/forms/schema/field-type-registry-advanced.js.map +7 -0
- package/dist/modules/forms/schema/field-type-registry.js +625 -0
- package/dist/modules/forms/schema/field-type-registry.js.map +7 -0
- package/dist/modules/forms/schema/file-field.js +64 -0
- package/dist/modules/forms/schema/file-field.js.map +7 -0
- package/dist/modules/forms/schema/group-field.js +143 -0
- package/dist/modules/forms/schema/group-field.js.map +7 -0
- package/dist/modules/forms/schema/jsonlogic-grammar.js +66 -0
- package/dist/modules/forms/schema/jsonlogic-grammar.js.map +7 -0
- package/dist/modules/forms/schema/jsonschema-extensions.js +739 -0
- package/dist/modules/forms/schema/jsonschema-extensions.js.map +7 -0
- package/dist/modules/forms/schema/layout-catalog.js +38 -0
- package/dist/modules/forms/schema/layout-catalog.js.map +7 -0
- package/dist/modules/forms/schema/signature-field.js +67 -0
- package/dist/modules/forms/schema/signature-field.js.map +7 -0
- package/dist/modules/forms/schema/style-extensions.js +77 -0
- package/dist/modules/forms/schema/style-extensions.js.map +7 -0
- package/dist/modules/forms/schema/style-validators.js +181 -0
- package/dist/modules/forms/schema/style-validators.js.map +7 -0
- package/dist/modules/forms/services/access-audit-logger.js +179 -0
- package/dist/modules/forms/services/access-audit-logger.js.map +7 -0
- package/dist/modules/forms/services/analytics-service.js +306 -0
- package/dist/modules/forms/services/analytics-service.js.map +7 -0
- package/dist/modules/forms/services/anonymize-service.js +123 -0
- package/dist/modules/forms/services/anonymize-service.js.map +7 -0
- package/dist/modules/forms/services/attachment-service.js +123 -0
- package/dist/modules/forms/services/attachment-service.js.map +7 -0
- package/dist/modules/forms/services/captcha-verifier.js +76 -0
- package/dist/modules/forms/services/captcha-verifier.js.map +7 -0
- package/dist/modules/forms/services/consent-record-service.js +96 -0
- package/dist/modules/forms/services/consent-record-service.js.map +7 -0
- package/dist/modules/forms/services/distribution-service.js +366 -0
- package/dist/modules/forms/services/distribution-service.js.map +7 -0
- package/dist/modules/forms/services/distribution-token.js +93 -0
- package/dist/modules/forms/services/distribution-token.js.map +7 -0
- package/dist/modules/forms/services/encryption-service.js +328 -0
- package/dist/modules/forms/services/encryption-service.js.map +7 -0
- package/dist/modules/forms/services/export-service.js +210 -0
- package/dist/modules/forms/services/export-service.js.map +7 -0
- package/dist/modules/forms/services/field-validation-service.js +168 -0
- package/dist/modules/forms/services/field-validation-service.js.map +7 -0
- package/dist/modules/forms/services/form-logic-evaluator.js +517 -0
- package/dist/modules/forms/services/form-logic-evaluator.js.map +7 -0
- package/dist/modules/forms/services/form-version-compiler.js +518 -0
- package/dist/modules/forms/services/form-version-compiler.js.map +7 -0
- package/dist/modules/forms/services/form-version-differ.js +89 -0
- package/dist/modules/forms/services/form-version-differ.js.map +7 -0
- package/dist/modules/forms/services/jsonlogic-evaluator.js +171 -0
- package/dist/modules/forms/services/jsonlogic-evaluator.js.map +7 -0
- package/dist/modules/forms/services/pdf-snapshot-service.js +526 -0
- package/dist/modules/forms/services/pdf-snapshot-service.js.map +7 -0
- package/dist/modules/forms/services/prefill-resolver.js +53 -0
- package/dist/modules/forms/services/prefill-resolver.js.map +7 -0
- package/dist/modules/forms/services/role-policy-service.js +55 -0
- package/dist/modules/forms/services/role-policy-service.js.map +7 -0
- package/dist/modules/forms/services/style-compiler.js +234 -0
- package/dist/modules/forms/services/style-compiler.js.map +7 -0
- package/dist/modules/forms/services/submission-service.js +858 -0
- package/dist/modules/forms/services/submission-service.js.map +7 -0
- package/dist/modules/forms/services/upload-scanner.js +9 -0
- package/dist/modules/forms/services/upload-scanner.js.map +7 -0
- package/dist/modules/forms/services/upload-validation.js +54 -0
- package/dist/modules/forms/services/upload-validation.js.map +7 -0
- package/dist/modules/forms/services/visibility-resolver.js +30 -0
- package/dist/modules/forms/services/visibility-resolver.js.map +7 -0
- package/dist/modules/forms/setup.js +18 -0
- package/dist/modules/forms/setup.js.map +7 -0
- package/dist/modules/forms/subscribers/forms-consent-projector.js +58 -0
- package/dist/modules/forms/subscribers/forms-consent-projector.js.map +7 -0
- package/dist/modules/forms/subscribers/forms-pdf-snapshot.js +68 -0
- package/dist/modules/forms/subscribers/forms-pdf-snapshot.js.map +7 -0
- package/dist/modules/forms/subscribers/forms-webhook-bridge-anonymized.js +29 -0
- package/dist/modules/forms/subscribers/forms-webhook-bridge-anonymized.js.map +7 -0
- package/dist/modules/forms/subscribers/forms-webhook-bridge.js +35 -0
- package/dist/modules/forms/subscribers/forms-webhook-bridge.js.map +7 -0
- package/dist/modules/forms/subscribers/invitation-email.js +100 -0
- package/dist/modules/forms/subscribers/invitation-email.js.map +7 -0
- package/dist/modules/forms/translations.js +10 -0
- package/dist/modules/forms/translations.js.map +7 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/CreateDistributionDialog.js +376 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/CreateDistributionDialog.js.map +7 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/DistributionsPanel.js +313 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/DistributionsPanel.js.map +7 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/EmbedSettingsDialog.js +263 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/EmbedSettingsDialog.js.map +7 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/RecipientsTable.js +373 -0
- package/dist/modules/forms/ui/admin/forms/[id]/distributions/RecipientsTable.js.map +7 -0
- package/dist/modules/forms/ui/public/EmbeddedForm.js +166 -0
- package/dist/modules/forms/ui/public/EmbeddedForm.js.map +7 -0
- package/dist/modules/forms/ui/public/FormRunner.js +359 -0
- package/dist/modules/forms/ui/public/FormRunner.js.map +7 -0
- package/dist/modules/forms/ui/public/FormTrigger.js +45 -0
- package/dist/modules/forms/ui/public/FormTrigger.js.map +7 -0
- package/dist/modules/forms/ui/public/PublicFormRunnerPage.js +14 -0
- package/dist/modules/forms/ui/public/PublicFormRunnerPage.js.map +7 -0
- package/dist/modules/forms/ui/public/components/CompletionScreen.js +55 -0
- package/dist/modules/forms/ui/public/components/CompletionScreen.js.map +7 -0
- package/dist/modules/forms/ui/public/components/LocaleSwitch.js +28 -0
- package/dist/modules/forms/ui/public/components/LocaleSwitch.js.map +7 -0
- package/dist/modules/forms/ui/public/components/ResumeGate.js +52 -0
- package/dist/modules/forms/ui/public/components/ResumeGate.js.map +7 -0
- package/dist/modules/forms/ui/public/components/ReviewStep.js +90 -0
- package/dist/modules/forms/ui/public/components/ReviewStep.js.map +7 -0
- package/dist/modules/forms/ui/public/components/SaveIndicator.js +65 -0
- package/dist/modules/forms/ui/public/components/SaveIndicator.js.map +7 -0
- package/dist/modules/forms/ui/public/components/SectionStepper.js +52 -0
- package/dist/modules/forms/ui/public/components/SectionStepper.js.map +7 -0
- package/dist/modules/forms/ui/public/index.js +38 -0
- package/dist/modules/forms/ui/public/index.js.map +7 -0
- package/dist/modules/forms/ui/public/renderers/index.js +737 -0
- package/dist/modules/forms/ui/public/renderers/index.js.map +7 -0
- package/dist/modules/forms/ui/public/state/logic-derivation.js +42 -0
- package/dist/modules/forms/ui/public/state/logic-derivation.js.map +7 -0
- package/dist/modules/forms/ui/public/state/runtime-client.js +306 -0
- package/dist/modules/forms/ui/public/state/runtime-client.js.map +7 -0
- package/dist/modules/forms/ui/public/state/useAutosave.js +64 -0
- package/dist/modules/forms/ui/public/state/useAutosave.js.map +7 -0
- package/dist/modules/forms/ui/public/state/useFormRunner.js +394 -0
- package/dist/modules/forms/ui/public/state/useFormRunner.js.map +7 -0
- package/dist/modules/forms/ui/public/style/LogoHeader.js +33 -0
- package/dist/modules/forms/ui/public/style/LogoHeader.js.map +7 -0
- package/dist/modules/forms/ui/public/style/applyStyle.js +12 -0
- package/dist/modules/forms/ui/public/style/applyStyle.js.map +7 -0
- package/dist/modules/forms/ui/public/types.js +18 -0
- package/dist/modules/forms/ui/public/types.js.map +7 -0
- package/dist/modules/forms/widgets/injection/access-audit-panel/widget.js +100 -0
- package/dist/modules/forms/widgets/injection/access-audit-panel/widget.js.map +7 -0
- package/dist/modules/forms/widgets/injection/anonymize-button/widget.js +148 -0
- package/dist/modules/forms/widgets/injection/anonymize-button/widget.js.map +7 -0
- package/dist/modules/forms/widgets/injection/audit-format.js +33 -0
- package/dist/modules/forms/widgets/injection/audit-format.js.map +7 -0
- package/dist/modules/forms/widgets/injection/context.js +5 -0
- package/dist/modules/forms/widgets/injection/context.js.map +7 -0
- package/dist/modules/forms/widgets/injection/embedded-form/widget.js +52 -0
- package/dist/modules/forms/widgets/injection/embedded-form/widget.js.map +7 -0
- package/dist/modules/forms/widgets/injection/pdf-download-button/widget.js +83 -0
- package/dist/modules/forms/widgets/injection/pdf-download-button/widget.js.map +7 -0
- package/dist/modules/forms/widgets/injection/self-audit-footer/widget.js +38 -0
- package/dist/modules/forms/widgets/injection/self-audit-footer/widget.js.map +7 -0
- package/dist/modules/forms/widgets/injection-table.js +32 -0
- package/dist/modules/forms/widgets/injection-table.js.map +7 -0
- package/dist/modules/forms/workers/pdf-snapshot.js +60 -0
- package/dist/modules/forms/workers/pdf-snapshot.js.map +7 -0
- package/dist/modules/forms/workers/retention-purge.js +112 -0
- package/dist/modules/forms/workers/retention-purge.js.map +7 -0
- package/dist/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.js +7 -1
- package/dist/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.js.map +2 -2
- package/dist/modules/inbox_ops/data/validators.js +2 -2
- package/dist/modules/inbox_ops/data/validators.js.map +2 -2
- package/dist/modules/inbox_ops/lib/llmProvider.js +5 -1
- package/dist/modules/inbox_ops/lib/llmProvider.js.map +2 -2
- package/dist/modules/inbox_ops/widgets/notifications/ProposalCreatedRenderer.js +2 -2
- package/dist/modules/inbox_ops/widgets/notifications/ProposalCreatedRenderer.js.map +2 -2
- package/dist/modules/integrations/di.js +3 -1
- package/dist/modules/integrations/di.js.map +2 -2
- package/dist/modules/integrations/lib/credentials-service.js +29 -36
- package/dist/modules/integrations/lib/credentials-service.js.map +2 -2
- package/dist/modules/messages/api/[id]/attachments/route.js +7 -3
- package/dist/modules/messages/api/[id]/attachments/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/forward-preview/route.js +4 -3
- package/dist/modules/messages/api/[id]/forward-preview/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/route.js +29 -3
- package/dist/modules/messages/api/[id]/route.js.map +2 -2
- package/dist/modules/messages/api/route.js +91 -2
- package/dist/modules/messages/api/route.js.map +2 -2
- package/dist/modules/messages/commands/messages.js +40 -6
- package/dist/modules/messages/commands/messages.js.map +2 -2
- package/dist/modules/messages/components/ComposeMessagePageClient.js +24 -1
- package/dist/modules/messages/components/ComposeMessagePageClient.js.map +2 -2
- package/dist/modules/messages/data/validators.js +11 -1
- package/dist/modules/messages/data/validators.js.map +2 -2
- package/dist/modules/messages/lib/channelThreadAccess.js +30 -0
- package/dist/modules/messages/lib/channelThreadAccess.js.map +7 -0
- package/dist/modules/messages/lib/composeSenderDelegation.js +87 -0
- package/dist/modules/messages/lib/composeSenderDelegation.js.map +7 -0
- package/dist/modules/messages/lib/composeSenderOptions.js +24 -0
- package/dist/modules/messages/lib/composeSenderOptions.js.map +7 -0
- package/dist/modules/messages/lib/email-sender.js +1 -11
- package/dist/modules/messages/lib/email-sender.js.map +2 -2
- package/dist/modules/messages/lib/forwarding.js +4 -4
- package/dist/modules/messages/lib/forwarding.js.map +2 -2
- package/dist/modules/messages/lib/markdownEmailBody.js +15 -0
- package/dist/modules/messages/lib/markdownEmailBody.js.map +7 -0
- package/dist/modules/messages/lib/messageSourceEntityTypes.js +7 -0
- package/dist/modules/messages/lib/messageSourceEntityTypes.js.map +7 -0
- package/dist/modules/messages/lib/routeHelpers.js +43 -0
- package/dist/modules/messages/lib/routeHelpers.js.map +2 -2
- package/dist/modules/messages/subscribers/message-notification.js +30 -1
- package/dist/modules/messages/subscribers/message-notification.js.map +2 -2
- package/dist/modules/notifications/api/[id]/action/route.js +2 -1
- package/dist/modules/notifications/api/[id]/action/route.js.map +2 -2
- package/dist/modules/notifications/api/openapi.js +2 -1
- package/dist/modules/notifications/api/openapi.js.map +2 -2
- package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js +47 -28
- package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js.map +2 -2
- package/dist/modules/notifications/lib/deliveryConfig.js +27 -2
- package/dist/modules/notifications/lib/deliveryConfig.js.map +2 -2
- package/dist/modules/notifications/lib/notificationMapper.js +3 -1
- package/dist/modules/notifications/lib/notificationMapper.js.map +2 -2
- package/dist/modules/notifications/lib/safeHref.js +4 -0
- package/dist/modules/notifications/lib/safeHref.js.map +2 -2
- package/dist/modules/planner/api/availability-date-specific.js +2 -1
- package/dist/modules/planner/api/availability-date-specific.js.map +2 -2
- package/dist/modules/planner/api/availability-weekly.js +2 -1
- package/dist/modules/planner/api/availability-weekly.js.map +2 -2
- package/dist/modules/progress/api/active/route.js +14 -2
- package/dist/modules/progress/api/active/route.js.map +2 -2
- package/dist/modules/progress/api/jobs/[id]/route.js +38 -22
- package/dist/modules/progress/api/jobs/[id]/route.js.map +2 -2
- package/dist/modules/progress/api/jobs/route.js +20 -6
- package/dist/modules/progress/api/jobs/route.js.map +2 -2
- package/dist/modules/progress/api/requestScope.js +32 -0
- package/dist/modules/progress/api/requestScope.js.map +7 -0
- package/dist/modules/progress/lib/organizationScope.js +10 -0
- package/dist/modules/progress/lib/organizationScope.js.map +7 -0
- package/dist/modules/progress/lib/progressService.js.map +2 -2
- package/dist/modules/progress/lib/progressServiceImpl.js +48 -15
- package/dist/modules/progress/lib/progressServiceImpl.js.map +2 -2
- package/dist/modules/push_notifications/api/custom-send/route.js +4 -1
- package/dist/modules/push_notifications/api/custom-send/route.js.map +2 -2
- package/dist/modules/query_index/api/status.js +5 -3
- package/dist/modules/query_index/api/status.js.map +2 -2
- package/dist/modules/query_index/di.js +2 -1
- package/dist/modules/query_index/di.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +2 -1
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/lib/request-encryption.js +16 -0
- package/dist/modules/query_index/lib/request-encryption.js.map +7 -0
- package/dist/modules/query_index/lib/search-tokens.js +31 -1
- package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/assign/route.js +2 -1
- package/dist/modules/resources/api/resources/tags/assign/route.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/unassign/route.js +2 -1
- package/dist/modules/resources/api/resources/tags/unassign/route.js.map +2 -2
- package/dist/modules/resources/commands/activities.js +2 -2
- package/dist/modules/resources/commands/activities.js.map +2 -2
- package/dist/modules/sales/api/document-history/route.js +5 -1
- package/dist/modules/sales/api/document-history/route.js.map +2 -2
- package/dist/modules/sales/api/document-numbers/route.js +2 -1
- package/dist/modules/sales/api/document-numbers/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/convert/route.js +2 -1
- package/dist/modules/sales/api/quotes/convert/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/send/route.js +2 -1
- package/dist/modules/sales/api/quotes/send/route.js.map +2 -2
- package/dist/modules/sales/api/settings/document-numbers/route.js +7 -1
- package/dist/modules/sales/api/settings/document-numbers/route.js.map +2 -2
- package/dist/modules/sales/api/settings/order-editing/route.js +7 -1
- package/dist/modules/sales/api/settings/order-editing/route.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +354 -138
- package/dist/modules/sales/commands/documents.js.map +3 -3
- package/dist/modules/sales/commands/payments.js +2 -1
- package/dist/modules/sales/commands/payments.js.map +2 -2
- package/dist/modules/sales/commands/settings.js +25 -5
- package/dist/modules/sales/commands/settings.js.map +2 -2
- package/dist/modules/sales/commands/shipments.js +2 -1
- package/dist/modules/sales/commands/shipments.js.map +2 -2
- package/dist/modules/sales/components/DocumentNumberSettings.js +32 -21
- package/dist/modules/sales/components/DocumentNumberSettings.js.map +2 -2
- package/dist/modules/sales/components/documents/ItemsSection.js +49 -11
- package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/LineItemDialog.js +159 -81
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/lineItemUtils.js +7 -0
- package/dist/modules/sales/components/documents/lineItemUtils.js.map +2 -2
- package/dist/modules/sales/lib/lineSnapshots.js +19 -0
- package/dist/modules/sales/lib/lineSnapshots.js.map +2 -2
- package/dist/modules/sales/setup.js +4 -4
- package/dist/modules/sales/setup.js.map +2 -2
- package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js +2 -2
- package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js.map +2 -2
- package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js +2 -2
- package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +2 -1
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +2 -1
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests.js +2 -1
- package/dist/modules/staff/api/leave-requests.js.map +2 -2
- package/dist/modules/staff/api/team-members/self/route.js +2 -1
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +2 -1
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +2 -1
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js +12 -11
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +2 -1
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/route.js +2 -1
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-work/route.js +2 -1
- package/dist/modules/staff/api/timesheets/my-work/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +2 -1
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js +2 -1
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js +3 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js +3 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js +3 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/preview/route.js +2 -1
- package/dist/modules/staff/api/timesheets/reports/preview/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/shared.js +2 -1
- package/dist/modules/staff/api/timesheets/reports/shared.js.map +2 -2
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js +2 -1
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js +2 -1
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js +2 -1
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js +2 -1
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js +2 -1
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js +3 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js +3 -2
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +3 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js +3 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/route.js +2 -1
- package/dist/modules/staff/api/timesheets/time-projects/route.js.map +2 -2
- package/dist/modules/staff/commands/activities.js +2 -2
- package/dist/modules/staff/commands/activities.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-reports.js +55 -14
- package/dist/modules/staff/commands/timesheets-reports.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js +2 -1
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js +32 -3
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-reports/reportPeriod.js +16 -0
- package/dist/modules/staff/lib/timesheets-reports/reportPeriod.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CalendarPicker.js +15 -10
- package/dist/modules/staff/lib/timesheets-ui/CalendarPicker.js.map +2 -2
- package/dist/modules/sync_excel/api/import/route.js +35 -12
- package/dist/modules/sync_excel/api/import/route.js.map +2 -2
- package/dist/modules/sync_excel/api/upload/route.js +29 -4
- package/dist/modules/sync_excel/api/upload/route.js.map +2 -2
- package/dist/modules/translations/api/context.js +2 -1
- package/dist/modules/translations/api/context.js.map +2 -2
- package/dist/modules/warranty_claims/api/ai/assess/route.js +2 -1
- package/dist/modules/warranty_claims/api/ai/assess/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/ai/draft-reply/route.js +2 -1
- package/dist/modules/warranty_claims/api/ai/draft-reply/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/ai/suggest/route.js +2 -1
- package/dist/modules/warranty_claims/api/ai/suggest/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/assign/route.js +2 -1
- package/dist/modules/warranty_claims/api/assign/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/credit-memo/route.js +2 -1
- package/dist/modules/warranty_claims/api/credit-memo/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/entitlement/route.js +2 -1
- package/dist/modules/warranty_claims/api/entitlement/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/events/route.js +2 -1
- package/dist/modules/warranty_claims/api/events/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/external/claims/route.js +2 -1
- package/dist/modules/warranty_claims/api/external/claims/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/receiving/route.js +2 -1
- package/dist/modules/warranty_claims/api/receiving/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/replacement-order/route.js +2 -1
- package/dist/modules/warranty_claims/api/replacement-order/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/return-label/route.js +2 -1
- package/dist/modules/warranty_claims/api/return-label/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/risk/route.js +2 -1
- package/dist/modules/warranty_claims/api/risk/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/sales-return/route.js +2 -1
- package/dist/modules/warranty_claims/api/sales-return/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/settings-general/route.js +2 -1
- package/dist/modules/warranty_claims/api/settings-general/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/stats/route.js +9 -5
- package/dist/modules/warranty_claims/api/stats/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/submit/route.js +2 -1
- package/dist/modules/warranty_claims/api/submit/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/transition/route.js +2 -1
- package/dist/modules/warranty_claims/api/transition/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/vendor-recovery/route.js +2 -1
- package/dist/modules/warranty_claims/api/vendor-recovery/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/vendor-recovery-suggestions/route.js +2 -1
- package/dist/modules/warranty_claims/api/vendor-recovery-suggestions/route.js.map +2 -2
- package/dist/modules/warranty_claims/widgets/notifications/WarrantyClaimNotificationRenderer.js +1 -1
- package/dist/modules/warranty_claims/widgets/notifications/WarrantyClaimNotificationRenderer.js.map +2 -2
- package/dist/modules/wms/api/dashboard/operational/route.js +2 -1
- package/dist/modules/wms/api/dashboard/operational/route.js.map +2 -2
- package/dist/modules/wms/api/inventory/cycle-count/route.js +1 -0
- package/dist/modules/wms/api/inventory/cycle-count/route.js.map +2 -2
- package/dist/modules/wms/api/inventory/helpers.js +2 -1
- package/dist/modules/wms/api/inventory/helpers.js.map +2 -2
- package/dist/modules/wms/api/inventory/import/helpers.js +2 -1
- package/dist/modules/wms/api/inventory/import/helpers.js.map +2 -2
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js +2 -1
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js.map +2 -2
- package/dist/modules/wms/commands/inventory-actions.js +39 -1
- package/dist/modules/wms/commands/inventory-actions.js.map +2 -2
- package/dist/modules/wms/components/backend/CycleCountWizardDialog.js +14 -1
- package/dist/modules/wms/components/backend/CycleCountWizardDialog.js.map +2 -2
- package/dist/modules/wms/di.js +5 -0
- package/dist/modules/wms/di.js.map +2 -2
- package/dist/modules/wms/lib/availabilityCache.js +86 -0
- package/dist/modules/wms/lib/availabilityCache.js.map +7 -0
- package/dist/modules/wms/lib/availabilityCalculation.js +212 -0
- package/dist/modules/wms/lib/availabilityCalculation.js.map +7 -0
- package/dist/modules/wms/lib/availabilityProvider.js +24 -0
- package/dist/modules/wms/lib/availabilityProvider.js.map +7 -0
- package/dist/modules/wms/lib/loadOperationalDashboard.js +42 -5
- package/dist/modules/wms/lib/loadOperationalDashboard.js.map +2 -2
- package/dist/modules/wms/lib/lowStockBalanceFilter.js +23 -10
- package/dist/modules/wms/lib/lowStockBalanceFilter.js.map +2 -2
- package/dist/modules/wms/lib/sqlInClause.js +9 -0
- package/dist/modules/wms/lib/sqlInClause.js.map +7 -0
- package/dist/modules/wms/lib/tryResolve.js +11 -0
- package/dist/modules/wms/lib/tryResolve.js.map +7 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache-policy.js +14 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache-policy.js.map +7 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache-profile.js +14 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache-profile.js.map +7 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache.js +16 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache.js.map +7 -0
- package/dist/modules/wms/widgets/notifications/WmsLowStockRenderer.js +2 -2
- package/dist/modules/wms/widgets/notifications/WmsLowStockRenderer.js.map +2 -2
- package/dist/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.js +4 -3
- package/dist/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.js.map +2 -2
- package/dist/modules/workflows/api/commands/route.js +4 -1
- package/dist/modules/workflows/api/commands/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/callers/route.js +4 -1
- package/dist/modules/workflows/api/definitions/[id]/callers/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/context-schema/route.js +4 -2
- package/dist/modules/workflows/api/definitions/[id]/context-schema/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/customize/route.js +4 -1
- package/dist/modules/workflows/api/definitions/[id]/customize/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/draft/route.js +6 -1
- package/dist/modules/workflows/api/definitions/[id]/draft/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/publish/route.js +6 -1
- package/dist/modules/workflows/api/definitions/[id]/publish/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/reset-to-code/route.js +4 -1
- package/dist/modules/workflows/api/definitions/[id]/reset-to-code/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/route.js +5 -3
- package/dist/modules/workflows/api/definitions/[id]/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/test-step/route.js +4 -2
- package/dist/modules/workflows/api/definitions/[id]/test-step/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/generate/route.js +4 -1
- package/dist/modules/workflows/api/definitions/generate/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/route.js +4 -2
- package/dist/modules/workflows/api/definitions/route.js.map +2 -2
- package/dist/modules/workflows/api/endpoints/route.js +4 -1
- package/dist/modules/workflows/api/endpoints/route.js.map +2 -2
- package/dist/modules/workflows/api/functions/route.js +4 -1
- package/dist/modules/workflows/api/functions/route.js.map +2 -2
- package/dist/modules/workflows/api/grantable-features/route.js +2 -1
- package/dist/modules/workflows/api/grantable-features/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/advance/route.js +4 -1
- package/dist/modules/workflows/api/instances/[id]/advance/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/cancel/route.js +4 -1
- package/dist/modules/workflows/api/instances/[id]/cancel/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/context/route.js +2 -1
- package/dist/modules/workflows/api/instances/[id]/context/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/rerun-step/route.js +4 -1
- package/dist/modules/workflows/api/instances/[id]/rerun-step/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/retry/route.js +4 -1
- package/dist/modules/workflows/api/instances/[id]/retry/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/signal/route.js +4 -1
- package/dist/modules/workflows/api/instances/[id]/signal/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/step-through/route.js +4 -2
- package/dist/modules/workflows/api/instances/[id]/step-through/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/route.js +4 -2
- package/dist/modules/workflows/api/instances/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/validate-start/route.js +4 -1
- package/dist/modules/workflows/api/instances/validate-start/route.js.map +2 -2
- package/dist/modules/workflows/api/rule-usage/route.js +4 -1
- package/dist/modules/workflows/api/rule-usage/route.js.map +2 -2
- package/dist/modules/workflows/api/signals/route.js +4 -1
- package/dist/modules/workflows/api/signals/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/claim/route.js +4 -1
- package/dist/modules/workflows/api/tasks/[id]/claim/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/complete/route.js +4 -1
- package/dist/modules/workflows/api/tasks/[id]/complete/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/reassign/route.js +2 -1
- package/dist/modules/workflows/api/tasks/[id]/reassign/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/unclaim/route.js +4 -1
- package/dist/modules/workflows/api/tasks/[id]/unclaim/route.js.map +2 -2
- package/dist/modules/workflows/api/templates/route.js +4 -1
- package/dist/modules/workflows/api/templates/route.js.map +2 -2
- package/dist/modules/workflows/api/work-inbox/next/route.js +4 -1
- package/dist/modules/workflows/api/work-inbox/next/route.js.map +2 -2
- package/dist/modules/workflows/lib/activity-executor.js +87 -20
- package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
- package/dist/modules/workflows/lib/activity-types.js +4 -4
- package/dist/modules/workflows/lib/activity-types.js.map +2 -2
- package/dist/modules/workflows/lib/activity-worker-handler.js +16 -11
- package/dist/modules/workflows/lib/activity-worker-handler.js.map +2 -2
- package/dist/modules/workflows/lib/event-trigger-service.js +8 -1
- package/dist/modules/workflows/lib/event-trigger-service.js.map +2 -2
- package/dist/modules/workflows/lib/step-handler.js +4 -4
- package/dist/modules/workflows/lib/step-handler.js.map +2 -2
- package/dist/test-utils/transactionalEntityManagerDouble.js +37 -0
- package/dist/test-utils/transactionalEntityManagerDouble.js.map +7 -0
- package/generated/entities/availability_policy/index.ts +19 -0
- package/generated/entities/communication_channel/index.ts +1 -0
- package/generated/entities/customer_email_conversation_share/index.ts +9 -0
- package/generated/entities/customer_group/index.ts +15 -0
- package/generated/entities/customer_group_membership/index.ts +13 -0
- package/generated/entities/customer_group_terms/index.ts +15 -0
- package/generated/entities/customer_interaction/index.ts +1 -0
- package/generated/entities/form/index.ts +16 -0
- package/generated/entities/form_access_audit/index.ts +9 -0
- package/generated/entities/form_attachment/index.ts +13 -0
- package/generated/entities/form_consent_record/index.ts +17 -0
- package/generated/entities/form_distribution/index.ts +22 -0
- package/generated/entities/form_invitation/index.ts +23 -0
- package/generated/entities/form_submission/index.ts +18 -0
- package/generated/entities/form_submission_actor/index.ts +10 -0
- package/generated/entities/form_submission_revision/index.ts +13 -0
- package/generated/entities/form_version/index.ts +17 -0
- package/generated/entities/forms_encryption_key/index.ts +6 -0
- package/generated/entities.ids.generated.ts +27 -2
- package/generated/entity-fields-registry.ts +269 -0
- package/package.json +18 -7
- package/src/helpers/integration/communicationChannelsFixtures.ts +43 -0
- package/src/helpers/integration/customerGroupsFixtures.ts +171 -0
- package/src/helpers/integration/formsFixtures.ts +757 -0
- package/src/modules/api_docs/api/get/version.ts +28 -11
- package/src/modules/api_keys/api/keys/route.ts +89 -199
- package/src/modules/api_keys/backend/api-keys/create/page.tsx +2 -2
- package/src/modules/api_keys/commands/keys.ts +172 -0
- package/src/modules/api_keys/i18n/de.json +1 -0
- package/src/modules/api_keys/i18n/en.json +1 -0
- package/src/modules/api_keys/i18n/es.json +1 -0
- package/src/modules/api_keys/i18n/ko.json +1 -0
- package/src/modules/api_keys/i18n/pl.json +1 -0
- package/src/modules/api_keys/services/apiKeyService.ts +82 -49
- package/src/modules/attachments/api/file/[id]/route.ts +9 -4
- package/src/modules/attachments/api/image/[id]/[[...slug]]/route.ts +6 -4
- package/src/modules/attachments/api/route.ts +10 -4
- package/src/modules/attachments/components/AttachmentLibrary.tsx +16 -5
- package/src/modules/attachments/lib/access.ts +1 -3
- package/src/modules/attachments/lib/requestScope.ts +35 -3
- package/src/modules/audit_logs/api/audit-logs/actions/export/route.ts +6 -1
- package/src/modules/audit_logs/api/audit-logs/actions/redo/route.ts +41 -6
- package/src/modules/audit_logs/api/audit-logs/actions/route.ts +6 -1
- package/src/modules/audit_logs/api/audit-logs/actions/undo/route.ts +39 -4
- package/src/modules/audit_logs/data/validators.ts +1 -0
- package/src/modules/audit_logs/lib/actorSubject.ts +82 -0
- package/src/modules/audit_logs/lib/replayAuthorization.ts +61 -0
- package/src/modules/audit_logs/services/actionLogService.ts +191 -47
- package/src/modules/auth/api/features.ts +1 -1
- package/src/modules/auth/cli.ts +31 -17
- package/src/modules/auth/commands/acl.ts +26 -36
- package/src/modules/auth/commands/interceptors.ts +23 -0
- package/src/modules/auth/commands/roles.ts +475 -148
- package/src/modules/auth/commands/users.ts +693 -81
- package/src/modules/auth/i18n/de.json +22 -0
- package/src/modules/auth/i18n/en.json +22 -0
- package/src/modules/auth/i18n/es.json +22 -0
- package/src/modules/auth/i18n/ko.json +22 -0
- package/src/modules/auth/i18n/pl.json +22 -0
- package/src/modules/auth/lib/authorizationStateLocks.ts +340 -0
- package/src/modules/auth/lib/commandReplay.ts +194 -0
- package/src/modules/auth/lib/executionPrincipal.ts +36 -28
- package/src/modules/auth/lib/grantChecks.ts +10 -2
- package/src/modules/auth/lib/setup-app.ts +97 -50
- package/src/modules/auth/lib/tokenHash.ts +16 -1
- package/src/modules/auth/services/rbacService.ts +578 -6
- package/src/modules/availability/acl.ts +12 -0
- package/src/modules/availability/api/check/route.ts +136 -0
- package/src/modules/availability/api/openapi.ts +28 -0
- package/src/modules/availability/api/policies/resolve-preview/route.ts +83 -0
- package/src/modules/availability/api/policies/route.ts +244 -0
- package/src/modules/availability/backend/availability/check/page.meta.ts +12 -0
- package/src/modules/availability/backend/availability/check/page.tsx +223 -0
- package/src/modules/availability/backend/availability/policies/ResolutionPreviewPanel.tsx +112 -0
- package/src/modules/availability/backend/availability/policies/ScopeFields.tsx +55 -0
- package/src/modules/availability/backend/availability/policies/StockManagedField.tsx +37 -0
- package/src/modules/availability/backend/availability/policies/[id]/page.meta.ts +8 -0
- package/src/modules/availability/backend/availability/policies/[id]/page.tsx +202 -0
- package/src/modules/availability/backend/availability/policies/create/page.meta.ts +8 -0
- package/src/modules/availability/backend/availability/policies/create/page.tsx +131 -0
- package/src/modules/availability/backend/availability/policies/formGroups.ts +83 -0
- package/src/modules/availability/backend/availability/policies/page.meta.ts +12 -0
- package/src/modules/availability/backend/availability/policies/page.tsx +232 -0
- package/src/modules/availability/backend/availability/policies/policyPayload.ts +29 -0
- package/src/modules/availability/commands/policies.ts +430 -0
- package/src/modules/availability/commands/scope.ts +26 -0
- package/src/modules/availability/data/entities.ts +93 -0
- package/src/modules/availability/data/validators.ts +87 -0
- package/src/modules/availability/di.ts +68 -0
- package/src/modules/availability/events.ts +17 -0
- package/src/modules/availability/i18n/de.json +92 -0
- package/src/modules/availability/i18n/en.json +92 -0
- package/src/modules/availability/i18n/es.json +92 -0
- package/src/modules/availability/i18n/ko.json +92 -0
- package/src/modules/availability/i18n/pl.json +92 -0
- package/src/modules/availability/index.ts +13 -0
- package/src/modules/availability/lib/catalogTarget.ts +72 -0
- package/src/modules/availability/lib/organizationScope.ts +18 -0
- package/src/modules/availability/lib/policyResolution.ts +289 -0
- package/src/modules/availability/lib/tryResolve.ts +8 -0
- package/src/modules/availability/migrations/.snapshot-open-mercato.json +375 -0
- package/src/modules/availability/migrations/Migration20260922095844_availability.ts +13 -0
- package/src/modules/availability/migrations/Migration20260930120000_availability.ts +22 -0
- package/src/modules/availability/setup.ts +10 -0
- package/src/modules/catalog/api/categories/bulk-create/route.ts +119 -0
- package/src/modules/catalog/api/categories/route.ts +70 -8
- package/src/modules/catalog/api/products/bulk-create/route.ts +119 -0
- package/src/modules/catalog/api/products/route.ts +55 -24
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +8 -16
- package/src/modules/catalog/backend/catalog/products/create/page.tsx +16 -10
- package/src/modules/catalog/commands/categories.ts +1 -0
- package/src/modules/catalog/commands/productDeleteChildren.ts +557 -0
- package/src/modules/catalog/commands/products.ts +69 -24
- package/src/modules/catalog/components/PriceKindSettings.tsx +6 -20
- package/src/modules/catalog/components/products/ProductUomSection.tsx +26 -37
- package/src/modules/catalog/components/products/productForm.ts +6 -4
- package/src/modules/catalog/data/validators.ts +22 -0
- package/src/modules/catalog/di.ts +2 -1
- package/src/modules/catalog/events.ts +9 -3
- package/src/modules/catalog/i18n/de.json +40 -0
- package/src/modules/catalog/i18n/en.json +40 -0
- package/src/modules/catalog/i18n/es.json +40 -0
- package/src/modules/catalog/i18n/ko.json +40 -0
- package/src/modules/catalog/i18n/pl.json +40 -0
- package/src/modules/catalog/lib/bulkCreateCategories.ts +349 -0
- package/src/modules/catalog/lib/bulkCreateCheckpoint.ts +176 -0
- package/src/modules/catalog/lib/bulkCreateMutationGuards.ts +62 -0
- package/src/modules/catalog/lib/bulkCreateProducts.ts +340 -0
- package/src/modules/catalog/lib/bulkDelete.ts +10 -14
- package/src/modules/catalog/lib/catalogQueue.ts +14 -0
- package/src/modules/catalog/lib/currencyOptions.ts +28 -0
- package/src/modules/catalog/lib/productSearch.ts +16 -0
- package/src/modules/catalog/lib/seeds.ts +2 -43
- package/src/modules/catalog/lib/unitLabels.ts +52 -0
- package/src/modules/catalog/migrations/Migration20260914120000.ts +51 -0
- package/src/modules/catalog/migrations/Migration20260914120100.ts +50 -0
- package/src/modules/catalog/workers/catalog-category-bulk-create.ts +48 -0
- package/src/modules/catalog/workers/catalog-product-bulk-create.ts +48 -0
- package/src/modules/communication_channels/acl.ts +8 -0
- package/src/modules/communication_channels/api/get/me/channels/route.ts +4 -0
- package/src/modules/communication_channels/api/get/oauth/[provider]/callback/route.ts +23 -0
- package/src/modules/communication_channels/api/post/channels/[id]/import-history/route.ts +3 -4
- package/src/modules/communication_channels/api/post/channels/[id]/test-send/route.ts +9 -1
- package/src/modules/communication_channels/api/post/channels/connect/credentials/route.ts +4 -6
- package/src/modules/communication_channels/api/post/channels/connect/tenant-credentials/route.ts +4 -6
- package/src/modules/communication_channels/api/post/test-seed/route.ts +109 -24
- package/src/modules/communication_channels/api/put/channels/[id]/visibility/route.ts +165 -0
- package/src/modules/communication_channels/backend/profile/communication-channels/page.tsx +247 -129
- package/src/modules/communication_channels/commands/ingest-inbound-message.ts +2 -1
- package/src/modules/communication_channels/commands/set-channel-visibility.ts +138 -0
- package/src/modules/communication_channels/data/enrichers.ts +42 -19
- package/src/modules/communication_channels/data/entities.ts +21 -0
- package/src/modules/communication_channels/di.ts +9 -0
- package/src/modules/communication_channels/events.ts +7 -0
- package/src/modules/communication_channels/i18n/de.json +16 -3
- package/src/modules/communication_channels/i18n/en.json +16 -3
- package/src/modules/communication_channels/i18n/es.json +16 -3
- package/src/modules/communication_channels/i18n/ko.json +16 -3
- package/src/modules/communication_channels/i18n/pl.json +16 -3
- package/src/modules/communication_channels/index.ts +1 -1
- package/src/modules/communication_channels/lib/access-control.ts +4 -1
- package/src/modules/communication_channels/lib/adapter.ts +16 -6
- package/src/modules/communication_channels/lib/channel-thread-access.ts +133 -0
- package/src/modules/communication_channels/lib/credential-refresh.ts +27 -5
- package/src/modules/communication_channels/lib/inbound-message-origin.ts +62 -0
- package/src/modules/communication_channels/lib/oauth-state.ts +96 -1
- package/src/modules/communication_channels/lib/outbound-delivery-intent.ts +57 -0
- package/src/modules/communication_channels/lib/send-as-user.ts +2 -2
- package/src/modules/communication_channels/migrations/.snapshot-open-mercato.json +18 -1
- package/src/modules/communication_channels/migrations/Migration20260825141000_communication_channels.ts +22 -0
- package/src/modules/communication_channels/setup.ts +4 -0
- package/src/modules/communication_channels/subscribers/outbound-bridge.ts +34 -9
- package/src/modules/communication_channels/workers/gmail-history-sync.ts +1 -1
- package/src/modules/communication_channels/workers/poll-channel.ts +1 -1
- package/src/modules/communication_channels/workers/reaction-processor.ts +2 -2
- package/src/modules/configs/api/upgrade-actions/route.ts +2 -1
- package/src/modules/configs/cli.ts +2 -2
- package/src/modules/configs/i18n/de.json +2 -0
- package/src/modules/configs/i18n/en.json +2 -0
- package/src/modules/configs/i18n/es.json +2 -0
- package/src/modules/configs/i18n/ko.json +2 -0
- package/src/modules/configs/i18n/pl.json +2 -0
- package/src/modules/configs/lib/upgrade-actions.ts +29 -6
- package/src/modules/configs/services/upgradeActionsService.ts +45 -30
- package/src/modules/currencies/api/currencies/route.ts +11 -5
- package/src/modules/currencies/api/exchange-rates/route.ts +11 -5
- package/src/modules/customer_groups/acl.ts +10 -0
- package/src/modules/customer_groups/api/customer-groups/[id]/terms/route.ts +355 -0
- package/src/modules/customer_groups/api/customer-groups/crud.ts +627 -0
- package/src/modules/customer_groups/api/customer-groups/explain-terms/route.ts +195 -0
- package/src/modules/customer_groups/api/customer-groups/memberships/crud.ts +525 -0
- package/src/modules/customer_groups/api/customer-groups/memberships/route.ts +65 -0
- package/src/modules/customer_groups/api/customer-groups/reconcile/adopt/route.ts +150 -0
- package/src/modules/customer_groups/api/customer-groups/reconcile/route.ts +90 -0
- package/src/modules/customer_groups/api/customer-groups/reorder/route.ts +147 -0
- package/src/modules/customer_groups/api/customer-groups/route.ts +65 -0
- package/src/modules/customer_groups/api/openapi.ts +28 -0
- package/src/modules/customer_groups/backend/customer-groups/[id]/edit/page.meta.ts +12 -0
- package/src/modules/customer_groups/backend/customer-groups/[id]/edit/page.tsx +392 -0
- package/src/modules/customer_groups/backend/customer-groups/create/page.meta.ts +25 -0
- package/src/modules/customer_groups/backend/customer-groups/create/page.tsx +279 -0
- package/src/modules/customer_groups/backend/customer-groups/orphans/page.meta.ts +12 -0
- package/src/modules/customer_groups/backend/customer-groups/orphans/page.tsx +216 -0
- package/src/modules/customer_groups/backend/customer-groups/page.meta.ts +11 -0
- package/src/modules/customer_groups/backend/customer-groups/page.tsx +478 -0
- package/src/modules/customer_groups/cli.ts +87 -0
- package/src/modules/customer_groups/commands/reorderGroups.ts +163 -0
- package/src/modules/customer_groups/components/CustomerGroupDefaultField.tsx +55 -0
- package/src/modules/customer_groups/components/CustomerGroupParentField.tsx +194 -0
- package/src/modules/customer_groups/components/CustomerGroupTermsPriceKindField.tsx +111 -0
- package/src/modules/customer_groups/components/CustomerGroupTermsSection.tsx +273 -0
- package/src/modules/customer_groups/components/GroupPickerField.tsx +142 -0
- package/src/modules/customer_groups/components/OrphanBanner.tsx +92 -0
- package/src/modules/customer_groups/components/customerGroupTree.ts +84 -0
- package/src/modules/customer_groups/data/entities.ts +244 -0
- package/src/modules/customer_groups/data/validators.ts +232 -0
- package/src/modules/customer_groups/di.ts +25 -0
- package/src/modules/customer_groups/events.ts +22 -0
- package/src/modules/customer_groups/i18n/de.json +199 -0
- package/src/modules/customer_groups/i18n/en.json +199 -0
- package/src/modules/customer_groups/i18n/es.json +199 -0
- package/src/modules/customer_groups/i18n/ko.json +199 -0
- package/src/modules/customer_groups/i18n/pl.json +199 -0
- package/src/modules/customer_groups/index.ts +13 -0
- package/src/modules/customer_groups/lib/createConflictRecheck.ts +39 -0
- package/src/modules/customer_groups/lib/customerScope.ts +145 -0
- package/src/modules/customer_groups/lib/groupEvents.ts +50 -0
- package/src/modules/customer_groups/lib/priceKindScope.ts +22 -0
- package/src/modules/customer_groups/lib/reconcile.ts +299 -0
- package/src/modules/customer_groups/migrations/.snapshot-open-mercato.json +905 -0
- package/src/modules/customer_groups/migrations/Migration20260922095316_customer_groups.ts +26 -0
- package/src/modules/customer_groups/migrations/Migration20260922103033_customer_groups.ts +22 -0
- package/src/modules/customer_groups/migrations/Migration20260922105444_customer_groups.ts +17 -0
- package/src/modules/customer_groups/migrations/Migration20260923193330_customer_groups.ts +20 -0
- package/src/modules/customer_groups/migrations/Migration20260929083000_customer_groups.ts +21 -0
- package/src/modules/customer_groups/services/customerGroupsService.ts +358 -0
- package/src/modules/customer_groups/setup.ts +11 -0
- package/src/modules/customer_groups/widgets/injection/group-picker-field/widget.ts +41 -0
- package/src/modules/customer_groups/widgets/injection/person-groups-explain-terms.tsx +227 -0
- package/src/modules/customer_groups/widgets/injection/person-groups-tab/widget.ts +21 -0
- package/src/modules/customer_groups/widgets/injection/person-groups-tab.tsx +573 -0
- package/src/modules/customer_groups/widgets/injection-table.ts +35 -0
- package/src/modules/customers/acl.ts +13 -0
- package/src/modules/customers/api/activities/route.ts +10 -0
- package/src/modules/customers/api/companies/[id]/people/route.ts +2 -1
- package/src/modules/customers/api/companies/[id]/route.ts +20 -6
- package/src/modules/customers/api/deals/[id]/companies/route.ts +2 -1
- package/src/modules/customers/api/deals/[id]/people/route.ts +84 -4
- package/src/modules/customers/api/deals/map/route.ts +11 -10
- package/src/modules/customers/api/dictionaries/context.ts +2 -1
- package/src/modules/customers/api/entity-roles-factory.ts +3 -2
- package/src/modules/customers/api/interactions/[id]/visibility/route.ts +2 -1
- package/src/modules/customers/api/interactions/cancel/route.ts +2 -1
- package/src/modules/customers/api/interactions/complete/route.ts +2 -1
- package/src/modules/customers/api/interactions/conflicts/route.ts +10 -10
- package/src/modules/customers/api/interactions/counts/route.ts +25 -7
- package/src/modules/customers/api/interactions/route.ts +34 -10
- package/src/modules/customers/api/labels/assign/route.ts +2 -1
- package/src/modules/customers/api/labels/route.ts +3 -2
- package/src/modules/customers/api/labels/unassign/route.ts +2 -1
- package/src/modules/customers/api/people/[id]/companies/context.ts +11 -2
- package/src/modules/customers/api/people/[id]/email-share/route.ts +276 -0
- package/src/modules/customers/api/people/[id]/email-threads/route.ts +14 -1
- package/src/modules/customers/api/people/[id]/emails/route.ts +2 -1
- package/src/modules/customers/api/people/[id]/route.ts +31 -22
- package/src/modules/customers/api/people/check-phone/route.ts +2 -1
- package/src/modules/customers/api/pipeline-stages/reorder/route.ts +3 -2
- package/src/modules/customers/api/pipeline-stages/route.ts +3 -3
- package/src/modules/customers/api/pipelines/route.ts +3 -3
- package/src/modules/customers/api/settings/address-format/route.ts +2 -1
- package/src/modules/customers/api/settings/dictionary-sort-modes/route.ts +2 -1
- package/src/modules/customers/api/settings/stuck-threshold/route.ts +2 -1
- package/src/modules/customers/api/tags/assign/route.ts +2 -1
- package/src/modules/customers/api/tags/unassign/route.ts +2 -1
- package/src/modules/customers/backend/customers/companies/[id]/page.tsx +4 -2
- package/src/modules/customers/backend/customers/deals/[id]/hooks/useDealAssociations.ts +10 -35
- package/src/modules/customers/backend/customers/deals/[id]/page.tsx +21 -18
- package/src/modules/customers/backend/customers/deals/components/ReassignOwnerDialog.tsx +115 -0
- package/src/modules/customers/backend/customers/deals/page.tsx +121 -1
- package/src/modules/customers/backend/customers/people/[id]/page.tsx +4 -2
- package/src/modules/customers/commands/addresses.ts +117 -15
- package/src/modules/customers/commands/companies.ts +10 -4
- package/src/modules/customers/commands/emailConversationShares.ts +261 -0
- package/src/modules/customers/commands/index.ts +1 -0
- package/src/modules/customers/commands/interactions.ts +61 -21
- package/src/modules/customers/commands/people.ts +3 -2
- package/src/modules/customers/commands/shared.ts +4 -0
- package/src/modules/customers/components/calendar/types.ts +1 -1
- package/src/modules/customers/components/detail/CompanyPeopleSection.tsx +97 -399
- package/src/modules/customers/components/detail/CreatePersonDialog.tsx +39 -19
- package/src/modules/customers/components/detail/DealForm.tsx +118 -5
- package/src/modules/customers/components/detail/DealOwnerSelect.tsx +161 -0
- package/src/modules/customers/components/detail/DealPeopleSection.tsx +256 -0
- package/src/modules/customers/components/detail/DealsSection.tsx +8 -14
- package/src/modules/customers/components/detail/LinkedPeopleSection.tsx +474 -0
- package/src/modules/customers/components/detail/PersonCard.tsx +12 -4
- package/src/modules/customers/components/detail/PersonEmailShareControl.tsx +273 -0
- package/src/modules/customers/components/detail/PersonEmailThreadsTab.tsx +26 -0
- package/src/modules/customers/components/detail/ScheduleActivityDialog.tsx +10 -2
- package/src/modules/customers/components/detail/create/CreateDealForm.tsx +30 -0
- package/src/modules/customers/components/detail/create/DealDetailsFields.tsx +12 -0
- package/src/modules/customers/components/detail/create/DealSectionCard.tsx +7 -2
- package/src/modules/customers/components/detail/create/dealFormTypes.ts +3 -0
- package/src/modules/customers/components/detail/schedule/useScheduleFormState.ts +16 -4
- package/src/modules/customers/components/formConfig.tsx +3 -0
- package/src/modules/customers/components/linking/LinkEntityDialog.tsx +8 -0
- package/src/modules/customers/components/linking/adapters/personAdapter.tsx +4 -0
- package/src/modules/customers/data/enrichers.ts +64 -5
- package/src/modules/customers/data/entities.ts +105 -1
- package/src/modules/customers/data/validators.ts +22 -0
- package/src/modules/customers/events.ts +5 -0
- package/src/modules/customers/i18n/de.json +49 -13
- package/src/modules/customers/i18n/en.json +44 -8
- package/src/modules/customers/i18n/es.json +44 -8
- package/src/modules/customers/i18n/ko.json +44 -8
- package/src/modules/customers/i18n/pl.json +44 -8
- package/src/modules/customers/lib/assignableStaff.ts +17 -0
- package/src/modules/customers/lib/calendar/editorPayload.ts +20 -13
- package/src/modules/customers/lib/calendar/mapItem.ts +1 -0
- package/src/modules/customers/lib/conversationShares.ts +250 -0
- package/src/modules/customers/lib/dealsOrganizationScope.ts +5 -3
- package/src/modules/customers/lib/interactionRequestContext.ts +2 -1
- package/src/modules/customers/lib/link-channel-message-handler.ts +27 -4
- package/src/modules/customers/lib/personDetailCacheTags.ts +68 -0
- package/src/modules/customers/lib/personEmailThreads.ts +61 -6
- package/src/modules/customers/lib/reassignDealOwner.ts +51 -0
- package/src/modules/customers/lib/userNames.ts +39 -0
- package/src/modules/customers/lib/visibilityFilter.ts +170 -3
- package/src/modules/customers/migrations/.snapshot-open-mercato.json +240 -0
- package/src/modules/customers/migrations/Migration20260825120000_customers.ts +19 -0
- package/src/modules/customers/migrations/Migration20260825140000_customers.ts +41 -0
- package/src/modules/customers/setup.ts +1 -0
- package/src/modules/customers/subscribers/channel-visibility-changed.ts +50 -0
- package/src/modules/dashboards/api/widgets/data/batch/route.ts +3 -8
- package/src/modules/dashboards/api/widgets/data/route.ts +12 -18
- package/src/modules/dashboards/lib/aggregations.ts +1 -1
- package/src/modules/dashboards/lib/widgetScope.ts +2 -7
- package/src/modules/data_sync/AGENTS.md +35 -1
- package/src/modules/data_sync/api/runs/[id]/cancel.ts +5 -1
- package/src/modules/data_sync/backend/data-sync/page.tsx +292 -19
- package/src/modules/data_sync/backend/data-sync/runs/[id]/page.tsx +205 -21
- package/src/modules/data_sync/components/useDataSyncRunAccess.ts +27 -0
- package/src/modules/data_sync/i18n/de.json +24 -0
- package/src/modules/data_sync/i18n/en.json +24 -0
- package/src/modules/data_sync/i18n/es.json +24 -0
- package/src/modules/data_sync/i18n/ko.json +24 -0
- package/src/modules/data_sync/i18n/pl.json +24 -0
- package/src/modules/data_sync/lib/adapter.ts +37 -0
- package/src/modules/data_sync/lib/resume-point.ts +63 -0
- package/src/modules/data_sync/lib/start-run.ts +61 -2
- package/src/modules/data_sync/lib/sync-run-service.ts +27 -34
- package/src/modules/devices/api/[id]/route.ts +3 -2
- package/src/modules/devices/api/admin/devices/route.ts +2 -1
- package/src/modules/devices/api/route.ts +2 -1
- package/src/modules/dictionaries/api/[dictionaryId]/route.ts +3 -5
- package/src/modules/dictionaries/api/context.ts +2 -1
- package/src/modules/dictionaries/api/route.ts +4 -0
- package/src/modules/dictionaries/components/DictionariesManager.tsx +4 -3
- package/src/modules/dictionaries/data/validators.ts +9 -1
- package/src/modules/dictionaries/i18n/de.json +3 -3
- package/src/modules/dictionaries/i18n/en.json +3 -3
- package/src/modules/dictionaries/i18n/es.json +3 -3
- package/src/modules/dictionaries/i18n/ko.json +3 -3
- package/src/modules/dictionaries/i18n/pl.json +3 -3
- package/src/modules/directory/api/organization-branding/route.ts +10 -1
- package/src/modules/directory/api/organizations/route.ts +1 -1
- package/src/modules/directory/backend/directory/branding/page.tsx +24 -2
- package/src/modules/directory/commands/organizations.ts +173 -80
- package/src/modules/directory/i18n/de.json +1 -0
- package/src/modules/directory/i18n/en.json +1 -0
- package/src/modules/directory/i18n/es.json +1 -0
- package/src/modules/directory/i18n/ko.json +1 -0
- package/src/modules/directory/i18n/pl.json +1 -0
- package/src/modules/directory/lib/hierarchy.ts +22 -1
- package/src/modules/directory/utils/organizationScope.ts +102 -15
- package/src/modules/directory/utils/organizationScopeFilter.ts +6 -3
- package/src/modules/directory/utils/organizationScopeGuard.ts +9 -5
- package/src/modules/entities/api/encryption.ts +73 -27
- package/src/modules/entities/api/records.ts +9 -8
- package/src/modules/entities/cli.ts +46 -24
- package/src/modules/entities/data/entities.ts +15 -0
- package/src/modules/entities/lib/definition-scope.ts +5 -1
- package/src/modules/entities/lib/encryption-maps.ts +164 -0
- package/src/modules/entities/lib/helpers.ts +95 -8
- package/src/modules/entities/migrations/.snapshot-open-mercato.json +21 -0
- package/src/modules/entities/migrations/.snapshot-openmercato.json +12 -0
- package/src/modules/entities/migrations/Migration20260910120000.ts +42 -0
- package/src/modules/entities/migrations/Migration20261004120000_encryption_map_scope_uniqueness.ts +130 -0
- package/src/modules/eudr/api/dashboard/widgets/compliance-overview/route.ts +2 -1
- package/src/modules/eudr/api/plots/import/route.ts +2 -1
- package/src/modules/eudr/api/product-mappings/suggestions/apply/route.ts +2 -1
- package/src/modules/eudr/api/product-mappings/suggestions/route.ts +2 -1
- package/src/modules/eudr/api/reports/annual/route.ts +2 -1
- package/src/modules/eudr/api/statements/[id]/export/route.ts +2 -1
- package/src/modules/eudr/api/statements/[id]/readiness/route.ts +2 -1
- package/src/modules/eudr/api/suppliers/compliance/route.ts +2 -1
- package/src/modules/feature_toggles/commands/global.ts +18 -15
- package/src/modules/feature_toggles/lib/feature-flag-check.ts +8 -3
- package/src/modules/forms/acl.ts +10 -0
- package/src/modules/forms/api/[id]/analytics/route.ts +137 -0
- package/src/modules/forms/api/[id]/distributions/route.ts +192 -0
- package/src/modules/forms/api/[id]/route.ts +245 -0
- package/src/modules/forms/api/[id]/run/context/route.ts +142 -0
- package/src/modules/forms/api/[id]/run/submissions/route.ts +147 -0
- package/src/modules/forms/api/[id]/submissions/route.ts +100 -0
- package/src/modules/forms/api/[id]/theme-logo/route.ts +147 -0
- package/src/modules/forms/api/[id]/versions/[versionId]/diff/route.ts +137 -0
- package/src/modules/forms/api/[id]/versions/[versionId]/publish/route.ts +108 -0
- package/src/modules/forms/api/[id]/versions/[versionId]/route.ts +200 -0
- package/src/modules/forms/api/[id]/versions/fork/route.ts +98 -0
- package/src/modules/forms/api/attachment-helpers.ts +160 -0
- package/src/modules/forms/api/by-key/[key]/active/route.ts +165 -0
- package/src/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/route.ts +92 -0
- package/src/modules/forms/api/distributions/[distributionId]/invitations/[invitationId]/send/route.ts +96 -0
- package/src/modules/forms/api/distributions/[distributionId]/invitations/route.ts +207 -0
- package/src/modules/forms/api/distributions/[distributionId]/route.ts +213 -0
- package/src/modules/forms/api/form-submissions/[id]/attachments/route.ts +114 -0
- package/src/modules/forms/api/form-submissions/[id]/resume-token/route.ts +140 -0
- package/src/modules/forms/api/form-submissions/[id]/route.ts +176 -0
- package/src/modules/forms/api/form-submissions/[id]/submit/route.ts +91 -0
- package/src/modules/forms/api/form-submissions/by-subject/[subject_type]/[subject_id]/route.ts +93 -0
- package/src/modules/forms/api/form-submissions/route.ts +133 -0
- package/src/modules/forms/api/helpers.ts +175 -0
- package/src/modules/forms/api/public/distributions/[slug]/embed-policy/route.ts +74 -0
- package/src/modules/forms/api/public/distributions/[slug]/route.ts +101 -0
- package/src/modules/forms/api/public/embed-loader/route.ts +136 -0
- package/src/modules/forms/api/public/invitations/[token]/route.ts +107 -0
- package/src/modules/forms/api/public/rate-limit.ts +69 -0
- package/src/modules/forms/api/public/start/route.ts +195 -0
- package/src/modules/forms/api/public/submissions/[id]/attachments/[attachmentId]/route.ts +86 -0
- package/src/modules/forms/api/public/submissions/[id]/attachments/route.ts +108 -0
- package/src/modules/forms/api/public/submissions/[id]/pdf/route.ts +96 -0
- package/src/modules/forms/api/public/submissions/[id]/route.ts +189 -0
- package/src/modules/forms/api/public/submissions/[id]/submit/route.ts +159 -0
- package/src/modules/forms/api/route.ts +240 -0
- package/src/modules/forms/api/runtime-helpers.ts +208 -0
- package/src/modules/forms/api/subjects/[subjectType]/[subjectId]/consents/route.ts +178 -0
- package/src/modules/forms/api/subjects/[subjectType]/[subjectId]/export/route.ts +135 -0
- package/src/modules/forms/api/submissions/[submissionId]/access-audit/route.ts +100 -0
- package/src/modules/forms/api/submissions/[submissionId]/actors/[actorId]/route.ts +70 -0
- package/src/modules/forms/api/submissions/[submissionId]/actors/route.ts +92 -0
- package/src/modules/forms/api/submissions/[submissionId]/anonymize/route.ts +134 -0
- package/src/modules/forms/api/submissions/[submissionId]/attachments/[attachmentId]/route.ts +90 -0
- package/src/modules/forms/api/submissions/[submissionId]/export/route.ts +111 -0
- package/src/modules/forms/api/submissions/[submissionId]/pdf/route.ts +118 -0
- package/src/modules/forms/api/submissions/[submissionId]/reopen/route.ts +69 -0
- package/src/modules/forms/api/submissions/[submissionId]/revisions/route.ts +75 -0
- package/src/modules/forms/api/submissions/[submissionId]/route.ts +90 -0
- package/src/modules/forms/backend/forms/[id]/FormStudio.tsx +3269 -0
- package/src/modules/forms/backend/forms/[id]/analytics/page.meta.ts +15 -0
- package/src/modules/forms/backend/forms/[id]/analytics/page.tsx +289 -0
- package/src/modules/forms/backend/forms/[id]/distributions/page.meta.ts +15 -0
- package/src/modules/forms/backend/forms/[id]/distributions/page.tsx +16 -0
- package/src/modules/forms/backend/forms/[id]/history/page.meta.ts +11 -0
- package/src/modules/forms/backend/forms/[id]/history/page.tsx +229 -0
- package/src/modules/forms/backend/forms/[id]/page.meta.ts +11 -0
- package/src/modules/forms/backend/forms/[id]/page.tsx +17 -0
- package/src/modules/forms/backend/forms/[id]/studio/YesNoRow.tsx +65 -0
- package/src/modules/forms/backend/forms/[id]/studio/autosave-guard.ts +25 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/DragOverlayCard.tsx +24 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/DropIndicator.tsx +36 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/FieldRow.tsx +308 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/FormCanvas.tsx +265 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/GridSlot.tsx +176 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/SectionContainer.tsx +473 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/grid-collision.ts +25 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/keyboard-coordinates.ts +128 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/overlay-size.ts +15 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/resize-math.ts +36 -0
- package/src/modules/forms/backend/forms/[id]/studio/canvas/row-layout.ts +110 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/ConditionBuilder.tsx +264 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/HiddenFieldsPanel.tsx +121 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/JumpsEditor.tsx +237 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/RecallTokenPicker.tsx +87 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/VariablesPanel.tsx +260 -0
- package/src/modules/forms/backend/forms/[id]/studio/logic/condition-model.ts +207 -0
- package/src/modules/forms/backend/forms/[id]/studio/lucide-icons.ts +87 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/FormAppearancePanel.tsx +561 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/FormPalettePanel.tsx +52 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/InputParametersTab.tsx +378 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/PaletteCard.tsx +40 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/RolesEditor.tsx +225 -0
- package/src/modules/forms/backend/forms/[id]/studio/palette/entries.ts +102 -0
- package/src/modules/forms/backend/forms/[id]/studio/preview/PreviewSurface.tsx +1459 -0
- package/src/modules/forms/backend/forms/[id]/studio/preview/ViewportFrame.tsx +49 -0
- package/src/modules/forms/backend/forms/[id]/studio/recall.ts +0 -0
- package/src/modules/forms/backend/forms/[id]/studio/schema-helpers.ts +2525 -0
- package/src/modules/forms/backend/forms/[id]/studio/style/BackgroundControl.tsx +137 -0
- package/src/modules/forms/backend/forms/[id]/studio/style/ColorControl.tsx +257 -0
- package/src/modules/forms/backend/forms/[id]/studio/style/contrast.ts +114 -0
- package/src/modules/forms/backend/forms/[id]/studio/style/presets.ts +104 -0
- package/src/modules/forms/backend/forms/[id]/studio/type-label.ts +13 -0
- package/src/modules/forms/backend/forms/[id]/studio/types.ts +31 -0
- package/src/modules/forms/backend/forms/[id]/studio/undo-controller.ts +52 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/FileConstraintsEditor.tsx +89 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/GroupConfigEditor.tsx +167 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/LengthRangeEditor.tsx +67 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/MatrixColumnsEditor.tsx +166 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/MatrixRowsEditor.tsx +184 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/MessageOverridesEditor.tsx +83 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/NpsAnchorsEditor.tsx +60 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/NumberRangeEditor.tsx +65 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/OpinionIconSelect.tsx +46 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/PatternEditor.tsx +122 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/RankingExhaustiveSwitch.tsx +28 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/SignatureConfigEditor.tsx +84 -0
- package/src/modules/forms/backend/forms/[id]/studio/validation/ValidationPanel.tsx +369 -0
- package/src/modules/forms/backend/forms/[id]/submissions/components/RowBadges.ts +56 -0
- package/src/modules/forms/backend/forms/[id]/submissions/components/SubmissionDrawer.tsx +604 -0
- package/src/modules/forms/backend/forms/[id]/submissions/page.meta.ts +10 -0
- package/src/modules/forms/backend/forms/[id]/submissions/page.tsx +264 -0
- package/src/modules/forms/backend/forms/create/page.meta.ts +11 -0
- package/src/modules/forms/backend/forms/create/page.tsx +113 -0
- package/src/modules/forms/backend/forms/page.meta.ts +31 -0
- package/src/modules/forms/backend/forms/page.tsx +269 -0
- package/src/modules/forms/commands/distribution.ts +502 -0
- package/src/modules/forms/commands/form-version.ts +806 -0
- package/src/modules/forms/commands/form.ts +472 -0
- package/src/modules/forms/commands/index.ts +18 -0
- package/src/modules/forms/commands/invitation.ts +424 -0
- package/src/modules/forms/commands/shared.ts +261 -0
- package/src/modules/forms/commands/submission.ts +209 -0
- package/src/modules/forms/data/entities.ts +686 -0
- package/src/modules/forms/data/validators.ts +483 -0
- package/src/modules/forms/di.ts +246 -0
- package/src/modules/forms/encryption.ts +31 -0
- package/src/modules/forms/events-payloads.ts +103 -0
- package/src/modules/forms/events.ts +50 -0
- package/src/modules/forms/extension-points.ts +41 -0
- package/src/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.meta.ts +9 -0
- package/src/modules/forms/frontend/[orgSlug]/portal/forms/[key]/page.tsx +45 -0
- package/src/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.meta.ts +9 -0
- package/src/modules/forms/frontend/[orgSlug]/portal/submissions/[id]/continue/page.tsx +56 -0
- package/src/modules/forms/frontend/embed/[slug]/page.meta.ts +42 -0
- package/src/modules/forms/frontend/embed/[slug]/page.tsx +171 -0
- package/src/modules/forms/frontend/f/[slug]/page.meta.ts +9 -0
- package/src/modules/forms/frontend/f/[slug]/page.tsx +10 -0
- package/src/modules/forms/frontend/forms/[id]/run/page.meta.ts +17 -0
- package/src/modules/forms/frontend/forms/[id]/run/page.tsx +83 -0
- package/src/modules/forms/frontend/i/[token]/page.meta.ts +9 -0
- package/src/modules/forms/frontend/i/[token]/page.tsx +10 -0
- package/src/modules/forms/i18n/de.json +800 -0
- package/src/modules/forms/i18n/en.json +800 -0
- package/src/modules/forms/i18n/es.json +800 -0
- package/src/modules/forms/i18n/ko.json +800 -0
- package/src/modules/forms/i18n/pl.json +800 -0
- package/src/modules/forms/index.ts +18 -0
- package/src/modules/forms/lib/embed-frame-policy.ts +144 -0
- package/src/modules/forms/lib/form-definition-slicing.ts +54 -0
- package/src/modules/forms/lib/log-redaction.ts +91 -0
- package/src/modules/forms/lib/navigable-url.ts +57 -0
- package/src/modules/forms/lib/retention.ts +73 -0
- package/src/modules/forms/lib/runtime-principal.ts +101 -0
- package/src/modules/forms/migrations/.snapshot-open-mercato.json +3185 -0
- package/src/modules/forms/migrations/Migration20260508135459_forms.ts +17 -0
- package/src/modules/forms/migrations/Migration20260508140932_forms.ts +26 -0
- package/src/modules/forms/migrations/Migration20260508155737_forms.ts +15 -0
- package/src/modules/forms/migrations/Migration20260520120000_forms.ts +26 -0
- package/src/modules/forms/migrations/Migration20260521090000_forms.ts +15 -0
- package/src/modules/forms/migrations/Migration20260521120000_forms.ts +21 -0
- package/src/modules/forms/runner/FormRunner.tsx +924 -0
- package/src/modules/forms/runner/MatrixField.tsx +210 -0
- package/src/modules/forms/runner/RankingField.tsx +207 -0
- package/src/modules/forms/runner/ScaleField.tsx +102 -0
- package/src/modules/forms/runner/SignatureField.tsx +158 -0
- package/src/modules/forms/runner/tamper-check.ts +131 -0
- package/src/modules/forms/schema/address-countries.ts +60 -0
- package/src/modules/forms/schema/field-type-patterns.ts +21 -0
- package/src/modules/forms/schema/field-type-registry-advanced.ts +58 -0
- package/src/modules/forms/schema/field-type-registry.ts +819 -0
- package/src/modules/forms/schema/file-field.ts +102 -0
- package/src/modules/forms/schema/group-field.ts +235 -0
- package/src/modules/forms/schema/jsonlogic-grammar.ts +95 -0
- package/src/modules/forms/schema/jsonschema-extensions.ts +1060 -0
- package/src/modules/forms/schema/layout-catalog.ts +68 -0
- package/src/modules/forms/schema/signature-field.ts +120 -0
- package/src/modules/forms/schema/style-extensions.ts +194 -0
- package/src/modules/forms/schema/style-validators.ts +252 -0
- package/src/modules/forms/services/access-audit-logger.ts +275 -0
- package/src/modules/forms/services/analytics-service.ts +498 -0
- package/src/modules/forms/services/anonymize-service.ts +177 -0
- package/src/modules/forms/services/attachment-service.ts +223 -0
- package/src/modules/forms/services/captcha-verifier.ts +156 -0
- package/src/modules/forms/services/consent-record-service.ts +162 -0
- package/src/modules/forms/services/distribution-service.ts +509 -0
- package/src/modules/forms/services/distribution-token.ts +153 -0
- package/src/modules/forms/services/encryption-service.ts +500 -0
- package/src/modules/forms/services/export-service.ts +360 -0
- package/src/modules/forms/services/field-validation-service.ts +300 -0
- package/src/modules/forms/services/form-logic-evaluator.ts +718 -0
- package/src/modules/forms/services/form-version-compiler.ts +829 -0
- package/src/modules/forms/services/form-version-differ.ts +143 -0
- package/src/modules/forms/services/jsonlogic-evaluator.ts +228 -0
- package/src/modules/forms/services/pdf-snapshot-service.ts +782 -0
- package/src/modules/forms/services/prefill-resolver.ts +125 -0
- package/src/modules/forms/services/role-policy-service.ts +90 -0
- package/src/modules/forms/services/style-compiler.ts +378 -0
- package/src/modules/forms/services/submission-service.ts +1259 -0
- package/src/modules/forms/services/upload-scanner.ts +36 -0
- package/src/modules/forms/services/upload-validation.ts +94 -0
- package/src/modules/forms/services/visibility-resolver.ts +63 -0
- package/src/modules/forms/setup.ts +16 -0
- package/src/modules/forms/subscribers/forms-consent-projector.ts +100 -0
- package/src/modules/forms/subscribers/forms-pdf-snapshot.ts +112 -0
- package/src/modules/forms/subscribers/forms-webhook-bridge-anonymized.ts +36 -0
- package/src/modules/forms/subscribers/forms-webhook-bridge.ts +56 -0
- package/src/modules/forms/subscribers/invitation-email.ts +180 -0
- package/src/modules/forms/translations.ts +14 -0
- package/src/modules/forms/ui/admin/forms/[id]/distributions/CreateDistributionDialog.tsx +401 -0
- package/src/modules/forms/ui/admin/forms/[id]/distributions/DistributionsPanel.tsx +381 -0
- package/src/modules/forms/ui/admin/forms/[id]/distributions/EmbedSettingsDialog.tsx +332 -0
- package/src/modules/forms/ui/admin/forms/[id]/distributions/RecipientsTable.tsx +460 -0
- package/src/modules/forms/ui/public/EmbeddedForm.tsx +248 -0
- package/src/modules/forms/ui/public/FormRunner.tsx +491 -0
- package/src/modules/forms/ui/public/FormTrigger.tsx +80 -0
- package/src/modules/forms/ui/public/PublicFormRunnerPage.tsx +34 -0
- package/src/modules/forms/ui/public/components/CompletionScreen.tsx +97 -0
- package/src/modules/forms/ui/public/components/LocaleSwitch.tsx +42 -0
- package/src/modules/forms/ui/public/components/ResumeGate.tsx +61 -0
- package/src/modules/forms/ui/public/components/ReviewStep.tsx +153 -0
- package/src/modules/forms/ui/public/components/SaveIndicator.tsx +69 -0
- package/src/modules/forms/ui/public/components/SectionStepper.tsx +60 -0
- package/src/modules/forms/ui/public/index.ts +48 -0
- package/src/modules/forms/ui/public/renderers/index.tsx +889 -0
- package/src/modules/forms/ui/public/state/logic-derivation.ts +91 -0
- package/src/modules/forms/ui/public/state/runtime-client.ts +495 -0
- package/src/modules/forms/ui/public/state/useAutosave.ts +97 -0
- package/src/modules/forms/ui/public/state/useFormRunner.ts +547 -0
- package/src/modules/forms/ui/public/style/LogoHeader.tsx +43 -0
- package/src/modules/forms/ui/public/style/applyStyle.ts +26 -0
- package/src/modules/forms/ui/public/types.ts +228 -0
- package/src/modules/forms/widgets/injection/access-audit-panel/widget.tsx +144 -0
- package/src/modules/forms/widgets/injection/anonymize-button/widget.tsx +177 -0
- package/src/modules/forms/widgets/injection/audit-format.ts +60 -0
- package/src/modules/forms/widgets/injection/context.ts +24 -0
- package/src/modules/forms/widgets/injection/embedded-form/widget.tsx +102 -0
- package/src/modules/forms/widgets/injection/pdf-download-button/widget.tsx +111 -0
- package/src/modules/forms/widgets/injection/self-audit-footer/widget.tsx +56 -0
- package/src/modules/forms/widgets/injection-table.ts +54 -0
- package/src/modules/forms/workers/pdf-snapshot.ts +110 -0
- package/src/modules/forms/workers/retention-purge.ts +169 -0
- package/src/modules/inbox_ops/api/proposals/[id]/actions/[actionId]/route.ts +7 -1
- package/src/modules/inbox_ops/data/validators.ts +2 -1
- package/src/modules/inbox_ops/lib/llmProvider.ts +11 -0
- package/src/modules/inbox_ops/widgets/notifications/ProposalCreatedRenderer.tsx +2 -2
- package/src/modules/integrations/di.ts +5 -1
- package/src/modules/integrations/lib/credentials-service.ts +45 -36
- package/src/modules/messages/api/[id]/attachments/route.ts +12 -3
- package/src/modules/messages/api/[id]/forward-preview/route.ts +9 -3
- package/src/modules/messages/api/[id]/route.ts +83 -4
- package/src/modules/messages/api/route.ts +123 -2
- package/src/modules/messages/commands/messages.ts +81 -7
- package/src/modules/messages/components/ComposeMessagePageClient.tsx +29 -1
- package/src/modules/messages/data/validators.ts +10 -0
- package/src/modules/messages/i18n/de.json +8 -0
- package/src/modules/messages/i18n/en.json +8 -0
- package/src/modules/messages/i18n/es.json +8 -0
- package/src/modules/messages/i18n/ko.json +8 -0
- package/src/modules/messages/i18n/pl.json +8 -0
- package/src/modules/messages/lib/channelThreadAccess.ts +101 -0
- package/src/modules/messages/lib/composeSenderDelegation.ts +182 -0
- package/src/modules/messages/lib/composeSenderOptions.ts +56 -0
- package/src/modules/messages/lib/email-sender.ts +1 -17
- package/src/modules/messages/lib/forwarding.ts +17 -2
- package/src/modules/messages/lib/markdownEmailBody.ts +25 -0
- package/src/modules/messages/lib/messageSourceEntityTypes.ts +12 -0
- package/src/modules/messages/lib/routeHelpers.ts +92 -0
- package/src/modules/messages/subscribers/message-notification.ts +47 -1
- package/src/modules/notifications/api/[id]/action/route.ts +2 -1
- package/src/modules/notifications/api/openapi.ts +1 -0
- package/src/modules/notifications/frontend/NotificationSettingsPageClient.tsx +77 -48
- package/src/modules/notifications/i18n/de.json +1 -0
- package/src/modules/notifications/i18n/en.json +1 -0
- package/src/modules/notifications/i18n/es.json +1 -0
- package/src/modules/notifications/i18n/ko.json +1 -0
- package/src/modules/notifications/i18n/pl.json +1 -0
- package/src/modules/notifications/lib/deliveryConfig.ts +31 -2
- package/src/modules/notifications/lib/notificationMapper.ts +2 -0
- package/src/modules/notifications/lib/safeHref.ts +7 -0
- package/src/modules/planner/api/availability-date-specific.ts +2 -1
- package/src/modules/planner/api/availability-weekly.ts +2 -1
- package/src/modules/progress/AGENTS.md +2 -0
- package/src/modules/progress/api/active/route.ts +14 -2
- package/src/modules/progress/api/jobs/[id]/route.ts +44 -27
- package/src/modules/progress/api/jobs/route.ts +22 -8
- package/src/modules/progress/api/requestScope.ts +43 -0
- package/src/modules/progress/lib/organizationScope.ts +17 -0
- package/src/modules/progress/lib/progressService.ts +3 -2
- package/src/modules/progress/lib/progressServiceImpl.ts +63 -14
- package/src/modules/push_notifications/api/custom-send/route.ts +4 -1
- package/src/modules/query_index/api/status.ts +4 -9
- package/src/modules/query_index/di.ts +2 -1
- package/src/modules/query_index/lib/engine.ts +2 -0
- package/src/modules/query_index/lib/request-encryption.ts +31 -0
- package/src/modules/query_index/lib/search-tokens.ts +42 -1
- package/src/modules/resources/api/resources/tags/assign/route.ts +2 -1
- package/src/modules/resources/api/resources/tags/unassign/route.ts +2 -1
- package/src/modules/resources/commands/activities.ts +2 -2
- package/src/modules/sales/api/document-history/route.ts +5 -1
- package/src/modules/sales/api/document-numbers/route.ts +2 -1
- package/src/modules/sales/api/quotes/convert/route.ts +2 -1
- package/src/modules/sales/api/quotes/send/route.ts +2 -1
- package/src/modules/sales/api/settings/document-numbers/route.ts +7 -1
- package/src/modules/sales/api/settings/order-editing/route.ts +7 -1
- package/src/modules/sales/commands/documents.ts +451 -131
- package/src/modules/sales/commands/payments.ts +2 -1
- package/src/modules/sales/commands/settings.ts +34 -6
- package/src/modules/sales/commands/shipments.ts +2 -1
- package/src/modules/sales/components/DocumentNumberSettings.tsx +41 -28
- package/src/modules/sales/components/documents/ItemsSection.tsx +58 -13
- package/src/modules/sales/components/documents/LineItemDialog.tsx +194 -111
- package/src/modules/sales/components/documents/lineItemUtils.ts +18 -0
- package/src/modules/sales/i18n/de.json +2 -0
- package/src/modules/sales/i18n/en.json +2 -0
- package/src/modules/sales/i18n/es.json +2 -0
- package/src/modules/sales/i18n/ko.json +2 -0
- package/src/modules/sales/i18n/pl.json +2 -0
- package/src/modules/sales/lib/lineSnapshots.ts +36 -0
- package/src/modules/sales/setup.ts +4 -4
- package/src/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.tsx +2 -2
- package/src/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.tsx +2 -2
- package/src/modules/staff/api/leave-requests/accept/route.ts +2 -1
- package/src/modules/staff/api/leave-requests/reject/route.ts +2 -1
- package/src/modules/staff/api/leave-requests.ts +2 -1
- package/src/modules/staff/api/team-members/self/route.ts +2 -1
- package/src/modules/staff/api/team-members/tags/assign/route.ts +2 -1
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +2 -1
- package/src/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.ts +16 -16
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +2 -1
- package/src/modules/staff/api/timesheets/my-projects/route.ts +2 -1
- package/src/modules/staff/api/timesheets/my-work/route.ts +2 -1
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +2 -1
- package/src/modules/staff/api/timesheets/reports/[id]/close/route.ts +2 -1
- package/src/modules/staff/api/timesheets/reports/[id]/export/route.ts +3 -2
- package/src/modules/staff/api/timesheets/reports/[id]/sheet/route.ts +3 -2
- package/src/modules/staff/api/timesheets/reports/[id]/unlock/route.ts +3 -2
- package/src/modules/staff/api/timesheets/reports/preview/route.ts +2 -1
- package/src/modules/staff/api/timesheets/reports/shared.ts +2 -1
- package/src/modules/staff/api/timesheets/settings/reapply-rounding/route.ts +2 -1
- package/src/modules/staff/api/timesheets/tags/entry-assignments/route.ts +2 -1
- package/src/modules/staff/api/timesheets/tags/task-assignments/route.ts +2 -1
- package/src/modules/staff/api/timesheets/tasks/[id]/comments/route.ts +2 -1
- package/src/modules/staff/api/timesheets/tasks/[id]/status/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.ts +3 -2
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/copy-day/route.ts +3 -2
- package/src/modules/staff/api/timesheets/time-entries/overlaps/route.ts +2 -1
- package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +3 -2
- package/src/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.ts +3 -2
- package/src/modules/staff/api/timesheets/time-projects/route.ts +2 -1
- package/src/modules/staff/commands/activities.ts +2 -2
- package/src/modules/staff/commands/timesheets-entries.ts +3 -2
- package/src/modules/staff/commands/timesheets-reports.ts +88 -15
- package/src/modules/staff/lib/timesheets-reports/buildReportSheet.ts +1 -0
- package/src/modules/staff/lib/timesheets-reports/loadReportData.ts +69 -8
- package/src/modules/staff/lib/timesheets-reports/reportPeriod.ts +18 -0
- package/src/modules/staff/lib/timesheets-ui/CalendarPicker.tsx +21 -10
- package/src/modules/sync_excel/api/import/route.ts +40 -12
- package/src/modules/sync_excel/api/upload/route.ts +34 -4
- package/src/modules/translations/api/context.ts +2 -1
- package/src/modules/warranty_claims/api/ai/assess/route.ts +2 -1
- package/src/modules/warranty_claims/api/ai/draft-reply/route.ts +2 -1
- package/src/modules/warranty_claims/api/ai/suggest/route.ts +2 -1
- package/src/modules/warranty_claims/api/assign/route.ts +2 -1
- package/src/modules/warranty_claims/api/credit-memo/route.ts +2 -1
- package/src/modules/warranty_claims/api/entitlement/route.ts +2 -1
- package/src/modules/warranty_claims/api/events/route.ts +2 -1
- package/src/modules/warranty_claims/api/external/claims/route.ts +2 -1
- package/src/modules/warranty_claims/api/receiving/route.ts +2 -1
- package/src/modules/warranty_claims/api/replacement-order/route.ts +2 -1
- package/src/modules/warranty_claims/api/return-label/route.ts +2 -1
- package/src/modules/warranty_claims/api/risk/route.ts +2 -1
- package/src/modules/warranty_claims/api/sales-return/route.ts +2 -1
- package/src/modules/warranty_claims/api/settings-general/route.ts +2 -1
- package/src/modules/warranty_claims/api/stats/route.ts +11 -11
- package/src/modules/warranty_claims/api/submit/route.ts +2 -1
- package/src/modules/warranty_claims/api/transition/route.ts +2 -1
- package/src/modules/warranty_claims/api/vendor-recovery/route.ts +2 -1
- package/src/modules/warranty_claims/api/vendor-recovery-suggestions/route.ts +2 -1
- package/src/modules/warranty_claims/widgets/notifications/WarrantyClaimNotificationRenderer.tsx +1 -1
- package/src/modules/wms/api/dashboard/operational/route.ts +2 -1
- package/src/modules/wms/api/inventory/cycle-count/route.ts +1 -0
- package/src/modules/wms/api/inventory/helpers.ts +2 -1
- package/src/modules/wms/api/inventory/import/helpers.ts +2 -1
- package/src/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.ts +2 -1
- package/src/modules/wms/commands/inventory-actions.ts +45 -1
- package/src/modules/wms/components/backend/CycleCountWizardDialog.tsx +14 -1
- package/src/modules/wms/di.ts +6 -0
- package/src/modules/wms/i18n/de.json +1 -0
- package/src/modules/wms/i18n/en.json +1 -0
- package/src/modules/wms/i18n/es.json +1 -0
- package/src/modules/wms/i18n/ko.json +1 -0
- package/src/modules/wms/i18n/pl.json +1 -0
- package/src/modules/wms/lib/availabilityCache.ts +137 -0
- package/src/modules/wms/lib/availabilityCalculation.ts +351 -0
- package/src/modules/wms/lib/availabilityProvider.ts +47 -0
- package/src/modules/wms/lib/loadOperationalDashboard.ts +51 -3
- package/src/modules/wms/lib/lowStockBalanceFilter.ts +23 -10
- package/src/modules/wms/lib/sqlInClause.ts +21 -0
- package/src/modules/wms/lib/tryResolve.ts +8 -0
- package/src/modules/wms/subscribers/invalidate-availability-cache-policy.ts +18 -0
- package/src/modules/wms/subscribers/invalidate-availability-cache-profile.ts +18 -0
- package/src/modules/wms/subscribers/invalidate-availability-cache.ts +30 -0
- package/src/modules/wms/widgets/notifications/WmsLowStockRenderer.tsx +2 -2
- package/src/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.tsx +4 -3
- package/src/modules/workflows/AGENTS.md +7 -5
- package/src/modules/workflows/api/commands/route.ts +4 -1
- package/src/modules/workflows/api/definitions/[id]/callers/route.ts +4 -1
- package/src/modules/workflows/api/definitions/[id]/context-schema/route.ts +4 -2
- package/src/modules/workflows/api/definitions/[id]/customize/route.ts +4 -1
- package/src/modules/workflows/api/definitions/[id]/draft/route.ts +6 -1
- package/src/modules/workflows/api/definitions/[id]/publish/route.ts +10 -1
- package/src/modules/workflows/api/definitions/[id]/reset-to-code/route.ts +4 -1
- package/src/modules/workflows/api/definitions/[id]/route.ts +5 -3
- package/src/modules/workflows/api/definitions/[id]/test-step/route.ts +4 -2
- package/src/modules/workflows/api/definitions/generate/route.ts +4 -1
- package/src/modules/workflows/api/definitions/route.ts +4 -2
- package/src/modules/workflows/api/endpoints/route.ts +4 -1
- package/src/modules/workflows/api/functions/route.ts +4 -1
- package/src/modules/workflows/api/grantable-features/route.ts +2 -1
- package/src/modules/workflows/api/instances/[id]/advance/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/cancel/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/context/route.ts +2 -1
- package/src/modules/workflows/api/instances/[id]/rerun-step/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/retry/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/signal/route.ts +4 -1
- package/src/modules/workflows/api/instances/[id]/step-through/route.ts +4 -2
- package/src/modules/workflows/api/instances/route.ts +4 -2
- package/src/modules/workflows/api/instances/validate-start/route.ts +4 -1
- package/src/modules/workflows/api/rule-usage/route.ts +4 -1
- package/src/modules/workflows/api/signals/route.ts +4 -1
- package/src/modules/workflows/api/tasks/[id]/claim/route.ts +4 -1
- package/src/modules/workflows/api/tasks/[id]/complete/route.ts +4 -1
- package/src/modules/workflows/api/tasks/[id]/reassign/route.ts +2 -1
- package/src/modules/workflows/api/tasks/[id]/unclaim/route.ts +4 -1
- package/src/modules/workflows/api/templates/route.ts +4 -1
- package/src/modules/workflows/api/work-inbox/next/route.ts +4 -1
- package/src/modules/workflows/lib/activity-executor.ts +125 -28
- package/src/modules/workflows/lib/activity-types.ts +8 -4
- package/src/modules/workflows/lib/activity-worker-handler.ts +16 -12
- package/src/modules/workflows/lib/event-trigger-service.ts +18 -2
- package/src/modules/workflows/lib/step-handler.ts +13 -8
- package/src/test-utils/transactionalEntityManagerDouble.ts +51 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/customers/commands/people.ts"],
|
|
4
|
-
"sourcesContent": ["import { registerCommand } from '@open-mercato/shared/lib/commands'\nimport type { CommandHandler } from '@open-mercato/shared/lib/commands'\nimport {\n parseWithCustomFields,\n setCustomFieldsIfAny,\n emitCrudSideEffects,\n emitCrudUndoSideEffects,\n requireId,\n snapshotsEqual,\n} from '@open-mercato/shared/lib/commands/helpers'\nimport type { DataEngine } from '@open-mercato/shared/lib/data/engine'\nimport type { CommandRuntimeContext } from '@open-mercato/shared/lib/commands'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport {\n CustomerAddress,\n CustomerComment,\n CustomerActivity,\n CustomerInteraction,\n CustomerDeal,\n CustomerDealPersonLink,\n CustomerPersonCompanyLink,\n CustomerTodoLink,\n CustomerEntity,\n CustomerPersonProfile,\n CustomerTagAssignment,\n} from '../data/entities'\nimport { resolvePersonCustomFieldRouting, CUSTOMER_ENTITY_ID, PERSON_ENTITY_ID } from '../lib/customFieldRouting'\nimport { CustomFieldValue } from '@open-mercato/core/modules/entities/data/entities'\nimport {\n personCreateSchema,\n personUpdateSchema,\n type PersonCreateInput,\n type PersonUpdateInput,\n} from '../data/validators'\nimport {\n ensureOrganizationScope,\n ensureTenantScope,\n extractUndoPayload,\n assertFound,\n syncEntityTags,\n loadEntityTagIds,\n ensureDictionaryEntry,\n emitQueryIndexDeleteEvents,\n emitQueryIndexUpsertEvents,\n type QueryIndexEventEntry,\n} from './shared'\nimport { withAtomicFlush } from '@open-mercato/shared/lib/commands/flush'\nimport { resolveRedoSnapshot } from '@open-mercato/shared/lib/commands/redo'\nimport { CrudHttpError, notFound } from '@open-mercato/shared/lib/crud/errors'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport {\n loadCustomFieldSnapshot,\n buildCustomFieldResetMap,\n} from '@open-mercato/shared/lib/commands/customFieldSnapshots'\nimport type { CrudIndexerConfig, CrudEventsConfig } from '@open-mercato/shared/lib/crud/types'\nimport { E } from '#generated/entities.ids.generated'\nimport { findWithDecryption, findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { deriveDisplayName, isDerivedDisplayName } from '../lib/displayName'\nimport {\n loadPersonCompanyLinks,\n summarizePersonCompanies,\n syncLegacyPrimaryCompanyLink,\n} from '../lib/personCompanies'\n\nconst INTERACTION_ENTITY_ID = 'customers:customer_interaction'\n\ntype PersonAddressSnapshot = {\n id: string\n name: string | null\n purpose: string | null\n addressLine1: string\n addressLine2: string | null\n city: string | null\n region: string | null\n postalCode: string | null\n country: string | null\n latitude: number | null\n longitude: number | null\n isPrimary: boolean\n}\n\ntype PersonCommentSnapshot = {\n id: string\n body: string\n authorUserId: string | null\n dealId: string | null\n createdAt: Date\n updatedAt: Date\n deletedAt: Date | null\n appearanceIcon: string | null\n appearanceColor: string | null\n}\n\ntype PersonActivitySnapshot = {\n id: string\n activityType: string\n subject: string | null\n body: string | null\n occurredAt: Date | null\n authorUserId: string | null\n appearanceIcon: string | null\n appearanceColor: string | null\n dealId: string | null\n createdAt: Date\n updatedAt: Date\n}\n\ntype PersonTodoSnapshot = {\n id: string\n todoId: string\n todoSource: string\n createdAt: Date\n createdByUserId: string | null\n}\n\ntype PersonInteractionSnapshot = {\n id: string\n interactionType: string\n title: string | null\n body: string | null\n status: string\n scheduledAt: Date | null\n occurredAt: Date | null\n priority: number | null\n authorUserId: string | null\n ownerUserId: string | null\n appearanceIcon: string | null\n appearanceColor: string | null\n source: string | null\n dealId: string | null\n createdAt: Date\n updatedAt: Date\n deletedAt: Date | null\n custom?: Record<string, unknown>\n}\n\ntype PersonSnapshot = {\n entity: {\n id: string\n organizationId: string\n tenantId: string\n displayName: string\n description: string | null\n ownerUserId: string | null\n primaryEmail: string | null\n primaryPhone: string | null\n status: string | null\n lifecycleStage: string | null\n source: string | null\n nextInteractionAt: Date | null\n nextInteractionName: string | null\n nextInteractionRefId: string | null\n nextInteractionIcon: string | null\n nextInteractionColor: string | null\n isActive: boolean\n }\n profile: {\n id: string\n firstName: string | null\n lastName: string | null\n preferredName: string | null\n jobTitle: string | null\n department: string | null\n seniority: string | null\n timezone: string | null\n linkedInUrl: string | null\n twitterUrl: string | null\n companyEntityId: string | null\n }\n companies: Array<{\n linkId: string | null\n companyId: string\n displayName: string\n isPrimary: boolean\n }>\n tagIds: string[]\n addresses: PersonAddressSnapshot[]\n comments: PersonCommentSnapshot[]\n custom?: Record<string, unknown>\n deals: Array<{\n id: string\n dealId: string\n participantRole: string | null\n isPrimary?: boolean\n createdAt: Date\n }>\n activities: PersonActivitySnapshot[]\n todos: PersonTodoSnapshot[]\n interactions: PersonInteractionSnapshot[]\n}\n\ntype PersonUndoPayload = {\n before?: PersonSnapshot | null\n after?: PersonSnapshot | null\n}\n\nconst personCrudIndexer: CrudIndexerConfig<CustomerEntity> = {\n entityType: E.customers.customer_person_profile,\n}\n\nconst personCrudEvents: CrudEventsConfig<CustomerEntity> = {\n module: 'customers',\n entity: 'person',\n persistent: true,\n buildPayload: (ctx) => ({\n id: ctx.identifiers.id,\n entityId: ctx.entity?.id ?? ctx.identifiers.id,\n organizationId: ctx.identifiers.organizationId,\n tenantId: ctx.identifiers.tenantId,\n ...(ctx.syncOrigin ? { syncOrigin: ctx.syncOrigin } : {}),\n }),\n}\n\nfunction personEntityIndexEntry(entity: CustomerEntity): QueryIndexEventEntry {\n return {\n entityType: E.customers.customer_entity,\n recordId: entity.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n }\n}\n\nfunction normalizeOptionalString(value: string | null | undefined): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim()\n return trimmed.length ? trimmed : null\n}\n\nfunction normalizeHexColor(value: string | null | undefined): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim().toLowerCase()\n return /^#([0-9a-f]{6})$/.test(trimmed) ? trimmed : null\n}\n\nfunction normalizeEmail(value: string | null | undefined): string | null {\n const normalized = normalizeOptionalString(value)\n return normalized ? normalized.toLowerCase() : null\n}\n\ntype PersonDeleteBlockerCounts = {\n dealLinks: number\n}\n\nfunction buildPersonHasDependentsError(\n translate: (key: string, fallback?: string, params?: Record<string, string | number>) => string,\n counts: PersonDeleteBlockerCounts,\n): CrudHttpError {\n const blockers: string[] = []\n if (counts.dealLinks > 0) {\n blockers.push(\n translate('customers.people.delete.blockers.deals', 'linked deals ({{count}})', { count: counts.dealLinks }),\n )\n }\n const summary = blockers.join(', ')\n const message = translate(\n 'customers.people.delete.blocked',\n 'Cannot delete person: {{blockers}}. Please unlink or reassign first.',\n { blockers: summary },\n )\n return new CrudHttpError(422, { error: message, code: 'PERSON_HAS_DEPENDENTS' })\n}\n\nfunction serializePersonSnapshot(\n entity: CustomerEntity,\n profile: CustomerPersonProfile,\n tagIds: string[],\n addresses: CustomerAddress[],\n comments: CustomerComment[],\n deals: CustomerDealPersonLink[],\n activities: CustomerActivity[],\n todoLinks: CustomerTodoLink[],\n interactions: Array<PersonInteractionSnapshot>,\n custom?: Record<string, unknown>\n): PersonSnapshot {\n const companies = summarizePersonCompanies(profile, [])\n return {\n entity: {\n id: entity.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n displayName: entity.displayName,\n description: entity.description ?? null,\n ownerUserId: entity.ownerUserId ?? null,\n primaryEmail: entity.primaryEmail ?? null,\n primaryPhone: entity.primaryPhone ?? null,\n status: entity.status ?? null,\n lifecycleStage: entity.lifecycleStage ?? null,\n source: entity.source ?? null,\n nextInteractionAt: entity.nextInteractionAt ?? null,\n nextInteractionName: entity.nextInteractionName ?? null,\n nextInteractionRefId: entity.nextInteractionRefId ?? null,\n nextInteractionIcon: entity.nextInteractionIcon ?? null,\n nextInteractionColor: entity.nextInteractionColor ?? null,\n isActive: entity.isActive,\n },\n profile: {\n id: profile.id,\n firstName: profile.firstName ?? null,\n lastName: profile.lastName ?? null,\n preferredName: profile.preferredName ?? null,\n jobTitle: profile.jobTitle ?? null,\n department: profile.department ?? null,\n seniority: profile.seniority ?? null,\n timezone: profile.timezone ?? null,\n linkedInUrl: profile.linkedInUrl ?? null,\n twitterUrl: profile.twitterUrl ?? null,\n companyEntityId: profile.company\n ? typeof profile.company === 'string'\n ? profile.company\n : profile.company.id\n : null,\n },\n companies,\n tagIds,\n addresses: addresses.map((address) => ({\n id: address.id,\n name: address.name ?? null,\n purpose: address.purpose ?? null,\n addressLine1: address.addressLine1,\n addressLine2: address.addressLine2 ?? null,\n city: address.city ?? null,\n region: address.region ?? null,\n postalCode: address.postalCode ?? null,\n country: address.country ?? null,\n latitude: address.latitude ?? null,\n longitude: address.longitude ?? null,\n isPrimary: address.isPrimary,\n })),\n comments: comments.map((comment) => ({\n id: comment.id,\n body: comment.body,\n authorUserId: comment.authorUserId ?? null,\n dealId: comment.deal\n ? typeof comment.deal === 'string'\n ? comment.deal\n : comment.deal.id\n : null,\n createdAt: comment.createdAt,\n updatedAt: comment.updatedAt,\n deletedAt: comment.deletedAt ?? null,\n appearanceIcon: comment.appearanceIcon ?? null,\n appearanceColor: comment.appearanceColor ?? null,\n })),\n deals: deals\n .filter((link) => link.deal)\n .map((link) => ({\n id: link.id,\n dealId: link.deal.id,\n participantRole: link.participantRole ?? null,\n isPrimary: link.isPrimary === true,\n createdAt: link.createdAt,\n })),\n activities: activities.map((activity) => ({\n id: activity.id,\n activityType: activity.activityType,\n subject: activity.subject ?? null,\n body: activity.body ?? null,\n occurredAt: activity.occurredAt ?? null,\n authorUserId: activity.authorUserId ?? null,\n appearanceIcon: activity.appearanceIcon ?? null,\n appearanceColor: activity.appearanceColor ?? null,\n dealId: activity.deal\n ? typeof activity.deal === 'string'\n ? activity.deal\n : activity.deal.id\n : null,\n createdAt: activity.createdAt,\n updatedAt: activity.updatedAt,\n })),\n todos: todoLinks.map((todo) => ({\n id: todo.id,\n todoId: todo.todoId,\n todoSource: todo.todoSource,\n createdAt: todo.createdAt,\n createdByUserId: todo.createdByUserId ?? null,\n })),\n interactions,\n custom,\n }\n}\n\nasync function loadPersonSnapshot(em: EntityManager, entityId: string): Promise<PersonSnapshot | null> {\n const entity = await em.findOne(CustomerEntity, { id: entityId, deletedAt: null })\n if (!entity || entity.kind !== 'person') return null\n const profile = await findOneWithDecryption(\n em,\n CustomerPersonProfile,\n { entity: entity },\n { populate: ['company'] },\n { tenantId: entity.tenantId, organizationId: entity.organizationId },\n )\n if (!profile) return null\n const companyLinks = await loadPersonCompanyLinks(em, entity)\n const tagIds = await loadEntityTagIds(em, entity)\n const addresses = await em.find(CustomerAddress, { entity }, { orderBy: { createdAt: 'asc' } })\n const comments = await findWithDecryption(\n em,\n CustomerComment,\n { entity },\n { orderBy: { createdAt: 'asc' }, populate: ['deal'] },\n { tenantId: entity.tenantId, organizationId: entity.organizationId },\n )\n const deals = await findWithDecryption(\n em,\n CustomerDealPersonLink,\n { person: entity },\n { orderBy: { createdAt: 'asc' }, populate: ['deal'] },\n { tenantId: entity.tenantId, organizationId: entity.organizationId },\n )\n const activities = await findWithDecryption(\n em,\n CustomerActivity,\n { entity },\n { orderBy: { createdAt: 'asc' }, populate: ['deal'] },\n { tenantId: entity.tenantId, organizationId: entity.organizationId },\n )\n const todoLinks = await em.find(CustomerTodoLink, { entity }, { orderBy: { createdAt: 'asc' } })\n const interactions = await em.find(CustomerInteraction, { entity }, { orderBy: { createdAt: 'asc' } })\n const entityCustom = await loadCustomFieldSnapshot(em, {\n entityId: CUSTOMER_ENTITY_ID,\n recordId: entity.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n const profileCustom = await loadCustomFieldSnapshot(em, {\n entityId: PERSON_ENTITY_ID,\n recordId: profile.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n const routing = await resolvePersonCustomFieldRouting(em, entity.tenantId, entity.organizationId)\n const custom: Record<string, unknown> = { ...entityCustom }\n for (const [key, value] of Object.entries(profileCustom)) {\n const target = routing.get(key)\n if (target === CUSTOMER_ENTITY_ID && Object.prototype.hasOwnProperty.call(custom, key)) continue\n custom[key] = value\n }\n const interactionSnapshots = await Promise.all(\n interactions.map(async (interaction) => ({\n id: interaction.id,\n interactionType: interaction.interactionType,\n title: interaction.title ?? null,\n body: interaction.body ?? null,\n status: interaction.status,\n scheduledAt: interaction.scheduledAt ?? null,\n occurredAt: interaction.occurredAt ?? null,\n priority: interaction.priority ?? null,\n authorUserId: interaction.authorUserId ?? null,\n ownerUserId: interaction.ownerUserId ?? null,\n appearanceIcon: interaction.appearanceIcon ?? null,\n appearanceColor: interaction.appearanceColor ?? null,\n source: interaction.source ?? null,\n dealId: interaction.dealId ?? null,\n createdAt: interaction.createdAt,\n updatedAt: interaction.updatedAt,\n deletedAt: interaction.deletedAt ?? null,\n custom: await loadCustomFieldSnapshot(em, {\n entityId: INTERACTION_ENTITY_ID,\n recordId: interaction.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n }),\n })),\n )\n const snapshot = serializePersonSnapshot(entity, profile, tagIds, addresses, comments, deals, activities, todoLinks, interactionSnapshots, custom)\n snapshot.companies = summarizePersonCompanies(profile, companyLinks)\n return snapshot\n}\n\nasync function resolveCompanyReference(\n em: EntityManager,\n companyId: string | null | undefined,\n organizationId: string,\n tenantId: string\n): Promise<CustomerEntity | null> {\n if (!companyId) return null\n const company = await em.findOne(CustomerEntity, { id: companyId, kind: 'company', deletedAt: null })\n if (!company) {\n throw new CrudHttpError(400, { error: 'Company not found' })\n }\n if (company.organizationId !== organizationId || company.tenantId !== tenantId) {\n throw new CrudHttpError(403, { error: 'Cannot link person to company outside current scope' })\n }\n return company\n}\n\nasync function setCustomFieldsForPerson(\n ctx: CommandRuntimeContext,\n entityId: string,\n profileId: string,\n organizationId: string,\n tenantId: string,\n values: Record<string, unknown>\n): Promise<void> {\n if (!values || !Object.keys(values).length) return\n const em = (ctx.container.resolve('em') as EntityManager)\n const routing = await resolvePersonCustomFieldRouting(em, tenantId, organizationId)\n const entityScoped: Record<string, unknown> = {}\n const profileScoped: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(values)) {\n const target = routing.get(key) ?? PERSON_ENTITY_ID\n if (target === CUSTOMER_ENTITY_ID) entityScoped[key] = value\n else profileScoped[key] = value\n }\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n if (Object.keys(entityScoped).length) {\n await setCustomFieldsIfAny({\n dataEngine: de,\n entityId: CUSTOMER_ENTITY_ID,\n recordId: entityId,\n organizationId,\n tenantId,\n values: entityScoped,\n notify: true,\n })\n }\n if (Object.keys(profileScoped).length) {\n await setCustomFieldsIfAny({\n dataEngine: de,\n entityId: PERSON_ENTITY_ID,\n recordId: profileId,\n organizationId,\n tenantId,\n values: profileScoped,\n notify: true,\n })\n }\n}\n\ntype PersonGraphValues = {\n entityId?: string\n profileId?: string\n organizationId: string\n tenantId: string\n displayName: string\n description: string | null\n ownerUserId: string | null\n primaryEmail: string | null\n primaryPhone: string | null\n status: string | null\n lifecycleStage: string | null\n source: string | null\n nextInteractionAt: Date | null\n nextInteractionName: string | null\n nextInteractionRefId: string | null\n nextInteractionIcon: string | null\n nextInteractionColor: string | null\n isActive: boolean\n firstName: string | null\n lastName: string | null\n preferredName: string | null\n jobTitle: string | null\n department: string | null\n seniority: string | null\n timezone: string | null\n linkedInUrl: string | null\n twitterUrl: string | null\n}\n\n// Single source of truth for the person entity+profile row mapping, shared by\n// `execute` (values from validated input) and `redo` (values from the after-\n// snapshot, carrying the original ids). Keeps create and id-preserving redo from\n// drifting field-by-field. Caller owns the surrounding flush, dictionary upserts,\n// tag/company-link sync, and custom-field restore.\nfunction buildPersonGraph(\n em: EntityManager,\n values: PersonGraphValues,\n): { entity: CustomerEntity; profile: CustomerPersonProfile } {\n const entity = em.create(CustomerEntity, {\n ...(values.entityId ? { id: values.entityId } : {}),\n organizationId: values.organizationId,\n tenantId: values.tenantId,\n kind: 'person',\n displayName: values.displayName,\n description: values.description,\n ownerUserId: values.ownerUserId,\n primaryEmail: values.primaryEmail,\n primaryPhone: values.primaryPhone,\n status: values.status,\n lifecycleStage: values.lifecycleStage,\n source: values.source,\n nextInteractionAt: values.nextInteractionAt,\n nextInteractionName: values.nextInteractionName,\n nextInteractionRefId: values.nextInteractionRefId,\n nextInteractionIcon: values.nextInteractionIcon,\n nextInteractionColor: values.nextInteractionColor,\n isActive: values.isActive,\n })\n const profile = em.create(CustomerPersonProfile, {\n ...(values.profileId ? { id: values.profileId } : {}),\n organizationId: values.organizationId,\n tenantId: values.tenantId,\n entity,\n firstName: values.firstName,\n lastName: values.lastName,\n preferredName: values.preferredName,\n jobTitle: values.jobTitle,\n department: values.department,\n seniority: values.seniority,\n timezone: values.timezone,\n linkedInUrl: values.linkedInUrl,\n twitterUrl: values.twitterUrl,\n company: null,\n })\n em.persist(entity)\n em.persist(profile)\n return { entity, profile }\n}\n\nconst createPersonCommand: CommandHandler<PersonCreateInput, { entityId: string; personId: string }> = {\n id: 'customers.people.create',\n async execute(rawInput, ctx) {\n const { parsed, custom } = parseWithCustomFields(personCreateSchema, rawInput)\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const firstName = parsed.firstName?.trim() ?? ''\n const lastName = parsed.lastName?.trim() ?? ''\n const description = normalizeOptionalString(parsed.description)\n const primaryEmail = normalizeEmail(parsed.primaryEmail)\n const primaryPhone = normalizeOptionalString(parsed.primaryPhone)\n const status = normalizeOptionalString(parsed.status)\n const lifecycleStage = normalizeOptionalString(parsed.lifecycleStage)\n const source = normalizeOptionalString(parsed.source)\n const preferredName = normalizeOptionalString(parsed.preferredName)\n const jobTitle = normalizeOptionalString(parsed.jobTitle)\n const department = normalizeOptionalString(parsed.department)\n const seniority = normalizeOptionalString(parsed.seniority)\n const timezone = normalizeOptionalString(parsed.timezone)\n const linkedInUrl = normalizeOptionalString(parsed.linkedInUrl)\n const twitterUrl = normalizeOptionalString(parsed.twitterUrl)\n const displayNameInput = parsed.displayName?.trim() ?? ''\n const displayName = displayNameInput.length > 0\n ? displayNameInput\n : deriveDisplayName(firstName, lastName)\n const nextInteractionName = parsed.nextInteraction?.name ? parsed.nextInteraction.name.trim() : null\n const nextInteractionRefId = normalizeOptionalString(parsed.nextInteraction?.refId)\n const nextInteractionIcon = normalizeOptionalString(parsed.nextInteraction?.icon)\n const nextInteractionColor = normalizeHexColor(parsed.nextInteraction?.color)\n if (!firstName || !lastName) {\n throw new CrudHttpError(400, { error: 'First and last name are required' })\n }\n if (!displayName) {\n throw new CrudHttpError(400, { error: 'Display name is required' })\n }\n\n let entity!: CustomerEntity\n let profile!: CustomerPersonProfile\n await withAtomicFlush(em, [\n () => {\n const graph = buildPersonGraph(em, {\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n displayName,\n description,\n ownerUserId: parsed.ownerUserId ?? null,\n primaryEmail,\n primaryPhone,\n status,\n lifecycleStage,\n source,\n nextInteractionAt: parsed.nextInteraction?.at ?? null,\n nextInteractionName,\n nextInteractionRefId,\n nextInteractionIcon,\n nextInteractionColor,\n isActive: parsed.isActive ?? true,\n firstName,\n lastName,\n preferredName,\n jobTitle,\n department,\n seniority,\n timezone,\n linkedInUrl,\n twitterUrl,\n })\n entity = graph.entity\n profile = graph.profile\n },\n async () => {\n if (status) {\n await ensureDictionaryEntry(em, {\n tenantId: parsed.tenantId,\n organizationId: parsed.organizationId,\n kind: 'status',\n value: status,\n })\n }\n if (jobTitle) {\n await ensureDictionaryEntry(em, {\n tenantId: parsed.tenantId,\n organizationId: parsed.organizationId,\n kind: 'job_title',\n value: jobTitle,\n })\n }\n if (source) {\n await ensureDictionaryEntry(em, {\n tenantId: parsed.tenantId,\n organizationId: parsed.organizationId,\n kind: 'source',\n value: source,\n })\n }\n },\n () => syncLegacyPrimaryCompanyLink(em, entity, profile, parsed.companyEntityId ?? null),\n () => syncEntityTags(em, entity, parsed.tags),\n ], { transaction: true })\n\n const tenantId = entity.tenantId\n const organizationId = entity.organizationId\n await setCustomFieldsForPerson(ctx, entity.id, profile.id, organizationId, tenantId, custom)\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudSideEffects({\n dataEngine: de,\n action: 'created',\n entity,\n identifiers: {\n id: profile.id ?? entity.id,\n tenantId,\n organizationId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n await emitQueryIndexUpsertEvents(ctx, [personEntityIndexEntry(entity)])\n\n return { entityId: entity.id, personId: profile.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n return await loadPersonSnapshot(em, result.entityId)\n },\n buildLog: async ({ result, snapshots }) => {\n const { translate } = await resolveTranslations()\n const snapshot = snapshots.after as PersonSnapshot | undefined\n return {\n actionLabel: translate('customers.audit.people.create', 'Create person'),\n resourceKind: 'customers.person',\n resourceId: result.entityId,\n tenantId: snapshot?.entity.tenantId ?? null,\n organizationId: snapshot?.entity.organizationId ?? null,\n snapshotAfter: snapshot ?? null,\n payload: {\n undo: {\n after: snapshot,\n },\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<PersonUndoPayload>(logEntry) ?? null\n const entityId = logEntry?.resourceId ?? payload?.after?.entity.id ?? null\n if (!entityId) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const entity = await em.findOne(CustomerEntity, { id: entityId })\n if (!entity) return\n const profile = await findOneWithDecryption(\n em,\n CustomerPersonProfile,\n { entity },\n undefined,\n { tenantId: entity.tenantId, organizationId: entity.organizationId },\n )\n const identifiers = {\n id: payload?.after?.profile.id ?? profile?.id ?? entity.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n }\n await withAtomicFlush(em, [\n () => em.nativeDelete(CustomerTagAssignment, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId }),\n () => {\n if (profile) em.remove(profile)\n },\n () => em.remove(entity),\n ], { transaction: true })\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudUndoSideEffects({\n dataEngine: de,\n action: 'deleted',\n entity,\n identifiers,\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n await emitQueryIndexDeleteEvents(ctx, [personEntityIndexEntry(entity)])\n },\n redo: async ({ logEntry, ctx }) => {\n const after = resolveRedoSnapshot<PersonSnapshot>(logEntry)\n if (!after) {\n throw new CrudHttpError(400, { error: '[internal] redo snapshot unavailable for person create' })\n }\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n let entity = await findOneWithDecryption(\n em,\n CustomerEntity,\n { id: after.entity.id },\n undefined,\n { tenantId: after.entity.tenantId, organizationId: after.entity.organizationId },\n )\n let profile!: CustomerPersonProfile\n if (!entity) {\n let newEntity!: CustomerEntity\n let newProfile!: CustomerPersonProfile\n await withAtomicFlush(em, [\n () => {\n const graph = buildPersonGraph(em, {\n entityId: after.entity.id,\n profileId: after.profile.id,\n organizationId: after.entity.organizationId,\n tenantId: after.entity.tenantId,\n displayName: after.entity.displayName,\n description: after.entity.description,\n ownerUserId: after.entity.ownerUserId,\n primaryEmail: after.entity.primaryEmail,\n primaryPhone: after.entity.primaryPhone,\n status: after.entity.status,\n lifecycleStage: after.entity.lifecycleStage,\n source: after.entity.source,\n nextInteractionAt: after.entity.nextInteractionAt,\n nextInteractionName: after.entity.nextInteractionName,\n nextInteractionRefId: after.entity.nextInteractionRefId,\n nextInteractionIcon: after.entity.nextInteractionIcon,\n nextInteractionColor: after.entity.nextInteractionColor,\n isActive: after.entity.isActive,\n firstName: after.profile.firstName,\n lastName: after.profile.lastName,\n preferredName: after.profile.preferredName,\n jobTitle: after.profile.jobTitle,\n department: after.profile.department,\n seniority: after.profile.seniority,\n timezone: after.profile.timezone,\n linkedInUrl: after.profile.linkedInUrl,\n twitterUrl: after.profile.twitterUrl,\n })\n newEntity = graph.entity\n newProfile = graph.profile\n },\n () => syncLegacyPrimaryCompanyLink(em, newEntity, newProfile, after.profile.companyEntityId),\n () => syncEntityTags(em, newEntity, after.tagIds),\n ], { transaction: true })\n entity = newEntity\n profile = newProfile\n } else {\n const existingProfile = await findOneWithDecryption(\n em,\n CustomerPersonProfile,\n { entity },\n undefined,\n { tenantId: after.entity.tenantId, organizationId: after.entity.organizationId },\n )\n if (!existingProfile) throw notFound('Person profile not found')\n profile = existingProfile\n const survivingEntity = entity\n await withAtomicFlush(em, [\n () => {\n survivingEntity.deletedAt = null\n survivingEntity.displayName = after.entity.displayName\n survivingEntity.description = after.entity.description\n survivingEntity.ownerUserId = after.entity.ownerUserId\n survivingEntity.primaryEmail = after.entity.primaryEmail\n survivingEntity.primaryPhone = after.entity.primaryPhone\n survivingEntity.status = after.entity.status\n survivingEntity.lifecycleStage = after.entity.lifecycleStage\n survivingEntity.source = after.entity.source\n survivingEntity.nextInteractionAt = after.entity.nextInteractionAt\n survivingEntity.nextInteractionName = after.entity.nextInteractionName\n survivingEntity.nextInteractionRefId = after.entity.nextInteractionRefId\n survivingEntity.nextInteractionIcon = after.entity.nextInteractionIcon\n survivingEntity.nextInteractionColor = after.entity.nextInteractionColor\n survivingEntity.isActive = after.entity.isActive\n profile.firstName = after.profile.firstName\n profile.lastName = after.profile.lastName\n profile.preferredName = after.profile.preferredName\n profile.jobTitle = after.profile.jobTitle\n profile.department = after.profile.department\n profile.seniority = after.profile.seniority\n profile.timezone = after.profile.timezone\n profile.linkedInUrl = after.profile.linkedInUrl\n profile.twitterUrl = after.profile.twitterUrl\n },\n () => syncLegacyPrimaryCompanyLink(em, survivingEntity, profile, after.profile.companyEntityId),\n () => syncEntityTags(em, survivingEntity, after.tagIds),\n ], { transaction: true })\n }\n\n const restoredEntity = entity\n const restoreValues = buildCustomFieldResetMap(after.custom, undefined)\n if (Object.keys(restoreValues).length) {\n await setCustomFieldsForPerson(ctx, restoredEntity.id, profile.id, restoredEntity.organizationId, restoredEntity.tenantId, restoreValues)\n }\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudSideEffects({\n dataEngine: de,\n action: 'created',\n entity: restoredEntity,\n identifiers: {\n id: profile.id ?? restoredEntity.id,\n tenantId: restoredEntity.tenantId,\n organizationId: restoredEntity.organizationId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n await emitQueryIndexUpsertEvents(ctx, [personEntityIndexEntry(restoredEntity)])\n\n return { entityId: restoredEntity.id, personId: profile.id }\n },\n}\n\nconst updatePersonCommand: CommandHandler<PersonUpdateInput, { entityId: string }> = {\n id: 'customers.people.update',\n async prepare(rawInput, ctx) {\n const { parsed } = parseWithCustomFields(personUpdateSchema, rawInput)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const snapshot = await loadPersonSnapshot(em, parsed.id)\n return snapshot ? { before: snapshot } : {}\n },\n async execute(rawInput, ctx) {\n const { parsed, custom } = parseWithCustomFields(personUpdateSchema, rawInput)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const entity = await em.findOne(CustomerEntity, { id: parsed.id, deletedAt: null })\n const record = assertFound(entity, 'Person not found')\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n const profile = await em.findOne(CustomerPersonProfile, { entity: record })\n if (!profile) throw notFound('Person profile not found')\n\n if (parsed.displayName !== undefined) {\n const nextDisplayName = parsed.displayName.trim()\n if (!nextDisplayName) {\n throw new CrudHttpError(400, { error: 'Display name is required' })\n }\n }\n\n if (\n parsed.displayName === undefined\n && (parsed.firstName !== undefined || parsed.lastName !== undefined)\n && isDerivedDisplayName(record.displayName, profile.firstName, profile.lastName)\n ) {\n const nextFirst = parsed.firstName !== undefined ? parsed.firstName : profile.firstName\n const nextLast = parsed.lastName !== undefined ? parsed.lastName : profile.lastName\n const derived = deriveDisplayName(nextFirst, nextLast)\n if (derived.length > 0) parsed.displayName = derived\n }\n\n await withAtomicFlush(em, [\n () => {\n if (parsed.description !== undefined) record.description = normalizeOptionalString(parsed.description)\n if (parsed.ownerUserId !== undefined) record.ownerUserId = parsed.ownerUserId ?? null\n if (parsed.primaryEmail !== undefined) record.primaryEmail = normalizeEmail(parsed.primaryEmail)\n if (parsed.primaryPhone !== undefined) record.primaryPhone = normalizeOptionalString(parsed.primaryPhone)\n if (parsed.status !== undefined) {\n record.status = normalizeOptionalString(parsed.status)\n }\n if (parsed.lifecycleStage !== undefined) record.lifecycleStage = normalizeOptionalString(parsed.lifecycleStage)\n if (parsed.source !== undefined) {\n record.source = normalizeOptionalString(parsed.source)\n }\n if (parsed.isActive !== undefined) record.isActive = parsed.isActive\n if (parsed.nextInteraction) {\n record.nextInteractionAt = parsed.nextInteraction.at\n record.nextInteractionName = parsed.nextInteraction.name.trim()\n record.nextInteractionRefId = normalizeOptionalString(parsed.nextInteraction.refId) ?? null\n record.nextInteractionIcon = normalizeOptionalString(parsed.nextInteraction.icon)\n record.nextInteractionColor = normalizeHexColor(parsed.nextInteraction.color)\n } else if (parsed.nextInteraction === null) {\n record.nextInteractionAt = null\n record.nextInteractionName = null\n record.nextInteractionRefId = null\n record.nextInteractionIcon = null\n record.nextInteractionColor = null\n }\n\n if (parsed.firstName !== undefined) profile.firstName = normalizeOptionalString(parsed.firstName)\n if (parsed.lastName !== undefined) profile.lastName = normalizeOptionalString(parsed.lastName)\n if (parsed.preferredName !== undefined) profile.preferredName = normalizeOptionalString(parsed.preferredName)\n if (parsed.jobTitle !== undefined) {\n profile.jobTitle = normalizeOptionalString(parsed.jobTitle)\n }\n if (parsed.department !== undefined) profile.department = normalizeOptionalString(parsed.department)\n if (parsed.seniority !== undefined) profile.seniority = normalizeOptionalString(parsed.seniority)\n if (parsed.timezone !== undefined) profile.timezone = normalizeOptionalString(parsed.timezone)\n if (parsed.linkedInUrl !== undefined) profile.linkedInUrl = normalizeOptionalString(parsed.linkedInUrl)\n if (parsed.twitterUrl !== undefined) profile.twitterUrl = normalizeOptionalString(parsed.twitterUrl)\n\n const profileFieldsUpdated = [\n parsed.firstName, parsed.lastName, parsed.preferredName, parsed.jobTitle,\n parsed.department, parsed.seniority, parsed.timezone, parsed.linkedInUrl,\n parsed.twitterUrl, parsed.companyEntityId,\n ].some((v) => v !== undefined)\n if (profileFieldsUpdated) {\n record.updatedAt = new Date()\n }\n\n if (parsed.displayName !== undefined) {\n record.displayName = parsed.displayName.trim()\n }\n },\n async () => {\n if (parsed.status !== undefined) {\n const normalizedStatus = normalizeOptionalString(parsed.status)\n if (normalizedStatus) {\n await ensureDictionaryEntry(em, {\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n kind: 'status',\n value: normalizedStatus,\n })\n }\n }\n if (parsed.source !== undefined) {\n const normalizedSource = normalizeOptionalString(parsed.source)\n if (normalizedSource) {\n await ensureDictionaryEntry(em, {\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n kind: 'source',\n value: normalizedSource,\n })\n }\n }\n if (parsed.jobTitle !== undefined) {\n const normalizedJobTitle = normalizeOptionalString(parsed.jobTitle)\n if (normalizedJobTitle) {\n await ensureDictionaryEntry(em, {\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n kind: 'job_title',\n value: normalizedJobTitle,\n })\n }\n }\n },\n async () => {\n if (parsed.companyEntityId !== undefined) {\n await syncLegacyPrimaryCompanyLink(em, record, profile, parsed.companyEntityId)\n }\n },\n () => syncEntityTags(em, record, parsed.tags),\n ], { transaction: true })\n\n await setCustomFieldsForPerson(ctx, record.id, profile.id, record.organizationId, record.tenantId, custom)\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudSideEffects({\n dataEngine: de,\n action: 'updated',\n entity: record,\n identifiers: {\n id: profile.id ?? record.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n await emitQueryIndexUpsertEvents(ctx, [personEntityIndexEntry(record)])\n\n // Expose the freshly-bumped updatedAt for inline-edit sequential-save lock refresh (#2055).\n return { entityId: record.id, updatedAt: record.updatedAt }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n return await loadPersonSnapshot(em, result.entityId)\n },\n buildLog: async ({ snapshots }) => {\n const { translate } = await resolveTranslations()\n const before = snapshots.before as PersonSnapshot | undefined\n if (!before) return null\n const afterSnapshot = snapshots.after as PersonSnapshot | undefined\n if (afterSnapshot && snapshotsEqual(before, afterSnapshot)) {\n return { skipLog: true }\n }\n return {\n actionLabel: translate('customers.audit.people.update', 'Update person'),\n resourceKind: 'customers.person',\n resourceId: before.entity.id,\n tenantId: before.entity.tenantId,\n organizationId: before.entity.organizationId,\n snapshotBefore: before,\n snapshotAfter: afterSnapshot ?? null,\n payload: {\n undo: {\n before,\n after: afterSnapshot ?? null,\n } satisfies PersonUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<PersonUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const entity = await em.findOne(CustomerEntity, { id: before.entity.id })\n if (!entity) {\n let newEntity!: CustomerEntity\n let newProfile!: CustomerPersonProfile\n await withAtomicFlush(em, [\n () => {\n newEntity = em.create(CustomerEntity, {\n id: before.entity.id,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n kind: 'person',\n displayName: before.entity.displayName,\n description: before.entity.description,\n ownerUserId: before.entity.ownerUserId,\n primaryEmail: before.entity.primaryEmail,\n primaryPhone: before.entity.primaryPhone,\n status: before.entity.status,\n lifecycleStage: before.entity.lifecycleStage,\n source: before.entity.source,\n nextInteractionAt: before.entity.nextInteractionAt,\n nextInteractionName: before.entity.nextInteractionName,\n nextInteractionRefId: before.entity.nextInteractionRefId,\n nextInteractionIcon: before.entity.nextInteractionIcon,\n nextInteractionColor: before.entity.nextInteractionColor,\n isActive: before.entity.isActive,\n })\n em.persist(newEntity)\n newProfile = em.create(CustomerPersonProfile, {\n id: before.profile.id,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n entity: newEntity,\n firstName: before.profile.firstName,\n lastName: before.profile.lastName,\n preferredName: before.profile.preferredName,\n jobTitle: before.profile.jobTitle,\n department: before.profile.department,\n seniority: before.profile.seniority,\n timezone: before.profile.timezone,\n linkedInUrl: before.profile.linkedInUrl,\n twitterUrl: before.profile.twitterUrl,\n })\n em.persist(newProfile)\n },\n () => syncLegacyPrimaryCompanyLink(em, newEntity, newProfile, before.profile.companyEntityId),\n () => syncEntityTags(em, newEntity, before.tagIds),\n ], { transaction: true })\n } else {\n await withAtomicFlush(em, [\n () => {\n entity.displayName = before.entity.displayName\n entity.description = before.entity.description\n entity.ownerUserId = before.entity.ownerUserId\n entity.primaryEmail = before.entity.primaryEmail\n entity.primaryPhone = before.entity.primaryPhone\n entity.status = before.entity.status\n entity.lifecycleStage = before.entity.lifecycleStage\n entity.source = before.entity.source\n entity.nextInteractionAt = before.entity.nextInteractionAt\n entity.nextInteractionName = before.entity.nextInteractionName\n entity.nextInteractionRefId = before.entity.nextInteractionRefId\n entity.nextInteractionIcon = before.entity.nextInteractionIcon\n entity.nextInteractionColor = before.entity.nextInteractionColor\n entity.isActive = before.entity.isActive\n },\n async () => {\n const profile = await findOneWithDecryption(\n em,\n CustomerPersonProfile,\n { entity },\n undefined,\n { tenantId: before.entity.tenantId, organizationId: before.entity.organizationId },\n )\n if (profile) {\n profile.firstName = before.profile.firstName\n profile.lastName = before.profile.lastName\n profile.preferredName = before.profile.preferredName\n profile.jobTitle = before.profile.jobTitle\n profile.department = before.profile.department\n profile.seniority = before.profile.seniority\n profile.timezone = before.profile.timezone\n profile.linkedInUrl = before.profile.linkedInUrl\n profile.twitterUrl = before.profile.twitterUrl\n await syncLegacyPrimaryCompanyLink(em, entity, profile, before.profile.companyEntityId)\n }\n },\n () => syncEntityTags(em, entity, before.tagIds),\n ], { transaction: true })\n }\n\n const indexedEntity = await em.findOne(CustomerEntity, { id: before.entity.id })\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudUndoSideEffects({\n dataEngine: de,\n action: 'updated',\n entity: indexedEntity,\n identifiers: {\n id: before.profile.id ?? before.entity.id,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n if (indexedEntity) {\n await emitQueryIndexUpsertEvents(ctx, [personEntityIndexEntry(indexedEntity)])\n }\n\n const resetValues = buildCustomFieldResetMap(before.custom, payload?.after?.custom)\n if (Object.keys(resetValues).length) {\n await setCustomFieldsForPerson(ctx, before.entity.id, before.profile.id, before.entity.organizationId, before.entity.tenantId, resetValues)\n }\n },\n}\n\nconst deletePersonCommand: CommandHandler<{ body?: Record<string, unknown>; query?: Record<string, unknown> }, { entityId: string }> =\n {\n id: 'customers.people.delete',\n async prepare(input, ctx) {\n const id = requireId(input, 'Person id required')\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const snapshot = await loadPersonSnapshot(em, id)\n return snapshot ? { before: snapshot } : {}\n },\n async execute(input, ctx) {\n const id = requireId(input, 'Person id required')\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const snapshot = await loadPersonSnapshot(em, id)\n const entity = await em.findOne(CustomerEntity, { id, deletedAt: null })\n const record = assertFound(entity, 'Person not found')\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n\n const dealLinks = await em.count(CustomerDealPersonLink, { person: record })\n if (dealLinks > 0) {\n const { translate } = await resolveTranslations()\n throw buildPersonHasDependentsError(translate, { dealLinks })\n }\n\n const profile = await em.findOne(CustomerPersonProfile, { entity: record })\n await withAtomicFlush(em, [\n async () => {\n if (profile) em.remove(profile)\n await em.nativeDelete(CustomerAddress, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerComment, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerActivity, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerInteraction, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerTodoLink, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerTagAssignment, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerDealPersonLink, { person: record })\n await em.nativeDelete(CustomerPersonCompanyLink, { person: record })\n if (profile) {\n await em.nativeDelete(CustomFieldValue, { entityId: PERSON_ENTITY_ID, recordId: profile.id })\n }\n await em.nativeDelete(CustomFieldValue, { entityId: CUSTOMER_ENTITY_ID, recordId: record.id })\n em.remove(record)\n },\n ], { transaction: true })\n\n const indexDeletes: QueryIndexEventEntry[] = []\n const dealUpserts: QueryIndexEventEntry[] = []\n if (snapshot) {\n for (const activity of snapshot.activities ?? []) {\n indexDeletes.push({\n entityType: E.customers.customer_activity,\n recordId: activity.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n for (const comment of snapshot.comments ?? []) {\n indexDeletes.push({\n entityType: E.customers.customer_comment,\n recordId: comment.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n for (const address of snapshot.addresses ?? []) {\n indexDeletes.push({\n entityType: E.customers.customer_address,\n recordId: address.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n for (const todo of snapshot.todos ?? []) {\n indexDeletes.push({\n entityType: E.customers.customer_todo_link,\n recordId: todo.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n for (const interaction of snapshot.interactions ?? []) {\n indexDeletes.push({\n entityType: E.customers.customer_interaction,\n recordId: interaction.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n for (const deal of snapshot.deals ?? []) {\n if (deal.dealId) {\n dealUpserts.push({\n entityType: E.customers.customer_deal,\n recordId: deal.dealId,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n }\n }\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudSideEffects({\n dataEngine: de,\n action: 'deleted',\n entity: record,\n identifiers: {\n id: profile?.id ?? record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n\n await emitQueryIndexDeleteEvents(ctx, [personEntityIndexEntry(record)])\n await emitQueryIndexDeleteEvents(ctx, indexDeletes)\n await emitQueryIndexUpsertEvents(ctx, dealUpserts)\n return { entityId: record.id }\n },\n buildLog: async ({ snapshots }) => {\n const before = snapshots.before as PersonSnapshot | undefined\n if (!before) return null\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('customers.audit.people.delete', 'Delete person'),\n resourceKind: 'customers.person',\n resourceId: before.entity.id,\n tenantId: before.entity.tenantId,\n organizationId: before.entity.organizationId,\n snapshotBefore: before,\n payload: {\n undo: {\n before,\n } satisfies PersonUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<PersonUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n\n const decryptionScope = {\n tenantId: before.entity.tenantId ?? null,\n organizationId: before.entity.organizationId ?? null,\n }\n // Bind the outer EntityManager to an explicit transaction so every\n // `em.flush()` below participates in the same unit of work. Using\n // `em.transactional(cb)` would pass a forked em into `cb` and the\n // surrounding closures would mutate the unwrapped em, escaping the\n // transaction (see SPEC-018 and H8 in the CRM details screens review).\n await em.begin()\n let txResult: {\n entity: CustomerEntity\n profile: CustomerPersonProfile\n beforeInteractions: PersonInteractionSnapshot[]\n beforeTodos: PersonTodoSnapshot[]\n }\n try {\n txResult = await (async () => {\n let entity = await findOneWithDecryption(\n em,\n CustomerEntity,\n {\n id: before.entity.id,\n tenantId: before.entity.tenantId,\n organizationId: before.entity.organizationId,\n },\n {},\n decryptionScope,\n )\n if (!entity) {\n entity = em.create(CustomerEntity, {\n id: before.entity.id,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n kind: 'person',\n displayName: before.entity.displayName,\n description: before.entity.description,\n ownerUserId: before.entity.ownerUserId,\n primaryEmail: before.entity.primaryEmail,\n primaryPhone: before.entity.primaryPhone,\n status: before.entity.status,\n lifecycleStage: before.entity.lifecycleStage,\n source: before.entity.source,\n nextInteractionAt: before.entity.nextInteractionAt,\n nextInteractionName: before.entity.nextInteractionName,\n nextInteractionRefId: before.entity.nextInteractionRefId,\n nextInteractionIcon: before.entity.nextInteractionIcon,\n nextInteractionColor: before.entity.nextInteractionColor,\n isActive: before.entity.isActive,\n })\n em.persist(entity)\n }\n\n entity.displayName = before.entity.displayName\n entity.description = before.entity.description\n entity.ownerUserId = before.entity.ownerUserId\n entity.primaryEmail = before.entity.primaryEmail\n entity.primaryPhone = before.entity.primaryPhone\n entity.status = before.entity.status\n entity.lifecycleStage = before.entity.lifecycleStage\n entity.source = before.entity.source\n entity.nextInteractionAt = before.entity.nextInteractionAt\n entity.nextInteractionName = before.entity.nextInteractionName\n entity.nextInteractionRefId = before.entity.nextInteractionRefId\n entity.nextInteractionIcon = before.entity.nextInteractionIcon\n entity.nextInteractionColor = before.entity.nextInteractionColor\n entity.isActive = before.entity.isActive\n entity.deletedAt = null\n\n let profile = await findOneWithDecryption(\n em,\n CustomerPersonProfile,\n {\n entity,\n tenantId: before.entity.tenantId,\n organizationId: before.entity.organizationId,\n },\n {},\n decryptionScope,\n )\n if (!profile) {\n profile = em.create(CustomerPersonProfile, {\n id: before.profile.id,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n entity,\n firstName: before.profile.firstName,\n lastName: before.profile.lastName,\n preferredName: before.profile.preferredName,\n jobTitle: before.profile.jobTitle,\n department: before.profile.department,\n seniority: before.profile.seniority,\n timezone: before.profile.timezone,\n linkedInUrl: before.profile.linkedInUrl,\n twitterUrl: before.profile.twitterUrl,\n })\n } else {\n profile.firstName = before.profile.firstName\n profile.lastName = before.profile.lastName\n profile.preferredName = before.profile.preferredName\n profile.jobTitle = before.profile.jobTitle\n profile.department = before.profile.department\n profile.seniority = before.profile.seniority\n profile.timezone = before.profile.timezone\n profile.linkedInUrl = before.profile.linkedInUrl\n profile.twitterUrl = before.profile.twitterUrl\n }\n\n await syncLegacyPrimaryCompanyLink(em, entity, profile, before.profile.companyEntityId)\n\n await em.flush()\n await em.nativeDelete(CustomerPersonCompanyLink, { person: entity })\n for (const companyLink of before.companies ?? []) {\n const company = await resolveCompanyReference(\n em,\n companyLink.companyId,\n before.entity.organizationId,\n before.entity.tenantId,\n )\n if (!company) continue\n const restoredLink = em.create(CustomerPersonCompanyLink, {\n id: companyLink.linkId ?? undefined,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n person: entity,\n company,\n isPrimary: companyLink.isPrimary,\n })\n em.persist(restoredLink)\n if (companyLink.isPrimary) {\n profile.company = company\n }\n }\n await withAtomicFlush(em, [\n () => syncEntityTags(em, entity, before.tagIds),\n ])\n\n const beforeActivities = (before as { activities?: PersonActivitySnapshot[] }).activities ?? []\n const beforeTodos = (before as { todos?: PersonTodoSnapshot[] }).todos ?? []\n const beforeInteractions = (before as { interactions?: PersonInteractionSnapshot[] }).interactions ?? []\n\n const relatedDealIds = new Set<string>()\n for (const link of before.deals) relatedDealIds.add(link.dealId)\n for (const activity of beforeActivities) {\n if (activity.dealId) relatedDealIds.add(activity.dealId)\n }\n for (const comment of before.comments) {\n if (comment.dealId) relatedDealIds.add(comment.dealId)\n }\n let dealMap = new Map<string, CustomerDeal>()\n if (relatedDealIds.size) {\n const deals = await em.find(CustomerDeal, {\n id: { $in: Array.from(relatedDealIds) },\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n })\n dealMap = new Map(deals.map((deal) => [deal.id, deal]))\n }\n\n await em.nativeDelete(CustomerDealPersonLink, { person: entity })\n for (const link of before.deals) {\n const deal = dealMap.get(link.dealId)\n if (!deal) continue\n const restoredLink = em.create(CustomerDealPersonLink, {\n id: link.id,\n deal,\n person: entity,\n participantRole: link.participantRole,\n isPrimary: link.isPrimary === true,\n createdAt: link.createdAt,\n })\n em.persist(restoredLink)\n }\n await em.flush()\n\n await em.nativeDelete(CustomerActivity, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId })\n for (const activity of beforeActivities) {\n const restoredActivity = em.create(CustomerActivity, {\n id: activity.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n entity,\n activityType: activity.activityType,\n subject: activity.subject,\n body: activity.body,\n occurredAt: activity.occurredAt,\n authorUserId: activity.authorUserId,\n appearanceIcon: activity.appearanceIcon,\n appearanceColor: activity.appearanceColor,\n deal: activity.dealId ? dealMap.get(activity.dealId) ?? null : null,\n createdAt: activity.createdAt,\n updatedAt: activity.updatedAt,\n })\n em.persist(restoredActivity)\n }\n await em.flush()\n\n await em.nativeDelete(CustomerComment, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId })\n for (const comment of before.comments) {\n const restoredComment = em.create(CustomerComment, {\n id: comment.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n entity,\n body: comment.body,\n authorUserId: comment.authorUserId,\n appearanceIcon: comment.appearanceIcon,\n appearanceColor: comment.appearanceColor,\n deal: comment.dealId ? dealMap.get(comment.dealId) ?? null : null,\n createdAt: comment.createdAt,\n updatedAt: comment.updatedAt,\n deletedAt: comment.deletedAt,\n })\n em.persist(restoredComment)\n }\n await em.flush()\n\n await em.nativeDelete(CustomerAddress, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId })\n for (const address of before.addresses) {\n const restoredAddress = em.create(CustomerAddress, {\n id: address.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n entity,\n name: address.name,\n purpose: address.purpose,\n addressLine1: address.addressLine1,\n addressLine2: address.addressLine2,\n city: address.city,\n region: address.region,\n postalCode: address.postalCode,\n country: address.country,\n latitude: address.latitude,\n longitude: address.longitude,\n isPrimary: address.isPrimary,\n })\n em.persist(restoredAddress)\n }\n await em.flush()\n\n await em.nativeDelete(CustomerTodoLink, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId })\n for (const todo of beforeTodos) {\n const restoredTodo = em.create(CustomerTodoLink, {\n id: todo.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n entity,\n todoId: todo.todoId,\n todoSource: todo.todoSource,\n createdAt: todo.createdAt,\n createdByUserId: todo.createdByUserId,\n })\n em.persist(restoredTodo)\n }\n await em.flush()\n\n await em.nativeDelete(CustomerInteraction, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId })\n for (const interaction of beforeInteractions) {\n const restoredInteraction = em.create(CustomerInteraction, {\n id: interaction.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n entity,\n interactionType: interaction.interactionType,\n title: interaction.title,\n body: interaction.body,\n status: interaction.status,\n scheduledAt: interaction.scheduledAt,\n occurredAt: interaction.occurredAt,\n priority: interaction.priority,\n authorUserId: interaction.authorUserId,\n ownerUserId: interaction.ownerUserId,\n dealId: interaction.dealId,\n source: interaction.source,\n appearanceIcon: interaction.appearanceIcon,\n appearanceColor: interaction.appearanceColor,\n createdAt: interaction.createdAt,\n updatedAt: interaction.updatedAt,\n deletedAt: interaction.deletedAt,\n })\n em.persist(restoredInteraction)\n }\n await em.flush()\n\n return { entity, profile, beforeInteractions, beforeTodos }\n })()\n await em.commit()\n } catch (err) {\n try {\n await em.rollback()\n } catch {\n // rollback failure should not mask the original error\n }\n throw err\n }\n\n for (const interaction of txResult.beforeInteractions) {\n if (!interaction.custom || !Object.keys(interaction.custom).length) continue\n await setCustomFieldsIfAny({\n dataEngine: de,\n entityId: INTERACTION_ENTITY_ID,\n recordId: interaction.id,\n organizationId: txResult.entity.organizationId,\n tenantId: txResult.entity.tenantId,\n values: interaction.custom,\n notify: false,\n })\n }\n\n const entity = txResult.entity\n const profile = txResult.profile\n\n await emitCrudUndoSideEffects({\n dataEngine: de,\n action: 'created',\n entity,\n identifiers: {\n id: profile.id ?? entity.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n\n const upsertEntries: QueryIndexEventEntry[] = []\n for (const activity of before.activities ?? []) {\n upsertEntries.push({\n entityType: E.customers.customer_activity,\n recordId: activity.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n for (const comment of before.comments ?? []) {\n upsertEntries.push({\n entityType: E.customers.customer_comment,\n recordId: comment.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n for (const address of before.addresses ?? []) {\n upsertEntries.push({\n entityType: E.customers.customer_address,\n recordId: address.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n for (const todo of txResult.beforeTodos ?? []) {\n upsertEntries.push({\n entityType: E.customers.customer_todo_link,\n recordId: todo.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n for (const interaction of txResult.beforeInteractions ?? []) {\n upsertEntries.push({\n entityType: E.customers.customer_interaction,\n recordId: interaction.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n const dealUpserts: QueryIndexEventEntry[] = []\n for (const deal of before.deals ?? []) {\n if (deal.dealId) {\n dealUpserts.push({\n entityType: E.customers.customer_deal,\n recordId: deal.dealId,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n }\n const resetValues = buildCustomFieldResetMap(before.custom, undefined)\n if (Object.keys(resetValues).length) {\n await setCustomFieldsForPerson(ctx, entity.id, profile.id, entity.organizationId, entity.tenantId, resetValues)\n }\n await emitQueryIndexUpsertEvents(ctx, [personEntityIndexEntry(entity)])\n await emitQueryIndexUpsertEvents(ctx, upsertEntries)\n await emitQueryIndexUpsertEvents(ctx, dealUpserts)\n },\n }\n\nregisterCommand(createPersonCommand)\nregisterCommand(updatePersonCommand)\nregisterCommand(deletePersonCommand)\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iCAAiC,oBAAoB,wBAAwB;AACtF,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,eAAe,gBAAg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AAa;AACnD,UAAM,2BAA2B,KAAK,WAAW;AAAA,EACnD;AACF;AAEF,gBAAgB,mBAAmB;AACnC,gBAAgB,mBAAmB;AACnC,gBAAgB,mBAAmB;",
|
|
4
|
+
"sourcesContent": ["import { registerCommand } from '@open-mercato/shared/lib/commands'\nimport type { CommandHandler } from '@open-mercato/shared/lib/commands'\nimport {\n parseWithCustomFields,\n setCustomFieldsIfAny,\n emitCrudSideEffects,\n emitCrudUndoSideEffects,\n requireId,\n snapshotsEqual,\n} from '@open-mercato/shared/lib/commands/helpers'\nimport type { DataEngine } from '@open-mercato/shared/lib/data/engine'\nimport type { CommandRuntimeContext } from '@open-mercato/shared/lib/commands'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport {\n CustomerAddress,\n CustomerComment,\n CustomerActivity,\n CustomerInteraction,\n CustomerDeal,\n CustomerDealPersonLink,\n CustomerPersonCompanyLink,\n CustomerTodoLink,\n CustomerEntity,\n CustomerPersonProfile,\n CustomerTagAssignment,\n} from '../data/entities'\nimport { resolvePersonCustomFieldRouting, CUSTOMER_ENTITY_ID, PERSON_ENTITY_ID } from '../lib/customFieldRouting'\nimport { CustomFieldValue } from '@open-mercato/core/modules/entities/data/entities'\nimport {\n personCreateSchema,\n personUpdateSchema,\n type PersonCreateInput,\n type PersonUpdateInput,\n} from '../data/validators'\nimport {\n ensureOrganizationScope,\n ensureTenantScope,\n extractUndoPayload,\n CUSTOMER_ENTITY_UNDO_DATE_OPTIONS,\n assertFound,\n syncEntityTags,\n loadEntityTagIds,\n ensureDictionaryEntry,\n emitQueryIndexDeleteEvents,\n emitQueryIndexUpsertEvents,\n type QueryIndexEventEntry,\n} from './shared'\nimport { withAtomicFlush } from '@open-mercato/shared/lib/commands/flush'\nimport { resolveRedoSnapshot } from '@open-mercato/shared/lib/commands/redo'\nimport { CrudHttpError, notFound } from '@open-mercato/shared/lib/crud/errors'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport {\n loadCustomFieldSnapshot,\n buildCustomFieldResetMap,\n} from '@open-mercato/shared/lib/commands/customFieldSnapshots'\nimport type { CrudIndexerConfig, CrudEventsConfig } from '@open-mercato/shared/lib/crud/types'\nimport { E } from '#generated/entities.ids.generated'\nimport { findWithDecryption, findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { deriveDisplayName, isDerivedDisplayName } from '../lib/displayName'\nimport {\n loadPersonCompanyLinks,\n summarizePersonCompanies,\n syncLegacyPrimaryCompanyLink,\n} from '../lib/personCompanies'\n\nconst INTERACTION_ENTITY_ID = 'customers:customer_interaction'\n\ntype PersonAddressSnapshot = {\n id: string\n name: string | null\n purpose: string | null\n addressLine1: string\n addressLine2: string | null\n city: string | null\n region: string | null\n postalCode: string | null\n country: string | null\n latitude: number | null\n longitude: number | null\n isPrimary: boolean\n}\n\ntype PersonCommentSnapshot = {\n id: string\n body: string\n authorUserId: string | null\n dealId: string | null\n createdAt: Date\n updatedAt: Date\n deletedAt: Date | null\n appearanceIcon: string | null\n appearanceColor: string | null\n}\n\ntype PersonActivitySnapshot = {\n id: string\n activityType: string\n subject: string | null\n body: string | null\n occurredAt: Date | null\n authorUserId: string | null\n appearanceIcon: string | null\n appearanceColor: string | null\n dealId: string | null\n createdAt: Date\n updatedAt: Date\n}\n\ntype PersonTodoSnapshot = {\n id: string\n todoId: string\n todoSource: string\n createdAt: Date\n createdByUserId: string | null\n}\n\ntype PersonInteractionSnapshot = {\n id: string\n interactionType: string\n title: string | null\n body: string | null\n status: string\n scheduledAt: Date | null\n occurredAt: Date | null\n priority: number | null\n authorUserId: string | null\n ownerUserId: string | null\n appearanceIcon: string | null\n appearanceColor: string | null\n source: string | null\n dealId: string | null\n createdAt: Date\n updatedAt: Date\n deletedAt: Date | null\n custom?: Record<string, unknown>\n}\n\ntype PersonSnapshot = {\n entity: {\n id: string\n organizationId: string\n tenantId: string\n displayName: string\n description: string | null\n ownerUserId: string | null\n primaryEmail: string | null\n primaryPhone: string | null\n status: string | null\n lifecycleStage: string | null\n source: string | null\n nextInteractionAt: Date | null\n nextInteractionName: string | null\n nextInteractionRefId: string | null\n nextInteractionIcon: string | null\n nextInteractionColor: string | null\n isActive: boolean\n }\n profile: {\n id: string\n firstName: string | null\n lastName: string | null\n preferredName: string | null\n jobTitle: string | null\n department: string | null\n seniority: string | null\n timezone: string | null\n linkedInUrl: string | null\n twitterUrl: string | null\n companyEntityId: string | null\n }\n companies: Array<{\n linkId: string | null\n companyId: string\n displayName: string\n isPrimary: boolean\n }>\n tagIds: string[]\n addresses: PersonAddressSnapshot[]\n comments: PersonCommentSnapshot[]\n custom?: Record<string, unknown>\n deals: Array<{\n id: string\n dealId: string\n participantRole: string | null\n isPrimary?: boolean\n createdAt: Date\n }>\n activities: PersonActivitySnapshot[]\n todos: PersonTodoSnapshot[]\n interactions: PersonInteractionSnapshot[]\n}\n\ntype PersonUndoPayload = {\n before?: PersonSnapshot | null\n after?: PersonSnapshot | null\n}\n\nconst personCrudIndexer: CrudIndexerConfig<CustomerEntity> = {\n entityType: E.customers.customer_person_profile,\n}\n\nconst personCrudEvents: CrudEventsConfig<CustomerEntity> = {\n module: 'customers',\n entity: 'person',\n persistent: true,\n buildPayload: (ctx) => ({\n id: ctx.identifiers.id,\n entityId: ctx.entity?.id ?? ctx.identifiers.id,\n organizationId: ctx.identifiers.organizationId,\n tenantId: ctx.identifiers.tenantId,\n ...(ctx.syncOrigin ? { syncOrigin: ctx.syncOrigin } : {}),\n }),\n}\n\nfunction personEntityIndexEntry(entity: CustomerEntity): QueryIndexEventEntry {\n return {\n entityType: E.customers.customer_entity,\n recordId: entity.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n }\n}\n\nfunction normalizeOptionalString(value: string | null | undefined): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim()\n return trimmed.length ? trimmed : null\n}\n\nfunction normalizeHexColor(value: string | null | undefined): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim().toLowerCase()\n return /^#([0-9a-f]{6})$/.test(trimmed) ? trimmed : null\n}\n\nfunction normalizeEmail(value: string | null | undefined): string | null {\n const normalized = normalizeOptionalString(value)\n return normalized ? normalized.toLowerCase() : null\n}\n\ntype PersonDeleteBlockerCounts = {\n dealLinks: number\n}\n\nfunction buildPersonHasDependentsError(\n translate: (key: string, fallback?: string, params?: Record<string, string | number>) => string,\n counts: PersonDeleteBlockerCounts,\n): CrudHttpError {\n const blockers: string[] = []\n if (counts.dealLinks > 0) {\n blockers.push(\n translate('customers.people.delete.blockers.deals', 'linked deals ({{count}})', { count: counts.dealLinks }),\n )\n }\n const summary = blockers.join(', ')\n const message = translate(\n 'customers.people.delete.blocked',\n 'Cannot delete person: {{blockers}}. Please unlink or reassign first.',\n { blockers: summary },\n )\n return new CrudHttpError(422, { error: message, code: 'PERSON_HAS_DEPENDENTS' })\n}\n\nfunction serializePersonSnapshot(\n entity: CustomerEntity,\n profile: CustomerPersonProfile,\n tagIds: string[],\n addresses: CustomerAddress[],\n comments: CustomerComment[],\n deals: CustomerDealPersonLink[],\n activities: CustomerActivity[],\n todoLinks: CustomerTodoLink[],\n interactions: Array<PersonInteractionSnapshot>,\n custom?: Record<string, unknown>\n): PersonSnapshot {\n const companies = summarizePersonCompanies(profile, [])\n return {\n entity: {\n id: entity.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n displayName: entity.displayName,\n description: entity.description ?? null,\n ownerUserId: entity.ownerUserId ?? null,\n primaryEmail: entity.primaryEmail ?? null,\n primaryPhone: entity.primaryPhone ?? null,\n status: entity.status ?? null,\n lifecycleStage: entity.lifecycleStage ?? null,\n source: entity.source ?? null,\n nextInteractionAt: entity.nextInteractionAt ?? null,\n nextInteractionName: entity.nextInteractionName ?? null,\n nextInteractionRefId: entity.nextInteractionRefId ?? null,\n nextInteractionIcon: entity.nextInteractionIcon ?? null,\n nextInteractionColor: entity.nextInteractionColor ?? null,\n isActive: entity.isActive,\n },\n profile: {\n id: profile.id,\n firstName: profile.firstName ?? null,\n lastName: profile.lastName ?? null,\n preferredName: profile.preferredName ?? null,\n jobTitle: profile.jobTitle ?? null,\n department: profile.department ?? null,\n seniority: profile.seniority ?? null,\n timezone: profile.timezone ?? null,\n linkedInUrl: profile.linkedInUrl ?? null,\n twitterUrl: profile.twitterUrl ?? null,\n companyEntityId: profile.company\n ? typeof profile.company === 'string'\n ? profile.company\n : profile.company.id\n : null,\n },\n companies,\n tagIds,\n addresses: addresses.map((address) => ({\n id: address.id,\n name: address.name ?? null,\n purpose: address.purpose ?? null,\n addressLine1: address.addressLine1,\n addressLine2: address.addressLine2 ?? null,\n city: address.city ?? null,\n region: address.region ?? null,\n postalCode: address.postalCode ?? null,\n country: address.country ?? null,\n latitude: address.latitude ?? null,\n longitude: address.longitude ?? null,\n isPrimary: address.isPrimary,\n })),\n comments: comments.map((comment) => ({\n id: comment.id,\n body: comment.body,\n authorUserId: comment.authorUserId ?? null,\n dealId: comment.deal\n ? typeof comment.deal === 'string'\n ? comment.deal\n : comment.deal.id\n : null,\n createdAt: comment.createdAt,\n updatedAt: comment.updatedAt,\n deletedAt: comment.deletedAt ?? null,\n appearanceIcon: comment.appearanceIcon ?? null,\n appearanceColor: comment.appearanceColor ?? null,\n })),\n deals: deals\n .filter((link) => link.deal)\n .map((link) => ({\n id: link.id,\n dealId: link.deal.id,\n participantRole: link.participantRole ?? null,\n isPrimary: link.isPrimary === true,\n createdAt: link.createdAt,\n })),\n activities: activities.map((activity) => ({\n id: activity.id,\n activityType: activity.activityType,\n subject: activity.subject ?? null,\n body: activity.body ?? null,\n occurredAt: activity.occurredAt ?? null,\n authorUserId: activity.authorUserId ?? null,\n appearanceIcon: activity.appearanceIcon ?? null,\n appearanceColor: activity.appearanceColor ?? null,\n dealId: activity.deal\n ? typeof activity.deal === 'string'\n ? activity.deal\n : activity.deal.id\n : null,\n createdAt: activity.createdAt,\n updatedAt: activity.updatedAt,\n })),\n todos: todoLinks.map((todo) => ({\n id: todo.id,\n todoId: todo.todoId,\n todoSource: todo.todoSource,\n createdAt: todo.createdAt,\n createdByUserId: todo.createdByUserId ?? null,\n })),\n interactions,\n custom,\n }\n}\n\nasync function loadPersonSnapshot(em: EntityManager, entityId: string): Promise<PersonSnapshot | null> {\n const entity = await em.findOne(CustomerEntity, { id: entityId, deletedAt: null })\n if (!entity || entity.kind !== 'person') return null\n const profile = await findOneWithDecryption(\n em,\n CustomerPersonProfile,\n { entity: entity },\n { populate: ['company'] },\n { tenantId: entity.tenantId, organizationId: entity.organizationId },\n )\n if (!profile) return null\n const companyLinks = await loadPersonCompanyLinks(em, entity)\n const tagIds = await loadEntityTagIds(em, entity)\n const addresses = await em.find(CustomerAddress, { entity }, { orderBy: { createdAt: 'asc' } })\n const comments = await findWithDecryption(\n em,\n CustomerComment,\n { entity },\n { orderBy: { createdAt: 'asc' }, populate: ['deal'] },\n { tenantId: entity.tenantId, organizationId: entity.organizationId },\n )\n const deals = await findWithDecryption(\n em,\n CustomerDealPersonLink,\n { person: entity },\n { orderBy: { createdAt: 'asc' }, populate: ['deal'] },\n { tenantId: entity.tenantId, organizationId: entity.organizationId },\n )\n const activities = await findWithDecryption(\n em,\n CustomerActivity,\n { entity },\n { orderBy: { createdAt: 'asc' }, populate: ['deal'] },\n { tenantId: entity.tenantId, organizationId: entity.organizationId },\n )\n const todoLinks = await em.find(CustomerTodoLink, { entity }, { orderBy: { createdAt: 'asc' } })\n const interactions = await em.find(CustomerInteraction, { entity }, { orderBy: { createdAt: 'asc' } })\n const entityCustom = await loadCustomFieldSnapshot(em, {\n entityId: CUSTOMER_ENTITY_ID,\n recordId: entity.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n const profileCustom = await loadCustomFieldSnapshot(em, {\n entityId: PERSON_ENTITY_ID,\n recordId: profile.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n const routing = await resolvePersonCustomFieldRouting(em, entity.tenantId, entity.organizationId)\n const custom: Record<string, unknown> = { ...entityCustom }\n for (const [key, value] of Object.entries(profileCustom)) {\n const target = routing.get(key)\n if (target === CUSTOMER_ENTITY_ID && Object.prototype.hasOwnProperty.call(custom, key)) continue\n custom[key] = value\n }\n const interactionSnapshots = await Promise.all(\n interactions.map(async (interaction) => ({\n id: interaction.id,\n interactionType: interaction.interactionType,\n title: interaction.title ?? null,\n body: interaction.body ?? null,\n status: interaction.status,\n scheduledAt: interaction.scheduledAt ?? null,\n occurredAt: interaction.occurredAt ?? null,\n priority: interaction.priority ?? null,\n authorUserId: interaction.authorUserId ?? null,\n ownerUserId: interaction.ownerUserId ?? null,\n appearanceIcon: interaction.appearanceIcon ?? null,\n appearanceColor: interaction.appearanceColor ?? null,\n source: interaction.source ?? null,\n dealId: interaction.dealId ?? null,\n createdAt: interaction.createdAt,\n updatedAt: interaction.updatedAt,\n deletedAt: interaction.deletedAt ?? null,\n custom: await loadCustomFieldSnapshot(em, {\n entityId: INTERACTION_ENTITY_ID,\n recordId: interaction.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n }),\n })),\n )\n const snapshot = serializePersonSnapshot(entity, profile, tagIds, addresses, comments, deals, activities, todoLinks, interactionSnapshots, custom)\n snapshot.companies = summarizePersonCompanies(profile, companyLinks)\n return snapshot\n}\n\nasync function resolveCompanyReference(\n em: EntityManager,\n companyId: string | null | undefined,\n organizationId: string,\n tenantId: string\n): Promise<CustomerEntity | null> {\n if (!companyId) return null\n const company = await em.findOne(CustomerEntity, { id: companyId, kind: 'company', deletedAt: null })\n if (!company) {\n throw new CrudHttpError(400, { error: 'Company not found' })\n }\n if (company.organizationId !== organizationId || company.tenantId !== tenantId) {\n throw new CrudHttpError(403, { error: 'Cannot link person to company outside current scope' })\n }\n return company\n}\n\nasync function setCustomFieldsForPerson(\n ctx: CommandRuntimeContext,\n entityId: string,\n profileId: string,\n organizationId: string,\n tenantId: string,\n values: Record<string, unknown>\n): Promise<void> {\n if (!values || !Object.keys(values).length) return\n const em = (ctx.container.resolve('em') as EntityManager)\n const routing = await resolvePersonCustomFieldRouting(em, tenantId, organizationId)\n const entityScoped: Record<string, unknown> = {}\n const profileScoped: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(values)) {\n const target = routing.get(key) ?? PERSON_ENTITY_ID\n if (target === CUSTOMER_ENTITY_ID) entityScoped[key] = value\n else profileScoped[key] = value\n }\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n if (Object.keys(entityScoped).length) {\n await setCustomFieldsIfAny({\n dataEngine: de,\n entityId: CUSTOMER_ENTITY_ID,\n recordId: entityId,\n organizationId,\n tenantId,\n values: entityScoped,\n notify: true,\n })\n }\n if (Object.keys(profileScoped).length) {\n await setCustomFieldsIfAny({\n dataEngine: de,\n entityId: PERSON_ENTITY_ID,\n recordId: profileId,\n organizationId,\n tenantId,\n values: profileScoped,\n notify: true,\n })\n }\n}\n\ntype PersonGraphValues = {\n entityId?: string\n profileId?: string\n organizationId: string\n tenantId: string\n displayName: string\n description: string | null\n ownerUserId: string | null\n primaryEmail: string | null\n primaryPhone: string | null\n status: string | null\n lifecycleStage: string | null\n source: string | null\n nextInteractionAt: Date | null\n nextInteractionName: string | null\n nextInteractionRefId: string | null\n nextInteractionIcon: string | null\n nextInteractionColor: string | null\n isActive: boolean\n firstName: string | null\n lastName: string | null\n preferredName: string | null\n jobTitle: string | null\n department: string | null\n seniority: string | null\n timezone: string | null\n linkedInUrl: string | null\n twitterUrl: string | null\n}\n\n// Single source of truth for the person entity+profile row mapping, shared by\n// `execute` (values from validated input) and `redo` (values from the after-\n// snapshot, carrying the original ids). Keeps create and id-preserving redo from\n// drifting field-by-field. Caller owns the surrounding flush, dictionary upserts,\n// tag/company-link sync, and custom-field restore.\nfunction buildPersonGraph(\n em: EntityManager,\n values: PersonGraphValues,\n): { entity: CustomerEntity; profile: CustomerPersonProfile } {\n const entity = em.create(CustomerEntity, {\n ...(values.entityId ? { id: values.entityId } : {}),\n organizationId: values.organizationId,\n tenantId: values.tenantId,\n kind: 'person',\n displayName: values.displayName,\n description: values.description,\n ownerUserId: values.ownerUserId,\n primaryEmail: values.primaryEmail,\n primaryPhone: values.primaryPhone,\n status: values.status,\n lifecycleStage: values.lifecycleStage,\n source: values.source,\n nextInteractionAt: values.nextInteractionAt,\n nextInteractionName: values.nextInteractionName,\n nextInteractionRefId: values.nextInteractionRefId,\n nextInteractionIcon: values.nextInteractionIcon,\n nextInteractionColor: values.nextInteractionColor,\n isActive: values.isActive,\n })\n const profile = em.create(CustomerPersonProfile, {\n ...(values.profileId ? { id: values.profileId } : {}),\n organizationId: values.organizationId,\n tenantId: values.tenantId,\n entity,\n firstName: values.firstName,\n lastName: values.lastName,\n preferredName: values.preferredName,\n jobTitle: values.jobTitle,\n department: values.department,\n seniority: values.seniority,\n timezone: values.timezone,\n linkedInUrl: values.linkedInUrl,\n twitterUrl: values.twitterUrl,\n company: null,\n })\n em.persist(entity)\n em.persist(profile)\n return { entity, profile }\n}\n\nconst createPersonCommand: CommandHandler<PersonCreateInput, { entityId: string; personId: string }> = {\n id: 'customers.people.create',\n async execute(rawInput, ctx) {\n const { parsed, custom } = parseWithCustomFields(personCreateSchema, rawInput)\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const firstName = parsed.firstName?.trim() ?? ''\n const lastName = parsed.lastName?.trim() ?? ''\n const description = normalizeOptionalString(parsed.description)\n const primaryEmail = normalizeEmail(parsed.primaryEmail)\n const primaryPhone = normalizeOptionalString(parsed.primaryPhone)\n const status = normalizeOptionalString(parsed.status)\n const lifecycleStage = normalizeOptionalString(parsed.lifecycleStage)\n const source = normalizeOptionalString(parsed.source)\n const preferredName = normalizeOptionalString(parsed.preferredName)\n const jobTitle = normalizeOptionalString(parsed.jobTitle)\n const department = normalizeOptionalString(parsed.department)\n const seniority = normalizeOptionalString(parsed.seniority)\n const timezone = normalizeOptionalString(parsed.timezone)\n const linkedInUrl = normalizeOptionalString(parsed.linkedInUrl)\n const twitterUrl = normalizeOptionalString(parsed.twitterUrl)\n const displayNameInput = parsed.displayName?.trim() ?? ''\n const displayName = displayNameInput.length > 0\n ? displayNameInput\n : deriveDisplayName(firstName, lastName)\n const nextInteractionName = parsed.nextInteraction?.name ? parsed.nextInteraction.name.trim() : null\n const nextInteractionRefId = normalizeOptionalString(parsed.nextInteraction?.refId)\n const nextInteractionIcon = normalizeOptionalString(parsed.nextInteraction?.icon)\n const nextInteractionColor = normalizeHexColor(parsed.nextInteraction?.color)\n if (!firstName || !lastName) {\n throw new CrudHttpError(400, { error: 'First and last name are required' })\n }\n if (!displayName) {\n throw new CrudHttpError(400, { error: 'Display name is required' })\n }\n\n let entity!: CustomerEntity\n let profile!: CustomerPersonProfile\n await withAtomicFlush(em, [\n () => {\n const graph = buildPersonGraph(em, {\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n displayName,\n description,\n ownerUserId: parsed.ownerUserId ?? null,\n primaryEmail,\n primaryPhone,\n status,\n lifecycleStage,\n source,\n nextInteractionAt: parsed.nextInteraction?.at ?? null,\n nextInteractionName,\n nextInteractionRefId,\n nextInteractionIcon,\n nextInteractionColor,\n isActive: parsed.isActive ?? true,\n firstName,\n lastName,\n preferredName,\n jobTitle,\n department,\n seniority,\n timezone,\n linkedInUrl,\n twitterUrl,\n })\n entity = graph.entity\n profile = graph.profile\n },\n async () => {\n if (status) {\n await ensureDictionaryEntry(em, {\n tenantId: parsed.tenantId,\n organizationId: parsed.organizationId,\n kind: 'status',\n value: status,\n })\n }\n if (jobTitle) {\n await ensureDictionaryEntry(em, {\n tenantId: parsed.tenantId,\n organizationId: parsed.organizationId,\n kind: 'job_title',\n value: jobTitle,\n })\n }\n if (source) {\n await ensureDictionaryEntry(em, {\n tenantId: parsed.tenantId,\n organizationId: parsed.organizationId,\n kind: 'source',\n value: source,\n })\n }\n },\n () => syncLegacyPrimaryCompanyLink(em, entity, profile, parsed.companyEntityId ?? null),\n () => syncEntityTags(em, entity, parsed.tags),\n ], { transaction: true })\n\n const tenantId = entity.tenantId\n const organizationId = entity.organizationId\n await setCustomFieldsForPerson(ctx, entity.id, profile.id, organizationId, tenantId, custom)\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudSideEffects({\n dataEngine: de,\n action: 'created',\n entity,\n identifiers: {\n id: profile.id ?? entity.id,\n tenantId,\n organizationId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n await emitQueryIndexUpsertEvents(ctx, [personEntityIndexEntry(entity)])\n\n return { entityId: entity.id, personId: profile.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n return await loadPersonSnapshot(em, result.entityId)\n },\n buildLog: async ({ result, snapshots }) => {\n const { translate } = await resolveTranslations()\n const snapshot = snapshots.after as PersonSnapshot | undefined\n return {\n actionLabel: translate('customers.audit.people.create', 'Create person'),\n resourceKind: 'customers.person',\n resourceId: result.entityId,\n tenantId: snapshot?.entity.tenantId ?? null,\n organizationId: snapshot?.entity.organizationId ?? null,\n snapshotAfter: snapshot ?? null,\n payload: {\n undo: {\n after: snapshot,\n },\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<PersonUndoPayload>(logEntry) ?? null\n const entityId = logEntry?.resourceId ?? payload?.after?.entity.id ?? null\n if (!entityId) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const entity = await em.findOne(CustomerEntity, { id: entityId })\n if (!entity) return\n const profile = await findOneWithDecryption(\n em,\n CustomerPersonProfile,\n { entity },\n undefined,\n { tenantId: entity.tenantId, organizationId: entity.organizationId },\n )\n const identifiers = {\n id: payload?.after?.profile.id ?? profile?.id ?? entity.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n }\n await withAtomicFlush(em, [\n () => em.nativeDelete(CustomerTagAssignment, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId }),\n () => {\n if (profile) em.remove(profile)\n },\n () => em.remove(entity),\n ], { transaction: true })\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudUndoSideEffects({\n dataEngine: de,\n action: 'deleted',\n entity,\n identifiers,\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n await emitQueryIndexDeleteEvents(ctx, [personEntityIndexEntry(entity)])\n },\n redo: async ({ logEntry, ctx }) => {\n const after = resolveRedoSnapshot<PersonSnapshot>(logEntry)\n if (!after) {\n throw new CrudHttpError(400, { error: '[internal] redo snapshot unavailable for person create' })\n }\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n let entity = await findOneWithDecryption(\n em,\n CustomerEntity,\n { id: after.entity.id },\n undefined,\n { tenantId: after.entity.tenantId, organizationId: after.entity.organizationId },\n )\n let profile!: CustomerPersonProfile\n if (!entity) {\n let newEntity!: CustomerEntity\n let newProfile!: CustomerPersonProfile\n await withAtomicFlush(em, [\n () => {\n const graph = buildPersonGraph(em, {\n entityId: after.entity.id,\n profileId: after.profile.id,\n organizationId: after.entity.organizationId,\n tenantId: after.entity.tenantId,\n displayName: after.entity.displayName,\n description: after.entity.description,\n ownerUserId: after.entity.ownerUserId,\n primaryEmail: after.entity.primaryEmail,\n primaryPhone: after.entity.primaryPhone,\n status: after.entity.status,\n lifecycleStage: after.entity.lifecycleStage,\n source: after.entity.source,\n nextInteractionAt: after.entity.nextInteractionAt,\n nextInteractionName: after.entity.nextInteractionName,\n nextInteractionRefId: after.entity.nextInteractionRefId,\n nextInteractionIcon: after.entity.nextInteractionIcon,\n nextInteractionColor: after.entity.nextInteractionColor,\n isActive: after.entity.isActive,\n firstName: after.profile.firstName,\n lastName: after.profile.lastName,\n preferredName: after.profile.preferredName,\n jobTitle: after.profile.jobTitle,\n department: after.profile.department,\n seniority: after.profile.seniority,\n timezone: after.profile.timezone,\n linkedInUrl: after.profile.linkedInUrl,\n twitterUrl: after.profile.twitterUrl,\n })\n newEntity = graph.entity\n newProfile = graph.profile\n },\n () => syncLegacyPrimaryCompanyLink(em, newEntity, newProfile, after.profile.companyEntityId),\n () => syncEntityTags(em, newEntity, after.tagIds),\n ], { transaction: true })\n entity = newEntity\n profile = newProfile\n } else {\n const existingProfile = await findOneWithDecryption(\n em,\n CustomerPersonProfile,\n { entity },\n undefined,\n { tenantId: after.entity.tenantId, organizationId: after.entity.organizationId },\n )\n if (!existingProfile) throw notFound('Person profile not found')\n profile = existingProfile\n const survivingEntity = entity\n await withAtomicFlush(em, [\n () => {\n survivingEntity.deletedAt = null\n survivingEntity.displayName = after.entity.displayName\n survivingEntity.description = after.entity.description\n survivingEntity.ownerUserId = after.entity.ownerUserId\n survivingEntity.primaryEmail = after.entity.primaryEmail\n survivingEntity.primaryPhone = after.entity.primaryPhone\n survivingEntity.status = after.entity.status\n survivingEntity.lifecycleStage = after.entity.lifecycleStage\n survivingEntity.source = after.entity.source\n survivingEntity.nextInteractionAt = after.entity.nextInteractionAt\n survivingEntity.nextInteractionName = after.entity.nextInteractionName\n survivingEntity.nextInteractionRefId = after.entity.nextInteractionRefId\n survivingEntity.nextInteractionIcon = after.entity.nextInteractionIcon\n survivingEntity.nextInteractionColor = after.entity.nextInteractionColor\n survivingEntity.isActive = after.entity.isActive\n profile.firstName = after.profile.firstName\n profile.lastName = after.profile.lastName\n profile.preferredName = after.profile.preferredName\n profile.jobTitle = after.profile.jobTitle\n profile.department = after.profile.department\n profile.seniority = after.profile.seniority\n profile.timezone = after.profile.timezone\n profile.linkedInUrl = after.profile.linkedInUrl\n profile.twitterUrl = after.profile.twitterUrl\n },\n () => syncLegacyPrimaryCompanyLink(em, survivingEntity, profile, after.profile.companyEntityId),\n () => syncEntityTags(em, survivingEntity, after.tagIds),\n ], { transaction: true })\n }\n\n const restoredEntity = entity\n const restoreValues = buildCustomFieldResetMap(after.custom, undefined)\n if (Object.keys(restoreValues).length) {\n await setCustomFieldsForPerson(ctx, restoredEntity.id, profile.id, restoredEntity.organizationId, restoredEntity.tenantId, restoreValues)\n }\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudSideEffects({\n dataEngine: de,\n action: 'created',\n entity: restoredEntity,\n identifiers: {\n id: profile.id ?? restoredEntity.id,\n tenantId: restoredEntity.tenantId,\n organizationId: restoredEntity.organizationId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n await emitQueryIndexUpsertEvents(ctx, [personEntityIndexEntry(restoredEntity)])\n\n return { entityId: restoredEntity.id, personId: profile.id }\n },\n}\n\nconst updatePersonCommand: CommandHandler<PersonUpdateInput, { entityId: string }> = {\n id: 'customers.people.update',\n async prepare(rawInput, ctx) {\n const { parsed } = parseWithCustomFields(personUpdateSchema, rawInput)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const snapshot = await loadPersonSnapshot(em, parsed.id)\n return snapshot ? { before: snapshot } : {}\n },\n async execute(rawInput, ctx) {\n const { parsed, custom } = parseWithCustomFields(personUpdateSchema, rawInput)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const entity = await em.findOne(CustomerEntity, { id: parsed.id, deletedAt: null })\n const record = assertFound(entity, 'Person not found')\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n const profile = await em.findOne(CustomerPersonProfile, { entity: record })\n if (!profile) throw notFound('Person profile not found')\n\n if (parsed.displayName !== undefined) {\n const nextDisplayName = parsed.displayName.trim()\n if (!nextDisplayName) {\n throw new CrudHttpError(400, { error: 'Display name is required' })\n }\n }\n\n if (\n parsed.displayName === undefined\n && (parsed.firstName !== undefined || parsed.lastName !== undefined)\n && isDerivedDisplayName(record.displayName, profile.firstName, profile.lastName)\n ) {\n const nextFirst = parsed.firstName !== undefined ? parsed.firstName : profile.firstName\n const nextLast = parsed.lastName !== undefined ? parsed.lastName : profile.lastName\n const derived = deriveDisplayName(nextFirst, nextLast)\n if (derived.length > 0) parsed.displayName = derived\n }\n\n await withAtomicFlush(em, [\n () => {\n if (parsed.description !== undefined) record.description = normalizeOptionalString(parsed.description)\n if (parsed.ownerUserId !== undefined) record.ownerUserId = parsed.ownerUserId ?? null\n if (parsed.primaryEmail !== undefined) record.primaryEmail = normalizeEmail(parsed.primaryEmail)\n if (parsed.primaryPhone !== undefined) record.primaryPhone = normalizeOptionalString(parsed.primaryPhone)\n if (parsed.status !== undefined) {\n record.status = normalizeOptionalString(parsed.status)\n }\n if (parsed.lifecycleStage !== undefined) record.lifecycleStage = normalizeOptionalString(parsed.lifecycleStage)\n if (parsed.source !== undefined) {\n record.source = normalizeOptionalString(parsed.source)\n }\n if (parsed.isActive !== undefined) record.isActive = parsed.isActive\n if (parsed.nextInteraction) {\n record.nextInteractionAt = parsed.nextInteraction.at\n record.nextInteractionName = parsed.nextInteraction.name.trim()\n record.nextInteractionRefId = normalizeOptionalString(parsed.nextInteraction.refId) ?? null\n record.nextInteractionIcon = normalizeOptionalString(parsed.nextInteraction.icon)\n record.nextInteractionColor = normalizeHexColor(parsed.nextInteraction.color)\n } else if (parsed.nextInteraction === null) {\n record.nextInteractionAt = null\n record.nextInteractionName = null\n record.nextInteractionRefId = null\n record.nextInteractionIcon = null\n record.nextInteractionColor = null\n }\n\n if (parsed.firstName !== undefined) profile.firstName = normalizeOptionalString(parsed.firstName)\n if (parsed.lastName !== undefined) profile.lastName = normalizeOptionalString(parsed.lastName)\n if (parsed.preferredName !== undefined) profile.preferredName = normalizeOptionalString(parsed.preferredName)\n if (parsed.jobTitle !== undefined) {\n profile.jobTitle = normalizeOptionalString(parsed.jobTitle)\n }\n if (parsed.department !== undefined) profile.department = normalizeOptionalString(parsed.department)\n if (parsed.seniority !== undefined) profile.seniority = normalizeOptionalString(parsed.seniority)\n if (parsed.timezone !== undefined) profile.timezone = normalizeOptionalString(parsed.timezone)\n if (parsed.linkedInUrl !== undefined) profile.linkedInUrl = normalizeOptionalString(parsed.linkedInUrl)\n if (parsed.twitterUrl !== undefined) profile.twitterUrl = normalizeOptionalString(parsed.twitterUrl)\n\n const profileFieldsUpdated = [\n parsed.firstName, parsed.lastName, parsed.preferredName, parsed.jobTitle,\n parsed.department, parsed.seniority, parsed.timezone, parsed.linkedInUrl,\n parsed.twitterUrl, parsed.companyEntityId,\n ].some((v) => v !== undefined)\n if (profileFieldsUpdated) {\n record.updatedAt = new Date()\n }\n\n if (parsed.displayName !== undefined) {\n record.displayName = parsed.displayName.trim()\n }\n },\n async () => {\n if (parsed.status !== undefined) {\n const normalizedStatus = normalizeOptionalString(parsed.status)\n if (normalizedStatus) {\n await ensureDictionaryEntry(em, {\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n kind: 'status',\n value: normalizedStatus,\n })\n }\n }\n if (parsed.source !== undefined) {\n const normalizedSource = normalizeOptionalString(parsed.source)\n if (normalizedSource) {\n await ensureDictionaryEntry(em, {\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n kind: 'source',\n value: normalizedSource,\n })\n }\n }\n if (parsed.jobTitle !== undefined) {\n const normalizedJobTitle = normalizeOptionalString(parsed.jobTitle)\n if (normalizedJobTitle) {\n await ensureDictionaryEntry(em, {\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n kind: 'job_title',\n value: normalizedJobTitle,\n })\n }\n }\n },\n async () => {\n if (parsed.companyEntityId !== undefined) {\n await syncLegacyPrimaryCompanyLink(em, record, profile, parsed.companyEntityId)\n }\n },\n () => syncEntityTags(em, record, parsed.tags),\n ], { transaction: true })\n\n await setCustomFieldsForPerson(ctx, record.id, profile.id, record.organizationId, record.tenantId, custom)\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudSideEffects({\n dataEngine: de,\n action: 'updated',\n entity: record,\n identifiers: {\n id: profile.id ?? record.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n await emitQueryIndexUpsertEvents(ctx, [personEntityIndexEntry(record)])\n\n // Expose the freshly-bumped updatedAt for inline-edit sequential-save lock refresh (#2055).\n return { entityId: record.id, updatedAt: record.updatedAt }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n return await loadPersonSnapshot(em, result.entityId)\n },\n buildLog: async ({ snapshots }) => {\n const { translate } = await resolveTranslations()\n const before = snapshots.before as PersonSnapshot | undefined\n if (!before) return null\n const afterSnapshot = snapshots.after as PersonSnapshot | undefined\n if (afterSnapshot && snapshotsEqual(before, afterSnapshot)) {\n return { skipLog: true }\n }\n return {\n actionLabel: translate('customers.audit.people.update', 'Update person'),\n resourceKind: 'customers.person',\n resourceId: before.entity.id,\n tenantId: before.entity.tenantId,\n organizationId: before.entity.organizationId,\n snapshotBefore: before,\n snapshotAfter: afterSnapshot ?? null,\n payload: {\n undo: {\n before,\n after: afterSnapshot ?? null,\n } satisfies PersonUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<PersonUndoPayload>(logEntry, CUSTOMER_ENTITY_UNDO_DATE_OPTIONS)\n const before = payload?.before\n if (!before) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const entity = await em.findOne(CustomerEntity, { id: before.entity.id })\n if (!entity) {\n let newEntity!: CustomerEntity\n let newProfile!: CustomerPersonProfile\n await withAtomicFlush(em, [\n () => {\n newEntity = em.create(CustomerEntity, {\n id: before.entity.id,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n kind: 'person',\n displayName: before.entity.displayName,\n description: before.entity.description,\n ownerUserId: before.entity.ownerUserId,\n primaryEmail: before.entity.primaryEmail,\n primaryPhone: before.entity.primaryPhone,\n status: before.entity.status,\n lifecycleStage: before.entity.lifecycleStage,\n source: before.entity.source,\n nextInteractionAt: before.entity.nextInteractionAt,\n nextInteractionName: before.entity.nextInteractionName,\n nextInteractionRefId: before.entity.nextInteractionRefId,\n nextInteractionIcon: before.entity.nextInteractionIcon,\n nextInteractionColor: before.entity.nextInteractionColor,\n isActive: before.entity.isActive,\n })\n em.persist(newEntity)\n newProfile = em.create(CustomerPersonProfile, {\n id: before.profile.id,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n entity: newEntity,\n firstName: before.profile.firstName,\n lastName: before.profile.lastName,\n preferredName: before.profile.preferredName,\n jobTitle: before.profile.jobTitle,\n department: before.profile.department,\n seniority: before.profile.seniority,\n timezone: before.profile.timezone,\n linkedInUrl: before.profile.linkedInUrl,\n twitterUrl: before.profile.twitterUrl,\n })\n em.persist(newProfile)\n },\n () => syncLegacyPrimaryCompanyLink(em, newEntity, newProfile, before.profile.companyEntityId),\n () => syncEntityTags(em, newEntity, before.tagIds),\n ], { transaction: true })\n } else {\n await withAtomicFlush(em, [\n () => {\n entity.displayName = before.entity.displayName\n entity.description = before.entity.description\n entity.ownerUserId = before.entity.ownerUserId\n entity.primaryEmail = before.entity.primaryEmail\n entity.primaryPhone = before.entity.primaryPhone\n entity.status = before.entity.status\n entity.lifecycleStage = before.entity.lifecycleStage\n entity.source = before.entity.source\n entity.nextInteractionAt = before.entity.nextInteractionAt\n entity.nextInteractionName = before.entity.nextInteractionName\n entity.nextInteractionRefId = before.entity.nextInteractionRefId\n entity.nextInteractionIcon = before.entity.nextInteractionIcon\n entity.nextInteractionColor = before.entity.nextInteractionColor\n entity.isActive = before.entity.isActive\n },\n async () => {\n const profile = await findOneWithDecryption(\n em,\n CustomerPersonProfile,\n { entity },\n undefined,\n { tenantId: before.entity.tenantId, organizationId: before.entity.organizationId },\n )\n if (profile) {\n profile.firstName = before.profile.firstName\n profile.lastName = before.profile.lastName\n profile.preferredName = before.profile.preferredName\n profile.jobTitle = before.profile.jobTitle\n profile.department = before.profile.department\n profile.seniority = before.profile.seniority\n profile.timezone = before.profile.timezone\n profile.linkedInUrl = before.profile.linkedInUrl\n profile.twitterUrl = before.profile.twitterUrl\n await syncLegacyPrimaryCompanyLink(em, entity, profile, before.profile.companyEntityId)\n }\n },\n () => syncEntityTags(em, entity, before.tagIds),\n ], { transaction: true })\n }\n\n const indexedEntity = await em.findOne(CustomerEntity, { id: before.entity.id })\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudUndoSideEffects({\n dataEngine: de,\n action: 'updated',\n entity: indexedEntity,\n identifiers: {\n id: before.profile.id ?? before.entity.id,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n if (indexedEntity) {\n await emitQueryIndexUpsertEvents(ctx, [personEntityIndexEntry(indexedEntity)])\n }\n\n const resetValues = buildCustomFieldResetMap(before.custom, payload?.after?.custom)\n if (Object.keys(resetValues).length) {\n await setCustomFieldsForPerson(ctx, before.entity.id, before.profile.id, before.entity.organizationId, before.entity.tenantId, resetValues)\n }\n },\n}\n\nconst deletePersonCommand: CommandHandler<{ body?: Record<string, unknown>; query?: Record<string, unknown> }, { entityId: string }> =\n {\n id: 'customers.people.delete',\n async prepare(input, ctx) {\n const id = requireId(input, 'Person id required')\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const snapshot = await loadPersonSnapshot(em, id)\n return snapshot ? { before: snapshot } : {}\n },\n async execute(input, ctx) {\n const id = requireId(input, 'Person id required')\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const snapshot = await loadPersonSnapshot(em, id)\n const entity = await em.findOne(CustomerEntity, { id, deletedAt: null })\n const record = assertFound(entity, 'Person not found')\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n\n const dealLinks = await em.count(CustomerDealPersonLink, { person: record })\n if (dealLinks > 0) {\n const { translate } = await resolveTranslations()\n throw buildPersonHasDependentsError(translate, { dealLinks })\n }\n\n const profile = await em.findOne(CustomerPersonProfile, { entity: record })\n await withAtomicFlush(em, [\n async () => {\n if (profile) em.remove(profile)\n await em.nativeDelete(CustomerAddress, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerComment, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerActivity, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerInteraction, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerTodoLink, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerTagAssignment, { entity: record, organizationId: record.organizationId, tenantId: record.tenantId })\n await em.nativeDelete(CustomerDealPersonLink, { person: record })\n await em.nativeDelete(CustomerPersonCompanyLink, { person: record })\n if (profile) {\n await em.nativeDelete(CustomFieldValue, { entityId: PERSON_ENTITY_ID, recordId: profile.id })\n }\n await em.nativeDelete(CustomFieldValue, { entityId: CUSTOMER_ENTITY_ID, recordId: record.id })\n em.remove(record)\n },\n ], { transaction: true })\n\n const indexDeletes: QueryIndexEventEntry[] = []\n const dealUpserts: QueryIndexEventEntry[] = []\n if (snapshot) {\n for (const activity of snapshot.activities ?? []) {\n indexDeletes.push({\n entityType: E.customers.customer_activity,\n recordId: activity.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n for (const comment of snapshot.comments ?? []) {\n indexDeletes.push({\n entityType: E.customers.customer_comment,\n recordId: comment.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n for (const address of snapshot.addresses ?? []) {\n indexDeletes.push({\n entityType: E.customers.customer_address,\n recordId: address.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n for (const todo of snapshot.todos ?? []) {\n indexDeletes.push({\n entityType: E.customers.customer_todo_link,\n recordId: todo.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n for (const interaction of snapshot.interactions ?? []) {\n indexDeletes.push({\n entityType: E.customers.customer_interaction,\n recordId: interaction.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n for (const deal of snapshot.deals ?? []) {\n if (deal.dealId) {\n dealUpserts.push({\n entityType: E.customers.customer_deal,\n recordId: deal.dealId,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n })\n }\n }\n }\n\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudSideEffects({\n dataEngine: de,\n action: 'deleted',\n entity: record,\n identifiers: {\n id: profile?.id ?? record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n\n await emitQueryIndexDeleteEvents(ctx, [personEntityIndexEntry(record)])\n await emitQueryIndexDeleteEvents(ctx, indexDeletes)\n await emitQueryIndexUpsertEvents(ctx, dealUpserts)\n return { entityId: record.id }\n },\n buildLog: async ({ snapshots }) => {\n const before = snapshots.before as PersonSnapshot | undefined\n if (!before) return null\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('customers.audit.people.delete', 'Delete person'),\n resourceKind: 'customers.person',\n resourceId: before.entity.id,\n tenantId: before.entity.tenantId,\n organizationId: before.entity.organizationId,\n snapshotBefore: before,\n payload: {\n undo: {\n before,\n } satisfies PersonUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<PersonUndoPayload>(logEntry, CUSTOMER_ENTITY_UNDO_DATE_OPTIONS)\n const before = payload?.before\n if (!before) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const de = (ctx.container.resolve('dataEngine') as DataEngine)\n\n const decryptionScope = {\n tenantId: before.entity.tenantId ?? null,\n organizationId: before.entity.organizationId ?? null,\n }\n // Bind the outer EntityManager to an explicit transaction so every\n // `em.flush()` below participates in the same unit of work. Using\n // `em.transactional(cb)` would pass a forked em into `cb` and the\n // surrounding closures would mutate the unwrapped em, escaping the\n // transaction (see SPEC-018 and H8 in the CRM details screens review).\n await em.begin()\n let txResult: {\n entity: CustomerEntity\n profile: CustomerPersonProfile\n beforeInteractions: PersonInteractionSnapshot[]\n beforeTodos: PersonTodoSnapshot[]\n }\n try {\n txResult = await (async () => {\n let entity = await findOneWithDecryption(\n em,\n CustomerEntity,\n {\n id: before.entity.id,\n tenantId: before.entity.tenantId,\n organizationId: before.entity.organizationId,\n },\n {},\n decryptionScope,\n )\n if (!entity) {\n entity = em.create(CustomerEntity, {\n id: before.entity.id,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n kind: 'person',\n displayName: before.entity.displayName,\n description: before.entity.description,\n ownerUserId: before.entity.ownerUserId,\n primaryEmail: before.entity.primaryEmail,\n primaryPhone: before.entity.primaryPhone,\n status: before.entity.status,\n lifecycleStage: before.entity.lifecycleStage,\n source: before.entity.source,\n nextInteractionAt: before.entity.nextInteractionAt,\n nextInteractionName: before.entity.nextInteractionName,\n nextInteractionRefId: before.entity.nextInteractionRefId,\n nextInteractionIcon: before.entity.nextInteractionIcon,\n nextInteractionColor: before.entity.nextInteractionColor,\n isActive: before.entity.isActive,\n })\n em.persist(entity)\n }\n\n entity.displayName = before.entity.displayName\n entity.description = before.entity.description\n entity.ownerUserId = before.entity.ownerUserId\n entity.primaryEmail = before.entity.primaryEmail\n entity.primaryPhone = before.entity.primaryPhone\n entity.status = before.entity.status\n entity.lifecycleStage = before.entity.lifecycleStage\n entity.source = before.entity.source\n entity.nextInteractionAt = before.entity.nextInteractionAt\n entity.nextInteractionName = before.entity.nextInteractionName\n entity.nextInteractionRefId = before.entity.nextInteractionRefId\n entity.nextInteractionIcon = before.entity.nextInteractionIcon\n entity.nextInteractionColor = before.entity.nextInteractionColor\n entity.isActive = before.entity.isActive\n entity.deletedAt = null\n\n let profile = await findOneWithDecryption(\n em,\n CustomerPersonProfile,\n {\n entity,\n tenantId: before.entity.tenantId,\n organizationId: before.entity.organizationId,\n },\n {},\n decryptionScope,\n )\n if (!profile) {\n profile = em.create(CustomerPersonProfile, {\n id: before.profile.id,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n entity,\n firstName: before.profile.firstName,\n lastName: before.profile.lastName,\n preferredName: before.profile.preferredName,\n jobTitle: before.profile.jobTitle,\n department: before.profile.department,\n seniority: before.profile.seniority,\n timezone: before.profile.timezone,\n linkedInUrl: before.profile.linkedInUrl,\n twitterUrl: before.profile.twitterUrl,\n })\n } else {\n profile.firstName = before.profile.firstName\n profile.lastName = before.profile.lastName\n profile.preferredName = before.profile.preferredName\n profile.jobTitle = before.profile.jobTitle\n profile.department = before.profile.department\n profile.seniority = before.profile.seniority\n profile.timezone = before.profile.timezone\n profile.linkedInUrl = before.profile.linkedInUrl\n profile.twitterUrl = before.profile.twitterUrl\n }\n\n await syncLegacyPrimaryCompanyLink(em, entity, profile, before.profile.companyEntityId)\n\n await em.flush()\n await em.nativeDelete(CustomerPersonCompanyLink, { person: entity })\n for (const companyLink of before.companies ?? []) {\n const company = await resolveCompanyReference(\n em,\n companyLink.companyId,\n before.entity.organizationId,\n before.entity.tenantId,\n )\n if (!company) continue\n const restoredLink = em.create(CustomerPersonCompanyLink, {\n id: companyLink.linkId ?? undefined,\n organizationId: before.entity.organizationId,\n tenantId: before.entity.tenantId,\n person: entity,\n company,\n isPrimary: companyLink.isPrimary,\n })\n em.persist(restoredLink)\n if (companyLink.isPrimary) {\n profile.company = company\n }\n }\n await withAtomicFlush(em, [\n () => syncEntityTags(em, entity, before.tagIds),\n ])\n\n const beforeActivities = (before as { activities?: PersonActivitySnapshot[] }).activities ?? []\n const beforeTodos = (before as { todos?: PersonTodoSnapshot[] }).todos ?? []\n const beforeInteractions = (before as { interactions?: PersonInteractionSnapshot[] }).interactions ?? []\n\n const relatedDealIds = new Set<string>()\n for (const link of before.deals) relatedDealIds.add(link.dealId)\n for (const activity of beforeActivities) {\n if (activity.dealId) relatedDealIds.add(activity.dealId)\n }\n for (const comment of before.comments) {\n if (comment.dealId) relatedDealIds.add(comment.dealId)\n }\n let dealMap = new Map<string, CustomerDeal>()\n if (relatedDealIds.size) {\n const deals = await em.find(CustomerDeal, {\n id: { $in: Array.from(relatedDealIds) },\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n })\n dealMap = new Map(deals.map((deal) => [deal.id, deal]))\n }\n\n await em.nativeDelete(CustomerDealPersonLink, { person: entity })\n for (const link of before.deals) {\n const deal = dealMap.get(link.dealId)\n if (!deal) continue\n const restoredLink = em.create(CustomerDealPersonLink, {\n id: link.id,\n deal,\n person: entity,\n participantRole: link.participantRole,\n isPrimary: link.isPrimary === true,\n createdAt: link.createdAt,\n })\n em.persist(restoredLink)\n }\n await em.flush()\n\n await em.nativeDelete(CustomerActivity, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId })\n for (const activity of beforeActivities) {\n const restoredActivity = em.create(CustomerActivity, {\n id: activity.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n entity,\n activityType: activity.activityType,\n subject: activity.subject,\n body: activity.body,\n occurredAt: activity.occurredAt,\n authorUserId: activity.authorUserId,\n appearanceIcon: activity.appearanceIcon,\n appearanceColor: activity.appearanceColor,\n deal: activity.dealId ? dealMap.get(activity.dealId) ?? null : null,\n createdAt: activity.createdAt,\n updatedAt: activity.updatedAt,\n })\n em.persist(restoredActivity)\n }\n await em.flush()\n\n await em.nativeDelete(CustomerComment, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId })\n for (const comment of before.comments) {\n const restoredComment = em.create(CustomerComment, {\n id: comment.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n entity,\n body: comment.body,\n authorUserId: comment.authorUserId,\n appearanceIcon: comment.appearanceIcon,\n appearanceColor: comment.appearanceColor,\n deal: comment.dealId ? dealMap.get(comment.dealId) ?? null : null,\n createdAt: comment.createdAt,\n updatedAt: comment.updatedAt,\n deletedAt: comment.deletedAt,\n })\n em.persist(restoredComment)\n }\n await em.flush()\n\n await em.nativeDelete(CustomerAddress, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId })\n for (const address of before.addresses) {\n const restoredAddress = em.create(CustomerAddress, {\n id: address.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n entity,\n name: address.name,\n purpose: address.purpose,\n addressLine1: address.addressLine1,\n addressLine2: address.addressLine2,\n city: address.city,\n region: address.region,\n postalCode: address.postalCode,\n country: address.country,\n latitude: address.latitude,\n longitude: address.longitude,\n isPrimary: address.isPrimary,\n })\n em.persist(restoredAddress)\n }\n await em.flush()\n\n await em.nativeDelete(CustomerTodoLink, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId })\n for (const todo of beforeTodos) {\n const restoredTodo = em.create(CustomerTodoLink, {\n id: todo.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n entity,\n todoId: todo.todoId,\n todoSource: todo.todoSource,\n createdAt: todo.createdAt,\n createdByUserId: todo.createdByUserId,\n })\n em.persist(restoredTodo)\n }\n await em.flush()\n\n await em.nativeDelete(CustomerInteraction, { entity, organizationId: entity.organizationId, tenantId: entity.tenantId })\n for (const interaction of beforeInteractions) {\n const restoredInteraction = em.create(CustomerInteraction, {\n id: interaction.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n entity,\n interactionType: interaction.interactionType,\n title: interaction.title,\n body: interaction.body,\n status: interaction.status,\n scheduledAt: interaction.scheduledAt,\n occurredAt: interaction.occurredAt,\n priority: interaction.priority,\n authorUserId: interaction.authorUserId,\n ownerUserId: interaction.ownerUserId,\n dealId: interaction.dealId,\n source: interaction.source,\n appearanceIcon: interaction.appearanceIcon,\n appearanceColor: interaction.appearanceColor,\n createdAt: interaction.createdAt,\n updatedAt: interaction.updatedAt,\n deletedAt: interaction.deletedAt,\n })\n em.persist(restoredInteraction)\n }\n await em.flush()\n\n return { entity, profile, beforeInteractions, beforeTodos }\n })()\n await em.commit()\n } catch (err) {\n try {\n await em.rollback()\n } catch {\n // rollback failure should not mask the original error\n }\n throw err\n }\n\n for (const interaction of txResult.beforeInteractions) {\n if (!interaction.custom || !Object.keys(interaction.custom).length) continue\n await setCustomFieldsIfAny({\n dataEngine: de,\n entityId: INTERACTION_ENTITY_ID,\n recordId: interaction.id,\n organizationId: txResult.entity.organizationId,\n tenantId: txResult.entity.tenantId,\n values: interaction.custom,\n notify: false,\n })\n }\n\n const entity = txResult.entity\n const profile = txResult.profile\n\n await emitCrudUndoSideEffects({\n dataEngine: de,\n action: 'created',\n entity,\n identifiers: {\n id: profile.id ?? entity.id,\n organizationId: entity.organizationId,\n tenantId: entity.tenantId,\n },\n syncOrigin: ctx.syncOrigin,\n actorUserId: ctx.auth?.sub ?? null,\n indexer: personCrudIndexer,\n events: personCrudEvents,\n })\n\n const upsertEntries: QueryIndexEventEntry[] = []\n for (const activity of before.activities ?? []) {\n upsertEntries.push({\n entityType: E.customers.customer_activity,\n recordId: activity.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n for (const comment of before.comments ?? []) {\n upsertEntries.push({\n entityType: E.customers.customer_comment,\n recordId: comment.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n for (const address of before.addresses ?? []) {\n upsertEntries.push({\n entityType: E.customers.customer_address,\n recordId: address.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n for (const todo of txResult.beforeTodos ?? []) {\n upsertEntries.push({\n entityType: E.customers.customer_todo_link,\n recordId: todo.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n for (const interaction of txResult.beforeInteractions ?? []) {\n upsertEntries.push({\n entityType: E.customers.customer_interaction,\n recordId: interaction.id,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n const dealUpserts: QueryIndexEventEntry[] = []\n for (const deal of before.deals ?? []) {\n if (deal.dealId) {\n dealUpserts.push({\n entityType: E.customers.customer_deal,\n recordId: deal.dealId,\n tenantId: entity.tenantId,\n organizationId: entity.organizationId,\n })\n }\n }\n const resetValues = buildCustomFieldResetMap(before.custom, undefined)\n if (Object.keys(resetValues).length) {\n await setCustomFieldsForPerson(ctx, entity.id, profile.id, entity.organizationId, entity.tenantId, resetValues)\n }\n await emitQueryIndexUpsertEvents(ctx, [personEntityIndexEntry(entity)])\n await emitQueryIndexUpsertEvents(ctx, upsertEntries)\n await emitQueryIndexUpsertEvents(ctx, dealUpserts)\n },\n }\n\nregisterCommand(createPersonCommand)\nregisterCommand(updatePersonCommand)\nregisterCommand(deletePersonCommand)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iCAAiC,oBAAoB,wBAAwB;AACtF,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,eAAe,gBAAgB;AACxC,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,SAAS;AAClB,SAAS,oBAAoB,6BAA6B;AAC1D,SAAS,mBAAmB,4BAA4B;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,wBAAwB;AAoI9B,MAAM,oBAAuD;AAAA,EAC3D,YAAY,EAAE,UAAU;AAC1B;AAEA,MAAM,mBAAqD;AAAA,EACzD,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,cAAc,CAAC,SAAS;AAAA,IACtB,IAAI,IAAI,YAAY;AAAA,IACpB,UAAU,IAAI,QAAQ,MAAM,IAAI,Y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A,QACf,UAAU,OAAO;AAAA,QACjB,gBAAgB,OAAO;AAAA,MACzB,CAAC;AAAA,IACH;AACA,eAAW,eAAe,SAAS,sBAAsB,CAAC,GAAG;AAC3D,oBAAc,KAAK;AAAA,QACjB,YAAY,EAAE,UAAU;AAAA,QACxB,UAAU,YAAY;AAAA,QACtB,UAAU,OAAO;AAAA,QACjB,gBAAgB,OAAO;AAAA,MACzB,CAAC;AAAA,IACH;AACA,UAAM,cAAsC,CAAC;AAC7C,eAAW,QAAQ,OAAO,SAAS,CAAC,GAAG;AACrC,UAAI,KAAK,QAAQ;AACf,oBAAY,KAAK;AAAA,UACf,YAAY,EAAE,UAAU;AAAA,UACxB,UAAU,KAAK;AAAA,UACf,UAAU,OAAO;AAAA,UACjB,gBAAgB,OAAO;AAAA,QACzB,CAAC;AAAA,MACH;AAAA,IACF;AACA,UAAM,cAAc,yBAAyB,OAAO,QAAQ,MAAS;AACrE,QAAI,OAAO,KAAK,WAAW,EAAE,QAAQ;AACnC,YAAM,yBAAyB,KAAK,OAAO,IAAI,QAAQ,IAAI,OAAO,gBAAgB,OAAO,UAAU,WAAW;AAAA,IAChH;AACA,UAAM,2BAA2B,KAAK,CAAC,uBAAuB,MAAM,CAAC,CAAC;AACtE,UAAM,2BAA2B,KAAK,aAAa;AACnD,UAAM,2BAA2B,KAAK,WAAW;AAAA,EACnD;AACF;AAEF,gBAAgB,mBAAmB;AACnC,gBAAgB,mBAAmB;AACnC,gBAAgB,mBAAmB;",
|
|
6
6
|
"names": ["entity", "profile"]
|
|
7
7
|
}
|
|
@@ -6,6 +6,9 @@ import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
|
6
6
|
const logger = createLogger("customers");
|
|
7
7
|
import { ensureOrganizationScope as ensureOrganizationScope2, ensureSameScope as ensureSameScope2, ensureTenantScope } from "@open-mercato/shared/lib/commands/scope";
|
|
8
8
|
import { extractUndoPayload } from "@open-mercato/shared/lib/commands/undo";
|
|
9
|
+
const CUSTOMER_ENTITY_UNDO_DATE_OPTIONS = {
|
|
10
|
+
datePaths: ["before.entity.nextInteractionAt"]
|
|
11
|
+
};
|
|
9
12
|
function normalizeDictionaryColor(input) {
|
|
10
13
|
if (typeof input !== "string") return null;
|
|
11
14
|
const trimmed = input.trim();
|
|
@@ -240,6 +243,7 @@ async function emitQueryIndexUpsertEvents(ctx, entries) {
|
|
|
240
243
|
await emitQueryIndexEvents(ctx, entries, "upsert");
|
|
241
244
|
}
|
|
242
245
|
export {
|
|
246
|
+
CUSTOMER_ENTITY_UNDO_DATE_OPTIONS,
|
|
243
247
|
assertFound,
|
|
244
248
|
emitQueryIndexDeleteEvents,
|
|
245
249
|
emitQueryIndexUpsertEvents,
|