@openclaw/slack 2026.7.1 → 2026.7.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/accounts.runtime-KvftRRek.js +2 -0
  2. package/dist/{action-runtime-DoQGk_8D.js → action-runtime-Cee2ih0s.js} +209 -30
  3. package/dist/action-runtime.runtime-DZfd7IFr.js +2 -0
  4. package/dist/{actions-DMpDmKEA.js → actions-BZiuSTIq.js} +88 -143
  5. package/dist/{actions.runtime-C103_BPW.js → actions.runtime-DoD0-gxw.js} +1 -1
  6. package/dist/api.js +14 -13
  7. package/dist/{approval-handler.runtime-CIUbOt5T.js → approval-handler.runtime-CUPtIM4k.js} +3 -3
  8. package/dist/{channel-BjlsaGHn.js → channel-DaIiGUOp.js} +119 -141
  9. package/dist/channel-config-api.js +1 -1
  10. package/dist/channel-plugin-api.js +1 -1
  11. package/dist/channel-type-Cfm6_6n1.js +109 -0
  12. package/dist/{channel.setup-Dq6syTNU.js → channel.setup-C-mLz50O.js} +3 -3
  13. package/dist/{client-DGxwSL7f.js → client-WIPAS3Yr.js} +46 -2
  14. package/dist/config-api-Df9a1B8C.js +3 -0
  15. package/dist/{config-schema-BzqzFW__.js → config-schema-xPSnK2VK.js} +32 -37
  16. package/dist/cursor-pages-DSmTg0su.js +13 -0
  17. package/dist/{directory-config-BZuS8141.js → directory-config-DRkFujwG.js} +2 -2
  18. package/dist/directory-contract-api.js +1 -1
  19. package/dist/{directory-live-BNsxCgqP.js → directory-live-D_yZhjgp.js} +2 -2
  20. package/dist/{doctor-contract-XL6HeNCb.js → doctor-contract-DddfkMlF.js} +25 -38
  21. package/dist/doctor-contract-api.js +1 -1
  22. package/dist/group-policy-85UWiriS.js +2345 -0
  23. package/dist/{interactive-replies-CXpT-vA_.js → interactive-replies-BilWUdcI.js} +5 -1
  24. package/dist/interactive-replies-api.js +1 -1
  25. package/dist/{message-tool-api-BgWKyu2r.js → message-tool-api-CA9jZrCY.js} +1 -1
  26. package/dist/message-tool-api.js +1 -1
  27. package/dist/{monitor-Ux-wzUWI.js → monitor-CalGciTs.js} +3 -3
  28. package/dist/outbound-adapter-BiLKcnyH.js +228 -0
  29. package/dist/{pipeline.runtime-rpVpay59.js → pipeline.runtime-DofAvTtb.js} +657 -221
  30. package/dist/{policy-Dj-puVPb.js → policy-BVs4LiSa.js} +7 -7
  31. package/dist/preflight-audio.runtime-D5Bgags0.js +3 -0
  32. package/dist/{probe-CuwRDE5j.js → probe-CN0ssfLN.js} +2 -2
  33. package/dist/{provider-C1-DFSpw.js → provider-CmeoUiIM.js} +907 -206
  34. package/dist/{relay-source-D2jv1iGg.js → relay-source-DMmgtvg4.js} +6 -17
  35. package/dist/replies-CJJCp6qz.js +420 -0
  36. package/dist/{resolve-channels-CstkChBE.js → resolve-channels-Rfts6POK.js} +17 -6
  37. package/dist/{resolve-users-C3NP2c-Q.js → resolve-users-y6wAxR8E.js} +11 -6
  38. package/dist/runtime-JSVZSWAj.js +8 -0
  39. package/dist/{runtime-api-CEmqYxR-.js → runtime-api-BGDyOt1D.js} +3 -3
  40. package/dist/runtime-api.js +11 -11
  41. package/dist/runtime-setter-api.js +1 -1
  42. package/dist/{scopes-DCWVD5-8.js → scopes-CuxNQZ6v.js} +2 -2
  43. package/dist/{secret-contract-C3ChHo5A.js → secret-contract-CMohXFWS.js} +18 -113
  44. package/dist/secret-contract-api.js +1 -1
  45. package/dist/{send-DKDXoeoV.js → send-DYp8ca-l.js} +662 -325
  46. package/dist/{send.runtime-GPRa63l1.js → send.runtime-CJLxAt26.js} +1 -1
  47. package/dist/{setup-core-fGd6Gquy.js → setup-core-CkwVLzFO.js} +15 -21
  48. package/dist/setup-plugin-api.js +1 -1
  49. package/dist/{setup-surface-Dv2fIJNB.js → setup-surface-oSd3NX9J.js} +4 -4
  50. package/dist/{shared-CosfcFri.js → shared-D9yz5Otg.js} +17 -38
  51. package/dist/{slash-dispatch.runtime-CcMbbT3_.js → slash-dispatch.runtime-CSja9VuD.js} +1 -1
  52. package/dist/{streaming-compat-DjlgH-Be.js → streaming-compat-3_X-21wW.js} +1 -0
  53. package/dist/{target-parsing-3jYH8LfB.js → target-parsing-N6lHogYZ.js} +16 -3
  54. package/dist/{targets-Dll4NJgs.js → targets-KmjP2E8s.js} +1 -1
  55. package/node_modules/p-map/index.d.ts +155 -0
  56. package/node_modules/p-map/index.js +284 -0
  57. package/node_modules/p-map/license +9 -0
  58. package/node_modules/p-map/package.json +57 -0
  59. package/node_modules/p-map/readme.md +190 -0
  60. package/npm-shrinkwrap.json +16 -3
  61. package/openclaw.plugin.json +84 -0
  62. package/package.json +7 -7
  63. package/dist/accounts.runtime-DWvaCb-X.js +0 -2
  64. package/dist/action-runtime.runtime-BABj3aM-.js +0 -2
  65. package/dist/config-api-DnT9ohtE.js +0 -2
  66. package/dist/configured-state.js +0 -11
  67. package/dist/format-YCNoNkM2.js +0 -107
  68. package/dist/outbound-adapter-DVoBfBW5.js +0 -272
  69. package/dist/replies-DpF38e1y.js +0 -287
  70. package/dist/reply-blocks-BGQ6zSqM.js +0 -877
  71. package/dist/resolve-allowlist-common-CP8SH0Zf.js +0 -43
  72. package/dist/runtime-BOk7xkOl.js +0 -8
@@ -1,2 +1,2 @@
1
- import { n as resolveSlackDmChannelId, r as sendMessageSlack, t as reconcileSlackUnknownSend } from "./send-DKDXoeoV.js";
1
+ import { n as resolveSlackDmChannelId, r as sendMessageSlack, t as reconcileSlackUnknownSend } from "./send-DYp8ca-l.js";
2
2
  export { reconcileSlackUnknownSend, resolveSlackDmChannelId, sendMessageSlack };
@@ -3,7 +3,7 @@ import { t as inspectSlackAccount } from "./account-inspect-Di7ditqZ.js";
3
3
  import { t as isSlackPluginAccountConfigured } from "./account-configured-DzC407uv.js";
4
4
  import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input";
5
5
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
6
- import { DEFAULT_ACCOUNT_ID, createAccountScopedAllowFromSection, createAccountScopedGroupAccessSection, createAllowlistSetupWizardProxy, createEnvPatchedAccountSetupAdapter, createLegacyCompatChannelDmPolicy, createSetupTranslator, createStandardChannelSetupStatus, parseMentionOrPrefixedId, patchChannelConfigForAccount, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup-runtime";
6
+ import { DEFAULT_ACCOUNT_ID, createAccountScopedAllowFromSection, createAccountScopedGroupAccessSection, createAllowlistSetupWizardProxy, createEnvPatchedAccountSetupAdapter, createLegacyCompatChannelDmPolicy, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, parseMentionOrPrefixedId, patchChannelConfigForAccount, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup-runtime";
7
7
  import { formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
8
8
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
9
9
  //#region extensions/slack/src/setup-shared.ts
@@ -169,8 +169,9 @@ function setSlackInteractiveReplies(cfg, accountId, interactiveReplies) {
169
169
  });
170
170
  }
171
171
  function createSlackTokenCredential(params) {
172
- return {
172
+ return defineTokenCredential({
173
173
  inputKey: params.inputKey,
174
+ configKey: params.inputKey,
174
175
  providerHint: params.providerHint,
175
176
  credentialLabel: params.credentialLabel,
176
177
  preferredEnvVar: params.preferredEnvVar,
@@ -178,31 +179,24 @@ function createSlackTokenCredential(params) {
178
179
  keepPrompt: params.keepPrompt,
179
180
  inputPrompt: params.inputPrompt,
180
181
  allowEnv: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID,
181
- inspect: ({ cfg, accountId }) => {
182
- const resolved = resolveSlackAccount({
183
- cfg,
184
- accountId
185
- });
186
- const configuredValue = params.inputKey === "botToken" ? resolved.config.botToken : resolved.config.appToken;
187
- const resolvedValue = params.inputKey === "botToken" ? resolved.botToken : resolved.appToken;
188
- return {
189
- accountConfigured: Boolean(resolvedValue) || hasConfiguredSecretInput(configuredValue),
190
- hasConfiguredValue: hasConfiguredSecretInput(configuredValue),
191
- resolvedValue: normalizeOptionalString(resolvedValue),
192
- envValue: accountId === DEFAULT_ACCOUNT_ID ? normalizeOptionalString(process.env[params.preferredEnvVar]) : void 0
193
- };
194
- },
195
- applyUseEnv: ({ cfg, accountId }) => enableSlackAccount(cfg, accountId),
196
- applySet: ({ cfg, accountId, value }) => patchChannelConfigForAccount({
182
+ resolveAccount: ({ cfg, accountId }) => resolveSlackAccount({
183
+ cfg,
184
+ accountId
185
+ }),
186
+ resolvedValue: (account) => normalizeOptionalString(params.inputKey === "botToken" ? account.botToken : account.appToken),
187
+ envValue: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID ? normalizeOptionalString(process.env[params.preferredEnvVar]) : void 0,
188
+ patchAccount: ({ cfg, accountId, mode, patch }) => mode === "env" ? enableSlackAccount(cfg, accountId) : patchChannelConfigForAccount({
197
189
  cfg,
198
190
  channel: SLACK_CHANNEL,
199
191
  accountId,
200
192
  patch: {
201
193
  enabled: true,
202
- [params.inputKey]: value
194
+ ...patch
203
195
  }
204
- })
205
- };
196
+ }),
197
+ useEnv: { clearFields: [] },
198
+ set: {}
199
+ });
206
200
  }
207
201
  const slackSetupAdapter = createEnvPatchedAccountSetupAdapter({
208
202
  channelKey: SLACK_CHANNEL,
@@ -1,2 +1,2 @@
1
- import { t as slackSetupPlugin } from "./channel.setup-Dq6syTNU.js";
1
+ import { t as slackSetupPlugin } from "./channel.setup-C-mLz50O.js";
2
2
  export { slackSetupPlugin };
@@ -1,8 +1,8 @@
1
1
  import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, o as resolveSlackAccountAllowFrom } from "./accounts-BOJJiHSr.js";
2
- import "./shared-CosfcFri.js";
3
- import { i as SLACK_CHANNEL, t as createSlackSetupWizardBase } from "./setup-core-fGd6Gquy.js";
4
- import { t as resolveSlackChannelAllowlist } from "./resolve-channels-CstkChBE.js";
5
- import { t as resolveSlackUserAllowlist } from "./resolve-users-C3NP2c-Q.js";
2
+ import "./shared-D9yz5Otg.js";
3
+ import { i as SLACK_CHANNEL, t as createSlackSetupWizardBase } from "./setup-core-CkwVLzFO.js";
4
+ import { t as resolveSlackChannelAllowlist } from "./resolve-channels-Rfts6POK.js";
5
+ import { t as resolveSlackUserAllowlist } from "./resolve-users-y6wAxR8E.js";
6
6
  import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import { adaptScopedAccountAccessor } from "openclaw/plugin-sdk/channel-config-helpers";
8
8
  import { createSetupTranslator, noteChannelLookupFailure, noteChannelLookupSummary, parseMentionOrPrefixedId, promptLegacyChannelAllowFromForAccount, resolveEntriesWithOptionalToken } from "openclaw/plugin-sdk/setup-runtime";
@@ -1,16 +1,16 @@
1
1
  import { a as resolveSlackAccount, c as resolveSlackConfigAccessorAccount, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, o as resolveSlackAccountAllowFrom, r as mergeSlackAccountConfig, s as resolveSlackAccountDmPolicy } from "./accounts-BOJJiHSr.js";
2
2
  import { t as inspectSlackAccount } from "./account-inspect-Di7ditqZ.js";
3
3
  import { t as isSlackPluginAccountConfigured } from "./account-configured-DzC407uv.js";
4
- import { n as isSlackInteractiveRepliesEnabled } from "./interactive-replies-CXpT-vA_.js";
5
- import { f as getChatChannelMeta } from "./client-DGxwSL7f.js";
6
- import { i as SLACK_CHANNEL } from "./setup-core-fGd6Gquy.js";
7
- import { t as SlackChannelConfigSchema } from "./config-schema-BzqzFW__.js";
8
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-XL6HeNCb.js";
9
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-C3ChHo5A.js";
4
+ import { n as isSlackInteractiveRepliesEnabled } from "./interactive-replies-BilWUdcI.js";
5
+ import { h as getChatChannelMeta } from "./client-WIPAS3Yr.js";
6
+ import { i as SLACK_CHANNEL } from "./setup-core-CkwVLzFO.js";
7
+ import { t as SlackChannelConfigSchema } from "./config-schema-xPSnK2VK.js";
8
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-DddfkMlF.js";
9
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-CMohXFWS.js";
10
10
  import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
11
11
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
12
12
  import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
13
- import { createDangerousNameMatchingMutableAllowlistWarningCollector, createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy";
13
+ import { buildMutableAllowEntryDetector, collectStandardAllowlistLists, createDangerousNameMatchingMutableAllowlistWarningCollector, createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy";
14
14
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
15
15
  //#region extensions/slack/src/security.ts
16
16
  const resolveSlackDmPolicy = createScopedDmSecurityResolver({
@@ -57,16 +57,7 @@ const slackSecurityAdapter = {
57
57
  };
58
58
  //#endregion
59
59
  //#region extensions/slack/src/security-doctor.ts
60
- function isSlackMutableAllowEntry(raw) {
61
- const text = raw.trim();
62
- if (!text || text === "*") return false;
63
- const mentionMatch = text.match(/^<@([A-Z0-9]+)>$/i);
64
- if (mentionMatch && /^[A-Z0-9]{8,}$/i.test(mentionMatch[1] ?? "")) return false;
65
- const withoutPrefix = text.replace(/^(slack|user):/i, "").trim();
66
- if (/^[UWBCGDT][A-Z0-9]{2,}$/.test(withoutPrefix)) return false;
67
- if (/^[A-Z0-9]{8,}$/i.test(withoutPrefix)) return false;
68
- return true;
69
- }
60
+ const isSlackMutableAllowEntry = buildMutableAllowEntryDetector({ stableIdPattern: /^(?:(?:(?:[sS][lL][aA][cC][kK]|[uU][sS][eE][rR]):)?(?:[UWBCGDT][A-Z0-9]{2,}|[A-Za-z0-9]{8,})|<@[A-Za-z0-9]{8,}>)$/ });
70
61
  //#endregion
71
62
  //#region extensions/slack/src/doctor.ts
72
63
  function asObjectRecord(value) {
@@ -75,27 +66,13 @@ function asObjectRecord(value) {
75
66
  const collectSlackMutableAllowlistWarnings = createDangerousNameMatchingMutableAllowlistWarningCollector({
76
67
  channel: "slack",
77
68
  detector: isSlackMutableAllowEntry,
78
- collectLists: (scope) => {
79
- const lists = [{
80
- pathLabel: `${scope.prefix}.allowFrom`,
81
- list: scope.account.allowFrom
82
- }];
83
- const dm = asObjectRecord(scope.account.dm);
84
- if (dm) lists.push({
85
- pathLabel: `${scope.prefix}.dm.allowFrom`,
86
- list: dm.allowFrom
87
- });
88
- const channels = asObjectRecord(scope.account.channels);
89
- if (channels) for (const [channelKey, channelRaw] of Object.entries(channels)) {
90
- const channel = asObjectRecord(channelRaw);
91
- if (!channel) continue;
92
- lists.push({
93
- pathLabel: `${scope.prefix}.channels.${channelKey}.users`,
94
- list: channel.users
95
- });
96
- }
97
- return lists;
98
- }
69
+ collectLists: (scope) => collectStandardAllowlistLists(scope, {
70
+ includeGroupAllowFrom: false,
71
+ includeDm: true,
72
+ includeGroups: true,
73
+ groupsKey: "channels",
74
+ groupField: "users"
75
+ })
99
76
  });
100
77
  const SLACK_CANONICAL_CHANNEL_ID_RE = /^[CG][A-Z0-9]{8,}$/;
101
78
  const SLACK_LOWERCASE_CHANNEL_ID_RE = /^[cg][0-9][a-z0-9]{7,}$/;
@@ -229,6 +206,8 @@ function createSlackPluginBase(params) {
229
206
  "- Slack interactive replies: use `[[slack_buttons: Label:value, Other:other]]` to add action buttons that route clicks back as Slack interaction system events.",
230
207
  "- Slack selects: use `[[slack_select: Placeholder | Label:value, Other:other]]` to add a static select menu that routes the chosen value back as a Slack interaction system event."
231
208
  ] : ["- Slack interactive replies are disabled. If needed, ask to set `channels.slack.capabilities.interactiveReplies=true` (or the same under `channels.slack.accounts.<account>.capabilities`)."]).concat([
209
+ "- For line, bar, area, or pie data, use a `presentation` chart block; Slack renders it as a native chart and retains a text data summary for accessibility.",
210
+ "- For row-and-column data, use an explicit `presentation` table block; Slack renders it as a native table and retains a linear text summary for accessibility. Markdown pipe tables are not auto-promoted.",
232
211
  "- Slack plain text sends: write standard Markdown; OpenClaw converts it to Slack mrkdwn, including `**bold**`, headings, lists, and `[label](url)` links.",
233
212
  "- When mentioning Slack users, use the stable `<@USER_ID>` token from Slack context instead of plain `@name` text so Slack notifies and links the user.",
234
213
  "- Slack Block Kit or presentation text fields are sent as Slack mrkdwn directly; use `*bold*`, `_italic_`, `~strike~`, `<url|label>` links, and avoid Markdown headings or pipe tables there."
@@ -1,4 +1,4 @@
1
- import { r as deliverSlackSlashReplies$1 } from "./replies-DpF38e1y.js";
1
+ import { r as deliverSlackSlashReplies$1 } from "./replies-CJJCp6qz.js";
2
2
  import { resolveAgentRoute as resolveAgentRoute$1 } from "openclaw/plugin-sdk/routing";
3
3
  import { resolveMarkdownTableMode as resolveMarkdownTableMode$1 } from "openclaw/plugin-sdk/markdown-table-runtime";
4
4
  import { recordInboundSessionMetaSafe as recordInboundSessionMetaSafe$1, resolveConversationLabel as resolveConversationLabel$1 } from "openclaw/plugin-sdk/conversation-runtime";
@@ -36,6 +36,7 @@ function resolveSlackStreamingMode(params = {}) {
36
36
  function resolveSlackNativeStreaming(params = {}) {
37
37
  const canonical = resolveChannelStreamingNativeTransport(params);
38
38
  if (typeof canonical === "boolean") return canonical;
39
+ if (typeof params.nativeStreaming === "boolean") return params.nativeStreaming;
39
40
  if (typeof params.streaming === "boolean") return params.streaming;
40
41
  return true;
41
42
  }
@@ -1,5 +1,17 @@
1
1
  import { buildMessagingTarget, ensureTargetId, parseMentionPrefixOrAtUserTarget, requireTargetKind } from "openclaw/plugin-sdk/channel-targets";
2
2
  //#region extensions/slack/src/target-parsing.ts
3
+ const SLACK_CHANNEL_API_ID_RE = /^[CDG][0-9][A-Z0-9]{7,}$/i;
4
+ const SLACK_USER_API_ID_RE = /^[UW][A-Z0-9]{8,}$/i;
5
+ function isUnambiguousSlackUserId(rawId) {
6
+ const id = rawId.trim();
7
+ return /^[UW][A-Z0-9]+$/.test(id) || /^[uw][0-9][a-z0-9]{7,}$/.test(id);
8
+ }
9
+ /** Restores API casing for unambiguous normalized Slack conversation IDs. */
10
+ function canonicalizeSlackApiTargetId(kind, rawId, rawTarget) {
11
+ const id = rawId.trim();
12
+ if (kind === "channel" && rawTarget?.trim().startsWith("#")) return id;
13
+ return (kind === "user" ? SLACK_USER_API_ID_RE : SLACK_CHANNEL_API_ID_RE).test(id) ? id.toUpperCase() : id;
14
+ }
3
15
  function parseSlackTarget(raw, options = {}) {
4
16
  const trimmed = raw.trim();
5
17
  if (!trimmed) return;
@@ -29,15 +41,16 @@ function parseSlackTarget(raw, options = {}) {
29
41
  pattern: /^[A-Z0-9]+$/i,
30
42
  errorMessage: "Slack channels require a channel id (use channel:<id>)"
31
43
  }), trimmed);
44
+ if (isUnambiguousSlackUserId(trimmed)) return buildMessagingTarget("user", trimmed, trimmed);
32
45
  if (options.defaultKind) return buildMessagingTarget(options.defaultKind, trimmed, trimmed);
33
46
  return buildMessagingTarget("channel", trimmed, trimmed);
34
47
  }
35
48
  function resolveSlackChannelId(raw) {
36
- return requireTargetKind({
49
+ return canonicalizeSlackApiTargetId("channel", requireTargetKind({
37
50
  platform: "Slack",
38
51
  target: parseSlackTarget(raw, { defaultKind: "channel" }),
39
52
  kind: "channel"
40
- });
53
+ }), raw);
41
54
  }
42
55
  function normalizeSlackMessagingTarget(raw) {
43
56
  return parseSlackTarget(raw, { defaultKind: "channel" })?.normalized;
@@ -57,4 +70,4 @@ function looksLikeSlackTargetId(raw) {
57
70
  return /^[CUWGD][A-Z0-9]{8,}$/i.test(trimmed);
58
71
  }
59
72
  //#endregion
60
- export { slackTargetsMatch as a, resolveSlackChannelId as i, normalizeSlackMessagingTarget as n, parseSlackTarget as r, looksLikeSlackTargetId as t };
73
+ export { resolveSlackChannelId as a, parseSlackTarget as i, looksLikeSlackTargetId as n, slackTargetsMatch as o, normalizeSlackMessagingTarget as r, canonicalizeSlackApiTargetId as t };
@@ -1,4 +1,4 @@
1
- import { a as slackTargetsMatch, r as parseSlackTarget } from "./target-parsing-3jYH8LfB.js";
1
+ import { i as parseSlackTarget, o as slackTargetsMatch } from "./target-parsing-N6lHogYZ.js";
2
2
  //#region extensions/slack/src/targets.ts
3
3
  function matchesResolvedUserTarget(target, currentMessagingTarget) {
4
4
  const resolvedId = target.trim();
@@ -0,0 +1,155 @@
1
+ type BaseOptions = {
2
+ /**
3
+ Number of concurrently pending promises returned by `mapper`.
4
+
5
+ Must be an integer from 1 and up or `Infinity`.
6
+
7
+ @default Infinity
8
+ */
9
+ readonly concurrency?: number;
10
+ };
11
+
12
+ export type Options = BaseOptions & {
13
+ /**
14
+ When `true`, the first mapper rejection will be rejected back to the consumer.
15
+
16
+ When `false`, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an [`AggregateError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError) containing all the errors from the rejected promises.
17
+
18
+ Caveat: When `true`, any already-started async mappers will continue to run until they resolve or reject. In the case of infinite concurrency with sync iterables, *all* mappers are invoked on startup and will continue after the first rejection. Use the `signal` option for abort control.
19
+
20
+ @default true
21
+ */
22
+ readonly stopOnError?: boolean;
23
+
24
+ /**
25
+ You can abort the promises using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
26
+
27
+ @example
28
+ ```
29
+ import pMap from 'p-map';
30
+ import delay from 'delay';
31
+
32
+ const abortController = new AbortController();
33
+
34
+ setTimeout(() => {
35
+ abortController.abort();
36
+ }, 500);
37
+
38
+ const mapper = async value => value;
39
+
40
+ await pMap([delay(1000), delay(1000)], mapper, {signal: abortController.signal});
41
+ // Throws AbortError (DOMException) after 500 ms.
42
+ ```
43
+ */
44
+ readonly signal?: AbortSignal | undefined;
45
+ };
46
+
47
+ export type IterableOptions = BaseOptions & {
48
+ /**
49
+ Maximum number of promises returned by `mapper` that have resolved but not yet collected by the consumer of the async iterable. Calls to `mapper` will be limited so that there is never too much backpressure.
50
+
51
+ Useful whenever you are consuming the iterable slower than what the mapper function can produce concurrently. For example, to avoid making an overwhelming number of HTTP requests if you are saving each of the results to a database.
52
+
53
+ Default: `options.concurrency`
54
+ */
55
+ readonly backpressure?: number;
56
+ };
57
+
58
+ type MaybePromise<T> = T | Promise<T>;
59
+
60
+ /**
61
+ Function which is called for every item in `input`. Expected to return a `Promise` or value.
62
+
63
+ @param element - Iterated element.
64
+ @param index - Index of the element in the source array.
65
+ */
66
+ export type Mapper<Element = any, NewElement = unknown> = (
67
+ element: Element,
68
+ index: number
69
+ ) => MaybePromise<NewElement | typeof pMapSkip>;
70
+
71
+ /**
72
+ @param input - Synchronous or asynchronous iterable that is iterated over concurrently, calling the `mapper` function for each element. Each iterated item is `await`'d before the `mapper` is invoked so the iterable may return a `Promise` that resolves to an item. Asynchronous iterables (different from synchronous iterables that return `Promise` that resolves to an item) can be used when the next item may not be ready without waiting for an asynchronous process to complete and/or the end of the iterable may be reached after the asynchronous process completes. For example, reading from a remote queue when the queue has reached empty, or reading lines from a stream.
73
+ @param mapper - Function which is called for every item in `input`. Expected to return a `Promise` or value.
74
+ @returns A `Promise` that is fulfilled when all promises in `input` and the ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `mapper` in `input` order.
75
+
76
+ @example
77
+ ```
78
+ import pMap from 'p-map';
79
+ import got from 'got';
80
+
81
+ const sites = [
82
+ getWebsiteFromUsername('sindresorhus'), //=> Promise
83
+ 'https://avajs.dev',
84
+ 'https://github.com'
85
+ ];
86
+
87
+ const mapper = async site => {
88
+ const {requestUrl} = await got.head(site);
89
+ return requestUrl;
90
+ };
91
+
92
+ const result = await pMap(sites, mapper, {concurrency: 2});
93
+
94
+ console.log(result);
95
+ //=> ['https://sindresorhus.com/', 'https://avajs.dev/', 'https://github.com/']
96
+ ```
97
+ */
98
+ export default function pMap<Element, NewElement>(
99
+ input: AsyncIterable<Element | Promise<Element>> | Iterable<Element | Promise<Element>>,
100
+ mapper: Mapper<Element, NewElement>,
101
+ options?: Options
102
+ ): Promise<Array<Exclude<NewElement, typeof pMapSkip>>>;
103
+
104
+ /**
105
+ @param input - Synchronous or asynchronous iterable that is iterated over concurrently, calling the `mapper` function for each element. Each iterated item is `await`'d before the `mapper` is invoked so the iterable may return a `Promise` that resolves to an item. Asynchronous iterables (different from synchronous iterables that return `Promise` that resolves to an item) can be used when the next item may not be ready without waiting for an asynchronous process to complete and/or the end of the iterable may be reached after the asynchronous process completes. For example, reading from a remote queue when the queue has reached empty, or reading lines from a stream.
106
+ @param mapper - Function which is called for every item in `input`. Expected to return a `Promise` or value.
107
+ @returns An async iterable that streams each return value from `mapper` in order.
108
+
109
+ @example
110
+ ```
111
+ import {pMapIterable} from 'p-map';
112
+
113
+ // Multiple posts are fetched concurrently, with limited concurrency and backpressure
114
+ for await (const post of pMapIterable(postIds, getPostMetadata, {concurrency: 8})) {
115
+ console.log(post);
116
+ };
117
+ ```
118
+ */
119
+ export function pMapIterable<Element, NewElement>(
120
+ input: AsyncIterable<Element | Promise<Element>> | Iterable<Element | Promise<Element>>,
121
+ mapper: Mapper<Element, NewElement>,
122
+ options?: IterableOptions
123
+ ): AsyncIterable<Exclude<NewElement, typeof pMapSkip>>;
124
+
125
+ /**
126
+ Return this value from a `mapper` function to skip including the value in the returned array.
127
+
128
+ @example
129
+ ```
130
+ import pMap, {pMapSkip} from 'p-map';
131
+ import got from 'got';
132
+
133
+ const sites = [
134
+ getWebsiteFromUsername('sindresorhus'), //=> Promise
135
+ 'https://avajs.dev',
136
+ 'https://example.invalid',
137
+ 'https://github.com'
138
+ ];
139
+
140
+ const mapper = async site => {
141
+ try {
142
+ const {requestUrl} = await got.head(site);
143
+ return requestUrl;
144
+ } catch {
145
+ return pMapSkip;
146
+ }
147
+ };
148
+
149
+ const result = await pMap(sites, mapper, {concurrency: 2});
150
+
151
+ console.log(result);
152
+ //=> ['https://sindresorhus.com/', 'https://avajs.dev/', 'https://github.com/']
153
+ ```
154
+ */
155
+ export const pMapSkip: unique symbol;