@cat-factory/worker 0.6.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/LICENSE +21 -0
- package/dist/app.d.ts +22 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +49 -0
- package/dist/app.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +234 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/ai/CloudflareModelProvider.d.ts +23 -0
- package/dist/infrastructure/ai/CloudflareModelProvider.d.ts.map +1 -0
- package/dist/infrastructure/ai/CloudflareModelProvider.js +62 -0
- package/dist/infrastructure/ai/CloudflareModelProvider.js.map +1 -0
- package/dist/infrastructure/ai/CompositeAgentExecutor.d.ts +2 -0
- package/dist/infrastructure/ai/CompositeAgentExecutor.d.ts.map +1 -0
- package/dist/infrastructure/ai/CompositeAgentExecutor.js +5 -0
- package/dist/infrastructure/ai/CompositeAgentExecutor.js.map +1 -0
- package/dist/infrastructure/ai/ContainerAgentExecutor.d.ts +2 -0
- package/dist/infrastructure/ai/ContainerAgentExecutor.d.ts.map +1 -0
- package/dist/infrastructure/ai/ContainerAgentExecutor.js +5 -0
- package/dist/infrastructure/ai/ContainerAgentExecutor.js.map +1 -0
- package/dist/infrastructure/ai/ContainerRepoBootstrapper.d.ts +2 -0
- package/dist/infrastructure/ai/ContainerRepoBootstrapper.d.ts.map +1 -0
- package/dist/infrastructure/ai/ContainerRepoBootstrapper.js +5 -0
- package/dist/infrastructure/ai/ContainerRepoBootstrapper.js.map +1 -0
- package/dist/infrastructure/ai/ContainerRepoScanner.d.ts +39 -0
- package/dist/infrastructure/ai/ContainerRepoScanner.d.ts.map +1 -0
- package/dist/infrastructure/ai/ContainerRepoScanner.js +115 -0
- package/dist/infrastructure/ai/ContainerRepoScanner.js.map +1 -0
- package/dist/infrastructure/ai/LlmFragmentSelector.d.ts +2 -0
- package/dist/infrastructure/ai/LlmFragmentSelector.d.ts.map +1 -0
- package/dist/infrastructure/ai/LlmFragmentSelector.js +4 -0
- package/dist/infrastructure/ai/LlmFragmentSelector.js.map +1 -0
- package/dist/infrastructure/ai/RunnerJobClient.d.ts +2 -0
- package/dist/infrastructure/ai/RunnerJobClient.d.ts.map +1 -0
- package/dist/infrastructure/ai/RunnerJobClient.js +5 -0
- package/dist/infrastructure/ai/RunnerJobClient.js.map +1 -0
- package/dist/infrastructure/ai/WorkersAiLlmUpstream.d.ts +28 -0
- package/dist/infrastructure/ai/WorkersAiLlmUpstream.d.ts.map +1 -0
- package/dist/infrastructure/ai/WorkersAiLlmUpstream.js +486 -0
- package/dist/infrastructure/ai/WorkersAiLlmUpstream.js.map +1 -0
- package/dist/infrastructure/ai/providerEndpoints.d.ts +17 -0
- package/dist/infrastructure/ai/providerEndpoints.d.ts.map +1 -0
- package/dist/infrastructure/ai/providerEndpoints.js +42 -0
- package/dist/infrastructure/ai/providerEndpoints.js.map +1 -0
- package/dist/infrastructure/ai/registries.d.ts +11 -0
- package/dist/infrastructure/ai/registries.d.ts.map +1 -0
- package/dist/infrastructure/ai/registries.js +14 -0
- package/dist/infrastructure/ai/registries.js.map +1 -0
- package/dist/infrastructure/auth/GitHubOAuth.d.ts +2 -0
- package/dist/infrastructure/auth/GitHubOAuth.d.ts.map +1 -0
- package/dist/infrastructure/auth/GitHubOAuth.js +3 -0
- package/dist/infrastructure/auth/GitHubOAuth.js.map +1 -0
- package/dist/infrastructure/auth/middleware.d.ts +2 -0
- package/dist/infrastructure/auth/middleware.d.ts.map +1 -0
- package/dist/infrastructure/auth/middleware.js +3 -0
- package/dist/infrastructure/auth/middleware.js.map +1 -0
- package/dist/infrastructure/auth/signing.d.ts +3 -0
- package/dist/infrastructure/auth/signing.d.ts.map +1 -0
- package/dist/infrastructure/auth/signing.js +3 -0
- package/dist/infrastructure/auth/signing.js.map +1 -0
- package/dist/infrastructure/config/agents.d.ts +6 -0
- package/dist/infrastructure/config/agents.d.ts.map +1 -0
- package/dist/infrastructure/config/agents.js +100 -0
- package/dist/infrastructure/config/agents.js.map +1 -0
- package/dist/infrastructure/config/auth.d.ts +13 -0
- package/dist/infrastructure/config/auth.d.ts.map +1 -0
- package/dist/infrastructure/config/auth.js +80 -0
- package/dist/infrastructure/config/auth.js.map +1 -0
- package/dist/infrastructure/config/cors.d.ts +2 -0
- package/dist/infrastructure/config/cors.d.ts.map +1 -0
- package/dist/infrastructure/config/cors.js +3 -0
- package/dist/infrastructure/config/cors.js.map +1 -0
- package/dist/infrastructure/config/datadog.d.ts +6 -0
- package/dist/infrastructure/config/datadog.d.ts.map +1 -0
- package/dist/infrastructure/config/datadog.js +22 -0
- package/dist/infrastructure/config/datadog.js.map +1 -0
- package/dist/infrastructure/config/documents.d.ts +5 -0
- package/dist/infrastructure/config/documents.d.ts.map +1 -0
- package/dist/infrastructure/config/documents.js +36 -0
- package/dist/infrastructure/config/documents.js.map +1 -0
- package/dist/infrastructure/config/email.d.ts +5 -0
- package/dist/infrastructure/config/email.d.ts.map +1 -0
- package/dist/infrastructure/config/email.js +12 -0
- package/dist/infrastructure/config/email.js.map +1 -0
- package/dist/infrastructure/config/environments.d.ts +5 -0
- package/dist/infrastructure/config/environments.d.ts.map +1 -0
- package/dist/infrastructure/config/environments.js +15 -0
- package/dist/infrastructure/config/environments.js.map +1 -0
- package/dist/infrastructure/config/execution.d.ts +5 -0
- package/dist/infrastructure/config/execution.d.ts.map +1 -0
- package/dist/infrastructure/config/execution.js +21 -0
- package/dist/infrastructure/config/execution.js.map +1 -0
- package/dist/infrastructure/config/fragmentLibrary.d.ts +5 -0
- package/dist/infrastructure/config/fragmentLibrary.d.ts.map +1 -0
- package/dist/infrastructure/config/fragmentLibrary.js +7 -0
- package/dist/infrastructure/config/fragmentLibrary.js.map +1 -0
- package/dist/infrastructure/config/github.d.ts +5 -0
- package/dist/infrastructure/config/github.d.ts.map +1 -0
- package/dist/infrastructure/config/github.js +25 -0
- package/dist/infrastructure/config/github.js.map +1 -0
- package/dist/infrastructure/config/index.d.ts +20 -0
- package/dist/infrastructure/config/index.d.ts.map +1 -0
- package/dist/infrastructure/config/index.js +52 -0
- package/dist/infrastructure/config/index.js.map +1 -0
- package/dist/infrastructure/config/langfuse.d.ts +10 -0
- package/dist/infrastructure/config/langfuse.d.ts.map +1 -0
- package/dist/infrastructure/config/langfuse.js +17 -0
- package/dist/infrastructure/config/langfuse.js.map +1 -0
- package/dist/infrastructure/config/observability.d.ts +10 -0
- package/dist/infrastructure/config/observability.d.ts.map +1 -0
- package/dist/infrastructure/config/observability.js +11 -0
- package/dist/infrastructure/config/observability.js.map +1 -0
- package/dist/infrastructure/config/retention.d.ts +5 -0
- package/dist/infrastructure/config/retention.d.ts.map +1 -0
- package/dist/infrastructure/config/retention.js +15 -0
- package/dist/infrastructure/config/retention.js.map +1 -0
- package/dist/infrastructure/config/runners.d.ts +5 -0
- package/dist/infrastructure/config/runners.d.ts.map +1 -0
- package/dist/infrastructure/config/runners.js +13 -0
- package/dist/infrastructure/config/runners.js.map +1 -0
- package/dist/infrastructure/config/slack.d.ts +5 -0
- package/dist/infrastructure/config/slack.d.ts.map +1 -0
- package/dist/infrastructure/config/slack.js +17 -0
- package/dist/infrastructure/config/slack.js.map +1 -0
- package/dist/infrastructure/config/spending.d.ts +4 -0
- package/dist/infrastructure/config/spending.d.ts.map +1 -0
- package/dist/infrastructure/config/spending.js +36 -0
- package/dist/infrastructure/config/spending.js.map +1 -0
- package/dist/infrastructure/config/tasks.d.ts +5 -0
- package/dist/infrastructure/config/tasks.d.ts.map +1 -0
- package/dist/infrastructure/config/tasks.js +31 -0
- package/dist/infrastructure/config/tasks.js.map +1 -0
- package/dist/infrastructure/config/utils.d.ts +6 -0
- package/dist/infrastructure/config/utils.d.ts.map +1 -0
- package/dist/infrastructure/config/utils.js +24 -0
- package/dist/infrastructure/config/utils.js.map +1 -0
- package/dist/infrastructure/container.d.ts +8 -0
- package/dist/infrastructure/container.d.ts.map +1 -0
- package/dist/infrastructure/container.js +1157 -0
- package/dist/infrastructure/container.js.map +1 -0
- package/dist/infrastructure/containers/CloudflareContainerTransport.d.ts +22 -0
- package/dist/infrastructure/containers/CloudflareContainerTransport.d.ts.map +1 -0
- package/dist/infrastructure/containers/CloudflareContainerTransport.js +129 -0
- package/dist/infrastructure/containers/CloudflareContainerTransport.js.map +1 -0
- package/dist/infrastructure/containers/ContainerInstanceRegistry.d.ts +62 -0
- package/dist/infrastructure/containers/ContainerInstanceRegistry.d.ts.map +1 -0
- package/dist/infrastructure/containers/ContainerInstanceRegistry.js +74 -0
- package/dist/infrastructure/containers/ContainerInstanceRegistry.js.map +1 -0
- package/dist/infrastructure/containers/ContainerSessionService.d.ts +2 -0
- package/dist/infrastructure/containers/ContainerSessionService.d.ts.map +1 -0
- package/dist/infrastructure/containers/ContainerSessionService.js +3 -0
- package/dist/infrastructure/containers/ContainerSessionService.js.map +1 -0
- package/dist/infrastructure/containers/ExecutionContainer.d.ts +48 -0
- package/dist/infrastructure/containers/ExecutionContainer.d.ts.map +1 -0
- package/dist/infrastructure/containers/ExecutionContainer.js +88 -0
- package/dist/infrastructure/containers/ExecutionContainer.js.map +1 -0
- package/dist/infrastructure/documents/ConfluenceProvider.d.ts +29 -0
- package/dist/infrastructure/documents/ConfluenceProvider.d.ts.map +1 -0
- package/dist/infrastructure/documents/ConfluenceProvider.js +179 -0
- package/dist/infrastructure/documents/ConfluenceProvider.js.map +1 -0
- package/dist/infrastructure/documents/GitHubDocsProvider.d.ts +42 -0
- package/dist/infrastructure/documents/GitHubDocsProvider.d.ts.map +1 -0
- package/dist/infrastructure/documents/GitHubDocsProvider.js +85 -0
- package/dist/infrastructure/documents/GitHubDocsProvider.js.map +1 -0
- package/dist/infrastructure/documents/NotionProvider.d.ts +32 -0
- package/dist/infrastructure/documents/NotionProvider.d.ts.map +1 -0
- package/dist/infrastructure/documents/NotionProvider.js +220 -0
- package/dist/infrastructure/documents/NotionProvider.js.map +1 -0
- package/dist/infrastructure/durable-objects/WorkspaceEventsHub.d.ts +20 -0
- package/dist/infrastructure/durable-objects/WorkspaceEventsHub.d.ts.map +1 -0
- package/dist/infrastructure/durable-objects/WorkspaceEventsHub.js +62 -0
- package/dist/infrastructure/durable-objects/WorkspaceEventsHub.js.map +1 -0
- package/dist/infrastructure/env.d.ts +370 -0
- package/dist/infrastructure/env.d.ts.map +1 -0
- package/dist/infrastructure/env.js +2 -0
- package/dist/infrastructure/env.js.map +1 -0
- package/dist/infrastructure/environments/HttpEnvironmentProvider.d.ts +27 -0
- package/dist/infrastructure/environments/HttpEnvironmentProvider.d.ts.map +1 -0
- package/dist/infrastructure/environments/HttpEnvironmentProvider.js +314 -0
- package/dist/infrastructure/environments/HttpEnvironmentProvider.js.map +1 -0
- package/dist/infrastructure/environments/WebCryptoSecretCipher.d.ts +2 -0
- package/dist/infrastructure/environments/WebCryptoSecretCipher.d.ts.map +1 -0
- package/dist/infrastructure/environments/WebCryptoSecretCipher.js +5 -0
- package/dist/infrastructure/environments/WebCryptoSecretCipher.js.map +1 -0
- package/dist/infrastructure/environments/sweep.d.ts +5 -0
- package/dist/infrastructure/environments/sweep.d.ts.map +1 -0
- package/dist/infrastructure/environments/sweep.js +16 -0
- package/dist/infrastructure/environments/sweep.js.map +1 -0
- package/dist/infrastructure/events/DurableObjectEventPublisher.d.ts +25 -0
- package/dist/infrastructure/events/DurableObjectEventPublisher.d.ts.map +1 -0
- package/dist/infrastructure/events/DurableObjectEventPublisher.js +64 -0
- package/dist/infrastructure/events/DurableObjectEventPublisher.js.map +1 -0
- package/dist/infrastructure/events/InAppNotificationChannel.d.ts +19 -0
- package/dist/infrastructure/events/InAppNotificationChannel.d.ts.map +1 -0
- package/dist/infrastructure/events/InAppNotificationChannel.js +22 -0
- package/dist/infrastructure/events/InAppNotificationChannel.js.map +1 -0
- package/dist/infrastructure/gateways/DoRealtimeGateway.d.ts +15 -0
- package/dist/infrastructure/gateways/DoRealtimeGateway.d.ts.map +1 -0
- package/dist/infrastructure/gateways/DoRealtimeGateway.js +20 -0
- package/dist/infrastructure/gateways/DoRealtimeGateway.js.map +1 -0
- package/dist/infrastructure/gateways/GitHubGateways.d.ts +27 -0
- package/dist/infrastructure/gateways/GitHubGateways.d.ts.map +1 -0
- package/dist/infrastructure/gateways/GitHubGateways.js +48 -0
- package/dist/infrastructure/gateways/GitHubGateways.js.map +1 -0
- package/dist/infrastructure/github/FetchGitHubClient.d.ts +2 -0
- package/dist/infrastructure/github/FetchGitHubClient.d.ts.map +1 -0
- package/dist/infrastructure/github/FetchGitHubClient.js +4 -0
- package/dist/infrastructure/github/FetchGitHubClient.js.map +1 -0
- package/dist/infrastructure/github/FetchGitHubProvisioningClient.d.ts +2 -0
- package/dist/infrastructure/github/FetchGitHubProvisioningClient.d.ts.map +1 -0
- package/dist/infrastructure/github/FetchGitHubProvisioningClient.js +5 -0
- package/dist/infrastructure/github/FetchGitHubProvisioningClient.js.map +1 -0
- package/dist/infrastructure/github/GitHubAppAuth.d.ts +2 -0
- package/dist/infrastructure/github/GitHubAppAuth.d.ts.map +1 -0
- package/dist/infrastructure/github/GitHubAppAuth.js +5 -0
- package/dist/infrastructure/github/GitHubAppAuth.js.map +1 -0
- package/dist/infrastructure/github/GitHubAppRegistry.d.ts +2 -0
- package/dist/infrastructure/github/GitHubAppRegistry.d.ts.map +1 -0
- package/dist/infrastructure/github/GitHubAppRegistry.js +4 -0
- package/dist/infrastructure/github/GitHubAppRegistry.js.map +1 -0
- package/dist/infrastructure/github/GitHubCiStatusProvider.d.ts +2 -0
- package/dist/infrastructure/github/GitHubCiStatusProvider.d.ts.map +1 -0
- package/dist/infrastructure/github/GitHubCiStatusProvider.js +4 -0
- package/dist/infrastructure/github/GitHubCiStatusProvider.js.map +1 -0
- package/dist/infrastructure/github/GitHubMergeabilityProvider.d.ts +2 -0
- package/dist/infrastructure/github/GitHubMergeabilityProvider.d.ts.map +1 -0
- package/dist/infrastructure/github/GitHubMergeabilityProvider.js +4 -0
- package/dist/infrastructure/github/GitHubMergeabilityProvider.js.map +1 -0
- package/dist/infrastructure/github/GitHubPullRequestMerger.d.ts +2 -0
- package/dist/infrastructure/github/GitHubPullRequestMerger.d.ts.map +1 -0
- package/dist/infrastructure/github/GitHubPullRequestMerger.js +4 -0
- package/dist/infrastructure/github/GitHubPullRequestMerger.js.map +1 -0
- package/dist/infrastructure/github/WebCryptoWebhookVerifier.d.ts +2 -0
- package/dist/infrastructure/github/WebCryptoWebhookVerifier.d.ts.map +1 -0
- package/dist/infrastructure/github/WebCryptoWebhookVerifier.js +5 -0
- package/dist/infrastructure/github/WebCryptoWebhookVerifier.js.map +1 -0
- package/dist/infrastructure/github/encoding.d.ts +2 -0
- package/dist/infrastructure/github/encoding.d.ts.map +1 -0
- package/dist/infrastructure/github/encoding.js +3 -0
- package/dist/infrastructure/github/encoding.js.map +1 -0
- package/dist/infrastructure/github/state.d.ts +2 -0
- package/dist/infrastructure/github/state.d.ts.map +1 -0
- package/dist/infrastructure/github/state.js +3 -0
- package/dist/infrastructure/github/state.js.map +1 -0
- package/dist/infrastructure/github/sync-consumer.d.ts +16 -0
- package/dist/infrastructure/github/sync-consumer.d.ts.map +1 -0
- package/dist/infrastructure/github/sync-consumer.js +130 -0
- package/dist/infrastructure/github/sync-consumer.js.map +1 -0
- package/dist/infrastructure/http/errorHandler.d.ts +2 -0
- package/dist/infrastructure/http/errorHandler.d.ts.map +1 -0
- package/dist/infrastructure/http/errorHandler.js +3 -0
- package/dist/infrastructure/http/errorHandler.js.map +1 -0
- package/dist/infrastructure/http/params.d.ts +2 -0
- package/dist/infrastructure/http/params.d.ts.map +1 -0
- package/dist/infrastructure/http/params.js +3 -0
- package/dist/infrastructure/http/params.js.map +1 -0
- package/dist/infrastructure/http/types.d.ts +12 -0
- package/dist/infrastructure/http/types.d.ts.map +1 -0
- package/dist/infrastructure/http/types.js +2 -0
- package/dist/infrastructure/http/types.js.map +1 -0
- package/dist/infrastructure/http/validation.d.ts +2 -0
- package/dist/infrastructure/http/validation.d.ts.map +1 -0
- package/dist/infrastructure/http/validation.js +3 -0
- package/dist/infrastructure/http/validation.js.map +1 -0
- package/dist/infrastructure/observability/logger.d.ts +3 -0
- package/dist/infrastructure/observability/logger.d.ts.map +1 -0
- package/dist/infrastructure/observability/logger.js +4 -0
- package/dist/infrastructure/observability/logger.js.map +1 -0
- package/dist/infrastructure/repositories/D1AccountInvitationRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1AccountInvitationRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1AccountInvitationRepository.js +63 -0
- package/dist/infrastructure/repositories/D1AccountInvitationRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1AccountRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1AccountRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1AccountRepository.js +52 -0
- package/dist/infrastructure/repositories/D1AccountRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1AgentRunRepository.d.ts +18 -0
- package/dist/infrastructure/repositories/D1AgentRunRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1AgentRunRepository.js +34 -0
- package/dist/infrastructure/repositories/D1AgentRunRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1BlockRepository.d.ts +23 -0
- package/dist/infrastructure/repositories/D1BlockRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1BlockRepository.js +101 -0
- package/dist/infrastructure/repositories/D1BlockRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1BootstrapJobRepository.d.ts +16 -0
- package/dist/infrastructure/repositories/D1BootstrapJobRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1BootstrapJobRepository.js +209 -0
- package/dist/infrastructure/repositories/D1BootstrapJobRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1BranchProjectionRepository.d.ts +12 -0
- package/dist/infrastructure/repositories/D1BranchProjectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1BranchProjectionRepository.js +29 -0
- package/dist/infrastructure/repositories/D1BranchProjectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1CheckRunProjectionRepository.d.ts +12 -0
- package/dist/infrastructure/repositories/D1CheckRunProjectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1CheckRunProjectionRepository.js +29 -0
- package/dist/infrastructure/repositories/D1CheckRunProjectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1ClarityReviewRepository.d.ts +19 -0
- package/dist/infrastructure/repositories/D1ClarityReviewRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1ClarityReviewRepository.js +75 -0
- package/dist/infrastructure/repositories/D1ClarityReviewRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1CommitProjectionRepository.d.ts +13 -0
- package/dist/infrastructure/repositories/D1CommitProjectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1CommitProjectionRepository.js +48 -0
- package/dist/infrastructure/repositories/D1CommitProjectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1ConsensusSessionRepository.d.ts +19 -0
- package/dist/infrastructure/repositories/D1ConsensusSessionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1ConsensusSessionRepository.js +88 -0
- package/dist/infrastructure/repositories/D1ConsensusSessionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1DatadogConnectionRepository.d.ts +17 -0
- package/dist/infrastructure/repositories/D1DatadogConnectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1DatadogConnectionRepository.js +47 -0
- package/dist/infrastructure/repositories/D1DatadogConnectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1DocumentConnectionRepository.d.ts +27 -0
- package/dist/infrastructure/repositories/D1DocumentConnectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1DocumentConnectionRepository.js +89 -0
- package/dist/infrastructure/repositories/D1DocumentConnectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1DocumentRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1DocumentRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1DocumentRepository.js +66 -0
- package/dist/infrastructure/repositories/D1DocumentRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1EmailConnectionRepository.d.ts +13 -0
- package/dist/infrastructure/repositories/D1EmailConnectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1EmailConnectionRepository.js +46 -0
- package/dist/infrastructure/repositories/D1EmailConnectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1EnvironmentConnectionRepository.d.ts +13 -0
- package/dist/infrastructure/repositories/D1EnvironmentConnectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1EnvironmentConnectionRepository.js +48 -0
- package/dist/infrastructure/repositories/D1EnvironmentConnectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1EnvironmentRegistryRepository.d.ts +17 -0
- package/dist/infrastructure/repositories/D1EnvironmentRegistryRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1EnvironmentRegistryRepository.js +95 -0
- package/dist/infrastructure/repositories/D1EnvironmentRegistryRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1ExecutionRepository.d.ts +28 -0
- package/dist/infrastructure/repositories/D1ExecutionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1ExecutionRepository.js +113 -0
- package/dist/infrastructure/repositories/D1ExecutionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1FragmentSourceRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1FragmentSourceRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1FragmentSourceRepository.js +66 -0
- package/dist/infrastructure/repositories/D1FragmentSourceRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1GitHubInstallationRepository.d.ts +17 -0
- package/dist/infrastructure/repositories/D1GitHubInstallationRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1GitHubInstallationRepository.js +79 -0
- package/dist/infrastructure/repositories/D1GitHubInstallationRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1IssueProjectionRepository.d.ts +13 -0
- package/dist/infrastructure/repositories/D1IssueProjectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1IssueProjectionRepository.js +36 -0
- package/dist/infrastructure/repositories/D1IssueProjectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1LiveContainerRepository.d.ts +17 -0
- package/dist/infrastructure/repositories/D1LiveContainerRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1LiveContainerRepository.js +40 -0
- package/dist/infrastructure/repositories/D1LiveContainerRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1LlmCallMetricRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1LlmCallMetricRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1LlmCallMetricRepository.js +123 -0
- package/dist/infrastructure/repositories/D1LlmCallMetricRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1LocalModelEndpointRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1LocalModelEndpointRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1LocalModelEndpointRepository.js +63 -0
- package/dist/infrastructure/repositories/D1LocalModelEndpointRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1MembershipRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1MembershipRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1MembershipRepository.js +58 -0
- package/dist/infrastructure/repositories/D1MembershipRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1MergePresetRepository.d.ts +21 -0
- package/dist/infrastructure/repositories/D1MergePresetRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1MergePresetRepository.js +88 -0
- package/dist/infrastructure/repositories/D1MergePresetRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1ModelDefaultsRepository.d.ts +18 -0
- package/dist/infrastructure/repositories/D1ModelDefaultsRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1ModelDefaultsRepository.js +47 -0
- package/dist/infrastructure/repositories/D1ModelDefaultsRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1NotificationRepository.d.ts +20 -0
- package/dist/infrastructure/repositories/D1NotificationRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1NotificationRepository.js +81 -0
- package/dist/infrastructure/repositories/D1NotificationRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1PersonalSubscriptionRepository.d.ts +28 -0
- package/dist/infrastructure/repositories/D1PersonalSubscriptionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1PersonalSubscriptionRepository.js +142 -0
- package/dist/infrastructure/repositories/D1PersonalSubscriptionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1PipelineRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1PipelineRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1PipelineRepository.js +46 -0
- package/dist/infrastructure/repositories/D1PipelineRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1PipelineScheduleRepository.d.ts +26 -0
- package/dist/infrastructure/repositories/D1PipelineScheduleRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1PipelineScheduleRepository.js +192 -0
- package/dist/infrastructure/repositories/D1PipelineScheduleRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1PromptFragmentRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1PromptFragmentRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1PromptFragmentRepository.js +90 -0
- package/dist/infrastructure/repositories/D1PromptFragmentRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1ProviderApiKeyRepository.d.ts +21 -0
- package/dist/infrastructure/repositories/D1ProviderApiKeyRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1ProviderApiKeyRepository.js +108 -0
- package/dist/infrastructure/repositories/D1ProviderApiKeyRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1ProviderSubscriptionTokenRepository.d.ts +19 -0
- package/dist/infrastructure/repositories/D1ProviderSubscriptionTokenRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1ProviderSubscriptionTokenRepository.js +78 -0
- package/dist/infrastructure/repositories/D1ProviderSubscriptionTokenRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1PullRequestProjectionRepository.d.ts +13 -0
- package/dist/infrastructure/repositories/D1PullRequestProjectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1PullRequestProjectionRepository.js +32 -0
- package/dist/infrastructure/repositories/D1PullRequestProjectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1RateLimitRepository.d.ts +18 -0
- package/dist/infrastructure/repositories/D1RateLimitRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1RateLimitRepository.js +30 -0
- package/dist/infrastructure/repositories/D1RateLimitRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1ReferenceArchitectureRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1ReferenceArchitectureRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1ReferenceArchitectureRepository.js +77 -0
- package/dist/infrastructure/repositories/D1ReferenceArchitectureRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1ReleaseHealthConfigRepository.d.ts +17 -0
- package/dist/infrastructure/repositories/D1ReleaseHealthConfigRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1ReleaseHealthConfigRepository.js +64 -0
- package/dist/infrastructure/repositories/D1ReleaseHealthConfigRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1RepoBlueprintRepository.d.ts +20 -0
- package/dist/infrastructure/repositories/D1RepoBlueprintRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1RepoBlueprintRepository.js +64 -0
- package/dist/infrastructure/repositories/D1RepoBlueprintRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1RepoProjectionRepository.d.ts +20 -0
- package/dist/infrastructure/repositories/D1RepoProjectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1RepoProjectionRepository.js +121 -0
- package/dist/infrastructure/repositories/D1RepoProjectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1RequirementReviewRepository.d.ts +20 -0
- package/dist/infrastructure/repositories/D1RequirementReviewRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1RequirementReviewRepository.js +76 -0
- package/dist/infrastructure/repositories/D1RequirementReviewRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1RunnerPoolConnectionRepository.d.ts +13 -0
- package/dist/infrastructure/repositories/D1RunnerPoolConnectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1RunnerPoolConnectionRepository.js +48 -0
- package/dist/infrastructure/repositories/D1RunnerPoolConnectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1ServiceFragmentDefaultsRepository.d.ts +16 -0
- package/dist/infrastructure/repositories/D1ServiceFragmentDefaultsRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1ServiceFragmentDefaultsRepository.js +27 -0
- package/dist/infrastructure/repositories/D1ServiceFragmentDefaultsRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1ServiceRepository.d.ts +19 -0
- package/dist/infrastructure/repositories/D1ServiceRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1ServiceRepository.js +114 -0
- package/dist/infrastructure/repositories/D1ServiceRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1SlackRepositories.d.ts +29 -0
- package/dist/infrastructure/repositories/D1SlackRepositories.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1SlackRepositories.js +119 -0
- package/dist/infrastructure/repositories/D1SlackRepositories.js.map +1 -0
- package/dist/infrastructure/repositories/D1TaskConnectionRepository.d.ts +27 -0
- package/dist/infrastructure/repositories/D1TaskConnectionRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1TaskConnectionRepository.js +89 -0
- package/dist/infrastructure/repositories/D1TaskConnectionRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1TaskRepository.d.ts +15 -0
- package/dist/infrastructure/repositories/D1TaskRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1TaskRepository.js +90 -0
- package/dist/infrastructure/repositories/D1TaskRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1TokenUsageRepository.d.ts +13 -0
- package/dist/infrastructure/repositories/D1TokenUsageRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1TokenUsageRepository.js +41 -0
- package/dist/infrastructure/repositories/D1TokenUsageRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1TrackerSettingsRepository.d.ts +12 -0
- package/dist/infrastructure/repositories/D1TrackerSettingsRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1TrackerSettingsRepository.js +32 -0
- package/dist/infrastructure/repositories/D1TrackerSettingsRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1UserRepository.d.ts +19 -0
- package/dist/infrastructure/repositories/D1UserRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1UserRepository.js +108 -0
- package/dist/infrastructure/repositories/D1UserRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1WorkspaceMountRepository.d.ts +19 -0
- package/dist/infrastructure/repositories/D1WorkspaceMountRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1WorkspaceMountRepository.js +115 -0
- package/dist/infrastructure/repositories/D1WorkspaceMountRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1WorkspaceRepository.d.ts +18 -0
- package/dist/infrastructure/repositories/D1WorkspaceRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1WorkspaceRepository.js +77 -0
- package/dist/infrastructure/repositories/D1WorkspaceRepository.js.map +1 -0
- package/dist/infrastructure/repositories/D1WorkspaceSettingsRepository.d.ts +17 -0
- package/dist/infrastructure/repositories/D1WorkspaceSettingsRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/D1WorkspaceSettingsRepository.js +50 -0
- package/dist/infrastructure/repositories/D1WorkspaceSettingsRepository.js.map +1 -0
- package/dist/infrastructure/repositories/chunk.d.ts +11 -0
- package/dist/infrastructure/repositories/chunk.d.ts.map +1 -0
- package/dist/infrastructure/repositories/chunk.js +17 -0
- package/dist/infrastructure/repositories/chunk.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/branch.d.ts +11 -0
- package/dist/infrastructure/repositories/github-mappers/branch.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/branch.js +22 -0
- package/dist/infrastructure/repositories/github-mappers/branch.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/check-run.d.ts +13 -0
- package/dist/infrastructure/repositories/github-mappers/check-run.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/check-run.js +24 -0
- package/dist/infrastructure/repositories/github-mappers/check-run.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/commit.d.ts +12 -0
- package/dist/infrastructure/repositories/github-mappers/commit.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/commit.js +22 -0
- package/dist/infrastructure/repositories/github-mappers/commit.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/index.d.ts +11 -0
- package/dist/infrastructure/repositories/github-mappers/index.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/index.js +14 -0
- package/dist/infrastructure/repositories/github-mappers/index.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/installation.d.ts +16 -0
- package/dist/infrastructure/repositories/github-mappers/installation.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/installation.js +29 -0
- package/dist/infrastructure/repositories/github-mappers/installation.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/issue.d.ts +15 -0
- package/dist/infrastructure/repositories/github-mappers/issue.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/issue.js +29 -0
- package/dist/infrastructure/repositories/github-mappers/issue.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/pull-request.d.ts +18 -0
- package/dist/infrastructure/repositories/github-mappers/pull-request.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/pull-request.js +36 -0
- package/dist/infrastructure/repositories/github-mappers/pull-request.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/repo.d.ts +15 -0
- package/dist/infrastructure/repositories/github-mappers/repo.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/repo.js +31 -0
- package/dist/infrastructure/repositories/github-mappers/repo.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/serialize.d.ts +3 -0
- package/dist/infrastructure/repositories/github-mappers/serialize.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/serialize.js +4 -0
- package/dist/infrastructure/repositories/github-mappers/serialize.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/sync-cursor.d.ts +8 -0
- package/dist/infrastructure/repositories/github-mappers/sync-cursor.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/sync-cursor.js +4 -0
- package/dist/infrastructure/repositories/github-mappers/sync-cursor.js.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/upsert.d.ts +11 -0
- package/dist/infrastructure/repositories/github-mappers/upsert.d.ts.map +1 -0
- package/dist/infrastructure/repositories/github-mappers/upsert.js +18 -0
- package/dist/infrastructure/repositories/github-mappers/upsert.js.map +1 -0
- package/dist/infrastructure/repositories/mappers.d.ts +2 -0
- package/dist/infrastructure/repositories/mappers.d.ts.map +1 -0
- package/dist/infrastructure/repositories/mappers.js +4 -0
- package/dist/infrastructure/repositories/mappers.js.map +1 -0
- package/dist/infrastructure/runners/HttpRunnerPoolProvider.d.ts +2 -0
- package/dist/infrastructure/runners/HttpRunnerPoolProvider.d.ts.map +1 -0
- package/dist/infrastructure/runners/HttpRunnerPoolProvider.js +5 -0
- package/dist/infrastructure/runners/HttpRunnerPoolProvider.js.map +1 -0
- package/dist/infrastructure/runners/RunnerPoolTransport.d.ts +2 -0
- package/dist/infrastructure/runners/RunnerPoolTransport.d.ts.map +1 -0
- package/dist/infrastructure/runners/RunnerPoolTransport.js +5 -0
- package/dist/infrastructure/runners/RunnerPoolTransport.js.map +1 -0
- package/dist/infrastructure/runtime.d.ts +8 -0
- package/dist/infrastructure/runtime.d.ts.map +1 -0
- package/dist/infrastructure/runtime.js +13 -0
- package/dist/infrastructure/runtime.js.map +1 -0
- package/dist/infrastructure/tasks/GitHubIssuesProvider.d.ts +50 -0
- package/dist/infrastructure/tasks/GitHubIssuesProvider.d.ts.map +1 -0
- package/dist/infrastructure/tasks/GitHubIssuesProvider.js +91 -0
- package/dist/infrastructure/tasks/GitHubIssuesProvider.js.map +1 -0
- package/dist/infrastructure/tasks/JiraProvider.d.ts +29 -0
- package/dist/infrastructure/tasks/JiraProvider.d.ts.map +1 -0
- package/dist/infrastructure/tasks/JiraProvider.js +109 -0
- package/dist/infrastructure/tasks/JiraProvider.js.map +1 -0
- package/dist/infrastructure/workflows/BootstrapWorkflow.d.ts +21 -0
- package/dist/infrastructure/workflows/BootstrapWorkflow.d.ts.map +1 -0
- package/dist/infrastructure/workflows/BootstrapWorkflow.js +72 -0
- package/dist/infrastructure/workflows/BootstrapWorkflow.js.map +1 -0
- package/dist/infrastructure/workflows/ExecutionWorkflow.d.ts +15 -0
- package/dist/infrastructure/workflows/ExecutionWorkflow.d.ts.map +1 -0
- package/dist/infrastructure/workflows/ExecutionWorkflow.js +169 -0
- package/dist/infrastructure/workflows/ExecutionWorkflow.js.map +1 -0
- package/dist/infrastructure/workflows/GitHubBackfillWorkflow.d.ts +17 -0
- package/dist/infrastructure/workflows/GitHubBackfillWorkflow.d.ts.map +1 -0
- package/dist/infrastructure/workflows/GitHubBackfillWorkflow.js +24 -0
- package/dist/infrastructure/workflows/GitHubBackfillWorkflow.js.map +1 -0
- package/dist/infrastructure/workflows/WorkflowsBootstrapRunner.d.ts +15 -0
- package/dist/infrastructure/workflows/WorkflowsBootstrapRunner.d.ts.map +1 -0
- package/dist/infrastructure/workflows/WorkflowsBootstrapRunner.js +34 -0
- package/dist/infrastructure/workflows/WorkflowsBootstrapRunner.js.map +1 -0
- package/dist/infrastructure/workflows/WorkflowsWorkRunner.d.ts +31 -0
- package/dist/infrastructure/workflows/WorkflowsWorkRunner.d.ts.map +1 -0
- package/dist/infrastructure/workflows/WorkflowsWorkRunner.js +55 -0
- package/dist/infrastructure/workflows/WorkflowsWorkRunner.js.map +1 -0
- package/dist/infrastructure/workflows/retention.d.ts +35 -0
- package/dist/infrastructure/workflows/retention.d.ts.map +1 -0
- package/dist/infrastructure/workflows/retention.js +26 -0
- package/dist/infrastructure/workflows/retention.js.map +1 -0
- package/dist/infrastructure/workflows/sweeper.d.ts +57 -0
- package/dist/infrastructure/workflows/sweeper.d.ts.map +1 -0
- package/dist/infrastructure/workflows/sweeper.js +62 -0
- package/dist/infrastructure/workflows/sweeper.js.map +1 -0
- package/migrations/0001_init.sql +677 -0
- package/migrations/0002_clarity_reviews.sql +19 -0
- package/migrations/0002_consensus.sql +38 -0
- package/migrations/0002_llm_reasoning_text.sql +6 -0
- package/migrations/0002_local_model_endpoints.sql +16 -0
- package/migrations/0003_pipeline_labels_archive.sql +13 -0
- package/migrations/0003_release_health.sql +34 -0
- package/migrations/0004_run_timing_task_types.sql +24 -0
- package/package.json +65 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
function rowToReview(row) {
|
|
2
|
+
let items = [];
|
|
3
|
+
try {
|
|
4
|
+
const parsed = JSON.parse(row.items);
|
|
5
|
+
if (Array.isArray(parsed))
|
|
6
|
+
items = parsed;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
items = [];
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
id: row.id,
|
|
13
|
+
blockId: row.block_id,
|
|
14
|
+
status: row.status,
|
|
15
|
+
items,
|
|
16
|
+
model: row.model,
|
|
17
|
+
clarifiedReport: row.clarified_report,
|
|
18
|
+
iteration: row.iteration,
|
|
19
|
+
maxIterations: row.max_iterations,
|
|
20
|
+
createdAt: row.created_at,
|
|
21
|
+
updatedAt: row.updated_at,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Clarity (bug-report triage) reviews, stored one row per review in `clarity_reviews`.
|
|
26
|
+
* The mirror of {@link D1RequirementReviewRepository}: items live as a JSON array, the
|
|
27
|
+
* service keeps at most one live review per block, so `getByBlock` returns the latest.
|
|
28
|
+
*/
|
|
29
|
+
export class D1ClarityReviewRepository {
|
|
30
|
+
db;
|
|
31
|
+
constructor({ db }) {
|
|
32
|
+
this.db = db;
|
|
33
|
+
}
|
|
34
|
+
async getByBlock(workspaceId, blockId) {
|
|
35
|
+
const row = await this.db
|
|
36
|
+
.prepare(`SELECT * FROM clarity_reviews
|
|
37
|
+
WHERE workspace_id = ? AND block_id = ?
|
|
38
|
+
ORDER BY created_at DESC LIMIT 1`)
|
|
39
|
+
.bind(workspaceId, blockId)
|
|
40
|
+
.first();
|
|
41
|
+
return row ? rowToReview(row) : null;
|
|
42
|
+
}
|
|
43
|
+
async get(workspaceId, id) {
|
|
44
|
+
const row = await this.db
|
|
45
|
+
.prepare(`SELECT * FROM clarity_reviews WHERE workspace_id = ? AND id = ?`)
|
|
46
|
+
.bind(workspaceId, id)
|
|
47
|
+
.first();
|
|
48
|
+
return row ? rowToReview(row) : null;
|
|
49
|
+
}
|
|
50
|
+
async upsert(workspaceId, review) {
|
|
51
|
+
await this.db
|
|
52
|
+
.prepare(`INSERT INTO clarity_reviews
|
|
53
|
+
(workspace_id, id, block_id, status, items, model, clarified_report,
|
|
54
|
+
iteration, max_iterations, created_at, updated_at)
|
|
55
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
56
|
+
ON CONFLICT (workspace_id, id) DO UPDATE SET
|
|
57
|
+
block_id = excluded.block_id,
|
|
58
|
+
status = excluded.status,
|
|
59
|
+
items = excluded.items,
|
|
60
|
+
model = excluded.model,
|
|
61
|
+
clarified_report = excluded.clarified_report,
|
|
62
|
+
iteration = excluded.iteration,
|
|
63
|
+
max_iterations = excluded.max_iterations,
|
|
64
|
+
updated_at = excluded.updated_at`)
|
|
65
|
+
.bind(workspaceId, review.id, review.blockId, review.status, JSON.stringify(review.items), review.model, review.clarifiedReport, review.iteration ?? 1, review.maxIterations ?? 1, review.createdAt, review.updatedAt)
|
|
66
|
+
.run();
|
|
67
|
+
}
|
|
68
|
+
async deleteByBlock(workspaceId, blockId) {
|
|
69
|
+
await this.db
|
|
70
|
+
.prepare(`DELETE FROM clarity_reviews WHERE workspace_id = ? AND block_id = ?`)
|
|
71
|
+
.bind(workspaceId, blockId)
|
|
72
|
+
.run();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=D1ClarityReviewRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1ClarityReviewRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1ClarityReviewRepository.ts"],"names":[],"mappings":"AAiBA,SAAS,WAAW,CAAC,GAAqB;IACxC,IAAI,KAAK,GAAwB,EAAE,CAAA;IACnC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACpC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,KAAK,GAAG,MAA6B,CAAA;IAClE,CAAC;IAAC,MAAM,CAAC;QACP,KAAK,GAAG,EAAE,CAAA;IACZ,CAAC;IACD,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,MAAM,EAAE,GAAG,CAAC,MAAiC;QAC7C,KAAK;QACL,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,eAAe,EAAE,GAAG,CAAC,gBAAgB;QACrC,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,aAAa,EAAE,GAAG,CAAC,cAAc;QACjC,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,SAAS,EAAE,GAAG,CAAC,U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AAA;IACV,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,WAAmB,EAAE,OAAe;QACtD,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CAAC,qEAAqE,CAAC;aAC9E,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;aAC1B,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CommitProjectionRepository, GitHubCommit } from '@cat-factory/kernel';
|
|
2
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
3
|
+
/** D1-backed projection of commits (migration 0004). */
|
|
4
|
+
export declare class D1CommitProjectionRepository implements CommitProjectionRepository {
|
|
5
|
+
private readonly db;
|
|
6
|
+
constructor({ db }: {
|
|
7
|
+
db: D1Database;
|
|
8
|
+
});
|
|
9
|
+
upsertMany(workspaceId: string, commits: GitHubCommit[]): Promise<void>;
|
|
10
|
+
deleteOlderThan(epochMs: number): Promise<number>;
|
|
11
|
+
listByRepo(workspaceId: string, repoGithubId: number, limit?: number): Promise<GitHubCommit[]>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=D1CommitProjectionRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1CommitProjectionRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1CommitProjectionRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACnF,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,2BAA2B,CAAA;AAWhF,wDAAwD;AACxD,qBAAa,4BAA6B,YAAW,0BAA0B;IAC7E,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAc5E;IAEK,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQtD;IAEK,UAAU,CACd,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,KAAK,SAAM,GACV,OAAO,CAAC,YAAY,EAAE,CAAC,CAQzB;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { buildUpsert, commitValues, rowToCommit } from './github-mappers';
|
|
2
|
+
/**
|
|
3
|
+
* Cap how many single-row upserts go in one `db.batch`. A backfill can hand us
|
|
4
|
+
* 100k+ commits in a single call; chunking keeps each batch well under D1's
|
|
5
|
+
* statement-count and bound-parameter ceilings (~100 params/statement). Each
|
|
6
|
+
* statement here binds one row's columns, so the cap is comfortably conservative.
|
|
7
|
+
*/
|
|
8
|
+
const UPSERT_CHUNK_SIZE = 50;
|
|
9
|
+
/** D1-backed projection of commits (migration 0004). */
|
|
10
|
+
export class D1CommitProjectionRepository {
|
|
11
|
+
db;
|
|
12
|
+
constructor({ db }) {
|
|
13
|
+
this.db = db;
|
|
14
|
+
}
|
|
15
|
+
async upsertMany(workspaceId, commits) {
|
|
16
|
+
if (commits.length === 0)
|
|
17
|
+
return;
|
|
18
|
+
const statements = commits.map((commit) => {
|
|
19
|
+
const { sql, binds } = buildUpsert('github_commits', commitValues(workspaceId, commit), [
|
|
20
|
+
'workspace_id',
|
|
21
|
+
'repo_github_id',
|
|
22
|
+
'sha',
|
|
23
|
+
]);
|
|
24
|
+
return this.db.prepare(sql).bind(...binds);
|
|
25
|
+
});
|
|
26
|
+
for (let i = 0; i < statements.length; i += UPSERT_CHUNK_SIZE) {
|
|
27
|
+
const chunk = statements.slice(i, i + UPSERT_CHUNK_SIZE);
|
|
28
|
+
await this.db.batch(chunk);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async deleteOlderThan(epochMs) {
|
|
32
|
+
// Range delete on idx_gh_commits_authored. NULL authored_at rows are kept,
|
|
33
|
+
// since we can't place them in the retention window.
|
|
34
|
+
const { meta } = await this.db
|
|
35
|
+
.prepare('DELETE FROM github_commits WHERE authored_at IS NOT NULL AND authored_at < ?')
|
|
36
|
+
.bind(epochMs)
|
|
37
|
+
.run();
|
|
38
|
+
return meta.changes ?? 0;
|
|
39
|
+
}
|
|
40
|
+
async listByRepo(workspaceId, repoGithubId, limit = 100) {
|
|
41
|
+
const { results } = await this.db
|
|
42
|
+
.prepare('SELECT * FROM github_commits WHERE workspace_id = ? AND repo_github_id = ? ORDER BY authored_at DESC LIMIT ?')
|
|
43
|
+
.bind(workspaceId, repoGithubId, limit)
|
|
44
|
+
.all();
|
|
45
|
+
return results.map(rowToCommit);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=D1CommitProjectionRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1CommitProjectionRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1CommitProjectionRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE/F;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAE5B,wDAAwD;AACxD,MAAM,OAAO,4BAA4B;IACtB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,WAAmB,EAAE,OAAuB;QAC3D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAM;QAChC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACxC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,gBAAgB,EAAE,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE;gBACtF,cAAc;gBACd,gBAAgB;gBAChB,KAAK;aACN,CAAC,CAAA;YACF,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAA;QAC5C,CAAC,CAAC,CAAA;QACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,IAAI,iBAAiB,EAAE,CAAC;YAC9D,MAAM,KAAK,GAA0B,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,CAAA;YAC/E,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAe;QACnC,2EAA2E;QAC3E,qDAAqD;QACrD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC3B,OAAO,CAAC,8EAA8E,CAAC;aACvF,IAAI,CAAC,OAAO,CAAC;aACb,GAAG,EAAE,CAAA;QACR,OAAO,IAAI,CAAC,OAAO,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED,KAAK,CAAC,UAAU,CACd,WAAmB,EACnB,YAAoB,EACpB,KAAK,GAAG,GAAG;QAEX,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC9B,OAAO,CACN,8GAA8G,CAC/G;aACA,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,KAAK,CAAC;aACtC,GAAG,EAAmB,CAAA;QACzB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ConsensusSessionRepository } from '@cat-factory/kernel';
|
|
2
|
+
import type { ConsensusSession } from '@cat-factory/contracts';
|
|
3
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
4
|
+
/**
|
|
5
|
+
* Consensus session transcripts in `consensus_sessions` (migration 0002), one row
|
|
6
|
+
* per (execution, step). The participants/rounds/dissent live as JSON columns; the
|
|
7
|
+
* session is upserted repeatedly as the multi-model process streams progress.
|
|
8
|
+
*/
|
|
9
|
+
export declare class D1ConsensusSessionRepository implements ConsensusSessionRepository {
|
|
10
|
+
private readonly db;
|
|
11
|
+
constructor({ db }: {
|
|
12
|
+
db: D1Database;
|
|
13
|
+
});
|
|
14
|
+
get(workspaceId: string, id: string): Promise<ConsensusSession | null>;
|
|
15
|
+
getByStep(workspaceId: string, executionId: string, stepIndex: number): Promise<ConsensusSession | null>;
|
|
16
|
+
getByBlock(workspaceId: string, blockId: string): Promise<ConsensusSession | null>;
|
|
17
|
+
upsert(workspaceId: string, session: ConsensusSession): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=D1ConsensusSessionRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1ConsensusSessionRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1ConsensusSessionRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,KAAK,EAAwC,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAiD3D;;;;GAIG;AACH,qBAAa,4BAA6B,YAAW,0BAA0B;IAC7E,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAM3E;IAEK,SAAS,CACb,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAUlC;IAEK,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAUvF;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC1E;CACF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
function parseJsonArray(raw) {
|
|
2
|
+
try {
|
|
3
|
+
const parsed = JSON.parse(raw);
|
|
4
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function rowToSession(row) {
|
|
11
|
+
return {
|
|
12
|
+
id: row.id,
|
|
13
|
+
blockId: row.block_id,
|
|
14
|
+
executionId: row.execution_id,
|
|
15
|
+
stepIndex: row.step_index,
|
|
16
|
+
agentKind: row.agent_kind,
|
|
17
|
+
strategy: row.strategy,
|
|
18
|
+
status: row.status,
|
|
19
|
+
participants: parseJsonArray(row.participants),
|
|
20
|
+
rounds: parseJsonArray(row.rounds),
|
|
21
|
+
synthesis: row.synthesis,
|
|
22
|
+
confidence: row.confidence,
|
|
23
|
+
dissent: parseJsonArray(row.dissent),
|
|
24
|
+
error: row.error,
|
|
25
|
+
createdAt: row.created_at,
|
|
26
|
+
updatedAt: row.updated_at,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Consensus session transcripts in `consensus_sessions` (migration 0002), one row
|
|
31
|
+
* per (execution, step). The participants/rounds/dissent live as JSON columns; the
|
|
32
|
+
* session is upserted repeatedly as the multi-model process streams progress.
|
|
33
|
+
*/
|
|
34
|
+
export class D1ConsensusSessionRepository {
|
|
35
|
+
db;
|
|
36
|
+
constructor({ db }) {
|
|
37
|
+
this.db = db;
|
|
38
|
+
}
|
|
39
|
+
async get(workspaceId, id) {
|
|
40
|
+
const row = await this.db
|
|
41
|
+
.prepare(`SELECT * FROM consensus_sessions WHERE workspace_id = ? AND id = ?`)
|
|
42
|
+
.bind(workspaceId, id)
|
|
43
|
+
.first();
|
|
44
|
+
return row ? rowToSession(row) : null;
|
|
45
|
+
}
|
|
46
|
+
async getByStep(workspaceId, executionId, stepIndex) {
|
|
47
|
+
const row = await this.db
|
|
48
|
+
.prepare(`SELECT * FROM consensus_sessions
|
|
49
|
+
WHERE workspace_id = ? AND execution_id = ? AND step_index = ?
|
|
50
|
+
ORDER BY created_at DESC LIMIT 1`)
|
|
51
|
+
.bind(workspaceId, executionId, stepIndex)
|
|
52
|
+
.first();
|
|
53
|
+
return row ? rowToSession(row) : null;
|
|
54
|
+
}
|
|
55
|
+
async getByBlock(workspaceId, blockId) {
|
|
56
|
+
const row = await this.db
|
|
57
|
+
.prepare(`SELECT * FROM consensus_sessions
|
|
58
|
+
WHERE workspace_id = ? AND block_id = ?
|
|
59
|
+
ORDER BY created_at DESC LIMIT 1`)
|
|
60
|
+
.bind(workspaceId, blockId)
|
|
61
|
+
.first();
|
|
62
|
+
return row ? rowToSession(row) : null;
|
|
63
|
+
}
|
|
64
|
+
async upsert(workspaceId, session) {
|
|
65
|
+
await this.db
|
|
66
|
+
.prepare(`INSERT INTO consensus_sessions
|
|
67
|
+
(workspace_id, id, block_id, execution_id, step_index, agent_kind, strategy, status,
|
|
68
|
+
participants, rounds, synthesis, confidence, dissent, error, created_at, updated_at)
|
|
69
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
70
|
+
ON CONFLICT (workspace_id, id) DO UPDATE SET
|
|
71
|
+
block_id = excluded.block_id,
|
|
72
|
+
execution_id = excluded.execution_id,
|
|
73
|
+
step_index = excluded.step_index,
|
|
74
|
+
agent_kind = excluded.agent_kind,
|
|
75
|
+
strategy = excluded.strategy,
|
|
76
|
+
status = excluded.status,
|
|
77
|
+
participants = excluded.participants,
|
|
78
|
+
rounds = excluded.rounds,
|
|
79
|
+
synthesis = excluded.synthesis,
|
|
80
|
+
confidence = excluded.confidence,
|
|
81
|
+
dissent = excluded.dissent,
|
|
82
|
+
error = excluded.error,
|
|
83
|
+
updated_at = excluded.updated_at`)
|
|
84
|
+
.bind(workspaceId, session.id, session.blockId, session.executionId, session.stepIndex, session.agentKind, session.strategy, session.status, JSON.stringify(session.participants), JSON.stringify(session.rounds), session.synthesis, session.confidence ?? null, JSON.stringify(session.dissent ?? []), session.error ?? null, session.createdAt, session.updatedAt)
|
|
85
|
+
.run();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=D1ConsensusSessionRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1ConsensusSessionRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1ConsensusSessionRepository.ts"],"names":[],"mappings":"AAsBA,SAAS,cAAc,CAAI,GAAW;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,MAAc,CAAC,CAAC,CAAC,EAAE,CAAA;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,GAAwB;IAC5C,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,WAAW,EAAE,GAAG,CAAC,YAAY;QAC7B,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,QAAQ,EAAE,GAAG,CAAC,QAAwC;QACtD,MAAM,EAAE,GAAG,CAAC,MAAoC;QAChD,YAAY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OAAO,CACN;;4CAEoC,CACrC;aACA,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;aAC1B,KAAK,EAAuB,CAAA;QAC/B,OAAO,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACvC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,WAAmB,EAAE,OAAyB;QACzD,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;;;;;;;;;;;;;;;;;4CAiBoC,CACrC;aACA,IAAI,CACH,WAAW,EACX,OAAO,CAAC,EAAE,EACV,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,MAAM,EACd,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,EACpC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAC9B,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,UAAU,IAAI,IAAI,EAC1B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,EACrC,OAAO,CAAC,KAAK,IAAI,IAAI,EACrB,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,SAAS,CAClB;aACA,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DatadogConnectionRecord, DatadogConnectionRepository } from '@cat-factory/kernel';
|
|
2
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
3
|
+
/**
|
|
4
|
+
* A workspace's Datadog connection (migration 0003). Exactly one row per workspace
|
|
5
|
+
* (the workspace id is the primary key). `api_key`/`app_key` are stored as sealed
|
|
6
|
+
* envelopes — the caller encrypts before upsert and decrypts at call time.
|
|
7
|
+
*/
|
|
8
|
+
export declare class D1DatadogConnectionRepository implements DatadogConnectionRepository {
|
|
9
|
+
private readonly db;
|
|
10
|
+
constructor({ db }: {
|
|
11
|
+
db: D1Database;
|
|
12
|
+
});
|
|
13
|
+
get(workspaceId: string): Promise<DatadogConnectionRecord | null>;
|
|
14
|
+
upsert(record: DatadogConnectionRecord): Promise<void>;
|
|
15
|
+
delete(workspaceId: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=D1DatadogConnectionRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1DatadogConnectionRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1DatadogConnectionRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAA;AAC/F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAsB3D;;;;GAIG;AACH,qBAAa,6BAA8B,YAAW,2BAA2B;IAC/E,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAMtE;IAEK,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB3D;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/C;CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
function rowToRecord(row) {
|
|
2
|
+
return {
|
|
3
|
+
workspaceId: row.workspace_id,
|
|
4
|
+
site: row.site,
|
|
5
|
+
apiKey: row.api_key,
|
|
6
|
+
appKey: row.app_key,
|
|
7
|
+
createdAt: row.created_at,
|
|
8
|
+
updatedAt: row.updated_at,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A workspace's Datadog connection (migration 0003). Exactly one row per workspace
|
|
13
|
+
* (the workspace id is the primary key). `api_key`/`app_key` are stored as sealed
|
|
14
|
+
* envelopes — the caller encrypts before upsert and decrypts at call time.
|
|
15
|
+
*/
|
|
16
|
+
export class D1DatadogConnectionRepository {
|
|
17
|
+
db;
|
|
18
|
+
constructor({ db }) {
|
|
19
|
+
this.db = db;
|
|
20
|
+
}
|
|
21
|
+
async get(workspaceId) {
|
|
22
|
+
const row = await this.db
|
|
23
|
+
.prepare(`SELECT * FROM datadog_connections WHERE workspace_id = ?`)
|
|
24
|
+
.bind(workspaceId)
|
|
25
|
+
.first();
|
|
26
|
+
return row ? rowToRecord(row) : null;
|
|
27
|
+
}
|
|
28
|
+
async upsert(record) {
|
|
29
|
+
await this.db
|
|
30
|
+
.prepare(`INSERT INTO datadog_connections (workspace_id, site, api_key, app_key, created_at, updated_at)
|
|
31
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
32
|
+
ON CONFLICT (workspace_id) DO UPDATE SET
|
|
33
|
+
site = excluded.site,
|
|
34
|
+
api_key = excluded.api_key,
|
|
35
|
+
app_key = excluded.app_key,
|
|
36
|
+
updated_at = excluded.updated_at`)
|
|
37
|
+
.bind(record.workspaceId, record.site, record.apiKey, record.appKey, record.createdAt, record.updatedAt)
|
|
38
|
+
.run();
|
|
39
|
+
}
|
|
40
|
+
async delete(workspaceId) {
|
|
41
|
+
await this.db
|
|
42
|
+
.prepare(`DELETE FROM datadog_connections WHERE workspace_id = ?`)
|
|
43
|
+
.bind(workspaceId)
|
|
44
|
+
.run();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=D1DatadogConnectionRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1DatadogConnectionRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1DatadogConnectionRepository.ts"],"names":[],"mappings":"AAYA,SAAS,WAAW,CAA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Cipher } from '@cat-factory/kernel';
|
|
2
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
3
|
+
/**
|
|
4
|
+
* D1-backed store of workspace → document-source connections (migration 0012).
|
|
5
|
+
*
|
|
6
|
+
* Source credentials (e.g. a Notion/Confluence API token) are third-party
|
|
7
|
+
* secrets, so they are encrypted at rest with the same AES-256-GCM envelope the
|
|
8
|
+
* environments integration uses — never written to D1 in plaintext. A row whose
|
|
9
|
+
* `credentials` column predates encryption (no `v1.` envelope) is still read as
|
|
10
|
+
* legacy plaintext JSON, then re-encrypted on the next write.
|
|
11
|
+
*/
|
|
12
|
+
export declare class D1DocumentConnectionRepository implements DocumentConnectionRepository {
|
|
13
|
+
private readonly db;
|
|
14
|
+
private readonly cipher;
|
|
15
|
+
constructor({ db, cipher }: {
|
|
16
|
+
db: D1Database;
|
|
17
|
+
cipher: SecretCipher;
|
|
18
|
+
});
|
|
19
|
+
/** Decode the stored credential blob, decrypting the envelope when present. */
|
|
20
|
+
private decodeCredentials;
|
|
21
|
+
private rowToRecord;
|
|
22
|
+
getByWorkspace(workspaceId: string, source: DocumentSourceKind): Promise<DocumentConnectionRecord | null>;
|
|
23
|
+
listByWorkspace(workspaceId: string): Promise<DocumentConnectionRecord[]>;
|
|
24
|
+
upsert(record: DocumentConnectionRecord): Promise<void>;
|
|
25
|
+
softDelete(workspaceId: string, source: DocumentSourceKind, at: number): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=D1DocumentConnectionRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1DocumentConnectionRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1DocumentConnectionRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,4BAA4B,EAC5B,kBAAkB,EAClB,YAAY,EACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAqB3D;;;;;;;;GAQG;AACH,qBAAa,8BAA+B,YAAW,4BAA4B;IACjF,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IAErC,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,YAAY,CAAA;KAAE,EAGnE;IAED,+EAA+E;YACjE,iBAAiB;YAYjB,WAAW;IAWnB,cAAc,CAClB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAQ1C;IAEK,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAQ9E;IAEK,MAAM,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB5D;IAEK,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO3F;CACF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function parseCredentials(json) {
|
|
2
|
+
try {
|
|
3
|
+
const parsed = JSON.parse(json);
|
|
4
|
+
if (parsed && typeof parsed === 'object')
|
|
5
|
+
return parsed;
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
// A malformed bag is treated as empty; the import path then fails closed.
|
|
9
|
+
}
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* D1-backed store of workspace → document-source connections (migration 0012).
|
|
14
|
+
*
|
|
15
|
+
* Source credentials (e.g. a Notion/Confluence API token) are third-party
|
|
16
|
+
* secrets, so they are encrypted at rest with the same AES-256-GCM envelope the
|
|
17
|
+
* environments integration uses — never written to D1 in plaintext. A row whose
|
|
18
|
+
* `credentials` column predates encryption (no `v1.` envelope) is still read as
|
|
19
|
+
* legacy plaintext JSON, then re-encrypted on the next write.
|
|
20
|
+
*/
|
|
21
|
+
export class D1DocumentConnectionRepository {
|
|
22
|
+
db;
|
|
23
|
+
cipher;
|
|
24
|
+
constructor({ db, cipher }) {
|
|
25
|
+
this.db = db;
|
|
26
|
+
this.cipher = cipher;
|
|
27
|
+
}
|
|
28
|
+
/** Decode the stored credential blob, decrypting the envelope when present. */
|
|
29
|
+
async decodeCredentials(stored) {
|
|
30
|
+
// Legacy plaintext rows (written before encryption) lack the envelope tag.
|
|
31
|
+
if (!stored.startsWith('v1.'))
|
|
32
|
+
return parseCredentials(stored);
|
|
33
|
+
try {
|
|
34
|
+
return parseCredentials(await this.cipher.decrypt(stored));
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// Wrong key / corrupt envelope: fail closed with an empty bag so the
|
|
38
|
+
// import path errors rather than leaking a decrypt exception.
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async rowToRecord(row) {
|
|
43
|
+
return {
|
|
44
|
+
workspaceId: row.workspace_id,
|
|
45
|
+
source: row.source,
|
|
46
|
+
credentials: await this.decodeCredentials(row.credentials),
|
|
47
|
+
label: row.label,
|
|
48
|
+
createdAt: row.created_at,
|
|
49
|
+
deletedAt: row.deleted_at,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async getByWorkspace(workspaceId, source) {
|
|
53
|
+
const row = await this.db
|
|
54
|
+
.prepare('SELECT * FROM document_connections WHERE workspace_id = ? AND source = ? AND deleted_at IS NULL')
|
|
55
|
+
.bind(workspaceId, source)
|
|
56
|
+
.first();
|
|
57
|
+
return row ? this.rowToRecord(row) : null;
|
|
58
|
+
}
|
|
59
|
+
async listByWorkspace(workspaceId) {
|
|
60
|
+
const { results } = await this.db
|
|
61
|
+
.prepare('SELECT * FROM document_connections WHERE workspace_id = ? AND deleted_at IS NULL ORDER BY created_at DESC')
|
|
62
|
+
.bind(workspaceId)
|
|
63
|
+
.all();
|
|
64
|
+
return Promise.all(results.map((row) => this.rowToRecord(row)));
|
|
65
|
+
}
|
|
66
|
+
async upsert(record) {
|
|
67
|
+
// A workspace has a single live connection per source: clear any prior
|
|
68
|
+
// binding (live or tombstoned) before inserting, so reconnecting can't
|
|
69
|
+
// collide on the (workspace_id, source) primary key.
|
|
70
|
+
await this.db
|
|
71
|
+
.prepare('DELETE FROM document_connections WHERE workspace_id = ? AND source = ?')
|
|
72
|
+
.bind(record.workspaceId, record.source)
|
|
73
|
+
.run();
|
|
74
|
+
const credentials = await this.cipher.encrypt(JSON.stringify(record.credentials));
|
|
75
|
+
await this.db
|
|
76
|
+
.prepare(`INSERT INTO document_connections
|
|
77
|
+
(workspace_id, source, credentials, label, created_at, deleted_at)
|
|
78
|
+
VALUES (?, ?, ?, ?, ?, NULL)`)
|
|
79
|
+
.bind(record.workspaceId, record.source, credentials, record.label, record.createdAt)
|
|
80
|
+
.run();
|
|
81
|
+
}
|
|
82
|
+
async softDelete(workspaceId, source, at) {
|
|
83
|
+
await this.db
|
|
84
|
+
.prepare('UPDATE document_connections SET deleted_at = ? WHERE workspace_id = ? AND source = ? AND deleted_at IS NULL')
|
|
85
|
+
.bind(at, workspaceId, source)
|
|
86
|
+
.run();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=D1DocumentConnectionRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1DocumentConnectionRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1DocumentConnectionRepository.ts"],"names":[],"mappings":"AAiBA,SAAS,gBAAgB,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC/B,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAgC,CAAA;IACnF,CAAC;IAAC,MAAM,CAAC;QACP,0EAA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|
|
1
|
+
import type { DocumentRecord, DocumentRepository, DocumentSourceKind } from '@cat-factory/kernel';
|
|
2
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
3
|
+
/** D1-backed store of imported document projections, across sources (migration 0012). */
|
|
4
|
+
export declare class D1DocumentRepository implements DocumentRepository {
|
|
5
|
+
private readonly db;
|
|
6
|
+
constructor({ db }: {
|
|
7
|
+
db: D1Database;
|
|
8
|
+
});
|
|
9
|
+
upsert(record: DocumentRecord): Promise<void>;
|
|
10
|
+
get(workspaceId: string, source: DocumentSourceKind, externalId: string): Promise<DocumentRecord | null>;
|
|
11
|
+
listByWorkspace(workspaceId: string): Promise<DocumentRecord[]>;
|
|
12
|
+
listByBlock(workspaceId: string, blockId: string): Promise<DocumentRecord[]>;
|
|
13
|
+
linkBlock(workspaceId: string, source: DocumentSourceKind, externalId: string, blockId: string | null): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=D1DocumentRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1DocumentRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1DocumentRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACjG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AA8B3D,yFAAyF;AACzF,qBAAa,oBAAqB,YAAW,kBAAkB;IAC7D,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BlD;IAEK,GAAG,CACP,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAQhC;IAEK,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAQpE;IAEK,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAQjF;IAEK,SAAS,CACb,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC,IAAI,CAAC,CAOf;CACF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
function rowToRecord(row) {
|
|
2
|
+
return {
|
|
3
|
+
workspaceId: row.workspace_id,
|
|
4
|
+
source: row.source,
|
|
5
|
+
externalId: row.external_id,
|
|
6
|
+
title: row.title,
|
|
7
|
+
url: row.url,
|
|
8
|
+
excerpt: row.excerpt,
|
|
9
|
+
body: row.body,
|
|
10
|
+
linkedBlockId: row.linked_block_id,
|
|
11
|
+
syncedAt: row.synced_at,
|
|
12
|
+
deletedAt: row.deleted_at,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** D1-backed store of imported document projections, across sources (migration 0012). */
|
|
16
|
+
export class D1DocumentRepository {
|
|
17
|
+
db;
|
|
18
|
+
constructor({ db }) {
|
|
19
|
+
this.db = db;
|
|
20
|
+
}
|
|
21
|
+
async upsert(record) {
|
|
22
|
+
await this.db
|
|
23
|
+
.prepare(`INSERT INTO documents
|
|
24
|
+
(workspace_id, source, external_id, title, url, excerpt, body,
|
|
25
|
+
linked_block_id, synced_at, deleted_at)
|
|
26
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL)
|
|
27
|
+
ON CONFLICT (workspace_id, source, external_id) DO UPDATE SET
|
|
28
|
+
title = excluded.title,
|
|
29
|
+
url = excluded.url,
|
|
30
|
+
excerpt = excluded.excerpt,
|
|
31
|
+
body = excluded.body,
|
|
32
|
+
linked_block_id = excluded.linked_block_id,
|
|
33
|
+
synced_at = excluded.synced_at,
|
|
34
|
+
deleted_at = NULL`)
|
|
35
|
+
.bind(record.workspaceId, record.source, record.externalId, record.title, record.url, record.excerpt, record.body, record.linkedBlockId, record.syncedAt)
|
|
36
|
+
.run();
|
|
37
|
+
}
|
|
38
|
+
async get(workspaceId, source, externalId) {
|
|
39
|
+
const row = await this.db
|
|
40
|
+
.prepare('SELECT * FROM documents WHERE workspace_id = ? AND source = ? AND external_id = ? AND deleted_at IS NULL')
|
|
41
|
+
.bind(workspaceId, source, externalId)
|
|
42
|
+
.first();
|
|
43
|
+
return row ? rowToRecord(row) : null;
|
|
44
|
+
}
|
|
45
|
+
async listByWorkspace(workspaceId) {
|
|
46
|
+
const { results } = await this.db
|
|
47
|
+
.prepare('SELECT * FROM documents WHERE workspace_id = ? AND deleted_at IS NULL ORDER BY synced_at DESC')
|
|
48
|
+
.bind(workspaceId)
|
|
49
|
+
.all();
|
|
50
|
+
return results.map(rowToRecord);
|
|
51
|
+
}
|
|
52
|
+
async listByBlock(workspaceId, blockId) {
|
|
53
|
+
const { results } = await this.db
|
|
54
|
+
.prepare('SELECT * FROM documents WHERE workspace_id = ? AND linked_block_id = ? AND deleted_at IS NULL ORDER BY synced_at DESC')
|
|
55
|
+
.bind(workspaceId, blockId)
|
|
56
|
+
.all();
|
|
57
|
+
return results.map(rowToRecord);
|
|
58
|
+
}
|
|
59
|
+
async linkBlock(workspaceId, source, externalId, blockId) {
|
|
60
|
+
await this.db
|
|
61
|
+
.prepare('UPDATE documents SET linked_block_id = ? WHERE workspace_id = ? AND source = ? AND external_id = ?')
|
|
62
|
+
.bind(blockId, workspaceId, source, externalId)
|
|
63
|
+
.run();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=D1DocumentRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1DocumentRepository.js","sourceRoot":"","s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G,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,WAAmB;QACvC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC9B,OAAO,CACN,+FAA+F,CAChG;aACA,IAAI,CAAC,WAAW,CAAC;aACjB,GAAG,EAAe,CAAA;QACrB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;IACjC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,WAAmB,EAAE,OAAe;QACpD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC9B,OAAO,CACN,uHAAuH,CACxH;aACA,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;aAC1B,GAAG,EAAe,CAAA;QACrB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;IACjC,CAAC;IAED,KAAK,CAAC,SAAS,CACb,WAAmB,EACnB,MAA0B,EAC1B,UAAkB,EAClB,OAAsB;QAEtB,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN,oGAAoG,CACrG;aACA,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC;aAC9C,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EmailConnectionRecord, EmailConnectionRepository } from '@cat-factory/kernel';
|
|
2
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
3
|
+
/** D1-backed per-account email-sender connection (sealed provider API key). */
|
|
4
|
+
export declare class D1EmailConnectionRepository implements EmailConnectionRepository {
|
|
5
|
+
private readonly db;
|
|
6
|
+
constructor({ db }: {
|
|
7
|
+
db: D1Database;
|
|
8
|
+
});
|
|
9
|
+
getByAccount(accountId: string): Promise<EmailConnectionRecord | null>;
|
|
10
|
+
upsert(record: EmailConnectionRecord): Promise<void>;
|
|
11
|
+
softDelete(accountId: string, at: number): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=D1EmailConnectionRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1EmailConnectionRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1EmailConnectionRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EAE1B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAwB3D,+EAA+E;AAC/E,qBAAa,2BAA4B,YAAW,yBAAyB;IAC3E,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAM3E;IAEK,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBzD;IAEK,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK7D;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
function rowToRecord(row) {
|
|
2
|
+
return {
|
|
3
|
+
accountId: row.account_id,
|
|
4
|
+
provider: row.provider,
|
|
5
|
+
fromAddress: row.from_address,
|
|
6
|
+
apiKeyCipher: row.api_key_cipher,
|
|
7
|
+
createdAt: row.created_at,
|
|
8
|
+
updatedAt: row.updated_at,
|
|
9
|
+
deletedAt: row.deleted_at,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** D1-backed per-account email-sender connection (sealed provider API key). */
|
|
13
|
+
export class D1EmailConnectionRepository {
|
|
14
|
+
db;
|
|
15
|
+
constructor({ db }) {
|
|
16
|
+
this.db = db;
|
|
17
|
+
}
|
|
18
|
+
async getByAccount(accountId) {
|
|
19
|
+
const row = await this.db
|
|
20
|
+
.prepare('SELECT * FROM email_connections WHERE account_id = ? AND deleted_at IS NULL')
|
|
21
|
+
.bind(accountId)
|
|
22
|
+
.first();
|
|
23
|
+
return row ? rowToRecord(row) : null;
|
|
24
|
+
}
|
|
25
|
+
async upsert(record) {
|
|
26
|
+
await this.db
|
|
27
|
+
.prepare(`INSERT INTO email_connections
|
|
28
|
+
(account_id, provider, from_address, api_key_cipher, created_at, updated_at, deleted_at)
|
|
29
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
30
|
+
ON CONFLICT (account_id) DO UPDATE SET
|
|
31
|
+
provider = excluded.provider,
|
|
32
|
+
from_address = excluded.from_address,
|
|
33
|
+
api_key_cipher = excluded.api_key_cipher,
|
|
34
|
+
updated_at = excluded.updated_at,
|
|
35
|
+
deleted_at = excluded.deleted_at`)
|
|
36
|
+
.bind(record.accountId, record.provider, record.fromAddress, record.apiKeyCipher, record.createdAt, record.updatedAt, record.deletedAt)
|
|
37
|
+
.run();
|
|
38
|
+
}
|
|
39
|
+
async softDelete(accountId, at) {
|
|
40
|
+
await this.db
|
|
41
|
+
.prepare('UPDATE email_connections SET deleted_at = ?, updated_at = ? WHERE account_id = ?')
|
|
42
|
+
.bind(at, at, accountId)
|
|
43
|
+
.run();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=D1EmailConnectionRepository.js.map
|