-
Notifications
You must be signed in to change notification settings - Fork 20
/
types.ts
252 lines (212 loc) · 4.59 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
import { type MDXProps } from "mdx/types";
import type monaco from "monaco-editor";
// eslint-disable-next-line
declare const process: {
env: {
REACT_APP_API_HOST: string;
};
};
declare module "*.mdx" {
export default function MDXContent(props: MDXProps): JSX.Element;
export const getStaticProps: () => {
title: string;
};
}
export type Usage = {
period: string;
asOf: string;
total: number;
data: Array<{
slot: string;
count: number;
}>;
};
export type Pagination = {
page: number;
perPage: number;
totalPages: number;
totalItems: number;
};
export type Shape = {
[key: string]: Typedef;
};
export type Typedef = {
scalar: Scalar;
compound: Compound;
fields?: Shape;
};
export type Scalar = "unknown" | "int" | "float" | "string" | "boolean";
export type Compound = "none" | "array" | "map";
export type Action = {
dsn: string;
name?: string;
tagline: string;
category: {
name: string;
};
latest: ActionVersion;
versions?: ActionVersion[];
settings?: Array<ActionSetting>;
};
export type ActionVersion = {
dsn: string;
name: string;
version: number;
createdAt: string;
Settings: { [key: string]: any };
WorkflowMetadata: WorkflowMetadata[];
Response: {
[key: string]: { name: "string"; type: Scalar; optional: boolean };
};
Edges: ActionEdge[];
};
export type ActionEdge = {
name?: string;
if?: string;
} & (EdgeTypeEdge | EdgeTypeAsync);
export type EdgeTypeEdge = {
type: "edge";
};
export type EdgeTypeAsync = {
type: "async";
async: {
ttl: string;
event: string;
match?: string;
};
};
export type WorkflowMetadata = {
name: string;
expression?: string | null;
required: boolean;
type: string;
Settings: { [key: string]: any };
form: WorkflowForm;
};
export type WorkflowForm =
| WorkflowFormTextarea
| WorkflowFormInput
| WorkflowFormDatetime
| WorkflowFormSelect
| WorkflowFormToggle;
type BaseFormProps = {
title: string;
hint?: string;
placeholder?: string;
};
export type WorkflowFormTextarea = BaseFormProps & {
type: "textarea";
};
export type WorkflowFormInput = BaseFormProps & {
type: "input";
};
export type WorkflowFormDatetime = BaseFormProps & {
type: "datetime";
};
export type WorkflowFormToggle = BaseFormProps & {
type: "toggle";
};
export type WorkflowFormSelect = BaseFormProps & {
type: "select";
formselect: {
choices: Array<{ name: string; value: string }>;
eval?: string;
};
};
export type ActionSetting = {
id: string;
actionDSN: string;
category: string;
name: string;
data: string;
createdAt: string;
updatedAt: string;
};
export type ActionSecret = {
id: string;
actionDSN: string;
service: string;
name: string;
dataPrefix: string;
createdAt: string;
updatedAt: string;
};
export type Workspace = {
id: string;
name: string;
test: boolean;
integrations: WorkspaceIntegration[];
secrets?: ActionSecret[];
};
export type WorkspaceIntegration = {
name: string;
service: string;
events: boolean;
actions: boolean;
webhookEndpoints: string[];
};
export type Contact = {
id: string;
predefinedAttributes: {
external_id: string | null;
first_name: string | null;
last_name: string | null;
email: string | null;
phone: string | null;
status: string | null;
name: string | null;
};
unsubscribedFrom: CommsUnsubscribe[];
createdAt: string;
updatedAt: string;
segments?: Array<{
createdAt: string;
segment: { id: string; name: string; type: string };
}>;
// TODO
status?: string;
lastActive: string;
attributes: ContactAttribute[];
};
type JSON = string;
export type ContactAttribute = {
id: string;
name: string;
value: JSON;
validFrom: string;
validTo?: string;
};
export type CommsUnsubscribe = {
commType: string;
service: "sms" | "email";
};
export type IntegrationEvent = {
name: string;
title: string;
description: string;
fields: { [field: string]: IntegrationField };
expressions: Array<IntegrationExpression>;
};
export type IntegrationField = {
field: string;
title: string;
description: string;
type: string; // TODO: enum
items?: { type: string };
examples?: Array<any>;
};
export type IntegrationExpression = {
name: string;
expression: string;
};
export interface CompletionItemSubset {
label: string | monaco.languages.CompletionItemLabel;
kind: monaco.languages.CompletionItemKind;
insertText: string;
tags?: ReadonlyArray<monaco.languages.CompletionItemTag>;
detail?: string;
documentation?: string | monaco.IMarkdownString;
sortText?: string;
filterText?: string;
preselect?: boolean;
}