@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,81 @@
|
|
|
1
|
+
function rowToNotification(row) {
|
|
2
|
+
let payload = null;
|
|
3
|
+
if (row.payload) {
|
|
4
|
+
try {
|
|
5
|
+
payload = JSON.parse(row.payload);
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
payload = null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
id: row.id,
|
|
13
|
+
type: row.type,
|
|
14
|
+
status: row.status,
|
|
15
|
+
severity: row.severity ?? 'normal',
|
|
16
|
+
blockId: row.block_id,
|
|
17
|
+
executionId: row.execution_id,
|
|
18
|
+
title: row.title,
|
|
19
|
+
body: row.body,
|
|
20
|
+
payload,
|
|
21
|
+
createdAt: row.created_at,
|
|
22
|
+
resolvedAt: row.resolved_at,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Notifications, one row per notification in `notifications` (migration 0024).
|
|
27
|
+
* The optional structured `payload` (assessment / PR url / pipeline name) is a
|
|
28
|
+
* JSON column. Open notifications back the board inbox + snapshot; the engine
|
|
29
|
+
* de-dupes an open card per (block, type) via {@link findOpenByBlock}.
|
|
30
|
+
*/
|
|
31
|
+
export class D1NotificationRepository {
|
|
32
|
+
db;
|
|
33
|
+
constructor({ db }) {
|
|
34
|
+
this.db = db;
|
|
35
|
+
}
|
|
36
|
+
async get(workspaceId, id) {
|
|
37
|
+
const row = await this.db
|
|
38
|
+
.prepare(`SELECT * FROM notifications WHERE workspace_id = ? AND id = ?`)
|
|
39
|
+
.bind(workspaceId, id)
|
|
40
|
+
.first();
|
|
41
|
+
return row ? rowToNotification(row) : null;
|
|
42
|
+
}
|
|
43
|
+
async listOpen(workspaceId) {
|
|
44
|
+
const { results } = await this.db
|
|
45
|
+
.prepare(`SELECT * FROM notifications
|
|
46
|
+
WHERE workspace_id = ? AND status = 'open'
|
|
47
|
+
ORDER BY created_at DESC`)
|
|
48
|
+
.bind(workspaceId)
|
|
49
|
+
.all();
|
|
50
|
+
return results.map(rowToNotification);
|
|
51
|
+
}
|
|
52
|
+
async findOpenByBlock(workspaceId, blockId, type) {
|
|
53
|
+
const row = await this.db
|
|
54
|
+
.prepare(`SELECT * FROM notifications
|
|
55
|
+
WHERE workspace_id = ? AND block_id = ? AND type = ? AND status = 'open'
|
|
56
|
+
ORDER BY created_at DESC LIMIT 1`)
|
|
57
|
+
.bind(workspaceId, blockId, type)
|
|
58
|
+
.first();
|
|
59
|
+
return row ? rowToNotification(row) : null;
|
|
60
|
+
}
|
|
61
|
+
async upsert(workspaceId, notification) {
|
|
62
|
+
await this.db
|
|
63
|
+
.prepare(`INSERT INTO notifications
|
|
64
|
+
(workspace_id, id, type, status, severity, block_id, execution_id, title, body, payload,
|
|
65
|
+
created_at, resolved_at)
|
|
66
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
67
|
+
ON CONFLICT (workspace_id, id) DO UPDATE SET
|
|
68
|
+
type = excluded.type,
|
|
69
|
+
status = excluded.status,
|
|
70
|
+
severity = excluded.severity,
|
|
71
|
+
block_id = excluded.block_id,
|
|
72
|
+
execution_id = excluded.execution_id,
|
|
73
|
+
title = excluded.title,
|
|
74
|
+
body = excluded.body,
|
|
75
|
+
payload = excluded.payload,
|
|
76
|
+
resolved_at = excluded.resolved_at`)
|
|
77
|
+
.bind(workspaceId, notification.id, notification.type, notification.status, notification.severity ?? 'normal', notification.blockId, notification.executionId, notification.title, notification.body, notification.payload ? JSON.stringify(notification.payload) : null, notification.createdAt, notification.resolvedAt)
|
|
78
|
+
.run();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=D1NotificationRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1NotificationRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1NotificationRepository.ts"],"names":[],"mappings":"AAuBA,SAAS,iBAAiB,CAAC,GAAoB;IAC7C,IAAI,OAAO,GAA+B,IAAI,CAAA;IAC9C,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC;YACH,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAwB,CAAA;QAC1D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,GAAG,IAAI,CAAA;QAChB,CAAC;IACH,CAAC;IACD,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,IAAI,EAAE,GAAG,CAAC,IAAwB;QAClC,MAAM,EAAE,GAAG,CAAC,MAAgC;QAC5C,QAAQ,EAAG,GAAG,CAAC,QAAwC,IAAI,QAAQ;QACnE,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,WAAW,EAAE,GAAG,CAAC,YAAY;QA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AC,WAAmB,EAAE,YAA0B;QAC1D,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;;;;;;;;;;;;;8CAasC,CACvC;aACA,IAAI,CACH,WAAW,EACX,YAAY,CAAC,EAAE,EACf,YAAY,CAAC,IAAI,EACjB,YAAY,CAAC,MAAM,EACnB,YAAY,CAAC,QAAQ,IAAI,QAAQ,EACjC,YAAY,CAAC,OAAO,EACpB,YAAY,CAAC,WAAW,EACxB,YAAY,CAAC,KAAK,EAClB,YAAY,CAAC,IAAI,EACjB,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAClE,YAAY,CAAC,SAAS,EACtB,YAAY,CAAC,UAAU,CACxB;aACA,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PersonalSubscriptionRecord, PersonalSubscriptionRepository, SubscriptionActivationRecord, SubscriptionActivationRepository, SubscriptionVendor } from '@cat-factory/kernel';
|
|
2
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
3
|
+
/** D1-backed store of a user's individual-usage subscriptions (migration 0039). */
|
|
4
|
+
export declare class D1PersonalSubscriptionRepository implements PersonalSubscriptionRepository {
|
|
5
|
+
private readonly db;
|
|
6
|
+
constructor({ db }: {
|
|
7
|
+
db: D1Database;
|
|
8
|
+
});
|
|
9
|
+
getByUserVendor(userId: string, vendor: SubscriptionVendor): Promise<PersonalSubscriptionRecord | null>;
|
|
10
|
+
listByUser(userId: string): Promise<PersonalSubscriptionRecord[]>;
|
|
11
|
+
upsert(record: PersonalSubscriptionRecord): Promise<void>;
|
|
12
|
+
markUsed(userId: string, vendor: SubscriptionVendor, at: number): Promise<void>;
|
|
13
|
+
softDelete(userId: string, vendor: SubscriptionVendor, at: number): Promise<void>;
|
|
14
|
+
listExpiring(now: number, before: number): Promise<PersonalSubscriptionRecord[]>;
|
|
15
|
+
}
|
|
16
|
+
/** D1-backed store of per-run personal-credential activations (migration 0039). */
|
|
17
|
+
export declare class D1SubscriptionActivationRepository implements SubscriptionActivationRepository {
|
|
18
|
+
private readonly db;
|
|
19
|
+
constructor({ db }: {
|
|
20
|
+
db: D1Database;
|
|
21
|
+
});
|
|
22
|
+
get(executionId: string, userId: string, vendor: SubscriptionVendor, now: number): Promise<SubscriptionActivationRecord | null>;
|
|
23
|
+
upsert(record: SubscriptionActivationRecord): Promise<void>;
|
|
24
|
+
refresh(executionId: string, userId: string, vendor: SubscriptionVendor, expiresAt: number): Promise<void>;
|
|
25
|
+
deleteByExecution(executionId: string): Promise<void>;
|
|
26
|
+
deleteExpired(now: number): Promise<number>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=D1PersonalSubscriptionRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1PersonalSubscriptionRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1PersonalSubscriptionRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,8BAA8B,EAC9B,4BAA4B,EAC5B,gCAAgC,EAChC,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AA8B3D,mFAAmF;AACnF,qBAAa,gCAAiC,YAAW,8BAA8B;IACrF,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAC/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,eAAe,CACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAS5C;IAEK,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAStE;IAEK,MAAM,CAAC,MAAM,E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id,
|
|
5
|
+
vendor: row.vendor,
|
|
6
|
+
label: row.label,
|
|
7
|
+
tokenCipher: row.token_cipher,
|
|
8
|
+
expiresAt: row.expires_at,
|
|
9
|
+
createdAt: row.created_at,
|
|
10
|
+
updatedAt: row.updated_at,
|
|
11
|
+
lastUsedAt: row.last_used_at,
|
|
12
|
+
deletedAt: row.deleted_at,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** D1-backed store of a user's individual-usage subscriptions (migration 0039). */
|
|
16
|
+
export class D1PersonalSubscriptionRepository {
|
|
17
|
+
db;
|
|
18
|
+
constructor({ db }) {
|
|
19
|
+
this.db = db;
|
|
20
|
+
}
|
|
21
|
+
async getByUserVendor(userId, vendor) {
|
|
22
|
+
const row = await this.db
|
|
23
|
+
.prepare(`SELECT * FROM personal_subscriptions
|
|
24
|
+
WHERE user_id = ? AND vendor = ? AND deleted_at IS NULL`)
|
|
25
|
+
.bind(userId, vendor)
|
|
26
|
+
.first();
|
|
27
|
+
return row ? toRecord(row) : null;
|
|
28
|
+
}
|
|
29
|
+
async listByUser(userId) {
|
|
30
|
+
const { results } = await this.db
|
|
31
|
+
.prepare(`SELECT * FROM personal_subscriptions
|
|
32
|
+
WHERE user_id = ? AND deleted_at IS NULL ORDER BY created_at ASC`)
|
|
33
|
+
.bind(userId)
|
|
34
|
+
.all();
|
|
35
|
+
return (results ?? []).map(toRecord);
|
|
36
|
+
}
|
|
37
|
+
async upsert(record) {
|
|
38
|
+
// Keyed by (user_id, vendor): replace any live row so a user has exactly one
|
|
39
|
+
// credential per vendor. Soft-delete the prior live row, then insert the new one.
|
|
40
|
+
await this.db
|
|
41
|
+
.prepare(`UPDATE personal_subscriptions SET deleted_at = ?
|
|
42
|
+
WHERE user_id = ? AND vendor = ? AND deleted_at IS NULL AND id != ?`)
|
|
43
|
+
.bind(record.updatedAt, record.userId, record.vendor, record.id)
|
|
44
|
+
.run();
|
|
45
|
+
await this.db
|
|
46
|
+
.prepare(`INSERT INTO personal_subscriptions
|
|
47
|
+
(id, user_id, vendor, label, token_cipher, expires_at, created_at, updated_at,
|
|
48
|
+
last_used_at, deleted_at)
|
|
49
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL)
|
|
50
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
51
|
+
label = excluded.label,
|
|
52
|
+
token_cipher = excluded.token_cipher,
|
|
53
|
+
expires_at = excluded.expires_at,
|
|
54
|
+
updated_at = excluded.updated_at,
|
|
55
|
+
deleted_at = NULL`)
|
|
56
|
+
.bind(record.id, record.userId, record.vendor, record.label, record.tokenCipher, record.expiresAt, record.createdAt, record.updatedAt, record.lastUsedAt)
|
|
57
|
+
.run();
|
|
58
|
+
}
|
|
59
|
+
async markUsed(userId, vendor, at) {
|
|
60
|
+
await this.db
|
|
61
|
+
.prepare(`UPDATE personal_subscriptions SET last_used_at = ?
|
|
62
|
+
WHERE user_id = ? AND vendor = ? AND deleted_at IS NULL`)
|
|
63
|
+
.bind(at, userId, vendor)
|
|
64
|
+
.run();
|
|
65
|
+
}
|
|
66
|
+
async softDelete(userId, vendor, at) {
|
|
67
|
+
await this.db
|
|
68
|
+
.prepare(`UPDATE personal_subscriptions SET deleted_at = ?
|
|
69
|
+
WHERE user_id = ? AND vendor = ? AND deleted_at IS NULL`)
|
|
70
|
+
.bind(at, userId, vendor)
|
|
71
|
+
.run();
|
|
72
|
+
}
|
|
73
|
+
async listExpiring(now, before) {
|
|
74
|
+
const { results } = await this.db
|
|
75
|
+
.prepare(`SELECT * FROM personal_subscriptions
|
|
76
|
+
WHERE deleted_at IS NULL AND expires_at IS NOT NULL
|
|
77
|
+
AND expires_at >= ? AND expires_at <= ?
|
|
78
|
+
ORDER BY expires_at ASC`)
|
|
79
|
+
.bind(now, before)
|
|
80
|
+
.all();
|
|
81
|
+
return (results ?? []).map(toRecord);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function toActivation(row) {
|
|
85
|
+
return {
|
|
86
|
+
id: row.id,
|
|
87
|
+
executionId: row.execution_id,
|
|
88
|
+
userId: row.user_id,
|
|
89
|
+
vendor: row.vendor,
|
|
90
|
+
tokenCipher: row.token_cipher,
|
|
91
|
+
createdAt: row.created_at,
|
|
92
|
+
expiresAt: row.expires_at,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** D1-backed store of per-run personal-credential activations (migration 0039). */
|
|
96
|
+
export class D1SubscriptionActivationRepository {
|
|
97
|
+
db;
|
|
98
|
+
constructor({ db }) {
|
|
99
|
+
this.db = db;
|
|
100
|
+
}
|
|
101
|
+
async get(executionId, userId, vendor, now) {
|
|
102
|
+
const row = await this.db
|
|
103
|
+
.prepare(`SELECT * FROM subscription_activations
|
|
104
|
+
WHERE execution_id = ? AND user_id = ? AND vendor = ? AND expires_at > ?`)
|
|
105
|
+
.bind(executionId, userId, vendor, now)
|
|
106
|
+
.first();
|
|
107
|
+
return row ? toActivation(row) : null;
|
|
108
|
+
}
|
|
109
|
+
async upsert(record) {
|
|
110
|
+
await this.db
|
|
111
|
+
.prepare(`INSERT INTO subscription_activations
|
|
112
|
+
(id, execution_id, user_id, vendor, token_cipher, created_at, expires_at)
|
|
113
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
114
|
+
ON CONFLICT (execution_id, user_id, vendor) DO UPDATE SET
|
|
115
|
+
token_cipher = excluded.token_cipher,
|
|
116
|
+
created_at = excluded.created_at,
|
|
117
|
+
expires_at = excluded.expires_at`)
|
|
118
|
+
.bind(record.id, record.executionId, record.userId, record.vendor, record.tokenCipher, record.createdAt, record.expiresAt)
|
|
119
|
+
.run();
|
|
120
|
+
}
|
|
121
|
+
async refresh(executionId, userId, vendor, expiresAt) {
|
|
122
|
+
await this.db
|
|
123
|
+
.prepare(`UPDATE subscription_activations SET expires_at = ?
|
|
124
|
+
WHERE execution_id = ? AND user_id = ? AND vendor = ?`)
|
|
125
|
+
.bind(expiresAt, executionId, userId, vendor)
|
|
126
|
+
.run();
|
|
127
|
+
}
|
|
128
|
+
async deleteByExecution(executionId) {
|
|
129
|
+
await this.db
|
|
130
|
+
.prepare('DELETE FROM subscription_activations WHERE execution_id = ?')
|
|
131
|
+
.bind(executionId)
|
|
132
|
+
.run();
|
|
133
|
+
}
|
|
134
|
+
async deleteExpired(now) {
|
|
135
|
+
const result = await this.db
|
|
136
|
+
.prepare('DELETE FROM subscription_activations WHERE expires_at <= ?')
|
|
137
|
+
.bind(now)
|
|
138
|
+
.run();
|
|
139
|
+
return result.meta.changes ?? 0;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=D1PersonalSubscriptionRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1PersonalSubscriptionRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1PersonalSubscriptionRepository.ts"],"names":[],"mappings":"AAsBA,SAAS,QAAQ,CAAC,GAA4B;IAC5C,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,MAAM,EAAE,GAAG,CAAC,MAA4B;QACxC,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,WAAW,EAAE,GAAG,CAAC,YAAY;QAC7B,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,UAAU,EAAE,GAAG,CAAC,YAAY;QAC5B,SAAS,EAAE,GAAG,CAAC,UAAU;KAC1B,CAAA;AACH,CAAC;AAED,mFAAmF;AACnF,MAAM,OAAO,gCAAgC;IAC1B,EAAE,CAAY;IAC/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,MAAc,EACd,MAA0B;QAE1B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CACN;kEAC0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AAK,EAA6B,CAAA;QACrC,OAAO,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACvC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAoC;QAC/C,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;;;;;;4CAMoC,CACrC;aACA,IAAI,CACH,MAAM,CAAC,EAAE,EACT,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,SAAS,CACjB;aACA,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,OAAO,CACX,WAAmB,EACnB,MAAc,EACd,MAA0B,EAC1B,SAAiB;QAEjB,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;gEACwD,CACzD;aACA,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC;aAC5C,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,WAAmB;QACzC,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CAAC,6DAA6D,CAAC;aACtE,IAAI,CAAC,WAAW,CAAC;aACjB,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,GAAW;QAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,EAAE;aACzB,OAAO,CAAC,4DAA4D,CAAC;aACrE,IAAI,CAAC,GAAG,CAAC;aACT,GAAG,EAAE,CAAA;QACR,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAA;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PipelineRepository } from '@cat-factory/kernel';
|
|
2
|
+
import type { Pipeline } from '@cat-factory/contracts';
|
|
3
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
4
|
+
export declare class D1PipelineRepository implements PipelineRepository {
|
|
5
|
+
private readonly db;
|
|
6
|
+
constructor({ db }: {
|
|
7
|
+
db: D1Database;
|
|
8
|
+
});
|
|
9
|
+
listByWorkspace(workspaceId: string): Promise<Pipeline[]>;
|
|
10
|
+
get(workspaceId: string, id: string): Promise<Pipeline | null>;
|
|
11
|
+
insert(workspaceId: string, pipeline: Pipeline): Promise<void>;
|
|
12
|
+
update(workspaceId: string, pipeline: Pipeline): Promise<void>;
|
|
13
|
+
delete(workspaceId: string, id: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=D1PipelineRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1PipelineRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1PipelineRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAG3D,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,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAU9D;IAEK,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAMnE;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBnE;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBnE;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK3D;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { rowToPipeline } from './mappers';
|
|
2
|
+
export class D1PipelineRepository {
|
|
3
|
+
db;
|
|
4
|
+
constructor({ db }) {
|
|
5
|
+
this.db = db;
|
|
6
|
+
}
|
|
7
|
+
async listByWorkspace(workspaceId) {
|
|
8
|
+
// Order by rowid: SQLite's monotonic insert sequence, so a workspace's pipelines
|
|
9
|
+
// come back in the deterministic order they were seeded (the curated
|
|
10
|
+
// `seedPipelines()` catalog order). The Postgres facade reproduces this with an
|
|
11
|
+
// explicit `seq` column (it has no rowid) — see DrizzlePipelineRepository.
|
|
12
|
+
const { results } = await this.db
|
|
13
|
+
.prepare('SELECT * FROM pipelines WHERE workspace_id = ? ORDER BY rowid')
|
|
14
|
+
.bind(workspaceId)
|
|
15
|
+
.all();
|
|
16
|
+
return results.map(rowToPipeline);
|
|
17
|
+
}
|
|
18
|
+
async get(workspaceId, id) {
|
|
19
|
+
const row = await this.db
|
|
20
|
+
.prepare('SELECT * FROM pipelines WHERE workspace_id = ? AND id = ?')
|
|
21
|
+
.bind(workspaceId, id)
|
|
22
|
+
.first();
|
|
23
|
+
return row ? rowToPipeline(row) : null;
|
|
24
|
+
}
|
|
25
|
+
async insert(workspaceId, pipeline) {
|
|
26
|
+
await this.db
|
|
27
|
+
.prepare('INSERT INTO pipelines (workspace_id, id, name, agent_kinds, gates, thresholds, enabled, consensus, gating, labels, archived, builtin) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)')
|
|
28
|
+
.bind(workspaceId, pipeline.id, pipeline.name, JSON.stringify(pipeline.agentKinds), pipeline.gates ? JSON.stringify(pipeline.gates) : null, pipeline.thresholds ? JSON.stringify(pipeline.thresholds) : null, pipeline.enabled ? JSON.stringify(pipeline.enabled) : null, pipeline.consensus ? JSON.stringify(pipeline.consensus) : null, pipeline.gating ? JSON.stringify(pipeline.gating) : null, pipeline.labels ? JSON.stringify(pipeline.labels) : null, pipeline.archived ? 1 : null, pipeline.builtin ? 1 : null)
|
|
29
|
+
.run();
|
|
30
|
+
}
|
|
31
|
+
async update(workspaceId, pipeline) {
|
|
32
|
+
// UPDATE (not delete+insert) preserves the row's rowid, so an edited pipeline keeps
|
|
33
|
+
// its place in the catalog order. `builtin` is immutable, so it is not rewritten.
|
|
34
|
+
await this.db
|
|
35
|
+
.prepare('UPDATE pipelines SET name = ?, agent_kinds = ?, gates = ?, thresholds = ?, enabled = ?, consensus = ?, gating = ?, labels = ?, archived = ? WHERE workspace_id = ? AND id = ?')
|
|
36
|
+
.bind(pipeline.name, JSON.stringify(pipeline.agentKinds), pipeline.gates ? JSON.stringify(pipeline.gates) : null, pipeline.thresholds ? JSON.stringify(pipeline.thresholds) : null, pipeline.enabled ? JSON.stringify(pipeline.enabled) : null, pipeline.consensus ? JSON.stringify(pipeline.consensus) : null, pipeline.gating ? JSON.stringify(pipeline.gating) : null, pipeline.labels ? JSON.stringify(pipeline.labels) : null, pipeline.archived ? 1 : null, workspaceId, pipeline.id)
|
|
37
|
+
.run();
|
|
38
|
+
}
|
|
39
|
+
async delete(workspaceId, id) {
|
|
40
|
+
await this.db
|
|
41
|
+
.prepare('DELETE FROM pipelines WHERE workspace_id = ? AND id = ?')
|
|
42
|
+
.bind(workspaceId, id)
|
|
43
|
+
.run();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=D1PipelineRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1PipelineRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1PipelineRepository.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,aAAa,EAAE,MAAM,WAAW,CAAA;AAE3D,MAAM,OAAO,oBAAoB;IACd,EAA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S,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAC9D,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EACxD,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EACxD,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAC5B,WAAW,EACX,QAAQ,CAAC,EAAE,CACZ;aACA,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,WAAmB,EAAE,EAAU;QAC1C,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CAAC,yDAAyD,CAAC;aAClE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;aACrB,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DueSchedule, PipelineScheduleRepository, PipelineSchedule, ScheduleRun } from '@cat-factory/kernel';
|
|
2
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
3
|
+
/**
|
|
4
|
+
* Recurring pipelines, in `pipeline_schedules` + `pipeline_schedule_runs`
|
|
5
|
+
* (migration 0029). `listDue` is a deliberately cross-workspace query (the cron
|
|
6
|
+
* sweeper fires every workspace's due schedules in one pass).
|
|
7
|
+
*/
|
|
8
|
+
export declare class D1PipelineScheduleRepository implements PipelineScheduleRepository {
|
|
9
|
+
private readonly db;
|
|
10
|
+
constructor({ db }: {
|
|
11
|
+
db: D1Database;
|
|
12
|
+
});
|
|
13
|
+
get(workspaceId: string, id: string): Promise<PipelineSchedule | null>;
|
|
14
|
+
getByBlock(workspaceId: string, blockId: string): Promise<PipelineSchedule | null>;
|
|
15
|
+
list(workspaceId: string): Promise<PipelineSchedule[]>;
|
|
16
|
+
listByService(serviceId: string): Promise<PipelineSchedule[]>;
|
|
17
|
+
listByServices(serviceIds: string[]): Promise<PipelineSchedule[]>;
|
|
18
|
+
listDue(asOf: number): Promise<DueSchedule[]>;
|
|
19
|
+
upsert(workspaceId: string, schedule: PipelineSchedule): Promise<void>;
|
|
20
|
+
remove(workspaceId: string, id: string): Promise<void>;
|
|
21
|
+
insertRun(workspaceId: string, run: ScheduleRun): Promise<void>;
|
|
22
|
+
updateRun(workspaceId: string, runId: string, patch: Partial<Pick<ScheduleRun, 'status' | 'finishedAt' | 'outcome' | 'executionId'>>): Promise<void>;
|
|
23
|
+
listRuns(workspaceId: string, scheduleId: string): Promise<ScheduleRun[]>;
|
|
24
|
+
pruneRunsBefore(before: number): Promise<number>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=D1PipelineScheduleRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1PipelineScheduleRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1PipelineScheduleRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,0BAA0B,EAC1B,gBAAgB,EAEhB,WAAW,EAEZ,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AA8E3D;;;;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,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAMvF;IAEK,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAM3D;IAEK,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAMlE;IAEK,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAetE;IAEK,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAUlD;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6C3E;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK3D;IAEK,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBpE;IAEK,SAAS,CACb,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,GAAG,aAAa,CAAC,CAAC,GACrF,OAAO,CAAC,IAAI,CAAC,CA2Bf;IAEK,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAU9E;IAEK,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMrD;CACF"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { chunkForIn } from './chunk';
|
|
2
|
+
function rowToSchedule(row) {
|
|
3
|
+
const recurrence = {
|
|
4
|
+
intervalHours: row.interval_hours,
|
|
5
|
+
weekdays: safeJsonArray(row.weekdays),
|
|
6
|
+
windowStartHour: row.window_start_hour,
|
|
7
|
+
windowEndHour: row.window_end_hour,
|
|
8
|
+
timezone: row.timezone,
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
id: row.id,
|
|
12
|
+
serviceId: row.service_id,
|
|
13
|
+
blockId: row.block_id,
|
|
14
|
+
frameId: row.frame_id,
|
|
15
|
+
pipelineId: row.pipeline_id,
|
|
16
|
+
template: row.template,
|
|
17
|
+
name: row.name,
|
|
18
|
+
recurrence,
|
|
19
|
+
enabled: row.enabled === 1,
|
|
20
|
+
lastRunAt: row.last_run_at,
|
|
21
|
+
nextRunAt: row.next_run_at,
|
|
22
|
+
createdAt: row.created_at,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function safeJsonArray(value) {
|
|
26
|
+
try {
|
|
27
|
+
const parsed = JSON.parse(value);
|
|
28
|
+
return Array.isArray(parsed) ? parsed.filter((n) => typeof n === 'number') : [];
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function rowToRun(row) {
|
|
35
|
+
return {
|
|
36
|
+
id: row.id,
|
|
37
|
+
scheduleId: row.schedule_id,
|
|
38
|
+
executionId: row.execution_id,
|
|
39
|
+
status: row.status,
|
|
40
|
+
startedAt: row.started_at,
|
|
41
|
+
finishedAt: row.finished_at,
|
|
42
|
+
outcome: row.outcome,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Recurring pipelines, in `pipeline_schedules` + `pipeline_schedule_runs`
|
|
47
|
+
* (migration 0029). `listDue` is a deliberately cross-workspace query (the cron
|
|
48
|
+
* sweeper fires every workspace's due schedules in one pass).
|
|
49
|
+
*/
|
|
50
|
+
export class D1PipelineScheduleRepository {
|
|
51
|
+
db;
|
|
52
|
+
constructor({ db }) {
|
|
53
|
+
this.db = db;
|
|
54
|
+
}
|
|
55
|
+
async get(workspaceId, id) {
|
|
56
|
+
const row = await this.db
|
|
57
|
+
.prepare(`SELECT * FROM pipeline_schedules WHERE workspace_id = ? AND id = ?`)
|
|
58
|
+
.bind(workspaceId, id)
|
|
59
|
+
.first();
|
|
60
|
+
return row ? rowToSchedule(row) : null;
|
|
61
|
+
}
|
|
62
|
+
async getByBlock(workspaceId, blockId) {
|
|
63
|
+
const row = await this.db
|
|
64
|
+
.prepare(`SELECT * FROM pipeline_schedules WHERE workspace_id = ? AND block_id = ?`)
|
|
65
|
+
.bind(workspaceId, blockId)
|
|
66
|
+
.first();
|
|
67
|
+
return row ? rowToSchedule(row) : null;
|
|
68
|
+
}
|
|
69
|
+
async list(workspaceId) {
|
|
70
|
+
const { results } = await this.db
|
|
71
|
+
.prepare(`SELECT * FROM pipeline_schedules WHERE workspace_id = ? ORDER BY created_at ASC`)
|
|
72
|
+
.bind(workspaceId)
|
|
73
|
+
.all();
|
|
74
|
+
return results.map(rowToSchedule);
|
|
75
|
+
}
|
|
76
|
+
async listByService(serviceId) {
|
|
77
|
+
const { results } = await this.db
|
|
78
|
+
.prepare(`SELECT * FROM pipeline_schedules WHERE service_id = ? ORDER BY created_at ASC`)
|
|
79
|
+
.bind(serviceId)
|
|
80
|
+
.all();
|
|
81
|
+
return results.map(rowToSchedule);
|
|
82
|
+
}
|
|
83
|
+
async listByServices(serviceIds) {
|
|
84
|
+
if (serviceIds.length === 0)
|
|
85
|
+
return [];
|
|
86
|
+
const out = [];
|
|
87
|
+
// Chunk the IN list to stay under D1's bound-parameter limit.
|
|
88
|
+
for (const chunk of chunkForIn(serviceIds)) {
|
|
89
|
+
const placeholders = chunk.map(() => '?').join(', ');
|
|
90
|
+
const { results } = await this.db
|
|
91
|
+
.prepare(`SELECT * FROM pipeline_schedules WHERE service_id IN (${placeholders}) ORDER BY created_at ASC`)
|
|
92
|
+
.bind(...chunk)
|
|
93
|
+
.all();
|
|
94
|
+
for (const row of results)
|
|
95
|
+
out.push(rowToSchedule(row));
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
async listDue(asOf) {
|
|
100
|
+
const { results } = await this.db
|
|
101
|
+
.prepare(`SELECT * FROM pipeline_schedules
|
|
102
|
+
WHERE enabled = 1 AND next_run_at <= ?
|
|
103
|
+
ORDER BY next_run_at ASC`)
|
|
104
|
+
.bind(asOf)
|
|
105
|
+
.all();
|
|
106
|
+
return results.map((row) => ({ workspaceId: row.workspace_id, schedule: rowToSchedule(row) }));
|
|
107
|
+
}
|
|
108
|
+
async upsert(workspaceId, schedule) {
|
|
109
|
+
const r = schedule.recurrence;
|
|
110
|
+
await this.db
|
|
111
|
+
.prepare(`INSERT INTO pipeline_schedules
|
|
112
|
+
(workspace_id, id, service_id, block_id, frame_id, pipeline_id, template, name,
|
|
113
|
+
interval_hours, weekdays, window_start_hour, window_end_hour, timezone, enabled,
|
|
114
|
+
last_run_at, next_run_at, created_at)
|
|
115
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
116
|
+
ON CONFLICT (workspace_id, id) DO UPDATE SET
|
|
117
|
+
service_id = excluded.service_id,
|
|
118
|
+
block_id = excluded.block_id,
|
|
119
|
+
frame_id = excluded.frame_id,
|
|
120
|
+
pipeline_id = excluded.pipeline_id,
|
|
121
|
+
template = excluded.template,
|
|
122
|
+
name = excluded.name,
|
|
123
|
+
interval_hours = excluded.interval_hours,
|
|
124
|
+
weekdays = excluded.weekdays,
|
|
125
|
+
window_start_hour = excluded.window_start_hour,
|
|
126
|
+
window_end_hour = excluded.window_end_hour,
|
|
127
|
+
timezone = excluded.timezone,
|
|
128
|
+
enabled = excluded.enabled,
|
|
129
|
+
last_run_at = excluded.last_run_at,
|
|
130
|
+
next_run_at = excluded.next_run_at`)
|
|
131
|
+
.bind(workspaceId, schedule.id, schedule.serviceId, schedule.blockId, schedule.frameId, schedule.pipelineId, schedule.template, schedule.name, r.intervalHours, JSON.stringify(r.weekdays), r.windowStartHour, r.windowEndHour, r.timezone, schedule.enabled ? 1 : 0, schedule.lastRunAt, schedule.nextRunAt, schedule.createdAt)
|
|
132
|
+
.run();
|
|
133
|
+
}
|
|
134
|
+
async remove(workspaceId, id) {
|
|
135
|
+
await this.db
|
|
136
|
+
.prepare(`DELETE FROM pipeline_schedules WHERE workspace_id = ? AND id = ?`)
|
|
137
|
+
.bind(workspaceId, id)
|
|
138
|
+
.run();
|
|
139
|
+
}
|
|
140
|
+
async insertRun(workspaceId, run) {
|
|
141
|
+
await this.db
|
|
142
|
+
.prepare(`INSERT INTO pipeline_schedule_runs
|
|
143
|
+
(workspace_id, id, schedule_id, execution_id, status, started_at, finished_at, outcome)
|
|
144
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
145
|
+
.bind(workspaceId, run.id, run.scheduleId, run.executionId, run.status, run.startedAt, run.finishedAt, run.outcome)
|
|
146
|
+
.run();
|
|
147
|
+
}
|
|
148
|
+
async updateRun(workspaceId, runId, patch) {
|
|
149
|
+
const sets = [];
|
|
150
|
+
const binds = [];
|
|
151
|
+
if (patch.status !== undefined) {
|
|
152
|
+
sets.push('status = ?');
|
|
153
|
+
binds.push(patch.status);
|
|
154
|
+
}
|
|
155
|
+
if (patch.finishedAt !== undefined) {
|
|
156
|
+
sets.push('finished_at = ?');
|
|
157
|
+
binds.push(patch.finishedAt);
|
|
158
|
+
}
|
|
159
|
+
if (patch.outcome !== undefined) {
|
|
160
|
+
sets.push('outcome = ?');
|
|
161
|
+
binds.push(patch.outcome);
|
|
162
|
+
}
|
|
163
|
+
if (patch.executionId !== undefined) {
|
|
164
|
+
sets.push('execution_id = ?');
|
|
165
|
+
binds.push(patch.executionId);
|
|
166
|
+
}
|
|
167
|
+
if (sets.length === 0)
|
|
168
|
+
return;
|
|
169
|
+
binds.push(workspaceId, runId);
|
|
170
|
+
await this.db
|
|
171
|
+
.prepare(`UPDATE pipeline_schedule_runs SET ${sets.join(', ')} WHERE workspace_id = ? AND id = ?`)
|
|
172
|
+
.bind(...binds)
|
|
173
|
+
.run();
|
|
174
|
+
}
|
|
175
|
+
async listRuns(workspaceId, scheduleId) {
|
|
176
|
+
const { results } = await this.db
|
|
177
|
+
.prepare(`SELECT * FROM pipeline_schedule_runs
|
|
178
|
+
WHERE workspace_id = ? AND schedule_id = ?
|
|
179
|
+
ORDER BY started_at DESC`)
|
|
180
|
+
.bind(workspaceId, scheduleId)
|
|
181
|
+
.all();
|
|
182
|
+
return results.map(rowToRun);
|
|
183
|
+
}
|
|
184
|
+
async pruneRunsBefore(before) {
|
|
185
|
+
const res = await this.db
|
|
186
|
+
.prepare(`DELETE FROM pipeline_schedule_runs WHERE started_at < ?`)
|
|
187
|
+
.bind(before)
|
|
188
|
+
.run();
|
|
189
|
+
return res.meta.changes ?? 0;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=D1PipelineScheduleRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1PipelineScheduleRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1PipelineScheduleRepository.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAgCpC,SAAS,aAAa,CAAC,GAAgB;IACrC,MAAM,UAAU,GAAe;QAC7B,aAAa,EAAE,GAAG,CAAC,cAAc;QACjC,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC;QACrC,eAAe,EAAE,GAAG,CAAC,iBAAiB;QACtC,aAAa,EAAE,GAAG,CAAC,eAAe;QAClC,QAAQ,EAAE,GAAG,CAAC,QAAQ;KACvB,CAAA;IACD,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,UAAU,EAAE,GAAG,CAAC,WAAW;QAC3B,QAAQ,EAAE,GAAG,CAAC,QAA4B;QAC1C,IAAI,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@cat-factory/kernel';
|
|
2
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
3
|
+
/** D1-backed store of managed prompt-fragment rows, both tiers (migration 0020). */
|
|
4
|
+
export declare class D1PromptFragmentRepository implements PromptFragmentRepository {
|
|
5
|
+
private readonly db;
|
|
6
|
+
constructor({ db }: {
|
|
7
|
+
db: D1Database;
|
|
8
|
+
});
|
|
9
|
+
listByOwner(ownerKind: FragmentOwnerKind, ownerId: string, includeDeleted?: boolean): Promise<PromptFragmentRecord[]>;
|
|
10
|
+
get(ownerKind: FragmentOwnerKind, ownerId: string, fragmentId: string): Promise<PromptFragmentRecord | null>;
|
|
11
|
+
upsert(record: PromptFragmentRecord): Promise<void>;
|
|
12
|
+
softDelete(ownerKind: FragmentOwnerKind, ownerId: string, fragmentId: string, at: number): Promise<void>;
|
|
13
|
+
listBySource(sourceId: string): Promise<PromptFragmentRecord[]>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=D1PromptFragmentRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1PromptFragmentRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1PromptFragmentRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAmD3D,oFAAoF;AACpF,qBAAa,0BAA2B,YAAW,wBAAwB;IACzE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,WAAW,CACf,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,MAAM,EACf,cAAc,UAAQ,GACrB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CASjC;IAEK,GAAG,CACP,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAQtC;IAEK,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCxD;IAEK,UAAU,CACd,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAOf;IAEK,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAMpE;CACF"}
|