@periskope/types 0.6.261 → 0.6.263
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/supabase.types.d.ts +231 -104
- package/dist/supabase.types.d.ts.map +1 -1
- package/dist/supabase.types.js +76 -0
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/workflows.types.d.ts +307 -0
- package/dist/workflows.types.d.ts.map +1 -0
- package/dist/workflows.types.js +256 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/supabase.types.ts +332 -196
- package/src/types.ts +3 -3
- package/src/workflows.types.ts +692 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Triggers = void 0;
|
|
4
|
+
exports.isSplitPathAction = isSplitPathAction;
|
|
5
|
+
exports.isConditionLeaf = isConditionLeaf;
|
|
6
|
+
function isSplitPathAction(workflow_action) {
|
|
7
|
+
return workflow_action.action_metadata.type === 'split_path';
|
|
8
|
+
}
|
|
9
|
+
/***************************** CONDITIONS TYPES *****************************/
|
|
10
|
+
// {
|
|
11
|
+
// "operator": "AND",
|
|
12
|
+
// "conditions": [
|
|
13
|
+
// {
|
|
14
|
+
// "id": "cond1",
|
|
15
|
+
// "variable_name": "message",
|
|
16
|
+
// "variable_type": "string",
|
|
17
|
+
// "condition": "CONTAINS",
|
|
18
|
+
// "value": "urgent"
|
|
19
|
+
// },
|
|
20
|
+
// {
|
|
21
|
+
// "operator": "OR",
|
|
22
|
+
// "conditions": [
|
|
23
|
+
// {
|
|
24
|
+
// "id": "cond2",
|
|
25
|
+
// "variable_name": "priority",
|
|
26
|
+
// "variable_type": "number",
|
|
27
|
+
// "condition": "GT",
|
|
28
|
+
// "value": 2
|
|
29
|
+
// },
|
|
30
|
+
// {
|
|
31
|
+
// "id": "cond3",
|
|
32
|
+
// "variable_name": "assigned",
|
|
33
|
+
// "variable_type": "boolean",
|
|
34
|
+
// "condition": "NKNOWN"
|
|
35
|
+
// }
|
|
36
|
+
// ]
|
|
37
|
+
// }
|
|
38
|
+
// ]
|
|
39
|
+
// }
|
|
40
|
+
var Conditions;
|
|
41
|
+
(function (Conditions) {
|
|
42
|
+
// string
|
|
43
|
+
Conditions["CONTAINS"] = "contains";
|
|
44
|
+
Conditions["NCONTAINS"] = "not contains";
|
|
45
|
+
Conditions["EQUALS"] = "equals";
|
|
46
|
+
Conditions["NEQUALS"] = "not equals";
|
|
47
|
+
Conditions["STARTS_WITH"] = "starts with";
|
|
48
|
+
Conditions["ENDS_WITH"] = "ends with";
|
|
49
|
+
// number, date, time
|
|
50
|
+
Conditions["GREATER_THAN"] = "greater than";
|
|
51
|
+
Conditions["GREATER_THAN_OR_EQUAL"] = "greater than or equal";
|
|
52
|
+
Conditions["LESS_THAN"] = "less than";
|
|
53
|
+
Conditions["LESS_THAN_OR_EQUAL"] = "less than or equal";
|
|
54
|
+
// none
|
|
55
|
+
Conditions["IS_KNOWN"] = "is known";
|
|
56
|
+
Conditions["IS_UNKNOWN"] = "is unknown";
|
|
57
|
+
// boolean
|
|
58
|
+
Conditions["IS"] = "is";
|
|
59
|
+
Conditions["IS_NOT"] = "is not";
|
|
60
|
+
// array
|
|
61
|
+
Conditions["IS_ANY_OF"] = "is any of";
|
|
62
|
+
Conditions["IS_NOT_ANY_OF"] = "is not any of";
|
|
63
|
+
// day
|
|
64
|
+
Conditions["ON"] = "on";
|
|
65
|
+
})(Conditions || (Conditions = {}));
|
|
66
|
+
function isConditionLeaf(condition) {
|
|
67
|
+
return 'id' in condition && !('operator' in condition);
|
|
68
|
+
}
|
|
69
|
+
var Triggers;
|
|
70
|
+
(function (Triggers) {
|
|
71
|
+
Triggers["MESSAGE_CREATED"] = "message.created";
|
|
72
|
+
Triggers["MESSAGE_UPDATED"] = "message.updated";
|
|
73
|
+
Triggers["MESSAGE_DELETED"] = "message.deleted";
|
|
74
|
+
Triggers["MESSAGE_FLAGGED"] = "message.flagged";
|
|
75
|
+
Triggers["MESSAGE_UNFLAGGED"] = "message.unflagged";
|
|
76
|
+
Triggers["REACTION_ADDED"] = "reaction.added";
|
|
77
|
+
Triggers["TICKET_CREATED"] = "ticket.created";
|
|
78
|
+
Triggers["TICKET_UPDATED"] = "ticket.updated";
|
|
79
|
+
Triggers["TICKET_DELETED"] = "ticket.deleted";
|
|
80
|
+
Triggers["TICKET_CLOSED"] = "ticket.closed";
|
|
81
|
+
Triggers["TICKET_DUE"] = "ticket.due";
|
|
82
|
+
Triggers["CHAT_CREATED"] = "chat.created";
|
|
83
|
+
Triggers["CHAT_LABEL_UPDATED"] = "chat.label.updated";
|
|
84
|
+
Triggers["CHAT_CLOSED"] = "chat.closed";
|
|
85
|
+
Triggers["TASK_CREATED"] = "task.created";
|
|
86
|
+
Triggers["TASK_DUE"] = "task.due";
|
|
87
|
+
})(Triggers || (exports.Triggers = Triggers = {}));
|
|
88
|
+
// Example workflow type ->
|
|
89
|
+
// const demoWorkflow: WorkflowType = {
|
|
90
|
+
// id: 'workflow-1',
|
|
91
|
+
// name: 'Urgent Chat Auto-Responder',
|
|
92
|
+
// trigger: Triggers.MESSAGE_CREATED,
|
|
93
|
+
// trigger_metadata: {
|
|
94
|
+
// org_phones: ['phone-1'],
|
|
95
|
+
// allow_internal_messages: false,
|
|
96
|
+
// first_action_id: 'action-validate',
|
|
97
|
+
// },
|
|
98
|
+
// actions: [
|
|
99
|
+
// {
|
|
100
|
+
// id: 'action-validate',
|
|
101
|
+
// action_metadata: {
|
|
102
|
+
// type: 'validate_action',
|
|
103
|
+
// metadata: {
|
|
104
|
+
// operator: 'AND',
|
|
105
|
+
// conditions: [
|
|
106
|
+
// {
|
|
107
|
+
// id: 'cond-1',
|
|
108
|
+
// variable_name: 'message.text',
|
|
109
|
+
// variable_type: 'string',
|
|
110
|
+
// condition: 'CONTAINS',
|
|
111
|
+
// value: 'urgent',
|
|
112
|
+
// },
|
|
113
|
+
// {
|
|
114
|
+
// id: 'cond-2',
|
|
115
|
+
// variable_name: 'chat.assigned',
|
|
116
|
+
// variable_type: 'boolean',
|
|
117
|
+
// condition: 'IS',
|
|
118
|
+
// value: false,
|
|
119
|
+
// },
|
|
120
|
+
// ],
|
|
121
|
+
// },
|
|
122
|
+
// },
|
|
123
|
+
// next: 'action-add-label',
|
|
124
|
+
// },
|
|
125
|
+
// {
|
|
126
|
+
// id: 'action-add-label',
|
|
127
|
+
// action_metadata: {
|
|
128
|
+
// type: 'add_chat_label',
|
|
129
|
+
// metadata: {
|
|
130
|
+
// labels: ['urgent'],
|
|
131
|
+
// },
|
|
132
|
+
// },
|
|
133
|
+
// next: 'action-assign-chat',
|
|
134
|
+
// },
|
|
135
|
+
// {
|
|
136
|
+
// id: 'action-assign-chat',
|
|
137
|
+
// action_metadata: {
|
|
138
|
+
// type: 'assign_chat',
|
|
139
|
+
// metadata: {
|
|
140
|
+
// assignee: {
|
|
141
|
+
// round_robin: true,
|
|
142
|
+
// emails: ['agent1@example.com', 'agent2@example.com'],
|
|
143
|
+
// assignee_check_for: 'all',
|
|
144
|
+
// },
|
|
145
|
+
// },
|
|
146
|
+
// },
|
|
147
|
+
// next: 'action-delay',
|
|
148
|
+
// },
|
|
149
|
+
// {
|
|
150
|
+
// id: 'action-delay',
|
|
151
|
+
// action_metadata: {
|
|
152
|
+
// type: 'delay',
|
|
153
|
+
// metadata: {
|
|
154
|
+
// delay: '5 minutes',
|
|
155
|
+
// },
|
|
156
|
+
// },
|
|
157
|
+
// next: 'action-send-message',
|
|
158
|
+
// },
|
|
159
|
+
// {
|
|
160
|
+
// id: 'action-send-message',
|
|
161
|
+
// action_metadata: {
|
|
162
|
+
// type: 'send_message_to_chat',
|
|
163
|
+
// metadata: {
|
|
164
|
+
// message: 'We’re on it!',
|
|
165
|
+
// chat_id: 'trigger_chat',
|
|
166
|
+
// },
|
|
167
|
+
// },
|
|
168
|
+
// next: 'action-split',
|
|
169
|
+
// },
|
|
170
|
+
// {
|
|
171
|
+
// id: 'action-split',
|
|
172
|
+
// action_metadata: {
|
|
173
|
+
// type: 'split_path',
|
|
174
|
+
// metadata: {
|
|
175
|
+
// paths: [
|
|
176
|
+
// {
|
|
177
|
+
// id: 'path-flagged',
|
|
178
|
+
// condition_action_id: 'action-condition-flagged',
|
|
179
|
+
// },
|
|
180
|
+
// {
|
|
181
|
+
// id: 'path-not-flagged',
|
|
182
|
+
// condition_action_id: 'action-condition-not-flagged',
|
|
183
|
+
// },
|
|
184
|
+
// ],
|
|
185
|
+
// },
|
|
186
|
+
// },
|
|
187
|
+
// {
|
|
188
|
+
// id: 'action-condition-flagged',
|
|
189
|
+
// action_metadata: {
|
|
190
|
+
// type: 'validate_action',
|
|
191
|
+
// metadata: {
|
|
192
|
+
// operator: 'AND',
|
|
193
|
+
// conditions: [
|
|
194
|
+
// {
|
|
195
|
+
// id: 'cond-flagged',
|
|
196
|
+
// variable_name: 'chat.has_flagged_messages',
|
|
197
|
+
// variable_type: 'boolean',
|
|
198
|
+
// condition: 'IS',
|
|
199
|
+
// value: true,
|
|
200
|
+
// },
|
|
201
|
+
// ],
|
|
202
|
+
// },
|
|
203
|
+
// },
|
|
204
|
+
// next: 'action-create-ticket',
|
|
205
|
+
// },
|
|
206
|
+
// {
|
|
207
|
+
// id: 'action-condition-not-flagged',
|
|
208
|
+
// action_metadata: {
|
|
209
|
+
// type: 'validate_action',
|
|
210
|
+
// metadata: {
|
|
211
|
+
// operator: 'AND',
|
|
212
|
+
// conditions: [
|
|
213
|
+
// {
|
|
214
|
+
// id: 'cond-unflagged',
|
|
215
|
+
// variable_name: 'chat.has_flagged_messages',
|
|
216
|
+
// variable_type: 'boolean',
|
|
217
|
+
// condition: 'IS',
|
|
218
|
+
// value: false,
|
|
219
|
+
// },
|
|
220
|
+
// ],
|
|
221
|
+
// },
|
|
222
|
+
// },
|
|
223
|
+
// next: 'action-send-slack',
|
|
224
|
+
// },
|
|
225
|
+
// {
|
|
226
|
+
// id: 'action-create-ticket',
|
|
227
|
+
// action_metadata: {
|
|
228
|
+
// type: 'create_ticket',
|
|
229
|
+
// metadata: {
|
|
230
|
+
// subject: 'Urgent Chat Follow-up',
|
|
231
|
+
// assignee: {
|
|
232
|
+
// email: 'manager@example.com',
|
|
233
|
+
// },
|
|
234
|
+
// priority: '4',
|
|
235
|
+
// status: 'open',
|
|
236
|
+
// labels: ['urgent', 'auto-created'],
|
|
237
|
+
// due_date: '30 minutes',
|
|
238
|
+
// },
|
|
239
|
+
// },
|
|
240
|
+
// next: '', // End
|
|
241
|
+
// },
|
|
242
|
+
// {
|
|
243
|
+
// id: 'action-send-slack',
|
|
244
|
+
// action_metadata: {
|
|
245
|
+
// type: 'send_slack_notification',
|
|
246
|
+
// metadata: {
|
|
247
|
+
// slack_payload: JSON.stringify({
|
|
248
|
+
// text: 'An urgent chat was received, no flagged messages.',
|
|
249
|
+
// }),
|
|
250
|
+
// url: 'https://hooks.slack.com/services/XXX/YYY/ZZZ',
|
|
251
|
+
// },
|
|
252
|
+
// },
|
|
253
|
+
// next: '', // End
|
|
254
|
+
// },
|
|
255
|
+
// ],
|
|
256
|
+
// };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED