import { FlowcoreClient } from "@flowcore/sdk"; import type { Logger } from "./logger.js"; export type ProvisionFailureMode = "throw" | "continue"; export interface ProvisionFailureConfig { /** * How to handle unexpected lookup/list failures. These are treated as * possible Flowcore outages by default, logged, and skipped so startup can continue. */ check?: ProvisionFailureMode; /** * How to handle expected provisioning failures after a real not-found path * or create/update failures. Defaults to fail loud. */ apply?: ProvisionFailureMode; } /** * Registration metadata for a single pathway, used by the provisioner */ export interface ProvisionerRegistration { flowType: string; eventType: string; flowTypeDescription?: string; eventTypeDescription?: string; } /** * Options for creating a PathwayProvisioner */ export interface PathwayProvisionerOptions { tenant: string; dataCore: string; apiKey: string; dataCoreDescription?: string; dataCoreAccessControl: string; dataCoreDeleteProtection: boolean; registrations: ProvisionerRegistration[]; logger?: Logger; /** Override FlowcoreClient for testing */ clientFactory?: (apiKey: string) => FlowcoreClient; /** * Skip data core create/update — still resolves the data core id via fetch so * downstream stages can run. Fails loudly if the data core doesn't exist and * no description was configured (same error as the non-skip path). */ skipDataCore?: boolean; /** * Skip flow type create/update. When event types are still provisioned, flow * type ids are resolved via `FlowTypeListCommand` (read-only). When event * types are skipped too, the flow type list fetch is skipped entirely. */ skipFlowTypes?: boolean; /** Skip the event type loop entirely (no list/fetch/create/update). */ skipEventTypes?: boolean; /** * Controls whether provisioning failures throw or are only logged. * * Defaults: * - `check`: `"continue"` for unexpected lookup/list failures, treated as possible outages. * - `apply`: `"throw"` for missing resources without descriptions and create/update failures. * * Passing `"throw"` or `"continue"` applies that mode to both categories. */ provisionFailure?: ProvisionFailureMode | ProvisionFailureConfig; } /** * Provisions Flowcore infrastructure (data core, flow types, event types). * Creates missing resources when descriptions are provided, updates descriptions * when they differ. Fails if a resource is missing and no description is provided. * Additive only — never deletes. */ export declare class PathwayProvisioner { private readonly tenant; private readonly dataCore; private readonly apiKey; private readonly dataCoreDescription?; private readonly dataCoreAccessControl; private readonly dataCoreDeleteProtection; private readonly registrations; private readonly logger; private readonly clientFactory; private readonly skipDataCore; private readonly skipFlowTypes; private readonly skipEventTypes; private readonly provisionFailure; constructor(options: PathwayProvisionerOptions); /** * Run the provisioning flow: * 1. Fetch tenant → tenantId * 2. Fetch or create data core (read-only when `skipDataCore` is set) * 3. For each unique flow type: fetch or create (read-only when `skipFlowTypes`) * 4. For each event type: fetch or create (entirely skipped when `skipEventTypes`) * 5. Update descriptions where they differ (unless skipped) */ provision(): Promise; private provisionDataCore; private provisionFlowTypes; private provisionEventTypes; private check; private apply; private handleCheckFailure; private handleApplyFailure; private logFailure; } //# sourceMappingURL=provisioner.d.ts.map