import * as Context from "effect/Context"; import type * as Effect from "effect/Effect"; import type { AuthArtifact, AuthLease, Execution, ExecutionInteraction, ExecutionStep, ProviderAuthGrant, SecretMaterial, SourceAuthSession, ScopeOauthClient, ScopedSourceOauthClient, } from "#schema"; type SecretMaterialSummary = { id: string; providerId: string; name: string | null; purpose: string; createdAt: number; updatedAt: number; }; export type ExecutorStateStoreShape = { authArtifacts: { listByScopeId: ( scopeId: AuthArtifact["scopeId"], ) => Effect.Effect; listByScopeAndSourceId: (input: { scopeId: AuthArtifact["scopeId"]; sourceId: AuthArtifact["sourceId"]; }) => Effect.Effect; getByScopeSourceAndActor: (input: { scopeId: AuthArtifact["scopeId"]; sourceId: AuthArtifact["sourceId"]; actorScopeId: AuthArtifact["actorScopeId"]; slot: AuthArtifact["slot"]; }) => Effect.Effect, Error, never>; upsert: (artifact: AuthArtifact) => Effect.Effect; removeByScopeSourceAndActor: (input: { scopeId: AuthArtifact["scopeId"]; sourceId: AuthArtifact["sourceId"]; actorScopeId: AuthArtifact["actorScopeId"]; slot?: AuthArtifact["slot"]; }) => Effect.Effect; removeByScopeAndSourceId: (input: { scopeId: AuthArtifact["scopeId"]; sourceId: AuthArtifact["sourceId"]; }) => Effect.Effect; }; authLeases: { listAll: () => Effect.Effect; getByAuthArtifactId: ( authArtifactId: AuthLease["authArtifactId"], ) => Effect.Effect, Error, never>; upsert: (lease: AuthLease) => Effect.Effect; removeByAuthArtifactId: ( authArtifactId: AuthLease["authArtifactId"], ) => Effect.Effect; }; sourceOauthClients: { getByScopeSourceAndProvider: (input: { scopeId: ScopedSourceOauthClient["scopeId"]; sourceId: ScopedSourceOauthClient["sourceId"]; providerKey: string; }) => Effect.Effect< import("effect/Option").Option, Error, never >; upsert: ( oauthClient: ScopedSourceOauthClient, ) => Effect.Effect; removeByScopeAndSourceId: (input: { scopeId: ScopedSourceOauthClient["scopeId"]; sourceId: ScopedSourceOauthClient["sourceId"]; }) => Effect.Effect; }; scopeOauthClients: { listByScopeAndProvider: (input: { scopeId: ScopeOauthClient["scopeId"]; providerKey: string; }) => Effect.Effect; getById: ( id: ScopeOauthClient["id"], ) => Effect.Effect, Error, never>; upsert: (oauthClient: ScopeOauthClient) => Effect.Effect; removeById: (id: ScopeOauthClient["id"]) => Effect.Effect; }; providerAuthGrants: { listByScopeId: ( scopeId: ProviderAuthGrant["scopeId"], ) => Effect.Effect; listByScopeActorAndProvider: (input: { scopeId: ProviderAuthGrant["scopeId"]; actorScopeId: ProviderAuthGrant["actorScopeId"]; providerKey: string; }) => Effect.Effect; getById: ( id: ProviderAuthGrant["id"], ) => Effect.Effect, Error, never>; upsert: (grant: ProviderAuthGrant) => Effect.Effect; removeById: (id: ProviderAuthGrant["id"]) => Effect.Effect; }; sourceAuthSessions: { listAll: () => Effect.Effect; listByScopeId: ( scopeId: SourceAuthSession["scopeId"], ) => Effect.Effect; getById: ( id: SourceAuthSession["id"], ) => Effect.Effect, Error, never>; getByState: ( state: SourceAuthSession["state"], ) => Effect.Effect, Error, never>; getPendingByScopeSourceAndActor: (input: { scopeId: SourceAuthSession["scopeId"]; sourceId: SourceAuthSession["sourceId"]; actorScopeId: SourceAuthSession["actorScopeId"]; credentialSlot?: SourceAuthSession["credentialSlot"]; }) => Effect.Effect< import("effect/Option").Option, Error, never >; insert: (session: SourceAuthSession) => Effect.Effect; update: ( id: SourceAuthSession["id"], patch: Partial< Omit >, ) => Effect.Effect, Error, never>; upsert: (session: SourceAuthSession) => Effect.Effect; removeByScopeAndSourceId: ( scopeId: SourceAuthSession["scopeId"], sourceId: SourceAuthSession["sourceId"], ) => Effect.Effect; }; secretMaterials: { getById: ( id: SecretMaterial["id"], ) => Effect.Effect, Error, never>; listAll: () => Effect.Effect; upsert: (material: SecretMaterial) => Effect.Effect; updateById: ( id: SecretMaterial["id"], update: { name?: string | null; value?: string }, ) => Effect.Effect< import("effect/Option").Option, Error, never >; removeById: (id: SecretMaterial["id"]) => Effect.Effect; }; executions: { getById: ( executionId: Execution["id"], ) => Effect.Effect, Error, never>; getByScopeAndId: ( scopeId: Execution["scopeId"], executionId: Execution["id"], ) => Effect.Effect, Error, never>; insert: (execution: Execution) => Effect.Effect; update: ( executionId: Execution["id"], patch: Partial< Omit >, ) => Effect.Effect, Error, never>; }; executionInteractions: { getById: ( interactionId: ExecutionInteraction["id"], ) => Effect.Effect< import("effect/Option").Option, Error, never >; listByExecutionId: ( executionId: ExecutionInteraction["executionId"], ) => Effect.Effect; getPendingByExecutionId: ( executionId: ExecutionInteraction["executionId"], ) => Effect.Effect< import("effect/Option").Option, Error, never >; insert: ( interaction: ExecutionInteraction, ) => Effect.Effect; update: ( interactionId: ExecutionInteraction["id"], patch: Partial< Omit >, ) => Effect.Effect< import("effect/Option").Option, Error, never >; }; executionSteps: { getByExecutionAndSequence: ( executionId: ExecutionStep["executionId"], sequence: ExecutionStep["sequence"], ) => Effect.Effect, Error, never>; listByExecutionId: ( executionId: ExecutionStep["executionId"], ) => Effect.Effect; insert: (step: ExecutionStep) => Effect.Effect; deleteByExecutionId: ( executionId: ExecutionStep["executionId"], ) => Effect.Effect; updateByExecutionAndSequence: ( executionId: ExecutionStep["executionId"], sequence: ExecutionStep["sequence"], patch: Partial< Omit >, ) => Effect.Effect, Error, never>; }; }; export class ExecutorStateStore extends Context.Tag( "#runtime/ExecutorStateStore", )() {}