@opentag/slack 0.1.0 → 0.3.0
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/LICENSE +21 -0
- package/README.md +2 -1
- package/dist/dispatcher-events.d.ts +7 -0
- package/dist/dispatcher-events.d.ts.map +1 -0
- package/dist/events.d.ts +107 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +860 -16
- package/dist/index.js.map +1 -1
- package/dist/ingress.d.ts +43 -0
- package/dist/ingress.d.ts.map +1 -0
- package/dist/normalize.d.ts +3 -0
- package/dist/normalize.d.ts.map +1 -1
- package/dist/render.d.ts +72 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/socket-mode.d.ts +33 -0
- package/dist/socket-mode.d.ts.map +1 -0
- package/package.json +11 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Amplift
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ pnpm add @opentag/slack
|
|
|
15
15
|
- `normalizeSlackAppMention`: converts a Slack app mention into an `OpenTagEvent`.
|
|
16
16
|
- `slackThreadKey`: encodes team, channel, and thread timestamp for callback routing.
|
|
17
17
|
- `parseSlackThreadKey`: decodes a Slack thread key for `chat.postMessage`.
|
|
18
|
-
- `SlackChannelBinding`: channel
|
|
18
|
+
- `SlackChannelBinding`: Slack compatibility binding contract that maps into the generic channel binding layer.
|
|
19
19
|
|
|
20
20
|
## Example
|
|
21
21
|
|
|
@@ -34,6 +34,7 @@ const event = normalizeSlackAppMention({
|
|
|
34
34
|
binding: {
|
|
35
35
|
teamId: "T123",
|
|
36
36
|
channelId: "C123",
|
|
37
|
+
repoProvider: "github",
|
|
37
38
|
owner: "acme",
|
|
38
39
|
repo: "demo"
|
|
39
40
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SlackEventProcessorInput } from "./events.js";
|
|
2
|
+
export type SlackDispatcherEventConfig = {
|
|
3
|
+
dispatcherUrl: string;
|
|
4
|
+
dispatcherToken?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function createSlackDispatcherEventProcessorInput(config: SlackDispatcherEventConfig): SlackEventProcessorInput;
|
|
7
|
+
//# sourceMappingURL=dispatcher-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher-events.d.ts","sourceRoot":"","sources":["../src/dispatcher-events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,0BAA0B,GAAG;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,wBAAgB,wCAAwC,CAAC,MAAM,EAAE,0BAA0B,GAAG,wBAAwB,CAsCrH"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type OpenTagEvent } from "@opentag/core";
|
|
2
|
+
import { type SlackChannelBinding } from "./normalize.js";
|
|
3
|
+
export type SlackThreadActionInput = {
|
|
4
|
+
id: string;
|
|
5
|
+
rawText: string;
|
|
6
|
+
actor: {
|
|
7
|
+
provider: "slack";
|
|
8
|
+
providerUserId: string;
|
|
9
|
+
handle: string;
|
|
10
|
+
organizationId: string;
|
|
11
|
+
};
|
|
12
|
+
callback: {
|
|
13
|
+
provider: "slack";
|
|
14
|
+
uri: string;
|
|
15
|
+
threadKey: string;
|
|
16
|
+
};
|
|
17
|
+
metadata: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
export type SlackEventEnvelope = {
|
|
20
|
+
token?: string;
|
|
21
|
+
type: "url_verification" | "event_callback";
|
|
22
|
+
challenge?: string;
|
|
23
|
+
team_id?: string;
|
|
24
|
+
api_app_id?: string;
|
|
25
|
+
event?: {
|
|
26
|
+
type: string;
|
|
27
|
+
user?: string;
|
|
28
|
+
text?: string;
|
|
29
|
+
ts?: string;
|
|
30
|
+
thread_ts?: string;
|
|
31
|
+
channel?: string;
|
|
32
|
+
subtype?: string;
|
|
33
|
+
bot_id?: string;
|
|
34
|
+
};
|
|
35
|
+
event_id?: string;
|
|
36
|
+
event_time?: number;
|
|
37
|
+
authorizations?: Array<{
|
|
38
|
+
user_id?: string;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
export type SlackInteractiveBlockAction = {
|
|
42
|
+
type?: string;
|
|
43
|
+
action_id?: string;
|
|
44
|
+
block_id?: string;
|
|
45
|
+
value?: string;
|
|
46
|
+
action_ts?: string;
|
|
47
|
+
};
|
|
48
|
+
export type SlackInteractivePayload = {
|
|
49
|
+
type: "block_actions";
|
|
50
|
+
api_app_id?: string;
|
|
51
|
+
team?: {
|
|
52
|
+
id?: string;
|
|
53
|
+
domain?: string;
|
|
54
|
+
};
|
|
55
|
+
user?: {
|
|
56
|
+
id?: string;
|
|
57
|
+
username?: string;
|
|
58
|
+
name?: string;
|
|
59
|
+
};
|
|
60
|
+
channel?: {
|
|
61
|
+
id?: string;
|
|
62
|
+
name?: string;
|
|
63
|
+
};
|
|
64
|
+
message?: {
|
|
65
|
+
ts?: string;
|
|
66
|
+
thread_ts?: string;
|
|
67
|
+
};
|
|
68
|
+
container?: {
|
|
69
|
+
type?: string;
|
|
70
|
+
channel_id?: string;
|
|
71
|
+
message_ts?: string;
|
|
72
|
+
thread_ts?: string;
|
|
73
|
+
};
|
|
74
|
+
trigger_id?: string;
|
|
75
|
+
actions?: SlackInteractiveBlockAction[];
|
|
76
|
+
};
|
|
77
|
+
export type SlackIngressPayload = SlackEventEnvelope | SlackInteractivePayload;
|
|
78
|
+
export type SlackAppRuntimeConfig = {
|
|
79
|
+
agentId: string;
|
|
80
|
+
appId?: string;
|
|
81
|
+
callbackUri?: string;
|
|
82
|
+
};
|
|
83
|
+
export type SlackEventProcessorInput = {
|
|
84
|
+
resolveChannelBinding(input: {
|
|
85
|
+
teamId: string;
|
|
86
|
+
channelId: string;
|
|
87
|
+
}): Promise<SlackChannelBinding | null>;
|
|
88
|
+
createRun(event: OpenTagEvent): Promise<{
|
|
89
|
+
runId: string;
|
|
90
|
+
}>;
|
|
91
|
+
submitThreadAction?(action: SlackThreadActionInput): Promise<unknown>;
|
|
92
|
+
now(): string;
|
|
93
|
+
};
|
|
94
|
+
export type SlackEventProcessorStatus = 200 | 400;
|
|
95
|
+
export type SlackEventProcessorResult = {
|
|
96
|
+
kind: "json";
|
|
97
|
+
status: SlackEventProcessorStatus;
|
|
98
|
+
body: Record<string, unknown>;
|
|
99
|
+
} | {
|
|
100
|
+
kind: "text";
|
|
101
|
+
status: SlackEventProcessorStatus;
|
|
102
|
+
body: string;
|
|
103
|
+
};
|
|
104
|
+
export declare function createSlackEventProcessor(input: SlackEventProcessorInput): {
|
|
105
|
+
process(payload: SlackIngressPayload, slackApp: SlackAppRuntimeConfig): Promise<SlackEventProcessorResult>;
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAwE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGhI,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QACL,QAAQ,EAAE,OAAO,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,QAAQ,EAAE;QACR,QAAQ,EAAE,OAAO,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,kBAAkB,GAAG,gBAAgB,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MA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B,GAAG,OAAO,CAAC,yBAAyB,CAAC;EA6FnH"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|