@flowdular/sdk 0.2.3 → 0.3.0
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 +100 -0
- 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/deploy-operate/SKILL.md +114 -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 +3 -2
- 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/README.md +3 -0
- package/modules/approvals/module.json +34 -0
- package/modules/approvals/package.json +43 -0
- package/modules/approvals/spec/module.yaml +318 -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 +95 -0
- package/modules/approvals/src/domain/types.ts +154 -0
- package/modules/approvals/src/index.ts +52 -0
- package/modules/approvals/src/platform.ts +128 -0
- package/modules/approvals/src/server/index.ts +42 -0
- package/modules/approvals/src/server/runtime.ts +181 -0
- package/modules/approvals/src/services/approvals-service.ts +557 -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 +724 -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 +222 -0
- package/modules/approvals/src/services/notifications.ts +95 -0
- package/modules/approvals/src/services/repository.ts +161 -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 +3 -2
- 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 +5 -2
- 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/README.md +3 -0
- package/modules/connectors/module.json +28 -0
- package/modules/{automations-workflows-integration → connectors}/package.json +27 -26
- package/modules/connectors/spec/module.yaml +447 -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/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-vault.ts +188 -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 +166 -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/README.md +3 -0
- package/modules/documents/module.json +28 -0
- package/modules/documents/package.json +49 -0
- package/modules/documents/spec/module.yaml +247 -0
- package/modules/documents/src/acl/permissions.ts +6 -0
- package/modules/documents/src/api/endpoints.ts +401 -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 +259 -0
- package/modules/documents/src/services/documents-service.ts +586 -0
- package/modules/documents/src/services/index.ts +18 -0
- package/modules/documents/src/services/migration.ts +82 -0
- package/modules/documents/src/services/repository.ts +48 -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/README.md +3 -0
- package/modules/exports/module.json +28 -0
- package/modules/exports/package.json +44 -0
- package/modules/exports/spec/module.yaml +229 -0
- package/modules/exports/src/acl/permissions.ts +6 -0
- package/modules/exports/src/api/endpoints.ts +211 -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 +51 -0
- package/modules/exports/src/server/runtime.ts +160 -0
- package/modules/exports/src/services/data-classes.ts +56 -0
- package/modules/exports/src/services/database-repository.ts +405 -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 +89 -0
- package/modules/exports/src/services/repository.ts +97 -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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +5 -2
- 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 +3 -2
- 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 +66 -7
- package/packages/client/package.json +2 -1
- 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 +179 -0
- package/packages/database/src/decoders.ts +25 -0
- package/packages/database/src/index.ts +17 -0
- package/packages/database/src/record-history.ts +5 -14
- package/packages/dev-console/package.json +2 -1
- package/packages/dev-console/src/brand.d.mts +8 -0
- package/packages/dev-console/src/brand.mjs +33 -0
- package/packages/dev-console/src/index.mjs +2 -1
- package/packages/harness/src/index.ts +2 -0
- package/packages/harness/src/runtime.ts +218 -1
- package/packages/harness/src/tool-adapters.ts +19 -1
- package/packages/kernel/src/acl.ts +179 -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 +65 -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 +189 -0
- package/packages/storage/src/index.ts +43 -0
- package/packages/storage/src/local.ts +75 -0
- package/packages/storage/src/port.ts +251 -0
- package/packages/storage/src/read-token.ts +130 -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,495 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AuditChainAnchor,
|
|
3
|
+
AuditDataClass,
|
|
4
|
+
AuditErasureRun,
|
|
5
|
+
AuditEvent,
|
|
6
|
+
AuditExportRun,
|
|
7
|
+
AuditLegalHold,
|
|
8
|
+
AuditSubjectKey,
|
|
9
|
+
AuditSweepRun,
|
|
10
|
+
AuditSubjectType,
|
|
11
|
+
ExportRunSummary,
|
|
12
|
+
ErasureClassOutcome,
|
|
13
|
+
ErasureRunStatus,
|
|
14
|
+
ExportStatus,
|
|
15
|
+
HoldScopeKind,
|
|
16
|
+
HoldStatus,
|
|
17
|
+
RetentionMode,
|
|
18
|
+
SweepStatus,
|
|
19
|
+
} from '../domain/types.ts';
|
|
20
|
+
|
|
21
|
+
/** What the registry says a class is, before a workspace ever read it. */
|
|
22
|
+
export interface DataClassFacts {
|
|
23
|
+
readonly classId: string;
|
|
24
|
+
readonly moduleId: string;
|
|
25
|
+
readonly label: string;
|
|
26
|
+
readonly exportable: boolean;
|
|
27
|
+
readonly sweepable: boolean;
|
|
28
|
+
readonly defaultRetentionDays: number | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Routing columns only, read across tenants on the background lease. */
|
|
32
|
+
export interface DataClassRouting {
|
|
33
|
+
readonly tenantId: string;
|
|
34
|
+
readonly classId: string;
|
|
35
|
+
readonly lastSweptAt: number | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface AppendAuditEventInput {
|
|
39
|
+
readonly tenantId: string;
|
|
40
|
+
readonly actorId: string;
|
|
41
|
+
readonly action: string;
|
|
42
|
+
readonly subjectType: AuditSubjectType;
|
|
43
|
+
readonly subjectId: string;
|
|
44
|
+
readonly metadata: Readonly<Record<string, unknown>>;
|
|
45
|
+
readonly occurredAt: number;
|
|
46
|
+
/**
|
|
47
|
+
* The person the event names. When present the actor, the subject and the
|
|
48
|
+
* details are sealed under that subject's data key, so destroying the key
|
|
49
|
+
* later makes them unreadable while the chain still verifies. Absent for an
|
|
50
|
+
* event written by the platform about itself.
|
|
51
|
+
*/
|
|
52
|
+
readonly subjectAccountId?: string | null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* One event exactly as it is stored, sealed fields included. Verification and
|
|
57
|
+
* sealing read this form: the hash of a row is a function of these bytes and of
|
|
58
|
+
* nothing a key could unlock.
|
|
59
|
+
*/
|
|
60
|
+
export interface StoredAuditEvent {
|
|
61
|
+
readonly id: string;
|
|
62
|
+
readonly tenantId: string;
|
|
63
|
+
readonly sequence: number;
|
|
64
|
+
readonly actorId: string;
|
|
65
|
+
readonly action: string;
|
|
66
|
+
readonly subjectType: string;
|
|
67
|
+
readonly subjectId: string;
|
|
68
|
+
readonly metadataJson: string;
|
|
69
|
+
readonly occurredAt: number;
|
|
70
|
+
readonly previousHash: string | null;
|
|
71
|
+
readonly eventHash: string;
|
|
72
|
+
readonly subjectKeyId: string | null;
|
|
73
|
+
readonly sealedPayload: string | null;
|
|
74
|
+
/**
|
|
75
|
+
* The event format that wrote the row. Null means it was written before
|
|
76
|
+
* audit.core recorded one at all, which is the set verify reports as
|
|
77
|
+
* plaintext; a row carrying the marker and no sealed payload is an event
|
|
78
|
+
* about nobody rather than an unsealed person.
|
|
79
|
+
*/
|
|
80
|
+
readonly sealFormat: string | null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface InsertAnchorInput {
|
|
84
|
+
readonly tenantId: string;
|
|
85
|
+
readonly anchorSequence: number;
|
|
86
|
+
readonly fromSequence: number;
|
|
87
|
+
readonly toSequence: number;
|
|
88
|
+
readonly rowCount: number;
|
|
89
|
+
readonly firstOccurredAt: number;
|
|
90
|
+
readonly lastOccurredAt: number;
|
|
91
|
+
readonly segmentHash: string;
|
|
92
|
+
readonly previousAnchorHash: string | null;
|
|
93
|
+
readonly anchorHash: string;
|
|
94
|
+
readonly signature: string;
|
|
95
|
+
readonly keyId: string;
|
|
96
|
+
readonly segmentFile: string;
|
|
97
|
+
readonly sealedBy: string;
|
|
98
|
+
readonly sealedAt: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Routing columns only, read across tenants on the background lease. */
|
|
102
|
+
export interface AnchorRouting {
|
|
103
|
+
readonly tenantId: string;
|
|
104
|
+
readonly id: string;
|
|
105
|
+
readonly keyId: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface AnchorKeyCount {
|
|
109
|
+
readonly keyId: string;
|
|
110
|
+
readonly anchors: number;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface InsertHoldInput {
|
|
114
|
+
readonly tenantId: string;
|
|
115
|
+
readonly scopeKind: HoldScopeKind;
|
|
116
|
+
readonly accountId: string | null;
|
|
117
|
+
readonly classId: string | null;
|
|
118
|
+
readonly fromAt: number | null;
|
|
119
|
+
readonly toAt: number | null;
|
|
120
|
+
readonly reason: string;
|
|
121
|
+
readonly placedBy: string;
|
|
122
|
+
readonly placedAt: number;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface LiftHoldRecordInput {
|
|
126
|
+
readonly tenantId: string;
|
|
127
|
+
readonly id: string;
|
|
128
|
+
readonly liftedBy: string;
|
|
129
|
+
readonly liftReason: string;
|
|
130
|
+
readonly liftedAt: number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface SubjectKeyMaterial {
|
|
134
|
+
readonly id: string;
|
|
135
|
+
readonly key: Buffer;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface StartErasureRunInput {
|
|
139
|
+
readonly tenantId: string;
|
|
140
|
+
readonly subject: string;
|
|
141
|
+
readonly subjectMarker: string;
|
|
142
|
+
readonly requestedBy: string;
|
|
143
|
+
/** Absolute and inside the directory the deployment allows; null for a plan. */
|
|
144
|
+
readonly outputDirectory: string | null;
|
|
145
|
+
readonly dryRun: boolean;
|
|
146
|
+
readonly destroyKey: boolean;
|
|
147
|
+
readonly workspaceSlug: string | null;
|
|
148
|
+
readonly workspaceName: string | null;
|
|
149
|
+
readonly startedAt: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface FinishErasureRunInput {
|
|
153
|
+
readonly tenantId: string;
|
|
154
|
+
readonly id: string;
|
|
155
|
+
readonly status: Exclude<ErasureRunStatus, 'requested'>;
|
|
156
|
+
readonly classes: number;
|
|
157
|
+
readonly rows: number;
|
|
158
|
+
readonly certificatePath: string | null;
|
|
159
|
+
readonly outcome: readonly ErasureClassOutcome[] | null;
|
|
160
|
+
readonly reason: string | null;
|
|
161
|
+
readonly completedAt: number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Routing columns only, read across tenants on the background lease. */
|
|
165
|
+
export interface ErasureRunRouting {
|
|
166
|
+
readonly tenantId: string;
|
|
167
|
+
readonly id: string;
|
|
168
|
+
readonly startedAt: number;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface ClaimErasureRunInput {
|
|
172
|
+
readonly tenantId: string;
|
|
173
|
+
readonly id: string;
|
|
174
|
+
readonly claimedAt: number;
|
|
175
|
+
/** A claim older than this is taken over; the process holding it is gone. */
|
|
176
|
+
readonly staleBefore: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface AppendSweepRunInput {
|
|
180
|
+
readonly tenantId: string;
|
|
181
|
+
readonly classId: string;
|
|
182
|
+
readonly cutoff: number;
|
|
183
|
+
readonly removed: number;
|
|
184
|
+
readonly status: SweepStatus;
|
|
185
|
+
readonly reason: string | null;
|
|
186
|
+
/** Rows a hold withheld, or null when only the owning module could count them. */
|
|
187
|
+
readonly heldBack: number | null;
|
|
188
|
+
readonly occurredAt: number;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface StartExportRunInput {
|
|
192
|
+
readonly tenantId: string;
|
|
193
|
+
readonly formatVersion: string;
|
|
194
|
+
readonly requestedBy: string;
|
|
195
|
+
/** Absolute, inside the directory the deployment allows. */
|
|
196
|
+
readonly outputDirectory: string;
|
|
197
|
+
readonly dryRun: boolean;
|
|
198
|
+
readonly workspaceSlug: string | null;
|
|
199
|
+
readonly workspaceName: string | null;
|
|
200
|
+
readonly startedAt: number;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface FinishExportRunInput {
|
|
204
|
+
readonly tenantId: string;
|
|
205
|
+
readonly id: string;
|
|
206
|
+
readonly status: Exclude<ExportStatus, 'started'>;
|
|
207
|
+
readonly classes: number;
|
|
208
|
+
readonly rows: number;
|
|
209
|
+
readonly archiveDigest: string | null;
|
|
210
|
+
readonly archivePath: string | null;
|
|
211
|
+
readonly reason: string | null;
|
|
212
|
+
readonly summary: ExportRunSummary | null;
|
|
213
|
+
readonly completedAt: number;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface ClaimExportRunInput {
|
|
217
|
+
readonly tenantId: string;
|
|
218
|
+
readonly id: string;
|
|
219
|
+
readonly claimedAt: number;
|
|
220
|
+
/** A claim older than this is taken over; the process holding it is gone. */
|
|
221
|
+
readonly staleBefore: number;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** Routing columns only, read across tenants on the background lease. */
|
|
225
|
+
export interface ExportRunRouting {
|
|
226
|
+
readonly tenantId: string;
|
|
227
|
+
readonly id: string;
|
|
228
|
+
readonly startedAt: number;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The persistence port. Async and database agnostic: the PostgreSQL
|
|
233
|
+
* statements, the tenant transactions and the cross-tenant routing lease live
|
|
234
|
+
* in the adapter.
|
|
235
|
+
*/
|
|
236
|
+
export interface AuditRepository {
|
|
237
|
+
/**
|
|
238
|
+
* Writes the classes the registry declared into one workspace and refreshes
|
|
239
|
+
* the facts of the ones already there. The workspace's period and sweep
|
|
240
|
+
* stamp are never touched. Answers every stored class of the workspace.
|
|
241
|
+
*/
|
|
242
|
+
materializeDataClasses(
|
|
243
|
+
tenantId: string,
|
|
244
|
+
facts: readonly DataClassFacts[],
|
|
245
|
+
now: number,
|
|
246
|
+
): Promise<readonly AuditDataClass[]>;
|
|
247
|
+
listDataClasses(tenantId: string): Promise<readonly AuditDataClass[]>;
|
|
248
|
+
getDataClass(
|
|
249
|
+
tenantId: string,
|
|
250
|
+
classId: string,
|
|
251
|
+
): Promise<AuditDataClass | null>;
|
|
252
|
+
/** Null when the workspace holds no row for the class. */
|
|
253
|
+
setRetention(
|
|
254
|
+
tenantId: string,
|
|
255
|
+
classId: string,
|
|
256
|
+
mode: RetentionMode,
|
|
257
|
+
days: number | null,
|
|
258
|
+
now: number,
|
|
259
|
+
): Promise<AuditDataClass | null>;
|
|
260
|
+
stampSwept(
|
|
261
|
+
tenantId: string,
|
|
262
|
+
classId: string,
|
|
263
|
+
sweptAt: number,
|
|
264
|
+
): Promise<boolean>;
|
|
265
|
+
|
|
266
|
+
/** Cross-tenant, routing columns only, on the read-only background lease. */
|
|
267
|
+
listDueDataClasses(
|
|
268
|
+
staleBefore: number,
|
|
269
|
+
limit: number,
|
|
270
|
+
): Promise<readonly DataClassRouting[]>;
|
|
271
|
+
|
|
272
|
+
appendSweepRun(input: AppendSweepRunInput): Promise<AuditSweepRun>;
|
|
273
|
+
listSweepRuns(
|
|
274
|
+
tenantId: string,
|
|
275
|
+
status: SweepStatus | undefined,
|
|
276
|
+
limit: number,
|
|
277
|
+
): Promise<readonly AuditSweepRun[]>;
|
|
278
|
+
/** Newest run of one class, so a standing refusal is not repeated. */
|
|
279
|
+
latestSweepRun(
|
|
280
|
+
tenantId: string,
|
|
281
|
+
classId: string,
|
|
282
|
+
): Promise<AuditSweepRun | null>;
|
|
283
|
+
|
|
284
|
+
startExportRun(input: StartExportRunInput): Promise<AuditExportRun>;
|
|
285
|
+
finishExportRun(input: FinishExportRunInput): Promise<AuditExportRun | null>;
|
|
286
|
+
getExportRun(tenantId: string, id: string): Promise<AuditExportRun | null>;
|
|
287
|
+
/** Cross-tenant, routing columns only, on the read-only background lease. */
|
|
288
|
+
listPendingExportRuns(limit: number): Promise<readonly ExportRunRouting[]>;
|
|
289
|
+
/**
|
|
290
|
+
* Takes the run for this process, or answers null when it is no longer
|
|
291
|
+
* requested or another process holds an unexpired claim. The read and the
|
|
292
|
+
* claim are one statement, so two platform processes cannot both perform
|
|
293
|
+
* one export.
|
|
294
|
+
*/
|
|
295
|
+
claimExportRun(input: ClaimExportRunInput): Promise<AuditExportRun | null>;
|
|
296
|
+
/**
|
|
297
|
+
* Renews the claim of a run this process is performing, fenced on the claim
|
|
298
|
+
* instant it holds. False means the lease lapsed and another process took the
|
|
299
|
+
* run over, so the pass holding it must stop without settling it.
|
|
300
|
+
*/
|
|
301
|
+
heartbeatExportRun(
|
|
302
|
+
tenantId: string,
|
|
303
|
+
id: string,
|
|
304
|
+
at: number,
|
|
305
|
+
claimedAt: number,
|
|
306
|
+
): Promise<boolean>;
|
|
307
|
+
listExportRuns(
|
|
308
|
+
tenantId: string,
|
|
309
|
+
status: ExportStatus | undefined,
|
|
310
|
+
limit: number,
|
|
311
|
+
): Promise<readonly AuditExportRun[]>;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Keyset pages for the export, ordered by id so a full walk sees every row
|
|
315
|
+
* exactly once however long it runs. `afterId` is the last id of the page
|
|
316
|
+
* before it; the empty string starts the walk.
|
|
317
|
+
*/
|
|
318
|
+
exportAuditEventsPage(
|
|
319
|
+
tenantId: string,
|
|
320
|
+
afterId: string,
|
|
321
|
+
limit: number,
|
|
322
|
+
): Promise<readonly AuditEvent[]>;
|
|
323
|
+
exportSweepRunsPage(
|
|
324
|
+
tenantId: string,
|
|
325
|
+
afterId: string,
|
|
326
|
+
limit: number,
|
|
327
|
+
): Promise<readonly AuditSweepRun[]>;
|
|
328
|
+
exportExportRunsPage(
|
|
329
|
+
tenantId: string,
|
|
330
|
+
afterId: string,
|
|
331
|
+
limit: number,
|
|
332
|
+
): Promise<readonly AuditExportRun[]>;
|
|
333
|
+
exportLegalHoldsPage(
|
|
334
|
+
tenantId: string,
|
|
335
|
+
afterId: string,
|
|
336
|
+
limit: number,
|
|
337
|
+
): Promise<readonly AuditLegalHold[]>;
|
|
338
|
+
exportErasureRunsPage(
|
|
339
|
+
tenantId: string,
|
|
340
|
+
afterId: string,
|
|
341
|
+
limit: number,
|
|
342
|
+
): Promise<readonly AuditErasureRun[]>;
|
|
343
|
+
|
|
344
|
+
/** Appends one link of the workspace chain inside a single transaction. */
|
|
345
|
+
appendAuditEvent(input: AppendAuditEventInput): Promise<AuditEvent>;
|
|
346
|
+
listAuditEvents(
|
|
347
|
+
tenantId: string,
|
|
348
|
+
limit: number,
|
|
349
|
+
): Promise<readonly AuditEvent[]>;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Events after `afterSequence` in sequence order, exactly as stored. The
|
|
353
|
+
* sealing pass walks this twice, once to compute the segment chain and once
|
|
354
|
+
* to write the file, and both walks see the same rows because the range it
|
|
355
|
+
* seals is closed before the second one starts.
|
|
356
|
+
*/
|
|
357
|
+
sealAuditEventsPage(
|
|
358
|
+
tenantId: string,
|
|
359
|
+
afterSequence: number,
|
|
360
|
+
limit: number,
|
|
361
|
+
): Promise<readonly StoredAuditEvent[]>;
|
|
362
|
+
/** Events older than `cutoff`; `maxSequence` null counts the unsealed ones too. */
|
|
363
|
+
countAuditEventsBefore(
|
|
364
|
+
tenantId: string,
|
|
365
|
+
cutoff: number,
|
|
366
|
+
maxSequence: number | null,
|
|
367
|
+
): Promise<number>;
|
|
368
|
+
/** Removes at most `limit` events older than `cutoff` at or below `maxSequence`. */
|
|
369
|
+
deleteAuditEventsBefore(
|
|
370
|
+
tenantId: string,
|
|
371
|
+
cutoff: number,
|
|
372
|
+
maxSequence: number,
|
|
373
|
+
limit: number,
|
|
374
|
+
): Promise<number>;
|
|
375
|
+
/**
|
|
376
|
+
* Ages the two ledgers audit.core keeps about itself. A run still waiting for
|
|
377
|
+
* the platform is never removed: the command that recorded it is still
|
|
378
|
+
* polling the row.
|
|
379
|
+
*/
|
|
380
|
+
deleteSweepRunsBefore(
|
|
381
|
+
tenantId: string,
|
|
382
|
+
cutoff: number,
|
|
383
|
+
limit: number,
|
|
384
|
+
): Promise<number>;
|
|
385
|
+
deleteExportRunsBefore(
|
|
386
|
+
tenantId: string,
|
|
387
|
+
cutoff: number,
|
|
388
|
+
limit: number,
|
|
389
|
+
): Promise<number>;
|
|
390
|
+
|
|
391
|
+
latestAnchor(tenantId: string): Promise<AuditChainAnchor | null>;
|
|
392
|
+
listAnchors(
|
|
393
|
+
tenantId: string,
|
|
394
|
+
limit: number,
|
|
395
|
+
): Promise<readonly AuditChainAnchor[]>;
|
|
396
|
+
insertAnchor(input: InsertAnchorInput): Promise<AuditChainAnchor>;
|
|
397
|
+
/**
|
|
398
|
+
* Writes a new signature over the same anchor hash. The stored signature is
|
|
399
|
+
* the optimistic check, so an anchor re-signed by another process in between
|
|
400
|
+
* keeps its own row and is counted as skipped rather than overwritten.
|
|
401
|
+
*/
|
|
402
|
+
resignAnchor(input: {
|
|
403
|
+
readonly tenantId: string;
|
|
404
|
+
readonly id: string;
|
|
405
|
+
readonly signature: string;
|
|
406
|
+
readonly keyId: string;
|
|
407
|
+
readonly expectedSignature: string;
|
|
408
|
+
}): Promise<boolean>;
|
|
409
|
+
/** Cross-tenant, routing columns only, on the read-only background lease. */
|
|
410
|
+
countAnchorsByKey(): Promise<readonly AnchorKeyCount[]>;
|
|
411
|
+
/** Cross-tenant, routing columns only, on the read-only background lease. */
|
|
412
|
+
listAnchorsNotOnKey(
|
|
413
|
+
keyId: string,
|
|
414
|
+
afterId: string,
|
|
415
|
+
limit: number,
|
|
416
|
+
): Promise<readonly AnchorRouting[]>;
|
|
417
|
+
getAnchor(tenantId: string, id: string): Promise<AuditChainAnchor | null>;
|
|
418
|
+
|
|
419
|
+
insertHold(input: InsertHoldInput): Promise<AuditLegalHold>;
|
|
420
|
+
liftHold(input: LiftHoldRecordInput): Promise<AuditLegalHold | null>;
|
|
421
|
+
getHold(tenantId: string, id: string): Promise<AuditLegalHold | null>;
|
|
422
|
+
listHolds(
|
|
423
|
+
tenantId: string,
|
|
424
|
+
status: HoldStatus | undefined,
|
|
425
|
+
limit: number,
|
|
426
|
+
): Promise<readonly AuditLegalHold[]>;
|
|
427
|
+
/** Every hold still standing, bounded; the sweep and erasure read this. */
|
|
428
|
+
listActiveHolds(
|
|
429
|
+
tenantId: string,
|
|
430
|
+
limit: number,
|
|
431
|
+
): Promise<readonly AuditLegalHold[]>;
|
|
432
|
+
/**
|
|
433
|
+
* Holds naming one account, lifted ones included. An erasure plan counts
|
|
434
|
+
* them so the certificate says what evidence about the subject stays.
|
|
435
|
+
*/
|
|
436
|
+
countHoldsForAccount(tenantId: string, accountId: string): Promise<number>;
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* The subject's data key, created on first use. A destroyed key is never
|
|
440
|
+
* recreated under the same subject: the row that held it keeps its id and
|
|
441
|
+
* the events that point at it stay unreadable for ever.
|
|
442
|
+
*/
|
|
443
|
+
subjectKey(
|
|
444
|
+
tenantId: string,
|
|
445
|
+
subject: string,
|
|
446
|
+
now: number,
|
|
447
|
+
): Promise<SubjectKeyMaterial>;
|
|
448
|
+
/** Null when the subject never had one; the destroyed row answers its state. */
|
|
449
|
+
getSubjectKey(
|
|
450
|
+
tenantId: string,
|
|
451
|
+
subject: string,
|
|
452
|
+
): Promise<AuditSubjectKey | null>;
|
|
453
|
+
/**
|
|
454
|
+
* The key row by the marker it keeps for ever, which is the only way to find
|
|
455
|
+
* a destroyed one: destruction removes the account the key belonged to.
|
|
456
|
+
*/
|
|
457
|
+
getSubjectKeyByMarker(
|
|
458
|
+
tenantId: string,
|
|
459
|
+
marker: string,
|
|
460
|
+
): Promise<AuditSubjectKey | null>;
|
|
461
|
+
destroySubjectKey(
|
|
462
|
+
tenantId: string,
|
|
463
|
+
subject: string,
|
|
464
|
+
now: number,
|
|
465
|
+
): Promise<AuditSubjectKey | null>;
|
|
466
|
+
listSubjectKeys(
|
|
467
|
+
tenantId: string,
|
|
468
|
+
limit: number,
|
|
469
|
+
): Promise<readonly AuditSubjectKey[]>;
|
|
470
|
+
|
|
471
|
+
startErasureRun(input: StartErasureRunInput): Promise<AuditErasureRun>;
|
|
472
|
+
/** Blanks the subject in the same statement: a finished run names nobody. */
|
|
473
|
+
finishErasureRun(
|
|
474
|
+
input: FinishErasureRunInput,
|
|
475
|
+
): Promise<AuditErasureRun | null>;
|
|
476
|
+
getErasureRun(tenantId: string, id: string): Promise<AuditErasureRun | null>;
|
|
477
|
+
/** Cross-tenant, routing columns only, on the read-only background lease. */
|
|
478
|
+
listPendingErasureRuns(limit: number): Promise<readonly ErasureRunRouting[]>;
|
|
479
|
+
/**
|
|
480
|
+
* Takes the run for this process, or answers null when it is no longer
|
|
481
|
+
* requested or another process holds an unexpired claim.
|
|
482
|
+
*/
|
|
483
|
+
claimErasureRun(input: ClaimErasureRunInput): Promise<AuditErasureRun | null>;
|
|
484
|
+
/** The same fenced renewal as the export one, for a run being erased. */
|
|
485
|
+
heartbeatErasureRun(
|
|
486
|
+
tenantId: string,
|
|
487
|
+
id: string,
|
|
488
|
+
at: number,
|
|
489
|
+
claimedAt: number,
|
|
490
|
+
): Promise<boolean>;
|
|
491
|
+
listErasureRuns(
|
|
492
|
+
tenantId: string,
|
|
493
|
+
limit: number,
|
|
494
|
+
): Promise<readonly AuditErasureRun[]>;
|
|
495
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { DATA_CLASS_LIMITS } from '../domain/data-classes.ts';
|
|
2
|
+
import {
|
|
3
|
+
AUDIT_EVENT_ACTIONS,
|
|
4
|
+
RETENTION_MODES,
|
|
5
|
+
type AuditDataClass,
|
|
6
|
+
type AuditExportRun,
|
|
7
|
+
type AuditRegistryModule,
|
|
8
|
+
type AuditSweepRun,
|
|
9
|
+
type ExportStatus,
|
|
10
|
+
type RetentionMode,
|
|
11
|
+
type SetRetentionInput,
|
|
12
|
+
type SweepStatus,
|
|
13
|
+
} from '../domain/types.ts';
|
|
14
|
+
import type { PlatformDataClassRegistry } from '@flowdular/sdk/kernel';
|
|
15
|
+
import { DeclaredDataClasses } from './declared-classes.ts';
|
|
16
|
+
import type { AuditRepository, DataClassFacts } from './repository.ts';
|
|
17
|
+
import { AuditServiceError, boundedInteger, oneOf } from './service-error.ts';
|
|
18
|
+
|
|
19
|
+
/** Longest ledger page a screen may ask for. */
|
|
20
|
+
export const LEDGER_PAGE_LIMIT = 200;
|
|
21
|
+
|
|
22
|
+
export function registryFacts(
|
|
23
|
+
declared: DeclaredDataClasses,
|
|
24
|
+
): readonly DataClassFacts[] {
|
|
25
|
+
return declared.all().map((entry) => ({
|
|
26
|
+
classId: entry.classId,
|
|
27
|
+
moduleId: entry.moduleId,
|
|
28
|
+
label: entry.declaration.label,
|
|
29
|
+
exportable: entry.declaration.exportable,
|
|
30
|
+
sweepable: entry.declaration.sweep !== undefined,
|
|
31
|
+
defaultRetentionDays: entry.declaration.defaultRetentionDays,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The registry, the periods and the ledgers as one workspace sees them. Rows
|
|
37
|
+
* are materialised from the declarations the first time a workspace reads them
|
|
38
|
+
* and refreshed when a composition changed a label or a default, so the screen
|
|
39
|
+
* follows the owning module without a migration. A workspace whose rows already
|
|
40
|
+
* carry the current declarations is answered from the read alone, which is what
|
|
41
|
+
* keeps the registry endpoint a read.
|
|
42
|
+
*/
|
|
43
|
+
export class AuditRetentionService {
|
|
44
|
+
readonly #declared: DeclaredDataClasses;
|
|
45
|
+
|
|
46
|
+
constructor(
|
|
47
|
+
private readonly repository: AuditRepository,
|
|
48
|
+
registry: PlatformDataClassRegistry,
|
|
49
|
+
private readonly now: () => number = Date.now,
|
|
50
|
+
) {
|
|
51
|
+
this.#declared = new DeclaredDataClasses(registry);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Every composed module with the classes it declared, including the ones
|
|
56
|
+
* that declared none, so a workspace can see which modules hold nothing.
|
|
57
|
+
*/
|
|
58
|
+
async listRegistry(
|
|
59
|
+
tenantId: string,
|
|
60
|
+
): Promise<readonly AuditRegistryModule[]> {
|
|
61
|
+
const stored = await this.materialize(tenantId);
|
|
62
|
+
const byClassId = new Map(stored.map((entry) => [entry.classId, entry]));
|
|
63
|
+
return this.#declared.modules().map((entry) => ({
|
|
64
|
+
moduleId: entry.moduleId,
|
|
65
|
+
classes: entry.classes.flatMap((declaration) => {
|
|
66
|
+
const record = byClassId.get(`${entry.moduleId}.${declaration.key}`);
|
|
67
|
+
return record ? [record] : [];
|
|
68
|
+
}),
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** The same classes, flattened, for a table that lists them in one page. */
|
|
73
|
+
async listDataClasses(tenantId: string): Promise<readonly AuditDataClass[]> {
|
|
74
|
+
const modules = await this.listRegistry(tenantId);
|
|
75
|
+
return modules.flatMap((entry) => entry.classes);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async materialize(tenantId: string): Promise<readonly AuditDataClass[]> {
|
|
79
|
+
return this.repository.materializeDataClasses(
|
|
80
|
+
tenantId,
|
|
81
|
+
registryFacts(this.#declared),
|
|
82
|
+
this.now(),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Sets the workspace's period for one class. `days` is refused for a class
|
|
88
|
+
* that cannot be swept and for anything outside 1 to 36500, so a zero can
|
|
89
|
+
* never be read as "remove everything now".
|
|
90
|
+
*/
|
|
91
|
+
async setRetention(
|
|
92
|
+
tenantId: string,
|
|
93
|
+
actorId: string,
|
|
94
|
+
input: SetRetentionInput,
|
|
95
|
+
): Promise<AuditDataClass> {
|
|
96
|
+
const classId = classIdentifier(input.classId);
|
|
97
|
+
const mode = oneOf<RetentionMode>(input.mode, 'mode', RETENTION_MODES);
|
|
98
|
+
const days =
|
|
99
|
+
mode === 'days'
|
|
100
|
+
? boundedInteger(
|
|
101
|
+
input.days ?? 0,
|
|
102
|
+
'days',
|
|
103
|
+
1,
|
|
104
|
+
DATA_CLASS_LIMITS.retentionDays,
|
|
105
|
+
)
|
|
106
|
+
: null;
|
|
107
|
+
/* Materialising first is what lets a workspace set a period on a class it
|
|
108
|
+
has never opened a screen for. */
|
|
109
|
+
await this.materialize(tenantId);
|
|
110
|
+
const existing = await this.repository.getDataClass(tenantId, classId);
|
|
111
|
+
if (!existing) {
|
|
112
|
+
throw new AuditServiceError(
|
|
113
|
+
'DATA_CLASS_NOT_FOUND',
|
|
114
|
+
`No composed module declares the data class ${classId}.`,
|
|
115
|
+
404,
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
if (mode !== 'none' && !existing.sweepable) {
|
|
119
|
+
throw new AuditServiceError(
|
|
120
|
+
'DATA_CLASS_NOT_SWEEPABLE',
|
|
121
|
+
`${classId} declares no sweep operation, so it can only be kept until a person deletes it.`,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
const now = this.now();
|
|
125
|
+
const updated = await this.repository.setRetention(
|
|
126
|
+
tenantId,
|
|
127
|
+
classId,
|
|
128
|
+
mode,
|
|
129
|
+
days,
|
|
130
|
+
now,
|
|
131
|
+
);
|
|
132
|
+
if (!updated) {
|
|
133
|
+
throw new AuditServiceError(
|
|
134
|
+
'DATA_CLASS_NOT_FOUND',
|
|
135
|
+
`The data class ${classId} is not held by this workspace.`,
|
|
136
|
+
404,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
await this.repository.appendAuditEvent({
|
|
140
|
+
tenantId,
|
|
141
|
+
actorId,
|
|
142
|
+
action: AUDIT_EVENT_ACTIONS.retentionSet,
|
|
143
|
+
subjectType: 'data-class',
|
|
144
|
+
subjectId: classId,
|
|
145
|
+
metadata: {
|
|
146
|
+
mode,
|
|
147
|
+
days,
|
|
148
|
+
previousMode: existing.retentionMode,
|
|
149
|
+
previousDays: existing.retentionDays,
|
|
150
|
+
},
|
|
151
|
+
occurredAt: now,
|
|
152
|
+
});
|
|
153
|
+
return updated;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async listSweepRuns(
|
|
157
|
+
tenantId: string,
|
|
158
|
+
status: SweepStatus | undefined,
|
|
159
|
+
limit = LEDGER_PAGE_LIMIT,
|
|
160
|
+
): Promise<readonly AuditSweepRun[]> {
|
|
161
|
+
return this.repository.listSweepRuns(tenantId, status, page(limit));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async listExportRuns(
|
|
165
|
+
tenantId: string,
|
|
166
|
+
status: ExportStatus | undefined,
|
|
167
|
+
limit = LEDGER_PAGE_LIMIT,
|
|
168
|
+
): Promise<readonly AuditExportRun[]> {
|
|
169
|
+
return this.repository.listExportRuns(tenantId, status, page(limit));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function page(limit: number): number {
|
|
174
|
+
return Math.min(Math.max(Math.trunc(limit) || 1, 1), LEDGER_PAGE_LIMIT);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const CLASS_ID = /^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)+$/;
|
|
178
|
+
|
|
179
|
+
export function classIdentifier(value: string): string {
|
|
180
|
+
if (
|
|
181
|
+
typeof value !== 'string' ||
|
|
182
|
+
value.length > DATA_CLASS_LIMITS.classId ||
|
|
183
|
+
!CLASS_ID.test(value)
|
|
184
|
+
) {
|
|
185
|
+
throw new AuditServiceError(
|
|
186
|
+
'INVALID_INPUT',
|
|
187
|
+
'classId must be a module id followed by a class key.',
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
return value;
|
|
191
|
+
}
|