-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathww-config.js
86 lines (86 loc) · 4.23 KB
/
ww-config.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
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
export default {
features: {
datasource: true,
},
editor: {
collection: {
edit: () => import('./src/components/CollectionEdit.vue'),
summary: () => import('./src/components/CollectionSummary.vue'),
getIsValid(config) {
return !!config.method && !!config.url;
},
},
},
actions: [
{
name: 'REST API Request',
code: 'apiRequest',
isAsync: true,
/* wwEditor:start */
edit: () => import('./src/components/ApiRequest.vue'),
getIsValid({ url, method }) {
return !!url && !!method;
},
copilot: {
description: 'Make a REST API request with configurable method, URL, headers, and data',
returns: `any - response body directly (the action automatically extracts the response body). Access the result using context.workflow['action_ref'].result (NOT .result.data as the data property is already extracted). The returned value structure depends on the API being called.`,
schema: {
url: {
type: 'string',
description: 'The URL to request',
bindable: true,
},
method: {
type: 'string',
description: 'The HTTP method to use',
bindable: false,
},
useRawBody: {
type: 'boolean',
description:
'Controls how the data field is processed:\n' +
'false (default): Use UI-friendly key-value pairs array format\n' +
'true: Send data field content directly without transformation. When enabled, the data field MUST be bound to a formula returning your payload structure.',
bindable: true,
},
data: {
type: 'Array<{key: string, value: string}> | any',
description:
'How to send request data:\n' +
'1. Default mode (UI-friendly): Provide data as an array of key-value pairs. Example: [{key: "name", value: "John"}] will be converted to {name: "John"}\n' +
'2. Raw body mode: When enabled, data MUST be bound to a formula returning the exact structure to send. Example: =({name: "John", age: 25})',
bindable: true,
},
headers: {
type: 'Array<{key: string, value: string}',
description: 'The headers to send',
bindable: true,
},
queries: {
type: 'Array<{key: string, value: string}',
description: 'The query string parameters',
bindable: true,
},
dataType: {
type: 'string',
description: 'The content type for the request',
bindable: false,
},
isThroughServer: {
type: 'boolean',
description:
'Whether to send the request through the WeWeb server to avoid CORS issues, use with caution, only when you know the request will fail due to CORS. This option will change the returns format to the whole response object instead (status,statusText,data,headers,config,request), body will not be automatically extracted anymore',
bindable: true,
},
isWithCredentials: {
type: 'boolean',
description:
'Whether to send credentials with the request, such as cookies, cannot be used with isThroughServer, use with caution, many API will fail if you enable this',
bindable: true,
},
},
},
/* wwEditor:end */
},
],
};