@open-mercato/core 0.5.1-develop.2691.d8a0934b37 → 0.5.1-develop.2694.732417c5ec
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/api_keys/data/entities.js +1 -1
- package/dist/modules/api_keys/data/entities.js.map +1 -1
- package/dist/modules/api_keys/services/apiKeyService.js +5 -5
- package/dist/modules/api_keys/services/apiKeyService.js.map +2 -2
- package/dist/modules/attachments/api/library/[id]/route.js +1 -1
- package/dist/modules/attachments/api/library/[id]/route.js.map +2 -2
- package/dist/modules/attachments/api/library/route.js +7 -9
- package/dist/modules/attachments/api/library/route.js.map +2 -2
- package/dist/modules/attachments/api/partitions/route.js +3 -3
- package/dist/modules/attachments/api/partitions/route.js.map +2 -2
- package/dist/modules/attachments/api/route.js +6 -5
- package/dist/modules/attachments/api/route.js.map +2 -2
- package/dist/modules/attachments/api/transfer/route.js +1 -1
- package/dist/modules/attachments/api/transfer/route.js.map +2 -2
- package/dist/modules/attachments/data/entities.js +2 -1
- package/dist/modules/attachments/data/entities.js.map +2 -2
- package/dist/modules/attachments/lib/ocrQueue.js +1 -1
- package/dist/modules/attachments/lib/ocrQueue.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/export/route.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/route.js.map +2 -2
- package/dist/modules/audit_logs/data/entities.js +1 -1
- package/dist/modules/audit_logs/data/entities.js.map +1 -1
- package/dist/modules/audit_logs/services/actionLogService.js +77 -70
- package/dist/modules/audit_logs/services/actionLogService.js.map +2 -2
- package/dist/modules/auth/api/roles/acl/route.js +1 -1
- package/dist/modules/auth/api/roles/acl/route.js.map +2 -2
- package/dist/modules/auth/api/users/acl/route.js +2 -2
- package/dist/modules/auth/api/users/acl/route.js.map +2 -2
- package/dist/modules/auth/api/users/resend-invite/route.js +1 -1
- package/dist/modules/auth/api/users/resend-invite/route.js.map +2 -2
- package/dist/modules/auth/cli.js +12 -6
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/commands/users.js +1 -1
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/data/entities.js +1 -1
- package/dist/modules/auth/data/entities.js.map +2 -2
- package/dist/modules/auth/lib/setup-app.js +3 -3
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/auth/services/authService.js +2 -2
- package/dist/modules/auth/services/authService.js.map +2 -2
- package/dist/modules/business_rules/api/rules/route.js +3 -3
- package/dist/modules/business_rules/api/rules/route.js.map +2 -2
- package/dist/modules/business_rules/api/sets/[id]/members/route.js +7 -4
- package/dist/modules/business_rules/api/sets/[id]/members/route.js.map +2 -2
- package/dist/modules/business_rules/api/sets/route.js +3 -3
- package/dist/modules/business_rules/api/sets/route.js.map +2 -2
- package/dist/modules/business_rules/cli.js +1 -1
- package/dist/modules/business_rules/cli.js.map +2 -2
- package/dist/modules/business_rules/data/entities.js +2 -9
- package/dist/modules/business_rules/data/entities.js.map +2 -2
- package/dist/modules/business_rules/lib/rule-engine.js +1 -1
- package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
- package/dist/modules/catalog/api/option-schemas/route.js +0 -1
- package/dist/modules/catalog/api/option-schemas/route.js.map +2 -2
- package/dist/modules/catalog/data/entities.js +2 -11
- package/dist/modules/catalog/data/entities.js.map +2 -2
- package/dist/modules/configs/data/entities.js +2 -1
- package/dist/modules/configs/data/entities.js.map +2 -2
- package/dist/modules/currencies/commands/fetch-configs.js +3 -3
- package/dist/modules/currencies/commands/fetch-configs.js.map +2 -2
- package/dist/modules/currencies/data/entities.js +1 -1
- package/dist/modules/currencies/data/entities.js.map +2 -2
- package/dist/modules/customer_accounts/api/signup.js +1 -1
- package/dist/modules/customer_accounts/api/signup.js.map +2 -2
- package/dist/modules/customer_accounts/data/entities.js +1 -1
- package/dist/modules/customer_accounts/data/entities.js.map +2 -2
- package/dist/modules/customer_accounts/services/customerInvitationService.js +1 -1
- package/dist/modules/customer_accounts/services/customerInvitationService.js.map +2 -2
- package/dist/modules/customer_accounts/services/customerSessionService.js +1 -1
- package/dist/modules/customer_accounts/services/customerSessionService.js.map +2 -2
- package/dist/modules/customer_accounts/services/customerTokenService.js +12 -7
- package/dist/modules/customer_accounts/services/customerTokenService.js.map +2 -2
- package/dist/modules/customers/api/interactions/conflicts/route.js +19 -17
- package/dist/modules/customers/api/interactions/conflicts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/counts/route.js +7 -6
- package/dist/modules/customers/api/interactions/counts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/route.js +28 -42
- package/dist/modules/customers/api/interactions/route.js.map +2 -2
- package/dist/modules/customers/api/utils.js +29 -24
- package/dist/modules/customers/api/utils.js.map +2 -2
- package/dist/modules/customers/cli.js +45 -40
- package/dist/modules/customers/cli.js.map +2 -2
- package/dist/modules/customers/commands/dictionaries.js +1 -1
- package/dist/modules/customers/commands/dictionaries.js.map +2 -2
- package/dist/modules/customers/commands/tags.js +1 -1
- package/dist/modules/customers/commands/tags.js.map +2 -2
- package/dist/modules/customers/data/entities.js +2 -12
- package/dist/modules/customers/data/entities.js.map +2 -2
- package/dist/modules/customers/lib/interactionProjection.js +18 -15
- package/dist/modules/customers/lib/interactionProjection.js.map +2 -2
- package/dist/modules/customers/lib/personCompanyLinkTable.js +6 -8
- package/dist/modules/customers/lib/personCompanyLinkTable.js.map +2 -2
- package/dist/modules/dashboards/api/roles/widgets/route.js +1 -1
- package/dist/modules/dashboards/api/roles/widgets/route.js.map +2 -2
- package/dist/modules/dashboards/api/users/widgets/route.js +1 -1
- package/dist/modules/dashboards/api/users/widgets/route.js.map +2 -2
- package/dist/modules/dashboards/data/entities.js +1 -1
- package/dist/modules/dashboards/data/entities.js.map +1 -1
- package/dist/modules/data_sync/api/mappings/route.js +1 -1
- package/dist/modules/data_sync/api/mappings/route.js.map +2 -2
- package/dist/modules/data_sync/data/entities.js +2 -1
- package/dist/modules/data_sync/data/entities.js.map +2 -2
- package/dist/modules/data_sync/lib/id-mapping.js +1 -1
- package/dist/modules/data_sync/lib/id-mapping.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-run-service.js +1 -1
- package/dist/modules/data_sync/lib/sync-run-service.js.map +2 -2
- package/dist/modules/dictionaries/commands/factory.js +1 -1
- package/dist/modules/dictionaries/commands/factory.js.map +2 -2
- package/dist/modules/dictionaries/data/entities.js +2 -9
- package/dist/modules/dictionaries/data/entities.js.map +2 -2
- package/dist/modules/directory/commands/organizations.js +4 -4
- package/dist/modules/directory/commands/organizations.js.map +2 -2
- package/dist/modules/directory/data/entities.js +2 -1
- package/dist/modules/directory/data/entities.js.map +2 -2
- package/dist/modules/entities/api/definitions.js +2 -2
- package/dist/modules/entities/api/definitions.js.map +2 -2
- package/dist/modules/entities/api/encryption.js +2 -2
- package/dist/modules/entities/api/encryption.js.map +2 -2
- package/dist/modules/entities/api/relations/options.js +2 -2
- package/dist/modules/entities/api/relations/options.js.map +2 -2
- package/dist/modules/entities/cli.js +4 -4
- package/dist/modules/entities/cli.js.map +2 -2
- package/dist/modules/entities/data/entities.js +1 -1
- package/dist/modules/entities/data/entities.js.map +2 -2
- package/dist/modules/entities/lib/field-definitions.js +2 -2
- package/dist/modules/entities/lib/field-definitions.js.map +2 -2
- package/dist/modules/entities/lib/register.js +1 -1
- package/dist/modules/entities/lib/register.js.map +2 -2
- package/dist/modules/feature_toggles/data/entities.js +2 -9
- package/dist/modules/feature_toggles/data/entities.js.map +2 -2
- package/dist/modules/inbox_ops/api/proposals/counts/route.js +3 -6
- package/dist/modules/inbox_ops/api/proposals/counts/route.js.map +2 -2
- package/dist/modules/inbox_ops/data/entities.js +2 -8
- package/dist/modules/inbox_ops/data/entities.js.map +2 -2
- package/dist/modules/inbox_ops/lib/messagesIntegration.js +6 -6
- package/dist/modules/inbox_ops/lib/messagesIntegration.js.map +2 -2
- package/dist/modules/integrations/data/entities.js +2 -1
- package/dist/modules/integrations/data/entities.js.map +2 -2
- package/dist/modules/integrations/lib/credentials-service.js +1 -1
- package/dist/modules/integrations/lib/credentials-service.js.map +2 -2
- package/dist/modules/integrations/lib/log-service.js +1 -1
- package/dist/modules/integrations/lib/log-service.js.map +2 -2
- package/dist/modules/integrations/lib/state-service.js +1 -1
- package/dist/modules/integrations/lib/state-service.js.map +2 -2
- package/dist/modules/messages/api/route.js +90 -93
- package/dist/modules/messages/api/route.js.map +2 -2
- package/dist/modules/messages/api/unread-count/route.js +8 -7
- package/dist/modules/messages/api/unread-count/route.js.map +2 -2
- package/dist/modules/messages/commands/confirmations.js +1 -1
- package/dist/modules/messages/commands/confirmations.js.map +2 -2
- package/dist/modules/messages/commands/messages.js +3 -3
- package/dist/modules/messages/commands/messages.js.map +2 -2
- package/dist/modules/messages/data/entities.js +2 -1
- package/dist/modules/messages/data/entities.js.map +2 -2
- package/dist/modules/messages/lib/email-sender.js +1 -1
- package/dist/modules/messages/lib/email-sender.js.map +2 -2
- package/dist/modules/messages/lib/searchLookup.js +8 -8
- package/dist/modules/messages/lib/searchLookup.js.map +2 -2
- package/dist/modules/messages/lib/tokenConsumption.js +9 -4
- package/dist/modules/messages/lib/tokenConsumption.js.map +2 -2
- package/dist/modules/notifications/data/entities.js +2 -1
- package/dist/modules/notifications/data/entities.js.map +2 -2
- package/dist/modules/notifications/lib/notificationRecipients.js +15 -5
- package/dist/modules/notifications/lib/notificationRecipients.js.map +2 -2
- package/dist/modules/notifications/lib/notificationService.js +39 -34
- package/dist/modules/notifications/lib/notificationService.js.map +2 -2
- package/dist/modules/notifications/workers/create-notification.worker.js +14 -13
- package/dist/modules/notifications/workers/create-notification.worker.js.map +2 -2
- package/dist/modules/payment_gateways/api/transactions/route.js +2 -2
- package/dist/modules/payment_gateways/api/transactions/route.js.map +2 -2
- package/dist/modules/payment_gateways/data/entities.js +2 -1
- package/dist/modules/payment_gateways/data/entities.js.map +2 -2
- package/dist/modules/payment_gateways/lib/gateway-service.js +1 -1
- package/dist/modules/payment_gateways/lib/gateway-service.js.map +2 -2
- package/dist/modules/payment_gateways/lib/webhook-utils.js +2 -2
- package/dist/modules/payment_gateways/lib/webhook-utils.js.map +2 -2
- package/dist/modules/perspectives/data/entities.js +1 -1
- package/dist/modules/perspectives/data/entities.js.map +2 -2
- package/dist/modules/planner/data/entities.js +1 -1
- package/dist/modules/planner/data/entities.js.map +2 -2
- package/dist/modules/progress/data/entities.js +2 -1
- package/dist/modules/progress/data/entities.js.map +2 -2
- package/dist/modules/progress/lib/progressServiceImpl.js +1 -1
- package/dist/modules/progress/lib/progressServiceImpl.js.map +2 -2
- package/dist/modules/query_index/api/status.js +66 -57
- package/dist/modules/query_index/api/status.js.map +2 -2
- package/dist/modules/query_index/cli.js +39 -24
- package/dist/modules/query_index/cli.js.map +2 -2
- package/dist/modules/query_index/data/entities.js +1 -1
- package/dist/modules/query_index/data/entities.js.map +2 -2
- package/dist/modules/query_index/di.js +25 -13
- package/dist/modules/query_index/di.js.map +2 -2
- package/dist/modules/query_index/lib/batch.js +31 -33
- package/dist/modules/query_index/lib/batch.js.map +2 -2
- package/dist/modules/query_index/lib/coverage.js +63 -50
- package/dist/modules/query_index/lib/coverage.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +592 -588
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/lib/indexer.js +74 -47
- package/dist/modules/query_index/lib/indexer.js.map +2 -2
- package/dist/modules/query_index/lib/jobs.js +37 -24
- package/dist/modules/query_index/lib/jobs.js.map +2 -2
- package/dist/modules/query_index/lib/purge.js +19 -11
- package/dist/modules/query_index/lib/purge.js.map +2 -2
- package/dist/modules/query_index/lib/reindexer.js +47 -44
- package/dist/modules/query_index/lib/reindexer.js.map +2 -2
- package/dist/modules/query_index/lib/search-tokens.js +47 -25
- package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
- package/dist/modules/query_index/lib/stale.js +14 -12
- package/dist/modules/query_index/lib/stale.js.map +2 -2
- package/dist/modules/query_index/lib/subscriber-scope.js +2 -2
- package/dist/modules/query_index/lib/subscriber-scope.js.map +2 -2
- package/dist/modules/query_index/subscribers/delete_one.js +3 -2
- package/dist/modules/query_index/subscribers/delete_one.js.map +2 -2
- package/dist/modules/resources/commands/tag-assignments.js +1 -1
- package/dist/modules/resources/commands/tag-assignments.js.map +2 -2
- package/dist/modules/resources/commands/tags.js +1 -1
- package/dist/modules/resources/commands/tags.js.map +2 -2
- package/dist/modules/resources/data/entities.js +2 -1
- package/dist/modules/resources/data/entities.js.map +2 -2
- package/dist/modules/sales/commands/documentAddresses.js +2 -2
- package/dist/modules/sales/commands/documentAddresses.js.map +2 -2
- package/dist/modules/sales/commands/notes.js.map +2 -2
- package/dist/modules/sales/commands/tags.js +1 -1
- package/dist/modules/sales/commands/tags.js.map +2 -2
- package/dist/modules/sales/data/enrichers.js +9 -8
- package/dist/modules/sales/data/enrichers.js.map +2 -2
- package/dist/modules/sales/data/entities.js +2 -11
- package/dist/modules/sales/data/entities.js.map +2 -2
- package/dist/modules/shipping_carriers/data/entities.js +2 -1
- package/dist/modules/shipping_carriers/data/entities.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/shipping-service.js +1 -1
- package/dist/modules/shipping_carriers/lib/shipping-service.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/webhook-utils.js +2 -2
- package/dist/modules/shipping_carriers/lib/webhook-utils.js.map +2 -2
- package/dist/modules/staff/data/entities.js +1 -1
- package/dist/modules/staff/data/entities.js.map +2 -2
- package/dist/modules/translations/api/[entityType]/[entityId]/route.js +3 -5
- package/dist/modules/translations/api/[entityType]/[entityId]/route.js.map +2 -2
- package/dist/modules/translations/api/context.js +2 -2
- package/dist/modules/translations/api/context.js.map +2 -2
- package/dist/modules/translations/commands/translations.js +46 -39
- package/dist/modules/translations/commands/translations.js.map +2 -2
- package/dist/modules/translations/components/TranslationManager.js +19 -10
- package/dist/modules/translations/components/TranslationManager.js.map +2 -2
- package/dist/modules/translations/data/entities.js +1 -1
- package/dist/modules/translations/data/entities.js.map +2 -2
- package/dist/modules/translations/lib/apply.js +4 -4
- package/dist/modules/translations/lib/apply.js.map +2 -2
- package/dist/modules/translations/lib/batch.js +3 -2
- package/dist/modules/translations/lib/batch.js.map +2 -2
- package/dist/modules/translations/subscribers/cleanup.js +3 -5
- package/dist/modules/translations/subscribers/cleanup.js.map +2 -2
- package/dist/modules/workflows/api/definitions/route.js +1 -1
- package/dist/modules/workflows/api/definitions/route.js.map +2 -2
- package/dist/modules/workflows/cli.js +5 -5
- package/dist/modules/workflows/cli.js.map +2 -2
- package/dist/modules/workflows/data/entities.js +2 -1
- package/dist/modules/workflows/data/entities.js.map +2 -2
- package/dist/modules/workflows/lib/event-logger.js +2 -2
- package/dist/modules/workflows/lib/event-logger.js.map +2 -2
- package/dist/modules/workflows/lib/seeds.js +16 -1
- package/dist/modules/workflows/lib/seeds.js.map +2 -2
- package/dist/modules/workflows/lib/step-handler.js +3 -3
- package/dist/modules/workflows/lib/step-handler.js.map +2 -2
- package/dist/modules/workflows/lib/task-handler.js +1 -1
- package/dist/modules/workflows/lib/task-handler.js.map +2 -2
- package/dist/modules/workflows/lib/transition-handler.js +1 -1
- package/dist/modules/workflows/lib/transition-handler.js.map +2 -2
- package/dist/modules/workflows/lib/workflow-executor.js +2 -2
- package/dist/modules/workflows/lib/workflow-executor.js.map +2 -2
- package/jest.config.cjs +4 -2
- package/package.json +3 -3
- package/src/modules/api_keys/data/entities.ts +1 -1
- package/src/modules/api_keys/services/apiKeyService.ts +5 -5
- package/src/modules/attachments/api/library/[id]/route.ts +1 -1
- package/src/modules/attachments/api/library/route.ts +10 -12
- package/src/modules/attachments/api/partitions/route.ts +3 -3
- package/src/modules/attachments/api/route.ts +10 -8
- package/src/modules/attachments/api/transfer/route.ts +1 -1
- package/src/modules/attachments/data/entities.ts +2 -1
- package/src/modules/attachments/lib/ocrQueue.ts +1 -1
- package/src/modules/audit_logs/api/audit-logs/actions/export/route.ts +4 -4
- package/src/modules/audit_logs/api/audit-logs/actions/route.ts +4 -4
- package/src/modules/audit_logs/data/entities.ts +1 -1
- package/src/modules/audit_logs/services/actionLogService.ts +96 -87
- package/src/modules/auth/api/roles/acl/route.ts +1 -1
- package/src/modules/auth/api/users/acl/route.ts +2 -2
- package/src/modules/auth/api/users/resend-invite/route.ts +1 -1
- package/src/modules/auth/cli.ts +46 -40
- package/src/modules/auth/commands/users.ts +1 -1
- package/src/modules/auth/data/entities.ts +1 -1
- package/src/modules/auth/lib/setup-app.ts +3 -3
- package/src/modules/auth/services/authService.ts +2 -2
- package/src/modules/business_rules/api/rules/route.ts +3 -3
- package/src/modules/business_rules/api/sets/[id]/members/route.ts +7 -4
- package/src/modules/business_rules/api/sets/route.ts +3 -3
- package/src/modules/business_rules/cli.ts +1 -1
- package/src/modules/business_rules/data/entities.ts +2 -9
- package/src/modules/business_rules/lib/rule-engine.ts +1 -1
- package/src/modules/catalog/api/option-schemas/route.ts +0 -1
- package/src/modules/catalog/data/entities.ts +2 -11
- package/src/modules/configs/data/entities.ts +2 -1
- package/src/modules/currencies/commands/fetch-configs.ts +3 -3
- package/src/modules/currencies/data/entities.ts +1 -1
- package/src/modules/customer_accounts/api/signup.ts +1 -1
- package/src/modules/customer_accounts/data/entities.ts +1 -1
- package/src/modules/customer_accounts/services/customerInvitationService.ts +1 -1
- package/src/modules/customer_accounts/services/customerSessionService.ts +1 -1
- package/src/modules/customer_accounts/services/customerTokenService.ts +26 -15
- package/src/modules/customers/api/interactions/conflicts/route.ts +26 -23
- package/src/modules/customers/api/interactions/counts/route.ts +13 -11
- package/src/modules/customers/api/interactions/route.ts +32 -44
- package/src/modules/customers/api/utils.ts +45 -37
- package/src/modules/customers/cli.ts +88 -67
- package/src/modules/customers/commands/dictionaries.ts +1 -1
- package/src/modules/customers/commands/tags.ts +1 -1
- package/src/modules/customers/data/entities.ts +2 -12
- package/src/modules/customers/lib/interactionProjection.ts +36 -25
- package/src/modules/customers/lib/personCompanyLinkTable.ts +13 -18
- package/src/modules/dashboards/api/roles/widgets/route.ts +1 -1
- package/src/modules/dashboards/api/users/widgets/route.ts +1 -1
- package/src/modules/dashboards/data/entities.ts +1 -1
- package/src/modules/data_sync/api/mappings/route.ts +1 -1
- package/src/modules/data_sync/data/entities.ts +2 -1
- package/src/modules/data_sync/lib/id-mapping.ts +1 -1
- package/src/modules/data_sync/lib/sync-run-service.ts +1 -1
- package/src/modules/dictionaries/commands/factory.ts +1 -1
- package/src/modules/dictionaries/data/entities.ts +2 -9
- package/src/modules/directory/commands/organizations.ts +4 -4
- package/src/modules/directory/data/entities.ts +2 -1
- package/src/modules/entities/api/definitions.ts +2 -2
- package/src/modules/entities/api/encryption.ts +2 -2
- package/src/modules/entities/api/relations/options.ts +8 -3
- package/src/modules/entities/cli.ts +4 -4
- package/src/modules/entities/data/entities.ts +1 -1
- package/src/modules/entities/lib/field-definitions.ts +2 -2
- package/src/modules/entities/lib/register.ts +1 -1
- package/src/modules/feature_toggles/data/entities.ts +2 -9
- package/src/modules/inbox_ops/api/proposals/counts/route.ts +10 -10
- package/src/modules/inbox_ops/data/entities.ts +2 -8
- package/src/modules/inbox_ops/lib/messagesIntegration.ts +12 -11
- package/src/modules/integrations/data/entities.ts +2 -1
- package/src/modules/integrations/lib/credentials-service.ts +1 -1
- package/src/modules/integrations/lib/log-service.ts +1 -1
- package/src/modules/integrations/lib/state-service.ts +1 -1
- package/src/modules/messages/api/route.ts +134 -123
- package/src/modules/messages/api/unread-count/route.ts +19 -16
- package/src/modules/messages/commands/confirmations.ts +1 -1
- package/src/modules/messages/commands/messages.ts +3 -3
- package/src/modules/messages/data/entities.ts +2 -1
- package/src/modules/messages/lib/email-sender.ts +1 -1
- package/src/modules/messages/lib/searchLookup.ts +16 -13
- package/src/modules/messages/lib/tokenConsumption.ts +16 -8
- package/src/modules/notifications/data/entities.ts +2 -1
- package/src/modules/notifications/lib/notificationRecipients.ts +42 -26
- package/src/modules/notifications/lib/notificationService.ts +53 -42
- package/src/modules/notifications/workers/create-notification.worker.ts +20 -17
- package/src/modules/payment_gateways/api/transactions/route.ts +2 -2
- package/src/modules/payment_gateways/data/entities.ts +2 -1
- package/src/modules/payment_gateways/lib/gateway-service.ts +1 -1
- package/src/modules/payment_gateways/lib/webhook-utils.ts +2 -2
- package/src/modules/perspectives/data/entities.ts +1 -1
- package/src/modules/planner/data/entities.ts +1 -1
- package/src/modules/progress/data/entities.ts +2 -1
- package/src/modules/progress/lib/progressServiceImpl.ts +1 -1
- package/src/modules/query_index/api/status.ts +85 -71
- package/src/modules/query_index/cli.ts +51 -31
- package/src/modules/query_index/data/entities.ts +1 -1
- package/src/modules/query_index/di.ts +41 -16
- package/src/modules/query_index/lib/batch.ts +68 -55
- package/src/modules/query_index/lib/coverage.ts +115 -88
- package/src/modules/query_index/lib/engine.ts +1036 -1096
- package/src/modules/query_index/lib/indexer.ts +115 -79
- package/src/modules/query_index/lib/jobs.ts +51 -31
- package/src/modules/query_index/lib/purge.ts +25 -19
- package/src/modules/query_index/lib/reindexer.ts +97 -84
- package/src/modules/query_index/lib/search-tokens.ts +67 -36
- package/src/modules/query_index/lib/stale.ts +14 -17
- package/src/modules/query_index/lib/subscriber-scope.ts +6 -5
- package/src/modules/query_index/subscribers/delete_one.ts +9 -6
- package/src/modules/resources/commands/tag-assignments.ts +1 -1
- package/src/modules/resources/commands/tags.ts +1 -1
- package/src/modules/resources/data/entities.ts +2 -1
- package/src/modules/sales/commands/documentAddresses.ts +2 -2
- package/src/modules/sales/commands/notes.ts +1 -1
- package/src/modules/sales/commands/tags.ts +1 -1
- package/src/modules/sales/data/enrichers.ts +17 -13
- package/src/modules/sales/data/entities.ts +2 -11
- package/src/modules/shipping_carriers/data/entities.ts +2 -1
- package/src/modules/shipping_carriers/lib/shipping-service.ts +1 -1
- package/src/modules/shipping_carriers/lib/webhook-utils.ts +2 -2
- package/src/modules/staff/data/entities.ts +1 -1
- package/src/modules/translations/api/[entityType]/[entityId]/route.ts +14 -11
- package/src/modules/translations/api/context.ts +4 -4
- package/src/modules/translations/commands/translations.ts +116 -81
- package/src/modules/translations/components/TranslationManager.tsx +23 -14
- package/src/modules/translations/data/entities.ts +1 -1
- package/src/modules/translations/i18n/de.json +1 -0
- package/src/modules/translations/i18n/en.json +1 -0
- package/src/modules/translations/i18n/es.json +1 -0
- package/src/modules/translations/i18n/pl.json +1 -0
- package/src/modules/translations/lib/apply.ts +6 -6
- package/src/modules/translations/lib/batch.ts +9 -7
- package/src/modules/translations/subscribers/cleanup.ts +10 -11
- package/src/modules/workflows/api/definitions/route.ts +1 -1
- package/src/modules/workflows/cli.ts +5 -5
- package/src/modules/workflows/data/entities.ts +2 -1
- package/src/modules/workflows/lib/event-logger.ts +2 -2
- package/src/modules/workflows/lib/seeds.ts +16 -1
- package/src/modules/workflows/lib/step-handler.ts +3 -3
- package/src/modules/workflows/lib/task-handler.ts +1 -1
- package/src/modules/workflows/lib/transition-handler.ts +1 -1
- package/src/modules/workflows/lib/workflow-executor.ts +2 -2
|
@@ -104,7 +104,7 @@ export async function POST(req: Request) {
|
|
|
104
104
|
: resolveDefaultAttachmentOcrEnabled(),
|
|
105
105
|
ocrModel: parsed.data.ocrModel?.trim() || null,
|
|
106
106
|
})
|
|
107
|
-
await em.
|
|
107
|
+
await em.persist(entry).flush()
|
|
108
108
|
return NextResponse.json({ item: serializePartition(entry) }, { status: 201 })
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -146,7 +146,7 @@ export async function PUT(req: Request) {
|
|
|
146
146
|
if (parsed.data.ocrModel !== undefined) {
|
|
147
147
|
entry.ocrModel = parsed.data.ocrModel?.trim() || null
|
|
148
148
|
}
|
|
149
|
-
await em.
|
|
149
|
+
await em.persist(entry).flush()
|
|
150
150
|
return NextResponse.json({ item: serializePartition(entry) })
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -179,7 +179,7 @@ export async function DELETE(req: Request) {
|
|
|
179
179
|
if (usage > 0) {
|
|
180
180
|
return NextResponse.json({ error: 'Partition is in use and cannot be removed.' }, { status: 409 })
|
|
181
181
|
}
|
|
182
|
-
await em.
|
|
182
|
+
await em.remove(entry).flush()
|
|
183
183
|
return NextResponse.json({ ok: true })
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -2,6 +2,7 @@ import { NextResponse } from 'next/server'
|
|
|
2
2
|
import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
3
3
|
import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
4
4
|
import { z } from 'zod'
|
|
5
|
+
import { sql } from 'kysely'
|
|
5
6
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
6
7
|
import { buildAttachmentFileUrl, buildAttachmentImageUrl, slugifyAttachmentFileName } from '../lib/imageUrls'
|
|
7
8
|
import { ensureDefaultPartitions, resolveDefaultPartitionCode, sanitizePartitionCode } from '../lib/partitions'
|
|
@@ -429,7 +430,7 @@ export async function POST(req: Request) {
|
|
|
429
430
|
content: extractedContent,
|
|
430
431
|
storageMetadata: metadata,
|
|
431
432
|
})
|
|
432
|
-
await em.
|
|
433
|
+
await em.persist(att).flush()
|
|
433
434
|
|
|
434
435
|
if (useLlmOcr) {
|
|
435
436
|
requestOcrProcessing(em, att, stored.absolutePath).catch((error) => {
|
|
@@ -491,12 +492,13 @@ export async function POST(req: Request) {
|
|
|
491
492
|
|
|
492
493
|
async function readTenantAttachmentUsageBytes(em: EntityManager, tenantId: string): Promise<number> {
|
|
493
494
|
try {
|
|
494
|
-
const
|
|
495
|
-
const row = await
|
|
496
|
-
.
|
|
497
|
-
.sum(
|
|
498
|
-
.
|
|
499
|
-
|
|
495
|
+
const db = em.getKysely<any>() as any
|
|
496
|
+
const row = await db
|
|
497
|
+
.selectFrom('attachments')
|
|
498
|
+
.select(sql<string>`sum(file_size)`.as('total_size'))
|
|
499
|
+
.where('tenant_id', '=', tenantId)
|
|
500
|
+
.executeTakeFirst() as { total_size: string | number | null } | undefined
|
|
501
|
+
const total = row?.total_size
|
|
500
502
|
if (typeof total === 'number') return Number.isFinite(total) ? total : 0
|
|
501
503
|
if (typeof total === 'string') {
|
|
502
504
|
const parsed = Number(total)
|
|
@@ -520,7 +522,7 @@ export async function DELETE(req: Request) {
|
|
|
520
522
|
const deleteFilter: Record<string, unknown> = { id, tenantId: auth.tenantId!, organizationId: auth.orgId }
|
|
521
523
|
const record = await em.findOne(Attachment, deleteFilter)
|
|
522
524
|
if (!record) return NextResponse.json({ error: 'Attachment not found' }, { status: 404 })
|
|
523
|
-
await em.
|
|
525
|
+
await em.remove(record).flush()
|
|
524
526
|
await clearAttachmentThumbnailCache(record.partitionCode, record.id).catch((error) => {
|
|
525
527
|
console.error('[attachments] failed to cleanup cached thumbnails', error)
|
|
526
528
|
})
|
|
@@ -72,7 +72,7 @@ export async function POST(req: Request) {
|
|
|
72
72
|
}) ?? []
|
|
73
73
|
record.storageMetadata = mergeAttachmentMetadata(record.storageMetadata, { assignments: nextAssignments })
|
|
74
74
|
}
|
|
75
|
-
await em.
|
|
75
|
+
await em.persist(records).flush()
|
|
76
76
|
return NextResponse.json({ ok: true, updated: records.length })
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OptionalProps } from '@mikro-orm/core'
|
|
2
|
+
import { Entity, Index, PrimaryKey, Property, Unique } from '@mikro-orm/decorators/legacy'
|
|
2
3
|
import { resolveDefaultAttachmentOcrEnabled } from '../lib/ocrConfig'
|
|
3
4
|
|
|
4
5
|
@Entity({ tableName: 'attachment_partitions' })
|
|
@@ -178,12 +178,12 @@ export async function GET(req: Request) {
|
|
|
178
178
|
const entries = entriesResult.items
|
|
179
179
|
|
|
180
180
|
const displayMaps = await loadAuditLogDisplayMaps(em, {
|
|
181
|
-
userIds: entries.map((entry) => entry.actorUserId).filter((value): value is string => Boolean(value)),
|
|
182
|
-
tenantIds: entries.map((entry) => entry.tenantId).filter((value): value is string => Boolean(value)),
|
|
183
|
-
organizationIds: entries.map((entry) => entry.organizationId).filter((value): value is string => Boolean(value)),
|
|
181
|
+
userIds: entries.map((entry: any) => entry.actorUserId).filter((value: any): value is string => Boolean(value)),
|
|
182
|
+
tenantIds: entries.map((entry: any) => entry.tenantId).filter((value: any): value is string => Boolean(value)),
|
|
183
|
+
organizationIds: entries.map((entry: any) => entry.organizationId).filter((value: any): value is string => Boolean(value)),
|
|
184
184
|
})
|
|
185
185
|
|
|
186
|
-
const rows = entries.flatMap((entry) => {
|
|
186
|
+
const rows = entries.flatMap((entry: any) => {
|
|
187
187
|
const actionType = deriveActionLogActionType(entry)
|
|
188
188
|
const actionLabel = actionType === 'system'
|
|
189
189
|
? entry.actionLabel ?? 'System'
|
|
@@ -229,12 +229,12 @@ export async function GET(req: Request) {
|
|
|
229
229
|
const list = await actionLogs.list(listQuery)
|
|
230
230
|
|
|
231
231
|
const displayMaps = await loadAuditLogDisplayMaps(em, {
|
|
232
|
-
userIds: list.items.map((entry) => entry.actorUserId).filter((value): value is string => !!value),
|
|
233
|
-
tenantIds: list.items.map((entry) => entry.tenantId).filter((value): value is string => !!value),
|
|
234
|
-
organizationIds: list.items.map((entry) => entry.organizationId).filter((value): value is string => !!value),
|
|
232
|
+
userIds: list.items.map((entry: any) => entry.actorUserId).filter((value: any): value is string => !!value),
|
|
233
|
+
tenantIds: list.items.map((entry: any) => entry.tenantId).filter((value: any): value is string => !!value),
|
|
234
|
+
organizationIds: list.items.map((entry: any) => entry.organizationId).filter((value: any): value is string => !!value),
|
|
235
235
|
})
|
|
236
236
|
|
|
237
|
-
const items = list.items.map((entry) => ({
|
|
237
|
+
const items = list.items.map((entry: any) => ({
|
|
238
238
|
id: entry.id,
|
|
239
239
|
commandId: entry.commandId,
|
|
240
240
|
actionLabel: entry.actionLabel,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Entity, Index, PrimaryKey, Property } from '@mikro-orm/
|
|
1
|
+
import { Entity, Index, PrimaryKey, Property } from '@mikro-orm/decorators/legacy'
|
|
2
2
|
import type { ActionLogProjectionType, ActionLogSourceKey } from '@open-mercato/core/modules/audit_logs/lib/projections'
|
|
3
3
|
|
|
4
4
|
export type ActionLogExecutionState = 'done' | 'undone' | 'failed' | 'redone'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FilterQuery } from '@mikro-orm/core'
|
|
2
2
|
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
3
|
+
import { sql } from 'kysely'
|
|
3
4
|
import { ActionLog } from '@open-mercato/core/modules/audit_logs/data/entities'
|
|
4
5
|
import {
|
|
5
6
|
actionLogCreateSchema,
|
|
@@ -184,7 +185,7 @@ export class ActionLogService {
|
|
|
184
185
|
const data = this.parseCreateInput(input)
|
|
185
186
|
const fork = this.em.fork()
|
|
186
187
|
const log = this.createLogEntity(fork, data)
|
|
187
|
-
await fork.
|
|
188
|
+
await fork.persist(log).flush()
|
|
188
189
|
await this.decryptEntries(log)
|
|
189
190
|
return log
|
|
190
191
|
}
|
|
@@ -353,15 +354,15 @@ export class ActionLogService {
|
|
|
353
354
|
}
|
|
354
355
|
|
|
355
356
|
private async loadEntries(parsed: ActionLogListQuery, options?: { paginate?: boolean }) {
|
|
356
|
-
|
|
357
|
+
let query = (this.buildListQuery(parsed) as any).select('action_logs.id as id')
|
|
357
358
|
|
|
358
359
|
if (options?.paginate !== false) {
|
|
359
360
|
const { limit, offset } = this.resolvePagination(parsed)
|
|
360
|
-
query.limit(limit).offset(offset)
|
|
361
|
+
query = query.limit(limit).offset(offset)
|
|
361
362
|
}
|
|
362
363
|
|
|
363
|
-
const rows = await query
|
|
364
|
-
const ids = rows.map((row) => row.id).filter(Boolean)
|
|
364
|
+
const rows = await query.execute()
|
|
365
|
+
const ids = rows.map((row: any) => row.id).filter(Boolean)
|
|
365
366
|
if (ids.length === 0) return []
|
|
366
367
|
|
|
367
368
|
const results = await this.em.find(ActionLog, {
|
|
@@ -370,90 +371,92 @@ export class ActionLogService {
|
|
|
370
371
|
})
|
|
371
372
|
await this.decryptEntries(results)
|
|
372
373
|
|
|
373
|
-
const byId = new Map(results.map((entry) => [entry.id, entry]))
|
|
374
|
+
const byId = new Map(results.map((entry: any) => [entry.id, entry]))
|
|
374
375
|
return ids
|
|
375
|
-
.map((id) => byId.get(id))
|
|
376
|
-
.filter((entry): entry is ActionLog => Boolean(entry))
|
|
376
|
+
.map((id: any) => byId.get(id))
|
|
377
|
+
.filter((entry: any): entry is ActionLog => Boolean(entry))
|
|
377
378
|
}
|
|
378
379
|
|
|
379
|
-
private buildListQuery(parsed: ActionLogListQuery) {
|
|
380
|
-
|
|
380
|
+
private buildListQuery(parsed: ActionLogListQuery): any {
|
|
381
|
+
let query = (this.em.getKysely<any>() as any)
|
|
382
|
+
.selectFrom('action_logs')
|
|
383
|
+
.selectAll()
|
|
384
|
+
.where('action_logs.deleted_at', 'is', null) as any
|
|
381
385
|
|
|
382
|
-
if (parsed.tenantId) query.
|
|
383
|
-
if (parsed.organizationId) query.
|
|
386
|
+
if (parsed.tenantId) query = query.where('action_logs.tenant_id', '=', parsed.tenantId)
|
|
387
|
+
if (parsed.organizationId) query = query.where('action_logs.organization_id', '=', parsed.organizationId)
|
|
384
388
|
|
|
385
389
|
const actorUserIds = this.resolveActorUserIds(parsed)
|
|
386
|
-
if (actorUserIds.length === 1) query.
|
|
387
|
-
if (actorUserIds.length > 1) query.
|
|
390
|
+
if (actorUserIds.length === 1) query = query.where('action_logs.actor_user_id', '=', actorUserIds[0])
|
|
391
|
+
if (actorUserIds.length > 1) query = query.where('action_logs.actor_user_id', 'in', actorUserIds)
|
|
388
392
|
|
|
389
393
|
if (parsed.includeRelated && parsed.resourceKind && parsed.resourceId) {
|
|
390
|
-
query.
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
394
|
+
query = query.where((eb: any) =>
|
|
395
|
+
eb.or([
|
|
396
|
+
eb.and([
|
|
397
|
+
eb('action_logs.resource_kind', '=', parsed.resourceKind),
|
|
398
|
+
eb('action_logs.resource_id', '=', parsed.resourceId),
|
|
399
|
+
]),
|
|
400
|
+
eb.and([
|
|
401
|
+
eb('action_logs.parent_resource_kind', '=', parsed.resourceKind),
|
|
402
|
+
eb('action_logs.parent_resource_id', '=', parsed.resourceId),
|
|
403
|
+
]),
|
|
404
|
+
])
|
|
405
|
+
)
|
|
399
406
|
} else {
|
|
400
|
-
if (parsed.resourceKind) query.
|
|
401
|
-
if (parsed.resourceId) query.
|
|
407
|
+
if (parsed.resourceKind) query = query.where('action_logs.resource_kind', '=', parsed.resourceKind)
|
|
408
|
+
if (parsed.resourceId) query = query.where('action_logs.resource_id', '=', parsed.resourceId)
|
|
402
409
|
}
|
|
403
410
|
|
|
404
|
-
if (parsed.undoableOnly) query.
|
|
405
|
-
if (parsed.before) query.
|
|
406
|
-
if (parsed.after) query.
|
|
411
|
+
if (parsed.undoableOnly) query = query.where('action_logs.undo_token', 'is not', null)
|
|
412
|
+
if (parsed.before) query = query.where('action_logs.created_at', '<', parsed.before)
|
|
413
|
+
if (parsed.after) query = query.where('action_logs.created_at', '>', parsed.after)
|
|
407
414
|
|
|
408
415
|
const fieldNames = this.resolveFieldNames(parsed)
|
|
409
|
-
if (fieldNames.length
|
|
410
|
-
|
|
411
|
-
query.andWhereRaw(
|
|
412
|
-
`coalesce(action_logs.changed_fields, ARRAY[]::text[]) && ARRAY[${placeholders}]::text[]`,
|
|
413
|
-
fieldNames,
|
|
414
|
-
)
|
|
415
|
-
}
|
|
416
|
+
if (fieldNames.length === 1) query = query.where('action_logs.primary_changed_field', '=', fieldNames[0])
|
|
417
|
+
if (fieldNames.length > 1) query = query.where('action_logs.primary_changed_field', 'in', fieldNames)
|
|
416
418
|
|
|
417
419
|
const actionTypes = this.resolveActionTypes(parsed)
|
|
418
|
-
if (actionTypes.length === 1) query.
|
|
419
|
-
if (actionTypes.length > 1) query.
|
|
420
|
+
if (actionTypes.length === 1) query = query.where('action_logs.action_type', '=', actionTypes[0])
|
|
421
|
+
if (actionTypes.length > 1) query = query.where('action_logs.action_type', 'in', actionTypes)
|
|
420
422
|
|
|
421
423
|
if (parsed.sortField === 'user') {
|
|
422
|
-
query.leftJoin('users as audit_actor', 'audit_actor.id', 'action_logs.actor_user_id')
|
|
424
|
+
query = query.leftJoin('users as audit_actor', 'audit_actor.id', 'action_logs.actor_user_id')
|
|
423
425
|
}
|
|
424
426
|
|
|
425
427
|
const sortDir = parsed.sortDir === 'asc' ? 'asc' : 'desc'
|
|
426
428
|
switch (parsed.sortField) {
|
|
427
429
|
case 'user':
|
|
428
|
-
query.
|
|
430
|
+
query = query.orderBy(sql`coalesce(nullif(audit_actor.name, ''), audit_actor.email, '')`, sortDir)
|
|
429
431
|
break
|
|
430
432
|
case 'action':
|
|
431
|
-
query.
|
|
433
|
+
query = query.orderBy(sql`coalesce(action_logs.action_type, '')`, sortDir)
|
|
432
434
|
break
|
|
433
435
|
case 'field':
|
|
434
|
-
query.
|
|
436
|
+
query = query.orderBy(sql`coalesce(action_logs.primary_changed_field, '')`, sortDir)
|
|
435
437
|
break
|
|
436
438
|
case 'source':
|
|
437
|
-
query.
|
|
439
|
+
query = query.orderBy(sql`coalesce(action_logs.source_key, '')`, sortDir)
|
|
438
440
|
break
|
|
439
441
|
case 'createdAt':
|
|
440
442
|
default:
|
|
441
|
-
query.orderBy(SORT_FIELDS.createdAt, sortDir)
|
|
442
|
-
query.orderBy('action_logs.id', sortDir)
|
|
443
|
+
query = query.orderBy(SORT_FIELDS.createdAt, sortDir)
|
|
444
|
+
query = query.orderBy('action_logs.id', sortDir)
|
|
443
445
|
return query
|
|
444
446
|
}
|
|
445
447
|
|
|
446
|
-
query.orderBy('action_logs.created_at', 'desc')
|
|
447
|
-
query.orderBy('action_logs.id', 'desc')
|
|
448
|
+
query = query.orderBy('action_logs.created_at', 'desc')
|
|
449
|
+
query = query.orderBy('action_logs.id', 'desc')
|
|
448
450
|
return query
|
|
449
451
|
}
|
|
450
452
|
|
|
451
453
|
async count(query: Partial<ActionLogListQuery>) {
|
|
452
454
|
const parsed = this.parseListQuery(query)
|
|
453
|
-
const row = await this.buildListQuery(parsed)
|
|
454
|
-
.
|
|
455
|
-
.
|
|
456
|
-
.
|
|
455
|
+
const row = await (this.buildListQuery(parsed) as any)
|
|
456
|
+
.clearSelect()
|
|
457
|
+
.clearOrderBy()
|
|
458
|
+
.select(sql<string>`count(*)`.as('count'))
|
|
459
|
+
.executeTakeFirst()
|
|
457
460
|
|
|
458
461
|
if (!row) return 0
|
|
459
462
|
const rawCount = row.count ?? 0
|
|
@@ -579,45 +582,49 @@ export class ActionLogService {
|
|
|
579
582
|
let cursorId: string | null = null
|
|
580
583
|
|
|
581
584
|
while (true) {
|
|
582
|
-
const rowsQuery = this.em.
|
|
583
|
-
.
|
|
584
|
-
|
|
585
|
-
'
|
|
586
|
-
'
|
|
587
|
-
'
|
|
588
|
-
'
|
|
589
|
-
'
|
|
590
|
-
'
|
|
591
|
-
'
|
|
592
|
-
'
|
|
593
|
-
'
|
|
594
|
-
'
|
|
595
|
-
'
|
|
596
|
-
'
|
|
597
|
-
'
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
if (options.
|
|
585
|
+
const rowsQuery = (this.em.getKysely<any>() as any)
|
|
586
|
+
.selectFrom('action_logs')
|
|
587
|
+
.select([
|
|
588
|
+
'action_logs.id',
|
|
589
|
+
'action_logs.tenant_id',
|
|
590
|
+
'action_logs.organization_id',
|
|
591
|
+
'action_logs.actor_user_id',
|
|
592
|
+
'action_logs.command_id',
|
|
593
|
+
'action_logs.action_label',
|
|
594
|
+
'action_logs.snapshot_before',
|
|
595
|
+
'action_logs.changes_json',
|
|
596
|
+
'action_logs.context_json',
|
|
597
|
+
'action_logs.action_type',
|
|
598
|
+
'action_logs.source_key',
|
|
599
|
+
'action_logs.changed_fields',
|
|
600
|
+
'action_logs.primary_changed_field',
|
|
601
|
+
'action_logs.created_at',
|
|
602
|
+
])
|
|
603
|
+
.where('action_logs.deleted_at', 'is', null) as any
|
|
604
|
+
|
|
605
|
+
if (options.tenantId) rowsQuery.where('action_logs.tenant_id', '=', options.tenantId)
|
|
606
|
+
if (options.organizationId) rowsQuery.where('action_logs.organization_id', '=', options.organizationId)
|
|
603
607
|
|
|
604
608
|
if (!options.force) {
|
|
605
|
-
rowsQuery.
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
609
|
+
rowsQuery.where((eb: any) =>
|
|
610
|
+
eb.or([
|
|
611
|
+
eb('action_logs.action_type', 'is', null),
|
|
612
|
+
eb('action_logs.source_key', 'is', null),
|
|
613
|
+
eb('action_logs.changed_fields', 'is', null),
|
|
614
|
+
])
|
|
615
|
+
)
|
|
611
616
|
}
|
|
612
617
|
|
|
613
618
|
if (cursorCreatedAt && cursorId) {
|
|
614
|
-
rowsQuery.
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
.
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
619
|
+
rowsQuery.where((eb: any) =>
|
|
620
|
+
eb.or([
|
|
621
|
+
eb('action_logs.created_at', '>', cursorCreatedAt),
|
|
622
|
+
eb.and([
|
|
623
|
+
eb('action_logs.created_at', '=', cursorCreatedAt),
|
|
624
|
+
eb('action_logs.id', '>', cursorId),
|
|
625
|
+
]),
|
|
626
|
+
])
|
|
627
|
+
)
|
|
621
628
|
}
|
|
622
629
|
|
|
623
630
|
const rows = await rowsQuery
|
|
@@ -652,14 +659,16 @@ export class ActionLogService {
|
|
|
652
659
|
continue
|
|
653
660
|
}
|
|
654
661
|
|
|
655
|
-
await this.em.
|
|
656
|
-
.
|
|
657
|
-
.
|
|
662
|
+
await (this.em.getKysely<any>() as any)
|
|
663
|
+
.updateTable('action_logs')
|
|
664
|
+
.set({
|
|
658
665
|
action_type: projection.actionType,
|
|
659
666
|
changed_fields: projection.changedFields,
|
|
660
667
|
primary_changed_field: projection.primaryChangedField,
|
|
661
668
|
source_key: projection.sourceKey,
|
|
662
669
|
})
|
|
670
|
+
.where('id', '=', row.id)
|
|
671
|
+
.execute()
|
|
663
672
|
|
|
664
673
|
result.updated += 1
|
|
665
674
|
} catch (err) {
|
|
@@ -170,7 +170,7 @@ export async function PUT(req: Request) {
|
|
|
170
170
|
if (parsed.data.organizations !== undefined) acl.organizationsJson = parsed.data.organizations
|
|
171
171
|
acl.isSuperAdmin = effectiveIsSuperAdmin
|
|
172
172
|
acl.featuresJson = effectiveFeatures
|
|
173
|
-
await em.
|
|
173
|
+
await em.persist(acl).flush()
|
|
174
174
|
|
|
175
175
|
// Invalidate cache for all users in this tenant since role ACL changed
|
|
176
176
|
if (targetTenantId) {
|
|
@@ -111,7 +111,7 @@ export async function PUT(req: Request) {
|
|
|
111
111
|
const hasCustomAcl = effectiveIsSuperAdmin || effectiveFeatures.length > 0
|
|
112
112
|
|
|
113
113
|
if (!hasCustomAcl) {
|
|
114
|
-
if (acl) await em.
|
|
114
|
+
if (acl) await em.remove(acl).flush()
|
|
115
115
|
} else {
|
|
116
116
|
if (!acl) {
|
|
117
117
|
acl = em.create(UserAcl, { user: parsed.data.userId as any, tenantId: auth.tenantId as any })
|
|
@@ -120,7 +120,7 @@ export async function PUT(req: Request) {
|
|
|
120
120
|
aclRecord.isSuperAdmin = effectiveIsSuperAdmin
|
|
121
121
|
aclRecord.featuresJson = effectiveFeatures
|
|
122
122
|
aclRecord.organizationsJson = organizations
|
|
123
|
-
await em.
|
|
123
|
+
await em.persist(acl).flush()
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// Invalidate cache for this user
|
|
@@ -129,7 +129,7 @@ export async function POST(req: Request) {
|
|
|
129
129
|
const tokenHash = hashAuthToken(rawToken)
|
|
130
130
|
const expiresAt = new Date(Date.now() + INVITE_TOKEN_TTL_MS)
|
|
131
131
|
const row = em.create(PasswordReset, { user, token: tokenHash, expiresAt, createdAt: new Date() })
|
|
132
|
-
await em.
|
|
132
|
+
await em.persist(row).flush()
|
|
133
133
|
|
|
134
134
|
const inviteUrl = `${base}/reset/${rawToken}`
|
|
135
135
|
|