@budibase/server 0.9.185-alpha.2 → 0.9.185-alpha.20
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/Dockerfile +7 -1
- package/__mocks__/oracledb.ts +31 -0
- package/builder/assets/bb-space-man.5be51a45.svg +290 -0
- package/builder/assets/index.7d405e74.css +1 -0
- package/builder/assets/index.83e08172.js +1316 -0
- package/builder/assets/oracle.66592424.png +0 -0
- package/builder/assets/vendor.470042a4.js +152 -0
- package/builder/assets/vendor.5e1fe644.css +1 -0
- package/builder/index.html +4 -4
- package/coverage/clover.xml +785 -687
- package/coverage/coverage-final.json +90 -88
- package/coverage/lcov-report/api/controllers/analytics.js.html +2 -2
- package/coverage/lcov-report/api/controllers/apikeys.js.html +2 -2
- package/coverage/lcov-report/api/controllers/application.js.html +43 -13
- package/coverage/lcov-report/api/controllers/auth.js.html +7 -7
- package/coverage/lcov-report/api/controllers/automation.js.html +3 -3
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +4 -4
- package/coverage/lcov-report/api/controllers/datasource.js.html +129 -21
- package/coverage/lcov-report/api/controllers/dev.js.html +16 -7
- package/coverage/lcov-report/api/controllers/hosting.js.html +10 -10
- package/coverage/lcov-report/api/controllers/index.html +77 -77
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +3 -3
- package/coverage/lcov-report/api/controllers/metadata.js.html +3 -3
- package/coverage/lcov-report/api/controllers/permission.js.html +3 -3
- package/coverage/lcov-report/api/controllers/query.js.html +48 -210
- package/coverage/lcov-report/api/controllers/role.js.html +9 -9
- package/coverage/lcov-report/api/controllers/routing.js.html +3 -3
- package/coverage/lcov-report/api/controllers/row/external.js.html +2 -2
- package/coverage/lcov-report/api/controllers/row/index.html +10 -10
- package/coverage/lcov-report/api/controllers/row/index.js.html +2 -2
- package/coverage/lcov-report/api/controllers/row/internal.js.html +9 -9
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +2 -2
- package/coverage/lcov-report/api/controllers/row/utils.js.html +2 -2
- package/coverage/lcov-report/api/controllers/screen.js.html +2 -2
- package/coverage/lcov-report/api/controllers/script.js.html +3 -3
- package/coverage/lcov-report/api/controllers/table/external.js.html +29 -8
- package/coverage/lcov-report/api/controllers/table/index.html +20 -20
- package/coverage/lcov-report/api/controllers/table/index.js.html +3 -3
- package/coverage/lcov-report/api/controllers/table/internal.js.html +2 -2
- package/coverage/lcov-report/api/controllers/table/utils.js.html +8 -8
- package/coverage/lcov-report/api/controllers/templates.js.html +4 -4
- package/coverage/lcov-report/api/controllers/user.js.html +2 -2
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +9 -9
- package/coverage/lcov-report/api/controllers/view/index.js.html +5 -5
- package/coverage/lcov-report/api/controllers/view/utils.js.html +11 -11
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +3 -3
- package/coverage/lcov-report/api/controllers/webhook.js.html +4 -4
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/application.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +2 -2
- package/coverage/lcov-report/api/routes/hosting.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +4 -4
- package/coverage/lcov-report/api/routes/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +5 -2
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/row.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +2 -2
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +2 -2
- package/coverage/lcov-report/automations/automationUtils.js.html +3 -3
- package/coverage/lcov-report/automations/bullboard.js.html +71 -20
- package/coverage/lcov-report/automations/index.html +33 -48
- package/coverage/lcov-report/automations/index.js.html +2 -2
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/createRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +3 -3
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +3 -3
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +14 -14
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +3 -3
- package/coverage/lcov-report/automations/steps/queryRows.js.html +3 -3
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +7 -7
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +8 -8
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +2 -2
- package/coverage/lcov-report/automations/triggers.js.html +22 -10
- package/coverage/lcov-report/automations/utils.js.html +42 -12
- package/coverage/lcov-report/constants/index.html +5 -5
- package/coverage/lcov-report/constants/index.js.html +44 -23
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/client.js.html +2 -2
- package/coverage/lcov-report/db/inMemoryView.js.html +2 -2
- package/coverage/lcov-report/db/index.html +2 -2
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +6 -6
- package/coverage/lcov-report/db/linkedRows/index.html +10 -10
- package/coverage/lcov-report/db/linkedRows/index.js.html +5 -5
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +6 -6
- package/coverage/lcov-report/db/newid.js.html +3 -3
- package/coverage/lcov-report/db/utils.js.html +57 -57
- package/coverage/lcov-report/events/AutomationEmitter.js.html +6 -6
- package/coverage/lcov-report/events/index.html +6 -6
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +5 -5
- package/coverage/lcov-report/index.html +86 -71
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +2 -2
- package/coverage/lcov-report/middleware/authorized.js.html +4 -4
- package/coverage/lcov-report/middleware/builder.js.html +16 -7
- package/coverage/lcov-report/middleware/currentapp.js.html +6 -6
- package/coverage/lcov-report/middleware/index.html +21 -21
- package/coverage/lcov-report/middleware/joi-validator.js.html +2 -2
- package/coverage/lcov-report/middleware/resourceId.js.html +18 -18
- package/coverage/lcov-report/middleware/selfhost.js.html +2 -2
- package/coverage/lcov-report/middleware/usageQuota.js.html +4 -4
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/{automations/thread.js.html → threads/automation.js.html} +90 -33
- package/coverage/lcov-report/threads/index.html +141 -0
- package/coverage/lcov-report/threads/index.js.html +278 -0
- package/coverage/lcov-report/threads/query.js.html +278 -0
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +2 -2
- package/coverage/lcov-report/utilities/global.js.html +2 -2
- package/coverage/lcov-report/utilities/index.html +21 -21
- package/coverage/lcov-report/utilities/index.js.html +12 -9
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +30 -9
- package/coverage/lcov-report/utilities/queue/index.html +14 -14
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +4 -4
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +2 -2
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +3 -3
- package/coverage/lcov-report/utilities/scriptRunner.js.html +16 -7
- package/coverage/lcov-report/utilities/security.js.html +3 -3
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +5 -5
- package/coverage/lcov.info +1247 -1070
- package/dist/api/controllers/application.js +11 -1
- package/dist/api/controllers/datasource.js +31 -7
- package/dist/api/controllers/deploy/index.js +2 -0
- package/dist/api/controllers/dev.js +4 -1
- package/dist/api/controllers/query.js +27 -57
- package/dist/api/controllers/table/external.js +8 -1
- package/dist/api/routes/query.js +1 -1
- package/dist/app.js +2 -11
- package/dist/automations/bullboard.js +37 -10
- package/dist/automations/triggers.js +7 -3
- package/dist/automations/utils.js +11 -2
- package/dist/constants/index.js +6 -0
- package/dist/definitions/datasource.js +1 -0
- package/dist/environment.js +13 -0
- package/dist/integrations/base/IntegrationBase.js +2 -0
- package/dist/integrations/base/sql.js +40 -8
- package/dist/integrations/index.js +6 -0
- package/dist/integrations/mysql.js +3 -1
- package/dist/integrations/oracle.js +345 -0
- package/dist/integrations/utils.js +17 -2
- package/dist/middleware/builder.js +4 -1
- package/dist/package.json +11 -6
- package/dist/{automations/thread.js → threads/automation.js} +26 -8
- package/dist/threads/index.js +64 -0
- package/dist/threads/query.js +64 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/queue/inMemoryQueue.js +8 -0
- package/dist/utilities/scriptRunner.js +4 -1
- package/package.json +12 -7
- package/scripts/dev/manage.js +1 -0
- package/scripts/integrations/oracle/docker-compose.yml +19 -0
- package/scripts/integrations/oracle/instantclient/linux/x86-64/basiclite-21.4.zip +0 -0
- package/scripts/integrations/oracle/instantclient/linux/x86-64/install.sh +23 -0
- package/scripts/integrations/oracle/oracle.md +90 -0
- package/scripts/integrations/postgres/docker-compose.yml +3 -3
- package/scripts/likeCypress.ts +33 -0
- package/src/api/controllers/application.js +11 -1
- package/src/api/controllers/datasource.js +45 -9
- package/src/api/controllers/deploy/index.js +2 -0
- package/src/api/controllers/dev.js +4 -1
- package/src/api/controllers/query.js +26 -80
- package/src/api/controllers/table/external.js +8 -1
- package/src/api/routes/query.js +1 -0
- package/src/app.ts +2 -10
- package/src/automations/bullboard.js +28 -11
- package/src/automations/tests/automation.spec.js +3 -4
- package/src/automations/triggers.js +7 -3
- package/src/automations/utils.js +12 -2
- package/src/constants/index.js +7 -0
- package/src/definitions/datasource.ts +1 -0
- package/src/environment.js +15 -0
- package/src/integrations/airtable.ts +2 -1
- package/src/integrations/arangodb.ts +2 -1
- package/src/integrations/base/IntegrationBase.ts +6 -0
- package/src/integrations/base/datasourcePlus.ts +2 -1
- package/src/integrations/base/sql.ts +41 -9
- package/src/integrations/couchdb.ts +2 -1
- package/src/integrations/dynamodb.ts +2 -1
- package/src/integrations/elasticsearch.ts +2 -1
- package/src/integrations/index.ts +7 -0
- package/src/integrations/mongodb.ts +2 -1
- package/src/integrations/mysql.ts +1 -1
- package/src/integrations/oracle.ts +445 -0
- package/src/integrations/rest.ts +2 -1
- package/src/integrations/s3.ts +2 -1
- package/src/integrations/tests/oracle.spec.js +94 -0
- package/src/integrations/utils.ts +16 -2
- package/src/middleware/builder.js +4 -1
- package/src/{automations/thread.js → threads/automation.js} +27 -8
- package/src/threads/index.js +66 -0
- package/src/threads/query.js +66 -0
- package/src/utilities/index.js +1 -0
- package/src/utilities/queue/inMemoryQueue.js +7 -0
- package/src/utilities/scriptRunner.js +4 -1
- package/tsconfig.json +1 -1
- package/builder/assets/index.0eadd2f5.js +0 -201
- package/builder/assets/index.a79ec0ef.css +0 -29
- package/builder/assets/vendor.278a305c.js +0 -9
- package/builder/assets/vendor.d75d5eb7.css +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { createBullBoard } = require("bull-board")
|
|
2
|
-
const { BullAdapter } = require("bull-board/bullAdapter")
|
|
3
|
-
const
|
|
1
|
+
const { createBullBoard } = require("@bull-board/api")
|
|
2
|
+
const { BullAdapter } = require("@bull-board/api/bullAdapter")
|
|
3
|
+
const { KoaAdapter } = require("@bull-board/koa")
|
|
4
4
|
const env = require("../environment")
|
|
5
5
|
const Queue = env.isTest()
|
|
6
6
|
? require("../utilities/queue/inMemoryQueue")
|
|
@@ -9,23 +9,40 @@ const { JobQueues } = require("../constants")
|
|
|
9
9
|
const { utils } = require("@budibase/auth/redis")
|
|
10
10
|
const { opts, redisProtocolUrl } = utils.getRedisOptions()
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const CLEANUP_PERIOD_MS = 60 * 1000
|
|
13
|
+
const queueConfig = redisProtocolUrl || { redis: opts }
|
|
14
|
+
let cleanupInternal = null
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
let automationQueue = new Queue(JobQueues.AUTOMATIONS, queueConfig)
|
|
17
|
+
|
|
18
|
+
async function cleanup() {
|
|
19
|
+
await automationQueue.clean(CLEANUP_PERIOD_MS, "completed")
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const PATH_PREFIX = "/bulladmin"
|
|
16
23
|
|
|
17
24
|
exports.init = () => {
|
|
18
|
-
|
|
25
|
+
// cleanup the events every 5 minutes
|
|
26
|
+
if (!cleanupInternal) {
|
|
27
|
+
cleanupInternal = setInterval(cleanup, CLEANUP_PERIOD_MS)
|
|
28
|
+
// fire off an initial cleanup
|
|
29
|
+
cleanup().catch(err => {
|
|
30
|
+
console.error(`Unable to cleanup automation queue initially - ${err}`)
|
|
31
|
+
})
|
|
32
|
+
}
|
|
19
33
|
// Set up queues for bull board admin
|
|
20
34
|
const queues = [automationQueue]
|
|
21
35
|
const adapters = []
|
|
36
|
+
const serverAdapter = new KoaAdapter()
|
|
22
37
|
for (let queue of queues) {
|
|
23
38
|
adapters.push(new BullAdapter(queue))
|
|
24
39
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
createBullBoard({
|
|
41
|
+
queues: adapters,
|
|
42
|
+
serverAdapter,
|
|
43
|
+
})
|
|
44
|
+
serverAdapter.setBasePath(PATH_PREFIX)
|
|
45
|
+
return serverAdapter.registerPlugin()
|
|
29
46
|
}
|
|
30
47
|
|
|
31
48
|
exports.queue = automationQueue
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
jest.mock("../../utilities/usageQuota")
|
|
2
|
-
jest.mock("
|
|
2
|
+
jest.mock("../../threads/automation")
|
|
3
3
|
jest.mock("../../utilities/redis", () => ({
|
|
4
4
|
init: jest.fn(),
|
|
5
5
|
checkTestFlag: () => {
|
|
@@ -11,8 +11,7 @@ jest.spyOn(global.console, "error")
|
|
|
11
11
|
|
|
12
12
|
require("../../environment")
|
|
13
13
|
const automation = require("../index")
|
|
14
|
-
const
|
|
15
|
-
const thread = require("../thread")
|
|
14
|
+
const thread = require("../../threads/automation")
|
|
16
15
|
const triggers = require("../triggers")
|
|
17
16
|
const { basicAutomation } = require("../../tests/utilities/structures")
|
|
18
17
|
const { wait } = require("../../utilities")
|
|
@@ -62,7 +61,7 @@ describe("Run through some parts of the automations system", () => {
|
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
|
-
}))
|
|
64
|
+
}), expect.any(Function))
|
|
66
65
|
})
|
|
67
66
|
|
|
68
67
|
it("should be able to clean inputs with the utilities", () => {
|
|
@@ -11,6 +11,10 @@ const utils = require("./utils")
|
|
|
11
11
|
const env = require("../environment")
|
|
12
12
|
|
|
13
13
|
const TRIGGER_DEFINITIONS = definitions
|
|
14
|
+
const JOB_OPTS = {
|
|
15
|
+
removeOnComplete: true,
|
|
16
|
+
removeOnFail: true,
|
|
17
|
+
}
|
|
14
18
|
|
|
15
19
|
async function queueRelevantRowAutomations(event, eventType) {
|
|
16
20
|
if (event.appId == null) {
|
|
@@ -47,7 +51,7 @@ async function queueRelevantRowAutomations(event, eventType) {
|
|
|
47
51
|
automationTrigger.inputs &&
|
|
48
52
|
automationTrigger.inputs.tableId === event.row.tableId
|
|
49
53
|
) {
|
|
50
|
-
await queue.add({ automation, event })
|
|
54
|
+
await queue.add({ automation, event }, JOB_OPTS)
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
}
|
|
@@ -86,7 +90,7 @@ exports.externalTrigger = async function (
|
|
|
86
90
|
automation.definition.trigger != null &&
|
|
87
91
|
automation.definition.trigger.stepId === definitions.APP.stepId &&
|
|
88
92
|
automation.definition.trigger.stepId === "APP" &&
|
|
89
|
-
!checkTestFlag(automation._id)
|
|
93
|
+
!(await checkTestFlag(automation._id))
|
|
90
94
|
) {
|
|
91
95
|
// values are likely to be submitted as strings, so we shall convert to correct type
|
|
92
96
|
const coercedFields = {}
|
|
@@ -100,7 +104,7 @@ exports.externalTrigger = async function (
|
|
|
100
104
|
if (getResponses) {
|
|
101
105
|
return utils.processEvent({ data })
|
|
102
106
|
} else {
|
|
103
|
-
return queue.add(data)
|
|
107
|
+
return queue.add(data, JOB_OPTS)
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
110
|
|
package/src/automations/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { Thread, ThreadType } = require("../threads")
|
|
2
2
|
const { definitions } = require("./triggerInfo")
|
|
3
3
|
const webhooks = require("../api/controllers/webhook")
|
|
4
4
|
const CouchDB = require("../db")
|
|
@@ -10,11 +10,12 @@ const { getDeployedAppID } = require("@budibase/auth/db")
|
|
|
10
10
|
|
|
11
11
|
const WH_STEP_ID = definitions.WEBHOOK.stepId
|
|
12
12
|
const CRON_STEP_ID = definitions.CRON.stepId
|
|
13
|
+
const Runner = new Thread(ThreadType.AUTOMATION)
|
|
13
14
|
|
|
14
15
|
exports.processEvent = async job => {
|
|
15
16
|
try {
|
|
16
17
|
// need to actually await these so that an error can be captured properly
|
|
17
|
-
return await
|
|
18
|
+
return await Runner.run(job)
|
|
18
19
|
} catch (err) {
|
|
19
20
|
console.error(
|
|
20
21
|
`${job.data.automation.appId} automation ${job.data.automation._id} was unable to run - ${err}`
|
|
@@ -162,3 +163,12 @@ exports.checkForWebhooks = async ({ appId, oldAuto, newAuto }) => {
|
|
|
162
163
|
}
|
|
163
164
|
return newAuto
|
|
164
165
|
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* When removing an app/unpublishing it need to make sure automations are cleaned up (cron).
|
|
169
|
+
* @param appId {string} the app that is being removed.
|
|
170
|
+
* @return {Promise<void>} clean is complete if this succeeds.
|
|
171
|
+
*/
|
|
172
|
+
exports.cleanupAutomations = async appId => {
|
|
173
|
+
await exports.disableAllCrons(appId)
|
|
174
|
+
}
|
package/src/constants/index.js
CHANGED
|
@@ -163,8 +163,15 @@ exports.MetadataTypes = {
|
|
|
163
163
|
AUTOMATION_TEST_HISTORY: "automationTestHistory",
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
exports.InvalidColumns = {
|
|
167
|
+
ID: "_id",
|
|
168
|
+
REV: "_rev",
|
|
169
|
+
TABLE_ID: "tableId",
|
|
170
|
+
}
|
|
171
|
+
|
|
166
172
|
exports.BuildSchemaErrors = {
|
|
167
173
|
NO_KEY: "no_key",
|
|
174
|
+
INVALID_COLUMN: "invalid_column",
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
// pass through the list from the auth/core lib
|
package/src/environment.js
CHANGED
|
@@ -23,6 +23,8 @@ if (!LOADED && isDev() && !isTest()) {
|
|
|
23
23
|
LOADED = true
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
let inThread = false
|
|
27
|
+
|
|
26
28
|
module.exports = {
|
|
27
29
|
// important
|
|
28
30
|
PORT: process.env.PORT,
|
|
@@ -62,6 +64,7 @@ module.exports = {
|
|
|
62
64
|
USERID_API_KEY: process.env.USERID_API_KEY,
|
|
63
65
|
DEPLOYMENT_CREDENTIALS_URL: process.env.DEPLOYMENT_CREDENTIALS_URL,
|
|
64
66
|
ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
|
|
67
|
+
DISABLE_THREADING: process.env.DISABLE_THREADING,
|
|
65
68
|
_set(key, value) {
|
|
66
69
|
process.env[key] = value
|
|
67
70
|
module.exports[key] = value
|
|
@@ -72,6 +75,18 @@ module.exports = {
|
|
|
72
75
|
isProd: () => {
|
|
73
76
|
return !isDev()
|
|
74
77
|
},
|
|
78
|
+
// used to check if already in a thread, don't thread further
|
|
79
|
+
setInThread: () => {
|
|
80
|
+
inThread = true
|
|
81
|
+
},
|
|
82
|
+
isInThread: () => {
|
|
83
|
+
return inThread
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// threading can cause memory issues with node-ts in development
|
|
88
|
+
if (isDev() && module.exports.DISABLE_THREADING == null) {
|
|
89
|
+
module.exports._set("DISABLE_THREADING", "1")
|
|
75
90
|
}
|
|
76
91
|
|
|
77
92
|
// clean up any environment variable edge cases
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DatasourceFieldTypes,
|
|
4
4
|
QueryTypes,
|
|
5
5
|
} from "../definitions/datasource"
|
|
6
|
+
import { IntegrationBase } from "./base/IntegrationBase"
|
|
6
7
|
|
|
7
8
|
module AirtableModule {
|
|
8
9
|
const Airtable = require("airtable")
|
|
@@ -73,7 +74,7 @@ module AirtableModule {
|
|
|
73
74
|
},
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
class AirtableIntegration {
|
|
77
|
+
class AirtableIntegration implements IntegrationBase {
|
|
77
78
|
private config: AirtableConfig
|
|
78
79
|
private client: any
|
|
79
80
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DatasourceFieldTypes,
|
|
4
4
|
QueryTypes,
|
|
5
5
|
} from "../definitions/datasource"
|
|
6
|
+
import { IntegrationBase } from "./base/IntegrationBase"
|
|
6
7
|
|
|
7
8
|
module ArangoModule {
|
|
8
9
|
const { Database, aql } = require("arangojs")
|
|
@@ -55,7 +56,7 @@ module ArangoModule {
|
|
|
55
56
|
},
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
class ArangoDBIntegration {
|
|
59
|
+
class ArangoDBIntegration implements IntegrationBase {
|
|
59
60
|
private config: ArangodbConfig
|
|
60
61
|
private client: any
|
|
61
62
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Table } from "../../definitions/common"
|
|
2
|
+
import { IntegrationBase } from "./IntegrationBase"
|
|
2
3
|
|
|
3
|
-
export interface DatasourcePlus {
|
|
4
|
+
export interface DatasourcePlus extends IntegrationBase {
|
|
4
5
|
tables: Record<string, Table>
|
|
5
6
|
schemaErrors: Record<string, string>
|
|
6
7
|
|
|
@@ -13,22 +13,50 @@ import SqlTableQueryBuilder from "./sqlTable"
|
|
|
13
13
|
const BASE_LIMIT = 5000
|
|
14
14
|
|
|
15
15
|
type KnexQuery = Knex.QueryBuilder | Knex
|
|
16
|
+
// these are invalid dates sent by the client, need to convert them to a real max date
|
|
17
|
+
const MIN_ISO_DATE = "0000-00-00T00:00:00.000Z"
|
|
18
|
+
const MAX_ISO_DATE = "9999-00-00T00:00:00.000Z"
|
|
19
|
+
|
|
20
|
+
function parse(input: any) {
|
|
21
|
+
if (Array.isArray(input)) {
|
|
22
|
+
return JSON.stringify(input)
|
|
23
|
+
}
|
|
24
|
+
if (typeof input !== "string") {
|
|
25
|
+
return input
|
|
26
|
+
}
|
|
27
|
+
if (input === MAX_ISO_DATE) {
|
|
28
|
+
return new Date(8640000000000000)
|
|
29
|
+
}
|
|
30
|
+
if (input === MIN_ISO_DATE) {
|
|
31
|
+
return new Date(-8640000000000000)
|
|
32
|
+
}
|
|
33
|
+
if (isIsoDateString(input)) {
|
|
34
|
+
return new Date(input)
|
|
35
|
+
}
|
|
36
|
+
return input
|
|
37
|
+
}
|
|
16
38
|
|
|
17
39
|
function parseBody(body: any) {
|
|
18
40
|
for (let [key, value] of Object.entries(body)) {
|
|
19
|
-
|
|
20
|
-
body[key] = JSON.stringify(value)
|
|
21
|
-
}
|
|
22
|
-
if (typeof value !== "string") {
|
|
23
|
-
continue
|
|
24
|
-
}
|
|
25
|
-
if (isIsoDateString(value)) {
|
|
26
|
-
body[key] = new Date(value)
|
|
27
|
-
}
|
|
41
|
+
body[key] = parse(value)
|
|
28
42
|
}
|
|
29
43
|
return body
|
|
30
44
|
}
|
|
31
45
|
|
|
46
|
+
function parseFilters(filters: SearchFilters): SearchFilters {
|
|
47
|
+
for (let [key, value] of Object.entries(filters)) {
|
|
48
|
+
let parsed
|
|
49
|
+
if (typeof value === "object") {
|
|
50
|
+
parsed = parseFilters(value)
|
|
51
|
+
} else {
|
|
52
|
+
parsed = parse(value)
|
|
53
|
+
}
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
filters[key] = parsed
|
|
56
|
+
}
|
|
57
|
+
return filters
|
|
58
|
+
}
|
|
59
|
+
|
|
32
60
|
class InternalBuilder {
|
|
33
61
|
private readonly client: string
|
|
34
62
|
|
|
@@ -53,6 +81,7 @@ class InternalBuilder {
|
|
|
53
81
|
if (!filters) {
|
|
54
82
|
return query
|
|
55
83
|
}
|
|
84
|
+
filters = parseFilters(filters)
|
|
56
85
|
// if all or specified in filters, then everything is an or
|
|
57
86
|
const allOr = filters.allOr
|
|
58
87
|
if (filters.oneOf) {
|
|
@@ -387,6 +416,8 @@ class SqlQueryBuilder extends SqlTableQueryBuilder {
|
|
|
387
416
|
id = results?.[0].id
|
|
388
417
|
} else if (sqlClient === SqlClients.MY_SQL) {
|
|
389
418
|
id = results?.insertId
|
|
419
|
+
} else if (sqlClient === SqlClients.ORACLE) {
|
|
420
|
+
id = response.outBinds[0][0]
|
|
390
421
|
}
|
|
391
422
|
row = processFn(
|
|
392
423
|
await this.getReturningRow(queryFn, this.checkLookupKeys(id, json))
|
|
@@ -399,4 +430,5 @@ class SqlQueryBuilder extends SqlTableQueryBuilder {
|
|
|
399
430
|
}
|
|
400
431
|
}
|
|
401
432
|
|
|
433
|
+
export default SqlQueryBuilder
|
|
402
434
|
module.exports = SqlQueryBuilder
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DatasourceFieldTypes,
|
|
4
4
|
QueryTypes,
|
|
5
5
|
} from "../definitions/datasource"
|
|
6
|
+
import { IntegrationBase } from "./base/IntegrationBase"
|
|
6
7
|
|
|
7
8
|
module CouchDBModule {
|
|
8
9
|
const PouchDB = require("pouchdb")
|
|
@@ -50,7 +51,7 @@ module CouchDBModule {
|
|
|
50
51
|
},
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
class CouchDBIntegration {
|
|
54
|
+
class CouchDBIntegration implements IntegrationBase {
|
|
54
55
|
private config: CouchDBConfig
|
|
55
56
|
private client: any
|
|
56
57
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DatasourceFieldTypes,
|
|
4
4
|
QueryTypes,
|
|
5
5
|
} from "../definitions/datasource"
|
|
6
|
+
import { IntegrationBase } from "./base/IntegrationBase"
|
|
6
7
|
|
|
7
8
|
module DynamoModule {
|
|
8
9
|
const AWS = require("aws-sdk")
|
|
@@ -113,7 +114,7 @@ module DynamoModule {
|
|
|
113
114
|
},
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
class DynamoDBIntegration {
|
|
117
|
+
class DynamoDBIntegration implements IntegrationBase {
|
|
117
118
|
private config: DynamoDBConfig
|
|
118
119
|
private client: any
|
|
119
120
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DatasourceFieldTypes,
|
|
4
4
|
QueryTypes,
|
|
5
5
|
} from "../definitions/datasource"
|
|
6
|
+
import { IntegrationBase } from "./base/IntegrationBase"
|
|
6
7
|
|
|
7
8
|
module ElasticsearchModule {
|
|
8
9
|
const { Client } = require("@elastic/elasticsearch")
|
|
@@ -74,7 +75,7 @@ module ElasticsearchModule {
|
|
|
74
75
|
},
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
class ElasticSearchIntegration {
|
|
78
|
+
class ElasticSearchIntegration implements IntegrationBase {
|
|
78
79
|
private config: ElasticsearchConfig
|
|
79
80
|
private client: any
|
|
80
81
|
|
|
@@ -39,6 +39,13 @@ const INTEGRATIONS = {
|
|
|
39
39
|
[SourceNames.REST]: rest.integration,
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
// optionally add oracle integration if the oracle binary can be installed
|
|
43
|
+
if (!(process.arch === 'arm64' && process.platform === 'darwin')) {
|
|
44
|
+
const oracle = require("./oracle")
|
|
45
|
+
DEFINITIONS[SourceNames.ORACLE] = oracle.schema
|
|
46
|
+
INTEGRATIONS[SourceNames.ORACLE] = oracle.integration
|
|
47
|
+
}
|
|
48
|
+
|
|
42
49
|
module.exports = {
|
|
43
50
|
definitions: DEFINITIONS,
|
|
44
51
|
integrations: INTEGRATIONS,
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DatasourceFieldTypes,
|
|
4
4
|
QueryTypes,
|
|
5
5
|
} from "../definitions/datasource"
|
|
6
|
+
import { IntegrationBase } from "./base/IntegrationBase"
|
|
6
7
|
|
|
7
8
|
module MongoDBModule {
|
|
8
9
|
const { MongoClient } = require("mongodb")
|
|
@@ -62,7 +63,7 @@ module MongoDBModule {
|
|
|
62
63
|
},
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
class MongoIntegration {
|
|
66
|
+
class MongoIntegration implements IntegrationBase {
|
|
66
67
|
private config: MongoDBConfig
|
|
67
68
|
private client: any
|
|
68
69
|
|