MCPcopy Index your code
hub / github.com/anomalyco/opencode / state

Function state

packages/opencode/src/account/repo.ts:59–69  ·  view source on GitHub ↗
(accountID: AccountID, orgID: Option.Option<OrgID>)

Source from the content-addressed store, hash-verified

57 })
58
59 const state = (accountID: AccountID, orgID: Option.Option<OrgID>) => {
60 const id = Option.getOrNull(orgID)
61 return db
62 .insert(AccountStateTable)
63 .values({ id: ACCOUNT_STATE_ID, active_account_id: accountID, active_org_id: id })
64 .onConflictDoUpdate({
65 target: AccountStateTable.id,
66 set: { active_account_id: accountID, active_org_id: id },
67 })
68 .run()
69 }
70
71 const active = Effect.fn("AccountRepo.active")(() =>
72 query(current()).pipe(Effect.map((row) => (row ? Option.some(decode(row)) : Option.none()))),

Callers 1

repo.tsFile · 0.70

Calls 4

onConflictDoUpdateMethod · 0.80
insertMethod · 0.80
runMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected