import { L as ProviderApiError, ct as JsonValue, o as fetchSlackMessage } from "../../index-DJ6CHaMc.js"; //#region src/providers/slack.d.ts /** * Slack answered a Web API call with `ok: false`. Check `code` to handle one * answer, such as `already_reacted`. * * @group Errors */ declare class SlackApiError extends ProviderApiError { /** Slack's `error` string, such as `invalid_auth` or `already_reacted`. */ readonly code: string; constructor(method: string, code: string, needed?: string, answer?: { status: number; body: string; }); } /** * Web API arguments. A value that is not a string is sent JSON-encoded, the way * Slack takes `blocks`. * * @group Any Web API method */ type SlackParams = Record; //#endregion //#region src/steps/slack/call.d.ts /** * Call any Slack Web API method as the factory's bot in the Slack installation * `installationName` names, and return Slack's response body. Wrap it in your own `"use step"` function. * * @remarks * Arguments that are not strings, such as `blocks`, are sent JSON-encoded, and * `undefined` ones are left out. When Slack answers `ok: false`, it throws a * {@link SlackApiError} with Slack's error as its `code`. Rate-limited calls are * retried. * * A step can run more than once, so a call that is not safe to repeat has to * accept what a repeat gets back, such as `already_reacted` from * `reactions.add`, or `message_not_found` once the message is deleted. Add * any scope the method needs that jigs does not already use to the app's bot * scopes in the hub; without it Slack answers `missing_scope`. * * @example * ```ts * // workflows/deploys/steps.ts * import { callSlack, SlackApiError } from "@jigs-ai/jigs/steps/slack"; * * export async function react(channel: string, timestamp: string, name: string) { * "use step"; * try { * await callSlack( * "reactions.add", * { channel, timestamp, name }, * { installationName: "slack-acme" }, * ); * } catch (error) { * const tolerated = ["already_reacted", "message_not_found"]; * if (!(error instanceof SlackApiError && tolerated.includes(error.code))) throw error; * } * } * ``` * * @group Any Web API method */ declare function callSlack>(method: string, params: SlackParams, options: { installationName: string; }): Promise; //#endregion //#region src/steps/slack/post-message.d.ts /** * Post plain `mrkdwn` text to a channel, or as a reply in the thread under * `threadTs`, as the bot of the Slack installation `installationName` names. * Returns the new message's ts. * * @group Create and update */ declare function postSlackMessage({ installationName, ...message }: { installationName: string; channel: string; text: string; threadTs?: string | undefined; }): Promise; //#endregion export { SlackApiError, type SlackParams, callSlack, fetchSlackMessage, postSlackMessage };