@open-mercato/core 0.6.4-develop.4217.1.c9aa050183 → 0.6.4-develop.4239.1.4a264a5828
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/staff_time_entry/index.js +37 -0
- package/dist/generated/entities/staff_time_entry/index.js.map +7 -0
- package/dist/generated/entities/staff_time_entry_segment/index.js +23 -0
- package/dist/generated/entities/staff_time_entry_segment/index.js.map +7 -0
- package/dist/generated/entities/staff_time_project/index.js +35 -0
- package/dist/generated/entities/staff_time_project/index.js.map +7 -0
- package/dist/generated/entities/staff_time_project_member/index.js +29 -0
- package/dist/generated/entities/staff_time_project_member/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +5 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +64 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/timesheetFixtures.js +50 -0
- package/dist/helpers/integration/timesheetFixtures.js.map +7 -0
- package/dist/modules/attachments/api/library/[id]/route.js +20 -16
- package/dist/modules/attachments/api/library/[id]/route.js.map +2 -2
- package/dist/modules/attachments/api/route.js +18 -14
- package/dist/modules/attachments/api/route.js.map +2 -2
- package/dist/modules/auth/api/roles/acl/route.js +10 -4
- package/dist/modules/auth/api/roles/acl/route.js.map +2 -2
- package/dist/modules/auth/api/sidebar/preferences/route.js +27 -20
- package/dist/modules/auth/api/sidebar/preferences/route.js.map +2 -2
- package/dist/modules/auth/api/users/acl/route.js +16 -11
- package/dist/modules/auth/api/users/acl/route.js.map +2 -2
- package/dist/modules/auth/commands/users.js +87 -71
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/services/sidebarPreferencesService.js +39 -30
- package/dist/modules/auth/services/sidebarPreferencesService.js.map +2 -2
- package/dist/modules/business_rules/backend/logs/[id]/page.js +24 -5
- package/dist/modules/business_rules/backend/logs/[id]/page.js.map +2 -2
- package/dist/modules/catalog/api/offers/route.js +15 -5
- package/dist/modules/catalog/api/offers/route.js.map +2 -2
- package/dist/modules/catalog/commands/categories.js +61 -12
- package/dist/modules/catalog/commands/categories.js.map +2 -2
- package/dist/modules/catalog/commands/products.js +79 -54
- package/dist/modules/catalog/commands/products.js.map +2 -2
- package/dist/modules/catalog/commands/variants.js +29 -16
- package/dist/modules/catalog/commands/variants.js.map +2 -2
- package/dist/modules/currencies/backend/currencies/[id]/page.js +19 -2
- package/dist/modules/currencies/backend/currencies/[id]/page.js.map +2 -2
- package/dist/modules/currencies/commands/currencies.js +15 -8
- package/dist/modules/currencies/commands/currencies.js.map +2 -2
- package/dist/modules/customer_accounts/api/admin/users.js +27 -26
- package/dist/modules/customer_accounts/api/admin/users.js.map +2 -2
- package/dist/modules/customer_accounts/api/password/reset-confirm.js +5 -5
- package/dist/modules/customer_accounts/api/password/reset-confirm.js.map +2 -2
- package/dist/modules/customer_accounts/api/portal/users/[id]/roles.js +11 -10
- package/dist/modules/customer_accounts/api/portal/users/[id]/roles.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.js +27 -7
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js +27 -7
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js +29 -8
- package/dist/modules/customers/backend/customers/people/[id]/page.js.map +2 -2
- package/dist/modules/customers/commands/addresses.js +35 -21
- package/dist/modules/customers/commands/addresses.js.map +2 -2
- package/dist/modules/customers/commands/companies.js +163 -162
- package/dist/modules/customers/commands/companies.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +3 -4
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/customers/commands/interactions.js +19 -22
- package/dist/modules/customers/commands/interactions.js.map +2 -2
- package/dist/modules/customers/commands/people.js +18 -15
- package/dist/modules/customers/commands/people.js.map +2 -2
- package/dist/modules/customers/commands/personCompanyLinks.js +105 -94
- package/dist/modules/customers/commands/personCompanyLinks.js.map +2 -2
- package/dist/modules/customers/commands/pipeline-stages.js +30 -23
- package/dist/modules/customers/commands/pipeline-stages.js.map +2 -2
- package/dist/modules/customers/commands/pipelines.js +27 -20
- package/dist/modules/customers/commands/pipelines.js.map +2 -2
- package/dist/modules/customers/commands/tags.js +13 -5
- package/dist/modules/customers/commands/tags.js.map +2 -2
- package/dist/modules/dashboards/api/users/widgets/route.js +0 -1
- package/dist/modules/dashboards/api/users/widgets/route.js.map +2 -2
- package/dist/modules/dashboards/api/widgets/data/route.js +29 -1
- package/dist/modules/dashboards/api/widgets/data/route.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-engine.js +4 -4
- package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-run-service.js +51 -27
- package/dist/modules/data_sync/lib/sync-run-service.js.map +2 -2
- package/dist/modules/directory/commands/organizations.js +192 -158
- package/dist/modules/directory/commands/organizations.js.map +3 -3
- package/dist/modules/inbox_ops/api/emails/[id]/reprocess/route.js +22 -16
- package/dist/modules/inbox_ops/api/emails/[id]/reprocess/route.js.map +2 -2
- package/dist/modules/messages/commands/messages.js +77 -75
- package/dist/modules/messages/commands/messages.js.map +2 -2
- package/dist/modules/messages/commands/shared.js +132 -132
- package/dist/modules/messages/commands/shared.js.map +2 -2
- package/dist/modules/perspectives/api/[tableId]/route.js +37 -26
- package/dist/modules/perspectives/api/[tableId]/route.js.map +2 -2
- package/dist/modules/progress/acl.js +8 -4
- package/dist/modules/progress/acl.js.map +2 -2
- package/dist/modules/resources/commands/resources.js +125 -117
- package/dist/modules/resources/commands/resources.js.map +2 -2
- package/dist/modules/resources/commands/tags.js +7 -3
- package/dist/modules/resources/commands/tags.js.map +2 -2
- package/dist/modules/sales/api/quotes/send/route.js +12 -11
- package/dist/modules/sales/api/quotes/send/route.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +629 -478
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/commands/payments.js +146 -146
- package/dist/modules/sales/commands/payments.js.map +2 -2
- package/dist/modules/sales/commands/returns.js +68 -60
- package/dist/modules/sales/commands/returns.js.map +2 -2
- package/dist/modules/staff/acl.js +10 -1
- package/dist/modules/staff/acl.js.map +2 -2
- package/dist/modules/staff/analytics.js +33 -0
- package/dist/modules/staff/analytics.js.map +7 -0
- package/dist/modules/staff/api/guards.js +31 -0
- package/dist/modules/staff/api/guards.js.map +7 -0
- package/dist/modules/staff/api/interceptors.js +96 -0
- package/dist/modules/staff/api/interceptors.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +170 -0
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-projects/route.js +103 -0
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +147 -0
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +171 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +180 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +155 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +173 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +260 -0
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/route.js +188 -0
- package/dist/modules/staff/api/timesheets/time-entries/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js +159 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-projects/route.js +230 -0
- package/dist/modules/staff/api/timesheets/time-projects/route.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/page.js +710 -0
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js +22 -0
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js +125 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js +418 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js +79 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +602 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js +25 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js +123 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js.map +7 -0
- package/dist/modules/staff/cli.js +38 -1
- package/dist/modules/staff/cli.js.map +2 -2
- package/dist/modules/staff/commands/index.js +2 -0
- package/dist/modules/staff/commands/index.js.map +2 -2
- package/dist/modules/staff/commands/leave-requests.js +30 -28
- package/dist/modules/staff/commands/leave-requests.js.map +3 -3
- package/dist/modules/staff/commands/team-members.js +21 -20
- package/dist/modules/staff/commands/team-members.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js +409 -0
- package/dist/modules/staff/commands/timesheets-entries.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-projects.js +618 -0
- package/dist/modules/staff/commands/timesheets-projects.js.map +7 -0
- package/dist/modules/staff/data/enrichers.js +104 -0
- package/dist/modules/staff/data/enrichers.js.map +7 -0
- package/dist/modules/staff/data/entities.js +226 -1
- package/dist/modules/staff/data/entities.js.map +2 -2
- package/dist/modules/staff/data/validators.js +113 -1
- package/dist/modules/staff/data/validators.js.map +2 -2
- package/dist/modules/staff/events.js +13 -1
- package/dist/modules/staff/events.js.map +2 -2
- package/dist/modules/staff/lib/crud.js +7 -1
- package/dist/modules/staff/lib/crud.js.map +2 -2
- package/dist/modules/staff/lib/staffMemberResolver.js +15 -0
- package/dist/modules/staff/lib/staffMemberResolver.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectHoursTrend.js +60 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectHoursTrend.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectsKpis.js +260 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectsKpis.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/dateBuckets.js +41 -0
- package/dist/modules/staff/lib/timesheets-projects/dateBuckets.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/initials.js +10 -0
- package/dist/modules/staff/lib/timesheets-projects/initials.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/kpiMath.js +12 -0
- package/dist/modules/staff/lib/timesheets-projects/kpiMath.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/listProjectMembersPreview.js +55 -0
- package/dist/modules/staff/lib/timesheets-projects/listProjectMembersPreview.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/HoursSparkline.js +66 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/HoursSparkline.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js +81 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectMembersAvatarStack.js +58 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectMembersAvatarStack.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsKpiStrip.js +152 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsKpiStrip.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.js +37 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ViewModeToggle.js +57 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ViewModeToggle.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/useProjectsViewMode.js +50 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/useProjectsViewMode.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/AddRowDropdown.js +163 -0
- package/dist/modules/staff/lib/timesheets-ui/AddRowDropdown.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CalendarPicker.js +209 -0
- package/dist/modules/staff/lib/timesheets-ui/CalendarPicker.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/ColorPicker.js +52 -0
- package/dist/modules/staff/lib/timesheets-ui/ColorPicker.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js +77 -0
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/ListView.js +173 -0
- package/dist/modules/staff/lib/timesheets-ui/ListView.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/ProjectColorDot.js +32 -0
- package/dist/modules/staff/lib/timesheets-ui/ProjectColorDot.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js +270 -0
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/ViewSwitcher.js +57 -0
- package/dist/modules/staff/lib/timesheets-ui/ViewSwitcher.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/colors.js +43 -0
- package/dist/modules/staff/lib/timesheets-ui/colors.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260326135612.js +24 -0
- package/dist/modules/staff/migrations/Migration20260326135612.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260413102715.js +23 -0
- package/dist/modules/staff/migrations/Migration20260413102715.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260413111602.js +13 -0
- package/dist/modules/staff/migrations/Migration20260413111602.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260511112759.js +19 -0
- package/dist/modules/staff/migrations/Migration20260511112759.js.map +7 -0
- package/dist/modules/staff/search.js +35 -0
- package/dist/modules/staff/search.js.map +2 -2
- package/dist/modules/staff/setup.js +15 -1
- package/dist/modules/staff/setup.js.map +2 -2
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/config.js +16 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/config.js.map +7 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.js +126 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.js.map +7 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.js +26 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.js.map +7 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/config.js +15 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/config.js.map +7 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.js +238 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.js.map +7 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.js +26 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.js.map +7 -0
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js +145 -0
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js.map +7 -0
- package/dist/modules/staff/widgets/injection-table.js +12 -0
- package/dist/modules/staff/widgets/injection-table.js.map +7 -0
- package/dist/modules/sync_excel/api/import/route.js +19 -17
- package/dist/modules/sync_excel/api/import/route.js.map +2 -2
- package/dist/modules/translations/commands/translations.js +22 -19
- package/dist/modules/translations/commands/translations.js.map +2 -2
- package/dist/modules/workflows/backend/events/[id]/page.js +24 -6
- package/dist/modules/workflows/backend/events/[id]/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/[id]/page.js +27 -5
- package/dist/modules/workflows/backend/instances/[id]/page.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/[id]/page.js +25 -6
- package/dist/modules/workflows/backend/tasks/[id]/page.js.map +2 -2
- package/generated/entities/staff_time_entry/index.ts +17 -0
- package/generated/entities/staff_time_entry_segment/index.ts +10 -0
- package/generated/entities/staff_time_project/index.ts +16 -0
- package/generated/entities/staff_time_project_member/index.ts +13 -0
- package/generated/entities.ids.generated.ts +5 -1
- package/generated/entity-fields-registry.ts +64 -0
- package/package.json +7 -7
- package/src/helpers/integration/timesheetFixtures.ts +61 -0
- package/src/modules/attachments/api/library/[id]/route.ts +24 -17
- package/src/modules/attachments/api/route.ts +20 -14
- package/src/modules/auth/api/roles/acl/route.ts +11 -5
- package/src/modules/auth/api/sidebar/preferences/route.ts +33 -24
- package/src/modules/auth/api/users/acl/route.ts +17 -12
- package/src/modules/auth/commands/users.ts +96 -80
- package/src/modules/auth/services/sidebarPreferencesService.ts +40 -32
- package/src/modules/business_rules/backend/logs/[id]/page.tsx +32 -7
- package/src/modules/catalog/api/offers/route.ts +20 -5
- package/src/modules/catalog/commands/categories.ts +61 -12
- package/src/modules/catalog/commands/products.ts +93 -60
- package/src/modules/catalog/commands/variants.ts +29 -16
- package/src/modules/currencies/backend/currencies/[id]/page.tsx +21 -2
- package/src/modules/currencies/commands/currencies.ts +27 -14
- package/src/modules/currencies/i18n/de.json +1 -0
- package/src/modules/currencies/i18n/en.json +1 -0
- package/src/modules/currencies/i18n/es.json +1 -0
- package/src/modules/currencies/i18n/pl.json +1 -0
- package/src/modules/customer_accounts/api/admin/users.ts +31 -26
- package/src/modules/customer_accounts/api/password/reset-confirm.ts +5 -6
- package/src/modules/customer_accounts/api/portal/users/[id]/roles.ts +14 -13
- package/src/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.tsx +34 -11
- package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/page.tsx +34 -11
- package/src/modules/customers/backend/customers/people/[id]/page.tsx +35 -11
- package/src/modules/customers/commands/addresses.ts +35 -23
- package/src/modules/customers/commands/companies.ts +166 -165
- package/src/modules/customers/commands/deals.ts +2 -4
- package/src/modules/customers/commands/interactions.ts +20 -26
- package/src/modules/customers/commands/people.ts +18 -15
- package/src/modules/customers/commands/personCompanyLinks.ts +109 -100
- package/src/modules/customers/commands/pipeline-stages.ts +31 -27
- package/src/modules/customers/commands/pipelines.ts +29 -23
- package/src/modules/customers/commands/tags.ts +13 -5
- package/src/modules/dashboards/api/users/widgets/route.ts +0 -1
- package/src/modules/dashboards/api/widgets/data/route.ts +36 -1
- package/src/modules/data_sync/lib/sync-engine.ts +4 -5
- package/src/modules/data_sync/lib/sync-run-service.ts +57 -28
- package/src/modules/directory/commands/organizations.ts +203 -166
- package/src/modules/inbox_ops/api/emails/[id]/reprocess/route.ts +26 -18
- package/src/modules/messages/commands/messages.ts +82 -80
- package/src/modules/messages/commands/shared.ts +138 -133
- package/src/modules/perspectives/api/[tableId]/route.ts +38 -27
- package/src/modules/progress/acl.ts +4 -0
- package/src/modules/resources/commands/resources.ts +127 -117
- package/src/modules/resources/commands/tags.ts +7 -3
- package/src/modules/sales/api/quotes/send/route.ts +17 -12
- package/src/modules/sales/commands/documents.ts +673 -481
- package/src/modules/sales/commands/payments.ts +158 -152
- package/src/modules/sales/commands/returns.ts +74 -63
- package/src/modules/staff/acl.ts +11 -0
- package/src/modules/staff/analytics.ts +30 -0
- package/src/modules/staff/api/guards.ts +59 -0
- package/src/modules/staff/api/interceptors.ts +122 -0
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +191 -0
- package/src/modules/staff/api/timesheets/my-projects/route.ts +115 -0
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +159 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +187 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +191 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +168 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +191 -0
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +292 -0
- package/src/modules/staff/api/timesheets/time-entries/route.ts +193 -0
- package/src/modules/staff/api/timesheets/time-projects/[id]/employees/route.ts +167 -0
- package/src/modules/staff/api/timesheets/time-projects/route.ts +244 -0
- package/src/modules/staff/backend/staff/timesheets/page.meta.ts +20 -0
- package/src/modules/staff/backend/staff/timesheets/page.tsx +899 -0
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.tsx +141 -0
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.tsx +579 -0
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.tsx +90 -0
- package/src/modules/staff/backend/staff/timesheets/projects/page.meta.ts +23 -0
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +765 -0
- package/src/modules/staff/backend/staff/timesheets/projects/projectFormConfig.ts +138 -0
- package/src/modules/staff/cli.ts +40 -1
- package/src/modules/staff/commands/index.ts +2 -0
- package/src/modules/staff/commands/leave-requests.ts +37 -29
- package/src/modules/staff/commands/team-members.ts +25 -20
- package/src/modules/staff/commands/timesheets-entries.ts +504 -0
- package/src/modules/staff/commands/timesheets-projects.ts +699 -0
- package/src/modules/staff/data/enrichers.ts +134 -0
- package/src/modules/staff/data/entities.ts +198 -0
- package/src/modules/staff/data/validators.ts +129 -0
- package/src/modules/staff/events.ts +13 -0
- package/src/modules/staff/i18n/de.json +209 -1
- package/src/modules/staff/i18n/en.json +209 -1
- package/src/modules/staff/i18n/es.json +209 -1
- package/src/modules/staff/i18n/pl.json +209 -1
- package/src/modules/staff/lib/crud.ts +8 -0
- package/src/modules/staff/lib/staffMemberResolver.ts +22 -0
- package/src/modules/staff/lib/timesheets-projects/computeProjectHoursTrend.ts +89 -0
- package/src/modules/staff/lib/timesheets-projects/computeProjectsKpis.ts +311 -0
- package/src/modules/staff/lib/timesheets-projects/dateBuckets.ts +37 -0
- package/src/modules/staff/lib/timesheets-projects/initials.ts +6 -0
- package/src/modules/staff/lib/timesheets-projects/kpiMath.ts +8 -0
- package/src/modules/staff/lib/timesheets-projects/listProjectMembersPreview.ts +83 -0
- package/src/modules/staff/lib/timesheets-projects-ui/HoursSparkline.tsx +75 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectCard.tsx +110 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectMembersAvatarStack.tsx +73 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectsKpiStrip.tsx +185 -0
- package/src/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.tsx +53 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ViewModeToggle.tsx +63 -0
- package/src/modules/staff/lib/timesheets-projects-ui/useProjectsViewMode.ts +63 -0
- package/src/modules/staff/lib/timesheets-ui/AddRowDropdown.tsx +188 -0
- package/src/modules/staff/lib/timesheets-ui/CalendarPicker.tsx +229 -0
- package/src/modules/staff/lib/timesheets-ui/ColorPicker.tsx +65 -0
- package/src/modules/staff/lib/timesheets-ui/CreateProjectDialog.tsx +99 -0
- package/src/modules/staff/lib/timesheets-ui/ListView.tsx +230 -0
- package/src/modules/staff/lib/timesheets-ui/ProjectColorDot.tsx +40 -0
- package/src/modules/staff/lib/timesheets-ui/TimerBar.tsx +327 -0
- package/src/modules/staff/lib/timesheets-ui/ViewSwitcher.tsx +60 -0
- package/src/modules/staff/lib/timesheets-ui/colors.ts +58 -0
- package/src/modules/staff/migrations/.snapshot-open-mercato.json +1148 -0
- package/src/modules/staff/migrations/Migration20260326135612.ts +26 -0
- package/src/modules/staff/migrations/Migration20260413102715.ts +25 -0
- package/src/modules/staff/migrations/Migration20260413111602.ts +13 -0
- package/src/modules/staff/migrations/Migration20260511112759.ts +21 -0
- package/src/modules/staff/search.ts +35 -0
- package/src/modules/staff/setup.ts +15 -0
- package/src/modules/staff/widgets/dashboard/timesheets-hours-by-project/config.ts +17 -0
- package/src/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.tsx +158 -0
- package/src/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.ts +25 -0
- package/src/modules/staff/widgets/dashboard/timesheets-time-reporting/config.ts +15 -0
- package/src/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.tsx +297 -0
- package/src/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.ts +25 -0
- package/src/modules/staff/widgets/injection/timer-sidebar-indicator/widget.tsx +161 -0
- package/src/modules/staff/widgets/injection-table.ts +10 -0
- package/src/modules/sync_excel/api/import/route.ts +23 -18
- package/src/modules/translations/commands/translations.ts +49 -41
- package/src/modules/workflows/backend/events/[id]/page.tsx +32 -10
- package/src/modules/workflows/backend/instances/[id]/page.tsx +33 -9
- package/src/modules/workflows/backend/tasks/[id]/page.tsx +33 -10
- package/src/modules/workflows/i18n/de.json +1 -0
- package/src/modules/workflows/i18n/en.json +1 -0
- package/src/modules/workflows/i18n/es.json +1 -0
- package/src/modules/workflows/i18n/pl.json +1 -0
|
@@ -2,6 +2,7 @@ import { registerCommand } from "@open-mercato/shared/lib/commands";
|
|
|
2
2
|
import { CrudHttpError } from "@open-mercato/shared/lib/crud/errors";
|
|
3
3
|
import { findOneWithDecryption } from "@open-mercato/shared/lib/encryption/find";
|
|
4
4
|
import { buildChanges, emitCrudSideEffects, emitCrudUndoSideEffects, parseWithCustomFields, setCustomFieldsIfAny } from "@open-mercato/shared/lib/commands/helpers";
|
|
5
|
+
import { withAtomicFlush } from "@open-mercato/shared/lib/commands/flush";
|
|
5
6
|
import { buildCustomFieldResetMap, diffCustomFieldChanges, loadCustomFieldSnapshot } from "@open-mercato/shared/lib/commands/customFieldSnapshots";
|
|
6
7
|
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
7
8
|
import { Dictionary, DictionaryEntry } from "@open-mercato/core/modules/dictionaries/data/entities";
|
|
@@ -172,8 +173,18 @@ const createResourceCommand = {
|
|
|
172
173
|
createdAt: now,
|
|
173
174
|
updatedAt: now
|
|
174
175
|
});
|
|
175
|
-
em
|
|
176
|
-
|
|
176
|
+
await withAtomicFlush(em, [
|
|
177
|
+
async () => {
|
|
178
|
+
em.persist(record);
|
|
179
|
+
await em.flush();
|
|
180
|
+
},
|
|
181
|
+
() => syncResourcesResourceTags(em, {
|
|
182
|
+
resourceId: record.id,
|
|
183
|
+
organizationId: record.organizationId,
|
|
184
|
+
tenantId: record.tenantId,
|
|
185
|
+
tagIds: parsed.tags
|
|
186
|
+
})
|
|
187
|
+
], { transaction: true });
|
|
177
188
|
const dataEngine = ctx.container.resolve("dataEngine");
|
|
178
189
|
await setCustomFieldsIfAny({
|
|
179
190
|
dataEngine,
|
|
@@ -183,13 +194,6 @@ const createResourceCommand = {
|
|
|
183
194
|
organizationId: record.organizationId,
|
|
184
195
|
values: custom
|
|
185
196
|
});
|
|
186
|
-
await syncResourcesResourceTags(em, {
|
|
187
|
-
resourceId: record.id,
|
|
188
|
-
organizationId: record.organizationId,
|
|
189
|
-
tenantId: record.tenantId,
|
|
190
|
-
tagIds: parsed.tags
|
|
191
|
-
});
|
|
192
|
-
await em.flush();
|
|
193
197
|
await emitCrudSideEffects({
|
|
194
198
|
dataEngine,
|
|
195
199
|
action: "created",
|
|
@@ -282,42 +286,40 @@ const updateResourceCommand = {
|
|
|
282
286
|
if (!record) throw new CrudHttpError(404, { error: "Resources resource not found." });
|
|
283
287
|
ensureTenantScope(ctx, record.tenantId);
|
|
284
288
|
ensureOrganizationScope(ctx, record.organizationId);
|
|
289
|
+
let capacityUnit;
|
|
285
290
|
if (parsed.capacityUnitValue !== void 0) {
|
|
286
291
|
const unitValue = typeof parsed.capacityUnitValue === "string" ? parsed.capacityUnitValue.trim() : "";
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
record.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
} else {
|
|
293
|
-
const unitSnapshot = await resolveCapacityUnit(
|
|
294
|
-
em,
|
|
295
|
-
{ tenantId: record.tenantId, organizationId: record.organizationId },
|
|
296
|
-
unitValue
|
|
297
|
-
);
|
|
298
|
-
record.capacityUnitValue = unitSnapshot.value;
|
|
299
|
-
record.capacityUnitName = unitSnapshot.name;
|
|
300
|
-
record.capacityUnitColor = unitSnapshot.color;
|
|
301
|
-
record.capacityUnitIcon = unitSnapshot.icon;
|
|
302
|
-
}
|
|
292
|
+
capacityUnit = unitValue ? await resolveCapacityUnit(
|
|
293
|
+
em,
|
|
294
|
+
{ tenantId: record.tenantId, organizationId: record.organizationId },
|
|
295
|
+
unitValue
|
|
296
|
+
) : null;
|
|
303
297
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
298
|
+
await withAtomicFlush(em, [
|
|
299
|
+
() => {
|
|
300
|
+
if (parsed.capacityUnitValue !== void 0) {
|
|
301
|
+
record.capacityUnitValue = capacityUnit?.value ?? null;
|
|
302
|
+
record.capacityUnitName = capacityUnit?.name ?? null;
|
|
303
|
+
record.capacityUnitColor = capacityUnit?.color ?? null;
|
|
304
|
+
record.capacityUnitIcon = capacityUnit?.icon ?? null;
|
|
305
|
+
}
|
|
306
|
+
if (parsed.name !== void 0) record.name = parsed.name;
|
|
307
|
+
if (parsed.description !== void 0) record.description = parsed.description ?? null;
|
|
308
|
+
if (parsed.resourceTypeId !== void 0) record.resourceTypeId = parsed.resourceTypeId ?? null;
|
|
309
|
+
if (parsed.capacity !== void 0) record.capacity = parsed.capacity ?? null;
|
|
310
|
+
if (parsed.appearanceIcon !== void 0) record.appearanceIcon = parsed.appearanceIcon ?? null;
|
|
311
|
+
if (parsed.appearanceColor !== void 0) record.appearanceColor = parsed.appearanceColor ?? null;
|
|
312
|
+
if (parsed.availabilityRuleSetId !== void 0) record.availabilityRuleSetId = parsed.availabilityRuleSetId ?? null;
|
|
313
|
+
record.updatedAt = /* @__PURE__ */ new Date();
|
|
314
|
+
if (parsed.isActive !== void 0) record.isActive = parsed.isActive;
|
|
315
|
+
},
|
|
316
|
+
() => syncResourcesResourceTags(em, {
|
|
317
|
+
resourceId: record.id,
|
|
318
|
+
organizationId: record.organizationId,
|
|
319
|
+
tenantId: record.tenantId,
|
|
320
|
+
tagIds: parsed.tags
|
|
321
|
+
})
|
|
322
|
+
], { transaction: true });
|
|
321
323
|
const dataEngine = ctx.container.resolve("dataEngine");
|
|
322
324
|
await setCustomFieldsIfAny({
|
|
323
325
|
dataEngine,
|
|
@@ -402,28 +404,30 @@ const updateResourceCommand = {
|
|
|
402
404
|
const em = ctx.container.resolve("em").fork();
|
|
403
405
|
const record = await em.findOne(ResourcesResource, { id: before.id });
|
|
404
406
|
if (!record) return;
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
407
|
+
await withAtomicFlush(em, [
|
|
408
|
+
() => {
|
|
409
|
+
record.name = before.name;
|
|
410
|
+
record.description = before.description ?? null;
|
|
411
|
+
record.resourceTypeId = before.resourceTypeId ?? null;
|
|
412
|
+
record.capacity = before.capacity ?? null;
|
|
413
|
+
record.capacityUnitValue = before.capacityUnitValue ?? null;
|
|
414
|
+
record.capacityUnitName = before.capacityUnitName ?? null;
|
|
415
|
+
record.capacityUnitColor = before.capacityUnitColor ?? null;
|
|
416
|
+
record.capacityUnitIcon = before.capacityUnitIcon ?? null;
|
|
417
|
+
record.appearanceIcon = before.appearanceIcon ?? null;
|
|
418
|
+
record.appearanceColor = before.appearanceColor ?? null;
|
|
419
|
+
record.isActive = before.isActive;
|
|
420
|
+
record.availabilityRuleSetId = before.availabilityRuleSetId ?? null;
|
|
421
|
+
record.deletedAt = before.deletedAt ? new Date(before.deletedAt) : null;
|
|
422
|
+
record.updatedAt = /* @__PURE__ */ new Date();
|
|
423
|
+
},
|
|
424
|
+
() => syncResourcesResourceTags(em, {
|
|
425
|
+
resourceId: record.id,
|
|
426
|
+
organizationId: record.organizationId,
|
|
427
|
+
tenantId: record.tenantId,
|
|
428
|
+
tagIds: before.tags
|
|
429
|
+
})
|
|
430
|
+
], { transaction: true });
|
|
427
431
|
const dataEngine = ctx.container.resolve("dataEngine");
|
|
428
432
|
const customBefore = payload.customBefore ?? fallbackCustomBefore ?? void 0;
|
|
429
433
|
const customAfter = payload.customAfter ?? fallbackCustomAfter ?? void 0;
|
|
@@ -523,52 +527,56 @@ const deleteResourceCommand = {
|
|
|
523
527
|
const fallbackCustomBefore = before.customFields ?? null;
|
|
524
528
|
const em = ctx.container.resolve("em").fork();
|
|
525
529
|
let record = await em.findOne(ResourcesResource, { id: before.id });
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
530
|
+
await withAtomicFlush(em, [
|
|
531
|
+
async () => {
|
|
532
|
+
if (!record) {
|
|
533
|
+
record = em.create(ResourcesResource, {
|
|
534
|
+
id: before.id,
|
|
535
|
+
tenantId: before.tenantId,
|
|
536
|
+
organizationId: before.organizationId,
|
|
537
|
+
name: before.name,
|
|
538
|
+
description: before.description ?? null,
|
|
539
|
+
resourceTypeId: before.resourceTypeId ?? null,
|
|
540
|
+
capacity: before.capacity ?? null,
|
|
541
|
+
capacityUnitValue: before.capacityUnitValue ?? null,
|
|
542
|
+
capacityUnitName: before.capacityUnitName ?? null,
|
|
543
|
+
capacityUnitColor: before.capacityUnitColor ?? null,
|
|
544
|
+
capacityUnitIcon: before.capacityUnitIcon ?? null,
|
|
545
|
+
appearanceIcon: before.appearanceIcon ?? null,
|
|
546
|
+
appearanceColor: before.appearanceColor ?? null,
|
|
547
|
+
isActive: before.isActive,
|
|
548
|
+
availabilityRuleSetId: before.availabilityRuleSetId ?? null,
|
|
549
|
+
deletedAt: null,
|
|
550
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
551
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
552
|
+
});
|
|
553
|
+
em.persist(record);
|
|
554
|
+
} else {
|
|
555
|
+
record.name = before.name;
|
|
556
|
+
record.description = before.description ?? null;
|
|
557
|
+
record.resourceTypeId = before.resourceTypeId ?? null;
|
|
558
|
+
record.capacity = before.capacity ?? null;
|
|
559
|
+
record.capacityUnitValue = before.capacityUnitValue ?? null;
|
|
560
|
+
record.capacityUnitName = before.capacityUnitName ?? null;
|
|
561
|
+
record.capacityUnitColor = before.capacityUnitColor ?? null;
|
|
562
|
+
record.capacityUnitIcon = before.capacityUnitIcon ?? null;
|
|
563
|
+
record.appearanceIcon = before.appearanceIcon ?? null;
|
|
564
|
+
record.appearanceColor = before.appearanceColor ?? null;
|
|
565
|
+
record.isActive = before.isActive;
|
|
566
|
+
record.availabilityRuleSetId = before.availabilityRuleSetId ?? null;
|
|
567
|
+
record.deletedAt = null;
|
|
568
|
+
record.updatedAt = /* @__PURE__ */ new Date();
|
|
569
|
+
}
|
|
570
|
+
await em.flush();
|
|
571
|
+
},
|
|
572
|
+
() => syncResourcesResourceTags(em, {
|
|
573
|
+
resourceId: record.id,
|
|
574
|
+
organizationId: record.organizationId,
|
|
575
|
+
tenantId: record.tenantId,
|
|
576
|
+
tagIds: before.tags
|
|
577
|
+
})
|
|
578
|
+
], { transaction: true });
|
|
579
|
+
const resolvedRecord = record;
|
|
572
580
|
const dataEngine = ctx.container.resolve("dataEngine");
|
|
573
581
|
const customBefore = payload.customBefore ?? fallbackCustomBefore ?? void 0;
|
|
574
582
|
if (customBefore) {
|
|
@@ -576,20 +584,20 @@ const deleteResourceCommand = {
|
|
|
576
584
|
await setCustomFieldsIfAny({
|
|
577
585
|
dataEngine,
|
|
578
586
|
entityId: E.resources.resources_resource,
|
|
579
|
-
recordId:
|
|
580
|
-
tenantId:
|
|
581
|
-
organizationId:
|
|
587
|
+
recordId: resolvedRecord.id,
|
|
588
|
+
tenantId: resolvedRecord.tenantId,
|
|
589
|
+
organizationId: resolvedRecord.organizationId,
|
|
582
590
|
values: reset
|
|
583
591
|
});
|
|
584
592
|
}
|
|
585
593
|
await emitCrudUndoSideEffects({
|
|
586
594
|
dataEngine,
|
|
587
595
|
action: "created",
|
|
588
|
-
entity:
|
|
596
|
+
entity: resolvedRecord,
|
|
589
597
|
identifiers: {
|
|
590
|
-
id:
|
|
591
|
-
organizationId:
|
|
592
|
-
tenantId:
|
|
598
|
+
id: resolvedRecord.id,
|
|
599
|
+
organizationId: resolvedRecord.organizationId,
|
|
600
|
+
tenantId: resolvedRecord.tenantId
|
|
593
601
|
},
|
|
594
602
|
events: resourcesResourceCrudEvents,
|
|
595
603
|
indexer: resourceCrudIndexer
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/resources/commands/resources.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CommandHandler } from '@open-mercato/shared/lib/commands'\nimport { registerCommand } from '@open-mercato/shared/lib/commands'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { buildChanges, emitCrudSideEffects, emitCrudUndoSideEffects, parseWithCustomFields, setCustomFieldsIfAny } from '@open-mercato/shared/lib/commands/helpers'\nimport { buildCustomFieldResetMap, diffCustomFieldChanges, loadCustomFieldSnapshot, type CustomFieldSnapshot } from '@open-mercato/shared/lib/commands/customFieldSnapshots'\nimport type { DataEngine } from '@open-mercato/shared/lib/data/engine'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport type { CrudIndexerConfig } from '@open-mercato/shared/lib/crud/types'\nimport { Dictionary, DictionaryEntry } from '@open-mercato/core/modules/dictionaries/data/entities'\nimport { ResourcesResource, ResourcesResourceTag, ResourcesResourceTagAssignment } from '../data/entities'\nimport {\n resourcesResourceCreateSchema,\n resourcesResourceUpdateSchema,\n type ResourcesResourceCreateInput,\n type ResourcesResourceUpdateInput,\n} from '../data/validators'\nimport { resourcesResourceCrudEvents } from '../lib/crud'\nimport { ensureOrganizationScope, ensureTenantScope, extractUndoPayload } from './shared'\nimport { RESOURCES_CAPACITY_UNIT_DICTIONARY_KEY } from '../lib/capacityUnits'\nimport { E } from '#generated/entities.ids.generated'\n\nconst resourceCrudIndexer: CrudIndexerConfig<ResourcesResource> = {\n entityType: E.resources.resources_resource,\n}\n\ntype CapacityUnitSnapshot = {\n value: string\n name: string\n color: string | null\n icon: string | null\n}\n\ntype ResourceSnapshot = {\n id: string\n tenantId: string\n organizationId: string\n name: string\n description: string | null\n resourceTypeId: string | null\n capacity: number | null\n capacityUnitValue: string | null\n capacityUnitName: string | null\n capacityUnitColor: string | null\n capacityUnitIcon: string | null\n appearanceIcon: string | null\n appearanceColor: string | null\n isActive: boolean\n availabilityRuleSetId: string | null\n tags: string[]\n deletedAt: string | null\n customFields?: CustomFieldSnapshot | null\n}\n\ntype ResourceUndoPayload = {\n before?: ResourceSnapshot | null\n after?: ResourceSnapshot | null\n customBefore?: CustomFieldSnapshot | null\n customAfter?: CustomFieldSnapshot | null\n}\n\nasync function resolveCapacityUnit(\n em: EntityManager,\n scope: { tenantId: string; organizationId: string },\n rawValue: string,\n): Promise<CapacityUnitSnapshot> {\n const trimmed = rawValue.trim()\n if (!trimmed) {\n throw new CrudHttpError(400, { error: 'Capacity unit is required.' })\n }\n const dictionary = await findOneWithDecryption(\n em,\n Dictionary,\n {\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n key: RESOURCES_CAPACITY_UNIT_DICTIONARY_KEY,\n deletedAt: null,\n isActive: true,\n },\n undefined,\n scope,\n )\n if (!dictionary) {\n throw new CrudHttpError(400, { error: 'Capacity unit dictionary is not configured.' })\n }\n const normalizedValue = trimmed.toLowerCase()\n const entry = await findOneWithDecryption(\n em,\n DictionaryEntry,\n {\n dictionary,\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n normalizedValue,\n },\n { populate: ['dictionary'] },\n scope,\n )\n if (!entry) {\n throw new CrudHttpError(400, { error: 'Capacity unit not found.' })\n }\n return {\n value: entry.value,\n name: entry.label?.trim().length ? entry.label : entry.value,\n color: entry.color ?? null,\n icon: entry.icon ?? null,\n }\n}\n\nfunction normalizeTagIds(tags?: Array<string | null | undefined>): string[] {\n if (!Array.isArray(tags)) return []\n const set = new Set<string>()\n tags.forEach((id) => {\n if (typeof id === 'string' && id.trim().length > 0) set.add(id.trim())\n })\n return Array.from(set)\n}\n\nasync function loadResourceSnapshot(em: EntityManager, id: string): Promise<ResourceSnapshot | null> {\n const resource = await findOneWithDecryption(\n em,\n ResourcesResource,\n { id },\n undefined,\n { tenantId: null, organizationId: null },\n )\n if (!resource) return null\n const assignments = await em.find(\n ResourcesResourceTagAssignment,\n { resource: resource.id },\n { populate: ['tag'] },\n )\n const tags = assignments\n .map((assignment) => (assignment.tag as ResourcesResourceTag | undefined)?.id ?? null)\n .filter((tagId): tagId is string => typeof tagId === 'string' && tagId.length > 0)\n .sort((a, b) => a.localeCompare(b))\n return {\n id: resource.id,\n tenantId: resource.tenantId,\n organizationId: resource.organizationId,\n name: resource.name,\n description: resource.description ?? null,\n resourceTypeId: resource.resourceTypeId ?? null,\n capacity: resource.capacity ?? null,\n capacityUnitValue: resource.capacityUnitValue ?? null,\n capacityUnitName: resource.capacityUnitName ?? null,\n capacityUnitColor: resource.capacityUnitColor ?? null,\n capacityUnitIcon: resource.capacityUnitIcon ?? null,\n appearanceIcon: resource.appearanceIcon ?? null,\n appearanceColor: resource.appearanceColor ?? null,\n isActive: resource.isActive,\n availabilityRuleSetId: resource.availabilityRuleSetId ?? null,\n tags,\n deletedAt: resource.deletedAt ? resource.deletedAt.toISOString() : null,\n }\n}\n\nasync function loadResourceCustomSnapshot(em: EntityManager, snapshot: ResourceSnapshot): Promise<CustomFieldSnapshot> {\n return loadCustomFieldSnapshot(em, {\n entityId: E.resources.resources_resource,\n recordId: snapshot.id,\n tenantId: snapshot.tenantId,\n organizationId: snapshot.organizationId,\n })\n}\n\nasync function syncResourcesResourceTags(em: EntityManager, params: {\n resourceId: string\n organizationId: string\n tenantId: string\n tagIds?: Array<string | null | undefined> | null\n}) {\n if (params.tagIds === undefined) return\n const tagIds = normalizeTagIds(params.tagIds ?? [])\n if (tagIds.length === 0) {\n await em.nativeDelete(ResourcesResourceTagAssignment, { resource: params.resourceId })\n return\n }\n const tagsInScope = await em.find(ResourcesResourceTag, {\n id: { $in: tagIds },\n organizationId: params.organizationId,\n tenantId: params.tenantId,\n })\n if (tagsInScope.length !== tagIds.length) {\n throw new CrudHttpError(400, { error: 'One or more tags not found for this scope' })\n }\n const byId = new Map(tagsInScope.map((tag) => [tag.id, tag]))\n await em.nativeDelete(ResourcesResourceTagAssignment, { resource: params.resourceId })\n const resource = em.getReference(ResourcesResource, params.resourceId)\n for (const tagId of tagIds) {\n const tag = byId.get(tagId)\n if (!tag) continue\n const assignment = em.create(ResourcesResourceTagAssignment, {\n organizationId: params.organizationId,\n tenantId: params.tenantId,\n resource,\n tag,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(assignment)\n }\n}\n\nconst createResourceCommand: CommandHandler<ResourcesResourceCreateInput, { resourceId: string }> = {\n id: 'resources.resources.create',\n async execute(rawInput, ctx) {\n const { parsed, custom } = parseWithCustomFields(resourcesResourceCreateSchema, rawInput)\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const now = new Date()\n const unitValue =\n typeof parsed.capacityUnitValue === 'string' ? parsed.capacityUnitValue.trim() : ''\n const unitSnapshot = unitValue\n ? await resolveCapacityUnit(em, { tenantId: parsed.tenantId, organizationId: parsed.organizationId }, unitValue)\n : null\n const record = em.create(ResourcesResource, {\n tenantId: parsed.tenantId,\n organizationId: parsed.organizationId,\n name: parsed.name,\n description: parsed.description ?? null,\n resourceTypeId: parsed.resourceTypeId ?? null,\n capacity: parsed.capacity ?? null,\n capacityUnitValue: unitSnapshot?.value ?? null,\n capacityUnitName: unitSnapshot?.name ?? null,\n capacityUnitColor: unitSnapshot?.color ?? null,\n capacityUnitIcon: unitSnapshot?.icon ?? null,\n appearanceIcon: parsed.appearanceIcon ?? null,\n appearanceColor: parsed.appearanceColor ?? null,\n isActive: parsed.isActive ?? true,\n availabilityRuleSetId: parsed.availabilityRuleSetId ?? null,\n createdAt: now,\n updatedAt: now,\n })\n em.persist(record)\n await em.flush()\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n await setCustomFieldsIfAny({\n dataEngine,\n entityId: E.resources.resources_resource,\n recordId: record.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n values: custom,\n })\n await syncResourcesResourceTags(em, {\n resourceId: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n tagIds: parsed.tags,\n })\n await em.flush()\n await emitCrudSideEffects({\n dataEngine,\n action: 'created',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n return { resourceId: record.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const snapshot = await loadResourceSnapshot(em, result.resourceId)\n if (!snapshot) return null\n const custom = await loadResourceCustomSnapshot(em, snapshot)\n return { snapshot, custom }\n },\n buildLog: async ({ result, ctx }) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const snapshot = await loadResourceSnapshot(em, result?.resourceId ?? '')\n if (!snapshot) return null\n const custom = await loadResourceCustomSnapshot(em, snapshot)\n const snapshotWithCustom: ResourceSnapshot = custom\n ? { ...snapshot, customFields: custom }\n : snapshot\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('resources.audit.resources.create', 'Create resource'),\n resourceKind: 'resources.resource',\n resourceId: snapshotWithCustom.id,\n tenantId: snapshotWithCustom.tenantId,\n organizationId: snapshotWithCustom.organizationId,\n snapshotAfter: snapshotWithCustom,\n payload: {\n undo: {\n after: snapshotWithCustom,\n customAfter: custom,\n } satisfies ResourceUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ResourceUndoPayload>(logEntry)\n const after = payload?.after\n if (!after) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const record = await em.findOne(ResourcesResource, { id: after.id })\n if (record) {\n record.deletedAt = new Date()\n record.updatedAt = new Date()\n await em.flush()\n\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudUndoSideEffects({\n dataEngine,\n action: 'deleted',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n }\n },\n}\n\nconst updateResourceCommand: CommandHandler<ResourcesResourceUpdateInput, { resourceId: string }> = {\n id: 'resources.resources.update',\n async prepare(rawInput, ctx) {\n const { parsed } = parseWithCustomFields(resourcesResourceUpdateSchema, rawInput)\n const em = (ctx.container.resolve('em') as EntityManager)\n const snapshot = await loadResourceSnapshot(em, parsed.id)\n if (!snapshot) return {}\n const custom = await loadResourceCustomSnapshot(em, snapshot)\n return { before: snapshot, customBefore: custom }\n },\n async execute(rawInput, ctx) {\n const { parsed, custom } = parseWithCustomFields(resourcesResourceUpdateSchema, rawInput)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const record = await findOneWithDecryption(\n em,\n ResourcesResource,\n { id: parsed.id, deletedAt: null },\n undefined,\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.auth?.orgId ?? null },\n )\n if (!record) throw new CrudHttpError(404, { error: 'Resources resource not found.' })\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n\n if (parsed.capacityUnitValue !== undefined) {\n const unitValue =\n typeof parsed.capacityUnitValue === 'string' ? parsed.capacityUnitValue.trim() : ''\n if (!unitValue) {\n record.capacityUnitValue = null\n record.capacityUnitName = null\n record.capacityUnitColor = null\n record.capacityUnitIcon = null\n } else {\n const unitSnapshot = await resolveCapacityUnit(\n em,\n { tenantId: record.tenantId, organizationId: record.organizationId },\n unitValue,\n )\n record.capacityUnitValue = unitSnapshot.value\n record.capacityUnitName = unitSnapshot.name\n record.capacityUnitColor = unitSnapshot.color\n record.capacityUnitIcon = unitSnapshot.icon\n }\n }\n if (parsed.name !== undefined) record.name = parsed.name\n if (parsed.description !== undefined) record.description = parsed.description ?? null\n if (parsed.resourceTypeId !== undefined) record.resourceTypeId = parsed.resourceTypeId ?? null\n if (parsed.capacity !== undefined) record.capacity = parsed.capacity ?? null\n if (parsed.appearanceIcon !== undefined) record.appearanceIcon = parsed.appearanceIcon ?? null\n if (parsed.appearanceColor !== undefined) record.appearanceColor = parsed.appearanceColor ?? null\n if (parsed.availabilityRuleSetId !== undefined) record.availabilityRuleSetId = parsed.availabilityRuleSetId ?? null\n record.updatedAt = new Date()\n if (parsed.isActive !== undefined) record.isActive = parsed.isActive\n await em.flush()\n await syncResourcesResourceTags(em, {\n resourceId: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n tagIds: parsed.tags,\n })\n await em.flush()\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n await setCustomFieldsIfAny({\n dataEngine,\n entityId: E.resources.resources_resource,\n recordId: record.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n values: custom,\n })\n await emitCrudSideEffects({\n dataEngine,\n action: 'updated',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n return { resourceId: record.id }\n },\n buildLog: async ({ snapshots, ctx }) => {\n const before = snapshots.before as ResourceSnapshot | undefined\n if (!before) return null\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const after = await loadResourceSnapshot(em, before.id)\n if (!after) return null\n const customBefore = (snapshots as { customBefore?: CustomFieldSnapshot | null }).customBefore ?? undefined\n const customAfter = await loadResourceCustomSnapshot(em, after)\n const beforeWithCustom: ResourceSnapshot = customBefore\n ? { ...before, customFields: customBefore }\n : before\n const afterWithCustom: ResourceSnapshot = customAfter\n ? { ...after, customFields: customAfter }\n : after\n const changes = buildChanges(before as unknown as Record<string, unknown>, after as unknown as Record<string, unknown>, [\n 'name',\n 'description',\n 'resourceTypeId',\n 'capacity',\n 'capacityUnitValue',\n 'capacityUnitName',\n 'capacityUnitColor',\n 'capacityUnitIcon',\n 'appearanceIcon',\n 'appearanceColor',\n 'isActive',\n 'availabilityRuleSetId',\n 'deletedAt',\n ])\n if (before.tags.join(',') !== after.tags.join(',')) {\n changes.tags = { from: before.tags, to: after.tags }\n }\n const customChanges = diffCustomFieldChanges(customBefore, customAfter)\n if (Object.keys(customChanges).length) {\n changes.customFields = { from: customBefore ?? null, to: customAfter ?? null }\n }\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('resources.audit.resources.update', 'Update resource'),\n resourceKind: 'resources.resource',\n resourceId: before.id,\n tenantId: before.tenantId,\n organizationId: before.organizationId,\n snapshotBefore: beforeWithCustom,\n snapshotAfter: afterWithCustom,\n changes,\n payload: {\n undo: {\n before: beforeWithCustom,\n after: afterWithCustom,\n customBefore: customBefore ?? null,\n customAfter,\n } satisfies ResourceUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ResourceUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const fallbackCustomBefore = (before as ResourceSnapshot).customFields ?? null\n const fallbackCustomAfter = (payload?.after as ResourceSnapshot | null | undefined)?.customFields ?? null\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const record = await em.findOne(ResourcesResource, { id: before.id })\n if (!record) return\n record.name = before.name\n record.description = before.description ?? null\n record.resourceTypeId = before.resourceTypeId ?? null\n record.capacity = before.capacity ?? null\n record.capacityUnitValue = before.capacityUnitValue ?? null\n record.capacityUnitName = before.capacityUnitName ?? null\n record.capacityUnitColor = before.capacityUnitColor ?? null\n record.capacityUnitIcon = before.capacityUnitIcon ?? null\n record.appearanceIcon = before.appearanceIcon ?? null\n record.appearanceColor = before.appearanceColor ?? null\n record.isActive = before.isActive\n record.availabilityRuleSetId = before.availabilityRuleSetId ?? null\n record.deletedAt = before.deletedAt ? new Date(before.deletedAt) : null\n record.updatedAt = new Date()\n await em.flush()\n await syncResourcesResourceTags(em, {\n resourceId: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n tagIds: before.tags,\n })\n await em.flush()\n\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n const customBefore = payload.customBefore ?? fallbackCustomBefore ?? undefined\n const customAfter = payload.customAfter ?? fallbackCustomAfter ?? undefined\n if (customBefore || customAfter) {\n const reset = buildCustomFieldResetMap(customBefore, customAfter)\n await setCustomFieldsIfAny({\n dataEngine,\n entityId: E.resources.resources_resource,\n recordId: record.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n values: reset,\n })\n }\n\n await emitCrudUndoSideEffects({\n dataEngine,\n action: 'updated',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n },\n}\n\nconst deleteResourceCommand: CommandHandler<{ id?: string }, { resourceId: string }> = {\n id: 'resources.resources.delete',\n async prepare(input, ctx) {\n const id = input?.id\n if (!id) throw new CrudHttpError(400, { error: 'Resource id is required.' })\n const em = (ctx.container.resolve('em') as EntityManager)\n const snapshot = await loadResourceSnapshot(em, id)\n if (!snapshot) return {}\n const custom = await loadResourceCustomSnapshot(em, snapshot)\n return { before: snapshot, customBefore: custom }\n },\n async execute(input, ctx) {\n const id = input?.id\n if (!id) throw new CrudHttpError(400, { error: 'Resource id is required.' })\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const record = await findOneWithDecryption(\n em,\n ResourcesResource,\n { id, deletedAt: null },\n undefined,\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.auth?.orgId ?? null },\n )\n if (!record) throw new CrudHttpError(404, { error: 'Resources resource not found.' })\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n record.deletedAt = new Date()\n record.updatedAt = new Date()\n await em.flush()\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudSideEffects({\n dataEngine,\n action: 'deleted',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n return { resourceId: record.id }\n },\n buildLog: async ({ snapshots }) => {\n const before = snapshots.before as ResourceSnapshot | undefined\n if (!before) return null\n const customBefore = (snapshots as { customBefore?: CustomFieldSnapshot | null }).customBefore ?? undefined\n const beforeWithCustom: ResourceSnapshot = customBefore\n ? { ...before, customFields: customBefore }\n : before\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('resources.audit.resources.delete', 'Delete resource'),\n resourceKind: 'resources.resource',\n resourceId: before.id,\n tenantId: before.tenantId,\n organizationId: before.organizationId,\n snapshotBefore: beforeWithCustom,\n payload: {\n undo: {\n before: beforeWithCustom,\n customBefore: customBefore ?? null,\n } satisfies ResourceUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ResourceUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const fallbackCustomBefore = (before as ResourceSnapshot).customFields ?? null\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n let record = await em.findOne(ResourcesResource, { id: before.id })\n if (!record) {\n record = em.create(ResourcesResource, {\n id: before.id,\n tenantId: before.tenantId,\n organizationId: before.organizationId,\n name: before.name,\n description: before.description ?? null,\n resourceTypeId: before.resourceTypeId ?? null,\n capacity: before.capacity ?? null,\n capacityUnitValue: before.capacityUnitValue ?? null,\n capacityUnitName: before.capacityUnitName ?? null,\n capacityUnitColor: before.capacityUnitColor ?? null,\n capacityUnitIcon: before.capacityUnitIcon ?? null,\n appearanceIcon: before.appearanceIcon ?? null,\n appearanceColor: before.appearanceColor ?? null,\n isActive: before.isActive,\n availabilityRuleSetId: before.availabilityRuleSetId ?? null,\n deletedAt: null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(record)\n } else {\n record.name = before.name\n record.description = before.description ?? null\n record.resourceTypeId = before.resourceTypeId ?? null\n record.capacity = before.capacity ?? null\n record.capacityUnitValue = before.capacityUnitValue ?? null\n record.capacityUnitName = before.capacityUnitName ?? null\n record.capacityUnitColor = before.capacityUnitColor ?? null\n record.capacityUnitIcon = before.capacityUnitIcon ?? null\n record.appearanceIcon = before.appearanceIcon ?? null\n record.appearanceColor = before.appearanceColor ?? null\n record.isActive = before.isActive\n record.availabilityRuleSetId = before.availabilityRuleSetId ?? null\n record.deletedAt = null\n record.updatedAt = new Date()\n }\n await em.flush()\n await syncResourcesResourceTags(em, {\n resourceId: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n tagIds: before.tags,\n })\n await em.flush()\n\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n const customBefore = payload.customBefore ?? fallbackCustomBefore ?? undefined\n if (customBefore) {\n const reset = buildCustomFieldResetMap(customBefore, undefined)\n await setCustomFieldsIfAny({\n dataEngine,\n entityId: E.resources.resources_resource,\n recordId: record.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n values: reset,\n })\n }\n\n await emitCrudUndoSideEffects({\n dataEngine,\n action: 'created',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n },\n}\n\nregisterCommand(createResourceCommand)\nregisterCommand(updateResourceCommand)\nregisterCommand(deleteResourceCommand)\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,uBAAuB;AAEhC,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AACtC,SAAS,cAAc,qBAAqB,yBAAyB,uBAAuB,4BAA4B;AACxH,SAAS,0BAA0B,wBAAwB,+BAAyD;AAEpH,SAAS,2BAA2B;AAEpC,SAAS,YAAY,uBAAuB;AAC5C,SAAS,mBAAmB,sBAAsB,sCAAsC;AACxF;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,mCAAmC;AAC5C,SAAS,yBAAyB,mBAAmB,0BAA0B;AAC/E,SAAS,8CAA8C;AACvD,SAAS,SAAS;AAElB,MAAM,sBAA4D;AAAA,EAChE,YAAY,EAAE,UAAU;AAC1B;AAqCA,eAAe,oBACb,IACA,OACA,UAC+B;AAC/B,QAAM,UAAU,SAAS,KAAK;AAC9B,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,cAAc,KAAK,EAAE,OAAO,6BAA6B,CAAC;AAAA,EACtE;AACA,QAAM,aAAa,MAAM;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,MACE,UAAU,MAAM;AAAA,MAChB,gBAAgB,MAAM;AAAA,MACtB,KAAK;AAAA,MACL,WAAW;AAAA,MACX,UAAU;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,MAAI,CAAC,YAAY;AACf,UAAM,IAAI,cAAc,KAAK,EAAE,OAAO,8CAA8C,CAAC;AAAA,EACvF;AACA,QAAM,kBAAkB,QAAQ,YAAY;AAC5C,QAAM,QAAQ,MAAM;AAA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AAqB;AACvD,aAAO,mBAAmB,OAAO,oBAAoB;AACrD,aAAO,iBAAiB,OAAO,kBAAkB;AACjD,aAAO,kBAAkB,OAAO,mBAAmB;AACnD,aAAO,WAAW,OAAO;AACzB,aAAO,wBAAwB,OAAO,yBAAyB;AAC/D,aAAO,YAAY;AACnB,aAAO,YAAY,oBAAI,KAAK;AAAA,IAC9B;AACA,UAAM,GAAG,MAAM;AACf,UAAM,0BAA0B,IAAI;AAAA,MAClC,YAAY,OAAO;AAAA,MACnB,gBAAgB,OAAO;AAAA,MACvB,UAAU,OAAO;AAAA,MACjB,QAAQ,OAAO;AAAA,IACjB,CAAC;AACD,UAAM,GAAG,MAAM;AAEf,UAAM,aAAc,IAAI,UAAU,QAAQ,YAAY;AACtD,UAAM,eAAe,QAAQ,gBAAgB,wBAAwB;AACrE,QAAI,cAAc;AAChB,YAAM,QAAQ,yBAAyB,cAAc,MAAS;AAC9D,YAAM,qBAAqB;AAAA,QACzB;AAAA,QACA,UAAU,EAAE,UAAU;AAAA,QACtB,UAAU,OAAO;AAAA,QACjB,UAAU,OAAO;AAAA,QACjB,gBAAgB,OAAO;AAAA,QACvB,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAEA,UAAM,wBAAwB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,aAAa;AAAA,QACX,IAAI,OAAO;AAAA,QACX,gBAAgB,OAAO;AAAA,QACvB,UAAU,OAAO;AAAA,MACnB;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF;AAEA,gBAAgB,qBAAqB;AACrC,gBAAgB,qBAAqB;AACrC,gBAAgB,qBAAqB;",
|
|
4
|
+
"sourcesContent": ["import type { CommandHandler } from '@open-mercato/shared/lib/commands'\nimport { registerCommand } from '@open-mercato/shared/lib/commands'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { buildChanges, emitCrudSideEffects, emitCrudUndoSideEffects, parseWithCustomFields, setCustomFieldsIfAny } from '@open-mercato/shared/lib/commands/helpers'\nimport { withAtomicFlush } from '@open-mercato/shared/lib/commands/flush'\nimport { buildCustomFieldResetMap, diffCustomFieldChanges, loadCustomFieldSnapshot, type CustomFieldSnapshot } from '@open-mercato/shared/lib/commands/customFieldSnapshots'\nimport type { DataEngine } from '@open-mercato/shared/lib/data/engine'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport type { CrudIndexerConfig } from '@open-mercato/shared/lib/crud/types'\nimport { Dictionary, DictionaryEntry } from '@open-mercato/core/modules/dictionaries/data/entities'\nimport { ResourcesResource, ResourcesResourceTag, ResourcesResourceTagAssignment } from '../data/entities'\nimport {\n resourcesResourceCreateSchema,\n resourcesResourceUpdateSchema,\n type ResourcesResourceCreateInput,\n type ResourcesResourceUpdateInput,\n} from '../data/validators'\nimport { resourcesResourceCrudEvents } from '../lib/crud'\nimport { ensureOrganizationScope, ensureTenantScope, extractUndoPayload } from './shared'\nimport { RESOURCES_CAPACITY_UNIT_DICTIONARY_KEY } from '../lib/capacityUnits'\nimport { E } from '#generated/entities.ids.generated'\n\nconst resourceCrudIndexer: CrudIndexerConfig<ResourcesResource> = {\n entityType: E.resources.resources_resource,\n}\n\ntype CapacityUnitSnapshot = {\n value: string\n name: string\n color: string | null\n icon: string | null\n}\n\ntype ResourceSnapshot = {\n id: string\n tenantId: string\n organizationId: string\n name: string\n description: string | null\n resourceTypeId: string | null\n capacity: number | null\n capacityUnitValue: string | null\n capacityUnitName: string | null\n capacityUnitColor: string | null\n capacityUnitIcon: string | null\n appearanceIcon: string | null\n appearanceColor: string | null\n isActive: boolean\n availabilityRuleSetId: string | null\n tags: string[]\n deletedAt: string | null\n customFields?: CustomFieldSnapshot | null\n}\n\ntype ResourceUndoPayload = {\n before?: ResourceSnapshot | null\n after?: ResourceSnapshot | null\n customBefore?: CustomFieldSnapshot | null\n customAfter?: CustomFieldSnapshot | null\n}\n\nasync function resolveCapacityUnit(\n em: EntityManager,\n scope: { tenantId: string; organizationId: string },\n rawValue: string,\n): Promise<CapacityUnitSnapshot> {\n const trimmed = rawValue.trim()\n if (!trimmed) {\n throw new CrudHttpError(400, { error: 'Capacity unit is required.' })\n }\n const dictionary = await findOneWithDecryption(\n em,\n Dictionary,\n {\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n key: RESOURCES_CAPACITY_UNIT_DICTIONARY_KEY,\n deletedAt: null,\n isActive: true,\n },\n undefined,\n scope,\n )\n if (!dictionary) {\n throw new CrudHttpError(400, { error: 'Capacity unit dictionary is not configured.' })\n }\n const normalizedValue = trimmed.toLowerCase()\n const entry = await findOneWithDecryption(\n em,\n DictionaryEntry,\n {\n dictionary,\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n normalizedValue,\n },\n { populate: ['dictionary'] },\n scope,\n )\n if (!entry) {\n throw new CrudHttpError(400, { error: 'Capacity unit not found.' })\n }\n return {\n value: entry.value,\n name: entry.label?.trim().length ? entry.label : entry.value,\n color: entry.color ?? null,\n icon: entry.icon ?? null,\n }\n}\n\nfunction normalizeTagIds(tags?: Array<string | null | undefined>): string[] {\n if (!Array.isArray(tags)) return []\n const set = new Set<string>()\n tags.forEach((id) => {\n if (typeof id === 'string' && id.trim().length > 0) set.add(id.trim())\n })\n return Array.from(set)\n}\n\nasync function loadResourceSnapshot(em: EntityManager, id: string): Promise<ResourceSnapshot | null> {\n const resource = await findOneWithDecryption(\n em,\n ResourcesResource,\n { id },\n undefined,\n { tenantId: null, organizationId: null },\n )\n if (!resource) return null\n const assignments = await em.find(\n ResourcesResourceTagAssignment,\n { resource: resource.id },\n { populate: ['tag'] },\n )\n const tags = assignments\n .map((assignment) => (assignment.tag as ResourcesResourceTag | undefined)?.id ?? null)\n .filter((tagId): tagId is string => typeof tagId === 'string' && tagId.length > 0)\n .sort((a, b) => a.localeCompare(b))\n return {\n id: resource.id,\n tenantId: resource.tenantId,\n organizationId: resource.organizationId,\n name: resource.name,\n description: resource.description ?? null,\n resourceTypeId: resource.resourceTypeId ?? null,\n capacity: resource.capacity ?? null,\n capacityUnitValue: resource.capacityUnitValue ?? null,\n capacityUnitName: resource.capacityUnitName ?? null,\n capacityUnitColor: resource.capacityUnitColor ?? null,\n capacityUnitIcon: resource.capacityUnitIcon ?? null,\n appearanceIcon: resource.appearanceIcon ?? null,\n appearanceColor: resource.appearanceColor ?? null,\n isActive: resource.isActive,\n availabilityRuleSetId: resource.availabilityRuleSetId ?? null,\n tags,\n deletedAt: resource.deletedAt ? resource.deletedAt.toISOString() : null,\n }\n}\n\nasync function loadResourceCustomSnapshot(em: EntityManager, snapshot: ResourceSnapshot): Promise<CustomFieldSnapshot> {\n return loadCustomFieldSnapshot(em, {\n entityId: E.resources.resources_resource,\n recordId: snapshot.id,\n tenantId: snapshot.tenantId,\n organizationId: snapshot.organizationId,\n })\n}\n\nasync function syncResourcesResourceTags(em: EntityManager, params: {\n resourceId: string\n organizationId: string\n tenantId: string\n tagIds?: Array<string | null | undefined> | null\n}) {\n if (params.tagIds === undefined) return\n const tagIds = normalizeTagIds(params.tagIds ?? [])\n if (tagIds.length === 0) {\n await em.nativeDelete(ResourcesResourceTagAssignment, { resource: params.resourceId })\n return\n }\n const tagsInScope = await em.find(ResourcesResourceTag, {\n id: { $in: tagIds },\n organizationId: params.organizationId,\n tenantId: params.tenantId,\n })\n if (tagsInScope.length !== tagIds.length) {\n throw new CrudHttpError(400, { error: 'One or more tags not found for this scope' })\n }\n const byId = new Map(tagsInScope.map((tag) => [tag.id, tag]))\n await em.nativeDelete(ResourcesResourceTagAssignment, { resource: params.resourceId })\n const resource = em.getReference(ResourcesResource, params.resourceId)\n for (const tagId of tagIds) {\n const tag = byId.get(tagId)\n if (!tag) continue\n const assignment = em.create(ResourcesResourceTagAssignment, {\n organizationId: params.organizationId,\n tenantId: params.tenantId,\n resource,\n tag,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(assignment)\n }\n}\n\nconst createResourceCommand: CommandHandler<ResourcesResourceCreateInput, { resourceId: string }> = {\n id: 'resources.resources.create',\n async execute(rawInput, ctx) {\n const { parsed, custom } = parseWithCustomFields(resourcesResourceCreateSchema, rawInput)\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const now = new Date()\n const unitValue =\n typeof parsed.capacityUnitValue === 'string' ? parsed.capacityUnitValue.trim() : ''\n const unitSnapshot = unitValue\n ? await resolveCapacityUnit(em, { tenantId: parsed.tenantId, organizationId: parsed.organizationId }, unitValue)\n : null\n const record = em.create(ResourcesResource, {\n tenantId: parsed.tenantId,\n organizationId: parsed.organizationId,\n name: parsed.name,\n description: parsed.description ?? null,\n resourceTypeId: parsed.resourceTypeId ?? null,\n capacity: parsed.capacity ?? null,\n capacityUnitValue: unitSnapshot?.value ?? null,\n capacityUnitName: unitSnapshot?.name ?? null,\n capacityUnitColor: unitSnapshot?.color ?? null,\n capacityUnitIcon: unitSnapshot?.icon ?? null,\n appearanceIcon: parsed.appearanceIcon ?? null,\n appearanceColor: parsed.appearanceColor ?? null,\n isActive: parsed.isActive ?? true,\n availabilityRuleSetId: parsed.availabilityRuleSetId ?? null,\n createdAt: now,\n updatedAt: now,\n })\n await withAtomicFlush(em, [\n async () => {\n em.persist(record)\n await em.flush()\n },\n () => syncResourcesResourceTags(em, {\n resourceId: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n tagIds: parsed.tags,\n }),\n ], { transaction: true })\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n await setCustomFieldsIfAny({\n dataEngine,\n entityId: E.resources.resources_resource,\n recordId: record.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n values: custom,\n })\n await emitCrudSideEffects({\n dataEngine,\n action: 'created',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n return { resourceId: record.id }\n },\n captureAfter: async (_input, result, ctx) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const snapshot = await loadResourceSnapshot(em, result.resourceId)\n if (!snapshot) return null\n const custom = await loadResourceCustomSnapshot(em, snapshot)\n return { snapshot, custom }\n },\n buildLog: async ({ result, ctx }) => {\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const snapshot = await loadResourceSnapshot(em, result?.resourceId ?? '')\n if (!snapshot) return null\n const custom = await loadResourceCustomSnapshot(em, snapshot)\n const snapshotWithCustom: ResourceSnapshot = custom\n ? { ...snapshot, customFields: custom }\n : snapshot\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('resources.audit.resources.create', 'Create resource'),\n resourceKind: 'resources.resource',\n resourceId: snapshotWithCustom.id,\n tenantId: snapshotWithCustom.tenantId,\n organizationId: snapshotWithCustom.organizationId,\n snapshotAfter: snapshotWithCustom,\n payload: {\n undo: {\n after: snapshotWithCustom,\n customAfter: custom,\n } satisfies ResourceUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ResourceUndoPayload>(logEntry)\n const after = payload?.after\n if (!after) return\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const record = await em.findOne(ResourcesResource, { id: after.id })\n if (record) {\n record.deletedAt = new Date()\n record.updatedAt = new Date()\n await em.flush()\n\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudUndoSideEffects({\n dataEngine,\n action: 'deleted',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n }\n },\n}\n\nconst updateResourceCommand: CommandHandler<ResourcesResourceUpdateInput, { resourceId: string }> = {\n id: 'resources.resources.update',\n async prepare(rawInput, ctx) {\n const { parsed } = parseWithCustomFields(resourcesResourceUpdateSchema, rawInput)\n const em = (ctx.container.resolve('em') as EntityManager)\n const snapshot = await loadResourceSnapshot(em, parsed.id)\n if (!snapshot) return {}\n const custom = await loadResourceCustomSnapshot(em, snapshot)\n return { before: snapshot, customBefore: custom }\n },\n async execute(rawInput, ctx) {\n const { parsed, custom } = parseWithCustomFields(resourcesResourceUpdateSchema, rawInput)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const record = await findOneWithDecryption(\n em,\n ResourcesResource,\n { id: parsed.id, deletedAt: null },\n undefined,\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.auth?.orgId ?? null },\n )\n if (!record) throw new CrudHttpError(404, { error: 'Resources resource not found.' })\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n\n let capacityUnit: CapacityUnitSnapshot | null | undefined\n if (parsed.capacityUnitValue !== undefined) {\n const unitValue =\n typeof parsed.capacityUnitValue === 'string' ? parsed.capacityUnitValue.trim() : ''\n capacityUnit = unitValue\n ? await resolveCapacityUnit(\n em,\n { tenantId: record.tenantId, organizationId: record.organizationId },\n unitValue,\n )\n : null\n }\n await withAtomicFlush(em, [\n () => {\n if (parsed.capacityUnitValue !== undefined) {\n record.capacityUnitValue = capacityUnit?.value ?? null\n record.capacityUnitName = capacityUnit?.name ?? null\n record.capacityUnitColor = capacityUnit?.color ?? null\n record.capacityUnitIcon = capacityUnit?.icon ?? null\n }\n if (parsed.name !== undefined) record.name = parsed.name\n if (parsed.description !== undefined) record.description = parsed.description ?? null\n if (parsed.resourceTypeId !== undefined) record.resourceTypeId = parsed.resourceTypeId ?? null\n if (parsed.capacity !== undefined) record.capacity = parsed.capacity ?? null\n if (parsed.appearanceIcon !== undefined) record.appearanceIcon = parsed.appearanceIcon ?? null\n if (parsed.appearanceColor !== undefined) record.appearanceColor = parsed.appearanceColor ?? null\n if (parsed.availabilityRuleSetId !== undefined) record.availabilityRuleSetId = parsed.availabilityRuleSetId ?? null\n record.updatedAt = new Date()\n if (parsed.isActive !== undefined) record.isActive = parsed.isActive\n },\n () => syncResourcesResourceTags(em, {\n resourceId: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n tagIds: parsed.tags,\n }),\n ], { transaction: true })\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n await setCustomFieldsIfAny({\n dataEngine,\n entityId: E.resources.resources_resource,\n recordId: record.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n values: custom,\n })\n await emitCrudSideEffects({\n dataEngine,\n action: 'updated',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n return { resourceId: record.id }\n },\n buildLog: async ({ snapshots, ctx }) => {\n const before = snapshots.before as ResourceSnapshot | undefined\n if (!before) return null\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const after = await loadResourceSnapshot(em, before.id)\n if (!after) return null\n const customBefore = (snapshots as { customBefore?: CustomFieldSnapshot | null }).customBefore ?? undefined\n const customAfter = await loadResourceCustomSnapshot(em, after)\n const beforeWithCustom: ResourceSnapshot = customBefore\n ? { ...before, customFields: customBefore }\n : before\n const afterWithCustom: ResourceSnapshot = customAfter\n ? { ...after, customFields: customAfter }\n : after\n const changes = buildChanges(before as unknown as Record<string, unknown>, after as unknown as Record<string, unknown>, [\n 'name',\n 'description',\n 'resourceTypeId',\n 'capacity',\n 'capacityUnitValue',\n 'capacityUnitName',\n 'capacityUnitColor',\n 'capacityUnitIcon',\n 'appearanceIcon',\n 'appearanceColor',\n 'isActive',\n 'availabilityRuleSetId',\n 'deletedAt',\n ])\n if (before.tags.join(',') !== after.tags.join(',')) {\n changes.tags = { from: before.tags, to: after.tags }\n }\n const customChanges = diffCustomFieldChanges(customBefore, customAfter)\n if (Object.keys(customChanges).length) {\n changes.customFields = { from: customBefore ?? null, to: customAfter ?? null }\n }\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('resources.audit.resources.update', 'Update resource'),\n resourceKind: 'resources.resource',\n resourceId: before.id,\n tenantId: before.tenantId,\n organizationId: before.organizationId,\n snapshotBefore: beforeWithCustom,\n snapshotAfter: afterWithCustom,\n changes,\n payload: {\n undo: {\n before: beforeWithCustom,\n after: afterWithCustom,\n customBefore: customBefore ?? null,\n customAfter,\n } satisfies ResourceUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ResourceUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const fallbackCustomBefore = (before as ResourceSnapshot).customFields ?? null\n const fallbackCustomAfter = (payload?.after as ResourceSnapshot | null | undefined)?.customFields ?? null\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const record = await em.findOne(ResourcesResource, { id: before.id })\n if (!record) return\n await withAtomicFlush(em, [\n () => {\n record.name = before.name\n record.description = before.description ?? null\n record.resourceTypeId = before.resourceTypeId ?? null\n record.capacity = before.capacity ?? null\n record.capacityUnitValue = before.capacityUnitValue ?? null\n record.capacityUnitName = before.capacityUnitName ?? null\n record.capacityUnitColor = before.capacityUnitColor ?? null\n record.capacityUnitIcon = before.capacityUnitIcon ?? null\n record.appearanceIcon = before.appearanceIcon ?? null\n record.appearanceColor = before.appearanceColor ?? null\n record.isActive = before.isActive\n record.availabilityRuleSetId = before.availabilityRuleSetId ?? null\n record.deletedAt = before.deletedAt ? new Date(before.deletedAt) : null\n record.updatedAt = new Date()\n },\n () => syncResourcesResourceTags(em, {\n resourceId: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n tagIds: before.tags,\n }),\n ], { transaction: true })\n\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n const customBefore = payload.customBefore ?? fallbackCustomBefore ?? undefined\n const customAfter = payload.customAfter ?? fallbackCustomAfter ?? undefined\n if (customBefore || customAfter) {\n const reset = buildCustomFieldResetMap(customBefore, customAfter)\n await setCustomFieldsIfAny({\n dataEngine,\n entityId: E.resources.resources_resource,\n recordId: record.id,\n tenantId: record.tenantId,\n organizationId: record.organizationId,\n values: reset,\n })\n }\n\n await emitCrudUndoSideEffects({\n dataEngine,\n action: 'updated',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n },\n}\n\nconst deleteResourceCommand: CommandHandler<{ id?: string }, { resourceId: string }> = {\n id: 'resources.resources.delete',\n async prepare(input, ctx) {\n const id = input?.id\n if (!id) throw new CrudHttpError(400, { error: 'Resource id is required.' })\n const em = (ctx.container.resolve('em') as EntityManager)\n const snapshot = await loadResourceSnapshot(em, id)\n if (!snapshot) return {}\n const custom = await loadResourceCustomSnapshot(em, snapshot)\n return { before: snapshot, customBefore: custom }\n },\n async execute(input, ctx) {\n const id = input?.id\n if (!id) throw new CrudHttpError(400, { error: 'Resource id is required.' })\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const record = await findOneWithDecryption(\n em,\n ResourcesResource,\n { id, deletedAt: null },\n undefined,\n { tenantId: ctx.auth?.tenantId ?? null, organizationId: ctx.auth?.orgId ?? null },\n )\n if (!record) throw new CrudHttpError(404, { error: 'Resources resource not found.' })\n ensureTenantScope(ctx, record.tenantId)\n ensureOrganizationScope(ctx, record.organizationId)\n record.deletedAt = new Date()\n record.updatedAt = new Date()\n await em.flush()\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n await emitCrudSideEffects({\n dataEngine,\n action: 'deleted',\n entity: record,\n identifiers: {\n id: record.id,\n organizationId: record.organizationId,\n tenantId: record.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n return { resourceId: record.id }\n },\n buildLog: async ({ snapshots }) => {\n const before = snapshots.before as ResourceSnapshot | undefined\n if (!before) return null\n const customBefore = (snapshots as { customBefore?: CustomFieldSnapshot | null }).customBefore ?? undefined\n const beforeWithCustom: ResourceSnapshot = customBefore\n ? { ...before, customFields: customBefore }\n : before\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('resources.audit.resources.delete', 'Delete resource'),\n resourceKind: 'resources.resource',\n resourceId: before.id,\n tenantId: before.tenantId,\n organizationId: before.organizationId,\n snapshotBefore: beforeWithCustom,\n payload: {\n undo: {\n before: beforeWithCustom,\n customBefore: customBefore ?? null,\n } satisfies ResourceUndoPayload,\n },\n }\n },\n undo: async ({ logEntry, ctx }) => {\n const payload = extractUndoPayload<ResourceUndoPayload>(logEntry)\n const before = payload?.before\n if (!before) return\n const fallbackCustomBefore = (before as ResourceSnapshot).customFields ?? null\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n let record = await em.findOne(ResourcesResource, { id: before.id })\n await withAtomicFlush(em, [\n async () => {\n if (!record) {\n record = em.create(ResourcesResource, {\n id: before.id,\n tenantId: before.tenantId,\n organizationId: before.organizationId,\n name: before.name,\n description: before.description ?? null,\n resourceTypeId: before.resourceTypeId ?? null,\n capacity: before.capacity ?? null,\n capacityUnitValue: before.capacityUnitValue ?? null,\n capacityUnitName: before.capacityUnitName ?? null,\n capacityUnitColor: before.capacityUnitColor ?? null,\n capacityUnitIcon: before.capacityUnitIcon ?? null,\n appearanceIcon: before.appearanceIcon ?? null,\n appearanceColor: before.appearanceColor ?? null,\n isActive: before.isActive,\n availabilityRuleSetId: before.availabilityRuleSetId ?? null,\n deletedAt: null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(record)\n } else {\n record.name = before.name\n record.description = before.description ?? null\n record.resourceTypeId = before.resourceTypeId ?? null\n record.capacity = before.capacity ?? null\n record.capacityUnitValue = before.capacityUnitValue ?? null\n record.capacityUnitName = before.capacityUnitName ?? null\n record.capacityUnitColor = before.capacityUnitColor ?? null\n record.capacityUnitIcon = before.capacityUnitIcon ?? null\n record.appearanceIcon = before.appearanceIcon ?? null\n record.appearanceColor = before.appearanceColor ?? null\n record.isActive = before.isActive\n record.availabilityRuleSetId = before.availabilityRuleSetId ?? null\n record.deletedAt = null\n record.updatedAt = new Date()\n }\n await em.flush()\n },\n () => syncResourcesResourceTags(em, {\n resourceId: (record as ResourcesResource).id,\n organizationId: (record as ResourcesResource).organizationId,\n tenantId: (record as ResourcesResource).tenantId,\n tagIds: before.tags,\n }),\n ], { transaction: true })\n const resolvedRecord = record as ResourcesResource\n\n const dataEngine = (ctx.container.resolve('dataEngine') as DataEngine)\n const customBefore = payload.customBefore ?? fallbackCustomBefore ?? undefined\n if (customBefore) {\n const reset = buildCustomFieldResetMap(customBefore, undefined)\n await setCustomFieldsIfAny({\n dataEngine,\n entityId: E.resources.resources_resource,\n recordId: resolvedRecord.id,\n tenantId: resolvedRecord.tenantId,\n organizationId: resolvedRecord.organizationId,\n values: reset,\n })\n }\n\n await emitCrudUndoSideEffects({\n dataEngine,\n action: 'created',\n entity: resolvedRecord,\n identifiers: {\n id: resolvedRecord.id,\n organizationId: resolvedRecord.organizationId,\n tenantId: resolvedRecord.tenantId,\n },\n events: resourcesResourceCrudEvents,\n indexer: resourceCrudIndexer,\n })\n },\n}\n\nregisterCommand(createResourceCommand)\nregisterCommand(updateResourceCommand)\nregisterCommand(deleteResourceCommand)\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,uBAAuB;AAEhC,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AACtC,SAAS,cAAc,qBAAqB,yBAAyB,uBAAuB,4BAA4B;AACxH,SAAS,uBAAuB;AAChC,SAAS,0BAA0B,wBAAwB,+BAAyD;AAEpH,SAAS,2BAA2B;AAEpC,SAAS,YAAY,uBAAuB;AAC5C,SAAS,mBAAmB,sBAAsB,sCAAsC;AACxF;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,mCAAmC;AAC5C,SAAS,yBAAyB,mBAAmB,0BAA0B;AAC/E,SAAS,8CAA8C;AACvD,SAAS,SAAS;AAElB,MAAM,sBAA4D;AAAA,EAChE,YAAY,EAAE,UAAU;AAC1B;AAqCA,eAAe,oBACb,IACA,OAC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ACtD,UAAM,eAAe,QAAQ,gBAAgB,wBAAwB;AACrE,QAAI,cAAc;AAChB,YAAM,QAAQ,yBAAyB,cAAc,MAAS;AAC9D,YAAM,qBAAqB;AAAA,QACzB;AAAA,QACA,UAAU,EAAE,UAAU;AAAA,QACtB,UAAU,eAAe;AAAA,QACzB,UAAU,eAAe;AAAA,QACzB,gBAAgB,eAAe;AAAA,QAC/B,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAEA,UAAM,wBAAwB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,aAAa;AAAA,QACX,IAAI,eAAe;AAAA,QACnB,gBAAgB,eAAe;AAAA,QAC/B,UAAU,eAAe;AAAA,MAC3B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF;AAEA,gBAAgB,qBAAqB;AACrC,gBAAgB,qBAAqB;AACrC,gBAAgB,qBAAqB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { registerCommand } from "@open-mercato/shared/lib/commands";
|
|
2
2
|
import { CrudHttpError } from "@open-mercato/shared/lib/crud/errors";
|
|
3
|
+
import { withAtomicFlush } from "@open-mercato/shared/lib/commands/flush";
|
|
3
4
|
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
4
5
|
import { slugifyTagLabel } from "@open-mercato/shared/lib/utils";
|
|
5
6
|
import { ResourcesResourceTag, ResourcesResourceTagAssignment } from "../data/entities.js";
|
|
@@ -95,9 +96,12 @@ const deleteTagCommand = {
|
|
|
95
96
|
if (!tag) throw new CrudHttpError(404, { error: "Tag not found" });
|
|
96
97
|
ensureTenantScope(ctx, tag.tenantId);
|
|
97
98
|
ensureOrganizationScope(ctx, tag.organizationId);
|
|
98
|
-
await em
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
await withAtomicFlush(em, [
|
|
100
|
+
async () => {
|
|
101
|
+
await em.nativeDelete(ResourcesResourceTagAssignment, { tag: tag.id });
|
|
102
|
+
em.remove(tag);
|
|
103
|
+
}
|
|
104
|
+
], { transaction: true });
|
|
101
105
|
return { tagId: id };
|
|
102
106
|
},
|
|
103
107
|
buildLog: async ({ input, result, ctx }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/resources/commands/tags.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CommandHandler } from '@open-mercato/shared/lib/commands'\nimport { registerCommand } from '@open-mercato/shared/lib/commands'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport { slugifyTagLabel } from '@open-mercato/shared/lib/utils'\nimport { ResourcesResourceTag, ResourcesResourceTagAssignment } from '../data/entities'\nimport {\n resourcesResourceTagCreateSchema,\n resourcesResourceTagUpdateSchema,\n type ResourcesResourceTagCreateInput,\n type ResourcesResourceTagUpdateInput,\n} from '../data/validators'\nimport { ensureOrganizationScope, ensureTenantScope } from './shared'\n\nconst createTagCommand: CommandHandler<ResourcesResourceTagCreateInput, { tagId: string }> = {\n id: 'resources.resourceTags.create',\n async execute(rawInput, ctx) {\n const parsed = resourcesResourceTagCreateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n const slug =\n typeof parsed.slug === 'string' && parsed.slug.trim().length\n ? parsed.slug.trim()\n : slugifyTagLabel(parsed.label)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const conflict = await em.findOne(ResourcesResourceTag, {\n slug,\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n })\n if (conflict) throw new CrudHttpError(409, { error: 'Tag slug already exists for this scope' })\n const tag = em.create(ResourcesResourceTag, {\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n slug,\n label: parsed.label,\n color: parsed.color ?? null,\n description: parsed.description ?? null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n await em.persist(tag).flush()\n return { tagId: tag.id }\n },\n buildLog: async ({ input, result, ctx }) => {\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('resources.audit.resourceTags.create', 'Create resource tag'),\n resourceKind: 'resources.resourceTag',\n resourceId: result?.tagId ?? null,\n tenantId: input?.tenantId ?? ctx.auth?.tenantId ?? null,\n organizationId: input?.organizationId ?? ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? null,\n }\n },\n}\n\nconst updateTagCommand: CommandHandler<ResourcesResourceTagUpdateInput, { tagId: string }> = {\n id: 'resources.resourceTags.update',\n async execute(rawInput, ctx) {\n const parsed = resourcesResourceTagUpdateSchema.parse(rawInput ?? {})\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const tag = await em.findOne(ResourcesResourceTag, { id: parsed.id })\n if (!tag) throw new CrudHttpError(404, { error: 'Tag not found' })\n ensureTenantScope(ctx, tag.tenantId)\n ensureOrganizationScope(ctx, tag.organizationId)\n if (parsed.slug && parsed.slug !== tag.slug) {\n const conflict = await em.findOne(ResourcesResourceTag, {\n slug: parsed.slug,\n organizationId: tag.organizationId,\n tenantId: tag.tenantId,\n })\n if (conflict && conflict.id !== tag.id) {\n throw new CrudHttpError(409, { error: 'Tag slug already exists for this scope' })\n }\n tag.slug = parsed.slug\n }\n if (parsed.label !== undefined) tag.label = parsed.label\n if (parsed.color !== undefined) tag.color = parsed.color ?? null\n if (parsed.description !== undefined) tag.description = parsed.description ?? null\n await em.flush()\n return { tagId: tag.id }\n },\n buildLog: async ({ input, result, ctx }) => {\n const { translate } = await resolveTranslations()\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const tag = result?.tagId ? await em.findOne(ResourcesResourceTag, { id: result.tagId }) : null\n return {\n actionLabel: translate('resources.audit.resourceTags.update', 'Update resource tag'),\n resourceKind: 'resources.resourceTag',\n resourceId: result?.tagId ?? input?.id ?? null,\n tenantId: tag?.tenantId ?? ctx.auth?.tenantId ?? null,\n organizationId: tag?.organizationId ?? ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? null,\n }\n },\n}\n\nconst deleteTagCommand: CommandHandler<{ id?: string }, { tagId: string }> = {\n id: 'resources.resourceTags.delete',\n async execute(input, ctx) {\n const id = typeof input?.id === 'string' ? input.id : null\n if (!id) throw new CrudHttpError(400, { error: 'Tag id is required' })\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const tag = await em.findOne(ResourcesResourceTag, { id })\n if (!tag) throw new CrudHttpError(404, { error: 'Tag not found' })\n ensureTenantScope(ctx, tag.tenantId)\n ensureOrganizationScope(ctx, tag.organizationId)\n await em.nativeDelete(ResourcesResourceTagAssignment, { tag: tag.id })\n
|
|
5
|
-
"mappings": "AACA,SAAS,uBAAuB;AAEhC,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAChC,SAAS,sBAAsB,sCAAsC;AACrE;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,yBAAyB,yBAAyB;AAE3D,MAAM,mBAAuF;AAAA,EAC3F,IAAI;AAAA,EACJ,MAAM,QAAQ,UAAU,KAAK;AAC3B,UAAM,SAAS,iCAAiC,MAAM,YAAY,CAAC,CAAC;AACpE,sBAAkB,KAAK,OAAO,QAAQ;AACtC,4BAAwB,KAAK,OAAO,cAAc;AAClD,UAAM,OACJ,OAAO,OAAO,SAAS,YAAY,OAAO,KAAK,KAAK,EAAE,SAClD,OAAO,KAAK,KAAK,IACjB,gBAAgB,OAAO,KAAK;AAClC,UAAM,KAAM,IAAI,UAAU,QAAQ,IAAI,EAAoB,KAAK;AAC/D,UAAM,WAAW,MAAM,GAAG,QAAQ,sBAAsB;AAAA,MACtD;AAAA,MACA,gBAAgB,OAAO;AAAA,MACvB,UAAU,OAAO;AAAA,IACnB,CAAC;AACD,QAAI,SAAU,OAAM,IAAI,cAAc,KAAK,EAAE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AAK;AAC/D,UAAM,MAAM,MAAM,GAAG,QAAQ,sBAAsB,EAAE,GAAG,CAAC;AACzD,QAAI,CAAC,IAAK,OAAM,IAAI,cAAc,KAAK,EAAE,OAAO,gBAAgB,CAAC;AACjE,sBAAkB,KAAK,IAAI,QAAQ;AACnC,4BAAwB,KAAK,IAAI,cAAc;AAC/C,UAAM,GAAG,aAAa,gCAAgC,EAAE,KAAK,IAAI,GAAG,CAAC;AACrE,
|
|
4
|
+
"sourcesContent": ["import type { CommandHandler } from '@open-mercato/shared/lib/commands'\nimport { registerCommand } from '@open-mercato/shared/lib/commands'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { withAtomicFlush } from '@open-mercato/shared/lib/commands/flush'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport { slugifyTagLabel } from '@open-mercato/shared/lib/utils'\nimport { ResourcesResourceTag, ResourcesResourceTagAssignment } from '../data/entities'\nimport {\n resourcesResourceTagCreateSchema,\n resourcesResourceTagUpdateSchema,\n type ResourcesResourceTagCreateInput,\n type ResourcesResourceTagUpdateInput,\n} from '../data/validators'\nimport { ensureOrganizationScope, ensureTenantScope } from './shared'\n\nconst createTagCommand: CommandHandler<ResourcesResourceTagCreateInput, { tagId: string }> = {\n id: 'resources.resourceTags.create',\n async execute(rawInput, ctx) {\n const parsed = resourcesResourceTagCreateSchema.parse(rawInput ?? {})\n ensureTenantScope(ctx, parsed.tenantId)\n ensureOrganizationScope(ctx, parsed.organizationId)\n const slug =\n typeof parsed.slug === 'string' && parsed.slug.trim().length\n ? parsed.slug.trim()\n : slugifyTagLabel(parsed.label)\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const conflict = await em.findOne(ResourcesResourceTag, {\n slug,\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n })\n if (conflict) throw new CrudHttpError(409, { error: 'Tag slug already exists for this scope' })\n const tag = em.create(ResourcesResourceTag, {\n organizationId: parsed.organizationId,\n tenantId: parsed.tenantId,\n slug,\n label: parsed.label,\n color: parsed.color ?? null,\n description: parsed.description ?? null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n await em.persist(tag).flush()\n return { tagId: tag.id }\n },\n buildLog: async ({ input, result, ctx }) => {\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('resources.audit.resourceTags.create', 'Create resource tag'),\n resourceKind: 'resources.resourceTag',\n resourceId: result?.tagId ?? null,\n tenantId: input?.tenantId ?? ctx.auth?.tenantId ?? null,\n organizationId: input?.organizationId ?? ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? null,\n }\n },\n}\n\nconst updateTagCommand: CommandHandler<ResourcesResourceTagUpdateInput, { tagId: string }> = {\n id: 'resources.resourceTags.update',\n async execute(rawInput, ctx) {\n const parsed = resourcesResourceTagUpdateSchema.parse(rawInput ?? {})\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const tag = await em.findOne(ResourcesResourceTag, { id: parsed.id })\n if (!tag) throw new CrudHttpError(404, { error: 'Tag not found' })\n ensureTenantScope(ctx, tag.tenantId)\n ensureOrganizationScope(ctx, tag.organizationId)\n if (parsed.slug && parsed.slug !== tag.slug) {\n const conflict = await em.findOne(ResourcesResourceTag, {\n slug: parsed.slug,\n organizationId: tag.organizationId,\n tenantId: tag.tenantId,\n })\n if (conflict && conflict.id !== tag.id) {\n throw new CrudHttpError(409, { error: 'Tag slug already exists for this scope' })\n }\n tag.slug = parsed.slug\n }\n if (parsed.label !== undefined) tag.label = parsed.label\n if (parsed.color !== undefined) tag.color = parsed.color ?? null\n if (parsed.description !== undefined) tag.description = parsed.description ?? null\n await em.flush()\n return { tagId: tag.id }\n },\n buildLog: async ({ input, result, ctx }) => {\n const { translate } = await resolveTranslations()\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const tag = result?.tagId ? await em.findOne(ResourcesResourceTag, { id: result.tagId }) : null\n return {\n actionLabel: translate('resources.audit.resourceTags.update', 'Update resource tag'),\n resourceKind: 'resources.resourceTag',\n resourceId: result?.tagId ?? input?.id ?? null,\n tenantId: tag?.tenantId ?? ctx.auth?.tenantId ?? null,\n organizationId: tag?.organizationId ?? ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? null,\n }\n },\n}\n\nconst deleteTagCommand: CommandHandler<{ id?: string }, { tagId: string }> = {\n id: 'resources.resourceTags.delete',\n async execute(input, ctx) {\n const id = typeof input?.id === 'string' ? input.id : null\n if (!id) throw new CrudHttpError(400, { error: 'Tag id is required' })\n const em = (ctx.container.resolve('em') as EntityManager).fork()\n const tag = await em.findOne(ResourcesResourceTag, { id })\n if (!tag) throw new CrudHttpError(404, { error: 'Tag not found' })\n ensureTenantScope(ctx, tag.tenantId)\n ensureOrganizationScope(ctx, tag.organizationId)\n await withAtomicFlush(em, [\n async () => {\n await em.nativeDelete(ResourcesResourceTagAssignment, { tag: tag.id })\n em.remove(tag)\n },\n ], { transaction: true })\n return { tagId: id }\n },\n buildLog: async ({ input, result, ctx }) => {\n const { translate } = await resolveTranslations()\n return {\n actionLabel: translate('resources.audit.resourceTags.delete', 'Delete resource tag'),\n resourceKind: 'resources.resourceTag',\n resourceId: result?.tagId ?? input?.id ?? null,\n tenantId: ctx.auth?.tenantId ?? null,\n organizationId: ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? null,\n }\n },\n}\n\nregisterCommand(createTagCommand)\nregisterCommand(updateTagCommand)\nregisterCommand(deleteTagCommand)\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,uBAAuB;AAEhC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAChC,SAAS,sBAAsB,sCAAsC;AACrE;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,yBAAyB,yBAAyB;AAE3D,MAAM,mBAAuF;AAAA,EAC3F,IAAI;AAAA,EACJ,MAAM,QAAQ,UAAU,KAAK;AAC3B,UAAM,SAAS,iCAAiC,MA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