@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,16 @@
|
|
|
1
|
+
-- An external provider asserts an identity about an account, not about one of
|
|
2
|
+
-- its workspaces, and it does so before a workspace is chosen. The row carries
|
|
3
|
+
-- no tenant column and no policy, exactly like the enrolled factor tables; the
|
|
4
|
+
-- membership tables remain the only place the workspace boundary is expressed.
|
|
5
|
+
-- The (provider, subject) pair is the identity the provider promises to keep
|
|
6
|
+
-- stable, so it is the primary key; the address it reports is not.
|
|
7
|
+
CREATE TABLE IF NOT EXISTS auth_external_identities (
|
|
8
|
+
provider TEXT NOT NULL,
|
|
9
|
+
subject TEXT NOT NULL,
|
|
10
|
+
account_id TEXT NOT NULL REFERENCES auth_accounts(id) ON DELETE CASCADE,
|
|
11
|
+
created_at BIGINT NOT NULL,
|
|
12
|
+
last_seen_at BIGINT NOT NULL,
|
|
13
|
+
PRIMARY KEY (provider, subject)
|
|
14
|
+
);
|
|
15
|
+
CREATE INDEX IF NOT EXISTS auth_external_identities_account_idx
|
|
16
|
+
ON auth_external_identities (account_id, provider, subject);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- The TOTP envelope in secret_ciphertext names no key, so rotating
|
|
2
|
+
-- FD_AUTH_MFA_KEY could only be recovered by re-enrolling every account. This
|
|
3
|
+
-- column records the key that sealed the row. A row written before it keeps
|
|
4
|
+
-- NULL and is opened by trying the ring in order until auth secrets-rotate
|
|
5
|
+
-- re-seals it; the envelope bytes themselves are unchanged. The factor belongs
|
|
6
|
+
-- to the account, not to one of its workspaces, so the table carries no tenant
|
|
7
|
+
-- column and no policy, exactly as 0015 created it.
|
|
8
|
+
ALTER TABLE auth_mfa_totp ADD COLUMN IF NOT EXISTS key_id TEXT;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
-- The parties and catalog modules no longer ship, and their read and manage
|
|
2
|
+
-- scopes are still granted to memberships created while they did. A grant that
|
|
3
|
+
-- nothing declares is a grant nobody reviews, so both pairs are retired here.
|
|
4
|
+
--
|
|
5
|
+
-- Row security is forced on both tables, and a migration role that is not a
|
|
6
|
+
-- superuser is subject to it like any other, so a plain statement would reach
|
|
7
|
+
-- no row on a real deployment. The force flag is lifted for the owner and put
|
|
8
|
+
-- back inside the same transaction; a role that does not own these tables
|
|
9
|
+
-- fails here loudly instead of leaving the grants in place. Nothing else runs
|
|
10
|
+
-- against them while the migration lock is held.
|
|
11
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
12
|
+
DELETE FROM auth_membership_scopes
|
|
13
|
+
WHERE scope IN ('parties.records.read', 'parties.records.manage', 'catalog.items.read', 'catalog.items.manage');
|
|
14
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
15
|
+
-- A role row grants too: assigning a role replaces the membership scopes with
|
|
16
|
+
-- the list it carries, so a retired scope left in one comes back on the next
|
|
17
|
+
-- assignment. Only rows that still name one are rewritten, and their order is
|
|
18
|
+
-- preserved.
|
|
19
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
20
|
+
UPDATE auth_roles
|
|
21
|
+
SET scopes_json = COALESCE(
|
|
22
|
+
(SELECT json_agg(entry.scope ORDER BY entry.position)::text
|
|
23
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
24
|
+
WITH ORDINALITY AS entry(scope, position)
|
|
25
|
+
WHERE entry.scope NOT IN ('parties.records.read', 'parties.records.manage', 'catalog.items.read', 'catalog.items.manage')),
|
|
26
|
+
'[]')
|
|
27
|
+
WHERE scopes_json LIKE '%"parties.records.%'
|
|
28
|
+
OR scopes_json LIKE '%"catalog.items.%';
|
|
29
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
-- notifications.core declares five permissions. Owners receive all five through
|
|
2
|
+
-- auth sync-scopes, which module enable runs; members receive none, because the
|
|
3
|
+
-- member defaults live in acl/scopes.ts and a built-in role row is seeded once,
|
|
4
|
+
-- with ON CONFLICT DO NOTHING, when the workspace is created. So a workspace
|
|
5
|
+
-- that already exists would never see the three member scopes. This grants them.
|
|
6
|
+
--
|
|
7
|
+
-- Row security is forced on both tables, and a migration role that is not a
|
|
8
|
+
-- superuser is subject to it like any other, so a plain statement would reach
|
|
9
|
+
-- no row on a real deployment. The force flag is lifted for the owner and put
|
|
10
|
+
-- back inside the same transaction; a role that does not own these tables fails
|
|
11
|
+
-- here loudly instead of leaving the grants missing. Nothing else runs against
|
|
12
|
+
-- them while the migration lock is held.
|
|
13
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
14
|
+
INSERT INTO auth_membership_scopes (account_id, tenant_id, scope)
|
|
15
|
+
SELECT account_id, tenant_id, scope
|
|
16
|
+
FROM auth_memberships
|
|
17
|
+
CROSS JOIN unnest(ARRAY['notifications.inbox.read', 'notifications.inbox.manage', 'notifications.webhooks.read']) AS granted(scope)
|
|
18
|
+
WHERE auth_memberships.role = 'member'
|
|
19
|
+
ON CONFLICT DO NOTHING;
|
|
20
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
21
|
+
-- A role row grants too: assigning a role replaces the membership scopes with
|
|
22
|
+
-- the list it carries, so a scope missing from the built-in member row would be
|
|
23
|
+
-- taken away again at the next assignment. The scopes already held keep their
|
|
24
|
+
-- order and the missing ones are appended in the order acl/scopes.ts declares
|
|
25
|
+
-- them, which is the order a freshly seeded workspace writes.
|
|
26
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
27
|
+
UPDATE auth_roles
|
|
28
|
+
SET scopes_json = (
|
|
29
|
+
SELECT json_agg(entry.scope ORDER BY entry.origin, entry.position)::text
|
|
30
|
+
FROM (
|
|
31
|
+
SELECT 0 AS origin, held.position, held.scope
|
|
32
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
33
|
+
WITH ORDINALITY AS held(scope, position)
|
|
34
|
+
UNION ALL
|
|
35
|
+
SELECT 1 AS origin, added.position, added.scope
|
|
36
|
+
FROM unnest(ARRAY['notifications.inbox.read', 'notifications.inbox.manage', 'notifications.webhooks.read'])
|
|
37
|
+
WITH ORDINALITY AS added(scope, position)
|
|
38
|
+
WHERE added.scope NOT IN (
|
|
39
|
+
SELECT existing.scope
|
|
40
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json) AS existing(scope))
|
|
41
|
+
) AS entry
|
|
42
|
+
)
|
|
43
|
+
WHERE builtin = 1 AND key = 'member';
|
|
44
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
-- A workspace may offer OIDC providers of its own beside the platform providers
|
|
2
|
+
-- FD_AUTH_OIDC_PROVIDERS configures at boot. Such a provider is workspace data,
|
|
3
|
+
-- so the row carries the tenant column and the forced policy every
|
|
4
|
+
-- workspace-owned table carries. The client secret is stored only as the sealed
|
|
5
|
+
-- envelope the auth keyring writes, beside the id of the key that sealed it, so
|
|
6
|
+
-- auth secrets-rotate re-seals these rows exactly as it re-seals enrolled
|
|
7
|
+
-- factors. The discovery endpoints are stored because they are what discovery
|
|
8
|
+
-- answered when the issuer was verified, not administrator input; keeping them
|
|
9
|
+
-- means a sign-in costs no outbound discovery request.
|
|
10
|
+
CREATE TABLE IF NOT EXISTS auth_identity_providers (
|
|
11
|
+
id TEXT PRIMARY KEY,
|
|
12
|
+
tenant_id TEXT NOT NULL REFERENCES auth_tenants(id) ON DELETE CASCADE,
|
|
13
|
+
key TEXT NOT NULL,
|
|
14
|
+
label TEXT NOT NULL,
|
|
15
|
+
issuer TEXT NOT NULL,
|
|
16
|
+
authorization_endpoint TEXT NOT NULL,
|
|
17
|
+
token_endpoint TEXT NOT NULL,
|
|
18
|
+
user_info_endpoint TEXT NOT NULL,
|
|
19
|
+
client_id TEXT NOT NULL,
|
|
20
|
+
client_secret_ciphertext TEXT NOT NULL,
|
|
21
|
+
client_secret_key_id TEXT NOT NULL,
|
|
22
|
+
client_secret_fingerprint TEXT NOT NULL,
|
|
23
|
+
scopes_json TEXT NOT NULL,
|
|
24
|
+
jit_enabled INTEGER NOT NULL DEFAULT 0,
|
|
25
|
+
allowed_domains_json TEXT NOT NULL DEFAULT '[]',
|
|
26
|
+
jit_role TEXT NOT NULL DEFAULT 'member',
|
|
27
|
+
status TEXT NOT NULL CHECK (status IN ('active', 'disabled')),
|
|
28
|
+
created_at BIGINT NOT NULL,
|
|
29
|
+
updated_at BIGINT NOT NULL,
|
|
30
|
+
UNIQUE (tenant_id, key)
|
|
31
|
+
);
|
|
32
|
+
CREATE INDEX IF NOT EXISTS auth_identity_providers_tenant_idx
|
|
33
|
+
ON auth_identity_providers (tenant_id, key, id);
|
|
34
|
+
ALTER TABLE auth_identity_providers ENABLE ROW LEVEL SECURITY;
|
|
35
|
+
ALTER TABLE auth_identity_providers FORCE ROW LEVEL SECURITY;
|
|
36
|
+
CREATE POLICY auth_identity_providers_tenant_policy ON auth_identity_providers
|
|
37
|
+
USING (tenant_id = current_setting('coreloom.tenant_id', true))
|
|
38
|
+
WITH CHECK (tenant_id = current_setting('coreloom.tenant_id', true));
|
|
39
|
+
|
|
40
|
+
-- A platform provider asserts an identity about an account before any workspace
|
|
41
|
+
-- is chosen, and keeps binding without one. A tenant-owned provider asserts it
|
|
42
|
+
-- inside its own workspace only, so the binding carries that workspace and the
|
|
43
|
+
-- pair (provider, subject) is unique per workspace rather than globally. The
|
|
44
|
+
-- primary key 0016 put on the pair would let one workspace's binding block
|
|
45
|
+
-- another's, so it goes and two partial unique indexes take its place.
|
|
46
|
+
ALTER TABLE auth_external_identities
|
|
47
|
+
ADD COLUMN IF NOT EXISTS tenant_id TEXT REFERENCES auth_tenants(id) ON DELETE CASCADE;
|
|
48
|
+
ALTER TABLE auth_external_identities
|
|
49
|
+
DROP CONSTRAINT IF EXISTS auth_external_identities_pkey;
|
|
50
|
+
CREATE UNIQUE INDEX IF NOT EXISTS auth_external_identities_platform_idx
|
|
51
|
+
ON auth_external_identities (provider, subject) WHERE tenant_id IS NULL;
|
|
52
|
+
CREATE UNIQUE INDEX IF NOT EXISTS auth_external_identities_workspace_idx
|
|
53
|
+
ON auth_external_identities (tenant_id, provider, subject) WHERE tenant_id IS NOT NULL;
|
|
54
|
+
-- The workspace rows are workspace data and the policy scopes them to their
|
|
55
|
+
-- tenant; the platform rows carry no workspace and stay readable under the
|
|
56
|
+
-- identity context that has always written them.
|
|
57
|
+
ALTER TABLE auth_external_identities ENABLE ROW LEVEL SECURITY;
|
|
58
|
+
ALTER TABLE auth_external_identities FORCE ROW LEVEL SECURITY;
|
|
59
|
+
CREATE POLICY auth_external_identities_tenant_policy ON auth_external_identities
|
|
60
|
+
USING (tenant_id IS NULL OR tenant_id = current_setting('coreloom.tenant_id', true))
|
|
61
|
+
WITH CHECK (tenant_id IS NULL OR tenant_id = current_setting('coreloom.tenant_id', true));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
-- Membership status is per workspace: disabling a member in one workspace
|
|
2
|
+
-- revokes that membership's sessions and tokens and refuses its sign-in, and
|
|
3
|
+
-- leaves the person's other memberships untouched. The account status column
|
|
4
|
+
-- stays what it was, the deployment operator's platform-level block.
|
|
5
|
+
ALTER TABLE auth_memberships ADD COLUMN IF NOT EXISTS status TEXT NOT NULL DEFAULT 'active';
|
|
6
|
+
DO $$
|
|
7
|
+
BEGIN
|
|
8
|
+
IF NOT EXISTS (
|
|
9
|
+
SELECT 1 FROM pg_constraint WHERE conname = 'auth_memberships_status_check'
|
|
10
|
+
) THEN
|
|
11
|
+
ALTER TABLE auth_memberships ADD CONSTRAINT auth_memberships_status_check
|
|
12
|
+
CHECK (status IN ('active', 'disabled'));
|
|
13
|
+
END IF;
|
|
14
|
+
END
|
|
15
|
+
$$;
|
|
16
|
+
-- A session cookie, a bearer token and an email address name no workspace, so
|
|
17
|
+
-- the routing read decides which membership answers for them. A disabled
|
|
18
|
+
-- membership must not be that answer, which is a column this role now reads.
|
|
19
|
+
GRANT SELECT (status) ON auth_memberships TO coreloom_background;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
-- auth.core declares auth.providers.read and auth.providers.manage for the
|
|
2
|
+
-- workspace identity providers screen. A module's scopes reach existing owners
|
|
3
|
+
-- through auth sync-scopes, which module enable runs, but auth.core is not a
|
|
4
|
+
-- module a deployment enables, and the built-in role rows are seeded once, with
|
|
5
|
+
-- ON CONFLICT DO NOTHING, when a workspace is created. So a workspace that
|
|
6
|
+
-- already exists would never see either scope. This grants them.
|
|
7
|
+
--
|
|
8
|
+
-- Row security is forced on both tables, and a migration role that is not a
|
|
9
|
+
-- superuser is subject to it like any other, so a plain statement would reach
|
|
10
|
+
-- no row on a real deployment. The force flag is lifted for the owner and put
|
|
11
|
+
-- back inside the same transaction; a role that does not own these tables fails
|
|
12
|
+
-- here loudly instead of leaving the grants missing. Nothing else runs against
|
|
13
|
+
-- them while the migration lock is held.
|
|
14
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
15
|
+
INSERT INTO auth_membership_scopes (account_id, tenant_id, scope)
|
|
16
|
+
SELECT account_id, tenant_id, scope
|
|
17
|
+
FROM auth_memberships
|
|
18
|
+
CROSS JOIN unnest(ARRAY['auth.providers.read', 'auth.providers.manage']) AS granted(scope)
|
|
19
|
+
WHERE auth_memberships.role = 'owner'
|
|
20
|
+
ON CONFLICT DO NOTHING;
|
|
21
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
22
|
+
-- A role row grants too: assigning a role replaces the membership scopes with
|
|
23
|
+
-- the list it carries, so a scope missing from the built-in owner row would be
|
|
24
|
+
-- taken away again at the next assignment. The scopes already held keep their
|
|
25
|
+
-- order and the missing ones are appended in the order acl/scopes.ts declares
|
|
26
|
+
-- them, which is the order a freshly seeded workspace writes.
|
|
27
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
28
|
+
UPDATE auth_roles
|
|
29
|
+
SET scopes_json = (
|
|
30
|
+
SELECT json_agg(entry.scope ORDER BY entry.origin, entry.position)::text
|
|
31
|
+
FROM (
|
|
32
|
+
SELECT 0 AS origin, held.position, held.scope
|
|
33
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
34
|
+
WITH ORDINALITY AS held(scope, position)
|
|
35
|
+
UNION ALL
|
|
36
|
+
SELECT 1 AS origin, added.position, added.scope
|
|
37
|
+
FROM unnest(ARRAY['auth.providers.read', 'auth.providers.manage'])
|
|
38
|
+
WITH ORDINALITY AS added(scope, position)
|
|
39
|
+
WHERE added.scope NOT IN (
|
|
40
|
+
SELECT existing.scope
|
|
41
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json) AS existing(scope))
|
|
42
|
+
) AS entry
|
|
43
|
+
)
|
|
44
|
+
WHERE builtin = 1 AND key = 'owner';
|
|
45
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
-- Documentation only; Flowdular never executes a down script. Reversing 0023
|
|
2
|
+
-- means retiring the sixteen scopes the way 0018 retires a scope: delete them
|
|
3
|
+
-- from every membership and rewrite every role row that still names one. It
|
|
4
|
+
-- cannot distinguish a grant this migration made from one auth sync-scopes made
|
|
5
|
+
-- for an enabled module, so running it revokes both.
|
|
6
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
7
|
+
DELETE FROM auth_membership_scopes
|
|
8
|
+
WHERE scope IN ('directory.tokens.read', 'directory.tokens.manage', 'directory.provisioning.read', 'audit.registry.read', 'audit.retention.manage', 'approvals.requests.read', 'approvals.requests.decide', 'approvals.requests.manage', 'documents.files.read', 'documents.files.manage', 'metering.usage.read', 'import.jobs.read', 'import.jobs.manage', 'search.records.read', 'connectors.instances.read', 'connectors.instances.manage');
|
|
9
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
10
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
11
|
+
UPDATE auth_roles
|
|
12
|
+
SET scopes_json = COALESCE(
|
|
13
|
+
(SELECT json_agg(entry.scope ORDER BY entry.position)::text
|
|
14
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
15
|
+
WITH ORDINALITY AS entry(scope, position)
|
|
16
|
+
WHERE entry.scope NOT IN ('directory.tokens.read', 'directory.tokens.manage', 'directory.provisioning.read', 'audit.registry.read', 'audit.retention.manage', 'approvals.requests.read', 'approvals.requests.decide', 'approvals.requests.manage', 'documents.files.read', 'documents.files.manage', 'metering.usage.read', 'import.jobs.read', 'import.jobs.manage', 'search.records.read', 'connectors.instances.read', 'connectors.instances.manage')),
|
|
17
|
+
'[]')
|
|
18
|
+
WHERE builtin = 1;
|
|
19
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
-- directory.core, audit.core, approvals.core, documents.core, metering.core,
|
|
2
|
+
-- import.core, search.core and connectors.core declare sixteen permissions
|
|
3
|
+
-- between them. Owners receive a module's scopes through auth sync-scopes,
|
|
4
|
+
-- which module enable runs, so only where that module is enabled; members
|
|
5
|
+
-- receive none, because the member defaults live in acl/scopes.ts and a
|
|
6
|
+
-- built-in role row is seeded once, with ON CONFLICT DO NOTHING, when the
|
|
7
|
+
-- workspace is created. So a workspace that already exists would see neither
|
|
8
|
+
-- the owner defaults of a module it never enabled nor any member default. This
|
|
9
|
+
-- grants both, in the order acl/scopes.ts declares them.
|
|
10
|
+
--
|
|
11
|
+
-- Row security is forced on both tables, and a migration role that is not a
|
|
12
|
+
-- superuser is subject to it like any other, so a plain statement would reach
|
|
13
|
+
-- no row on a real deployment. The force flag is lifted for the owner and put
|
|
14
|
+
-- back inside the same transaction; a role that does not own these tables fails
|
|
15
|
+
-- here loudly instead of leaving the grants missing. Nothing else runs against
|
|
16
|
+
-- them while the migration lock is held.
|
|
17
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
18
|
+
INSERT INTO auth_membership_scopes (account_id, tenant_id, scope)
|
|
19
|
+
SELECT account_id, tenant_id, scope
|
|
20
|
+
FROM auth_memberships
|
|
21
|
+
CROSS JOIN unnest(ARRAY['directory.tokens.read', 'directory.tokens.manage', 'directory.provisioning.read', 'audit.registry.read', 'audit.retention.manage', 'approvals.requests.read', 'approvals.requests.decide', 'approvals.requests.manage', 'documents.files.read', 'documents.files.manage', 'metering.usage.read', 'import.jobs.read', 'import.jobs.manage', 'search.records.read', 'connectors.instances.read', 'connectors.instances.manage']) AS granted(scope)
|
|
22
|
+
WHERE auth_memberships.role = 'owner'
|
|
23
|
+
ON CONFLICT DO NOTHING;
|
|
24
|
+
INSERT INTO auth_membership_scopes (account_id, tenant_id, scope)
|
|
25
|
+
SELECT account_id, tenant_id, scope
|
|
26
|
+
FROM auth_memberships
|
|
27
|
+
CROSS JOIN unnest(ARRAY['documents.files.read', 'documents.files.manage', 'search.records.read', 'connectors.instances.read']) AS granted(scope)
|
|
28
|
+
WHERE auth_memberships.role = 'member'
|
|
29
|
+
ON CONFLICT DO NOTHING;
|
|
30
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
31
|
+
-- A role row grants too: assigning a role replaces the membership scopes with
|
|
32
|
+
-- the list it carries, so a scope missing from a built-in row would be taken
|
|
33
|
+
-- away again at the next assignment. The scopes already held keep their order
|
|
34
|
+
-- and the missing ones are appended in the order acl/scopes.ts declares them,
|
|
35
|
+
-- which is the order a freshly seeded workspace writes.
|
|
36
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
37
|
+
UPDATE auth_roles
|
|
38
|
+
SET scopes_json = (
|
|
39
|
+
SELECT json_agg(entry.scope ORDER BY entry.origin, entry.position)::text
|
|
40
|
+
FROM (
|
|
41
|
+
SELECT 0 AS origin, held.position, held.scope
|
|
42
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
43
|
+
WITH ORDINALITY AS held(scope, position)
|
|
44
|
+
UNION ALL
|
|
45
|
+
SELECT 1 AS origin, added.position, added.scope
|
|
46
|
+
FROM unnest(ARRAY['directory.tokens.read', 'directory.tokens.manage', 'directory.provisioning.read', 'audit.registry.read', 'audit.retention.manage', 'approvals.requests.read', 'approvals.requests.decide', 'approvals.requests.manage', 'documents.files.read', 'documents.files.manage', 'metering.usage.read', 'import.jobs.read', 'import.jobs.manage', 'search.records.read', 'connectors.instances.read', 'connectors.instances.manage'])
|
|
47
|
+
WITH ORDINALITY AS added(scope, position)
|
|
48
|
+
WHERE added.scope NOT IN (
|
|
49
|
+
SELECT existing.scope
|
|
50
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json) AS existing(scope))
|
|
51
|
+
) AS entry
|
|
52
|
+
)
|
|
53
|
+
WHERE builtin = 1 AND key = 'owner';
|
|
54
|
+
UPDATE auth_roles
|
|
55
|
+
SET scopes_json = (
|
|
56
|
+
SELECT json_agg(entry.scope ORDER BY entry.origin, entry.position)::text
|
|
57
|
+
FROM (
|
|
58
|
+
SELECT 0 AS origin, held.position, held.scope
|
|
59
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
60
|
+
WITH ORDINALITY AS held(scope, position)
|
|
61
|
+
UNION ALL
|
|
62
|
+
SELECT 1 AS origin, added.position, added.scope
|
|
63
|
+
FROM unnest(ARRAY['documents.files.read', 'documents.files.manage', 'search.records.read', 'connectors.instances.read'])
|
|
64
|
+
WITH ORDINALITY AS added(scope, position)
|
|
65
|
+
WHERE added.scope NOT IN (
|
|
66
|
+
SELECT existing.scope
|
|
67
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json) AS existing(scope))
|
|
68
|
+
) AS entry
|
|
69
|
+
)
|
|
70
|
+
WHERE builtin = 1 AND key = 'member';
|
|
71
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- Documentation only; Flowdular never executes a down script. Reversing 0024
|
|
2
|
+
-- means taking the two scopes back from every member membership and from the
|
|
3
|
+
-- built-in member role row. It cannot distinguish a grant this migration made
|
|
4
|
+
-- from one a workspace made by assigning a role that names the scope. The owner
|
|
5
|
+
-- grants of 0023 survive it: no owner membership and no owner role row is
|
|
6
|
+
-- rewritten here.
|
|
7
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
8
|
+
DELETE FROM auth_membership_scopes
|
|
9
|
+
WHERE scope IN ('approvals.requests.read', 'approvals.requests.decide')
|
|
10
|
+
AND (account_id, tenant_id) IN (
|
|
11
|
+
SELECT account_id, tenant_id FROM auth_memberships WHERE role = 'member');
|
|
12
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
13
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
14
|
+
UPDATE auth_roles
|
|
15
|
+
SET scopes_json = COALESCE(
|
|
16
|
+
(SELECT json_agg(entry.scope ORDER BY entry.position)::text
|
|
17
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
18
|
+
WITH ORDINALITY AS entry(scope, position)
|
|
19
|
+
WHERE entry.scope NOT IN ('approvals.requests.read', 'approvals.requests.decide')),
|
|
20
|
+
'[]')
|
|
21
|
+
WHERE builtin = 1 AND key = 'member';
|
|
22
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
-- approvals.core resolves the deciders of a request from the workspace roles,
|
|
2
|
+
-- so a member has to read the requests that name them and record a decision on
|
|
3
|
+
-- them. 0023 granted the three approval scopes to owners alone, which was the
|
|
4
|
+
-- member default at the time; acl/scopes.ts now carries approvals.requests.read
|
|
5
|
+
-- and approvals.requests.decide among the member defaults, and a built-in role
|
|
6
|
+
-- row is seeded once, with ON CONFLICT DO NOTHING, when the workspace is
|
|
7
|
+
-- created. So a workspace that already exists would never see either. This
|
|
8
|
+
-- grants both to its members, in the order acl/scopes.ts declares them. Owners
|
|
9
|
+
-- keep what 0023 gave them and are not touched here.
|
|
10
|
+
--
|
|
11
|
+
-- Row security is forced on both tables, and a migration role that is not a
|
|
12
|
+
-- superuser is subject to it like any other, so a plain statement would reach
|
|
13
|
+
-- no row on a real deployment. The force flag is lifted for the owner and put
|
|
14
|
+
-- back inside the same transaction; a role that does not own these tables fails
|
|
15
|
+
-- here loudly instead of leaving the grants missing. Nothing else runs against
|
|
16
|
+
-- them while the migration lock is held.
|
|
17
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
18
|
+
INSERT INTO auth_membership_scopes (account_id, tenant_id, scope)
|
|
19
|
+
SELECT account_id, tenant_id, scope
|
|
20
|
+
FROM auth_memberships
|
|
21
|
+
CROSS JOIN unnest(ARRAY['approvals.requests.read', 'approvals.requests.decide']) AS granted(scope)
|
|
22
|
+
WHERE auth_memberships.role = 'member'
|
|
23
|
+
ON CONFLICT DO NOTHING;
|
|
24
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
25
|
+
-- A role row grants too: assigning a role replaces the membership scopes with
|
|
26
|
+
-- the list it carries, so a scope missing from the built-in member row would be
|
|
27
|
+
-- taken away again at the next assignment. The scopes already held keep their
|
|
28
|
+
-- order and the missing ones are appended in the order acl/scopes.ts declares
|
|
29
|
+
-- them, which is the order a freshly seeded workspace writes.
|
|
30
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
31
|
+
UPDATE auth_roles
|
|
32
|
+
SET scopes_json = (
|
|
33
|
+
SELECT json_agg(entry.scope ORDER BY entry.origin, entry.position)::text
|
|
34
|
+
FROM (
|
|
35
|
+
SELECT 0 AS origin, held.position, held.scope
|
|
36
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
37
|
+
WITH ORDINALITY AS held(scope, position)
|
|
38
|
+
UNION ALL
|
|
39
|
+
SELECT 1 AS origin, added.position, added.scope
|
|
40
|
+
FROM unnest(ARRAY['approvals.requests.read', 'approvals.requests.decide'])
|
|
41
|
+
WITH ORDINALITY AS added(scope, position)
|
|
42
|
+
WHERE added.scope NOT IN (
|
|
43
|
+
SELECT existing.scope
|
|
44
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json) AS existing(scope))
|
|
45
|
+
) AS entry
|
|
46
|
+
)
|
|
47
|
+
WHERE builtin = 1 AND key = 'member';
|
|
48
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- Documentation only; Flowdular never executes a down script. Reversing 0025
|
|
2
|
+
-- means taking audit.holds.manage back from every owner membership and from the
|
|
3
|
+
-- built-in owner role row. It cannot distinguish a grant this migration made
|
|
4
|
+
-- from one a workspace made by assigning a role that names the scope. Nothing
|
|
5
|
+
-- 0023 or 0024 granted is rewritten here.
|
|
6
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
7
|
+
DELETE FROM auth_membership_scopes
|
|
8
|
+
WHERE scope = 'audit.holds.manage'
|
|
9
|
+
AND (account_id, tenant_id) IN (
|
|
10
|
+
SELECT account_id, tenant_id FROM auth_memberships WHERE role = 'owner');
|
|
11
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
12
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
13
|
+
UPDATE auth_roles
|
|
14
|
+
SET scopes_json = COALESCE(
|
|
15
|
+
(SELECT json_agg(entry.scope ORDER BY entry.position)::text
|
|
16
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
17
|
+
WITH ORDINALITY AS entry(scope, position)
|
|
18
|
+
WHERE entry.scope <> 'audit.holds.manage'),
|
|
19
|
+
'[]')
|
|
20
|
+
WHERE builtin = 1 AND key = 'owner';
|
|
21
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
-- audit.core declares audit.holds.manage, and D-AUDIT-HOLD-PERMISSION keeps it
|
|
2
|
+
-- with owners: only an owner places or lifts a legal hold. The permission was
|
|
3
|
+
-- declared after 0023 backfilled the enterprise module scopes, so an existing
|
|
4
|
+
-- workspace carries it on neither its owner memberships nor its built-in owner
|
|
5
|
+
-- role row. auth sync-scopes grants a module's declared scopes when the module
|
|
6
|
+
-- is enabled, and audit.core was already enabled when this one appeared, so
|
|
7
|
+
-- that path does not reach it either. This grants it to every owner
|
|
8
|
+
-- membership and appends it to the built-in owner role row. Members receive
|
|
9
|
+
-- nothing here: D-AUDIT-PERMISSIONS keeps every audit permission owner-only.
|
|
10
|
+
--
|
|
11
|
+
-- Row security is forced on both tables, and a migration role that is not a
|
|
12
|
+
-- superuser is subject to it like any other, so a plain statement would reach
|
|
13
|
+
-- no row on a real deployment. The force flag is lifted for the owner and put
|
|
14
|
+
-- back inside the same transaction; a role that does not own these tables fails
|
|
15
|
+
-- here loudly instead of leaving the grants missing. Nothing else runs against
|
|
16
|
+
-- them while the migration lock is held.
|
|
17
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
18
|
+
INSERT INTO auth_membership_scopes (account_id, tenant_id, scope)
|
|
19
|
+
SELECT account_id, tenant_id, scope
|
|
20
|
+
FROM auth_memberships
|
|
21
|
+
CROSS JOIN unnest(ARRAY['audit.holds.manage']) AS granted(scope)
|
|
22
|
+
WHERE auth_memberships.role = 'owner'
|
|
23
|
+
ON CONFLICT DO NOTHING;
|
|
24
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
25
|
+
-- A role row grants too: assigning a role replaces the membership scopes with
|
|
26
|
+
-- the list it carries, so a scope missing from the built-in owner row would be
|
|
27
|
+
-- taken away again at the next assignment. The scopes already held keep their
|
|
28
|
+
-- order and the missing one is appended.
|
|
29
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
30
|
+
UPDATE auth_roles
|
|
31
|
+
SET scopes_json = (
|
|
32
|
+
SELECT json_agg(entry.scope ORDER BY entry.origin, entry.position)::text
|
|
33
|
+
FROM (
|
|
34
|
+
SELECT 0 AS origin, held.position, held.scope
|
|
35
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
36
|
+
WITH ORDINALITY AS held(scope, position)
|
|
37
|
+
UNION ALL
|
|
38
|
+
SELECT 1 AS origin, added.position, added.scope
|
|
39
|
+
FROM unnest(ARRAY['audit.holds.manage'])
|
|
40
|
+
WITH ORDINALITY AS added(scope, position)
|
|
41
|
+
WHERE added.scope NOT IN (
|
|
42
|
+
SELECT existing.scope
|
|
43
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json) AS existing(scope))
|
|
44
|
+
) AS entry
|
|
45
|
+
)
|
|
46
|
+
WHERE builtin = 1 AND key = 'owner';
|
|
47
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- Documentation only; Flowdular never executes a down script. Reversing 0026
|
|
2
|
+
-- drops the three keyset indexes. No row and no constraint depends on them, so
|
|
3
|
+
-- the only consequence is that an export walk sorts each page again.
|
|
4
|
+
DROP INDEX IF EXISTS auth_sessions_tenant_keyset_idx;
|
|
5
|
+
DROP INDEX IF EXISTS auth_api_tokens_tenant_keyset_idx;
|
|
6
|
+
DROP INDEX IF EXISTS auth_audit_tenant_keyset_idx;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
-- The three data class export walks page one workspace by keyset:
|
|
2
|
+
-- WHERE tenant_id = $1 AND id > $2 ORDER BY id LIMIT $3. No index ordered that
|
|
3
|
+
-- pair, so every page sorted the whole workspace again: auth_sessions carried
|
|
4
|
+
-- (account_id, expires_at), (expires_at) and a unique (id); auth_api_tokens
|
|
5
|
+
-- (tenant_id, revoked_at, created_at DESC); auth_audit
|
|
6
|
+
-- (tenant_id, occurred_at DESC, id DESC). These three turn each page into an
|
|
7
|
+
-- index range scan of exactly the rows it returns, which is what makes an
|
|
8
|
+
-- export of a large workspace linear in the rows it carries rather than
|
|
9
|
+
-- quadratic in them.
|
|
10
|
+
CREATE INDEX IF NOT EXISTS auth_sessions_tenant_keyset_idx
|
|
11
|
+
ON auth_sessions (tenant_id, id);
|
|
12
|
+
CREATE INDEX IF NOT EXISTS auth_api_tokens_tenant_keyset_idx
|
|
13
|
+
ON auth_api_tokens (tenant_id, id);
|
|
14
|
+
CREATE INDEX IF NOT EXISTS auth_audit_tenant_keyset_idx
|
|
15
|
+
ON auth_audit (tenant_id, id);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
-- Documentation only; Flowdular never executes a down script. Reversing 0027
|
|
2
|
+
-- means taking the eleven scopes back from every owner membership and from the
|
|
3
|
+
-- built-in owner role row, and profile.self.manage back from every member
|
|
4
|
+
-- membership and the built-in member role row. It cannot distinguish a grant
|
|
5
|
+
-- this migration made from one a workspace made by assigning a role that names
|
|
6
|
+
-- the scope. Nothing 0023, 0024 or 0025 granted is rewritten here.
|
|
7
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
8
|
+
DELETE FROM auth_membership_scopes
|
|
9
|
+
WHERE scope IN ('workflows.definitions.read', 'workflows.definitions.manage', 'workflows.definitions.publish', 'workflows.runs.read', 'workflows.runs.execute', 'workflows.runs.cancel', 'automations.schedules.read', 'automations.schedules.manage', 'automations.triggers.read', 'automations.triggers.manage', 'profile.self.manage')
|
|
10
|
+
AND (account_id, tenant_id) IN (
|
|
11
|
+
SELECT account_id, tenant_id FROM auth_memberships WHERE role = 'owner');
|
|
12
|
+
DELETE FROM auth_membership_scopes
|
|
13
|
+
WHERE scope = 'profile.self.manage'
|
|
14
|
+
AND (account_id, tenant_id) IN (
|
|
15
|
+
SELECT account_id, tenant_id FROM auth_memberships WHERE role = 'member');
|
|
16
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
17
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
18
|
+
UPDATE auth_roles
|
|
19
|
+
SET scopes_json = COALESCE(
|
|
20
|
+
(SELECT json_agg(entry.scope ORDER BY entry.position)::text
|
|
21
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
22
|
+
WITH ORDINALITY AS entry(scope, position)
|
|
23
|
+
WHERE entry.scope NOT IN ('workflows.definitions.read', 'workflows.definitions.manage', 'workflows.definitions.publish', 'workflows.runs.read', 'workflows.runs.execute', 'workflows.runs.cancel', 'automations.schedules.read', 'automations.schedules.manage', 'automations.triggers.read', 'automations.triggers.manage', 'profile.self.manage')),
|
|
24
|
+
'[]')
|
|
25
|
+
WHERE builtin = 1 AND key = 'owner';
|
|
26
|
+
UPDATE auth_roles
|
|
27
|
+
SET scopes_json = COALESCE(
|
|
28
|
+
(SELECT json_agg(entry.scope ORDER BY entry.position)::text
|
|
29
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
30
|
+
WITH ORDINALITY AS entry(scope, position)
|
|
31
|
+
WHERE entry.scope <> 'profile.self.manage'),
|
|
32
|
+
'[]')
|
|
33
|
+
WHERE builtin = 1 AND key = 'member';
|
|
34
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
-- workflows.core, automations.core and profile.core declare eleven permissions
|
|
2
|
+
-- between them, and owners hold every permission an enabled module declares.
|
|
3
|
+
-- All three were already enabled when the owner defaults gained them, so auth
|
|
4
|
+
-- sync-scopes does not reach an existing workspace: it grants a module's scopes
|
|
5
|
+
-- when the module is enabled and to the workspaces that exist at that moment.
|
|
6
|
+
-- The seed lists in acl/scopes.ts reach a workspace created from now on and no
|
|
7
|
+
-- earlier one. This grants the eleven to every owner membership and appends
|
|
8
|
+
-- them to the built-in owner role row. Members receive profile.self.manage
|
|
9
|
+
-- alone, because every member manages their own profile, language, password
|
|
10
|
+
-- and sessions, while the workflow and automation permissions stay with owners.
|
|
11
|
+
--
|
|
12
|
+
-- Row security is forced on both tables, and a migration role that is not a
|
|
13
|
+
-- superuser is subject to it like any other, so a plain statement would reach
|
|
14
|
+
-- no row on a real deployment. The force flag is lifted for the owner and put
|
|
15
|
+
-- back inside the same transaction; a role that does not own these tables fails
|
|
16
|
+
-- here loudly instead of leaving the grants missing. Nothing else runs against
|
|
17
|
+
-- them while the migration lock is held.
|
|
18
|
+
ALTER TABLE auth_membership_scopes NO FORCE ROW LEVEL SECURITY;
|
|
19
|
+
INSERT INTO auth_membership_scopes (account_id, tenant_id, scope)
|
|
20
|
+
SELECT account_id, tenant_id, scope
|
|
21
|
+
FROM auth_memberships
|
|
22
|
+
CROSS JOIN unnest(ARRAY['workflows.definitions.read', 'workflows.definitions.manage', 'workflows.definitions.publish', 'workflows.runs.read', 'workflows.runs.execute', 'workflows.runs.cancel', 'automations.schedules.read', 'automations.schedules.manage', 'automations.triggers.read', 'automations.triggers.manage', 'profile.self.manage']) AS granted(scope)
|
|
23
|
+
WHERE auth_memberships.role = 'owner'
|
|
24
|
+
ON CONFLICT DO NOTHING;
|
|
25
|
+
INSERT INTO auth_membership_scopes (account_id, tenant_id, scope)
|
|
26
|
+
SELECT account_id, tenant_id, scope
|
|
27
|
+
FROM auth_memberships
|
|
28
|
+
CROSS JOIN unnest(ARRAY['profile.self.manage']) AS granted(scope)
|
|
29
|
+
WHERE auth_memberships.role = 'member'
|
|
30
|
+
ON CONFLICT DO NOTHING;
|
|
31
|
+
ALTER TABLE auth_membership_scopes FORCE ROW LEVEL SECURITY;
|
|
32
|
+
-- A role row grants too: assigning a role replaces the membership scopes with
|
|
33
|
+
-- the list it carries, so a scope missing from a built-in row would be taken
|
|
34
|
+
-- away again at the next assignment. The scopes already held keep their order
|
|
35
|
+
-- and the missing ones are appended in the order acl/scopes.ts declares them,
|
|
36
|
+
-- which is the order a freshly seeded workspace writes.
|
|
37
|
+
ALTER TABLE auth_roles NO FORCE ROW LEVEL SECURITY;
|
|
38
|
+
UPDATE auth_roles
|
|
39
|
+
SET scopes_json = (
|
|
40
|
+
SELECT json_agg(entry.scope ORDER BY entry.origin, entry.position)::text
|
|
41
|
+
FROM (
|
|
42
|
+
SELECT 0 AS origin, held.position, held.scope
|
|
43
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
44
|
+
WITH ORDINALITY AS held(scope, position)
|
|
45
|
+
UNION ALL
|
|
46
|
+
SELECT 1 AS origin, added.position, added.scope
|
|
47
|
+
FROM unnest(ARRAY['workflows.definitions.read', 'workflows.definitions.manage', 'workflows.definitions.publish', 'workflows.runs.read', 'workflows.runs.execute', 'workflows.runs.cancel', 'automations.schedules.read', 'automations.schedules.manage', 'automations.triggers.read', 'automations.triggers.manage', 'profile.self.manage'])
|
|
48
|
+
WITH ORDINALITY AS added(scope, position)
|
|
49
|
+
WHERE added.scope NOT IN (
|
|
50
|
+
SELECT existing.scope
|
|
51
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json) AS existing(scope))
|
|
52
|
+
) AS entry
|
|
53
|
+
)
|
|
54
|
+
WHERE builtin = 1 AND key = 'owner';
|
|
55
|
+
UPDATE auth_roles
|
|
56
|
+
SET scopes_json = (
|
|
57
|
+
SELECT json_agg(entry.scope ORDER BY entry.origin, entry.position)::text
|
|
58
|
+
FROM (
|
|
59
|
+
SELECT 0 AS origin, held.position, held.scope
|
|
60
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json)
|
|
61
|
+
WITH ORDINALITY AS held(scope, position)
|
|
62
|
+
UNION ALL
|
|
63
|
+
SELECT 1 AS origin, added.position, added.scope
|
|
64
|
+
FROM unnest(ARRAY['profile.self.manage'])
|
|
65
|
+
WITH ORDINALITY AS added(scope, position)
|
|
66
|
+
WHERE added.scope NOT IN (
|
|
67
|
+
SELECT existing.scope
|
|
68
|
+
FROM json_array_elements_text(auth_roles.scopes_json::json) AS existing(scope))
|
|
69
|
+
) AS entry
|
|
70
|
+
)
|
|
71
|
+
WHERE builtin = 1 AND key = 'member';
|
|
72
|
+
ALTER TABLE auth_roles FORCE ROW LEVEL SECURITY;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- Documentation only; Flowdular never executes a down script. Reversing 0028
|
|
2
|
+
-- drops the two prefix indexes. No row and no constraint depends on them, so
|
|
3
|
+
-- the only consequence is that a member search reads the workspace and sorts it
|
|
4
|
+
-- again.
|
|
5
|
+
DROP INDEX IF EXISTS auth_accounts_display_name_prefix_idx;
|
|
6
|
+
DROP INDEX IF EXISTS auth_accounts_email_prefix_idx;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- Member search matched a display name anywhere, LIKE '%term%', which no index
|
|
2
|
+
-- can answer: every keystroke read the workspace and sorted it before the LIMIT
|
|
3
|
+
-- cut it. Both branches are prefixes now, and these indexes turn each branch
|
|
4
|
+
-- into a range scan of the rows it returns. The ordering is still a sort, over
|
|
5
|
+
-- the rows the prefix matched rather than over the workspace.
|
|
6
|
+
--
|
|
7
|
+
-- The operator class is the load-bearing part. A btree over text in any
|
|
8
|
+
-- collation but C orders by that collation, while LIKE 'term%' is a range in
|
|
9
|
+
-- byte order, so an index in the database's default collation is ignored on a
|
|
10
|
+
-- deployment created with a locale and the workspace scan comes back unnoticed.
|
|
11
|
+
-- text_pattern_ops states the byte order the prefix needs, so the same plan
|
|
12
|
+
-- holds under every collation. The unique index on email_normalized stays the
|
|
13
|
+
-- key it is; it answers equality, and under C collation the prefix as well.
|
|
14
|
+
--
|
|
15
|
+
-- Neither index carries a workspace column because auth_accounts carries none.
|
|
16
|
+
-- A search reaches an account through auth_memberships, whose policy and
|
|
17
|
+
-- primary key bind the workspace to it.
|
|
18
|
+
CREATE INDEX IF NOT EXISTS auth_accounts_display_name_prefix_idx
|
|
19
|
+
ON auth_accounts (lower(display_name) text_pattern_ops);
|
|
20
|
+
CREATE INDEX IF NOT EXISTS auth_accounts_email_prefix_idx
|
|
21
|
+
ON auth_accounts (email_normalized text_pattern_ops);
|