import { Dictionary } from 'ts-essentials'; import { AirbyteConfig, AirbyteInputState, AirbyteLegacyStateOutput, AirbyteOutputState, AirbyteSpec, AirbyteStreamStateOutput, CompressedData } from './protocol'; export declare const PACKAGE_ROOT: string; export declare const PACKAGE_VERSION: any; export declare function pathsToRedact(spec: AirbyteSpec): string[]; /** Redact config of all secret values based on the provided specification */ export declare function redactConfig(config: AirbyteConfig, spec: AirbyteSpec): AirbyteConfig; export declare function redactConfigAsString(config: AirbyteConfig, spec: AirbyteSpec): string; /** * Sets all undefined values with defaults from spec to their default value. * The changes are made on a copy of the input. * */ export declare function withDefaults(config: Config, spec: AirbyteSpec): Config; /** Convert a value to Date */ export declare function toDate(val: Date | string | number | undefined): Date | undefined; export declare function base64Encode(str: string): string; export declare function minimizeSpec(airbyteSpec: AirbyteSpec): AirbyteSpec; export declare function addSourceCommonProperties(spec: AirbyteSpec): AirbyteSpec; export declare class Data { static compress(data: Dictionary): CompressedData; static decompress(data?: Dictionary): Dictionary | null | undefined; } /** * Check if the connector is running on the Airbyte platform. * WORKER_JOB_ID is set by Airbyte when running syncs on the platform. * When running via CLI, this environment variable is not set. */ export declare function isRunningOnPlatform(): boolean; export declare const FULL_REFRESH_STATE_KEY = "__full_refresh_state"; export declare const STREAM_FRESHNESS_STATE_KEY = "__stream_freshness_state"; export declare class State { /** * Decode input state (any format) to internal state (plain object). * Supports: STREAM format (array), legacy compressed, legacy uncompressed. * Also handles array-wrapped legacy states (platform passes state as array). */ static decode(state?: AirbyteInputState | AirbyteInputState[]): Dictionary | null | undefined; /** * Encode a single stream's state to STREAM output format. * Used on Airbyte platform for per-stream state messages. */ static encodeStream(streamName: string, streamState: any, namespace?: string): AirbyteStreamStateOutput; /** * Encode full connector state to legacy output format. * Used on CLI for backward compatibility with older CLI versions * that expect state in {data: ...} format. */ static encodeLegacy(connectorState: Dictionary): AirbyteLegacyStateOutput; /** * Encode state to appropriate output format based on runtime environment. * - Platform (WORKER_JOB_ID set): STREAM format (per-stream, compressed) * - CLI (WORKER_JOB_ID unset): Legacy format ({data: compressed}) * * @param streamName - Name of the stream being checkpointed * @param streamState - Current state of the stream * @param connectorState - Full connector state (all streams) * @param namespace - Optional namespace for the stream */ static encode(streamName: string, streamState: any, connectorState: Dictionary, namespace?: string): AirbyteOutputState; /** * Encode all shared state keys as STREAM output messages. * Each shared key becomes its own stream with special namespace. * Only used on platform - on CLI, shared states are included in legacy format. */ static encodeSharedStates(connectorState: Dictionary): AirbyteStreamStateOutput[]; /** * Check if a key is a shared state key (not a regular stream). */ static isSharedStateKey(key: string): boolean; } /** No-op state for special messages that don't trigger state persistence */ export declare const NOOP_STATE: AirbyteStreamStateOutput; /** Pre-encoded empty state for convenience */ export declare const EMPTY_STATE: AirbyteStreamStateOutput;