@shipfox/api-integration-slack-dto 4.0.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/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +193 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +108 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +56 -0
- package/src/index.ts +1 -0
- package/src/schemas/index.test.ts +151 -0
- package/src/schemas/index.ts +136 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +9 -0
- package/vitest.config.ts +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ shipfox-tsc-emit
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ shipfox-tsc-check
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# @shipfox/api-integration-slack-dto
|
|
2
|
+
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dda7c54: Adds the Slack integration provider contract with OAuth, event, command, and E2E schemas.
|
|
8
|
+
- 7267872: Adds signed Slack Events API and slash-command receivers that publish normalized integration events without persisting command verification tokens.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shipfox
|
|
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/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './schemas/index.js';\n"],"names":[],"mappings":"AAAA,cAAc,qBAAqB"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SLACK_PROVIDER = "slack";
|
|
3
|
+
export type SlackProvider = typeof SLACK_PROVIDER;
|
|
4
|
+
export declare const slackApiEventTypes: readonly ["app_mention", "message", "reaction_added"];
|
|
5
|
+
export declare const SLACK_SLASH_COMMAND_EVENT: "slash_command";
|
|
6
|
+
export declare const slackEventNames: readonly ["app_mention", "message", "reaction_added", "slash_command"];
|
|
7
|
+
export type SlackApiEventType = (typeof slackApiEventTypes)[number];
|
|
8
|
+
export type SlackEventName = (typeof slackEventNames)[number];
|
|
9
|
+
export declare const slackInnerEventBaseSchema: z.ZodObject<{
|
|
10
|
+
type: z.ZodString;
|
|
11
|
+
}, z.core.$loose>;
|
|
12
|
+
export declare const slackInnerEventSchema: z.ZodObject<{
|
|
13
|
+
type: z.ZodEnum<{
|
|
14
|
+
app_mention: "app_mention";
|
|
15
|
+
message: "message";
|
|
16
|
+
reaction_added: "reaction_added";
|
|
17
|
+
}>;
|
|
18
|
+
}, z.core.$loose>;
|
|
19
|
+
export declare const slackEventBaseEnvelopeSchema: z.ZodObject<{
|
|
20
|
+
type: z.ZodLiteral<"event_callback">;
|
|
21
|
+
team_id: z.ZodString;
|
|
22
|
+
api_app_id: z.ZodString;
|
|
23
|
+
event: z.ZodObject<{
|
|
24
|
+
type: z.ZodString;
|
|
25
|
+
}, z.core.$loose>;
|
|
26
|
+
event_id: z.ZodString;
|
|
27
|
+
event_time: z.ZodNumber;
|
|
28
|
+
authorizations: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type SlackEventBaseEnvelopeDto = z.infer<typeof slackEventBaseEnvelopeSchema>;
|
|
31
|
+
export declare const slackEventEnvelopeSchema: z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"event_callback">;
|
|
33
|
+
team_id: z.ZodString;
|
|
34
|
+
api_app_id: z.ZodString;
|
|
35
|
+
event_id: z.ZodString;
|
|
36
|
+
event_time: z.ZodNumber;
|
|
37
|
+
authorizations: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
38
|
+
event: z.ZodObject<{
|
|
39
|
+
type: z.ZodEnum<{
|
|
40
|
+
app_mention: "app_mention";
|
|
41
|
+
message: "message";
|
|
42
|
+
reaction_added: "reaction_added";
|
|
43
|
+
}>;
|
|
44
|
+
}, z.core.$loose>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
export type SlackEventEnvelopeDto = z.infer<typeof slackEventEnvelopeSchema>;
|
|
47
|
+
export declare const slackUrlVerificationSchema: z.ZodObject<{
|
|
48
|
+
type: z.ZodLiteral<"url_verification">;
|
|
49
|
+
token: z.ZodString;
|
|
50
|
+
challenge: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type SlackUrlVerificationDto = z.infer<typeof slackUrlVerificationSchema>;
|
|
53
|
+
export declare const slackEventsRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<"url_verification">;
|
|
55
|
+
token: z.ZodString;
|
|
56
|
+
challenge: z.ZodString;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"event_callback">;
|
|
59
|
+
team_id: z.ZodString;
|
|
60
|
+
api_app_id: z.ZodString;
|
|
61
|
+
event: z.ZodObject<{
|
|
62
|
+
type: z.ZodString;
|
|
63
|
+
}, z.core.$loose>;
|
|
64
|
+
event_id: z.ZodString;
|
|
65
|
+
event_time: z.ZodNumber;
|
|
66
|
+
authorizations: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
67
|
+
}, z.core.$strip>], "type">;
|
|
68
|
+
export type SlackEventsRequestDto = z.infer<typeof slackEventsRequestSchema>;
|
|
69
|
+
export declare const slackSlashCommandSchema: z.ZodObject<{
|
|
70
|
+
token: z.ZodString;
|
|
71
|
+
command: z.ZodString;
|
|
72
|
+
team_id: z.ZodString;
|
|
73
|
+
channel_id: z.ZodString;
|
|
74
|
+
user_id: z.ZodString;
|
|
75
|
+
response_url: z.ZodString;
|
|
76
|
+
trigger_id: z.ZodString;
|
|
77
|
+
text: z.ZodDefault<z.ZodString>;
|
|
78
|
+
team_domain: z.ZodOptional<z.ZodString>;
|
|
79
|
+
channel_name: z.ZodOptional<z.ZodString>;
|
|
80
|
+
user_name: z.ZodOptional<z.ZodString>;
|
|
81
|
+
api_app_id: z.ZodOptional<z.ZodString>;
|
|
82
|
+
is_enterprise_install: z.ZodOptional<z.ZodString>;
|
|
83
|
+
enterprise_id: z.ZodOptional<z.ZodString>;
|
|
84
|
+
enterprise_name: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
export type SlackSlashCommandDto = z.infer<typeof slackSlashCommandSchema>;
|
|
87
|
+
export declare const slackSlashCommandPayloadSchema: z.ZodObject<{
|
|
88
|
+
team_id: z.ZodString;
|
|
89
|
+
api_app_id: z.ZodOptional<z.ZodString>;
|
|
90
|
+
command: z.ZodString;
|
|
91
|
+
channel_id: z.ZodString;
|
|
92
|
+
user_id: z.ZodString;
|
|
93
|
+
response_url: z.ZodString;
|
|
94
|
+
trigger_id: z.ZodString;
|
|
95
|
+
text: z.ZodDefault<z.ZodString>;
|
|
96
|
+
team_domain: z.ZodOptional<z.ZodString>;
|
|
97
|
+
channel_name: z.ZodOptional<z.ZodString>;
|
|
98
|
+
user_name: z.ZodOptional<z.ZodString>;
|
|
99
|
+
is_enterprise_install: z.ZodOptional<z.ZodString>;
|
|
100
|
+
enterprise_id: z.ZodOptional<z.ZodString>;
|
|
101
|
+
enterprise_name: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
export type SlackSlashCommandPayloadDto = z.infer<typeof slackSlashCommandPayloadSchema>;
|
|
104
|
+
export declare const slackEventPayloadSchema: z.ZodObject<{
|
|
105
|
+
type: z.ZodEnum<{
|
|
106
|
+
app_mention: "app_mention";
|
|
107
|
+
message: "message";
|
|
108
|
+
reaction_added: "reaction_added";
|
|
109
|
+
}>;
|
|
110
|
+
team_id: z.ZodString;
|
|
111
|
+
api_app_id: z.ZodString;
|
|
112
|
+
event_id: z.ZodString;
|
|
113
|
+
event_time: z.ZodNumber;
|
|
114
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
115
|
+
channel_type: z.ZodOptional<z.ZodString>;
|
|
116
|
+
user: z.ZodOptional<z.ZodString>;
|
|
117
|
+
ts: z.ZodOptional<z.ZodString>;
|
|
118
|
+
thread_ts: z.ZodOptional<z.ZodString>;
|
|
119
|
+
text: z.ZodOptional<z.ZodString>;
|
|
120
|
+
bot_id: z.ZodOptional<z.ZodString>;
|
|
121
|
+
reaction: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, z.core.$loose>;
|
|
123
|
+
export type SlackEventPayloadDto = z.infer<typeof slackEventPayloadSchema>;
|
|
124
|
+
export declare const createSlackInstallBodySchema: z.ZodObject<{
|
|
125
|
+
workspace_id: z.ZodString;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export type CreateSlackInstallBodyDto = z.infer<typeof createSlackInstallBodySchema>;
|
|
128
|
+
export declare const createSlackInstallResponseSchema: z.ZodObject<{
|
|
129
|
+
install_url: z.ZodString;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
export type CreateSlackInstallResponseDto = z.infer<typeof createSlackInstallResponseSchema>;
|
|
132
|
+
export declare const slackCallbackQuerySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
133
|
+
code: z.ZodString;
|
|
134
|
+
state: z.ZodString;
|
|
135
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
136
|
+
error: z.ZodString;
|
|
137
|
+
error_description: z.ZodOptional<z.ZodString>;
|
|
138
|
+
state: z.ZodString;
|
|
139
|
+
}, z.core.$strip>]>;
|
|
140
|
+
export type SlackCallbackQueryDto = z.infer<typeof slackCallbackQuerySchema>;
|
|
141
|
+
export declare const slackCallbackResponseSchema: z.ZodObject<{
|
|
142
|
+
id: z.ZodString;
|
|
143
|
+
workspace_id: z.ZodString;
|
|
144
|
+
provider: z.ZodString;
|
|
145
|
+
external_account_id: z.ZodString;
|
|
146
|
+
slug: z.ZodString;
|
|
147
|
+
display_name: z.ZodString;
|
|
148
|
+
lifecycle_status: z.ZodEnum<{
|
|
149
|
+
error: "error";
|
|
150
|
+
active: "active";
|
|
151
|
+
disabled: "disabled";
|
|
152
|
+
}>;
|
|
153
|
+
capabilities: z.ZodArray<z.ZodEnum<{
|
|
154
|
+
source_control: "source_control";
|
|
155
|
+
agent_tools: "agent_tools";
|
|
156
|
+
}>>;
|
|
157
|
+
external_url: z.ZodOptional<z.ZodString>;
|
|
158
|
+
created_at: z.ZodString;
|
|
159
|
+
updated_at: z.ZodString;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
export type SlackCallbackResponseDto = z.infer<typeof slackCallbackResponseSchema>;
|
|
162
|
+
export declare const createE2eSlackConnectionBodySchema: z.ZodObject<{
|
|
163
|
+
workspace_id: z.ZodString;
|
|
164
|
+
team_id: z.ZodString;
|
|
165
|
+
team_name: z.ZodString;
|
|
166
|
+
app_id: z.ZodString;
|
|
167
|
+
bot_user_id: z.ZodString;
|
|
168
|
+
bot_token: z.ZodString;
|
|
169
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
export type CreateE2eSlackConnectionBodyDto = z.infer<typeof createE2eSlackConnectionBodySchema>;
|
|
172
|
+
export declare const createE2eSlackConnectionResponseSchema: z.ZodObject<{
|
|
173
|
+
id: z.ZodString;
|
|
174
|
+
workspace_id: z.ZodString;
|
|
175
|
+
provider: z.ZodString;
|
|
176
|
+
external_account_id: z.ZodString;
|
|
177
|
+
slug: z.ZodString;
|
|
178
|
+
display_name: z.ZodString;
|
|
179
|
+
lifecycle_status: z.ZodEnum<{
|
|
180
|
+
error: "error";
|
|
181
|
+
active: "active";
|
|
182
|
+
disabled: "disabled";
|
|
183
|
+
}>;
|
|
184
|
+
capabilities: z.ZodArray<z.ZodEnum<{
|
|
185
|
+
source_control: "source_control";
|
|
186
|
+
agent_tools: "agent_tools";
|
|
187
|
+
}>>;
|
|
188
|
+
external_url: z.ZodOptional<z.ZodString>;
|
|
189
|
+
created_at: z.ZodString;
|
|
190
|
+
updated_at: z.ZodString;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
export type CreateE2eSlackConnectionResponseDto = z.infer<typeof createE2eSlackConnectionResponseSchema>;
|
|
193
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,cAAc,UAAU,CAAC;AACtC,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAC;AAElD,eAAO,MAAM,kBAAkB,uDAAwD,CAAC;AACxF,eAAO,MAAM,yBAAyB,EAAG,eAAwB,CAAC;AAClE,eAAO,MAAM,eAAe,wEAA8D,CAAC;AAE3F,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,eAAO,MAAM,yBAAyB;;iBAItB,CAAC;AAEjB,eAAO,MAAM,qBAAqB;;;;;;iBAIlB,CAAC;AAEjB,eAAO,MAAM,4BAA4B;;;;;;;;;;iBAQvC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAErF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;iBAEnC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE7E,eAAO,MAAM,0BAA0B;;;;iBAIrC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEjF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;2BAGnC,CAAC;AACH,MAAM,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rF,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,sCAAsC,CAC9C,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { integrationConnectionDtoSchema } from '@shipfox/api-integration-core-dto';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export const SLACK_PROVIDER = 'slack';
|
|
4
|
+
export const slackApiEventTypes = [
|
|
5
|
+
'app_mention',
|
|
6
|
+
'message',
|
|
7
|
+
'reaction_added'
|
|
8
|
+
];
|
|
9
|
+
export const SLACK_SLASH_COMMAND_EVENT = 'slash_command';
|
|
10
|
+
export const slackEventNames = [
|
|
11
|
+
...slackApiEventTypes,
|
|
12
|
+
SLACK_SLASH_COMMAND_EVENT
|
|
13
|
+
];
|
|
14
|
+
export const slackInnerEventBaseSchema = z.object({
|
|
15
|
+
type: z.string().min(1)
|
|
16
|
+
}).passthrough();
|
|
17
|
+
export const slackInnerEventSchema = z.object({
|
|
18
|
+
type: z.enum(slackApiEventTypes)
|
|
19
|
+
}).passthrough();
|
|
20
|
+
export const slackEventBaseEnvelopeSchema = z.object({
|
|
21
|
+
type: z.literal('event_callback'),
|
|
22
|
+
team_id: z.string().min(1),
|
|
23
|
+
api_app_id: z.string().min(1),
|
|
24
|
+
event: slackInnerEventBaseSchema,
|
|
25
|
+
event_id: z.string().min(1),
|
|
26
|
+
event_time: z.number().int(),
|
|
27
|
+
authorizations: z.array(z.unknown()).optional()
|
|
28
|
+
});
|
|
29
|
+
export const slackEventEnvelopeSchema = slackEventBaseEnvelopeSchema.extend({
|
|
30
|
+
event: slackInnerEventSchema
|
|
31
|
+
});
|
|
32
|
+
export const slackUrlVerificationSchema = z.object({
|
|
33
|
+
type: z.literal('url_verification'),
|
|
34
|
+
token: z.string().min(1),
|
|
35
|
+
challenge: z.string().min(1)
|
|
36
|
+
});
|
|
37
|
+
export const slackEventsRequestSchema = z.discriminatedUnion('type', [
|
|
38
|
+
slackUrlVerificationSchema,
|
|
39
|
+
slackEventBaseEnvelopeSchema
|
|
40
|
+
]);
|
|
41
|
+
export const slackSlashCommandSchema = z.object({
|
|
42
|
+
token: z.string().min(1),
|
|
43
|
+
command: z.string().min(1),
|
|
44
|
+
team_id: z.string().min(1),
|
|
45
|
+
channel_id: z.string().min(1),
|
|
46
|
+
user_id: z.string().min(1),
|
|
47
|
+
response_url: z.string().url(),
|
|
48
|
+
trigger_id: z.string().min(1),
|
|
49
|
+
text: z.string().default(''),
|
|
50
|
+
team_domain: z.string().min(1).optional(),
|
|
51
|
+
channel_name: z.string().min(1).optional(),
|
|
52
|
+
user_name: z.string().min(1).optional(),
|
|
53
|
+
api_app_id: z.string().min(1).optional(),
|
|
54
|
+
is_enterprise_install: z.string().min(1).optional(),
|
|
55
|
+
enterprise_id: z.string().min(1).optional(),
|
|
56
|
+
enterprise_name: z.string().min(1).optional()
|
|
57
|
+
});
|
|
58
|
+
export const slackSlashCommandPayloadSchema = slackSlashCommandSchema.omit({
|
|
59
|
+
token: true
|
|
60
|
+
});
|
|
61
|
+
export const slackEventPayloadSchema = z.object({
|
|
62
|
+
type: z.enum(slackApiEventTypes),
|
|
63
|
+
team_id: z.string().min(1),
|
|
64
|
+
api_app_id: z.string().min(1),
|
|
65
|
+
event_id: z.string().min(1),
|
|
66
|
+
event_time: z.number().int(),
|
|
67
|
+
channel: z.string().min(1).optional(),
|
|
68
|
+
channel_type: z.string().min(1).optional(),
|
|
69
|
+
user: z.string().min(1).optional(),
|
|
70
|
+
ts: z.string().min(1).optional(),
|
|
71
|
+
thread_ts: z.string().min(1).optional(),
|
|
72
|
+
text: z.string().optional(),
|
|
73
|
+
bot_id: z.string().min(1).optional(),
|
|
74
|
+
reaction: z.string().min(1).optional()
|
|
75
|
+
}).passthrough();
|
|
76
|
+
export const createSlackInstallBodySchema = z.object({
|
|
77
|
+
workspace_id: z.string().uuid()
|
|
78
|
+
});
|
|
79
|
+
export const createSlackInstallResponseSchema = z.object({
|
|
80
|
+
install_url: z.string().url()
|
|
81
|
+
});
|
|
82
|
+
export const slackCallbackQuerySchema = z.union([
|
|
83
|
+
z.object({
|
|
84
|
+
code: z.string().min(1),
|
|
85
|
+
state: z.string().min(1)
|
|
86
|
+
}),
|
|
87
|
+
z.object({
|
|
88
|
+
error: z.string().min(1),
|
|
89
|
+
error_description: z.string().min(1).optional(),
|
|
90
|
+
state: z.string().min(1)
|
|
91
|
+
})
|
|
92
|
+
]);
|
|
93
|
+
export const slackCallbackResponseSchema = integrationConnectionDtoSchema;
|
|
94
|
+
export const createE2eSlackConnectionBodySchema = z.object({
|
|
95
|
+
workspace_id: z.string().uuid(),
|
|
96
|
+
team_id: z.string().min(1),
|
|
97
|
+
team_name: z.string().min(1),
|
|
98
|
+
app_id: z.string().min(1),
|
|
99
|
+
bot_user_id: z.string().min(1),
|
|
100
|
+
bot_token: z.string().min(1),
|
|
101
|
+
scopes: z.array(z.string().min(1)).min(1).default([
|
|
102
|
+
'app_mentions:read',
|
|
103
|
+
'chat:write'
|
|
104
|
+
])
|
|
105
|
+
});
|
|
106
|
+
export const createE2eSlackConnectionResponseSchema = integrationConnectionDtoSchema;
|
|
107
|
+
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schemas/index.ts"],"sourcesContent":["import {integrationConnectionDtoSchema} from '@shipfox/api-integration-core-dto';\nimport {z} from 'zod';\n\nexport const SLACK_PROVIDER = 'slack';\nexport type SlackProvider = typeof SLACK_PROVIDER;\n\nexport const slackApiEventTypes = ['app_mention', 'message', 'reaction_added'] as const;\nexport const SLACK_SLASH_COMMAND_EVENT = 'slash_command' as const;\nexport const slackEventNames = [...slackApiEventTypes, SLACK_SLASH_COMMAND_EVENT] as const;\n\nexport type SlackApiEventType = (typeof slackApiEventTypes)[number];\nexport type SlackEventName = (typeof slackEventNames)[number];\n\nexport const slackInnerEventBaseSchema = z\n .object({\n type: z.string().min(1),\n })\n .passthrough();\n\nexport const slackInnerEventSchema = z\n .object({\n type: z.enum(slackApiEventTypes),\n })\n .passthrough();\n\nexport const slackEventBaseEnvelopeSchema = z.object({\n type: z.literal('event_callback'),\n team_id: z.string().min(1),\n api_app_id: z.string().min(1),\n event: slackInnerEventBaseSchema,\n event_id: z.string().min(1),\n event_time: z.number().int(),\n authorizations: z.array(z.unknown()).optional(),\n});\nexport type SlackEventBaseEnvelopeDto = z.infer<typeof slackEventBaseEnvelopeSchema>;\n\nexport const slackEventEnvelopeSchema = slackEventBaseEnvelopeSchema.extend({\n event: slackInnerEventSchema,\n});\nexport type SlackEventEnvelopeDto = z.infer<typeof slackEventEnvelopeSchema>;\n\nexport const slackUrlVerificationSchema = z.object({\n type: z.literal('url_verification'),\n token: z.string().min(1),\n challenge: z.string().min(1),\n});\nexport type SlackUrlVerificationDto = z.infer<typeof slackUrlVerificationSchema>;\n\nexport const slackEventsRequestSchema = z.discriminatedUnion('type', [\n slackUrlVerificationSchema,\n slackEventBaseEnvelopeSchema,\n]);\nexport type SlackEventsRequestDto = z.infer<typeof slackEventsRequestSchema>;\n\nexport const slackSlashCommandSchema = z.object({\n token: z.string().min(1),\n command: z.string().min(1),\n team_id: z.string().min(1),\n channel_id: z.string().min(1),\n user_id: z.string().min(1),\n response_url: z.string().url(),\n trigger_id: z.string().min(1),\n text: z.string().default(''),\n team_domain: z.string().min(1).optional(),\n channel_name: z.string().min(1).optional(),\n user_name: z.string().min(1).optional(),\n api_app_id: z.string().min(1).optional(),\n is_enterprise_install: z.string().min(1).optional(),\n enterprise_id: z.string().min(1).optional(),\n enterprise_name: z.string().min(1).optional(),\n});\nexport type SlackSlashCommandDto = z.infer<typeof slackSlashCommandSchema>;\n\nexport const slackSlashCommandPayloadSchema = slackSlashCommandSchema.omit({token: true});\nexport type SlackSlashCommandPayloadDto = z.infer<typeof slackSlashCommandPayloadSchema>;\n\nexport const slackEventPayloadSchema = z\n .object({\n type: z.enum(slackApiEventTypes),\n team_id: z.string().min(1),\n api_app_id: z.string().min(1),\n event_id: z.string().min(1),\n event_time: z.number().int(),\n channel: z.string().min(1).optional(),\n channel_type: z.string().min(1).optional(),\n user: z.string().min(1).optional(),\n ts: z.string().min(1).optional(),\n thread_ts: z.string().min(1).optional(),\n text: z.string().optional(),\n bot_id: z.string().min(1).optional(),\n reaction: z.string().min(1).optional(),\n })\n .passthrough();\nexport type SlackEventPayloadDto = z.infer<typeof slackEventPayloadSchema>;\n\nexport const createSlackInstallBodySchema = z.object({\n workspace_id: z.string().uuid(),\n});\nexport type CreateSlackInstallBodyDto = z.infer<typeof createSlackInstallBodySchema>;\n\nexport const createSlackInstallResponseSchema = z.object({\n install_url: z.string().url(),\n});\nexport type CreateSlackInstallResponseDto = z.infer<typeof createSlackInstallResponseSchema>;\n\nexport const slackCallbackQuerySchema = z.union([\n z.object({\n code: z.string().min(1),\n state: z.string().min(1),\n }),\n z.object({\n error: z.string().min(1),\n error_description: z.string().min(1).optional(),\n state: z.string().min(1),\n }),\n]);\nexport type SlackCallbackQueryDto = z.infer<typeof slackCallbackQuerySchema>;\n\nexport const slackCallbackResponseSchema = integrationConnectionDtoSchema;\nexport type SlackCallbackResponseDto = z.infer<typeof slackCallbackResponseSchema>;\n\nexport const createE2eSlackConnectionBodySchema = z.object({\n workspace_id: z.string().uuid(),\n team_id: z.string().min(1),\n team_name: z.string().min(1),\n app_id: z.string().min(1),\n bot_user_id: z.string().min(1),\n bot_token: z.string().min(1),\n scopes: z.array(z.string().min(1)).min(1).default(['app_mentions:read', 'chat:write']),\n});\nexport type CreateE2eSlackConnectionBodyDto = z.infer<typeof createE2eSlackConnectionBodySchema>;\n\nexport const createE2eSlackConnectionResponseSchema = integrationConnectionDtoSchema;\nexport type CreateE2eSlackConnectionResponseDto = z.infer<\n typeof createE2eSlackConnectionResponseSchema\n>;\n"],"names":["integrationConnectionDtoSchema","z","SLACK_PROVIDER","slackApiEventTypes","SLACK_SLASH_COMMAND_EVENT","slackEventNames","slackInnerEventBaseSchema","object","type","string","min","passthrough","slackInnerEventSchema","enum","slackEventBaseEnvelopeSchema","literal","team_id","api_app_id","event","event_id","event_time","number","int","authorizations","array","unknown","optional","slackEventEnvelopeSchema","extend","slackUrlVerificationSchema","token","challenge","slackEventsRequestSchema","discriminatedUnion","slackSlashCommandSchema","command","channel_id","user_id","response_url","url","trigger_id","text","default","team_domain","channel_name","user_name","is_enterprise_install","enterprise_id","enterprise_name","slackSlashCommandPayloadSchema","omit","slackEventPayloadSchema","channel","channel_type","user","ts","thread_ts","bot_id","reaction","createSlackInstallBodySchema","workspace_id","uuid","createSlackInstallResponseSchema","install_url","slackCallbackQuerySchema","union","code","state","error","error_description","slackCallbackResponseSchema","createE2eSlackConnectionBodySchema","team_name","app_id","bot_user_id","bot_token","scopes","createE2eSlackConnectionResponseSchema"],"mappings":"AAAA,SAAQA,8BAA8B,QAAO,oCAAoC;AACjF,SAAQC,CAAC,QAAO,MAAM;AAEtB,OAAO,MAAMC,iBAAiB,QAAQ;AAGtC,OAAO,MAAMC,qBAAqB;IAAC;IAAe;IAAW;CAAiB,CAAU;AACxF,OAAO,MAAMC,4BAA4B,gBAAyB;AAClE,OAAO,MAAMC,kBAAkB;OAAIF;IAAoBC;CAA0B,CAAU;AAK3F,OAAO,MAAME,4BAA4BL,EACtCM,MAAM,CAAC;IACNC,MAAMP,EAAEQ,MAAM,GAAGC,GAAG,CAAC;AACvB,GACCC,WAAW,GAAG;AAEjB,OAAO,MAAMC,wBAAwBX,EAClCM,MAAM,CAAC;IACNC,MAAMP,EAAEY,IAAI,CAACV;AACf,GACCQ,WAAW,GAAG;AAEjB,OAAO,MAAMG,+BAA+Bb,EAAEM,MAAM,CAAC;IACnDC,MAAMP,EAAEc,OAAO,CAAC;IAChBC,SAASf,EAAEQ,MAAM,GAAGC,GAAG,CAAC;IACxBO,YAAYhB,EAAEQ,MAAM,GAAGC,GAAG,CAAC;IAC3BQ,OAAOZ;IACPa,UAAUlB,EAAEQ,MAAM,GAAGC,GAAG,CAAC;IACzBU,YAAY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