@mastra/factory 0.0.0-esbuild-bundle-worker-20260807173433
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 +1008 -0
- package/LICENSE.md +30 -0
- package/README.md +27 -0
- package/dist/auth.d.ts +183 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +507 -0
- package/dist/auth.js.map +1 -0
- package/dist/capabilities/connection.d.ts +9 -0
- package/dist/capabilities/connection.d.ts.map +1 -0
- package/dist/capabilities/connection.js +1 -0
- package/dist/capabilities/intake.d.ts +141 -0
- package/dist/capabilities/intake.d.ts.map +1 -0
- package/dist/capabilities/intake.js +1 -0
- package/dist/capabilities/version-control.d.ts +247 -0
- package/dist/capabilities/version-control.d.ts.map +1 -0
- package/dist/capabilities/version-control.js +1 -0
- package/dist/factory.d.ts +159 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +491 -0
- package/dist/factory.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/integrations/base.d.ts +254 -0
- package/dist/integrations/base.d.ts.map +1 -0
- package/dist/integrations/base.js +1 -0
- package/dist/integrations/github/config.d.ts +60 -0
- package/dist/integrations/github/config.d.ts.map +1 -0
- package/dist/integrations/github/config.js +42 -0
- package/dist/integrations/github/config.js.map +1 -0
- package/dist/integrations/github/integration.d.ts +220 -0
- package/dist/integrations/github/integration.d.ts.map +1 -0
- package/dist/integrations/github/integration.js +1162 -0
- package/dist/integrations/github/integration.js.map +1 -0
- package/dist/integrations/github/issue-triage.d.ts +27 -0
- package/dist/integrations/github/issue-triage.d.ts.map +1 -0
- package/dist/integrations/github/issue-triage.js +82 -0
- package/dist/integrations/github/issue-triage.js.map +1 -0
- package/dist/integrations/github/pat.d.ts +38 -0
- package/dist/integrations/github/pat.d.ts.map +1 -0
- package/dist/integrations/github/pat.js +59 -0
- package/dist/integrations/github/pat.js.map +1 -0
- package/dist/integrations/github/provenance.d.ts +27 -0
- package/dist/integrations/github/provenance.d.ts.map +1 -0
- package/dist/integrations/github/provenance.js +75 -0
- package/dist/integrations/github/provenance.js.map +1 -0
- package/dist/integrations/github/reconcile-worker.d.ts +41 -0
- package/dist/integrations/github/reconcile-worker.d.ts.map +1 -0
- package/dist/integrations/github/reconcile-worker.js +125 -0
- package/dist/integrations/github/reconcile-worker.js.map +1 -0
- package/dist/integrations/github/routes.d.ts +69 -0
- package/dist/integrations/github/routes.d.ts.map +1 -0
- package/dist/integrations/github/routes.js +1335 -0
- package/dist/integrations/github/routes.js.map +1 -0
- package/dist/integrations/github/rules.d.ts +105 -0
- package/dist/integrations/github/rules.d.ts.map +1 -0
- package/dist/integrations/github/rules.js +551 -0
- package/dist/integrations/github/rules.js.map +1 -0
- package/dist/integrations/github/sandbox-release.d.ts +53 -0
- package/dist/integrations/github/sandbox-release.d.ts.map +1 -0
- package/dist/integrations/github/sandbox-release.js +115 -0
- package/dist/integrations/github/sandbox-release.js.map +1 -0
- package/dist/integrations/github/sandbox.d.ts +281 -0
- package/dist/integrations/github/sandbox.d.ts.map +1 -0
- package/dist/integrations/github/sandbox.js +547 -0
- package/dist/integrations/github/sandbox.js.map +1 -0
- package/dist/integrations/github/session-subscriptions.d.ts +26 -0
- package/dist/integrations/github/session-subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/session-subscriptions.js +192 -0
- package/dist/integrations/github/session-subscriptions.js.map +1 -0
- package/dist/integrations/github/subscriptions.d.ts +54 -0
- package/dist/integrations/github/subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/subscriptions.js +62 -0
- package/dist/integrations/github/subscriptions.js.map +1 -0
- package/dist/integrations/github/token-refresh.d.ts +12 -0
- package/dist/integrations/github/token-refresh.d.ts.map +1 -0
- package/dist/integrations/github/token-refresh.js +24 -0
- package/dist/integrations/github/token-refresh.js.map +1 -0
- package/dist/integrations/github/webhook.d.ts +107 -0
- package/dist/integrations/github/webhook.d.ts.map +1 -0
- package/dist/integrations/github/webhook.js +371 -0
- package/dist/integrations/github/webhook.js.map +1 -0
- package/dist/integrations/linear/agent-tools.d.ts +34 -0
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -0
- package/dist/integrations/linear/agent-tools.js +85 -0
- package/dist/integrations/linear/agent-tools.js.map +1 -0
- package/dist/integrations/linear/integration.d.ts +235 -0
- package/dist/integrations/linear/integration.d.ts.map +1 -0
- package/dist/integrations/linear/integration.js +676 -0
- package/dist/integrations/linear/integration.js.map +1 -0
- package/dist/integrations/linear/routes.d.ts +61 -0
- package/dist/integrations/linear/routes.d.ts.map +1 -0
- package/dist/integrations/linear/routes.js +240 -0
- package/dist/integrations/linear/routes.js.map +1 -0
- package/dist/integrations/linear/rules.d.ts +44 -0
- package/dist/integrations/linear/rules.d.ts.map +1 -0
- package/dist/integrations/linear/rules.js +133 -0
- package/dist/integrations/linear/rules.js.map +1 -0
- package/dist/integrations/linear/storage.d.ts +65 -0
- package/dist/integrations/linear/storage.d.ts.map +1 -0
- package/dist/integrations/linear/storage.js +1 -0
- package/dist/integrations/platform/api-client.d.ts +26 -0
- package/dist/integrations/platform/api-client.d.ts.map +1 -0
- package/dist/integrations/platform/api-client.js +156 -0
- package/dist/integrations/platform/api-client.js.map +1 -0
- package/dist/integrations/platform/github/event-worker.d.ts +44 -0
- package/dist/integrations/platform/github/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/github/event-worker.js +349 -0
- package/dist/integrations/platform/github/event-worker.js.map +1 -0
- package/dist/integrations/platform/github/integration.d.ts +64 -0
- package/dist/integrations/platform/github/integration.d.ts.map +1 -0
- package/dist/integrations/platform/github/integration.js +1006 -0
- package/dist/integrations/platform/github/integration.js.map +1 -0
- package/dist/integrations/platform/linear/integration.d.ts +46 -0
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -0
- package/dist/integrations/platform/linear/integration.js +483 -0
- package/dist/integrations/platform/linear/integration.js.map +1 -0
- package/dist/integrations/slack/connect-route.d.ts +46 -0
- package/dist/integrations/slack/connect-route.d.ts.map +1 -0
- package/dist/integrations/slack/connect-route.js +186 -0
- package/dist/integrations/slack/connect-route.js.map +1 -0
- package/dist/integrations/slack/integration.d.ts +62 -0
- package/dist/integrations/slack/integration.d.ts.map +1 -0
- package/dist/integrations/slack/integration.js +68 -0
- package/dist/integrations/slack/integration.js.map +1 -0
- package/dist/integrations/slack/slack.d.ts +200 -0
- package/dist/integrations/slack/slack.d.ts.map +1 -0
- package/dist/integrations/slack/slack.js +411 -0
- package/dist/integrations/slack/slack.js.map +1 -0
- package/dist/integrations/workos/integration.d.ts +39 -0
- package/dist/integrations/workos/integration.d.ts.map +1 -0
- package/dist/integrations/workos/integration.js +91 -0
- package/dist/integrations/workos/integration.js.map +1 -0
- package/dist/routes/config.d.ts +235 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +972 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/custom-provider-source.d.ts +52 -0
- package/dist/routes/custom-provider-source.d.ts.map +1 -0
- package/dist/routes/custom-provider-source.js +124 -0
- package/dist/routes/custom-provider-source.js.map +1 -0
- package/dist/routes/fs.d.ts +151 -0
- package/dist/routes/fs.d.ts.map +1 -0
- package/dist/routes/fs.js +708 -0
- package/dist/routes/fs.js.map +1 -0
- package/dist/routes/intake.d.ts +23 -0
- package/dist/routes/intake.d.ts.map +1 -0
- package/dist/routes/intake.js +179 -0
- package/dist/routes/intake.js.map +1 -0
- package/dist/routes/oauth.d.ts +43 -0
- package/dist/routes/oauth.d.ts.map +1 -0
- package/dist/routes/oauth.js +463 -0
- package/dist/routes/oauth.js.map +1 -0
- package/dist/routes/projects.d.ts +19 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +461 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/provider-credentials.d.ts +81 -0
- package/dist/routes/provider-credentials.d.ts.map +1 -0
- package/dist/routes/provider-credentials.js +86 -0
- package/dist/routes/provider-credentials.js.map +1 -0
- package/dist/routes/route.d.ts +48 -0
- package/dist/routes/route.d.ts.map +1 -0
- package/dist/routes/route.js +15 -0
- package/dist/routes/route.js.map +1 -0
- package/dist/routes/skills.d.ts +30 -0
- package/dist/routes/skills.d.ts.map +1 -0
- package/dist/routes/skills.js +168 -0
- package/dist/routes/skills.js.map +1 -0
- package/dist/routes/surface.d.ts +107 -0
- package/dist/routes/surface.d.ts.map +1 -0
- package/dist/routes/surface.js +297 -0
- package/dist/routes/surface.js.map +1 -0
- package/dist/routes/tenant-credentials.d.ts +74 -0
- package/dist/routes/tenant-credentials.d.ts.map +1 -0
- package/dist/routes/tenant-credentials.js +156 -0
- package/dist/routes/tenant-credentials.js.map +1 -0
- package/dist/routes/work-items.d.ts +40 -0
- package/dist/routes/work-items.d.ts.map +1 -0
- package/dist/routes/work-items.js +695 -0
- package/dist/routes/work-items.js.map +1 -0
- package/dist/rules/binding-context.d.ts +5 -0
- package/dist/rules/binding-context.d.ts.map +1 -0
- package/dist/rules/binding-context.js +28 -0
- package/dist/rules/binding-context.js.map +1 -0
- package/dist/rules/defaults.d.ts +9 -0
- package/dist/rules/defaults.d.ts.map +1 -0
- package/dist/rules/defaults.js +322 -0
- package/dist/rules/defaults.js.map +1 -0
- package/dist/rules/dispatcher.d.ts +43 -0
- package/dist/rules/dispatcher.d.ts.map +1 -0
- package/dist/rules/dispatcher.js +547 -0
- package/dist/rules/dispatcher.js.map +1 -0
- package/dist/rules/index.d.ts +7 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +5 -0
- package/dist/rules/processor.d.ts +54 -0
- package/dist/rules/processor.d.ts.map +1 -0
- package/dist/rules/processor.js +378 -0
- package/dist/rules/processor.js.map +1 -0
- package/dist/rules/resolve.d.ts +17 -0
- package/dist/rules/resolve.d.ts.map +1 -0
- package/dist/rules/resolve.js +30 -0
- package/dist/rules/resolve.js.map +1 -0
- package/dist/rules/start-coordinator.d.ts +60 -0
- package/dist/rules/start-coordinator.d.ts.map +1 -0
- package/dist/rules/start-coordinator.js +175 -0
- package/dist/rules/start-coordinator.js.map +1 -0
- package/dist/rules/tools.d.ts +10 -0
- package/dist/rules/tools.d.ts.map +1 -0
- package/dist/rules/tools.js +59 -0
- package/dist/rules/tools.js.map +1 -0
- package/dist/rules/transition-service.d.ts +49 -0
- package/dist/rules/transition-service.d.ts.map +1 -0
- package/dist/rules/transition-service.js +232 -0
- package/dist/rules/transition-service.js.map +1 -0
- package/dist/rules/types.d.ts +261 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +43 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/rules/validation.d.ts +11 -0
- package/dist/rules/validation.d.ts.map +1 -0
- package/dist/rules/validation.js +308 -0
- package/dist/rules/validation.js.map +1 -0
- package/dist/sandbox/fleet.d.ts +222 -0
- package/dist/sandbox/fleet.d.ts.map +1 -0
- package/dist/sandbox/fleet.js +322 -0
- package/dist/sandbox/fleet.js.map +1 -0
- package/dist/sandbox/reattach.d.ts +3 -0
- package/dist/sandbox/reattach.d.ts.map +1 -0
- package/dist/sandbox/reattach.js +16 -0
- package/dist/sandbox/reattach.js.map +1 -0
- package/dist/server-error.d.ts +12 -0
- package/dist/server-error.d.ts.map +1 -0
- package/dist/server-error.js +16 -0
- package/dist/server-error.js.map +1 -0
- package/dist/session/factory-session.d.ts +116 -0
- package/dist/session/factory-session.d.ts.map +1 -0
- package/dist/session/factory-session.js +162 -0
- package/dist/session/factory-session.js.map +1 -0
- package/dist/skills/service.d.ts +48 -0
- package/dist/skills/service.d.ts.map +1 -0
- package/dist/skills/service.js +40 -0
- package/dist/skills/service.js.map +1 -0
- package/dist/spa-static.d.ts +33 -0
- package/dist/spa-static.d.ts.map +1 -0
- package/dist/spa-static.js +104 -0
- package/dist/spa-static.js.map +1 -0
- package/dist/state-signing.d.ts +59 -0
- package/dist/state-signing.d.ts.map +1 -0
- package/dist/state-signing.js +83 -0
- package/dist/state-signing.js.map +1 -0
- package/dist/storage/domains/audit/agent-audit.d.ts +27 -0
- package/dist/storage/domains/audit/agent-audit.d.ts.map +1 -0
- package/dist/storage/domains/audit/agent-audit.js +66 -0
- package/dist/storage/domains/audit/agent-audit.js.map +1 -0
- package/dist/storage/domains/audit/base.d.ts +140 -0
- package/dist/storage/domains/audit/base.d.ts.map +1 -0
- package/dist/storage/domains/audit/base.js +184 -0
- package/dist/storage/domains/audit/base.js.map +1 -0
- package/dist/storage/domains/audit/domain.d.ts +76 -0
- package/dist/storage/domains/audit/domain.d.ts.map +1 -0
- package/dist/storage/domains/audit/domain.js +269 -0
- package/dist/storage/domains/audit/domain.js.map +1 -0
- package/dist/storage/domains/channel-identity/base.d.ts +96 -0
- package/dist/storage/domains/channel-identity/base.d.ts.map +1 -0
- package/dist/storage/domains/channel-identity/base.js +149 -0
- package/dist/storage/domains/channel-identity/base.js.map +1 -0
- package/dist/storage/domains/credentials/base.d.ts +134 -0
- package/dist/storage/domains/credentials/base.d.ts.map +1 -0
- package/dist/storage/domains/credentials/base.js +273 -0
- package/dist/storage/domains/credentials/base.js.map +1 -0
- package/dist/storage/domains/custom-providers/base.d.ts +57 -0
- package/dist/storage/domains/custom-providers/base.d.ts.map +1 -0
- package/dist/storage/domains/custom-providers/base.js +145 -0
- package/dist/storage/domains/custom-providers/base.js.map +1 -0
- package/dist/storage/domains/intake/base.d.ts +38 -0
- package/dist/storage/domains/intake/base.d.ts.map +1 -0
- package/dist/storage/domains/intake/base.js +80 -0
- package/dist/storage/domains/intake/base.js.map +1 -0
- package/dist/storage/domains/integrations/base.d.ts +126 -0
- package/dist/storage/domains/integrations/base.d.ts.map +1 -0
- package/dist/storage/domains/integrations/base.js +317 -0
- package/dist/storage/domains/integrations/base.js.map +1 -0
- package/dist/storage/domains/memory-settings/base.d.ts +62 -0
- package/dist/storage/domains/memory-settings/base.d.ts.map +1 -0
- package/dist/storage/domains/memory-settings/base.js +126 -0
- package/dist/storage/domains/memory-settings/base.js.map +1 -0
- package/dist/storage/domains/model-packs/base.d.ts +49 -0
- package/dist/storage/domains/model-packs/base.d.ts.map +1 -0
- package/dist/storage/domains/model-packs/base.js +96 -0
- package/dist/storage/domains/model-packs/base.js.map +1 -0
- package/dist/storage/domains/projects/base.d.ts +58 -0
- package/dist/storage/domains/projects/base.d.ts.map +1 -0
- package/dist/storage/domains/projects/base.js +111 -0
- package/dist/storage/domains/projects/base.js.map +1 -0
- package/dist/storage/domains/queue-health/base.d.ts +52 -0
- package/dist/storage/domains/queue-health/base.d.ts.map +1 -0
- package/dist/storage/domains/queue-health/base.js +122 -0
- package/dist/storage/domains/queue-health/base.js.map +1 -0
- package/dist/storage/domains/source-control/base.d.ts +360 -0
- package/dist/storage/domains/source-control/base.d.ts.map +1 -0
- package/dist/storage/domains/source-control/base.js +914 -0
- package/dist/storage/domains/source-control/base.js.map +1 -0
- package/dist/storage/domains/source-control/inmemory.d.ts +175 -0
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/source-control/inmemory.js +380 -0
- package/dist/storage/domains/source-control/inmemory.js.map +1 -0
- package/dist/storage/domains/work-items/base.d.ts +412 -0
- package/dist/storage/domains/work-items/base.d.ts.map +1 -0
- package/dist/storage/domains/work-items/base.js +1320 -0
- package/dist/storage/domains/work-items/base.js.map +1 -0
- package/dist/storage/domains/work-items/metrics.d.ts +101 -0
- package/dist/storage/domains/work-items/metrics.d.ts.map +1 -0
- package/dist/storage/domains/work-items/metrics.js +221 -0
- package/dist/storage/domains/work-items/metrics.js.map +1 -0
- package/dist/timing.d.ts +15 -0
- package/dist/timing.d.ts.map +1 -0
- package/dist/timing.js +34 -0
- package/dist/timing.js.map +1 -0
- package/dist/workspace.d.ts +24 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +287 -0
- package/dist/workspace.js.map +1 -0
- package/factory-skills/configure-factory-rules/SKILL.md +67 -0
- package/factory-skills/factory-plan/SKILL.md +61 -0
- package/factory-skills/factory-review/SKILL.md +157 -0
- package/factory-skills/factory-triage/SKILL.md +99 -0
- package/package.json +83 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { randomUUID } from "crypto";
|
|
2
|
+
import { UniqueViolationError } from "@mastra/core/storage";
|
|
3
|
+
//#region src/storage/domains/source-control/inmemory.ts
|
|
4
|
+
/** In-memory provider-scoped source-control handle for route tests. */
|
|
5
|
+
var SourceControlStorageInMemory = class {
|
|
6
|
+
integrationId;
|
|
7
|
+
installationsRows = [];
|
|
8
|
+
repositoriesRows = [];
|
|
9
|
+
connectionsRows = [];
|
|
10
|
+
projectRepositoriesRows = [];
|
|
11
|
+
sandboxesRows = [];
|
|
12
|
+
sandboxPoolRows = [];
|
|
13
|
+
worktreesRows = [];
|
|
14
|
+
sessionsRows = [];
|
|
15
|
+
constructor(integrationId = "github") {
|
|
16
|
+
this.integrationId = integrationId;
|
|
17
|
+
}
|
|
18
|
+
installations = {
|
|
19
|
+
list: async ({ orgId }) => this.installationsRows.filter((row) => row.orgId === orgId),
|
|
20
|
+
get: async ({ orgId, id }) => this.installationsRows.find((row) => row.orgId === orgId && row.id === id) ?? null,
|
|
21
|
+
findByExternalId: async ({ orgId, externalId }) => this.installationsRows.find((row) => row.orgId === orgId && row.externalId === externalId) ?? null,
|
|
22
|
+
upsert: async (input) => {
|
|
23
|
+
const existing = this.installationsRows.find((row) => row.orgId === input.orgId && row.externalId === input.externalId);
|
|
24
|
+
if (existing) {
|
|
25
|
+
Object.assign(existing, {
|
|
26
|
+
connectedByUserId: input.connectedByUserId,
|
|
27
|
+
accountName: input.accountName ?? null,
|
|
28
|
+
accountType: input.accountType ?? null,
|
|
29
|
+
providerMetadata: input.providerMetadata ?? {}
|
|
30
|
+
});
|
|
31
|
+
return existing;
|
|
32
|
+
}
|
|
33
|
+
const created = {
|
|
34
|
+
id: randomUUID(),
|
|
35
|
+
integrationId: this.integrationId,
|
|
36
|
+
orgId: input.orgId,
|
|
37
|
+
connectedByUserId: input.connectedByUserId,
|
|
38
|
+
externalId: input.externalId,
|
|
39
|
+
accountName: input.accountName ?? null,
|
|
40
|
+
accountType: input.accountType ?? null,
|
|
41
|
+
providerMetadata: input.providerMetadata ?? {},
|
|
42
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
43
|
+
};
|
|
44
|
+
this.installationsRows.push(created);
|
|
45
|
+
return created;
|
|
46
|
+
},
|
|
47
|
+
delete: async ({ orgId, id }) => {
|
|
48
|
+
const index = this.installationsRows.findIndex((row) => row.orgId === orgId && row.id === id);
|
|
49
|
+
if (index < 0) return false;
|
|
50
|
+
this.installationsRows.splice(index, 1);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
repositories = {
|
|
55
|
+
list: async ({ orgId, installationId }) => {
|
|
56
|
+
return await this.installations.get({
|
|
57
|
+
orgId,
|
|
58
|
+
id: installationId
|
|
59
|
+
}) ? this.repositoriesRows.filter((row) => row.installationId === installationId) : [];
|
|
60
|
+
},
|
|
61
|
+
get: async ({ orgId, id }) => {
|
|
62
|
+
const row = this.repositoriesRows.find((candidate) => candidate.id === id);
|
|
63
|
+
if (!row) return null;
|
|
64
|
+
return await this.installations.get({
|
|
65
|
+
orgId,
|
|
66
|
+
id: row.installationId
|
|
67
|
+
}) ? row : null;
|
|
68
|
+
},
|
|
69
|
+
findByExternalId: async ({ orgId, installationId, externalId }) => {
|
|
70
|
+
return (await this.repositories.list({
|
|
71
|
+
orgId,
|
|
72
|
+
installationId
|
|
73
|
+
})).find((row) => row.externalId === externalId) ?? null;
|
|
74
|
+
},
|
|
75
|
+
findBySlug: async ({ orgId, installationId, slug }) => {
|
|
76
|
+
return (await this.repositories.list({
|
|
77
|
+
orgId,
|
|
78
|
+
installationId
|
|
79
|
+
})).find((row) => row.slug === slug) ?? null;
|
|
80
|
+
},
|
|
81
|
+
upsert: async ({ orgId, input }) => {
|
|
82
|
+
if (!await this.installations.get({
|
|
83
|
+
orgId,
|
|
84
|
+
id: input.installationId
|
|
85
|
+
})) throw new Error("Source-control installation not found");
|
|
86
|
+
const existing = this.repositoriesRows.find((row) => row.installationId === input.installationId && row.externalId === input.externalId);
|
|
87
|
+
const now = /* @__PURE__ */ new Date();
|
|
88
|
+
if (existing) {
|
|
89
|
+
Object.assign(existing, {
|
|
90
|
+
slug: input.slug,
|
|
91
|
+
defaultBranch: input.defaultBranch,
|
|
92
|
+
providerMetadata: input.providerMetadata ?? {},
|
|
93
|
+
updatedAt: now
|
|
94
|
+
});
|
|
95
|
+
return existing;
|
|
96
|
+
}
|
|
97
|
+
const created = {
|
|
98
|
+
id: randomUUID(),
|
|
99
|
+
installationId: input.installationId,
|
|
100
|
+
externalId: input.externalId,
|
|
101
|
+
slug: input.slug,
|
|
102
|
+
defaultBranch: input.defaultBranch,
|
|
103
|
+
providerMetadata: input.providerMetadata ?? {},
|
|
104
|
+
createdAt: now,
|
|
105
|
+
updatedAt: now
|
|
106
|
+
};
|
|
107
|
+
this.repositoriesRows.push(created);
|
|
108
|
+
return created;
|
|
109
|
+
},
|
|
110
|
+
migrateInstallation: async ({ orgId, id, newInstallationId }) => {
|
|
111
|
+
const existing = await this.repositories.get({
|
|
112
|
+
orgId,
|
|
113
|
+
id
|
|
114
|
+
});
|
|
115
|
+
if (!existing) throw new Error(`Repository ${id} not found in organization ${orgId}`);
|
|
116
|
+
if (!await this.installations.get({
|
|
117
|
+
orgId,
|
|
118
|
+
id: newInstallationId
|
|
119
|
+
})) throw new Error("Source-control installation not found");
|
|
120
|
+
const conflict = this.repositoriesRows.find((row) => row.installationId === newInstallationId && row.externalId === existing.externalId);
|
|
121
|
+
if (conflict) return conflict;
|
|
122
|
+
existing.installationId = newInstallationId;
|
|
123
|
+
existing.updatedAt = /* @__PURE__ */ new Date();
|
|
124
|
+
for (const conn of this.connectionsRows) if (conn.installationId === existing.installationId) conn.installationId = newInstallationId;
|
|
125
|
+
return existing;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
connections = {
|
|
129
|
+
list: async ({ factoryProjectId }) => this.connectionsRows.filter((row) => row.factoryProjectId === factoryProjectId),
|
|
130
|
+
get: async ({ orgId, id }) => {
|
|
131
|
+
const row = this.connectionsRows.find((candidate) => candidate.id === id);
|
|
132
|
+
if (!row) return null;
|
|
133
|
+
return await this.installations.get({
|
|
134
|
+
orgId,
|
|
135
|
+
id: row.installationId
|
|
136
|
+
}) ? row : null;
|
|
137
|
+
},
|
|
138
|
+
create: async (input) => {
|
|
139
|
+
if (!await this.installations.get({
|
|
140
|
+
orgId: input.orgId,
|
|
141
|
+
id: input.installationId
|
|
142
|
+
})) throw new Error("Source-control installation not found");
|
|
143
|
+
const existing = this.connectionsRows.find((row) => row.factoryProjectId === input.factoryProjectId && row.integrationId === this.integrationId && row.installationId === input.installationId);
|
|
144
|
+
if (existing) return existing;
|
|
145
|
+
const created = {
|
|
146
|
+
id: randomUUID(),
|
|
147
|
+
factoryProjectId: input.factoryProjectId,
|
|
148
|
+
integrationId: this.integrationId,
|
|
149
|
+
installationId: input.installationId,
|
|
150
|
+
createdByUserId: input.createdByUserId,
|
|
151
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
152
|
+
};
|
|
153
|
+
this.connectionsRows.push(created);
|
|
154
|
+
return created;
|
|
155
|
+
},
|
|
156
|
+
delete: async ({ orgId, id }) => {
|
|
157
|
+
if (!await this.connections.get({
|
|
158
|
+
orgId,
|
|
159
|
+
id
|
|
160
|
+
})) return false;
|
|
161
|
+
this.connectionsRows.splice(0, this.connectionsRows.length, ...this.connectionsRows.filter((row) => row.id !== id));
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
projectRepositories = {
|
|
166
|
+
list: async ({ orgId, connectionId }) => await this.connections.get({
|
|
167
|
+
orgId,
|
|
168
|
+
id: connectionId
|
|
169
|
+
}) ? this.projectRepositoriesRows.filter((row) => row.connectionId === connectionId) : [],
|
|
170
|
+
listConfiguredExternalKeys: async () => {
|
|
171
|
+
const keys = /* @__PURE__ */ new Map();
|
|
172
|
+
for (const connection of this.connectionsRows.filter((row) => row.integrationId === this.integrationId)) {
|
|
173
|
+
const installation = this.installationsRows.find((row) => row.id === connection.installationId);
|
|
174
|
+
if (!installation) continue;
|
|
175
|
+
for (const link of this.projectRepositoriesRows.filter((row) => row.connectionId === connection.id)) {
|
|
176
|
+
const repository = this.repositoriesRows.find((row) => row.id === link.repositoryId);
|
|
177
|
+
if (!repository) continue;
|
|
178
|
+
keys.set(`${installation.externalId}\u0000${repository.externalId}`, {
|
|
179
|
+
installationExternalId: installation.externalId,
|
|
180
|
+
repositoryExternalId: repository.externalId
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return [...keys.values()];
|
|
185
|
+
},
|
|
186
|
+
listByExternalRepository: async ({ installationExternalId, repositoryExternalId }) => {
|
|
187
|
+
const targets = [];
|
|
188
|
+
for (const installation of this.installationsRows.filter((row) => row.externalId === installationExternalId)) {
|
|
189
|
+
const repository = this.repositoriesRows.find((row) => row.installationId === installation.id && row.externalId === repositoryExternalId);
|
|
190
|
+
if (!repository) continue;
|
|
191
|
+
for (const projectRepository of this.projectRepositoriesRows.filter((row) => row.repositoryId === repository.id)) {
|
|
192
|
+
const connection = this.connectionsRows.find((row) => row.id === projectRepository.connectionId && row.installationId === installation.id && row.integrationId === this.integrationId);
|
|
193
|
+
if (!connection) continue;
|
|
194
|
+
targets.push({
|
|
195
|
+
orgId: installation.orgId,
|
|
196
|
+
factoryProjectId: connection.factoryProjectId,
|
|
197
|
+
projectRepository
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return targets;
|
|
202
|
+
},
|
|
203
|
+
get: async ({ orgId, id }) => {
|
|
204
|
+
const row = this.projectRepositoriesRows.find((candidate) => candidate.id === id);
|
|
205
|
+
if (!row) return null;
|
|
206
|
+
return await this.connections.get({
|
|
207
|
+
orgId,
|
|
208
|
+
id: row.connectionId
|
|
209
|
+
}) ? row : null;
|
|
210
|
+
},
|
|
211
|
+
link: async (input) => {
|
|
212
|
+
const connection = await this.connections.get({
|
|
213
|
+
orgId: input.orgId,
|
|
214
|
+
id: input.connectionId
|
|
215
|
+
});
|
|
216
|
+
const repository = await this.repositories.get({
|
|
217
|
+
orgId: input.orgId,
|
|
218
|
+
id: input.repositoryId
|
|
219
|
+
});
|
|
220
|
+
if (!connection || !repository || repository.installationId !== connection.installationId) throw new Error("Source-control connection or repository not found");
|
|
221
|
+
const existing = this.projectRepositoriesRows.find((row) => row.connectionId === input.connectionId && row.repositoryId === input.repositoryId);
|
|
222
|
+
if (existing) return existing;
|
|
223
|
+
const now = /* @__PURE__ */ new Date();
|
|
224
|
+
const created = {
|
|
225
|
+
id: randomUUID(),
|
|
226
|
+
connectionId: input.connectionId,
|
|
227
|
+
repositoryId: input.repositoryId,
|
|
228
|
+
createdByUserId: input.createdByUserId,
|
|
229
|
+
branch: input.branch ?? null,
|
|
230
|
+
sandboxProvider: input.sandboxProvider,
|
|
231
|
+
sandboxWorkdir: input.sandboxWorkdir,
|
|
232
|
+
setupCommand: input.setupCommand ?? null,
|
|
233
|
+
createdAt: now,
|
|
234
|
+
updatedAt: now
|
|
235
|
+
};
|
|
236
|
+
this.projectRepositoriesRows.push(created);
|
|
237
|
+
return created;
|
|
238
|
+
},
|
|
239
|
+
update: async ({ orgId, id, input }) => {
|
|
240
|
+
const row = await this.projectRepositories.get({
|
|
241
|
+
orgId,
|
|
242
|
+
id
|
|
243
|
+
});
|
|
244
|
+
if (!row) return null;
|
|
245
|
+
Object.assign(row, input, { updatedAt: /* @__PURE__ */ new Date() });
|
|
246
|
+
return row;
|
|
247
|
+
},
|
|
248
|
+
unlink: async ({ orgId, id }) => {
|
|
249
|
+
if (!await this.projectRepositories.get({
|
|
250
|
+
orgId,
|
|
251
|
+
id
|
|
252
|
+
})) return false;
|
|
253
|
+
this.projectRepositoriesRows.splice(0, this.projectRepositoriesRows.length, ...this.projectRepositoriesRows.filter((row) => row.id !== id));
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
sandboxes = {
|
|
258
|
+
getOrCreate: async ({ projectRepository, userId }) => {
|
|
259
|
+
const existing = this.sandboxesRows.find((row) => row.projectRepositoryId === projectRepository.id && row.userId === userId);
|
|
260
|
+
if (existing) return existing;
|
|
261
|
+
const created = {
|
|
262
|
+
id: randomUUID(),
|
|
263
|
+
projectRepositoryId: projectRepository.id,
|
|
264
|
+
userId,
|
|
265
|
+
sandboxId: null,
|
|
266
|
+
sandboxWorkdir: projectRepository.sandboxWorkdir,
|
|
267
|
+
materializedAt: null,
|
|
268
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
269
|
+
};
|
|
270
|
+
this.sandboxesRows.push(created);
|
|
271
|
+
return created;
|
|
272
|
+
},
|
|
273
|
+
getById: async ({ id }) => this.sandboxesRows.find((row) => row.id === id) ?? null,
|
|
274
|
+
setWorkdir: async ({ id, sandboxWorkdir }) => {
|
|
275
|
+
const row = this.sandboxesRows.find((candidate) => candidate.id === id);
|
|
276
|
+
if (row) Object.assign(row, {
|
|
277
|
+
sandboxWorkdir,
|
|
278
|
+
materializedAt: null
|
|
279
|
+
});
|
|
280
|
+
},
|
|
281
|
+
setSandboxId: async ({ id, sandboxId }) => {
|
|
282
|
+
const row = this.sandboxesRows.find((candidate) => candidate.id === id);
|
|
283
|
+
if (row) row.sandboxId = sandboxId;
|
|
284
|
+
},
|
|
285
|
+
clearBinding: async ({ id }) => {
|
|
286
|
+
const row = this.sandboxesRows.find((candidate) => candidate.id === id);
|
|
287
|
+
if (row) Object.assign(row, {
|
|
288
|
+
sandboxId: null,
|
|
289
|
+
materializedAt: null
|
|
290
|
+
});
|
|
291
|
+
},
|
|
292
|
+
markMaterialized: async ({ id }) => {
|
|
293
|
+
const row = this.sandboxesRows.find((candidate) => candidate.id === id);
|
|
294
|
+
if (row) row.materializedAt = /* @__PURE__ */ new Date();
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
sandboxPool = {
|
|
298
|
+
release: async (input) => {
|
|
299
|
+
if (!this.projectRepositoriesRows.some((row) => row.id === input.projectRepositoryId)) return;
|
|
300
|
+
if (this.sandboxPoolRows.some((row) => row.sandboxId === input.sandboxId)) return;
|
|
301
|
+
this.sandboxPoolRows.push({
|
|
302
|
+
id: randomUUID(),
|
|
303
|
+
releasedAt: /* @__PURE__ */ new Date(),
|
|
304
|
+
...input
|
|
305
|
+
});
|
|
306
|
+
},
|
|
307
|
+
claim: async ({ projectRepositoryId }) => {
|
|
308
|
+
const claimed = this.sandboxPoolRows.filter((row) => row.projectRepositoryId === projectRepositoryId).sort((left, right) => right.releasedAt.getTime() - left.releasedAt.getTime())[0];
|
|
309
|
+
if (!claimed) return null;
|
|
310
|
+
this.sandboxPoolRows.splice(this.sandboxPoolRows.indexOf(claimed), 1);
|
|
311
|
+
return claimed;
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
worktrees = {
|
|
315
|
+
upsert: async (input) => {
|
|
316
|
+
const existing = this.worktreesRows.find((row) => row.projectRepositoryId === input.projectRepositoryId && row.userId === input.userId && row.branch === input.branch);
|
|
317
|
+
if (existing) {
|
|
318
|
+
existing.baseBranch = input.baseBranch;
|
|
319
|
+
existing.worktreePath = input.worktreePath;
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
this.worktreesRows.push({
|
|
323
|
+
id: randomUUID(),
|
|
324
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
325
|
+
...input
|
|
326
|
+
});
|
|
327
|
+
},
|
|
328
|
+
list: async ({ projectRepositoryId, userId }) => this.worktreesRows.filter((row) => row.projectRepositoryId === projectRepositoryId && row.userId === userId),
|
|
329
|
+
get: async ({ projectRepositoryId, userId, branch }) => this.worktreesRows.find((row) => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch) ?? null,
|
|
330
|
+
findByPath: async ({ projectRepositoryId, userId, worktreePath }) => this.worktreesRows.find((row) => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.worktreePath === worktreePath) ?? null,
|
|
331
|
+
delete: async ({ projectRepositoryId, userId, branch }) => {
|
|
332
|
+
this.worktreesRows.splice(0, this.worktreesRows.length, ...this.worktreesRows.filter((row) => !(row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch)));
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
sessions = {
|
|
336
|
+
list: async ({ projectRepositoryId, userId }) => this.sessionsRows.filter((row) => row.projectRepositoryId === projectRepositoryId && row.userId === userId),
|
|
337
|
+
getBySessionId: async (sessionId) => this.sessionsRows.find((row) => row.sessionId === sessionId) ?? null,
|
|
338
|
+
getForBranch: async ({ projectRepositoryId, userId, branch }) => this.sessionsRows.find((row) => row.projectRepositoryId === projectRepositoryId && row.userId === userId && row.branch === branch) ?? null,
|
|
339
|
+
create: async (input) => {
|
|
340
|
+
const existing = await this.sessions.getForBranch(input);
|
|
341
|
+
if (existing) return existing;
|
|
342
|
+
if (this.sessionsRows.some((row) => row.sessionId === input.sessionId)) throw new UniqueViolationError("Source-control session ID already exists");
|
|
343
|
+
const now = /* @__PURE__ */ new Date();
|
|
344
|
+
const session = {
|
|
345
|
+
id: randomUUID(),
|
|
346
|
+
...input,
|
|
347
|
+
title: input.title ?? null,
|
|
348
|
+
sandboxId: null,
|
|
349
|
+
sandboxWorkdir: null,
|
|
350
|
+
materializedAt: null,
|
|
351
|
+
createdAt: now,
|
|
352
|
+
updatedAt: now
|
|
353
|
+
};
|
|
354
|
+
this.sessionsRows.push(session);
|
|
355
|
+
return session;
|
|
356
|
+
},
|
|
357
|
+
setSandbox: async ({ id, sandboxId, sandboxWorkdir }) => {
|
|
358
|
+
const row = this.sessionsRows.find((candidate) => candidate.id === id);
|
|
359
|
+
if (row) Object.assign(row, {
|
|
360
|
+
sandboxId,
|
|
361
|
+
sandboxWorkdir,
|
|
362
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
363
|
+
});
|
|
364
|
+
},
|
|
365
|
+
markMaterialized: async ({ id }) => {
|
|
366
|
+
const row = this.sessionsRows.find((candidate) => candidate.id === id);
|
|
367
|
+
if (row) Object.assign(row, {
|
|
368
|
+
materializedAt: /* @__PURE__ */ new Date(),
|
|
369
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
370
|
+
});
|
|
371
|
+
},
|
|
372
|
+
delete: async (id) => {
|
|
373
|
+
this.sessionsRows.splice(0, this.sessionsRows.length, ...this.sessionsRows.filter((row) => row.id !== id));
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
//#endregion
|
|
378
|
+
export { SourceControlStorageInMemory };
|
|
379
|
+
|
|
380
|
+
//# sourceMappingURL=inmemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inmemory.js","names":[],"sources":["../../../../src/storage/domains/source-control/inmemory.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { UniqueViolationError } from '@mastra/core/storage';\n\nimport type {\n ConfiguredExternalRepositoryKey,\n CreateProjectSourceControlConnectionInput,\n CreateSourceControlSessionInput,\n ExternalRepositoryProjectTarget,\n LinkProjectRepositoryInput,\n PooledSandbox,\n ProjectRepository,\n ProjectRepositorySandbox,\n ProjectSourceControlConnection,\n ReleasePooledSandboxInput,\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 sandboxPoolRows: PooledSandbox[] = [];\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 migrateInstallation: async ({\n orgId,\n id,\n newInstallationId,\n }: {\n orgId: string;\n id: string;\n newInstallationId: string;\n }) => {\n const existing = await this.repositories.get({ orgId, id });\n if (!existing) {\n throw new Error(`Repository ${id} not found in organization ${orgId}`);\n }\n if (!(await this.installations.get({ orgId, id: newInstallationId }))) {\n throw new Error('Source-control installation not found');\n }\n // Check if a repository with the same external_id exists under the new installation\n const conflict = this.repositoriesRows.find(\n row => row.installationId === newInstallationId && row.externalId === existing.externalId,\n );\n if (conflict) {\n // Return the existing repository under the new installation\n return conflict;\n }\n // Update the repository's installation\n existing.installationId = newInstallationId;\n existing.updatedAt = new Date();\n // Migrate dependent connections to the new installation\n for (const conn of this.connectionsRows) {\n if (conn.installationId === existing.installationId) {\n conn.installationId = newInstallationId;\n }\n }\n return existing;\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 sandboxPool = {\n release: async (input: ReleasePooledSandboxInput): Promise<void> => {\n // Mirror the SQL implementation: a missing project-repository link\n // makes the release a silent no-op.\n if (!this.projectRepositoriesRows.some(row => row.id === input.projectRepositoryId)) return;\n if (this.sandboxPoolRows.some(row => row.sandboxId === input.sandboxId)) return;\n this.sandboxPoolRows.push({ id: randomUUID(), releasedAt: new Date(), ...input });\n },\n claim: async ({ projectRepositoryId }: { projectRepositoryId: string }): Promise<PooledSandbox | null> => {\n const candidates = this.sandboxPoolRows\n .filter(row => row.projectRepositoryId === projectRepositoryId)\n .sort((left, right) => right.releasedAt.getTime() - left.releasedAt.getTime());\n const claimed = candidates[0];\n if (!claimed) return null;\n this.sandboxPoolRows.splice(this.sandboxPoolRows.indexOf(claimed), 1);\n return claimed;\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 if (this.sessionsRows.some(row => row.sessionId === input.sessionId)) {\n throw new UniqueViolationError('Source-control session ID already exists');\n }\n const now = new Date();\n const session: SourceControlSession = {\n id: randomUUID(),\n ...input,\n title: input.title ?? null,\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":";;;;AA0BA,IAAa,+BAAb,MAAgF;CAC9E;CACA,oBAAiD,CAAC;CAClD,mBAA8C,CAAC;CAC/C,kBAAoD,CAAC;CACrD,0BAA+C,CAAC;CAChD,gBAA4C,CAAC;CAC7C,kBAAmC,CAAC;CACpC,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;IACD,OAAO;GACT;GACA,MAAM,UAAqC;IACzC,IAAI,WAAW;IACf,eAAe,KAAK;IACpB,OAAO,MAAM;IACb,mBAAmB,MAAM;IACzB,YAAY,MAAM;IAClB,aAAa,MAAM,eAAe;IAClC,aAAa,MAAM,eAAe;IAClC,kBAAkB,MAAM,oBAAoB,CAAC;IAC7C,2BAAW,IAAI,KAAK;GACtB;GACA,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