@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,209 @@
|
|
|
1
|
+
import { t } from '@flowdular/sdk/client/i18n';
|
|
2
|
+
import type { DocumentAttachment } from '../domain/attachments.ts';
|
|
3
|
+
import type {
|
|
4
|
+
DocumentDeleteOutcome,
|
|
5
|
+
DocumentReadUrl,
|
|
6
|
+
DocumentScan,
|
|
7
|
+
} from '../domain/types.ts';
|
|
8
|
+
|
|
9
|
+
interface ErrorEnvelope {
|
|
10
|
+
readonly error?: {
|
|
11
|
+
readonly code?: string;
|
|
12
|
+
readonly message?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** A failed request with the server's stable code, so a screen can translate it. */
|
|
17
|
+
export class DocumentsApiError extends Error {
|
|
18
|
+
readonly status: number;
|
|
19
|
+
readonly code: string;
|
|
20
|
+
|
|
21
|
+
constructor(status: number, code: string, message: string) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = 'DocumentsApiError';
|
|
24
|
+
this.status = status;
|
|
25
|
+
this.code = code;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The server message is English and written for an operator. A code this module
|
|
31
|
+
* knows becomes translated copy; anything else keeps the server's own sentence
|
|
32
|
+
* rather than hiding what went wrong behind a generic line.
|
|
33
|
+
*/
|
|
34
|
+
export function documentsErrorMessage(
|
|
35
|
+
error: unknown,
|
|
36
|
+
fallbackKey: string,
|
|
37
|
+
): string {
|
|
38
|
+
if (error instanceof DocumentsApiError) {
|
|
39
|
+
const key = 'documents.error.code.' + error.code;
|
|
40
|
+
const translated = t(key);
|
|
41
|
+
if (translated !== key) return translated;
|
|
42
|
+
return error.message;
|
|
43
|
+
}
|
|
44
|
+
if (error instanceof Error && error.message !== '') return error.message;
|
|
45
|
+
return t(fallbackKey);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function payload<T>(response: Response): Promise<T> {
|
|
49
|
+
const value = (await response.json()) as T & ErrorEnvelope;
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
throw new DocumentsApiError(
|
|
52
|
+
response.status,
|
|
53
|
+
value.error?.code ?? 'REQUEST_FAILED',
|
|
54
|
+
value.error?.message ?? t('documents.error.request'),
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function post<T>(
|
|
61
|
+
path: string,
|
|
62
|
+
body: unknown,
|
|
63
|
+
csrfToken: string,
|
|
64
|
+
): Promise<T> {
|
|
65
|
+
return payload<T>(
|
|
66
|
+
await fetch(path, {
|
|
67
|
+
method: 'POST',
|
|
68
|
+
headers: {
|
|
69
|
+
'content-type': 'application/json',
|
|
70
|
+
'x-csrf-token': csrfToken,
|
|
71
|
+
},
|
|
72
|
+
credentials: 'same-origin',
|
|
73
|
+
body: JSON.stringify(body),
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface DocumentFilter {
|
|
79
|
+
readonly ownerModule?: string;
|
|
80
|
+
readonly recordRef?: string;
|
|
81
|
+
readonly scan?: DocumentScan | '';
|
|
82
|
+
/** Substring of the filename or the description; the server matches it. */
|
|
83
|
+
readonly search?: string;
|
|
84
|
+
/** The page to continue; null or absent asks for the first one. */
|
|
85
|
+
readonly cursor?: string | null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function query(entries: Readonly<Record<string, string>>): string {
|
|
89
|
+
const parameters = new URLSearchParams();
|
|
90
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
91
|
+
if (value !== '') parameters.set(key, value);
|
|
92
|
+
}
|
|
93
|
+
const text = parameters.toString();
|
|
94
|
+
return text === '' ? '' : '?' + text;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface DocumentPage {
|
|
98
|
+
readonly items: readonly DocumentAttachment[];
|
|
99
|
+
readonly page: { readonly nextCursor: string | null };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** One server-filtered, server-paged listing; the screen narrows nothing. */
|
|
103
|
+
export async function loadDocuments(
|
|
104
|
+
filter: DocumentFilter = {},
|
|
105
|
+
): Promise<DocumentPage> {
|
|
106
|
+
const response = await fetch(
|
|
107
|
+
'/api/documents' +
|
|
108
|
+
query({
|
|
109
|
+
ownerModule: filter.ownerModule ?? '',
|
|
110
|
+
recordRef: filter.recordRef ?? '',
|
|
111
|
+
scan: filter.scan ?? '',
|
|
112
|
+
q: filter.search ?? '',
|
|
113
|
+
cursor: filter.cursor ?? '',
|
|
114
|
+
}),
|
|
115
|
+
{
|
|
116
|
+
headers: { accept: 'application/json' },
|
|
117
|
+
credentials: 'same-origin',
|
|
118
|
+
},
|
|
119
|
+
);
|
|
120
|
+
return payload<DocumentPage>(response);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface DocumentLimits {
|
|
124
|
+
readonly maxObjectBytes: number;
|
|
125
|
+
readonly contentTypes: readonly string[];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export async function loadDocumentLimits(): Promise<DocumentLimits> {
|
|
129
|
+
return payload<DocumentLimits>(
|
|
130
|
+
await fetch('/api/documents/limits', {
|
|
131
|
+
headers: { accept: 'application/json' },
|
|
132
|
+
credentials: 'same-origin',
|
|
133
|
+
}),
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface UploadDocumentRequest {
|
|
138
|
+
readonly file: File;
|
|
139
|
+
readonly ownerModule: string;
|
|
140
|
+
readonly recordRef: string;
|
|
141
|
+
readonly description: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* A header is ASCII on the wire and a document name is not, so every text
|
|
145
|
+
header is percent encoded and the server decodes it once. */
|
|
146
|
+
function encodedHeaders(
|
|
147
|
+
input: UploadDocumentRequest,
|
|
148
|
+
csrfToken: string,
|
|
149
|
+
): Record<string, string> {
|
|
150
|
+
return {
|
|
151
|
+
'content-type': input.file.type,
|
|
152
|
+
'x-csrf-token': csrfToken,
|
|
153
|
+
'x-document-filename': encodeURIComponent(input.file.name),
|
|
154
|
+
'x-document-owner-module': encodeURIComponent(input.ownerModule),
|
|
155
|
+
'x-document-record-ref': encodeURIComponent(input.recordRef),
|
|
156
|
+
...(input.description === ''
|
|
157
|
+
? {}
|
|
158
|
+
: { 'x-document-description': encodeURIComponent(input.description) }),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** The file is the whole body: there is no multipart parser on the server. */
|
|
163
|
+
export async function uploadDocument(
|
|
164
|
+
input: UploadDocumentRequest,
|
|
165
|
+
csrfToken: string,
|
|
166
|
+
): Promise<DocumentAttachment> {
|
|
167
|
+
const response = await fetch('/api/documents/upload', {
|
|
168
|
+
method: 'POST',
|
|
169
|
+
headers: encodedHeaders(input, csrfToken),
|
|
170
|
+
credentials: 'same-origin',
|
|
171
|
+
body: input.file,
|
|
172
|
+
});
|
|
173
|
+
return (await payload<{ readonly document: DocumentAttachment }>(response))
|
|
174
|
+
.document;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export async function documentReadUrl(
|
|
178
|
+
id: string,
|
|
179
|
+
csrfToken: string,
|
|
180
|
+
): Promise<DocumentReadUrl> {
|
|
181
|
+
return post<DocumentReadUrl>('/api/documents/read-url', { id }, csrfToken);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export async function deleteDocument(
|
|
185
|
+
id: string,
|
|
186
|
+
csrfToken: string,
|
|
187
|
+
): Promise<DocumentAttachment> {
|
|
188
|
+
return (
|
|
189
|
+
await post<{ readonly document: DocumentAttachment }>(
|
|
190
|
+
'/api/documents/delete',
|
|
191
|
+
{ id },
|
|
192
|
+
csrfToken,
|
|
193
|
+
)
|
|
194
|
+
).document;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** One outcome per id, in the order the ids were sent. */
|
|
198
|
+
export async function deleteDocuments(
|
|
199
|
+
ids: readonly string[],
|
|
200
|
+
csrfToken: string,
|
|
201
|
+
): Promise<readonly DocumentDeleteOutcome[]> {
|
|
202
|
+
return (
|
|
203
|
+
await post<{ readonly outcomes: readonly DocumentDeleteOutcome[] }>(
|
|
204
|
+
'/api/documents/delete-many',
|
|
205
|
+
{ ids },
|
|
206
|
+
csrfToken,
|
|
207
|
+
)
|
|
208
|
+
).outcomes;
|
|
209
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ModuleClientContribution } from '@flowdular/sdk/client';
|
|
2
|
+
import translationsEn from '../../translations/en.json';
|
|
3
|
+
import translationsPl from '../../translations/pl.json';
|
|
4
|
+
import { DOCUMENTS_PERMISSIONS } from '../acl/permissions.ts';
|
|
5
|
+
import { DocumentsView } from './DocumentsView.tsrx';
|
|
6
|
+
import { documentsNavigation, DOCUMENTS_VIEW } from './navigation.ts';
|
|
7
|
+
|
|
8
|
+
export interface DocumentsClientContributionOptions {
|
|
9
|
+
readonly csrfToken: string;
|
|
10
|
+
readonly scopes: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function createDocumentsClientContribution(
|
|
14
|
+
options: DocumentsClientContributionOptions,
|
|
15
|
+
): ModuleClientContribution {
|
|
16
|
+
const canManage = options.scopes.includes(DOCUMENTS_PERMISSIONS.manage);
|
|
17
|
+
return {
|
|
18
|
+
moduleId: 'documents.core',
|
|
19
|
+
translations: { en: translationsEn, pl: translationsPl },
|
|
20
|
+
navigation: documentsNavigation,
|
|
21
|
+
views: [
|
|
22
|
+
{
|
|
23
|
+
id: DOCUMENTS_VIEW,
|
|
24
|
+
render: () =>
|
|
25
|
+
<DocumentsView csrfToken={options.csrfToken} canManage={canManage} />,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of a browser window this module uses to hand a reader a file. Named
|
|
3
|
+
* as an interface so the behaviour can be exercised without one.
|
|
4
|
+
*/
|
|
5
|
+
export interface DownloadWindow {
|
|
6
|
+
open(url: string, target: string): DownloadTab | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface DownloadTab {
|
|
10
|
+
location: { href: string };
|
|
11
|
+
opener: unknown;
|
|
12
|
+
close(): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** The tab a download was started in, before the URL that fills it exists. */
|
|
16
|
+
export interface DownloadTarget {
|
|
17
|
+
/** Sends the waiting tab to the URL the server issued. */
|
|
18
|
+
send(url: string): void;
|
|
19
|
+
/** Closes it when no URL was issued, so no blank tab is left behind. */
|
|
20
|
+
abort(): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Opens the tab inside the click that asked for it. A tab opened after the
|
|
25
|
+
* await that resolves the read URL is a pop-up the browser blocks, so the tab
|
|
26
|
+
* is claimed first and sent to the URL when it arrives. `opener` is dropped as
|
|
27
|
+
* soon as the tab exists: the download route must not reach back into the app.
|
|
28
|
+
*/
|
|
29
|
+
export function openDownloadTarget(
|
|
30
|
+
view: DownloadWindow,
|
|
31
|
+
): DownloadTarget | null {
|
|
32
|
+
const tab = view.open('', '_blank');
|
|
33
|
+
if (!tab) return null;
|
|
34
|
+
tab.opener = null;
|
|
35
|
+
return {
|
|
36
|
+
send(url) {
|
|
37
|
+
tab.location.href = url;
|
|
38
|
+
},
|
|
39
|
+
abort() {
|
|
40
|
+
tab.close();
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* One download from the click to the bytes. The tab is claimed before `resolve`
|
|
47
|
+
* runs and closed again when it refuses, and a window the browser would not
|
|
48
|
+
* open is reported rather than passed over in silence.
|
|
49
|
+
*/
|
|
50
|
+
export async function runDownload(
|
|
51
|
+
view: DownloadWindow,
|
|
52
|
+
resolve: () => Promise<string>,
|
|
53
|
+
): Promise<void> {
|
|
54
|
+
const target = openDownloadTarget(view);
|
|
55
|
+
if (!target) throw new DownloadBlocked();
|
|
56
|
+
try {
|
|
57
|
+
target.send(await resolve());
|
|
58
|
+
} catch (error) {
|
|
59
|
+
target.abort();
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The browser refused the tab, so the reader has to allow it themselves. */
|
|
65
|
+
export class DownloadBlocked extends Error {
|
|
66
|
+
constructor() {
|
|
67
|
+
super('The browser blocked the download tab.');
|
|
68
|
+
this.name = 'DownloadBlocked';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ModuleClientContext,
|
|
3
|
+
ModuleClientContribution,
|
|
4
|
+
} from '@flowdular/sdk/client';
|
|
5
|
+
import { createDocumentsClientContribution as canonicalContribution } from './contribution.tsrx';
|
|
6
|
+
|
|
7
|
+
export { createDocumentsClientContribution } from './contribution.tsrx';
|
|
8
|
+
export type { DocumentsClientContributionOptions } from './contribution.tsrx';
|
|
9
|
+
export { documentsNavigation, DOCUMENTS_VIEW } from './navigation.ts';
|
|
10
|
+
export { DocumentsView } from './DocumentsView.tsrx';
|
|
11
|
+
export { DocumentUploader } from './DocumentUploader.tsrx';
|
|
12
|
+
export type { DocumentUploadValue } from './DocumentUploader.tsrx';
|
|
13
|
+
|
|
14
|
+
/* Canonical entry used by the generated platform composition. */
|
|
15
|
+
export function createClientContribution(
|
|
16
|
+
context: ModuleClientContext,
|
|
17
|
+
): ModuleClientContribution {
|
|
18
|
+
return canonicalContribution({
|
|
19
|
+
csrfToken: context.csrfToken,
|
|
20
|
+
scopes: context.scopes,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NavigationContribution } from '@flowdular/sdk/client';
|
|
2
|
+
import { t } from '@flowdular/sdk/client/i18n';
|
|
3
|
+
import { DOCUMENTS_PERMISSIONS } from '../acl/permissions.ts';
|
|
4
|
+
|
|
5
|
+
/** The view id the navigation entry points at; it equals the URL slug. */
|
|
6
|
+
export const DOCUMENTS_VIEW = 'documents';
|
|
7
|
+
|
|
8
|
+
/* Labels are read every render, so a locale change reaches an entry the shell
|
|
9
|
+
built once. */
|
|
10
|
+
export const documentsNavigation: readonly NavigationContribution[] = [
|
|
11
|
+
{
|
|
12
|
+
id: 'documents.navigation',
|
|
13
|
+
viewId: DOCUMENTS_VIEW,
|
|
14
|
+
group: 'Workspace',
|
|
15
|
+
get label() {
|
|
16
|
+
return t('documents.navigation.label');
|
|
17
|
+
},
|
|
18
|
+
glyph: 'file-text',
|
|
19
|
+
get description() {
|
|
20
|
+
return t('documents.navigation.description');
|
|
21
|
+
},
|
|
22
|
+
scope: DOCUMENTS_PERMISSIONS.read,
|
|
23
|
+
order: 30,
|
|
24
|
+
},
|
|
25
|
+
];
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { TableEmpty, TagTone } from '@flowdular/sdk/ui';
|
|
2
|
+
import { activeLocale, t } from '@flowdular/sdk/client/i18n';
|
|
3
|
+
import type { DocumentAttachment } from '../domain/attachments.ts';
|
|
4
|
+
import type { DocumentScan } from '../domain/types.ts';
|
|
5
|
+
import type { ScreenStatus } from './state.ts';
|
|
6
|
+
|
|
7
|
+
const BYTE_UNITS = ['bytes', 'kb', 'mb', 'gb'] as const;
|
|
8
|
+
|
|
9
|
+
/** Epoch milliseconds as the reader's local date and time. */
|
|
10
|
+
export function timestampLabel(value: number): string {
|
|
11
|
+
return new Intl.DateTimeFormat(activeLocale(), {
|
|
12
|
+
dateStyle: 'medium',
|
|
13
|
+
timeStyle: 'short',
|
|
14
|
+
}).format(value);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A size a person reads, in the reader's locale. The unit stops at gigabytes
|
|
19
|
+
* because the object limit is 25 MB and a workspace quota is counted in GB.
|
|
20
|
+
*/
|
|
21
|
+
export function byteLabel(value: number): string {
|
|
22
|
+
let size = value;
|
|
23
|
+
let unit = 0;
|
|
24
|
+
while (size >= 1024 && unit < BYTE_UNITS.length - 1) {
|
|
25
|
+
size /= 1024;
|
|
26
|
+
unit += 1;
|
|
27
|
+
}
|
|
28
|
+
return t('documents.unit.' + BYTE_UNITS[unit], {
|
|
29
|
+
value: new Intl.NumberFormat(activeLocale(), {
|
|
30
|
+
maximumFractionDigits: unit === 0 ? 0 : 1,
|
|
31
|
+
}).format(size),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function scanLabel(scan: DocumentScan): string {
|
|
36
|
+
return t('documents.scan.' + scan);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function scanTone(scan: DocumentScan): TagTone {
|
|
40
|
+
if (scan === 'clean') return 'success';
|
|
41
|
+
return scan === 'infected' ? 'danger' : 'warning';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Why this file cannot be uploaded, or empty when it can. The storage port
|
|
46
|
+
* applies the same ceiling to the bytes it receives; checking it here spends a
|
|
47
|
+
* comparison instead of the upload. A screen that could not read the limits
|
|
48
|
+
* offers the upload and lets the server answer.
|
|
49
|
+
*/
|
|
50
|
+
export function uploadRefusal(
|
|
51
|
+
bytes: number,
|
|
52
|
+
maxObjectBytes: number | null,
|
|
53
|
+
): string {
|
|
54
|
+
if (maxObjectBytes === null || bytes <= maxObjectBytes) return '';
|
|
55
|
+
return t('documents.upload.form.tooLarge', {
|
|
56
|
+
limit: byteLabel(maxObjectBytes),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Why a row cannot be downloaded, or empty when it can. An infected object was
|
|
62
|
+
* deleted the moment the scan found it, and a deleted one is gone.
|
|
63
|
+
*/
|
|
64
|
+
export function downloadRefusal(record: DocumentAttachment): string {
|
|
65
|
+
if (record.scan === 'infected')
|
|
66
|
+
return t('documents.action.downloadRefusedInfected');
|
|
67
|
+
if (record.status === 'deleted')
|
|
68
|
+
return t('documents.action.downloadRefusedDeleted');
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** The copy of a row action: its name, and why it is refused. */
|
|
73
|
+
export interface ActionCopy {
|
|
74
|
+
readonly label: string;
|
|
75
|
+
readonly disabled: boolean;
|
|
76
|
+
/** Why the action is refused, empty while it is allowed. */
|
|
77
|
+
readonly reason: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* What the download action says about this row. The label is the name of the
|
|
82
|
+
* action whatever the row is, and the refusal travels as the reason, which the
|
|
83
|
+
* table renders as the button's accessible description: an action whose name
|
|
84
|
+
* changes under the reader is a different action.
|
|
85
|
+
*/
|
|
86
|
+
export function downloadAction(record: DocumentAttachment): ActionCopy {
|
|
87
|
+
const reason = downloadRefusal(record);
|
|
88
|
+
return {
|
|
89
|
+
label: t('documents.action.download'),
|
|
90
|
+
disabled: reason !== '',
|
|
91
|
+
reason,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* What the table renders in place of its rows. A load that failed must never
|
|
97
|
+
* answer with the empty state: "no documents yet" is a statement about the
|
|
98
|
+
* workspace, and a failed request read nothing to make it from.
|
|
99
|
+
*/
|
|
100
|
+
export function tableEmpty(
|
|
101
|
+
status: ScreenStatus,
|
|
102
|
+
populated: TableEmpty,
|
|
103
|
+
): TableEmpty {
|
|
104
|
+
if (status !== 'error') return populated;
|
|
105
|
+
return {
|
|
106
|
+
icon: 'alert',
|
|
107
|
+
title: t('documents.loadFailed.title'),
|
|
108
|
+
hint: t('documents.loadFailed.hint'),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { cell, createStore } from 'segment-state';
|
|
2
|
+
import type { DocumentAttachment } from '../domain/attachments.ts';
|
|
3
|
+
import type { DocumentDeleteOutcome, DocumentScan } from '../domain/types.ts';
|
|
4
|
+
|
|
5
|
+
/** `denied` is a 403 the shell could not hide; `error` is everything else. */
|
|
6
|
+
export type ScreenStatus =
|
|
7
|
+
| 'idle'
|
|
8
|
+
| 'loading'
|
|
9
|
+
| 'submitting'
|
|
10
|
+
| 'denied'
|
|
11
|
+
| 'error';
|
|
12
|
+
|
|
13
|
+
export function createDocumentsClientState() {
|
|
14
|
+
const store = createStore({
|
|
15
|
+
documents: cell<readonly DocumentAttachment[]>([]),
|
|
16
|
+
status: cell<ScreenStatus>('idle'),
|
|
17
|
+
error: '',
|
|
18
|
+
query: '',
|
|
19
|
+
/* The term the rows on screen were loaded with, so a typed one is known
|
|
20
|
+
to be pending and a cleared one still asks the server for a listing. */
|
|
21
|
+
appliedQuery: '',
|
|
22
|
+
ownerModuleFilter: '',
|
|
23
|
+
scanFilter: cell<DocumentScan | ''>(''),
|
|
24
|
+
/* Owner modules seen on any page loaded so far: the filter's options
|
|
25
|
+
cannot come from one page without disappearing as the reader walks. */
|
|
26
|
+
ownerModulesSeen: cell<readonly string[]>([]),
|
|
27
|
+
filtersOpen: false,
|
|
28
|
+
uploaderOpen: false,
|
|
29
|
+
/* Remounts the uploader so the native file input starts empty again. */
|
|
30
|
+
formSession: 0,
|
|
31
|
+
/* Null once the server stops handing one back: that is the last page. */
|
|
32
|
+
nextCursor: cell<string | null>(null),
|
|
33
|
+
confirmDeleteId: cell<string | null>(null),
|
|
34
|
+
/* Row ids checked in the table; the screen owns it, the table never
|
|
35
|
+
clears it. */
|
|
36
|
+
selectedIds: cell<ReadonlySet<string>>(new Set()),
|
|
37
|
+
confirmDeleteMany: false,
|
|
38
|
+
});
|
|
39
|
+
return { store, state: store.state };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Whether the typed term still has to reach the server. The search is a query
|
|
44
|
+
* filter, so what is on screen is only right once a listing was loaded with
|
|
45
|
+
* exactly this term; whitespace alone is not a term.
|
|
46
|
+
*/
|
|
47
|
+
export function searchPending(query: string, applied: string): boolean {
|
|
48
|
+
return query.trim() !== applied;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Owner modules present in the loaded set, for the filter's option list. */
|
|
52
|
+
export function ownerModules(
|
|
53
|
+
documents: readonly DocumentAttachment[],
|
|
54
|
+
): readonly string[] {
|
|
55
|
+
return [...new Set(documents.map((document) => document.ownerModule))].sort();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The rows a screen holds after a page arrives. Appending keeps what the reader
|
|
60
|
+
* already walked; a new listing replaces it, so a changed filter can never mix
|
|
61
|
+
* two result sets.
|
|
62
|
+
*/
|
|
63
|
+
export function mergeDocumentPage(
|
|
64
|
+
held: readonly DocumentAttachment[],
|
|
65
|
+
page: readonly DocumentAttachment[],
|
|
66
|
+
append: boolean,
|
|
67
|
+
): readonly DocumentAttachment[] {
|
|
68
|
+
return append ? [...held, ...page] : page;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** The owner modules the filter offers once this page has been seen. */
|
|
72
|
+
export function mergeOwnerModules(
|
|
73
|
+
seen: readonly string[],
|
|
74
|
+
page: readonly DocumentAttachment[],
|
|
75
|
+
): readonly string[] {
|
|
76
|
+
return [...new Set([...seen, ...ownerModules(page)])].sort();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The selection once a page arrives. A new listing is a new set of rows, so
|
|
81
|
+
* nothing checked before it is still selected; an appended page keeps it.
|
|
82
|
+
*/
|
|
83
|
+
export function selectionAfterPage(
|
|
84
|
+
selected: ReadonlySet<string>,
|
|
85
|
+
append: boolean,
|
|
86
|
+
): ReadonlySet<string> {
|
|
87
|
+
return append ? selected : new Set();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The selected rows a bulk delete may name: the stored ones on screen. */
|
|
91
|
+
export function deletableIds(
|
|
92
|
+
documents: readonly DocumentAttachment[],
|
|
93
|
+
selected: ReadonlySet<string>,
|
|
94
|
+
): readonly string[] {
|
|
95
|
+
return documents
|
|
96
|
+
.filter((record) => selected.has(record.id) && record.status === 'stored')
|
|
97
|
+
.map((record) => record.id);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** How many ids each outcome covered, for the notice after a bulk delete. */
|
|
101
|
+
export function deleteOutcomeCounts(
|
|
102
|
+
outcomes: readonly DocumentDeleteOutcome[],
|
|
103
|
+
): {
|
|
104
|
+
readonly deleted: number;
|
|
105
|
+
readonly missing: number;
|
|
106
|
+
readonly refused: number;
|
|
107
|
+
} {
|
|
108
|
+
let deleted = 0;
|
|
109
|
+
let missing = 0;
|
|
110
|
+
let refused = 0;
|
|
111
|
+
for (const entry of outcomes) {
|
|
112
|
+
if (entry.outcome === 'deleted') deleted += 1;
|
|
113
|
+
else if (entry.outcome === 'not-found') missing += 1;
|
|
114
|
+
else refused += 1;
|
|
115
|
+
}
|
|
116
|
+
return { deleted, missing, refused };
|
|
117
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { DocumentScan, DocumentStatus } from './types.ts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The public cross-module surface. A module that owns a record resolves it with
|
|
5
|
+
* `context.capabilities.get<DocumentAttachments>(DOCUMENTS_ATTACHMENTS_CAPABILITY)`
|
|
6
|
+
* and reaches its own attachments by reference: its module id plus the record
|
|
7
|
+
* reference it chose. There is no attach call, because bytes only ever enter
|
|
8
|
+
* through `POST /api/documents/upload`, where the session, the CSRF proof, the
|
|
9
|
+
* workspace quota and the storage port's limits are applied; a capability that
|
|
10
|
+
* took bytes would be a second upload path with none of them.
|
|
11
|
+
*/
|
|
12
|
+
export const DOCUMENTS_ATTACHMENTS_CAPABILITY = 'documents.attachments.v1';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* One document as another module sees it. The storage key is documents.core's
|
|
16
|
+
* own bookkeeping and stays out: bytes are reached through `open` or a read
|
|
17
|
+
* URL, never by addressing the object store.
|
|
18
|
+
*/
|
|
19
|
+
export interface DocumentAttachment {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly ownerModule: string;
|
|
22
|
+
readonly recordRef: string;
|
|
23
|
+
readonly filename: string;
|
|
24
|
+
readonly contentType: string;
|
|
25
|
+
readonly bytes: number;
|
|
26
|
+
readonly checksum: string | null;
|
|
27
|
+
readonly scan: DocumentScan;
|
|
28
|
+
readonly status: DocumentStatus;
|
|
29
|
+
readonly uploaderAccountId: string;
|
|
30
|
+
readonly description: string | null;
|
|
31
|
+
readonly createdAt: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The bytes of one document as another module reads them. The storage key is
|
|
36
|
+
* absent here too: documents.core opens the object and hands over the stream,
|
|
37
|
+
* so a caller never addresses the store.
|
|
38
|
+
*/
|
|
39
|
+
export interface DocumentAttachmentBody {
|
|
40
|
+
readonly contentType: string;
|
|
41
|
+
readonly bytes: number;
|
|
42
|
+
readonly filename: string;
|
|
43
|
+
readonly body: ReadableStream<Uint8Array>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface DocumentAttachments {
|
|
47
|
+
/**
|
|
48
|
+
* Documents of one record, newest first. The tenant id comes from the
|
|
49
|
+
* caller's principal; a caller naming another module's id sees that module's
|
|
50
|
+
* attachments, so the reference pair is a scope, not an authorization.
|
|
51
|
+
*/
|
|
52
|
+
list(
|
|
53
|
+
tenantId: string,
|
|
54
|
+
ownerModule: string,
|
|
55
|
+
recordRef: string,
|
|
56
|
+
): Promise<readonly DocumentAttachment[]>;
|
|
57
|
+
/**
|
|
58
|
+
* The decrypted body of one document of that reference, streamed from the
|
|
59
|
+
* same storage access the read URL route serves. Null is every reference
|
|
60
|
+
* that has no readable object: an unknown id, another module's or another
|
|
61
|
+
* record's pair, another workspace's document, a deleted row, an infected
|
|
62
|
+
* one, or a row whose object is gone. A caller that has to tell those apart
|
|
63
|
+
* reads `list`, which carries the scan verdict and the status of each row.
|
|
64
|
+
*
|
|
65
|
+
* The stream is the caller's: nothing else reads it, cancels it or closes
|
|
66
|
+
* it, and the whole object is held in memory while it is open.
|
|
67
|
+
*/
|
|
68
|
+
open(
|
|
69
|
+
tenantId: string,
|
|
70
|
+
ownerModule: string,
|
|
71
|
+
recordRef: string,
|
|
72
|
+
id: string,
|
|
73
|
+
): Promise<DocumentAttachmentBody | null>;
|
|
74
|
+
/**
|
|
75
|
+
* Deletes the object, then marks the row deleted. Idempotent: false means the
|
|
76
|
+
* reference matched no stored document, including a second delete of one.
|
|
77
|
+
*/
|
|
78
|
+
delete(
|
|
79
|
+
tenantId: string,
|
|
80
|
+
ownerModule: string,
|
|
81
|
+
recordRef: string,
|
|
82
|
+
id: string,
|
|
83
|
+
): Promise<boolean>;
|
|
84
|
+
}
|