@moh-sso/report-scheduler 0.0.0-stage → 0.4.2
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/README.md +117 -2
- package/dist/_types/apps/report-scheduler/src/api/index.d.ts +3418 -0
- package/dist/_types/apps/report-scheduler/src/components/RecipientSelect.d.ts +10 -0
- package/dist/_types/apps/report-scheduler/src/components/ScheduleFormPanel.d.ts +9 -0
- package/dist/_types/apps/report-scheduler/src/components/SchedulerTables.d.ts +33 -0
- package/dist/_types/apps/report-scheduler/src/hooks/useSchedulerPermissions.d.ts +9 -0
- package/dist/_types/apps/report-scheduler/src/hooks/useSchedulerQueryToasts.d.ts +9 -0
- package/dist/_types/apps/report-scheduler/src/index.d.ts +4 -0
- package/dist/_types/apps/report-scheduler/src/root.component.d.ts +2 -0
- package/dist/_types/apps/report-scheduler/src/routes.d.ts +2 -0
- package/dist/_types/apps/report-scheduler/src/single-spa.d.ts +1 -0
- package/dist/_types/apps/report-scheduler/src/types/index.d.ts +185 -0
- package/dist/_types/apps/report-scheduler/src/utils/report-parameters.d.ts +3 -0
- package/dist/_types/apps/report-scheduler/src/utils/scheduler-permissions.d.ts +12 -0
- package/dist/_types/packages/api/src/api/baseApi.d.ts +2 -0
- package/dist/_types/packages/api/src/index.d.ts +1 -0
- package/dist/_types/packages/auth/src/api/auth.api.d.ts +531 -0
- package/dist/_types/packages/auth/src/api/health-context.api.d.ts +374 -0
- package/dist/_types/packages/auth/src/auth/AuthBootstrap.d.ts +1 -0
- package/dist/_types/packages/auth/src/auth/HealthContextProvider.d.ts +20 -0
- package/dist/_types/packages/auth/src/auth/PermissionGuard.d.ts +10 -0
- package/dist/_types/packages/auth/src/auth/auth.selectors.d.ts +896 -0
- package/dist/_types/packages/auth/src/auth/auth.slice.d.ts +14 -0
- package/dist/_types/packages/auth/src/auth/auth.types.d.ts +61 -0
- package/dist/_types/packages/auth/src/auth/login-url.d.ts +2 -0
- package/dist/_types/packages/auth/src/auth/permissions.d.ts +58 -0
- package/dist/_types/packages/auth/src/auth/rbac.d.ts +8 -0
- package/dist/_types/packages/auth/src/auth/system-launch-url.d.ts +9 -0
- package/dist/_types/packages/auth/src/auth/useAuthorization.d.ts +14 -0
- package/dist/_types/packages/auth/src/index.d.ts +14 -0
- package/dist/_types/packages/config/src/appMeta.d.ts +3 -0
- package/dist/_types/packages/config/src/index.d.ts +6 -0
- package/dist/_types/packages/config/src/lib/constants/api.constants.d.ts +178 -0
- package/dist/_types/packages/config/src/lib/constants/document-templates.d.ts +11 -0
- package/dist/_types/packages/config/src/lib/errors/errorMessages.d.ts +2 -0
- package/dist/_types/packages/config/src/lib/errors/errorSeverity.d.ts +3 -0
- package/dist/_types/packages/config/src/lib/errors/errorTypes.d.ts +1 -0
- package/dist/_types/packages/microfrontend/src/basename.d.ts +1 -0
- package/dist/_types/packages/microfrontend/src/index.d.ts +6 -0
- package/dist/_types/packages/microfrontend/src/lifecycle.d.ts +6 -0
- package/dist/_types/packages/microfrontend/src/navigation.d.ts +2 -0
- package/dist/_types/packages/microfrontend/src/props.d.ts +44 -0
- package/dist/_types/packages/microfrontend/src/react-lifecycle.d.ts +11 -0
- package/dist/_types/packages/microfrontend/src/routes.d.ts +13 -0
- package/dist/_types/packages/state/src/clients/clients.selectors.d.ts +534 -0
- package/dist/_types/packages/state/src/clients/clients.slice.d.ts +4 -0
- package/dist/_types/packages/state/src/document/documents.selectors.d.ts +1 -0
- package/dist/_types/packages/state/src/index.d.ts +29 -0
- package/dist/_types/packages/state/src/ui/ui.state.d.ts +1 -0
- package/dist/_types/packages/types/src/index.d.ts +6 -0
- package/dist/_types/packages/types/src/types/announcement-summary.types.d.ts +16 -0
- package/dist/_types/packages/types/src/types/client-role.types.d.ts +6 -0
- package/dist/_types/packages/types/src/types/client.types.d.ts +46 -0
- package/dist/_types/packages/types/src/types/document-processing.types.d.ts +1 -0
- package/dist/_types/packages/types/src/types/notifications.types.d.ts +96 -0
- package/dist/_types/packages/types/src/types/system-navigation.types.d.ts +18 -0
- package/dist/_types/packages/ui/src/accessibility/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/accessibility/useFocusTrap.d.ts +10 -0
- package/dist/_types/packages/ui/src/branding/BuildMeta.d.ts +6 -0
- package/dist/_types/packages/ui/src/branding/PublicFooter.d.ts +6 -0
- package/dist/_types/packages/ui/src/branding/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/data-display/DataTablePagination.d.ts +12 -0
- package/dist/_types/packages/ui/src/data-display/DataTableShell.d.ts +35 -0
- package/dist/_types/packages/ui/src/data-display/RowActionsCell.d.ts +7 -0
- package/dist/_types/packages/ui/src/data-display/TableEmptyState.d.ts +8 -0
- package/dist/_types/packages/ui/src/data-display/TableStatusTag.d.ts +8 -0
- package/dist/_types/packages/ui/src/data-display/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/feedback/comingsoon/ComingSoon.d.ts +7 -0
- package/dist/_types/packages/ui/src/feedback/emptystate/EmptyState.d.ts +15 -0
- package/dist/_types/packages/ui/src/feedback/errorstate/ErrorState.d.ts +14 -0
- package/dist/_types/packages/ui/src/feedback/errorstate/MicrofrontendErrorBoundary.d.ts +16 -0
- package/dist/_types/packages/ui/src/feedback/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/feedback/loadingstate/LoadingState.d.ts +5 -0
- package/dist/_types/packages/ui/src/forms/CaseFormsGrid.d.ts +1 -0
- package/dist/_types/packages/ui/src/forms/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/index.d.ts +16 -0
- package/dist/_types/packages/ui/src/layout/PageShell/PageShell.d.ts +9 -0
- package/dist/_types/packages/ui/src/layout/SectionCard/SectionCard.d.ts +11 -0
- package/dist/_types/packages/ui/src/layout/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppGridContent.d.ts +12 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppMenu.component.d.ts +6 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppMenuItem.component.d.ts +13 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/appMenuGroups.d.ts +11 -0
- package/dist/_types/packages/ui/src/navigation/breadcrumbs/AppBreadcrumbs.d.ts +12 -0
- package/dist/_types/packages/ui/src/navigation/breadcrumbs/BreadcrumbBar.d.ts +10 -0
- package/dist/_types/packages/ui/src/navigation/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/navigation/sidenav/ClientSideNav.d.ts +14 -0
- package/dist/_types/packages/ui/src/notifications/FormInlineAlert.d.ts +7 -0
- package/dist/_types/packages/ui/src/notifications/NotificationsPanel.d.ts +14 -0
- package/dist/_types/packages/ui/src/notifications/index.d.ts +4 -0
- package/dist/_types/packages/ui/src/notifications/toast/ToastProvider.d.ts +20 -0
- package/dist/_types/packages/ui/src/notifications/toast/useToast.d.ts +20 -0
- package/dist/_types/packages/ui/src/overlays/header-panel/ReusableHeaderPanel.d.ts +17 -0
- package/dist/_types/packages/ui/src/overlays/header-panel/header-panel.context.d.ts +23 -0
- package/dist/_types/packages/ui/src/overlays/index.d.ts +4 -0
- package/dist/_types/packages/ui/src/overlays/modal/ReusableModal.d.ts +20 -0
- package/dist/_types/packages/ui/src/overlays/modal/modal.context.d.ts +14 -0
- package/dist/_types/packages/ui/src/shell/ExternalAppHeader.d.ts +22 -0
- package/dist/_types/packages/ui/src/shell/PublicHeader.component.d.ts +8 -0
- package/dist/_types/packages/ui/src/shell/UserHeader.component.d.ts +17 -0
- package/dist/_types/packages/ui/src/shell/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/theme/ThemeProvider.d.ts +8 -0
- package/dist/_types/packages/ui/src/theme/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/utils/severity.d.ts +22 -0
- package/dist/_types/packages/ui/src/utils/status.d.ts +1 -0
- package/dist/api.d.ts +1 -0
- package/dist/api.js +154 -0
- package/dist/api.js.map +1 -0
- package/dist/assets/report-scheduler-CR8i8OX0.css +1 -0
- package/dist/assets/root.component-CObknIW7.js +1411 -0
- package/dist/assets/root.component-CObknIW7.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/routes.d.ts +1 -0
- package/dist/routes.js +33 -0
- package/dist/routes.js.map +1 -0
- package/dist/single-spa.d.ts +1 -0
- package/dist/single-spa.js +32 -0
- package/dist/single-spa.js.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +25 -0
- package/dist/types.js.map +1 -0
- package/package.json +61 -4
package/README.md
CHANGED
|
@@ -1,3 +1,118 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Report Scheduler
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Portal module for scheduling reports that are defined and generated by Health BI.
|
|
4
|
+
|
|
5
|
+
- Frontend: `frontend/apps/report-scheduler`, mounted at `/apps/dwh/report-scheduler`.
|
|
6
|
+
- Backend: `backend/internal/features/report_scheduler`.
|
|
7
|
+
- Parent system: `data-statistics`.
|
|
8
|
+
- Access role: `data-statistics:report-scheduler_access`.
|
|
9
|
+
|
|
10
|
+
## Implemented capabilities
|
|
11
|
+
|
|
12
|
+
The current module supports:
|
|
13
|
+
|
|
14
|
+
- Health BI report catalogue discovery.
|
|
15
|
+
- Dynamic Health BI parameter loading.
|
|
16
|
+
- Health-context-aware schedules using Keycloak `district` and `facility` claims.
|
|
17
|
+
- Output format selection using the formats exposed by Health BI.
|
|
18
|
+
- Schedule recipients using direct email addresses, SSO users, and Keycloak groups.
|
|
19
|
+
- Searchable multi-select dropdowns for email recipients, recipient groups, and portal users, with optional external email addresses. Saved selections retain their labels when filtering; administrative user/group permissions are not required.
|
|
20
|
+
- Group-recipient preview/resolution through the existing email feature.
|
|
21
|
+
- PDF/CSV email attachments through the existing queued email service, with a secure download link.
|
|
22
|
+
- Portal delivery to authenticated users.
|
|
23
|
+
- Secure artifact download links through the configured storage provider.
|
|
24
|
+
- Persistent schedules, recipients, executions, artifacts, and deliveries.
|
|
25
|
+
- Daily, weekly, monthly, quarterly, and annual recurrence timing.
|
|
26
|
+
- Reporting periods constrained by each report's advertised capabilities.
|
|
27
|
+
- Schedule edit, pause, resume, duplicate, delete, and Run Now controls.
|
|
28
|
+
- Automatic background execution and Health BI job polling with multi-replica database locking.
|
|
29
|
+
- Execution history with resolved periods, generation attempt counts, errors, artifacts, and recipient-level delivery state.
|
|
30
|
+
- Independent generation and delivery retry/backoff with manual retry controls.
|
|
31
|
+
- Terminal failure audit events, administrator alerts, and owner email notifications.
|
|
32
|
+
- Operational overview with 24-hour execution, success, failure, retry, delivery, and scheduler-worker heartbeat metrics.
|
|
33
|
+
- Health-context-constrained administration for district/facility managers; only unscoped administrators receive global scheduler management visibility.
|
|
34
|
+
- SSO-controlled artifact download endpoints instead of exposing object keys or Health BI artifact URLs in API responses.
|
|
35
|
+
- Expiring opaque email delivery links with SHA-256 server-side token storage and public endpoint rate limiting.
|
|
36
|
+
- Missed-run protection that performs one catch-up execution instead of replaying an unlimited backlog after downtime.
|
|
37
|
+
- Server-backed schedule filtering by search and enabled/paused state.
|
|
38
|
+
- Server-backed execution filtering by report search and execution status.
|
|
39
|
+
- Bounded history/inbox queries to avoid unbounded scheduler UI loads.
|
|
40
|
+
- Admin scheduler metrics endpoint for operations tooling.
|
|
41
|
+
|
|
42
|
+
## Health BI integration
|
|
43
|
+
|
|
44
|
+
The `dwh_visualization` scheduler adapter uses the application base
|
|
45
|
+
`https://dashboards.health.go.ug/report-browser`, within the shared Integrated
|
|
46
|
+
Health Portal Keycloak realm. Users retain their
|
|
47
|
+
portal session and module permissions. Background jobs use a dedicated backend
|
|
48
|
+
Keycloak service account with automatically refreshed bearer tokens. See the
|
|
49
|
+
[backend configuration and contract](../../../backend/internal/features/report_scheduler/README.md).
|
|
50
|
+
|
|
51
|
+
The form loads report detail before saving and offers only supported periods and
|
|
52
|
+
formats. The current adapter supports PDF/CSV and whole calendar periods in
|
|
53
|
+
`Africa/Kampala`; daily reporting periods are unsupported. Recurrence frequency
|
|
54
|
+
is independent of the period being exported. Nested report IDs use query
|
|
55
|
+
parameters so category paths survive routing. Additional filters without inline
|
|
56
|
+
options are entered as text; the browser API's `optionsEndpoint` is not called
|
|
57
|
+
with the scheduler service token.
|
|
58
|
+
|
|
59
|
+
Health BI artifacts expire after seven days, even if their portal inbox entry
|
|
60
|
+
remains. End-to-end verification requires both services, the configured Keycloak service
|
|
61
|
+
account, and configured database/email services.
|
|
62
|
+
|
|
63
|
+
Selecting a report prefills its declared parameter defaults, supported reporting
|
|
64
|
+
period, and export format. Saved values and manual edits override defaults;
|
|
65
|
+
refreshes do not overwrite them. Changing the report clears its previous
|
|
66
|
+
parameters. Filters without declared defaults remain blank. Health BI's
|
|
67
|
+
`defaultValue` and `metadata.noDefault`/`hideNone` settings control prepopulation.
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
Run from `frontend/`:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
npm run dev:mf:report-scheduler
|
|
75
|
+
npm run build -w @moh-sso/report-scheduler
|
|
76
|
+
npm run preview:mf:report-scheduler
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The local microfrontend uses port 4115 and relies on the portal login session.
|
|
80
|
+
|
|
81
|
+
## Access
|
|
82
|
+
|
|
83
|
+
The backend requires the `data-statistics` parent system plus the relevant granular scheduler permission. Apply/sync the RBAC seed after permission changes:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
go run ./cmd/cli system-rbac validate --file config/system-rbac.seed.yaml
|
|
87
|
+
go run ./cmd/cli system-rbac seed --file config/system-rbac.seed.yaml
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Existing installations should assign `data-statistics:report-scheduler_access` to authorized users/groups and refresh their sessions.
|
|
91
|
+
The `report_admin` role adds `report_scheduler:manage` for cross-owner administration, subject to the authenticated district/facility health context when one is present.
|
|
92
|
+
|
|
93
|
+
## Frontend permissions
|
|
94
|
+
|
|
95
|
+
The scheduler uses the shared `@moh-sso/auth` authorization state. Both module
|
|
96
|
+
entry and the independently mounted schedule form deny access without
|
|
97
|
+
`data-statistics` system access and `report_scheduler:read`. Protected requests
|
|
98
|
+
are skipped when their permission is absent; hiding controls alone is insufficient.
|
|
99
|
+
|
|
100
|
+
| Permission | Frontend access |
|
|
101
|
+
| -------------------------- | --------------------------------------------------------------------------- |
|
|
102
|
+
| `report_scheduler:read` | Own schedules, portal inbox, authorized artifact downloads |
|
|
103
|
+
| `report_scheduler:create` | Create and duplicate schedules, recipient directory and preview |
|
|
104
|
+
| `report_scheduler:update` | Edit, pause and resume schedules, recipient directory and preview |
|
|
105
|
+
| `report_scheduler:delete` | Delete schedule controls and confirmation |
|
|
106
|
+
| `report_scheduler:execute` | Run now; retry when execution history is also accessible |
|
|
107
|
+
| `report_scheduler:history` | Execution tab, expandable details, health strip and summary metrics |
|
|
108
|
+
| `report_scheduler:manage` | Broader ownership scope from the backend; does not grant action permissions |
|
|
109
|
+
|
|
110
|
+
Read-only users do not subscribe to history/health endpoints, see mutation
|
|
111
|
+
controls, or load the recipient directory. Revoking history access returns an
|
|
112
|
+
open history tab to schedules and stops detail polling. Revoking create/update
|
|
113
|
+
access unmounts an open form. Backend permissions, ownership, and health-context
|
|
114
|
+
checks remain authoritative for every request. Portal downloads use `read` and
|
|
115
|
+
server-side recipient authorization; no additional download permission is required.
|
|
116
|
+
|
|
117
|
+
Run `node --test scripts/report-scheduler-permissions.test.mjs` from `frontend`
|
|
118
|
+
for permission, rendered-control, query-subscription, and retry boundary checks.
|