import type { SchemaObject } from 'openapi3-ts/oas31'; import type { EventBridgeCapabilities } from '../core/EventBridge/types/EventBridgeCapabilities.js'; import type { QueueBridgeCapabilities } from '../core/QueueBridge/types/QueueBridgeCapabilities.js'; import type { CustomMessage } from '../core/types/CustomMessage.js'; import type { ScheduleDefinition } from '../core/types/schedule/index.js'; import type { FullDefinition } from './types/FullDefinition.js'; import type { FullServiceDefinition } from './types/FullServiceDefinition.js'; /** * JSON object shape used by provider export helpers for provider-native * manifest fragments. * * @example * ```ts * const annotations: JsonRecord = { 'purista.dev/source': 'billing' } * ``` */ export type JsonRecord = Record; export type ServiceContractInput = FullDefinition | FullServiceDefinition; export type ExportAsyncApiOptions = { title: string; version: string; services: ServiceContractInput; }; export type ExportScheduleManifestOptions = { title?: string; version: string; services: ServiceContractInput; }; export type ScheduleManifest = { title?: string; version: string; schedules: KubernetesCronJobScheduleInput[]; }; export type KubernetesCronJobScheduleInput = { name: string; description?: string; targetKind: string; targetServiceName?: string; targetServiceVersion?: string; targetName: string; payloadSchema?: SchemaObject; parameterSchema?: SchemaObject; expression: ScheduleDefinition['expression']; timezone?: string; concurrencyPolicy?: ScheduleDefinition['concurrencyPolicy']; missedRunPolicy?: ScheduleDefinition['missedRunPolicy']; maxCatchUpCount?: number; jitterWindowMs?: number; idempotencyKey?: string; enabledByDefault?: boolean; providerHints?: Record; }; export type KubernetesCronJobTriggerTemplate = { image: string; name?: string; command?: string[]; args?: string[]; http?: { method?: string; url: string; headers?: Record; body?: unknown; }; env?: JsonRecord[]; envFrom?: JsonRecord[]; imagePullPolicy?: string; }; export type ExportKubernetesCronJobsOptions = { services?: ServiceContractInput; manifest?: ScheduleManifest; trigger: KubernetesCronJobTriggerTemplate; namespace?: string; labels?: Record; annotations?: Record; restartPolicy?: 'Never' | 'OnFailure'; }; export type KubernetesCronJobManifest = { apiVersion: 'batch/v1'; kind: 'CronJob'; metadata: { name: string; namespace?: string; labels?: Record; annotations: Record; }; spec: JsonRecord & { schedule: string; timeZone?: string; concurrencyPolicy?: 'Allow' | 'Forbid' | 'Replace'; suspend?: boolean; jobTemplate: { spec: { template: { spec: { restartPolicy: 'Never' | 'OnFailure'; containers: JsonRecord[]; }; }; }; }; }; }; export type RuntimeBridgeCapabilities = { name: string; capabilities?: TCapabilities; }; export type RuntimeCapabilityReportMode = 'definition-only' | 'runtime-inspect'; export type ExportRuntimeCapabilitiesOptions = { mode?: RuntimeCapabilityReportMode; eventBridge?: RuntimeBridgeCapabilities; queueBridge?: RuntimeBridgeCapabilities; }; export type CloudEvent = { specversion: '1.0'; id: string; source: string; type: string; time?: string; datacontenttype?: string; data?: unknown; [key: string]: unknown; }; export type FromCloudEventOptions = { mode: 'strict' | 'compat'; }; /** * Export service definitions as a provider-neutral AsyncAPI 3 document. * * The helper only reads PURISTA definitions and never starts services, brokers, * HTTP servers, or cloud adapters. * * @example * ```ts * const document = await exportAsyncApi({ * title: 'Billing contracts', * version: '1.0.0', * services: exportedDefinitions, * }) * ``` */ export declare const exportAsyncApi: (options: ExportAsyncApiOptions) => Promise<{ asyncapi: string; info: { title: string; version: string; }; defaultContentType: string; channels: JsonRecord; operations: JsonRecord; components: { messages: JsonRecord; schemas: { PuristaHeaders: { type: string; properties: { traceId: { type: string; }; correlationId: { type: string; }; tenantId: { type: string; }; principalId: { type: string; }; messageId: { type: string; }; timestamp: { type: string; }; contentType: { type: string; }; contentEncoding: { type: string; }; }; }; }; }; 'x-purista': { version: string; }; }>; /** * Export provider-neutral schedule metadata from service definitions. * * @example * ```ts * const manifest = await exportScheduleManifest({ * title: 'Billing schedules', * version: '1.0.0', * services: exportedDefinitions, * }) * ``` */ export declare const exportScheduleManifest: (options: ExportScheduleManifestOptions) => Promise; /** * Export cron-based PURISTA schedule metadata as Kubernetes `batch/v1` * `CronJob` manifest objects. * * The exporter is a pure JSON manifest generator. It requires the caller to * supply the trigger container image and command/args or HTTP request template; * it never invents URLs, images, credentials, namespaces, service accounts, or * cluster policy. * * @example * ```ts * const cronJobs = await exportKubernetesCronJobs({ * services: exportedDefinitions, * trigger: { * image: 'registry.example.com/purista-trigger:1.0.0', * command: ['/app/trigger'], * args: ['--kind', '{{targetKind}}', '--target', '{{targetName}}'], * }, * }) * ``` */ export declare const exportKubernetesCronJobs: (options: ExportKubernetesCronJobsOptions) => Promise; /** * Export a normalized runtime capability report from bridge declarations. * * Definition-only mode is pure data transformation. Runtime inspection can pass * already-instantiated adapter capability objects without requiring this helper * to connect to infrastructure. */ export declare const exportRuntimeCapabilities: (options: ExportRuntimeCapabilitiesOptions) => { version: string; mode: RuntimeCapabilityReportMode; eventBridge: { name: string; capabilities: EventBridgeCapabilities | undefined; } | undefined; queueBridge: { name: string; capabilities: QueueBridgeCapabilities | undefined; longRunning: { leaseExtension: boolean; leaseInspection: boolean; strictStartupValidation: boolean; } | undefined; idempotency: { enforced: boolean; exactlyOnce: boolean; } | undefined; resultPolicies: { event: boolean; state: boolean; stateAndEvent: boolean; } | undefined; } | undefined; }; /** * Convert a PURISTA custom event message to a CloudEvents 1.0 structured object. * * @example * ```ts * const event = toCloudEvent(puristaMessage) * ``` */ export declare const toCloudEvent: (message: CustomMessage) => CloudEvent; /** * Convert a CloudEvents 1.0 object into a PURISTA custom event message. * * Strict mode requires PURISTA sender extension metadata. Compat mode accepts * external CloudEvents and derives explicit external sender defaults. */ export declare const fromCloudEvent: (cloudEvent: CloudEvent | JsonRecord, options: FromCloudEventOptions) => CustomMessage; export declare const exportCloudEventsSchema: () => { $schema: string; title: string; type: string; required: string[]; properties: { specversion: { const: string; }; id: { type: string; }; source: { type: string; }; type: { type: string; }; time: { type: string; format: string; }; datacontenttype: { type: string; }; data: boolean; serviceName: { type: string; }; serviceVersion: { type: string; }; serviceTarget: { type: string; }; instanceId: { type: string; }; traceid: { type: string; }; correlationid: { type: string; }; tenantid: { type: string; }; principalid: { type: string; }; contentencoding: { type: string; }; }; }; //# sourceMappingURL=enterpriseInterop.d.ts.map