Codemod db pass-through calls to domain modules: tasks + agents (C1 part 1/3)
Rewrite ~525 call sites from `db.<method>()` to `db.<module>.<method>()` for tasks and agents domains (including `getAgent`/`findAgent`/`getTask` which live on the `entityCrud` field). Delete the corresponding pass-through methods on AppDatabaseBase. Structural types that narrowed `db` to a bag of flat methods (CapabilityMatchDb, EscalationDeps, SweepStaleReviewsDeps) are reshaped to match the new namespace. Internal callback references inside database.ts/database-base.ts now invoke the owning module directly (e.g. `this.agents.saveAgent`) rather than the deleted pass-through. The codemod lives at scripts/codemod/remove-appdatabase-passthrough.mjs and filters by owning module + optional explicit method list. It is idempotent and does not re-rewrite already-namespaced calls.
This commit is contained in:
1 parent
411294afa6
commit
5e9b7acbc6
95 files changed
+1123
-793
No files matched your search
@@ -77,8 +77,8 @@ export class AppDatabase extends AppDatabaseBase {
|
||||
countActiveGoalsForCompany(companyId: string) { return this.entityCrud.countActiveGoalsForCompany(companyId); }
|
||||
createHireRequest(input: { companyId: string; requestedByAgentId?: string | null; name: string; role: string; title: string; department?: string | null; reportsTo?: string | null; connectorId: ConnectorId; workspaceId?: string | null; model?: string | null; metadataJson?: string; capabilities: string; budgetMonthlyUsd: number; payloadSummary: string; impactSummary: string; payloadJson?: string | null }) {
|
||||
return this.entityCrud.createHireRequest(input, {
|
||||
saveAgent: (agentInput) => this.saveAgent(agentInput),
|
||||
requestApproval: (approvalInput) => this.requestApproval(approvalInput),
|
||||
saveAgent: (agentInput) => this.agents.saveAgent(agentInput),
|
||||
requestApproval: (approvalInput) => this.approvalsMod.requestApproval(approvalInput),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,9 +110,9 @@ export class AppDatabase extends AppDatabaseBase {
|
||||
getConfigRevision(revisionId: string, companyId: string) { return this.documentsMod.getConfigRevision(revisionId, companyId); }
|
||||
rollbackConfigRevision(agentId: string, revisionId: string, companyId: string) {
|
||||
return this.documentsMod.rollbackConfigRevision(agentId, revisionId, companyId, {
|
||||
getConfigRevision: (rid, cid) => this.getConfigRevision(rid, cid),
|
||||
getAgent: (id) => this.getAgent(id),
|
||||
recordConfigRevision: (input) => this.recordConfigRevision(input),
|
||||
getConfigRevision: (rid, cid) => this.documentsMod.getConfigRevision(rid, cid),
|
||||
getAgent: (id) => this.entityCrud.getAgent(id),
|
||||
recordConfigRevision: (input) => this.documentsMod.recordConfigRevision(input),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user