@budibase/server 2.6.8-alpha.8 → 2.6.8-alpha.9
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/builder/assets/{index.4c04cd3a.js → index.6b9dfaa1.js} +277 -277
- package/builder/assets/{index.3df09d49.css → index.79e88f35.css} +1 -1
- package/builder/index.html +2 -2
- package/dist/automations/steps/make.js +19 -5
- package/dist/automations/steps/zapier.js +19 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/automations/steps/make.ts +18 -1
- package/src/automations/steps/zapier.ts +18 -1
- package/src/automations/tests/make.spec.ts +54 -0
- package/src/automations/tests/zapier.spec.ts +56 -0
- package/src/automations/tests/zapier.spec.js +0 -27
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.6.8-alpha.
|
|
4
|
+
"version": "2.6.8-alpha.9",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"license": "GPL-3.0",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
48
|
-
"@budibase/backend-core": "2.6.8-alpha.
|
|
49
|
-
"@budibase/client": "2.6.8-alpha.
|
|
50
|
-
"@budibase/pro": "2.6.8-alpha.
|
|
51
|
-
"@budibase/shared-core": "2.6.8-alpha.
|
|
52
|
-
"@budibase/string-templates": "2.6.8-alpha.
|
|
53
|
-
"@budibase/types": "2.6.8-alpha.
|
|
48
|
+
"@budibase/backend-core": "2.6.8-alpha.9",
|
|
49
|
+
"@budibase/client": "2.6.8-alpha.9",
|
|
50
|
+
"@budibase/pro": "2.6.8-alpha.9",
|
|
51
|
+
"@budibase/shared-core": "2.6.8-alpha.9",
|
|
52
|
+
"@budibase/string-templates": "2.6.8-alpha.9",
|
|
53
|
+
"@budibase/types": "2.6.8-alpha.9",
|
|
54
54
|
"@bull-board/api": "3.7.0",
|
|
55
55
|
"@bull-board/koa": "3.9.4",
|
|
56
56
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -176,5 +176,5 @@
|
|
|
176
176
|
"optionalDependencies": {
|
|
177
177
|
"oracledb": "5.3.0"
|
|
178
178
|
},
|
|
179
|
-
"gitHead": "
|
|
179
|
+
"gitHead": "399422f5a1ac3133b80fcbba253875cae662df5d"
|
|
180
180
|
}
|
|
@@ -26,6 +26,10 @@ export const definition: AutomationStepSchema = {
|
|
|
26
26
|
type: AutomationIOType.STRING,
|
|
27
27
|
title: "Webhook URL",
|
|
28
28
|
},
|
|
29
|
+
body: {
|
|
30
|
+
type: AutomationIOType.JSON,
|
|
31
|
+
title: "Payload",
|
|
32
|
+
},
|
|
29
33
|
value1: {
|
|
30
34
|
type: AutomationIOType.STRING,
|
|
31
35
|
title: "Input Value 1",
|
|
@@ -70,7 +74,19 @@ export const definition: AutomationStepSchema = {
|
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
export async function run({ inputs }: AutomationStepInput) {
|
|
73
|
-
|
|
77
|
+
//TODO - Remove deprecated values 1,2,3,4,5 after November 2023
|
|
78
|
+
const { url, value1, value2, value3, value4, value5, body } = inputs
|
|
79
|
+
|
|
80
|
+
let payload = {}
|
|
81
|
+
try {
|
|
82
|
+
payload = body?.value ? JSON.parse(body?.value) : {}
|
|
83
|
+
} catch (err) {
|
|
84
|
+
return {
|
|
85
|
+
httpStatus: 400,
|
|
86
|
+
response: "Invalid payload JSON",
|
|
87
|
+
success: false,
|
|
88
|
+
}
|
|
89
|
+
}
|
|
74
90
|
|
|
75
91
|
if (!url?.trim()?.length) {
|
|
76
92
|
return {
|
|
@@ -89,6 +105,7 @@ export async function run({ inputs }: AutomationStepInput) {
|
|
|
89
105
|
value3,
|
|
90
106
|
value4,
|
|
91
107
|
value5,
|
|
108
|
+
...payload,
|
|
92
109
|
}),
|
|
93
110
|
headers: {
|
|
94
111
|
"Content-Type": "application/json",
|
|
@@ -24,6 +24,10 @@ export const definition: AutomationStepSchema = {
|
|
|
24
24
|
type: AutomationIOType.STRING,
|
|
25
25
|
title: "Webhook URL",
|
|
26
26
|
},
|
|
27
|
+
body: {
|
|
28
|
+
type: AutomationIOType.JSON,
|
|
29
|
+
title: "Payload",
|
|
30
|
+
},
|
|
27
31
|
value1: {
|
|
28
32
|
type: AutomationIOType.STRING,
|
|
29
33
|
title: "Payload Value 1",
|
|
@@ -63,7 +67,19 @@ export const definition: AutomationStepSchema = {
|
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
export async function run({ inputs }: AutomationStepInput) {
|
|
66
|
-
|
|
70
|
+
//TODO - Remove deprecated values 1,2,3,4,5 after November 2023
|
|
71
|
+
const { url, value1, value2, value3, value4, value5, body } = inputs
|
|
72
|
+
|
|
73
|
+
let payload = {}
|
|
74
|
+
try {
|
|
75
|
+
payload = body?.value ? JSON.parse(body?.value) : {}
|
|
76
|
+
} catch (err) {
|
|
77
|
+
return {
|
|
78
|
+
httpStatus: 400,
|
|
79
|
+
response: "Invalid payload JSON",
|
|
80
|
+
success: false,
|
|
81
|
+
}
|
|
82
|
+
}
|
|
67
83
|
|
|
68
84
|
if (!url?.trim()?.length) {
|
|
69
85
|
return {
|
|
@@ -85,6 +101,7 @@ export async function run({ inputs }: AutomationStepInput) {
|
|
|
85
101
|
value3,
|
|
86
102
|
value4,
|
|
87
103
|
value5,
|
|
104
|
+
...payload,
|
|
88
105
|
}),
|
|
89
106
|
headers: {
|
|
90
107
|
"Content-Type": "application/json",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getConfig, afterAll, runStep, actions } from "./utilities"
|
|
2
|
+
|
|
3
|
+
describe("test the outgoing webhook action", () => {
|
|
4
|
+
let config = getConfig()
|
|
5
|
+
|
|
6
|
+
beforeAll(async () => {
|
|
7
|
+
await config.init()
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
afterAll()
|
|
11
|
+
|
|
12
|
+
it("should be able to run the action", async () => {
|
|
13
|
+
const res = await runStep(actions.integromat.stepId, {
|
|
14
|
+
value1: "test",
|
|
15
|
+
url: "http://www.test.com",
|
|
16
|
+
})
|
|
17
|
+
expect(res.response.url).toEqual("http://www.test.com")
|
|
18
|
+
expect(res.response.method).toEqual("post")
|
|
19
|
+
expect(res.success).toEqual(true)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it("should add the payload props when a JSON string is provided", async () => {
|
|
23
|
+
const payload = `{"value1":1,"value2":2,"value3":3,"value4":4,"value5":5,"name":"Adam","age":9}`
|
|
24
|
+
const res = await runStep(actions.integromat.stepId, {
|
|
25
|
+
value1: "ONE",
|
|
26
|
+
value2: "TWO",
|
|
27
|
+
value3: "THREE",
|
|
28
|
+
value4: "FOUR",
|
|
29
|
+
value5: "FIVE",
|
|
30
|
+
body: {
|
|
31
|
+
value: payload,
|
|
32
|
+
},
|
|
33
|
+
url: "http://www.test.com",
|
|
34
|
+
})
|
|
35
|
+
expect(res.response.url).toEqual("http://www.test.com")
|
|
36
|
+
expect(res.response.method).toEqual("post")
|
|
37
|
+
expect(res.response.body).toEqual(payload)
|
|
38
|
+
expect(res.success).toEqual(true)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it("should return a 400 if the JSON payload string is malformed", async () => {
|
|
42
|
+
const payload = `{ value1 1 }`
|
|
43
|
+
const res = await runStep(actions.integromat.stepId, {
|
|
44
|
+
value1: "ONE",
|
|
45
|
+
body: {
|
|
46
|
+
value: payload,
|
|
47
|
+
},
|
|
48
|
+
url: "http://www.test.com",
|
|
49
|
+
})
|
|
50
|
+
expect(res.httpStatus).toEqual(400)
|
|
51
|
+
expect(res.response).toEqual("Invalid payload JSON")
|
|
52
|
+
expect(res.success).toEqual(false)
|
|
53
|
+
})
|
|
54
|
+
})
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getConfig, afterAll, runStep, actions } from "./utilities"
|
|
2
|
+
|
|
3
|
+
describe("test the outgoing webhook action", () => {
|
|
4
|
+
let config = getConfig()
|
|
5
|
+
|
|
6
|
+
beforeAll(async () => {
|
|
7
|
+
await config.init()
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
afterAll()
|
|
11
|
+
|
|
12
|
+
it("should be able to run the action", async () => {
|
|
13
|
+
const res = await runStep(actions.zapier.stepId, {
|
|
14
|
+
value1: "test",
|
|
15
|
+
url: "http://www.test.com",
|
|
16
|
+
})
|
|
17
|
+
expect(res.response.url).toEqual("http://www.test.com")
|
|
18
|
+
expect(res.response.method).toEqual("post")
|
|
19
|
+
expect(res.success).toEqual(true)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it("should add the payload props when a JSON string is provided", async () => {
|
|
23
|
+
const payload = `{ "value1": 1, "value2": 2, "value3": 3, "value4": 4, "value5": 5, "name": "Adam", "age": 9 }`
|
|
24
|
+
const res = await runStep(actions.zapier.stepId, {
|
|
25
|
+
value1: "ONE",
|
|
26
|
+
value2: "TWO",
|
|
27
|
+
value3: "THREE",
|
|
28
|
+
value4: "FOUR",
|
|
29
|
+
value5: "FIVE",
|
|
30
|
+
body: {
|
|
31
|
+
value: payload,
|
|
32
|
+
},
|
|
33
|
+
url: "http://www.test.com",
|
|
34
|
+
})
|
|
35
|
+
expect(res.response.url).toEqual("http://www.test.com")
|
|
36
|
+
expect(res.response.method).toEqual("post")
|
|
37
|
+
expect(res.response.body).toEqual(
|
|
38
|
+
`{"platform":"budibase","value1":1,"value2":2,"value3":3,"value4":4,"value5":5,"name":"Adam","age":9}`
|
|
39
|
+
)
|
|
40
|
+
expect(res.success).toEqual(true)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it("should return a 400 if the JSON payload string is malformed", async () => {
|
|
44
|
+
const payload = `{ value1 1 }`
|
|
45
|
+
const res = await runStep(actions.zapier.stepId, {
|
|
46
|
+
value1: "ONE",
|
|
47
|
+
body: {
|
|
48
|
+
value: payload,
|
|
49
|
+
},
|
|
50
|
+
url: "http://www.test.com",
|
|
51
|
+
})
|
|
52
|
+
expect(res.httpStatus).toEqual(400)
|
|
53
|
+
expect(res.response).toEqual("Invalid payload JSON")
|
|
54
|
+
expect(res.success).toEqual(false)
|
|
55
|
+
})
|
|
56
|
+
})
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const setup = require("./utilities")
|
|
2
|
-
const fetch = require("node-fetch")
|
|
3
|
-
|
|
4
|
-
jest.mock("node-fetch")
|
|
5
|
-
|
|
6
|
-
describe("test the outgoing webhook action", () => {
|
|
7
|
-
let inputs
|
|
8
|
-
let config = setup.getConfig()
|
|
9
|
-
|
|
10
|
-
beforeAll(async () => {
|
|
11
|
-
await config.init()
|
|
12
|
-
inputs = {
|
|
13
|
-
value1: "test",
|
|
14
|
-
url: "http://www.test.com",
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
afterAll(setup.afterAll)
|
|
19
|
-
|
|
20
|
-
it("should be able to run the action", async () => {
|
|
21
|
-
const res = await setup.runStep(setup.actions.zapier.stepId, inputs)
|
|
22
|
-
expect(res.response.url).toEqual("http://www.test.com")
|
|
23
|
-
expect(res.response.method).toEqual("post")
|
|
24
|
-
expect(res.success).toEqual(true)
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
})
|