import * as _walkeros_core_dev from '@walkeros/core/dev'; import { z } from '@walkeros/core/dev'; import { DestinationServer } from '@walkeros/server-core'; import { Flow } from '@walkeros/core'; declare const RedisSettingsSchema: z.ZodObject<{ streamKey: z.ZodString; url: z.ZodOptional; options: z.ZodOptional>; maxLen: z.ZodOptional; exactTrimming: z.ZodOptional; serialization: z.ZodOptional>; }, z.core.$strip>; declare const SettingsSchema: z.ZodObject<{ redis: z.ZodObject<{ streamKey: z.ZodString; url: z.ZodOptional; options: z.ZodOptional>; maxLen: z.ZodOptional; exactTrimming: z.ZodOptional; serialization: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>; type Settings$1 = z.infer; declare const MappingSchema: z.ZodObject<{ streamKey: z.ZodOptional; }, z.core.$strip>; type Mapping = z.infer; declare const settings: _walkeros_core_dev.JSONSchema; declare const mapping: _walkeros_core_dev.JSONSchema; type index$1_Mapping = Mapping; declare const index$1_MappingSchema: typeof MappingSchema; declare const index$1_RedisSettingsSchema: typeof RedisSettingsSchema; declare const index$1_SettingsSchema: typeof SettingsSchema; declare const index$1_mapping: typeof mapping; declare const index$1_settings: typeof settings; declare namespace index$1 { export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, index$1_RedisSettingsSchema as RedisSettingsSchema, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings }; } /** * Arguments passed to Redis XADD. Strings or numbers (for MAXLEN counts). */ type XaddArg = string | number; /** * Mock-friendly Redis pipeline interface. Accumulates commands and * executes them with a single round-trip via exec(). */ interface RedisPipelineMock { xadd: (...args: XaddArg[]) => RedisPipelineMock; exec: () => Promise | null>; } /** * Mock-friendly Redis client interface used by the destination. * Tests provide this via env.Redis; production creates a real ioredis * client and uses it directly. */ interface RedisClientMock { xadd: (...args: XaddArg[]) => Promise; pipeline: () => RedisPipelineMock; quit: () => Promise; on?: (event: string, listener: (...args: unknown[]) => void) => unknown; } /** * Constructor signature for the Redis client. Accepts either a URL * string or an options object, matching ioredis's dual signature. */ interface RedisClientConstructor { new (url: string): RedisClientMock; new (options: RedisClientOptions): RedisClientMock; } /** * Minimal ioredis options subset the destination passes through. * Unknown options are preserved for the SDK to handle. */ interface RedisClientOptions { host?: string; port?: number; username?: string; password?: string; db?: number; tls?: boolean | Record; connectTimeout?: number; commandTimeout?: number; [key: string]: unknown; } type SerializationMode = 'json' | 'flat'; interface RedisSettings { /** Redis stream key name (e.g. 'walkeros:events'). */ streamKey: string; /** Redis connection URL (e.g. 'redis://localhost:6379' or 'rediss://...'). */ url?: string; /** ioredis connection options (used if no url provided). */ options?: RedisClientOptions; /** * Maximum stream length. Enables MAXLEN trimming on every XADD. * Uses approximate (~) trimming by default for performance. * Omit for unlimited stream length. */ maxLen?: number; /** * Use exact MAXLEN instead of approximate (~). * Not recommended for production -- significantly slower. * Default: false (approximate trimming). */ exactTrimming?: boolean; /** * Serialization mode for the event payload. * - 'json': Single 'event' field with JSON string (default) * - 'flat': Top-level event fields as separate stream fields */ serialization?: SerializationMode; _client?: RedisClientMock; _ownedClient?: boolean; } interface Settings { redis: RedisSettings; } /** * Env -- optional Redis SDK override. Production leaves this undefined * and the destination creates real ioredis client instances. Tests provide * mocks via env.Redis. */ interface Env extends DestinationServer.Env { Redis?: { Client: RedisClientConstructor; }; } declare const push: Env; declare const simulation: string[]; declare const env_push: typeof push; declare const env_simulation: typeof simulation; declare namespace env { export { env_push as push, env_simulation as simulation }; } /** * Extended step example that may carry destination-level settings overrides. */ type RedisStepExample = Flow.StepExample & { settings?: Partial; }; /** * Default JSON serialization -- single 'event' field with full event JSON. */ declare const jsonDefault: RedisStepExample; /** * Order event -- verifies different event types pass through correctly. */ declare const orderComplete: RedisStepExample; /** * With MAXLEN approximate trimming -- trimming args inserted before '*'. */ declare const withMaxLen: RedisStepExample; /** * Exact MAXLEN trimming -- no '~' between MAXLEN and the count. */ declare const withExactTrim: RedisStepExample; /** * Stream key override per rule -- routes this event to a dedicated stream. */ declare const streamKeyOverride: RedisStepExample; /** * Ignored event -- mapping.ignore: true produces no xadd call. */ declare const ignoredEvent: RedisStepExample; type step_RedisStepExample = RedisStepExample; declare const step_ignoredEvent: typeof ignoredEvent; declare const step_jsonDefault: typeof jsonDefault; declare const step_orderComplete: typeof orderComplete; declare const step_streamKeyOverride: typeof streamKeyOverride; declare const step_withExactTrim: typeof withExactTrim; declare const step_withMaxLen: typeof withMaxLen; declare namespace step { export { type step_RedisStepExample as RedisStepExample, step_ignoredEvent as ignoredEvent, step_jsonDefault as jsonDefault, step_orderComplete as orderComplete, step_streamKeyOverride as streamKeyOverride, step_withExactTrim as withExactTrim, step_withMaxLen as withMaxLen }; } declare const index_env: typeof env; declare const index_step: typeof step; declare namespace index { export { index_env as env, index_step as step }; } export { index as examples, index$1 as schemas };