@open-mercato/core 0.6.8-develop.7100.1.fbf66fca35 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/helpers/integration/api.js +1 -13
- package/dist/helpers/integration/api.js.map +2 -2
- package/dist/helpers/integration/communicationChannelsFixtures.js +0 -19
- package/dist/helpers/integration/communicationChannelsFixtures.js.map +2 -2
- package/dist/modules/api_keys/api/keys/route.js +1 -1
- package/dist/modules/api_keys/api/keys/route.js.map +2 -2
- package/dist/modules/api_keys/backend/api-keys/page.js +1 -3
- package/dist/modules/api_keys/backend/api-keys/page.js.map +2 -2
- package/dist/modules/attachments/api/route.js +2 -2
- package/dist/modules/attachments/api/route.js.map +2 -2
- package/dist/modules/attachments/components/AttachmentLibrary.js +0 -2
- package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
- package/dist/modules/attachments/di.js +1 -11
- package/dist/modules/attachments/di.js.map +2 -2
- package/dist/modules/attachments/index.js.map +1 -1
- package/dist/modules/attachments/lib/scoped-upload-service.js +2 -15
- package/dist/modules/attachments/lib/scoped-upload-service.js.map +2 -2
- package/dist/modules/attachments/lib/upload-limits.js +2 -6
- package/dist/modules/attachments/lib/upload-limits.js.map +2 -2
- package/dist/modules/audit_logs/backend/audit-logs/page.js +0 -6
- package/dist/modules/audit_logs/backend/audit-logs/page.js.map +2 -2
- package/dist/modules/audit_logs/lib/display-helpers.js +11 -19
- package/dist/modules/audit_logs/lib/display-helpers.js.map +2 -2
- package/dist/modules/audit_logs/services/actionLogService.js +12 -57
- package/dist/modules/audit_logs/services/actionLogService.js.map +3 -3
- package/dist/modules/auth/acl.js +5 -30
- package/dist/modules/auth/acl.js.map +2 -2
- package/dist/modules/auth/api/feature-check.js +2 -8
- package/dist/modules/auth/api/feature-check.js.map +2 -2
- package/dist/modules/auth/api/login.js +20 -4
- package/dist/modules/auth/api/login.js.map +2 -2
- package/dist/modules/auth/api/roles/acl/route.js +33 -28
- package/dist/modules/auth/api/roles/acl/route.js.map +2 -2
- package/dist/modules/auth/api/routeError.js +11 -0
- package/dist/modules/auth/api/routeError.js.map +7 -0
- package/dist/modules/auth/api/session/refresh.js +1 -25
- package/dist/modules/auth/api/session/refresh.js.map +2 -2
- package/dist/modules/auth/api/users/acl/route.js +73 -102
- package/dist/modules/auth/api/users/acl/route.js.map +2 -2
- package/dist/modules/auth/api/users/route.js +5 -13
- package/dist/modules/auth/api/users/route.js.map +2 -2
- package/dist/modules/auth/backend/roles/[id]/edit/page.meta.js +1 -5
- package/dist/modules/auth/backend/roles/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/auth/backend/roles/page.js +1 -3
- package/dist/modules/auth/backend/roles/page.js.map +2 -2
- package/dist/modules/auth/backend/users/[id]/edit/page.meta.js +1 -5
- package/dist/modules/auth/backend/users/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/auth/backend/users/page.js +1 -2
- package/dist/modules/auth/backend/users/page.js.map +2 -2
- package/dist/modules/auth/components/AclEditor.js +30 -39
- package/dist/modules/auth/components/AclEditor.js.map +2 -2
- package/dist/modules/auth/data/entities.js.map +2 -2
- package/dist/modules/auth/data/validators.js +1 -5
- package/dist/modules/auth/data/validators.js.map +2 -2
- package/dist/modules/auth/di.js +9 -35
- package/dist/modules/auth/di.js.map +2 -2
- package/dist/modules/auth/frontend/reset/[token]/page.js +0 -46
- package/dist/modules/auth/frontend/reset/[token]/page.js.map +2 -2
- package/dist/modules/auth/lib/grantChecks.js.map +2 -2
- package/dist/modules/auth/services/authService.js +2 -16
- package/dist/modules/auth/services/authService.js.map +2 -2
- package/dist/modules/auth/services/rbacService.js +24 -67
- package/dist/modules/auth/services/rbacService.js.map +3 -3
- package/dist/modules/business_rules/backend/logs/page.js +1 -3
- package/dist/modules/business_rules/backend/logs/page.js.map +2 -2
- package/dist/modules/business_rules/backend/rules/[id]/page.meta.js +6 -1
- package/dist/modules/business_rules/backend/rules/[id]/page.meta.js.map +2 -2
- package/dist/modules/business_rules/backend/rules/create/page.meta.js +5 -1
- package/dist/modules/business_rules/backend/rules/create/page.meta.js.map +2 -2
- package/dist/modules/business_rules/backend/rules/page.js +1 -3
- package/dist/modules/business_rules/backend/rules/page.js.map +2 -2
- package/dist/modules/business_rules/backend/sets/[id]/page.meta.js +6 -1
- package/dist/modules/business_rules/backend/sets/[id]/page.meta.js.map +2 -2
- package/dist/modules/business_rules/backend/sets/create/page.meta.js +5 -1
- package/dist/modules/business_rules/backend/sets/create/page.meta.js.map +2 -2
- package/dist/modules/business_rules/backend/sets/page.js +1 -3
- package/dist/modules/business_rules/backend/sets/page.js.map +2 -2
- package/dist/modules/business_rules/lib/expression-evaluator.js +9 -9
- package/dist/modules/business_rules/lib/expression-evaluator.js.map +2 -2
- package/dist/modules/business_rules/lib/rule-evaluator.js +9 -10
- package/dist/modules/business_rules/lib/rule-evaluator.js.map +2 -2
- package/dist/modules/catalog/ai-agents.js +1 -1
- package/dist/modules/catalog/ai-agents.js.map +1 -1
- package/dist/modules/catalog/ai-tools/merchandising-pack.js +2 -2
- package/dist/modules/catalog/ai-tools/merchandising-pack.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.js +2 -5
- package/dist/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.js.map +2 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js +0 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductsDataTable.js +1 -7
- package/dist/modules/catalog/components/products/ProductsDataTable.js.map +2 -2
- package/dist/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.js +0 -2
- package/dist/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.js.map +2 -2
- package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js +1 -9
- package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js.map +2 -2
- package/dist/modules/communication_channels/api/post/test-seed/route.js +10 -95
- package/dist/modules/communication_channels/api/post/test-seed/route.js.map +2 -2
- package/dist/modules/communication_channels/backend/communication_channels/channels/page.js +0 -3
- package/dist/modules/communication_channels/backend/communication_channels/channels/page.js.map +2 -2
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js +1 -14
- package/dist/modules/communication_channels/commands/ingest-inbound-message.js.map +2 -2
- package/dist/modules/communication_channels/di.js +1 -7
- package/dist/modules/communication_channels/di.js.map +2 -2
- package/dist/modules/communication_channels/lib/email-capabilities.js +1 -4
- package/dist/modules/communication_channels/lib/email-capabilities.js.map +2 -2
- package/dist/modules/communication_channels/lib/test-seed.js +2 -41
- package/dist/modules/communication_channels/lib/test-seed.js.map +2 -2
- package/dist/modules/configs/lib/system-status.js +0 -9
- package/dist/modules/configs/lib/system-status.js.map +2 -2
- package/dist/modules/currencies/backend/currencies/page.js +1 -3
- package/dist/modules/currencies/backend/currencies/page.js.map +2 -2
- package/dist/modules/currencies/backend/exchange-rates/page.js +1 -3
- package/dist/modules/currencies/backend/exchange-rates/page.js.map +2 -2
- package/dist/modules/customer_accounts/api/admin/domain-mappings.js +0 -9
- package/dist/modules/customer_accounts/api/admin/domain-mappings.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js +1 -3
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.js +84 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/page.js +7 -81
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.js +523 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/PortalUserDetailPageClient.js +731 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/PortalUserDetailPageClient.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js +7 -727
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js +7 -521
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js.map +2 -2
- package/dist/modules/customer_accounts/extension-points.js +1 -1
- package/dist/modules/customer_accounts/extension-points.js.map +2 -2
- package/dist/modules/customer_accounts/lib/portalUrl.js +69 -0
- package/dist/modules/customer_accounts/lib/portalUrl.js.map +7 -0
- package/dist/modules/customer_accounts/services/domainMappingService.js +0 -10
- package/dist/modules/customer_accounts/services/domainMappingService.js.map +2 -2
- package/dist/modules/customers/ai-tools/companies-pack.js +1 -4
- package/dist/modules/customers/ai-tools/companies-pack.js.map +2 -2
- package/dist/modules/customers/ai-tools/deal-analyzer-pack.js +2 -13
- package/dist/modules/customers/ai-tools/deal-analyzer-pack.js.map +2 -2
- package/dist/modules/customers/ai-tools/deals-pack.js +6 -52
- package/dist/modules/customers/ai-tools/deals-pack.js.map +2 -2
- package/dist/modules/customers/ai-tools/people-pack.js +1 -4
- package/dist/modules/customers/ai-tools/people-pack.js.map +2 -2
- package/dist/modules/customers/api/activities/route.js +6 -48
- package/dist/modules/customers/api/activities/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/people/route.js +64 -20
- package/dist/modules/customers/api/companies/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/route.js +94 -17
- package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js +5 -8
- package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/companies/route.js +1 -1
- package/dist/modules/customers/api/deals/[id]/companies/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/people/route.js +1 -1
- package/dist/modules/customers/api/deals/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/route.js +25 -8
- package/dist/modules/customers/api/deals/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/stats/route.js +22 -3
- package/dist/modules/customers/api/deals/[id]/stats/route.js.map +2 -2
- package/dist/modules/customers/api/deals/aggregate/route.js +4 -11
- package/dist/modules/customers/api/deals/aggregate/route.js.map +2 -2
- package/dist/modules/customers/api/deals/map/route.js +1 -2
- package/dist/modules/customers/api/deals/map/route.js.map +2 -2
- package/dist/modules/customers/api/deals/route.js +1 -38
- package/dist/modules/customers/api/deals/route.js.map +2 -2
- package/dist/modules/customers/api/entity-roles-factory.js +4 -4
- package/dist/modules/customers/api/entity-roles-factory.js.map +2 -2
- package/dist/modules/customers/api/interactions/route.js +1 -3
- package/dist/modules/customers/api/interactions/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/tasks/route.js +4 -27
- package/dist/modules/customers/api/interactions/tasks/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js +3 -4
- package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/context.js +1 -1
- package/dist/modules/customers/api/people/[id]/companies/context.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/enriched/route.js +1 -1
- package/dist/modules/customers/api/people/[id]/companies/enriched/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/route.js +10 -11
- package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/people/check-phone/route.js +9 -51
- package/dist/modules/customers/api/people/check-phone/route.js.map +2 -2
- package/dist/modules/customers/api/todos/route.js +5 -30
- package/dist/modules/customers/api/todos/route.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/page.js +4 -6
- package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/page.js +1 -6
- package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/page.js +4 -7
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/pipeline/components/Lane.js +13 -4
- package/dist/modules/customers/backend/customers/deals/pipeline/components/Lane.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.js +14 -85
- package/dist/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/page.js +4 -6
- package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
- package/dist/modules/customers/backend/hooks/useEmailDuplicateCheck.js +3 -9
- package/dist/modules/customers/backend/hooks/useEmailDuplicateCheck.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +34 -21
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/customers/commands/interactions.js.map +1 -1
- package/dist/modules/customers/commands/personCompanyLinks.js +2 -131
- package/dist/modules/customers/commands/personCompanyLinks.js.map +2 -2
- package/dist/modules/customers/components/CustomerTodosTable.js +0 -1
- package/dist/modules/customers/components/CustomerTodosTable.js.map +2 -2
- package/dist/modules/customers/components/DealsKpiStrip.js +6 -7
- package/dist/modules/customers/components/DealsKpiStrip.js.map +2 -2
- package/dist/modules/customers/components/calendar/AgendaList.js +2 -2
- package/dist/modules/customers/components/calendar/AgendaList.js.map +2 -2
- package/dist/modules/customers/components/calendar/CalendarEventEditor.js +1 -1
- package/dist/modules/customers/components/calendar/CalendarEventEditor.js.map +2 -2
- package/dist/modules/customers/components/calendar/CalendarScreen.js +1 -1
- package/dist/modules/customers/components/calendar/CalendarScreen.js.map +2 -2
- package/dist/modules/customers/components/calendar/CalendarSettingsModal.js +1 -1
- package/dist/modules/customers/components/calendar/CalendarSettingsModal.js.map +2 -2
- package/dist/modules/customers/components/calendar/EventBlock.js +1 -1
- package/dist/modules/customers/components/calendar/EventBlock.js.map +2 -2
- package/dist/modules/customers/components/calendar/EventPeekPopover.js +2 -3
- package/dist/modules/customers/components/calendar/EventPeekPopover.js.map +2 -2
- package/dist/modules/customers/components/calendar/editor/PeopleField.js +5 -40
- package/dist/modules/customers/components/calendar/editor/PeopleField.js.map +2 -2
- package/dist/modules/customers/components/calendar/editor/hooks.js +1 -2
- package/dist/modules/customers/components/calendar/editor/hooks.js.map +2 -2
- package/dist/modules/customers/components/calendar/types.js +1 -1
- package/dist/modules/customers/components/calendar/types.js.map +2 -2
- package/dist/modules/customers/components/detail/AssignRoleDialog.js +33 -28
- package/dist/modules/customers/components/detail/AssignRoleDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyKpiBar.js +4 -5
- package/dist/modules/customers/components/detail/CompanyKpiBar.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyPeopleSection.js +1 -3
- package/dist/modules/customers/components/detail/CompanyPeopleSection.js.map +2 -2
- package/dist/modules/customers/components/detail/DealForm.js +7 -19
- package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
- package/dist/modules/customers/components/detail/DealsSection.js +5 -6
- package/dist/modules/customers/components/detail/DealsSection.js.map +2 -2
- package/dist/modules/customers/components/detail/EntityTagsDialog.js +11 -35
- package/dist/modules/customers/components/detail/EntityTagsDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/PersonCompaniesSection.js +1 -3
- package/dist/modules/customers/components/detail/PersonCompaniesSection.js.map +2 -2
- package/dist/modules/customers/components/detail/hooks/usePersonTasks.js +13 -19
- package/dist/modules/customers/components/detail/hooks/usePersonTasks.js.map +2 -2
- package/dist/modules/customers/components/detail/schedule/ParticipantsField.js +4 -4
- package/dist/modules/customers/components/detail/schedule/ParticipantsField.js.map +2 -2
- package/dist/modules/customers/components/detail/schedule/useScheduleFormState.js +3 -3
- package/dist/modules/customers/components/detail/schedule/useScheduleFormState.js.map +2 -2
- package/dist/modules/customers/components/detail/utils.js +5 -5
- package/dist/modules/customers/components/detail/utils.js.map +2 -2
- package/dist/modules/customers/data/entities.js.map +1 -1
- package/dist/modules/customers/data/validators.js +3 -32
- package/dist/modules/customers/data/validators.js.map +2 -2
- package/dist/modules/customers/events.js +0 -5
- package/dist/modules/customers/events.js.map +2 -2
- package/dist/modules/customers/lib/calendar/conflicts.js +2 -8
- package/dist/modules/customers/lib/calendar/conflicts.js.map +2 -2
- package/dist/modules/customers/lib/calendar/editorPayload.js +2 -3
- package/dist/modules/customers/lib/calendar/editorPayload.js.map +2 -2
- package/dist/modules/customers/lib/calendar/mapItem.js +3 -8
- package/dist/modules/customers/lib/calendar/mapItem.js.map +2 -2
- package/dist/modules/customers/lib/dealStatus.js +0 -30
- package/dist/modules/customers/lib/dealStatus.js.map +2 -2
- package/dist/modules/customers/lib/findPeopleByAddresses.js +0 -1
- package/dist/modules/customers/lib/findPeopleByAddresses.js.map +2 -2
- package/dist/modules/customers/lib/personCompanies.js +2 -100
- package/dist/modules/customers/lib/personCompanies.js.map +2 -2
- package/dist/modules/customers/lib/todoCompatibility.js +0 -12
- package/dist/modules/customers/lib/todoCompatibility.js.map +2 -2
- package/dist/modules/dashboards/lib/widgetScope.js +1 -6
- package/dist/modules/dashboards/lib/widgetScope.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +1 -3
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-engine.js +6 -72
- package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
- package/dist/modules/data_sync/workers/sync-export.js +1 -5
- package/dist/modules/data_sync/workers/sync-export.js.map +2 -2
- package/dist/modules/data_sync/workers/sync-import.js +1 -5
- package/dist/modules/data_sync/workers/sync-import.js.map +2 -2
- package/dist/modules/devices/acl.js +1 -9
- package/dist/modules/devices/acl.js.map +2 -2
- package/dist/modules/devices/api/admin/devices/[id]/route.js +32 -5
- package/dist/modules/devices/api/admin/devices/[id]/route.js.map +2 -2
- package/dist/modules/devices/api/admin/devices/route.js +1 -14
- package/dist/modules/devices/api/admin/devices/route.js.map +2 -2
- package/dist/modules/devices/api/deviceList.js +12 -99
- package/dist/modules/devices/api/deviceList.js.map +2 -2
- package/dist/modules/devices/api/openapi.js +1 -3
- package/dist/modules/devices/api/openapi.js.map +2 -2
- package/dist/modules/devices/api/route.js +1 -9
- package/dist/modules/devices/api/route.js.map +2 -2
- package/dist/modules/devices/backend/devices/[id]/page.js +26 -10
- package/dist/modules/devices/backend/devices/[id]/page.js.map +2 -2
- package/dist/modules/devices/backend/devices/create/page.js +1 -17
- package/dist/modules/devices/backend/devices/create/page.js.map +2 -2
- package/dist/modules/devices/backend/devices/page.js +34 -28
- package/dist/modules/devices/backend/devices/page.js.map +2 -2
- package/dist/modules/devices/setup.js +2 -6
- package/dist/modules/devices/setup.js.map +2 -2
- package/dist/modules/directory/backend/directory/organizations/page.js +1 -2
- package/dist/modules/directory/backend/directory/organizations/page.js.map +2 -2
- package/dist/modules/directory/backend/directory/tenants/page.js +1 -2
- package/dist/modules/directory/backend/directory/tenants/page.js.map +2 -2
- package/dist/modules/directory/di.js +0 -9
- package/dist/modules/directory/di.js.map +2 -2
- package/dist/modules/directory/utils/organizationScope.js.map +2 -2
- package/dist/modules/entities/api/records.js +2 -4
- package/dist/modules/entities/api/records.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +1 -3
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
- package/dist/modules/eudr/api/plots/route.js +1 -5
- package/dist/modules/eudr/api/plots/route.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.js +3 -1
- package/dist/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.js +1 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.js +0 -3
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.meta.js +4 -1
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/page.meta.js +2 -2
- package/dist/modules/eudr/backend/eudr/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.js +8 -2
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.meta.js +3 -1
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/create/page.js +8 -2
- package/dist/modules/eudr/backend/eudr/plots/create/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/create/page.meta.js +1 -0
- package/dist/modules/eudr/backend/eudr/plots/create/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/page.js +0 -3
- package/dist/modules/eudr/backend/eudr/plots/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/plots/page.meta.js +4 -1
- package/dist/modules/eudr/backend/eudr/plots/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.js +3 -1
- package/dist/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/product-mappings/create/page.meta.js +1 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/create/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/product-mappings/page.js +0 -3
- package/dist/modules/eudr/backend/eudr/product-mappings/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/product-mappings/page.meta.js +4 -1
- package/dist/modules/eudr/backend/eudr/product-mappings/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.js +3 -1
- package/dist/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/risk-assessments/create/page.meta.js +1 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/create/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.js +0 -3
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.meta.js +4 -1
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.js +2 -0
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.meta.js +3 -1
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/create/page.meta.js +1 -0
- package/dist/modules/eudr/backend/eudr/statements/create/page.meta.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/page.js +30 -28
- package/dist/modules/eudr/backend/eudr/statements/page.js.map +2 -2
- package/dist/modules/eudr/backend/eudr/statements/page.meta.js +4 -1
- package/dist/modules/eudr/backend/eudr/statements/page.meta.js.map +2 -2
- package/dist/modules/eudr/commands/statements.js +8 -3
- package/dist/modules/eudr/commands/statements.js.map +2 -2
- package/dist/modules/eudr/components/crudErrorI18n.js +21 -1
- package/dist/modules/eudr/components/crudErrorI18n.js.map +2 -2
- package/dist/modules/eudr/components/formConfig.js +6 -2
- package/dist/modules/eudr/components/formConfig.js.map +2 -2
- package/dist/modules/eudr/data/validators.js +1 -4
- package/dist/modules/eudr/data/validators.js.map +2 -2
- package/dist/modules/eudr/lib/statement-lifecycle.js +9 -1
- package/dist/modules/eudr/lib/statement-lifecycle.js.map +2 -2
- package/dist/modules/feature_toggles/components/FeatureTogglesTable.js +0 -1
- package/dist/modules/feature_toggles/components/FeatureTogglesTable.js.map +2 -2
- package/dist/modules/feature_toggles/components/OverridesTable.js +0 -1
- package/dist/modules/feature_toggles/components/OverridesTable.js.map +2 -2
- package/dist/modules/feature_toggles/defaults.json +8 -0
- package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js +0 -3
- package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js.map +2 -2
- package/dist/modules/inbox_ops/backend/inbox-ops/page.js +0 -3
- package/dist/modules/inbox_ops/backend/inbox-ops/page.js.map +2 -2
- package/dist/modules/inbox_ops/lib/htmlToPlainText.js +12 -1
- package/dist/modules/inbox_ops/lib/htmlToPlainText.js.map +2 -2
- package/dist/modules/integrations/api/[id]/credentials/route.js +1 -6
- package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/[id]/page.js +29 -38
- package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +9 -36
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +2 -2
- package/dist/modules/integrations/data/validators.js +3 -11
- package/dist/modules/integrations/data/validators.js.map +2 -2
- package/dist/modules/integrations/lib/credentials-masking.js +2 -6
- package/dist/modules/integrations/lib/credentials-masking.js.map +2 -2
- package/dist/modules/messages/api/[id]/route.js +1 -29
- package/dist/modules/messages/api/[id]/route.js.map +2 -2
- package/dist/modules/messages/api/openapi.js +2 -17
- package/dist/modules/messages/api/openapi.js.map +2 -2
- package/dist/modules/messages/api/route.js +2 -17
- package/dist/modules/messages/api/route.js.map +2 -2
- package/dist/modules/messages/components/MessagesInboxPageClient.js +14 -7
- package/dist/modules/messages/components/MessagesInboxPageClient.js.map +2 -2
- package/dist/modules/messages/components/inboxFilters.js +0 -15
- package/dist/modules/messages/components/inboxFilters.js.map +2 -2
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.js +1 -11
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/MessageHeader.js +1 -3
- package/dist/modules/messages/components/message-detail/panels/MessageHeader.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/thread-panel.js +1 -2
- package/dist/modules/messages/components/message-detail/panels/thread-panel.js.map +2 -2
- package/dist/modules/messages/components/messageListLabels.js +2 -14
- package/dist/modules/messages/components/messageListLabels.js.map +2 -2
- package/dist/modules/messages/data/validators.js +4 -18
- package/dist/modules/messages/data/validators.js.map +2 -2
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js +6 -4
- package/dist/modules/payment_gateways/api/webhook/[provider]/route.js.map +2 -2
- package/dist/modules/payment_gateways/backend/payment-gateways/page.js +1 -3
- package/dist/modules/payment_gateways/backend/payment-gateways/page.js.map +2 -2
- package/dist/modules/payment_gateways/lib/webhook-processor.js +0 -7
- package/dist/modules/payment_gateways/lib/webhook-processor.js.map +2 -2
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js +0 -3
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
- package/dist/modules/push_notifications/backend/push_notifications/page.js +1 -3
- package/dist/modules/push_notifications/backend/push_notifications/page.js.map +2 -2
- package/dist/modules/push_notifications/backend/push_notifications/send/page.js +1 -1
- package/dist/modules/push_notifications/backend/push_notifications/send/page.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +51 -150
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/lib/search-tokens.js +3 -79
- package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js +1 -3
- package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resources/page.js +1 -3
- package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/offers/page.js +0 -3
- package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/page.js +0 -3
- package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/documents/[id]/page.js +8 -10
- package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +1 -79
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/components/PriceWithCurrency.js +5 -7
- package/dist/modules/sales/components/PriceWithCurrency.js.map +2 -2
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js +0 -3
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js.map +2 -2
- package/dist/modules/sales/components/documents/AdjustmentsSection.js +6 -8
- package/dist/modules/sales/components/documents/AdjustmentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/ItemsSection.js +22 -51
- package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/LineItemDialog.js +19 -84
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/PaymentsSection.js +9 -23
- package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/ReturnsSection.js +6 -8
- package/dist/modules/sales/components/documents/ReturnsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js +14 -68
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesOrderDraftLines.js +5 -6
- package/dist/modules/sales/components/documents/SalesOrderDraftLines.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentDialog.js +4 -5
- package/dist/modules/sales/components/documents/ShipmentDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentsSection.js +6 -8
- package/dist/modules/sales/components/documents/ShipmentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/lineItemUtils.js +2 -2
- package/dist/modules/sales/components/documents/lineItemUtils.js.map +2 -2
- package/dist/modules/sales/data/entities.js +2 -8
- package/dist/modules/sales/data/entities.js.map +2 -2
- package/dist/modules/sales/extension-points.js +0 -1
- package/dist/modules/sales/extension-points.js.map +2 -2
- package/dist/modules/sales/setup.js +0 -2
- package/dist/modules/sales/setup.js.map +2 -2
- package/dist/modules/sales/widgets/injection/document-history/widget.client.js +44 -2
- package/dist/modules/sales/widgets/injection/document-history/widget.client.js.map +2 -2
- package/dist/modules/sales/widgets/injection/payment-gateway-status-column/widget.js +2 -10
- package/dist/modules/sales/widgets/injection/payment-gateway-status-column/widget.js.map +2 -2
- package/dist/modules/sales/widgets/injection-table.js +7 -4
- package/dist/modules/sales/widgets/injection-table.js.map +2 -2
- package/dist/modules/staff/backend/staff/leave-requests/page.js +0 -3
- package/dist/modules/staff/backend/staff/leave-requests/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/my-leave-requests/page.js +0 -3
- package/dist/modules/staff/backend/staff/my-leave-requests/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-members/page.js +0 -3
- package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-roles/page.js +0 -3
- package/dist/modules/staff/backend/staff/team-roles/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +0 -3
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/page.js +0 -3
- package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/page.js +18 -29
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +0 -3
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
- package/dist/modules/sync_excel/lib/adapters/customers.js +0 -1
- package/dist/modules/sync_excel/lib/adapters/customers.js.map +2 -2
- package/dist/modules/warranty_claims/api/assignees/route.js +3 -3
- package/dist/modules/warranty_claims/api/assignees/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/portal/attachments/route.js +2 -2
- package/dist/modules/warranty_claims/api/portal/attachments/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/portal/claims/route.js +9 -12
- package/dist/modules/warranty_claims/api/portal/claims/route.js.map +2 -2
- package/dist/modules/warranty_claims/backend/page.js +0 -3
- package/dist/modules/warranty_claims/backend/page.js.map +2 -2
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.js +0 -3
- package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.js.map +2 -2
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.js +0 -3
- package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.js.map +2 -2
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.js +0 -3
- package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.js.map +2 -2
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.js +0 -3
- package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.js.map +2 -2
- package/dist/modules/wms/api/warehouses/route.js +9 -13
- package/dist/modules/wms/api/warehouses/route.js.map +2 -2
- package/dist/modules/wms/api/zones/route.js +2 -15
- package/dist/modules/wms/api/zones/route.js.map +2 -2
- package/dist/modules/wms/commands/configuration.js +9 -121
- package/dist/modules/wms/commands/configuration.js.map +2 -2
- package/dist/modules/wms/commands/inventory-actions.js +0 -3
- package/dist/modules/wms/commands/inventory-actions.js.map +2 -2
- package/dist/modules/wms/commands/shared.js +1 -9
- package/dist/modules/wms/commands/shared.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js +111 -76
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js.map +3 -3
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js +0 -1
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js +20 -16
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js +10 -6
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLotsListPage.js +0 -1
- package/dist/modules/wms/components/backend/WmsLotsListPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js +11 -7
- package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js +10 -6
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js +20 -27
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/page.js +1 -3
- package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
- package/dist/modules/workflows/backend/events/page.js +1 -3
- package/dist/modules/workflows/backend/events/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/page.js +1 -3
- package/dist/modules/workflows/backend/instances/page.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/page.js +1 -3
- package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
- package/dist/modules/workflows/lib/activity-executor.js +0 -4
- package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
- package/package.json +10 -9
- package/src/helpers/integration/api.ts +1 -33
- package/src/helpers/integration/communicationChannelsFixtures.ts +1 -69
- package/src/modules/api_keys/api/keys/route.ts +1 -3
- package/src/modules/api_keys/backend/api-keys/page.tsx +1 -4
- package/src/modules/attachments/AGENTS.md +0 -15
- package/src/modules/attachments/api/route.ts +2 -2
- package/src/modules/attachments/components/AttachmentLibrary.tsx +0 -3
- package/src/modules/attachments/di.ts +0 -16
- package/src/modules/attachments/i18n/de.json +0 -5
- package/src/modules/attachments/i18n/en.json +0 -5
- package/src/modules/attachments/i18n/es.json +0 -5
- package/src/modules/attachments/i18n/ko.json +0 -5
- package/src/modules/attachments/i18n/pl.json +0 -5
- package/src/modules/attachments/index.ts +0 -10
- package/src/modules/attachments/lib/scoped-upload-service.ts +0 -46
- package/src/modules/attachments/lib/upload-limits.ts +2 -6
- package/src/modules/audit_logs/backend/audit-logs/page.tsx +0 -8
- package/src/modules/audit_logs/lib/display-helpers.tsx +32 -42
- package/src/modules/audit_logs/services/actionLogService.ts +11 -74
- package/src/modules/auth/acl.ts +6 -30
- package/src/modules/auth/api/feature-check.ts +3 -10
- package/src/modules/auth/api/login.ts +24 -9
- package/src/modules/auth/api/roles/acl/route.ts +39 -42
- package/src/modules/auth/api/routeError.ts +30 -0
- package/src/modules/auth/api/session/refresh.ts +1 -32
- package/src/modules/auth/api/users/acl/route.ts +101 -185
- package/src/modules/auth/api/users/route.ts +5 -18
- package/src/modules/auth/backend/roles/[id]/edit/page.meta.ts +2 -5
- package/src/modules/auth/backend/roles/page.tsx +2 -4
- package/src/modules/auth/backend/users/[id]/edit/page.meta.ts +2 -5
- package/src/modules/auth/backend/users/page.tsx +2 -3
- package/src/modules/auth/components/AclEditor.tsx +33 -63
- package/src/modules/auth/data/entities.ts +1 -4
- package/src/modules/auth/data/validators.ts +0 -5
- package/src/modules/auth/di.ts +16 -46
- package/src/modules/auth/frontend/reset/[token]/page.tsx +0 -74
- package/src/modules/auth/i18n/de.json +0 -389
- package/src/modules/auth/i18n/en.json +0 -389
- package/src/modules/auth/i18n/es.json +0 -389
- package/src/modules/auth/i18n/ko.json +0 -389
- package/src/modules/auth/i18n/pl.json +2 -391
- package/src/modules/auth/lib/grantChecks.ts +0 -6
- package/src/modules/auth/services/authService.ts +2 -18
- package/src/modules/auth/services/rbacService.ts +24 -110
- package/src/modules/business_rules/backend/logs/page.tsx +1 -4
- package/src/modules/business_rules/backend/rules/[id]/page.meta.ts +5 -0
- package/src/modules/business_rules/backend/rules/create/page.meta.ts +5 -1
- package/src/modules/business_rules/backend/rules/page.tsx +1 -4
- package/src/modules/business_rules/backend/sets/[id]/page.meta.ts +5 -0
- package/src/modules/business_rules/backend/sets/create/page.meta.ts +5 -1
- package/src/modules/business_rules/backend/sets/page.tsx +1 -4
- package/src/modules/business_rules/lib/expression-evaluator.ts +9 -9
- package/src/modules/business_rules/lib/rule-evaluator.ts +9 -10
- package/src/modules/catalog/ai-agents.ts +1 -1
- package/src/modules/catalog/ai-tools/merchandising-pack.ts +2 -2
- package/src/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.tsx +5 -12
- package/src/modules/catalog/components/categories/CategoriesDataTable.tsx +0 -3
- package/src/modules/catalog/components/products/ProductsDataTable.tsx +0 -7
- package/src/modules/catalog/i18n/de.json +0 -1
- package/src/modules/catalog/i18n/en.json +0 -1
- package/src/modules/catalog/i18n/es.json +0 -1
- package/src/modules/catalog/i18n/ko.json +0 -1
- package/src/modules/catalog/i18n/pl.json +0 -1
- package/src/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.tsx +0 -4
- package/src/modules/communication_channels/api/post/channels/[id]/test-send/route.ts +1 -17
- package/src/modules/communication_channels/api/post/test-seed/route.ts +16 -155
- package/src/modules/communication_channels/backend/communication_channels/channels/page.tsx +0 -4
- package/src/modules/communication_channels/commands/ingest-inbound-message.ts +1 -38
- package/src/modules/communication_channels/di.ts +0 -7
- package/src/modules/communication_channels/lib/adapter.ts +0 -14
- package/src/modules/communication_channels/lib/email-capabilities.ts +0 -4
- package/src/modules/communication_channels/lib/test-seed.ts +4 -64
- package/src/modules/configs/i18n/de.json +0 -2
- package/src/modules/configs/i18n/en.json +0 -2
- package/src/modules/configs/i18n/es.json +0 -2
- package/src/modules/configs/i18n/ko.json +0 -2
- package/src/modules/configs/i18n/pl.json +0 -2
- package/src/modules/configs/lib/system-status.ts +0 -9
- package/src/modules/currencies/backend/currencies/page.tsx +1 -4
- package/src/modules/currencies/backend/exchange-rates/page.tsx +1 -4
- package/src/modules/customer_accounts/api/admin/domain-mappings.ts +0 -7
- package/src/modules/customer_accounts/backend/customer_accounts/roles/page.tsx +1 -4
- package/src/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.tsx +138 -0
- package/src/modules/customer_accounts/backend/customer_accounts/settings/page.tsx +8 -132
- package/src/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.tsx +598 -0
- package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/PortalUserDetailPageClient.tsx +838 -0
- package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/page.tsx +6 -838
- package/src/modules/customer_accounts/backend/customer_accounts/users/page.tsx +6 -590
- package/src/modules/customer_accounts/extension-points.ts +1 -1
- package/src/modules/customer_accounts/lib/portalUrl.ts +112 -0
- package/src/modules/customer_accounts/services/domainMappingService.ts +0 -10
- package/src/modules/customers/ai-tools/companies-pack.ts +1 -4
- package/src/modules/customers/ai-tools/deal-analyzer-pack.ts +2 -17
- package/src/modules/customers/ai-tools/deals-pack.ts +1 -66
- package/src/modules/customers/ai-tools/people-pack.ts +1 -4
- package/src/modules/customers/api/activities/route.ts +0 -45
- package/src/modules/customers/api/companies/[id]/people/route.ts +73 -24
- package/src/modules/customers/api/companies/[id]/route.ts +107 -24
- package/src/modules/customers/api/dashboard/widgets/customer-todos/route.ts +8 -16
- package/src/modules/customers/api/deals/[id]/companies/route.ts +1 -4
- package/src/modules/customers/api/deals/[id]/people/route.ts +1 -4
- package/src/modules/customers/api/deals/[id]/route.ts +28 -17
- package/src/modules/customers/api/deals/[id]/stats/route.ts +25 -10
- package/src/modules/customers/api/deals/aggregate/route.ts +4 -14
- package/src/modules/customers/api/deals/map/route.ts +0 -1
- package/src/modules/customers/api/deals/route.ts +1 -50
- package/src/modules/customers/api/entity-roles-factory.ts +4 -8
- package/src/modules/customers/api/interactions/route.ts +2 -8
- package/src/modules/customers/api/interactions/tasks/route.ts +1 -24
- package/src/modules/customers/api/people/[id]/companies/[linkId]/route.ts +4 -12
- package/src/modules/customers/api/people/[id]/companies/context.ts +1 -4
- package/src/modules/customers/api/people/[id]/companies/enriched/route.ts +1 -4
- package/src/modules/customers/api/people/[id]/route.ts +11 -16
- package/src/modules/customers/api/people/check-phone/route.ts +10 -75
- package/src/modules/customers/api/todos/route.ts +2 -27
- package/src/modules/customers/backend/customers/companies/page.tsx +4 -7
- package/src/modules/customers/backend/customers/deals/[id]/page.tsx +2 -7
- package/src/modules/customers/backend/customers/deals/page.tsx +4 -10
- package/src/modules/customers/backend/customers/deals/pipeline/components/Lane.tsx +14 -5
- package/src/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.tsx +27 -109
- package/src/modules/customers/backend/customers/people/page.tsx +4 -7
- package/src/modules/customers/backend/hooks/useEmailDuplicateCheck.ts +4 -12
- package/src/modules/customers/commands/deals.ts +59 -34
- package/src/modules/customers/commands/interactions.ts +1 -1
- package/src/modules/customers/commands/personCompanyLinks.ts +8 -224
- package/src/modules/customers/components/CustomerTodosTable.tsx +0 -2
- package/src/modules/customers/components/DealsKpiStrip.tsx +7 -7
- package/src/modules/customers/components/calendar/AgendaList.tsx +3 -3
- package/src/modules/customers/components/calendar/CalendarEventEditor.tsx +1 -1
- package/src/modules/customers/components/calendar/CalendarScreen.tsx +1 -1
- package/src/modules/customers/components/calendar/CalendarSettingsModal.tsx +1 -1
- package/src/modules/customers/components/calendar/EventBlock.tsx +2 -2
- package/src/modules/customers/components/calendar/EventPeekPopover.tsx +2 -4
- package/src/modules/customers/components/calendar/editor/PeopleField.tsx +5 -61
- package/src/modules/customers/components/calendar/editor/hooks.ts +1 -7
- package/src/modules/customers/components/calendar/types.ts +2 -2
- package/src/modules/customers/components/detail/AssignRoleDialog.tsx +12 -7
- package/src/modules/customers/components/detail/CompanyKpiBar.tsx +4 -5
- package/src/modules/customers/components/detail/CompanyPeopleSection.tsx +1 -8
- package/src/modules/customers/components/detail/DealForm.tsx +2 -22
- package/src/modules/customers/components/detail/DealsSection.tsx +5 -11
- package/src/modules/customers/components/detail/EntityTagsDialog.tsx +12 -58
- package/src/modules/customers/components/detail/PersonCompaniesSection.tsx +1 -8
- package/src/modules/customers/components/detail/hooks/usePersonTasks.ts +14 -23
- package/src/modules/customers/components/detail/schedule/ParticipantsField.tsx +5 -5
- package/src/modules/customers/components/detail/schedule/useScheduleFormState.ts +5 -5
- package/src/modules/customers/components/detail/types.ts +1 -1
- package/src/modules/customers/components/detail/utils.ts +5 -15
- package/src/modules/customers/data/entities.ts +1 -1
- package/src/modules/customers/data/validators.ts +9 -50
- package/src/modules/customers/events.ts +0 -5
- package/src/modules/customers/i18n/de.json +1 -9
- package/src/modules/customers/i18n/en.json +1 -9
- package/src/modules/customers/i18n/es.json +1 -9
- package/src/modules/customers/i18n/ko.json +1 -9
- package/src/modules/customers/i18n/pl.json +1 -9
- package/src/modules/customers/lib/calendar/conflicts.ts +2 -10
- package/src/modules/customers/lib/calendar/editorPayload.ts +3 -4
- package/src/modules/customers/lib/calendar/mapItem.ts +3 -8
- package/src/modules/customers/lib/dealStatus.ts +0 -42
- package/src/modules/customers/lib/findPeopleByAddresses.ts +6 -8
- package/src/modules/customers/lib/personCompanies.ts +1 -136
- package/src/modules/customers/lib/todoCompatibility.ts +1 -19
- package/src/modules/dashboards/i18n/es.json +4 -4
- package/src/modules/dashboards/i18n/pl.json +7 -7
- package/src/modules/dashboards/lib/widgetScope.ts +0 -6
- package/src/modules/data_sync/AGENTS.md +1 -1
- package/src/modules/data_sync/backend/data-sync/page.tsx +1 -4
- package/src/modules/data_sync/lib/adapter.ts +0 -36
- package/src/modules/data_sync/lib/sync-engine.ts +5 -113
- package/src/modules/data_sync/workers/sync-export.ts +0 -4
- package/src/modules/data_sync/workers/sync-import.ts +0 -4
- package/src/modules/devices/AGENTS.md +1 -20
- package/src/modules/devices/acl.ts +1 -9
- package/src/modules/devices/api/admin/devices/[id]/route.ts +34 -5
- package/src/modules/devices/api/admin/devices/route.ts +1 -14
- package/src/modules/devices/api/deviceList.ts +11 -135
- package/src/modules/devices/api/openapi.ts +1 -9
- package/src/modules/devices/api/route.ts +1 -9
- package/src/modules/devices/backend/devices/[id]/page.tsx +32 -18
- package/src/modules/devices/backend/devices/create/page.tsx +1 -17
- package/src/modules/devices/backend/devices/page.tsx +45 -44
- package/src/modules/devices/i18n/de.json +2 -3
- package/src/modules/devices/i18n/en.json +2 -3
- package/src/modules/devices/i18n/es.json +2 -3
- package/src/modules/devices/i18n/ko.json +2 -3
- package/src/modules/devices/i18n/pl.json +2 -3
- package/src/modules/devices/setup.ts +2 -6
- package/src/modules/directory/backend/directory/organizations/page.tsx +1 -3
- package/src/modules/directory/backend/directory/tenants/page.tsx +1 -3
- package/src/modules/directory/di.ts +2 -14
- package/src/modules/directory/utils/organizationScope.ts +15 -4
- package/src/modules/entities/api/records.ts +0 -2
- package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +1 -4
- package/src/modules/eudr/api/plots/route.ts +0 -4
- package/src/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.ts +2 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.ts +1 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/page.meta.ts +4 -1
- package/src/modules/eudr/backend/eudr/evidence-submissions/page.tsx +0 -4
- package/src/modules/eudr/backend/eudr/page.meta.ts +2 -2
- package/src/modules/eudr/backend/eudr/plots/[id]/page.meta.ts +2 -0
- package/src/modules/eudr/backend/eudr/plots/[id]/page.tsx +8 -2
- package/src/modules/eudr/backend/eudr/plots/create/page.meta.ts +1 -0
- package/src/modules/eudr/backend/eudr/plots/create/page.tsx +8 -2
- package/src/modules/eudr/backend/eudr/plots/page.meta.ts +4 -1
- package/src/modules/eudr/backend/eudr/plots/page.tsx +0 -4
- package/src/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.ts +2 -0
- package/src/modules/eudr/backend/eudr/product-mappings/create/page.meta.ts +1 -0
- package/src/modules/eudr/backend/eudr/product-mappings/page.meta.ts +4 -1
- package/src/modules/eudr/backend/eudr/product-mappings/page.tsx +0 -4
- package/src/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.ts +2 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/create/page.meta.ts +1 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/page.meta.ts +4 -1
- package/src/modules/eudr/backend/eudr/risk-assessments/page.tsx +0 -4
- package/src/modules/eudr/backend/eudr/statements/[id]/page.meta.ts +2 -0
- package/src/modules/eudr/backend/eudr/statements/[id]/page.tsx +2 -0
- package/src/modules/eudr/backend/eudr/statements/create/page.meta.ts +1 -0
- package/src/modules/eudr/backend/eudr/statements/page.meta.ts +4 -1
- package/src/modules/eudr/backend/eudr/statements/page.tsx +32 -30
- package/src/modules/eudr/commands/statements.ts +7 -2
- package/src/modules/eudr/components/crudErrorI18n.ts +31 -0
- package/src/modules/eudr/components/formConfig.tsx +9 -1
- package/src/modules/eudr/data/validators.ts +1 -16
- package/src/modules/eudr/i18n/de.json +3 -2
- package/src/modules/eudr/i18n/en.json +3 -2
- package/src/modules/eudr/i18n/es.json +3 -2
- package/src/modules/eudr/i18n/ko.json +3 -2
- package/src/modules/eudr/i18n/pl.json +3 -2
- package/src/modules/eudr/lib/statement-lifecycle.ts +8 -0
- package/src/modules/feature_toggles/components/FeatureTogglesTable.tsx +1 -2
- package/src/modules/feature_toggles/components/OverridesTable.tsx +1 -2
- package/src/modules/feature_toggles/defaults.json +8 -0
- package/src/modules/inbox_ops/backend/inbox-ops/log/page.tsx +0 -4
- package/src/modules/inbox_ops/backend/inbox-ops/page.tsx +0 -4
- package/src/modules/inbox_ops/lib/htmlToPlainText.ts +17 -1
- package/src/modules/integrations/api/[id]/credentials/route.ts +4 -6
- package/src/modules/integrations/backend/integrations/[id]/page.tsx +31 -61
- package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +9 -44
- package/src/modules/integrations/data/validators.ts +2 -12
- package/src/modules/integrations/i18n/de.json +0 -1
- package/src/modules/integrations/i18n/en.json +0 -1
- package/src/modules/integrations/i18n/es.json +0 -1
- package/src/modules/integrations/i18n/ko.json +0 -1
- package/src/modules/integrations/i18n/pl.json +0 -1
- package/src/modules/integrations/lib/credentials-masking.ts +6 -10
- package/src/modules/messages/api/[id]/route.ts +1 -55
- package/src/modules/messages/api/openapi.ts +0 -20
- package/src/modules/messages/api/route.ts +2 -31
- package/src/modules/messages/components/MessagesInboxPageClient.tsx +16 -9
- package/src/modules/messages/components/inboxFilters.ts +0 -36
- package/src/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.ts +1 -14
- package/src/modules/messages/components/message-detail/panels/MessageHeader.tsx +1 -3
- package/src/modules/messages/components/message-detail/panels/thread-panel.tsx +1 -2
- package/src/modules/messages/components/message-detail/types.ts +0 -3
- package/src/modules/messages/components/messageListLabels.ts +3 -52
- package/src/modules/messages/data/validators.ts +4 -43
- package/src/modules/payment_gateways/api/webhook/[provider]/route.ts +6 -4
- package/src/modules/payment_gateways/backend/payment-gateways/page.tsx +1 -4
- package/src/modules/payment_gateways/lib/webhook-processor.ts +0 -11
- package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +0 -4
- package/src/modules/push_notifications/backend/push_notifications/page.tsx +1 -4
- package/src/modules/push_notifications/backend/push_notifications/send/page.tsx +4 -4
- package/src/modules/query_index/lib/engine.ts +61 -249
- package/src/modules/query_index/lib/search-tokens.ts +3 -135
- package/src/modules/resources/backend/resources/resource-types/page.tsx +1 -4
- package/src/modules/resources/backend/resources/resources/page.tsx +1 -4
- package/src/modules/sales/backend/sales/channels/offers/page.tsx +0 -4
- package/src/modules/sales/backend/sales/channels/page.tsx +0 -4
- package/src/modules/sales/backend/sales/documents/[id]/page.tsx +8 -14
- package/src/modules/sales/commands/documents.ts +0 -93
- package/src/modules/sales/components/PriceWithCurrency.tsx +5 -17
- package/src/modules/sales/components/channels/SalesChannelOffersPanel.tsx +0 -4
- package/src/modules/sales/components/documents/AdjustmentsSection.tsx +5 -6
- package/src/modules/sales/components/documents/ItemsSection.tsx +18 -56
- package/src/modules/sales/components/documents/LineItemDialog.tsx +21 -138
- package/src/modules/sales/components/documents/PaymentsSection.tsx +9 -20
- package/src/modules/sales/components/documents/ReturnsSection.tsx +5 -6
- package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +14 -106
- package/src/modules/sales/components/documents/SalesOrderDraftLines.tsx +5 -6
- package/src/modules/sales/components/documents/ShipmentDialog.tsx +4 -5
- package/src/modules/sales/components/documents/ShipmentsSection.tsx +5 -6
- package/src/modules/sales/components/documents/lineItemUtils.ts +2 -7
- package/src/modules/sales/data/entities.ts +0 -6
- package/src/modules/sales/extension-points.ts +0 -1
- package/src/modules/sales/i18n/de.json +37 -8
- package/src/modules/sales/i18n/en.json +37 -8
- package/src/modules/sales/i18n/es.json +37 -8
- package/src/modules/sales/i18n/ko.json +37 -8
- package/src/modules/sales/i18n/pl.json +37 -8
- package/src/modules/sales/migrations/.snapshot-open-mercato.json +0 -60
- package/src/modules/sales/setup.ts +0 -2
- package/src/modules/sales/widgets/injection/document-history/widget.client.tsx +42 -2
- package/src/modules/sales/widgets/injection/payment-gateway-status-column/widget.ts +1 -9
- package/src/modules/sales/widgets/injection-table.ts +7 -4
- package/src/modules/staff/backend/staff/leave-requests/page.tsx +0 -4
- package/src/modules/staff/backend/staff/my-leave-requests/page.tsx +0 -4
- package/src/modules/staff/backend/staff/team-members/page.tsx +0 -6
- package/src/modules/staff/backend/staff/team-roles/page.tsx +0 -4
- package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +0 -4
- package/src/modules/staff/backend/staff/teams/page.tsx +0 -4
- package/src/modules/staff/backend/staff/timesheets/page.tsx +1 -12
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +0 -4
- package/src/modules/sync_excel/lib/adapters/customers.ts +0 -5
- package/src/modules/warranty_claims/api/assignees/route.ts +3 -3
- package/src/modules/warranty_claims/api/portal/attachments/route.ts +2 -2
- package/src/modules/warranty_claims/api/portal/claims/route.ts +9 -12
- package/src/modules/warranty_claims/backend/page.tsx +0 -4
- package/src/modules/warranty_claims/backend/warranty_claims/registrations/page.tsx +0 -4
- package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.tsx +0 -4
- package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.tsx +0 -4
- package/src/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.tsx +0 -4
- package/src/modules/wms/api/warehouses/route.ts +9 -13
- package/src/modules/wms/api/zones/route.ts +0 -16
- package/src/modules/wms/commands/configuration.ts +10 -159
- package/src/modules/wms/commands/inventory-actions.ts +0 -3
- package/src/modules/wms/commands/shared.ts +0 -17
- package/src/modules/wms/components/backend/WmsConfigurationPage.tsx +141 -95
- package/src/modules/wms/components/backend/WmsInventoryConsolePage.tsx +0 -2
- package/src/modules/wms/components/backend/WmsLocationDetailPage.tsx +30 -26
- package/src/modules/wms/components/backend/WmsLotDetailPage.tsx +21 -17
- package/src/modules/wms/components/backend/WmsLotsListPage.tsx +0 -2
- package/src/modules/wms/components/backend/WmsOperationalDashboardPage.tsx +17 -13
- package/src/modules/wms/components/backend/WmsSkuDetailPage.tsx +16 -12
- package/src/modules/wms/components/backend/inventoryMutationLoaders.ts +20 -36
- package/src/modules/wms/i18n/de.json +0 -2
- package/src/modules/wms/i18n/en.json +0 -2
- package/src/modules/wms/i18n/es.json +0 -2
- package/src/modules/wms/i18n/ko.json +0 -2
- package/src/modules/wms/i18n/pl.json +0 -2
- package/src/modules/workflows/backend/definitions/page.tsx +1 -4
- package/src/modules/workflows/backend/events/page.tsx +1 -4
- package/src/modules/workflows/backend/instances/page.tsx +1 -4
- package/src/modules/workflows/backend/tasks/page.tsx +1 -4
- package/src/modules/workflows/lib/activity-executor.ts +0 -9
- package/dist/modules/api_keys/di.js +0 -9
- package/dist/modules/api_keys/di.js.map +0 -7
- package/dist/modules/api_keys/services/principalService.js +0 -31
- package/dist/modules/api_keys/services/principalService.js.map +0 -7
- package/dist/modules/attachments/lib/attachment-service.js +0 -313
- package/dist/modules/attachments/lib/attachment-service.js.map +0 -7
- package/dist/modules/auth/api/reset/validate.js +0 -55
- package/dist/modules/auth/api/reset/validate.js.map +0 -7
- package/dist/modules/auth/commands/acl.js +0 -254
- package/dist/modules/auth/commands/acl.js.map +0 -7
- package/dist/modules/auth/lib/userIdFilter.js +0 -16
- package/dist/modules/auth/lib/userIdFilter.js.map +0 -7
- package/dist/modules/auth/services/principalService.js +0 -200
- package/dist/modules/auth/services/principalService.js.map +0 -7
- package/dist/modules/auth/services/roleOrganizationScope.js +0 -41
- package/dist/modules/auth/services/roleOrganizationScope.js.map +0 -7
- package/dist/modules/communication_channels/lib/outbound-recipient.js +0 -33
- package/dist/modules/communication_channels/lib/outbound-recipient.js.map +0 -7
- package/dist/modules/communication_channels/lib/resolve-channel-type.js +0 -51
- package/dist/modules/communication_channels/lib/resolve-channel-type.js.map +0 -7
- package/dist/modules/customers/backend/customers/deals/pipeline/components/toneClasses.js +0 -18
- package/dist/modules/customers/backend/customers/deals/pipeline/components/toneClasses.js.map +0 -7
- package/dist/modules/customers/lib/calendar/participantIdentity.js +0 -9
- package/dist/modules/customers/lib/calendar/participantIdentity.js.map +0 -7
- package/dist/modules/customers/lib/closureStage.js +0 -45
- package/dist/modules/customers/lib/closureStage.js.map +0 -7
- package/dist/modules/customers/lib/detailReadAccess.js +0 -12
- package/dist/modules/customers/lib/detailReadAccess.js.map +0 -7
- package/dist/modules/data_sync/lib/abandoned-run.js +0 -19
- package/dist/modules/data_sync/lib/abandoned-run.js.map +0 -7
- package/dist/modules/devices/api/deviceSerialization.js +0 -46
- package/dist/modules/devices/api/deviceSerialization.js.map +0 -7
- package/dist/modules/devices/backend/devices/useDeviceUserLabels.js +0 -34
- package/dist/modules/devices/backend/devices/useDeviceUserLabels.js.map +0 -7
- package/dist/modules/devices/backend/devices/userOptions.js +0 -52
- package/dist/modules/devices/backend/devices/userOptions.js.map +0 -7
- package/dist/modules/directory/services/organizationHierarchyService.js +0 -29
- package/dist/modules/directory/services/organizationHierarchyService.js.map +0 -7
- package/dist/modules/directory/services/organizationScopeService.js +0 -56
- package/dist/modules/directory/services/organizationScopeService.js.map +0 -7
- package/dist/modules/integrations/backend/integrations/credential-secret-fields.js +0 -55
- package/dist/modules/integrations/backend/integrations/credential-secret-fields.js.map +0 -7
- package/dist/modules/messages/lib/channel-sender-identity.js +0 -26
- package/dist/modules/messages/lib/channel-sender-identity.js.map +0 -7
- package/dist/modules/messages/lib/composeSourceChannelType.js +0 -41
- package/dist/modules/messages/lib/composeSourceChannelType.js.map +0 -7
- package/dist/modules/query_index/lib/search-entity-policy.js +0 -14
- package/dist/modules/query_index/lib/search-entity-policy.js.map +0 -7
- package/dist/modules/sales/components/documents/lineItemShipmentLock.js +0 -54
- package/dist/modules/sales/components/documents/lineItemShipmentLock.js.map +0 -7
- package/dist/modules/sales/lib/salesChannelsToggleSeed.js +0 -33
- package/dist/modules/sales/lib/salesChannelsToggleSeed.js.map +0 -7
- package/dist/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.js +0 -32
- package/dist/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.js.map +0 -7
- package/dist/modules/wms/api/warehouseSearch.js +0 -21
- package/dist/modules/wms/api/warehouseSearch.js.map +0 -7
- package/dist/modules/wms/components/backend/WarehouseEditDialog.js +0 -158
- package/dist/modules/wms/components/backend/WarehouseEditDialog.js.map +0 -7
- package/dist/modules/wms/components/backend/warehouseFormOptions.js +0 -66
- package/dist/modules/wms/components/backend/warehouseFormOptions.js.map +0 -7
- package/src/modules/api_keys/di.ts +0 -7
- package/src/modules/api_keys/services/principalService.ts +0 -33
- package/src/modules/attachments/lib/attachment-service.ts +0 -468
- package/src/modules/auth/api/reset/validate.ts +0 -57
- package/src/modules/auth/commands/acl.ts +0 -495
- package/src/modules/auth/lib/userIdFilter.ts +0 -31
- package/src/modules/auth/services/principalService.ts +0 -266
- package/src/modules/auth/services/roleOrganizationScope.ts +0 -70
- package/src/modules/communication_channels/lib/outbound-recipient.ts +0 -71
- package/src/modules/communication_channels/lib/resolve-channel-type.ts +0 -99
- package/src/modules/customers/backend/customers/deals/pipeline/components/toneClasses.ts +0 -21
- package/src/modules/customers/lib/calendar/participantIdentity.ts +0 -17
- package/src/modules/customers/lib/closureStage.ts +0 -76
- package/src/modules/customers/lib/detailReadAccess.ts +0 -35
- package/src/modules/data_sync/lib/abandoned-run.ts +0 -56
- package/src/modules/devices/api/deviceSerialization.ts +0 -50
- package/src/modules/devices/backend/devices/useDeviceUserLabels.ts +0 -45
- package/src/modules/devices/backend/devices/userOptions.ts +0 -99
- package/src/modules/directory/services/organizationHierarchyService.ts +0 -34
- package/src/modules/directory/services/organizationScopeService.ts +0 -85
- package/src/modules/integrations/backend/integrations/credential-secret-fields.ts +0 -84
- package/src/modules/messages/lib/channel-sender-identity.ts +0 -55
- package/src/modules/messages/lib/composeSourceChannelType.ts +0 -95
- package/src/modules/query_index/lib/search-entity-policy.ts +0 -46
- package/src/modules/sales/components/documents/lineItemShipmentLock.ts +0 -74
- package/src/modules/sales/lib/salesChannelsToggleSeed.ts +0 -42
- package/src/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.ts +0 -87
- package/src/modules/wms/api/warehouseSearch.ts +0 -23
- package/src/modules/wms/components/backend/WarehouseEditDialog.tsx +0 -216
- package/src/modules/wms/components/backend/warehouseFormOptions.ts +0 -72
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/modules/push_notifications/backend/push_notifications/send/page.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { Plus, X } from 'lucide-react'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { CrudForm, type CrudField, type CrudFieldOption, type CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall, apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@open-mercato/ui/primitives/select'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\ntype KeyValue = { key: string; value: string }\n\ntype FormValues = {\n userId: string\n deviceId: string\n mode: string\n title: string\n body: string\n data: KeyValue[]\n sound: string\n badge: number | string\n image: string\n priority: string\n channelId: string\n // form-only helper (never sent): drives channelId visibility (hidden in silent / for an iOS target)\n showChannelId: boolean\n}\n\nconst DELIVERIES_HREF = '/backend/push_notifications'\nconst FORM_ID = 'push-custom-send-form'\n// Radix Select forbids an empty-string item value, so \"all devices\" uses a sentinel that we map\n// back to '' (the form value that means \"fan out to every push-capable device\").\nconst ALL_DEVICES = '__all__'\n\ntype DeviceOption = { id: string; label: string; platform: string }\n// Reported up to the page so the (custom) submit button can disable when there is nothing to send to.\ntype DeviceState = { userId: string; count: number; loading: boolean }\n\n// Dependent picker: loads the *selected recipient's* push-capable devices (admin devices API,\n// filtered by userId) so an admin can target one device or all of them. Reads the live form values,\n// so it re-loads whenever the recipient changes and clears a stale selection. It also derives\n// `showChannelId` (Android channel id is Android-only + visible-only) so the channelId field can hide\n// itself for a selected iOS device or in silent mode. Degrades to \"All devices\" when the admin lacks\n// devices.admin or the recipient has no push-capable device.\nfunction DeviceField({ value, setValue, setFormValue, values, onState }: CrudCustomFieldRenderProps & { onState?: (s: DeviceState) => void }) {\n const t = useT()\n const userId = typeof values?.userId === 'string' ? values.userId : ''\n const mode = typeof values?.mode === 'string' ? values.mode : 'visible'\n const selected = typeof value === 'string' && value ? value : ''\n const [devices, setDevices] = React.useState<DeviceOption[]>([])\n const [loading, setLoading] = React.useState(false)\n\n // Report the recipient + push-capable device count up so the page can disable \"Send\" when there is\n // nowhere to deliver (no recipient, or the recipient has zero push-capable devices).\n React.useEffect(() => {\n onState?.({ userId, count: devices.length, loading })\n }, [userId, devices.length, loading, onState])\n\n React.useEffect(() => {\n if (!userId) {\n setDevices([])\n if (selected) setValue('')\n return\n }\n let cancelled = false\n setLoading(true)\n const params = new URLSearchParams({ userId, pageSize: '50' })\n apiCall<{ items?: Array<{ id: string; deviceId: string; platform: string; pushProvider?: string | null }> }>(\n `/api/devices/admin/devices?${params.toString()}`,\n { headers: { 'x-om-forbidden-redirect': '0' } },\n { fallback: null },\n )\n .catch(() => null)\n .then((call) => {\n if (cancelled) return\n const items = (call && call.ok ? call.result?.items : []) ?? []\n const opts = items\n .filter((d): d is { id: string; deviceId: string; platform: string; pushProvider?: string | null } =>\n !!d && typeof d.id === 'string' && !!d.pushProvider)\n .map((d) => ({ id: d.id, label: `${d.deviceId} \u00B7 ${d.platform}${d.pushProvider ? ` \u00B7 ${d.pushProvider}` : ''}`, platform: d.platform }))\n setDevices(opts)\n if (selected && !opts.some((o) => o.id === selected)) setValue('')\n })\n .finally(() => { if (!cancelled) setLoading(false) })\n return () => { cancelled = true }\n // Reload only when the recipient changes; `selected`/`setValue` are handled inside.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [userId])\n\n // channelId is Android-only and irrelevant to silent pushes \u2192 hide it for a selected iOS device or\n // in silent mode. Only write when the derived value actually changes (avoids a render loop).\n const selectedPlatform = React.useMemo(() => devices.find((d) => d.id === selected)?.platform, [devices, selected])\n React.useEffect(() => {\n const show = mode !== 'silent' && selectedPlatform !== 'ios'\n if (values?.showChannelId !== show) setFormValue?.('showChannelId', show)\n }, [mode, selectedPlatform, values?.showChannelId, setFormValue])\n\n return (\n <div className=\"space-y-1\">\n <Select value={selected || ALL_DEVICES} onValueChange={(v) => setValue(v === ALL_DEVICES ? '' : v)} disabled={!userId}>\n <SelectTrigger>\n <SelectValue placeholder={`${t('push_notifications.send.deviceAll')} (${devices.length})`} />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={ALL_DEVICES}>{`${t('push_notifications.send.deviceAll')} (${devices.length})`}</SelectItem>\n {devices.map((d) => (\n <SelectItem key={d.id} value={d.id}>{d.label}</SelectItem>\n ))}\n </SelectContent>\n </Select>\n <p className={`text-xs ${userId && !loading && devices.length === 0 ? 'text-status-warning-text' : 'text-muted-foreground'}`}>\n {!userId\n ? t('push_notifications.send.deviceSelectUserFirst')\n : loading\n ? t('common.loading', 'Loading\u2026')\n : devices.length === 0\n ? t('push_notifications.send.deviceNone')\n : t('push_notifications.send.deviceHint')}\n </p>\n </div>\n )\n}\n\n// Arbitrary key/value payload delivered inside the push `data` map (the app reads it). Shown for both\n// visible and silent sends \u2014 for silent it is the entire payload.\nfunction DataField({ value, setValue }: CrudCustomFieldRenderProps) {\n const t = useT()\n const pairs: KeyValue[] = Array.isArray(value) ? (value as KeyValue[]) : []\n const update = (next: KeyValue[]) => setValue(next)\n return (\n <div className=\"space-y-2\">\n {pairs.length === 0 ? (\n <p className=\"text-xs text-muted-foreground\">{t('push_notifications.send.dataEmpty')}</p>\n ) : null}\n {pairs.map((pair, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n <Input\n placeholder={t('push_notifications.send.dataKey')}\n value={pair.key}\n onChange={(e) => update(pairs.map((p, i) => (i === index ? { ...p, key: e.target.value } : p)))}\n />\n <Input\n placeholder={t('push_notifications.send.dataValue')}\n value={pair.value}\n onChange={(e) => update(pairs.map((p, i) => (i === index ? { ...p, value: e.target.value } : p)))}\n />\n <IconButton\n type=\"button\"\n variant=\"ghost\"\n aria-label={t('push_notifications.send.dataRemove')}\n onClick={() => update(pairs.filter((_, i) => i !== index))}\n >\n <X className=\"h-4 w-4\" />\n </IconButton>\n </div>\n ))}\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => update([...pairs, { key: '', value: '' }])}>\n <Plus className=\"h-4 w-4 mr-1\" />\n {t('push_notifications.send.dataAdd')}\n </Button>\n </div>\n )\n}\n\nexport default function PushCustomSendPage() {\n const router = useRouter()\n const t = useT()\n const [deviceState, setDeviceState] = React.useState<DeviceState>({ userId: '', count: 0, loading: false })\n const [submitting, setSubmitting] = React.useState(false)\n\n // Stable reporter for the device picker \u2192 bails when unchanged so it can't loop the render.\n const reportDeviceState = React.useCallback((next: DeviceState) => {\n setDeviceState((prev) =>\n prev.userId === next.userId && prev.count === next.count && prev.loading === next.loading ? prev : next)\n }, [])\n\n // Recipient search by name/email via /api/auth/users (mirrors the devices list + admin\n // notification-preferences picker). Return results only \u2014 the combobox retains them internally, so\n // pushing them into state that `fields` depends on would re-render the whole form per keystroke.\n const loadUserOptions = React.useCallback(async (query?: string): Promise<CrudFieldOption[]> => {\n const params = new URLSearchParams()\n params.set('page', '1')\n params.set('pageSize', '20')\n if (query && query.trim().length > 0) params.set('search', query.trim())\n const call = await apiCall<{ items?: { id: string; name?: string | null; email?: string | null }[] }>(\n `/api/auth/users?${params.toString()}`,\n { headers: { 'x-om-forbidden-redirect': '0' } },\n { fallback: null },\n ).catch(() => null)\n if (!call || !call.ok) return []\n return (call.result?.items ?? []).flatMap((item): CrudFieldOption[] => {\n if (!item || typeof item.id !== 'string' || !item.id.trim()) return []\n const name = typeof item.name === 'string' && item.name.trim() ? item.name.trim() : null\n const email = typeof item.email === 'string' && item.email.trim() ? item.email.trim() : null\n const label = name && email ? `${name} \u2014 ${email}` : email ?? name ?? item.id\n return [{ value: item.id, label }]\n })\n }, [])\n\n const visibleOnly = { field: 'mode', equals: 'visible' } as const\n\n const fields = React.useMemo<CrudField[]>(() => [\n { id: 'userId', label: t('push_notifications.send.userId'), type: 'combobox', required: true, description: t('push_notifications.send.userIdHint'), loadOptions: loadUserOptions },\n { id: 'deviceId', label: t('push_notifications.send.device'), type: 'custom', component: (props) => <DeviceField {...props} onState={reportDeviceState} /> },\n {\n id: 'mode',\n label: t('push_notifications.send.mode'),\n type: 'select',\n required: true,\n description: t('push_notifications.send.modeHint'),\n options: [\n { value: 'visible', label: t('push_notifications.send.modeVisible') },\n { value: 'silent', label: t('push_notifications.send.modeSilent') },\n ],\n },\n { id: 'title', label: t('push_notifications.send.title'), type: 'text', required: true, visibleWhen: visibleOnly },\n { id: 'body', label: t('push_notifications.send.body'), type: 'textarea', visibleWhen: visibleOnly },\n { id: 'data', label: t('push_notifications.send.data'), type: 'custom', description: t('push_notifications.send.dataHint'), component: (props) => <DataField {...props} /> },\n { id: 'sound', label: t('push_notifications.send.sound'), type: 'text', visibleWhen: visibleOnly },\n { id: 'badge', label: t('push_notifications.send.badge'), type: 'number', visibleWhen: visibleOnly },\n { id: 'image', label: t('push_notifications.send.image'), type: 'text', visibleWhen: visibleOnly },\n {\n id: 'priority',\n label: t('push_notifications.send.priority'),\n type: 'select',\n options: [\n { value: '', label: t('push_notifications.send.priorityDefault') },\n { value: 'high', label: t('push_notifications.send.priorityHigh') },\n { value: 'normal', label: t('push_notifications.send.priorityNormal') },\n ],\n },\n { id: 'channelId', label: t('push_notifications.send.channelId'), type: 'text', visibleWhen: { field: 'showChannelId', equals: true } },\n ], [t, loadUserOptions, reportDeviceState])\n\n // NOTE: intentionally a flat field list (no `groups`). CrudForm only applies `visibleWhen` in the\n // ungrouped render path \u2014 grouped fields ignore it \u2014 and this form relies on mode/platform-driven\n // field visibility (silent hides title/body/options; iOS hides channelId).\n\n return (\n <Page>\n <PageBody>\n <CrudForm<FormValues>\n title={t('push_notifications.send.pageTitle')}\n backHref={DELIVERIES_HREF}\n formId={FORM_ID}\n hideFooterActions\n fields={fields}\n initialValues={{ userId: '', deviceId: '', mode: 'visible', title: '', body: '', data: [], sound: '', badge: '', image: '', priority: '', channelId: '', showChannelId: true }}\n submitLabel={t('push_notifications.send.submit')}\n onSubmit={async (values) => {\n setSubmitting(true)\n try {\n const silent = values.mode === 'silent'\n const body = (values.body ?? '').trim()\n\n const dataMap: Record<string, string> = {}\n for (const pair of Array.isArray(values.data) ? values.data : []) {\n const key = (pair?.key ?? '').trim()\n if (key) dataMap[key] = `${pair?.value ?? ''}`\n }\n const hasData = Object.keys(dataMap).length > 0\n\n // Options that only affect a visible banner are dropped for silent.\n const pushOptions: Record<string, unknown> = {}\n if (!silent) {\n if (typeof values.sound === 'string' && values.sound.trim()) pushOptions.sound = values.sound.trim()\n const badgeNum = typeof values.badge === 'number' ? values.badge : Number.parseInt(String(values.badge ?? ''), 10)\n if (Number.isFinite(badgeNum) && badgeNum >= 0) pushOptions.badge = badgeNum\n if (typeof values.image === 'string' && values.image.trim()) pushOptions.image = values.image.trim()\n if (typeof values.channelId === 'string' && values.channelId.trim()) pushOptions.channelId = values.channelId.trim()\n }\n if (values.priority === 'high' || values.priority === 'normal') pushOptions.priority = values.priority\n const hasOptions = Object.keys(pushOptions).length > 0\n\n // Silent hides the title field; the API still needs one, so use a stable label for the log.\n const title = silent ? (values.title ?? '').trim() || 'Silent push' : (values.title ?? '').trim()\n\n await apiCallOrThrow('/api/push_notifications/custom-send', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n recipientUserId: (values.userId ?? '').trim(),\n deviceId: (values.deviceId ?? '').trim() || undefined,\n title,\n body: !silent && body.length > 0 ? body : undefined,\n silent,\n data: hasData ? dataMap : undefined,\n pushOptions: hasOptions ? pushOptions : undefined,\n }),\n })\n flash(t('push_notifications.send.success'), 'success')\n router.push(DELIVERIES_HREF)\n } finally {\n setSubmitting(false)\n }\n }}\n />\n <div className=\"mt-4 flex items-center justify-between gap-3\">\n <div className=\"text-xs\">\n {!deviceState.userId ? (\n <span className=\"text-muted-foreground\">{t('push_notifications.send.deviceSelectUserFirst')}</span>\n ) : deviceState.count === 0 && !deviceState.loading ? (\n <span className=\"text-status-warning-text\">{t('push_notifications.send.deviceNone')}</span>\n ) : null}\n </div>\n <div className=\"flex gap-2\">\n <Button asChild variant=\"outline\">\n <Link href={DELIVERIES_HREF}>{t('common.cancel', 'Cancel')}</Link>\n </Button>\n <Button\n type=\"submit\"\n form={FORM_ID}\n disabled={!deviceState.userId || deviceState.count === 0 || deviceState.loading || submitting}\n >\n {t('push_notifications.send.submit')}\n </Button>\n </div>\n </div>\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
-
"mappings": ";AA0GU,cAEF,YAFE;AAzGV,YAAY,WAAW;AACvB,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,MAAM,SAAS;AACxB,SAAS,MAAM,gBAAgB;AAC/B,SAAS,gBAAuF;AAChG,SAAS,SAAS,s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M,OAAO,MACV,OAAO,CAAC,MACP,CAAC,CAAC,KAAK,OAAO,EAAE,OAAO,YAAY,CAAC,CAAC,EAAE,
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { Plus, X } from 'lucide-react'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { CrudForm, type CrudField, type CrudFieldOption, type CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall, apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@open-mercato/ui/primitives/select'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\ntype KeyValue = { key: string; value: string }\n\ntype FormValues = {\n userId: string\n deviceId: string\n mode: string\n title: string\n body: string\n data: KeyValue[]\n sound: string\n badge: number | string\n image: string\n priority: string\n channelId: string\n // form-only helper (never sent): drives channelId visibility (hidden in silent / for an iOS target)\n showChannelId: boolean\n}\n\nconst DELIVERIES_HREF = '/backend/push_notifications'\nconst FORM_ID = 'push-custom-send-form'\n// Radix Select forbids an empty-string item value, so \"all devices\" uses a sentinel that we map\n// back to '' (the form value that means \"fan out to every push-capable device\").\nconst ALL_DEVICES = '__all__'\n\ntype DeviceOption = { id: string; label: string; platform: string }\n// Reported up to the page so the (custom) submit button can disable when there is nothing to send to.\ntype DeviceState = { userId: string; count: number; loading: boolean }\n\n// Dependent picker: loads the *selected recipient's* push-capable devices (admin devices API,\n// filtered by userId) so an admin can target one device or all of them. Reads the live form values,\n// so it re-loads whenever the recipient changes and clears a stale selection. It also derives\n// `showChannelId` (Android channel id is Android-only + visible-only) so the channelId field can hide\n// itself for a selected iOS device or in silent mode. Degrades to \"All devices\" when the admin lacks\n// devices.admin or the recipient has no push-capable device.\nfunction DeviceField({ value, setValue, setFormValue, values, onState }: CrudCustomFieldRenderProps & { onState?: (s: DeviceState) => void }) {\n const t = useT()\n const userId = typeof values?.userId === 'string' ? values.userId : ''\n const mode = typeof values?.mode === 'string' ? values.mode : 'visible'\n const selected = typeof value === 'string' && value ? value : ''\n const [devices, setDevices] = React.useState<DeviceOption[]>([])\n const [loading, setLoading] = React.useState(false)\n\n // Report the recipient + push-capable device count up so the page can disable \"Send\" when there is\n // nowhere to deliver (no recipient, or the recipient has zero push-capable devices).\n React.useEffect(() => {\n onState?.({ userId, count: devices.length, loading })\n }, [userId, devices.length, loading, onState])\n\n React.useEffect(() => {\n if (!userId) {\n setDevices([])\n if (selected) setValue('')\n return\n }\n let cancelled = false\n setLoading(true)\n const params = new URLSearchParams({ userId, pageSize: '50' })\n apiCall<{ items?: Array<{ id: string; device_id: string; platform: string; push_provider?: string | null }> }>(\n `/api/devices/admin/devices?${params.toString()}`,\n { headers: { 'x-om-forbidden-redirect': '0' } },\n { fallback: null },\n )\n .catch(() => null)\n .then((call) => {\n if (cancelled) return\n const items = (call && call.ok ? call.result?.items : []) ?? []\n const opts = items\n .filter((d): d is { id: string; device_id: string; platform: string; push_provider?: string | null } =>\n !!d && typeof d.id === 'string' && !!d.push_provider)\n .map((d) => ({ id: d.id, label: `${d.device_id} \u00B7 ${d.platform}${d.push_provider ? ` \u00B7 ${d.push_provider}` : ''}`, platform: d.platform }))\n setDevices(opts)\n if (selected && !opts.some((o) => o.id === selected)) setValue('')\n })\n .finally(() => { if (!cancelled) setLoading(false) })\n return () => { cancelled = true }\n // Reload only when the recipient changes; `selected`/`setValue` are handled inside.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [userId])\n\n // channelId is Android-only and irrelevant to silent pushes \u2192 hide it for a selected iOS device or\n // in silent mode. Only write when the derived value actually changes (avoids a render loop).\n const selectedPlatform = React.useMemo(() => devices.find((d) => d.id === selected)?.platform, [devices, selected])\n React.useEffect(() => {\n const show = mode !== 'silent' && selectedPlatform !== 'ios'\n if (values?.showChannelId !== show) setFormValue?.('showChannelId', show)\n }, [mode, selectedPlatform, values?.showChannelId, setFormValue])\n\n return (\n <div className=\"space-y-1\">\n <Select value={selected || ALL_DEVICES} onValueChange={(v) => setValue(v === ALL_DEVICES ? '' : v)} disabled={!userId}>\n <SelectTrigger>\n <SelectValue placeholder={`${t('push_notifications.send.deviceAll')} (${devices.length})`} />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={ALL_DEVICES}>{`${t('push_notifications.send.deviceAll')} (${devices.length})`}</SelectItem>\n {devices.map((d) => (\n <SelectItem key={d.id} value={d.id}>{d.label}</SelectItem>\n ))}\n </SelectContent>\n </Select>\n <p className={`text-xs ${userId && !loading && devices.length === 0 ? 'text-status-warning-text' : 'text-muted-foreground'}`}>\n {!userId\n ? t('push_notifications.send.deviceSelectUserFirst')\n : loading\n ? t('common.loading', 'Loading\u2026')\n : devices.length === 0\n ? t('push_notifications.send.deviceNone')\n : t('push_notifications.send.deviceHint')}\n </p>\n </div>\n )\n}\n\n// Arbitrary key/value payload delivered inside the push `data` map (the app reads it). Shown for both\n// visible and silent sends \u2014 for silent it is the entire payload.\nfunction DataField({ value, setValue }: CrudCustomFieldRenderProps) {\n const t = useT()\n const pairs: KeyValue[] = Array.isArray(value) ? (value as KeyValue[]) : []\n const update = (next: KeyValue[]) => setValue(next)\n return (\n <div className=\"space-y-2\">\n {pairs.length === 0 ? (\n <p className=\"text-xs text-muted-foreground\">{t('push_notifications.send.dataEmpty')}</p>\n ) : null}\n {pairs.map((pair, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n <Input\n placeholder={t('push_notifications.send.dataKey')}\n value={pair.key}\n onChange={(e) => update(pairs.map((p, i) => (i === index ? { ...p, key: e.target.value } : p)))}\n />\n <Input\n placeholder={t('push_notifications.send.dataValue')}\n value={pair.value}\n onChange={(e) => update(pairs.map((p, i) => (i === index ? { ...p, value: e.target.value } : p)))}\n />\n <IconButton\n type=\"button\"\n variant=\"ghost\"\n aria-label={t('push_notifications.send.dataRemove')}\n onClick={() => update(pairs.filter((_, i) => i !== index))}\n >\n <X className=\"h-4 w-4\" />\n </IconButton>\n </div>\n ))}\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => update([...pairs, { key: '', value: '' }])}>\n <Plus className=\"h-4 w-4 mr-1\" />\n {t('push_notifications.send.dataAdd')}\n </Button>\n </div>\n )\n}\n\nexport default function PushCustomSendPage() {\n const router = useRouter()\n const t = useT()\n const [deviceState, setDeviceState] = React.useState<DeviceState>({ userId: '', count: 0, loading: false })\n const [submitting, setSubmitting] = React.useState(false)\n\n // Stable reporter for the device picker \u2192 bails when unchanged so it can't loop the render.\n const reportDeviceState = React.useCallback((next: DeviceState) => {\n setDeviceState((prev) =>\n prev.userId === next.userId && prev.count === next.count && prev.loading === next.loading ? prev : next)\n }, [])\n\n // Recipient search by name/email via /api/auth/users (mirrors the devices list + admin\n // notification-preferences picker). Return results only \u2014 the combobox retains them internally, so\n // pushing them into state that `fields` depends on would re-render the whole form per keystroke.\n const loadUserOptions = React.useCallback(async (query?: string): Promise<CrudFieldOption[]> => {\n const params = new URLSearchParams()\n params.set('page', '1')\n params.set('pageSize', '20')\n if (query && query.trim().length > 0) params.set('search', query.trim())\n const call = await apiCall<{ items?: { id: string; name?: string | null; email?: string | null }[] }>(\n `/api/auth/users?${params.toString()}`,\n { headers: { 'x-om-forbidden-redirect': '0' } },\n { fallback: null },\n ).catch(() => null)\n if (!call || !call.ok) return []\n return (call.result?.items ?? []).flatMap((item): CrudFieldOption[] => {\n if (!item || typeof item.id !== 'string' || !item.id.trim()) return []\n const name = typeof item.name === 'string' && item.name.trim() ? item.name.trim() : null\n const email = typeof item.email === 'string' && item.email.trim() ? item.email.trim() : null\n const label = name && email ? `${name} \u2014 ${email}` : email ?? name ?? item.id\n return [{ value: item.id, label }]\n })\n }, [])\n\n const visibleOnly = { field: 'mode', equals: 'visible' } as const\n\n const fields = React.useMemo<CrudField[]>(() => [\n { id: 'userId', label: t('push_notifications.send.userId'), type: 'combobox', required: true, description: t('push_notifications.send.userIdHint'), loadOptions: loadUserOptions },\n { id: 'deviceId', label: t('push_notifications.send.device'), type: 'custom', component: (props) => <DeviceField {...props} onState={reportDeviceState} /> },\n {\n id: 'mode',\n label: t('push_notifications.send.mode'),\n type: 'select',\n required: true,\n description: t('push_notifications.send.modeHint'),\n options: [\n { value: 'visible', label: t('push_notifications.send.modeVisible') },\n { value: 'silent', label: t('push_notifications.send.modeSilent') },\n ],\n },\n { id: 'title', label: t('push_notifications.send.title'), type: 'text', required: true, visibleWhen: visibleOnly },\n { id: 'body', label: t('push_notifications.send.body'), type: 'textarea', visibleWhen: visibleOnly },\n { id: 'data', label: t('push_notifications.send.data'), type: 'custom', description: t('push_notifications.send.dataHint'), component: (props) => <DataField {...props} /> },\n { id: 'sound', label: t('push_notifications.send.sound'), type: 'text', visibleWhen: visibleOnly },\n { id: 'badge', label: t('push_notifications.send.badge'), type: 'number', visibleWhen: visibleOnly },\n { id: 'image', label: t('push_notifications.send.image'), type: 'text', visibleWhen: visibleOnly },\n {\n id: 'priority',\n label: t('push_notifications.send.priority'),\n type: 'select',\n options: [\n { value: '', label: t('push_notifications.send.priorityDefault') },\n { value: 'high', label: t('push_notifications.send.priorityHigh') },\n { value: 'normal', label: t('push_notifications.send.priorityNormal') },\n ],\n },\n { id: 'channelId', label: t('push_notifications.send.channelId'), type: 'text', visibleWhen: { field: 'showChannelId', equals: true } },\n ], [t, loadUserOptions, reportDeviceState])\n\n // NOTE: intentionally a flat field list (no `groups`). CrudForm only applies `visibleWhen` in the\n // ungrouped render path \u2014 grouped fields ignore it \u2014 and this form relies on mode/platform-driven\n // field visibility (silent hides title/body/options; iOS hides channelId).\n\n return (\n <Page>\n <PageBody>\n <CrudForm<FormValues>\n title={t('push_notifications.send.pageTitle')}\n backHref={DELIVERIES_HREF}\n formId={FORM_ID}\n hideFooterActions\n fields={fields}\n initialValues={{ userId: '', deviceId: '', mode: 'visible', title: '', body: '', data: [], sound: '', badge: '', image: '', priority: '', channelId: '', showChannelId: true }}\n submitLabel={t('push_notifications.send.submit')}\n onSubmit={async (values) => {\n setSubmitting(true)\n try {\n const silent = values.mode === 'silent'\n const body = (values.body ?? '').trim()\n\n const dataMap: Record<string, string> = {}\n for (const pair of Array.isArray(values.data) ? values.data : []) {\n const key = (pair?.key ?? '').trim()\n if (key) dataMap[key] = `${pair?.value ?? ''}`\n }\n const hasData = Object.keys(dataMap).length > 0\n\n // Options that only affect a visible banner are dropped for silent.\n const pushOptions: Record<string, unknown> = {}\n if (!silent) {\n if (typeof values.sound === 'string' && values.sound.trim()) pushOptions.sound = values.sound.trim()\n const badgeNum = typeof values.badge === 'number' ? values.badge : Number.parseInt(String(values.badge ?? ''), 10)\n if (Number.isFinite(badgeNum) && badgeNum >= 0) pushOptions.badge = badgeNum\n if (typeof values.image === 'string' && values.image.trim()) pushOptions.image = values.image.trim()\n if (typeof values.channelId === 'string' && values.channelId.trim()) pushOptions.channelId = values.channelId.trim()\n }\n if (values.priority === 'high' || values.priority === 'normal') pushOptions.priority = values.priority\n const hasOptions = Object.keys(pushOptions).length > 0\n\n // Silent hides the title field; the API still needs one, so use a stable label for the log.\n const title = silent ? (values.title ?? '').trim() || 'Silent push' : (values.title ?? '').trim()\n\n await apiCallOrThrow('/api/push_notifications/custom-send', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n recipientUserId: (values.userId ?? '').trim(),\n deviceId: (values.deviceId ?? '').trim() || undefined,\n title,\n body: !silent && body.length > 0 ? body : undefined,\n silent,\n data: hasData ? dataMap : undefined,\n pushOptions: hasOptions ? pushOptions : undefined,\n }),\n })\n flash(t('push_notifications.send.success'), 'success')\n router.push(DELIVERIES_HREF)\n } finally {\n setSubmitting(false)\n }\n }}\n />\n <div className=\"mt-4 flex items-center justify-between gap-3\">\n <div className=\"text-xs\">\n {!deviceState.userId ? (\n <span className=\"text-muted-foreground\">{t('push_notifications.send.deviceSelectUserFirst')}</span>\n ) : deviceState.count === 0 && !deviceState.loading ? (\n <span className=\"text-status-warning-text\">{t('push_notifications.send.deviceNone')}</span>\n ) : null}\n </div>\n <div className=\"flex gap-2\">\n <Button asChild variant=\"outline\">\n <Link href={DELIVERIES_HREF}>{t('common.cancel', 'Cancel')}</Link>\n </Button>\n <Button\n type=\"submit\"\n form={FORM_ID}\n disabled={!deviceState.userId || deviceState.count === 0 || deviceState.loading || submitting}\n >\n {t('push_notifications.send.submit')}\n </Button>\n </div>\n </div>\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA0GU,cAEF,YAFE;AAzGV,YAAY,WAAW;AACvB,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,MAAM,SAAS;AACxB,SAAS,MAAM,gBAAgB;AAC/B,SAAS,gBAAuF;AAChG,SAAS,SAAS,sBAAsB;AACxC,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,aAAa,eAAe,kBAAkB;AAC9E,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,YAAY;AAoBrB,MAAM,kBAAkB;AACxB,MAAM,UAAU;AAGhB,MAAM,cAAc;AAYpB,SAAS,YAAY,EAAE,OAAO,UAAU,cAAc,QAAQ,QAAQ,GAAwE;AAC5I,QAAM,IAAI,KAAK;AACf,QAAM,SAAS,OAAO,QAAQ,WAAW,WAAW,OAAO,SAAS;AACpE,QAAM,OAAO,OAAO,QAAQ,SAAS,WAAW,OAAO,OAAO;AAC9D,QAAM,WAAW,OAAO,UAAU,YAAY,QAAQ,QAAQ;AAC9D,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAyB,CAAC,CAAC;AAC/D,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,KAAK;AAIlD,QAAM,UAAU,MAAM;AACpB,cAAU,EAAE,QAAQ,OAA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AAU,WACZ,WAAC,YAAY,SACZ,oBAAC,UAAK,WAAU,yBAAyB,YAAE,+CAA+C,GAAE,IAC1F,YAAY,UAAU,KAAK,CAAC,YAAY,UAC1C,oBAAC,UAAK,WAAU,4BAA4B,YAAE,oCAAoC,GAAE,IAClF,MACN;AAAA,MACA,qBAAC,SAAI,WAAU,cACb;AAAA,4BAAC,UAAO,SAAO,MAAC,SAAQ,WACtB,8BAAC,QAAK,MAAM,iBAAkB,YAAE,iBAAiB,QAAQ,GAAE,GAC7D;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,MAAM;AAAA,YACN,UAAU,CAAC,YAAY,UAAU,YAAY,UAAU,KAAK,YAAY,WAAW;AAAA,YAElF,YAAE,gCAAgC;AAAA;AAAA,QACrC;AAAA,SACF;AAAA,OACF;AAAA,KACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,8 +13,6 @@ import {
|
|
|
13
13
|
resolveJoins
|
|
14
14
|
} from "@open-mercato/shared/lib/query/join-utils";
|
|
15
15
|
import { resolveSearchConfig } from "@open-mercato/shared/lib/search/config";
|
|
16
|
-
import { isEncryptedLikeField, resolveEncryptedLikeFieldSet } from "@open-mercato/shared/lib/query/engine";
|
|
17
|
-
import { isTenantDataEncryptionEnabled } from "@open-mercato/shared/lib/encryption/toggles";
|
|
18
16
|
import {
|
|
19
17
|
createSearchTokenAvailability,
|
|
20
18
|
isSearchFilterOp,
|
|
@@ -24,7 +22,6 @@ import { tokenizeText } from "@open-mercato/shared/lib/search/tokenize";
|
|
|
24
22
|
import { runBeforeQueryPipeline, runAfterQueryPipeline } from "@open-mercato/shared/lib/query/query-extension-runner";
|
|
25
23
|
import { warnOnCiphertextLikeFallback } from "@open-mercato/shared/lib/query/ciphertext-search-warning";
|
|
26
24
|
import { resolveEncryptedSortFields, resolveEncryptedSortMaxRows, sortRowsInMemory } from "@open-mercato/shared/lib/query/encrypted-sort";
|
|
27
|
-
import { resolveListCountCap } from "@open-mercato/shared/lib/query/count-cap";
|
|
28
25
|
import { mapWithConcurrency } from "@open-mercato/shared/lib/query/bounded-decrypt";
|
|
29
26
|
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
30
27
|
import { parseNumberWithDefault } from "@open-mercato/shared/lib/number";
|
|
@@ -390,34 +387,6 @@ class HybridQueryEngine {
|
|
|
390
387
|
].filter((filter) => isSearchFilterOp(filter.op));
|
|
391
388
|
const hasSearchTokens = searchEnabled && searchSources.length && sourceSearchFilters.length ? await this.searchAvailability().anySourceHasTokens(searchSources, opts.tenantId ?? null, orgScope) : false;
|
|
392
389
|
const searchRuntime = { ...searchRuntimeBase, searchSources, enabled: searchEnabled && hasSearchTokens };
|
|
393
|
-
if (searchRuntime.enabled && searchConfig.useIlikeForNonEncryptedFields === true && sourceSearchFilters.some((filter) => !String(filter.field).startsWith("cf:"))) {
|
|
394
|
-
try {
|
|
395
|
-
const encryptionService = this.getEncryptionService();
|
|
396
|
-
const readEncryptedFieldNames = encryptionService?.getEncryptedFieldNames?.bind(encryptionService);
|
|
397
|
-
if (readEncryptedFieldNames) {
|
|
398
|
-
searchRuntime.encryptedFields = await resolveEncryptedLikeFieldSet(
|
|
399
|
-
() => readEncryptedFieldNames(
|
|
400
|
-
entity,
|
|
401
|
-
opts.tenantId ?? null,
|
|
402
|
-
null,
|
|
403
|
-
{ ignoreRuntimeHealth: true }
|
|
404
|
-
),
|
|
405
|
-
String(entity),
|
|
406
|
-
opts.tenantId ?? null
|
|
407
|
-
);
|
|
408
|
-
} else if (isTenantDataEncryptionEnabled()) {
|
|
409
|
-
searchRuntime.encryptedFields = null;
|
|
410
|
-
} else {
|
|
411
|
-
searchRuntime.encryptedFields = /* @__PURE__ */ new Set();
|
|
412
|
-
}
|
|
413
|
-
} catch (err) {
|
|
414
|
-
logger.warn("search: encrypted-field map unavailable; keeping the token rewrite for all columns", {
|
|
415
|
-
entity: String(entity),
|
|
416
|
-
error: err instanceof Error ? err.message : String(err)
|
|
417
|
-
});
|
|
418
|
-
searchRuntime.encryptedFields = null;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
390
|
if (searchFilters.length) {
|
|
422
391
|
this.logSearchDebug("search:init", {
|
|
423
392
|
entity,
|
|
@@ -800,79 +769,6 @@ class HybridQueryEngine {
|
|
|
800
769
|
};
|
|
801
770
|
const hasCustomFieldFilters = cfFilters.length > 0;
|
|
802
771
|
const canOptimizeCount = !hasCustomFieldFilters && !hasNonBaseSearchSource;
|
|
803
|
-
const isRowsetDependentFilter = (filter) => {
|
|
804
|
-
const baseField = resolveBaseColumn(String(filter.field));
|
|
805
|
-
if (!baseField) return true;
|
|
806
|
-
if ((filter.op === "like" || filter.op === "ilike") && searchRuntime.enabled && typeof filter.value === "string" && hasNonBaseSearchSource) return true;
|
|
807
|
-
return false;
|
|
808
|
-
};
|
|
809
|
-
const rowsetRegularFilters = regularBaseFilters.filter((filter) => isRowsetDependentFilter(filter));
|
|
810
|
-
const outerRegularFilters = regularBaseFilters.filter((filter) => !isRowsetDependentFilter(filter));
|
|
811
|
-
const orGroupsRowsetDependent = orGroupCfFilters.length > 0 || orGroupFilters.some((filter) => isRowsetDependentFilter(filter));
|
|
812
|
-
const hasInnerTypedCfSource = preparedCfSources.some((source) => ((opts.customFieldSources ?? []).find((s) => s && (s.alias ?? void 0) === source.alias)?.join?.type ?? "left") === "inner");
|
|
813
|
-
const needsIndexRowset = hasCustomFieldFilters || rowsetRegularFilters.length > 0 || orGroupsRowsetDependent || hasInnerTypedCfSource;
|
|
814
|
-
const applyCountShape = async (q) => {
|
|
815
|
-
let next = applyBaseScope(q);
|
|
816
|
-
for (const filter of outerRegularFilters) {
|
|
817
|
-
const baseField = resolveBaseColumn(String(filter.field));
|
|
818
|
-
if (!baseField) continue;
|
|
819
|
-
next = this.applyColumnFilter(next, qualify(baseField), filter, {
|
|
820
|
-
...searchRuntime,
|
|
821
|
-
entity,
|
|
822
|
-
field: String(filter.field),
|
|
823
|
-
recordIdColumn: qualify("id")
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
if (!orGroupsRowsetDependent) next = applyOrGroupedBaseFilters(next);
|
|
827
|
-
if (needsIndexRowset) {
|
|
828
|
-
let rowset = db.selectFrom(sql`(select 1)`.as("om_count_seed")).select(sql`1`.as("one"));
|
|
829
|
-
rowset = applyEntityIndexesJoin(rowset);
|
|
830
|
-
rowset = applyCustomFieldSourceJoins(rowset);
|
|
831
|
-
rowset = applyCfFilters(rowset);
|
|
832
|
-
for (const filter of rowsetRegularFilters) {
|
|
833
|
-
const baseField = resolveBaseColumn(String(filter.field));
|
|
834
|
-
if (!baseField) {
|
|
835
|
-
rowset = this.applyIndexDocFilterFromAlias(
|
|
836
|
-
rowset,
|
|
837
|
-
"ei",
|
|
838
|
-
entity,
|
|
839
|
-
String(filter.field),
|
|
840
|
-
filter.op,
|
|
841
|
-
filter.value,
|
|
842
|
-
qualify("id"),
|
|
843
|
-
searchRuntime
|
|
844
|
-
);
|
|
845
|
-
continue;
|
|
846
|
-
}
|
|
847
|
-
rowset = this.applyColumnFilter(rowset, qualify(baseField), filter, {
|
|
848
|
-
...searchRuntime,
|
|
849
|
-
entity,
|
|
850
|
-
field: String(filter.field),
|
|
851
|
-
recordIdColumn: qualify("id")
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
if (orGroupsRowsetDependent) rowset = applyOrGroupedBaseFilters(rowset);
|
|
855
|
-
const capturedRowset = rowset;
|
|
856
|
-
next = next.where((eb) => eb.exists(capturedRowset));
|
|
857
|
-
}
|
|
858
|
-
next = await applyJoinFilters({
|
|
859
|
-
db,
|
|
860
|
-
baseTable,
|
|
861
|
-
builder: next,
|
|
862
|
-
joinMap,
|
|
863
|
-
joinFilters,
|
|
864
|
-
aliasTables,
|
|
865
|
-
qualifyBase: (column) => qualify(column),
|
|
866
|
-
applyAliasScope: async (target, alias) => applyAliasScopes(target, alias),
|
|
867
|
-
applyFilterOp: (target, column, op, value) => applyJoinFilterOpFn(target, column, op, value),
|
|
868
|
-
applyJoinFilterOp: async (target, filter, qualified, join) => {
|
|
869
|
-
const applied = await applyJoinSearchFilterOp(target, filter, qualified, join);
|
|
870
|
-
return { applied, builder: target };
|
|
871
|
-
},
|
|
872
|
-
columnExists: (tbl, column) => this.columnExists(tbl, column)
|
|
873
|
-
});
|
|
874
|
-
return next;
|
|
875
|
-
};
|
|
876
772
|
const selectFieldSet = new Set(opts.fields && opts.fields.length ? opts.fields.map(String) : Array.from(columns.keys()));
|
|
877
773
|
if (requiresPlaintextSort) {
|
|
878
774
|
for (const field of encryptedSortFields) selectFieldSet.add(field);
|
|
@@ -928,11 +824,30 @@ class HybridQueryEngine {
|
|
|
928
824
|
const page = opts.page?.page ?? 1;
|
|
929
825
|
const pageSize = opts.page?.pageSize ?? 20;
|
|
930
826
|
const sqlDebugEnabled = this.isSqlDebugEnabled();
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
const
|
|
934
|
-
|
|
935
|
-
|
|
827
|
+
let total;
|
|
828
|
+
if (canOptimizeCount) {
|
|
829
|
+
const optimizedRoot = db.selectFrom(`${baseTable} as b`);
|
|
830
|
+
let countCore = applyBaseScope(optimizedRoot);
|
|
831
|
+
countCore = applyRegularBaseFilters(countCore);
|
|
832
|
+
countCore = applyOrGroupedBaseFilters(countCore);
|
|
833
|
+
countCore = await applyJoinFilters({
|
|
834
|
+
db,
|
|
835
|
+
baseTable,
|
|
836
|
+
builder: countCore,
|
|
837
|
+
joinMap,
|
|
838
|
+
joinFilters,
|
|
839
|
+
aliasTables,
|
|
840
|
+
qualifyBase: (column) => qualify(column),
|
|
841
|
+
applyAliasScope: async (target, alias) => applyAliasScopes(target, alias),
|
|
842
|
+
applyFilterOp: (target, column, op, value) => applyJoinFilterOpFn(target, column, op, value),
|
|
843
|
+
applyJoinFilterOp: async (target, filter, qualified, join) => {
|
|
844
|
+
const applied = await applyJoinSearchFilterOp(target, filter, qualified, join);
|
|
845
|
+
return { applied, builder: target };
|
|
846
|
+
},
|
|
847
|
+
columnExists: (tbl, column) => this.columnExists(tbl, column)
|
|
848
|
+
});
|
|
849
|
+
const sub = countCore.select(sql.ref(qualify("id")).as("id")).groupBy(qualify("id")).as("sq");
|
|
850
|
+
const countQuery = db.selectFrom(sub).select(sql`count(*)`.as("count"));
|
|
936
851
|
if (debugEnabled && sqlDebugEnabled) {
|
|
937
852
|
const compiled = countQuery.compile();
|
|
938
853
|
this.debug("query:sql:count", { entity, sql: compiled.sql, bindings: compiled.parameters });
|
|
@@ -941,18 +856,26 @@ class HybridQueryEngine {
|
|
|
941
856
|
"query:sql:count",
|
|
942
857
|
entity,
|
|
943
858
|
() => countQuery.executeTakeFirst(),
|
|
944
|
-
{ optimized:
|
|
859
|
+
{ optimized: true },
|
|
945
860
|
profiler
|
|
946
861
|
);
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
862
|
+
total = this.parseCount(countRow);
|
|
863
|
+
} else {
|
|
864
|
+
const countRoot = db.selectFrom(`${baseTable} as b`);
|
|
865
|
+
const countBuilder = (await applyQueryShape(countRoot)).select(sql`count(distinct ${sql.ref(qualify("id"))})`.as("count"));
|
|
866
|
+
if (debugEnabled && sqlDebugEnabled) {
|
|
867
|
+
const compiled = countBuilder.compile();
|
|
868
|
+
this.debug("query:sql:count", { entity, sql: compiled.sql, bindings: compiled.parameters });
|
|
950
869
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
870
|
+
const countRow = await this.captureSqlTiming(
|
|
871
|
+
"query:sql:count",
|
|
872
|
+
entity,
|
|
873
|
+
() => countBuilder.executeTakeFirst(),
|
|
874
|
+
{ optimized: false },
|
|
875
|
+
profiler
|
|
876
|
+
);
|
|
877
|
+
total = this.parseCount(countRow);
|
|
878
|
+
}
|
|
956
879
|
const dekKeyCache = /* @__PURE__ */ new Map();
|
|
957
880
|
const decryptRow = async (item) => {
|
|
958
881
|
let next = item;
|
|
@@ -999,25 +922,23 @@ class HybridQueryEngine {
|
|
|
999
922
|
const sortFieldNames = Array.from(/* @__PURE__ */ new Set(["id", ...scopeFieldNames, ...resolvedSorts.map((s) => String(s.field))]));
|
|
1000
923
|
phase1 = applySelection(phase1, sortFieldNames);
|
|
1001
924
|
if (cap !== null) {
|
|
1002
|
-
phase1 = phase1.limit(cap
|
|
925
|
+
phase1 = phase1.limit(cap).orderBy(qualify("id"), "asc");
|
|
1003
926
|
}
|
|
1004
927
|
if (debugEnabled && sqlDebugEnabled) {
|
|
1005
928
|
const compiled = phase1.compile();
|
|
1006
929
|
this.debug("query:sql:data:phase1", { entity, sql: compiled.sql, bindings: compiled.parameters });
|
|
1007
930
|
}
|
|
1008
|
-
const
|
|
931
|
+
const candidateRows = await this.captureSqlTiming(
|
|
1009
932
|
"query:sql:data:phase1",
|
|
1010
933
|
entity,
|
|
1011
934
|
() => phase1.execute(),
|
|
1012
935
|
{ phase: 1 },
|
|
1013
936
|
profiler
|
|
1014
937
|
);
|
|
1015
|
-
const sortTruncated = cap !== null && candidateRowsRaw.length > cap;
|
|
1016
|
-
const candidateRows = sortTruncated && cap !== null ? candidateRowsRaw.slice(0, cap) : candidateRowsRaw;
|
|
1017
938
|
const decryptedCandidates = await mapWithConcurrency(candidateRows, DECRYPT_CONCURRENCY, decryptRow);
|
|
1018
939
|
const orderedCandidates = sortRowsInMemory(decryptedCandidates, resolvedSorts);
|
|
1019
940
|
const pageIds = orderedCandidates.slice((page - 1) * pageSize, page * pageSize).map((row) => row.id);
|
|
1020
|
-
if (
|
|
941
|
+
if (cap !== null && total > cap) {
|
|
1021
942
|
encryptedSortRowCapWarning = {
|
|
1022
943
|
entity,
|
|
1023
944
|
sortFields: resolvedSorts.map((s) => String(s.field)),
|
|
@@ -1069,11 +990,10 @@ class HybridQueryEngine {
|
|
|
1069
990
|
if (debugEnabled) this.debug("query:complete", { entity, total, items: items.length });
|
|
1070
991
|
const typedItems = items;
|
|
1071
992
|
let result = { items: typedItems, page, pageSize, total };
|
|
1072
|
-
if (partialIndexWarning || encryptedSortRowCapWarning
|
|
993
|
+
if (partialIndexWarning || encryptedSortRowCapWarning) {
|
|
1073
994
|
const meta = {};
|
|
1074
995
|
if (partialIndexWarning) meta.partialIndexWarning = partialIndexWarning;
|
|
1075
996
|
if (encryptedSortRowCapWarning) meta.encryptedSortRowCapWarning = encryptedSortRowCapWarning;
|
|
1076
|
-
if (listCountCapWarning) meta.listCountCapWarning = listCountCapWarning;
|
|
1077
997
|
result.meta = meta;
|
|
1078
998
|
}
|
|
1079
999
|
result = await applyAfterExtensions(result);
|
|
@@ -1499,7 +1419,7 @@ class HybridQueryEngine {
|
|
|
1499
1419
|
if (!baseField) {
|
|
1500
1420
|
return this.buildIndexDocFilterExpression(eb, "ei", entity, fieldName, filter.op, filter.value, "b.id", searchRuntime);
|
|
1501
1421
|
}
|
|
1502
|
-
if ((filter.op === "like" || filter.op === "ilike") && searchRuntime?.enabled && typeof filter.value === "string"
|
|
1422
|
+
if ((filter.op === "like" || filter.op === "ilike") && searchRuntime?.enabled && typeof filter.value === "string") {
|
|
1503
1423
|
const tokens = tokenizeText(String(filter.value), searchRuntime.config);
|
|
1504
1424
|
if (tokens.hashes.length) {
|
|
1505
1425
|
const sources = (searchRuntime.searchSources && searchRuntime.searchSources.length ? searchRuntime.searchSources : [{ entity: String(entity), recordIdColumn: "b.id" }]).filter((src) => src.recordIdColumn && src.entity);
|
|
@@ -1519,7 +1439,7 @@ class HybridQueryEngine {
|
|
|
1519
1439
|
);
|
|
1520
1440
|
}
|
|
1521
1441
|
}
|
|
1522
|
-
return
|
|
1442
|
+
return sql`true`;
|
|
1523
1443
|
}
|
|
1524
1444
|
return this.buildColumnFilterExpression(eb, qualify(baseField), filter.op, filter.value);
|
|
1525
1445
|
}
|
|
@@ -1695,26 +1615,16 @@ class HybridQueryEngine {
|
|
|
1695
1615
|
};
|
|
1696
1616
|
const page = opts.page?.page ?? 1;
|
|
1697
1617
|
const pageSize = opts.page?.pageSize ?? 20;
|
|
1698
|
-
const countCap = resolveListCountCap();
|
|
1699
1618
|
const root = db.selectFrom(`custom_entities_storage as ${alias}`);
|
|
1700
|
-
const
|
|
1701
|
-
const countQuery = countCap !== null ? db.selectFrom(countShape.select(sql`1`.as("one")).limit(countCap + 1).as("om_count_probe")).select(sql`count(*)`.as("count")) : countShape.select(sql`count(*)`.as("count"));
|
|
1619
|
+
const countQuery = applyScope(root).select(sql`count(distinct ${sql.ref(`${alias}.entity_id`)})`.as("count"));
|
|
1702
1620
|
const countRow = await countQuery.executeTakeFirst();
|
|
1703
|
-
const
|
|
1704
|
-
let total = probed;
|
|
1705
|
-
let listCountCapWarning;
|
|
1706
|
-
if (countCap !== null && probed > countCap) {
|
|
1707
|
-
total = countCap;
|
|
1708
|
-
listCountCapWarning = { entity, cap: countCap };
|
|
1709
|
-
}
|
|
1621
|
+
const total = this.parseCount(countRow);
|
|
1710
1622
|
let dataQuery = applyScope(db.selectFrom(`custom_entities_storage as ${alias}`));
|
|
1711
1623
|
dataQuery = applySelection(dataQuery);
|
|
1712
1624
|
dataQuery = applySort(dataQuery);
|
|
1713
1625
|
dataQuery = dataQuery.limit(pageSize).offset((page - 1) * pageSize);
|
|
1714
1626
|
const items = await dataQuery.execute();
|
|
1715
|
-
|
|
1716
|
-
if (listCountCapWarning) result.meta = { listCountCapWarning };
|
|
1717
|
-
return result;
|
|
1627
|
+
return { items, page, pageSize, total };
|
|
1718
1628
|
}
|
|
1719
1629
|
async tableExists(table) {
|
|
1720
1630
|
const db = this.getDb();
|
|
@@ -2069,10 +1979,7 @@ class HybridQueryEngine {
|
|
|
2069
1979
|
logger.debug("Search debug event", { event, payload });
|
|
2070
1980
|
}
|
|
2071
1981
|
applyColumnFilter(q, column, filter, search) {
|
|
2072
|
-
if ((filter.op === "like" || filter.op === "ilike") && search?.enabled && typeof filter.value === "string"
|
|
2073
|
-
// Membership runs across name-shape candidates: maps may declare `displayName` while the
|
|
2074
|
-
// filter carries the column name `display_name`.
|
|
2075
|
-
(search.encryptedFields == null || isEncryptedLikeField(search.encryptedFields, search.field))) {
|
|
1982
|
+
if ((filter.op === "like" || filter.op === "ilike") && search?.enabled && typeof filter.value === "string") {
|
|
2076
1983
|
const tokens = tokenizeText(String(filter.value), search.config);
|
|
2077
1984
|
const hashes = tokens.hashes;
|
|
2078
1985
|
if (hashes.length) {
|
|
@@ -2102,18 +2009,12 @@ class HybridQueryEngine {
|
|
|
2102
2009
|
});
|
|
2103
2010
|
return q;
|
|
2104
2011
|
}
|
|
2105
|
-
if (search.encryptedFields != null && isEncryptedLikeField(search.encryptedFields, search.field)) {
|
|
2106
|
-
return q.where(sql`false`);
|
|
2107
|
-
}
|
|
2108
2012
|
} else {
|
|
2109
2013
|
this.logSearchDebug("search:skip-empty-hashes", {
|
|
2110
2014
|
entity: search.entity,
|
|
2111
2015
|
field: search.field,
|
|
2112
2016
|
value: filter.value
|
|
2113
2017
|
});
|
|
2114
|
-
if (search.encryptedFields != null && isEncryptedLikeField(search.encryptedFields, search.field)) {
|
|
2115
|
-
return q.where(sql`false`);
|
|
2116
|
-
}
|
|
2117
2018
|
}
|
|
2118
2019
|
return q;
|
|
2119
2020
|
}
|