@flowdular/sdk 0.2.4 → 0.3.1
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/.ai/agents/sandbox/business-manager.md +5 -1
- package/.ai/blueprints/author-spec/README.md +1 -1
- package/.ai/blueprints/author-spec/spec-requirements.yaml +44 -0
- package/.ai/blueprints/author-spec/steps.yaml +5 -5
- package/.ai/blueprints/author-spec/templates/module.yaml +99 -3
- package/.ai/blueprints/edit-module/gates.yaml +4 -0
- package/.ai/blueprints/edit-module/required-files.yaml +9 -0
- package/.ai/blueprints/new-module/gates.yaml +4 -0
- package/.ai/blueprints/new-module/spec-requirements.yaml +2 -2
- package/.ai/blueprints/release/gates.yaml +4 -0
- package/.ai/platform-capabilities.md +128 -0
- package/.ai/policies/capabilities.yaml +130 -3
- package/.ai/policies/path-ownership.yaml +5 -2
- package/.ai/policies/task-budgets.yaml +5 -3
- package/.ai/references/catalog/module.json +4 -4
- package/.ai/references/catalog/package.json +2 -2
- package/.ai/references/catalog/spec/module.yaml +5 -3
- package/.ai/references/catalog/src/platform.ts +2 -0
- package/.ai/references/catalog/src/services/catalog-service.ts +89 -1
- package/.ai/references/catalog/src/services/data-classes.ts +47 -0
- package/.ai/references/catalog/src/services/database-repository.ts +98 -1
- package/.ai/references/catalog/src/services/repository.ts +22 -1
- package/.ai/references/catalog/tests/data-classes.test.ts +157 -0
- package/.ai/references/catalog.provenance.json +12 -10
- package/.ai/skills/README.md +10 -0
- package/.ai/skills/agent-tool-design/SKILL.md +1 -2
- package/.ai/skills/auth-security-review/SKILL.md +1 -1
- package/.ai/skills/business-agent-design/SKILL.md +0 -1
- package/.ai/skills/cli-extension/SKILL.md +1 -1
- package/.ai/skills/deploy-operate/SKILL.md +119 -0
- package/.ai/skills/module-new/SKILL.md +29 -3
- package/.ai/skills/module-update/SKILL.md +9 -3
- package/.ai/skills/perf-audit/SKILL.md +0 -1
- package/.ai/skills/release-eject-pr/SKILL.md +0 -1
- package/.ai/skills/spec-interview/SKILL.md +120 -0
- package/.ai/skills/test-hardening/SKILL.md +1 -0
- package/.ai/skills/ux-design/SKILL.md +34 -3
- package/.ai/skills/variables/SKILL.md +0 -2
- package/.ai/skills/workflow-development/SKILL.md +0 -1
- package/AGENTS.md +4 -0
- package/docs/agent-contract.md +2 -2
- package/docs/design-system.md +185 -31
- package/modules/access/migrations/0001_access_core.down.sql +1 -0
- package/modules/access/migrations/0001_access_core.up.sql +28 -0
- package/modules/access/migrations/README.md +3 -0
- package/modules/access/module.json +33 -0
- package/modules/access/package.json +43 -0
- package/modules/access/spec/module.yaml +225 -0
- package/modules/access/src/acl/permissions.ts +6 -0
- package/modules/access/src/api/endpoints.ts +244 -0
- package/modules/access/src/client/ActivityView.tsrx +245 -0
- package/modules/access/src/client/AttestationsView.tsrx +176 -0
- package/modules/access/src/client/ReviewView.tsrx +586 -0
- package/modules/access/src/client/api.ts +132 -0
- package/modules/access/src/client/contribution.tsrx +41 -0
- package/modules/access/src/client/index.ts +41 -0
- package/modules/access/src/client/navigation.ts +57 -0
- package/modules/access/src/client/presentation.ts +69 -0
- package/modules/access/src/client/state.ts +72 -0
- package/modules/access/src/domain/types.ts +189 -0
- package/modules/access/src/index.ts +38 -0
- package/modules/access/src/platform.ts +60 -0
- package/modules/access/src/server/index.ts +42 -0
- package/modules/access/src/server/runtime.ts +105 -0
- package/modules/access/src/services/access-service.ts +298 -0
- package/modules/access/src/services/audit-window.ts +78 -0
- package/modules/access/src/services/auth-directory.ts +72 -0
- package/modules/access/src/services/changes.ts +91 -0
- package/modules/access/src/services/data-classes.ts +28 -0
- package/modules/access/src/services/database-repository.ts +185 -0
- package/modules/access/src/services/directory.ts +102 -0
- package/modules/access/src/services/index.ts +33 -0
- package/modules/access/src/services/list-exports.ts +150 -0
- package/modules/access/src/services/migration.ts +54 -0
- package/modules/access/src/services/repository.ts +30 -0
- package/modules/access/src/services/review.ts +178 -0
- package/modules/access/translations/en.json +155 -0
- package/modules/access/translations/pl.json +155 -0
- package/modules/agents/migrations/0022_credential_rotation_inventory.down.sql +2 -0
- package/modules/agents/migrations/0022_credential_rotation_inventory.up.sql +7 -0
- package/modules/agents/migrations/0023_agents_retention_indexes.down.sql +2 -0
- package/modules/agents/migrations/0023_agents_retention_indexes.up.sql +9 -0
- package/modules/agents/migrations/0024_agent_meter_refusals.down.sql +3 -0
- package/modules/agents/migrations/0024_agent_meter_refusals.up.sql +22 -0
- package/modules/agents/migrations/0025_agent_list_indexes.down.sql +3 -0
- package/modules/agents/migrations/0025_agent_list_indexes.up.sql +11 -0
- package/modules/agents/module.json +30 -4
- package/modules/agents/package.json +2 -1
- package/modules/agents/spec/module.yaml +63 -5
- package/modules/agents/src/api/endpoints.ts +291 -33
- package/modules/agents/src/cli/commands.json +11 -0
- package/modules/agents/src/cli/index.ts +45 -0
- package/modules/agents/src/client/AgentDashboardWidget.tsrx +19 -11
- package/modules/agents/src/client/AgentDefinitionList.tsrx +53 -10
- package/modules/agents/src/client/AgentPlaygroundView.tsrx +4 -4
- package/modules/agents/src/client/AgentProceduresView.tsrx +2 -2
- package/modules/agents/src/client/AgentRunsView.tsrx +143 -40
- package/modules/agents/src/client/AgentsView.tsrx +109 -33
- package/modules/agents/src/client/api.ts +99 -21
- package/modules/agents/src/client/state.ts +97 -0
- package/modules/agents/src/domain/types.ts +44 -4
- package/modules/agents/src/platform.ts +42 -0
- package/modules/agents/src/server/action-execution.ts +201 -106
- package/modules/agents/src/server/runtime.ts +32 -0
- package/modules/agents/src/services/agent-service.ts +158 -30
- package/modules/agents/src/services/credential-rotation.ts +185 -0
- package/modules/agents/src/services/credential-vault.ts +71 -46
- package/modules/agents/src/services/data-classes.ts +176 -0
- package/modules/agents/src/services/database-repository.ts +393 -101
- package/modules/agents/src/services/metering.ts +111 -0
- package/modules/agents/src/services/migration.ts +109 -0
- package/modules/agents/src/services/module-agent-preflight.ts +17 -9
- package/modules/agents/src/services/notifications.ts +98 -0
- package/modules/agents/src/services/provider-repository.ts +9 -18
- package/modules/agents/src/services/provider-service.ts +1 -9
- package/modules/agents/src/services/reports.ts +107 -0
- package/modules/agents/src/services/repository.ts +86 -6
- package/modules/agents/src/services/usage-service.ts +2 -0
- package/modules/agents/src/services/worker.ts +114 -4
- package/modules/agents/src/settings.ts +14 -3
- package/modules/agents/translations/en.json +14 -4
- package/modules/agents/translations/pl.json +14 -4
- package/modules/approvals/migrations/0001_approvals_core.down.sql +3 -0
- package/modules/approvals/migrations/0001_approvals_core.up.sql +78 -0
- package/modules/approvals/migrations/0002_approvals_expiry_routing_role.down.sql +2 -0
- package/modules/approvals/migrations/0002_approvals_expiry_routing_role.up.sql +19 -0
- package/modules/approvals/migrations/0003_approvals_retention_indexes.down.sql +6 -0
- package/modules/approvals/migrations/0003_approvals_retention_indexes.up.sql +14 -0
- package/modules/approvals/migrations/0004_approvals_inbox_keyset_indexes.down.sql +5 -0
- package/modules/approvals/migrations/0004_approvals_inbox_keyset_indexes.up.sql +12 -0
- package/modules/approvals/migrations/0005_approvals_grant_audit.down.sql +4 -0
- package/modules/approvals/migrations/0005_approvals_grant_audit.up.sql +20 -0
- package/modules/approvals/migrations/README.md +3 -0
- package/modules/approvals/module.json +34 -0
- package/modules/approvals/package.json +43 -0
- package/modules/approvals/spec/module.yaml +327 -0
- package/modules/approvals/src/acl/permissions.ts +7 -0
- package/modules/approvals/src/api/endpoints.ts +457 -0
- package/modules/approvals/src/client/ApprovalRequestDrawer.tsrx +138 -0
- package/modules/approvals/src/client/ApprovalsView.tsrx +562 -0
- package/modules/approvals/src/client/PendingCountWidget.tsrx +52 -0
- package/modules/approvals/src/client/api.ts +203 -0
- package/modules/approvals/src/client/approvals.css +51 -0
- package/modules/approvals/src/client/contribution.tsrx +44 -0
- package/modules/approvals/src/client/index.ts +26 -0
- package/modules/approvals/src/client/navigation.ts +39 -0
- package/modules/approvals/src/client/pending-count.ts +26 -0
- package/modules/approvals/src/client/presentation.ts +52 -0
- package/modules/approvals/src/client/state.ts +141 -0
- package/modules/approvals/src/domain/capability.ts +107 -0
- package/modules/approvals/src/domain/grant.ts +69 -0
- package/modules/approvals/src/domain/types.ts +168 -0
- package/modules/approvals/src/index.ts +61 -0
- package/modules/approvals/src/platform.ts +136 -0
- package/modules/approvals/src/server/index.ts +42 -0
- package/modules/approvals/src/server/runtime.ts +185 -0
- package/modules/approvals/src/services/approvals-service.ts +637 -0
- package/modules/approvals/src/services/callbacks.ts +75 -0
- package/modules/approvals/src/services/data-classes.ts +167 -0
- package/modules/approvals/src/services/database-repository.ts +783 -0
- package/modules/approvals/src/services/eligibility.ts +121 -0
- package/modules/approvals/src/services/expiry-runner.ts +81 -0
- package/modules/approvals/src/services/index.ts +31 -0
- package/modules/approvals/src/services/migration.ts +256 -0
- package/modules/approvals/src/services/notifications.ts +95 -0
- package/modules/approvals/src/services/repository.ts +169 -0
- package/modules/approvals/src/services/service-error.ts +70 -0
- package/modules/approvals/src/settings.ts +102 -0
- package/modules/approvals/translations/en.json +104 -0
- package/modules/approvals/translations/pl.json +104 -0
- package/modules/audit/migrations/0001_audit_core.down.sql +8 -0
- package/modules/audit/migrations/0001_audit_core.up.sql +107 -0
- package/modules/audit/migrations/0002_audit_sweep_routing_role.down.sql +2 -0
- package/modules/audit/migrations/0002_audit_sweep_routing_role.up.sql +21 -0
- package/modules/audit/migrations/0003_audit_export_request.down.sql +12 -0
- package/modules/audit/migrations/0003_audit_export_request.up.sql +40 -0
- package/modules/audit/migrations/0004_audit_hold_seal_erasure.down.sql +17 -0
- package/modules/audit/migrations/0004_audit_hold_seal_erasure.up.sql +192 -0
- package/modules/audit/migrations/0005_audit_event_format.down.sql +17 -0
- package/modules/audit/migrations/0005_audit_event_format.up.sql +60 -0
- package/modules/audit/migrations/0006_audit_own_class_walks.down.sql +3 -0
- package/modules/audit/migrations/0006_audit_own_class_walks.up.sql +14 -0
- package/modules/audit/migrations/README.md +3 -0
- package/modules/audit/module.json +32 -0
- package/modules/audit/package.json +49 -0
- package/modules/audit/spec/module.yaml +809 -0
- package/modules/audit/src/acl/permissions.ts +7 -0
- package/modules/audit/src/api/endpoints.ts +315 -0
- package/modules/audit/src/cli/commands.json +95 -0
- package/modules/audit/src/cli/index.ts +658 -0
- package/modules/audit/src/client/DataClassesView.tsrx +420 -0
- package/modules/audit/src/client/ExportsView.tsrx +256 -0
- package/modules/audit/src/client/HoldsView.tsrx +604 -0
- package/modules/audit/src/client/SweepsView.tsrx +251 -0
- package/modules/audit/src/client/api.ts +185 -0
- package/modules/audit/src/client/contribution.tsrx +52 -0
- package/modules/audit/src/client/index.ts +23 -0
- package/modules/audit/src/client/navigation.ts +74 -0
- package/modules/audit/src/client/presentation.ts +105 -0
- package/modules/audit/src/client/state.ts +86 -0
- package/modules/audit/src/domain/data-classes.ts +16 -0
- package/modules/audit/src/domain/types.ts +339 -0
- package/modules/audit/src/index.ts +76 -0
- package/modules/audit/src/platform.ts +44 -0
- package/modules/audit/src/server/index.ts +177 -0
- package/modules/audit/src/server/runtime.ts +303 -0
- package/modules/audit/src/services/anchor-key.ts +143 -0
- package/modules/audit/src/services/anchor-rotation.ts +147 -0
- package/modules/audit/src/services/audit-runners.ts +278 -0
- package/modules/audit/src/services/backup-guard.ts +95 -0
- package/modules/audit/src/services/database-repository.ts +1946 -0
- package/modules/audit/src/services/declared-classes.ts +64 -0
- package/modules/audit/src/services/erasure-port.ts +126 -0
- package/modules/audit/src/services/erasure-service.ts +770 -0
- package/modules/audit/src/services/export-directory.ts +106 -0
- package/modules/audit/src/services/export-service.ts +714 -0
- package/modules/audit/src/services/hold-service.ts +295 -0
- package/modules/audit/src/services/index.ts +17 -0
- package/modules/audit/src/services/migration.ts +658 -0
- package/modules/audit/src/services/own-classes.ts +318 -0
- package/modules/audit/src/services/platform-version.ts +23 -0
- package/modules/audit/src/services/repository.ts +495 -0
- package/modules/audit/src/services/retention-service.ts +191 -0
- package/modules/audit/src/services/seal-service.ts +769 -0
- package/modules/audit/src/services/service-error.ts +61 -0
- package/modules/audit/src/services/subject-keys.ts +90 -0
- package/modules/audit/src/services/sweep-service.ts +298 -0
- package/modules/audit/src/services/zip.ts +217 -0
- package/modules/audit/src/settings.ts +69 -0
- package/modules/audit/translations/en.json +210 -0
- package/modules/audit/translations/pl.json +210 -0
- package/modules/auth/README.md +77 -29
- package/modules/auth/migrations/0016_external_identities.up.sql +16 -0
- package/modules/auth/migrations/0017_mfa_key_id.up.sql +8 -0
- package/modules/auth/migrations/0018_retire_bundled_module_scopes.up.sql +29 -0
- package/modules/auth/migrations/0019_notifications_member_scopes.up.sql +44 -0
- package/modules/auth/migrations/0020_identity_providers.up.sql +61 -0
- package/modules/auth/migrations/0021_membership_status.up.sql +19 -0
- package/modules/auth/migrations/0022_auth_provider_scopes.up.sql +45 -0
- package/modules/auth/migrations/0023_enterprise_module_scopes.down.sql +19 -0
- package/modules/auth/migrations/0023_enterprise_module_scopes.up.sql +71 -0
- package/modules/auth/migrations/0024_approvals_member_scopes.down.sql +22 -0
- package/modules/auth/migrations/0024_approvals_member_scopes.up.sql +48 -0
- package/modules/auth/migrations/0025_audit_holds_owner_scope.down.sql +21 -0
- package/modules/auth/migrations/0025_audit_holds_owner_scope.up.sql +47 -0
- package/modules/auth/migrations/0026_auth_export_keyset_indexes.down.sql +6 -0
- package/modules/auth/migrations/0026_auth_export_keyset_indexes.up.sql +15 -0
- package/modules/auth/migrations/0027_workflow_automation_profile_scopes.down.sql +34 -0
- package/modules/auth/migrations/0027_workflow_automation_profile_scopes.up.sql +72 -0
- package/modules/auth/migrations/0028_auth_member_search_prefix_indexes.down.sql +6 -0
- package/modules/auth/migrations/0028_auth_member_search_prefix_indexes.up.sql +21 -0
- package/modules/auth/migrations/0029_reports_exports_access_scopes.down.sql +22 -0
- package/modules/auth/migrations/0029_reports_exports_access_scopes.up.sql +56 -0
- package/modules/auth/migrations/0030_auth_membership_keyset_index.down.sql +4 -0
- package/modules/auth/migrations/0030_auth_membership_keyset_index.up.sql +10 -0
- package/modules/auth/migrations/0031_membership_scope_backfills_under_rls.down.sql +4 -0
- package/modules/auth/migrations/0031_membership_scope_backfills_under_rls.up.sql +31 -0
- package/modules/auth/migrations/0032_audit_actor_service.down.sql +9 -0
- package/modules/auth/migrations/0032_audit_actor_service.up.sql +10 -0
- package/modules/auth/migrations/0033_auth_account_keyset_indexes.down.sql +5 -0
- package/modules/auth/migrations/0033_auth_account_keyset_indexes.up.sql +23 -0
- package/modules/auth/module.json +3 -3
- package/modules/auth/package.json +2 -1
- package/modules/auth/spec/module.yaml +372 -3
- package/modules/auth/src/acl/scopes.ts +50 -6
- package/modules/auth/src/cli/commands.json +11 -0
- package/modules/auth/src/cli/greenfield.ts +2 -2
- package/modules/auth/src/cli/index.ts +14 -0
- package/modules/auth/src/cli/secrets.ts +114 -0
- package/modules/auth/src/client/AuthenticationCore.tsrx +61 -8
- package/modules/auth/src/client/api.ts +72 -6
- package/modules/auth/src/client/contribution.tsrx +23 -0
- package/modules/auth/src/client/index.ts +6 -0
- package/modules/auth/src/client/providers/IdentityProviderForm.tsrx +191 -0
- package/modules/auth/src/client/providers/IdentityProvidersView.tsrx +358 -0
- package/modules/auth/src/client/providers/api.ts +128 -0
- package/modules/auth/src/client/providers/provider-columns.tsrx +60 -0
- package/modules/auth/src/client/providers/state.ts +35 -0
- package/modules/auth/src/client/security/SecurityView.tsrx +9 -1
- package/modules/auth/src/client/state.ts +15 -1
- package/modules/auth/src/domain/types.ts +55 -0
- package/modules/auth/src/index.ts +11 -1
- package/modules/auth/src/middleware/authentication.ts +4 -0
- package/modules/auth/src/server/endpoints.ts +467 -171
- package/modules/auth/src/server/http.ts +3 -2
- package/modules/auth/src/server/index.ts +22 -1
- package/modules/auth/src/server/membership-endpoints.ts +62 -0
- package/modules/auth/src/server/mfa-enforcement.ts +156 -0
- package/modules/auth/src/server/oidc.ts +389 -0
- package/modules/auth/src/server/provider-endpoints.ts +246 -0
- package/modules/auth/src/server/provider-host.ts +77 -0
- package/modules/auth/src/server/runtime.ts +231 -55
- package/modules/auth/src/services/auth-service-error.ts +7 -2
- package/modules/auth/src/services/auth-service.ts +948 -51
- package/modules/auth/src/services/data-classes.ts +236 -0
- package/modules/auth/src/services/database-repository.ts +853 -71
- package/modules/auth/src/services/identity-provider-service.ts +571 -0
- package/modules/auth/src/services/mail-delivery.ts +16 -16
- package/modules/auth/src/services/mail-message.ts +54 -0
- package/modules/auth/src/services/mail-port.ts +24 -0
- package/modules/auth/src/services/mail-smtp.ts +85 -0
- package/modules/auth/src/services/mfa-rotation.ts +144 -0
- package/modules/auth/src/services/migration.ts +810 -0
- package/modules/auth/src/services/password.ts +14 -0
- package/modules/auth/src/services/provider-secret-rotation.ts +169 -0
- package/modules/auth/src/services/provider-secrets.ts +136 -0
- package/modules/auth/src/services/repository.ts +321 -5
- package/modules/auth/src/services/session-sweep-runner.ts +73 -0
- package/modules/auth/src/services/settings-store.ts +10 -83
- package/modules/auth/src/services/totp.ts +88 -62
- package/modules/auth/src/services/validation.ts +194 -7
- package/modules/auth/src/settings.ts +18 -0
- package/modules/auth/translations/en.json +84 -1
- package/modules/auth/translations/pl.json +84 -1
- package/modules/automations/migrations/0005_secret_rotation_inventory.down.sql +1 -0
- package/modules/automations/migrations/0005_secret_rotation_inventory.up.sql +6 -0
- package/modules/automations/migrations/0006_automations_list_sort_indexes.down.sql +4 -0
- package/modules/automations/migrations/0006_automations_list_sort_indexes.up.sql +11 -0
- package/modules/automations/module.json +24 -6
- package/modules/automations/package.json +4 -1
- package/modules/automations/spec/module.yaml +81 -7
- package/modules/automations/src/api/endpoints.ts +202 -28
- package/modules/automations/src/cli/commands.json +17 -0
- package/modules/automations/src/cli/index.ts +114 -0
- package/modules/automations/src/client/AutomationScheduleForm.tsrx +77 -19
- package/modules/automations/src/client/AutomationSchedulesView.tsrx +144 -40
- package/modules/automations/src/client/AutomationTriggersView.tsrx +131 -32
- package/modules/automations/src/client/api.ts +62 -19
- package/modules/automations/src/client/presentation.ts +20 -2
- package/modules/automations/src/client/state.ts +84 -0
- package/modules/automations/src/domain/cadence.ts +99 -3
- package/modules/automations/src/domain/cron.ts +366 -0
- package/modules/automations/src/domain/time-zone.ts +61 -0
- package/modules/automations/src/platform.ts +38 -4
- package/modules/automations/src/server/index.ts +11 -0
- package/modules/automations/src/server/runtime.ts +46 -22
- package/modules/{automations-workflows-integration/src/server/adapter.ts → automations/src/server/workflow-target.ts} +13 -14
- package/modules/{automations-workflows-integration/src/server/tools.ts → automations/src/server/workflow-tools.ts} +0 -0
- package/modules/automations/src/services/data-classes.ts +62 -0
- package/modules/automations/src/services/database-repository.ts +152 -38
- package/modules/automations/src/services/migration.ts +119 -9
- package/modules/automations/src/services/repository.ts +52 -1
- package/modules/automations/src/services/schedule-runner.ts +84 -0
- package/modules/automations/src/services/schedule-service.ts +152 -26
- package/modules/automations/src/services/secret-rotation.ts +176 -0
- package/modules/automations/src/services/secret-vault.ts +68 -41
- package/modules/automations/src/services/trigger-service.ts +13 -10
- package/modules/automations/translations/en.json +15 -2
- package/modules/automations/translations/pl.json +15 -2
- package/modules/connectors/migrations/0001_connectors_core.down.sql +3 -0
- package/modules/connectors/migrations/0001_connectors_core.up.sql +72 -0
- package/modules/connectors/migrations/0002_connectors_call_keys.down.sql +3 -0
- package/modules/connectors/migrations/0002_connectors_call_keys.up.sql +18 -0
- package/modules/connectors/migrations/0003_connectors_rotation_inventory.down.sql +2 -0
- package/modules/connectors/migrations/0003_connectors_rotation_inventory.up.sql +19 -0
- package/modules/connectors/migrations/README.md +3 -0
- package/modules/connectors/module.json +32 -0
- package/modules/{automations-workflows-integration → connectors}/package.json +28 -26
- package/modules/connectors/spec/module.yaml +448 -0
- package/modules/connectors/src/acl/permissions.ts +6 -0
- package/modules/connectors/src/agent/tools.ts +180 -0
- package/modules/connectors/src/api/endpoints.ts +572 -0
- package/modules/connectors/src/cli/commands.json +17 -0
- package/modules/connectors/src/cli/index.ts +126 -0
- package/modules/connectors/src/client/ConnectorCallsView.tsrx +358 -0
- package/modules/connectors/src/client/ConnectorForm.tsrx +424 -0
- package/modules/connectors/src/client/ConnectorsView.tsrx +711 -0
- package/modules/connectors/src/client/api.ts +281 -0
- package/modules/connectors/src/client/consent.ts +48 -0
- package/modules/connectors/src/client/contribution.tsrx +37 -0
- package/modules/connectors/src/client/index.ts +22 -0
- package/modules/connectors/src/client/navigation.ts +42 -0
- package/modules/connectors/src/client/presentation.ts +38 -0
- package/modules/connectors/src/client/state.ts +175 -0
- package/modules/connectors/src/domain/calls.ts +70 -0
- package/modules/connectors/src/domain/definitions.ts +190 -0
- package/modules/connectors/src/domain/http-json.ts +68 -0
- package/modules/connectors/src/domain/types.ts +185 -0
- package/modules/connectors/src/index.ts +64 -0
- package/modules/connectors/src/platform.ts +56 -0
- package/modules/connectors/src/server/index.ts +66 -0
- package/modules/connectors/src/server/runtime.ts +163 -0
- package/modules/connectors/src/services/call-service.ts +903 -0
- package/modules/connectors/src/services/connectors-service.ts +653 -0
- package/modules/connectors/src/services/credential-rotation.ts +221 -0
- package/modules/connectors/src/services/credential-vault.ts +194 -0
- package/modules/connectors/src/services/data-classes.ts +158 -0
- package/modules/connectors/src/services/database-repository.ts +897 -0
- package/modules/connectors/src/services/egress.ts +261 -0
- package/modules/connectors/src/services/index.ts +19 -0
- package/modules/connectors/src/services/migration.ts +202 -0
- package/modules/connectors/src/services/repository.ts +175 -0
- package/modules/connectors/src/services/service-error.ts +46 -0
- package/modules/connectors/src/settings.ts +69 -0
- package/modules/connectors/translations/en.json +191 -0
- package/modules/connectors/translations/pl.json +191 -0
- package/modules/directory/migrations/0001_directory_core.down.sql +5 -0
- package/modules/directory/migrations/0001_directory_core.up.sql +111 -0
- package/modules/directory/migrations/README.md +3 -0
- package/modules/directory/module.json +27 -0
- package/modules/directory/package.json +46 -0
- package/modules/directory/spec/module.yaml +351 -0
- package/modules/directory/src/acl/permissions.ts +7 -0
- package/modules/directory/src/api/endpoints.ts +478 -0
- package/modules/directory/src/api/scim-endpoints.ts +516 -0
- package/modules/directory/src/client/GroupMappingsView.tsrx +430 -0
- package/modules/directory/src/client/ProvisioningLogView.tsrx +248 -0
- package/modules/directory/src/client/ScimTokensView.tsrx +587 -0
- package/modules/directory/src/client/api.ts +222 -0
- package/modules/directory/src/client/contribution.tsrx +46 -0
- package/modules/directory/src/client/index.ts +22 -0
- package/modules/directory/src/client/navigation.ts +57 -0
- package/modules/directory/src/client/presentation.ts +143 -0
- package/modules/directory/src/client/state.ts +173 -0
- package/modules/directory/src/domain/scim.ts +346 -0
- package/modules/directory/src/domain/types.ts +166 -0
- package/modules/directory/src/index.ts +44 -0
- package/modules/directory/src/platform.ts +43 -0
- package/modules/directory/src/server/index.ts +17 -0
- package/modules/directory/src/server/runtime.ts +124 -0
- package/modules/directory/src/services/auth-port.ts +127 -0
- package/modules/directory/src/services/data-classes.ts +41 -0
- package/modules/directory/src/services/database-repository.ts +1067 -0
- package/modules/directory/src/services/directory-service.ts +311 -0
- package/modules/directory/src/services/index.ts +43 -0
- package/modules/directory/src/services/migration.ts +146 -0
- package/modules/directory/src/services/provisioning-service.ts +1420 -0
- package/modules/directory/src/services/rate-limiter.ts +103 -0
- package/modules/directory/src/services/repository.ts +208 -0
- package/modules/directory/src/services/service-error.ts +42 -0
- package/modules/directory/src/services/token-service.ts +215 -0
- package/modules/directory/src/settings.ts +86 -0
- package/modules/directory/translations/en.json +185 -0
- package/modules/directory/translations/pl.json +185 -0
- package/modules/documents/migrations/0001_documents_core.down.sql +1 -0
- package/modules/documents/migrations/0001_documents_core.up.sql +35 -0
- package/modules/documents/migrations/0002_documents_files_page.down.sql +1 -0
- package/modules/documents/migrations/0002_documents_files_page.up.sql +6 -0
- package/modules/documents/migrations/0003_documents_rotation_inventory.down.sql +2 -0
- package/modules/documents/migrations/0003_documents_rotation_inventory.up.sql +18 -0
- package/modules/documents/migrations/README.md +3 -0
- package/modules/documents/module.json +32 -0
- package/modules/documents/package.json +50 -0
- package/modules/documents/spec/module.yaml +248 -0
- package/modules/documents/src/acl/permissions.ts +6 -0
- package/modules/documents/src/api/endpoints.ts +401 -0
- package/modules/documents/src/cli/commands.json +17 -0
- package/modules/documents/src/cli/index.ts +145 -0
- package/modules/documents/src/client/DocumentUploader.tsrx +148 -0
- package/modules/documents/src/client/DocumentsView.tsrx +540 -0
- package/modules/documents/src/client/api.ts +209 -0
- package/modules/documents/src/client/contribution.tsrx +29 -0
- package/modules/documents/src/client/download.ts +70 -0
- package/modules/documents/src/client/index.ts +22 -0
- package/modules/documents/src/client/navigation.ts +25 -0
- package/modules/documents/src/client/presentation.ts +110 -0
- package/modules/documents/src/client/state.ts +117 -0
- package/modules/documents/src/domain/attachments.ts +84 -0
- package/modules/documents/src/domain/types.ts +80 -0
- package/modules/documents/src/index.ts +46 -0
- package/modules/documents/src/platform.ts +61 -0
- package/modules/documents/src/server/index.ts +30 -0
- package/modules/documents/src/server/runtime.ts +107 -0
- package/modules/documents/src/services/attachments.ts +39 -0
- package/modules/documents/src/services/data-classes.ts +25 -0
- package/modules/documents/src/services/database-repository.ts +270 -0
- package/modules/documents/src/services/documents-service.ts +590 -0
- package/modules/documents/src/services/index.ts +18 -0
- package/modules/documents/src/services/migration.ts +117 -0
- package/modules/documents/src/services/repository.ts +58 -0
- package/modules/documents/src/services/storage-rotation.ts +157 -0
- package/modules/documents/src/settings.ts +107 -0
- package/modules/documents/translations/en.json +111 -0
- package/modules/documents/translations/pl.json +111 -0
- package/modules/exports/migrations/0001_exports_core.down.sql +2 -0
- package/modules/exports/migrations/0001_exports_core.up.sql +28 -0
- package/modules/exports/migrations/0002_exports_job_routing_role.down.sql +4 -0
- package/modules/exports/migrations/0002_exports_job_routing_role.up.sql +21 -0
- package/modules/exports/migrations/0003_exports_rotation_inventory.down.sql +1 -0
- package/modules/exports/migrations/0003_exports_rotation_inventory.up.sql +9 -0
- package/modules/exports/migrations/README.md +3 -0
- package/modules/exports/module.json +32 -0
- package/modules/exports/package.json +45 -0
- package/modules/exports/spec/module.yaml +230 -0
- package/modules/exports/src/acl/permissions.ts +6 -0
- package/modules/exports/src/api/endpoints.ts +211 -0
- package/modules/exports/src/cli/commands.json +17 -0
- package/modules/exports/src/cli/index.ts +145 -0
- package/modules/exports/src/client/ExportsView.tsrx +327 -0
- package/modules/exports/src/client/api.ts +133 -0
- package/modules/exports/src/client/contribution.tsrx +31 -0
- package/modules/exports/src/client/index.ts +20 -0
- package/modules/exports/src/client/navigation.ts +25 -0
- package/modules/exports/src/client/presentation.ts +53 -0
- package/modules/exports/src/client/state.ts +56 -0
- package/modules/exports/src/domain/lists.ts +29 -0
- package/modules/exports/src/domain/types.ts +120 -0
- package/modules/exports/src/index.ts +41 -0
- package/modules/exports/src/platform.ts +80 -0
- package/modules/exports/src/server/index.ts +50 -0
- package/modules/exports/src/server/runtime.ts +160 -0
- package/modules/exports/src/services/data-classes.ts +59 -0
- package/modules/exports/src/services/database-repository.ts +403 -0
- package/modules/exports/src/services/export-runner.ts +123 -0
- package/modules/exports/src/services/export-service.ts +356 -0
- package/modules/exports/src/services/index.ts +6 -0
- package/modules/exports/src/services/list-registry.ts +105 -0
- package/modules/exports/src/services/migration.ts +116 -0
- package/modules/exports/src/services/repository.ts +96 -0
- package/modules/exports/src/services/storage-rotation.ts +138 -0
- package/modules/exports/src/settings.ts +70 -0
- package/modules/exports/translations/en.json +69 -0
- package/modules/exports/translations/pl.json +69 -0
- package/modules/import/migrations/0001_import_core.down.sql +6 -0
- package/modules/import/migrations/0001_import_core.up.sql +61 -0
- package/modules/import/migrations/0002_import_job_routing_role.down.sql +4 -0
- package/modules/import/migrations/0002_import_job_routing_role.up.sql +20 -0
- package/modules/import/migrations/0003_import_jobs_export_index.down.sql +1 -0
- package/modules/import/migrations/0003_import_jobs_export_index.up.sql +7 -0
- package/modules/import/migrations/0004_import_jobs_traceparent.down.sql +1 -0
- package/modules/import/migrations/0004_import_jobs_traceparent.up.sql +7 -0
- package/modules/import/migrations/README.md +3 -0
- package/modules/import/module.json +37 -0
- package/modules/import/package.json +50 -0
- package/modules/import/spec/module.yaml +335 -0
- package/modules/import/src/acl/permissions.ts +6 -0
- package/modules/import/src/api/endpoints.ts +400 -0
- package/modules/import/src/client/ImportJobDrawer.tsrx +229 -0
- package/modules/import/src/client/ImportsView.tsrx +455 -0
- package/modules/import/src/client/NewImportForm.tsrx +274 -0
- package/modules/import/src/client/api.ts +243 -0
- package/modules/import/src/client/contribution.tsrx +29 -0
- package/modules/import/src/client/index.ts +23 -0
- package/modules/import/src/client/navigation.ts +25 -0
- package/modules/import/src/client/presentation.ts +59 -0
- package/modules/import/src/client/state.ts +43 -0
- package/modules/import/src/domain/csv.ts +258 -0
- package/modules/import/src/domain/ports.ts +157 -0
- package/modules/import/src/domain/types.ts +179 -0
- package/modules/import/src/index.ts +58 -0
- package/modules/import/src/platform.ts +60 -0
- package/modules/import/src/server/index.ts +49 -0
- package/modules/import/src/server/runtime.ts +158 -0
- package/modules/import/src/services/csv-source.ts +121 -0
- package/modules/import/src/services/data-classes.ts +63 -0
- package/modules/import/src/services/database-repository.ts +780 -0
- package/modules/import/src/services/import-runner.ts +127 -0
- package/modules/import/src/services/import-service.ts +872 -0
- package/modules/import/src/services/index.ts +6 -0
- package/modules/import/src/services/migration.ts +156 -0
- package/modules/import/src/services/port-registry.ts +158 -0
- package/modules/import/src/services/repository.ts +147 -0
- package/modules/import/src/settings.ts +70 -0
- package/modules/import/translations/en.json +175 -0
- package/modules/import/translations/pl.json +175 -0
- package/modules/metering/migrations/0001_metering_core.down.sql +6 -0
- package/modules/metering/migrations/0001_metering_core.up.sql +119 -0
- package/modules/metering/migrations/0002_metering_bucket_export.down.sql +3 -0
- package/modules/metering/migrations/0002_metering_bucket_export.up.sql +5 -0
- package/modules/metering/migrations/README.md +3 -0
- package/modules/metering/module.json +46 -0
- package/modules/metering/package.json +50 -0
- package/modules/metering/spec/module.yaml +269 -0
- package/modules/metering/src/acl/permissions.ts +5 -0
- package/modules/metering/src/api/endpoints.ts +104 -0
- package/modules/metering/src/cli/commands.json +28 -0
- package/modules/metering/src/cli/index.ts +246 -0
- package/modules/metering/src/client/LimitsView.tsrx +170 -0
- package/modules/metering/src/client/UsageSummaryWidget.tsrx +63 -0
- package/modules/metering/src/client/UsageView.tsrx +205 -0
- package/modules/metering/src/client/api.ts +91 -0
- package/modules/metering/src/client/contribution.tsrx +42 -0
- package/modules/metering/src/client/index.ts +26 -0
- package/modules/metering/src/client/navigation.ts +54 -0
- package/modules/metering/src/client/presentation.ts +63 -0
- package/modules/metering/src/client/state.ts +31 -0
- package/modules/metering/src/domain/meters.ts +100 -0
- package/modules/metering/src/domain/types.ts +71 -0
- package/modules/metering/src/index.ts +51 -0
- package/modules/metering/src/platform.ts +84 -0
- package/modules/metering/src/server/index.ts +40 -0
- package/modules/metering/src/server/runtime.ts +165 -0
- package/modules/metering/src/services/data-classes.ts +34 -0
- package/modules/metering/src/services/database-repository.ts +574 -0
- package/modules/metering/src/services/index.ts +9 -0
- package/modules/metering/src/services/meter-registry.ts +145 -0
- package/modules/metering/src/services/metering-service.ts +441 -0
- package/modules/metering/src/services/migration.ts +183 -0
- package/modules/metering/src/services/notifications.ts +75 -0
- package/modules/metering/src/services/reports.ts +105 -0
- package/modules/metering/src/services/repository.ts +132 -0
- package/modules/metering/src/services/service-error.ts +46 -0
- package/modules/metering/src/settings.ts +47 -0
- package/modules/metering/translations/en.json +68 -0
- package/modules/metering/translations/pl.json +68 -0
- package/modules/notifications/migrations/0001_notifications_core.down.sql +1 -0
- package/modules/notifications/migrations/0001_notifications_core.up.sql +26 -0
- package/modules/notifications/migrations/0002_notifications_preferences.down.sql +1 -0
- package/modules/notifications/migrations/0002_notifications_preferences.up.sql +17 -0
- package/modules/notifications/migrations/0003_notifications_webhook_subscriptions.down.sql +1 -0
- package/modules/notifications/migrations/0003_notifications_webhook_subscriptions.up.sql +30 -0
- package/modules/notifications/migrations/0004_notifications_deliveries.down.sql +1 -0
- package/modules/notifications/migrations/0004_notifications_deliveries.up.sql +35 -0
- package/modules/notifications/migrations/0005_notifications_delivery_routing_role.down.sql +2 -0
- package/modules/notifications/migrations/0005_notifications_delivery_routing_role.up.sql +17 -0
- package/modules/notifications/migrations/0006_notifications_delivery_title.down.sql +1 -0
- package/modules/notifications/migrations/0006_notifications_delivery_title.up.sql +11 -0
- package/modules/notifications/migrations/0007_notifications_secret_rotation_inventory.down.sql +2 -0
- package/modules/notifications/migrations/0007_notifications_secret_rotation_inventory.up.sql +19 -0
- package/modules/notifications/migrations/0008_notifications_delivery_claim.down.sql +8 -0
- package/modules/notifications/migrations/0008_notifications_delivery_claim.up.sql +19 -0
- package/modules/notifications/migrations/0009_notifications_kind_approvals.down.sql +16 -0
- package/modules/notifications/migrations/0009_notifications_kind_approvals.up.sql +18 -0
- package/modules/notifications/migrations/0010_notifications_kind_meter_threshold.down.sql +16 -0
- package/modules/notifications/migrations/0010_notifications_kind_meter_threshold.up.sql +18 -0
- package/modules/notifications/migrations/0011_notifications_retention_keyset.down.sql +5 -0
- package/modules/notifications/migrations/0011_notifications_retention_keyset.up.sql +15 -0
- package/modules/notifications/migrations/0012_notifications_email_channel.down.sql +12 -0
- package/modules/notifications/migrations/0012_notifications_email_channel.up.sql +38 -0
- package/modules/notifications/migrations/0013_notifications_list_pages.down.sql +5 -0
- package/modules/notifications/migrations/0013_notifications_list_pages.up.sql +13 -0
- package/modules/notifications/migrations/README.md +3 -0
- package/modules/notifications/module.json +32 -0
- package/modules/notifications/package.json +49 -0
- package/modules/notifications/spec/module.yaml +718 -0
- package/modules/notifications/src/acl/permissions.ts +11 -0
- package/modules/notifications/src/api/endpoints.ts +814 -0
- package/modules/notifications/src/cli/commands.json +17 -0
- package/modules/notifications/src/cli/index.ts +126 -0
- package/modules/notifications/src/client/DeliveriesView.tsrx +483 -0
- package/modules/notifications/src/client/FactList.tsrx +24 -0
- package/modules/notifications/src/client/NotificationPreferencesView.tsrx +240 -0
- package/modules/notifications/src/client/NotificationsInboxView.tsrx +592 -0
- package/modules/notifications/src/client/UnreadCountWidget.tsrx +62 -0
- package/modules/notifications/src/client/WebhookForm.tsrx +297 -0
- package/modules/notifications/src/client/WebhooksView.tsrx +637 -0
- package/modules/notifications/src/client/api.ts +382 -0
- package/modules/notifications/src/client/contribution.tsrx +83 -0
- package/modules/notifications/src/client/inbox.ts +41 -0
- package/modules/notifications/src/client/index.ts +29 -0
- package/modules/notifications/src/client/navigation.ts +92 -0
- package/modules/notifications/src/client/notifications.css +70 -0
- package/modules/notifications/src/client/presentation.ts +81 -0
- package/modules/notifications/src/client/state.ts +246 -0
- package/modules/notifications/src/client/unread-count.ts +26 -0
- package/modules/notifications/src/domain/locale.ts +47 -0
- package/modules/notifications/src/domain/publish.ts +46 -0
- package/modules/notifications/src/domain/types.ts +186 -0
- package/modules/notifications/src/index.ts +62 -0
- package/modules/notifications/src/platform.ts +85 -0
- package/modules/notifications/src/server/index.ts +82 -0
- package/modules/notifications/src/server/runtime.ts +251 -0
- package/modules/notifications/src/services/data-classes.ts +139 -0
- package/modules/notifications/src/services/database-repository.ts +1334 -0
- package/modules/notifications/src/services/delivery-payload.ts +93 -0
- package/modules/notifications/src/services/delivery-runner.ts +170 -0
- package/modules/notifications/src/services/delivery-service.ts +811 -0
- package/modules/notifications/src/services/egress.ts +239 -0
- package/modules/notifications/src/services/email-channel.ts +93 -0
- package/modules/notifications/src/services/index.ts +23 -0
- package/modules/notifications/src/services/migration.ts +572 -0
- package/modules/notifications/src/services/notifications-service.ts +297 -0
- package/modules/notifications/src/services/paging.ts +60 -0
- package/modules/notifications/src/services/publish-service.ts +133 -0
- package/modules/notifications/src/services/repository.ts +342 -0
- package/modules/notifications/src/services/secret-rotation.ts +177 -0
- package/modules/notifications/src/services/secret-vault.ts +168 -0
- package/modules/notifications/src/services/service-error.ts +67 -0
- package/modules/notifications/src/services/signature.ts +81 -0
- package/modules/notifications/src/services/webhook-service.ts +307 -0
- package/modules/notifications/src/settings.ts +130 -0
- package/modules/notifications/translations/en.json +255 -0
- package/modules/notifications/translations/pl.json +255 -0
- package/modules/profile/module.json +3 -3
- package/modules/profile/package.json +1 -1
- package/modules/profile/spec/module.yaml +3 -3
- package/modules/profile/src/services/database-repository.ts +3 -13
- package/modules/reports/module.json +28 -0
- package/modules/reports/package.json +42 -0
- package/modules/reports/spec/module.yaml +231 -0
- package/modules/reports/src/acl/permissions.ts +5 -0
- package/modules/reports/src/api/endpoints.ts +72 -0
- package/modules/reports/src/client/ReportsSummaryWidget.tsrx +52 -0
- package/modules/reports/src/client/ReportsView.tsrx +246 -0
- package/modules/reports/src/client/api.ts +65 -0
- package/modules/reports/src/client/contribution.tsrx +36 -0
- package/modules/reports/src/client/index.ts +18 -0
- package/modules/reports/src/client/navigation.ts +39 -0
- package/modules/reports/src/client/presentation.ts +123 -0
- package/modules/reports/src/client/state.ts +28 -0
- package/modules/reports/src/domain/providers.ts +115 -0
- package/modules/reports/src/domain/types.ts +44 -0
- package/modules/reports/src/index.ts +47 -0
- package/modules/reports/src/platform.ts +37 -0
- package/modules/reports/src/server/index.ts +21 -0
- package/modules/reports/src/server/runtime.ts +40 -0
- package/modules/reports/src/services/index.ts +17 -0
- package/modules/reports/src/services/provider-registry.ts +144 -0
- package/modules/reports/src/services/range.ts +65 -0
- package/modules/reports/src/services/reports-service.ts +316 -0
- package/modules/reports/src/services/service-error.ts +26 -0
- package/modules/reports/src/settings.ts +49 -0
- package/modules/reports/translations/en.json +35 -0
- package/modules/reports/translations/pl.json +35 -0
- package/modules/sandbox/module.json +4 -4
- package/modules/sandbox/package.json +1 -1
- package/modules/sandbox/spec/module.yaml +3 -3
- package/modules/sandbox/src/services/database-repository.ts +14 -23
- package/modules/sandbox/src/services/directory.ts +16 -0
- package/modules/sandbox/src/services/sandbox-service.ts +13 -11
- package/modules/search/migrations/0001_search_core.down.sql +1 -0
- package/modules/search/migrations/0001_search_core.up.sql +22 -0
- package/modules/search/migrations/0002_search_recent_export.down.sql +3 -0
- package/modules/search/migrations/0002_search_recent_export.up.sql +5 -0
- package/modules/search/migrations/README.md +3 -0
- package/modules/search/module.json +28 -0
- package/modules/search/package.json +43 -0
- package/modules/search/spec/module.yaml +177 -0
- package/modules/search/src/acl/permissions.ts +5 -0
- package/modules/search/src/api/endpoints.ts +221 -0
- package/modules/search/src/client/SearchView.tsrx +346 -0
- package/modules/search/src/client/api.ts +157 -0
- package/modules/search/src/client/contribution.tsrx +31 -0
- package/modules/search/src/client/index.ts +17 -0
- package/modules/search/src/client/navigation.ts +97 -0
- package/modules/search/src/client/search.css +56 -0
- package/modules/search/src/client/state.ts +113 -0
- package/modules/search/src/domain/data-classes.ts +73 -0
- package/modules/search/src/domain/providers.ts +88 -0
- package/modules/search/src/domain/types.ts +56 -0
- package/modules/search/src/index.ts +46 -0
- package/modules/search/src/platform.ts +42 -0
- package/modules/search/src/server/index.ts +25 -0
- package/modules/search/src/server/runtime.ts +123 -0
- package/modules/search/src/services/database-repository.ts +163 -0
- package/modules/search/src/services/index.ts +21 -0
- package/modules/search/src/services/migration.ts +65 -0
- package/modules/search/src/services/provider-registry.ts +137 -0
- package/modules/search/src/services/repository.ts +43 -0
- package/modules/search/src/services/search-service.ts +442 -0
- package/modules/search/src/services/service-error.ts +35 -0
- package/modules/search/src/settings.ts +68 -0
- package/modules/search/translations/en.json +45 -0
- package/modules/search/translations/pl.json +45 -0
- package/modules/system/module.json +2 -2
- package/modules/system/package.json +1 -1
- package/modules/system/spec/module.yaml +30 -3
- package/modules/system/src/client/FlagsPanel.tsrx +127 -0
- package/modules/system/src/client/ModuleSettingRow.tsrx +17 -7
- package/modules/system/src/client/ModuleSettingsSection.tsrx +10 -71
- package/modules/system/src/client/ModulesView.tsrx +91 -65
- package/modules/system/src/client/flags.ts +35 -0
- package/modules/system/src/client/index.ts +8 -0
- package/modules/system/src/client/navigation.ts +8 -0
- package/modules/system/src/client/settings-state.ts +159 -0
- package/modules/system/src/client/state.ts +2 -0
- package/modules/system/src/domain/time-zone.ts +105 -0
- package/modules/system/src/index.ts +12 -0
- package/modules/system/src/platform.ts +5 -1
- package/modules/system/src/server/endpoints.ts +72 -21
- package/modules/system/src/settings.ts +28 -0
- package/modules/system/translations/en.json +17 -0
- package/modules/system/translations/pl.json +17 -0
- package/modules/users/module.json +30 -4
- package/modules/users/package.json +4 -1
- package/modules/users/spec/module.yaml +290 -7
- package/modules/users/src/api/endpoints.ts +228 -15
- package/modules/users/src/client/InviteMemberForm.tsrx +2 -2
- package/modules/users/src/client/MemberDrawer.tsrx +142 -26
- package/modules/users/src/client/UserAccountForm.tsrx +2 -2
- package/modules/users/src/client/UsersView.tsrx +432 -71
- package/modules/users/src/client/api.ts +106 -12
- package/modules/users/src/client/contribution.tsrx +5 -0
- package/modules/users/src/client/member-columns.tsrx +22 -9
- package/modules/users/src/client/state.ts +172 -7
- package/modules/users/src/domain/lists.ts +9 -0
- package/modules/users/src/index.ts +11 -0
- package/modules/users/src/platform.ts +50 -1
- package/modules/users/src/services/member-export.ts +51 -0
- package/modules/users/src/services/member-import.ts +249 -0
- package/modules/users/src/services/member-search.ts +145 -0
- package/modules/users/src/services/users-service.ts +117 -4
- package/modules/users/translations/en.json +57 -8
- package/modules/users/translations/pl.json +57 -8
- package/modules/workflows/migrations/0004_payload_rotation_inventory.up.sql +17 -0
- package/modules/workflows/migrations/0005_workflows_human_approval.up.sql +28 -0
- package/modules/workflows/migrations/0006_workflows_retention_indexes.up.sql +11 -0
- package/modules/workflows/migrations/0007_workflows_erasure_subject_indexes.up.sql +17 -0
- package/modules/workflows/migrations/0008_workflows_subject_account.up.sql +24 -0
- package/modules/workflows/migrations/0009_workflows_definition_list_indexes.up.sql +9 -0
- package/modules/workflows/module.json +34 -6
- package/modules/workflows/package.json +2 -1
- package/modules/workflows/spec/module.yaml +26 -9
- package/modules/workflows/src/api/endpoints.ts +131 -25
- package/modules/workflows/src/cli/commands.json +17 -0
- package/modules/workflows/src/cli/index.ts +114 -0
- package/modules/workflows/src/client/WorkflowExecutionHistory.tsrx +36 -27
- package/modules/workflows/src/client/WorkflowInspector.tsrx +116 -0
- package/modules/workflows/src/client/WorkflowNodePalette.tsrx +1 -0
- package/modules/workflows/src/client/WorkflowsView.tsrx +236 -99
- package/modules/workflows/src/client/api.ts +54 -34
- package/modules/workflows/src/client/canvas-model.ts +12 -0
- package/modules/workflows/src/client/state.ts +95 -0
- package/modules/workflows/src/domain/events.ts +25 -11
- package/modules/workflows/src/domain/graph.ts +135 -1
- package/modules/workflows/src/domain/types.ts +91 -4
- package/modules/workflows/src/platform.ts +12 -0
- package/modules/workflows/src/server/runtime.ts +78 -5
- package/modules/workflows/src/services/approvals.ts +62 -0
- package/modules/workflows/src/services/cursors.ts +37 -0
- package/modules/workflows/src/services/data-classes.ts +232 -0
- package/modules/workflows/src/services/database-repository.ts +660 -171
- package/modules/workflows/src/services/migration.ts +240 -0
- package/modules/workflows/src/services/notifications.ts +98 -0
- package/modules/workflows/src/services/payload-codec.ts +51 -28
- package/modules/workflows/src/services/payload-rotation.ts +171 -0
- package/modules/workflows/src/services/repository.ts +123 -8
- package/modules/workflows/src/services/simulation.ts +7 -0
- package/modules/workflows/src/services/worker.ts +446 -25
- package/modules/workflows/src/services/workflows-service.ts +264 -103
- package/modules/workflows/translations/en.json +12 -4
- package/modules/workflows/translations/pl.json +12 -4
- package/modules.json +48 -4
- package/package.json +64 -6
- package/packages/client/package.json +1 -0
- package/packages/client/src/ApplicationShell.tsrx +43 -0
- package/packages/client/src/contributions.ts +55 -0
- package/packages/client/src/i18n/locales/en.json +5 -0
- package/packages/client/src/i18n/locales/pl.json +5 -0
- package/packages/client/src/index.ts +13 -1
- package/packages/client/src/routing.ts +22 -0
- package/packages/client/src/shell/CommandPalette.tsrx +223 -11
- package/packages/client/src/shell/command-search.ts +126 -0
- package/packages/client/src/shell/command.ts +30 -0
- package/packages/client/src/shell/navigation.ts +12 -0
- package/packages/client/src/shell/palette-keys.ts +27 -0
- package/packages/client/src/shell/shell.css +7 -0
- package/packages/contracts/schemas/module-spec.schema.json +287 -1
- package/packages/contracts/schemas/module.schema.json +25 -0
- package/packages/contracts/src/index.ts +144 -1
- package/packages/database/src/backup.ts +180 -0
- package/packages/database/src/decoders.ts +25 -0
- package/packages/database/src/index.ts +17 -0
- package/packages/database/src/migrations.ts +7 -0
- package/packages/database/src/record-history.ts +5 -14
- package/packages/harness/src/index.ts +2 -0
- package/packages/harness/src/runtime.ts +378 -2
- package/packages/harness/src/tool-adapters.ts +20 -9
- package/packages/kernel/src/acl.ts +179 -0
- package/packages/kernel/src/approval-grant.ts +310 -0
- package/packages/kernel/src/capability-registry.ts +69 -2
- package/packages/kernel/src/data-class-registry.ts +354 -0
- package/packages/kernel/src/index.ts +85 -4
- package/packages/kernel/src/keyring.ts +208 -0
- package/packages/kernel/src/module-compatibility.ts +35 -4
- package/packages/kernel/src/module-registry.ts +49 -2
- package/packages/kernel/src/module-settings.ts +189 -27
- package/packages/server/package.json +2 -1
- package/packages/server/src/composition.ts +38 -0
- package/packages/server/src/endpoint.ts +104 -47
- package/packages/server/src/export/csv.ts +34 -0
- package/packages/server/src/export/definition.ts +346 -0
- package/packages/server/src/export/index.ts +61 -0
- package/packages/server/src/export/run.ts +116 -0
- package/packages/server/src/index.ts +155 -0
- package/packages/server/src/jobs/index.ts +93 -0
- package/packages/server/src/jobs/runner.ts +486 -0
- package/packages/server/src/log.ts +291 -0
- package/packages/server/src/mail/config.ts +184 -0
- package/packages/server/src/mail/contracts.ts +251 -0
- package/packages/server/src/mail/index.ts +31 -0
- package/packages/server/src/mail/port.ts +101 -0
- package/packages/server/src/mail/smtp.ts +191 -0
- package/packages/server/src/mail/template.ts +105 -0
- package/packages/server/src/metrics.ts +447 -0
- package/packages/server/src/pagination.ts +246 -0
- package/packages/server/src/trace/context.ts +103 -0
- package/packages/server/src/trace/egress.ts +66 -0
- package/packages/server/src/trace/error-sink.ts +296 -0
- package/packages/server/src/trace/exporter.ts +295 -0
- package/packages/server/src/trace/index.ts +60 -0
- package/packages/server/src/trace/job-sink.ts +172 -0
- package/packages/server/src/trace/tracer.ts +338 -0
- package/packages/server/src/web.ts +5 -1
- package/packages/storage/package.json +40 -0
- package/packages/storage/src/config.ts +189 -0
- package/packages/storage/src/content-type.ts +124 -0
- package/packages/storage/src/contracts.ts +112 -0
- package/packages/storage/src/envelope.ts +238 -0
- package/packages/storage/src/index.ts +49 -0
- package/packages/storage/src/local.ts +75 -0
- package/packages/storage/src/port.ts +262 -0
- package/packages/storage/src/read-token.ts +130 -0
- package/packages/storage/src/reseal.ts +128 -0
- package/packages/storage/src/s3.ts +144 -0
- package/packages/storage/src/scanner.ts +22 -0
- package/packages/storage/src/sigv4.ts +104 -0
- package/packages/storage/src/store.ts +13 -0
- package/packages/ui/package.json +1 -0
- package/packages/ui/src/components/Button.tsrx +3 -0
- package/packages/ui/src/components/ConfirmDialog.tsrx +13 -2
- package/packages/ui/src/components/DateField.tsrx +92 -0
- package/packages/ui/src/components/DatePicker.tsrx +525 -0
- package/packages/ui/src/components/DateRangeField.tsrx +93 -0
- package/packages/ui/src/components/Drawer.tsrx +10 -1
- package/packages/ui/src/components/FileUpload.tsrx +158 -0
- package/packages/ui/src/components/Pagination.tsrx +130 -0
- package/packages/ui/src/components/Select.tsrx +78 -0
- package/packages/ui/src/components/Table.tsrx +498 -81
- package/packages/ui/src/components/Tabs.tsrx +53 -0
- package/packages/ui/src/components/ToastHost.tsrx +48 -0
- package/packages/ui/src/components/calendar.ts +243 -0
- package/packages/ui/src/components/date-field.ts +62 -0
- package/packages/ui/src/components/file-upload.ts +49 -0
- package/packages/ui/src/components/focus-trap.ts +62 -0
- package/packages/ui/src/components/pagination.ts +68 -0
- package/packages/ui/src/components/table-sorting.ts +49 -0
- package/packages/ui/src/components/tabs.ts +61 -0
- package/packages/ui/src/components/toast-store.ts +116 -0
- package/packages/ui/src/icons/Icon.tsrx +5 -0
- package/packages/ui/src/index.ts +45 -0
- package/packages/ui/src/styles/components.css +598 -0
- package/modules/automations-workflows-integration/module.json +0 -27
- package/modules/automations-workflows-integration/spec/module.yaml +0 -93
- package/modules/automations-workflows-integration/src/index.ts +0 -14
- package/modules/automations-workflows-integration/src/platform.ts +0 -24
- package/modules/automations-workflows-integration/src/server/index.ts +0 -11
- package/modules/automations-workflows-integration/translations/en.json +0 -21
- package/modules/automations-workflows-integration/translations/pl.json +0 -21
- package/modules/workflows/src/services/cursor-codec.ts +0 -62
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ApprovalAuditEntry,
|
|
3
|
+
ApprovalDecision,
|
|
4
|
+
ApprovalListPage,
|
|
5
|
+
ApprovalRequest,
|
|
6
|
+
ApprovalRequestDetail,
|
|
7
|
+
ApprovalRouting,
|
|
8
|
+
ApprovalStatus,
|
|
9
|
+
TerminalApprovalStatus,
|
|
10
|
+
} from '../domain/types.ts';
|
|
11
|
+
|
|
12
|
+
export interface ApprovalRequestFilters {
|
|
13
|
+
readonly status?: ApprovalStatus | undefined;
|
|
14
|
+
readonly subjectModule?: string | undefined;
|
|
15
|
+
readonly subjectRef?: string | undefined;
|
|
16
|
+
readonly requesterAccountId?: string | undefined;
|
|
17
|
+
/** Requests whose eligibility snapshot names this account. */
|
|
18
|
+
readonly decidableBy?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CreateApprovalResult {
|
|
22
|
+
readonly request: ApprovalRequest;
|
|
23
|
+
/** False when a pending request for the same subject already existed. */
|
|
24
|
+
readonly created: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* One decision, written in a single tenant-scoped write transaction. `resolve`
|
|
29
|
+
* is pure and receives every decision recorded on the request including this
|
|
30
|
+
* one: the service owns when a request resolves, the adapter owns the
|
|
31
|
+
* transaction the count is taken in.
|
|
32
|
+
*/
|
|
33
|
+
export interface DecideApprovalInput {
|
|
34
|
+
readonly tenantId: string;
|
|
35
|
+
readonly requestId: string;
|
|
36
|
+
readonly decision: ApprovalDecision;
|
|
37
|
+
readonly resolve: (
|
|
38
|
+
decisions: readonly ApprovalDecision[],
|
|
39
|
+
) => TerminalApprovalStatus | null;
|
|
40
|
+
readonly resolvedAt: number;
|
|
41
|
+
/** Written in the same transaction when the request resolves; null writes nothing. */
|
|
42
|
+
readonly audit?: (request: ApprovalRequest) => ApprovalAuditEntry | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type DecideApprovalResult =
|
|
46
|
+
| {
|
|
47
|
+
readonly outcome: 'recorded';
|
|
48
|
+
readonly request: ApprovalRequest;
|
|
49
|
+
readonly decisions: readonly ApprovalDecision[];
|
|
50
|
+
readonly resolved: boolean;
|
|
51
|
+
}
|
|
52
|
+
/** The request left `pending` before this decision reached it. */
|
|
53
|
+
| { readonly outcome: 'not-pending'; readonly request: ApprovalRequest }
|
|
54
|
+
/** This account already approved or rejected this request. */
|
|
55
|
+
| { readonly outcome: 'duplicate'; readonly request: ApprovalRequest }
|
|
56
|
+
| { readonly outcome: 'not-found' };
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The persistence port. Async and database agnostic: the PostgreSQL statements,
|
|
60
|
+
* the tenant transactions and the background lease live in the adapter.
|
|
61
|
+
*/
|
|
62
|
+
export interface ApprovalsRepository {
|
|
63
|
+
/**
|
|
64
|
+
* Idempotent while a request for the same subject is pending: a repeat
|
|
65
|
+
* writes nothing and answers with the open request and `created: false`.
|
|
66
|
+
*/
|
|
67
|
+
create(
|
|
68
|
+
request: ApprovalRequest,
|
|
69
|
+
eligibleAccountIds: readonly string[],
|
|
70
|
+
): Promise<CreateApprovalResult>;
|
|
71
|
+
get(tenantId: string, id: string): Promise<ApprovalRequest | null>;
|
|
72
|
+
/**
|
|
73
|
+
* The one request still asking about this subject, read on the unique index
|
|
74
|
+
* that makes opening idempotent.
|
|
75
|
+
*/
|
|
76
|
+
findPendingBySubject(
|
|
77
|
+
tenantId: string,
|
|
78
|
+
subjectModule: string,
|
|
79
|
+
subjectRef: string,
|
|
80
|
+
): Promise<ApprovalRequest | null>;
|
|
81
|
+
detail(tenantId: string, id: string): Promise<ApprovalRequestDetail | null>;
|
|
82
|
+
/**
|
|
83
|
+
* The first `limit` matches, newest first, ties on createdAt broken by id
|
|
84
|
+
* descending. It answers the `approvals.requests.v1` capability; the inbox
|
|
85
|
+
* pages through `listPage`.
|
|
86
|
+
*/
|
|
87
|
+
list(
|
|
88
|
+
tenantId: string,
|
|
89
|
+
filters: ApprovalRequestFilters,
|
|
90
|
+
limit: number,
|
|
91
|
+
): Promise<readonly ApprovalRequest[]>;
|
|
92
|
+
/** One keyset page of the same order, in either direction. */
|
|
93
|
+
listPage(
|
|
94
|
+
tenantId: string,
|
|
95
|
+
filters: ApprovalRequestFilters,
|
|
96
|
+
page: ApprovalListPage,
|
|
97
|
+
): Promise<readonly ApprovalRequest[]>;
|
|
98
|
+
/** Whether the snapshot taken when the request opened names this account. */
|
|
99
|
+
isSnapshotDecider(
|
|
100
|
+
tenantId: string,
|
|
101
|
+
requestId: string,
|
|
102
|
+
accountId: string,
|
|
103
|
+
): Promise<boolean>;
|
|
104
|
+
/** Pending requests this account is in the eligibility snapshot of. */
|
|
105
|
+
countDecidable(tenantId: string, accountId: string): Promise<number>;
|
|
106
|
+
decide(input: DecideApprovalInput): Promise<DecideApprovalResult>;
|
|
107
|
+
/** The issuance ledger of one request, oldest first. */
|
|
108
|
+
listAudit(
|
|
109
|
+
tenantId: string,
|
|
110
|
+
requestId: string,
|
|
111
|
+
): Promise<readonly ApprovalAuditEntry[]>;
|
|
112
|
+
/** Cross-tenant, routing columns only, on the read-only background lease. */
|
|
113
|
+
listDueExpiries(
|
|
114
|
+
now: number,
|
|
115
|
+
limit: number,
|
|
116
|
+
): Promise<readonly ApprovalRouting[]>;
|
|
117
|
+
|
|
118
|
+
/* The operations behind the declared data class. Each runs on this module's
|
|
119
|
+
own lease, inside its own tenant-scoped transaction, in bounded batches. */
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Keyset page of the workspace's requests with their ledgers, ordered by id.
|
|
123
|
+
* `afterId` is the id of the last request the previous page carried.
|
|
124
|
+
*/
|
|
125
|
+
exportRequestsPage(
|
|
126
|
+
tenantId: string,
|
|
127
|
+
afterId: string | null,
|
|
128
|
+
limit: number,
|
|
129
|
+
): Promise<readonly ApprovalRequestDetail[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Removes at most `limit` requests resolved strictly before `before`, with
|
|
132
|
+
* their eligibility and decision rows. A pending request is never taken.
|
|
133
|
+
*/
|
|
134
|
+
deleteResolvedBefore(
|
|
135
|
+
tenantId: string,
|
|
136
|
+
before: number,
|
|
137
|
+
limit: number,
|
|
138
|
+
): Promise<number>;
|
|
139
|
+
/**
|
|
140
|
+
* Removes at most `limit` resolved requests this account opened, with their
|
|
141
|
+
* eligibility and decision rows.
|
|
142
|
+
*/
|
|
143
|
+
deleteResolvedRequestedBy(
|
|
144
|
+
tenantId: string,
|
|
145
|
+
accountId: string,
|
|
146
|
+
limit: number,
|
|
147
|
+
): Promise<number>;
|
|
148
|
+
/**
|
|
149
|
+
* Redacts at most `limit` decisions this account recorded, keeping the rows:
|
|
150
|
+
* the comment becomes a fixed marker and the account a per-row tombstone.
|
|
151
|
+
*/
|
|
152
|
+
redactDecisionsBy(
|
|
153
|
+
tenantId: string,
|
|
154
|
+
accountId: string,
|
|
155
|
+
limit: number,
|
|
156
|
+
): Promise<number>;
|
|
157
|
+
/**
|
|
158
|
+
* Redacts at most `limit` eligibility rows naming this account, in requests
|
|
159
|
+
* pending as well as resolved, keeping the rows so a snapshot goes on
|
|
160
|
+
* reporting how many people could answer. The other deciders are untouched.
|
|
161
|
+
*/
|
|
162
|
+
redactEligibilityOf(
|
|
163
|
+
tenantId: string,
|
|
164
|
+
accountId: string,
|
|
165
|
+
limit: number,
|
|
166
|
+
): Promise<number>;
|
|
167
|
+
/** Requests this account opened, in any state. */
|
|
168
|
+
countRequestedBy(tenantId: string, accountId: string): Promise<number>;
|
|
169
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export class ApprovalsServiceError extends Error {
|
|
2
|
+
constructor(
|
|
3
|
+
readonly code: string,
|
|
4
|
+
message: string,
|
|
5
|
+
readonly status = 400,
|
|
6
|
+
) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'ApprovalsServiceError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function bounded(
|
|
13
|
+
value: string,
|
|
14
|
+
field: string,
|
|
15
|
+
minimum: number,
|
|
16
|
+
maximum: number,
|
|
17
|
+
): string {
|
|
18
|
+
const normalized = value.trim();
|
|
19
|
+
if (normalized.length < minimum || normalized.length > maximum) {
|
|
20
|
+
throw new ApprovalsServiceError(
|
|
21
|
+
'INVALID_INPUT',
|
|
22
|
+
`${field} must contain between ${minimum} and ${maximum} characters.`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
if (normalized.includes('\u0000')) {
|
|
26
|
+
throw new ApprovalsServiceError(
|
|
27
|
+
'INVALID_INPUT',
|
|
28
|
+
`${field} contains an unsupported character.`,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
return normalized;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function optionalBounded(
|
|
35
|
+
value: string | null | undefined,
|
|
36
|
+
field: string,
|
|
37
|
+
maximum: number,
|
|
38
|
+
): string | null {
|
|
39
|
+
if (value === undefined || value === null || value.trim() === '') return null;
|
|
40
|
+
return bounded(value, field, 1, maximum);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function boundedInteger(
|
|
44
|
+
value: number,
|
|
45
|
+
field: string,
|
|
46
|
+
minimum: number,
|
|
47
|
+
maximum: number,
|
|
48
|
+
): number {
|
|
49
|
+
if (!Number.isSafeInteger(value) || value < minimum || value > maximum) {
|
|
50
|
+
throw new ApprovalsServiceError(
|
|
51
|
+
'INVALID_INPUT',
|
|
52
|
+
`${field} must be an integer between ${minimum} and ${maximum}.`,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function oneOf<T extends string>(
|
|
59
|
+
value: string,
|
|
60
|
+
field: string,
|
|
61
|
+
allowed: readonly T[],
|
|
62
|
+
): T {
|
|
63
|
+
if (!(allowed as readonly string[]).includes(value)) {
|
|
64
|
+
throw new ApprovalsServiceError(
|
|
65
|
+
'INVALID_INPUT',
|
|
66
|
+
`${field} must be one of: ${allowed.join(', ')}.`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return value as T;
|
|
70
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineModuleSettings,
|
|
3
|
+
ModuleSettingsError,
|
|
4
|
+
PLATFORM_SETTINGS_TENANT,
|
|
5
|
+
type ModuleSettingsRuntime,
|
|
6
|
+
} from '@flowdular/sdk/kernel';
|
|
7
|
+
|
|
8
|
+
export const APPROVALS_MODULE_ID = 'approvals.core';
|
|
9
|
+
|
|
10
|
+
export const APPROVALS_MODULE_SETTINGS = defineModuleSettings({
|
|
11
|
+
moduleId: APPROVALS_MODULE_ID,
|
|
12
|
+
settings: {
|
|
13
|
+
defaultExpiryDays: {
|
|
14
|
+
type: 'number',
|
|
15
|
+
defaultValue: 7,
|
|
16
|
+
min: 1,
|
|
17
|
+
max: 90,
|
|
18
|
+
visibility: 'shared',
|
|
19
|
+
client: false,
|
|
20
|
+
scope: 'tenant',
|
|
21
|
+
labelKey: 'approvals.settings.defaultExpiryDays.label',
|
|
22
|
+
label: 'Default expiry (days)',
|
|
23
|
+
descriptionKey: 'approvals.settings.defaultExpiryDays.description',
|
|
24
|
+
description:
|
|
25
|
+
'Days a request stays open when the requirement names no expiry of its own.',
|
|
26
|
+
},
|
|
27
|
+
expiryIntervalMinutes: {
|
|
28
|
+
type: 'number',
|
|
29
|
+
defaultValue: 15,
|
|
30
|
+
min: 1,
|
|
31
|
+
max: 1_440,
|
|
32
|
+
visibility: 'private',
|
|
33
|
+
client: false,
|
|
34
|
+
scope: 'platform',
|
|
35
|
+
labelKey: 'approvals.settings.expiryIntervalMinutes.label',
|
|
36
|
+
label: 'Expiry loop interval (minutes)',
|
|
37
|
+
descriptionKey: 'approvals.settings.expiryIntervalMinutes.description',
|
|
38
|
+
description:
|
|
39
|
+
'How often the expiry loop looks for due requests. Applied when the approvals runtime starts.',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const DEFAULTS = APPROVALS_MODULE_SETTINGS.settings;
|
|
45
|
+
|
|
46
|
+
/* A setting read must never take a running loop down, so every accessor falls
|
|
47
|
+
back to the declared default when the runtime has not registered it yet. A
|
|
48
|
+
workspace nobody primed is a caller defect and stays loud: the accessors
|
|
49
|
+
below prime before they read. */
|
|
50
|
+
function value(
|
|
51
|
+
settings: ModuleSettingsRuntime,
|
|
52
|
+
tenantId: string,
|
|
53
|
+
key: keyof typeof DEFAULTS,
|
|
54
|
+
fallback: number,
|
|
55
|
+
): number {
|
|
56
|
+
try {
|
|
57
|
+
return settings.get<number>(tenantId, APPROVALS_MODULE_ID, key);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (
|
|
60
|
+
error instanceof ModuleSettingsError &&
|
|
61
|
+
error.code === 'SETTINGS_NOT_PRIMED'
|
|
62
|
+
) {
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
return fallback;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function approvalsDefaultExpiryDays(
|
|
70
|
+
settings: ModuleSettingsRuntime,
|
|
71
|
+
tenantId: string,
|
|
72
|
+
): number {
|
|
73
|
+
return value(settings, tenantId, 'defaultExpiryDays', 7);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function approvalsExpiryIntervalMs(
|
|
77
|
+
settings: ModuleSettingsRuntime,
|
|
78
|
+
): number {
|
|
79
|
+
return (
|
|
80
|
+
value(settings, PLATFORM_SETTINGS_TENANT, 'expiryIntervalMinutes', 15) *
|
|
81
|
+
60 *
|
|
82
|
+
1_000
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* The open capability and the expiry loop run in the background, where no
|
|
87
|
+
request middleware primed the workspace; prime is idempotent and memoised,
|
|
88
|
+
so a primed tenant costs one lookup. */
|
|
89
|
+
export async function approvalsPrimedDefaultExpiryDays(
|
|
90
|
+
settings: ModuleSettingsRuntime,
|
|
91
|
+
tenantId: string,
|
|
92
|
+
): Promise<number> {
|
|
93
|
+
await settings.prime(tenantId);
|
|
94
|
+
return approvalsDefaultExpiryDays(settings, tenantId);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function approvalsPrimedExpiryIntervalMs(
|
|
98
|
+
settings: ModuleSettingsRuntime,
|
|
99
|
+
): Promise<number> {
|
|
100
|
+
await settings.prime(PLATFORM_SETTINGS_TENANT);
|
|
101
|
+
return approvalsExpiryIntervalMs(settings);
|
|
102
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"module.name": "Approvals",
|
|
3
|
+
"common.workspace": "Workspace",
|
|
4
|
+
"common.refresh": "Refresh",
|
|
5
|
+
"common.refreshing": "Refreshing…",
|
|
6
|
+
"common.filters": "Filters",
|
|
7
|
+
"common.accessDenied": "Access denied",
|
|
8
|
+
"common.notYet": "Not yet",
|
|
9
|
+
"common.messages": "Messages",
|
|
10
|
+
"common.close": "Close",
|
|
11
|
+
"navigation.inbox": "Approvals",
|
|
12
|
+
"navigation.inboxDescription": "Requests you opened and requests you may decide.",
|
|
13
|
+
"widget.label": "Approvals waiting for you",
|
|
14
|
+
"widget.note": "Pending requests you may decide.",
|
|
15
|
+
"widget.link": "Open approvals",
|
|
16
|
+
"pagination.label": "Pages",
|
|
17
|
+
"pagination.previous": "Previous",
|
|
18
|
+
"pagination.next": "Next",
|
|
19
|
+
"pagination.size": "Rows per page",
|
|
20
|
+
"pagination.summary": "Page {page} · from row {from}",
|
|
21
|
+
"inbox.title": "Approvals",
|
|
22
|
+
"inbox.description": "Requests waiting for a decision in this workspace.",
|
|
23
|
+
"inbox.table.title": "Requests",
|
|
24
|
+
"inbox.table.count": "{count} requests",
|
|
25
|
+
"inbox.table.caption": "Approval requests",
|
|
26
|
+
"inbox.table.loading": "Loading requests…",
|
|
27
|
+
"inbox.empty.title": "Nothing is waiting",
|
|
28
|
+
"inbox.empty.hint": "A module opens a request here when an action needs a person to agree to it.",
|
|
29
|
+
"inbox.emptyFiltered.title": "No request matches",
|
|
30
|
+
"inbox.emptyFiltered.hint": "Change the selection or the status to widen the list.",
|
|
31
|
+
"inbox.note": "You see the requests you opened and the requests you may decide.",
|
|
32
|
+
"inbox.error.title": "The requests could not be loaded",
|
|
33
|
+
"inbox.error.hint": "The server did not answer. Refresh to try again.",
|
|
34
|
+
"inbox.denied": "You need the approvals read permission to open this screen.",
|
|
35
|
+
"column.status": "Status",
|
|
36
|
+
"column.title": "Request",
|
|
37
|
+
"column.subjectModule": "Source module",
|
|
38
|
+
"column.action": "Action",
|
|
39
|
+
"column.requester": "Requested by",
|
|
40
|
+
"column.createdAt": "Created",
|
|
41
|
+
"column.expiresAt": "Expires",
|
|
42
|
+
"selection.label": "Select all requests on screen",
|
|
43
|
+
"selection.rowLabel": "Select {title}",
|
|
44
|
+
"selection.clear": "Clear selection",
|
|
45
|
+
"selection.summary": "{count} selected",
|
|
46
|
+
"filter.scope": "Show",
|
|
47
|
+
"filter.scopeDecidable": "Waiting for me",
|
|
48
|
+
"filter.scopeMine": "Opened by me",
|
|
49
|
+
"filter.scopeAll": "Every request",
|
|
50
|
+
"filter.status": "Status",
|
|
51
|
+
"filter.allStatuses": "All statuses",
|
|
52
|
+
"status.pending": "Pending",
|
|
53
|
+
"status.approved": "Approved",
|
|
54
|
+
"status.rejected": "Rejected",
|
|
55
|
+
"status.expired": "Expired",
|
|
56
|
+
"status.cancelled": "Cancelled",
|
|
57
|
+
"decision.approve": "Approved",
|
|
58
|
+
"decision.reject": "Rejected",
|
|
59
|
+
"decision.expire": "Expired",
|
|
60
|
+
"decision.cancel": "Cancelled",
|
|
61
|
+
"request.title": "Approval request",
|
|
62
|
+
"request.noSummary": "This request carries no further detail.",
|
|
63
|
+
"request.subjectRef": "Source reference",
|
|
64
|
+
"request.permission": "Permission",
|
|
65
|
+
"request.requirement": "Requirement",
|
|
66
|
+
"request.decisionsNeeded": "Approvals needed",
|
|
67
|
+
"request.resolvedAt": "Resolved",
|
|
68
|
+
"request.ledger": "Decisions",
|
|
69
|
+
"request.ledgerEmpty": "Nobody has decided yet.",
|
|
70
|
+
"request.byTheLoop": "expiry loop",
|
|
71
|
+
"request.comment": "Comment (optional)",
|
|
72
|
+
"requirement.summary": "{who}, {decisions} approvals, {days} days",
|
|
73
|
+
"requirement.role": "role {role}",
|
|
74
|
+
"requirement.scope": "permission {scope}",
|
|
75
|
+
"requirement.roleAndScope": "role {role} with {scope}",
|
|
76
|
+
"action.approve": "Approve",
|
|
77
|
+
"action.reject": "Reject",
|
|
78
|
+
"action.cancel": "Cancel request",
|
|
79
|
+
"action.approveSelected": "Approve selected",
|
|
80
|
+
"action.rejectSelected": "Reject selected",
|
|
81
|
+
"action.selectedRefused": "Select at least one pending request.",
|
|
82
|
+
"decideMany.approveTitle": "Approve the selected requests?",
|
|
83
|
+
"decideMany.rejectTitle": "Reject the selected requests?",
|
|
84
|
+
"decideMany.description": "{count} requests are decided one by one, each checked against your eligibility, and every decision is recorded with the comment below.",
|
|
85
|
+
"notice.decidedMany": "Decided {decided}, missing {missing}, refused {refused}.",
|
|
86
|
+
"error.request": "The request failed.",
|
|
87
|
+
"error.load": "Could not load the approval requests.",
|
|
88
|
+
"error.decide": "Could not record your decision.",
|
|
89
|
+
"error.decideMany": "Could not record your decisions.",
|
|
90
|
+
"error.code.APPROVAL_NOT_FOUND": "This request no longer exists.",
|
|
91
|
+
"error.code.APPROVAL_NOT_PENDING": "This request was already decided.",
|
|
92
|
+
"error.code.APPROVAL_ALREADY_DECIDED": "You already decided this request.",
|
|
93
|
+
"error.code.APPROVAL_NOT_ELIGIBLE": "You may not decide this request.",
|
|
94
|
+
"error.code.APPROVAL_NOT_CANCELLABLE": "Only the requester or a member who may manage requests can cancel it.",
|
|
95
|
+
"error.code.APPROVAL_NO_ELIGIBLE_DECIDER": "No member of this workspace can decide this request.",
|
|
96
|
+
"error.code.APPROVAL_ELIGIBLE_INSUFFICIENT": "Fewer members can decide than the request needs approvals.",
|
|
97
|
+
"error.code.APPROVAL_ELIGIBLE_TOO_MANY": "The requirement names too many deciders.",
|
|
98
|
+
"error.code.APPROVAL_REQUIREMENT_INVALID": "The requirement names neither a role nor a permission.",
|
|
99
|
+
"error.code.FORBIDDEN": "You need the manage permission to read every request.",
|
|
100
|
+
"settings.defaultExpiryDays.label": "Default expiry (days)",
|
|
101
|
+
"settings.defaultExpiryDays.description": "Days a request stays open when the requirement names no expiry of its own.",
|
|
102
|
+
"settings.expiryIntervalMinutes.label": "Expiry loop interval (minutes)",
|
|
103
|
+
"settings.expiryIntervalMinutes.description": "How often the expiry loop looks for due requests. Applied when the approvals runtime starts."
|
|
104
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"module.name": "Akceptacje",
|
|
3
|
+
"common.workspace": "Obszar roboczy",
|
|
4
|
+
"common.refresh": "Odśwież",
|
|
5
|
+
"common.refreshing": "Odświeżanie…",
|
|
6
|
+
"common.filters": "Filtry",
|
|
7
|
+
"common.accessDenied": "Brak dostępu",
|
|
8
|
+
"common.notYet": "Jeszcze nie",
|
|
9
|
+
"common.messages": "Komunikaty",
|
|
10
|
+
"common.close": "Zamknij",
|
|
11
|
+
"navigation.inbox": "Akceptacje",
|
|
12
|
+
"navigation.inboxDescription": "Wnioski, które zgłosiłeś, i wnioski, o których możesz zdecydować.",
|
|
13
|
+
"widget.label": "Akceptacje czekające na Ciebie",
|
|
14
|
+
"widget.note": "Otwarte wnioski, o których możesz zdecydować.",
|
|
15
|
+
"widget.link": "Otwórz akceptacje",
|
|
16
|
+
"pagination.label": "Strony",
|
|
17
|
+
"pagination.previous": "Poprzednia",
|
|
18
|
+
"pagination.next": "Następna",
|
|
19
|
+
"pagination.size": "Wierszy na stronę",
|
|
20
|
+
"pagination.summary": "Strona {page} · od wiersza {from}",
|
|
21
|
+
"inbox.title": "Akceptacje",
|
|
22
|
+
"inbox.description": "Wnioski czekające na decyzję w tym obszarze roboczym.",
|
|
23
|
+
"inbox.table.title": "Wnioski",
|
|
24
|
+
"inbox.table.count": "{count} wniosków",
|
|
25
|
+
"inbox.table.caption": "Wnioski o akceptację",
|
|
26
|
+
"inbox.table.loading": "Wczytywanie wniosków…",
|
|
27
|
+
"inbox.empty.title": "Nic nie czeka",
|
|
28
|
+
"inbox.empty.hint": "Moduł otwiera tu wniosek, gdy działanie wymaga zgody człowieka.",
|
|
29
|
+
"inbox.emptyFiltered.title": "Żaden wniosek nie pasuje",
|
|
30
|
+
"inbox.emptyFiltered.hint": "Zmień zakres lub status, aby poszerzyć listę.",
|
|
31
|
+
"inbox.note": "Widzisz wnioski, które zgłosiłeś, oraz te, o których możesz zdecydować.",
|
|
32
|
+
"inbox.error.title": "Nie udało się wczytać wniosków",
|
|
33
|
+
"inbox.error.hint": "Serwer nie odpowiedział. Odśwież, aby spróbować ponownie.",
|
|
34
|
+
"inbox.denied": "Potrzebujesz uprawnienia do odczytu akceptacji, aby otworzyć ten ekran.",
|
|
35
|
+
"column.status": "Status",
|
|
36
|
+
"column.title": "Wniosek",
|
|
37
|
+
"column.subjectModule": "Moduł źródłowy",
|
|
38
|
+
"column.action": "Działanie",
|
|
39
|
+
"column.requester": "Zgłosił",
|
|
40
|
+
"column.createdAt": "Utworzono",
|
|
41
|
+
"column.expiresAt": "Wygasa",
|
|
42
|
+
"selection.label": "Zaznacz wszystkie wnioski na ekranie",
|
|
43
|
+
"selection.rowLabel": "Zaznacz {title}",
|
|
44
|
+
"selection.clear": "Wyczyść zaznaczenie",
|
|
45
|
+
"selection.summary": "Zaznaczono: {count}",
|
|
46
|
+
"filter.scope": "Pokaż",
|
|
47
|
+
"filter.scopeDecidable": "Czekające na mnie",
|
|
48
|
+
"filter.scopeMine": "Zgłoszone przeze mnie",
|
|
49
|
+
"filter.scopeAll": "Wszystkie wnioski",
|
|
50
|
+
"filter.status": "Status",
|
|
51
|
+
"filter.allStatuses": "Wszystkie statusy",
|
|
52
|
+
"status.pending": "Oczekuje",
|
|
53
|
+
"status.approved": "Zaakceptowany",
|
|
54
|
+
"status.rejected": "Odrzucony",
|
|
55
|
+
"status.expired": "Wygasł",
|
|
56
|
+
"status.cancelled": "Anulowany",
|
|
57
|
+
"decision.approve": "Zaakceptowano",
|
|
58
|
+
"decision.reject": "Odrzucono",
|
|
59
|
+
"decision.expire": "Wygasło",
|
|
60
|
+
"decision.cancel": "Anulowano",
|
|
61
|
+
"request.title": "Wniosek o akceptację",
|
|
62
|
+
"request.noSummary": "Ten wniosek nie zawiera dodatkowych szczegółów.",
|
|
63
|
+
"request.subjectRef": "Odniesienie źródłowe",
|
|
64
|
+
"request.permission": "Uprawnienie",
|
|
65
|
+
"request.requirement": "Wymaganie",
|
|
66
|
+
"request.decisionsNeeded": "Wymagane akceptacje",
|
|
67
|
+
"request.resolvedAt": "Rozstrzygnięto",
|
|
68
|
+
"request.ledger": "Decyzje",
|
|
69
|
+
"request.ledgerEmpty": "Nikt jeszcze nie zdecydował.",
|
|
70
|
+
"request.byTheLoop": "pętla wygasania",
|
|
71
|
+
"request.comment": "Komentarz (opcjonalnie)",
|
|
72
|
+
"requirement.summary": "{who}, akceptacje: {decisions}, dni: {days}",
|
|
73
|
+
"requirement.role": "rola {role}",
|
|
74
|
+
"requirement.scope": "uprawnienie {scope}",
|
|
75
|
+
"requirement.roleAndScope": "rola {role} z {scope}",
|
|
76
|
+
"action.approve": "Zaakceptuj",
|
|
77
|
+
"action.reject": "Odrzuć",
|
|
78
|
+
"action.cancel": "Anuluj wniosek",
|
|
79
|
+
"action.approveSelected": "Zatwierdź zaznaczone",
|
|
80
|
+
"action.rejectSelected": "Odrzuć zaznaczone",
|
|
81
|
+
"action.selectedRefused": "Zaznacz co najmniej jeden oczekujący wniosek.",
|
|
82
|
+
"decideMany.approveTitle": "Zatwierdzić zaznaczone wnioski?",
|
|
83
|
+
"decideMany.rejectTitle": "Odrzucić zaznaczone wnioski?",
|
|
84
|
+
"decideMany.description": "Wnioski ({count}) zostaną rozstrzygnięte po kolei, każdy po sprawdzeniu Twoich uprawnień, a każda decyzja zostanie zapisana z poniższym komentarzem.",
|
|
85
|
+
"notice.decidedMany": "Rozstrzygnięto: {decided}, brakujące: {missing}, odrzucone: {refused}.",
|
|
86
|
+
"error.request": "Żądanie nie powiodło się.",
|
|
87
|
+
"error.load": "Nie udało się wczytać wniosków o akceptację.",
|
|
88
|
+
"error.decide": "Nie udało się zapisać Twojej decyzji.",
|
|
89
|
+
"error.decideMany": "Nie udało się zapisać decyzji.",
|
|
90
|
+
"error.code.APPROVAL_NOT_FOUND": "Ten wniosek już nie istnieje.",
|
|
91
|
+
"error.code.APPROVAL_NOT_PENDING": "Ten wniosek został już rozstrzygnięty.",
|
|
92
|
+
"error.code.APPROVAL_ALREADY_DECIDED": "Już zdecydowałeś o tym wniosku.",
|
|
93
|
+
"error.code.APPROVAL_NOT_ELIGIBLE": "Nie możesz zdecydować o tym wniosku.",
|
|
94
|
+
"error.code.APPROVAL_NOT_CANCELLABLE": "Anulować może tylko zgłaszający lub osoba zarządzająca wnioskami.",
|
|
95
|
+
"error.code.APPROVAL_NO_ELIGIBLE_DECIDER": "Żaden członek tego obszaru roboczego nie może zdecydować o tym wniosku.",
|
|
96
|
+
"error.code.APPROVAL_ELIGIBLE_INSUFFICIENT": "Mniej osób może zdecydować, niż wniosek wymaga akceptacji.",
|
|
97
|
+
"error.code.APPROVAL_ELIGIBLE_TOO_MANY": "Wymaganie wskazuje zbyt wiele osób decydujących.",
|
|
98
|
+
"error.code.APPROVAL_REQUIREMENT_INVALID": "Wymaganie nie wskazuje ani roli, ani uprawnienia.",
|
|
99
|
+
"error.code.FORBIDDEN": "Potrzebujesz uprawnienia do zarządzania, aby czytać wszystkie wnioski.",
|
|
100
|
+
"settings.defaultExpiryDays.label": "Domyślne wygaśnięcie (dni)",
|
|
101
|
+
"settings.defaultExpiryDays.description": "Liczba dni, przez które wniosek pozostaje otwarty, gdy wymaganie nie określa własnego terminu.",
|
|
102
|
+
"settings.expiryIntervalMinutes.label": "Interwał pętli wygasania (minuty)",
|
|
103
|
+
"settings.expiryIntervalMinutes.description": "Jak często pętla wygasania szuka wniosków po terminie. Stosowane przy starcie modułu akceptacji."
|
|
104
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
DROP POLICY IF EXISTS audit_events_tenant_policy ON audit_events;
|
|
2
|
+
DROP POLICY IF EXISTS audit_export_runs_tenant_policy ON audit_export_runs;
|
|
3
|
+
DROP POLICY IF EXISTS audit_sweep_runs_tenant_policy ON audit_sweep_runs;
|
|
4
|
+
DROP POLICY IF EXISTS audit_data_classes_tenant_policy ON audit_data_classes;
|
|
5
|
+
DROP TABLE IF EXISTS audit_events;
|
|
6
|
+
DROP TABLE IF EXISTS audit_export_runs;
|
|
7
|
+
DROP TABLE IF EXISTS audit_sweep_runs;
|
|
8
|
+
DROP TABLE IF EXISTS audit_data_classes;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
-- One row per workspace and declared class, materialised from the registry the
|
|
2
|
+
-- first time the workspace reads it and refreshed on every read afterwards. The
|
|
3
|
+
-- registry stays the truth about what a class is; this row carries only what
|
|
4
|
+
-- the workspace owns: its period and when the sweep last ran.
|
|
5
|
+
--
|
|
6
|
+
-- retention_mode separates the two absent states the period has: 'default'
|
|
7
|
+
-- follows the declaring module, 'none' keeps the rows until a person deletes
|
|
8
|
+
-- them, and 'days' is the workspace's own number. A single nullable integer
|
|
9
|
+
-- could not tell the first two apart.
|
|
10
|
+
CREATE TABLE IF NOT EXISTS audit_data_classes (
|
|
11
|
+
id TEXT PRIMARY KEY,
|
|
12
|
+
tenant_id TEXT NOT NULL,
|
|
13
|
+
class_id TEXT NOT NULL,
|
|
14
|
+
module_id TEXT NOT NULL,
|
|
15
|
+
label TEXT NOT NULL,
|
|
16
|
+
exportable SMALLINT NOT NULL CHECK (exportable IN (0, 1)),
|
|
17
|
+
sweepable SMALLINT NOT NULL CHECK (sweepable IN (0, 1)),
|
|
18
|
+
default_retention_days BIGINT,
|
|
19
|
+
retention_mode TEXT NOT NULL CHECK (retention_mode IN ('default', 'days', 'none')),
|
|
20
|
+
retention_days BIGINT CHECK (retention_days IS NULL OR retention_days > 0),
|
|
21
|
+
last_swept_at BIGINT,
|
|
22
|
+
created_at BIGINT NOT NULL,
|
|
23
|
+
updated_at BIGINT NOT NULL,
|
|
24
|
+
CHECK ((retention_mode = 'days') = (retention_days IS NOT NULL))
|
|
25
|
+
);
|
|
26
|
+
CREATE UNIQUE INDEX IF NOT EXISTS audit_data_classes_tenant_class_idx
|
|
27
|
+
ON audit_data_classes (tenant_id, class_id);
|
|
28
|
+
-- The sweep walks this index across tenants on the routing role. Ordering by
|
|
29
|
+
-- last_swept_at first makes the walk start at the classes waiting longest.
|
|
30
|
+
CREATE INDEX IF NOT EXISTS audit_data_classes_due_idx
|
|
31
|
+
ON audit_data_classes (sweepable, last_swept_at, tenant_id, class_id);
|
|
32
|
+
ALTER TABLE audit_data_classes ENABLE ROW LEVEL SECURITY;
|
|
33
|
+
ALTER TABLE audit_data_classes FORCE ROW LEVEL SECURITY;
|
|
34
|
+
CREATE POLICY audit_data_classes_tenant_policy ON audit_data_classes
|
|
35
|
+
USING (tenant_id = current_setting('coreloom.tenant_id', true))
|
|
36
|
+
WITH CHECK (tenant_id = current_setting('coreloom.tenant_id', true));
|
|
37
|
+
|
|
38
|
+
CREATE TABLE IF NOT EXISTS audit_sweep_runs (
|
|
39
|
+
id TEXT PRIMARY KEY,
|
|
40
|
+
tenant_id TEXT NOT NULL,
|
|
41
|
+
class_id TEXT NOT NULL,
|
|
42
|
+
cutoff BIGINT NOT NULL,
|
|
43
|
+
removed BIGINT NOT NULL CHECK (removed >= 0),
|
|
44
|
+
status TEXT NOT NULL CHECK (status IN ('completed', 'partial', 'refused')),
|
|
45
|
+
reason TEXT,
|
|
46
|
+
occurred_at BIGINT NOT NULL
|
|
47
|
+
);
|
|
48
|
+
CREATE INDEX IF NOT EXISTS audit_sweep_runs_tenant_time_idx
|
|
49
|
+
ON audit_sweep_runs (tenant_id, occurred_at DESC, id);
|
|
50
|
+
-- A refusal stands until it is answered, so the loop asks for the newest run of
|
|
51
|
+
-- one class instead of appending the same refusal every interval.
|
|
52
|
+
CREATE INDEX IF NOT EXISTS audit_sweep_runs_tenant_class_time_idx
|
|
53
|
+
ON audit_sweep_runs (tenant_id, class_id, occurred_at DESC, id);
|
|
54
|
+
ALTER TABLE audit_sweep_runs ENABLE ROW LEVEL SECURITY;
|
|
55
|
+
ALTER TABLE audit_sweep_runs FORCE ROW LEVEL SECURITY;
|
|
56
|
+
CREATE POLICY audit_sweep_runs_tenant_policy ON audit_sweep_runs
|
|
57
|
+
USING (tenant_id = current_setting('coreloom.tenant_id', true))
|
|
58
|
+
WITH CHECK (tenant_id = current_setting('coreloom.tenant_id', true));
|
|
59
|
+
|
|
60
|
+
-- row_count rather than "rows": ROWS is a PostgreSQL keyword and an unquoted
|
|
61
|
+
-- column of that name would have to be quoted at every use site.
|
|
62
|
+
CREATE TABLE IF NOT EXISTS audit_export_runs (
|
|
63
|
+
id TEXT PRIMARY KEY,
|
|
64
|
+
tenant_id TEXT NOT NULL,
|
|
65
|
+
format_version TEXT NOT NULL,
|
|
66
|
+
status TEXT NOT NULL CHECK (status IN ('started', 'completed', 'failed')),
|
|
67
|
+
classes BIGINT NOT NULL CHECK (classes >= 0),
|
|
68
|
+
row_count BIGINT NOT NULL CHECK (row_count >= 0),
|
|
69
|
+
archive_digest TEXT,
|
|
70
|
+
requested_by TEXT NOT NULL,
|
|
71
|
+
started_at BIGINT NOT NULL,
|
|
72
|
+
completed_at BIGINT
|
|
73
|
+
);
|
|
74
|
+
CREATE INDEX IF NOT EXISTS audit_export_runs_tenant_time_idx
|
|
75
|
+
ON audit_export_runs (tenant_id, started_at DESC, id);
|
|
76
|
+
ALTER TABLE audit_export_runs ENABLE ROW LEVEL SECURITY;
|
|
77
|
+
ALTER TABLE audit_export_runs FORCE ROW LEVEL SECURITY;
|
|
78
|
+
CREATE POLICY audit_export_runs_tenant_policy ON audit_export_runs
|
|
79
|
+
USING (tenant_id = current_setting('coreloom.tenant_id', true))
|
|
80
|
+
WITH CHECK (tenant_id = current_setting('coreloom.tenant_id', true));
|
|
81
|
+
|
|
82
|
+
-- auth.core keeps its trail private to its own service, and it registers no
|
|
83
|
+
-- public capability, so a module cannot append to it. This is audit.core's own
|
|
84
|
+
-- tamper-evident trail: one chain per workspace, each event sealing the hash of
|
|
85
|
+
-- the one before it, so a removed or edited row breaks every hash after it.
|
|
86
|
+
CREATE TABLE IF NOT EXISTS audit_events (
|
|
87
|
+
id TEXT PRIMARY KEY,
|
|
88
|
+
tenant_id TEXT NOT NULL,
|
|
89
|
+
sequence BIGINT NOT NULL CHECK (sequence > 0),
|
|
90
|
+
actor_id TEXT NOT NULL,
|
|
91
|
+
action TEXT NOT NULL,
|
|
92
|
+
subject_type TEXT NOT NULL CHECK (subject_type IN ('data-class', 'sweep-run', 'export-run')),
|
|
93
|
+
subject_id TEXT NOT NULL,
|
|
94
|
+
metadata_json TEXT NOT NULL,
|
|
95
|
+
occurred_at BIGINT NOT NULL,
|
|
96
|
+
previous_hash TEXT,
|
|
97
|
+
event_hash TEXT NOT NULL,
|
|
98
|
+
UNIQUE (tenant_id, sequence),
|
|
99
|
+
UNIQUE (tenant_id, event_hash)
|
|
100
|
+
);
|
|
101
|
+
CREATE INDEX IF NOT EXISTS audit_events_tenant_time_idx
|
|
102
|
+
ON audit_events (tenant_id, occurred_at DESC, sequence DESC);
|
|
103
|
+
ALTER TABLE audit_events ENABLE ROW LEVEL SECURITY;
|
|
104
|
+
ALTER TABLE audit_events FORCE ROW LEVEL SECURITY;
|
|
105
|
+
CREATE POLICY audit_events_tenant_policy ON audit_events
|
|
106
|
+
USING (tenant_id = current_setting('coreloom.tenant_id', true))
|
|
107
|
+
WITH CHECK (tenant_id = current_setting('coreloom.tenant_id', true));
|