import type { AnyRouter as AnyORPCRouter } from '@orpc/server'; import type { TableAccessInput } from './access.js'; import type { RealtimeApiRouter } from './api/realtime-router.js'; import type { CrudApiRouterFor, MergeApiRouterTypes, UnifiedApiRouter } from './api/types.js'; import type { DbFor } from './db.js'; import type { BunderstackJobsBuilder, JobsDefs, JobsFacade, StartWorkerOptions, WorkerHandle } from './jobs/index.js'; import type { StorageConfigInput } from './storage/buckets.js'; import type { StorageAdapter } from './storage/index.js'; import { createAuth } from './auth.js'; import { type BunderstackConfig } from './config.js'; import { type EmailFacade } from './email.js'; import { type EnvConfigInput, type ValidatedEnv } from './env.js'; import { type LifecycleStatus } from './lifecycle.js'; import { type BunderstackManifest } from './manifest.js'; import { type RealtimeFacade } from './realtime/facade.js'; export type AuthInstance = ReturnType; /** * Public storage facade exposed as `app.storage`. Object-level operations live * on the per-bucket adapters; this surface offers the app-wide deletes that * must also clean the file-meta row. */ export interface StorageFacade { /** Delete a file row and purge all underlying storage derivatives. */ delete(fileId: string): Promise; /** Low-level access to the underlying storage adapter for a bucket. */ bucket(name: string): StorageAdapter | undefined; /** * Reap stale `pending` uploads older than `olderThanMs` (default 30m). Runs * only when explicitly invoked by the host or local scheduler. Returns * the count reaped. */ sweep(olderThanMs?: number): Promise; /** * Get a public or presigned download URL for a file key. * Returns a presigned S3 URL when S3 is configured, or local proxy route `/api/files/...` in development. */ getUrl(key: string, opts?: { bucket?: string; expiresIn?: number; }): Promise; /** * Upload bytes as a ready file and register it in file_meta so it is * accessible via `GET /api/files/`. Use this for server-generated * files (e.g. generated PDFs) that are not uploaded by end-users. */ upload(key: string, body: ArrayBuffer | Uint8Array, contentType: string, opts?: { ownerId?: string; filename?: string; }): Promise; } export type AppStartWorkerOptions = Omit; export type AppRunWorkerOptions = AppStartWorkerOptions & { /** * Permit process-local realtime in a standalone worker. * * Use only when job handlers never call ctx.realtime.publish(). Publications * made through the memory broker cannot reach SSE clients in another process. */ allowProcessLocalRealtime?: boolean; }; /** Bucket names declared in a storage config; `string` when unknowable. */ export type BucketNamesOf = TStorage extends { buckets: infer B extends Record; } ? keyof B & string : string; export type BunderstackApp, TAccess extends Record | undefined = undefined, TBuckets extends string = string, TEnv extends EnvConfigInput | undefined = undefined, TJobsDefs extends JobsDefs | undefined = undefined, TCustomApiRouter extends AnyORPCRouter | undefined = undefined, TRealtime = undefined> = { handler: (req: Request) => Promise; db: DbFor; auth: AuthInstance; storage: StorageFacade; /** Validated env: bunderstack's base vars plus the config's `env` extension. */ env: ValidatedEnv; /** Email facade; always present — send() throws when email isn't configured. */ email: EmailFacade; /** Job queue facade; always present — enqueue throws when jobs aren't configured. */ jobs: JobsFacade>; /** Typed custom row publication; enabled=false/no-op when realtime is off. */ realtime: RealtimeFacade; startWorker(options?: AppStartWorkerOptions): Promise; /** Run a queue worker until aborted, then close the application. */ runWorker(options?: AppRunWorkerOptions): Promise; close(): Promise; /** True when this process is running the background tick loop. */ readonly backgroundRunning: boolean; readonly status: LifecycleStatus; readonly signal: AbortSignal; /** Deploy-time introspection: what this app needs provisioned. */ manifest: BunderstackManifest; /** * Type-only carrier for client inference (`createClient()`). * Never assigned at runtime. */ readonly $inferClient?: { schema: TSchema; access: TAccess; buckets: TBuckets; api: MergeApiRouterTypes, TCustomApiRouter>, [ TRealtime ] extends [false | undefined] ? {} : RealtimeApiRouter>; }; }; export declare function createBunderstack, const TAccess extends Record | undefined = undefined, const TStorage extends StorageConfigInput | undefined = undefined, const TEnv extends EnvConfigInput | undefined = undefined, const TJobsDefs extends JobsDefs | undefined = undefined, TCustomApiRouter extends AnyORPCRouter | undefined = undefined, const TRealtime extends BunderstackConfig['realtime'] = undefined>(options: BunderstackConfig & { realtime?: TRealtime; jobs?: TJobsDefs | ((j: BunderstackJobsBuilder>) => TJobsDefs); }): Promise, TEnv, TJobsDefs, TCustomApiRouter, TRealtime>>; export { listSpec } from './api/list-spec.js'; export type { ListSpecOptions } from './api/list-spec.js'; export type { BunderstackDb, BunderstackTx } from './db.js'; export { MAX_LIST_LIMIT } from './list-query.js'; export { BunderstackError } from './errors.js'; export type { BunderstackErrorCode } from './errors.js'; export { resolveConfig, resolveAuthConfig, defineAuth } from './config.js'; export type { AuthConfigContext, AuthConfigFactory, AuthConfigInput, BetterAuthConfig, BunderstackConfig, ResolvedConfig, } from './config.js'; export { validateEnv, createClientEnv, BunderstackEnvError } from './env.js'; export type { EnvConfigInput, BaseEnv, ValidatedEnv } from './env.js'; export { buildManifest, parseManifest } from './manifest.js'; export type { BunderstackManifest, ManifestEnvVar } from './manifest.js'; export { createEmail } from './email.js'; export type { EmailMessage, EmailAdapter, EmailConfigInput, EmailFacade, } from './email.js'; export { createJobsBuilder } from './jobs/index.js'; export type { BunderstackJobContext, BunderstackJobsBuilder, BackgroundDefinition, BackgroundDefs, CronDefinition, CronInvocation, EnqueueOptions, JobContext, JobDefinition, JobsDefs, JobsFacade, JobsRuntimeFacade, QueueJobDefinition, QueueJobKeys, RunWorkerOptions, StartWorkerOptions, WorkerHandle, } from './jobs/index.js'; export { defineAccess, validateAndResolveAccess, checkAccess, AUTH_TABLE_NAMES, } from './access.js'; export type { TableAccessInput, OperationRule, AccessContext, AccessUser, } from './access.js'; export { typeid, generate as generateTypeId, parse as parseTypeId, asTypeId, } from './typeid.js'; export type { TypeId } from './typeid.js'; export type { DatabaseAdapter, DatabaseConnectOptions, DatabaseConnection, DatabaseConnectionResult, } from './database/adapter.js'; export type { StorageAdapter } from './storage/index.js'; export type { StorageConfigInput, BucketConfigInput, ResolvedBucket, } from './storage/buckets.js'; export type { TransformSpec } from './storage/thumbnails.js'; export { mockAuthSession } from './testing.js'; export type { RealtimeAction } from './realtime/publisher.js'; export { createRealtimeFacade } from './realtime/facade.js'; export type { RealtimeFacade, RealtimeTransport, SchemaTable, } from './realtime/facade.js'; export { createApiBuilder, defineApi } from './api/builder.js'; export type { BunderstackApiBuilder, ApiFactory } from './api/builder.js'; export type { ApiContext } from './api/context.js'; export type { CrudApiRouterFor, ExposedApiTables, MergeApiRouterTypes, UnifiedApiRouter, } from './api/types.js'; export type { TableCrudProcedures } from './api/crud-router.js'; export { buildApiRegistry, mergeApiRoutersStrict, normalizeApiPath, normalizeForeignOpenAPISpec, } from './api/registry.js'; export { mergeOpenAPISpecs } from './api/openapi.js'; //# sourceMappingURL=index.d.ts.map