@open-mercato/core 0.6.8-develop.6924.1.a8d208fcdc → 0.6.8-develop.6930.1.1e5976efc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/eudr_due_diligence_statement/index.js +47 -0
- package/dist/generated/entities/eudr_due_diligence_statement/index.js.map +7 -0
- package/dist/generated/entities/eudr_evidence_submission/index.js +51 -0
- package/dist/generated/entities/eudr_evidence_submission/index.js.map +7 -0
- package/dist/generated/entities/eudr_mitigation_action/index.js +31 -0
- package/dist/generated/entities/eudr_mitigation_action/index.js.map +7 -0
- package/dist/generated/entities/eudr_plot/index.js +39 -0
- package/dist/generated/entities/eudr_plot/index.js.map +7 -0
- package/dist/generated/entities/eudr_product_mapping/index.js +31 -0
- package/dist/generated/entities/eudr_product_mapping/index.js.map +7 -0
- package/dist/generated/entities/eudr_risk_assessment/index.js +35 -0
- package/dist/generated/entities/eudr_risk_assessment/index.js.map +7 -0
- package/dist/generated/entities/role/index.js +2 -0
- package/dist/generated/entities/role/index.js.map +2 -2
- package/dist/generated/entities.ids.generated.js +9 -0
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +121 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/api.js +4 -0
- package/dist/helpers/integration/api.js.map +2 -2
- package/dist/modules/attachments/fields/attachment.js +5 -1
- package/dist/modules/attachments/fields/attachment.js.map +2 -2
- package/dist/modules/attachments/lib/crud.js +3 -1
- package/dist/modules/attachments/lib/crud.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js +5 -0
- package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js.map +2 -2
- package/dist/modules/audit_logs/api/audit-logs/actions/undo/route.js +5 -0
- package/dist/modules/audit_logs/api/audit-logs/actions/undo/route.js.map +2 -2
- package/dist/modules/audit_logs/backend/audit-logs/page.js +4 -4
- package/dist/modules/audit_logs/backend/audit-logs/page.js.map +2 -2
- package/dist/modules/audit_logs/components/AuditLogsActions.js +9 -2
- package/dist/modules/audit_logs/components/AuditLogsActions.js.map +2 -2
- package/dist/modules/auth/api/login.js +5 -2
- package/dist/modules/auth/api/login.js.map +2 -2
- package/dist/modules/auth/api/users/route.js +8 -5
- package/dist/modules/auth/api/users/route.js.map +2 -2
- package/dist/modules/auth/backend/users/[id]/edit/page.js +15 -1
- package/dist/modules/auth/backend/users/[id]/edit/page.js.map +2 -2
- package/dist/modules/auth/backend/users/page.js +7 -1
- package/dist/modules/auth/backend/users/page.js.map +2 -2
- package/dist/modules/auth/commands/users.js +175 -76
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/data/entities.js +4 -0
- package/dist/modules/auth/data/entities.js.map +2 -2
- package/dist/modules/auth/lib/sessionIntegrity.js +1 -1
- package/dist/modules/auth/lib/sessionIntegrity.js.map +2 -2
- package/dist/modules/auth/lib/setup-app.js +1 -1
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/auth/migrations/Migration20260728134212_auth.js +14 -0
- package/dist/modules/auth/migrations/Migration20260728134212_auth.js.map +7 -0
- package/dist/modules/eudr/acl.js +43 -0
- package/dist/modules/eudr/acl.js.map +7 -0
- package/dist/modules/eudr/ai-agents.js +205 -0
- package/dist/modules/eudr/ai-agents.js.map +7 -0
- package/dist/modules/eudr/ai-tools/compliance-pack.js +495 -0
- package/dist/modules/eudr/ai-tools/compliance-pack.js.map +7 -0
- package/dist/modules/eudr/ai-tools/types.js +10 -0
- package/dist/modules/eudr/ai-tools/types.js.map +7 -0
- package/dist/modules/eudr/ai-tools.js +10 -0
- package/dist/modules/eudr/ai-tools.js.map +7 -0
- package/dist/modules/eudr/api/dashboard/widgets/compliance-overview/route.js +386 -0
- package/dist/modules/eudr/api/dashboard/widgets/compliance-overview/route.js.map +7 -0
- package/dist/modules/eudr/api/evidence-submissions/route.js +318 -0
- package/dist/modules/eudr/api/evidence-submissions/route.js.map +7 -0
- package/dist/modules/eudr/api/mitigation-actions/route.js +249 -0
- package/dist/modules/eudr/api/mitigation-actions/route.js.map +7 -0
- package/dist/modules/eudr/api/openapi.js +27 -0
- package/dist/modules/eudr/api/openapi.js.map +7 -0
- package/dist/modules/eudr/api/plots/import/route.js +294 -0
- package/dist/modules/eudr/api/plots/import/route.js.map +7 -0
- package/dist/modules/eudr/api/plots/route.js +279 -0
- package/dist/modules/eudr/api/plots/route.js.map +7 -0
- package/dist/modules/eudr/api/product-mappings/route.js +257 -0
- package/dist/modules/eudr/api/product-mappings/route.js.map +7 -0
- package/dist/modules/eudr/api/product-mappings/suggestions/apply/route.js +298 -0
- package/dist/modules/eudr/api/product-mappings/suggestions/apply/route.js.map +7 -0
- package/dist/modules/eudr/api/product-mappings/suggestions/route.js +132 -0
- package/dist/modules/eudr/api/product-mappings/suggestions/route.js.map +7 -0
- package/dist/modules/eudr/api/reports/annual/route.js +266 -0
- package/dist/modules/eudr/api/reports/annual/route.js.map +7 -0
- package/dist/modules/eudr/api/risk-assessments/route.js +300 -0
- package/dist/modules/eudr/api/risk-assessments/route.js.map +7 -0
- package/dist/modules/eudr/api/statements/[id]/export/route.js +631 -0
- package/dist/modules/eudr/api/statements/[id]/export/route.js.map +7 -0
- package/dist/modules/eudr/api/statements/[id]/readiness/route.js +111 -0
- package/dist/modules/eudr/api/statements/[id]/readiness/route.js.map +7 -0
- package/dist/modules/eudr/api/statements/route.js +314 -0
- package/dist/modules/eudr/api/statements/route.js.map +7 -0
- package/dist/modules/eudr/api/suppliers/compliance/route.js +173 -0
- package/dist/modules/eudr/api/suppliers/compliance/route.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/[id]/page.js +468 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/[id]/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/create/page.js +351 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/create/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.js +17 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.js +313 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/evidence-submissions/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/page.js +360 -0
- package/dist/modules/eudr/backend/eudr/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.js +346 -0
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/plots/[id]/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/plots/create/page.js +253 -0
- package/dist/modules/eudr/backend/eudr/plots/create/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/plots/create/page.meta.js +17 -0
- package/dist/modules/eudr/backend/eudr/plots/create/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/plots/page.js +386 -0
- package/dist/modules/eudr/backend/eudr/plots/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/plots/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/plots/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/[id]/page.js +253 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/[id]/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/create/page.js +174 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/create/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/create/page.meta.js +17 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/create/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/page.js +306 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/product-mappings/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/[id]/page.js +335 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/[id]/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/create/page.js +220 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/create/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/create/page.meta.js +17 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/create/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.js +324 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/risk-assessments/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.js +648 -0
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/statements/[id]/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/statements/create/page.js +432 -0
- package/dist/modules/eudr/backend/eudr/statements/create/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/statements/create/page.meta.js +17 -0
- package/dist/modules/eudr/backend/eudr/statements/create/page.meta.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/statements/page.js +309 -0
- package/dist/modules/eudr/backend/eudr/statements/page.js.map +7 -0
- package/dist/modules/eudr/backend/eudr/statements/page.meta.js +16 -0
- package/dist/modules/eudr/backend/eudr/statements/page.meta.js.map +7 -0
- package/dist/modules/eudr/ce.js +56 -0
- package/dist/modules/eudr/ce.js.map +7 -0
- package/dist/modules/eudr/commands/evidence-submissions.js +571 -0
- package/dist/modules/eudr/commands/evidence-submissions.js.map +7 -0
- package/dist/modules/eudr/commands/index.js +7 -0
- package/dist/modules/eudr/commands/index.js.map +7 -0
- package/dist/modules/eudr/commands/lifecycle-events.js +19 -0
- package/dist/modules/eudr/commands/lifecycle-events.js.map +7 -0
- package/dist/modules/eudr/commands/mitigation-actions.js +488 -0
- package/dist/modules/eudr/commands/mitigation-actions.js.map +7 -0
- package/dist/modules/eudr/commands/plots.js +517 -0
- package/dist/modules/eudr/commands/plots.js.map +7 -0
- package/dist/modules/eudr/commands/product-mappings.js +468 -0
- package/dist/modules/eudr/commands/product-mappings.js.map +7 -0
- package/dist/modules/eudr/commands/risk-assessments.js +599 -0
- package/dist/modules/eudr/commands/risk-assessments.js.map +7 -0
- package/dist/modules/eudr/commands/statements.js +747 -0
- package/dist/modules/eudr/commands/statements.js.map +7 -0
- package/dist/modules/eudr/components/CountrySelectField.js +64 -0
- package/dist/modules/eudr/components/CountrySelectField.js.map +7 -0
- package/dist/modules/eudr/components/GeometryInput.js +133 -0
- package/dist/modules/eudr/components/GeometryInput.js.map +7 -0
- package/dist/modules/eudr/components/MappingSuggestionsDialog.js +307 -0
- package/dist/modules/eudr/components/MappingSuggestionsDialog.js.map +7 -0
- package/dist/modules/eudr/components/MitigationActionsSection.js +345 -0
- package/dist/modules/eudr/components/MitigationActionsSection.js.map +7 -0
- package/dist/modules/eudr/components/OrderSelectField.js +88 -0
- package/dist/modules/eudr/components/OrderSelectField.js.map +7 -0
- package/dist/modules/eudr/components/PlotImportDialog.js +229 -0
- package/dist/modules/eudr/components/PlotImportDialog.js.map +7 -0
- package/dist/modules/eudr/components/PlotMapPreview.js +35 -0
- package/dist/modules/eudr/components/PlotMapPreview.js.map +7 -0
- package/dist/modules/eudr/components/PlotMapPreviewImpl.js +97 -0
- package/dist/modules/eudr/components/PlotMapPreviewImpl.js.map +7 -0
- package/dist/modules/eudr/components/PlotMultiSelectField.js +198 -0
- package/dist/modules/eudr/components/PlotMultiSelectField.js.map +7 -0
- package/dist/modules/eudr/components/RiskCriteriaField.js +128 -0
- package/dist/modules/eudr/components/RiskCriteriaField.js.map +7 -0
- package/dist/modules/eudr/components/StatementLifecycleBar.js +274 -0
- package/dist/modules/eudr/components/StatementLifecycleBar.js.map +7 -0
- package/dist/modules/eudr/components/StatementReadinessChecklist.js +56 -0
- package/dist/modules/eudr/components/StatementReadinessChecklist.js.map +7 -0
- package/dist/modules/eudr/components/StatementRiskSection.js +179 -0
- package/dist/modules/eudr/components/StatementRiskSection.js.map +7 -0
- package/dist/modules/eudr/components/crudErrorI18n.js +31 -0
- package/dist/modules/eudr/components/crudErrorI18n.js.map +7 -0
- package/dist/modules/eudr/components/formConfig.js +593 -0
- package/dist/modules/eudr/components/formConfig.js.map +7 -0
- package/dist/modules/eudr/components/plotForm.js +68 -0
- package/dist/modules/eudr/components/plotForm.js.map +7 -0
- package/dist/modules/eudr/data/enrichers.js +62 -0
- package/dist/modules/eudr/data/enrichers.js.map +7 -0
- package/dist/modules/eudr/data/entities.js +437 -0
- package/dist/modules/eudr/data/entities.js.map +7 -0
- package/dist/modules/eudr/data/validators.js +271 -0
- package/dist/modules/eudr/data/validators.js.map +7 -0
- package/dist/modules/eudr/encryption.js +33 -0
- package/dist/modules/eudr/encryption.js.map +7 -0
- package/dist/modules/eudr/events.js +38 -0
- package/dist/modules/eudr/events.js.map +7 -0
- package/dist/modules/eudr/index.js +15 -0
- package/dist/modules/eudr/index.js.map +7 -0
- package/dist/modules/eudr/lib/annual-report.js +104 -0
- package/dist/modules/eudr/lib/annual-report.js.map +7 -0
- package/dist/modules/eudr/lib/completeness.js +64 -0
- package/dist/modules/eudr/lib/completeness.js.map +7 -0
- package/dist/modules/eudr/lib/detail-read-scope.js +16 -0
- package/dist/modules/eudr/lib/detail-read-scope.js.map +7 -0
- package/dist/modules/eudr/lib/geometry.js +142 -0
- package/dist/modules/eudr/lib/geometry.js.map +7 -0
- package/dist/modules/eudr/lib/notifications.js +56 -0
- package/dist/modules/eudr/lib/notifications.js.map +7 -0
- package/dist/modules/eudr/lib/plural.js +26 -0
- package/dist/modules/eudr/lib/plural.js.map +7 -0
- package/dist/modules/eudr/lib/reference-data.js +240 -0
- package/dist/modules/eudr/lib/reference-data.js.map +7 -0
- package/dist/modules/eudr/lib/species.js +10 -0
- package/dist/modules/eudr/lib/species.js.map +7 -0
- package/dist/modules/eudr/lib/statement-lifecycle.js +84 -0
- package/dist/modules/eudr/lib/statement-lifecycle.js.map +7 -0
- package/dist/modules/eudr/lib/statement-seeding.js +49 -0
- package/dist/modules/eudr/lib/statement-seeding.js.map +7 -0
- package/dist/modules/eudr/migrations/Migration20260706102002_eudr.js +15 -0
- package/dist/modules/eudr/migrations/Migration20260706102002_eudr.js.map +7 -0
- package/dist/modules/eudr/migrations/Migration20260706152612_eudr.js +24 -0
- package/dist/modules/eudr/migrations/Migration20260706152612_eudr.js.map +7 -0
- package/dist/modules/eudr/migrations/Migration20260722100000_eudr.js +15 -0
- package/dist/modules/eudr/migrations/Migration20260722100000_eudr.js.map +7 -0
- package/dist/modules/eudr/notifications.js +58 -0
- package/dist/modules/eudr/notifications.js.map +7 -0
- package/dist/modules/eudr/search.js +186 -0
- package/dist/modules/eudr/search.js.map +7 -0
- package/dist/modules/eudr/setup.js +12 -0
- package/dist/modules/eudr/setup.js.map +7 -0
- package/dist/modules/eudr/subscribers/notify-mitigation-completed.js +34 -0
- package/dist/modules/eudr/subscribers/notify-mitigation-completed.js.map +7 -0
- package/dist/modules/eudr/subscribers/notify-risk-concluded.js +35 -0
- package/dist/modules/eudr/subscribers/notify-risk-concluded.js.map +7 -0
- package/dist/modules/eudr/subscribers/notify-statement-reference-issued.js +37 -0
- package/dist/modules/eudr/subscribers/notify-statement-reference-issued.js.map +7 -0
- package/dist/modules/eudr/subscribers/notify-statement-submitted.js +34 -0
- package/dist/modules/eudr/subscribers/notify-statement-submitted.js.map +7 -0
- package/dist/modules/eudr/subscribers/notify-statement-withdrawn.js +34 -0
- package/dist/modules/eudr/subscribers/notify-statement-withdrawn.js.map +7 -0
- package/dist/modules/eudr/subscribers/recompute-completeness-on-attachment-created.js +124 -0
- package/dist/modules/eudr/subscribers/recompute-completeness-on-attachment-created.js.map +7 -0
- package/dist/modules/eudr/subscribers/recompute-completeness-on-attachment-deleted.js +22 -0
- package/dist/modules/eudr/subscribers/recompute-completeness-on-attachment-deleted.js.map +7 -0
- package/dist/modules/eudr/widgets/dashboard/compliance-overview/widget.client.js +203 -0
- package/dist/modules/eudr/widgets/dashboard/compliance-overview/widget.client.js.map +7 -0
- package/dist/modules/eudr/widgets/dashboard/compliance-overview/widget.js +23 -0
- package/dist/modules/eudr/widgets/dashboard/compliance-overview/widget.js.map +7 -0
- package/dist/modules/eudr/widgets/injection/eudr-product-column/widget.client.js +19 -0
- package/dist/modules/eudr/widgets/injection/eudr-product-column/widget.client.js.map +7 -0
- package/dist/modules/eudr/widgets/injection/eudr-product-column/widget.js +31 -0
- package/dist/modules/eudr/widgets/injection/eudr-product-column/widget.js.map +7 -0
- package/dist/modules/eudr/widgets/injection/order-compliance/widget.client.js +100 -0
- package/dist/modules/eudr/widgets/injection/order-compliance/widget.client.js.map +7 -0
- package/dist/modules/eudr/widgets/injection/order-compliance/widget.js +17 -0
- package/dist/modules/eudr/widgets/injection/order-compliance/widget.js.map +7 -0
- package/dist/modules/eudr/widgets/injection/supplier-compliance/widget.client.js +116 -0
- package/dist/modules/eudr/widgets/injection/supplier-compliance/widget.client.js.map +7 -0
- package/dist/modules/eudr/widgets/injection/supplier-compliance/widget.js +17 -0
- package/dist/modules/eudr/widgets/injection/supplier-compliance/widget.js.map +7 -0
- package/dist/modules/eudr/widgets/injection-table.js +32 -0
- package/dist/modules/eudr/widgets/injection-table.js.map +7 -0
- package/dist/modules/notifications/lib/notificationService.js +67 -3
- package/dist/modules/notifications/lib/notificationService.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +121 -48
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/sales/api/documents/factory.js +17 -0
- package/dist/modules/sales/api/documents/factory.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +32 -18
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/data/entities.js +1 -0
- package/dist/modules/sales/data/entities.js.map +2 -2
- package/dist/modules/sales/migrations/Migration20260806120000_sales_tag_assignment_document_idx.js +17 -0
- package/dist/modules/sales/migrations/Migration20260806120000_sales_tag_assignment_document_idx.js.map +7 -0
- package/generated/entities/eudr_due_diligence_statement/index.ts +22 -0
- package/generated/entities/eudr_evidence_submission/index.ts +24 -0
- package/generated/entities/eudr_mitigation_action/index.ts +14 -0
- package/generated/entities/eudr_plot/index.ts +18 -0
- package/generated/entities/eudr_product_mapping/index.ts +14 -0
- package/generated/entities/eudr_risk_assessment/index.ts +16 -0
- package/generated/entities/role/index.ts +1 -0
- package/generated/entities.ids.generated.ts +9 -0
- package/generated/entity-fields-registry.ts +121 -0
- package/package.json +7 -7
- package/src/helpers/integration/api.ts +13 -0
- package/src/modules/attachments/fields/attachment.tsx +5 -0
- package/src/modules/attachments/lib/crud.ts +2 -0
- package/src/modules/audit_logs/api/audit-logs/actions/redo/route.ts +7 -0
- package/src/modules/audit_logs/api/audit-logs/actions/undo/route.ts +9 -0
- package/src/modules/audit_logs/backend/audit-logs/page.tsx +4 -4
- package/src/modules/audit_logs/components/AuditLogsActions.tsx +20 -4
- package/src/modules/auth/api/login.ts +9 -2
- package/src/modules/auth/api/users/route.ts +8 -4
- package/src/modules/auth/backend/users/[id]/edit/page.tsx +17 -1
- package/src/modules/auth/backend/users/page.tsx +11 -0
- package/src/modules/auth/commands/users.ts +251 -85
- package/src/modules/auth/data/entities.ts +3 -0
- package/src/modules/auth/i18n/de.json +6 -0
- package/src/modules/auth/i18n/en.json +6 -0
- package/src/modules/auth/i18n/es.json +6 -0
- package/src/modules/auth/i18n/ko.json +6 -0
- package/src/modules/auth/i18n/pl.json +6 -0
- package/src/modules/auth/lib/sessionIntegrity.ts +1 -1
- package/src/modules/auth/lib/setup-app.ts +1 -1
- package/src/modules/auth/migrations/.snapshot-open-mercato.json +16 -0
- package/src/modules/auth/migrations/Migration20260728134212_auth.ts +14 -0
- package/src/modules/eudr/acl.ts +39 -0
- package/src/modules/eudr/ai-agents.ts +258 -0
- package/src/modules/eudr/ai-tools/compliance-pack.ts +618 -0
- package/src/modules/eudr/ai-tools/types.ts +44 -0
- package/src/modules/eudr/ai-tools.ts +15 -0
- package/src/modules/eudr/api/dashboard/widgets/compliance-overview/route.ts +481 -0
- package/src/modules/eudr/api/evidence-submissions/route.ts +335 -0
- package/src/modules/eudr/api/mitigation-actions/route.ts +263 -0
- package/src/modules/eudr/api/openapi.ts +28 -0
- package/src/modules/eudr/api/plots/import/route.ts +369 -0
- package/src/modules/eudr/api/plots/route.ts +296 -0
- package/src/modules/eudr/api/product-mappings/route.ts +269 -0
- package/src/modules/eudr/api/product-mappings/suggestions/apply/route.ts +382 -0
- package/src/modules/eudr/api/product-mappings/suggestions/route.ts +169 -0
- package/src/modules/eudr/api/reports/annual/route.ts +457 -0
- package/src/modules/eudr/api/risk-assessments/route.ts +323 -0
- package/src/modules/eudr/api/statements/[id]/export/route.ts +713 -0
- package/src/modules/eudr/api/statements/[id]/readiness/route.ts +129 -0
- package/src/modules/eudr/api/statements/route.ts +329 -0
- package/src/modules/eudr/api/suppliers/compliance/route.ts +241 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/[id]/page.tsx +545 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.ts +13 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/create/page.tsx +383 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/evidence-submissions/page.tsx +379 -0
- package/src/modules/eudr/backend/eudr/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/page.tsx +477 -0
- package/src/modules/eudr/backend/eudr/plots/[id]/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/plots/[id]/page.tsx +404 -0
- package/src/modules/eudr/backend/eudr/plots/create/page.meta.ts +13 -0
- package/src/modules/eudr/backend/eudr/plots/create/page.tsx +267 -0
- package/src/modules/eudr/backend/eudr/plots/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/plots/page.tsx +442 -0
- package/src/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/product-mappings/[id]/page.tsx +311 -0
- package/src/modules/eudr/backend/eudr/product-mappings/create/page.meta.ts +13 -0
- package/src/modules/eudr/backend/eudr/product-mappings/create/page.tsx +190 -0
- package/src/modules/eudr/backend/eudr/product-mappings/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/product-mappings/page.tsx +344 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/[id]/page.tsx +421 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/create/page.meta.ts +13 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/create/page.tsx +247 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/risk-assessments/page.tsx +383 -0
- package/src/modules/eudr/backend/eudr/statements/[id]/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/statements/[id]/page.tsx +777 -0
- package/src/modules/eudr/backend/eudr/statements/create/page.meta.ts +13 -0
- package/src/modules/eudr/backend/eudr/statements/create/page.tsx +511 -0
- package/src/modules/eudr/backend/eudr/statements/page.meta.ts +12 -0
- package/src/modules/eudr/backend/eudr/statements/page.tsx +372 -0
- package/src/modules/eudr/ce.ts +52 -0
- package/src/modules/eudr/commands/evidence-submissions.ts +699 -0
- package/src/modules/eudr/commands/index.ts +6 -0
- package/src/modules/eudr/commands/lifecycle-events.ts +28 -0
- package/src/modules/eudr/commands/mitigation-actions.ts +574 -0
- package/src/modules/eudr/commands/plots.ts +627 -0
- package/src/modules/eudr/commands/product-mappings.ts +556 -0
- package/src/modules/eudr/commands/risk-assessments.ts +728 -0
- package/src/modules/eudr/commands/statements.ts +933 -0
- package/src/modules/eudr/components/CountrySelectField.tsx +77 -0
- package/src/modules/eudr/components/GeometryInput.tsx +170 -0
- package/src/modules/eudr/components/MappingSuggestionsDialog.tsx +385 -0
- package/src/modules/eudr/components/MitigationActionsSection.tsx +417 -0
- package/src/modules/eudr/components/OrderSelectField.tsx +116 -0
- package/src/modules/eudr/components/PlotImportDialog.tsx +277 -0
- package/src/modules/eudr/components/PlotMapPreview.tsx +46 -0
- package/src/modules/eudr/components/PlotMapPreviewImpl.tsx +111 -0
- package/src/modules/eudr/components/PlotMultiSelectField.tsx +238 -0
- package/src/modules/eudr/components/RiskCriteriaField.tsx +173 -0
- package/src/modules/eudr/components/StatementLifecycleBar.tsx +363 -0
- package/src/modules/eudr/components/StatementReadinessChecklist.tsx +82 -0
- package/src/modules/eudr/components/StatementRiskSection.tsx +242 -0
- package/src/modules/eudr/components/crudErrorI18n.ts +36 -0
- package/src/modules/eudr/components/formConfig.tsx +717 -0
- package/src/modules/eudr/components/plotForm.ts +75 -0
- package/src/modules/eudr/data/enrichers.ts +82 -0
- package/src/modules/eudr/data/entities.ts +369 -0
- package/src/modules/eudr/data/validators.ts +357 -0
- package/src/modules/eudr/encryption.ts +31 -0
- package/src/modules/eudr/events.ts +38 -0
- package/src/modules/eudr/i18n/de.json +747 -0
- package/src/modules/eudr/i18n/en.json +747 -0
- package/src/modules/eudr/i18n/es.json +747 -0
- package/src/modules/eudr/i18n/ko.json +747 -0
- package/src/modules/eudr/i18n/pl.json +747 -0
- package/src/modules/eudr/index.ts +13 -0
- package/src/modules/eudr/lib/annual-report.ts +120 -0
- package/src/modules/eudr/lib/completeness.ts +90 -0
- package/src/modules/eudr/lib/detail-read-scope.ts +44 -0
- package/src/modules/eudr/lib/geometry.ts +191 -0
- package/src/modules/eudr/lib/notifications.ts +85 -0
- package/src/modules/eudr/lib/plural.ts +36 -0
- package/src/modules/eudr/lib/reference-data.ts +128 -0
- package/src/modules/eudr/lib/species.ts +12 -0
- package/src/modules/eudr/lib/statement-lifecycle.ts +109 -0
- package/src/modules/eudr/lib/statement-seeding.ts +86 -0
- package/src/modules/eudr/migrations/.snapshot-open-mercato.json +2046 -0
- package/src/modules/eudr/migrations/Migration20260706102002_eudr.ts +16 -0
- package/src/modules/eudr/migrations/Migration20260706152612_eudr.ts +30 -0
- package/src/modules/eudr/migrations/Migration20260722100000_eudr.ts +17 -0
- package/src/modules/eudr/notifications.ts +56 -0
- package/src/modules/eudr/search.ts +212 -0
- package/src/modules/eudr/setup.ts +10 -0
- package/src/modules/eudr/subscribers/notify-mitigation-completed.ts +56 -0
- package/src/modules/eudr/subscribers/notify-risk-concluded.ts +58 -0
- package/src/modules/eudr/subscribers/notify-statement-reference-issued.ts +59 -0
- package/src/modules/eudr/subscribers/notify-statement-submitted.ts +49 -0
- package/src/modules/eudr/subscribers/notify-statement-withdrawn.ts +49 -0
- package/src/modules/eudr/subscribers/recompute-completeness-on-attachment-created.ts +189 -0
- package/src/modules/eudr/subscribers/recompute-completeness-on-attachment-deleted.ts +31 -0
- package/src/modules/eudr/widgets/dashboard/compliance-overview/widget.client.tsx +271 -0
- package/src/modules/eudr/widgets/dashboard/compliance-overview/widget.ts +24 -0
- package/src/modules/eudr/widgets/injection/eudr-product-column/widget.client.tsx +37 -0
- package/src/modules/eudr/widgets/injection/eudr-product-column/widget.ts +30 -0
- package/src/modules/eudr/widgets/injection/order-compliance/widget.client.tsx +131 -0
- package/src/modules/eudr/widgets/injection/order-compliance/widget.ts +16 -0
- package/src/modules/eudr/widgets/injection/supplier-compliance/widget.client.tsx +168 -0
- package/src/modules/eudr/widgets/injection/supplier-compliance/widget.ts +16 -0
- package/src/modules/eudr/widgets/injection-table.ts +31 -0
- package/src/modules/notifications/lib/notificationService.ts +83 -4
- package/src/modules/query_index/lib/engine.ts +139 -51
- package/src/modules/sales/api/documents/factory.ts +29 -0
- package/src/modules/sales/commands/documents.ts +65 -18
- package/src/modules/sales/data/entities.ts +1 -0
- package/src/modules/sales/migrations/.snapshot-open-mercato.json +10 -0
- package/src/modules/sales/migrations/Migration20260806120000_sales_tag_assignment_document_idx.ts +59 -0
package/dist/modules/sales/migrations/Migration20260806120000_sales_tag_assignment_document_idx.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Migration } from "@mikro-orm/migrations";
|
|
2
|
+
class Migration20260806120000_sales_tag_assignment_document_idx extends Migration {
|
|
3
|
+
isTransactional() {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
up() {
|
|
7
|
+
this.addSql(`drop index concurrently if exists "sales_document_tag_assignments_document_idx";`);
|
|
8
|
+
this.addSql(`create index concurrently "sales_document_tag_assignments_document_idx" on "sales_document_tag_assignments" ("document_id");`);
|
|
9
|
+
}
|
|
10
|
+
down() {
|
|
11
|
+
this.addSql(`drop index concurrently if exists "sales_document_tag_assignments_document_idx";`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
Migration20260806120000_sales_tag_assignment_document_idx
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Migration20260806120000_sales_tag_assignment_document_idx.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/sales/migrations/Migration20260806120000_sales_tag_assignment_document_idx.ts"],
|
|
4
|
+
"sourcesContent": ["import { Migration } from '@mikro-orm/migrations';\n\n// sales_document_tag_assignments had no index whose leading column is\n// document_id: the table carries PK(id), (organization_id, tenant_id) and the\n// unique (tag_id, document_id, document_kind) \u2014 and the unique index leads with\n// tag_id, which a document-scoped predicate never supplies. Every read and\n// write that resolves a document's tags therefore degraded to a sequential scan\n// as the table grew: syncSalesDocumentTags' per-save delete\n// (commands/documents.ts) and the order/quote grid's\n// `left join ... on id = document_id` (api/documents/factory.ts) alike. On a\n// 2.85M-row / 868MB production table the delete measured 139.9 ms \u2014 a full\n// table scan to remove the two rows belonging to one order.\n//\n// document_kind is deliberately omitted. sales_orders.id and sales_quotes.id\n// are both gen_random_uuid() from their own tables, so a document_id already\n// determines its kind; the second column adds no selectivity for ~30% more\n// index and document_kind is simply rechecked over the rows the seek returns.\n// The unique (tag_id, document_id, document_kind) index stays as-is \u2014 its\n// leading tag_id is load-bearing for sales.tags.delete (commands/tags.ts), for\n// the grid's tag filter and for the foreign-key check. Both column orders are\n// needed; two indexes is correct.\n//\n// The table is high-churn, so the index is built CONCURRENTLY to avoid blocking\n// writes during the build. CREATE INDEX CONCURRENTLY cannot run inside a\n// transaction, hence isTransactional() => false; the migration runner applies\n// migrations one-by-one, so this opt-out is safe. Drop first so retrying a\n// failed concurrent build removes PostgreSQL's invalid index stub instead of\n// letting IF NOT EXISTS silently accept it: a half-built concurrent index is\n// left INVALID, the planner ignores it, and IF NOT EXISTS would report success\n// while the table stays unindexed.\n//\n// Both halves follow Migration20260731105052_query_index, which builds\n// concurrently and drops first for the same reason. The earlier\n// Migration20260611103000_query_index builds concurrently but uses IF NOT\n// EXISTS without the drop \u2014 cited here only so a reader comparing the two knows\n// the divergence is deliberate rather than an oversight.\n//\n// On a database that does not have the index yet \u2014 every fresh install \u2014 the\n// drop is a no-op and there is no window without it. An operator who already\n// created this index out of band should expect it to be rebuilt here, and the\n// document-scoped scans to fall back to their pre-index cost until the\n// concurrent build finishes; on a large table, run this while the writers that\n// depend on it are paused.\nexport class Migration20260806120000_sales_tag_assignment_document_idx extends Migration {\n\n override isTransactional(): boolean {\n return false;\n }\n\n override up(): void | Promise<void> {\n this.addSql(`drop index concurrently if exists \"sales_document_tag_assignments_document_idx\";`);\n this.addSql(`create index concurrently \"sales_document_tag_assignments_document_idx\" on \"sales_document_tag_assignments\" (\"document_id\");`);\n }\n\n override down(): void | Promise<void> {\n this.addSql(`drop index concurrently if exists \"sales_document_tag_assignments_document_idx\";`);\n }\n\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AA2CnB,MAAM,kEAAkE,UAAU;AAAA,EAE9E,kBAA2B;AAClC,WAAO;AAAA,EACT;AAAA,EAES,KAA2B;AAClC,SAAK,OAAO,kFAAkF;AAC9F,SAAK,OAAO,8HAA8H;AAAA,EAC5I;AAAA,EAES,OAA6B;AACpC,SAAK,OAAO,kFAAkF;AAAA,EAChG;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const id = "id";
|
|
2
|
+
export const organization_id = "organization_id";
|
|
3
|
+
export const tenant_id = "tenant_id";
|
|
4
|
+
export const title = "title";
|
|
5
|
+
export const commodity = "commodity";
|
|
6
|
+
export const reference_number = "reference_number";
|
|
7
|
+
export const verification_number = "verification_number";
|
|
8
|
+
export const status = "status";
|
|
9
|
+
export const activity_type = "activity_type";
|
|
10
|
+
export const actor_role = "actor_role";
|
|
11
|
+
export const referenced_statements = "referenced_statements";
|
|
12
|
+
export const quantity_kg = "quantity_kg";
|
|
13
|
+
export const supplementary_unit = "supplementary_unit";
|
|
14
|
+
export const supplementary_quantity = "supplementary_quantity";
|
|
15
|
+
export const order_id = "order_id";
|
|
16
|
+
export const submitted_at = "submitted_at";
|
|
17
|
+
export const reference_issued_at = "reference_issued_at";
|
|
18
|
+
export const order_snapshot = "order_snapshot";
|
|
19
|
+
export const notes = "notes";
|
|
20
|
+
export const created_at = "created_at";
|
|
21
|
+
export const updated_at = "updated_at";
|
|
22
|
+
export const deleted_at = "deleted_at";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const id = "id";
|
|
2
|
+
export const organization_id = "organization_id";
|
|
3
|
+
export const tenant_id = "tenant_id";
|
|
4
|
+
export const supplier_entity_id = "supplier_entity_id";
|
|
5
|
+
export const supplier_snapshot = "supplier_snapshot";
|
|
6
|
+
export const commodity = "commodity";
|
|
7
|
+
export const product_mapping_id = "product_mapping_id";
|
|
8
|
+
export const statement_id = "statement_id";
|
|
9
|
+
export const origin_country = "origin_country";
|
|
10
|
+
export const geolocation = "geolocation";
|
|
11
|
+
export const quantity_kg = "quantity_kg";
|
|
12
|
+
export const batch_number = "batch_number";
|
|
13
|
+
export const harvest_from = "harvest_from";
|
|
14
|
+
export const harvest_to = "harvest_to";
|
|
15
|
+
export const producer_name = "producer_name";
|
|
16
|
+
export const attachment_ids = "attachment_ids";
|
|
17
|
+
export const plot_ids = "plot_ids";
|
|
18
|
+
export const status = "status";
|
|
19
|
+
export const completeness_score = "completeness_score";
|
|
20
|
+
export const missing_fields = "missing_fields";
|
|
21
|
+
export const notes = "notes";
|
|
22
|
+
export const created_at = "created_at";
|
|
23
|
+
export const updated_at = "updated_at";
|
|
24
|
+
export const deleted_at = "deleted_at";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const id = "id";
|
|
2
|
+
export const organization_id = "organization_id";
|
|
3
|
+
export const tenant_id = "tenant_id";
|
|
4
|
+
export const risk_assessment_id = "risk_assessment_id";
|
|
5
|
+
export const action_type = "action_type";
|
|
6
|
+
export const title = "title";
|
|
7
|
+
export const description = "description";
|
|
8
|
+
export const status = "status";
|
|
9
|
+
export const due_date = "due_date";
|
|
10
|
+
export const completed_at = "completed_at";
|
|
11
|
+
export const notes = "notes";
|
|
12
|
+
export const created_at = "created_at";
|
|
13
|
+
export const updated_at = "updated_at";
|
|
14
|
+
export const deleted_at = "deleted_at";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const id = "id";
|
|
2
|
+
export const organization_id = "organization_id";
|
|
3
|
+
export const tenant_id = "tenant_id";
|
|
4
|
+
export const supplier_entity_id = "supplier_entity_id";
|
|
5
|
+
export const supplier_snapshot = "supplier_snapshot";
|
|
6
|
+
export const name = "name";
|
|
7
|
+
export const external_id = "external_id";
|
|
8
|
+
export const description = "description";
|
|
9
|
+
export const origin_country = "origin_country";
|
|
10
|
+
export const plot_type = "plot_type";
|
|
11
|
+
export const geometry = "geometry";
|
|
12
|
+
export const area_ha = "area_ha";
|
|
13
|
+
export const validation_warnings = "validation_warnings";
|
|
14
|
+
export const producer_name = "producer_name";
|
|
15
|
+
export const is_active = "is_active";
|
|
16
|
+
export const created_at = "created_at";
|
|
17
|
+
export const updated_at = "updated_at";
|
|
18
|
+
export const deleted_at = "deleted_at";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const id = "id";
|
|
2
|
+
export const organization_id = "organization_id";
|
|
3
|
+
export const tenant_id = "tenant_id";
|
|
4
|
+
export const product_id = "product_id";
|
|
5
|
+
export const product_snapshot = "product_snapshot";
|
|
6
|
+
export const commodity = "commodity";
|
|
7
|
+
export const hs_code = "hs_code";
|
|
8
|
+
export const species_scientific_name = "species_scientific_name";
|
|
9
|
+
export const species_common_name = "species_common_name";
|
|
10
|
+
export const is_in_scope = "is_in_scope";
|
|
11
|
+
export const notes = "notes";
|
|
12
|
+
export const created_at = "created_at";
|
|
13
|
+
export const updated_at = "updated_at";
|
|
14
|
+
export const deleted_at = "deleted_at";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const id = "id";
|
|
2
|
+
export const organization_id = "organization_id";
|
|
3
|
+
export const tenant_id = "tenant_id";
|
|
4
|
+
export const statement_id = "statement_id";
|
|
5
|
+
export const country_risks = "country_risks";
|
|
6
|
+
export const overall_tier = "overall_tier";
|
|
7
|
+
export const criteria = "criteria";
|
|
8
|
+
export const conclusion = "conclusion";
|
|
9
|
+
export const is_simplified = "is_simplified";
|
|
10
|
+
export const assessed_at = "assessed_at";
|
|
11
|
+
export const assessed_by_name = "assessed_by_name";
|
|
12
|
+
export const review_due_at = "review_due_at";
|
|
13
|
+
export const notes = "notes";
|
|
14
|
+
export const created_at = "created_at";
|
|
15
|
+
export const updated_at = "updated_at";
|
|
16
|
+
export const deleted_at = "deleted_at";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const id = "id";
|
|
2
2
|
export const name = "name";
|
|
3
3
|
export const tenant_id = "tenant_id";
|
|
4
|
+
export const min_active_holders = "min_active_holders";
|
|
4
5
|
export const created_at = "created_at";
|
|
5
6
|
export const updated_at = "updated_at";
|
|
6
7
|
export const deleted_at = "deleted_at";
|
|
@@ -35,6 +35,7 @@ export const M = {
|
|
|
35
35
|
"inbox_ops": "inbox_ops",
|
|
36
36
|
"payment_gateways": "payment_gateways",
|
|
37
37
|
"shipping_carriers": "shipping_carriers",
|
|
38
|
+
"eudr": "eudr",
|
|
38
39
|
"customer_accounts": "customer_accounts",
|
|
39
40
|
"portal": "portal"
|
|
40
41
|
} as const, E = {
|
|
@@ -290,6 +291,14 @@ export const M = {
|
|
|
290
291
|
"carrier_webhook_processed_event": "shipping_carriers:carrier_webhook_processed_event",
|
|
291
292
|
"carrier_shipment_idempotency_key": "shipping_carriers:carrier_shipment_idempotency_key"
|
|
292
293
|
},
|
|
294
|
+
"eudr": {
|
|
295
|
+
"eudr_product_mapping": "eudr:eudr_product_mapping",
|
|
296
|
+
"eudr_plot": "eudr:eudr_plot",
|
|
297
|
+
"eudr_evidence_submission": "eudr:eudr_evidence_submission",
|
|
298
|
+
"eudr_due_diligence_statement": "eudr:eudr_due_diligence_statement",
|
|
299
|
+
"eudr_risk_assessment": "eudr:eudr_risk_assessment",
|
|
300
|
+
"eudr_mitigation_action": "eudr:eudr_mitigation_action"
|
|
301
|
+
},
|
|
293
302
|
"customer_accounts": {
|
|
294
303
|
"customer_user": "customer_accounts:customer_user",
|
|
295
304
|
"customer_role": "customer_accounts:customer_role",
|
|
@@ -1184,6 +1184,126 @@ export const entityFieldsRegistry: Record<string, Record<string, string>> = {
|
|
|
1184
1184
|
"created_at": "created_at",
|
|
1185
1185
|
"updated_at": "updated_at"
|
|
1186
1186
|
},
|
|
1187
|
+
"eudr_due_diligence_statement": {
|
|
1188
|
+
"id": "id",
|
|
1189
|
+
"organization_id": "organization_id",
|
|
1190
|
+
"tenant_id": "tenant_id",
|
|
1191
|
+
"title": "title",
|
|
1192
|
+
"commodity": "commodity",
|
|
1193
|
+
"reference_number": "reference_number",
|
|
1194
|
+
"verification_number": "verification_number",
|
|
1195
|
+
"status": "status",
|
|
1196
|
+
"activity_type": "activity_type",
|
|
1197
|
+
"actor_role": "actor_role",
|
|
1198
|
+
"referenced_statements": "referenced_statements",
|
|
1199
|
+
"quantity_kg": "quantity_kg",
|
|
1200
|
+
"supplementary_unit": "supplementary_unit",
|
|
1201
|
+
"supplementary_quantity": "supplementary_quantity",
|
|
1202
|
+
"order_id": "order_id",
|
|
1203
|
+
"submitted_at": "submitted_at",
|
|
1204
|
+
"reference_issued_at": "reference_issued_at",
|
|
1205
|
+
"order_snapshot": "order_snapshot",
|
|
1206
|
+
"notes": "notes",
|
|
1207
|
+
"created_at": "created_at",
|
|
1208
|
+
"updated_at": "updated_at",
|
|
1209
|
+
"deleted_at": "deleted_at"
|
|
1210
|
+
},
|
|
1211
|
+
"eudr_evidence_submission": {
|
|
1212
|
+
"id": "id",
|
|
1213
|
+
"organization_id": "organization_id",
|
|
1214
|
+
"tenant_id": "tenant_id",
|
|
1215
|
+
"supplier_entity_id": "supplier_entity_id",
|
|
1216
|
+
"supplier_snapshot": "supplier_snapshot",
|
|
1217
|
+
"commodity": "commodity",
|
|
1218
|
+
"product_mapping_id": "product_mapping_id",
|
|
1219
|
+
"statement_id": "statement_id",
|
|
1220
|
+
"origin_country": "origin_country",
|
|
1221
|
+
"geolocation": "geolocation",
|
|
1222
|
+
"quantity_kg": "quantity_kg",
|
|
1223
|
+
"batch_number": "batch_number",
|
|
1224
|
+
"harvest_from": "harvest_from",
|
|
1225
|
+
"harvest_to": "harvest_to",
|
|
1226
|
+
"producer_name": "producer_name",
|
|
1227
|
+
"attachment_ids": "attachment_ids",
|
|
1228
|
+
"plot_ids": "plot_ids",
|
|
1229
|
+
"status": "status",
|
|
1230
|
+
"completeness_score": "completeness_score",
|
|
1231
|
+
"missing_fields": "missing_fields",
|
|
1232
|
+
"notes": "notes",
|
|
1233
|
+
"created_at": "created_at",
|
|
1234
|
+
"updated_at": "updated_at",
|
|
1235
|
+
"deleted_at": "deleted_at"
|
|
1236
|
+
},
|
|
1237
|
+
"eudr_mitigation_action": {
|
|
1238
|
+
"id": "id",
|
|
1239
|
+
"organization_id": "organization_id",
|
|
1240
|
+
"tenant_id": "tenant_id",
|
|
1241
|
+
"risk_assessment_id": "risk_assessment_id",
|
|
1242
|
+
"action_type": "action_type",
|
|
1243
|
+
"title": "title",
|
|
1244
|
+
"description": "description",
|
|
1245
|
+
"status": "status",
|
|
1246
|
+
"due_date": "due_date",
|
|
1247
|
+
"completed_at": "completed_at",
|
|
1248
|
+
"notes": "notes",
|
|
1249
|
+
"created_at": "created_at",
|
|
1250
|
+
"updated_at": "updated_at",
|
|
1251
|
+
"deleted_at": "deleted_at"
|
|
1252
|
+
},
|
|
1253
|
+
"eudr_plot": {
|
|
1254
|
+
"id": "id",
|
|
1255
|
+
"organization_id": "organization_id",
|
|
1256
|
+
"tenant_id": "tenant_id",
|
|
1257
|
+
"supplier_entity_id": "supplier_entity_id",
|
|
1258
|
+
"supplier_snapshot": "supplier_snapshot",
|
|
1259
|
+
"name": "name",
|
|
1260
|
+
"external_id": "external_id",
|
|
1261
|
+
"description": "description",
|
|
1262
|
+
"origin_country": "origin_country",
|
|
1263
|
+
"plot_type": "plot_type",
|
|
1264
|
+
"geometry": "geometry",
|
|
1265
|
+
"area_ha": "area_ha",
|
|
1266
|
+
"validation_warnings": "validation_warnings",
|
|
1267
|
+
"producer_name": "producer_name",
|
|
1268
|
+
"is_active": "is_active",
|
|
1269
|
+
"created_at": "created_at",
|
|
1270
|
+
"updated_at": "updated_at",
|
|
1271
|
+
"deleted_at": "deleted_at"
|
|
1272
|
+
},
|
|
1273
|
+
"eudr_product_mapping": {
|
|
1274
|
+
"id": "id",
|
|
1275
|
+
"organization_id": "organization_id",
|
|
1276
|
+
"tenant_id": "tenant_id",
|
|
1277
|
+
"product_id": "product_id",
|
|
1278
|
+
"product_snapshot": "product_snapshot",
|
|
1279
|
+
"commodity": "commodity",
|
|
1280
|
+
"hs_code": "hs_code",
|
|
1281
|
+
"species_scientific_name": "species_scientific_name",
|
|
1282
|
+
"species_common_name": "species_common_name",
|
|
1283
|
+
"is_in_scope": "is_in_scope",
|
|
1284
|
+
"notes": "notes",
|
|
1285
|
+
"created_at": "created_at",
|
|
1286
|
+
"updated_at": "updated_at",
|
|
1287
|
+
"deleted_at": "deleted_at"
|
|
1288
|
+
},
|
|
1289
|
+
"eudr_risk_assessment": {
|
|
1290
|
+
"id": "id",
|
|
1291
|
+
"organization_id": "organization_id",
|
|
1292
|
+
"tenant_id": "tenant_id",
|
|
1293
|
+
"statement_id": "statement_id",
|
|
1294
|
+
"country_risks": "country_risks",
|
|
1295
|
+
"overall_tier": "overall_tier",
|
|
1296
|
+
"criteria": "criteria",
|
|
1297
|
+
"conclusion": "conclusion",
|
|
1298
|
+
"is_simplified": "is_simplified",
|
|
1299
|
+
"assessed_at": "assessed_at",
|
|
1300
|
+
"assessed_by_name": "assessed_by_name",
|
|
1301
|
+
"review_due_at": "review_due_at",
|
|
1302
|
+
"notes": "notes",
|
|
1303
|
+
"created_at": "created_at",
|
|
1304
|
+
"updated_at": "updated_at",
|
|
1305
|
+
"deleted_at": "deleted_at"
|
|
1306
|
+
},
|
|
1187
1307
|
"exchange_rate": {
|
|
1188
1308
|
"id": "id",
|
|
1189
1309
|
"organization_id": "organization_id",
|
|
@@ -1873,6 +1993,7 @@ export const entityFieldsRegistry: Record<string, Record<string, string>> = {
|
|
|
1873
1993
|
"id": "id",
|
|
1874
1994
|
"name": "name",
|
|
1875
1995
|
"tenant_id": "tenant_id",
|
|
1996
|
+
"min_active_holders": "min_active_holders",
|
|
1876
1997
|
"created_at": "created_at",
|
|
1877
1998
|
"updated_at": "updated_at",
|
|
1878
1999
|
"deleted_at": "deleted_at"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/core",
|
|
3
|
-
"version": "0.6.8-develop.
|
|
3
|
+
"version": "0.6.8-develop.6930.1.1e5976efc3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -254,16 +254,16 @@
|
|
|
254
254
|
"zod": "^4.4.3"
|
|
255
255
|
},
|
|
256
256
|
"peerDependencies": {
|
|
257
|
-
"@open-mercato/ai-assistant": "0.6.8-develop.
|
|
258
|
-
"@open-mercato/shared": "0.6.8-develop.
|
|
259
|
-
"@open-mercato/ui": "0.6.8-develop.
|
|
257
|
+
"@open-mercato/ai-assistant": "0.6.8-develop.6930.1.1e5976efc3",
|
|
258
|
+
"@open-mercato/shared": "0.6.8-develop.6930.1.1e5976efc3",
|
|
259
|
+
"@open-mercato/ui": "0.6.8-develop.6930.1.1e5976efc3",
|
|
260
260
|
"react": "^19.0.0",
|
|
261
261
|
"react-dom": "^19.0.0"
|
|
262
262
|
},
|
|
263
263
|
"devDependencies": {
|
|
264
|
-
"@open-mercato/ai-assistant": "0.6.8-develop.
|
|
265
|
-
"@open-mercato/shared": "0.6.8-develop.
|
|
266
|
-
"@open-mercato/ui": "0.6.8-develop.
|
|
264
|
+
"@open-mercato/ai-assistant": "0.6.8-develop.6930.1.1e5976efc3",
|
|
265
|
+
"@open-mercato/shared": "0.6.8-develop.6930.1.1e5976efc3",
|
|
266
|
+
"@open-mercato/ui": "0.6.8-develop.6930.1.1e5976efc3",
|
|
267
267
|
"@testing-library/dom": "^10.4.1",
|
|
268
268
|
"@testing-library/jest-dom": "^7.0.0",
|
|
269
269
|
"@testing-library/react": "^16.3.1",
|
|
@@ -13,6 +13,19 @@ function resolveUrl(path: string): string {
|
|
|
13
13
|
const tokenCache = new Map<string, { token: string; mintedAt: number }>();
|
|
14
14
|
const TOKEN_TTL_MS = 45 * 60 * 1000; // 45 min; well under the default 2h session TTL.
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Drops cached tokens so the next getAuthToken() mints a fresh session.
|
|
18
|
+
*
|
|
19
|
+
* A cached token points at a `sessions` row. Anything that deletes those rows —
|
|
20
|
+
* deactivating the user, a password change, an explicit session purge — leaves the
|
|
21
|
+
* cached token resolving to 401 for the rest of the TTL, and `apiRequest` neither
|
|
22
|
+
* retries nor re-mints. A spec that revokes sessions for an account other specs also
|
|
23
|
+
* use MUST call this afterwards.
|
|
24
|
+
*/
|
|
25
|
+
export function clearAuthTokenCache(): void {
|
|
26
|
+
tokenCache.clear();
|
|
27
|
+
}
|
|
28
|
+
|
|
16
29
|
export async function getAuthToken(
|
|
17
30
|
request: APIRequestContext,
|
|
18
31
|
roleOrEmail: Role | string = 'admin',
|
|
@@ -50,11 +50,13 @@ export const AttachmentInput = ({
|
|
|
50
50
|
recordId,
|
|
51
51
|
def,
|
|
52
52
|
disabled,
|
|
53
|
+
onUploaded,
|
|
53
54
|
}: {
|
|
54
55
|
entityId?: string
|
|
55
56
|
recordId?: string
|
|
56
57
|
def?: AttachmentFieldDef
|
|
57
58
|
disabled?: boolean
|
|
59
|
+
onUploaded?: () => void
|
|
58
60
|
}) => {
|
|
59
61
|
const t = useT()
|
|
60
62
|
const [items, setItems] = React.useState<Array<{ id: string; url: string; fileName: string; fileSize: number }>>([])
|
|
@@ -92,6 +94,7 @@ export const AttachmentInput = ({
|
|
|
92
94
|
if (!files || !entityId || !recordId) return
|
|
93
95
|
setError(null)
|
|
94
96
|
setUploading(true)
|
|
97
|
+
let uploadedCount = 0
|
|
95
98
|
try {
|
|
96
99
|
for (const file of Array.from(files)) {
|
|
97
100
|
const ext = (file.name || '').split('.').pop()?.toLowerCase() || ''
|
|
@@ -119,8 +122,10 @@ export const AttachmentInput = ({
|
|
|
119
122
|
setError(call.result?.error || t('attachments.library.upload.failed', 'Upload failed.'))
|
|
120
123
|
break
|
|
121
124
|
}
|
|
125
|
+
uploadedCount += 1
|
|
122
126
|
}
|
|
123
127
|
await load()
|
|
128
|
+
if (uploadedCount > 0) onUploaded?.()
|
|
124
129
|
} finally {
|
|
125
130
|
setUploading(false)
|
|
126
131
|
if (fileInputRef.current) {
|
|
@@ -10,6 +10,8 @@ export const attachmentCrudEvents: CrudEventsConfig<Attachment> = {
|
|
|
10
10
|
id: ctx.identifiers.id,
|
|
11
11
|
organizationId: ctx.identifiers.organizationId,
|
|
12
12
|
tenantId: ctx.identifiers.tenantId,
|
|
13
|
+
entityId: ctx.entity?.entityId ?? null,
|
|
14
|
+
recordId: ctx.entity?.recordId ?? null,
|
|
13
15
|
}),
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -4,6 +4,7 @@ import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
|
4
4
|
import { resolveFeatureCheckContext, resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
5
5
|
import type { RbacService } from '@open-mercato/core/modules/auth/services/rbacService'
|
|
6
6
|
import { CommandBus } from '@open-mercato/shared/lib/commands/command-bus'
|
|
7
|
+
import { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
7
8
|
import { ActionLogService } from '@open-mercato/core/modules/audit_logs/services/actionLogService'
|
|
8
9
|
import type { CommandRuntimeContext, CommandLogMetadata } from '@open-mercato/shared/lib/commands'
|
|
9
10
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
@@ -160,6 +161,12 @@ export async function POST(req: Request) {
|
|
|
160
161
|
}
|
|
161
162
|
return response
|
|
162
163
|
} catch (err) {
|
|
164
|
+
// Same contract as undo: a domain refusal carries an already-localized body the
|
|
165
|
+
// operator can act on, so surface it instead of a generic message.
|
|
166
|
+
if (isCrudHttpError(err)) {
|
|
167
|
+
logger.warn('Redo rejected', { err })
|
|
168
|
+
return NextResponse.json(err.body, { status: err.status })
|
|
169
|
+
}
|
|
163
170
|
logger.error('Redo failed', { err })
|
|
164
171
|
return NextResponse.json({ error: 'Redo failed' }, { status: 400 })
|
|
165
172
|
}
|
|
@@ -4,6 +4,7 @@ import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
|
4
4
|
import { resolveFeatureCheckContext, resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
5
5
|
import type { RbacService } from '@open-mercato/core/modules/auth/services/rbacService'
|
|
6
6
|
import { CommandBus } from '@open-mercato/shared/lib/commands/command-bus'
|
|
7
|
+
import { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
7
8
|
import { ActionLogService } from '@open-mercato/core/modules/audit_logs/services/actionLogService'
|
|
8
9
|
import type { CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
9
10
|
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
@@ -121,6 +122,14 @@ export async function POST(req: Request) {
|
|
|
121
122
|
await commandBus.undo(undoToken, ctx)
|
|
122
123
|
return NextResponse.json({ ok: true, logId: target.id })
|
|
123
124
|
} catch (err) {
|
|
125
|
+
// A command can refuse an undo for a domain reason the operator can act on — e.g.
|
|
126
|
+
// reverting a role grant would drop a tenant below a protected role's active-holder
|
|
127
|
+
// floor. Those arrive as CrudHttpError with an already-localized body, so pass them
|
|
128
|
+
// through verbatim instead of flattening every failure to a generic message.
|
|
129
|
+
if (isCrudHttpError(err)) {
|
|
130
|
+
logger.warn('Undo rejected', { err, logId: target.id })
|
|
131
|
+
return NextResponse.json(err.body, { status: err.status })
|
|
132
|
+
}
|
|
124
133
|
// A beforeUndo interceptor that blocked with an explicit status is a deliberate business
|
|
125
134
|
// rejection, not an undo failure — surface its status and message (issue #5045).
|
|
126
135
|
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
@@ -146,11 +146,11 @@ export default function AuditLogsPage() {
|
|
|
146
146
|
</Button>
|
|
147
147
|
), [loadWithState, actionsPage, actionsPageSize, accessPage, accessPageSize, loading, t])
|
|
148
148
|
|
|
149
|
-
const handleUndoError = React.useCallback(() => {
|
|
150
|
-
setError(t('audit_logs.error.undo'))
|
|
149
|
+
const handleUndoError = React.useCallback((reason?: string) => {
|
|
150
|
+
setError(reason || t('audit_logs.error.undo'))
|
|
151
151
|
}, [t])
|
|
152
|
-
const handleRedoError = React.useCallback(() => {
|
|
153
|
-
setError(t('audit_logs.error.redo'))
|
|
152
|
+
const handleRedoError = React.useCallback((reason?: string) => {
|
|
153
|
+
setError(reason || t('audit_logs.error.redo'))
|
|
154
154
|
}, [t])
|
|
155
155
|
|
|
156
156
|
const handleActionsPageChange = React.useCallback((nextPage: number) => {
|
|
@@ -16,6 +16,21 @@ import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
|
16
16
|
|
|
17
17
|
const logger = createLogger('audit_logs').child({ component: 'AuditLogsActions' })
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* `raiseCrudError` prefers the server's `error` body over the fallback message and stamps
|
|
21
|
+
* `status` on anything it builds from an HTTP response, so a numeric `status` is what
|
|
22
|
+
* distinguishes a route's refusal from a client-side failure. Without that check an
|
|
23
|
+
* offline or aborted request would put a raw "Failed to fetch" into the operator's
|
|
24
|
+
* banner; those keep the generic fallback instead.
|
|
25
|
+
*/
|
|
26
|
+
function resolveServerReason(err: unknown): string | undefined {
|
|
27
|
+
if (!(err instanceof Error)) return undefined
|
|
28
|
+
const status = (err as Error & { status?: unknown }).status
|
|
29
|
+
if (typeof status !== 'number') return undefined
|
|
30
|
+
const message = err.message?.trim()
|
|
31
|
+
return message ? message : undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
19
34
|
export type ActionLogItem = {
|
|
20
35
|
id: string
|
|
21
36
|
commandId: string
|
|
@@ -51,8 +66,9 @@ export function AuditLogsActions({
|
|
|
51
66
|
onRefresh: () => Promise<void>
|
|
52
67
|
isLoading?: boolean
|
|
53
68
|
headerExtras?: React.ReactNode
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
/** Receives the server's reason when it sent one, so the page can show why the undo was refused. */
|
|
70
|
+
onUndoError?: (reason?: string) => void
|
|
71
|
+
onRedoError?: (reason?: string) => void
|
|
56
72
|
pagination?: PaginationProps
|
|
57
73
|
}) {
|
|
58
74
|
const t = useT()
|
|
@@ -109,7 +125,7 @@ export function AuditLogsActions({
|
|
|
109
125
|
await onRefresh()
|
|
110
126
|
} catch (err) {
|
|
111
127
|
logger.error('Undo action failed', { err })
|
|
112
|
-
onUndoError?.()
|
|
128
|
+
onUndoError?.(resolveServerReason(err))
|
|
113
129
|
} finally {
|
|
114
130
|
setUndoingToken(null)
|
|
115
131
|
}
|
|
@@ -128,7 +144,7 @@ export function AuditLogsActions({
|
|
|
128
144
|
await onRefresh()
|
|
129
145
|
} catch (err) {
|
|
130
146
|
logger.error('Redo action failed', { err })
|
|
131
|
-
onRedoError?.()
|
|
147
|
+
onRedoError?.(resolveServerReason(err))
|
|
132
148
|
} finally {
|
|
133
149
|
setRedoingId(null)
|
|
134
150
|
}
|
|
@@ -120,8 +120,15 @@ export async function POST(req: Request) {
|
|
|
120
120
|
// wrong-password, and multi-tenant cases return an identical 401 with
|
|
121
121
|
// identical latency.
|
|
122
122
|
const ok = await auth.verifyPassword(user, parsed.data.password)
|
|
123
|
-
if (!user || !ok) {
|
|
124
|
-
|
|
123
|
+
if (!user || !ok || user.isConfirmed === false) {
|
|
124
|
+
// The 401 body stays identical for every branch so the response never reveals
|
|
125
|
+
// which one fired. `reason` goes to the audit stream instead, where separating a
|
|
126
|
+
// deactivated account from a mistyped password is the whole point — otherwise
|
|
127
|
+
// repeated attempts against a disabled account look like ordinary fat-fingering.
|
|
128
|
+
let reason: string
|
|
129
|
+
if (user && user.isConfirmed === false) reason = 'account_deactivated'
|
|
130
|
+
else if (user?.passwordHash) reason = 'invalid_password'
|
|
131
|
+
else reason = 'invalid_credentials'
|
|
125
132
|
void emitAuthEvent('auth.login.failed', { email: parsed.data.email, reason }).catch(() => undefined)
|
|
126
133
|
return NextResponse.json({ ok: false, error: translate('auth.login.errors.invalidCredentials', 'Invalid email or password') }, { status: 401 })
|
|
127
134
|
}
|
|
@@ -72,6 +72,7 @@ const userUpdateSchema = z.object({
|
|
|
72
72
|
password: passwordSchema.optional(),
|
|
73
73
|
organizationId: z.string().uuid().optional(),
|
|
74
74
|
roles: z.array(z.string()).optional(),
|
|
75
|
+
isConfirmed: z.boolean().optional(),
|
|
75
76
|
})
|
|
76
77
|
|
|
77
78
|
const userListItemSchema = z.object({
|
|
@@ -85,6 +86,7 @@ const userListItemSchema = z.object({
|
|
|
85
86
|
roles: z.array(z.string()),
|
|
86
87
|
roleIds: z.array(z.string().uuid()).optional(),
|
|
87
88
|
hasPassword: z.boolean().optional(),
|
|
89
|
+
isConfirmed: z.boolean(),
|
|
88
90
|
updatedAt: z.string().nullable().optional(),
|
|
89
91
|
})
|
|
90
92
|
|
|
@@ -476,6 +478,7 @@ export async function GET(req: Request) {
|
|
|
476
478
|
roles: roleMap[uid] || [],
|
|
477
479
|
roleIds: roleIdMap[uid] || [],
|
|
478
480
|
...(id ? { hasPassword: !!u.passwordHash } : {}),
|
|
481
|
+
isConfirmed: u.isConfirmed !== false,
|
|
479
482
|
updatedAt: u.updatedAt instanceof Date ? u.updatedAt.toISOString() : null,
|
|
480
483
|
...(cfByUser[uid] || {}),
|
|
481
484
|
}
|
|
@@ -662,7 +665,8 @@ export const openApi: OpenApiRouteDoc = {
|
|
|
662
665
|
},
|
|
663
666
|
PUT: {
|
|
664
667
|
summary: 'Update user',
|
|
665
|
-
description:
|
|
668
|
+
description:
|
|
669
|
+
'Updates profile fields including display name, organization assignment, credentials, or role memberships. Setting isConfirmed=false deactivates the account: the user can no longer sign in and every active session is revoked; isConfirmed=true reactivates it. A tenant cannot drop below a protected role\'s minimum active holder count, so revoking the role from, deactivating, moving, or deleting the last active administrator is rejected.',
|
|
666
670
|
requestBody: {
|
|
667
671
|
contentType: 'application/json',
|
|
668
672
|
schema: userUpdateSchema,
|
|
@@ -671,7 +675,7 @@ export const openApi: OpenApiRouteDoc = {
|
|
|
671
675
|
{ status: 200, description: 'User updated', schema: okResponseSchema },
|
|
672
676
|
],
|
|
673
677
|
errors: [
|
|
674
|
-
{ status: 400, description: 'Invalid payload', schema: errorResponseSchema },
|
|
678
|
+
{ status: 400, description: 'Invalid payload, duplicate email, or the update would remove the last active holder of a protected role', schema: errorResponseSchema },
|
|
675
679
|
{ status: 401, description: 'Unauthorized', schema: errorResponseSchema },
|
|
676
680
|
{ status: 403, description: 'Attempted to assign privileged roles', schema: errorResponseSchema },
|
|
677
681
|
{ status: 404, description: 'User not found', schema: errorResponseSchema },
|
|
@@ -679,13 +683,13 @@ export const openApi: OpenApiRouteDoc = {
|
|
|
679
683
|
},
|
|
680
684
|
DELETE: {
|
|
681
685
|
summary: 'Delete user',
|
|
682
|
-
description: 'Deletes a user by identifier. Undo support is provided via the command bus.',
|
|
686
|
+
description: 'Deletes a user by identifier. Rejected when the target is the last active holder of a protected role in the tenant. Undo support is provided via the command bus.',
|
|
683
687
|
query: z.object({ id: z.string().uuid().describe('User identifier') }),
|
|
684
688
|
responses: [
|
|
685
689
|
{ status: 200, description: 'User deleted', schema: okResponseSchema },
|
|
686
690
|
],
|
|
687
691
|
errors: [
|
|
688
|
-
{ status: 400, description: 'User cannot be deleted', schema: errorResponseSchema },
|
|
692
|
+
{ status: 400, description: 'User cannot be deleted, or is the last active holder of a protected role', schema: errorResponseSchema },
|
|
689
693
|
{ status: 401, description: 'Unauthorized', schema: errorResponseSchema },
|
|
690
694
|
{ status: 404, description: 'User not found', schema: errorResponseSchema },
|
|
691
695
|
],
|