-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.js
58 lines (53 loc) · 2.37 KB
/
utils.js
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
import { authorizations, domains } from './variables.js';
export const getAutomationTemplateGraphQL = (template_id) => ({
operationName: 'GetAutomationsV2Template',
variables: {
templateId: template_id,
},
query: 'query GetAutomationsV2Template($templateId: String!, $version: String) {\n automationsV2 {\n template(templateId: $templateId, version: $version)\n __typename\n }\n}\n',
});
export const getAutomationNodesGraphQL = (template_id) => ({
operationName: 'GetAutomationsV2Nodes',
variables: {
templateId: template_id,
},
query: 'query GetAutomationsV2Nodes($templateId: String!, $version: String) {\n automationsV2 {\n nodes(templateId: $templateId, version: $version)\n __typename\n }\n}\n',
});
export const getHeaders = (locale) => {
return {
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-US,en;q=0.9',
authorization: authorizations[locale],
connection: 'keep-alive',
host: domains[locale],
origin: `https://${domains[locale]}`,
referer: `https://${domains[locale]}/`,
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'user-agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
accept: '*/*',
'content-type': 'application/json',
'sec-ch-ua':
'"Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"macOS"',
};
};
export const saveAutomationV2GraphQL = (nodes, template_with_graph) => ({
operationName: 'SaveAutomationV2Graph',
variables: {
nodes: nodes,
template: template_with_graph,
},
query: 'mutation SaveAutomationV2Graph($template: JSON!, $nodes: JSON!) {\n automationsV2 {\n publishTemplate(template: $template, nodes: $nodes)\n __typename\n }\n}\n',
});
export const saveAutomationV2TemplateQl = (nodes, template_with_graph) => ({
operationName: 'SaveAutomationV2Template',
variables: {
nodes: nodes,
template: template_with_graph,
},
query: 'mutation SaveAutomationV2Template($template: JSON!, $nodes: JSON!) {\n automationsV2 {\n saveTemplate(template: $template, nodes: $nodes)\n __typename\n }\n}\n',
});