@budibase/server 2.5.9 → 2.5.10-alpha.1
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.24635afb.js +1794 -0
- package/builder/assets/index.4eae16b2.css +6 -0
- package/builder/index.html +2 -2
- package/dist/api/controllers/application.js +3 -4
- package/dist/api/controllers/automation.js +13 -7
- package/dist/api/controllers/datasource.js +1 -1
- package/dist/api/controllers/dev.js +1 -1
- package/dist/api/controllers/ops.js +40 -0
- package/dist/api/controllers/plugin/index.js +6 -37
- package/dist/api/controllers/query/index.js +2 -2
- package/dist/api/controllers/row/ExternalRequest.js +21 -14
- package/dist/api/controllers/row/internal.js +5 -2
- package/dist/api/controllers/row/utils.js +2 -2
- package/dist/api/controllers/table/index.js +2 -2
- package/dist/api/controllers/table/utils.js +9 -3
- package/dist/api/controllers/user.js +1 -83
- package/dist/api/controllers/view/exporters.js +3 -1
- package/dist/api/index.js +1 -2
- package/dist/api/routes/index.js +2 -2
- package/dist/api/routes/{cloud.js → ops.js} +19 -6
- package/dist/api/routes/user.js +0 -1
- package/dist/app.js +4 -13
- package/dist/automations/actions.js +32 -6
- package/dist/automations/index.js +3 -2
- package/dist/automations/steps/bash.js +6 -6
- package/dist/automations/steps/createRow.js +11 -11
- package/dist/automations/steps/delay.js +3 -3
- package/dist/automations/steps/deleteRow.js +8 -8
- package/dist/automations/steps/discord.js +8 -8
- package/dist/automations/steps/executeQuery.js +9 -9
- package/dist/automations/steps/executeScript.js +6 -6
- package/dist/automations/steps/filter.js +6 -6
- package/dist/automations/steps/integromat.js +10 -10
- package/dist/automations/steps/loop.js +9 -9
- package/dist/automations/steps/outgoingWebhook.js +10 -10
- package/dist/automations/steps/queryRows.js +14 -14
- package/dist/automations/steps/sendSmtpEmail.js +9 -9
- package/dist/automations/steps/serverLog.js +4 -4
- package/dist/automations/steps/slack.js +6 -6
- package/dist/automations/steps/updateRow.js +11 -11
- package/dist/automations/steps/zapier.js +9 -9
- package/dist/automations/triggerInfo/app.js +5 -5
- package/dist/automations/triggerInfo/cron.js +4 -4
- package/dist/automations/triggerInfo/rowDeleted.js +5 -5
- package/dist/automations/triggerInfo/rowSaved.js +7 -7
- package/dist/automations/triggerInfo/rowUpdated.js +7 -7
- package/dist/automations/triggerInfo/webhook.js +6 -6
- package/dist/db/utils.js +3 -2
- package/dist/environment.js +0 -1
- package/dist/events/docUpdates/index.js +17 -0
- package/dist/events/docUpdates/processors.js +18 -0
- package/dist/events/docUpdates/syncUsers.js +49 -0
- package/dist/events/index.js +3 -0
- package/dist/integrations/base/sqlTable.js +9 -2
- package/dist/integrations/index.js +3 -3
- package/dist/integrations/microsoftSqlServer.js +5 -2
- package/dist/integrations/mysql.js +5 -3
- package/dist/integrations/postgres.js +7 -5
- package/dist/integrations/redis.js +7 -0
- package/dist/integrations/rest.js +4 -0
- package/dist/migrations/functions/syncQuotas.js +2 -0
- package/dist/migrations/functions/usageQuotas/syncApps.js +1 -2
- package/dist/migrations/functions/usageQuotas/syncRows.js +1 -2
- package/dist/migrations/functions/usageQuotas/syncUsers.js +21 -0
- package/dist/sdk/app/applications/sync.js +117 -23
- package/dist/sdk/app/backups/exports.js +14 -38
- package/dist/sdk/index.js +2 -0
- package/dist/sdk/plugins/index.js +27 -0
- package/dist/sdk/plugins/plugins.js +53 -0
- package/dist/sdk/users/utils.js +21 -4
- package/dist/startup.js +31 -28
- package/dist/threads/automation.js +16 -5
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/csv.js +33 -0
- package/dist/utilities/fileSystem/plugin.js +33 -23
- package/dist/utilities/global.js +17 -12
- package/dist/utilities/rowProcessor/utils.js +4 -5
- package/dist/utilities/schema.js +5 -1
- package/dist/watch.js +2 -2
- package/dist/websockets/client.js +14 -0
- package/dist/websockets/grid.js +60 -0
- package/dist/websockets/index.js +17 -0
- package/dist/websockets/websocket.js +78 -0
- package/package.json +16 -16
- package/scripts/dev/manage.js +2 -0
- package/scripts/integrations/mssql/data/entrypoint.sh +1 -0
- package/scripts/integrations/mssql/data/setup.sql +17 -17
- package/scripts/integrations/mysql/init.sql +1 -1
- package/scripts/integrations/postgres/init.sql +1 -0
- package/src/api/controllers/application.ts +4 -4
- package/src/api/controllers/automation.ts +12 -6
- package/src/api/controllers/datasource.ts +15 -5
- package/src/api/controllers/dev.ts +2 -2
- package/src/api/controllers/ops.ts +32 -0
- package/src/api/controllers/plugin/index.ts +8 -45
- package/src/api/controllers/query/index.ts +2 -2
- package/src/api/controllers/row/ExternalRequest.ts +21 -12
- package/src/api/controllers/row/internal.ts +13 -11
- package/src/api/controllers/row/utils.ts +4 -4
- package/src/api/controllers/table/index.ts +2 -2
- package/src/api/controllers/table/utils.ts +10 -3
- package/src/api/controllers/user.ts +10 -96
- package/src/api/controllers/view/exporters.ts +3 -1
- package/src/api/index.ts +2 -4
- package/src/api/routes/index.ts +2 -2
- package/src/api/routes/ops.ts +30 -0
- package/src/api/routes/tests/automation.spec.js +7 -4
- package/src/api/routes/tests/user.spec.js +48 -37
- package/src/api/routes/user.ts +0 -5
- package/src/app.ts +4 -15
- package/src/automations/actions.ts +56 -24
- package/src/automations/index.ts +1 -1
- package/src/automations/steps/bash.ts +10 -7
- package/src/automations/steps/createRow.ts +15 -12
- package/src/automations/steps/delay.ts +6 -4
- package/src/automations/steps/deleteRow.ts +12 -9
- package/src/automations/steps/discord.ts +10 -8
- package/src/automations/steps/executeQuery.ts +13 -10
- package/src/automations/steps/executeScript.ts +10 -7
- package/src/automations/steps/filter.ts +8 -6
- package/src/automations/steps/integromat.ts +12 -10
- package/src/automations/steps/loop.ts +16 -10
- package/src/automations/steps/outgoingWebhook.ts +14 -11
- package/src/automations/steps/queryRows.ts +18 -15
- package/src/automations/steps/sendSmtpEmail.ts +11 -9
- package/src/automations/steps/serverLog.ts +6 -4
- package/src/automations/steps/slack.ts +8 -6
- package/src/automations/steps/updateRow.ts +15 -12
- package/src/automations/steps/zapier.ts +11 -9
- package/src/automations/tests/utilities/index.ts +2 -2
- package/src/automations/triggerInfo/app.ts +8 -5
- package/src/automations/triggerInfo/cron.ts +7 -4
- package/src/automations/triggerInfo/rowDeleted.ts +8 -5
- package/src/automations/triggerInfo/rowSaved.ts +10 -7
- package/src/automations/triggerInfo/rowUpdated.ts +10 -7
- package/src/automations/triggerInfo/webhook.ts +9 -6
- package/src/db/utils.ts +1 -0
- package/src/environment.ts +0 -1
- package/src/events/docUpdates/index.ts +1 -0
- package/src/events/docUpdates/processors.ts +14 -0
- package/src/events/docUpdates/syncUsers.ts +35 -0
- package/src/events/index.ts +1 -0
- package/src/integration-test/postgres.spec.ts +3 -1
- package/src/integrations/base/sqlTable.ts +9 -2
- package/src/integrations/index.ts +3 -3
- package/src/integrations/microsoftSqlServer.ts +5 -2
- package/src/integrations/mysql.ts +5 -3
- package/src/integrations/postgres.ts +7 -5
- package/src/integrations/redis.ts +8 -0
- package/src/integrations/rest.ts +3 -0
- package/src/migrations/functions/syncQuotas.ts +2 -0
- package/src/migrations/functions/usageQuotas/syncApps.ts +2 -3
- package/src/migrations/functions/usageQuotas/syncRows.ts +2 -3
- package/src/migrations/functions/usageQuotas/syncUsers.ts +9 -0
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +2 -2
- package/src/migrations/functions/usageQuotas/tests/syncUsers.spec.ts +26 -0
- package/src/migrations/index.ts +1 -0
- package/src/sdk/app/applications/sync.ts +129 -22
- package/src/sdk/app/applications/tests/sync.spec.ts +137 -0
- package/src/sdk/app/backups/exports.ts +17 -41
- package/src/sdk/index.ts +2 -0
- package/src/sdk/plugins/index.ts +5 -0
- package/src/sdk/plugins/plugins.ts +41 -0
- package/src/sdk/users/tests/utils.spec.ts +1 -32
- package/src/sdk/users/utils.ts +23 -5
- package/src/startup.ts +36 -34
- package/src/tests/jestEnv.ts +0 -1
- package/src/tests/jestSetup.ts +0 -1
- package/src/tests/utilities/TestConfiguration.ts +28 -0
- package/src/tests/utilities/structures.ts +25 -17
- package/src/threads/automation.ts +18 -6
- package/src/utilities/csv.ts +22 -0
- package/src/utilities/fileSystem/plugin.ts +13 -4
- package/src/utilities/global.ts +21 -16
- package/src/utilities/rowProcessor/utils.ts +9 -10
- package/src/utilities/schema.ts +8 -0
- package/src/utilities/tests/csv.spec.ts +33 -0
- package/src/watch.ts +2 -2
- package/src/websockets/client.ts +11 -0
- package/src/websockets/grid.ts +55 -0
- package/src/websockets/index.ts +14 -0
- package/src/websockets/websocket.ts +83 -0
- package/tsconfig.build.json +3 -5
- package/tsconfig.json +2 -1
- package/builder/assets/index.0b358332.js +0 -1817
- package/builder/assets/index.7f9a008b.css +0 -6
- package/dist/api/controllers/cloud.js +0 -130
- package/dist/elasticApm.js +0 -14
- package/dist/package.json +0 -180
- package/dist/websocket.js +0 -22
- package/scripts/likeCypress.ts +0 -35
- package/src/api/controllers/cloud.ts +0 -119
- package/src/api/routes/cloud.ts +0 -18
- package/src/api/routes/tests/cloud.spec.ts +0 -54
- package/src/elasticApm.ts +0 -10
- package/src/migrations/functions/tests/syncQuotas.spec.js +0 -26
- package/src/tests/logging.ts +0 -34
- package/src/websocket.ts +0 -26
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
AutomationActionStepId,
|
|
5
5
|
AutomationStepSchema,
|
|
6
6
|
AutomationStepInput,
|
|
7
|
+
AutomationStepType,
|
|
8
|
+
AutomationIOType,
|
|
7
9
|
} from "@budibase/types"
|
|
8
10
|
|
|
9
11
|
export const definition: AutomationStepSchema = {
|
|
@@ -11,7 +13,7 @@ export const definition: AutomationStepSchema = {
|
|
|
11
13
|
tagline: "Send SMTP email to {{inputs.to}}",
|
|
12
14
|
icon: "Email",
|
|
13
15
|
name: "Send Email (SMTP)",
|
|
14
|
-
type:
|
|
16
|
+
type: AutomationStepType.ACTION,
|
|
15
17
|
internal: true,
|
|
16
18
|
stepId: AutomationActionStepId.SEND_EMAIL_SMTP,
|
|
17
19
|
inputs: {},
|
|
@@ -19,27 +21,27 @@ export const definition: AutomationStepSchema = {
|
|
|
19
21
|
inputs: {
|
|
20
22
|
properties: {
|
|
21
23
|
to: {
|
|
22
|
-
type:
|
|
24
|
+
type: AutomationIOType.STRING,
|
|
23
25
|
title: "Send To",
|
|
24
26
|
},
|
|
25
27
|
from: {
|
|
26
|
-
type:
|
|
28
|
+
type: AutomationIOType.STRING,
|
|
27
29
|
title: "Send From",
|
|
28
30
|
},
|
|
29
31
|
cc: {
|
|
30
|
-
type:
|
|
32
|
+
type: AutomationIOType.STRING,
|
|
31
33
|
title: "CC",
|
|
32
34
|
},
|
|
33
35
|
bcc: {
|
|
34
|
-
type:
|
|
36
|
+
type: AutomationIOType.STRING,
|
|
35
37
|
title: "BCC",
|
|
36
38
|
},
|
|
37
39
|
subject: {
|
|
38
|
-
type:
|
|
40
|
+
type: AutomationIOType.STRING,
|
|
39
41
|
title: "Email Subject",
|
|
40
42
|
},
|
|
41
43
|
contents: {
|
|
42
|
-
type:
|
|
44
|
+
type: AutomationIOType.STRING,
|
|
43
45
|
title: "HTML Contents",
|
|
44
46
|
},
|
|
45
47
|
},
|
|
@@ -48,11 +50,11 @@ export const definition: AutomationStepSchema = {
|
|
|
48
50
|
outputs: {
|
|
49
51
|
properties: {
|
|
50
52
|
success: {
|
|
51
|
-
type:
|
|
53
|
+
type: AutomationIOType.BOOLEAN,
|
|
52
54
|
description: "Whether the email was sent",
|
|
53
55
|
},
|
|
54
56
|
response: {
|
|
55
|
-
type:
|
|
57
|
+
type: AutomationIOType.OBJECT,
|
|
56
58
|
description: "A response from the email client, this may be an error",
|
|
57
59
|
},
|
|
58
60
|
},
|
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
AutomationActionStepId,
|
|
3
3
|
AutomationStepSchema,
|
|
4
4
|
AutomationStepInput,
|
|
5
|
+
AutomationStepType,
|
|
6
|
+
AutomationIOType,
|
|
5
7
|
} from "@budibase/types"
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -15,7 +17,7 @@ export const definition: AutomationStepSchema = {
|
|
|
15
17
|
tagline: "Console log a value in the backend",
|
|
16
18
|
icon: "Monitoring",
|
|
17
19
|
description: "Logs the given text to the server (using console.log)",
|
|
18
|
-
type:
|
|
20
|
+
type: AutomationStepType.ACTION,
|
|
19
21
|
internal: true,
|
|
20
22
|
stepId: AutomationActionStepId.SERVER_LOG,
|
|
21
23
|
inputs: {
|
|
@@ -25,7 +27,7 @@ export const definition: AutomationStepSchema = {
|
|
|
25
27
|
inputs: {
|
|
26
28
|
properties: {
|
|
27
29
|
text: {
|
|
28
|
-
type:
|
|
30
|
+
type: AutomationIOType.STRING,
|
|
29
31
|
title: "Log",
|
|
30
32
|
},
|
|
31
33
|
},
|
|
@@ -34,11 +36,11 @@ export const definition: AutomationStepSchema = {
|
|
|
34
36
|
outputs: {
|
|
35
37
|
properties: {
|
|
36
38
|
success: {
|
|
37
|
-
type:
|
|
39
|
+
type: AutomationIOType.BOOLEAN,
|
|
38
40
|
description: "Whether the action was successful",
|
|
39
41
|
},
|
|
40
42
|
message: {
|
|
41
|
-
type:
|
|
43
|
+
type: AutomationIOType.STRING,
|
|
42
44
|
description: "What was output",
|
|
43
45
|
},
|
|
44
46
|
},
|
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
AutomationActionStepId,
|
|
5
5
|
AutomationStepSchema,
|
|
6
6
|
AutomationStepInput,
|
|
7
|
+
AutomationStepType,
|
|
8
|
+
AutomationIOType,
|
|
7
9
|
} from "@budibase/types"
|
|
8
10
|
|
|
9
11
|
export const definition: AutomationStepSchema = {
|
|
@@ -12,18 +14,18 @@ export const definition: AutomationStepSchema = {
|
|
|
12
14
|
description: "Send a message to Slack",
|
|
13
15
|
icon: "ri-slack-line",
|
|
14
16
|
stepId: AutomationActionStepId.slack,
|
|
15
|
-
type:
|
|
17
|
+
type: AutomationStepType.ACTION,
|
|
16
18
|
internal: false,
|
|
17
19
|
inputs: {},
|
|
18
20
|
schema: {
|
|
19
21
|
inputs: {
|
|
20
22
|
properties: {
|
|
21
23
|
url: {
|
|
22
|
-
type:
|
|
24
|
+
type: AutomationIOType.STRING,
|
|
23
25
|
title: "Incoming Webhook URL",
|
|
24
26
|
},
|
|
25
27
|
text: {
|
|
26
|
-
type:
|
|
28
|
+
type: AutomationIOType.STRING,
|
|
27
29
|
title: "Message",
|
|
28
30
|
},
|
|
29
31
|
},
|
|
@@ -32,15 +34,15 @@ export const definition: AutomationStepSchema = {
|
|
|
32
34
|
outputs: {
|
|
33
35
|
properties: {
|
|
34
36
|
httpStatus: {
|
|
35
|
-
type:
|
|
37
|
+
type: AutomationIOType.NUMBER,
|
|
36
38
|
description: "The HTTP status code of the request",
|
|
37
39
|
},
|
|
38
40
|
success: {
|
|
39
|
-
type:
|
|
41
|
+
type: AutomationIOType.BOOLEAN,
|
|
40
42
|
description: "Whether the message sent successfully",
|
|
41
43
|
},
|
|
42
44
|
response: {
|
|
43
|
-
type:
|
|
45
|
+
type: AutomationIOType.STRING,
|
|
44
46
|
description: "The response from the Slack Webhook",
|
|
45
47
|
},
|
|
46
48
|
},
|
|
@@ -3,8 +3,11 @@ import * as automationUtils from "../automationUtils"
|
|
|
3
3
|
import { buildCtx } from "./utils"
|
|
4
4
|
import {
|
|
5
5
|
AutomationActionStepId,
|
|
6
|
-
|
|
6
|
+
AutomationCustomIOType,
|
|
7
|
+
AutomationIOType,
|
|
7
8
|
AutomationStepInput,
|
|
9
|
+
AutomationStepSchema,
|
|
10
|
+
AutomationStepType,
|
|
8
11
|
} from "@budibase/types"
|
|
9
12
|
|
|
10
13
|
export const definition: AutomationStepSchema = {
|
|
@@ -12,7 +15,7 @@ export const definition: AutomationStepSchema = {
|
|
|
12
15
|
tagline: "Update a {{inputs.enriched.table.name}} row",
|
|
13
16
|
icon: "Refresh",
|
|
14
17
|
description: "Update a row in your database",
|
|
15
|
-
type:
|
|
18
|
+
type: AutomationStepType.ACTION,
|
|
16
19
|
internal: true,
|
|
17
20
|
stepId: AutomationActionStepId.UPDATE_ROW,
|
|
18
21
|
inputs: {},
|
|
@@ -20,16 +23,16 @@ export const definition: AutomationStepSchema = {
|
|
|
20
23
|
inputs: {
|
|
21
24
|
properties: {
|
|
22
25
|
meta: {
|
|
23
|
-
type:
|
|
26
|
+
type: AutomationIOType.OBJECT,
|
|
24
27
|
title: "Field settings",
|
|
25
28
|
},
|
|
26
29
|
row: {
|
|
27
|
-
type:
|
|
28
|
-
customType:
|
|
30
|
+
type: AutomationIOType.OBJECT,
|
|
31
|
+
customType: AutomationCustomIOType.ROW,
|
|
29
32
|
title: "Table",
|
|
30
33
|
},
|
|
31
34
|
rowId: {
|
|
32
|
-
type:
|
|
35
|
+
type: AutomationIOType.STRING,
|
|
33
36
|
title: "Row ID",
|
|
34
37
|
},
|
|
35
38
|
},
|
|
@@ -38,24 +41,24 @@ export const definition: AutomationStepSchema = {
|
|
|
38
41
|
outputs: {
|
|
39
42
|
properties: {
|
|
40
43
|
row: {
|
|
41
|
-
type:
|
|
42
|
-
customType:
|
|
44
|
+
type: AutomationIOType.OBJECT,
|
|
45
|
+
customType: AutomationCustomIOType.ROW,
|
|
43
46
|
description: "The updated row",
|
|
44
47
|
},
|
|
45
48
|
response: {
|
|
46
|
-
type:
|
|
49
|
+
type: AutomationIOType.OBJECT,
|
|
47
50
|
description: "The response from the table",
|
|
48
51
|
},
|
|
49
52
|
success: {
|
|
50
|
-
type:
|
|
53
|
+
type: AutomationIOType.BOOLEAN,
|
|
51
54
|
description: "Whether the action was successful",
|
|
52
55
|
},
|
|
53
56
|
id: {
|
|
54
|
-
type:
|
|
57
|
+
type: AutomationIOType.STRING,
|
|
55
58
|
description: "The identifier of the updated row",
|
|
56
59
|
},
|
|
57
60
|
revision: {
|
|
58
|
-
type:
|
|
61
|
+
type: AutomationIOType.STRING,
|
|
59
62
|
description: "The revision of the updated row",
|
|
60
63
|
},
|
|
61
64
|
},
|
|
@@ -4,12 +4,14 @@ import {
|
|
|
4
4
|
AutomationActionStepId,
|
|
5
5
|
AutomationStepSchema,
|
|
6
6
|
AutomationStepInput,
|
|
7
|
+
AutomationStepType,
|
|
8
|
+
AutomationIOType,
|
|
7
9
|
} from "@budibase/types"
|
|
8
10
|
|
|
9
11
|
export const definition: AutomationStepSchema = {
|
|
10
12
|
name: "Zapier Webhook",
|
|
11
13
|
stepId: AutomationActionStepId.zapier,
|
|
12
|
-
type:
|
|
14
|
+
type: AutomationStepType.ACTION,
|
|
13
15
|
internal: false,
|
|
14
16
|
description: "Trigger a Zapier Zap via webhooks",
|
|
15
17
|
tagline: "Trigger a Zapier Zap",
|
|
@@ -19,27 +21,27 @@ export const definition: AutomationStepSchema = {
|
|
|
19
21
|
inputs: {
|
|
20
22
|
properties: {
|
|
21
23
|
url: {
|
|
22
|
-
type:
|
|
24
|
+
type: AutomationIOType.STRING,
|
|
23
25
|
title: "Webhook URL",
|
|
24
26
|
},
|
|
25
27
|
value1: {
|
|
26
|
-
type:
|
|
28
|
+
type: AutomationIOType.STRING,
|
|
27
29
|
title: "Payload Value 1",
|
|
28
30
|
},
|
|
29
31
|
value2: {
|
|
30
|
-
type:
|
|
32
|
+
type: AutomationIOType.STRING,
|
|
31
33
|
title: "Payload Value 2",
|
|
32
34
|
},
|
|
33
35
|
value3: {
|
|
34
|
-
type:
|
|
36
|
+
type: AutomationIOType.STRING,
|
|
35
37
|
title: "Payload Value 3",
|
|
36
38
|
},
|
|
37
39
|
value4: {
|
|
38
|
-
type:
|
|
40
|
+
type: AutomationIOType.STRING,
|
|
39
41
|
title: "Payload Value 4",
|
|
40
42
|
},
|
|
41
43
|
value5: {
|
|
42
|
-
type:
|
|
44
|
+
type: AutomationIOType.STRING,
|
|
43
45
|
title: "Payload Value 5",
|
|
44
46
|
},
|
|
45
47
|
},
|
|
@@ -48,11 +50,11 @@ export const definition: AutomationStepSchema = {
|
|
|
48
50
|
outputs: {
|
|
49
51
|
properties: {
|
|
50
52
|
httpStatus: {
|
|
51
|
-
type:
|
|
53
|
+
type: AutomationIOType.NUMBER,
|
|
52
54
|
description: "The HTTP status code of the request",
|
|
53
55
|
},
|
|
54
56
|
response: {
|
|
55
|
-
type:
|
|
57
|
+
type: AutomationIOType.STRING,
|
|
56
58
|
description: "The response from Zapier",
|
|
57
59
|
},
|
|
58
60
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import TestConfig from "../../../tests/utilities/TestConfiguration"
|
|
2
2
|
import { context } from "@budibase/backend-core"
|
|
3
|
-
import {
|
|
3
|
+
import { BUILTIN_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 =
|
|
60
|
+
export const actions = BUILTIN_ACTION_DEFINITIONS
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AutomationCustomIOType,
|
|
3
|
+
AutomationIOType,
|
|
4
|
+
AutomationStepType,
|
|
2
5
|
AutomationTriggerSchema,
|
|
3
6
|
AutomationTriggerStepId,
|
|
4
7
|
} from "@budibase/types"
|
|
@@ -15,8 +18,8 @@ export const definition: AutomationTriggerSchema = {
|
|
|
15
18
|
inputs: {
|
|
16
19
|
properties: {
|
|
17
20
|
fields: {
|
|
18
|
-
type:
|
|
19
|
-
customType:
|
|
21
|
+
type: AutomationIOType.OBJECT,
|
|
22
|
+
customType: AutomationCustomIOType.TRIGGER_SCHEMA,
|
|
20
23
|
title: "Fields",
|
|
21
24
|
},
|
|
22
25
|
},
|
|
@@ -25,13 +28,13 @@ export const definition: AutomationTriggerSchema = {
|
|
|
25
28
|
outputs: {
|
|
26
29
|
properties: {
|
|
27
30
|
fields: {
|
|
28
|
-
type:
|
|
31
|
+
type: AutomationIOType.OBJECT,
|
|
29
32
|
description: "Fields submitted from the app frontend",
|
|
30
|
-
customType:
|
|
33
|
+
customType: AutomationCustomIOType.TRIGGER_SCHEMA,
|
|
31
34
|
},
|
|
32
35
|
},
|
|
33
36
|
required: ["fields"],
|
|
34
37
|
},
|
|
35
38
|
},
|
|
36
|
-
type:
|
|
39
|
+
type: AutomationStepType.TRIGGER,
|
|
37
40
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AutomationCustomIOType,
|
|
3
|
+
AutomationIOType,
|
|
4
|
+
AutomationStepType,
|
|
2
5
|
AutomationTriggerSchema,
|
|
3
6
|
AutomationTriggerStepId,
|
|
4
7
|
} from "@budibase/types"
|
|
@@ -15,8 +18,8 @@ export const definition: AutomationTriggerSchema = {
|
|
|
15
18
|
inputs: {
|
|
16
19
|
properties: {
|
|
17
20
|
cron: {
|
|
18
|
-
type:
|
|
19
|
-
customType:
|
|
21
|
+
type: AutomationIOType.STRING,
|
|
22
|
+
customType: AutomationCustomIOType.CRON,
|
|
20
23
|
title: "Expression",
|
|
21
24
|
},
|
|
22
25
|
},
|
|
@@ -25,12 +28,12 @@ export const definition: AutomationTriggerSchema = {
|
|
|
25
28
|
outputs: {
|
|
26
29
|
properties: {
|
|
27
30
|
timestamp: {
|
|
28
|
-
type:
|
|
31
|
+
type: AutomationIOType.NUMBER,
|
|
29
32
|
description: "Timestamp the cron was executed",
|
|
30
33
|
},
|
|
31
34
|
},
|
|
32
35
|
required: ["timestamp"],
|
|
33
36
|
},
|
|
34
37
|
},
|
|
35
|
-
type:
|
|
38
|
+
type: AutomationStepType.TRIGGER,
|
|
36
39
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AutomationCustomIOType,
|
|
3
|
+
AutomationIOType,
|
|
4
|
+
AutomationStepType,
|
|
2
5
|
AutomationTriggerSchema,
|
|
3
6
|
AutomationTriggerStepId,
|
|
4
7
|
} from "@budibase/types"
|
|
@@ -15,8 +18,8 @@ export const definition: AutomationTriggerSchema = {
|
|
|
15
18
|
inputs: {
|
|
16
19
|
properties: {
|
|
17
20
|
tableId: {
|
|
18
|
-
type:
|
|
19
|
-
customType:
|
|
21
|
+
type: AutomationIOType.STRING,
|
|
22
|
+
customType: AutomationCustomIOType.TABLE,
|
|
20
23
|
title: "Table",
|
|
21
24
|
},
|
|
22
25
|
},
|
|
@@ -25,13 +28,13 @@ export const definition: AutomationTriggerSchema = {
|
|
|
25
28
|
outputs: {
|
|
26
29
|
properties: {
|
|
27
30
|
row: {
|
|
28
|
-
type:
|
|
29
|
-
customType:
|
|
31
|
+
type: AutomationIOType.OBJECT,
|
|
32
|
+
customType: AutomationCustomIOType.ROW,
|
|
30
33
|
description: "The row that was deleted",
|
|
31
34
|
},
|
|
32
35
|
},
|
|
33
36
|
required: ["row"],
|
|
34
37
|
},
|
|
35
38
|
},
|
|
36
|
-
type:
|
|
39
|
+
type: AutomationStepType.TRIGGER,
|
|
37
40
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AutomationCustomIOType,
|
|
3
|
+
AutomationIOType,
|
|
4
|
+
AutomationStepType,
|
|
2
5
|
AutomationTriggerSchema,
|
|
3
6
|
AutomationTriggerStepId,
|
|
4
7
|
} from "@budibase/types"
|
|
@@ -15,8 +18,8 @@ export const definition: AutomationTriggerSchema = {
|
|
|
15
18
|
inputs: {
|
|
16
19
|
properties: {
|
|
17
20
|
tableId: {
|
|
18
|
-
type:
|
|
19
|
-
customType:
|
|
21
|
+
type: AutomationIOType.STRING,
|
|
22
|
+
customType: AutomationCustomIOType.TABLE,
|
|
20
23
|
title: "Table",
|
|
21
24
|
},
|
|
22
25
|
},
|
|
@@ -25,21 +28,21 @@ export const definition: AutomationTriggerSchema = {
|
|
|
25
28
|
outputs: {
|
|
26
29
|
properties: {
|
|
27
30
|
row: {
|
|
28
|
-
type:
|
|
29
|
-
customType:
|
|
31
|
+
type: AutomationIOType.OBJECT,
|
|
32
|
+
customType: AutomationCustomIOType.ROW,
|
|
30
33
|
description: "The new row that was created",
|
|
31
34
|
},
|
|
32
35
|
id: {
|
|
33
|
-
type:
|
|
36
|
+
type: AutomationIOType.STRING,
|
|
34
37
|
description: "Row ID - can be used for updating",
|
|
35
38
|
},
|
|
36
39
|
revision: {
|
|
37
|
-
type:
|
|
40
|
+
type: AutomationIOType.STRING,
|
|
38
41
|
description: "Revision of row",
|
|
39
42
|
},
|
|
40
43
|
},
|
|
41
44
|
required: ["row", "id"],
|
|
42
45
|
},
|
|
43
46
|
},
|
|
44
|
-
type:
|
|
47
|
+
type: AutomationStepType.TRIGGER,
|
|
45
48
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AutomationCustomIOType,
|
|
3
|
+
AutomationIOType,
|
|
4
|
+
AutomationStepType,
|
|
2
5
|
AutomationTriggerSchema,
|
|
3
6
|
AutomationTriggerStepId,
|
|
4
7
|
} from "@budibase/types"
|
|
@@ -15,8 +18,8 @@ export const definition: AutomationTriggerSchema = {
|
|
|
15
18
|
inputs: {
|
|
16
19
|
properties: {
|
|
17
20
|
tableId: {
|
|
18
|
-
type:
|
|
19
|
-
customType:
|
|
21
|
+
type: AutomationIOType.STRING,
|
|
22
|
+
customType: AutomationCustomIOType.TABLE,
|
|
20
23
|
title: "Table",
|
|
21
24
|
},
|
|
22
25
|
},
|
|
@@ -25,21 +28,21 @@ export const definition: AutomationTriggerSchema = {
|
|
|
25
28
|
outputs: {
|
|
26
29
|
properties: {
|
|
27
30
|
row: {
|
|
28
|
-
type:
|
|
29
|
-
customType:
|
|
31
|
+
type: AutomationIOType.OBJECT,
|
|
32
|
+
customType: AutomationCustomIOType.ROW,
|
|
30
33
|
description: "The row that was updated",
|
|
31
34
|
},
|
|
32
35
|
id: {
|
|
33
|
-
type:
|
|
36
|
+
type: AutomationIOType.STRING,
|
|
34
37
|
description: "Row ID - can be used for updating",
|
|
35
38
|
},
|
|
36
39
|
revision: {
|
|
37
|
-
type:
|
|
40
|
+
type: AutomationIOType.STRING,
|
|
38
41
|
description: "Revision of row",
|
|
39
42
|
},
|
|
40
43
|
},
|
|
41
44
|
required: ["row", "id"],
|
|
42
45
|
},
|
|
43
46
|
},
|
|
44
|
-
type:
|
|
47
|
+
type: AutomationStepType.TRIGGER,
|
|
45
48
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AutomationCustomIOType,
|
|
3
|
+
AutomationIOType,
|
|
4
|
+
AutomationStepType,
|
|
2
5
|
AutomationTriggerSchema,
|
|
3
6
|
AutomationTriggerStepId,
|
|
4
7
|
} from "@budibase/types"
|
|
@@ -15,13 +18,13 @@ export const definition: AutomationTriggerSchema = {
|
|
|
15
18
|
inputs: {
|
|
16
19
|
properties: {
|
|
17
20
|
schemaUrl: {
|
|
18
|
-
type:
|
|
19
|
-
customType:
|
|
21
|
+
type: AutomationIOType.STRING,
|
|
22
|
+
customType: AutomationCustomIOType.WEBHOOK_URL,
|
|
20
23
|
title: "Schema URL",
|
|
21
24
|
},
|
|
22
25
|
triggerUrl: {
|
|
23
|
-
type:
|
|
24
|
-
customType:
|
|
26
|
+
type: AutomationIOType.STRING,
|
|
27
|
+
customType: AutomationCustomIOType.WEBHOOK_URL,
|
|
25
28
|
title: "Trigger URL",
|
|
26
29
|
},
|
|
27
30
|
},
|
|
@@ -30,12 +33,12 @@ export const definition: AutomationTriggerSchema = {
|
|
|
30
33
|
outputs: {
|
|
31
34
|
properties: {
|
|
32
35
|
body: {
|
|
33
|
-
type:
|
|
36
|
+
type: AutomationIOType.OBJECT,
|
|
34
37
|
description: "Body of the request which hit the webhook",
|
|
35
38
|
},
|
|
36
39
|
},
|
|
37
40
|
required: ["body"],
|
|
38
41
|
},
|
|
39
42
|
},
|
|
40
|
-
type:
|
|
43
|
+
type: AutomationStepType.TRIGGER,
|
|
41
44
|
}
|
package/src/db/utils.ts
CHANGED
|
@@ -27,6 +27,7 @@ export const isProdAppID = dbCore.isProdAppID
|
|
|
27
27
|
export const USER_METDATA_PREFIX = `${DocumentType.ROW}${SEPARATOR}${dbCore.InternalTable.USER_METADATA}${SEPARATOR}`
|
|
28
28
|
export const LINK_USER_METADATA_PREFIX = `${DocumentType.LINK}${SEPARATOR}${dbCore.InternalTable.USER_METADATA}${SEPARATOR}`
|
|
29
29
|
export const TABLE_ROW_PREFIX = `${DocumentType.ROW}${SEPARATOR}${DocumentType.TABLE}`
|
|
30
|
+
export const AUTOMATION_LOG_PREFIX = `${DocumentType.AUTOMATION_LOG}${SEPARATOR}`
|
|
30
31
|
export const ViewName = dbCore.ViewName
|
|
31
32
|
export const InternalTables = dbCore.InternalTable
|
|
32
33
|
export const UNICODE_MAX = dbCore.UNICODE_MAX
|
package/src/environment.ts
CHANGED
|
@@ -62,7 +62,6 @@ 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,
|
|
66
65
|
ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL,
|
|
67
66
|
AUTOMATION_MAX_ITERATIONS:
|
|
68
67
|
parseIntSafe(process.env.AUTOMATION_MAX_ITERATIONS) || 200,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./processors"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import userGroupProcessor from "./syncUsers"
|
|
2
|
+
import { docUpdates } from "@budibase/backend-core"
|
|
3
|
+
|
|
4
|
+
export type UpdateCallback = (docId: string) => void
|
|
5
|
+
let started = false
|
|
6
|
+
|
|
7
|
+
export function init(updateCb?: UpdateCallback) {
|
|
8
|
+
if (started) {
|
|
9
|
+
return
|
|
10
|
+
}
|
|
11
|
+
const processors = [userGroupProcessor(updateCb)]
|
|
12
|
+
docUpdates.init(processors)
|
|
13
|
+
started = true
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { constants, logging } from "@budibase/backend-core"
|
|
2
|
+
import { sdk as proSdk } from "@budibase/pro"
|
|
3
|
+
import { DocUpdateEvent, UserGroupSyncEvents } from "@budibase/types"
|
|
4
|
+
import { syncUsersToAllApps } from "../../sdk/app/applications/sync"
|
|
5
|
+
import { UpdateCallback } from "./processors"
|
|
6
|
+
|
|
7
|
+
export default function process(updateCb?: UpdateCallback) {
|
|
8
|
+
const processor = async (update: DocUpdateEvent) => {
|
|
9
|
+
try {
|
|
10
|
+
const docId = update.id
|
|
11
|
+
const isGroup = docId.startsWith(constants.DocumentType.GROUP)
|
|
12
|
+
let userIds: string[]
|
|
13
|
+
if (isGroup) {
|
|
14
|
+
const group = await proSdk.groups.get(docId)
|
|
15
|
+
userIds = group.users?.map(user => user._id) || []
|
|
16
|
+
} else {
|
|
17
|
+
userIds = [docId]
|
|
18
|
+
}
|
|
19
|
+
if (userIds.length > 0) {
|
|
20
|
+
await syncUsersToAllApps(userIds)
|
|
21
|
+
}
|
|
22
|
+
if (updateCb) {
|
|
23
|
+
updateCb(docId)
|
|
24
|
+
}
|
|
25
|
+
} catch (err: any) {
|
|
26
|
+
// if something not found - no changes to perform
|
|
27
|
+
if (err?.status === 404) {
|
|
28
|
+
return
|
|
29
|
+
} else {
|
|
30
|
+
logging.logAlert("Failed to perform user/group app sync", err)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { events: UserGroupSyncEvents, processor }
|
|
35
|
+
}
|
package/src/events/index.ts
CHANGED
|
@@ -349,7 +349,7 @@ describe("row api - postgres", () => {
|
|
|
349
349
|
},
|
|
350
350
|
plus: true,
|
|
351
351
|
source: "POSTGRES",
|
|
352
|
-
type: "
|
|
352
|
+
type: "datasource_plus",
|
|
353
353
|
_id: expect.any(String),
|
|
354
354
|
_rev: expect.any(String),
|
|
355
355
|
createdAt: expect.any(String),
|
|
@@ -921,6 +921,7 @@ describe("row api - postgres", () => {
|
|
|
921
921
|
[m2mFieldName]: [
|
|
922
922
|
{
|
|
923
923
|
_id: row._id,
|
|
924
|
+
primaryDisplay: "Invalid display column",
|
|
924
925
|
},
|
|
925
926
|
],
|
|
926
927
|
})
|
|
@@ -929,6 +930,7 @@ describe("row api - postgres", () => {
|
|
|
929
930
|
[m2mFieldName]: [
|
|
930
931
|
{
|
|
931
932
|
_id: row._id,
|
|
933
|
+
primaryDisplay: "Invalid display column",
|
|
932
934
|
},
|
|
933
935
|
],
|
|
934
936
|
})
|
|
@@ -79,10 +79,17 @@ function generateSchema(
|
|
|
79
79
|
if (!relatedTable) {
|
|
80
80
|
throw "Referenced table doesn't exist"
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
const relatedPrimary = relatedTable.primary[0]
|
|
83
|
+
const externalType = relatedTable.schema[relatedPrimary].externalType
|
|
84
|
+
if (externalType) {
|
|
85
|
+
schema.specificType(column.foreignKey, externalType)
|
|
86
|
+
} else {
|
|
87
|
+
schema.integer(column.foreignKey).unsigned()
|
|
88
|
+
}
|
|
89
|
+
|
|
83
90
|
schema
|
|
84
91
|
.foreign(column.foreignKey)
|
|
85
|
-
.references(`${tableName}.${
|
|
92
|
+
.references(`${tableName}.${relatedPrimary}`)
|
|
86
93
|
}
|
|
87
94
|
break
|
|
88
95
|
}
|