@mastra/factory 0.2.2-alpha.3 → 0.2.2
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/CHANGELOG.md +78 -0
- package/README.md +17 -9
- package/dist/integrations/github/rules.d.ts +48 -0
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +134 -5
- package/dist/integrations/github/rules.js.map +1 -1
- package/dist/integrations/github/sandbox.d.ts.map +1 -1
- package/dist/integrations/github/sandbox.js +56 -2
- package/dist/integrations/github/sandbox.js.map +1 -1
- package/dist/integrations/platform/github/event-worker.d.ts +5 -0
- package/dist/integrations/platform/github/event-worker.d.ts.map +1 -1
- package/dist/integrations/platform/github/event-worker.js +58 -3
- package/dist/integrations/platform/github/event-worker.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts +11 -0
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +38 -4
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/routes/config.d.ts +6 -0
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +13 -5
- package/dist/routes/config.js.map +1 -1
- package/dist/rules/defaults.d.ts.map +1 -1
- package/dist/rules/defaults.js +20 -1
- package/dist/rules/defaults.js.map +1 -1
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +33 -2
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/types.d.ts +10 -1
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js +2 -1
- package/dist/rules/types.js.map +1 -1
- package/dist/rules/validation.d.ts.map +1 -1
- package/dist/rules/validation.js +16 -3
- package/dist/rules/validation.js.map +1 -1
- package/dist/storage/domains/source-control/base.d.ts +11 -0
- package/dist/storage/domains/source-control/base.d.ts.map +1 -1
- package/dist/storage/domains/source-control/base.js +21 -0
- package/dist/storage/domains/source-control/base.js.map +1 -1
- package/dist/storage/domains/source-control/inmemory.d.ts +2 -1
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/source-control/inmemory.js +16 -0
- package/dist/storage/domains/source-control/inmemory.js.map +1 -1
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +4 -2
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +26 -5
- package/dist/workspace.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","names":[],"sources":["../../../../src/storage/domains/source-control/base.ts"],"sourcesContent":["import { FactoryStorageDomain, UniqueViolationError } from '@mastra/core/storage';\nimport type { CollectionSchema, FactoryStorageOps } from '@mastra/core/storage';\n\nconst FACTORY_PROJECTS = 'factory_projects';\nconst INSTALLATIONS = 'source_control_installations';\nconst REPOSITORIES = 'source_control_repositories';\nconst CONNECTIONS = 'factory_project_source_control_connections';\nconst PROJECT_REPOSITORIES = 'factory_project_repositories';\nconst SANDBOXES = 'source_control_project_repository_sandboxes';\nconst WORKTREES = 'source_control_worktrees';\nconst SESSIONS = 'source_control_sessions';\n\nexport const SOURCE_CONTROL_SCHEMAS: CollectionSchema[] = [\n {\n name: INSTALLATIONS,\n columns: {\n id: { type: 'uuid-pk' },\n integration_id: { type: 'text' },\n org_id: { type: 'text' },\n connected_by_user_id: { type: 'text' },\n external_id: { type: 'text' },\n account_name: { type: 'text', nullable: true },\n account_type: { type: 'text', nullable: true },\n provider_metadata: { type: 'json' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_installations_integration_org_external_unique',\n columns: ['integration_id', 'org_id', 'external_id'],\n },\n ],\n },\n {\n name: REPOSITORIES,\n columns: {\n id: { type: 'uuid-pk' },\n installation_id: { type: 'text' },\n external_id: { type: 'text' },\n slug: { type: 'text' },\n default_branch: { type: 'text', default: 'main' },\n provider_metadata: { type: 'json' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_repositories_installation_external_unique',\n columns: ['installation_id', 'external_id'],\n },\n ],\n indexes: [\n {\n name: 'source_control_repositories_installation_slug_idx',\n columns: ['installation_id', 'slug'],\n },\n ],\n },\n {\n name: CONNECTIONS,\n columns: {\n id: { type: 'uuid-pk' },\n factory_project_id: { type: 'text' },\n integration_id: { type: 'text' },\n installation_id: { type: 'text' },\n created_by_user_id: { type: 'text' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_project_source_control_connections_project_integration_installation_unique',\n columns: ['factory_project_id', 'integration_id', 'installation_id'],\n },\n ],\n indexes: [\n {\n name: 'factory_project_source_control_connections_project_idx',\n columns: ['factory_project_id'],\n },\n ],\n },\n {\n name: PROJECT_REPOSITORIES,\n columns: {\n id: { type: 'uuid-pk' },\n connection_id: { type: 'text' },\n repository_id: { type: 'text' },\n created_by_user_id: { type: 'text' },\n branch: { type: 'text', nullable: true },\n sandbox_provider: { type: 'text' },\n sandbox_workdir: { type: 'text' },\n setup_command: { type: 'text', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_project_repositories_connection_repository_unique',\n columns: ['connection_id', 'repository_id'],\n },\n ],\n indexes: [\n {\n name: 'factory_project_repositories_connection_idx',\n columns: ['connection_id'],\n },\n ],\n },\n {\n name: SANDBOXES,\n columns: {\n id: { type: 'uuid-pk' },\n project_repository_id: { type: 'text' },\n user_id: { type: 'text' },\n sandbox_id: { type: 'text', nullable: true },\n sandbox_workdir: { type: 'text' },\n materialized_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_project_repository_sandboxes_link_user_unique',\n columns: ['project_repository_id', 'user_id'],\n },\n ],\n },\n {\n name: WORKTREES,\n columns: {\n id: { type: 'uuid-pk' },\n project_repository_id: { type: 'text' },\n user_id: { type: 'text' },\n branch: { type: 'text' },\n base_branch: { type: 'text' },\n worktree_path: { type: 'text' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_worktrees_project_repository_user_branch_unique',\n columns: ['project_repository_id', 'user_id', 'branch'],\n },\n ],\n },\n {\n name: SESSIONS,\n columns: {\n id: { type: 'uuid-pk' },\n session_id: { type: 'text' },\n project_repository_id: { type: 'text' },\n org_id: { type: 'text' },\n user_id: { type: 'text' },\n branch: { type: 'text' },\n base_branch: { type: 'text' },\n sandbox_id: { type: 'text', nullable: true },\n sandbox_workdir: { type: 'text', nullable: true },\n materialized_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n { name: 'source_control_sessions_session_id_unique', columns: ['session_id'] },\n {\n name: 'source_control_sessions_repository_user_branch_unique',\n columns: ['project_repository_id', 'user_id', 'branch'],\n },\n ],\n },\n];\n\nexport type SourceControlProviderMetadata = Record<string, unknown>;\n\nexport interface SourceControlInstallation {\n id: string;\n integrationId: string;\n orgId: string;\n connectedByUserId: string;\n externalId: string;\n accountName: string | null;\n accountType: string | null;\n providerMetadata: SourceControlProviderMetadata;\n createdAt: Date;\n}\n\nexport interface UpsertSourceControlInstallationInput {\n orgId: string;\n connectedByUserId: string;\n externalId: string;\n accountName?: string | null;\n accountType?: string | null;\n providerMetadata?: SourceControlProviderMetadata;\n}\n\nexport interface SourceControlRepository {\n id: string;\n installationId: string;\n externalId: string;\n slug: string;\n defaultBranch: string;\n providerMetadata: SourceControlProviderMetadata;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface UpsertSourceControlRepositoryInput {\n installationId: string;\n externalId: string;\n slug: string;\n defaultBranch: string;\n providerMetadata?: SourceControlProviderMetadata;\n}\n\nexport interface ProjectSourceControlConnection {\n id: string;\n factoryProjectId: string;\n integrationId: string;\n installationId: string;\n createdByUserId: string;\n createdAt: Date;\n}\n\nexport interface CreateProjectSourceControlConnectionInput {\n orgId: string;\n factoryProjectId: string;\n installationId: string;\n createdByUserId: string;\n}\n\nexport interface ProjectRepository {\n id: string;\n connectionId: string;\n repositoryId: string;\n createdByUserId: string;\n branch: string | null;\n sandboxProvider: string;\n sandboxWorkdir: string;\n setupCommand: string | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface ExternalRepositoryProjectTarget {\n orgId: string;\n factoryProjectId: string;\n projectRepository: ProjectRepository;\n}\n\nexport interface LinkProjectRepositoryInput {\n orgId: string;\n connectionId: string;\n repositoryId: string;\n createdByUserId: string;\n branch?: string | null;\n sandboxProvider: string;\n sandboxWorkdir: string;\n setupCommand?: string | null;\n}\n\nexport interface UpdateProjectRepositoryInput {\n branch?: string | null;\n sandboxProvider?: string;\n sandboxWorkdir?: string;\n setupCommand?: string | null;\n}\n\nexport interface ProjectRepositorySandbox {\n id: string;\n projectRepositoryId: string;\n userId: string;\n sandboxId: string | null;\n sandboxWorkdir: string;\n materializedAt: Date | null;\n createdAt: Date;\n}\n\nexport interface SourceControlWorktree {\n id: string;\n projectRepositoryId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n worktreePath: string;\n createdAt: Date;\n}\n\nexport interface UpsertSourceControlWorktreeInput {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n worktreePath: string;\n}\n\nexport interface SourceControlSession {\n id: string;\n sessionId: string;\n projectRepositoryId: string;\n orgId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n sandboxId: string | null;\n sandboxWorkdir: string | null;\n materializedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface CreateSourceControlSessionInput {\n sessionId: string;\n projectRepositoryId: string;\n orgId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n}\n\nexport interface SourceControlStorageHandle {\n readonly integrationId: string;\n readonly installations: {\n list(args: { orgId: string }): Promise<SourceControlInstallation[]>;\n get(args: { orgId: string; id: string }): Promise<SourceControlInstallation | null>;\n findByExternalId(args: { orgId: string; externalId: string }): Promise<SourceControlInstallation | null>;\n upsert(args: UpsertSourceControlInstallationInput): Promise<SourceControlInstallation>;\n delete(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly repositories: {\n list(args: { orgId: string; installationId: string }): Promise<SourceControlRepository[]>;\n get(args: { orgId: string; id: string }): Promise<SourceControlRepository | null>;\n findByExternalId(args: { orgId: string; externalId: string }): Promise<SourceControlRepository | null>;\n findBySlug(args: { orgId: string; installationId: string; slug: string }): Promise<SourceControlRepository | null>;\n upsert(args: { orgId: string; input: UpsertSourceControlRepositoryInput }): Promise<SourceControlRepository>;\n };\n readonly connections: {\n list(args: { orgId: string; factoryProjectId: string }): Promise<ProjectSourceControlConnection[]>;\n get(args: { orgId: string; id: string }): Promise<ProjectSourceControlConnection | null>;\n create(args: CreateProjectSourceControlConnectionInput): Promise<ProjectSourceControlConnection>;\n delete(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly projectRepositories: {\n list(args: { orgId: string; connectionId: string }): Promise<ProjectRepository[]>;\n listByExternalRepository(args: {\n installationExternalId: string;\n repositoryExternalId: string;\n }): Promise<ExternalRepositoryProjectTarget[]>;\n get(args: { orgId: string; id: string }): Promise<ProjectRepository | null>;\n link(args: LinkProjectRepositoryInput): Promise<ProjectRepository>;\n update(args: { orgId: string; id: string; input: UpdateProjectRepositoryInput }): Promise<ProjectRepository | null>;\n unlink(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly sandboxes: {\n getOrCreate(args: { projectRepository: ProjectRepository; userId: string }): Promise<ProjectRepositorySandbox>;\n getById(args: { id: string }): Promise<ProjectRepositorySandbox | null>;\n /**\n * Point the binding at a new workdir and clear `materializedAt` — a moved\n * workdir means the checkout must be re-cloned. Used to heal bindings whose\n * inherited workdir went stale (e.g. the sandbox provider changed).\n */\n setWorkdir(args: { id: string; sandboxWorkdir: string }): Promise<void>;\n setSandboxId(args: { id: string; sandboxId: string }): Promise<void>;\n clearBinding(args: { id: string }): Promise<void>;\n markMaterialized(args: { id: string }): Promise<void>;\n };\n readonly worktrees: {\n upsert(args: UpsertSourceControlWorktreeInput): Promise<void>;\n list(args: { projectRepositoryId: string; userId: string }): Promise<SourceControlWorktree[]>;\n get(args: { projectRepositoryId: string; userId: string; branch: string }): Promise<SourceControlWorktree | null>;\n findByPath(args: {\n projectRepositoryId: string;\n userId: string;\n worktreePath: string;\n }): Promise<SourceControlWorktree | null>;\n delete(args: { projectRepositoryId: string; userId: string; branch: string }): Promise<void>;\n };\n readonly sessions: {\n list(args: { projectRepositoryId: string; userId: string }): Promise<SourceControlSession[]>;\n getBySessionId(sessionId: string): Promise<SourceControlSession | null>;\n getForBranch(args: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlSession | null>;\n create(input: CreateSourceControlSessionInput): Promise<SourceControlSession>;\n setSandbox(args: { id: string; sandboxId: string | null; sandboxWorkdir: string }): Promise<void>;\n markMaterialized(args: { id: string }): Promise<void>;\n delete(id: string): Promise<void>;\n };\n}\n\ninterface InstallationDbRow extends Record<string, unknown> {\n id: string;\n integration_id: string;\n org_id: string;\n connected_by_user_id: string;\n external_id: string;\n account_name: string | null;\n account_type: string | null;\n provider_metadata: SourceControlProviderMetadata;\n created_at: Date;\n}\n\ninterface RepositoryDbRow extends Record<string, unknown> {\n id: string;\n installation_id: string;\n external_id: string;\n slug: string;\n default_branch: string;\n provider_metadata: SourceControlProviderMetadata;\n created_at: Date;\n updated_at: Date;\n}\n\ninterface ConnectionDbRow extends Record<string, unknown> {\n id: string;\n factory_project_id: string;\n integration_id: string;\n installation_id: string;\n created_by_user_id: string;\n created_at: Date;\n}\n\ninterface ProjectRepositoryDbRow extends Record<string, unknown> {\n id: string;\n connection_id: string;\n repository_id: string;\n created_by_user_id: string;\n branch: string | null;\n sandbox_provider: string;\n sandbox_workdir: string;\n setup_command: string | null;\n created_at: Date;\n updated_at: Date;\n}\n\ninterface SandboxDbRow extends Record<string, unknown> {\n id: string;\n project_repository_id: string;\n user_id: string;\n sandbox_id: string | null;\n sandbox_workdir: string;\n materialized_at: Date | null;\n created_at: Date;\n}\n\ninterface WorktreeDbRow extends Record<string, unknown> {\n id: string;\n project_repository_id: string;\n user_id: string;\n branch: string;\n base_branch: string;\n worktree_path: string;\n created_at: Date;\n}\n\ninterface SessionDbRow extends Record<string, unknown> {\n id: string;\n session_id: string;\n project_repository_id: string;\n org_id: string;\n user_id: string;\n branch: string;\n base_branch: string;\n sandbox_id: string | null;\n sandbox_workdir: string | null;\n materialized_at: Date | null;\n created_at: Date;\n updated_at: Date;\n}\n\nfunction toInstallation(row: InstallationDbRow): SourceControlInstallation {\n return {\n id: row.id,\n integrationId: row.integration_id,\n orgId: row.org_id,\n connectedByUserId: row.connected_by_user_id,\n externalId: row.external_id,\n accountName: row.account_name,\n accountType: row.account_type,\n providerMetadata: row.provider_metadata,\n createdAt: row.created_at,\n };\n}\n\nfunction toRepository(row: RepositoryDbRow): SourceControlRepository {\n return {\n id: row.id,\n installationId: row.installation_id,\n externalId: row.external_id,\n slug: row.slug,\n defaultBranch: row.default_branch,\n providerMetadata: row.provider_metadata,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nfunction toConnection(row: ConnectionDbRow): ProjectSourceControlConnection {\n return {\n id: row.id,\n factoryProjectId: row.factory_project_id,\n integrationId: row.integration_id,\n installationId: row.installation_id,\n createdByUserId: row.created_by_user_id,\n createdAt: row.created_at,\n };\n}\n\nfunction toProjectRepository(row: ProjectRepositoryDbRow): ProjectRepository {\n return {\n id: row.id,\n connectionId: row.connection_id,\n repositoryId: row.repository_id,\n createdByUserId: row.created_by_user_id,\n branch: row.branch,\n sandboxProvider: row.sandbox_provider,\n sandboxWorkdir: row.sandbox_workdir,\n setupCommand: row.setup_command,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nfunction toSandbox(row: SandboxDbRow): ProjectRepositorySandbox {\n return {\n id: row.id,\n projectRepositoryId: row.project_repository_id,\n userId: row.user_id,\n sandboxId: row.sandbox_id,\n sandboxWorkdir: row.sandbox_workdir,\n materializedAt: row.materialized_at,\n createdAt: row.created_at,\n };\n}\n\nfunction toWorktree(row: WorktreeDbRow): SourceControlWorktree {\n return {\n id: row.id,\n projectRepositoryId: row.project_repository_id,\n userId: row.user_id,\n branch: row.branch,\n baseBranch: row.base_branch,\n worktreePath: row.worktree_path,\n createdAt: row.created_at,\n };\n}\n\nfunction toSession(row: SessionDbRow): SourceControlSession {\n return {\n id: row.id,\n sessionId: row.session_id,\n projectRepositoryId: row.project_repository_id,\n orgId: row.org_id,\n userId: row.user_id,\n branch: row.branch,\n baseBranch: row.base_branch,\n sandboxId: row.sandbox_id,\n sandboxWorkdir: row.sandbox_workdir,\n materializedAt: row.materialized_at,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nexport class SourceControlStorage extends FactoryStorageDomain {\n constructor() {\n super('source-control');\n }\n\n async init(): Promise<void> {\n await this.ensureCollections(SOURCE_CONTROL_SCHEMAS);\n }\n\n async dangerouslyClearAll(): Promise<void> {\n await this.ops.deleteMany(SESSIONS, {});\n await this.ops.deleteMany(WORKTREES, {});\n await this.ops.deleteMany(SANDBOXES, {});\n await this.ops.deleteMany(PROJECT_REPOSITORIES, {});\n await this.ops.deleteMany(CONNECTIONS, {});\n await this.ops.deleteMany(REPOSITORIES, {});\n await this.ops.deleteMany(INSTALLATIONS, {});\n }\n\n forIntegration(integrationId: string): SourceControlStorageHandle {\n if (!integrationId.trim()) throw new Error('[SourceControlStorage] integrationId must not be empty.');\n const db = (): FactoryStorageOps => this.ops;\n\n const getInstallation = async (args: { orgId: string; id: string }): Promise<SourceControlInstallation | null> => {\n const row = await db().findOne<InstallationDbRow>(INSTALLATIONS, {\n id: args.id,\n integration_id: integrationId,\n org_id: args.orgId,\n });\n return row ? toInstallation(row) : null;\n };\n\n const requireInstallation = async (args: { orgId: string; id: string }): Promise<SourceControlInstallation> => {\n const installation = await getInstallation(args);\n if (!installation)\n throw new Error('Source-control installation not found for this organization and integration.');\n return installation;\n };\n\n const getRepository = async (args: { orgId: string; id: string }): Promise<SourceControlRepository | null> => {\n const row = await db().findOne<RepositoryDbRow>(REPOSITORIES, { id: args.id });\n if (!row || !(await getInstallation({ orgId: args.orgId, id: row.installation_id }))) return null;\n return toRepository(row);\n };\n\n const requireRepository = async (args: { orgId: string; id: string }): Promise<SourceControlRepository> => {\n const repository = await getRepository(args);\n if (!repository) throw new Error('Source-control repository not found for this organization and integration.');\n return repository;\n };\n\n const getConnection = async (args: {\n orgId: string;\n id: string;\n }): Promise<ProjectSourceControlConnection | null> => {\n const row = await db().findOne<ConnectionDbRow>(CONNECTIONS, { id: args.id, integration_id: integrationId });\n if (!row) return null;\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: row.factory_project_id,\n org_id: args.orgId,\n });\n if (!project || !(await getInstallation({ orgId: args.orgId, id: row.installation_id }))) return null;\n return toConnection(row);\n };\n\n const requireConnection = async (args: { orgId: string; id: string }): Promise<ProjectSourceControlConnection> => {\n const connection = await getConnection(args);\n if (!connection)\n throw new Error('Project source-control connection not found for this organization and integration.');\n return connection;\n };\n\n const getProjectRepository = async (args: { orgId: string; id: string }): Promise<ProjectRepository | null> => {\n const row = await db().findOne<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { id: args.id });\n if (!row || !(await getConnection({ orgId: args.orgId, id: row.connection_id }))) return null;\n return toProjectRepository(row);\n };\n\n const getProjectRepositoryById = async (id: string): Promise<ProjectRepository | null> => {\n const row = await db().findOne<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { id });\n if (!row) return null;\n const connection = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n id: row.connection_id,\n integration_id: integrationId,\n });\n return connection ? toProjectRepository(row) : null;\n };\n\n const requireProjectRepositoryById = async (id: string): Promise<ProjectRepository> => {\n const projectRepository = await getProjectRepositoryById(id);\n if (!projectRepository) throw new Error('Project repository not found for this integration.');\n return projectRepository;\n };\n\n const getSandbox = async (id: string): Promise<ProjectRepositorySandbox | null> => {\n const row = await db().findOne<SandboxDbRow>(SANDBOXES, { id });\n if (!row || !(await getProjectRepositoryById(row.project_repository_id))) return null;\n return toSandbox(row);\n };\n\n const requireSandbox = async (id: string): Promise<ProjectRepositorySandbox> => {\n const sandbox = await getSandbox(id);\n if (!sandbox) throw new Error('Project-repository sandbox not found for this integration.');\n return sandbox;\n };\n\n return {\n integrationId,\n installations: {\n list: async ({ orgId }) =>\n (\n await db().findMany<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n org_id: orgId,\n })\n ).map(toInstallation),\n get: getInstallation,\n findByExternalId: async ({ orgId, externalId }) => {\n const row = await db().findOne<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n org_id: orgId,\n external_id: externalId,\n });\n return row ? toInstallation(row) : null;\n },\n upsert: async input => {\n const row = await db().upsertOne<InstallationDbRow>(\n INSTALLATIONS,\n ['integration_id', 'org_id', 'external_id'],\n {\n integration_id: integrationId,\n org_id: input.orgId,\n connected_by_user_id: input.connectedByUserId,\n external_id: input.externalId,\n account_name: input.accountName ?? null,\n account_type: input.accountType ?? null,\n provider_metadata: input.providerMetadata ?? {},\n created_at: new Date(),\n },\n );\n return toInstallation(row);\n },\n delete: async ({ orgId, id }) => {\n const installation = await getInstallation({ orgId, id });\n if (!installation) return false;\n await db().deleteMany(INSTALLATIONS, { id, integration_id: integrationId, org_id: orgId });\n return true;\n },\n },\n repositories: {\n list: async ({ orgId, installationId }) => {\n await requireInstallation({ orgId, id: installationId });\n return (await db().findMany<RepositoryDbRow>(REPOSITORIES, { installation_id: installationId })).map(\n toRepository,\n );\n },\n get: getRepository,\n findByExternalId: async ({ orgId, externalId }) => {\n const rows = await db().findMany<RepositoryDbRow>(REPOSITORIES, { external_id: externalId });\n for (const row of rows) {\n if (await getInstallation({ orgId, id: row.installation_id })) return toRepository(row);\n }\n return null;\n },\n findBySlug: async ({ orgId, installationId, slug }) => {\n await requireInstallation({ orgId, id: installationId });\n const row = await db().findOne<RepositoryDbRow>(REPOSITORIES, { installation_id: installationId, slug });\n return row ? toRepository(row) : null;\n },\n upsert: async ({ orgId, input }) => {\n await requireInstallation({ orgId, id: input.installationId });\n const now = new Date();\n const row = await db().upsertOne<RepositoryDbRow>(REPOSITORIES, ['installation_id', 'external_id'], {\n installation_id: input.installationId,\n external_id: input.externalId,\n slug: input.slug,\n default_branch: input.defaultBranch,\n provider_metadata: input.providerMetadata ?? {},\n created_at: now,\n updated_at: now,\n });\n return toRepository(row);\n },\n },\n connections: {\n list: async ({ orgId, factoryProjectId }) => {\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: factoryProjectId,\n org_id: orgId,\n });\n if (!project) return [];\n return (\n await db().findMany<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: factoryProjectId,\n integration_id: integrationId,\n })\n ).map(toConnection);\n },\n get: getConnection,\n create: async input => {\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: input.factoryProjectId,\n org_id: input.orgId,\n });\n if (!project) throw new Error('Factory project not found for this organization.');\n await requireInstallation({ orgId: input.orgId, id: input.installationId });\n try {\n const row = await db().insertOne<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: input.factoryProjectId,\n integration_id: integrationId,\n installation_id: input.installationId,\n created_by_user_id: input.createdByUserId,\n created_at: new Date(),\n });\n return toConnection(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: input.factoryProjectId,\n integration_id: integrationId,\n installation_id: input.installationId,\n });\n if (!row) throw error;\n return toConnection(row);\n }\n },\n delete: async ({ orgId, id }) => {\n const connection = await getConnection({ orgId, id });\n if (!connection) return false;\n const projectRepositories = await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, {\n connection_id: id,\n });\n for (const projectRepository of projectRepositories) {\n await db().deleteMany(SESSIONS, { project_repository_id: projectRepository.id });\n await db().deleteMany(WORKTREES, { project_repository_id: projectRepository.id });\n await db().deleteMany(SANDBOXES, { project_repository_id: projectRepository.id });\n }\n await db().deleteMany(PROJECT_REPOSITORIES, { connection_id: id });\n await db().deleteMany(CONNECTIONS, { id, integration_id: integrationId });\n return true;\n },\n },\n projectRepositories: {\n list: async ({ orgId, connectionId }) => {\n await requireConnection({ orgId, id: connectionId });\n return (\n await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { connection_id: connectionId })\n ).map(toProjectRepository);\n },\n listByExternalRepository: async ({ installationExternalId, repositoryExternalId }) => {\n const targets: ExternalRepositoryProjectTarget[] = [];\n const installations = await db().findMany<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n external_id: installationExternalId,\n });\n for (const installation of installations) {\n const repository = await db().findOne<RepositoryDbRow>(REPOSITORIES, {\n installation_id: installation.id,\n external_id: repositoryExternalId,\n });\n if (!repository) continue;\n const links = await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, {\n repository_id: repository.id,\n });\n for (const link of links) {\n const connection = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n id: link.connection_id,\n integration_id: integrationId,\n installation_id: installation.id,\n });\n if (!connection) continue;\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: connection.factory_project_id,\n org_id: installation.org_id,\n });\n if (!project) continue;\n targets.push({\n orgId: installation.org_id,\n factoryProjectId: connection.factory_project_id,\n projectRepository: toProjectRepository(link),\n });\n }\n }\n return targets;\n },\n get: getProjectRepository,\n link: async input => {\n const connection = await requireConnection({ orgId: input.orgId, id: input.connectionId });\n const repository = await requireRepository({ orgId: input.orgId, id: input.repositoryId });\n if (repository.installationId !== connection.installationId) {\n throw new Error('Repository does not belong to the connection installation.');\n }\n const now = new Date();\n const row = await db().upsertOne<ProjectRepositoryDbRow>(\n PROJECT_REPOSITORIES,\n ['connection_id', 'repository_id'],\n {\n connection_id: input.connectionId,\n repository_id: input.repositoryId,\n created_by_user_id: input.createdByUserId,\n branch: input.branch ?? null,\n sandbox_provider: input.sandboxProvider,\n sandbox_workdir: input.sandboxWorkdir,\n setup_command: input.setupCommand ?? null,\n created_at: now,\n updated_at: now,\n },\n );\n return toProjectRepository(row);\n },\n update: async ({ orgId, id, input }) => {\n const existing = await getProjectRepository({ orgId, id });\n if (!existing) return null;\n const patch: Record<string, unknown> = { updated_at: new Date() };\n if (input.branch !== undefined) patch.branch = input.branch;\n if (input.sandboxProvider !== undefined) patch.sandbox_provider = input.sandboxProvider;\n if (input.sandboxWorkdir !== undefined) patch.sandbox_workdir = input.sandboxWorkdir;\n if (input.setupCommand !== undefined) patch.setup_command = input.setupCommand;\n await db().updateMany(PROJECT_REPOSITORIES, { id }, patch);\n return getProjectRepository({ orgId, id });\n },\n unlink: async ({ orgId, id }) => {\n const existing = await getProjectRepository({ orgId, id });\n if (!existing) return false;\n await db().deleteMany(SESSIONS, { project_repository_id: id });\n await db().deleteMany(WORKTREES, { project_repository_id: id });\n await db().deleteMany(SANDBOXES, { project_repository_id: id });\n await db().deleteMany(PROJECT_REPOSITORIES, { id });\n return true;\n },\n },\n sandboxes: {\n getOrCreate: async ({ projectRepository, userId }) => {\n await requireProjectRepositoryById(projectRepository.id);\n const where = { project_repository_id: projectRepository.id, user_id: userId };\n const existing = await db().findOne<SandboxDbRow>(SANDBOXES, where);\n if (existing) return toSandbox(existing);\n try {\n const row = await db().insertOne<SandboxDbRow>(SANDBOXES, {\n ...where,\n sandbox_id: null,\n sandbox_workdir: projectRepository.sandboxWorkdir,\n materialized_at: null,\n created_at: new Date(),\n });\n return toSandbox(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<SandboxDbRow>(SANDBOXES, where);\n if (!row) throw error;\n return toSandbox(row);\n }\n },\n getById: ({ id }) => getSandbox(id),\n setWorkdir: async ({ id, sandboxWorkdir }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_workdir: sandboxWorkdir, materialized_at: null });\n },\n setSandboxId: async ({ id, sandboxId }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_id: sandboxId });\n },\n clearBinding: async ({ id }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_id: null, materialized_at: null });\n },\n markMaterialized: async ({ id }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { materialized_at: new Date() });\n },\n },\n worktrees: {\n upsert: async input => {\n await requireProjectRepositoryById(input.projectRepositoryId);\n await db().upsertOne<WorktreeDbRow>(WORKTREES, ['project_repository_id', 'user_id', 'branch'], {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n base_branch: input.baseBranch,\n worktree_path: input.worktreePath,\n created_at: new Date(),\n });\n },\n list: async ({ projectRepositoryId, userId }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return [];\n const rows = await db().findMany<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n });\n return rows.map(toWorktree);\n },\n get: async ({ projectRepositoryId, userId, branch }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n return row ? toWorktree(row) : null;\n },\n findByPath: async ({ projectRepositoryId, userId, worktreePath }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n worktree_path: worktreePath,\n });\n return row ? toWorktree(row) : null;\n },\n delete: async ({ projectRepositoryId, userId, branch }) => {\n await requireProjectRepositoryById(projectRepositoryId);\n await db().deleteMany(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n },\n },\n sessions: {\n list: async ({ projectRepositoryId, userId }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return [];\n return (\n await db().findMany<SessionDbRow>(SESSIONS, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n })\n ).map(toSession);\n },\n getBySessionId: async sessionId => {\n const row = await db().findOne<SessionDbRow>(SESSIONS, { session_id: sessionId });\n return row && (await getProjectRepositoryById(row.project_repository_id)) ? toSession(row) : null;\n },\n getForBranch: async ({ projectRepositoryId, userId, branch }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n return row ? toSession(row) : null;\n },\n create: async input => {\n await requireProjectRepositoryById(input.projectRepositoryId);\n const existing = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n });\n if (existing) return toSession(existing);\n const now = new Date();\n try {\n const row = await db().insertOne<SessionDbRow>(SESSIONS, {\n session_id: input.sessionId,\n project_repository_id: input.projectRepositoryId,\n org_id: input.orgId,\n user_id: input.userId,\n branch: input.branch,\n base_branch: input.baseBranch,\n sandbox_id: null,\n sandbox_workdir: null,\n materialized_at: null,\n created_at: now,\n updated_at: now,\n });\n return toSession(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n });\n if (!row) throw error;\n return toSession(row);\n }\n },\n setSandbox: async ({ id, sandboxId, sandboxWorkdir }) => {\n await db().updateMany(\n SESSIONS,\n { id },\n { sandbox_id: sandboxId, sandbox_workdir: sandboxWorkdir, updated_at: new Date() },\n );\n },\n markMaterialized: async ({ id }) => {\n await db().updateMany(SESSIONS, { id }, { materialized_at: new Date(), updated_at: new Date() });\n },\n delete: async id => {\n await db().deleteMany(SESSIONS, { id });\n },\n },\n };\n }\n}\n"],"mappings":";;AAGA,MAAM,mBAAmB;AACzB,MAAM,gBA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MAAM;MAChB,CAAC;MACD,IAAI,CAAC,KAAK,MAAM;MAChB,OAAO,UAAU,GAAG;KACtB;IACF;IACA,YAAY,OAAO,EAAE,IAAI,WAAW,qBAAqB;KACvD,MAAM,GAAG,CAAC,CAAC,WACT,UACA,EAAE,GAAG,GACL;MAAE,YAAY;MAAW,iBAAiB;MAAgB,4BAAY,IAAI,KAAK;KAAE,CACnF;IACF;IACA,kBAAkB,OAAO,EAAE,SAAS;KAClC,MAAM,GAAG,CAAC,CAAC,WAAW,UAAU,EAAE,GAAG,GAAG;MAAE,iCAAiB,IAAI,KAAK;MAAG,4BAAY,IAAI,KAAK;KAAE,CAAC;IACjG;IACA,QAAQ,OAAM,OAAM;KAClB,MAAM,GAAG,CAAC,CAAC,WAAW,UAAU,EAAE,GAAG,CAAC;IACxC;GACF;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"base.js","names":[],"sources":["../../../../src/storage/domains/source-control/base.ts"],"sourcesContent":["import { FactoryStorageDomain, UniqueViolationError } from '@mastra/core/storage';\nimport type { CollectionSchema, FactoryStorageOps } from '@mastra/core/storage';\n\nconst FACTORY_PROJECTS = 'factory_projects';\nconst INSTALLATIONS = 'source_control_installations';\nconst REPOSITORIES = 'source_control_repositories';\nconst CONNECTIONS = 'factory_project_source_control_connections';\nconst PROJECT_REPOSITORIES = 'factory_project_repositories';\nconst SANDBOXES = 'source_control_project_repository_sandboxes';\nconst WORKTREES = 'source_control_worktrees';\nconst SESSIONS = 'source_control_sessions';\n\nexport const SOURCE_CONTROL_SCHEMAS: CollectionSchema[] = [\n {\n name: INSTALLATIONS,\n columns: {\n id: { type: 'uuid-pk' },\n integration_id: { type: 'text' },\n org_id: { type: 'text' },\n connected_by_user_id: { type: 'text' },\n external_id: { type: 'text' },\n account_name: { type: 'text', nullable: true },\n account_type: { type: 'text', nullable: true },\n provider_metadata: { type: 'json' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_installations_integration_org_external_unique',\n columns: ['integration_id', 'org_id', 'external_id'],\n },\n ],\n },\n {\n name: REPOSITORIES,\n columns: {\n id: { type: 'uuid-pk' },\n installation_id: { type: 'text' },\n external_id: { type: 'text' },\n slug: { type: 'text' },\n default_branch: { type: 'text', default: 'main' },\n provider_metadata: { type: 'json' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_repositories_installation_external_unique',\n columns: ['installation_id', 'external_id'],\n },\n ],\n indexes: [\n {\n name: 'source_control_repositories_installation_slug_idx',\n columns: ['installation_id', 'slug'],\n },\n ],\n },\n {\n name: CONNECTIONS,\n columns: {\n id: { type: 'uuid-pk' },\n factory_project_id: { type: 'text' },\n integration_id: { type: 'text' },\n installation_id: { type: 'text' },\n created_by_user_id: { type: 'text' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_project_source_control_connections_project_integration_installation_unique',\n columns: ['factory_project_id', 'integration_id', 'installation_id'],\n },\n ],\n indexes: [\n {\n name: 'factory_project_source_control_connections_project_idx',\n columns: ['factory_project_id'],\n },\n ],\n },\n {\n name: PROJECT_REPOSITORIES,\n columns: {\n id: { type: 'uuid-pk' },\n connection_id: { type: 'text' },\n repository_id: { type: 'text' },\n created_by_user_id: { type: 'text' },\n branch: { type: 'text', nullable: true },\n sandbox_provider: { type: 'text' },\n sandbox_workdir: { type: 'text' },\n setup_command: { type: 'text', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_project_repositories_connection_repository_unique',\n columns: ['connection_id', 'repository_id'],\n },\n ],\n indexes: [\n {\n name: 'factory_project_repositories_connection_idx',\n columns: ['connection_id'],\n },\n ],\n },\n {\n name: SANDBOXES,\n columns: {\n id: { type: 'uuid-pk' },\n project_repository_id: { type: 'text' },\n user_id: { type: 'text' },\n sandbox_id: { type: 'text', nullable: true },\n sandbox_workdir: { type: 'text' },\n materialized_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_project_repository_sandboxes_link_user_unique',\n columns: ['project_repository_id', 'user_id'],\n },\n ],\n },\n {\n name: WORKTREES,\n columns: {\n id: { type: 'uuid-pk' },\n project_repository_id: { type: 'text' },\n user_id: { type: 'text' },\n branch: { type: 'text' },\n base_branch: { type: 'text' },\n worktree_path: { type: 'text' },\n created_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'source_control_worktrees_project_repository_user_branch_unique',\n columns: ['project_repository_id', 'user_id', 'branch'],\n },\n ],\n },\n {\n name: SESSIONS,\n columns: {\n id: { type: 'uuid-pk' },\n session_id: { type: 'text' },\n project_repository_id: { type: 'text' },\n org_id: { type: 'text' },\n user_id: { type: 'text' },\n branch: { type: 'text' },\n base_branch: { type: 'text' },\n sandbox_id: { type: 'text', nullable: true },\n sandbox_workdir: { type: 'text', nullable: true },\n materialized_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n { name: 'source_control_sessions_session_id_unique', columns: ['session_id'] },\n {\n name: 'source_control_sessions_repository_user_branch_unique',\n columns: ['project_repository_id', 'user_id', 'branch'],\n },\n ],\n },\n];\n\nexport type SourceControlProviderMetadata = Record<string, unknown>;\n\nexport interface SourceControlInstallation {\n id: string;\n integrationId: string;\n orgId: string;\n connectedByUserId: string;\n externalId: string;\n accountName: string | null;\n accountType: string | null;\n providerMetadata: SourceControlProviderMetadata;\n createdAt: Date;\n}\n\nexport interface UpsertSourceControlInstallationInput {\n orgId: string;\n connectedByUserId: string;\n externalId: string;\n accountName?: string | null;\n accountType?: string | null;\n providerMetadata?: SourceControlProviderMetadata;\n}\n\nexport interface SourceControlRepository {\n id: string;\n installationId: string;\n externalId: string;\n slug: string;\n defaultBranch: string;\n providerMetadata: SourceControlProviderMetadata;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface UpsertSourceControlRepositoryInput {\n installationId: string;\n externalId: string;\n slug: string;\n defaultBranch: string;\n providerMetadata?: SourceControlProviderMetadata;\n}\n\nexport interface ProjectSourceControlConnection {\n id: string;\n factoryProjectId: string;\n integrationId: string;\n installationId: string;\n createdByUserId: string;\n createdAt: Date;\n}\n\nexport interface CreateProjectSourceControlConnectionInput {\n orgId: string;\n factoryProjectId: string;\n installationId: string;\n createdByUserId: string;\n}\n\nexport interface ProjectRepository {\n id: string;\n connectionId: string;\n repositoryId: string;\n createdByUserId: string;\n branch: string | null;\n sandboxProvider: string;\n sandboxWorkdir: string;\n setupCommand: string | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface ExternalRepositoryProjectTarget {\n orgId: string;\n factoryProjectId: string;\n projectRepository: ProjectRepository;\n}\n\n/** External id pair identifying a repository linked to a factory project. */\nexport interface ConfiguredExternalRepositoryKey {\n installationExternalId: string;\n repositoryExternalId: string;\n}\n\nexport interface LinkProjectRepositoryInput {\n orgId: string;\n connectionId: string;\n repositoryId: string;\n createdByUserId: string;\n branch?: string | null;\n sandboxProvider: string;\n sandboxWorkdir: string;\n setupCommand?: string | null;\n}\n\nexport interface UpdateProjectRepositoryInput {\n branch?: string | null;\n sandboxProvider?: string;\n sandboxWorkdir?: string;\n setupCommand?: string | null;\n}\n\nexport interface ProjectRepositorySandbox {\n id: string;\n projectRepositoryId: string;\n userId: string;\n sandboxId: string | null;\n sandboxWorkdir: string;\n materializedAt: Date | null;\n createdAt: Date;\n}\n\nexport interface SourceControlWorktree {\n id: string;\n projectRepositoryId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n worktreePath: string;\n createdAt: Date;\n}\n\nexport interface UpsertSourceControlWorktreeInput {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n worktreePath: string;\n}\n\nexport interface SourceControlSession {\n id: string;\n sessionId: string;\n projectRepositoryId: string;\n orgId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n sandboxId: string | null;\n sandboxWorkdir: string | null;\n materializedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface CreateSourceControlSessionInput {\n sessionId: string;\n projectRepositoryId: string;\n orgId: string;\n userId: string;\n branch: string;\n baseBranch: string;\n}\n\nexport interface SourceControlStorageHandle {\n readonly integrationId: string;\n readonly installations: {\n list(args: { orgId: string }): Promise<SourceControlInstallation[]>;\n get(args: { orgId: string; id: string }): Promise<SourceControlInstallation | null>;\n findByExternalId(args: { orgId: string; externalId: string }): Promise<SourceControlInstallation | null>;\n upsert(args: UpsertSourceControlInstallationInput): Promise<SourceControlInstallation>;\n delete(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly repositories: {\n list(args: { orgId: string; installationId: string }): Promise<SourceControlRepository[]>;\n get(args: { orgId: string; id: string }): Promise<SourceControlRepository | null>;\n findByExternalId(args: { orgId: string; externalId: string }): Promise<SourceControlRepository | null>;\n findBySlug(args: { orgId: string; installationId: string; slug: string }): Promise<SourceControlRepository | null>;\n upsert(args: { orgId: string; input: UpsertSourceControlRepositoryInput }): Promise<SourceControlRepository>;\n };\n readonly connections: {\n list(args: { orgId: string; factoryProjectId: string }): Promise<ProjectSourceControlConnection[]>;\n get(args: { orgId: string; id: string }): Promise<ProjectSourceControlConnection | null>;\n create(args: CreateProjectSourceControlConnectionInput): Promise<ProjectSourceControlConnection>;\n delete(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly projectRepositories: {\n list(args: { orgId: string; connectionId: string }): Promise<ProjectRepository[]>;\n listByExternalRepository(args: {\n installationExternalId: string;\n repositoryExternalId: string;\n }): Promise<ExternalRepositoryProjectTarget[]>;\n /**\n * Distinct external (installation, repository) id pairs linked to any\n * factory project. Lets sweeps scope work to configured repositories\n * without probing every repository an installation can see.\n */\n listConfiguredExternalKeys(): Promise<ConfiguredExternalRepositoryKey[]>;\n get(args: { orgId: string; id: string }): Promise<ProjectRepository | null>;\n link(args: LinkProjectRepositoryInput): Promise<ProjectRepository>;\n update(args: { orgId: string; id: string; input: UpdateProjectRepositoryInput }): Promise<ProjectRepository | null>;\n unlink(args: { orgId: string; id: string }): Promise<boolean>;\n };\n readonly sandboxes: {\n getOrCreate(args: { projectRepository: ProjectRepository; userId: string }): Promise<ProjectRepositorySandbox>;\n getById(args: { id: string }): Promise<ProjectRepositorySandbox | null>;\n /**\n * Point the binding at a new workdir and clear `materializedAt` — a moved\n * workdir means the checkout must be re-cloned. Used to heal bindings whose\n * inherited workdir went stale (e.g. the sandbox provider changed).\n */\n setWorkdir(args: { id: string; sandboxWorkdir: string }): Promise<void>;\n setSandboxId(args: { id: string; sandboxId: string }): Promise<void>;\n clearBinding(args: { id: string }): Promise<void>;\n markMaterialized(args: { id: string }): Promise<void>;\n };\n readonly worktrees: {\n upsert(args: UpsertSourceControlWorktreeInput): Promise<void>;\n list(args: { projectRepositoryId: string; userId: string }): Promise<SourceControlWorktree[]>;\n get(args: { projectRepositoryId: string; userId: string; branch: string }): Promise<SourceControlWorktree | null>;\n findByPath(args: {\n projectRepositoryId: string;\n userId: string;\n worktreePath: string;\n }): Promise<SourceControlWorktree | null>;\n delete(args: { projectRepositoryId: string; userId: string; branch: string }): Promise<void>;\n };\n readonly sessions: {\n list(args: { projectRepositoryId: string; userId: string }): Promise<SourceControlSession[]>;\n getBySessionId(sessionId: string): Promise<SourceControlSession | null>;\n getForBranch(args: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlSession | null>;\n create(input: CreateSourceControlSessionInput): Promise<SourceControlSession>;\n setSandbox(args: { id: string; sandboxId: string | null; sandboxWorkdir: string }): Promise<void>;\n markMaterialized(args: { id: string }): Promise<void>;\n delete(id: string): Promise<void>;\n };\n}\n\ninterface InstallationDbRow extends Record<string, unknown> {\n id: string;\n integration_id: string;\n org_id: string;\n connected_by_user_id: string;\n external_id: string;\n account_name: string | null;\n account_type: string | null;\n provider_metadata: SourceControlProviderMetadata;\n created_at: Date;\n}\n\ninterface RepositoryDbRow extends Record<string, unknown> {\n id: string;\n installation_id: string;\n external_id: string;\n slug: string;\n default_branch: string;\n provider_metadata: SourceControlProviderMetadata;\n created_at: Date;\n updated_at: Date;\n}\n\ninterface ConnectionDbRow extends Record<string, unknown> {\n id: string;\n factory_project_id: string;\n integration_id: string;\n installation_id: string;\n created_by_user_id: string;\n created_at: Date;\n}\n\ninterface ProjectRepositoryDbRow extends Record<string, unknown> {\n id: string;\n connection_id: string;\n repository_id: string;\n created_by_user_id: string;\n branch: string | null;\n sandbox_provider: string;\n sandbox_workdir: string;\n setup_command: string | null;\n created_at: Date;\n updated_at: Date;\n}\n\ninterface SandboxDbRow extends Record<string, unknown> {\n id: string;\n project_repository_id: string;\n user_id: string;\n sandbox_id: string | null;\n sandbox_workdir: string;\n materialized_at: Date | null;\n created_at: Date;\n}\n\ninterface WorktreeDbRow extends Record<string, unknown> {\n id: string;\n project_repository_id: string;\n user_id: string;\n branch: string;\n base_branch: string;\n worktree_path: string;\n created_at: Date;\n}\n\ninterface SessionDbRow extends Record<string, unknown> {\n id: string;\n session_id: string;\n project_repository_id: string;\n org_id: string;\n user_id: string;\n branch: string;\n base_branch: string;\n sandbox_id: string | null;\n sandbox_workdir: string | null;\n materialized_at: Date | null;\n created_at: Date;\n updated_at: Date;\n}\n\nfunction toInstallation(row: InstallationDbRow): SourceControlInstallation {\n return {\n id: row.id,\n integrationId: row.integration_id,\n orgId: row.org_id,\n connectedByUserId: row.connected_by_user_id,\n externalId: row.external_id,\n accountName: row.account_name,\n accountType: row.account_type,\n providerMetadata: row.provider_metadata,\n createdAt: row.created_at,\n };\n}\n\nfunction toRepository(row: RepositoryDbRow): SourceControlRepository {\n return {\n id: row.id,\n installationId: row.installation_id,\n externalId: row.external_id,\n slug: row.slug,\n defaultBranch: row.default_branch,\n providerMetadata: row.provider_metadata,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nfunction toConnection(row: ConnectionDbRow): ProjectSourceControlConnection {\n return {\n id: row.id,\n factoryProjectId: row.factory_project_id,\n integrationId: row.integration_id,\n installationId: row.installation_id,\n createdByUserId: row.created_by_user_id,\n createdAt: row.created_at,\n };\n}\n\nfunction toProjectRepository(row: ProjectRepositoryDbRow): ProjectRepository {\n return {\n id: row.id,\n connectionId: row.connection_id,\n repositoryId: row.repository_id,\n createdByUserId: row.created_by_user_id,\n branch: row.branch,\n sandboxProvider: row.sandbox_provider,\n sandboxWorkdir: row.sandbox_workdir,\n setupCommand: row.setup_command,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nfunction toSandbox(row: SandboxDbRow): ProjectRepositorySandbox {\n return {\n id: row.id,\n projectRepositoryId: row.project_repository_id,\n userId: row.user_id,\n sandboxId: row.sandbox_id,\n sandboxWorkdir: row.sandbox_workdir,\n materializedAt: row.materialized_at,\n createdAt: row.created_at,\n };\n}\n\nfunction toWorktree(row: WorktreeDbRow): SourceControlWorktree {\n return {\n id: row.id,\n projectRepositoryId: row.project_repository_id,\n userId: row.user_id,\n branch: row.branch,\n baseBranch: row.base_branch,\n worktreePath: row.worktree_path,\n createdAt: row.created_at,\n };\n}\n\nfunction toSession(row: SessionDbRow): SourceControlSession {\n return {\n id: row.id,\n sessionId: row.session_id,\n projectRepositoryId: row.project_repository_id,\n orgId: row.org_id,\n userId: row.user_id,\n branch: row.branch,\n baseBranch: row.base_branch,\n sandboxId: row.sandbox_id,\n sandboxWorkdir: row.sandbox_workdir,\n materializedAt: row.materialized_at,\n createdAt: row.created_at,\n updatedAt: row.updated_at,\n };\n}\n\nexport class SourceControlStorage extends FactoryStorageDomain {\n constructor() {\n super('source-control');\n }\n\n async init(): Promise<void> {\n await this.ensureCollections(SOURCE_CONTROL_SCHEMAS);\n }\n\n async dangerouslyClearAll(): Promise<void> {\n await this.ops.deleteMany(SESSIONS, {});\n await this.ops.deleteMany(WORKTREES, {});\n await this.ops.deleteMany(SANDBOXES, {});\n await this.ops.deleteMany(PROJECT_REPOSITORIES, {});\n await this.ops.deleteMany(CONNECTIONS, {});\n await this.ops.deleteMany(REPOSITORIES, {});\n await this.ops.deleteMany(INSTALLATIONS, {});\n }\n\n forIntegration(integrationId: string): SourceControlStorageHandle {\n if (!integrationId.trim()) throw new Error('[SourceControlStorage] integrationId must not be empty.');\n const db = (): FactoryStorageOps => this.ops;\n\n const getInstallation = async (args: { orgId: string; id: string }): Promise<SourceControlInstallation | null> => {\n const row = await db().findOne<InstallationDbRow>(INSTALLATIONS, {\n id: args.id,\n integration_id: integrationId,\n org_id: args.orgId,\n });\n return row ? toInstallation(row) : null;\n };\n\n const requireInstallation = async (args: { orgId: string; id: string }): Promise<SourceControlInstallation> => {\n const installation = await getInstallation(args);\n if (!installation)\n throw new Error('Source-control installation not found for this organization and integration.');\n return installation;\n };\n\n const getRepository = async (args: { orgId: string; id: string }): Promise<SourceControlRepository | null> => {\n const row = await db().findOne<RepositoryDbRow>(REPOSITORIES, { id: args.id });\n if (!row || !(await getInstallation({ orgId: args.orgId, id: row.installation_id }))) return null;\n return toRepository(row);\n };\n\n const requireRepository = async (args: { orgId: string; id: string }): Promise<SourceControlRepository> => {\n const repository = await getRepository(args);\n if (!repository) throw new Error('Source-control repository not found for this organization and integration.');\n return repository;\n };\n\n const getConnection = async (args: {\n orgId: string;\n id: string;\n }): Promise<ProjectSourceControlConnection | null> => {\n const row = await db().findOne<ConnectionDbRow>(CONNECTIONS, { id: args.id, integration_id: integrationId });\n if (!row) return null;\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: row.factory_project_id,\n org_id: args.orgId,\n });\n if (!project || !(await getInstallation({ orgId: args.orgId, id: row.installation_id }))) return null;\n return toConnection(row);\n };\n\n const requireConnection = async (args: { orgId: string; id: string }): Promise<ProjectSourceControlConnection> => {\n const connection = await getConnection(args);\n if (!connection)\n throw new Error('Project source-control connection not found for this organization and integration.');\n return connection;\n };\n\n const getProjectRepository = async (args: { orgId: string; id: string }): Promise<ProjectRepository | null> => {\n const row = await db().findOne<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { id: args.id });\n if (!row || !(await getConnection({ orgId: args.orgId, id: row.connection_id }))) return null;\n return toProjectRepository(row);\n };\n\n const getProjectRepositoryById = async (id: string): Promise<ProjectRepository | null> => {\n const row = await db().findOne<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { id });\n if (!row) return null;\n const connection = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n id: row.connection_id,\n integration_id: integrationId,\n });\n return connection ? toProjectRepository(row) : null;\n };\n\n const requireProjectRepositoryById = async (id: string): Promise<ProjectRepository> => {\n const projectRepository = await getProjectRepositoryById(id);\n if (!projectRepository) throw new Error('Project repository not found for this integration.');\n return projectRepository;\n };\n\n const getSandbox = async (id: string): Promise<ProjectRepositorySandbox | null> => {\n const row = await db().findOne<SandboxDbRow>(SANDBOXES, { id });\n if (!row || !(await getProjectRepositoryById(row.project_repository_id))) return null;\n return toSandbox(row);\n };\n\n const requireSandbox = async (id: string): Promise<ProjectRepositorySandbox> => {\n const sandbox = await getSandbox(id);\n if (!sandbox) throw new Error('Project-repository sandbox not found for this integration.');\n return sandbox;\n };\n\n return {\n integrationId,\n installations: {\n list: async ({ orgId }) =>\n (\n await db().findMany<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n org_id: orgId,\n })\n ).map(toInstallation),\n get: getInstallation,\n findByExternalId: async ({ orgId, externalId }) => {\n const row = await db().findOne<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n org_id: orgId,\n external_id: externalId,\n });\n return row ? toInstallation(row) : null;\n },\n upsert: async input => {\n const row = await db().upsertOne<InstallationDbRow>(\n INSTALLATIONS,\n ['integration_id', 'org_id', 'external_id'],\n {\n integration_id: integrationId,\n org_id: input.orgId,\n connected_by_user_id: input.connectedByUserId,\n external_id: input.externalId,\n account_name: input.accountName ?? null,\n account_type: input.accountType ?? null,\n provider_metadata: input.providerMetadata ?? {},\n created_at: new Date(),\n },\n );\n return toInstallation(row);\n },\n delete: async ({ orgId, id }) => {\n const installation = await getInstallation({ orgId, id });\n if (!installation) return false;\n await db().deleteMany(INSTALLATIONS, { id, integration_id: integrationId, org_id: orgId });\n return true;\n },\n },\n repositories: {\n list: async ({ orgId, installationId }) => {\n await requireInstallation({ orgId, id: installationId });\n return (await db().findMany<RepositoryDbRow>(REPOSITORIES, { installation_id: installationId })).map(\n toRepository,\n );\n },\n get: getRepository,\n findByExternalId: async ({ orgId, externalId }) => {\n const rows = await db().findMany<RepositoryDbRow>(REPOSITORIES, { external_id: externalId });\n for (const row of rows) {\n if (await getInstallation({ orgId, id: row.installation_id })) return toRepository(row);\n }\n return null;\n },\n findBySlug: async ({ orgId, installationId, slug }) => {\n await requireInstallation({ orgId, id: installationId });\n const row = await db().findOne<RepositoryDbRow>(REPOSITORIES, { installation_id: installationId, slug });\n return row ? toRepository(row) : null;\n },\n upsert: async ({ orgId, input }) => {\n await requireInstallation({ orgId, id: input.installationId });\n const now = new Date();\n const row = await db().upsertOne<RepositoryDbRow>(REPOSITORIES, ['installation_id', 'external_id'], {\n installation_id: input.installationId,\n external_id: input.externalId,\n slug: input.slug,\n default_branch: input.defaultBranch,\n provider_metadata: input.providerMetadata ?? {},\n created_at: now,\n updated_at: now,\n });\n return toRepository(row);\n },\n },\n connections: {\n list: async ({ orgId, factoryProjectId }) => {\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: factoryProjectId,\n org_id: orgId,\n });\n if (!project) return [];\n return (\n await db().findMany<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: factoryProjectId,\n integration_id: integrationId,\n })\n ).map(toConnection);\n },\n get: getConnection,\n create: async input => {\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: input.factoryProjectId,\n org_id: input.orgId,\n });\n if (!project) throw new Error('Factory project not found for this organization.');\n await requireInstallation({ orgId: input.orgId, id: input.installationId });\n try {\n const row = await db().insertOne<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: input.factoryProjectId,\n integration_id: integrationId,\n installation_id: input.installationId,\n created_by_user_id: input.createdByUserId,\n created_at: new Date(),\n });\n return toConnection(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n factory_project_id: input.factoryProjectId,\n integration_id: integrationId,\n installation_id: input.installationId,\n });\n if (!row) throw error;\n return toConnection(row);\n }\n },\n delete: async ({ orgId, id }) => {\n const connection = await getConnection({ orgId, id });\n if (!connection) return false;\n const projectRepositories = await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, {\n connection_id: id,\n });\n for (const projectRepository of projectRepositories) {\n await db().deleteMany(SESSIONS, { project_repository_id: projectRepository.id });\n await db().deleteMany(WORKTREES, { project_repository_id: projectRepository.id });\n await db().deleteMany(SANDBOXES, { project_repository_id: projectRepository.id });\n }\n await db().deleteMany(PROJECT_REPOSITORIES, { connection_id: id });\n await db().deleteMany(CONNECTIONS, { id, integration_id: integrationId });\n return true;\n },\n },\n projectRepositories: {\n list: async ({ orgId, connectionId }) => {\n await requireConnection({ orgId, id: connectionId });\n return (\n await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, { connection_id: connectionId })\n ).map(toProjectRepository);\n },\n listConfiguredExternalKeys: async () => {\n const keys = new Map<string, ConfiguredExternalRepositoryKey>();\n const connections = await db().findMany<ConnectionDbRow>(CONNECTIONS, { integration_id: integrationId });\n for (const connection of connections) {\n const installation = await db().findOne<InstallationDbRow>(INSTALLATIONS, {\n id: connection.installation_id,\n integration_id: integrationId,\n });\n if (!installation) continue;\n const links = await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, {\n connection_id: connection.id,\n });\n for (const link of links) {\n const repository = await db().findOne<RepositoryDbRow>(REPOSITORIES, { id: link.repository_id });\n if (!repository) continue;\n keys.set(`${installation.external_id}\\u0000${repository.external_id}`, {\n installationExternalId: installation.external_id,\n repositoryExternalId: repository.external_id,\n });\n }\n }\n return [...keys.values()];\n },\n listByExternalRepository: async ({ installationExternalId, repositoryExternalId }) => {\n const targets: ExternalRepositoryProjectTarget[] = [];\n const installations = await db().findMany<InstallationDbRow>(INSTALLATIONS, {\n integration_id: integrationId,\n external_id: installationExternalId,\n });\n for (const installation of installations) {\n const repository = await db().findOne<RepositoryDbRow>(REPOSITORIES, {\n installation_id: installation.id,\n external_id: repositoryExternalId,\n });\n if (!repository) continue;\n const links = await db().findMany<ProjectRepositoryDbRow>(PROJECT_REPOSITORIES, {\n repository_id: repository.id,\n });\n for (const link of links) {\n const connection = await db().findOne<ConnectionDbRow>(CONNECTIONS, {\n id: link.connection_id,\n integration_id: integrationId,\n installation_id: installation.id,\n });\n if (!connection) continue;\n const project = await db().findOne<Record<string, unknown>>(FACTORY_PROJECTS, {\n id: connection.factory_project_id,\n org_id: installation.org_id,\n });\n if (!project) continue;\n targets.push({\n orgId: installation.org_id,\n factoryProjectId: connection.factory_project_id,\n projectRepository: toProjectRepository(link),\n });\n }\n }\n return targets;\n },\n get: getProjectRepository,\n link: async input => {\n const connection = await requireConnection({ orgId: input.orgId, id: input.connectionId });\n const repository = await requireRepository({ orgId: input.orgId, id: input.repositoryId });\n if (repository.installationId !== connection.installationId) {\n throw new Error('Repository does not belong to the connection installation.');\n }\n const now = new Date();\n const row = await db().upsertOne<ProjectRepositoryDbRow>(\n PROJECT_REPOSITORIES,\n ['connection_id', 'repository_id'],\n {\n connection_id: input.connectionId,\n repository_id: input.repositoryId,\n created_by_user_id: input.createdByUserId,\n branch: input.branch ?? null,\n sandbox_provider: input.sandboxProvider,\n sandbox_workdir: input.sandboxWorkdir,\n setup_command: input.setupCommand ?? null,\n created_at: now,\n updated_at: now,\n },\n );\n return toProjectRepository(row);\n },\n update: async ({ orgId, id, input }) => {\n const existing = await getProjectRepository({ orgId, id });\n if (!existing) return null;\n const patch: Record<string, unknown> = { updated_at: new Date() };\n if (input.branch !== undefined) patch.branch = input.branch;\n if (input.sandboxProvider !== undefined) patch.sandbox_provider = input.sandboxProvider;\n if (input.sandboxWorkdir !== undefined) patch.sandbox_workdir = input.sandboxWorkdir;\n if (input.setupCommand !== undefined) patch.setup_command = input.setupCommand;\n await db().updateMany(PROJECT_REPOSITORIES, { id }, patch);\n return getProjectRepository({ orgId, id });\n },\n unlink: async ({ orgId, id }) => {\n const existing = await getProjectRepository({ orgId, id });\n if (!existing) return false;\n await db().deleteMany(SESSIONS, { project_repository_id: id });\n await db().deleteMany(WORKTREES, { project_repository_id: id });\n await db().deleteMany(SANDBOXES, { project_repository_id: id });\n await db().deleteMany(PROJECT_REPOSITORIES, { id });\n return true;\n },\n },\n sandboxes: {\n getOrCreate: async ({ projectRepository, userId }) => {\n await requireProjectRepositoryById(projectRepository.id);\n const where = { project_repository_id: projectRepository.id, user_id: userId };\n const existing = await db().findOne<SandboxDbRow>(SANDBOXES, where);\n if (existing) return toSandbox(existing);\n try {\n const row = await db().insertOne<SandboxDbRow>(SANDBOXES, {\n ...where,\n sandbox_id: null,\n sandbox_workdir: projectRepository.sandboxWorkdir,\n materialized_at: null,\n created_at: new Date(),\n });\n return toSandbox(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<SandboxDbRow>(SANDBOXES, where);\n if (!row) throw error;\n return toSandbox(row);\n }\n },\n getById: ({ id }) => getSandbox(id),\n setWorkdir: async ({ id, sandboxWorkdir }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_workdir: sandboxWorkdir, materialized_at: null });\n },\n setSandboxId: async ({ id, sandboxId }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_id: sandboxId });\n },\n clearBinding: async ({ id }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { sandbox_id: null, materialized_at: null });\n },\n markMaterialized: async ({ id }) => {\n await requireSandbox(id);\n await db().updateMany(SANDBOXES, { id }, { materialized_at: new Date() });\n },\n },\n worktrees: {\n upsert: async input => {\n await requireProjectRepositoryById(input.projectRepositoryId);\n await db().upsertOne<WorktreeDbRow>(WORKTREES, ['project_repository_id', 'user_id', 'branch'], {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n base_branch: input.baseBranch,\n worktree_path: input.worktreePath,\n created_at: new Date(),\n });\n },\n list: async ({ projectRepositoryId, userId }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return [];\n const rows = await db().findMany<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n });\n return rows.map(toWorktree);\n },\n get: async ({ projectRepositoryId, userId, branch }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n return row ? toWorktree(row) : null;\n },\n findByPath: async ({ projectRepositoryId, userId, worktreePath }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<WorktreeDbRow>(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n worktree_path: worktreePath,\n });\n return row ? toWorktree(row) : null;\n },\n delete: async ({ projectRepositoryId, userId, branch }) => {\n await requireProjectRepositoryById(projectRepositoryId);\n await db().deleteMany(WORKTREES, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n },\n },\n sessions: {\n list: async ({ projectRepositoryId, userId }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return [];\n return (\n await db().findMany<SessionDbRow>(SESSIONS, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n })\n ).map(toSession);\n },\n getBySessionId: async sessionId => {\n const row = await db().findOne<SessionDbRow>(SESSIONS, { session_id: sessionId });\n return row && (await getProjectRepositoryById(row.project_repository_id)) ? toSession(row) : null;\n },\n getForBranch: async ({ projectRepositoryId, userId, branch }) => {\n if (!(await getProjectRepositoryById(projectRepositoryId))) return null;\n const row = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: projectRepositoryId,\n user_id: userId,\n branch,\n });\n return row ? toSession(row) : null;\n },\n create: async input => {\n await requireProjectRepositoryById(input.projectRepositoryId);\n const existing = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n });\n if (existing) return toSession(existing);\n const now = new Date();\n try {\n const row = await db().insertOne<SessionDbRow>(SESSIONS, {\n session_id: input.sessionId,\n project_repository_id: input.projectRepositoryId,\n org_id: input.orgId,\n user_id: input.userId,\n branch: input.branch,\n base_branch: input.baseBranch,\n sandbox_id: null,\n sandbox_workdir: null,\n materialized_at: null,\n created_at: now,\n updated_at: now,\n });\n return toSession(row);\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n const row = await db().findOne<SessionDbRow>(SESSIONS, {\n project_repository_id: input.projectRepositoryId,\n user_id: input.userId,\n branch: input.branch,\n });\n if (!row) throw error;\n return toSession(row);\n }\n },\n setSandbox: async ({ id, sandboxId, sandboxWorkdir }) => {\n await db().updateMany(\n SESSIONS,\n { id },\n { sandbox_id: sandboxId, sandbox_workdir: sandboxWorkdir, updated_at: new Date() },\n );\n },\n markMaterialized: async ({ id }) => {\n await db().updateMany(SESSIONS, { id }, { materialized_at: new Date(), updated_at: new Date() });\n },\n delete: async id => {\n await db().deleteMany(SESSIONS, { id });\n },\n },\n };\n }\n}\n"],"mappings":";;AAGA,MAAM,mBAAmB;AACzB,MAAM,gBAAgB;AACtB,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,uBAAuB;AAC7B,MAAM,YAAY;AAClB,MAAM,YAAY;AAClB,MAAM,WAAW;AAEjB,MAAa,yBAA6C;CACxD;EACE,MAAM;EACN,SAAS;GACP,IAAI,EAAE,MAAM,UAAU;GACtB,gBAAgB,EAAE,MAAM,OAAO;GAC/B,QAAQ,EAAE,MAAM,OAAO;GACvB,sBAAsB,EAAE,MAAM,OAAO;GACrC,aAAa,EAAE,MAAM,OAAO;GAC5B,cAAc;IAAE,MAAM;IAAQ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BAAuB,MAAM;OAC7B,QAAQ,MAAM;OACd,SAAS,MAAM;OACf,QAAQ,MAAM;OACd,aAAa,MAAM;OACnB,YAAY;OACZ,iBAAiB;OACjB,iBAAiB;OACjB,YAAY;OACZ,YAAY;MACd,CAAC,CACmB;KACtB,SAAS,OAAO;MACd,IAAI,EAAE,iBAAiB,uBAAuB,MAAM;MACpD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,QAAsB,UAAU;OACrD,uBAAuB,MAAM;OAC7B,SAAS,MAAM;OACf,QAAQ,MAAM;MAChB,CAAC;MACD,IAAI,CAAC,KAAK,MAAM;MAChB,OAAO,UAAU,GAAG;KACtB;IACF;IACA,YAAY,OAAO,EAAE,IAAI,WAAW,qBAAqB;KACvD,MAAM,GAAG,CAAC,CAAC,WACT,UACA,EAAE,GAAG,GACL;MAAE,YAAY;MAAW,iBAAiB;MAAgB,4BAAY,IAAI,KAAK;KAAE,CACnF;IACF;IACA,kBAAkB,OAAO,EAAE,SAAS;KAClC,MAAM,GAAG,CAAC,CAAC,WAAW,UAAU,EAAE,GAAG,GAAG;MAAE,iCAAiB,IAAI,KAAK;MAAG,4BAAY,IAAI,KAAK;KAAE,CAAC;IACjG;IACA,QAAQ,OAAM,OAAM;KAClB,MAAM,GAAG,CAAC,CAAC,WAAW,UAAU,EAAE,GAAG,CAAC;IACxC;GACF;EACF;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CreateProjectSourceControlConnectionInput, CreateSourceControlSessionInput, ExternalRepositoryProjectTarget, LinkProjectRepositoryInput, ProjectRepository, ProjectRepositorySandbox, ProjectSourceControlConnection, SourceControlInstallation, SourceControlRepository, SourceControlSession, SourceControlStorageHandle, SourceControlWorktree, UpdateProjectRepositoryInput, UpsertSourceControlInstallationInput, UpsertSourceControlRepositoryInput, UpsertSourceControlWorktreeInput } from './base.js';
|
|
1
|
+
import type { ConfiguredExternalRepositoryKey, CreateProjectSourceControlConnectionInput, CreateSourceControlSessionInput, ExternalRepositoryProjectTarget, LinkProjectRepositoryInput, ProjectRepository, ProjectRepositorySandbox, ProjectSourceControlConnection, SourceControlInstallation, SourceControlRepository, SourceControlSession, SourceControlStorageHandle, SourceControlWorktree, UpdateProjectRepositoryInput, UpsertSourceControlInstallationInput, UpsertSourceControlRepositoryInput, UpsertSourceControlWorktreeInput } from './base.js';
|
|
2
2
|
/** In-memory provider-scoped source-control handle for route tests. */
|
|
3
3
|
export declare class SourceControlStorageInMemory implements SourceControlStorageHandle {
|
|
4
4
|
readonly integrationId: string;
|
|
@@ -72,6 +72,7 @@ export declare class SourceControlStorageInMemory implements SourceControlStorag
|
|
|
72
72
|
orgId: string;
|
|
73
73
|
connectionId: string;
|
|
74
74
|
}) => Promise<ProjectRepository[]>;
|
|
75
|
+
listConfiguredExternalKeys: () => Promise<ConfiguredExternalRepositoryKey[]>;
|
|
75
76
|
listByExternalRepository: ({ installationExternalId, repositoryExternalId, }: {
|
|
76
77
|
installationExternalId: string;
|
|
77
78
|
repositoryExternalId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inmemory.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/source-control/inmemory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yCAAyC,EACzC,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC1B,iBAAiB,EACjB,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EAClC,gCAAgC,EACjC,MAAM,WAAW,CAAC;AAEnB,uEAAuE;AACvE,qBAAa,4BAA6B,YAAW,0BAA0B;IAC7E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,yBAAyB,EAAE,CAAM;IACpD,gBAAgB,EAAE,uBAAuB,EAAE,CAAM;IACjD,eAAe,EAAE,8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BAIlB,+BAA+B,KAAG,OAAO,CAAC,oBAAoB,CAAC;yDAoBlF;YACD,EAAE,EAAE,MAAM,CAAC;YACX,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;YACzB,cAAc,EAAE,MAAM,CAAC;SACxB;mCAIgC;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE;qBAI5B,MAAM;MAGzB;CACH"}
|
|
@@ -148,6 +148,22 @@ var SourceControlStorageInMemory = class {
|
|
|
148
148
|
orgId,
|
|
149
149
|
id: connectionId
|
|
150
150
|
}) ? this.projectRepositoriesRows.filter((row) => row.connectionId === connectionId) : [],
|
|
151
|
+
listConfiguredExternalKeys: async () => {
|
|
152
|
+
const keys = /* @__PURE__ */ new Map();
|
|
153
|
+
for (const connection of this.connectionsRows.filter((row) => row.integrationId === this.integrationId)) {
|
|
154
|
+
const installation = this.installationsRows.find((row) => row.id === connection.installationId);
|
|
155
|
+
if (!installation) continue;
|
|
156
|
+
for (const link of this.projectRepositoriesRows.filter((row) => row.connectionId === connection.id)) {
|
|
157
|
+
const repository = this.repositoriesRows.find((row) => row.id === link.repositoryId);
|
|
158
|
+
if (!repository) continue;
|
|
159
|
+
keys.set(`${installation.externalId}\u0000${repository.externalId}`, {
|
|
160
|
+
installationExternalId: installation.externalId,
|
|
161
|
+
repositoryExternalId: repository.externalId
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return [...keys.values()];
|
|
166
|
+
},
|
|
151
167
|
listByExternalRepository: async ({ installationExternalId, repositoryExternalId }) => {
|
|
152
168
|
const targets = [];
|
|
153
169
|
for (const installation of this.installationsRows.filter((row) => row.externalId === installationExternalId)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inmemory.js","names":[],"sources":["../../../../src/storage/domains/source-control/inmemory.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport type {\n CreateProjectSourceControlConnectionInput,\n CreateSourceControlSessionInput,\n ExternalRepositoryProjectTarget,\n LinkProjectRepositoryInput,\n ProjectRepository,\n ProjectRepositorySandbox,\n ProjectSourceControlConnection,\n SourceControlInstallation,\n SourceControlRepository,\n SourceControlSession,\n SourceControlStorageHandle,\n SourceControlWorktree,\n UpdateProjectRepositoryInput,\n UpsertSourceControlInstallationInput,\n UpsertSourceControlRepositoryInput,\n UpsertSourceControlWorktreeInput,\n} from './base.js';\n\n/** In-memory provider-scoped source-control handle for route tests. */\nexport class SourceControlStorageInMemory implements SourceControlStorageHandle {\n readonly integrationId: string;\n installationsRows: SourceControlInstallation[] = [];\n repositoriesRows: SourceControlRepository[] = [];\n connectionsRows: ProjectSourceControlConnection[] = [];\n projectRepositoriesRows: ProjectRepository[] = [];\n sandboxesRows: ProjectRepositorySandbox[] = [];\n worktreesRows: SourceControlWorktree[] = [];\n sessionsRows: SourceControlSession[] = [];\n\n constructor(integrationId = 'github') {\n this.integrationId = integrationId;\n }\n\n readonly installations = {\n list: async ({ orgId }: { orgId: string }): Promise<SourceControlInstallation[]> =>\n this.installationsRows.filter(row => row.orgId === orgId),\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<SourceControlInstallation | null> =>\n this.installationsRows.find(row => row.orgId === orgId && row.id === id) ?? null,\n findByExternalId: async ({\n orgId,\n externalId,\n }: {\n orgId: string;\n externalId: string;\n }): Promise<SourceControlInstallation | null> =>\n this.installationsRows.find(row => row.orgId === orgId && row.externalId === externalId) ?? null,\n upsert: async (input: UpsertSourceControlInstallationInput): Promise<SourceControlInstallation> => {\n const existing = this.installationsRows.find(\n row => row.orgId === input.orgId && row.externalId === input.externalId,\n );\n if (existing) {\n Object.assign(existing, {\n connectedByUserId: input.connectedByUserId,\n accountName: input.accountName ?? null,\n accountType: input.accountType ?? null,\n providerMetadata: input.providerMetadata ?? {},\n });\n return existing;\n }\n const created: SourceControlInstallation = {\n id: randomUUID(),\n integrationId: this.integrationId,\n orgId: input.orgId,\n connectedByUserId: input.connectedByUserId,\n externalId: input.externalId,\n accountName: input.accountName ?? null,\n accountType: input.accountType ?? null,\n providerMetadata: input.providerMetadata ?? {},\n createdAt: new Date(),\n };\n this.installationsRows.push(created);\n return created;\n },\n delete: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n const index = this.installationsRows.findIndex(row => row.orgId === orgId && row.id === id);\n if (index < 0) return false;\n this.installationsRows.splice(index, 1);\n return true;\n },\n };\n\n readonly repositories = {\n list: async ({ orgId, installationId }: { orgId: string; installationId: string }) => {\n const installation = await this.installations.get({ orgId, id: installationId });\n return installation ? this.repositoriesRows.filter(row => row.installationId === installationId) : [];\n },\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<SourceControlRepository | null> => {\n const row = this.repositoriesRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.installations.get({ orgId, id: row.installationId })) ? row : null;\n },\n findByExternalId: async ({\n orgId,\n installationId,\n externalId,\n }: {\n orgId: string;\n installationId: string;\n externalId: string;\n }) => {\n const rows = await this.repositories.list({ orgId, installationId });\n return rows.find(row => row.externalId === externalId) ?? null;\n },\n findBySlug: async ({ orgId, installationId, slug }: { orgId: string; installationId: string; slug: string }) => {\n const rows = await this.repositories.list({ orgId, installationId });\n return rows.find(row => row.slug === slug) ?? null;\n },\n upsert: async ({\n orgId,\n input,\n }: {\n orgId: string;\n input: UpsertSourceControlRepositoryInput;\n }): Promise<SourceControlRepository> => {\n if (!(await this.installations.get({ orgId, id: input.installationId }))) {\n throw new Error('Source-control installation not found');\n }\n const existing = this.repositoriesRows.find(\n row => row.installationId === input.installationId && row.externalId === input.externalId,\n );\n const now = new Date();\n if (existing) {\n Object.assign(existing, {\n slug: input.slug,\n defaultBranch: input.defaultBranch,\n providerMetadata: input.providerMetadata ?? {},\n updatedAt: now,\n });\n return existing;\n }\n const created: SourceControlRepository = {\n id: randomUUID(),\n installationId: input.installationId,\n externalId: input.externalId,\n slug: input.slug,\n defaultBranch: input.defaultBranch,\n providerMetadata: input.providerMetadata ?? {},\n createdAt: now,\n updatedAt: now,\n };\n this.repositoriesRows.push(created);\n return created;\n },\n };\n\n readonly connections = {\n list: async ({ factoryProjectId }: { orgId: string; factoryProjectId: string }) =>\n this.connectionsRows.filter(row => row.factoryProjectId === factoryProjectId),\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<ProjectSourceControlConnection | null> => {\n const row = this.connectionsRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.installations.get({ orgId, id: row.installationId })) ? row : null;\n },\n create: async (input: CreateProjectSourceControlConnectionInput): Promise<ProjectSourceControlConnection> => {\n if (!(await this.installations.get({ orgId: input.orgId, id: input.installationId }))) {\n throw new Error('Source-control installation not found');\n }\n const existing = this.connectionsRows.find(\n row =>\n row.factoryProjectId === input.factoryProjectId &&\n row.integrationId === this.integrationId &&\n row.installationId === input.installationId,\n );\n if (existing) return existing;\n const created: ProjectSourceControlConnection = {\n id: randomUUID(),\n factoryProjectId: input.factoryProjectId,\n integrationId: this.integrationId,\n installationId: input.installationId,\n createdByUserId: input.createdByUserId,\n createdAt: new Date(),\n };\n this.connectionsRows.push(created);\n return created;\n },\n delete: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n if (!(await this.connections.get({ orgId, id }))) return false;\n this.connectionsRows.splice(0, this.connectionsRows.length, ...this.connectionsRows.filter(row => row.id !== id));\n return true;\n },\n };\n\n readonly projectRepositories = {\n list: async ({ orgId, connectionId }: { orgId: string; connectionId: string }) =>\n (await this.connections.get({ orgId, id: connectionId }))\n ? this.projectRepositoriesRows.filter(row => row.connectionId === connectionId)\n : [],\n listByExternalRepository: async ({\n installationExternalId,\n repositoryExternalId,\n }: {\n installationExternalId: string;\n repositoryExternalId: string;\n }): Promise<ExternalRepositoryProjectTarget[]> => {\n const targets: ExternalRepositoryProjectTarget[] = [];\n for (const installation of this.installationsRows.filter(row => row.externalId === installationExternalId)) {\n const repository = this.repositoriesRows.find(\n row => row.installationId === installation.id && row.externalId === repositoryExternalId,\n );\n if (!repository) continue;\n for (const projectRepository of this.projectRepositoriesRows.filter(\n row => row.repositoryId === repository.id,\n )) {\n const connection = this.connectionsRows.find(\n row =>\n row.id === projectRepository.connectionId &&\n row.installationId === installation.id &&\n row.integrationId === this.integrationId,\n );\n if (!connection) continue;\n targets.push({\n orgId: installation.orgId,\n factoryProjectId: connection.factoryProjectId,\n projectRepository,\n });\n }\n }\n return targets;\n },\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<ProjectRepository | null> => {\n const row = this.projectRepositoriesRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.connections.get({ orgId, id: row.connectionId })) ? row : null;\n },\n link: async (input: LinkProjectRepositoryInput): Promise<ProjectRepository> => {\n const connection = await this.connections.get({ orgId: input.orgId, id: input.connectionId });\n const repository = await this.repositories.get({ orgId: input.orgId, id: input.repositoryId });\n if (!connection || !repository || repository.installationId !== connection.installationId) {\n throw new Error('Source-control connection or repository not found');\n }\n const existing = this.projectRepositoriesRows.find(\n row => row.connectionId === input.connectionId && row.repositoryId === input.repositoryId,\n );\n if (existing) return existing;\n const now = new Date();\n const created: ProjectRepository = {\n id: randomUUID(),\n connectionId: input.connectionId,\n repositoryId: input.repositoryId,\n createdByUserId: input.createdByUserId,\n branch: input.branch ?? null,\n sandboxProvider: input.sandboxProvider,\n sandboxWorkdir: input.sandboxWorkdir,\n setupCommand: input.setupCommand ?? null,\n createdAt: now,\n updatedAt: now,\n };\n this.projectRepositoriesRows.push(created);\n return created;\n },\n update: async ({\n orgId,\n id,\n input,\n }: {\n orgId: string;\n id: string;\n input: UpdateProjectRepositoryInput;\n }): Promise<ProjectRepository | null> => {\n const row = await this.projectRepositories.get({ orgId, id });\n if (!row) return null;\n Object.assign(row, input, { updatedAt: new Date() });\n return row;\n },\n unlink: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n if (!(await this.projectRepositories.get({ orgId, id }))) return false;\n this.projectRepositoriesRows.splice(\n 0,\n this.projectRepositoriesRows.length,\n ...this.projectRepositoriesRows.filter(row => row.id !== id),\n );\n return true;\n },\n };\n\n readonly sandboxes = {\n getOrCreate: async ({\n projectRepository,\n userId,\n }: {\n projectRepository: ProjectRepository;\n userId: string;\n }): Promise<ProjectRepositorySandbox> => {\n const existing = this.sandboxesRows.find(\n row => row.projectRepositoryId === projectRepository.id && row.userId === userId,\n );\n if (existing) return existing;\n const created: ProjectRepositorySandbox = {\n id: randomUUID(),\n projectRepositoryId: projectRepository.id,\n userId,\n sandboxId: null,\n sandboxWorkdir: projectRepository.sandboxWorkdir,\n materializedAt: null,\n createdAt: new Date(),\n };\n this.sandboxesRows.push(created);\n return created;\n },\n getById: async ({ id }: { id: string }): Promise<ProjectRepositorySandbox | null> =>\n this.sandboxesRows.find(row => row.id === id) ?? null,\n setWorkdir: async ({ id, sandboxWorkdir }: { id: string; sandboxWorkdir: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxWorkdir, materializedAt: null });\n },\n setSandboxId: async ({ id, sandboxId }: { id: string; sandboxId: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) row.sandboxId = sandboxId;\n },\n clearBinding: async ({ id }: { id: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxId: null, materializedAt: null });\n },\n markMaterialized: async ({ id }: { id: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) row.materializedAt = new Date();\n },\n };\n\n readonly worktrees = {\n upsert: async (input: UpsertSourceControlWorktreeInput): Promise<void> => {\n const existing = this.worktreesRows.find(\n row =>\n row.projectRepositoryId === input.projectRepositoryId &&\n row.userId === input.userId &&\n row.branch === input.branch,\n );\n if (existing) {\n existing.baseBranch = input.baseBranch;\n existing.worktreePath = input.worktreePath;\n return;\n }\n this.worktreesRows.push({ id: randomUUID(), createdAt: new Date(), ...input });\n },\n list: async ({\n projectRepositoryId,\n userId,\n }: {\n projectRepositoryId: string;\n userId: string;\n }): Promise<SourceControlWorktree[]> =>\n this.worktreesRows.filter(row => row.projectRepositoryId === projectRepositoryId && row.userId === userId),\n get: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlWorktree | null> =>\n this.worktreesRows.find(\n row => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch,\n ) ?? null,\n findByPath: async ({\n projectRepositoryId,\n userId,\n worktreePath,\n }: {\n projectRepositoryId: string;\n userId: string;\n worktreePath: string;\n }): Promise<SourceControlWorktree | null> =>\n this.worktreesRows.find(\n row =>\n row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.worktreePath === worktreePath,\n ) ?? null,\n delete: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<void> => {\n this.worktreesRows.splice(\n 0,\n this.worktreesRows.length,\n ...this.worktreesRows.filter(\n row => !(row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch),\n ),\n );\n },\n };\n\n readonly sessions = {\n list: async ({ projectRepositoryId, userId }: { projectRepositoryId: string; userId: string }) =>\n this.sessionsRows.filter(row => row.projectRepositoryId === projectRepositoryId && row.userId === userId),\n getBySessionId: async (sessionId: string): Promise<SourceControlSession | null> =>\n this.sessionsRows.find(row => row.sessionId === sessionId) ?? null,\n getForBranch: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlSession | null> =>\n this.sessionsRows.find(\n row => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch,\n ) ?? null,\n create: async (input: CreateSourceControlSessionInput): Promise<SourceControlSession> => {\n const existing = await this.sessions.getForBranch(input);\n if (existing) return existing;\n const now = new Date();\n const session: SourceControlSession = {\n id: randomUUID(),\n ...input,\n sandboxId: null,\n sandboxWorkdir: null,\n materializedAt: null,\n createdAt: now,\n updatedAt: now,\n };\n this.sessionsRows.push(session);\n return session;\n },\n setSandbox: async ({\n id,\n sandboxId,\n sandboxWorkdir,\n }: {\n id: string;\n sandboxId: string | null;\n sandboxWorkdir: string;\n }) => {\n const row = this.sessionsRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxId, sandboxWorkdir, updatedAt: new Date() });\n },\n markMaterialized: async ({ id }: { id: string }) => {\n const row = this.sessionsRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { materializedAt: new Date(), updatedAt: new Date() });\n },\n delete: async (id: string) => {\n this.sessionsRows.splice(0, this.sessionsRows.length, ...this.sessionsRows.filter(row => row.id !== id));\n },\n };\n}\n"],"mappings":";;;AAsBA,IAAa,+BAAb,MAAgF;CAC9E;CACA,oBAAiD,CAAC;CAClD,mBAA8C,CAAC;CAC/C,kBAAoD,CAAC;CACrD,0BAA+C,CAAC;CAChD,gBAA4C,CAAC;CAC7C,gBAAyC,CAAC;CAC1C,eAAuC,CAAC;CAExC,YAAY,gBAAgB,UAAU;EACpC,KAAK,gBAAgB;CACvB;CAEA,gBAAyB;EACvB,MAAM,OAAO,EAAE,YACb,KAAK,kBAAkB,QAAO,QAAO,IAAI,UAAU,KAAK;EAC1D,KAAK,OAAO,EAAE,OAAO,SACnB,KAAK,kBAAkB,MAAK,QAAO,IAAI,UAAU,SAAS,IAAI,OAAO,EAAE,KAAK;EAC9E,kBAAkB,OAAO,EACvB,OACA,iBAKA,KAAK,kBAAkB,MAAK,QAAO,IAAI,UAAU,SAAS,IAAI,eAAe,UAAU,KAAK;EAC9F,QAAQ,OAAO,UAAoF;GACjG,MAAM,WAAW,KAAK,kBAAkB,MACtC,QAAO,IAAI,UAAU,MAAM,SAAS,IAAI,eAAe,MAAM,UAC/D;GACA,IAAI,UAAU;IACZ,OAAO,OAAO,UAAU;KACtB,mBAAmB,MAAM;KACzB,aAAa,MAAM,eAAe;KAClC,aAAa,MAAM,eAAe;KAClC,kBAAkB,MAAM,oBAAoB,CAAC;IAC/C,CAAC;I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K;EACP,QAAQ,OAAO,UAA0E;GACvF,MAAM,WAAW,MAAM,KAAK,SAAS,aAAa,KAAK;GACvD,IAAI,UAAU,OAAO;GACrB,MAAM,sBAAM,IAAI,KAAK;GACrB,MAAM,UAAgC;IACpC,IAAI,WAAW;IACf,GAAG;IACH,WAAW;IACX,gBAAgB;IAChB,gBAAgB;IAChB,WAAW;IACX,WAAW;GACb;GACA,KAAK,aAAa,KAAK,OAAO;GAC9B,OAAO;EACT;EACA,YAAY,OAAO,EACjB,IACA,WACA,qBAKI;GACJ,MAAM,MAAM,KAAK,aAAa,MAAK,cAAa,UAAU,OAAO,EAAE;GACnE,IAAI,KAAK,OAAO,OAAO,KAAK;IAAE;IAAW;IAAgB,2BAAW,IAAI,KAAK;GAAE,CAAC;EAClF;EACA,kBAAkB,OAAO,EAAE,SAAyB;GAClD,MAAM,MAAM,KAAK,aAAa,MAAK,cAAa,UAAU,OAAO,EAAE;GACnE,IAAI,KAAK,OAAO,OAAO,KAAK;IAAE,gCAAgB,IAAI,KAAK;IAAG,2BAAW,IAAI,KAAK;GAAE,CAAC;EACnF;EACA,QAAQ,OAAO,OAAe;GAC5B,KAAK,aAAa,OAAO,GAAG,KAAK,aAAa,QAAQ,GAAG,KAAK,aAAa,QAAO,QAAO,IAAI,OAAO,EAAE,CAAC;EACzG;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"inmemory.js","names":[],"sources":["../../../../src/storage/domains/source-control/inmemory.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport type {\n ConfiguredExternalRepositoryKey,\n CreateProjectSourceControlConnectionInput,\n CreateSourceControlSessionInput,\n ExternalRepositoryProjectTarget,\n LinkProjectRepositoryInput,\n ProjectRepository,\n ProjectRepositorySandbox,\n ProjectSourceControlConnection,\n SourceControlInstallation,\n SourceControlRepository,\n SourceControlSession,\n SourceControlStorageHandle,\n SourceControlWorktree,\n UpdateProjectRepositoryInput,\n UpsertSourceControlInstallationInput,\n UpsertSourceControlRepositoryInput,\n UpsertSourceControlWorktreeInput,\n} from './base.js';\n\n/** In-memory provider-scoped source-control handle for route tests. */\nexport class SourceControlStorageInMemory implements SourceControlStorageHandle {\n readonly integrationId: string;\n installationsRows: SourceControlInstallation[] = [];\n repositoriesRows: SourceControlRepository[] = [];\n connectionsRows: ProjectSourceControlConnection[] = [];\n projectRepositoriesRows: ProjectRepository[] = [];\n sandboxesRows: ProjectRepositorySandbox[] = [];\n worktreesRows: SourceControlWorktree[] = [];\n sessionsRows: SourceControlSession[] = [];\n\n constructor(integrationId = 'github') {\n this.integrationId = integrationId;\n }\n\n readonly installations = {\n list: async ({ orgId }: { orgId: string }): Promise<SourceControlInstallation[]> =>\n this.installationsRows.filter(row => row.orgId === orgId),\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<SourceControlInstallation | null> =>\n this.installationsRows.find(row => row.orgId === orgId && row.id === id) ?? null,\n findByExternalId: async ({\n orgId,\n externalId,\n }: {\n orgId: string;\n externalId: string;\n }): Promise<SourceControlInstallation | null> =>\n this.installationsRows.find(row => row.orgId === orgId && row.externalId === externalId) ?? null,\n upsert: async (input: UpsertSourceControlInstallationInput): Promise<SourceControlInstallation> => {\n const existing = this.installationsRows.find(\n row => row.orgId === input.orgId && row.externalId === input.externalId,\n );\n if (existing) {\n Object.assign(existing, {\n connectedByUserId: input.connectedByUserId,\n accountName: input.accountName ?? null,\n accountType: input.accountType ?? null,\n providerMetadata: input.providerMetadata ?? {},\n });\n return existing;\n }\n const created: SourceControlInstallation = {\n id: randomUUID(),\n integrationId: this.integrationId,\n orgId: input.orgId,\n connectedByUserId: input.connectedByUserId,\n externalId: input.externalId,\n accountName: input.accountName ?? null,\n accountType: input.accountType ?? null,\n providerMetadata: input.providerMetadata ?? {},\n createdAt: new Date(),\n };\n this.installationsRows.push(created);\n return created;\n },\n delete: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n const index = this.installationsRows.findIndex(row => row.orgId === orgId && row.id === id);\n if (index < 0) return false;\n this.installationsRows.splice(index, 1);\n return true;\n },\n };\n\n readonly repositories = {\n list: async ({ orgId, installationId }: { orgId: string; installationId: string }) => {\n const installation = await this.installations.get({ orgId, id: installationId });\n return installation ? this.repositoriesRows.filter(row => row.installationId === installationId) : [];\n },\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<SourceControlRepository | null> => {\n const row = this.repositoriesRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.installations.get({ orgId, id: row.installationId })) ? row : null;\n },\n findByExternalId: async ({\n orgId,\n installationId,\n externalId,\n }: {\n orgId: string;\n installationId: string;\n externalId: string;\n }) => {\n const rows = await this.repositories.list({ orgId, installationId });\n return rows.find(row => row.externalId === externalId) ?? null;\n },\n findBySlug: async ({ orgId, installationId, slug }: { orgId: string; installationId: string; slug: string }) => {\n const rows = await this.repositories.list({ orgId, installationId });\n return rows.find(row => row.slug === slug) ?? null;\n },\n upsert: async ({\n orgId,\n input,\n }: {\n orgId: string;\n input: UpsertSourceControlRepositoryInput;\n }): Promise<SourceControlRepository> => {\n if (!(await this.installations.get({ orgId, id: input.installationId }))) {\n throw new Error('Source-control installation not found');\n }\n const existing = this.repositoriesRows.find(\n row => row.installationId === input.installationId && row.externalId === input.externalId,\n );\n const now = new Date();\n if (existing) {\n Object.assign(existing, {\n slug: input.slug,\n defaultBranch: input.defaultBranch,\n providerMetadata: input.providerMetadata ?? {},\n updatedAt: now,\n });\n return existing;\n }\n const created: SourceControlRepository = {\n id: randomUUID(),\n installationId: input.installationId,\n externalId: input.externalId,\n slug: input.slug,\n defaultBranch: input.defaultBranch,\n providerMetadata: input.providerMetadata ?? {},\n createdAt: now,\n updatedAt: now,\n };\n this.repositoriesRows.push(created);\n return created;\n },\n };\n\n readonly connections = {\n list: async ({ factoryProjectId }: { orgId: string; factoryProjectId: string }) =>\n this.connectionsRows.filter(row => row.factoryProjectId === factoryProjectId),\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<ProjectSourceControlConnection | null> => {\n const row = this.connectionsRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.installations.get({ orgId, id: row.installationId })) ? row : null;\n },\n create: async (input: CreateProjectSourceControlConnectionInput): Promise<ProjectSourceControlConnection> => {\n if (!(await this.installations.get({ orgId: input.orgId, id: input.installationId }))) {\n throw new Error('Source-control installation not found');\n }\n const existing = this.connectionsRows.find(\n row =>\n row.factoryProjectId === input.factoryProjectId &&\n row.integrationId === this.integrationId &&\n row.installationId === input.installationId,\n );\n if (existing) return existing;\n const created: ProjectSourceControlConnection = {\n id: randomUUID(),\n factoryProjectId: input.factoryProjectId,\n integrationId: this.integrationId,\n installationId: input.installationId,\n createdByUserId: input.createdByUserId,\n createdAt: new Date(),\n };\n this.connectionsRows.push(created);\n return created;\n },\n delete: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n if (!(await this.connections.get({ orgId, id }))) return false;\n this.connectionsRows.splice(0, this.connectionsRows.length, ...this.connectionsRows.filter(row => row.id !== id));\n return true;\n },\n };\n\n readonly projectRepositories = {\n list: async ({ orgId, connectionId }: { orgId: string; connectionId: string }) =>\n (await this.connections.get({ orgId, id: connectionId }))\n ? this.projectRepositoriesRows.filter(row => row.connectionId === connectionId)\n : [],\n listConfiguredExternalKeys: async (): Promise<ConfiguredExternalRepositoryKey[]> => {\n const keys = new Map<string, ConfiguredExternalRepositoryKey>();\n for (const connection of this.connectionsRows.filter(row => row.integrationId === this.integrationId)) {\n const installation = this.installationsRows.find(row => row.id === connection.installationId);\n if (!installation) continue;\n for (const link of this.projectRepositoriesRows.filter(row => row.connectionId === connection.id)) {\n const repository = this.repositoriesRows.find(row => row.id === link.repositoryId);\n if (!repository) continue;\n keys.set(`${installation.externalId}\\u0000${repository.externalId}`, {\n installationExternalId: installation.externalId,\n repositoryExternalId: repository.externalId,\n });\n }\n }\n return [...keys.values()];\n },\n listByExternalRepository: async ({\n installationExternalId,\n repositoryExternalId,\n }: {\n installationExternalId: string;\n repositoryExternalId: string;\n }): Promise<ExternalRepositoryProjectTarget[]> => {\n const targets: ExternalRepositoryProjectTarget[] = [];\n for (const installation of this.installationsRows.filter(row => row.externalId === installationExternalId)) {\n const repository = this.repositoriesRows.find(\n row => row.installationId === installation.id && row.externalId === repositoryExternalId,\n );\n if (!repository) continue;\n for (const projectRepository of this.projectRepositoriesRows.filter(\n row => row.repositoryId === repository.id,\n )) {\n const connection = this.connectionsRows.find(\n row =>\n row.id === projectRepository.connectionId &&\n row.installationId === installation.id &&\n row.integrationId === this.integrationId,\n );\n if (!connection) continue;\n targets.push({\n orgId: installation.orgId,\n factoryProjectId: connection.factoryProjectId,\n projectRepository,\n });\n }\n }\n return targets;\n },\n get: async ({ orgId, id }: { orgId: string; id: string }): Promise<ProjectRepository | null> => {\n const row = this.projectRepositoriesRows.find(candidate => candidate.id === id);\n if (!row) return null;\n return (await this.connections.get({ orgId, id: row.connectionId })) ? row : null;\n },\n link: async (input: LinkProjectRepositoryInput): Promise<ProjectRepository> => {\n const connection = await this.connections.get({ orgId: input.orgId, id: input.connectionId });\n const repository = await this.repositories.get({ orgId: input.orgId, id: input.repositoryId });\n if (!connection || !repository || repository.installationId !== connection.installationId) {\n throw new Error('Source-control connection or repository not found');\n }\n const existing = this.projectRepositoriesRows.find(\n row => row.connectionId === input.connectionId && row.repositoryId === input.repositoryId,\n );\n if (existing) return existing;\n const now = new Date();\n const created: ProjectRepository = {\n id: randomUUID(),\n connectionId: input.connectionId,\n repositoryId: input.repositoryId,\n createdByUserId: input.createdByUserId,\n branch: input.branch ?? null,\n sandboxProvider: input.sandboxProvider,\n sandboxWorkdir: input.sandboxWorkdir,\n setupCommand: input.setupCommand ?? null,\n createdAt: now,\n updatedAt: now,\n };\n this.projectRepositoriesRows.push(created);\n return created;\n },\n update: async ({\n orgId,\n id,\n input,\n }: {\n orgId: string;\n id: string;\n input: UpdateProjectRepositoryInput;\n }): Promise<ProjectRepository | null> => {\n const row = await this.projectRepositories.get({ orgId, id });\n if (!row) return null;\n Object.assign(row, input, { updatedAt: new Date() });\n return row;\n },\n unlink: async ({ orgId, id }: { orgId: string; id: string }): Promise<boolean> => {\n if (!(await this.projectRepositories.get({ orgId, id }))) return false;\n this.projectRepositoriesRows.splice(\n 0,\n this.projectRepositoriesRows.length,\n ...this.projectRepositoriesRows.filter(row => row.id !== id),\n );\n return true;\n },\n };\n\n readonly sandboxes = {\n getOrCreate: async ({\n projectRepository,\n userId,\n }: {\n projectRepository: ProjectRepository;\n userId: string;\n }): Promise<ProjectRepositorySandbox> => {\n const existing = this.sandboxesRows.find(\n row => row.projectRepositoryId === projectRepository.id && row.userId === userId,\n );\n if (existing) return existing;\n const created: ProjectRepositorySandbox = {\n id: randomUUID(),\n projectRepositoryId: projectRepository.id,\n userId,\n sandboxId: null,\n sandboxWorkdir: projectRepository.sandboxWorkdir,\n materializedAt: null,\n createdAt: new Date(),\n };\n this.sandboxesRows.push(created);\n return created;\n },\n getById: async ({ id }: { id: string }): Promise<ProjectRepositorySandbox | null> =>\n this.sandboxesRows.find(row => row.id === id) ?? null,\n setWorkdir: async ({ id, sandboxWorkdir }: { id: string; sandboxWorkdir: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxWorkdir, materializedAt: null });\n },\n setSandboxId: async ({ id, sandboxId }: { id: string; sandboxId: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) row.sandboxId = sandboxId;\n },\n clearBinding: async ({ id }: { id: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxId: null, materializedAt: null });\n },\n markMaterialized: async ({ id }: { id: string }): Promise<void> => {\n const row = this.sandboxesRows.find(candidate => candidate.id === id);\n if (row) row.materializedAt = new Date();\n },\n };\n\n readonly worktrees = {\n upsert: async (input: UpsertSourceControlWorktreeInput): Promise<void> => {\n const existing = this.worktreesRows.find(\n row =>\n row.projectRepositoryId === input.projectRepositoryId &&\n row.userId === input.userId &&\n row.branch === input.branch,\n );\n if (existing) {\n existing.baseBranch = input.baseBranch;\n existing.worktreePath = input.worktreePath;\n return;\n }\n this.worktreesRows.push({ id: randomUUID(), createdAt: new Date(), ...input });\n },\n list: async ({\n projectRepositoryId,\n userId,\n }: {\n projectRepositoryId: string;\n userId: string;\n }): Promise<SourceControlWorktree[]> =>\n this.worktreesRows.filter(row => row.projectRepositoryId === projectRepositoryId && row.userId === userId),\n get: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlWorktree | null> =>\n this.worktreesRows.find(\n row => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch,\n ) ?? null,\n findByPath: async ({\n projectRepositoryId,\n userId,\n worktreePath,\n }: {\n projectRepositoryId: string;\n userId: string;\n worktreePath: string;\n }): Promise<SourceControlWorktree | null> =>\n this.worktreesRows.find(\n row =>\n row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.worktreePath === worktreePath,\n ) ?? null,\n delete: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<void> => {\n this.worktreesRows.splice(\n 0,\n this.worktreesRows.length,\n ...this.worktreesRows.filter(\n row => !(row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch),\n ),\n );\n },\n };\n\n readonly sessions = {\n list: async ({ projectRepositoryId, userId }: { projectRepositoryId: string; userId: string }) =>\n this.sessionsRows.filter(row => row.projectRepositoryId === projectRepositoryId && row.userId === userId),\n getBySessionId: async (sessionId: string): Promise<SourceControlSession | null> =>\n this.sessionsRows.find(row => row.sessionId === sessionId) ?? null,\n getForBranch: async ({\n projectRepositoryId,\n userId,\n branch,\n }: {\n projectRepositoryId: string;\n userId: string;\n branch: string;\n }): Promise<SourceControlSession | null> =>\n this.sessionsRows.find(\n row => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch,\n ) ?? null,\n create: async (input: CreateSourceControlSessionInput): Promise<SourceControlSession> => {\n const existing = await this.sessions.getForBranch(input);\n if (existing) return existing;\n const now = new Date();\n const session: SourceControlSession = {\n id: randomUUID(),\n ...input,\n sandboxId: null,\n sandboxWorkdir: null,\n materializedAt: null,\n createdAt: now,\n updatedAt: now,\n };\n this.sessionsRows.push(session);\n return session;\n },\n setSandbox: async ({\n id,\n sandboxId,\n sandboxWorkdir,\n }: {\n id: string;\n sandboxId: string | null;\n sandboxWorkdir: string;\n }) => {\n const row = this.sessionsRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { sandboxId, sandboxWorkdir, updatedAt: new Date() });\n },\n markMaterialized: async ({ id }: { id: string }) => {\n const row = this.sessionsRows.find(candidate => candidate.id === id);\n if (row) Object.assign(row, { materializedAt: new Date(), updatedAt: new Date() });\n },\n delete: async (id: string) => {\n this.sessionsRows.splice(0, this.sessionsRows.length, ...this.sessionsRows.filter(row => row.id !== id));\n },\n };\n}\n"],"mappings":";;;AAuBA,IAAa,+BAAb,MAAgF;CAC9E;CACA,oBAAiD,CAAC;CAClD,mBAA8C,CAAC;CAC/C,kBAAoD,CAAC;CACrD,0BAA+C,CAAC;CAChD,gBAA4C,CAAC;CAC7C,gBAAyC,CAAC;CAC1C,eAAuC,CAAC;CAExC,YAAY,gBAAgB,UAAU;EACpC,KAAK,gBAAgB;CACvB;CAEA,gBAAyB;EACvB,MAAM,OAAO,EAAE,YACb,KAAK,kBAAkB,QAAO,QAAO,IAAI,UAAU,KAAK;EAC1D,KAAK,OAAO,EAAE,OAAO,SACnB,KAAK,kBAAkB,MAAK,QAAO,IAAI,UAAU,SAAS,IAAI,OAAO,EAAE,KAAK;EAC9E,kBAAkB,OAAO,EACvB,OACA,iBAKA,KAAK,kBAAkB,MAAK,QAAO,IAAI,UAAU,SAAS,IAAI,eAAe,UAAU,KAAK;EAC9F,QAAQ,OAAO,UAAoF;GACjG,MAAM,WAAW,KAAK,kBAAkB,MACtC,QAAO,IAAI,UAAU,MAAM,SAA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|
|
1137
1137
|
};
|
|
1138
1138
|
});
|
|
1139
|
-
|
|
1139
|
+
let lastError;
|
|
1140
|
+
for (let attempt = 0; attempt < 3; attempt++) try {
|
|
1140
1141
|
return await prepare();
|
|
1141
1142
|
} catch (error) {
|
|
1142
1143
|
if (!(error instanceof UniqueViolationError)) throw error;
|
|
1143
|
-
|
|
1144
|
+
lastError = error;
|
|
1144
1145
|
}
|
|
1146
|
+
throw lastError;
|
|
1145
1147
|
}
|
|
1146
1148
|
async markPendingStart(bindingId, status, lastError) {
|
|
1147
1149
|
const row = await this.#db.updateAtomic("factory_pending_starts", { binding_id: bindingId }, () => ({
|