@desplega.ai/slack-mock 0.1.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/src/types.ts ADDED
@@ -0,0 +1,159 @@
1
+ // Slack-shaped domain objects stored by the mock. Field names follow the Slack
2
+ // Web API so they can be returned verbatim and embedded in event payloads.
3
+
4
+ export interface SlackUser {
5
+ id: string;
6
+ team_id: string;
7
+ name: string;
8
+ real_name: string;
9
+ deleted: boolean;
10
+ is_bot: boolean;
11
+ is_admin: boolean;
12
+ is_app_user: boolean;
13
+ tz: string;
14
+ profile: {
15
+ real_name: string;
16
+ display_name: string;
17
+ real_name_normalized: string;
18
+ display_name_normalized: string;
19
+ email?: string;
20
+ image_72?: string;
21
+ team: string;
22
+ };
23
+ }
24
+
25
+ export interface SlackChannel {
26
+ id: string;
27
+ name: string;
28
+ is_channel: boolean;
29
+ is_group: boolean;
30
+ is_im: boolean;
31
+ is_mpim: boolean;
32
+ is_private: boolean;
33
+ is_archived: boolean;
34
+ is_general: boolean;
35
+ created: number;
36
+ creator: string;
37
+ /** Peer user id for DMs. */
38
+ user?: string;
39
+ topic: { value: string; creator: string; last_set: number };
40
+ purpose: { value: string; creator: string; last_set: number };
41
+ /** Not a Slack field on the wire; exposed via conversations.members. */
42
+ members: string[];
43
+ }
44
+
45
+ export interface SlackFile {
46
+ id: string;
47
+ created: number;
48
+ timestamp: number;
49
+ name: string;
50
+ title: string;
51
+ mimetype: string;
52
+ filetype: string;
53
+ pretty_type: string;
54
+ user: string;
55
+ size: number;
56
+ mode: string;
57
+ is_external: boolean;
58
+ is_public: boolean;
59
+ url_private: string;
60
+ url_private_download: string;
61
+ permalink: string;
62
+ channels: string[];
63
+ /** Raw bytes; stripped before the object is put on the wire. */
64
+ bytes?: Uint8Array;
65
+ }
66
+
67
+ export interface SlackReaction {
68
+ name: string;
69
+ users: string[];
70
+ count: number;
71
+ }
72
+
73
+ export interface SlackMessage {
74
+ type: "message";
75
+ subtype?: string;
76
+ channel: string;
77
+ team: string;
78
+ user?: string;
79
+ text: string;
80
+ ts: string;
81
+ thread_ts?: string;
82
+ parent_user_id?: string;
83
+ blocks?: unknown[];
84
+ attachments?: unknown[];
85
+ metadata?: { event_type: string; event_payload?: Record<string, unknown> };
86
+ files?: SlackFile[];
87
+ bot_id?: string;
88
+ app_id?: string;
89
+ username?: string;
90
+ icons?: Record<string, string>;
91
+ bot_profile?: { id: string; name: string; app_id: string; team_id: string; deleted: boolean };
92
+ reactions?: SlackReaction[];
93
+ edited?: { user: string; ts: string };
94
+ reply_count?: number;
95
+ reply_users?: string[];
96
+ reply_users_count?: number;
97
+ latest_reply?: string;
98
+ client_msg_id?: string;
99
+ /** Set on messages created by chat.startStream: "in_progress" until chat.stopStream. */
100
+ streaming_state?: string;
101
+ thumb_64?: string;
102
+ /** Mock-only: the user who can see an ephemeral message. Stripped on the wire. */
103
+ ephemeral_user?: string;
104
+ }
105
+
106
+ export interface SlackView {
107
+ id: string;
108
+ team_id: string;
109
+ type: string;
110
+ callback_id?: string;
111
+ private_metadata?: string;
112
+ title?: unknown;
113
+ submit?: unknown;
114
+ close?: unknown;
115
+ blocks: unknown[];
116
+ hash: string;
117
+ external_id?: string;
118
+ /** Mock-only bookkeeping. */
119
+ opened_by: string;
120
+ trigger_id: string;
121
+ state: { values: Record<string, Record<string, unknown>> };
122
+ root_view_id: string;
123
+ app_id: string;
124
+ bot_id: string;
125
+ clear_on_close: boolean;
126
+ notify_on_close: boolean;
127
+ }
128
+
129
+ export interface ApiCall {
130
+ at: string;
131
+ method: string;
132
+ args: Record<string, unknown>;
133
+ ok: boolean;
134
+ error?: string;
135
+ }
136
+
137
+ export type Change =
138
+ | { kind: "message.add"; message: SlackMessage }
139
+ | { kind: "message.update"; message: SlackMessage; previous: SlackMessage }
140
+ | { kind: "message.delete"; message: SlackMessage }
141
+ | { kind: "reaction.add"; message: SlackMessage; name: string; user: string }
142
+ | { kind: "reaction.remove"; message: SlackMessage; name: string; user: string }
143
+ | { kind: "channel.add"; channel: SlackChannel }
144
+ | { kind: "channel.update"; channel: SlackChannel }
145
+ | { kind: "member.join"; channel: SlackChannel; user: string; inviter?: string }
146
+ | { kind: "user.add"; user: SlackUser }
147
+ | { kind: "file.add"; file: SlackFile }
148
+ | { kind: "view.open"; view: SlackView }
149
+ | { kind: "view.update"; view: SlackView }
150
+ | { kind: "assistant.status"; channel: string; thread_ts: string; status: string }
151
+ | { kind: "assistant.title"; channel: string; thread_ts: string; title: string }
152
+ | {
153
+ kind: "assistant.prompts";
154
+ channel: string;
155
+ thread_ts: string;
156
+ prompts: unknown[];
157
+ title?: string;
158
+ }
159
+ | { kind: "api.call"; call: ApiCall };