@openclaw/slack 2026.8.1 → 2026.8.33
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.
- package/dist/{account-inspect-CN2hBsim.js → .setup/account-inspect-B86OaUEt.mjs} +5 -5
- package/dist/{accounts-Dm_H77gH.js → .setup/accounts-C1FspRF-.mjs} +1 -1
- package/dist/{accounts.runtime-DRuEK6mL.js → .setup/accounts.runtime-BpWv-6-2.mjs} +1 -1
- package/dist/{action-runtime-044ldvNL.js → .setup/action-runtime-C_G4J1MV.mjs} +52 -42
- package/dist/.setup/action-runtime.runtime-DldZIYpL.mjs +2 -0
- package/dist/{actions-BI7JkfVm.js → .setup/actions-8uuOLGDR.mjs} +20 -14
- package/dist/{approval-handler.runtime-DYv0UIZS.js → .setup/approval-handler.runtime-Bj-Kl-Ak.mjs} +7 -6
- package/dist/{channel-1vIJOzPx.js → .setup/channel-Dmbj_FF6.mjs} +43 -35
- package/dist/{channel-type-DlFSKeIZ.js → .setup/channel-type-CncPqtvr.mjs} +4 -4
- package/dist/{channel.setup-ofDi3_Pu.js → .setup/channel.setup-CTV8N2nI.mjs} +25 -24
- package/dist/{config-schema-BVIMyiDN.js → .setup/config-schema-B9GwoRlE.mjs} +5 -3
- package/dist/{conversation-binding-route-DFVLUdYF.js → .setup/conversation-binding-route-shed4O6L.mjs} +2 -2
- package/dist/{directory-config-DqfQ42OV.js → .setup/directory-config-CW4ICy0y.mjs} +6 -5
- package/dist/{directory-live-BPaNHjmP.js → .setup/directory-live-C2hI1rq1.mjs} +4 -4
- package/dist/{doctor-contract-BAy7-EUQ.js → .setup/doctor-contract-CtMUqjvk.mjs} +6 -5
- package/dist/{group-policy-BdwszjYn.js → .setup/group-policy-9pMyFFRP.mjs} +72 -41
- package/dist/{message-tool-api-CJ0kjcg5.js → .setup/message-tool-api-CBtuGn2d.mjs} +3 -3
- package/dist/{monitor-Dq5Cmrvp.js → .setup/monitor-t4yqSbLZ.mjs} +4 -4
- package/dist/{outbound-adapter-DYaI8ThX.js → .setup/outbound-adapter-CIO-lnfQ.mjs} +6 -6
- package/dist/{pipeline.runtime-Bd22U0ga.js → .setup/pipeline.runtime-xjOJ8ltM.mjs} +239 -394
- package/dist/{plugin-routes-CLp4obpN.js → .setup/plugin-routes-C3X0eVaK.mjs} +1 -1
- package/dist/{policy-CtQVbde1.js → .setup/policy-CpLMTEad.mjs} +7 -5
- package/dist/{probe-0usmAb0i.js → .setup/probe-DnWN6oBa.mjs} +115 -114
- package/dist/{provider-CN_8hFv2.js → .setup/provider-1mRMBuV5.mjs} +75 -50
- package/dist/{relay-source-BNGpsdwV.js → .setup/relay-source-DiUZ6ltP.mjs} +6 -4
- package/dist/{replies-BSiRQOJ1.js → .setup/replies-Cpng2F6w.mjs} +13 -8
- package/dist/{resolve-channels-Czheznc8.js → .setup/resolve-channels-Dpv7OyKO.mjs} +6 -5
- package/dist/{resolve-users-BAOlNimr.js → .setup/resolve-users-DmyA3D_2.mjs} +6 -5
- package/dist/.setup/runtime-setter-api-CMFvhrAr.mjs +3 -0
- package/dist/{scopes-COSlmhnH.js → .setup/scopes-Dcgl9Nme.mjs} +1 -1
- package/dist/.setup/secret-contract-api-D9UfYujm.mjs +3 -0
- package/dist/{security-audit-B_yKr7MW.js → .setup/security-audit-tCbGyCfU.mjs} +1 -1
- package/dist/{send-DS9ICrBI.js → .setup/send-CBfhmYDj.mjs} +24 -16
- package/dist/{send.runtime-D_Bb6IuH.js → .setup/send.runtime-BTyALMiN.mjs} +1 -1
- package/dist/.setup/setup-plugin-api-B1Y-kMp_.mjs +3 -0
- package/dist/{setup-surface-BGnd2pSe.js → .setup/setup-surface-BcIT0kDT.mjs} +6 -6
- package/dist/{shared-D5B-5hBg.js → .setup/shared-DWQcLrb8.mjs} +9 -9
- package/dist/{slash-dispatch.runtime-CilDmI0c.js → .setup/slash-dispatch.runtime-D5WAai-5.mjs} +1 -1
- package/dist/{target-parsing-BnMD2ZqZ.js → .setup/target-parsing-PbxGDbr9.mjs} +11 -6
- package/dist/{targets-Cx5W_n3W.js → .setup/targets-BlQcnjPc.mjs} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/api.js +17 -17
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/configured-state.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/http-routes-api.js +1 -1
- package/dist/index.js +1 -1
- package/dist/message-tool-api.js +1 -1
- package/dist/runtime-api.js +13 -13
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +4 -3
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/package.json +16 -10
- package/node_modules/@slack/bolt/node_modules/proxy-addr/HISTORY.md +60 -54
- package/node_modules/@slack/bolt/node_modules/proxy-addr/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/proxy-addr/index.js +32 -0
- package/node_modules/@slack/bolt/node_modules/proxy-addr/package.json +8 -4
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +4 -2
- package/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +70 -14
- package/node_modules/undici/lib/dispatcher/client.js +6 -2
- package/node_modules/undici/lib/handler/cache-handler.js +21 -5
- package/node_modules/undici/lib/handler/retry-handler.js +42 -7
- package/node_modules/undici/lib/interceptor/cache.js +20 -1
- package/node_modules/undici/lib/interceptor/decompress.js +146 -14
- package/node_modules/undici/lib/interceptor/dump.js +10 -23
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +245 -150
- package/node_modules/undici/lib/web/websocket/connection.js +1 -1
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/interceptors.d.ts +2 -0
- package/package.json +6 -6
- package/dist/action-runtime.runtime-BL3KzX13.js +0 -2
- package/node_modules/@slack/bolt/node_modules/negotiator/HISTORY.md +0 -114
- /package/dist/{account-configured-sUohAxZr.js → .setup/account-configured-sUohAxZr.mjs} +0 -0
- /package/dist/{cursor-pages-eX7p8Wwt.js → .setup/cursor-pages-eX7p8Wwt.mjs} +0 -0
- /package/dist/{registry-bbjH7IHX.js → .setup/registry-bbjH7IHX.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{runtime-JSVZSWAj.js → .setup/runtime-JSVZSWAj.mjs} +0 -0
- /package/dist/{secret-contract-DxmvbxBF.js → .setup/secret-contract-DxmvbxBF.mjs} +0 -0
- /package/dist/{send-results-eeOu_HYm.js → .setup/send-results-eeOu_HYm.mjs} +0 -0
- /package/dist/{slash-commands.runtime-BTTMlmwy.js → .setup/slash-commands.runtime-BTTMlmwy.mjs} +0 -0
- /package/dist/{slash-skill-commands.runtime-CD1J2ODY.js → .setup/slash-skill-commands.runtime-CD1J2ODY.mjs} +0 -0
- /package/dist/{streaming-compat-B-e0mqM0.js → .setup/streaming-compat-B-e0mqM0.mjs} +0 -0
- /package/dist/{thread-ts-DUGhaYKq.js → .setup/thread-ts-DUGhaYKq.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as normalizeSlackWebhookPath, t as handleSlackHttpRequest } from "./registry-bbjH7IHX.
|
|
1
|
+
import { r as normalizeSlackWebhookPath, t as handleSlackHttpRequest } from "./registry-bbjH7IHX.mjs";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
3
3
|
//#region extensions/slack/src/http/plugin-routes.ts
|
|
4
4
|
function resolveSlackWebhookPaths(config) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as buildSlackChannelPolicyScope, t as buildSlackChannelIdCandidates } from "./group-policy-
|
|
2
|
-
import {
|
|
1
|
+
import { n as buildSlackChannelPolicyScope, t as buildSlackChannelIdCandidates } from "./group-policy-9pMyFFRP.mjs";
|
|
2
|
+
import { D as resolveSlackUserAllowListForTeam, T as normalizeSlackSlug } from "./probe-DnWN6oBa.mjs";
|
|
3
3
|
import { applyChannelMatchMeta, buildChannelKeyCandidates } from "openclaw/plugin-sdk/channel-targets";
|
|
4
4
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
5
5
|
//#region extensions/slack/src/monitor/channel-config.ts
|
|
@@ -18,9 +18,10 @@ function resolveSlackChannelConfig(params) {
|
|
|
18
18
|
const keys = channelKeys ?? Object.keys(entries);
|
|
19
19
|
const normalizedName = channelName ? normalizeSlackSlug(channelName) : "";
|
|
20
20
|
const directName = channelName ? channelName.trim() : "";
|
|
21
|
+
const candidates = buildChannelKeyCandidates(...buildSlackChannelIdCandidates(channelId, params.teamId, { allowUnscoped: params.allowUnscoped }), allowNameMatching ? channelName ? `#${directName}` : void 0 : void 0, allowNameMatching ? directName : void 0, allowNameMatching ? normalizedName : void 0);
|
|
21
22
|
const match = buildSlackChannelPolicyScope({
|
|
22
23
|
channels: entries,
|
|
23
|
-
candidates
|
|
24
|
+
candidates
|
|
24
25
|
});
|
|
25
26
|
const { entry: matched, wildcardEntry: fallback } = match;
|
|
26
27
|
const requireMentionDefault = defaultRequireMention ?? true;
|
|
@@ -47,7 +48,7 @@ function resolveSlackChannelConfig(params) {
|
|
|
47
48
|
const skills = firstDefined(resolved.skills, fallback?.skills);
|
|
48
49
|
const systemPrompt = firstDefined(resolved.systemPrompt, fallback?.systemPrompt);
|
|
49
50
|
const presenceEvents = firstDefined(resolved.presenceEvents, fallback?.presenceEvents);
|
|
50
|
-
|
|
51
|
+
const result = {
|
|
51
52
|
allowed,
|
|
52
53
|
requireMention,
|
|
53
54
|
ignoreOtherMentions,
|
|
@@ -58,7 +59,8 @@ function resolveSlackChannelConfig(params) {
|
|
|
58
59
|
skills,
|
|
59
60
|
systemPrompt,
|
|
60
61
|
presenceEvents
|
|
61
|
-
}
|
|
62
|
+
};
|
|
63
|
+
return applyChannelMatchMeta(result, match);
|
|
62
64
|
}
|
|
63
65
|
//#endregion
|
|
64
66
|
//#region extensions/slack/src/monitor/policy.ts
|
|
@@ -1,20 +1,128 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.
|
|
2
|
-
import { u as formatSlackBotTokenIdentityWarning } from "./accounts-
|
|
3
|
-
import { a as parseSlackTarget } from "./target-parsing-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
+
import { u as formatSlackBotTokenIdentityWarning } from "./accounts-C1FspRF-.mjs";
|
|
3
|
+
import { a as parseSlackTarget } from "./target-parsing-PbxGDbr9.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { isRecord, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
+
import { compileAllowlist, resolveCompiledAllowlistMatch } from "openclaw/plugin-sdk/allow-from";
|
|
7
|
+
import { normalizeHyphenSlug, normalizeStringEntries as normalizeStringEntries$1, normalizeStringEntriesLower } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
6
8
|
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
7
9
|
import { createHash } from "node:crypto";
|
|
8
10
|
import { WebClient } from "@slack/web-api";
|
|
9
11
|
import { addActiveManagedProxyTlsOptions, resolveEnvHttpProxyAgentOptions, resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
10
12
|
import { isDebugProxyGlobalFetchPatchInstalled } from "openclaw/plugin-sdk/proxy-capture";
|
|
11
|
-
import { compileAllowlist, resolveCompiledAllowlistMatch } from "openclaw/plugin-sdk/allow-from";
|
|
12
|
-
import { normalizeHyphenSlug, normalizeStringEntries as normalizeStringEntries$1, normalizeStringEntriesLower } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
13
13
|
import { redactSensitiveText } from "openclaw/plugin-sdk/logging-core";
|
|
14
14
|
import { defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
15
|
+
//#region extensions/slack/src/monitor/allow-list.ts
|
|
16
|
+
const SLACK_SLUG_CACHE_MAX = 512;
|
|
17
|
+
const SLACK_STABLE_USER_ID_RE = /^[ubw][a-z0-9]+$/;
|
|
18
|
+
const slackSlugCache = /* @__PURE__ */ new Map();
|
|
19
|
+
function normalizeSlackSlug(raw) {
|
|
20
|
+
const key = raw ?? "";
|
|
21
|
+
const cached = slackSlugCache.get(key);
|
|
22
|
+
if (cached !== void 0) return cached;
|
|
23
|
+
const normalized = normalizeHyphenSlug(raw);
|
|
24
|
+
slackSlugCache.set(key, normalized);
|
|
25
|
+
if (slackSlugCache.size > SLACK_SLUG_CACHE_MAX) {
|
|
26
|
+
const oldest = slackSlugCache.keys().next();
|
|
27
|
+
if (!oldest.done) slackSlugCache.delete(oldest.value);
|
|
28
|
+
}
|
|
29
|
+
return normalized;
|
|
30
|
+
}
|
|
31
|
+
function normalizeAllowList(list) {
|
|
32
|
+
return normalizeStringEntries$1(list);
|
|
33
|
+
}
|
|
34
|
+
function normalizeAllowListLower(list) {
|
|
35
|
+
return normalizeStringEntriesLower(list);
|
|
36
|
+
}
|
|
37
|
+
function normalizeSlackAllowOwnerEntry(entry) {
|
|
38
|
+
const trimmed = normalizeOptionalLowercaseString(entry);
|
|
39
|
+
if (!trimmed || trimmed === "*") return;
|
|
40
|
+
try {
|
|
41
|
+
const target = parseSlackTarget(trimmed);
|
|
42
|
+
if (target?.kind === "user" && target.teamId) return target.id.toLowerCase();
|
|
43
|
+
} catch {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const withoutPrefix = trimmed.replace(/^(slack:|user:)/, "");
|
|
47
|
+
return SLACK_STABLE_USER_ID_RE.test(withoutPrefix) ? withoutPrefix : void 0;
|
|
48
|
+
}
|
|
49
|
+
function resolveSlackAllowListMatch(params) {
|
|
50
|
+
const compiledAllowList = compileAllowlist(params.allowList);
|
|
51
|
+
const teamId = normalizeOptionalLowercaseString(params.teamId);
|
|
52
|
+
const id = normalizeOptionalLowercaseString(params.id);
|
|
53
|
+
const name = normalizeOptionalLowercaseString(params.name);
|
|
54
|
+
const slug = normalizeSlackSlug(name);
|
|
55
|
+
const scopedCandidates = [{
|
|
56
|
+
value: teamId && id ? `team:${teamId}:user:${id}` : void 0,
|
|
57
|
+
source: "workspace-id"
|
|
58
|
+
}];
|
|
59
|
+
const unscopedCandidates = [
|
|
60
|
+
{
|
|
61
|
+
value: id,
|
|
62
|
+
source: "id"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: id ? `slack:${id}` : void 0,
|
|
66
|
+
source: "prefixed-id"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
value: id ? `user:${id}` : void 0,
|
|
70
|
+
source: "prefixed-user"
|
|
71
|
+
},
|
|
72
|
+
...params.allowNameMatching === true ? [
|
|
73
|
+
{
|
|
74
|
+
value: name,
|
|
75
|
+
source: "name"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
value: name ? `slack:${name}` : void 0,
|
|
79
|
+
source: "prefixed-name"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
value: slug,
|
|
83
|
+
source: "slug"
|
|
84
|
+
}
|
|
85
|
+
] : []
|
|
86
|
+
];
|
|
87
|
+
return resolveCompiledAllowlistMatch({
|
|
88
|
+
compiledAllowlist: compiledAllowList,
|
|
89
|
+
candidates: [...scopedCandidates, ...unscopedCandidates]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function allowListMatches(params) {
|
|
93
|
+
return resolveSlackAllowListMatch(params).allowed;
|
|
94
|
+
}
|
|
95
|
+
function resolveSlackUserAllowed(params) {
|
|
96
|
+
const allowList = normalizeAllowListLower(params.allowList);
|
|
97
|
+
if (allowList.length === 0) return true;
|
|
98
|
+
return allowListMatches({
|
|
99
|
+
allowList,
|
|
100
|
+
teamId: params.teamId,
|
|
101
|
+
id: params.userId,
|
|
102
|
+
name: params.userName,
|
|
103
|
+
allowNameMatching: params.allowNameMatching
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function resolveSlackUserAllowListForTeam(params) {
|
|
107
|
+
const allowList = normalizeAllowListLower(params.allowList);
|
|
108
|
+
const teamId = normalizeOptionalLowercaseString(params.teamId);
|
|
109
|
+
return allowList.flatMap((entry) => {
|
|
110
|
+
if (entry === "*") return [entry];
|
|
111
|
+
if (!entry.startsWith("team:")) return [entry];
|
|
112
|
+
try {
|
|
113
|
+
const target = parseSlackTarget(entry);
|
|
114
|
+
if (target?.kind === "user" && target.teamId?.toLowerCase() === teamId) return [entry];
|
|
115
|
+
return params.preserveUnmatchedScopedEntries ? [entry] : [];
|
|
116
|
+
} catch {
|
|
117
|
+
return params.preserveUnmatchedScopedEntries ? [entry] : [];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
15
122
|
//#region extensions/slack/src/client-options.ts
|
|
16
123
|
const requireFromSlackSocketMode = (() => {
|
|
17
|
-
|
|
124
|
+
const require = createRequire(import.meta.url);
|
|
125
|
+
return createRequire(require.resolve("@slack/socket-mode/package.json"));
|
|
18
126
|
})();
|
|
19
127
|
function loadSlackUndiciRuntime() {
|
|
20
128
|
return requireFromSlackSocketMode("undici");
|
|
@@ -179,113 +287,6 @@ function getSlackListenerUploadCompletionClient(params) {
|
|
|
179
287
|
return client;
|
|
180
288
|
}
|
|
181
289
|
//#endregion
|
|
182
|
-
//#region extensions/slack/src/monitor/allow-list.ts
|
|
183
|
-
const SLACK_SLUG_CACHE_MAX = 512;
|
|
184
|
-
const SLACK_STABLE_USER_ID_RE = /^[ubw][a-z0-9]+$/;
|
|
185
|
-
const slackSlugCache = /* @__PURE__ */ new Map();
|
|
186
|
-
function normalizeSlackSlug(raw) {
|
|
187
|
-
const key = raw ?? "";
|
|
188
|
-
const cached = slackSlugCache.get(key);
|
|
189
|
-
if (cached !== void 0) return cached;
|
|
190
|
-
const normalized = normalizeHyphenSlug(raw);
|
|
191
|
-
slackSlugCache.set(key, normalized);
|
|
192
|
-
if (slackSlugCache.size > SLACK_SLUG_CACHE_MAX) {
|
|
193
|
-
const oldest = slackSlugCache.keys().next();
|
|
194
|
-
if (!oldest.done) slackSlugCache.delete(oldest.value);
|
|
195
|
-
}
|
|
196
|
-
return normalized;
|
|
197
|
-
}
|
|
198
|
-
function normalizeAllowList(list) {
|
|
199
|
-
return normalizeStringEntries$1(list);
|
|
200
|
-
}
|
|
201
|
-
function normalizeAllowListLower(list) {
|
|
202
|
-
return normalizeStringEntriesLower(list);
|
|
203
|
-
}
|
|
204
|
-
function normalizeSlackAllowOwnerEntry(entry) {
|
|
205
|
-
const trimmed = normalizeOptionalLowercaseString(entry);
|
|
206
|
-
if (!trimmed || trimmed === "*") return;
|
|
207
|
-
try {
|
|
208
|
-
const target = parseSlackTarget(trimmed);
|
|
209
|
-
if (target?.kind === "user" && target.teamId) return target.id.toLowerCase();
|
|
210
|
-
} catch {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
const withoutPrefix = trimmed.replace(/^(slack:|user:)/, "");
|
|
214
|
-
return SLACK_STABLE_USER_ID_RE.test(withoutPrefix) ? withoutPrefix : void 0;
|
|
215
|
-
}
|
|
216
|
-
function resolveSlackAllowListMatch(params) {
|
|
217
|
-
const compiledAllowList = compileAllowlist(params.allowList);
|
|
218
|
-
const teamId = normalizeOptionalLowercaseString(params.teamId);
|
|
219
|
-
const id = normalizeOptionalLowercaseString(params.id);
|
|
220
|
-
const name = normalizeOptionalLowercaseString(params.name);
|
|
221
|
-
const slug = normalizeSlackSlug(name);
|
|
222
|
-
const scopedCandidates = [{
|
|
223
|
-
value: teamId && id ? `team:${teamId}:user:${id}` : void 0,
|
|
224
|
-
source: "workspace-id"
|
|
225
|
-
}];
|
|
226
|
-
const unscopedCandidates = [
|
|
227
|
-
{
|
|
228
|
-
value: id,
|
|
229
|
-
source: "id"
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
value: id ? `slack:${id}` : void 0,
|
|
233
|
-
source: "prefixed-id"
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
value: id ? `user:${id}` : void 0,
|
|
237
|
-
source: "prefixed-user"
|
|
238
|
-
},
|
|
239
|
-
...params.allowNameMatching === true ? [
|
|
240
|
-
{
|
|
241
|
-
value: name,
|
|
242
|
-
source: "name"
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
value: name ? `slack:${name}` : void 0,
|
|
246
|
-
source: "prefixed-name"
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
value: slug,
|
|
250
|
-
source: "slug"
|
|
251
|
-
}
|
|
252
|
-
] : []
|
|
253
|
-
];
|
|
254
|
-
return resolveCompiledAllowlistMatch({
|
|
255
|
-
compiledAllowlist: compiledAllowList,
|
|
256
|
-
candidates: [...scopedCandidates, ...unscopedCandidates]
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
function allowListMatches(params) {
|
|
260
|
-
return resolveSlackAllowListMatch(params).allowed;
|
|
261
|
-
}
|
|
262
|
-
function resolveSlackUserAllowed(params) {
|
|
263
|
-
const allowList = normalizeAllowListLower(params.allowList);
|
|
264
|
-
if (allowList.length === 0) return true;
|
|
265
|
-
return allowListMatches({
|
|
266
|
-
allowList,
|
|
267
|
-
teamId: params.teamId,
|
|
268
|
-
id: params.userId,
|
|
269
|
-
name: params.userName,
|
|
270
|
-
allowNameMatching: params.allowNameMatching
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
function resolveSlackUserAllowListForTeam(params) {
|
|
274
|
-
const allowList = normalizeAllowListLower(params.allowList);
|
|
275
|
-
const teamId = normalizeOptionalLowercaseString(params.teamId);
|
|
276
|
-
return allowList.flatMap((entry) => {
|
|
277
|
-
if (entry === "*") return [entry];
|
|
278
|
-
if (!entry.startsWith("team:")) return [entry];
|
|
279
|
-
try {
|
|
280
|
-
const target = parseSlackTarget(entry);
|
|
281
|
-
if (target?.kind === "user" && target.teamId?.toLowerCase() === teamId) return [entry];
|
|
282
|
-
return params.preserveUnmatchedScopedEntries ? [entry] : [];
|
|
283
|
-
} catch {
|
|
284
|
-
return params.preserveUnmatchedScopedEntries ? [entry] : [];
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
//#endregion
|
|
289
290
|
//#region extensions/slack/src/errors.ts
|
|
290
291
|
const NO_ERROR_DETAIL = "no error detail";
|
|
291
292
|
function redact(value) {
|
|
@@ -549,4 +550,4 @@ async function probeSlack(token, timeoutMs = 2500, opts) {
|
|
|
549
550
|
}));
|
|
550
551
|
}
|
|
551
552
|
//#endregion
|
|
552
|
-
export {
|
|
553
|
+
export { normalizeAllowListLower as C, resolveSlackUserAllowListForTeam as D, resolveSlackAllowListMatch as E, resolveSlackUserAllowed as O, normalizeAllowList as S, normalizeSlackSlug as T, resolveSlackLookupClientOptions as _, slackIngressIdentity as a, resolveSlackWriteClientOptions as b, createSlackReadClient as c, createSlackWebClient as d, createSlackWriteClient as f, SLACK_WRITE_RETRY_OPTIONS as g, SLACK_DEFAULT_RETRY_OPTIONS as h, createSlackIngressSubject as i, createSlackStartupAuthClient as l, getSlackWriteClient as m, probe_exports as n, formatSlackError as o, getSlackListenerUploadCompletionClient as p, SLACK_USER_NAME_KIND as r, createSlackLookupClient as s, probeSlack as t, createSlackTokenCacheKey as u, resolveSlackProxyDispatcher as v, normalizeSlackAllowOwnerEntry as w, allowListMatches as x, resolveSlackWebClientOptions as y };
|