import type { ExecuteGraphParams, ExecuteGraphResult, GraphsProvider } from '@kubun/protocol'; export type { GraphQLOperationParams, GraphQLSource, GraphQLSourceParams, GraphQLSourceProvider, GraphsProvider, } from '@kubun/protocol'; import type { GetAPI } from './registry.js'; /** * Engine-specific graph params extending the protocol-level params with viewerDID. * viewerDID is resolved server-side (not sent over the wire), so it belongs * on the engine type rather than the protocol schema. */ export type EngineGraphParams = ExecuteGraphParams & { viewerDID?: string; /** * Document owner for a delegated write: the server signs the mutation with its * own identity but the resulting document is owned by `owner` (the viewer), * authorized by a held viewer→server delegation capability. Omitted means the * owner is the signer. Used by `mutateGraph` only. */ owner?: string; /** * Delegation tokens authorizing actions the caller cannot take unaided. On * `mutateGraph` they ride each outgoing mutation's `cap` field (part of the * signed payload) and are verified on apply against the owner→delegate chain. * On every operation they are also surfaced on the request's ExecutionContext * so a plugin's credential authority can authorize a delegated read/administer; * `queryGraph`/`subscribeToGraph` produce no mutation cap but still carry them * this way. */ delegationTokens?: Array; /** * Trusted provenance for `viewerDID`, forwarded onto `ExecutionContext.authenticated`. * Set `true` only by a caller that verified `viewerDID` from a signed envelope * `iss` (the graph-service handler); every other caller omits it, defaulting to `false`. */ authenticated?: boolean; /** * Server-derived group ID for this request, forwarded onto * `ExecutionContext.groupID`. Set only by a caller that read it off the * transport (the graph-service handler's `ServiceHandlerContext.groupID`); * never read from any client-supplied payload. `undefined` outside a group * context. */ groupID?: string; /** * Client-presented independent capability chains, forwarded onto * `ExecutionContext.invocationCaps`. Unlike `groupID`, this DOES ride the * wire (`MutateGraphParams.invocationCaps`) — the graph-service handler * reads it from the request payload, not from the transport. Verification * of these chains happens downstream of this rail. */ invocationCaps?: Array>; /** * Connector operation-envelope ids for a credential-spend connector action, * forwarded onto `ExecutionContext.operationID`/ * `ExecutionContext.deterministicEventID`. Unlike `groupID`, these DO ride * the wire (`MutateGraphParams.operationID`/`deterministicEventID`) — the * graph-service handler reads them from the request payload, not from the * transport. Verification (presence, replay, conflict) happens downstream * in `@kubun/plugin-connector`, not on this rail. */ operationID?: string; deterministicEventID?: string; }; export type Engine = Omit & { queryGraph = Record>(params: EngineGraphParams): Promise>; mutateGraph = Record>(params: EngineGraphParams): Promise>; subscribeToGraph = Record>(params: EngineGraphParams): Promise> | ExecuteGraphResult>; getAPI: GetAPI; ready(): Promise; };