import { DbAdapter, AdapterConfigurationError } from '@geenius/adapters'; export { AuthContractError, AuthIdentitySchema, AuthProviderAdapter, AuthSessionContractSchema, CacheAdapter, CacheContractError, CacheEntrySchema, DeployAdapter, DeployContractError, DeploymentResultSchema, DeploymentTargetSchema, EventEnvelopeSchema, EventsAdapter, EventsContractError, PaymentCheckoutInputSchema, PaymentPlanContractSchema, PaymentSubscriptionContractSchema, PaymentsContractError, PaymentsProviderAdapter, QueueAdapter, QueueContractError, QueueJobSchema, StorageAdapter, StorageContractError, StorageObjectSchema } from '@geenius/adapters'; /** * @module types * @package @geenius/adapters/convex * @description Declares the adapter-side Convex binding helper types. This * package accepts a Convex-compatible `DbAdapter` factory output and exposes it * as the shared contract without importing downstream runtime SDKs. */ /** CRUD operations that a Convex collection binding can expose. */ type ConvexCollectionOperation = "create" | "get" | "update" | "delete" | "list" | "query" | "count"; /** SDK-free table name used in Convex metadata. Runtime binding rejects empty strings. */ type ConvexTableName = string; /** Non-empty table list for generated Convex schema metadata. */ type ConvexTableNameList = readonly [ ConvexTableName, ...ConvexTableName[] ]; /** SDK-free operation expectation descriptor for a Convex collection method. */ type ConvexOperationExpectation = boolean | string | Readonly<{ readonly kind?: "action" | "mutation" | "query"; readonly name?: string; readonly args?: readonly string[]; readonly returns?: string; }>; /** Full operation expectation set for one Convex collection. */ type ConvexCollectionOperationExpectations = Readonly>; /** SDK-free schema field descriptor accepted as Convex table metadata. */ type ConvexSchemaFieldExpectation = string | Readonly<{ readonly type: string; readonly fields?: Readonly>; readonly items?: ConvexSchemaFieldExpectation; readonly nullable?: boolean; readonly optional?: boolean; }>; type ConvexSchemaMetadataBase = Readonly<{ readonly fields?: Readonly>; readonly indexes?: readonly string[] | Readonly>; readonly schema?: string | Readonly>; }>; /** SDK-free schema metadata descriptor for one Convex collection. */ type ConvexSchemaMetadata = (ConvexSchemaMetadataBase & { readonly fields: Readonly>; }) | (ConvexSchemaMetadataBase & { readonly indexes: readonly string[] | Readonly>; }) | (ConvexSchemaMetadataBase & { readonly schema: string | Readonly>; }); /** SDK-free table/function expectation for one Convex collection. */ type ConvexCollectionExpectation = ConvexCollectionOperationExpectations | ConvexSchemaMetadata | (ConvexSchemaMetadata & ConvexCollectionOperationExpectations); /** Registry of typed Convex collection expectations keyed by table name. */ type ConvexTableExpectationMap = Readonly>; /** Convex table expectation shapes accepted from schema or factory metadata. */ type ConvexTableExpectations = ConvexTableNameList | ConvexTableExpectationMap; /** Launch metadata required before a Convex adapter can be bound. */ interface ConvexProviderContract { readonly provider: "convex"; readonly stage: "launch"; readonly sdk: "convex"; readonly schema: "ConvexDB schema"; readonly factory: "createConvexDbAdapter"; readonly tables: ConvexTableExpectations; } /** Downstream factory output carrying the generated Convex contract namespace. */ type ConvexDbNamespacedFactoryOutput = DbAdapter & { readonly convex: ConvexProviderContract; }; /** Downstream factory output carrying the generated Convex contract directly. */ type ConvexDbContractFactoryOutput = DbAdapter & { readonly contract: ConvexProviderContract; }; /** Downstream factory output carrying top-level Convex launch table metadata. */ type ConvexDbTableFactoryOutput = DbAdapter & { readonly provider: "convex"; readonly stage: "launch"; readonly sdk: "convex"; readonly schema: "ConvexDB schema"; readonly factory: "createConvexDbAdapter"; readonly tables: ConvexTableExpectations; }; /** Output shape expected from a downstream Convex DB adapter factory. */ type ConvexDbFactoryOutput = ConvexDbNamespacedFactoryOutput | ConvexDbContractFactoryOutput | ConvexDbTableFactoryOutput; /** * SDK-free structural mirror of Convex `QueryCtx`. Public boundary type so * downstream callers can annotate Convex query handlers without pulling * `convex/server` into adapter consumers. */ type ConvexQueryCtx = Readonly<{ readonly db: Readonly>; readonly auth?: Readonly>; readonly storage?: Readonly>; }>; /** * SDK-free structural mirror of Convex `MutationCtx`. Extends `ConvexQueryCtx` * with the scheduler surface available inside mutations. */ type ConvexMutationCtx = ConvexQueryCtx & Readonly<{ readonly scheduler?: Readonly>; }>; /** SDK-free args shape accepted by Convex-compatible runtime operations. */ type ConvexRuntimeOperationArgs = Readonly>; /** SDK-free operation shape for Convex-compatible runtime metadata. */ type ConvexRuntimeOperation = (name: string, args?: ConvexRuntimeOperationArgs) => Promise; /** Minimal Convex runtime client shape accepted for binding metadata. */ type ConvexRuntimeClient = Readonly<{ readonly query: ConvexRuntimeOperation; readonly mutation: ConvexRuntimeOperation; }>; /** Options preserved as metadata when binding a downstream Convex adapter. */ type ConvexDbFactoryOptions = { readonly client?: ConvexRuntimeClient; readonly deploymentUrl?: string; readonly functions?: Readonly>; readonly schema?: { readonly tables?: ConvexTableExpectations; }; readonly tables?: ConvexTableExpectations; readonly [key: string]: unknown; }; type ConvexDbAdapterSource = { readonly factoryOptions?: ConvexDbFactoryOptions; readonly client?: ConvexRuntimeClient; }; type ConvexDbFactoryOutputBinding = { readonly adapter: ConvexDbFactoryOutput; readonly provider?: "convex"; readonly contract?: ConvexProviderContract; readonly source?: ConvexDbAdapterSource; }; type ConvexDbContractBinding = { readonly adapter: DbAdapter; readonly provider?: "convex"; readonly contract: ConvexProviderContract; readonly source?: ConvexDbAdapterSource; }; type ConvexDbFactoryOptionsBinding = { readonly adapter: DbAdapter; readonly provider?: "convex"; readonly contract?: ConvexProviderContract; readonly source: ConvexDbAdapterSource & { readonly factoryOptions: ConvexDbFactoryOptions; }; }; /** Binding object accepted by `withConvexDb` for adapter-side Convex wiring. */ type ConvexDbAdapterBinding = ConvexDbFactoryOutputBinding | ConvexDbContractBinding | ConvexDbFactoryOptionsBinding; /** Accepted input for wrapping Convex DB adapters in the shared contract. */ type ConvexDbAdapterOptions = ConvexDbFactoryOutput | ConvexDbAdapterBinding; /** * @module adapter * @package @geenius/adapters/convex * @description Provides a typed adapter-side binder for Convex database * providers produced by `@geenius/db`. This package performs shape validation * and returns a `DbAdapter` wrapper without importing or constructing a * Convex runtime client. */ /** * Wraps a Convex-compatible DB adapter in the shared adapters contract. * * @param config Existing DB adapter output with Convex contract metadata, or a * binding object tagged for Convex. Downstream `@geenius/db` factories may * provide metadata through `convex`, `contract`, or top-level * `provider: "convex"` plus `tables`. * @returns A DB adapter that delegates CRUD, list, query, and count operations. */ declare function withConvexDb(config: ConvexDbAdapterOptions): DbAdapter; /** * @module errors * @package @geenius/adapters/convex * @description Defines typed binding errors for the Convex adapter helper. */ /** Error code emitted when a Convex DB adapter binding fails shape validation. */ type ConvexBindingErrorCode = "CONVEX_DB_ADAPTER_MISMATCH"; /** Error thrown when `withConvexDb` receives a non-conforming adapter binding. */ declare class ConvexBindingError extends AdapterConfigurationError { readonly convexCode: ConvexBindingErrorCode; /** * Creates a typed Convex adapter binding error. * * @param message Human-readable validation failure. * @param cause Optional original error that triggered the failure. */ constructor(message: string, cause?: unknown); } export { ConvexBindingError, type ConvexBindingErrorCode, type ConvexCollectionExpectation, type ConvexCollectionOperation, type ConvexCollectionOperationExpectations, type ConvexDbAdapterBinding, type ConvexDbAdapterOptions, type ConvexDbContractFactoryOutput, type ConvexDbFactoryOptions, type ConvexDbFactoryOutput, type ConvexDbNamespacedFactoryOutput, type ConvexDbTableFactoryOutput, type ConvexMutationCtx, type ConvexOperationExpectation, type ConvexProviderContract, type ConvexQueryCtx, type ConvexRuntimeClient, type ConvexRuntimeOperation, type ConvexRuntimeOperationArgs, type ConvexSchemaFieldExpectation, type ConvexSchemaMetadata, type ConvexTableExpectationMap, type ConvexTableExpectations, type ConvexTableName, type ConvexTableNameList, withConvexDb };