@flowdular/sdk 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ai/agents/sandbox/business-manager.md +5 -1
- package/.ai/blueprints/author-spec/README.md +1 -1
- package/.ai/blueprints/author-spec/spec-requirements.yaml +44 -0
- package/.ai/blueprints/author-spec/steps.yaml +5 -5
- package/.ai/blueprints/author-spec/templates/module.yaml +99 -3
- package/.ai/blueprints/edit-module/gates.yaml +4 -0
- package/.ai/blueprints/edit-module/required-files.yaml +9 -0
- package/.ai/blueprints/new-module/gates.yaml +4 -0
- package/.ai/blueprints/new-module/spec-requirements.yaml +2 -2
- package/.ai/blueprints/release/gates.yaml +4 -0
- package/.ai/platform-capabilities.md +128 -0
- package/.ai/policies/capabilities.yaml +100 -0
- package/.ai/policies/path-ownership.yaml +5 -2
- package/.ai/policies/task-budgets.yaml +5 -3
- package/.ai/references/catalog/module.json +4 -4
- package/.ai/references/catalog/package.json +2 -2
- package/.ai/references/catalog/spec/module.yaml +5 -3
- package/.ai/references/catalog/src/platform.ts +2 -0
- package/.ai/references/catalog/src/services/catalog-service.ts +89 -1
- package/.ai/references/catalog/src/services/data-classes.ts +47 -0
- package/.ai/references/catalog/src/services/database-repository.ts +98 -1
- package/.ai/references/catalog/src/services/repository.ts +22 -1
- package/.ai/references/catalog/tests/data-classes.test.ts +157 -0
- package/.ai/references/catalog.provenance.json +12 -10
- package/.ai/skills/README.md +10 -0
- package/.ai/skills/agent-tool-design/SKILL.md +1 -2
- package/.ai/skills/auth-security-review/SKILL.md +1 -1
- package/.ai/skills/business-agent-design/SKILL.md +0 -1
- package/.ai/skills/deploy-operate/SKILL.md +114 -0
- package/.ai/skills/module-new/SKILL.md +29 -3
- package/.ai/skills/module-update/SKILL.md +9 -3
- package/.ai/skills/perf-audit/SKILL.md +0 -1
- package/.ai/skills/release-eject-pr/SKILL.md +0 -1
- package/.ai/skills/spec-interview/SKILL.md +120 -0
- package/.ai/skills/test-hardening/SKILL.md +1 -0
- package/.ai/skills/ux-design/SKILL.md +34 -3
- package/.ai/skills/variables/SKILL.md +0 -2
- package/.ai/skills/workflow-development/SKILL.md +0 -1
- package/AGENTS.md +4 -0
- package/docs/agent-contract.md +2 -2
- package/docs/design-system.md +185 -31
- package/modules/access/migrations/0001_access_core.down.sql +1 -0
- package/modules/access/migrations/0001_access_core.up.sql +28 -0
- package/modules/access/migrations/README.md +3 -0
- package/modules/access/module.json +33 -0
- package/modules/access/package.json +43 -0
- package/modules/access/spec/module.yaml +225 -0
- package/modules/access/src/acl/permissions.ts +6 -0
- package/modules/access/src/api/endpoints.ts +244 -0
- package/modules/access/src/client/ActivityView.tsrx +245 -0
- package/modules/access/src/client/AttestationsView.tsrx +176 -0
- package/modules/access/src/client/ReviewView.tsrx +586 -0
- package/modules/access/src/client/api.ts +132 -0
- package/modules/access/src/client/contribution.tsrx +41 -0
- package/modules/access/src/client/index.ts +41 -0
- package/modules/access/src/client/navigation.ts +57 -0
- package/modules/access/src/client/presentation.ts +69 -0
- package/modules/access/src/client/state.ts +72 -0
- package/modules/access/src/domain/types.ts +189 -0
- package/modules/access/src/index.ts +38 -0
- package/modules/access/src/platform.ts +60 -0
- package/modules/access/src/server/index.ts +42 -0
- package/modules/access/src/server/runtime.ts +105 -0
- package/modules/access/src/services/access-service.ts +298 -0
- package/modules/access/src/services/audit-window.ts +78 -0
- package/modules/access/src/services/auth-directory.ts +72 -0
- package/modules/access/src/services/changes.ts +91 -0
- package/modules/access/src/services/data-classes.ts +28 -0
- package/modules/access/src/services/database-repository.ts +185 -0
- package/modules/access/src/services/directory.ts +102 -0
- package/modules/access/src/services/index.ts +33 -0
- package/modules/access/src/services/list-exports.ts +150 -0
- package/modules/access/src/services/migration.ts +54 -0
- package/modules/access/src/services/repository.ts +30 -0
- package/modules/access/src/services/review.ts +178 -0
- package/modules/access/translations/en.json +155 -0
- package/modules/access/translations/pl.json +155 -0
- package/modules/agents/migrations/0022_credential_rotation_inventory.down.sql +2 -0
- package/modules/agents/migrations/0022_credential_rotation_inventory.up.sql +7 -0
- package/modules/agents/migrations/0023_agents_retention_indexes.down.sql +2 -0
- package/modules/agents/migrations/0023_agents_retention_indexes.up.sql +9 -0
- package/modules/agents/migrations/0024_agent_meter_refusals.down.sql +3 -0
- package/modules/agents/migrations/0024_agent_meter_refusals.up.sql +22 -0
- package/modules/agents/migrations/0025_agent_list_indexes.down.sql +3 -0
- package/modules/agents/migrations/0025_agent_list_indexes.up.sql +11 -0
- package/modules/agents/module.json +30 -4
- package/modules/agents/package.json +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/README.md +3 -0
- package/modules/approvals/module.json +34 -0
- package/modules/approvals/package.json +43 -0
- package/modules/approvals/spec/module.yaml +318 -0
- package/modules/approvals/src/acl/permissions.ts +7 -0
- package/modules/approvals/src/api/endpoints.ts +457 -0
- package/modules/approvals/src/client/ApprovalRequestDrawer.tsrx +138 -0
- package/modules/approvals/src/client/ApprovalsView.tsrx +562 -0
- package/modules/approvals/src/client/PendingCountWidget.tsrx +52 -0
- package/modules/approvals/src/client/api.ts +203 -0
- package/modules/approvals/src/client/approvals.css +51 -0
- package/modules/approvals/src/client/contribution.tsrx +44 -0
- package/modules/approvals/src/client/index.ts +26 -0
- package/modules/approvals/src/client/navigation.ts +39 -0
- package/modules/approvals/src/client/pending-count.ts +26 -0
- package/modules/approvals/src/client/presentation.ts +52 -0
- package/modules/approvals/src/client/state.ts +141 -0
- package/modules/approvals/src/domain/capability.ts +95 -0
- package/modules/approvals/src/domain/types.ts +154 -0
- package/modules/approvals/src/index.ts +52 -0
- package/modules/approvals/src/platform.ts +128 -0
- package/modules/approvals/src/server/index.ts +42 -0
- package/modules/approvals/src/server/runtime.ts +181 -0
- package/modules/approvals/src/services/approvals-service.ts +557 -0
- package/modules/approvals/src/services/callbacks.ts +75 -0
- package/modules/approvals/src/services/data-classes.ts +167 -0
- package/modules/approvals/src/services/database-repository.ts +724 -0
- package/modules/approvals/src/services/eligibility.ts +121 -0
- package/modules/approvals/src/services/expiry-runner.ts +81 -0
- package/modules/approvals/src/services/index.ts +31 -0
- package/modules/approvals/src/services/migration.ts +222 -0
- package/modules/approvals/src/services/notifications.ts +95 -0
- package/modules/approvals/src/services/repository.ts +161 -0
- package/modules/approvals/src/services/service-error.ts +70 -0
- package/modules/approvals/src/settings.ts +102 -0
- package/modules/approvals/translations/en.json +104 -0
- package/modules/approvals/translations/pl.json +104 -0
- package/modules/audit/migrations/0001_audit_core.down.sql +8 -0
- package/modules/audit/migrations/0001_audit_core.up.sql +107 -0
- package/modules/audit/migrations/0002_audit_sweep_routing_role.down.sql +2 -0
- package/modules/audit/migrations/0002_audit_sweep_routing_role.up.sql +21 -0
- package/modules/audit/migrations/0003_audit_export_request.down.sql +12 -0
- package/modules/audit/migrations/0003_audit_export_request.up.sql +40 -0
- package/modules/audit/migrations/0004_audit_hold_seal_erasure.down.sql +17 -0
- package/modules/audit/migrations/0004_audit_hold_seal_erasure.up.sql +192 -0
- package/modules/audit/migrations/0005_audit_event_format.down.sql +17 -0
- package/modules/audit/migrations/0005_audit_event_format.up.sql +60 -0
- package/modules/audit/migrations/0006_audit_own_class_walks.down.sql +3 -0
- package/modules/audit/migrations/0006_audit_own_class_walks.up.sql +14 -0
- package/modules/audit/migrations/README.md +3 -0
- package/modules/audit/module.json +32 -0
- package/modules/audit/package.json +49 -0
- package/modules/audit/spec/module.yaml +809 -0
- package/modules/audit/src/acl/permissions.ts +7 -0
- package/modules/audit/src/api/endpoints.ts +315 -0
- package/modules/audit/src/cli/commands.json +95 -0
- package/modules/audit/src/cli/index.ts +658 -0
- package/modules/audit/src/client/DataClassesView.tsrx +420 -0
- package/modules/audit/src/client/ExportsView.tsrx +256 -0
- package/modules/audit/src/client/HoldsView.tsrx +604 -0
- package/modules/audit/src/client/SweepsView.tsrx +251 -0
- package/modules/audit/src/client/api.ts +185 -0
- package/modules/audit/src/client/contribution.tsrx +52 -0
- package/modules/audit/src/client/index.ts +23 -0
- package/modules/audit/src/client/navigation.ts +74 -0
- package/modules/audit/src/client/presentation.ts +105 -0
- package/modules/audit/src/client/state.ts +86 -0
- package/modules/audit/src/domain/data-classes.ts +16 -0
- package/modules/audit/src/domain/types.ts +339 -0
- package/modules/audit/src/index.ts +76 -0
- package/modules/audit/src/platform.ts +44 -0
- package/modules/audit/src/server/index.ts +177 -0
- package/modules/audit/src/server/runtime.ts +303 -0
- package/modules/audit/src/services/anchor-key.ts +143 -0
- package/modules/audit/src/services/anchor-rotation.ts +147 -0
- package/modules/audit/src/services/audit-runners.ts +278 -0
- package/modules/audit/src/services/backup-guard.ts +95 -0
- package/modules/audit/src/services/database-repository.ts +1946 -0
- package/modules/audit/src/services/declared-classes.ts +64 -0
- package/modules/audit/src/services/erasure-port.ts +126 -0
- package/modules/audit/src/services/erasure-service.ts +770 -0
- package/modules/audit/src/services/export-directory.ts +106 -0
- package/modules/audit/src/services/export-service.ts +714 -0
- package/modules/audit/src/services/hold-service.ts +295 -0
- package/modules/audit/src/services/index.ts +17 -0
- package/modules/audit/src/services/migration.ts +658 -0
- package/modules/audit/src/services/own-classes.ts +318 -0
- package/modules/audit/src/services/platform-version.ts +23 -0
- package/modules/audit/src/services/repository.ts +495 -0
- package/modules/audit/src/services/retention-service.ts +191 -0
- package/modules/audit/src/services/seal-service.ts +769 -0
- package/modules/audit/src/services/service-error.ts +61 -0
- package/modules/audit/src/services/subject-keys.ts +90 -0
- package/modules/audit/src/services/sweep-service.ts +298 -0
- package/modules/audit/src/services/zip.ts +217 -0
- package/modules/audit/src/settings.ts +69 -0
- package/modules/audit/translations/en.json +210 -0
- package/modules/audit/translations/pl.json +210 -0
- package/modules/auth/README.md +77 -29
- package/modules/auth/migrations/0016_external_identities.up.sql +16 -0
- package/modules/auth/migrations/0017_mfa_key_id.up.sql +8 -0
- package/modules/auth/migrations/0018_retire_bundled_module_scopes.up.sql +29 -0
- package/modules/auth/migrations/0019_notifications_member_scopes.up.sql +44 -0
- package/modules/auth/migrations/0020_identity_providers.up.sql +61 -0
- package/modules/auth/migrations/0021_membership_status.up.sql +19 -0
- package/modules/auth/migrations/0022_auth_provider_scopes.up.sql +45 -0
- package/modules/auth/migrations/0023_enterprise_module_scopes.down.sql +19 -0
- package/modules/auth/migrations/0023_enterprise_module_scopes.up.sql +71 -0
- package/modules/auth/migrations/0024_approvals_member_scopes.down.sql +22 -0
- package/modules/auth/migrations/0024_approvals_member_scopes.up.sql +48 -0
- package/modules/auth/migrations/0025_audit_holds_owner_scope.down.sql +21 -0
- package/modules/auth/migrations/0025_audit_holds_owner_scope.up.sql +47 -0
- package/modules/auth/migrations/0026_auth_export_keyset_indexes.down.sql +6 -0
- package/modules/auth/migrations/0026_auth_export_keyset_indexes.up.sql +15 -0
- package/modules/auth/migrations/0027_workflow_automation_profile_scopes.down.sql +34 -0
- package/modules/auth/migrations/0027_workflow_automation_profile_scopes.up.sql +72 -0
- package/modules/auth/migrations/0028_auth_member_search_prefix_indexes.down.sql +6 -0
- package/modules/auth/migrations/0028_auth_member_search_prefix_indexes.up.sql +21 -0
- package/modules/auth/migrations/0029_reports_exports_access_scopes.down.sql +22 -0
- package/modules/auth/migrations/0029_reports_exports_access_scopes.up.sql +56 -0
- package/modules/auth/migrations/0030_auth_membership_keyset_index.down.sql +4 -0
- package/modules/auth/migrations/0030_auth_membership_keyset_index.up.sql +10 -0
- package/modules/auth/migrations/0031_membership_scope_backfills_under_rls.down.sql +4 -0
- package/modules/auth/migrations/0031_membership_scope_backfills_under_rls.up.sql +31 -0
- package/modules/auth/migrations/0032_audit_actor_service.down.sql +9 -0
- package/modules/auth/migrations/0032_audit_actor_service.up.sql +10 -0
- package/modules/auth/migrations/0033_auth_account_keyset_indexes.down.sql +5 -0
- package/modules/auth/migrations/0033_auth_account_keyset_indexes.up.sql +23 -0
- package/modules/auth/module.json +3 -3
- package/modules/auth/package.json +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/README.md +3 -0
- package/modules/connectors/module.json +28 -0
- package/modules/{automations-workflows-integration → connectors}/package.json +27 -26
- package/modules/connectors/spec/module.yaml +447 -0
- package/modules/connectors/src/acl/permissions.ts +6 -0
- package/modules/connectors/src/agent/tools.ts +180 -0
- package/modules/connectors/src/api/endpoints.ts +572 -0
- package/modules/connectors/src/client/ConnectorCallsView.tsrx +358 -0
- package/modules/connectors/src/client/ConnectorForm.tsrx +424 -0
- package/modules/connectors/src/client/ConnectorsView.tsrx +711 -0
- package/modules/connectors/src/client/api.ts +281 -0
- package/modules/connectors/src/client/consent.ts +48 -0
- package/modules/connectors/src/client/contribution.tsrx +37 -0
- package/modules/connectors/src/client/index.ts +22 -0
- package/modules/connectors/src/client/navigation.ts +42 -0
- package/modules/connectors/src/client/presentation.ts +38 -0
- package/modules/connectors/src/client/state.ts +175 -0
- package/modules/connectors/src/domain/calls.ts +70 -0
- package/modules/connectors/src/domain/definitions.ts +190 -0
- package/modules/connectors/src/domain/http-json.ts +68 -0
- package/modules/connectors/src/domain/types.ts +185 -0
- package/modules/connectors/src/index.ts +64 -0
- package/modules/connectors/src/platform.ts +56 -0
- package/modules/connectors/src/server/index.ts +66 -0
- package/modules/connectors/src/server/runtime.ts +163 -0
- package/modules/connectors/src/services/call-service.ts +903 -0
- package/modules/connectors/src/services/connectors-service.ts +653 -0
- package/modules/connectors/src/services/credential-vault.ts +188 -0
- package/modules/connectors/src/services/data-classes.ts +158 -0
- package/modules/connectors/src/services/database-repository.ts +897 -0
- package/modules/connectors/src/services/egress.ts +261 -0
- package/modules/connectors/src/services/index.ts +19 -0
- package/modules/connectors/src/services/migration.ts +166 -0
- package/modules/connectors/src/services/repository.ts +175 -0
- package/modules/connectors/src/services/service-error.ts +46 -0
- package/modules/connectors/src/settings.ts +69 -0
- package/modules/connectors/translations/en.json +191 -0
- package/modules/connectors/translations/pl.json +191 -0
- package/modules/directory/migrations/0001_directory_core.down.sql +5 -0
- package/modules/directory/migrations/0001_directory_core.up.sql +111 -0
- package/modules/directory/migrations/README.md +3 -0
- package/modules/directory/module.json +27 -0
- package/modules/directory/package.json +46 -0
- package/modules/directory/spec/module.yaml +351 -0
- package/modules/directory/src/acl/permissions.ts +7 -0
- package/modules/directory/src/api/endpoints.ts +478 -0
- package/modules/directory/src/api/scim-endpoints.ts +516 -0
- package/modules/directory/src/client/GroupMappingsView.tsrx +430 -0
- package/modules/directory/src/client/ProvisioningLogView.tsrx +248 -0
- package/modules/directory/src/client/ScimTokensView.tsrx +587 -0
- package/modules/directory/src/client/api.ts +222 -0
- package/modules/directory/src/client/contribution.tsrx +46 -0
- package/modules/directory/src/client/index.ts +22 -0
- package/modules/directory/src/client/navigation.ts +57 -0
- package/modules/directory/src/client/presentation.ts +143 -0
- package/modules/directory/src/client/state.ts +173 -0
- package/modules/directory/src/domain/scim.ts +346 -0
- package/modules/directory/src/domain/types.ts +166 -0
- package/modules/directory/src/index.ts +44 -0
- package/modules/directory/src/platform.ts +43 -0
- package/modules/directory/src/server/index.ts +17 -0
- package/modules/directory/src/server/runtime.ts +124 -0
- package/modules/directory/src/services/auth-port.ts +127 -0
- package/modules/directory/src/services/data-classes.ts +41 -0
- package/modules/directory/src/services/database-repository.ts +1067 -0
- package/modules/directory/src/services/directory-service.ts +311 -0
- package/modules/directory/src/services/index.ts +43 -0
- package/modules/directory/src/services/migration.ts +146 -0
- package/modules/directory/src/services/provisioning-service.ts +1420 -0
- package/modules/directory/src/services/rate-limiter.ts +103 -0
- package/modules/directory/src/services/repository.ts +208 -0
- package/modules/directory/src/services/service-error.ts +42 -0
- package/modules/directory/src/services/token-service.ts +215 -0
- package/modules/directory/src/settings.ts +86 -0
- package/modules/directory/translations/en.json +185 -0
- package/modules/directory/translations/pl.json +185 -0
- package/modules/documents/migrations/0001_documents_core.down.sql +1 -0
- package/modules/documents/migrations/0001_documents_core.up.sql +35 -0
- package/modules/documents/migrations/0002_documents_files_page.down.sql +1 -0
- package/modules/documents/migrations/0002_documents_files_page.up.sql +6 -0
- package/modules/documents/migrations/README.md +3 -0
- package/modules/documents/module.json +28 -0
- package/modules/documents/package.json +49 -0
- package/modules/documents/spec/module.yaml +247 -0
- package/modules/documents/src/acl/permissions.ts +6 -0
- package/modules/documents/src/api/endpoints.ts +401 -0
- package/modules/documents/src/client/DocumentUploader.tsrx +148 -0
- package/modules/documents/src/client/DocumentsView.tsrx +540 -0
- package/modules/documents/src/client/api.ts +209 -0
- package/modules/documents/src/client/contribution.tsrx +29 -0
- package/modules/documents/src/client/download.ts +70 -0
- package/modules/documents/src/client/index.ts +22 -0
- package/modules/documents/src/client/navigation.ts +25 -0
- package/modules/documents/src/client/presentation.ts +110 -0
- package/modules/documents/src/client/state.ts +117 -0
- package/modules/documents/src/domain/attachments.ts +84 -0
- package/modules/documents/src/domain/types.ts +80 -0
- package/modules/documents/src/index.ts +46 -0
- package/modules/documents/src/platform.ts +61 -0
- package/modules/documents/src/server/index.ts +30 -0
- package/modules/documents/src/server/runtime.ts +107 -0
- package/modules/documents/src/services/attachments.ts +39 -0
- package/modules/documents/src/services/data-classes.ts +25 -0
- package/modules/documents/src/services/database-repository.ts +259 -0
- package/modules/documents/src/services/documents-service.ts +586 -0
- package/modules/documents/src/services/index.ts +18 -0
- package/modules/documents/src/services/migration.ts +82 -0
- package/modules/documents/src/services/repository.ts +48 -0
- package/modules/documents/src/settings.ts +107 -0
- package/modules/documents/translations/en.json +111 -0
- package/modules/documents/translations/pl.json +111 -0
- package/modules/exports/migrations/0001_exports_core.down.sql +2 -0
- package/modules/exports/migrations/0001_exports_core.up.sql +28 -0
- package/modules/exports/migrations/0002_exports_job_routing_role.down.sql +4 -0
- package/modules/exports/migrations/0002_exports_job_routing_role.up.sql +21 -0
- package/modules/exports/migrations/README.md +3 -0
- package/modules/exports/module.json +28 -0
- package/modules/exports/package.json +44 -0
- package/modules/exports/spec/module.yaml +229 -0
- package/modules/exports/src/acl/permissions.ts +6 -0
- package/modules/exports/src/api/endpoints.ts +211 -0
- package/modules/exports/src/client/ExportsView.tsrx +327 -0
- package/modules/exports/src/client/api.ts +133 -0
- package/modules/exports/src/client/contribution.tsrx +31 -0
- package/modules/exports/src/client/index.ts +20 -0
- package/modules/exports/src/client/navigation.ts +25 -0
- package/modules/exports/src/client/presentation.ts +53 -0
- package/modules/exports/src/client/state.ts +56 -0
- package/modules/exports/src/domain/lists.ts +29 -0
- package/modules/exports/src/domain/types.ts +120 -0
- package/modules/exports/src/index.ts +41 -0
- package/modules/exports/src/platform.ts +80 -0
- package/modules/exports/src/server/index.ts +51 -0
- package/modules/exports/src/server/runtime.ts +160 -0
- package/modules/exports/src/services/data-classes.ts +56 -0
- package/modules/exports/src/services/database-repository.ts +405 -0
- package/modules/exports/src/services/export-runner.ts +123 -0
- package/modules/exports/src/services/export-service.ts +356 -0
- package/modules/exports/src/services/index.ts +6 -0
- package/modules/exports/src/services/list-registry.ts +105 -0
- package/modules/exports/src/services/migration.ts +89 -0
- package/modules/exports/src/services/repository.ts +97 -0
- package/modules/exports/src/settings.ts +70 -0
- package/modules/exports/translations/en.json +69 -0
- package/modules/exports/translations/pl.json +69 -0
- package/modules/import/migrations/0001_import_core.down.sql +6 -0
- package/modules/import/migrations/0001_import_core.up.sql +61 -0
- package/modules/import/migrations/0002_import_job_routing_role.down.sql +4 -0
- package/modules/import/migrations/0002_import_job_routing_role.up.sql +20 -0
- package/modules/import/migrations/0003_import_jobs_export_index.down.sql +1 -0
- package/modules/import/migrations/0003_import_jobs_export_index.up.sql +7 -0
- package/modules/import/migrations/0004_import_jobs_traceparent.down.sql +1 -0
- package/modules/import/migrations/0004_import_jobs_traceparent.up.sql +7 -0
- package/modules/import/migrations/README.md +3 -0
- package/modules/import/module.json +37 -0
- package/modules/import/package.json +50 -0
- package/modules/import/spec/module.yaml +335 -0
- package/modules/import/src/acl/permissions.ts +6 -0
- package/modules/import/src/api/endpoints.ts +400 -0
- package/modules/import/src/client/ImportJobDrawer.tsrx +229 -0
- package/modules/import/src/client/ImportsView.tsrx +455 -0
- package/modules/import/src/client/NewImportForm.tsrx +274 -0
- package/modules/import/src/client/api.ts +243 -0
- package/modules/import/src/client/contribution.tsrx +29 -0
- package/modules/import/src/client/index.ts +23 -0
- package/modules/import/src/client/navigation.ts +25 -0
- package/modules/import/src/client/presentation.ts +59 -0
- package/modules/import/src/client/state.ts +43 -0
- package/modules/import/src/domain/csv.ts +258 -0
- package/modules/import/src/domain/ports.ts +157 -0
- package/modules/import/src/domain/types.ts +179 -0
- package/modules/import/src/index.ts +58 -0
- package/modules/import/src/platform.ts +60 -0
- package/modules/import/src/server/index.ts +49 -0
- package/modules/import/src/server/runtime.ts +158 -0
- package/modules/import/src/services/csv-source.ts +121 -0
- package/modules/import/src/services/data-classes.ts +63 -0
- package/modules/import/src/services/database-repository.ts +780 -0
- package/modules/import/src/services/import-runner.ts +127 -0
- package/modules/import/src/services/import-service.ts +872 -0
- package/modules/import/src/services/index.ts +6 -0
- package/modules/import/src/services/migration.ts +156 -0
- package/modules/import/src/services/port-registry.ts +158 -0
- package/modules/import/src/services/repository.ts +147 -0
- package/modules/import/src/settings.ts +70 -0
- package/modules/import/translations/en.json +175 -0
- package/modules/import/translations/pl.json +175 -0
- package/modules/metering/migrations/0001_metering_core.down.sql +6 -0
- package/modules/metering/migrations/0001_metering_core.up.sql +119 -0
- package/modules/metering/migrations/0002_metering_bucket_export.down.sql +3 -0
- package/modules/metering/migrations/0002_metering_bucket_export.up.sql +5 -0
- package/modules/metering/migrations/README.md +3 -0
- package/modules/metering/module.json +46 -0
- package/modules/metering/package.json +50 -0
- package/modules/metering/spec/module.yaml +269 -0
- package/modules/metering/src/acl/permissions.ts +5 -0
- package/modules/metering/src/api/endpoints.ts +104 -0
- package/modules/metering/src/cli/commands.json +28 -0
- package/modules/metering/src/cli/index.ts +246 -0
- package/modules/metering/src/client/LimitsView.tsrx +170 -0
- package/modules/metering/src/client/UsageSummaryWidget.tsrx +63 -0
- package/modules/metering/src/client/UsageView.tsrx +205 -0
- package/modules/metering/src/client/api.ts +91 -0
- package/modules/metering/src/client/contribution.tsrx +42 -0
- package/modules/metering/src/client/index.ts +26 -0
- package/modules/metering/src/client/navigation.ts +54 -0
- package/modules/metering/src/client/presentation.ts +63 -0
- package/modules/metering/src/client/state.ts +31 -0
- package/modules/metering/src/domain/meters.ts +100 -0
- package/modules/metering/src/domain/types.ts +71 -0
- package/modules/metering/src/index.ts +51 -0
- package/modules/metering/src/platform.ts +84 -0
- package/modules/metering/src/server/index.ts +40 -0
- package/modules/metering/src/server/runtime.ts +165 -0
- package/modules/metering/src/services/data-classes.ts +34 -0
- package/modules/metering/src/services/database-repository.ts +574 -0
- package/modules/metering/src/services/index.ts +9 -0
- package/modules/metering/src/services/meter-registry.ts +145 -0
- package/modules/metering/src/services/metering-service.ts +441 -0
- package/modules/metering/src/services/migration.ts +183 -0
- package/modules/metering/src/services/notifications.ts +75 -0
- package/modules/metering/src/services/reports.ts +105 -0
- package/modules/metering/src/services/repository.ts +132 -0
- package/modules/metering/src/services/service-error.ts +46 -0
- package/modules/metering/src/settings.ts +47 -0
- package/modules/metering/translations/en.json +68 -0
- package/modules/metering/translations/pl.json +68 -0
- package/modules/notifications/migrations/0001_notifications_core.down.sql +1 -0
- package/modules/notifications/migrations/0001_notifications_core.up.sql +26 -0
- package/modules/notifications/migrations/0002_notifications_preferences.down.sql +1 -0
- package/modules/notifications/migrations/0002_notifications_preferences.up.sql +17 -0
- package/modules/notifications/migrations/0003_notifications_webhook_subscriptions.down.sql +1 -0
- package/modules/notifications/migrations/0003_notifications_webhook_subscriptions.up.sql +30 -0
- package/modules/notifications/migrations/0004_notifications_deliveries.down.sql +1 -0
- package/modules/notifications/migrations/0004_notifications_deliveries.up.sql +35 -0
- package/modules/notifications/migrations/0005_notifications_delivery_routing_role.down.sql +2 -0
- package/modules/notifications/migrations/0005_notifications_delivery_routing_role.up.sql +17 -0
- package/modules/notifications/migrations/0006_notifications_delivery_title.down.sql +1 -0
- package/modules/notifications/migrations/0006_notifications_delivery_title.up.sql +11 -0
- package/modules/notifications/migrations/0007_notifications_secret_rotation_inventory.down.sql +2 -0
- package/modules/notifications/migrations/0007_notifications_secret_rotation_inventory.up.sql +19 -0
- package/modules/notifications/migrations/0008_notifications_delivery_claim.down.sql +8 -0
- package/modules/notifications/migrations/0008_notifications_delivery_claim.up.sql +19 -0
- package/modules/notifications/migrations/0009_notifications_kind_approvals.down.sql +16 -0
- package/modules/notifications/migrations/0009_notifications_kind_approvals.up.sql +18 -0
- package/modules/notifications/migrations/0010_notifications_kind_meter_threshold.down.sql +16 -0
- package/modules/notifications/migrations/0010_notifications_kind_meter_threshold.up.sql +18 -0
- package/modules/notifications/migrations/0011_notifications_retention_keyset.down.sql +5 -0
- package/modules/notifications/migrations/0011_notifications_retention_keyset.up.sql +15 -0
- package/modules/notifications/migrations/0012_notifications_email_channel.down.sql +12 -0
- package/modules/notifications/migrations/0012_notifications_email_channel.up.sql +38 -0
- package/modules/notifications/migrations/0013_notifications_list_pages.down.sql +5 -0
- package/modules/notifications/migrations/0013_notifications_list_pages.up.sql +13 -0
- package/modules/notifications/migrations/README.md +3 -0
- package/modules/notifications/module.json +32 -0
- package/modules/notifications/package.json +49 -0
- package/modules/notifications/spec/module.yaml +718 -0
- package/modules/notifications/src/acl/permissions.ts +11 -0
- package/modules/notifications/src/api/endpoints.ts +814 -0
- package/modules/notifications/src/cli/commands.json +17 -0
- package/modules/notifications/src/cli/index.ts +126 -0
- package/modules/notifications/src/client/DeliveriesView.tsrx +483 -0
- package/modules/notifications/src/client/FactList.tsrx +24 -0
- package/modules/notifications/src/client/NotificationPreferencesView.tsrx +240 -0
- package/modules/notifications/src/client/NotificationsInboxView.tsrx +592 -0
- package/modules/notifications/src/client/UnreadCountWidget.tsrx +62 -0
- package/modules/notifications/src/client/WebhookForm.tsrx +297 -0
- package/modules/notifications/src/client/WebhooksView.tsrx +637 -0
- package/modules/notifications/src/client/api.ts +382 -0
- package/modules/notifications/src/client/contribution.tsrx +83 -0
- package/modules/notifications/src/client/inbox.ts +41 -0
- package/modules/notifications/src/client/index.ts +29 -0
- package/modules/notifications/src/client/navigation.ts +92 -0
- package/modules/notifications/src/client/notifications.css +70 -0
- package/modules/notifications/src/client/presentation.ts +81 -0
- package/modules/notifications/src/client/state.ts +246 -0
- package/modules/notifications/src/client/unread-count.ts +26 -0
- package/modules/notifications/src/domain/locale.ts +47 -0
- package/modules/notifications/src/domain/publish.ts +46 -0
- package/modules/notifications/src/domain/types.ts +186 -0
- package/modules/notifications/src/index.ts +62 -0
- package/modules/notifications/src/platform.ts +85 -0
- package/modules/notifications/src/server/index.ts +82 -0
- package/modules/notifications/src/server/runtime.ts +251 -0
- package/modules/notifications/src/services/data-classes.ts +139 -0
- package/modules/notifications/src/services/database-repository.ts +1334 -0
- package/modules/notifications/src/services/delivery-payload.ts +93 -0
- package/modules/notifications/src/services/delivery-runner.ts +170 -0
- package/modules/notifications/src/services/delivery-service.ts +811 -0
- package/modules/notifications/src/services/egress.ts +239 -0
- package/modules/notifications/src/services/email-channel.ts +93 -0
- package/modules/notifications/src/services/index.ts +23 -0
- package/modules/notifications/src/services/migration.ts +572 -0
- package/modules/notifications/src/services/notifications-service.ts +297 -0
- package/modules/notifications/src/services/paging.ts +60 -0
- package/modules/notifications/src/services/publish-service.ts +133 -0
- package/modules/notifications/src/services/repository.ts +342 -0
- package/modules/notifications/src/services/secret-rotation.ts +177 -0
- package/modules/notifications/src/services/secret-vault.ts +168 -0
- package/modules/notifications/src/services/service-error.ts +67 -0
- package/modules/notifications/src/services/signature.ts +81 -0
- package/modules/notifications/src/services/webhook-service.ts +307 -0
- package/modules/notifications/src/settings.ts +130 -0
- package/modules/notifications/translations/en.json +255 -0
- package/modules/notifications/translations/pl.json +255 -0
- package/modules/profile/module.json +3 -3
- package/modules/profile/package.json +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 +179 -0
- package/packages/database/src/decoders.ts +25 -0
- package/packages/database/src/index.ts +17 -0
- package/packages/database/src/record-history.ts +5 -14
- package/packages/harness/src/index.ts +2 -0
- package/packages/harness/src/runtime.ts +218 -1
- package/packages/harness/src/tool-adapters.ts +19 -1
- package/packages/kernel/src/acl.ts +179 -0
- package/packages/kernel/src/capability-registry.ts +69 -2
- package/packages/kernel/src/data-class-registry.ts +354 -0
- package/packages/kernel/src/index.ts +65 -4
- package/packages/kernel/src/keyring.ts +208 -0
- package/packages/kernel/src/module-compatibility.ts +35 -4
- package/packages/kernel/src/module-registry.ts +49 -2
- package/packages/kernel/src/module-settings.ts +189 -27
- package/packages/server/package.json +2 -1
- package/packages/server/src/composition.ts +38 -0
- package/packages/server/src/endpoint.ts +104 -47
- package/packages/server/src/export/csv.ts +34 -0
- package/packages/server/src/export/definition.ts +346 -0
- package/packages/server/src/export/index.ts +61 -0
- package/packages/server/src/export/run.ts +116 -0
- package/packages/server/src/index.ts +155 -0
- package/packages/server/src/jobs/index.ts +93 -0
- package/packages/server/src/jobs/runner.ts +486 -0
- package/packages/server/src/log.ts +291 -0
- package/packages/server/src/mail/config.ts +184 -0
- package/packages/server/src/mail/contracts.ts +251 -0
- package/packages/server/src/mail/index.ts +31 -0
- package/packages/server/src/mail/port.ts +101 -0
- package/packages/server/src/mail/smtp.ts +191 -0
- package/packages/server/src/mail/template.ts +105 -0
- package/packages/server/src/metrics.ts +447 -0
- package/packages/server/src/pagination.ts +246 -0
- package/packages/server/src/trace/context.ts +103 -0
- package/packages/server/src/trace/egress.ts +66 -0
- package/packages/server/src/trace/error-sink.ts +296 -0
- package/packages/server/src/trace/exporter.ts +295 -0
- package/packages/server/src/trace/index.ts +60 -0
- package/packages/server/src/trace/job-sink.ts +172 -0
- package/packages/server/src/trace/tracer.ts +338 -0
- package/packages/server/src/web.ts +5 -1
- package/packages/storage/package.json +40 -0
- package/packages/storage/src/config.ts +189 -0
- package/packages/storage/src/content-type.ts +124 -0
- package/packages/storage/src/contracts.ts +112 -0
- package/packages/storage/src/envelope.ts +189 -0
- package/packages/storage/src/index.ts +43 -0
- package/packages/storage/src/local.ts +75 -0
- package/packages/storage/src/port.ts +251 -0
- package/packages/storage/src/read-token.ts +130 -0
- package/packages/storage/src/s3.ts +144 -0
- package/packages/storage/src/scanner.ts +22 -0
- package/packages/storage/src/sigv4.ts +104 -0
- package/packages/storage/src/store.ts +13 -0
- package/packages/ui/package.json +1 -0
- package/packages/ui/src/components/Button.tsrx +3 -0
- package/packages/ui/src/components/ConfirmDialog.tsrx +13 -2
- package/packages/ui/src/components/DateField.tsrx +92 -0
- package/packages/ui/src/components/DatePicker.tsrx +525 -0
- package/packages/ui/src/components/DateRangeField.tsrx +93 -0
- package/packages/ui/src/components/Drawer.tsrx +10 -1
- package/packages/ui/src/components/FileUpload.tsrx +158 -0
- package/packages/ui/src/components/Pagination.tsrx +130 -0
- package/packages/ui/src/components/Select.tsrx +78 -0
- package/packages/ui/src/components/Table.tsrx +498 -81
- package/packages/ui/src/components/Tabs.tsrx +53 -0
- package/packages/ui/src/components/ToastHost.tsrx +48 -0
- package/packages/ui/src/components/calendar.ts +243 -0
- package/packages/ui/src/components/date-field.ts +62 -0
- package/packages/ui/src/components/file-upload.ts +49 -0
- package/packages/ui/src/components/focus-trap.ts +62 -0
- package/packages/ui/src/components/pagination.ts +68 -0
- package/packages/ui/src/components/table-sorting.ts +49 -0
- package/packages/ui/src/components/tabs.ts +61 -0
- package/packages/ui/src/components/toast-store.ts +116 -0
- package/packages/ui/src/icons/Icon.tsrx +5 -0
- package/packages/ui/src/index.ts +45 -0
- package/packages/ui/src/styles/components.css +598 -0
- package/modules/automations-workflows-integration/module.json +0 -27
- package/modules/automations-workflows-integration/spec/module.yaml +0 -93
- package/modules/automations-workflows-integration/src/index.ts +0 -14
- package/modules/automations-workflows-integration/src/platform.ts +0 -24
- package/modules/automations-workflows-integration/src/server/index.ts +0 -11
- package/modules/automations-workflows-integration/translations/en.json +0 -21
- package/modules/automations-workflows-integration/translations/pl.json +0 -21
- package/modules/workflows/src/services/cursor-codec.ts +0 -62
|
@@ -15,9 +15,31 @@ function compareModules(
|
|
|
15
15
|
return left.manifest.id.localeCompare(right.manifest.id);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/* Every provider of a capability id, by module id. A capability has one
|
|
19
|
+
provider: two modules registering the same id would race at composition. */
|
|
20
|
+
export function capabilityProviders(
|
|
21
|
+
modules: Iterable<RegisteredModule>,
|
|
22
|
+
): ReadonlyMap<string, string> {
|
|
23
|
+
const providers = new Map<string, string>();
|
|
24
|
+
for (const module of modules) {
|
|
25
|
+
for (const capability of module.manifest.provides ?? []) {
|
|
26
|
+
const existing = providers.get(capability);
|
|
27
|
+
if (existing && existing !== module.manifest.id) {
|
|
28
|
+
throw new RegistryError(
|
|
29
|
+
'MODULE_CAPABILITY_DUPLICATE',
|
|
30
|
+
`Capability "${capability}" is provided by both "${existing}" and "${module.manifest.id}".`,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
providers.set(capability, module.manifest.id);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return providers;
|
|
37
|
+
}
|
|
38
|
+
|
|
18
39
|
function visitModule(
|
|
19
40
|
id: string,
|
|
20
41
|
modules: ReadonlyMap<string, RegisteredModule>,
|
|
42
|
+
providers: ReadonlyMap<string, string>,
|
|
21
43
|
visiting: Set<string>,
|
|
22
44
|
visited: Set<string>,
|
|
23
45
|
ordered: RegisteredModule[],
|
|
@@ -53,7 +75,24 @@ function visitModule(
|
|
|
53
75
|
dependency,
|
|
54
76
|
modules.get(dependency.id)!.manifest.version,
|
|
55
77
|
);
|
|
56
|
-
visitModule(dependency.id, modules, visiting, visited, ordered);
|
|
78
|
+
visitModule(dependency.id, modules, providers, visiting, visited, ordered);
|
|
79
|
+
}
|
|
80
|
+
/* A required capability orders its provider first, like a dependency. An
|
|
81
|
+
optional one is resolved lazily by the consumer, so it neither fails when
|
|
82
|
+
absent nor takes part in ordering. */
|
|
83
|
+
for (const requirement of [...(current.manifest.requires ?? [])].sort(
|
|
84
|
+
(a, b) => a.id.localeCompare(b.id),
|
|
85
|
+
)) {
|
|
86
|
+
if (requirement.optional) continue;
|
|
87
|
+
const provider = providers.get(requirement.id);
|
|
88
|
+
if (!provider) {
|
|
89
|
+
throw new RegistryError(
|
|
90
|
+
'MODULE_CAPABILITY_MISSING',
|
|
91
|
+
`Module "${id}" requires capability "${requirement.id}" and no registered module provides it.`,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
if (provider === id) continue;
|
|
95
|
+
visitModule(provider, modules, providers, visiting, visited, ordered);
|
|
57
96
|
}
|
|
58
97
|
visiting.delete(id);
|
|
59
98
|
visited.add(id);
|
|
@@ -96,11 +135,19 @@ export function createModuleRegistry(
|
|
|
96
135
|
}
|
|
97
136
|
}
|
|
98
137
|
|
|
138
|
+
const providers = capabilityProviders(byId.values());
|
|
99
139
|
const ordered: RegisteredModule[] = [];
|
|
100
140
|
const visiting = new Set<string>();
|
|
101
141
|
const visited = new Set<string>();
|
|
102
142
|
for (const module of [...input].sort(compareModules)) {
|
|
103
|
-
visitModule(
|
|
143
|
+
visitModule(
|
|
144
|
+
module.manifest.id,
|
|
145
|
+
byId,
|
|
146
|
+
providers,
|
|
147
|
+
visiting,
|
|
148
|
+
visited,
|
|
149
|
+
ordered,
|
|
150
|
+
);
|
|
104
151
|
}
|
|
105
152
|
|
|
106
153
|
return Object.freeze({
|
|
@@ -4,6 +4,11 @@ export type ModuleSettingType = 'string' | 'number' | 'boolean';
|
|
|
4
4
|
shared by every tenant; auth uses them for knobs that apply before a tenant
|
|
5
5
|
is known, such as sign-up availability. */
|
|
6
6
|
export type ModuleSettingScope = 'platform' | 'tenant';
|
|
7
|
+
/* A feature flag is a boolean setting an operator turns on or off per
|
|
8
|
+
workspace. It is stored, read and validated exactly like any other setting;
|
|
9
|
+
the kind is what makes the change audited as a flag change and listed on the
|
|
10
|
+
Flags screen. */
|
|
11
|
+
export type ModuleSettingKind = 'flag';
|
|
7
12
|
|
|
8
13
|
export interface ModuleSettingDefinition {
|
|
9
14
|
readonly type: ModuleSettingType;
|
|
@@ -12,6 +17,8 @@ export interface ModuleSettingDefinition {
|
|
|
12
17
|
readonly client: boolean;
|
|
13
18
|
/** Write-only: the API never returns the value, only whether one is set. */
|
|
14
19
|
readonly secret?: boolean;
|
|
20
|
+
/** `flag` requires a tenant-scoped, non-secret boolean, labelled and described. */
|
|
21
|
+
readonly kind?: ModuleSettingKind;
|
|
15
22
|
readonly scope?: ModuleSettingScope;
|
|
16
23
|
/** Fully qualified client translation key; `label` remains the fallback. */
|
|
17
24
|
readonly labelKey?: string;
|
|
@@ -45,13 +52,15 @@ export interface ModuleSettingRecord {
|
|
|
45
52
|
readonly updatedAt: number;
|
|
46
53
|
}
|
|
47
54
|
|
|
55
|
+
/* Storage may be a database or a network, so every operation is asynchronous;
|
|
56
|
+
the runtime serves reads from a snapshot it primes per tenant. */
|
|
48
57
|
export interface ModuleSettingsStore {
|
|
49
58
|
load(
|
|
50
59
|
tenantId: string,
|
|
51
60
|
moduleId: string,
|
|
52
|
-
): Readonly<Record<string, ModuleSettingValue
|
|
53
|
-
save(record: ModuleSettingRecord): void
|
|
54
|
-
clear(tenantId: string, moduleId: string, key: string): void
|
|
61
|
+
): Promise<Readonly<Record<string, ModuleSettingValue>>>;
|
|
62
|
+
save(record: ModuleSettingRecord): Promise<void>;
|
|
63
|
+
clear(tenantId: string, moduleId: string, key: string): Promise<void>;
|
|
55
64
|
}
|
|
56
65
|
|
|
57
66
|
export interface ModuleSettingEntry {
|
|
@@ -71,6 +80,15 @@ export interface ModuleSettingChange {
|
|
|
71
80
|
readonly key: string;
|
|
72
81
|
/** True when the stored value was removed and the default applies again. */
|
|
73
82
|
readonly cleared: boolean;
|
|
83
|
+
/** Declared kind, so a listener can audit a flag change as a flag change. */
|
|
84
|
+
readonly kind?: ModuleSettingKind;
|
|
85
|
+
/**
|
|
86
|
+
* Effective values around the write, default included, so an audit trail
|
|
87
|
+
* records what an operator actually changed. Both are null for a secret,
|
|
88
|
+
* whose value never leaves the store.
|
|
89
|
+
*/
|
|
90
|
+
readonly previous: ModuleSettingValue | null;
|
|
91
|
+
readonly next: ModuleSettingValue | null;
|
|
74
92
|
/** The set() caller and the workspace the change was made from. */
|
|
75
93
|
readonly actor: {
|
|
76
94
|
readonly accountId: string;
|
|
@@ -81,27 +99,34 @@ export interface ModuleSettingChange {
|
|
|
81
99
|
export interface ModuleSettingsRuntime {
|
|
82
100
|
declare(declaration: ModuleSettingsDeclaration): void;
|
|
83
101
|
declarations(): readonly ModuleSettingsDeclaration[];
|
|
84
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Loads the stored values of every declared module for this tenant, and the
|
|
104
|
+
* platform-scoped ones, into memory. Idempotent and memoised: a primed
|
|
105
|
+
* tenant costs one lookup. `get` and `list` answer from that snapshot, so a
|
|
106
|
+
* request path primes the tenant before it reads.
|
|
107
|
+
*/
|
|
108
|
+
prime(tenantId: string): Promise<void>;
|
|
109
|
+
/** The stored value, else the declared default; throws for an unprimed tenant. */
|
|
85
110
|
get<T extends ModuleSettingValue>(
|
|
86
111
|
tenantId: string,
|
|
87
112
|
moduleId: string,
|
|
88
113
|
key: string,
|
|
89
114
|
): T;
|
|
90
115
|
list(tenantId: string): readonly ModuleSettingEntry[];
|
|
91
|
-
/** Validates against the declaration; null clears the stored value. */
|
|
116
|
+
/** Validates against the declaration; null clears the stored value. Resolves once the store holds it and the snapshot is refreshed. */
|
|
92
117
|
set(
|
|
93
118
|
tenantId: string,
|
|
94
119
|
moduleId: string,
|
|
95
120
|
key: string,
|
|
96
121
|
value: ModuleSettingValue | null,
|
|
97
122
|
actor: string,
|
|
98
|
-
): void
|
|
123
|
+
): Promise<void>;
|
|
99
124
|
onChange(listener: (change: ModuleSettingChange) => void): () => void;
|
|
100
125
|
}
|
|
101
126
|
|
|
102
127
|
export interface ModuleSettingsRuntimeOptions {
|
|
103
128
|
readonly now?: () => number;
|
|
104
|
-
/** Bound on
|
|
129
|
+
/** Bound on tenants held in memory; the least recently primed is evicted, the platform tenant stays. */
|
|
105
130
|
readonly cacheLimit?: number;
|
|
106
131
|
}
|
|
107
132
|
|
|
@@ -124,6 +149,22 @@ function invalid(name: string, detail: string): ModuleSettingsError {
|
|
|
124
149
|
);
|
|
125
150
|
}
|
|
126
151
|
|
|
152
|
+
/* One compiled pattern per declared setting. Every read validates the stored
|
|
153
|
+
value against its declaration, so compiling here rather than per call keeps
|
|
154
|
+
the regular expression off the request path; `defineModuleSettings` builds it
|
|
155
|
+
while it checks the declared default. Keyed by the definition, so a
|
|
156
|
+
declaration that goes away takes its pattern with it. */
|
|
157
|
+
const patterns = new WeakMap<ModuleSettingDefinition, RegExp>();
|
|
158
|
+
|
|
159
|
+
function patternOf(definition: ModuleSettingDefinition): RegExp {
|
|
160
|
+
let compiled = patterns.get(definition);
|
|
161
|
+
if (compiled === undefined) {
|
|
162
|
+
compiled = new RegExp(`^(?:${definition.pattern})$`, 'u');
|
|
163
|
+
patterns.set(definition, compiled);
|
|
164
|
+
}
|
|
165
|
+
return compiled;
|
|
166
|
+
}
|
|
167
|
+
|
|
127
168
|
export function assertSettingValue(
|
|
128
169
|
moduleId: string,
|
|
129
170
|
key: string,
|
|
@@ -158,7 +199,7 @@ export function assertSettingValue(
|
|
|
158
199
|
}
|
|
159
200
|
if (
|
|
160
201
|
definition.pattern !== undefined &&
|
|
161
|
-
!
|
|
202
|
+
!patternOf(definition).test(value)
|
|
162
203
|
) {
|
|
163
204
|
throw invalid(name, 'has an unsupported format.');
|
|
164
205
|
}
|
|
@@ -225,6 +266,30 @@ export function defineModuleSettings(
|
|
|
225
266
|
`Secret setting ${declaration.moduleId}.${key} cannot be shared or sent to clients.`,
|
|
226
267
|
);
|
|
227
268
|
}
|
|
269
|
+
/* A flag is offered to an operator as a bare switch on a screen that
|
|
270
|
+
shows no module documentation, so the declaration has to carry the
|
|
271
|
+
words that explain it; a secret one could be neither read back nor
|
|
272
|
+
audited with its values. A flag is on or off for one workspace, and
|
|
273
|
+
the screen that turns it on is that workspace's, so a platform-scoped
|
|
274
|
+
one would let an operator switch every other workspace from inside
|
|
275
|
+
their own. */
|
|
276
|
+
if (definition.kind === 'flag') {
|
|
277
|
+
if (definition.type !== 'boolean' || definition.secret) {
|
|
278
|
+
throw new Error(
|
|
279
|
+
`Flag ${declaration.moduleId}.${key} must be a non-secret boolean setting.`,
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
if (definition.scope === 'platform') {
|
|
283
|
+
throw new Error(
|
|
284
|
+
`Flag ${declaration.moduleId}.${key} must be tenant-scoped; a platform setting carries one value for every workspace.`,
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
if (!definition.label || !definition.description) {
|
|
288
|
+
throw new Error(
|
|
289
|
+
`Flag ${declaration.moduleId}.${key} must declare a label and a description.`,
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
228
293
|
}
|
|
229
294
|
return Object.freeze(declaration);
|
|
230
295
|
}
|
|
@@ -238,7 +303,17 @@ export function createModuleSettingsRuntime(
|
|
|
238
303
|
const now = options.now ?? Date.now;
|
|
239
304
|
const cacheLimit = options.cacheLimit ?? 512;
|
|
240
305
|
const declarations = new Map<string, ModuleSettingsDeclaration>();
|
|
241
|
-
|
|
306
|
+
/* Tenant, then module, to the values the store holds. Filled by prime and
|
|
307
|
+
by set, never by a read: a read of a tenant that is not here fails. */
|
|
308
|
+
const snapshots = new Map<
|
|
309
|
+
string,
|
|
310
|
+
Map<string, Readonly<Record<string, ModuleSettingValue>>>
|
|
311
|
+
>();
|
|
312
|
+
const loads = new Map<string, Promise<void>>();
|
|
313
|
+
/* The declaration generation a tenant was primed at; a module declared
|
|
314
|
+
later makes the next prime load what is missing. */
|
|
315
|
+
const primed = new Map<string, number>();
|
|
316
|
+
let generation = 0;
|
|
242
317
|
const listeners = new Set<ChangeListener>();
|
|
243
318
|
|
|
244
319
|
const definitionOf = (
|
|
@@ -280,24 +355,95 @@ export function createModuleSettingsRuntime(
|
|
|
280
355
|
return tenantId;
|
|
281
356
|
};
|
|
282
357
|
|
|
358
|
+
const tenantSnapshot = (
|
|
359
|
+
tenantId: string,
|
|
360
|
+
): Map<string, Readonly<Record<string, ModuleSettingValue>>> => {
|
|
361
|
+
let snapshot = snapshots.get(tenantId);
|
|
362
|
+
if (snapshot) return snapshot;
|
|
363
|
+
if (snapshots.size >= cacheLimit) {
|
|
364
|
+
for (const oldest of snapshots.keys()) {
|
|
365
|
+
if (oldest === PLATFORM_SETTINGS_TENANT) continue;
|
|
366
|
+
snapshots.delete(oldest);
|
|
367
|
+
primed.delete(oldest);
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
snapshot = new Map();
|
|
372
|
+
snapshots.set(tenantId, snapshot);
|
|
373
|
+
return snapshot;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
const loadModule = (tenantId: string, moduleId: string): Promise<void> => {
|
|
377
|
+
if (snapshots.get(tenantId)?.has(moduleId)) return Promise.resolve();
|
|
378
|
+
const loadKey = `${tenantId} ${moduleId}`;
|
|
379
|
+
const inflight = loads.get(loadKey);
|
|
380
|
+
if (inflight) return inflight;
|
|
381
|
+
const pending = store
|
|
382
|
+
.load(tenantId, moduleId)
|
|
383
|
+
.then((values) => {
|
|
384
|
+
tenantSnapshot(tenantId).set(moduleId, values);
|
|
385
|
+
})
|
|
386
|
+
.finally(() => loads.delete(loadKey));
|
|
387
|
+
loads.set(loadKey, pending);
|
|
388
|
+
return pending;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
const scopesOf = (
|
|
392
|
+
declaration: ModuleSettingsDeclaration,
|
|
393
|
+
): { readonly tenant: boolean; readonly platform: boolean } => {
|
|
394
|
+
let tenant = false;
|
|
395
|
+
let platform = false;
|
|
396
|
+
for (const definition of Object.values(declaration.settings)) {
|
|
397
|
+
if (definition.scope === 'platform') platform = true;
|
|
398
|
+
else tenant = true;
|
|
399
|
+
}
|
|
400
|
+
return { tenant, platform };
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
const prime = async (tenantId: string): Promise<void> => {
|
|
404
|
+
const at = generation;
|
|
405
|
+
if (primed.get(tenantId) === at) {
|
|
406
|
+
const snapshot = snapshots.get(tenantId);
|
|
407
|
+
if (snapshot) {
|
|
408
|
+
snapshots.delete(tenantId);
|
|
409
|
+
snapshots.set(tenantId, snapshot);
|
|
410
|
+
}
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const pending: Promise<void>[] = [];
|
|
414
|
+
for (const declaration of declarations.values()) {
|
|
415
|
+
const scopes = scopesOf(declaration);
|
|
416
|
+
if (scopes.platform) {
|
|
417
|
+
pending.push(
|
|
418
|
+
loadModule(PLATFORM_SETTINGS_TENANT, declaration.moduleId),
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
if (scopes.tenant && tenantId !== PLATFORM_SETTINGS_TENANT) {
|
|
422
|
+
pending.push(loadModule(tenantId, declaration.moduleId));
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
await Promise.all(pending);
|
|
426
|
+
tenantSnapshot(tenantId);
|
|
427
|
+
primed.set(tenantId, at);
|
|
428
|
+
};
|
|
429
|
+
|
|
283
430
|
const stored = (
|
|
284
431
|
tenantId: string,
|
|
285
432
|
moduleId: string,
|
|
286
433
|
): Readonly<Record<string, ModuleSettingValue>> => {
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
434
|
+
const values = snapshots.get(tenantId)?.get(moduleId);
|
|
435
|
+
if (!values) {
|
|
436
|
+
throw new ModuleSettingsError(
|
|
437
|
+
'SETTINGS_NOT_PRIMED',
|
|
438
|
+
`Settings of ${moduleId} for ${
|
|
439
|
+
tenantId === PLATFORM_SETTINGS_TENANT
|
|
440
|
+
? 'the platform'
|
|
441
|
+
: `tenant ${tenantId}`
|
|
442
|
+
} are not loaded; await settings.prime(tenantId) before reading.`,
|
|
443
|
+
500,
|
|
444
|
+
);
|
|
298
445
|
}
|
|
299
|
-
|
|
300
|
-
return loaded;
|
|
446
|
+
return values;
|
|
301
447
|
};
|
|
302
448
|
|
|
303
449
|
const resolve = (
|
|
@@ -332,10 +478,12 @@ export function createModuleSettingsRuntime(
|
|
|
332
478
|
);
|
|
333
479
|
}
|
|
334
480
|
declarations.set(declaration.moduleId, defineModuleSettings(declaration));
|
|
481
|
+
generation += 1;
|
|
335
482
|
},
|
|
336
483
|
declarations() {
|
|
337
484
|
return [...declarations.values()];
|
|
338
485
|
},
|
|
486
|
+
prime,
|
|
339
487
|
get(tenantId, moduleId, key) {
|
|
340
488
|
return resolve(tenantId, moduleId, key, definitionOf(moduleId, key))
|
|
341
489
|
.value as never;
|
|
@@ -361,27 +509,41 @@ export function createModuleSettingsRuntime(
|
|
|
361
509
|
}
|
|
362
510
|
return entries;
|
|
363
511
|
},
|
|
364
|
-
set(tenantId, moduleId, key, value, actor) {
|
|
512
|
+
async set(tenantId, moduleId, key, value, actor) {
|
|
365
513
|
const definition = definitionOf(moduleId, key);
|
|
366
514
|
const target = storageTenant(definition, moduleId, key, tenantId);
|
|
515
|
+
const next =
|
|
516
|
+
value === null
|
|
517
|
+
? definition.defaultValue
|
|
518
|
+
: assertSettingValue(moduleId, key, definition, value);
|
|
519
|
+
/* Read before the write, so the change carries the value that was
|
|
520
|
+
replaced. The snapshot keeps serving the old values until the
|
|
521
|
+
reload lands, so a concurrent read never finds a gap. */
|
|
522
|
+
await loadModule(target, moduleId);
|
|
523
|
+
const previous = definition.secret
|
|
524
|
+
? null
|
|
525
|
+
: resolve(tenantId, moduleId, key, definition).value;
|
|
367
526
|
if (value === null) {
|
|
368
|
-
store.clear(target, moduleId, key);
|
|
527
|
+
await store.clear(target, moduleId, key);
|
|
369
528
|
} else {
|
|
370
|
-
store.save({
|
|
529
|
+
await store.save({
|
|
371
530
|
tenantId: target,
|
|
372
531
|
moduleId,
|
|
373
532
|
key,
|
|
374
|
-
value:
|
|
533
|
+
value: next,
|
|
375
534
|
updatedBy: actor,
|
|
376
535
|
updatedAt: now(),
|
|
377
536
|
});
|
|
378
537
|
}
|
|
379
|
-
|
|
538
|
+
tenantSnapshot(target).set(moduleId, await store.load(target, moduleId));
|
|
380
539
|
const change: ModuleSettingChange = {
|
|
381
540
|
tenantId: target,
|
|
382
541
|
moduleId,
|
|
383
542
|
key,
|
|
384
543
|
cleared: value === null,
|
|
544
|
+
...(definition.kind ? { kind: definition.kind } : {}),
|
|
545
|
+
previous,
|
|
546
|
+
next: definition.secret ? null : next,
|
|
385
547
|
actor: { accountId: actor, tenantId },
|
|
386
548
|
};
|
|
387
549
|
for (const listener of listeners) {
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"@octanejs/app-core": "0.0.47",
|
|
14
14
|
"@flowdular/contracts": "workspace:*",
|
|
15
15
|
"@flowdular/kernel": "workspace:*",
|
|
16
|
-
"@flowdular/database": "workspace:*"
|
|
16
|
+
"@flowdular/database": "workspace:*",
|
|
17
|
+
"@flowdular/storage": "workspace:*"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
20
|
"typescript": "5.9.3",
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { ServerRoute } from '@octanejs/app-core';
|
|
2
2
|
import type { ModuleWebSurface } from '@flowdular/sdk/contracts';
|
|
3
3
|
import type { DatabaseProvider } from '@flowdular/sdk/database';
|
|
4
|
+
import type { StoragePort } from '@flowdular/sdk/storage';
|
|
5
|
+
import type { MailPort } from './mail/index.ts';
|
|
6
|
+
import type { ModuleMetrics } from './metrics.ts';
|
|
7
|
+
import type { Tracer } from './trace/index.ts';
|
|
4
8
|
import type {
|
|
5
9
|
ModuleSettingsDeclaration,
|
|
6
10
|
ModuleSettingsRuntime,
|
|
7
11
|
PlatformAgentRegistry,
|
|
8
12
|
PlatformCapabilityRegistry,
|
|
13
|
+
PlatformDataClassRegistry,
|
|
9
14
|
PlatformToolRegistry,
|
|
10
15
|
} from '@flowdular/sdk/kernel';
|
|
11
16
|
|
|
@@ -24,10 +29,43 @@ export interface ModuleServerContext<Auth> {
|
|
|
24
29
|
readonly agentTools: PlatformToolRegistry;
|
|
25
30
|
/** Business agent definitions modules register before the platform starts. */
|
|
26
31
|
readonly agentDefinitions: PlatformAgentRegistry;
|
|
32
|
+
/**
|
|
33
|
+
* The data a module owns, declared while it composes. The platform seals
|
|
34
|
+
* the registry after every composition ran, so `list()` answers the whole
|
|
35
|
+
* catalogue from any module's view; the binding limits what a module may
|
|
36
|
+
* declare, never what it may read.
|
|
37
|
+
*/
|
|
38
|
+
readonly dataClasses: PlatformDataClassRegistry;
|
|
27
39
|
/** Typed public services shared by composed modules without database access. */
|
|
28
40
|
readonly capabilities: PlatformCapabilityRegistry;
|
|
29
41
|
/** Platform-owned database leases. Modules never receive a DSN or pool. */
|
|
30
42
|
readonly databases: DatabaseProvider;
|
|
43
|
+
/**
|
|
44
|
+
* Platform-owned object storage. The tenant id is the first key segment and
|
|
45
|
+
* comes from the principal, never from the request, because no row-level
|
|
46
|
+
* security reaches an object store.
|
|
47
|
+
*/
|
|
48
|
+
readonly storage: StoragePort;
|
|
49
|
+
/**
|
|
50
|
+
* Platform-owned outbound mail. A module hands it a bounded message and
|
|
51
|
+
* never selects a transport; `configured` is false when the deployment
|
|
52
|
+
* composed none, and every send is refused with MAIL_NOT_CONFIGURED.
|
|
53
|
+
*/
|
|
54
|
+
readonly mail: MailPort;
|
|
55
|
+
/**
|
|
56
|
+
* The counters and histograms this module owns, already bound to its id by
|
|
57
|
+
* the generated composition. Every series it opens is exposed on
|
|
58
|
+
* `/api/metrics` as `flowdular_module_<module id>_<name>`, under the same
|
|
59
|
+
* bounds the request series have.
|
|
60
|
+
*/
|
|
61
|
+
readonly metrics: ModuleMetrics;
|
|
62
|
+
/**
|
|
63
|
+
* Spans for the work this module does. A module that enqueues work stores
|
|
64
|
+
* `currentTraceParent()` on the row it enqueues and hands that value back as
|
|
65
|
+
* `traceparent` when it starts the span for the claimed item, so a job
|
|
66
|
+
* carries the trace that enqueued it.
|
|
67
|
+
*/
|
|
68
|
+
readonly tracer: Tracer;
|
|
31
69
|
}
|
|
32
70
|
|
|
33
71
|
export interface ModuleServerComposition {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { ServerRoute, type Context } from '@octanejs/app-core';
|
|
2
|
+
import { serverLogger } from './log.ts';
|
|
3
|
+
import { serverMetrics } from './metrics.ts';
|
|
4
|
+
import {
|
|
5
|
+
formatTraceParent,
|
|
6
|
+
runWithTrace,
|
|
7
|
+
type TraceContext,
|
|
8
|
+
} from './trace/context.ts';
|
|
9
|
+
import { serverTracer, type Span } from './trace/tracer.ts';
|
|
2
10
|
|
|
3
11
|
export interface EndpointIdentity {
|
|
4
12
|
readonly subjectId: string;
|
|
@@ -7,6 +15,12 @@ export interface EndpointIdentity {
|
|
|
7
15
|
|
|
8
16
|
export interface EndpointExecutionContext {
|
|
9
17
|
readonly requestId: string;
|
|
18
|
+
/**
|
|
19
|
+
* The W3C trace this request runs in: the caller's `traceparent` when it
|
|
20
|
+
* sent a usable one, a new root otherwise. It is the ambient trace for
|
|
21
|
+
* everything the handler awaits and it is returned in the response header.
|
|
22
|
+
*/
|
|
23
|
+
readonly trace: TraceContext;
|
|
10
24
|
readonly identity: EndpointIdentity | null;
|
|
11
25
|
readonly octane: Context;
|
|
12
26
|
}
|
|
@@ -46,10 +60,11 @@ function problem(
|
|
|
46
60
|
code: string,
|
|
47
61
|
message: string,
|
|
48
62
|
requestId: string,
|
|
63
|
+
traceparent: string,
|
|
49
64
|
): Response {
|
|
50
65
|
return Response.json(
|
|
51
66
|
{ error: { code, message }, requestId },
|
|
52
|
-
{ status, headers: { 'cache-control': 'no-store' } },
|
|
67
|
+
{ status, headers: { 'cache-control': 'no-store', traceparent } },
|
|
53
68
|
);
|
|
54
69
|
}
|
|
55
70
|
|
|
@@ -81,56 +96,98 @@ export function defineEndpoint(
|
|
|
81
96
|
);
|
|
82
97
|
}
|
|
83
98
|
|
|
99
|
+
const serve = async (
|
|
100
|
+
context: Context,
|
|
101
|
+
requestId: string,
|
|
102
|
+
span: Span,
|
|
103
|
+
): Promise<Response> => {
|
|
104
|
+
const traceparent = formatTraceParent(span.context);
|
|
105
|
+
const startedAt = performance.now();
|
|
106
|
+
let identity: EndpointIdentity | null = null;
|
|
107
|
+
let status = 500;
|
|
108
|
+
try {
|
|
109
|
+
if (
|
|
110
|
+
definition.access.kind === 'permission' &&
|
|
111
|
+
'resolveIdentity' in definition
|
|
112
|
+
) {
|
|
113
|
+
identity = await definition.resolveIdentity(context);
|
|
114
|
+
if (!identity) {
|
|
115
|
+
status = 401;
|
|
116
|
+
return problem(
|
|
117
|
+
401,
|
|
118
|
+
'UNAUTHENTICATED',
|
|
119
|
+
'Authentication is required.',
|
|
120
|
+
requestId,
|
|
121
|
+
traceparent,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
if (!identity.permissions.has(definition.access.permission)) {
|
|
125
|
+
status = 403;
|
|
126
|
+
return problem(
|
|
127
|
+
403,
|
|
128
|
+
'FORBIDDEN',
|
|
129
|
+
'The required permission was not granted.',
|
|
130
|
+
requestId,
|
|
131
|
+
traceparent,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const response = await definition.handler({
|
|
137
|
+
requestId,
|
|
138
|
+
trace: span.context,
|
|
139
|
+
identity,
|
|
140
|
+
octane: context,
|
|
141
|
+
});
|
|
142
|
+
response.headers.set('x-request-id', requestId);
|
|
143
|
+
response.headers.set('traceparent', traceparent);
|
|
144
|
+
status = response.status;
|
|
145
|
+
return response;
|
|
146
|
+
} catch (error) {
|
|
147
|
+
/* An unexpected error may carry SQL parameters, provider responses, or
|
|
148
|
+
credentials in its message and attached fields. The request id and
|
|
149
|
+
endpoint identify the failure without sending that value to a logger. */
|
|
150
|
+
serverLogger().error('endpoint failed', {
|
|
151
|
+
requestId,
|
|
152
|
+
endpoint: definition.id,
|
|
153
|
+
err: { name: error instanceof Error ? error.name : 'non-error' },
|
|
154
|
+
});
|
|
155
|
+
return problem(
|
|
156
|
+
500,
|
|
157
|
+
'INTERNAL_ERROR',
|
|
158
|
+
'The request could not be completed.',
|
|
159
|
+
requestId,
|
|
160
|
+
traceparent,
|
|
161
|
+
);
|
|
162
|
+
} finally {
|
|
163
|
+
span.setAttribute('http.response.status_code', status);
|
|
164
|
+
span.end(status >= 500 ? 'error' : 'ok');
|
|
165
|
+
serverMetrics().recordHttpRequest({
|
|
166
|
+
endpoint: definition.id,
|
|
167
|
+
method: context.request.method,
|
|
168
|
+
status,
|
|
169
|
+
durationSeconds: (performance.now() - startedAt) / 1000,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
84
174
|
const serverRoute = new ServerRoute({
|
|
85
175
|
path: definition.path,
|
|
86
176
|
methods: definition.methods.map((method) => method.toUpperCase()),
|
|
87
|
-
handler:
|
|
177
|
+
handler: (context) => {
|
|
88
178
|
const requestId = requestIdOf(context);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
requestId,
|
|
102
|
-
);
|
|
103
|
-
if (!identity.permissions.has(definition.access.permission)) {
|
|
104
|
-
return problem(
|
|
105
|
-
403,
|
|
106
|
-
'FORBIDDEN',
|
|
107
|
-
'The required permission was not granted.',
|
|
108
|
-
requestId,
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const response = await definition.handler({
|
|
114
|
-
requestId,
|
|
115
|
-
identity,
|
|
116
|
-
octane: context,
|
|
117
|
-
});
|
|
118
|
-
response.headers.set('x-request-id', requestId);
|
|
119
|
-
return response;
|
|
120
|
-
} catch (error) {
|
|
121
|
-
/* An unexpected error may carry SQL parameters, provider responses, or
|
|
122
|
-
credentials in its message and attached fields. The request id and
|
|
123
|
-
endpoint identify the failure without sending that value to a logger. */
|
|
124
|
-
console.error(
|
|
125
|
-
`[${requestId}] endpoint ${definition.id} failed (${error instanceof Error ? 'Error' : 'non-error'})`,
|
|
126
|
-
);
|
|
127
|
-
return problem(
|
|
128
|
-
500,
|
|
129
|
-
'INTERNAL_ERROR',
|
|
130
|
-
'The request could not be completed.',
|
|
131
|
-
requestId,
|
|
132
|
-
);
|
|
133
|
-
}
|
|
179
|
+
/* An inbound header names the parent; an absent or malformed one is a
|
|
180
|
+
new root, so a request always belongs to exactly one trace. */
|
|
181
|
+
const span = serverTracer().startSpan(definition.id, {
|
|
182
|
+
traceparent: context.request.headers.get('traceparent'),
|
|
183
|
+
kind: 'server',
|
|
184
|
+
attributes: {
|
|
185
|
+
'flowdular.endpoint': definition.id,
|
|
186
|
+
'flowdular.request_id': requestId,
|
|
187
|
+
'http.request.method': context.request.method,
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
return runWithTrace(span.context, () => serve(context, requestId, span));
|
|
134
191
|
},
|
|
135
192
|
});
|
|
136
193
|
|