@open-mercato/core 0.4.2-canary-da2b080494 → 0.4.2-canary-19353c5970
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/entities/notification/index.js +57 -0
- package/dist/generated/entities/notification/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 +2 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/api_docs/frontend/docs/api/page.js +3 -2
- package/dist/modules/api_docs/frontend/docs/api/page.js.map +2 -2
- package/dist/modules/api_keys/backend/api-keys/page.js +1 -1
- package/dist/modules/api_keys/backend/api-keys/page.js.map +2 -2
- package/dist/modules/attachments/components/AttachmentLibrary.js +4 -0
- package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
- package/dist/modules/attachments/components/AttachmentPartitionSettings.js +2 -0
- package/dist/modules/attachments/components/AttachmentPartitionSettings.js.map +2 -2
- package/dist/modules/auth/api/admin/nav.js +4 -3
- package/dist/modules/auth/api/admin/nav.js.map +2 -2
- package/dist/modules/auth/api/profile/route.js +157 -0
- package/dist/modules/auth/api/profile/route.js.map +7 -0
- package/dist/modules/auth/api/reset/confirm.js +25 -2
- package/dist/modules/auth/api/reset/confirm.js.map +2 -2
- package/dist/modules/auth/api/reset.js +23 -0
- package/dist/modules/auth/api/reset.js.map +2 -2
- package/dist/modules/auth/api/sidebar/preferences/route.js +14 -9
- package/dist/modules/auth/api/sidebar/preferences/route.js.map +2 -2
- package/dist/modules/auth/api/users/route.js +4 -2
- package/dist/modules/auth/api/users/route.js.map +2 -2
- package/dist/modules/auth/backend/auth/profile/page.js +141 -0
- package/dist/modules/auth/backend/auth/profile/page.js.map +7 -0
- package/dist/modules/auth/backend/auth/profile/page.meta.js +13 -0
- package/dist/modules/auth/backend/auth/profile/page.meta.js.map +7 -0
- package/dist/modules/auth/backend/roles/[id]/edit/page.js +4 -1
- package/dist/modules/auth/backend/roles/[id]/edit/page.js.map +2 -2
- package/dist/modules/auth/backend/roles/page.js +3 -3
- package/dist/modules/auth/backend/roles/page.js.map +2 -2
- package/dist/modules/auth/backend/users/[id]/edit/page.js +18 -3
- package/dist/modules/auth/backend/users/[id]/edit/page.js.map +2 -2
- package/dist/modules/auth/backend/users/create/page.js +15 -2
- package/dist/modules/auth/backend/users/create/page.js.map +2 -2
- package/dist/modules/auth/backend/users/page.js +3 -3
- package/dist/modules/auth/backend/users/page.js.map +2 -2
- package/dist/modules/auth/cli.js +25 -11
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/commands/users.js +59 -2
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/data/validators.js +4 -2
- package/dist/modules/auth/data/validators.js.map +2 -2
- package/dist/modules/auth/frontend/reset/[token]/page.js +20 -10
- package/dist/modules/auth/frontend/reset/[token]/page.js.map +2 -2
- package/dist/modules/auth/lib/setup-app.js +23 -2
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/auth/notifications.js +112 -0
- package/dist/modules/auth/notifications.js.map +7 -0
- package/dist/modules/auth/services/authService.js +3 -3
- package/dist/modules/auth/services/authService.js.map +2 -2
- package/dist/modules/business_rules/api/execute/route.js +7 -1
- package/dist/modules/business_rules/api/execute/route.js.map +2 -2
- package/dist/modules/business_rules/backend/rules/page.js +4 -0
- package/dist/modules/business_rules/backend/rules/page.js.map +2 -2
- package/dist/modules/business_rules/backend/sets/page.js +3 -0
- package/dist/modules/business_rules/backend/sets/page.js.map +2 -2
- package/dist/modules/business_rules/lib/rule-engine.js +33 -3
- package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
- package/dist/modules/business_rules/notifications.js +28 -0
- package/dist/modules/business_rules/notifications.js.map +7 -0
- package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js +37 -0
- package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js.map +7 -0
- package/dist/modules/catalog/components/PriceKindSettings.js +2 -0
- package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js +2 -2
- package/dist/modules/catalog/components/categories/CategoriesDataTable.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductsDataTable.js +2 -0
- package/dist/modules/catalog/components/products/ProductsDataTable.js.map +2 -2
- package/dist/modules/catalog/notifications.js +28 -0
- package/dist/modules/catalog/notifications.js.map +7 -0
- package/dist/modules/catalog/subscribers/low-stock-notification.js +38 -0
- package/dist/modules/catalog/subscribers/low-stock-notification.js.map +7 -0
- package/dist/modules/configs/cli.js +6 -0
- package/dist/modules/configs/cli.js.map +2 -2
- package/dist/modules/configs/components/CachePanel.js +4 -4
- package/dist/modules/configs/components/CachePanel.js.map +2 -2
- package/dist/modules/configs/lib/system-status.js +48 -1
- package/dist/modules/configs/lib/system-status.js.map +2 -2
- package/dist/modules/configs/lib/upgrade-actions.js +18 -0
- package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
- package/dist/modules/currencies/backend/currencies/page.js +3 -0
- package/dist/modules/currencies/backend/currencies/page.js.map +2 -2
- package/dist/modules/currencies/backend/exchange-rates/page.js +2 -0
- package/dist/modules/currencies/backend/exchange-rates/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/page.js +3 -0
- package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/page.js +3 -0
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/page.js +3 -0
- package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +31 -0
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/customers/components/CustomerTodosTable.js +1 -0
- package/dist/modules/customers/components/CustomerTodosTable.js.map +2 -2
- package/dist/modules/customers/notifications.js +48 -0
- package/dist/modules/customers/notifications.js.map +7 -0
- package/dist/modules/dashboards/cli.js +44 -5
- package/dist/modules/dashboards/cli.js.map +2 -2
- package/dist/modules/dashboards/components/WidgetVisibilityEditor.js +16 -11
- package/dist/modules/dashboards/components/WidgetVisibilityEditor.js.map +3 -3
- package/dist/modules/dashboards/lib/role-widgets.js +58 -0
- package/dist/modules/dashboards/lib/role-widgets.js.map +7 -0
- package/dist/modules/dashboards/services/widgetDataService.js +139 -3
- package/dist/modules/dashboards/services/widgetDataService.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionaryTable.js +2 -0
- package/dist/modules/dictionaries/components/DictionaryTable.js.map +2 -2
- package/dist/modules/directory/backend/directory/organizations/page.js +2 -2
- package/dist/modules/directory/backend/directory/organizations/page.js.map +2 -2
- package/dist/modules/directory/backend/directory/tenants/page.js +2 -2
- package/dist/modules/directory/backend/directory/tenants/page.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
- package/dist/modules/entities/components/SystemEntitiesTable.js +1 -1
- package/dist/modules/entities/components/SystemEntitiesTable.js.map +2 -2
- package/dist/modules/entities/components/UserEntitiesTable.js +2 -2
- package/dist/modules/entities/components/UserEntitiesTable.js.map +2 -2
- package/dist/modules/feature_toggles/components/FeatureTogglesTable.js +3 -3
- package/dist/modules/feature_toggles/components/FeatureTogglesTable.js.map +2 -2
- package/dist/modules/feature_toggles/components/OverridesTable.js +1 -1
- package/dist/modules/feature_toggles/components/OverridesTable.js.map +2 -2
- package/dist/modules/notifications/acl.js +11 -0
- package/dist/modules/notifications/acl.js.map +7 -0
- package/dist/modules/notifications/api/[id]/action/route.js +74 -0
- package/dist/modules/notifications/api/[id]/action/route.js.map +7 -0
- package/dist/modules/notifications/api/[id]/dismiss/route.js +15 -0
- package/dist/modules/notifications/api/[id]/dismiss/route.js.map +7 -0
- package/dist/modules/notifications/api/[id]/read/route.js +15 -0
- package/dist/modules/notifications/api/[id]/read/route.js.map +7 -0
- package/dist/modules/notifications/api/[id]/restore/route.js +53 -0
- package/dist/modules/notifications/api/[id]/restore/route.js.map +7 -0
- package/dist/modules/notifications/api/batch/route.js +17 -0
- package/dist/modules/notifications/api/batch/route.js.map +7 -0
- package/dist/modules/notifications/api/feature/route.js +17 -0
- package/dist/modules/notifications/api/feature/route.js.map +7 -0
- package/dist/modules/notifications/api/mark-all-read/route.js +35 -0
- package/dist/modules/notifications/api/mark-all-read/route.js.map +7 -0
- package/dist/modules/notifications/api/openapi.js +76 -0
- package/dist/modules/notifications/api/openapi.js.map +7 -0
- package/dist/modules/notifications/api/role/route.js +17 -0
- package/dist/modules/notifications/api/role/route.js.map +7 -0
- package/dist/modules/notifications/api/route.js +85 -0
- package/dist/modules/notifications/api/route.js.map +7 -0
- package/dist/modules/notifications/api/settings/route.js +155 -0
- package/dist/modules/notifications/api/settings/route.js.map +7 -0
- package/dist/modules/notifications/api/unread-count/route.js +38 -0
- package/dist/modules/notifications/api/unread-count/route.js.map +7 -0
- package/dist/modules/notifications/backend/config/notifications/page.js +10 -0
- package/dist/modules/notifications/backend/config/notifications/page.js.map +7 -0
- package/dist/modules/notifications/backend/config/notifications/page.meta.js +24 -0
- package/dist/modules/notifications/backend/config/notifications/page.meta.js.map +7 -0
- package/dist/modules/notifications/cli.js +16 -0
- package/dist/modules/notifications/cli.js.map +7 -0
- package/dist/modules/notifications/data/entities.js +112 -0
- package/dist/modules/notifications/data/entities.js.map +7 -0
- package/dist/modules/notifications/data/validators.js +98 -0
- package/dist/modules/notifications/data/validators.js.map +7 -0
- package/dist/modules/notifications/di.js +13 -0
- package/dist/modules/notifications/di.js.map +7 -0
- package/dist/modules/notifications/emails/NotificationEmail.js +58 -0
- package/dist/modules/notifications/emails/NotificationEmail.js.map +7 -0
- package/dist/modules/notifications/frontend/NotificationInboxPageClient.js +44 -0
- package/dist/modules/notifications/frontend/NotificationInboxPageClient.js.map +7 -0
- package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js +220 -0
- package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js.map +7 -0
- package/dist/modules/notifications/index.js +14 -0
- package/dist/modules/notifications/index.js.map +7 -0
- package/dist/modules/notifications/lib/deliveryConfig.js +107 -0
- package/dist/modules/notifications/lib/deliveryConfig.js.map +7 -0
- package/dist/modules/notifications/lib/deliveryStrategies.js +14 -0
- package/dist/modules/notifications/lib/deliveryStrategies.js.map +7 -0
- package/dist/modules/notifications/lib/events.js +12 -0
- package/dist/modules/notifications/lib/events.js.map +7 -0
- package/dist/modules/notifications/lib/notificationBuilder.js +66 -0
- package/dist/modules/notifications/lib/notificationBuilder.js.map +7 -0
- package/dist/modules/notifications/lib/notificationFactory.js +54 -0
- package/dist/modules/notifications/lib/notificationFactory.js.map +7 -0
- package/dist/modules/notifications/lib/notificationMapper.js +34 -0
- package/dist/modules/notifications/lib/notificationMapper.js.map +7 -0
- package/dist/modules/notifications/lib/notificationRecipients.js +35 -0
- package/dist/modules/notifications/lib/notificationRecipients.js.map +7 -0
- package/dist/modules/notifications/lib/notificationService.js +279 -0
- package/dist/modules/notifications/lib/notificationService.js.map +7 -0
- package/dist/modules/notifications/lib/routeHelpers.js +101 -0
- package/dist/modules/notifications/lib/routeHelpers.js.map +7 -0
- package/dist/modules/notifications/lib/safeHref.js +24 -0
- package/dist/modules/notifications/lib/safeHref.js.map +7 -0
- package/dist/modules/notifications/migrations/Migration20260123000001.js +70 -0
- package/dist/modules/notifications/migrations/Migration20260123000001.js.map +7 -0
- package/dist/modules/notifications/migrations/Migration20260126150000.js +37 -0
- package/dist/modules/notifications/migrations/Migration20260126150000.js.map +7 -0
- package/dist/modules/notifications/subscribers/deliver-notification.js +165 -0
- package/dist/modules/notifications/subscribers/deliver-notification.js.map +7 -0
- package/dist/modules/notifications/workers/create-notification.worker.js +70 -0
- package/dist/modules/notifications/workers/create-notification.worker.js.map +7 -0
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js +2 -2
- package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
- package/dist/modules/query_index/components/QueryIndexesTable.js +7 -1
- package/dist/modules/query_index/components/QueryIndexesTable.js.map +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js +2 -2
- package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resources/page.js +2 -2
- package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/offers/page.js +2 -0
- package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/page.js +2 -0
- package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +53 -0
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/commands/payments.js +26 -0
- package/dist/modules/sales/commands/payments.js.map +2 -2
- package/dist/modules/sales/components/AdjustmentKindSettings.js +2 -2
- package/dist/modules/sales/components/AdjustmentKindSettings.js.map +2 -2
- package/dist/modules/sales/components/PaymentMethodsSettings.js +2 -2
- package/dist/modules/sales/components/PaymentMethodsSettings.js.map +2 -2
- package/dist/modules/sales/components/ShippingMethodsSettings.js +2 -2
- package/dist/modules/sales/components/ShippingMethodsSettings.js.map +2 -2
- package/dist/modules/sales/components/TaxRatesSettings.js +2 -2
- package/dist/modules/sales/components/TaxRatesSettings.js.map +2 -2
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js +2 -0
- package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js.map +2 -2
- package/dist/modules/sales/components/documents/AdjustmentsSection.js +2 -0
- package/dist/modules/sales/components/documents/AdjustmentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/PaymentsSection.js +2 -1
- package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js +2 -0
- package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
- package/dist/modules/sales/notifications.client.js +51 -0
- package/dist/modules/sales/notifications.client.js.map +7 -0
- package/dist/modules/sales/notifications.js +88 -0
- package/dist/modules/sales/notifications.js.map +7 -0
- package/dist/modules/sales/subscribers/quote-expiring-notification.js +38 -0
- package/dist/modules/sales/subscribers/quote-expiring-notification.js.map +7 -0
- package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js +137 -0
- package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js.map +7 -0
- package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js +137 -0
- package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js.map +7 -0
- package/dist/modules/sales/widgets/notifications/index.js +7 -0
- package/dist/modules/sales/widgets/notifications/index.js.map +7 -0
- package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js +60 -0
- package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js.map +7 -0
- package/dist/modules/staff/backend/staff/team-members/page.js +1 -1
- package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-roles/page.js +2 -2
- package/dist/modules/staff/backend/staff/team-roles/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +2 -2
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/page.js +2 -2
- package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
- package/dist/modules/staff/commands/leave-requests.js +79 -0
- package/dist/modules/staff/commands/leave-requests.js.map +2 -2
- package/dist/modules/staff/notifications.js +75 -0
- package/dist/modules/staff/notifications.js.map +7 -0
- package/dist/modules/workflows/backend/definitions/page.js +5 -0
- package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/page.js +3 -0
- package/dist/modules/workflows/backend/instances/page.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/page.js +3 -0
- package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
- package/dist/modules/workflows/lib/transition-handler.js +14 -6
- package/dist/modules/workflows/lib/transition-handler.js.map +2 -2
- package/dist/modules/workflows/notifications.js +28 -0
- package/dist/modules/workflows/notifications.js.map +7 -0
- package/dist/modules/workflows/subscribers/task-assigned-notification.js +38 -0
- package/dist/modules/workflows/subscribers/task-assigned-notification.js.map +7 -0
- package/generated/entities/notification/index.ts +27 -0
- package/generated/entities.ids.generated.ts +5 -1
- package/generated/entity-fields-registry.ts +2 -0
- package/package.json +2 -2
- package/src/modules/api_docs/frontend/docs/api/page.tsx +3 -2
- package/src/modules/api_keys/backend/api-keys/page.tsx +1 -1
- package/src/modules/attachments/components/AttachmentLibrary.tsx +4 -0
- package/src/modules/attachments/components/AttachmentPartitionSettings.tsx +2 -0
- package/src/modules/auth/README.md +1 -1
- package/src/modules/auth/__tests__/cli-setup-acl.test.ts +1 -1
- package/src/modules/auth/api/admin/nav.ts +10 -6
- package/src/modules/auth/api/profile/route.ts +163 -0
- package/src/modules/auth/api/reset/confirm.ts +25 -2
- package/src/modules/auth/api/reset.ts +23 -0
- package/src/modules/auth/api/sidebar/preferences/route.ts +21 -12
- package/src/modules/auth/api/users/route.ts +5 -2
- package/src/modules/auth/backend/auth/profile/page.meta.ts +9 -0
- package/src/modules/auth/backend/auth/profile/page.tsx +174 -0
- package/src/modules/auth/backend/roles/[id]/edit/page.tsx +4 -1
- package/src/modules/auth/backend/roles/page.tsx +3 -3
- package/src/modules/auth/backend/users/[id]/edit/page.tsx +22 -3
- package/src/modules/auth/backend/users/create/page.tsx +19 -2
- package/src/modules/auth/backend/users/page.tsx +3 -3
- package/src/modules/auth/cli.ts +38 -11
- package/src/modules/auth/commands/users.ts +73 -2
- package/src/modules/auth/data/validators.ts +5 -2
- package/src/modules/auth/frontend/reset/[token]/page.tsx +24 -11
- package/src/modules/auth/i18n/de.json +43 -1
- package/src/modules/auth/i18n/en.json +43 -1
- package/src/modules/auth/i18n/es.json +43 -1
- package/src/modules/auth/i18n/pl.json +43 -1
- package/src/modules/auth/lib/setup-app.ts +29 -2
- package/src/modules/auth/notifications.ts +109 -0
- package/src/modules/auth/services/authService.ts +4 -4
- package/src/modules/business_rules/api/execute/route.ts +8 -1
- package/src/modules/business_rules/backend/rules/page.tsx +4 -0
- package/src/modules/business_rules/backend/sets/page.tsx +3 -0
- package/src/modules/business_rules/i18n/en.json +3 -1
- package/src/modules/business_rules/lib/__tests__/rule-engine.test.ts +51 -0
- package/src/modules/business_rules/lib/rule-engine.ts +57 -3
- package/src/modules/business_rules/notifications.ts +25 -0
- package/src/modules/business_rules/subscribers/rule-execution-failed-notification.ts +50 -0
- package/src/modules/catalog/components/PriceKindSettings.tsx +2 -0
- package/src/modules/catalog/components/categories/CategoriesDataTable.tsx +2 -2
- package/src/modules/catalog/components/products/ProductsDataTable.tsx +2 -0
- package/src/modules/catalog/i18n/en.json +3 -1
- package/src/modules/catalog/notifications.ts +25 -0
- package/src/modules/catalog/subscribers/low-stock-notification.ts +52 -0
- package/src/modules/configs/cli.ts +6 -0
- package/src/modules/configs/components/CachePanel.tsx +4 -4
- package/src/modules/configs/i18n/en.json +12 -2
- package/src/modules/configs/i18n/pl.json +12 -2
- package/src/modules/configs/lib/system-status.ts +48 -1
- package/src/modules/configs/lib/system-status.types.ts +1 -0
- package/src/modules/configs/lib/upgrade-actions.ts +18 -0
- package/src/modules/currencies/backend/currencies/page.tsx +3 -0
- package/src/modules/currencies/backend/exchange-rates/page.tsx +2 -0
- package/src/modules/customers/backend/customers/companies/page.tsx +3 -0
- package/src/modules/customers/backend/customers/deals/page.tsx +3 -0
- package/src/modules/customers/backend/customers/people/page.tsx +3 -0
- package/src/modules/customers/commands/deals.ts +39 -0
- package/src/modules/customers/components/CustomerTodosTable.tsx +1 -0
- package/src/modules/customers/i18n/en.json +5 -1
- package/src/modules/customers/notifications.ts +44 -0
- package/src/modules/dashboards/cli.ts +55 -5
- package/src/modules/dashboards/components/WidgetVisibilityEditor.tsx +22 -11
- package/src/modules/dashboards/lib/role-widgets.ts +80 -0
- package/src/modules/dashboards/services/widgetDataService.ts +164 -4
- package/src/modules/dictionaries/components/DictionaryTable.tsx +2 -0
- package/src/modules/directory/backend/directory/organizations/page.tsx +2 -2
- package/src/modules/directory/backend/directory/tenants/page.tsx +2 -2
- package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +2 -2
- package/src/modules/entities/components/SystemEntitiesTable.tsx +1 -1
- package/src/modules/entities/components/UserEntitiesTable.tsx +2 -2
- package/src/modules/feature_toggles/components/FeatureTogglesTable.tsx +3 -4
- package/src/modules/feature_toggles/components/OverridesTable.tsx +1 -1
- package/src/modules/notifications/__tests__/deliver-notification.test.ts +195 -0
- package/src/modules/notifications/__tests__/deliveryStrategies.test.ts +19 -0
- package/src/modules/notifications/__tests__/notificationService.test.ts +208 -0
- package/src/modules/notifications/acl.ts +7 -0
- package/src/modules/notifications/api/[id]/action/route.ts +75 -0
- package/src/modules/notifications/api/[id]/dismiss/route.ts +12 -0
- package/src/modules/notifications/api/[id]/read/route.ts +12 -0
- package/src/modules/notifications/api/[id]/restore/route.ts +53 -0
- package/src/modules/notifications/api/batch/route.ts +14 -0
- package/src/modules/notifications/api/feature/route.ts +14 -0
- package/src/modules/notifications/api/mark-all-read/route.ts +34 -0
- package/src/modules/notifications/api/openapi.ts +76 -0
- package/src/modules/notifications/api/role/route.ts +14 -0
- package/src/modules/notifications/api/route.ts +92 -0
- package/src/modules/notifications/api/settings/route.ts +157 -0
- package/src/modules/notifications/api/unread-count/route.ts +38 -0
- package/src/modules/notifications/backend/config/notifications/page.meta.ts +22 -0
- package/src/modules/notifications/backend/config/notifications/page.tsx +12 -0
- package/src/modules/notifications/cli.ts +18 -0
- package/src/modules/notifications/data/entities.ts +99 -0
- package/src/modules/notifications/data/validators.ts +115 -0
- package/src/modules/notifications/di.ts +11 -0
- package/src/modules/notifications/emails/NotificationEmail.tsx +98 -0
- package/src/modules/notifications/frontend/NotificationInboxPageClient.tsx +42 -0
- package/src/modules/notifications/frontend/NotificationSettingsPageClient.tsx +233 -0
- package/src/modules/notifications/i18n/de.json +50 -0
- package/src/modules/notifications/i18n/en.json +50 -0
- package/src/modules/notifications/i18n/es.json +50 -0
- package/src/modules/notifications/i18n/pl.json +50 -0
- package/src/modules/notifications/index.ts +12 -0
- package/src/modules/notifications/lib/deliveryConfig.ts +153 -0
- package/src/modules/notifications/lib/deliveryStrategies.ts +50 -0
- package/src/modules/notifications/lib/events.ts +48 -0
- package/src/modules/notifications/lib/notificationBuilder.ts +121 -0
- package/src/modules/notifications/lib/notificationFactory.ts +76 -0
- package/src/modules/notifications/lib/notificationMapper.ts +33 -0
- package/src/modules/notifications/lib/notificationRecipients.ts +83 -0
- package/src/modules/notifications/lib/notificationService.ts +414 -0
- package/src/modules/notifications/lib/routeHelpers.ts +151 -0
- package/src/modules/notifications/lib/safeHref.ts +29 -0
- package/src/modules/notifications/migrations/.snapshot-open-mercato.json +300 -0
- package/src/modules/notifications/migrations/Migration20260123000001.ts +73 -0
- package/src/modules/notifications/migrations/Migration20260126150000.ts +39 -0
- package/src/modules/notifications/subscribers/deliver-notification.ts +204 -0
- package/src/modules/notifications/workers/create-notification.worker.ts +122 -0
- package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +2 -2
- package/src/modules/query_index/components/QueryIndexesTable.tsx +8 -2
- package/src/modules/resources/backend/resources/resource-types/page.tsx +2 -2
- package/src/modules/resources/backend/resources/resources/page.tsx +2 -2
- package/src/modules/sales/backend/sales/channels/offers/page.tsx +2 -0
- package/src/modules/sales/backend/sales/channels/page.tsx +2 -0
- package/src/modules/sales/commands/documents.ts +65 -0
- package/src/modules/sales/commands/payments.ts +33 -0
- package/src/modules/sales/components/AdjustmentKindSettings.tsx +2 -2
- package/src/modules/sales/components/PaymentMethodsSettings.tsx +2 -2
- package/src/modules/sales/components/ShippingMethodsSettings.tsx +2 -2
- package/src/modules/sales/components/TaxRatesSettings.tsx +2 -2
- package/src/modules/sales/components/channels/SalesChannelOffersPanel.tsx +2 -0
- package/src/modules/sales/components/documents/AdjustmentsSection.tsx +2 -0
- package/src/modules/sales/components/documents/PaymentsSection.tsx +2 -1
- package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +2 -0
- package/src/modules/sales/i18n/de.json +20 -0
- package/src/modules/sales/i18n/en.json +25 -1
- package/src/modules/sales/i18n/es.json +20 -0
- package/src/modules/sales/i18n/pl.json +20 -0
- package/src/modules/sales/notifications.client.ts +65 -0
- package/src/modules/sales/notifications.ts +82 -0
- package/src/modules/sales/subscribers/quote-expiring-notification.ts +53 -0
- package/src/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.tsx +156 -0
- package/src/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.tsx +156 -0
- package/src/modules/sales/widgets/notifications/index.ts +2 -0
- package/src/modules/sales/widgets/notifications/useSalesDocumentTotals.ts +81 -0
- package/src/modules/staff/backend/staff/team-members/page.tsx +1 -1
- package/src/modules/staff/backend/staff/team-roles/page.tsx +2 -2
- package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +2 -2
- package/src/modules/staff/backend/staff/teams/page.tsx +2 -2
- package/src/modules/staff/commands/leave-requests.ts +94 -0
- package/src/modules/staff/i18n/de.json +4 -0
- package/src/modules/staff/i18n/en.json +9 -1
- package/src/modules/staff/i18n/es.json +4 -0
- package/src/modules/staff/i18n/pl.json +4 -0
- package/src/modules/staff/notifications.ts +71 -0
- package/src/modules/workflows/backend/definitions/page.tsx +5 -0
- package/src/modules/workflows/backend/instances/page.tsx +4 -1
- package/src/modules/workflows/backend/tasks/page.tsx +4 -1
- package/src/modules/workflows/i18n/en.json +3 -1
- package/src/modules/workflows/lib/transition-handler.ts +18 -6
- package/src/modules/workflows/notifications.ts +25 -0
- package/src/modules/workflows/subscribers/task-assigned-notification.ts +53 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/feature_toggles/components/OverridesTable.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport { DataTable } from \"@open-mercato/ui/backend/DataTable\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { apiCall } from \"@open-mercato/ui/backend/utils/apiCall\";\nimport { raiseCrudError } from \"@open-mercato/ui/backend/utils/serverErrors\";\nimport { useT } from \"@open-mercato/shared/lib/i18n/context\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { ColumnDef, SortingState } from \"@tanstack/react-table\";\nimport * as React from 'react'\nimport type { FilterDef, FilterValues } from \"@open-mercato/ui/backend/FilterBar\"\nimport { RowActions } from \"@open-mercato/ui/backend/RowActions\";\nimport { OverrideListResponse } from \"../data/validators\";\n\n\nexport default function OverridesTable() {\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [sorting, setSorting] = React.useState<SortingState>([])\n const [pagination, setPagination] = React.useState({ page: 1, pageSize: 25 })\n\n const t = useT()\n const queryClient = useQueryClient()\n\n const sortField = sorting.length > 0 ? sorting[0].id : undefined\n const sortDir = sorting.length > 0 && sorting[0].desc ? 'desc' : 'asc'\n\n const queryParams = React.useMemo(() => {\n const params = new URLSearchParams()\n Object.entries(filterValues).forEach(([key, value]) => {\n params.set(key, value as string)\n })\n if (sortField) params.set('sortField', sortField)\n if (sorting.length > 0) params.set('sortDir', sortDir)\n\n params.set('page', pagination.page.toString())\n params.set('pageSize', pagination.pageSize.toString())\n\n return params.toString()\n }, [filterValues, sortField, sortDir, pagination])\n\n const { data: featureTogglesData, isLoading, error } = useQuery({\n queryKey: ['feature_toggle_overrides', queryParams],\n queryFn: async () => {\n const call = await apiCall<{\n items: OverrideListResponse[];\n total: number;\n totalPages: number;\n page: number;\n pageSize: number;\n isSuperAdmin?: boolean\n }>(`/api/feature_toggles/overrides?${queryParams}`)\n if (!call.ok) {\n await raiseCrudError(call.response, t('feature_toggles.list.error.load', 'Failed to load feature toggles'))\n }\n return call.result ?? {\n items: [],\n total: 0,\n totalPages: 1,\n page: 1,\n pageSize: 25\n }\n },\n })\n\n const handleFiltersApply = React.useCallback((values: FilterValues) => {\n setFilterValues(values)\n }, [])\n\n const handleFiltersClear = React.useCallback(() => {\n setFilterValues({})\n }, [])\n\n const handleSortingChange = React.useCallback((newSorting: SortingState) => {\n setSorting(newSorting)\n }, [])\n\n const handlePageChange = React.useCallback((page: number) => {\n setPagination(prev => ({ ...prev, page }))\n }, [])\n\n const handleRefresh = React.useCallback(() => {\n void queryClient.refetchQueries({ queryKey: ['feature_toggle_overrides'] })\n }, [queryClient])\n\n const columns = React.useMemo<ColumnDef<OverrideListResponse>[]>(() => {\n return [\n {\n accessorKey: 'tenantName',\n header: t('feature_toggles.overrides.headers.tenant', 'Tenant'),\n enableSorting: true\n },\n {\n accessorKey: 'identifier',\n header: t('feature_toggles.overrides.headers.identifier', 'Identifier'),\n enableSorting: true\n },\n {\n accessorKey: 'name',\n header: t('feature_toggles.overrides.headers.name', 'Name'),\n enableSorting: true\n },\n {\n accessorKey: 'category',\n header: t('feature_toggles.overrides.headers.category', 'Category'),\n enableSorting: true\n },\n {\n accessorKey: 'isOverride',\n header: t('feature_toggles.overrides.headers.overrideState', 'Override'),\n enableSorting: false,\n cell: ({ row }) => {\n return row.original.isOverride ? t('feature_toggles.overrides.headers.isOverride.true', 'Yes') : t('feature_toggles.overrides.headers.isOverride.false', 'No')\n },\n },\n ]\n }, [])\n\n\n const filters = React.useMemo<FilterDef[]>(() => [\n {\n id: 'identifier',\n label: t('feature_toggles.list.filters.identifier', 'Identifier'),\n type: 'text',\n },\n {\n id: 'name',\n label: t('feature_toggles.list.filters.name', 'Name'),\n type: 'text',\n },\n {\n id: 'category',\n label: t('feature_toggles.list.filters.category', 'Category'),\n type: 'text',\n }\n ], [t])\n\n return (\n <DataTable\n title={t('feature_toggles.overrides.help.title', 'Feature Toggle Overrides')}\n columns={columns}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={handleFiltersApply}\n onFiltersClear={handleFiltersClear}\n data={featureTogglesData?.items ?? []}\n isLoading={isLoading}\n sorting={sorting}\n onSortingChange={handleSortingChange}\n sortable={true}\n pagination={{\n page: featureTogglesData?.page ?? 1,\n pageSize: featureTogglesData?.pageSize ?? 25,\n total: featureTogglesData?.total ?? 0,\n totalPages: featureTogglesData?.totalPages ?? 1,\n onPageChange: handlePageChange,\n }}\n refreshButton={{\n label: t('feature_toggles.list.table.refresh', 'Refresh'),\n onRefresh: handleRefresh,\n isRefreshing: isLoading,\n }}\n rowActions={(row) => (\n <RowActions items={[\n { label: t('common.edit', 'Edit'), href: `/backend/feature-toggles/global/${row.toggleId}` },\n ]} />\n )}\n error={error ? error.message : undefined}\n />\n )\n}\n"],
|
|
5
|
-
"mappings": ";AAkKgB;AAhKhB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAE/B,YAAY,WAAW;AAEvB,SAAS,kBAAkB;AAIZ,SAAR,iBAAkC;AACrC,QAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAuB,CAAC,CAAC;AACvE,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAuB,CAAC,CAAC;AAC7D,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,CAAC;AAE5E,QAAM,IAAI,KAAK;AACf,QAAM,cAAc,eAAe;AAEnC,QAAM,YAAY,QAAQ,SAAS,IAAI,QAAQ,CAAC,EAAE,KAAK;AACvD,QAAM,UAAU,QAAQ,SAAS,KAAK,QAAQ,CAAC,EAAE,OAAO,SAAS;AAEjE,QAAM,cAAc,MAAM,QAAQ,MAAM;AACpC,UAAM,SAAS,IAAI,gBAAgB;AACnC,WAAO,QAAQ,YAAY,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACnD,aAAO,IAAI,KAAK,KAAe;AAAA,IACnC,CAAC;AACD,QAAI,UAAW,QAAO,IAAI,aAAa,SAAS;AAChD,QAAI,QAAQ,SAAS,EAAG,QAAO,IAAI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iB;AAAA,MACjB,UAAU;AAAA,MACV,YAAY;AAAA,QACR,MAAM,oBAAoB,QAAQ;AAAA,QAClC,UAAU,oBAAoB,YAAY;AAAA,QAC1C,OAAO,oBAAoB,SAAS;AAAA,QACpC,YAAY,oBAAoB,cAAc;AAAA,QAC9C,cAAc;AAAA,MAClB;AAAA,MACA,eAAe;AAAA,QACX,OAAO,EAAE,sCAAsC,SAAS;AAAA,QACxD,WAAW;AAAA,QACX,cAAc;AAAA,MAClB;AAAA,MACA,YAAY,CAAC,QACT,oBAAC,cAAW,OAAO;AAAA,QACf,EAAE,OAAO,EAAE,eAAe,MAAM,GAAG,MAAM,mCAAmC,IAAI,QAAQ,GAAG;AAAA,
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport { DataTable } from \"@open-mercato/ui/backend/DataTable\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { apiCall } from \"@open-mercato/ui/backend/utils/apiCall\";\nimport { raiseCrudError } from \"@open-mercato/ui/backend/utils/serverErrors\";\nimport { useT } from \"@open-mercato/shared/lib/i18n/context\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { ColumnDef, SortingState } from \"@tanstack/react-table\";\nimport * as React from 'react'\nimport type { FilterDef, FilterValues } from \"@open-mercato/ui/backend/FilterBar\"\nimport { RowActions } from \"@open-mercato/ui/backend/RowActions\";\nimport { OverrideListResponse } from \"../data/validators\";\n\n\nexport default function OverridesTable() {\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [sorting, setSorting] = React.useState<SortingState>([])\n const [pagination, setPagination] = React.useState({ page: 1, pageSize: 25 })\n\n const t = useT()\n const queryClient = useQueryClient()\n\n const sortField = sorting.length > 0 ? sorting[0].id : undefined\n const sortDir = sorting.length > 0 && sorting[0].desc ? 'desc' : 'asc'\n\n const queryParams = React.useMemo(() => {\n const params = new URLSearchParams()\n Object.entries(filterValues).forEach(([key, value]) => {\n params.set(key, value as string)\n })\n if (sortField) params.set('sortField', sortField)\n if (sorting.length > 0) params.set('sortDir', sortDir)\n\n params.set('page', pagination.page.toString())\n params.set('pageSize', pagination.pageSize.toString())\n\n return params.toString()\n }, [filterValues, sortField, sortDir, pagination])\n\n const { data: featureTogglesData, isLoading, error } = useQuery({\n queryKey: ['feature_toggle_overrides', queryParams],\n queryFn: async () => {\n const call = await apiCall<{\n items: OverrideListResponse[];\n total: number;\n totalPages: number;\n page: number;\n pageSize: number;\n isSuperAdmin?: boolean\n }>(`/api/feature_toggles/overrides?${queryParams}`)\n if (!call.ok) {\n await raiseCrudError(call.response, t('feature_toggles.list.error.load', 'Failed to load feature toggles'))\n }\n return call.result ?? {\n items: [],\n total: 0,\n totalPages: 1,\n page: 1,\n pageSize: 25\n }\n },\n })\n\n const handleFiltersApply = React.useCallback((values: FilterValues) => {\n setFilterValues(values)\n }, [])\n\n const handleFiltersClear = React.useCallback(() => {\n setFilterValues({})\n }, [])\n\n const handleSortingChange = React.useCallback((newSorting: SortingState) => {\n setSorting(newSorting)\n }, [])\n\n const handlePageChange = React.useCallback((page: number) => {\n setPagination(prev => ({ ...prev, page }))\n }, [])\n\n const handleRefresh = React.useCallback(() => {\n void queryClient.refetchQueries({ queryKey: ['feature_toggle_overrides'] })\n }, [queryClient])\n\n const columns = React.useMemo<ColumnDef<OverrideListResponse>[]>(() => {\n return [\n {\n accessorKey: 'tenantName',\n header: t('feature_toggles.overrides.headers.tenant', 'Tenant'),\n enableSorting: true\n },\n {\n accessorKey: 'identifier',\n header: t('feature_toggles.overrides.headers.identifier', 'Identifier'),\n enableSorting: true\n },\n {\n accessorKey: 'name',\n header: t('feature_toggles.overrides.headers.name', 'Name'),\n enableSorting: true\n },\n {\n accessorKey: 'category',\n header: t('feature_toggles.overrides.headers.category', 'Category'),\n enableSorting: true\n },\n {\n accessorKey: 'isOverride',\n header: t('feature_toggles.overrides.headers.overrideState', 'Override'),\n enableSorting: false,\n cell: ({ row }) => {\n return row.original.isOverride ? t('feature_toggles.overrides.headers.isOverride.true', 'Yes') : t('feature_toggles.overrides.headers.isOverride.false', 'No')\n },\n },\n ]\n }, [])\n\n\n const filters = React.useMemo<FilterDef[]>(() => [\n {\n id: 'identifier',\n label: t('feature_toggles.list.filters.identifier', 'Identifier'),\n type: 'text',\n },\n {\n id: 'name',\n label: t('feature_toggles.list.filters.name', 'Name'),\n type: 'text',\n },\n {\n id: 'category',\n label: t('feature_toggles.list.filters.category', 'Category'),\n type: 'text',\n }\n ], [t])\n\n return (\n <DataTable\n title={t('feature_toggles.overrides.help.title', 'Feature Toggle Overrides')}\n columns={columns}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={handleFiltersApply}\n onFiltersClear={handleFiltersClear}\n data={featureTogglesData?.items ?? []}\n isLoading={isLoading}\n sorting={sorting}\n onSortingChange={handleSortingChange}\n sortable={true}\n pagination={{\n page: featureTogglesData?.page ?? 1,\n pageSize: featureTogglesData?.pageSize ?? 25,\n total: featureTogglesData?.total ?? 0,\n totalPages: featureTogglesData?.totalPages ?? 1,\n onPageChange: handlePageChange,\n }}\n refreshButton={{\n label: t('feature_toggles.list.table.refresh', 'Refresh'),\n onRefresh: handleRefresh,\n isRefreshing: isLoading,\n }}\n rowActions={(row) => (\n <RowActions items={[\n { id: 'edit', label: t('common.edit', 'Edit'), href: `/backend/feature-toggles/global/${row.toggleId}` },\n ]} />\n )}\n error={error ? error.message : undefined}\n />\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAkKgB;AAhKhB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAE/B,YAAY,WAAW;AAEvB,SAAS,kBAAkB;AAIZ,SAAR,iBAAkC;AACrC,QAAM,CAAC,cAAc,eAAe,IAAI,MAAM,SAAuB,CAAC,CAAC;AACvE,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAuB,CAAC,CAAC;AAC7D,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM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AE,2CAA2C,YAAY;AAAA,MAChE,MAAM;AAAA,IACV;AAAA,IACA;AAAA,MACI,IAAI;AAAA,MACJ,OAAO,EAAE,qCAAqC,MAAM;AAAA,MACpD,MAAM;AAAA,IACV;AAAA,IACA;AAAA,MACI,IAAI;AAAA,MACJ,OAAO,EAAE,yCAAyC,UAAU;AAAA,MAC5D,MAAM;AAAA,IACV;AAAA,EACJ,GAAG,CAAC,CAAC,CAAC;AAEN,SACI;AAAA,IAAC;AAAA;AAAA,MACG,OAAO,EAAE,wCAAwC,0BAA0B;AAAA,MAC3E;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB,MAAM,oBAAoB,SAAS,CAAC;AAAA,MACpC;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjB,UAAU;AAAA,MACV,YAAY;AAAA,QACR,MAAM,oBAAoB,QAAQ;AAAA,QAClC,UAAU,oBAAoB,YAAY;AAAA,QAC1C,OAAO,oBAAoB,SAAS;AAAA,QACpC,YAAY,oBAAoB,cAAc;AAAA,QAC9C,cAAc;AAAA,MAClB;AAAA,MACA,eAAe;AAAA,QACX,OAAO,EAAE,sCAAsC,SAAS;AAAA,QACxD,WAAW;AAAA,QACX,cAAc;AAAA,MAClB;AAAA,MACA,YAAY,CAAC,QACT,oBAAC,cAAW,OAAO;AAAA,QACf,EAAE,IAAI,QAAQ,OAAO,EAAE,eAAe,MAAM,GAAG,MAAM,mCAAmC,IAAI,QAAQ,GAAG;AAAA,MAC3G,GAAG;AAAA,MAEP,OAAO,QAAQ,MAAM,UAAU;AAAA;AAAA,EACnC;AAER;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const features = [
|
|
2
|
+
{ id: "notifications.view", title: "View own notifications", module: "notifications" },
|
|
3
|
+
{ id: "notifications.create", title: "Create notifications for others", module: "notifications" },
|
|
4
|
+
{ id: "notifications.manage", title: "Manage all notifications", module: "notifications" }
|
|
5
|
+
];
|
|
6
|
+
var acl_default = features;
|
|
7
|
+
export {
|
|
8
|
+
acl_default as default,
|
|
9
|
+
features
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=acl.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/modules/notifications/acl.ts"],
|
|
4
|
+
"sourcesContent": ["export const features = [\n { id: 'notifications.view', title: 'View own notifications', module: 'notifications' },\n { id: 'notifications.create', title: 'Create notifications for others', module: 'notifications' },\n { id: 'notifications.manage', title: 'Manage all notifications', module: 'notifications' },\n]\n\nexport default features\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,WAAW;AAAA,EACtB,EAAE,IAAI,sBAAsB,OAAO,0BAA0B,QAAQ,gBAAgB;AAAA,EACrF,EAAE,IAAI,wBAAwB,OAAO,mCAAmC,QAAQ,gBAAgB;AAAA,EAChG,EAAE,IAAI,wBAAwB,OAAO,4BAA4B,QAAQ,gBAAgB;AAC3F;AAEA,IAAO,cAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { executeActionSchema } from "../../../data/validators.js";
|
|
2
|
+
import { actionResultResponseSchema, errorResponseSchema } from "../../openapi.js";
|
|
3
|
+
import { resolveNotificationContext } from "../../../lib/routeHelpers.js";
|
|
4
|
+
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
5
|
+
const metadata = {
|
|
6
|
+
POST: { requireAuth: true }
|
|
7
|
+
};
|
|
8
|
+
async function POST(req, { params }) {
|
|
9
|
+
const { id } = await params;
|
|
10
|
+
const { service, scope } = await resolveNotificationContext(req);
|
|
11
|
+
const body = await req.json().catch(() => ({}));
|
|
12
|
+
const input = executeActionSchema.parse(body);
|
|
13
|
+
try {
|
|
14
|
+
const { notification, result } = await service.executeAction(id, input, scope);
|
|
15
|
+
const action = notification.actionData?.actions?.find((a) => a.id === input.actionId);
|
|
16
|
+
const href = action?.href?.replace("{sourceEntityId}", notification.sourceEntityId ?? "");
|
|
17
|
+
return Response.json({
|
|
18
|
+
ok: true,
|
|
19
|
+
result,
|
|
20
|
+
href
|
|
21
|
+
});
|
|
22
|
+
} catch (error) {
|
|
23
|
+
const { t } = await resolveTranslations();
|
|
24
|
+
const fallback = t("notifications.error.action", "Failed to execute action");
|
|
25
|
+
const message = error instanceof Error && error.message ? error.message : fallback;
|
|
26
|
+
return Response.json({ error: message }, { status: 400 });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const openApi = {
|
|
30
|
+
POST: {
|
|
31
|
+
summary: "Execute notification action",
|
|
32
|
+
tags: ["Notifications"],
|
|
33
|
+
parameters: [
|
|
34
|
+
{
|
|
35
|
+
name: "id",
|
|
36
|
+
in: "path",
|
|
37
|
+
required: true,
|
|
38
|
+
schema: { type: "string", format: "uuid" }
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
requestBody: {
|
|
42
|
+
required: true,
|
|
43
|
+
content: {
|
|
44
|
+
"application/json": {
|
|
45
|
+
schema: executeActionSchema
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
responses: {
|
|
50
|
+
200: {
|
|
51
|
+
description: "Action executed successfully",
|
|
52
|
+
content: {
|
|
53
|
+
"application/json": {
|
|
54
|
+
schema: actionResultResponseSchema
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
400: {
|
|
59
|
+
description: "Action not found or failed",
|
|
60
|
+
content: {
|
|
61
|
+
"application/json": {
|
|
62
|
+
schema: errorResponseSchema
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
POST,
|
|
71
|
+
metadata,
|
|
72
|
+
openApi
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/notifications/api/%5Bid%5D/action/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { executeActionSchema } from '../../../data/validators'\nimport { actionResultResponseSchema, errorResponseSchema } from '../../openapi'\nimport { resolveNotificationContext } from '../../../lib/routeHelpers'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\n\nexport const metadata = {\n POST: { requireAuth: true },\n}\n\nexport async function POST(req: Request, { params }: { params: Promise<{ id: string }> }) {\n const { id } = await params\n const { service, scope } = await resolveNotificationContext(req)\n\n const body = await req.json().catch(() => ({}))\n const input = executeActionSchema.parse(body)\n\n try {\n const { notification, result } = await service.executeAction(id, input, scope)\n\n const action = notification.actionData?.actions?.find((a) => a.id === input.actionId)\n const href = action?.href?.replace('{sourceEntityId}', notification.sourceEntityId ?? '')\n\n return Response.json({\n ok: true,\n result,\n href,\n })\n } catch (error) {\n const { t } = await resolveTranslations()\n const fallback = t('notifications.error.action', 'Failed to execute action')\n const message = error instanceof Error && error.message ? error.message : fallback\n return Response.json({ error: message }, { status: 400 })\n }\n}\n\nexport const openApi = {\n POST: {\n summary: 'Execute notification action',\n tags: ['Notifications'],\n parameters: [\n {\n name: 'id',\n in: 'path',\n required: true,\n schema: { type: 'string', format: 'uuid' },\n },\n ],\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: executeActionSchema,\n },\n },\n },\n responses: {\n 200: {\n description: 'Action executed successfully',\n content: {\n 'application/json': {\n schema: actionResultResponseSchema,\n },\n },\n },\n 400: {\n description: 'Action not found or failed',\n content: {\n 'application/json': {\n schema: errorResponseSchema,\n },\n },\n },\n },\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,2BAA2B;AACpC,SAAS,4BAA4B,2BAA2B;AAChE,SAAS,kCAAkC;AAC3C,SAAS,2BAA2B;AAE7B,MAAM,WAAW;AAAA,EACtB,MAAM,E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AK;AAAA,QACH,aAAa;AAAA,QACb,SAAS;AAAA,UACP,oBAAoB;AAAA,YAClB,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,MACF;AAAA,MACA,KAAK;AAAA,QACH,aAAa;AAAA,QACb,SAAS;AAAA,UACP,oBAAoB;AAAA,YAClB,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createSingleNotificationActionRoute, createSingleNotificationActionOpenApi } from "../../../lib/routeHelpers.js";
|
|
2
|
+
const metadata = {
|
|
3
|
+
PUT: { requireAuth: true }
|
|
4
|
+
};
|
|
5
|
+
const PUT = createSingleNotificationActionRoute("dismiss");
|
|
6
|
+
const openApi = createSingleNotificationActionOpenApi(
|
|
7
|
+
"Dismiss notification",
|
|
8
|
+
"Notification dismissed"
|
|
9
|
+
);
|
|
10
|
+
export {
|
|
11
|
+
PUT,
|
|
12
|
+
metadata,
|
|
13
|
+
openApi
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/notifications/api/%5Bid%5D/dismiss/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { createSingleNotificationActionRoute, createSingleNotificationActionOpenApi } from '../../../lib/routeHelpers'\n\nexport const metadata = {\n PUT: { requireAuth: true },\n}\n\nexport const PUT = createSingleNotificationActionRoute('dismiss')\n\nexport const openApi = createSingleNotificationActionOpenApi(\n 'Dismiss notification',\n 'Notification dismissed'\n)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qCAAqC,6CAA6C;AAEpF,MAAM,WAAW;AAAA,EACtB,KAAK,EAAE,aAAa,KAAK;AAC3B;AAEO,MAAM,MAAM,oCAAoC,SAAS;AAEzD,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createSingleNotificationActionRoute, createSingleNotificationActionOpenApi } from "../../../lib/routeHelpers.js";
|
|
2
|
+
const metadata = {
|
|
3
|
+
PUT: { requireAuth: true }
|
|
4
|
+
};
|
|
5
|
+
const PUT = createSingleNotificationActionRoute("markAsRead");
|
|
6
|
+
const openApi = createSingleNotificationActionOpenApi(
|
|
7
|
+
"Mark notification as read",
|
|
8
|
+
"Notification marked as read"
|
|
9
|
+
);
|
|
10
|
+
export {
|
|
11
|
+
PUT,
|
|
12
|
+
metadata,
|
|
13
|
+
openApi
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/notifications/api/%5Bid%5D/read/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { createSingleNotificationActionRoute, createSingleNotificationActionOpenApi } from '../../../lib/routeHelpers'\n\nexport const metadata = {\n PUT: { requireAuth: true },\n}\n\nexport const PUT = createSingleNotificationActionRoute('markAsRead')\n\nexport const openApi = createSingleNotificationActionOpenApi(\n 'Mark notification as read',\n 'Notification marked as read'\n)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qCAAqC,6CAA6C;AAEpF,MAAM,WAAW;AAAA,EACtB,KAAK,EAAE,aAAa,KAAK;AAC3B;AAEO,MAAM,MAAM,oCAAoC,YAAY;AAE5D,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { restoreNotificationSchema } from "../../../data/validators.js";
|
|
3
|
+
import { resolveNotificationContext } from "../../../lib/routeHelpers.js";
|
|
4
|
+
const metadata = {
|
|
5
|
+
PUT: { requireAuth: true }
|
|
6
|
+
};
|
|
7
|
+
async function PUT(req, { params }) {
|
|
8
|
+
const { id } = await params;
|
|
9
|
+
const { service, scope } = await resolveNotificationContext(req);
|
|
10
|
+
const body = await req.json().catch(() => ({}));
|
|
11
|
+
const input = restoreNotificationSchema.parse(body);
|
|
12
|
+
await service.restoreDismissed(id, input.status, scope);
|
|
13
|
+
return Response.json({ ok: true });
|
|
14
|
+
}
|
|
15
|
+
const openApi = {
|
|
16
|
+
PUT: {
|
|
17
|
+
summary: "Restore dismissed notification",
|
|
18
|
+
description: "Undo a dismissal and restore a notification to read or unread.",
|
|
19
|
+
tags: ["Notifications"],
|
|
20
|
+
parameters: [
|
|
21
|
+
{
|
|
22
|
+
name: "id",
|
|
23
|
+
in: "path",
|
|
24
|
+
required: true,
|
|
25
|
+
schema: { type: "string", format: "uuid" }
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
requestBody: {
|
|
29
|
+
required: false,
|
|
30
|
+
content: {
|
|
31
|
+
"application/json": {
|
|
32
|
+
schema: restoreNotificationSchema
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
responses: {
|
|
37
|
+
200: {
|
|
38
|
+
description: "Notification restored",
|
|
39
|
+
content: {
|
|
40
|
+
"application/json": {
|
|
41
|
+
schema: z.object({ ok: z.boolean() })
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
PUT,
|
|
50
|
+
metadata,
|
|
51
|
+
openApi
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/notifications/api/%5Bid%5D/restore/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\nimport { restoreNotificationSchema } from '../../../data/validators'\nimport { resolveNotificationContext } from '../../../lib/routeHelpers'\n\nexport const metadata = {\n PUT: { requireAuth: true },\n}\n\nexport async function PUT(req: Request, { params }: { params: Promise<{ id: string }> }) {\n const { id } = await params\n const { service, scope } = await resolveNotificationContext(req)\n\n const body = await req.json().catch(() => ({}))\n const input = restoreNotificationSchema.parse(body)\n\n await service.restoreDismissed(id, input.status, scope)\n\n return Response.json({ ok: true })\n}\n\nexport const openApi = {\n PUT: {\n summary: 'Restore dismissed notification',\n description: 'Undo a dismissal and restore a notification to read or unread.',\n tags: ['Notifications'],\n parameters: [\n {\n name: 'id',\n in: 'path',\n required: true,\n schema: { type: 'string', format: 'uuid' },\n },\n ],\n requestBody: {\n required: false,\n content: {\n 'application/json': {\n schema: restoreNotificationSchema,\n },\n },\n },\n responses: {\n 200: {\n description: 'Notification restored',\n content: {\n 'application/json': {\n schema: z.object({ ok: z.boolean() }),\n },\n },\n },\n },\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,iCAAiC;AAC1C,SAAS,kCAAkC;AAEpC,MAAM,WAAW;AAAA,EACtB,KAAK,EAAE,aAAa,KAAK;AAC3B;AAEA,eAAsB,IAAI,KAAc,EAAE,OAAO,GAAwC;AACvF,QAAM,EAAE,GAAG,IAAI,MAAM;AACrB,QAAM,EAAE,SAAS,MAAM,IAAI,MAAM,2BAA2B,GAAG;AAE/D,QAAM,OAAO,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC,EAAE;AAC9C,QAAM,QAAQ,0BAA0B,MAAM,IAAI;AAElD,QAAM,QAAQ,iBAAiB,IAAI,MAAM,QAAQ,KAAK;AAEtD,SAAO,SAAS,KAAK,EAAE,IAAI,KAAK,CAAC;AACnC;AAEO,MAAM,UAAU;AAAA,EACrB,KAAK;AAAA,IACH,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM,CAAC,eAAe;AAAA,IACtB,YAAY;AAAA,MACV;AAAA,QACE,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,QAAQ,EAAE,MAAM,UAAU,QAAQ,OAAO;AAAA,MAC3C;AAAA,IACF;AAAA,IACA,aAAa;AAAA,MACX,UAAU;AAAA,MACV,SAAS;AAAA,QACP,oBAAoB;AAAA,UAClB,QAAQ;AAAA,QACV;AAAA,MACF;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,KAAK;AAAA,QACH,aAAa;AAAA,QACb,SAAS;AAAA,UACP,oBAAoB;AAAA,YAClB,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createBatchNotificationSchema } from "../../data/validators.js";
|
|
2
|
+
import { createBulkNotificationRoute, createBulkNotificationOpenApi } from "../../lib/routeHelpers.js";
|
|
3
|
+
const metadata = {
|
|
4
|
+
POST: { requireAuth: true, requireFeatures: ["notifications.create"] }
|
|
5
|
+
};
|
|
6
|
+
const POST = createBulkNotificationRoute(createBatchNotificationSchema, "createBatch");
|
|
7
|
+
const openApi = createBulkNotificationOpenApi(
|
|
8
|
+
createBatchNotificationSchema,
|
|
9
|
+
"Create batch notifications",
|
|
10
|
+
"Send the same notification to multiple users"
|
|
11
|
+
);
|
|
12
|
+
export {
|
|
13
|
+
POST,
|
|
14
|
+
metadata,
|
|
15
|
+
openApi
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/notifications/api/batch/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { createBatchNotificationSchema } from '../../data/validators'\nimport { createBulkNotificationRoute, createBulkNotificationOpenApi } from '../../lib/routeHelpers'\n\nexport const metadata = {\n POST: { requireAuth: true, requireFeatures: ['notifications.create'] },\n}\n\nexport const POST = createBulkNotificationRoute(createBatchNotificationSchema, 'createBatch')\n\nexport const openApi = createBulkNotificationOpenApi(\n createBatchNotificationSchema,\n 'Create batch notifications',\n 'Send the same notification to multiple users'\n)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qCAAqC;AAC9C,SAAS,6BAA6B,qCAAqC;AAEpE,MAAM,WAAW;AAAA,EACtB,MAAM,EAAE,aAAa,MAAM,iBAAiB,CAAC,sBAAsB,EAAE;AACvE;AAEO,MAAM,OAAO,4BAA4B,+BAA+B,aAAa;AAErF,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createFeatureNotificationSchema } from "../../data/validators.js";
|
|
2
|
+
import { createBulkNotificationRoute, createBulkNotificationOpenApi } from "../../lib/routeHelpers.js";
|
|
3
|
+
const metadata = {
|
|
4
|
+
POST: { requireAuth: true, requireFeatures: ["notifications.create"] }
|
|
5
|
+
};
|
|
6
|
+
const POST = createBulkNotificationRoute(createFeatureNotificationSchema, "createForFeature");
|
|
7
|
+
const openApi = createBulkNotificationOpenApi(
|
|
8
|
+
createFeatureNotificationSchema,
|
|
9
|
+
"Create notifications for all users with a specific feature/permission",
|
|
10
|
+
"Send the same notification to all users who have the specified feature permission (via role ACL or user ACL). Supports wildcard matching."
|
|
11
|
+
);
|
|
12
|
+
export {
|
|
13
|
+
POST,
|
|
14
|
+
metadata,
|
|
15
|
+
openApi
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/notifications/api/feature/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { createFeatureNotificationSchema } from '../../data/validators'\nimport { createBulkNotificationRoute, createBulkNotificationOpenApi } from '../../lib/routeHelpers'\n\nexport const metadata = {\n POST: { requireAuth: true, requireFeatures: ['notifications.create'] },\n}\n\nexport const POST = createBulkNotificationRoute(createFeatureNotificationSchema, 'createForFeature')\n\nexport const openApi = createBulkNotificationOpenApi(\n createFeatureNotificationSchema,\n 'Create notifications for all users with a specific feature/permission',\n 'Send the same notification to all users who have the specified feature permission (via role ACL or user ACL). Supports wildcard matching.'\n)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,uCAAuC;AAChD,SAAS,6BAA6B,qCAAqC;AAEpE,MAAM,WAAW;AAAA,EACtB,MAAM,EAAE,aAAa,MAAM,iBAAiB,CAAC,sBAAsB,EAAE;AACvE;AAEO,MAAM,OAAO,4BAA4B,iCAAiC,kBAAkB;AAE5F,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { resolveNotificationContext } from "../../lib/routeHelpers.js";
|
|
3
|
+
const metadata = {
|
|
4
|
+
PUT: { requireAuth: true }
|
|
5
|
+
};
|
|
6
|
+
async function PUT(req) {
|
|
7
|
+
const { service, scope } = await resolveNotificationContext(req);
|
|
8
|
+
const count = await service.markAllAsRead(scope);
|
|
9
|
+
return Response.json({ ok: true, count });
|
|
10
|
+
}
|
|
11
|
+
const openApi = {
|
|
12
|
+
PUT: {
|
|
13
|
+
summary: "Mark all notifications as read",
|
|
14
|
+
tags: ["Notifications"],
|
|
15
|
+
responses: {
|
|
16
|
+
200: {
|
|
17
|
+
description: "All notifications marked as read",
|
|
18
|
+
content: {
|
|
19
|
+
"application/json": {
|
|
20
|
+
schema: z.object({
|
|
21
|
+
ok: z.boolean(),
|
|
22
|
+
count: z.number()
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
PUT,
|
|
32
|
+
metadata,
|
|
33
|
+
openApi
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/notifications/api/mark-all-read/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\nimport { resolveNotificationContext } from '../../lib/routeHelpers'\n\nexport const metadata = {\n PUT: { requireAuth: true },\n}\n\nexport async function PUT(req: Request) {\n const { service, scope } = await resolveNotificationContext(req)\n\n const count = await service.markAllAsRead(scope)\n\n return Response.json({ ok: true, count })\n}\n\nexport const openApi = {\n PUT: {\n summary: 'Mark all notifications as read',\n tags: ['Notifications'],\n responses: {\n 200: {\n description: 'All notifications marked as read',\n content: {\n 'application/json': {\n schema: z.object({\n ok: z.boolean(),\n count: z.number(),\n }),\n },\n },\n },\n },\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,kCAAkC;AAEpC,MAAM,WAAW;AAAA,EACtB,KAAK,EAAE,aAAa,KAAK;AAC3B;AAEA,eAAsB,IAAI,KAAc;AACtC,QAAM,EAAE,SAAS,MAAM,IAAI,MAAM,2BAA2B,GAAG;AAE/D,QAAM,QAAQ,MAAM,QAAQ,cAAc,KAAK;AAE/C,SAAO,SAAS,KAAK,EAAE,IAAI,MAAM,MAAM,CAAC;AAC1C;AAEO,MAAM,UAAU;AAAA,EACrB,KAAK;AAAA,IACH,SAAS;AAAA,IACT,MAAM,CAAC,eAAe;AAAA,IACtB,WAAW;AAAA,MACT,KAAK;AAAA,QACH,aAAa;AAAA,QACb,SAAS;AAAA,UACP,oBAAoB;AAAA,YAClB,QAAQ,EAAE,OAAO;AAAA,cACf,IAAI,EAAE,QAAQ;AAAA,cACd,OAAO,EAAE,OAAO;AAAA,YAClB,CAAC;AAAA,UACH;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createCrudOpenApiFactory, createPagedListResponseSchema } from "@open-mercato/shared/lib/openapi/crud";
|
|
3
|
+
import {
|
|
4
|
+
listNotificationsSchema,
|
|
5
|
+
createNotificationSchema,
|
|
6
|
+
executeActionSchema,
|
|
7
|
+
notificationDeliveryConfigSchema
|
|
8
|
+
} from "../data/validators.js";
|
|
9
|
+
const buildNotificationsCrudOpenApi = createCrudOpenApiFactory({
|
|
10
|
+
defaultTag: "Notifications"
|
|
11
|
+
});
|
|
12
|
+
const notificationItemSchema = z.object({
|
|
13
|
+
id: z.string().uuid(),
|
|
14
|
+
type: z.string(),
|
|
15
|
+
title: z.string(),
|
|
16
|
+
body: z.string().nullable().optional(),
|
|
17
|
+
titleKey: z.string().nullable().optional(),
|
|
18
|
+
bodyKey: z.string().nullable().optional(),
|
|
19
|
+
titleVariables: z.record(z.string(), z.string()).nullable().optional(),
|
|
20
|
+
bodyVariables: z.record(z.string(), z.string()).nullable().optional(),
|
|
21
|
+
icon: z.string().nullable().optional(),
|
|
22
|
+
severity: z.string(),
|
|
23
|
+
status: z.string(),
|
|
24
|
+
actions: z.array(z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
label: z.string(),
|
|
27
|
+
labelKey: z.string().optional(),
|
|
28
|
+
variant: z.string().optional(),
|
|
29
|
+
icon: z.string().optional()
|
|
30
|
+
})),
|
|
31
|
+
primaryActionId: z.string().optional(),
|
|
32
|
+
sourceModule: z.string().nullable().optional(),
|
|
33
|
+
sourceEntityType: z.string().nullable().optional(),
|
|
34
|
+
sourceEntityId: z.string().uuid().nullable().optional(),
|
|
35
|
+
linkHref: z.string().nullable().optional(),
|
|
36
|
+
createdAt: z.string(),
|
|
37
|
+
readAt: z.string().nullable().optional(),
|
|
38
|
+
actionTaken: z.string().nullable().optional()
|
|
39
|
+
});
|
|
40
|
+
const okResponseSchema = z.object({
|
|
41
|
+
ok: z.boolean()
|
|
42
|
+
});
|
|
43
|
+
const errorResponseSchema = z.object({
|
|
44
|
+
error: z.string()
|
|
45
|
+
});
|
|
46
|
+
const unreadCountResponseSchema = z.object({
|
|
47
|
+
unreadCount: z.number()
|
|
48
|
+
});
|
|
49
|
+
const actionResultResponseSchema = z.object({
|
|
50
|
+
ok: z.boolean(),
|
|
51
|
+
result: z.unknown().optional(),
|
|
52
|
+
href: z.string().optional()
|
|
53
|
+
});
|
|
54
|
+
const notificationSettingsResponseSchema = z.object({
|
|
55
|
+
settings: notificationDeliveryConfigSchema
|
|
56
|
+
});
|
|
57
|
+
const notificationSettingsUpdateResponseSchema = z.object({
|
|
58
|
+
ok: z.boolean(),
|
|
59
|
+
settings: notificationDeliveryConfigSchema
|
|
60
|
+
});
|
|
61
|
+
export {
|
|
62
|
+
actionResultResponseSchema,
|
|
63
|
+
buildNotificationsCrudOpenApi,
|
|
64
|
+
createNotificationSchema,
|
|
65
|
+
createPagedListResponseSchema,
|
|
66
|
+
errorResponseSchema,
|
|
67
|
+
executeActionSchema,
|
|
68
|
+
listNotificationsSchema,
|
|
69
|
+
notificationDeliveryConfigSchema,
|
|
70
|
+
notificationItemSchema,
|
|
71
|
+
notificationSettingsResponseSchema,
|
|
72
|
+
notificationSettingsUpdateResponseSchema,
|
|
73
|
+
okResponseSchema,
|
|
74
|
+
unreadCountResponseSchema
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=openapi.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/notifications/api/openapi.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\nimport { createCrudOpenApiFactory, createPagedListResponseSchema } from '@open-mercato/shared/lib/openapi/crud'\nimport {\n listNotificationsSchema,\n createNotificationSchema,\n executeActionSchema,\n notificationDeliveryConfigSchema,\n} from '../data/validators'\n\nexport const buildNotificationsCrudOpenApi = createCrudOpenApiFactory({\n defaultTag: 'Notifications',\n})\n\nexport const notificationItemSchema = z.object({\n id: z.string().uuid(),\n type: z.string(),\n title: z.string(),\n body: z.string().nullable().optional(),\n titleKey: z.string().nullable().optional(),\n bodyKey: z.string().nullable().optional(),\n titleVariables: z.record(z.string(), z.string()).nullable().optional(),\n bodyVariables: z.record(z.string(), z.string()).nullable().optional(),\n icon: z.string().nullable().optional(),\n severity: z.string(),\n status: z.string(),\n actions: z.array(z.object({\n id: z.string(),\n label: z.string(),\n labelKey: z.string().optional(),\n variant: z.string().optional(),\n icon: z.string().optional(),\n })),\n primaryActionId: z.string().optional(),\n sourceModule: z.string().nullable().optional(),\n sourceEntityType: z.string().nullable().optional(),\n sourceEntityId: z.string().uuid().nullable().optional(),\n linkHref: z.string().nullable().optional(),\n createdAt: z.string(),\n readAt: z.string().nullable().optional(),\n actionTaken: z.string().nullable().optional(),\n})\n\nexport const okResponseSchema = z.object({\n ok: z.boolean(),\n})\n\nexport const errorResponseSchema = z.object({\n error: z.string(),\n})\n\nexport const unreadCountResponseSchema = z.object({\n unreadCount: z.number(),\n})\n\nexport const actionResultResponseSchema = z.object({\n ok: z.boolean(),\n result: z.unknown().optional(),\n href: z.string().optional(),\n})\n\nexport const notificationSettingsResponseSchema = z.object({\n settings: notificationDeliveryConfigSchema,\n})\n\nexport const notificationSettingsUpdateResponseSchema = z.object({\n ok: z.boolean(),\n settings: notificationDeliveryConfigSchema,\n})\n\nexport {\n createPagedListResponseSchema,\n listNotificationsSchema,\n createNotificationSchema,\n executeActionSchema,\n notificationDeliveryConfigSchema,\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,0BAA0B,qCAAqC;AACxE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,MAAM,gCAAgC,yBAAyB;AAAA,EACpE,YAAY;AACd,CAAC;AAEM,MAAM,yBAAyB,E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S,EAAE,SAAS;AAC9C,CAAC;AAEM,MAAM,mBAAmB,EAAE,OAAO;AAAA,EACvC,IAAI,EAAE,QAAQ;AAChB,CAAC;AAEM,MAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,OAAO,EAAE,OAAO;AAClB,CAAC;AAEM,MAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,aAAa,EAAE,OAAO;AACxB,CAAC;AAEM,MAAM,6BAA6B,EAAE,OAAO;AAAA,EACjD,IAAI,EAAE,QAAQ;AAAA,EACd,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7B,MAAM,EAAE,OAAO,EAAE,SAAS;AAC5B,CAAC;AAEM,MAAM,qCAAqC,EAAE,OAAO;AAAA,EACzD,UAAU;AACZ,CAAC;AAEM,MAAM,2CAA2C,EAAE,OAAO;AAAA,EAC/D,IAAI,EAAE,QAAQ;AAAA,EACd,UAAU;AACZ,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createRoleNotificationSchema } from "../../data/validators.js";
|
|
2
|
+
import { createBulkNotificationRoute, createBulkNotificationOpenApi } from "../../lib/routeHelpers.js";
|
|
3
|
+
const metadata = {
|
|
4
|
+
POST: { requireAuth: true, requireFeatures: ["notifications.create"] }
|
|
5
|
+
};
|
|
6
|
+
const POST = createBulkNotificationRoute(createRoleNotificationSchema, "createForRole");
|
|
7
|
+
const openApi = createBulkNotificationOpenApi(
|
|
8
|
+
createRoleNotificationSchema,
|
|
9
|
+
"Create notifications for all users in a role",
|
|
10
|
+
"Send the same notification to all users who have the specified role within the organization"
|
|
11
|
+
);
|
|
12
|
+
export {
|
|
13
|
+
POST,
|
|
14
|
+
metadata,
|
|
15
|
+
openApi
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/notifications/api/role/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { createRoleNotificationSchema } from '../../data/validators'\nimport { createBulkNotificationRoute, createBulkNotificationOpenApi } from '../../lib/routeHelpers'\n\nexport const metadata = {\n POST: { requireAuth: true, requireFeatures: ['notifications.create'] },\n}\n\nexport const POST = createBulkNotificationRoute(createRoleNotificationSchema, 'createForRole')\n\nexport const openApi = createBulkNotificationOpenApi(\n createRoleNotificationSchema,\n 'Create notifications for all users in a role',\n 'Send the same notification to all users who have the specified role within the organization'\n)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oCAAoC;AAC7C,SAAS,6BAA6B,qCAAqC;AAEpE,MAAM,WAAW;AAAA,EACtB,MAAM,EAAE,aAAa,MAAM,iBAAiB,CAAC,sBAAsB,EAAE;AACvE;AAEO,MAAM,OAAO,4BAA4B,8BAA8B,eAAe;AAEtF,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Notification } from "../data/entities.js";
|
|
3
|
+
import { listNotificationsSchema, createNotificationSchema } from "../data/validators.js";
|
|
4
|
+
import { toNotificationDto } from "../lib/notificationMapper.js";
|
|
5
|
+
import { resolveNotificationContext } from "../lib/routeHelpers.js";
|
|
6
|
+
import {
|
|
7
|
+
buildNotificationsCrudOpenApi,
|
|
8
|
+
createPagedListResponseSchema,
|
|
9
|
+
notificationItemSchema
|
|
10
|
+
} from "./openapi.js";
|
|
11
|
+
const metadata = {
|
|
12
|
+
GET: { requireAuth: true },
|
|
13
|
+
POST: { requireAuth: true, requireFeatures: ["notifications.create"] }
|
|
14
|
+
};
|
|
15
|
+
async function GET(req) {
|
|
16
|
+
const { ctx, scope } = await resolveNotificationContext(req);
|
|
17
|
+
const em = ctx.container.resolve("em");
|
|
18
|
+
const url = new URL(req.url);
|
|
19
|
+
const queryParams = Object.fromEntries(url.searchParams.entries());
|
|
20
|
+
const input = listNotificationsSchema.parse(queryParams);
|
|
21
|
+
const filters = {
|
|
22
|
+
recipientUserId: scope.userId,
|
|
23
|
+
tenantId: scope.tenantId
|
|
24
|
+
};
|
|
25
|
+
if (input.status) {
|
|
26
|
+
filters.status = Array.isArray(input.status) ? { $in: input.status } : input.status;
|
|
27
|
+
} else {
|
|
28
|
+
filters.status = { $ne: "dismissed" };
|
|
29
|
+
}
|
|
30
|
+
if (input.type) {
|
|
31
|
+
filters.type = input.type;
|
|
32
|
+
}
|
|
33
|
+
if (input.severity) {
|
|
34
|
+
filters.severity = input.severity;
|
|
35
|
+
}
|
|
36
|
+
if (input.sourceEntityType) {
|
|
37
|
+
filters.sourceEntityType = input.sourceEntityType;
|
|
38
|
+
}
|
|
39
|
+
if (input.sourceEntityId) {
|
|
40
|
+
filters.sourceEntityId = input.sourceEntityId;
|
|
41
|
+
}
|
|
42
|
+
if (input.since) {
|
|
43
|
+
filters.createdAt = { $gt: new Date(input.since) };
|
|
44
|
+
}
|
|
45
|
+
const [notifications, total] = await Promise.all([
|
|
46
|
+
em.find(Notification, filters, {
|
|
47
|
+
orderBy: { createdAt: "desc" },
|
|
48
|
+
limit: input.pageSize,
|
|
49
|
+
offset: (input.page - 1) * input.pageSize
|
|
50
|
+
}),
|
|
51
|
+
em.count(Notification, filters)
|
|
52
|
+
]);
|
|
53
|
+
const items = notifications.map(toNotificationDto);
|
|
54
|
+
return Response.json({
|
|
55
|
+
items,
|
|
56
|
+
total,
|
|
57
|
+
page: input.page,
|
|
58
|
+
pageSize: input.pageSize,
|
|
59
|
+
totalPages: Math.ceil(total / input.pageSize)
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async function POST(req) {
|
|
63
|
+
const { service, scope } = await resolveNotificationContext(req);
|
|
64
|
+
const body = await req.json().catch(() => ({}));
|
|
65
|
+
const input = createNotificationSchema.parse(body);
|
|
66
|
+
const notification = await service.create(input, scope);
|
|
67
|
+
return Response.json({ id: notification.id }, { status: 201 });
|
|
68
|
+
}
|
|
69
|
+
const openApi = buildNotificationsCrudOpenApi({
|
|
70
|
+
resourceName: "Notification",
|
|
71
|
+
querySchema: listNotificationsSchema,
|
|
72
|
+
listResponseSchema: createPagedListResponseSchema(notificationItemSchema),
|
|
73
|
+
create: {
|
|
74
|
+
schema: createNotificationSchema,
|
|
75
|
+
responseSchema: z.object({ id: z.string().uuid() }),
|
|
76
|
+
description: "Creates a notification for a user."
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
export {
|
|
80
|
+
GET,
|
|
81
|
+
POST,
|
|
82
|
+
metadata,
|
|
83
|
+
openApi
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/notifications/api/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\nimport type { EntityManager } from '@mikro-orm/core'\nimport { Notification } from '../data/entities'\nimport { listNotificationsSchema, createNotificationSchema } from '../data/validators'\nimport { toNotificationDto } from '../lib/notificationMapper'\nimport { resolveNotificationContext } from '../lib/routeHelpers'\nimport {\n buildNotificationsCrudOpenApi,\n createPagedListResponseSchema,\n notificationItemSchema,\n} from './openapi'\n\nexport const metadata = {\n GET: { requireAuth: true },\n POST: { requireAuth: true, requireFeatures: ['notifications.create'] },\n}\n\nexport async function GET(req: Request) {\n const { ctx, scope } = await resolveNotificationContext(req)\n const em = ctx.container.resolve('em') as EntityManager\n\n const url = new URL(req.url)\n const queryParams = Object.fromEntries(url.searchParams.entries())\n const input = listNotificationsSchema.parse(queryParams)\n\n const filters: Record<string, unknown> = {\n recipientUserId: scope.userId,\n tenantId: scope.tenantId,\n }\n\n if (input.status) {\n filters.status = Array.isArray(input.status) ? { $in: input.status } : input.status\n } else {\n filters.status = { $ne: 'dismissed' }\n }\n if (input.type) {\n filters.type = input.type\n }\n if (input.severity) {\n filters.severity = input.severity\n }\n if (input.sourceEntityType) {\n filters.sourceEntityType = input.sourceEntityType\n }\n if (input.sourceEntityId) {\n filters.sourceEntityId = input.sourceEntityId\n }\n if (input.since) {\n filters.createdAt = { $gt: new Date(input.since) }\n }\n\n const [notifications, total] = await Promise.all([\n em.find(Notification, filters, {\n orderBy: { createdAt: 'desc' },\n limit: input.pageSize,\n offset: (input.page - 1) * input.pageSize,\n }),\n em.count(Notification, filters),\n ])\n\n const items = notifications.map(toNotificationDto)\n\n return Response.json({\n items,\n total,\n page: input.page,\n pageSize: input.pageSize,\n totalPages: Math.ceil(total / input.pageSize),\n })\n}\n\nexport async function POST(req: Request) {\n const { service, scope } = await resolveNotificationContext(req)\n\n const body = await req.json().catch(() => ({}))\n const input = createNotificationSchema.parse(body)\n\n const notification = await service.create(input, scope)\n\n return Response.json({ id: notification.id }, { status: 201 })\n}\n\nexport const openApi = buildNotificationsCrudOpenApi({\n resourceName: 'Notification',\n querySchema: listNotificationsSchema,\n listResponseSchema: createPagedListResponseSchema(notificationItemSchema),\n create: {\n schema: createNotificationSchema,\n responseSchema: z.object({ id: z.string().uuid() }),\n description: 'Creates a notification for a user.',\n },\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAElB,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB,gCAAgC;AAClE,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,MAAM,WAAW;AAAA,EACtB,KAAK,EAAE,aAAa,KAAK;AAAA,EACzB,MAAM,EAAE,aAAa,MAAM,iBAAiB,CAAC,sBAAsB,EAAE;AACvE;AAEA,eAAsB,IAAI,KAAc;AACtC,QAAM,EAAE,KAAK,MAAM,IAAI,MAAM,2BAA2B,GAAG;AAC3D,QAAM,KAAK,IAAI,UAAU,QAAQ,IAAI;AAErC,QAAM,MAAM,IAAI,IAAI,IAAI,GAAG;AAC3B,QAAM,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