import * as _walkeros_core_dev from '@walkeros/core/dev'; import { z } from '@walkeros/core/dev'; import { DestinationServer, sendServer } from '@walkeros/server-core'; import { ChatPostMessageArguments, ChatPostMessageResponse, ChatPostEphemeralArguments, ChatPostEphemeralResponse, ConversationsOpenArguments, ConversationsOpenResponse, WebClient } from '@slack/web-api'; import { Flow } from '@walkeros/core'; declare const SettingsSchema: z.ZodObject<{ token: z.ZodOptional; webhookUrl: z.ZodOptional; channel: z.ZodOptional; text: z.ZodOptional; blocks: z.ZodOptional>>; includeHeader: z.ZodOptional; unfurlLinks: z.ZodOptional; unfurlMedia: z.ZodOptional; mrkdwn: z.ZodOptional; threadTs: z.ZodOptional; retryConfig: z.ZodOptional>; }, z.core.$strip>; type Settings$1 = z.infer; declare const MappingSchema: z.ZodObject<{ channel: z.ZodOptional; text: z.ZodOptional; blocks: z.ZodOptional>>; threadTs: z.ZodOptional; replyBroadcast: z.ZodOptional; ephemeral: z.ZodOptional; user: z.ZodOptional; dm: 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_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, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings }; } /** A single Block Kit block (kept loose -- Slack does not export a union type). */ type SlackBlock = Record; interface Settings { /** Slack Bot token (xoxb-...). Enables Web API mode. */ token?: string; /** Incoming Webhook URL. Enables webhook mode. */ webhookUrl?: string; /** Default channel ID or name. Required for Web API mode unless every rule provides one. */ channel?: string; /** Default text template. Supports `${data.field}` interpolation against the walkerOS event. */ text?: string; /** Default Block Kit blocks applied when no mapping override is set. */ blocks?: SlackBlock[]; /** Auto-add an event-name header block when generating default blocks. Default: true. */ includeHeader?: boolean; /** Enable link unfurling. Default: false. */ unfurlLinks?: boolean; /** Enable media unfurling. Default: false. */ unfurlMedia?: boolean; /** Use mrkdwn formatting. Default: true. */ mrkdwn?: boolean; /** Static thread_ts to reply to (rarely set at destination level). */ threadTs?: string; /** Retry policy passed to WebClient. Default: 'default'. */ retryConfig?: 'default' | 'fiveRetriesInFiveMinutes' | 'none'; _client?: WebClient; } /** * Mock-friendly interface for the WebClient methods the destination calls. * Tests inject this via env.slackClient. */ interface SlackClientMock { chat: { postMessage: (opts: ChatPostMessageArguments) => Promise; postEphemeral: (opts: ChatPostEphemeralArguments) => Promise; }; conversations: { open: (opts: ConversationsOpenArguments) => Promise; }; } /** * Env -- optional SDK / transport overrides. Production leaves these undefined. * Tests inject `slackClient` (Web API mode) and/or `sendServer` (webhook mode). */ interface Env extends DestinationServer.Env { slackClient?: SlackClientMock; sendServer?: typeof sendServer; } 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 SlackStepExample = Flow.StepExample & { settings?: Partial; }; /** * Slack server destination operates in two modes: * * 1. Web API mode - calls the injected `env.slackClient` SDK methods * (`chat.postMessage`, `chat.postEphemeral`, `conversations.open`). * Captured as `[callable, args]` with dotted callable names such as * `'slackClient.chat.postMessage'`. * * 2. Webhook mode - calls `env.sendServer(url, JSON.stringify(body))`. * Captured as `['sendServer', url, bodyAsString]` where `bodyAsString` * is the already-stringified JSON body. Key insertion order in the * source object matters for string equality. * * A single push may emit multiple calls (e.g. a DM opens a conversation * then posts to the returned channel id), so every `out` is wrapped as * `[[callable, ...args], ...]`. */ /** * Purchase notification -- Web API mode, channel from mapping override, * text template interpolated against event.data. */ declare const purchaseAlert: SlackStepExample; /** * Error alert -- routes to a different channel via mapping override. */ declare const errorAlert: SlackStepExample; /** * Welcome DM -- conversations.open(users) -> chat.postMessage(channel: D-id). */ declare const welcomeDM: SlackStepExample; /** * Threaded checkout step -- thread_ts override puts the reply into a thread. */ declare const threadedCheckoutStep: SlackStepExample; /** * Ephemeral message -- visible to one user in the target channel. */ declare const ephemeralMessage: SlackStepExample; /** * Default blocks -- no custom text/blocks, destination auto-generates a * Block Kit message from the event data. */ declare const defaultBlocks: SlackStepExample; /** * Webhook mode -- no token, just webhookUrl. The destination calls * `env.sendServer(url, JSON.stringify(body))`. Channel is baked into the * URL by Slack. */ declare const deployNotification: SlackStepExample; type step_SlackStepExample = SlackStepExample; declare const step_defaultBlocks: typeof defaultBlocks; declare const step_deployNotification: typeof deployNotification; declare const step_ephemeralMessage: typeof ephemeralMessage; declare const step_errorAlert: typeof errorAlert; declare const step_purchaseAlert: typeof purchaseAlert; declare const step_threadedCheckoutStep: typeof threadedCheckoutStep; declare const step_welcomeDM: typeof welcomeDM; declare namespace step { export { type step_SlackStepExample as SlackStepExample, step_defaultBlocks as defaultBlocks, step_deployNotification as deployNotification, step_ephemeralMessage as ephemeralMessage, step_errorAlert as errorAlert, step_purchaseAlert as purchaseAlert, step_threadedCheckoutStep as threadedCheckoutStep, step_welcomeDM as welcomeDM }; } 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 };