import * as kysely from 'kysely'; import { Kysely } from 'kysely'; export { default as KSUID } from 'ksuid'; import * as opentelemetry from '@opentelemetry/api'; import { StandardSchemaV1 } from '@standard-schema/spec'; import { LanguageModel } from 'ai'; export { z } from 'zod'; type MimeType = "application/json" | "application/gzip" | "application/pdf" | "application/rtf" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.ms-excel" | "application/vnd.ms-powerpoint" | "application/msword" | "application/zip" | "application/xml" | "application/x-7z-compressed" | "application/x-tar" | "image/gif" | "image/jpeg" | "image/svg+xml" | "image/png" | "text/html" | "text/csv" | "text/javascript" | "text/plain" | "text/calendar" | (string & {}); type InlineFileConstructor = { filename: string; contentType: MimeType; }; type FileDbRecord = { key: string; filename: string; contentType: string; size: number; }; declare class InlineFile { protected _filename: string; protected _contentType: MimeType; protected _contents: Blob | null; constructor(input: InlineFileConstructor); static fromDataURL(dataURL: string): InlineFile; get size(): number; get contentType(): string; get filename(): string; write(buffer: Buffer): void; read(maxBytes?: number): Promise; toDataURL(): Promise; store(expires?: Date | null): Promise; } declare class File extends InlineFile { private _key; private _size; constructor(input: Partial); static fromDbRecord(input: FileDbRecord): File; get size(): number; get key(): string; get isPublic(): boolean; read(maxBytes?: number): Promise; store(expires?: Date | null): Promise; getPresignedUrl(options?: { contentDisposition?: "inline" | "attachment"; filename?: string; }): Promise; getPresignedUploadUrl(): Promise; toDbRecord(): FileDbRecord; toJSON(): FileDbRecord; } type FileWriteTypes = InlineFile | File; interface RecipientUser { id: string; email?: string | null; } interface RecipientIdentity { id: string; email?: string | null; } interface EmailActionButton { label: string; url: string; variant?: "primary" | "secondary"; } interface EmailDetail { label: string; value: string; } interface StructuredEmailContent { title?: string; body: string; details?: EmailDetail[]; actions?: EmailActionButton[]; } type EmailContent = string | StructuredEmailContent; interface EmailRecipientGroup { emails?: string | string[]; users?: string | RecipientUser | Array; identities?: string | RecipientIdentity | Array; teams?: string | string[]; } interface EmailRecipients { to: EmailRecipientGroup; cc?: EmailRecipientGroup; bcc?: EmailRecipientGroup; } interface EmailInput { recipients: EmailRecipients; subject: string; content: EmailContent; replyTo?: EmailRecipientGroup; attachments?: FileWriteTypes[]; branding?: boolean; } interface NotifyApi { email(input: EmailInput): Promise; } declare function createNotifier(): NotifyApi; declare namespace ErrorPresets { export { NotFoundError$1 as NotFound }; export { BadRequestError as BadRequest }; export { UnknownError as Unknown }; } declare class NotFoundError$1 extends Error { constructor(message: any); errorCode: number; } /** * QueryContext is used to store state about the current query, for example * which joins have already been applied. It is used by applyJoins and * applyWhereConditions to generate consistent table aliases for joins. * * This class has the concept of a "table path". This is just a list of tables, starting * with some "root" table and ending with the table we're currently joining to. So * for example if we started with a "product" table and joined from there to "order_item" * and then to "order" and then to "customer" the table path would be: * ["product", "order_item", "order", "customer"] * At this point the "current" table is "customer" and it's alias would be: * "product$order_item$order$customer" */ declare class QueryContext { /** * @param {string[]} tablePath This is the path from the "root" table to the "current table". * @param {import("./ModelAPI").TableConfigMap} tableConfigMap * @param {string[]} joins */ constructor(tablePath: string[], tableConfigMap: TableConfigMap, joins?: string[]); _tablePath: string[]; _tableConfigMap: { [x: string]: { [x: string]: RelationshipConfig; }; }; _joins: string[]; clone(): QueryContext; /** * Returns true if, given the current table path, a join to the given * table has already been added. * @param {string} table * @returns {boolean} */ hasJoin(table: string): boolean; /** * Adds table to the QueryContext's path and registers the join, * calls fn, then pops the table off the path. * @param {string} table * @param {Function} fn */ withJoin(table: string, fn: Function): void; /** * Returns the alias that will be used for the current table * @returns {string} */ tableAlias(): string; /** * Returns the current table name * @returns {string} */ tableName(): string; /** * Return the TableConfig for the current table * @returns {import("./ModelAPI").TableConfig | undefined} */ tableConfig(): TableConfig | undefined; } declare class QueryBuilder { /** * @param {string} tableName * @param {import("./QueryContext").QueryContext} context * @param {import("kysely").Kysely} db */ constructor(tableName: string, context: QueryContext, db: kysely.Kysely); _tableName: string; _context: QueryContext; _db: kysely.Kysely; _modelName: any; where(where: any): QueryBuilder; sql(): any; update(values: any): Promise; delete(): Promise; findOne(): Promise; findMany(params: any): Promise; /** * Execute query with pagination support. * Returns results along with pageInfo metadata. * @param {Object} params - Pagination parameters * @param {number} [params.first] - Number of items for cursor pagination (forward) * @param {string} [params.after] - Cursor for forward pagination * @param {number} [params.last] - Number of items for cursor pagination (backward) * @param {string} [params.before] - Cursor for backward pagination * @param {number} [params.limit] - Page size for offset pagination * @param {number} [params.offset] - Offset for offset pagination * @param {Object} [params.orderBy] - Ordering specification * @returns {Promise<{results: any[], pageInfo: Object}>} */ findManyWithPageInfo(params?: { first?: number | undefined; after?: string | undefined; last?: number | undefined; before?: string | undefined; limit?: number | undefined; offset?: number | undefined; orderBy?: Object | undefined; }): Promise<{ results: any[]; pageInfo: Object; }>; } /** * TableConfig is an object where the keys are relationship field names * (which don't exist in the database) and the values are RelationshipConfig * objects describing that relationship. */ type RelationshipConfig = { relationshipType: "belongsTo" | "hasMany"; foreignKey: string; referencesTable: string; }; /** * TableConfigMap is mapping of database table names to TableConfig objects */ type TableConfig = { [x: string]: RelationshipConfig; }; /** * RelationshipConfig is a simple representation of a model field that * is a relationship. It is used by applyJoins and applyWhereConditions * to build the correct query. */ type TableConfigMap = { [x: string]: { [x: string]: RelationshipConfig; }; }; /** * RelationshipConfig is a simple representation of a model field that * is a relationship. It is used by applyJoins and applyWhereConditions * to build the correct query. * @typedef {{ * relationshipType: "belongsTo" | "hasMany", * foreignKey: string, * referencesTable: string, * }} RelationshipConfig * * TableConfig is an object where the keys are relationship field names * (which don't exist in the database) and the values are RelationshipConfig * objects describing that relationship. * @typedef {Object.} TableConfigMap */ declare class ModelAPI { /** * @param {string} tableName The name of the table this API is for * @param {Function} _ Used to be a function that returns the default values for a row in this table. No longer used. * @param {TableConfigMap} tableConfigMap */ constructor(tableName: string, _: Function, tableConfigMap?: TableConfigMap, fileFieldsMap?: {}); _tableName: string; _tableConfigMap: { [x: string]: { [x: string]: RelationshipConfig; }; }; _fileFields: any; _modelName: any; create(values: any): Promise; findOne(where?: {}): Promise; findMany(params: any): Promise; update(where: any, values: any): Promise; delete(where: any): Promise; where(where: any): QueryBuilder; _selectExistingFileValues(where: any, fileColumns: any): Promise<{}[]>; _deferReplacedFiles(existingRows: any, fileColumns: any, newRow: any): void; } /** * UnionAPI is the model API for a union: a read-only fact set assembled from several models * and compiled to a database view. * * A union is just a relation to read from, so this reuses ModelAPI's query machinery pointed * at the view, and exposes only the read methods. The generated TypeScript omits the write * methods entirely, so a write is a compile error; this class is the runtime half of that * guarantee, and Postgres refuses writes to a UNION ALL view regardless. */ declare class UnionAPI { /** * @param {string} viewName The name of the view this union compiles to * @param {import("./ModelAPI").TableConfigMap} tableConfigMap * @param {object} fileFieldsMap */ constructor(viewName: string, tableConfigMap?: TableConfigMap, fileFieldsMap?: object); _model: ModelAPI; /** * Finds a single fact. */ findOne(where?: {}): Promise; /** * Finds multiple facts. */ findMany(params: any): Promise; /** * Builds a query over the fact set. */ where(conditions: any): QueryBuilder; } /** * TaskAPI provides methods for creating and querying tasks. * It combines HTTP API calls for task actions (create, assign, complete, etc.) * with ModelAPI for querying (findOne, findMany). */ declare class TaskAPI { /** * @param {string} taskName The name of the task/topic * @param {Object} tableConfigMap Configuration for table relationships * @param {Object|null} identity Optional identity object for authentication * @param {string|null} authToken Optional auth token for authentication */ constructor(taskName: string, tableConfigMap?: Object, identity?: Object | null, authToken?: string | null); _taskName: string; _tableName: string; _tableConfigMap: Object; _identity: Object | null; _authToken: string | null; _modelAPI: ModelAPI; /** * Returns a new TaskAPI instance that will use the given identity for authentication. * @param {Object} identity The identity object * @returns {TaskAPI} A new TaskAPI instance with the identity set */ withIdentity(identity: Object): TaskAPI; /** * Returns a new TaskAPI instance that will use the given auth token for authentication. * @param {string} token The auth token to use * @returns {TaskAPI} A new TaskAPI instance with the auth token set */ withAuthToken(token: string): TaskAPI; /** * Creates a new task with the given data by calling the tasks API. * After creation, fetches the full task data from the database to include all fields. * @param {Object} data The task data fields * @param {Object} options Optional settings like deferredUntil * @returns {Promise} The created task with all fields */ create(data?: Object, options?: Object): Promise; /** * Wraps an entity with Task methods by setting its prototype and adding required fields. * @param {Object} entity The entity from ModelAPI * @returns {Task} The entity with Task methods */ _wrapAsTask(entity: Object): Task$1; /** * Finds a single task matching the given conditions. * Returns a Task instance with both entity fields and action methods. * @param {Object} where Conditions to match * @returns {Promise} The Task instance or null if not found */ findOne(where?: Object): Promise; /** * Finds multiple tasks matching the given conditions. * Returns Task instances with both entity fields and action methods. * @param {Object} params Query parameters including where, limit, offset, orderBy * @returns {Promise>} Array of Task instances */ findMany(params?: Object): Promise>; } /** * Task provides action methods for task instances. * These methods are attached to entities returned from findOne/findMany. */ declare class Task$1 { /** * Sets the identity for authentication and returns this instance. * @param {Object} identity The identity object * @returns {Task} This Task instance with the identity set */ withIdentity(identity: Object): Task$1; _identity: Object | null | undefined; _authToken: string | null | undefined; /** * Sets the auth token for authentication and returns this instance. * @param {string} token The auth token to use * @returns {Task} This Task instance with the auth token set */ withAuthToken(token: string): Task$1; /** * Updates the current task instance with data from the API response. * The API returns camelCase fields matching the Go struct JSON tags. * @param {Object} data The API response data */ _updateFromResponse(data: Object): void; id: any; status: any; deferredUntil: Date | null | undefined; createdAt: Date | undefined; updatedAt: Date | undefined; assignedToUserId: any; assignedToTeam: any; assignedAt: Date | null | undefined; resolvedAt: Date | null | undefined; flowRunId: any; /** * Assigns the task to a user or team. * @param {Object} options Options containing userId or teamName (exactly one required) * @param {string} [options.userId] The ID of the user to assign the task to * @param {string} [options.teamName] The name of the team to assign the task to * @returns {Promise} */ assign({ userId, teamName }: { userId?: string | undefined; teamName?: string | undefined; }): Promise; /** * Starts the task, creating and running the associated flow. * @returns {Promise} */ start(): Promise; /** * Completes the task. * @returns {Promise} */ complete(): Promise; /** * Defers the task until a specified date. * @param {Object} options Options containing deferUntil * @param {Date} options.deferUntil The date to defer the task until * @returns {Promise} */ defer({ deferUntil }: { deferUntil: Date; }): Promise; /** * Cancels the task. * @returns {Promise} */ cancel(): Promise; /** * Unassigns the task, removing the current assignee. * @returns {Promise} */ unassign(): Promise; } /** * FlowsAPI provides methods for starting and managing flows via the HTTP API. */ declare class FlowsAPI { /** * @param {string} flowName The name of the flow * @param {Object|null} identity Optional identity object for authentication * @param {string|null} authToken Optional auth token for authentication */ constructor(flowName: string, identity?: Object | null, authToken?: string | null); _flowName: string; _identity: Object | null; _authToken: string | null; /** * Returns a new FlowsAPI instance that will use the given identity for authentication. * @param {Object} identity The identity object * @returns {FlowsAPI} A new FlowsAPI instance with the identity set */ withIdentity(identity: Object): FlowsAPI; /** * Returns a new FlowsAPI instance that will use the given auth token for authentication. * @param {string} token The auth token to use * @returns {FlowsAPI} A new FlowsAPI instance with the auth token set */ withAuthToken(token: string): FlowsAPI; /** * Starts a new flow run with the given inputs. * @param {Object} inputs The flow input data * @returns {Promise} The created flow run */ start(inputs?: Object): Promise; /** * The signed-link management namespace for this flow: create, list and revoke signed links. The * flow must be declared with @externalAccess (the SDK types only expose `signedLinks` on such * flows). By default each operation authenticates with a first-party `flows` service token that * the runtime trusts, so backend code can manage links without satisfying the flow's `share` * permission. Chaining withIdentity()/withAuthToken() switches to user-scoped auth, where the * flow's @permission(actions: [share]) rule is enforced. * @returns {{create: Function, list: Function, revoke: Function}} The signed links API */ get signedLinks(): { create: Function; list: Function; revoke: Function; }; /** * Gets a flow run by ID. * @param {string} runId The flow run ID * @returns {Promise} The flow run */ get(runId: string): Promise; /** * Lists flow runs for this flow. * @param {Object} options Optional pagination options * @param {number} options.limit Maximum number of runs to return * @param {number} options.offset Offset for pagination * @returns {Promise<{results: FlowRun[], pageInfo: Object}>} List of flow runs with pagination info */ list(options?: { limit: number; offset: number; }): Promise<{ results: FlowRun$1[]; pageInfo: Object; }>; } /** * FlowRun represents a flow run instance with action methods. */ declare class FlowRun$1 { /** * @param {Object} data The flow run data from the API * @param {string} flowName The name of the flow * @param {Object|null} identity Optional identity object for authentication * @param {string|null} authToken Optional auth token for authentication */ constructor(data: Object, flowName: string, identity?: Object | null, authToken?: string | null); id: any; name: any; status: any; inputs: any; outputs: any; steps: any; pendingStep: any; createdAt: Date | undefined; updatedAt: Date | undefined; completedAt: Date | undefined; _flowName: string; _identity: Object | null; _authToken: string | null; /** * Returns a new FlowRun instance that will use the given identity for authentication. * @param {Object} identity The identity object * @returns {FlowRun} A new FlowRun instance with the identity set */ withIdentity(identity: Object): FlowRun$1; /** * Returns a new FlowRun instance that will use the given auth token for authentication. * @param {string} token The auth token to use * @returns {FlowRun} A new FlowRun instance with the auth token set */ withAuthToken(token: string): FlowRun$1; /** * Converts the flow run back to API data format for creating new instances. * @returns {Object} The flow run data in API format */ _toApiData(): Object; /** * Refreshes the flow run state from the API. * @returns {Promise} The updated flow run */ refresh(): Promise; /** * Cancels the flow run. * @returns {Promise} The updated flow run */ cancel(): Promise; } declare function createIntegrationServer(name: any, identity: any): { do: (request: any) => Promise; }; type ModuleExportsContext = { name: string; server: unknown; secret(key: string): string; }; type ModuleExportsFactory = (ctx: C) => T; declare function defineModuleExports(factory: ModuleExportsFactory): ModuleExportsFactory; declare function registerModuleExports(map: Record): void; declare function buildModuleAPI(name: string, base: Omit): Record; interface RequestHeadersMap { [key: string]: string; } declare class RequestHeaders { private _headers; /** * @param {{Object.}} requestHeaders Map of request headers submitted from the client */ constructor(requestHeaders: RequestHeadersMap); get: Headers["get"]; has: Headers["has"]; } declare function handleRequest(request: any, config: any): Promise; declare function handleJob(request: any, config: any): Promise; declare function handleSubscriber(request: any, config: any): Promise; declare function handleRoute(request: any, config: any): Promise; declare function handleFlow(request: any, config: any): Promise; declare function useDatabase(): Kysely; declare const PERMISSION_STATE: { readonly UNKNOWN: "unknown"; readonly PERMITTED: "permitted"; readonly UNPERMITTED: "unpermitted"; }; type PermissionState = (typeof PERMISSION_STATE)[keyof typeof PERMISSION_STATE]; /** * Permissions class for managing access control in the runtime */ declare class Permissions { /** * Explicitly permit access to an action */ allow(): void; /** * Explicitly deny access to an action */ deny(): never; getState(): PermissionState; } interface CheckBuiltInPermissionsParams { rows: any[]; permissionFns: Array<(rows: any[], ctx: any, db: any) => Promise>; ctx: any; db: any; functionName: string; } declare const checkBuiltInPermissions: ({ rows, permissionFns, ctx, db, functionName, }: CheckBuiltInPermissionsParams) => Promise; declare namespace ATTRS { let ACTION: string; let ACTION_TYPE: string; let ACTION_IMPLEMENTATION: string; let MODEL: string; let API: string; let PROTOCOL: string; let KIND: string; let LOG_SOURCE: string; let LOG_RAW: string; let IDENTITY_ID: string; let JOB_NAME: string; let JOB_ID: string; let EVENT_NAME: string; let EVENT_TARGET_TYPE: string; let EVENT_TARGET_ID: string; let SUBSCRIBER: string; let SUBSCRIBER_ID: string; let FLOW_NAME: string; let FLOW_RUN_ID: string; let STEP_NAME: string; let STEP_TYPE: string; let STEP_STATUS: string; let STEP_ID: string; let STEP_EXPECTED_ID: string; let STEP_ELEMENT: string; let STEP_CALLBACK: string; let TRIGGER: string; let GRAPHQL_QUERY_BYTES: string; let GRAPHQL_OPERATION: string; let GRAPHQL_DEMAND: string; let GRAPHQL_METADATA_DEMAND: string; let PERMISSION_RESULT: string; let VALIDATION_RESULT: string; let VALIDATION_RULES: string; let VALIDATION_RULES_FAILED: string; let VALIDATION_FAILED_RULES: string; let PERMISSION_REASON: string; let INTERNAL: string; let STATUS: string; let ATTEMPT: string; let EVENTS_GENERATED: string; let FLOW_STATUS: string; let FLOW_DURATION_MS: string; let MIGRATION_DRY_RUN: string; let MIGRATION_CHANGES: string; let MIGRATION_CHANGES_ADDED: string; let MIGRATION_CHANGES_REMOVED: string; let MIGRATION_CHANGES_MODIFIED: string; let MIGRATION_BACKFILL_TABLE: string; let MIGRATION_BACKFILL_WINDOWS: string; let MIGRATION_BACKFILL_ROWS_CORRECTED: string; let MIGRATION_BACKFILL_CHECKPOINT: string; let MIGRATION_BACKFILL_LOCK_RETRIES: string; let MIGRATION_BACKFILL_RESUMED_FROM: string; let MIGRATION_BACKFILL_DURATION_MS: string; let MIGRATION_BACKFILL_ELAPSED_MS: string; let MIGRATION_BACKFILL_STOP_REASON: string; let MIGRATION_DEFERRED_BUDGET_MS: string; let MIGRATION_DEFERRED_DONE: string; let MIGRATION_DEFERRED_PENDING: string; let MIGRATION_GUARDED_DDL_ATTEMPT: string; let MIGRATION_GUARDED_DDL_STATEMENT: string; let EVENT_PAYLOAD_BYTES: string; let RESPONSE_CODE: string; let RESPONSE_BYTES: string; let CREATE_FIELDS: string; let UPDATE_FIELDS: string; let UPDATE_WHERE: string; let GET_EMBEDS: string; let LIST_WHERE: string; let LIST_ORDER_BY: string; let LIST_SEARCH: string; let LIST_FACETS: string; let LIST_PAGE_FIRST: string; let LIST_PAGE_HAS_CURSOR: string; let LIST_PAGE_LAST: string; let LIST_PAGE_LIMIT: string; let LIST_PAGE_OFFSET: string; let LIST_RESULTS_COUNT: string; let AUTH_ISSUER: string; let IDENTITY_EXTERNAL_ID: string; let USER_ID: string; let AUTH_EMAIL_LOOKUP: string; let AUTH_USER_PROVISIONING: string; let OUTCOME: string; let AUTH_ERROR: string; let AUTH_ERROR_DESCRIPTION: string; let FLOW_COUNT: string; let FLOW_METADATA_ONLY: string; let FLOW_SCHEDULED_AT: string; let MIGRATION_STATEMENTS: string; let TIMEZONE: string; let FILES_DELETED: string; let UPLOAD_ACTION: string; let UPLOAD_FIELD: string; let STEP_VALUE_BYTES: string; let STEP_RENDERED: string; let AUDIENCE: string; let SPAN_TYPE: string; let QUEUED_MS: string; let LEDGER: string; let LEDGER_GROUP: string; let LEDGER_ENTRIES: string; let LEDGER_POSITIONS: string; let INTEGRATION: string; let INTEGRATION_ATTEMPTS: string; let INTEGRATION_TOKEN_REFRESH: string; let INTEGRATION_REQUEST_ID: string; let INTEGRATION_REPLAY_OF: string; let INTEGRATION_REQUESTS_SHED: string; let INTEGRATION_REQUESTS_DELETED: string; let SYNC_INTEGRATION: string; let SYNC_ENTITY: string; let SYNC_SCOPE: string; let SYNC_STRATEGY: string; let SYNC_PHASE: string; let SYNC_MODE: string; let SYNC_PAGE: string; let SYNC_RECONCILE_ID: string; let SYNC_RECORDS_FETCHED: string; let SYNC_RECORDS_CHANGED: string; let SYNC_RECORDS_APPLIED: string; let SYNC_RECORDS_FAILED: string; let SYNC_RECORDS_SKIPPED: string; let SYNC_RECORDS_TOMBSTONED: string; let SYNC_RECORDS_LIVE: string; let SYNC_RECORDS_ATTEMPTED: string; let SYNC_RECORD_EXTERNAL_ID: string; let SYNC_RECORD_ATTEMPTS: string; let SYNC_RATE_LIMIT_REMAINING: string; let SYNC_RATE_LIMIT_RESERVE: string; let SYNC_ACTION: string; } declare function getTracer(): opentelemetry.Tracer; declare function withSpan(name: any, fn: any, opts?: {}): Promise; declare function withUserSpan(span: any, fn: any): any; declare function init(): void; declare function forceFlush(): Promise; declare function createTraceAPI$1(defaultSpan: any): { readonly traceId: any; readonly spanId: any; setAttribute(key: any, value: any): void; setAttributes(attributes: any): void; }; declare function withDbQuerySpan(modelName: any, action: any, fn: any): Promise; declare function spanNameForServiceAPI(service: any, op: any): string; declare function fetchUntraced(...args: any[]): any; declare const TRACER_NAME: "keel.functions"; declare const KEEL_INTERNAL_ATTR: string; declare const KEEL_INTERNAL_TRUE: "true"; declare const KEEL_INTERNAL_CHILDREN: "children"; declare const SpanKind: typeof opentelemetry.SpanKind; declare function truncateSQL(s: any): any; declare function markUserFacing(span: any, archetype: any): void; declare function withUserFacingSpan(archetype: any, attrs: any, fn: any, opts?: {}): Promise; declare const AUDIENCE_USER: "user"; declare const ARCHETYPE_CUSTOM: "custom"; declare function getUserTracingRegistry(): any; declare const tracing_ARCHETYPE_CUSTOM: typeof ARCHETYPE_CUSTOM; declare const tracing_ATTRS: typeof ATTRS; declare const tracing_AUDIENCE_USER: typeof AUDIENCE_USER; declare const tracing_KEEL_INTERNAL_ATTR: typeof KEEL_INTERNAL_ATTR; declare const tracing_KEEL_INTERNAL_CHILDREN: typeof KEEL_INTERNAL_CHILDREN; declare const tracing_KEEL_INTERNAL_TRUE: typeof KEEL_INTERNAL_TRUE; declare const tracing_SpanKind: typeof SpanKind; declare const tracing_TRACER_NAME: typeof TRACER_NAME; declare const tracing_fetchUntraced: typeof fetchUntraced; declare const tracing_forceFlush: typeof forceFlush; declare const tracing_getTracer: typeof getTracer; declare const tracing_getUserTracingRegistry: typeof getUserTracingRegistry; declare const tracing_init: typeof init; declare const tracing_markUserFacing: typeof markUserFacing; declare const tracing_spanNameForServiceAPI: typeof spanNameForServiceAPI; declare const tracing_truncateSQL: typeof truncateSQL; declare const tracing_withDbQuerySpan: typeof withDbQuerySpan; declare const tracing_withSpan: typeof withSpan; declare const tracing_withUserFacingSpan: typeof withUserFacingSpan; declare const tracing_withUserSpan: typeof withUserSpan; declare namespace tracing { export { tracing_ARCHETYPE_CUSTOM as ARCHETYPE_CUSTOM, tracing_ATTRS as ATTRS, tracing_AUDIENCE_USER as AUDIENCE_USER, tracing_KEEL_INTERNAL_ATTR as KEEL_INTERNAL_ATTR, tracing_KEEL_INTERNAL_CHILDREN as KEEL_INTERNAL_CHILDREN, tracing_KEEL_INTERNAL_TRUE as KEEL_INTERNAL_TRUE, tracing_SpanKind as SpanKind, tracing_TRACER_NAME as TRACER_NAME, createTraceAPI$1 as createTraceAPI, tracing_fetchUntraced as fetchUntraced, tracing_forceFlush as forceFlush, tracing_getTracer as getTracer, tracing_getUserTracingRegistry as getUserTracingRegistry, tracing_init as init, tracing_markUserFacing as markUserFacing, tracing_spanNameForServiceAPI as spanNameForServiceAPI, tracing_truncateSQL as truncateSQL, tracing_withDbQuerySpan as withDbQuerySpan, tracing_withSpan as withSpan, tracing_withUserFacingSpan as withUserFacingSpan, tracing_withUserSpan as withUserSpan }; } declare class Duration { private _typename; private pgInterval; private _interval; constructor(postgresString: string); static fromISOString(isoString: string): Duration; toISOString(): string; toPostgres(): string; } type ActionInputs = T extends File ? FileWriteTypes : T extends InlineFile | Date | Duration ? T : T extends Array ? ActionInputs[] : T extends object ? { [K in keyof T]: ActionInputs; } : T; type ActionPaths = Record; type ActionsAPIOptions = { authToken?: string | null; timezone?: string | null; }; /** * ActionsAPI calls schema-defined actions over the runtime's public JSON API, as the identity the * current invocation runs as. * * The generated SDK exposes a single instance as `actions`, with a typed method per action. This * class provides no such methods itself: a Proxy turns any unknown property access into a call to * `execute`, so codegen only has to emit type declarations. * * Who the action runs as - the runtime applies that identity's permission rules, @where filters and * row-level checks exactly as it would for an API request; there is no backend bypass: * 1. withAuthToken(token) -> that token is sent; the runtime resolves the caller from it. * 2. otherwise -> the access token of the invocation this call is made from: the token * the function's caller presented, or one the runtime minted for a flow's or job's identity. * An anonymous invocation (a subscriber, an unauthenticated request) calls anonymously. * * Options are immutable: each with* method returns a new instance, so an instance handed out by * the SDK can never be re-scoped by a caller elsewhere. */ declare class ActionsAPI { private readonly _paths; private readonly _authToken; private readonly _timezone; constructor(paths?: ActionPaths, opts?: ActionsAPIOptions); /** * Returns a new ActionsAPI that authenticates with the given token instead of the invocation's own. */ withAuthToken(token: string): ActionsAPI; /** * Returns a new ActionsAPI that evaluates the action's relative dates in the given timezone. */ withTimezone(timezone: string): ActionsAPI; /** * Calls the named action with the given inputs, returning its result. Throws an ActionError * when the runtime rejects the call or the request itself fails. */ execute(actionName: string, inputs?: Record): Promise; private _buildHeaders; } declare const ACTION_ERROR_CODES: readonly ["ERR_INTERNAL", "ERR_INVALID_INPUT", "ERR_INPUT_MALFORMED", "ERR_AUTHENTICATION_FAILED", "ERR_PERMISSION_DENIED", "ERR_RECORD_NOT_FOUND", "ERR_ACTION_NOT_FOUND", "ERR_HTTP_METHOD_NOT_ALLOWED", "ERR_UNKNOWN", "ERR_REQUEST_BODY_TOO_LARGE", "ERR_CONFLICT", "ERR_LEDGER_GUARD"]; type ActionErrorCode = (typeof ACTION_ERROR_CODES)[number]; type ActionValidationErrorData = { errors: { field: string; error: string; }[]; }; type ActionLedgerErrorData = { entryIndex: number; }; type ActionLedgerGuardKind = "min" | "max"; type ActionLedgerBalanceGuardError = { error: string; guard: ActionLedgerGuardKind; bound: number; balance: string; position: Record; current: number; attempted: number; }; type ActionLedgerAmountGuardError = { error: string; guard: ActionLedgerGuardKind; bound: number; amount: string; value: number; entryIndex?: number; }; type ActionLedgerRelatedRowGuardError = { error: string; guard: ActionLedgerGuardKind; bound: number; ledger: string; balance: string; }; type ActionLedgerGuardErrorData = { errors: (ActionLedgerBalanceGuardError | ActionLedgerAmountGuardError | ActionLedgerRelatedRowGuardError | { error: string; })[]; }; type ActionErrorInit = { action: string; code: ActionErrorCode; message: string; status: number; data?: Record; cause?: unknown; }; declare class ActionError extends Error { readonly name = "ActionError"; readonly code: ActionErrorCode; readonly status: number; readonly action: string; readonly data?: Record; readonly cause?: unknown; constructor(init: ActionErrorInit); } declare function isActionError(e: unknown, code?: ActionErrorCode): e is ActionError; type TraceAttributePrimitive = string | number | boolean; type TraceAttributeValue = TraceAttributePrimitive | string[] | number[] | boolean[]; type TraceAttributes = Record; type TraceAPI = { readonly traceId: string; readonly spanId: string; setAttribute(key: string, value: TraceAttributeValue | undefined): void; setAttributes(attributes: TraceAttributes): void; }; type LogFields = Record; declare const log: { debug: (msg: string, fields?: LogFields) => void; info: (msg: string, fields?: LogFields) => void; warn: (msg: string, fields?: LogFields) => void; error: (msg: string, fields?: LogFields) => void; }; /** * Type-level tokenizer for the visibility expression subset of CEL. Runs entirely in the type * system: `Tokenize<"a >= 10">` is `[{ id: "a" }, ">=", { num: "10" }]`. Every recursive step is * in tail position so TypeScript's tail-call evaluation applies. */ type Ws = " " | "\t" | "\n" | "\r"; type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"; type Lower = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"; type IdentStart = Lower | Uppercase | "_"; type IdentChar = IdentStart | Digit; type TwoCharOp = "==" | "!=" | "<=" | ">=" | "&&" | "||"; type OneCharOp = "<" | ">" | "!" | "(" | ")" | "[" | "]" | "," | "."; /** CEL keywords; they cannot follow `inputs.` as a field selector, use `inputs["..."]` instead. */ type CelKeyword = "as" | "break" | "const" | "continue" | "else" | "for" | "function" | "if" | "import" | "let" | "loop" | "package" | "namespace" | "return" | "var" | "void" | "while" | "true" | "false" | "null" | "in"; /** Aggregates over an iterator's rows, spelled as in schema expressions. */ type AggregateFn = "COUNT" | "ANY" | "ALL" | "SUM" | "MIN" | "MAX"; /** * Text functions, spelled as Keel functions: `STARTSWITH(inputs.code, "D-")`. The wire carries * CEL's receiver form (`inputs.code.startsWith("D-")`), which is the only spelling CEL defines. */ type StringFn = "STARTSWITH" | "ENDSWITH" | "CONTAINS" | "MATCHES"; /** CEL's receiver-style names, recognised only to point authors at the Keel spelling. */ type StringMethod = "contains" | "startsWith" | "endsWith" | "matches"; type MethodToFn = M extends "contains" ? "CONTAINS" : M extends "startsWith" ? "STARTSWITH" : M extends "endsWith" ? "ENDSWITH" : "MATCHES"; type CmpOp = "==" | "!=" | "<" | "<=" | ">" | ">="; type Keyword = "true" | "false" | "null" | "in"; type Tok = TwoCharOp | OneCharOp | Keyword | { id: string; } | { str: string; } | { num: string; }; type Err = { err: M; }; type MatchOp = Ops extends infer O extends string ? S extends `${O}${infer R}` ? [O, R] : never : never; type FirstOp = [MatchOp] extends [ never ] ? null : MatchOp; type ScanIdent = S extends `${infer C extends IdentChar}${infer R}` ? ScanIdent : [Acc, S]; type ScanDigits = S extends `${infer C extends Digit}${infer R}` ? ScanDigits : [Acc, S]; type ScanNum = ScanDigits extends [infer I extends string, infer R extends string] ? R extends `.${infer D extends Digit}${infer R2}` ? ScanDigits : [I, R] : never; type Word = Id extends Keyword ? Id : { id: Id; }; type Tokenize = S extends "" ? Acc : S extends `${Ws}${infer R}` ? Tokenize : FirstOp extends [ infer O extends Tok, infer R extends string ] ? Tokenize : FirstOp extends [ infer O extends Tok, infer R extends string ] ? Tokenize : S extends `"${infer Str}"${infer R}` ? Tokenize : S extends `'${infer Str}'${infer R}` ? Tokenize : S extends `-${Digit}${string}` ? (S extends `-${infer R}` ? ScanNum : never) extends [ infer N extends string, infer R extends string ] ? Tokenize : never : S extends `${Digit}${string}` ? ScanNum extends [ infer N extends string, infer R extends string ] ? Tokenize : never : S extends `${IdentStart}${string}` ? ScanIdent extends [ infer Id extends string, infer R extends string ] ? Tokenize]> : never : S extends `${infer C}${string}` ? Err<`Unexpected character '${C}'`> : never; /** Human-readable rendering of a token for "near ..." messages. */ type TokText = T extends string ? T : T extends { id: infer I extends string; } ? I : T extends { str: infer S extends string; } ? `"${S}"` : T extends { num: infer N extends string; } ? N : "?"; /** * Value categories and typing rules for the visibility expression subset. Identifiers take their * category from the input's `valueType`; literals from their token. */ type TBool = { k: "bool"; }; type TNum = { k: "num"; }; /** A string-valued field; `u` is the union of values it can hold (`string` when unconstrained). */ type TStr = { k: "str"; u: U; }; /** A quoted literal in the expression. */ type TLit = { k: "lit"; lit: S; }; type TList = { k: "list"; }; type TNull = { k: "null"; }; /** Object-valued fields (files, table rows, pick lists): only comparable with null. */ type TOther = { k: "other"; }; /** Fields whose value type is `any`; nothing is checked. */ type TAny = { k: "any"; }; /** An iterator: a list of rows whose fields are described by `R` (a row `CelCtx`). */ type TRows = { k: "rows"; rows: R; }; /** Brand on a `CelCtx` entry that marks an iterator; `R` is the row context. */ declare const rowsBrand: unique symbol; type Rows = { readonly [rowsBrand]: R; }; /** Brand on a `CelCtx` saying whether it is a page (aggregates allowed) or an iterator row. */ declare const scopeBrand: unique symbol; type ScopeKind = "page" | "row"; /** Brand set on a `CelCtx` while parsing an `ANY`/`ALL` body: the iterator being quantified. */ declare const quantifiedBrand: unique symbol; type IsAny = 0 extends 1 & V ? true : false; type TyOf = IsAny extends true ? TAny : V extends Rows ? TRows : [V] extends [boolean] ? TBool : [V] extends [number] ? TNum : [V] extends [string] ? TStr : [V] extends [readonly unknown[]] ? TList : TOther; /** The type of a field reference; carries the field name for messages. */ type IdentTy = TyOf> & { name: N; }; type KindOf = T extends { k: "lit"; } ? "str" : T extends { k: infer K; } ? K : never; type KindName = KindOf extends "num" ? "a number" : KindOf extends "bool" ? "a boolean" : KindOf extends "str" ? "text" : KindOf extends "list" ? "a list" : KindOf extends "null" ? "null" : KindOf extends "rows" ? "an iterator" : "an object"; /** How an operand is named in a message. */ type Desc = T extends { k: "rows"; name: infer N extends string; } ? `iterator '${N}'` : T extends { name: infer N extends string; } ? `field '${N}'` : T extends TLit ? `'${S}'` : T extends { num: infer N extends string; } ? N : KindName; type IsAnyTy = T extends { k: "any"; } ? true : false; type Either = KindOf extends K ? true : KindOf extends K ? true : false; type CheckMembership = L extends TStr & { name: infer N extends string; } ? R extends TLit ? S extends U ? true : Err<`'${S}' is not one of the options of ${Desc}`> : true : R extends TStr & { name: infer N extends string; } ? L extends TLit ? S extends U ? true : Err<`'${S}' is not one of the options of ${Desc}`> : true : true; type CheckEq = IsAnyTy extends true ? true : IsAnyTy extends true ? true : Either extends true ? Err<`${Desc} can only be used inside COUNT, ANY, ALL, SUM, MIN or MAX`> : Either extends true ? true : Either extends true ? Err<`${Desc} can only be compared with null`> : Either extends true ? Err<`${Desc} is a list; use size(...) or compare it with null`> : KindOf extends KindOf ? CheckMembership : Err<`Cannot compare ${Desc} (${KindName}) with ${Desc} (${KindName})`>; type CheckOrd = IsAnyTy extends true ? true : IsAnyTy extends true ? true : KindOf extends "num" ? KindOf extends "num" ? true : Err<`'${Op}' needs two numbers or two strings, got ${Desc} and ${Desc}`> : KindOf extends "str" ? KindOf extends "str" ? true : Err<`'${Op}' needs two numbers or two strings, got ${Desc} and ${Desc}`> : Err<`'${Op}' needs two numbers or two strings, got ${Desc} and ${Desc}`>; type CheckItems = Items extends [infer I, ...infer Rest] ? CheckEq extends Err ? Err : CheckItems : true; type CheckIn = IsAnyTy extends true ? true : KindOf extends "bool" | "num" | "str" ? CheckItems : Err<`'in' needs a boolean, number or text on the left, got ${Desc}`>; type RequireBool = IsAnyTy extends true ? true : KindOf extends "bool" ? true : Err<`Operand of '${Op}' must be a boolean, got ${Desc}`>; type StringFnOn = KindOf extends "str" | "any" ? TBool : Err<`${Fn}() needs a text field, ${Desc} is ${KindName}`>; type SizeOf = KindOf extends "list" | "str" | "any" ? TNum : KindOf extends "rows" ? Err<`size() does not apply to iterators; write COUNT(inputs.${T extends { name: infer N extends string; } ? N : "lines"}) instead`> : Err<`size() needs a list or text field, ${Desc} is ${KindName}`>; /** `SUM`/`MIN`/`MAX` need a numeric row field. */ type NumericRowField = KindOf extends "num" | "any" ? TNum : Err<`${Fn}() needs a number field, ${Desc} is ${KindName}`>; /** * Type-level recursive-descent parser for the visibility expression subset of CEL: * * expr := or ; or := and ("||" and)* ; and := cmp ("&&" cmp)* * cmp := unary (("=="|"!="|"<"|"<="|">"|">=") unary | "in" list)? ; unary := "!" unary | primary * * `!` binds tighter than comparisons, as in CEL: `!a == 1` is `(!a) == 1`, so negating a whole * comparison needs parentheses. * primary := "(" expr ")" | field | literal | "size" "(" field ")" * | ("STARTSWITH"|"ENDSWITH"|"CONTAINS"|"MATCHES") "(" field "," string ")" * | "COUNT" "(" field ")" | ("SUM"|"MIN"|"MAX") "(" rowPath ")" | ("ANY"|"ALL") "(" expr ")" * field := "inputs" "." ident | "inputs" "[" string "]" * rowPath := field "." ident | field "[" string "]" (field must be an iterator) * * Aggregates are page-scope only. Inside an ANY/ALL body exactly one iterator is quantified, and * its row paths resolve to the row's field types; `inputs.` still resolves to the page. * literal := "…" | '…' | number | true | false | null ; list := "[" literal ("," literal)* "]" * * Each level returns `[Ty, RemainingTokens]` or an `Err`. Repetition is handled by tail helpers so * instantiation depth grows only with parenthesis nesting. */ type Step$1 = [Ty, Rest]; type Fail = R extends Err ? R : never; type ParseOr = ParseAnd extends infer A ? A extends Step$1 ? OrTail : Fail : never; type OrTail = Toks extends [ "||", ...infer R extends Tok[] ] ? ParseAnd extends infer B ? B extends Step$1 ? RequireBool extends Err ? Err : RequireBool extends Err ? Err : OrTail : Fail : never : Step$1; type ParseAnd = ParseCmp extends infer A ? A extends Step$1 ? AndTail : Fail : never; type AndTail = Toks extends [ "&&", ...infer R extends Tok[] ] ? ParseCmp extends infer B ? B extends Step$1 ? RequireBool extends Err ? Err : RequireBool extends Err ? Err : AndTail : Fail : never : Step$1; type ParseUnary = Toks extends [ "!", ...infer R extends Tok[] ] ? ParseUnary extends infer U ? U extends Step$1 ? RequireBool extends Err ? Err : Step$1 : Fail : never : ParsePrimary; type ParseCmp = ParseUnary extends infer P ? P extends Step$1 ? R extends [infer Op extends CmpOp, ...infer R2 extends Tok[]] ? ParseUnary extends infer Q ? Q extends Step$1 ? (Op extends "==" | "!=" ? CheckEq : CheckOrd) extends Err ? Err : Step$1 : Fail : never : R extends ["in", ...infer R2 extends Tok[]] ? ParseList extends infer LS ? LS extends Step$1 ? CheckIn extends Err ? Err : Step$1 : Fail : never : Step$1 : Fail

: never; type ParseKey = Toks extends [".", { id: infer N extends string; }, ...infer R extends Tok[]] ? N extends CelKeyword ? Err<`'${N}' is a CEL keyword; write ${Prefix}["${N}"] instead`> : [N, R] : Toks extends [ "[", { str: infer N extends string; }, "]", ...infer R extends Tok[] ] ? [N, R] : never; type IsRows = 0 extends 1 & V ? false : V extends Rows ? true : false; type RowCtxOf = Iter extends keyof Ctx ? Ctx[Iter] extends Rows ? R : never : never; type ParseFieldRef = Toks extends [ { id: "inputs"; }, ...infer R extends Tok[] ] ? ParseKey extends infer K ? [K] extends [never] ? Err<'Inputs are referenced as inputs.name or inputs["name"]'> : K extends [infer N extends string, infer R2 extends Tok[]] ? N extends keyof Ctx ? IsRows extends true ? ParseKey extends infer K2 ? [K2] extends [never] ? Step$1> & { name: N; }, R2> : K2 extends [infer F extends string, infer R3 extends Tok[]] ? Ctx extends { readonly [quantifiedBrand]: N; } ? F extends keyof RowCtxOf ? Step$1[F]> & { rowOf: N; }, R3> : Err<`Unknown row field '${F}' on iterator '${N}'`> : Err<`inputs.${N}.${F} can only be used inside ANY, ALL, SUM, MIN or MAX`> : Fail : never : Step$1, R2> : Err<`Unknown input '${N}'`> : Fail : never : Toks extends [{ id: "ctx"; }, ...Tok[]] ? Err<"'ctx' is reserved for future use and cannot be an input name"> : Toks extends [{ id: infer N extends string; }, ...Tok[]] ? Err<`Unknown identifier '${N}'; inputs are referenced as inputs.${N}`> : never; type ParseRowPath = Toks extends [ { id: "inputs"; }, ...infer R extends Tok[] ] ? ParseKey extends infer K ? [K] extends [never] ? Err<`${Fn}() takes a row field, e.g. ${Fn}(inputs.lines.qty)`> : K extends [infer N extends string, infer R2 extends Tok[]] ? N extends keyof Ctx ? IsRows extends true ? ParseKey extends infer K2 ? [K2] extends [never] ? Err<`${Fn}() takes a row field, e.g. ${Fn}(inputs.${N}.qty)`> : K2 extends [infer F extends string, infer R3 extends Tok[]] ? F extends keyof RowCtxOf ? Step$1[F]>, R3> : Err<`Unknown row field '${F}' on iterator '${N}'`> : Fail : never : Err<`${Fn}() needs an iterator, field '${N}' is an input`> : Err<`Unknown iterator '${N}'`> : Fail : never : Err<`${Fn}() takes a row field, e.g. ${Fn}(inputs.lines.qty)`>; type BodyTokens = Toks extends [infer T extends Tok, ...infer R extends Tok[]] ? T extends ")" ? Depth extends [1, ...infer D extends 1[]] ? BodyTokens : Acc : T extends "(" ? BodyTokens : BodyTokens : Acc; type CollectIterators = Toks extends [ { id: "inputs"; }, ...infer R extends Tok[] ] ? ParseKey extends infer K ? [K] extends [never] ? CollectIterators : K extends [infer N extends string, infer R2 extends Tok[]] ? N extends keyof Ctx ? IsRows extends true ? ParseKey extends infer K2 ? [K2] extends [never] ? CollectIterators : K2 extends [string, infer R3 extends Tok[]] ? CollectIterators : CollectIterators : never : CollectIterators : CollectIterators : CollectIterators : never : Toks extends [Tok, ...infer R extends Tok[]] ? CollectIterators : Acc; type IsUnion = U extends any ? [C] extends [U] ? false : true : never; type ParseAggregate = Ctx extends { readonly [scopeBrand]: "row"; } ? Err<"Aggregates are not available inside an iterator's own rules"> : Fn extends "COUNT" ? ParseFieldRef extends infer F ? F extends Step$1 ? T extends { k: "rows"; } ? R extends [")", ...infer R2 extends Tok[]] ? Step$1 : Err<"COUNT() takes an iterator, e.g. COUNT(inputs.lines)"> : Err<"COUNT() takes an iterator, e.g. COUNT(inputs.lines)"> : F extends Err ? F : Err<"COUNT() takes an iterator, e.g. COUNT(inputs.lines)"> : never : Fn extends "SUM" | "MIN" | "MAX" ? ParseRowPath extends infer P ? P extends Step$1 ? NumericRowField extends Err ? Err : R extends [")", ...infer R2 extends Tok[]] ? Step$1 : Err<`Expected ')' to close ${Fn}(...)`> : Fail

: never : CollectIterators, Ctx> extends infer Iters ? [Iters] extends [never] ? Err<`${Fn}(...) must reference a row field such as inputs.lines.qty`> : IsUnion extends true ? Err<`${Fn}(...) may only reference one iterator`> : Iters extends string ? ParseOr extends infer B ? B extends Step$1 ? RequireBool extends Err ? Err : R extends [")", ...infer R2 extends Tok[]] ? Step$1 : Err<`Expected ')' to close ${Fn}(...)`> : Fail : never : never : never; type ParsePrimary = Toks extends [ "(", ...infer R extends Tok[] ] ? ParseOr extends infer E ? E extends Step$1 ? R2 extends [")", ...infer R3 extends Tok[]] ? Step$1 : Err<"Expected ')'"> : Fail : never : Toks extends [ { id: infer Fn extends AggregateFn; }, "(", ...infer R extends Tok[] ] ? ParseAggregate : Toks extends [{ id: "size"; }, "(", ...infer R extends Tok[]] ? ParseFieldRef extends infer F ? F extends Step$1 ? R2 extends [")", ...infer R3 extends Tok[]] ? SizeOf extends infer S ? S extends Err ? S : Step$1 : never : Err<"size() takes one input, e.g. size(inputs.items)"> : Fail : never : Toks extends [ { id: infer Fn extends StringFn; }, "(", ...infer R extends Tok[] ] ? ParseFieldRef extends infer F ? F extends Step$1 ? R2 extends [",", { str: string; }, ")", ...infer R3 extends Tok[]] ? StringFnOn extends infer S ? S extends Err ? S : Step$1 : never : Err<`${Fn}() takes a field and one quoted string, e.g. ${Fn}(inputs.code, "abc")`> : Fail : never : Toks extends [{ id: "inputs" | "ctx"; }, ...Tok[]] ? ParseFieldRef extends infer F ? F extends Step$1 ? R extends [".", { id: infer M extends string; }, "(", ...Tok[]] ? M extends StringMethod ? Err<`Methods are not supported; write ${MethodToFn}(inputs.${T extends { name: infer N extends string; } ? N : "field"}, "...") instead`> : Err<`Unknown function '${M}'; text fields support STARTSWITH, ENDSWITH, CONTAINS and MATCHES`> : Step$1 : Fail : never : Toks extends [{ id: infer N extends string; }, ...Tok[]] ? Err<`Unknown identifier '${N}'; inputs are referenced as inputs.${N}`> : Toks extends [ { str: infer S extends string; }, ...infer R extends Tok[] ] ? Step$1, R> : Toks extends [ { num: infer N extends string; }, ...infer R extends Tok[] ] ? Step$1 : Toks extends ["true" | "false", ...infer R extends Tok[]] ? Step$1 : Toks extends ["null", ...infer R extends Tok[]] ? Step$1 : Toks extends [] ? Err<"Unexpected end of expression"> : Err<`Unsupported expression near '${TokText}'`>; type ParseList = Toks extends [ "[", ...infer R extends Tok[] ] ? R extends ["]", ...Tok[]] ? Err<"List must not be empty"> : ParseListItems : Err<`'in' must be followed by a list like ["a", "b"]`>; type ListItem$1 = T extends { str: infer S extends string; } ? TLit : T extends { num: infer N extends string; } ? TNum & { num: N; } : T extends "true" | "false" ? TBool : T extends "null" ? Err<"null is not allowed inside a list"> : Err<`Unsupported list item '${TokText}'`>; type ParseListItems = Toks extends [ infer I, ...infer R extends Tok[] ] ? ListItem$1 extends infer Item ? Item extends Err ? Item : R extends [",", ...infer R2 extends Tok[]] ? ParseListItems : R extends ["]", ...infer R2 extends Tok[]] ? Step$1<[...Acc, Item], R2> : Err<"Expected ',' or ']' in list"> : never : Err<"Expected ']' to close the list">; /** `true` when `S` is a valid boolean expression over `Ctx`, otherwise an `Err` with the message. */ type CelResult = string extends S ? Err<"Visibility expression must be a string literal"> : Tokenize extends infer Toks ? Toks extends Err ? Toks : Toks extends Tok[] ? ParseOr extends infer P ? P extends Step$1 ? Rest extends [] ? T extends { k: "bool" | "any"; } ? true : Err<"Expression must evaluate to a boolean"> : Err<`Unsupported expression near '${TokText}'`> : Fail

: never : never : never; type FieldSuggestion = N extends `${string}${" " | "-" | "."}${string}` ? `inputs["${N}"]` : `inputs.${N}`; type NamesStartingWith = Extract, `${P}${string}`>; type CompleteReference = S extends `${infer Pre}inputs.${infer Rest}` ? ScanIdent extends [infer P extends string, infer After extends string] ? P extends keyof Ctx ? IsRows extends true ? CompleteRowField : CompleteReference : NamesStartingWith extends infer N ? N extends string ? `${Before}${Pre}${FieldSuggestion}${After}` : never : never : never : never; type CompleteRowField = After extends `.${infer Rest}` ? ScanIdent extends [ infer P extends string, infer After2 extends string ] ? P extends keyof RowCtxOf ? CompleteReference : NamesStartingWith, P> extends infer N ? N extends string ? `${Before}.${N}${After2}` : never : never : never : CompleteReference; type Suggestions = S extends `${string}inputs.${string}` ? CompleteReference : S extends `${string}${" " | "\t" | "\n"}${string}` ? never : FieldSuggestion>; type StillTypingReference = M extends "Unexpected end of expression" | `Unknown identifier ${string}` | `Unknown input ${string}` | `Unknown iterator ${string}` | `Unknown row field ${string}` | 'Inputs are referenced as inputs.name or inputs["name"]' ? true : false; /** * The expression itself when it is valid over `Ctx`, otherwise the error message as a string * literal type, so that using this as the expected type of a property makes TypeScript report * `Type '"inputs.pakcs >= 10"' is not assignable to type '"Unknown input 'pakcs'"'` on that * property. While a reference is still being typed the expected type also carries completion * hints (see above), so the input names are discoverable inside the string. */ type CelExpression = CelResult extends infer R ? R extends true ? S : R extends Err ? StillTypingReference extends true ? M | Exclude, S> : M : never : never; /** * An element's `visible` property is a CEL expression over the inputs of the scope the element * lives in (the page, or the iterator row). The console re-evaluates it whenever the form changes; * the runtime evaluates it once on submit to skip validation of, and strip values from, hidden * elements. Inputs are referenced as `inputs.name` (or `inputs["name"]`). Both sides evaluate with * @marcbachmann/cel-js against a context `{ inputs: {...} }` holding every input of the scope (null * when the form has no value), treating an evaluation error as "hidden". */ type VisibilityExpression = string; type InputNames = Extract>["name"]; /** Everything a rule can target: inputs and iterators by name, display elements by `key`. */ type VisibilityTargets = InputNames | Extract>["name"] | Extract>["key"]; type IteratorNames = Extract>["name"]; /** * The members of a scope as `{ name: valueType }`, the context a CEL string is checked against. * Inputs map to their value type; iterators map to a branded `Rows` of their row context so * aggregates can type their row fields. The scope brand says whether aggregates are allowed. */ type CelCtx = { [K in InputNames]: Extract>["valueType"]; } & { [K in IteratorNames]: Rows>; } & { readonly [scopeBrand]: Scope; }; type IteratorRowCtx = Extract> extends IteratorElementResponse ? CelCtx : never; /** * The `visibility` option of a page or iterator: one CEL expression per target element. `V` is * the inferred (const) type of the object written by the author, so each string literal can be * checked by the type-level CEL parser and replaced by its error message when invalid; the error * then lands on that property. "Is set" is spelled `inputs.x != null && inputs.x != ""` for text * fields and `inputs.x != null && size(inputs.x) > 0` for lists. */ type VisibilityInput = { [K in keyof V]: K extends VisibilityTargets ? V[K] extends string ? CelExpression> : `Visibility rules are CEL strings, e.g. "inputs.hasDiscount == true"` : `Unknown visibility target '${K & string}'`; }; type ElementDataType$6 = string | number | boolean | Date; type UiElementSelectOne = (name: N, options?: BaseInputConfig & { options: ({ label: string; value: TValue; } | TValue)[]; }) => InputElementResponse; interface UiElementSelectOneApiResponse extends BaseUiInputResponse<"ui.select.one", ElementDataType$6> { options: ({ label: string; value: ElementDataType$6; } | ElementDataType$6)[]; } type ElementDataType$5 = string; type UiElementInputText = InputElement; interface UiElementInputTextApiResponse extends BaseUiInputResponse<"ui.input.text", ElementDataType$5> { placeholder?: string; multiline?: boolean; maxLength?: number; minLength?: number; } type ElementDataType$4 = number; type UiElementInputNumber = InputElement; interface UiElementInputNumberApiResponse extends BaseUiInputResponse<"ui.input.number", ElementDataType$4> { placeholder?: string; min?: number; max?: number; } type ElementDataType$3 = boolean; type UiElementInputBoolean = InputElement; interface UiElementInputBooleanApiResponse extends BaseUiInputResponse<"ui.input.boolean", ElementDataType$3> { mode: "checkbox" | "switch"; } type ElementDataType$2 = string; /** * Defines what type of datepicker should we use. * @default "dateTime" */ type DatePickerMode = /** Pick both a date and a time */ "dateTime" /** Pick only a date */ | "date"; type UiElementInputDatePicker = InputElement; interface UiElementInputDatePickerApiResponse extends BaseUiInputResponse<"ui.input.datePicker", ElementDataType$2> { mode?: DatePickerMode; min?: string; max?: string; } type ElementDataType$1 = Partial; type UiElementInputFile = InputElement; interface UiElementInputFileApiResponse extends BaseUiInputResponse<"ui.input.file", ElementDataType$1> { } /** * Data posted by the client for a single image capture entry. * `file` carries the upload metadata (the bytes go via the presigned URL). */ type ImageCaptureValue = { file: Partial; caption?: string; }; /** * Hydrated entry handed to the flow function: `file` becomes a real File * instance (via transformRichDataTypes). */ type ImageCaptureResult = { file: File; caption?: string; }; type ImageCaptureMode = "single" | "multi"; type ImageCaptureCaptionMode = "disabled" | "optional" | "required"; type ImageCaptureValueFor = M extends "multi" ? ImageCaptureValue[] : ImageCaptureValue; type ImageCaptureResultFor = M extends "multi" ? ImageCaptureResult[] : ImageCaptureResult; type SharedOptions = { /** Controls whether captions are disabled, optional, or required. Defaults to "optional". */ caption?: ImageCaptureCaptionMode; }; type ImageCaptureOptions = SharedOptions & { /** The mode of the image capture input. Defaults to "single". */ mode?: M; } & (M extends "multi" ? { /** Maximum number of photos the user can capture. */ max?: number; /** Minimum number of photos the user must capture. */ min?: number; } : {}); type UiElementInputImageCapture = (name: N, options?: BaseInputConfig> & ImageCaptureOptions) => InputElementResponse, ImageCaptureResultFor>; interface UiElementInputImageCaptureApiResponse extends BaseUiInputResponse<"ui.input.imageCapture", ImageCaptureValue | ImageCaptureValue[]> { mode: ImageCaptureMode; caption: ImageCaptureCaptionMode; /** Multi mode only: maximum number of photos. */ max?: number; /** Multi mode only: minimum number of photos. */ min?: number; } type ElementDataType = { svg: string; signedAt: string; }; declare class Signature { readonly svg: string; readonly signedAt: string; constructor(data: ElementDataType); toPngDataURL(): Promise; } type UiElementInputSignature = InputElement; interface UiElementInputSignatureApiResponse extends BaseUiInputResponse<"ui.input.signature", ElementDataType> { } type UiElementMarkdown = DisplayElement<{ content: string; }>; interface UiElementMarkdownApiResponse extends BaseUiDisplayResponse<"ui.display.markdown"> { content: string; } type TableData> = { data: T[]; columns?: Array>; }; type UiElementTable = , K extends string = never>(options: TableData & DisplayElementConfig) => DisplayElementResponse; type TableColumn = { name: string; index: number; }; interface UiElementTableApiResponse extends BaseUiDisplayResponse<"ui.display.table"> { data: any[]; columns: TableColumn[]; } type UiElementDivider = DisplayElement<{}>; interface UiElementDividerApiResponse extends BaseUiDisplayResponse<"ui.display.divider"> { } type PageOptions = { stage?: ExtractStageKeys; title?: string; description?: string; content: T; /** * Show elements only while a CEL expression over the page's other inputs holds, e.g. * `{ discountCode: "inputs.hasDiscount == true" }`. Keys are input and iterator names and display * element `key`s. Expressions are checked against the page's inputs as you type. Hidden inputs * are not validated and are absent from the result. */ visibility?: VisibilityInput; validate?: ValidateFn>; actions?: A; allowBack?: boolean; fullWidth?: boolean; }; type UiPage = (name: string, options: PageOptions) => Promise : { data: ExtractFormData; action: ActionValue; }>; type PageActions = string | PageActionConfig; type PageActionConfig = { label: string; value: string; mode?: "primary" | "secondary" | "destructive"; /** * Keyboard shortcut for this action. * * @example * // Single key * hotkey: "1" * hotkey: "enter" * hotkey: "space" * hotkey: "F1" * * * // With modifier: * // shift, alt + mod (cmd on macOS, ctrl on Windows/Linux) * * hotkey: "mod+s" // cmd+s on macOS, ctrl+s on Windows/Linux * hotkey: "mod+shift+enter" // cmd+shift+enter on macOS, ctrl+shift+enter on Windows/Linux * * // With behavior control * hotkey: { * key: "mod+enter", * behaviour: "includeForms" // Trigger even when focused on form elements * } */ hotkey?: string | HotkeyConfig; }; type HotkeyConfig = { key: string; /** If the hotkey should be triggered when the user is on a form element or not * * @default "excludeForms" */ behaviour?: "includeForms" | "excludeForms"; }; type ActionValue = T extends string ? T : T extends { value: infer V; } ? V : never; type ExtractFormData

{ /** snake_case identifier the model sees. */ name: string; description: string; /** Extra guidance on when/how to use the tool, appended to the description. */ usage?: string; /** Standard Schema (Zod v4) for the tool's arguments. */ parameters: StandardSchemaV1; /** true = always gate behind a UI approval step; predicate = gate when it returns true. */ approval?: boolean | ((args: P) => boolean); execute: (args: P) => Promise; } declare function defineTool$1

(config: ToolDefinition$1

): Readonly>; interface AgentConfig$1 { /** Unique agent name; used to namespace checkpointed steps. */ name: string; model: string; instructions: string; tools?: ReadonlyArray; /** Sealed prompt template — callers pass inputs, never a raw prompt. */ prompt: (args: { inputs: I; context: Record; }) => string; /** Result contract. Omit for free-text agents (run resolves to final assistant text). */ result?: StandardSchemaV1; /** Max LLM turns before the run fails. Default 10. */ maxTurns?: number; /** * Pre-run hook; the object it returns merges into the prompt template context. * Like the agent body, this runs again on every orchestrator replay, so any * side effects must be wrapped in `ctx.step(...)` to stay idempotent (see the * `beforeRun` test, which loads its value through a checkpointed step). */ beforeRun?: (ctx: any, args: { inputs: I; }) => Promise | void>; /** * Post-run hook, called with the final result once the agent completes. Like * `beforeRun` it runs again on every orchestrator replay, so any side effects * (writes, notifications) must be wrapped in `ctx.step(...)` to stay * idempotent — an un-checkpointed write here repeats on each replay. */ afterRun?: (ctx: any, result: R | string) => Promise; } interface Agent$1 { readonly name: string; readonly config: AgentConfig$1; run(ctx: any, inputs: I): Promise; } declare function defineAgent$1(config: AgentConfig$1): Agent$1; type ai_BooleanAnswer = BooleanAnswer; type ai_BooleanQuestion = BooleanQuestion; type ai_ChoiceAnswer = ChoiceAnswer; type ai_ChoiceQuestion = ChoiceQuestion; type ai_DateAnswer = DateAnswer; type ai_DateField = DateField; type ai_DecideAnswer = DecideAnswer; type ai_DecideAnswers> = DecideAnswers; type ai_DecideOptions> = DecideOptions; type ai_DecideQuestion = DecideQuestion; type ai_DecideRequest = DecideRequest; type ai_DecideResult = DecideResult; type ai_DecideValue = DecideValue; type ai_DecisionEngine = DecisionEngine; type ai_DurationAnswer = DurationAnswer; type ai_DurationField = DurationField; type ai_EstimateAnswer = EstimateAnswer; type ai_EstimateField = EstimateField; type ai_ExtractAnswer = ExtractAnswer; type ai_ExtractAnswerFor = ExtractAnswerFor; type ai_ExtractAnswers> = ExtractAnswers; type ai_ExtractField = ExtractField; type ai_ExtractImage = ExtractImage; type ai_ExtractOptions> = ExtractOptions; type ai_ExtractRequest = ExtractRequest; type ai_ExtractResult = ExtractResult; type ai_ExtractionEngine = ExtractionEngine; type ai_GenerateOptions = GenerateOptions; type ai_ListAnswer = ListAnswer; type ai_ListField = ListField; type ai_NumberAnswer = NumberAnswer; type ai_NumberField = NumberField; type ai_ScoreAnswer = ScoreAnswer; type ai_ScoreQuestion = ScoreQuestion; type ai_TextAnswer = TextAnswer; type ai_TextField = TextField; declare const ai_decide: typeof decide; declare const ai_extract: typeof extract; declare const ai_generate: typeof generate; declare namespace ai { export { type Agent$1 as Agent, type AgentConfig$1 as AgentConfig, type AgentMessage$1 as AgentMessage, type ai_BooleanAnswer as BooleanAnswer, type ai_BooleanQuestion as BooleanQuestion, type ai_ChoiceAnswer as ChoiceAnswer, type ai_ChoiceQuestion as ChoiceQuestion, type ai_DateAnswer as DateAnswer, type ai_DateField as DateField, type ai_DecideAnswer as DecideAnswer, type ai_DecideAnswers as DecideAnswers, type ai_DecideOptions as DecideOptions, type ai_DecideQuestion as DecideQuestion, type ai_DecideRequest as DecideRequest, type ai_DecideResult as DecideResult, type ai_DecideValue as DecideValue, type ai_DecisionEngine as DecisionEngine, type ai_DurationAnswer as DurationAnswer, type ai_DurationField as DurationField, type ai_EstimateAnswer as EstimateAnswer, type ai_EstimateField as EstimateField, type ai_ExtractAnswer as ExtractAnswer, type ai_ExtractAnswerFor as ExtractAnswerFor, type ai_ExtractAnswers as ExtractAnswers, type ai_ExtractField as ExtractField, type ai_ExtractImage as ExtractImage, type ai_ExtractOptions as ExtractOptions, type ai_ExtractRequest as ExtractRequest, type ai_ExtractResult as ExtractResult, type ai_ExtractionEngine as ExtractionEngine, type ai_GenerateOptions as GenerateOptions, type ai_ListAnswer as ListAnswer, type ai_ListField as ListField, type ai_NumberAnswer as NumberAnswer, type ai_NumberField as NumberField, type ai_ScoreAnswer as ScoreAnswer, type ai_ScoreQuestion as ScoreQuestion, type ai_TextAnswer as TextAnswer, type ai_TextField as TextField, type ToolDefinition$1 as ToolDefinition, type TurnEngine$1 as TurnEngine, type TurnRequest$1 as TurnRequest, type TurnResult$1 as TurnResult, ai_decide as decide, defineAgent$1 as defineAgent, defineTool$1 as defineTool, ai_extract as extract, ai_generate as generate }; } type testing_ScriptedDecisionEngine = ScriptedDecisionEngine; declare const testing_ScriptedDecisionEngine: typeof ScriptedDecisionEngine; type testing_ScriptedExtractionEngine = ScriptedExtractionEngine; declare const testing_ScriptedExtractionEngine: typeof ScriptedExtractionEngine; declare namespace testing { export { testing_ScriptedDecisionEngine as ScriptedDecisionEngine, ScriptedEngine$1 as ScriptedEngine, testing_ScriptedExtractionEngine as ScriptedExtractionEngine, scriptedTurn$1 as scriptedTurn }; } interface AiSdkEngineOptions { /** Standard API key (sk-ant-api...), sent as x-api-key. */ apiKey?: string; /** Bearer token (sk-ant-oat... OAuth tokens), sent as Authorization: Bearer * together with the anthropic-beta oauth header. */ authToken?: string; /** Scoped bearer token minted by the Keel runtime for the platform AI proxy, * sent as Authorization: Bearer. Unlike authToken, NO anthropic-beta oauth * header is attached — the proxy fronts the standard Messages API. */ proxyToken?: string; /** Override the provider base URL (e.g. the platform AI proxy). Must end in * /v1 — the provider appends /messages verbatim. */ baseURL?: string; /** Extra headers merged into every request (e.g. x-keel-flow-run-id and * x-keel-flow-name for usage attribution at the platform AI proxy). Also * acts as the signal that per-call attribution headers (x-keel-flow-step) * should be sent — it is only ever set on the proxy path. */ headers?: Record; } /** Reference TurnEngine over the Vercel AI SDK. One turn per call: tools are * declared WITHOUT execute functions, so generateText returns tool calls * without running them or looping. */ declare class AiSdkEngine$1 implements TurnEngine$1 { private opts; constructor(opts: AiSdkEngineOptions); resolveModel(model: string): LanguageModel; turn(req: TurnRequest$1): Promise; } /** @deprecated Use `experimental.ai.generate`. */ declare const LlmFlowStep: typeof generate; /** @deprecated Use `experimental.ai.GenerateOptions`. */ type LlmOptions = GenerateOptions; /** @deprecated Use `experimental.ai.defineAgent`. */ declare const defineAgent: typeof defineAgent$1; /** @deprecated Use `experimental.ai.Agent`. */ type Agent = Agent$1; /** @deprecated Use `experimental.ai.AgentConfig`. */ type AgentConfig = AgentConfig$1; /** @deprecated Use `experimental.ai.defineTool`. */ declare const defineTool: typeof defineTool$1; /** @deprecated Use `experimental.ai.ToolDefinition`. */ type ToolDefinition

= ToolDefinition$1

; /** @deprecated Use `experimental.ai.TurnEngine`. */ type TurnEngine = TurnEngine$1; /** @deprecated Use `experimental.ai.TurnRequest`. */ type TurnRequest = TurnRequest$1; /** @deprecated Use `experimental.ai.TurnResult`. */ type TurnResult = TurnResult$1; /** @deprecated Use `experimental.ai.AgentMessage`. */ type AgentMessage = AgentMessage$1; /** @deprecated Use `experimental.testing.ScriptedEngine`. */ declare const ScriptedEngine: typeof ScriptedEngine$1; /** @deprecated Use `experimental.testing.ScriptedEngine`. */ type ScriptedEngine = ScriptedEngine$1; /** @deprecated Use `experimental.testing.scriptedTurn`. */ declare const scriptedTurn: { text(text: string): TurnResult$1; toolCall(name: string, args: Record, id?: string): TurnResult$1; }; /** @deprecated The engine is chosen by the runtime; flows don't construct it. */ declare const AiSdkEngine: typeof AiSdkEngine$1; /** @deprecated The engine is chosen by the runtime; flows don't construct it. */ type AiSdkEngine = AiSdkEngine$1; type index_Agent = Agent; type index_AgentConfig = AgentConfig; type index_AgentMessage = AgentMessage; type index_AiSdkEngine = AiSdkEngine; declare const index_LlmFlowStep: typeof LlmFlowStep; type index_LlmOptions = LlmOptions; type index_ScriptedEngine = ScriptedEngine; type index_ToolDefinition

= ToolDefinition

; type index_TurnEngine = TurnEngine; type index_TurnRequest = TurnRequest; type index_TurnResult = TurnResult; declare const index_ai: typeof ai; declare const index_defineAgent: typeof defineAgent; declare const index_defineTool: typeof defineTool; declare const index_scriptedTurn: typeof scriptedTurn; declare const index_testing: typeof testing; declare namespace index { export { type index_Agent as Agent, type index_AgentConfig as AgentConfig, type index_AgentMessage as AgentMessage, type index_AiSdkEngine as AiSdkEngine, index_LlmFlowStep as LlmFlowStep, type index_LlmOptions as LlmOptions, type index_ScriptedEngine as ScriptedEngine, type index_ToolDefinition as ToolDefinition, type index_TurnEngine as TurnEngine, type index_TurnRequest as TurnRequest, type index_TurnResult as TurnResult, index_ai as ai, index_defineAgent as defineAgent, index_defineTool as defineTool, index_scriptedTurn as scriptedTurn, index_testing as testing }; } declare const createTraceAPI: typeof createTraceAPI$1; declare function ksuid(): string; declare const notify: NotifyApi; type IDWhereCondition = { equals?: string | null; notEquals?: string | null; oneOf?: string[] | null; }; type StringWhereCondition = { startsWith?: string | null; endsWith?: string | null; oneOf?: string[] | null; contains?: string | null; equals?: string | null; notEquals?: string | null; }; type BooleanWhereCondition = { equals?: boolean | null; notEquals?: boolean | null; }; type NumberWhereCondition = { greaterThan?: number | null; greaterThanOrEquals?: number | null; lessThan?: number | null; lessThanOrEquals?: number | null; equals?: number | null; notEquals?: number | null; }; type DurationWhereCondition = { greaterThan?: DurationString | null; greaterThanOrEquals?: DurationString | null; lessThan?: DurationString | null; lessThanOrEquals?: DurationString | null; equals?: DurationString | null; notEquals?: DurationString | null; }; type DateWhereCondition = { equals?: Date | string | null; equalsRelative?: RelativeDateString | null; before?: Date | string | null; beforeRelative?: RelativeDateString | null; onOrBefore?: Date | string | null; after?: Date | string | null; afterRelative?: RelativeDateString | null; onOrAfter?: Date | string | null; }; type DateQueryInput = { equals?: string | null; before?: string | null; onOrBefore?: string | null; after?: string | null; onOrAfter?: string | null; }; type TimestampQueryInput = { before?: string | null; onOrBefore?: string | null; after?: string | null; onOrAfter?: string | null; equalsRelative?: RelativeDateString | null; beforeRelative?: RelativeDateString | null; afterRelative?: RelativeDateString | null; }; type StringArrayWhereCondition = { equals?: string[] | null; notEquals?: string[] | null; any?: StringArrayQueryWhereCondition | null; all?: StringArrayQueryWhereCondition | null; }; type StringArrayQueryWhereCondition = { equals?: string | null; notEquals?: string | null; }; type NumberArrayWhereCondition = { equals?: number[] | null; notEquals?: number[] | null; any?: NumberArrayQueryWhereCondition | null; all?: NumberArrayQueryWhereCondition | null; }; type NumberArrayQueryWhereCondition = { greaterThan?: number | null; greaterThanOrEquals?: number | null; lessThan?: number | null; lessThanOrEquals?: number | null; equals?: number | null; notEquals?: number | null; }; type BooleanArrayWhereCondition = { equals?: boolean[] | null; notEquals?: boolean[] | null; any?: BooleanArrayQueryWhereCondition | null; all?: BooleanArrayQueryWhereCondition | null; }; type BooleanArrayQueryWhereCondition = { equals?: boolean | null; notEquals?: boolean | null; }; type DateArrayWhereCondition = { equals?: Date[] | null; notEquals?: Date[] | null; any?: DateArrayQueryWhereCondition | null; all?: DateArrayQueryWhereCondition | null; }; type DateArrayQueryWhereCondition = { greaterThan?: Date | null; greaterThanOrEquals?: Date | null; lessThan?: Date | null; lessThanOrEquals?: number | null; equals?: Date | null; notEquals?: Date | null; }; type ContextAPI = { headers: RequestHeaders; response: Response; isAuthenticated: boolean; trace: TraceAPI; now(): Date; }; type Response = { headers: Headers; status?: number; }; type PageInfo = { startCursor: string; endCursor: string; totalCount: number; hasNextPage: boolean; count: number; pageNumber?: number; }; /** * Partial PageInfo for manual pagination - all fields optional with sensible defaults. * - count: defaults to results.length * - totalCount: defaults to results.length * - hasNextPage: defaults to false * - startCursor: defaults to first result's id or "" * - endCursor: defaults to last result's id or "" * - pageNumber: optional, no default */ type PartialPageInfo = { startCursor?: string; endCursor?: string; totalCount?: number; hasNextPage?: boolean; count?: number; pageNumber?: number; }; /** * Result type for list operations with pagination info. * Used when returning manually paginated results from beforeQuery or afterQuery hooks. */ type ListResult = { results: Array; pageInfo: PartialPageInfo; }; type SortDirection = "asc" | "desc" | "ASC" | "DESC"; declare class NotFoundError extends Error { } declare class BadRequestError$1 extends Error { } declare class UnknownError$1 extends Error { } type Errors = { /** * Returns a 404 HTTP status with an optional message. * This error indicates that the requested resource could not be found. */ NotFound: typeof NotFoundError; /** * Returns a 400 HTTP status with an optional message. * This error indicates that the request made by the client is invalid or malformed. */ BadRequest: typeof BadRequestError$1; /** * Returns a 500 HTTP status with an optional message. * This error indicates that an unexpected condition was encountered, preventing the server from fulfilling the request. */ Unknown: typeof UnknownError$1; }; type FunctionConfig = { /** * All DB calls within the function will be executed within a transaction. * The transaction is rolled back if the function throws an error. */ dbTransaction?: boolean; }; type FuncWithConfig = T & { config: FunctionConfig; }; type unit = "year" | "years" | "month" | "months" | "day" | "days" | "hour" | "hours" | "minute" | "minutes" | "second" | "seconds"; type direction = "next" | "last"; type completed = "complete"; type value = number; type RelativeDateString = "now" | "today" | "tomorrow" | "yesterday" | `this ${unit}` | `${direction} ${unit}` | `${direction} ${value} ${unit}` | `${direction} ${value} ${completed} ${unit}`; type dateDuration = `${number}Y${number}M${number}D` | `${number}Y${number}M` | `${number}Y${number}D` | `${number}M${number}D` | `${number}Y` | `${number}M` | `${number}D`; type timeDuration = `${number}H${number}M${number}S` | `${number}H${number}M` | `${number}M${number}S` | `${number}H${number}S` | `${number}H` | `${number}M` | `${number}S`; type DurationString = `P${dateDuration}T${timeDuration}` | `P${dateDuration}` | `PT${timeDuration}`; type TaskStatus = "NEW" | "ASSIGNED" | "STARTED" | "COMPLETED" | "CANCELLED" | "DEFERRED"; type Task = { id: string; topic: string; status: TaskStatus; deferredUntil?: Date; createdAt: Date; updatedAt: Date; assignedToUserId?: string; assignedToTeam?: string; assignedAt?: Date; resolvedAt?: Date; flowRunId?: string; }; type TaskCreateOptions = { deferredUntil?: Date; }; type FlowRunStatus = "PENDING" | "RUNNING" | "COMPLETED" | "FAILED" | "CANCELLED"; type FlowRunStep = { id: string; name?: string; status?: string; data?: any; }; type FlowRun = { id: string; name: string; status: FlowRunStatus; inputs?: any; outputs?: any; steps?: FlowRunStep[]; pendingStep?: FlowRunStep; createdAt?: Date; updatedAt?: Date; completedAt?: Date; }; type FlowListOptions = { limit?: number; offset?: number; }; type FlowListResult = { results: FlowRun[]; pageInfo: { totalCount: number; hasNextPage: boolean; }; }; type SignedLinkOptions = { inputs?: Inputs; expiresAt?: Date; reusable?: boolean; }; type SignedLinkStatus = "active" | "revoked" | "expired"; type SignedLinkRecord = { id: string; flowName: string; inputs: Record | null; reusable: boolean; createdBy: string | null; expiresAt: Date | null; usedCount: number; revokedAt: Date | null; createdAt: Date; updatedAt: Date; status: SignedLinkStatus; url?: string; }; type ListSignedLinksOptions = { status?: SignedLinkStatus; }; type ListSignedLinksResult = { results: SignedLinkRecord[]; }; type SignedLinksAPI = { create(options?: SignedLinkOptions): Promise; list(options?: ListSignedLinksOptions): Promise; revoke(linkId: string): Promise; }; export { ACTION_ERROR_CODES, ActionError, type ActionErrorCode, type ActionInputs, type ActionLedgerAmountGuardError, type ActionLedgerBalanceGuardError, type ActionLedgerErrorData, type ActionLedgerGuardErrorData, type ActionLedgerGuardKind, type ActionLedgerRelatedRowGuardError, type ActionPaths, type ActionValidationErrorData, ActionsAPI, type AnyToolInputs, type BooleanArrayQueryWhereCondition, type BooleanArrayWhereCondition, type BooleanWhereCondition, type ColumnBooleanFormat, type ColumnFormat, type ColumnNumberColor, type ColumnNumberFormat, type ColumnTextFormat, type ColumnValueFormat, type ContextAPI, type ContinueOptions, type DataGridOption, type DataGridSummaryBlock, type DataGridSummaryItem, type DataGridTotal, type DataGridTotals, type DateArrayQueryWhereCondition, type DateArrayWhereCondition, type DateQueryInput, type DateWhereCondition, Duration, type DurationString, type DurationWhereCondition, type EmailContent, type EmailDetail, type EmailInput, type EmailRecipientGroup, type EmailRecipients, ErrorPresets, type Errors, type ExtractStageKeys, File, type FlowConfig, type FlowConfigAPI, type FlowContext, type FlowDefinition, type FlowExternalAccessConfig, type FlowFunction, type FlowListOptions, type FlowListResult, type FlowResult, type FlowRun, type FlowRunStatus, type FlowRunStep, FlowsAPI, type FuncWithConfig, type FunctionConfig, type Hardware, type IDWhereCondition, type IngestItem, InlineFile, type IntegrationServer, type ListArgs, type ListResult, type ListSignedLinksOptions, type ListSignedLinksResult, ModelAPI, type ModuleExportsContext, type ModuleExportsFactory, NonRetriableError, type NotifyApi, type NullableHardware, type NumberArrayQueryWhereCondition, type NumberArrayWhereCondition, type NumberWhereCondition, PERMISSION_STATE, type PageInfo, type PartialPageInfo, Permissions, type Printer, type ProgressHandle, type ProgressPatch, type RateLimitConfig, type RecipientIdentity, type RecipientUser, type ReconcileArgs, type ReconcilePage, type RecordSource, type RecordState, type RedirectConfig, type RelativeDateString, RequestHeaders, type Response, RetryBackoffExponential, RetryBackoffLinear, RetryConstant, STEP_STATUS, STEP_TYPE, Signature, type SignedLinkOptions, type SignedLinkRecord, type SignedLinkStatus, type SignedLinksAPI, type SortDirection, type Step, type StepProgress, type StringArrayQueryWhereCondition, type StringArrayWhereCondition, type StringWhereCondition, type SyncDefinition, type SyncEngineHooks, type SyncEngineInternals, type SyncEngineOptions, type SyncEntityDeclaration, type SyncIngestOptions, type SyncIngestResult, type SyncModuleRef, type SyncPage, type SyncRecord, type SyncRecordOptions, type SyncStrategy, type SyncUpsertModel, type Task, TaskAPI, type TaskCreateOptions, type TaskFlowFunction, type TaskStatus, type TimelineGranularity, type TimelineItem, type TimelineItemInput, type TimelineRow, type TimestampQueryInput, type ToolAccessor, type ToolRef, type TraceAPI, type TraceAttributeValue, type TraceAttributes, type UI, type UIApiResponses, UnionAPI, type VisibilityExpression, buildModuleAPI, checkBuiltInPermissions, createChildRun, createFlowContext, createIntegrationServer, createNotifier, createToolsAPI, createTraceAPI, defineModuleExports, defineSync, index as experimental, handleFlow, handleJob, handleRequest, handleRoute, handleSubscriber, insertNewStep, isActionError, ksuid, log, notify, parseCadenceMs, registerModuleExports, runSync, runWithStatementTimeout, syncIngest, syncRecord, syncUpsert, tracing, useDatabase };