@budibase/server 2.5.6-alpha.9 → 2.5.7

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.
Files changed (156) hide show
  1. package/builder/assets/index.7f9a008b.css +6 -0
  2. package/builder/assets/index.f02eef32.js +1817 -0
  3. package/builder/index.html +2 -2
  4. package/dist/api/controllers/automation.js +7 -13
  5. package/dist/api/controllers/plugin/index.js +37 -6
  6. package/dist/api/controllers/table/utils.js +1 -2
  7. package/dist/api/controllers/user.js +83 -1
  8. package/dist/api/routes/index.js +0 -2
  9. package/dist/api/routes/user.js +1 -0
  10. package/dist/app.js +13 -4
  11. package/dist/automations/actions.js +6 -32
  12. package/dist/automations/index.js +2 -3
  13. package/dist/automations/steps/bash.js +6 -6
  14. package/dist/automations/steps/createRow.js +11 -11
  15. package/dist/automations/steps/delay.js +3 -3
  16. package/dist/automations/steps/deleteRow.js +8 -8
  17. package/dist/automations/steps/discord.js +8 -8
  18. package/dist/automations/steps/executeQuery.js +9 -9
  19. package/dist/automations/steps/executeScript.js +6 -6
  20. package/dist/automations/steps/filter.js +6 -6
  21. package/dist/automations/steps/integromat.js +10 -10
  22. package/dist/automations/steps/loop.js +9 -9
  23. package/dist/automations/steps/outgoingWebhook.js +10 -10
  24. package/dist/automations/steps/queryRows.js +14 -14
  25. package/dist/automations/steps/sendSmtpEmail.js +9 -9
  26. package/dist/automations/steps/serverLog.js +4 -4
  27. package/dist/automations/steps/slack.js +6 -6
  28. package/dist/automations/steps/updateRow.js +11 -11
  29. package/dist/automations/steps/zapier.js +9 -9
  30. package/dist/automations/triggerInfo/app.js +5 -5
  31. package/dist/automations/triggerInfo/cron.js +4 -4
  32. package/dist/automations/triggerInfo/rowDeleted.js +5 -5
  33. package/dist/automations/triggerInfo/rowSaved.js +7 -7
  34. package/dist/automations/triggerInfo/rowUpdated.js +7 -7
  35. package/dist/automations/triggerInfo/webhook.js +6 -6
  36. package/dist/elasticApm.js +14 -0
  37. package/dist/environment.js +1 -0
  38. package/dist/events/index.js +0 -3
  39. package/dist/integrations/index.js +3 -3
  40. package/dist/integrations/microsoftSqlServer.js +2 -5
  41. package/dist/integrations/mysql.js +3 -5
  42. package/dist/integrations/postgres.js +5 -7
  43. package/dist/integrations/redis.js +0 -7
  44. package/dist/integrations/rest.js +0 -4
  45. package/dist/migrations/functions/usageQuotas/syncApps.js +1 -1
  46. package/dist/migrations/functions/usageQuotas/syncRows.js +2 -1
  47. package/dist/package.json +15 -15
  48. package/dist/sdk/app/applications/sync.js +23 -117
  49. package/dist/sdk/index.js +0 -2
  50. package/dist/sdk/users/utils.js +4 -21
  51. package/dist/startup.js +28 -31
  52. package/dist/threads/automation.js +5 -16
  53. package/dist/tsconfig.build.tsbuildinfo +1 -1
  54. package/dist/utilities/fileSystem/plugin.js +23 -33
  55. package/dist/utilities/global.js +12 -17
  56. package/dist/watch.js +2 -2
  57. package/dist/websocket.js +22 -0
  58. package/jest.config.ts +3 -3
  59. package/nodemon.json +3 -7
  60. package/package.json +16 -16
  61. package/scripts/dev/manage.js +0 -2
  62. package/scripts/integrations/mssql/data/entrypoint.sh +0 -1
  63. package/scripts/integrations/mssql/data/setup.sql +17 -17
  64. package/scripts/integrations/mysql/init.sql +1 -1
  65. package/scripts/integrations/postgres/init.sql +0 -1
  66. package/scripts/likeCypress.ts +35 -0
  67. package/src/api/controllers/automation.ts +6 -12
  68. package/src/api/controllers/plugin/index.ts +45 -8
  69. package/src/api/controllers/row/internal.ts +10 -9
  70. package/src/api/controllers/row/utils.ts +2 -2
  71. package/src/api/controllers/table/utils.ts +1 -2
  72. package/src/api/controllers/user.ts +96 -10
  73. package/src/api/routes/index.ts +0 -2
  74. package/src/api/routes/tests/automation.spec.js +4 -7
  75. package/src/api/routes/tests/user.spec.js +37 -48
  76. package/src/api/routes/user.ts +5 -0
  77. package/src/app.ts +15 -4
  78. package/src/automations/actions.ts +24 -56
  79. package/src/automations/index.ts +1 -1
  80. package/src/automations/steps/bash.ts +7 -10
  81. package/src/automations/steps/createRow.ts +12 -15
  82. package/src/automations/steps/delay.ts +4 -6
  83. package/src/automations/steps/deleteRow.ts +9 -12
  84. package/src/automations/steps/discord.ts +8 -10
  85. package/src/automations/steps/executeQuery.ts +10 -13
  86. package/src/automations/steps/executeScript.ts +7 -10
  87. package/src/automations/steps/filter.ts +6 -8
  88. package/src/automations/steps/integromat.ts +10 -12
  89. package/src/automations/steps/loop.ts +10 -16
  90. package/src/automations/steps/outgoingWebhook.ts +11 -14
  91. package/src/automations/steps/queryRows.ts +15 -18
  92. package/src/automations/steps/sendSmtpEmail.ts +9 -11
  93. package/src/automations/steps/serverLog.ts +4 -6
  94. package/src/automations/steps/slack.ts +6 -8
  95. package/src/automations/steps/updateRow.ts +12 -15
  96. package/src/automations/steps/zapier.ts +9 -11
  97. package/src/automations/tests/utilities/index.ts +2 -2
  98. package/src/automations/triggerInfo/app.ts +5 -8
  99. package/src/automations/triggerInfo/cron.ts +4 -7
  100. package/src/automations/triggerInfo/rowDeleted.ts +5 -8
  101. package/src/automations/triggerInfo/rowSaved.ts +7 -10
  102. package/src/automations/triggerInfo/rowUpdated.ts +7 -10
  103. package/src/automations/triggerInfo/webhook.ts +6 -9
  104. package/src/elasticApm.ts +10 -0
  105. package/src/environment.ts +1 -0
  106. package/src/events/index.ts +0 -1
  107. package/src/integrations/index.ts +3 -3
  108. package/src/integrations/microsoftSqlServer.ts +2 -5
  109. package/src/integrations/mysql.ts +3 -5
  110. package/src/integrations/postgres.ts +5 -7
  111. package/src/integrations/redis.ts +0 -8
  112. package/src/integrations/rest.ts +0 -3
  113. package/src/migrations/functions/usageQuotas/syncApps.ts +1 -1
  114. package/src/migrations/functions/usageQuotas/syncRows.ts +3 -2
  115. package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +2 -2
  116. package/src/sdk/app/applications/sync.ts +22 -129
  117. package/src/sdk/index.ts +0 -2
  118. package/src/sdk/users/tests/utils.spec.ts +32 -1
  119. package/src/sdk/users/utils.ts +5 -23
  120. package/src/startup.ts +34 -36
  121. package/src/tests/jestEnv.ts +1 -0
  122. package/src/tests/jestSetup.ts +1 -0
  123. package/src/tests/logging.ts +34 -0
  124. package/src/tests/utilities/TestConfiguration.ts +0 -28
  125. package/src/tests/utilities/structures.ts +17 -25
  126. package/src/threads/automation.ts +6 -18
  127. package/src/utilities/fileSystem/plugin.ts +4 -13
  128. package/src/utilities/global.ts +16 -21
  129. package/src/watch.ts +2 -2
  130. package/src/websocket.ts +26 -0
  131. package/tsconfig.json +7 -1
  132. package/builder/assets/index.5c1a6913.js +0 -1776
  133. package/builder/assets/index.c0265b74.css +0 -6
  134. package/dist/api/controllers/ops.js +0 -40
  135. package/dist/api/routes/ops.js +0 -52
  136. package/dist/events/docUpdates/index.js +0 -17
  137. package/dist/events/docUpdates/processors.js +0 -18
  138. package/dist/events/docUpdates/syncUsers.js +0 -49
  139. package/dist/sdk/plugins/index.js +0 -27
  140. package/dist/sdk/plugins/plugins.js +0 -53
  141. package/dist/websockets/client.js +0 -14
  142. package/dist/websockets/grid.js +0 -60
  143. package/dist/websockets/index.js +0 -17
  144. package/dist/websockets/websocket.js +0 -78
  145. package/src/api/controllers/ops.ts +0 -32
  146. package/src/api/routes/ops.ts +0 -30
  147. package/src/events/docUpdates/index.ts +0 -1
  148. package/src/events/docUpdates/processors.ts +0 -14
  149. package/src/events/docUpdates/syncUsers.ts +0 -35
  150. package/src/sdk/app/applications/tests/sync.spec.ts +0 -137
  151. package/src/sdk/plugins/index.ts +0 -5
  152. package/src/sdk/plugins/plugins.ts +0 -41
  153. package/src/websockets/client.ts +0 -11
  154. package/src/websockets/grid.ts +0 -55
  155. package/src/websockets/index.ts +0 -14
  156. package/src/websockets/websocket.ts +0 -83
@@ -4,8 +4,6 @@ import {
4
4
  AutomationActionStepId,
5
5
  AutomationStepSchema,
6
6
  AutomationStepInput,
7
- AutomationStepType,
8
- AutomationIOType,
9
7
  } from "@budibase/types"
10
8
 
11
9
  export const definition: AutomationStepSchema = {
@@ -13,7 +11,7 @@ export const definition: AutomationStepSchema = {
13
11
  tagline: "Send SMTP email to {{inputs.to}}",
14
12
  icon: "Email",
15
13
  name: "Send Email (SMTP)",
16
- type: AutomationStepType.ACTION,
14
+ type: "ACTION",
17
15
  internal: true,
18
16
  stepId: AutomationActionStepId.SEND_EMAIL_SMTP,
19
17
  inputs: {},
@@ -21,27 +19,27 @@ export const definition: AutomationStepSchema = {
21
19
  inputs: {
22
20
  properties: {
23
21
  to: {
24
- type: AutomationIOType.STRING,
22
+ type: "string",
25
23
  title: "Send To",
26
24
  },
27
25
  from: {
28
- type: AutomationIOType.STRING,
26
+ type: "string",
29
27
  title: "Send From",
30
28
  },
31
29
  cc: {
32
- type: AutomationIOType.STRING,
30
+ type: "string",
33
31
  title: "CC",
34
32
  },
35
33
  bcc: {
36
- type: AutomationIOType.STRING,
34
+ type: "string",
37
35
  title: "BCC",
38
36
  },
39
37
  subject: {
40
- type: AutomationIOType.STRING,
38
+ type: "string",
41
39
  title: "Email Subject",
42
40
  },
43
41
  contents: {
44
- type: AutomationIOType.STRING,
42
+ type: "string",
45
43
  title: "HTML Contents",
46
44
  },
47
45
  },
@@ -50,11 +48,11 @@ export const definition: AutomationStepSchema = {
50
48
  outputs: {
51
49
  properties: {
52
50
  success: {
53
- type: AutomationIOType.BOOLEAN,
51
+ type: "boolean",
54
52
  description: "Whether the email was sent",
55
53
  },
56
54
  response: {
57
- type: AutomationIOType.OBJECT,
55
+ type: "object",
58
56
  description: "A response from the email client, this may be an error",
59
57
  },
60
58
  },
@@ -2,8 +2,6 @@ import {
2
2
  AutomationActionStepId,
3
3
  AutomationStepSchema,
4
4
  AutomationStepInput,
5
- AutomationStepType,
6
- AutomationIOType,
7
5
  } from "@budibase/types"
8
6
 
9
7
  /**
@@ -17,7 +15,7 @@ export const definition: AutomationStepSchema = {
17
15
  tagline: "Console log a value in the backend",
18
16
  icon: "Monitoring",
19
17
  description: "Logs the given text to the server (using console.log)",
20
- type: AutomationStepType.ACTION,
18
+ type: "ACTION",
21
19
  internal: true,
22
20
  stepId: AutomationActionStepId.SERVER_LOG,
23
21
  inputs: {
@@ -27,7 +25,7 @@ export const definition: AutomationStepSchema = {
27
25
  inputs: {
28
26
  properties: {
29
27
  text: {
30
- type: AutomationIOType.STRING,
28
+ type: "string",
31
29
  title: "Log",
32
30
  },
33
31
  },
@@ -36,11 +34,11 @@ export const definition: AutomationStepSchema = {
36
34
  outputs: {
37
35
  properties: {
38
36
  success: {
39
- type: AutomationIOType.BOOLEAN,
37
+ type: "boolean",
40
38
  description: "Whether the action was successful",
41
39
  },
42
40
  message: {
43
- type: AutomationIOType.STRING,
41
+ type: "string",
44
42
  description: "What was output",
45
43
  },
46
44
  },
@@ -4,8 +4,6 @@ import {
4
4
  AutomationActionStepId,
5
5
  AutomationStepSchema,
6
6
  AutomationStepInput,
7
- AutomationStepType,
8
- AutomationIOType,
9
7
  } from "@budibase/types"
10
8
 
11
9
  export const definition: AutomationStepSchema = {
@@ -14,18 +12,18 @@ export const definition: AutomationStepSchema = {
14
12
  description: "Send a message to Slack",
15
13
  icon: "ri-slack-line",
16
14
  stepId: AutomationActionStepId.slack,
17
- type: AutomationStepType.ACTION,
15
+ type: "ACTION",
18
16
  internal: false,
19
17
  inputs: {},
20
18
  schema: {
21
19
  inputs: {
22
20
  properties: {
23
21
  url: {
24
- type: AutomationIOType.STRING,
22
+ type: "string",
25
23
  title: "Incoming Webhook URL",
26
24
  },
27
25
  text: {
28
- type: AutomationIOType.STRING,
26
+ type: "string",
29
27
  title: "Message",
30
28
  },
31
29
  },
@@ -34,15 +32,15 @@ export const definition: AutomationStepSchema = {
34
32
  outputs: {
35
33
  properties: {
36
34
  httpStatus: {
37
- type: AutomationIOType.NUMBER,
35
+ type: "number",
38
36
  description: "The HTTP status code of the request",
39
37
  },
40
38
  success: {
41
- type: AutomationIOType.BOOLEAN,
39
+ type: "boolean",
42
40
  description: "Whether the message sent successfully",
43
41
  },
44
42
  response: {
45
- type: AutomationIOType.STRING,
43
+ type: "string",
46
44
  description: "The response from the Slack Webhook",
47
45
  },
48
46
  },
@@ -3,11 +3,8 @@ import * as automationUtils from "../automationUtils"
3
3
  import { buildCtx } from "./utils"
4
4
  import {
5
5
  AutomationActionStepId,
6
- AutomationCustomIOType,
7
- AutomationIOType,
8
- AutomationStepInput,
9
6
  AutomationStepSchema,
10
- AutomationStepType,
7
+ AutomationStepInput,
11
8
  } from "@budibase/types"
12
9
 
13
10
  export const definition: AutomationStepSchema = {
@@ -15,7 +12,7 @@ export const definition: AutomationStepSchema = {
15
12
  tagline: "Update a {{inputs.enriched.table.name}} row",
16
13
  icon: "Refresh",
17
14
  description: "Update a row in your database",
18
- type: AutomationStepType.ACTION,
15
+ type: "ACTION",
19
16
  internal: true,
20
17
  stepId: AutomationActionStepId.UPDATE_ROW,
21
18
  inputs: {},
@@ -23,16 +20,16 @@ export const definition: AutomationStepSchema = {
23
20
  inputs: {
24
21
  properties: {
25
22
  meta: {
26
- type: AutomationIOType.OBJECT,
23
+ type: "object",
27
24
  title: "Field settings",
28
25
  },
29
26
  row: {
30
- type: AutomationIOType.OBJECT,
31
- customType: AutomationCustomIOType.ROW,
27
+ type: "object",
28
+ customType: "row",
32
29
  title: "Table",
33
30
  },
34
31
  rowId: {
35
- type: AutomationIOType.STRING,
32
+ type: "string",
36
33
  title: "Row ID",
37
34
  },
38
35
  },
@@ -41,24 +38,24 @@ export const definition: AutomationStepSchema = {
41
38
  outputs: {
42
39
  properties: {
43
40
  row: {
44
- type: AutomationIOType.OBJECT,
45
- customType: AutomationCustomIOType.ROW,
41
+ type: "object",
42
+ customType: "row",
46
43
  description: "The updated row",
47
44
  },
48
45
  response: {
49
- type: AutomationIOType.OBJECT,
46
+ type: "object",
50
47
  description: "The response from the table",
51
48
  },
52
49
  success: {
53
- type: AutomationIOType.BOOLEAN,
50
+ type: "boolean",
54
51
  description: "Whether the action was successful",
55
52
  },
56
53
  id: {
57
- type: AutomationIOType.STRING,
54
+ type: "string",
58
55
  description: "The identifier of the updated row",
59
56
  },
60
57
  revision: {
61
- type: AutomationIOType.STRING,
58
+ type: "string",
62
59
  description: "The revision of the updated row",
63
60
  },
64
61
  },
@@ -4,14 +4,12 @@ import {
4
4
  AutomationActionStepId,
5
5
  AutomationStepSchema,
6
6
  AutomationStepInput,
7
- AutomationStepType,
8
- AutomationIOType,
9
7
  } from "@budibase/types"
10
8
 
11
9
  export const definition: AutomationStepSchema = {
12
10
  name: "Zapier Webhook",
13
11
  stepId: AutomationActionStepId.zapier,
14
- type: AutomationStepType.ACTION,
12
+ type: "ACTION",
15
13
  internal: false,
16
14
  description: "Trigger a Zapier Zap via webhooks",
17
15
  tagline: "Trigger a Zapier Zap",
@@ -21,27 +19,27 @@ export const definition: AutomationStepSchema = {
21
19
  inputs: {
22
20
  properties: {
23
21
  url: {
24
- type: AutomationIOType.STRING,
22
+ type: "string",
25
23
  title: "Webhook URL",
26
24
  },
27
25
  value1: {
28
- type: AutomationIOType.STRING,
26
+ type: "string",
29
27
  title: "Payload Value 1",
30
28
  },
31
29
  value2: {
32
- type: AutomationIOType.STRING,
30
+ type: "string",
33
31
  title: "Payload Value 2",
34
32
  },
35
33
  value3: {
36
- type: AutomationIOType.STRING,
34
+ type: "string",
37
35
  title: "Payload Value 3",
38
36
  },
39
37
  value4: {
40
- type: AutomationIOType.STRING,
38
+ type: "string",
41
39
  title: "Payload Value 4",
42
40
  },
43
41
  value5: {
44
- type: AutomationIOType.STRING,
42
+ type: "string",
45
43
  title: "Payload Value 5",
46
44
  },
47
45
  },
@@ -50,11 +48,11 @@ export const definition: AutomationStepSchema = {
50
48
  outputs: {
51
49
  properties: {
52
50
  httpStatus: {
53
- type: AutomationIOType.NUMBER,
51
+ type: "number",
54
52
  description: "The HTTP status code of the request",
55
53
  },
56
54
  response: {
57
- type: AutomationIOType.STRING,
55
+ type: "string",
58
56
  description: "The response from Zapier",
59
57
  },
60
58
  },
@@ -1,6 +1,6 @@
1
1
  import TestConfig from "../../../tests/utilities/TestConfiguration"
2
2
  import { context } from "@budibase/backend-core"
3
- import { BUILTIN_ACTION_DEFINITIONS, getAction } from "../../actions"
3
+ import { ACTION_DEFINITIONS, getAction } from "../../actions"
4
4
  import emitter from "../../../events/index"
5
5
  import env from "../../../environment"
6
6
 
@@ -57,4 +57,4 @@ export async function runStep(stepId: string, inputs: any, stepContext?: any) {
57
57
  }
58
58
 
59
59
  export const apiKey = "test"
60
- export const actions = BUILTIN_ACTION_DEFINITIONS
60
+ export const actions = ACTION_DEFINITIONS
@@ -1,7 +1,4 @@
1
1
  import {
2
- AutomationCustomIOType,
3
- AutomationIOType,
4
- AutomationStepType,
5
2
  AutomationTriggerSchema,
6
3
  AutomationTriggerStepId,
7
4
  } from "@budibase/types"
@@ -18,8 +15,8 @@ export const definition: AutomationTriggerSchema = {
18
15
  inputs: {
19
16
  properties: {
20
17
  fields: {
21
- type: AutomationIOType.OBJECT,
22
- customType: AutomationCustomIOType.TRIGGER_SCHEMA,
18
+ type: "object",
19
+ customType: "triggerSchema",
23
20
  title: "Fields",
24
21
  },
25
22
  },
@@ -28,13 +25,13 @@ export const definition: AutomationTriggerSchema = {
28
25
  outputs: {
29
26
  properties: {
30
27
  fields: {
31
- type: AutomationIOType.OBJECT,
28
+ type: "object",
32
29
  description: "Fields submitted from the app frontend",
33
- customType: AutomationCustomIOType.TRIGGER_SCHEMA,
30
+ customType: "triggerSchema",
34
31
  },
35
32
  },
36
33
  required: ["fields"],
37
34
  },
38
35
  },
39
- type: AutomationStepType.TRIGGER,
36
+ type: "TRIGGER",
40
37
  }
@@ -1,7 +1,4 @@
1
1
  import {
2
- AutomationCustomIOType,
3
- AutomationIOType,
4
- AutomationStepType,
5
2
  AutomationTriggerSchema,
6
3
  AutomationTriggerStepId,
7
4
  } from "@budibase/types"
@@ -18,8 +15,8 @@ export const definition: AutomationTriggerSchema = {
18
15
  inputs: {
19
16
  properties: {
20
17
  cron: {
21
- type: AutomationIOType.STRING,
22
- customType: AutomationCustomIOType.CRON,
18
+ type: "string",
19
+ customType: "cron",
23
20
  title: "Expression",
24
21
  },
25
22
  },
@@ -28,12 +25,12 @@ export const definition: AutomationTriggerSchema = {
28
25
  outputs: {
29
26
  properties: {
30
27
  timestamp: {
31
- type: AutomationIOType.NUMBER,
28
+ type: "number",
32
29
  description: "Timestamp the cron was executed",
33
30
  },
34
31
  },
35
32
  required: ["timestamp"],
36
33
  },
37
34
  },
38
- type: AutomationStepType.TRIGGER,
35
+ type: "TRIGGER",
39
36
  }
@@ -1,7 +1,4 @@
1
1
  import {
2
- AutomationCustomIOType,
3
- AutomationIOType,
4
- AutomationStepType,
5
2
  AutomationTriggerSchema,
6
3
  AutomationTriggerStepId,
7
4
  } from "@budibase/types"
@@ -18,8 +15,8 @@ export const definition: AutomationTriggerSchema = {
18
15
  inputs: {
19
16
  properties: {
20
17
  tableId: {
21
- type: AutomationIOType.STRING,
22
- customType: AutomationCustomIOType.TABLE,
18
+ type: "string",
19
+ customType: "table",
23
20
  title: "Table",
24
21
  },
25
22
  },
@@ -28,13 +25,13 @@ export const definition: AutomationTriggerSchema = {
28
25
  outputs: {
29
26
  properties: {
30
27
  row: {
31
- type: AutomationIOType.OBJECT,
32
- customType: AutomationCustomIOType.ROW,
28
+ type: "object",
29
+ customType: "row",
33
30
  description: "The row that was deleted",
34
31
  },
35
32
  },
36
33
  required: ["row"],
37
34
  },
38
35
  },
39
- type: AutomationStepType.TRIGGER,
36
+ type: "TRIGGER",
40
37
  }
@@ -1,7 +1,4 @@
1
1
  import {
2
- AutomationCustomIOType,
3
- AutomationIOType,
4
- AutomationStepType,
5
2
  AutomationTriggerSchema,
6
3
  AutomationTriggerStepId,
7
4
  } from "@budibase/types"
@@ -18,8 +15,8 @@ export const definition: AutomationTriggerSchema = {
18
15
  inputs: {
19
16
  properties: {
20
17
  tableId: {
21
- type: AutomationIOType.STRING,
22
- customType: AutomationCustomIOType.TABLE,
18
+ type: "string",
19
+ customType: "table",
23
20
  title: "Table",
24
21
  },
25
22
  },
@@ -28,21 +25,21 @@ export const definition: AutomationTriggerSchema = {
28
25
  outputs: {
29
26
  properties: {
30
27
  row: {
31
- type: AutomationIOType.OBJECT,
32
- customType: AutomationCustomIOType.ROW,
28
+ type: "object",
29
+ customType: "row",
33
30
  description: "The new row that was created",
34
31
  },
35
32
  id: {
36
- type: AutomationIOType.STRING,
33
+ type: "string",
37
34
  description: "Row ID - can be used for updating",
38
35
  },
39
36
  revision: {
40
- type: AutomationIOType.STRING,
37
+ type: "string",
41
38
  description: "Revision of row",
42
39
  },
43
40
  },
44
41
  required: ["row", "id"],
45
42
  },
46
43
  },
47
- type: AutomationStepType.TRIGGER,
44
+ type: "TRIGGER",
48
45
  }
@@ -1,7 +1,4 @@
1
1
  import {
2
- AutomationCustomIOType,
3
- AutomationIOType,
4
- AutomationStepType,
5
2
  AutomationTriggerSchema,
6
3
  AutomationTriggerStepId,
7
4
  } from "@budibase/types"
@@ -18,8 +15,8 @@ export const definition: AutomationTriggerSchema = {
18
15
  inputs: {
19
16
  properties: {
20
17
  tableId: {
21
- type: AutomationIOType.STRING,
22
- customType: AutomationCustomIOType.TABLE,
18
+ type: "string",
19
+ customType: "table",
23
20
  title: "Table",
24
21
  },
25
22
  },
@@ -28,21 +25,21 @@ export const definition: AutomationTriggerSchema = {
28
25
  outputs: {
29
26
  properties: {
30
27
  row: {
31
- type: AutomationIOType.OBJECT,
32
- customType: AutomationCustomIOType.ROW,
28
+ type: "object",
29
+ customType: "row",
33
30
  description: "The row that was updated",
34
31
  },
35
32
  id: {
36
- type: AutomationIOType.STRING,
33
+ type: "string",
37
34
  description: "Row ID - can be used for updating",
38
35
  },
39
36
  revision: {
40
- type: AutomationIOType.STRING,
37
+ type: "string",
41
38
  description: "Revision of row",
42
39
  },
43
40
  },
44
41
  required: ["row", "id"],
45
42
  },
46
43
  },
47
- type: AutomationStepType.TRIGGER,
44
+ type: "TRIGGER",
48
45
  }
@@ -1,7 +1,4 @@
1
1
  import {
2
- AutomationCustomIOType,
3
- AutomationIOType,
4
- AutomationStepType,
5
2
  AutomationTriggerSchema,
6
3
  AutomationTriggerStepId,
7
4
  } from "@budibase/types"
@@ -18,13 +15,13 @@ export const definition: AutomationTriggerSchema = {
18
15
  inputs: {
19
16
  properties: {
20
17
  schemaUrl: {
21
- type: AutomationIOType.STRING,
22
- customType: AutomationCustomIOType.WEBHOOK_URL,
18
+ type: "string",
19
+ customType: "webhookUrl",
23
20
  title: "Schema URL",
24
21
  },
25
22
  triggerUrl: {
26
- type: AutomationIOType.STRING,
27
- customType: AutomationCustomIOType.WEBHOOK_URL,
23
+ type: "string",
24
+ customType: "webhookUrl",
28
25
  title: "Trigger URL",
29
26
  },
30
27
  },
@@ -33,12 +30,12 @@ export const definition: AutomationTriggerSchema = {
33
30
  outputs: {
34
31
  properties: {
35
32
  body: {
36
- type: AutomationIOType.OBJECT,
33
+ type: "object",
37
34
  description: "Body of the request which hit the webhook",
38
35
  },
39
36
  },
40
37
  required: ["body"],
41
38
  },
42
39
  },
43
- type: AutomationStepType.TRIGGER,
40
+ type: "TRIGGER",
44
41
  }
@@ -0,0 +1,10 @@
1
+ import apm from "elastic-apm-node"
2
+
3
+ // enable APM if configured
4
+ if (process.env.ELASTIC_APM_ENABLED) {
5
+ console.log("Starting elastic-apm-node")
6
+ apm.start({
7
+ serviceName: process.env.SERVICE,
8
+ environment: process.env.BUDIBASE_ENVIRONMENT,
9
+ })
10
+ }
@@ -62,6 +62,7 @@ const environment = {
62
62
  // minor
63
63
  SALT_ROUNDS: process.env.SALT_ROUNDS,
64
64
  LOGGER: process.env.LOGGER,
65
+ LOG_LEVEL: process.env.LOG_LEVEL,
65
66
  ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL,
66
67
  AUTOMATION_MAX_ITERATIONS:
67
68
  parseIntSafe(process.env.AUTOMATION_MAX_ITERATIONS) || 200,
@@ -2,5 +2,4 @@ import BudibaseEmitter from "./BudibaseEmitter"
2
2
 
3
3
  const emitter = new BudibaseEmitter()
4
4
 
5
- export { init } from "./docUpdates"
6
5
  export default emitter
@@ -14,11 +14,11 @@ import firebase from "./firebase"
14
14
  import redis from "./redis"
15
15
  import snowflake from "./snowflake"
16
16
  import oracle from "./oracle"
17
+ import { getPlugins } from "../api/controllers/plugin"
17
18
  import { SourceName, Integration, PluginType } from "@budibase/types"
18
19
  import { getDatasourcePlugin } from "../utilities/fileSystem"
19
20
  import env from "../environment"
20
21
  import { cloneDeep } from "lodash"
21
- import sdk from "../sdk"
22
22
 
23
23
  const DEFINITIONS: { [key: string]: Integration } = {
24
24
  [SourceName.POSTGRES]: postgres.schema,
@@ -79,7 +79,7 @@ export async function getDefinition(source: SourceName): Promise<Integration> {
79
79
  export async function getDefinitions() {
80
80
  const pluginSchemas: { [key: string]: Integration } = {}
81
81
  if (env.SELF_HOSTED) {
82
- const plugins = await sdk.plugins.fetch(PluginType.DATASOURCE)
82
+ const plugins = await getPlugins(PluginType.DATASOURCE)
83
83
  // extract the actual schema from each custom
84
84
  for (let plugin of plugins) {
85
85
  const sourceId = plugin.name
@@ -103,7 +103,7 @@ export async function getIntegration(integration: string) {
103
103
  return INTEGRATIONS[integration]
104
104
  }
105
105
  if (env.SELF_HOSTED) {
106
- const plugins = await sdk.plugins.fetch(PluginType.DATASOURCE)
106
+ const plugins = await getPlugins(PluginType.DATASOURCE)
107
107
  for (let plugin of plugins) {
108
108
  if (plugin.name === integration) {
109
109
  // need to use commonJS require due to its dynamic runtime nature
@@ -243,14 +243,11 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
243
243
  if (typeof name !== "string") {
244
244
  continue
245
245
  }
246
- const hasDefault = def.COLUMN_DEFAULT
247
- const isAuto = !!autoColumns.find(col => col === name)
248
- const required = !!requiredColumns.find(col => col === name)
249
246
  schema[name] = {
250
- autocolumn: isAuto,
247
+ autocolumn: !!autoColumns.find(col => col === name),
251
248
  name: name,
252
249
  constraints: {
253
- presence: required && !isAuto && !hasDefault,
250
+ presence: requiredColumns.find(col => col === name),
254
251
  },
255
252
  ...convertSqlType(def.DATA_TYPE),
256
253
  externalType: def.DATA_TYPE,
@@ -229,15 +229,13 @@ class MySQLIntegration extends Sql implements DatasourcePlus {
229
229
  if (column.Key === "PRI" && primaryKeys.indexOf(column.Key) === -1) {
230
230
  primaryKeys.push(columnName)
231
231
  }
232
- const hasDefault = column.Default != null
232
+ const constraints = {
233
+ presence: column.Null !== "YES",
234
+ }
233
235
  const isAuto: boolean =
234
236
  typeof column.Extra === "string" &&
235
237
  (column.Extra === "auto_increment" ||
236
238
  column.Extra.toLowerCase().includes("generated"))
237
- const required = column.Null !== "YES"
238
- const constraints = {
239
- presence: required && !isAuto && !hasDefault,
240
- }
241
239
  schema[columnName] = {
242
240
  name: columnName,
243
241
  autocolumn: isAuto,
@@ -262,17 +262,15 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
262
262
  column.identity_start ||
263
263
  column.identity_increment
264
264
  )
265
- const hasDefault = column.column_default != null
266
- const hasNextVal =
265
+ const constraints = {
266
+ presence: column.is_nullable === "NO",
267
+ }
268
+ const hasDefault =
267
269
  typeof column.column_default === "string" &&
268
270
  column.column_default.startsWith("nextval")
269
271
  const isGenerated =
270
272
  column.is_generated && column.is_generated !== "NEVER"
271
- const isAuto: boolean = hasNextVal || identity || isGenerated
272
- const required = column.is_nullable === "NO"
273
- const constraints = {
274
- presence: required && !hasDefault && !isGenerated,
275
- }
273
+ const isAuto: boolean = hasDefault || identity || isGenerated
276
274
  tables[tableName].schema[columnName] = {
277
275
  autocolumn: isAuto,
278
276
  name: columnName,