@budibase/server 2.3.17-alpha.8 → 2.3.18-alpha.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.3.17-alpha.8",
4
+ "version": "2.3.18-alpha.0",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -43,11 +43,11 @@
43
43
  "license": "GPL-3.0",
44
44
  "dependencies": {
45
45
  "@apidevtools/swagger-parser": "10.0.3",
46
- "@budibase/backend-core": "2.3.17-alpha.8",
47
- "@budibase/client": "2.3.17-alpha.8",
48
- "@budibase/pro": "2.3.17-alpha.7",
49
- "@budibase/string-templates": "2.3.17-alpha.8",
50
- "@budibase/types": "2.3.17-alpha.8",
46
+ "@budibase/backend-core": "2.3.18-alpha.0",
47
+ "@budibase/client": "2.3.18-alpha.0",
48
+ "@budibase/pro": "2.3.17",
49
+ "@budibase/string-templates": "2.3.18-alpha.0",
50
+ "@budibase/types": "2.3.18-alpha.0",
51
51
  "@bull-board/api": "3.7.0",
52
52
  "@bull-board/koa": "3.9.4",
53
53
  "@elastic/elasticsearch": "7.10.0",
@@ -173,5 +173,5 @@
173
173
  "optionalDependencies": {
174
174
  "oracledb": "5.3.0"
175
175
  },
176
- "gitHead": "c3e4bfe17d81b44b0b941abece28bd494bf7594e"
176
+ "gitHead": "f4dd710b75eb0a7a65e6f9d8b8f709d3b76c435b"
177
177
  }
@@ -38,7 +38,13 @@ export async function updateRelatedFormula(
38
38
  if (!relatedRows[relatedTableId]) {
39
39
  relatedRows[relatedTableId] = []
40
40
  }
41
- relatedRows[relatedTableId] = relatedRows[relatedTableId].concat(field)
41
+ // filter down to the rows which are not already included in related
42
+ const currentIds = relatedRows[relatedTableId].map(row => row._id)
43
+ const uniqueRelatedRows = field.filter(
44
+ (row: Row) => !currentIds.includes(row._id)
45
+ )
46
+ relatedRows[relatedTableId] =
47
+ relatedRows[relatedTableId].concat(uniqueRelatedRows)
42
48
  }
43
49
  }
44
50
  for (let tableId of table.relatedFormula) {
@@ -67,17 +67,33 @@ export async function run({ inputs }: AutomationStepInput) {
67
67
  if (!avatar_url) {
68
68
  avatar_url = DEFAULT_AVATAR_URL
69
69
  }
70
- const response = await fetch(url, {
71
- method: "post",
72
- body: JSON.stringify({
73
- username,
74
- avatar_url,
75
- content,
76
- }),
77
- headers: {
78
- "Content-Type": "application/json",
79
- },
80
- })
70
+ if (!url?.trim()?.length) {
71
+ return {
72
+ httpStatus: 400,
73
+ response: "Missing Webhook URL",
74
+ success: false,
75
+ }
76
+ }
77
+ let response
78
+ try {
79
+ response = await fetch(url, {
80
+ method: "post",
81
+ body: JSON.stringify({
82
+ username,
83
+ avatar_url,
84
+ content,
85
+ }),
86
+ headers: {
87
+ "Content-Type": "application/json",
88
+ },
89
+ })
90
+ } catch (err: any) {
91
+ return {
92
+ httpStatus: 400,
93
+ response: err.message,
94
+ success: false,
95
+ }
96
+ }
81
97
 
82
98
  const { status, message } = await getFetchResponse(response)
83
99
  return {
@@ -69,19 +69,35 @@ export const definition: AutomationStepSchema = {
69
69
  export async function run({ inputs }: AutomationStepInput) {
70
70
  const { url, value1, value2, value3, value4, value5 } = inputs
71
71
 
72
- const response = await fetch(url, {
73
- method: "post",
74
- body: JSON.stringify({
75
- value1,
76
- value2,
77
- value3,
78
- value4,
79
- value5,
80
- }),
81
- headers: {
82
- "Content-Type": "application/json",
83
- },
84
- })
72
+ if (!url?.trim()?.length) {
73
+ return {
74
+ httpStatus: 400,
75
+ response: "Missing Webhook URL",
76
+ success: false,
77
+ }
78
+ }
79
+ let response
80
+ try {
81
+ response = await fetch(url, {
82
+ method: "post",
83
+ body: JSON.stringify({
84
+ value1,
85
+ value2,
86
+ value3,
87
+ value4,
88
+ value5,
89
+ }),
90
+ headers: {
91
+ "Content-Type": "application/json",
92
+ },
93
+ })
94
+ } catch (err: any) {
95
+ return {
96
+ httpStatus: 400,
97
+ response: err.message,
98
+ success: false,
99
+ }
100
+ }
85
101
 
86
102
  const { status, message } = await getFetchResponse(response)
87
103
  return {
@@ -50,15 +50,31 @@ export const definition: AutomationStepSchema = {
50
50
 
51
51
  export async function run({ inputs }: AutomationStepInput) {
52
52
  let { url, text } = inputs
53
- const response = await fetch(url, {
54
- method: "post",
55
- body: JSON.stringify({
56
- text,
57
- }),
58
- headers: {
59
- "Content-Type": "application/json",
60
- },
61
- })
53
+ if (!url?.trim()?.length) {
54
+ return {
55
+ httpStatus: 400,
56
+ response: "Missing Webhook URL",
57
+ success: false,
58
+ }
59
+ }
60
+ let response
61
+ try {
62
+ response = await fetch(url, {
63
+ method: "post",
64
+ body: JSON.stringify({
65
+ text,
66
+ }),
67
+ headers: {
68
+ "Content-Type": "application/json",
69
+ },
70
+ })
71
+ } catch (err: any) {
72
+ return {
73
+ httpStatus: 400,
74
+ response: err.message,
75
+ success: false,
76
+ }
77
+ }
62
78
 
63
79
  const { status, message } = await getFetchResponse(response)
64
80
  return {
@@ -63,22 +63,38 @@ export const definition: AutomationStepSchema = {
63
63
  export async function run({ inputs }: AutomationStepInput) {
64
64
  const { url, value1, value2, value3, value4, value5 } = inputs
65
65
 
66
+ if (!url?.trim()?.length) {
67
+ return {
68
+ httpStatus: 400,
69
+ response: "Missing Webhook URL",
70
+ success: false,
71
+ }
72
+ }
66
73
  // send the platform to make sure zaps always work, even
67
74
  // if no values supplied
68
- const response = await fetch(url, {
69
- method: "post",
70
- body: JSON.stringify({
71
- platform: "budibase",
72
- value1,
73
- value2,
74
- value3,
75
- value4,
76
- value5,
77
- }),
78
- headers: {
79
- "Content-Type": "application/json",
80
- },
81
- })
75
+ let response
76
+ try {
77
+ response = await fetch(url, {
78
+ method: "post",
79
+ body: JSON.stringify({
80
+ platform: "budibase",
81
+ value1,
82
+ value2,
83
+ value3,
84
+ value4,
85
+ value5,
86
+ }),
87
+ headers: {
88
+ "Content-Type": "application/json",
89
+ },
90
+ })
91
+ } catch (err: any) {
92
+ return {
93
+ httpStatus: 400,
94
+ response: err.message,
95
+ success: false,
96
+ }
97
+ }
82
98
 
83
99
  const { status, message } = await getFetchResponse(response)
84
100