@budibase/server 2.6.16-alpha.5 → 2.6.17
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.07382a47.css → index.86c992bf.css} +2 -2
- package/builder/assets/{index.b9eeb2a8.js → index.a40dcadd.js} +315 -307
- package/builder/index.html +2 -2
- package/dist/api/controllers/datasource.js +39 -70
- package/dist/api/controllers/integration.js +2 -2
- package/dist/api/routes/datasource.js +0 -1
- package/dist/automations/steps/make.js +5 -19
- package/dist/automations/steps/zapier.js +6 -19
- package/dist/automations/triggers.js +2 -1
- package/dist/automations/utils.js +22 -17
- package/dist/db/dynamoClient.js +1 -1
- package/dist/integrations/airtable.js +2 -28
- package/dist/integrations/arangodb.js +3 -19
- package/dist/integrations/couchdb.js +1 -16
- package/dist/integrations/dynamodb.js +0 -16
- package/dist/integrations/elasticsearch.js +0 -15
- package/dist/integrations/firebase.js +0 -15
- package/dist/integrations/googlesheets.js +1 -30
- package/dist/integrations/index.js +2 -5
- package/dist/integrations/microsoftSqlServer.js +0 -16
- package/dist/integrations/mongodb.js +0 -16
- package/dist/integrations/mysql.js +5 -21
- package/dist/integrations/oracle.js +0 -29
- package/dist/integrations/postgres.js +7 -26
- package/dist/integrations/redis.js +1 -20
- package/dist/integrations/s3.js +4 -23
- package/dist/integrations/snowflake.js +0 -15
- package/dist/migrations/functions/backfill/app/queries.js +2 -1
- package/dist/sdk/app/datasources/datasources.js +3 -10
- package/dist/threads/automation.js +2 -1
- package/dist/threads/index.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/jest.config.ts +3 -3
- package/nodemon.json +3 -7
- package/package.json +9 -10
- package/src/api/controllers/datasource.ts +49 -88
- package/src/api/controllers/integration.ts +3 -3
- package/src/api/routes/datasource.ts +0 -5
- package/src/automations/steps/make.ts +1 -18
- package/src/automations/steps/zapier.ts +1 -18
- package/src/automations/tests/zapier.spec.js +27 -0
- package/src/automations/triggers.ts +5 -3
- package/src/automations/utils.ts +23 -16
- package/src/db/dynamoClient.ts +1 -1
- package/src/definitions/automations.ts +1 -5
- package/src/integration-test/postgres.spec.ts +1 -0
- package/src/integrations/airtable.ts +4 -31
- package/src/integrations/arangodb.ts +2 -18
- package/src/integrations/couchdb.ts +4 -18
- package/src/integrations/dynamodb.ts +5 -34
- package/src/integrations/elasticsearch.ts +1 -16
- package/src/integrations/firebase.ts +0 -15
- package/src/integrations/googlesheets.ts +2 -31
- package/src/integrations/index.ts +7 -12
- package/src/integrations/microsoftSqlServer.ts +0 -16
- package/src/integrations/mongodb.ts +0 -16
- package/src/integrations/mysql.ts +16 -27
- package/src/integrations/oracle.ts +6 -28
- package/src/integrations/postgres.ts +3 -21
- package/src/integrations/redis.ts +3 -26
- package/src/integrations/s3.ts +3 -19
- package/src/integrations/snowflake.ts +1 -20
- package/src/migrations/functions/backfill/app/queries.ts +1 -1
- package/src/sdk/app/datasources/datasources.ts +1 -7
- package/src/threads/automation.ts +11 -6
- package/src/threads/definitions.ts +0 -2
- package/src/threads/index.ts +4 -2
- package/tsconfig.json +1 -1
- package/src/automations/tests/make.spec.ts +0 -54
- package/src/automations/tests/zapier.spec.ts +0 -56
package/src/integrations/s3.ts
CHANGED
|
@@ -3,12 +3,10 @@ import {
|
|
|
3
3
|
QueryType,
|
|
4
4
|
IntegrationBase,
|
|
5
5
|
DatasourceFieldType,
|
|
6
|
-
DatasourceFeature,
|
|
7
|
-
ConnectionInfo,
|
|
8
6
|
} from "@budibase/types"
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const AWS = require("aws-sdk")
|
|
9
|
+
const csv = require("csvtojson")
|
|
12
10
|
|
|
13
11
|
interface S3Config {
|
|
14
12
|
region: string
|
|
@@ -24,7 +22,6 @@ const SCHEMA: Integration = {
|
|
|
24
22
|
"Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
|
|
25
23
|
friendlyName: "Amazon S3",
|
|
26
24
|
type: "Object store",
|
|
27
|
-
features: [DatasourceFeature.CONNECTION_CHECKING],
|
|
28
25
|
datasource: {
|
|
29
26
|
region: {
|
|
30
27
|
type: "string",
|
|
@@ -155,7 +152,7 @@ const SCHEMA: Integration = {
|
|
|
155
152
|
|
|
156
153
|
class S3Integration implements IntegrationBase {
|
|
157
154
|
private readonly config: S3Config
|
|
158
|
-
private client
|
|
155
|
+
private client: any
|
|
159
156
|
|
|
160
157
|
constructor(config: S3Config) {
|
|
161
158
|
this.config = config
|
|
@@ -168,19 +165,6 @@ class S3Integration implements IntegrationBase {
|
|
|
168
165
|
this.client = new AWS.S3(this.config)
|
|
169
166
|
}
|
|
170
167
|
|
|
171
|
-
async testConnection() {
|
|
172
|
-
const response: ConnectionInfo = {
|
|
173
|
-
connected: false,
|
|
174
|
-
}
|
|
175
|
-
try {
|
|
176
|
-
await this.client.listBuckets().promise()
|
|
177
|
-
response.connected = true
|
|
178
|
-
} catch (e: any) {
|
|
179
|
-
response.error = e.message as string
|
|
180
|
-
}
|
|
181
|
-
return response
|
|
182
|
-
}
|
|
183
|
-
|
|
184
168
|
async create(query: {
|
|
185
169
|
bucket: string
|
|
186
170
|
location: string
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConnectionInfo,
|
|
3
|
-
DatasourceFeature,
|
|
4
|
-
Integration,
|
|
5
|
-
QueryType,
|
|
6
|
-
SqlQuery,
|
|
7
|
-
} from "@budibase/types"
|
|
1
|
+
import { Integration, QueryType, SqlQuery } from "@budibase/types"
|
|
8
2
|
import { Snowflake } from "snowflake-promise"
|
|
9
3
|
|
|
10
4
|
interface SnowflakeConfig {
|
|
@@ -22,7 +16,6 @@ const SCHEMA: Integration = {
|
|
|
22
16
|
"Snowflake is a solution for data warehousing, data lakes, data engineering, data science, data application development, and securely sharing and consuming shared data.",
|
|
23
17
|
friendlyName: "Snowflake",
|
|
24
18
|
type: "Relational",
|
|
25
|
-
features: [DatasourceFeature.CONNECTION_CHECKING],
|
|
26
19
|
datasource: {
|
|
27
20
|
account: {
|
|
28
21
|
type: "string",
|
|
@@ -72,18 +65,6 @@ class SnowflakeIntegration {
|
|
|
72
65
|
this.client = new Snowflake(config)
|
|
73
66
|
}
|
|
74
67
|
|
|
75
|
-
async testConnection(): Promise<ConnectionInfo> {
|
|
76
|
-
try {
|
|
77
|
-
await this.client.connect()
|
|
78
|
-
return { connected: true }
|
|
79
|
-
} catch (e: any) {
|
|
80
|
-
return {
|
|
81
|
-
connected: false,
|
|
82
|
-
error: e.message as string,
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
68
|
async internalQuery(query: SqlQuery) {
|
|
88
69
|
await this.client.connect()
|
|
89
70
|
try {
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
import { cloneDeep } from "lodash/fp"
|
|
14
14
|
import { getEnvironmentVariables } from "../../utils"
|
|
15
15
|
import { getDefinitions, getDefinition } from "../../../integrations"
|
|
16
|
-
import _ from "lodash"
|
|
17
16
|
|
|
18
17
|
const ENV_VAR_PREFIX = "env."
|
|
19
18
|
|
|
@@ -42,7 +41,7 @@ async function enrichDatasourceWithValues(datasource: Datasource) {
|
|
|
42
41
|
{ onlyFound: true }
|
|
43
42
|
) as Datasource
|
|
44
43
|
const definition = await getDefinition(processed.source)
|
|
45
|
-
processed.config = checkDatasourceTypes(definition
|
|
44
|
+
processed.config = checkDatasourceTypes(definition, processed.config)
|
|
46
45
|
return {
|
|
47
46
|
datasource: processed,
|
|
48
47
|
envVars: env as Record<string, string>,
|
|
@@ -148,11 +147,6 @@ export function mergeConfigs(update: Datasource, old: Datasource) {
|
|
|
148
147
|
}
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
|
-
|
|
152
|
-
if (old.config?.auth) {
|
|
153
|
-
update.config = _.merge(old.config, update.config)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
150
|
// update back to actual passwords for everything else
|
|
157
151
|
for (let [key, value] of Object.entries(update.config)) {
|
|
158
152
|
if (value !== PASSWORD_REPLACEMENT) {
|
|
@@ -13,13 +13,18 @@ import { generateAutomationMetadataID, isProdAppID } from "../db/utils"
|
|
|
13
13
|
import { definitions as triggerDefs } from "../automations/triggerInfo"
|
|
14
14
|
import { AutomationErrors, MAX_AUTOMATION_RECURRING_ERRORS } from "../constants"
|
|
15
15
|
import { storeLog } from "../automations/logging"
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
Automation,
|
|
18
|
+
AutomationStep,
|
|
19
|
+
AutomationStatus,
|
|
20
|
+
AutomationMetadata,
|
|
21
|
+
AutomationJob,
|
|
22
|
+
} from "@budibase/types"
|
|
17
23
|
import {
|
|
18
24
|
LoopStep,
|
|
19
25
|
LoopInput,
|
|
20
26
|
TriggerOutput,
|
|
21
27
|
AutomationContext,
|
|
22
|
-
AutomationMetadata,
|
|
23
28
|
} from "../definitions/automations"
|
|
24
29
|
import { WorkerCallback } from "./definitions"
|
|
25
30
|
import { context, logging } from "@budibase/backend-core"
|
|
@@ -60,11 +65,11 @@ class Orchestrator {
|
|
|
60
65
|
_job: Job
|
|
61
66
|
executionOutput: AutomationContext
|
|
62
67
|
|
|
63
|
-
constructor(job:
|
|
64
|
-
let automation = job.data.automation
|
|
65
|
-
|
|
68
|
+
constructor(job: AutomationJob) {
|
|
69
|
+
let automation = job.data.automation
|
|
70
|
+
let triggerOutput = job.data.event
|
|
66
71
|
const metadata = triggerOutput.metadata
|
|
67
|
-
this._chainCount = metadata ? metadata.automationChainCount : 0
|
|
72
|
+
this._chainCount = metadata ? metadata.automationChainCount! : 0
|
|
68
73
|
this._appId = triggerOutput.appId as string
|
|
69
74
|
this._job = job
|
|
70
75
|
const triggerStepId = automation.definition.trigger.stepId
|
package/src/threads/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import workerFarm from "worker-farm"
|
|
2
2
|
import env from "../environment"
|
|
3
|
+
import { AutomationJob } from "@budibase/types"
|
|
4
|
+
import { QueryEvent } from "./definitions"
|
|
3
5
|
|
|
4
6
|
export const ThreadType = {
|
|
5
7
|
QUERY: "query",
|
|
@@ -64,11 +66,11 @@ export class Thread {
|
|
|
64
66
|
)
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
run(
|
|
69
|
+
run(job: AutomationJob | QueryEvent) {
|
|
68
70
|
const timeout = this.timeoutMs
|
|
69
71
|
return new Promise((resolve, reject) => {
|
|
70
72
|
function fire(worker: any) {
|
|
71
|
-
worker.execute(
|
|
73
|
+
worker.execute(job, (err: any, response: any) => {
|
|
72
74
|
if (err && err.type === "TimeoutError") {
|
|
73
75
|
reject(
|
|
74
76
|
new Error(`Query response time exceeded ${timeout}ms timeout.`)
|
package/tsconfig.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@budibase/backend-core": ["../backend-core/src"],
|
|
12
12
|
"@budibase/backend-core/*": ["../backend-core/*"],
|
|
13
13
|
"@budibase/shared-core": ["../shared-core/src"],
|
|
14
|
-
"@budibase/pro": ["
|
|
14
|
+
"@budibase/pro": ["../../../budibase-pro/packages/pro/src"]
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"ts-node": {
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { getConfig, afterAll, runStep, actions } from "./utilities"
|
|
2
|
-
|
|
3
|
-
describe("test the outgoing webhook action", () => {
|
|
4
|
-
let config = getConfig()
|
|
5
|
-
|
|
6
|
-
beforeAll(async () => {
|
|
7
|
-
await config.init()
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
afterAll()
|
|
11
|
-
|
|
12
|
-
it("should be able to run the action", async () => {
|
|
13
|
-
const res = await runStep(actions.integromat.stepId, {
|
|
14
|
-
value1: "test",
|
|
15
|
-
url: "http://www.test.com",
|
|
16
|
-
})
|
|
17
|
-
expect(res.response.url).toEqual("http://www.test.com")
|
|
18
|
-
expect(res.response.method).toEqual("post")
|
|
19
|
-
expect(res.success).toEqual(true)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it("should add the payload props when a JSON string is provided", async () => {
|
|
23
|
-
const payload = `{"value1":1,"value2":2,"value3":3,"value4":4,"value5":5,"name":"Adam","age":9}`
|
|
24
|
-
const res = await runStep(actions.integromat.stepId, {
|
|
25
|
-
value1: "ONE",
|
|
26
|
-
value2: "TWO",
|
|
27
|
-
value3: "THREE",
|
|
28
|
-
value4: "FOUR",
|
|
29
|
-
value5: "FIVE",
|
|
30
|
-
body: {
|
|
31
|
-
value: payload,
|
|
32
|
-
},
|
|
33
|
-
url: "http://www.test.com",
|
|
34
|
-
})
|
|
35
|
-
expect(res.response.url).toEqual("http://www.test.com")
|
|
36
|
-
expect(res.response.method).toEqual("post")
|
|
37
|
-
expect(res.response.body).toEqual(payload)
|
|
38
|
-
expect(res.success).toEqual(true)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
it("should return a 400 if the JSON payload string is malformed", async () => {
|
|
42
|
-
const payload = `{ value1 1 }`
|
|
43
|
-
const res = await runStep(actions.integromat.stepId, {
|
|
44
|
-
value1: "ONE",
|
|
45
|
-
body: {
|
|
46
|
-
value: payload,
|
|
47
|
-
},
|
|
48
|
-
url: "http://www.test.com",
|
|
49
|
-
})
|
|
50
|
-
expect(res.httpStatus).toEqual(400)
|
|
51
|
-
expect(res.response).toEqual("Invalid payload JSON")
|
|
52
|
-
expect(res.success).toEqual(false)
|
|
53
|
-
})
|
|
54
|
-
})
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { getConfig, afterAll, runStep, actions } from "./utilities"
|
|
2
|
-
|
|
3
|
-
describe("test the outgoing webhook action", () => {
|
|
4
|
-
let config = getConfig()
|
|
5
|
-
|
|
6
|
-
beforeAll(async () => {
|
|
7
|
-
await config.init()
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
afterAll()
|
|
11
|
-
|
|
12
|
-
it("should be able to run the action", async () => {
|
|
13
|
-
const res = await runStep(actions.zapier.stepId, {
|
|
14
|
-
value1: "test",
|
|
15
|
-
url: "http://www.test.com",
|
|
16
|
-
})
|
|
17
|
-
expect(res.response.url).toEqual("http://www.test.com")
|
|
18
|
-
expect(res.response.method).toEqual("post")
|
|
19
|
-
expect(res.success).toEqual(true)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it("should add the payload props when a JSON string is provided", async () => {
|
|
23
|
-
const payload = `{ "value1": 1, "value2": 2, "value3": 3, "value4": 4, "value5": 5, "name": "Adam", "age": 9 }`
|
|
24
|
-
const res = await runStep(actions.zapier.stepId, {
|
|
25
|
-
value1: "ONE",
|
|
26
|
-
value2: "TWO",
|
|
27
|
-
value3: "THREE",
|
|
28
|
-
value4: "FOUR",
|
|
29
|
-
value5: "FIVE",
|
|
30
|
-
body: {
|
|
31
|
-
value: payload,
|
|
32
|
-
},
|
|
33
|
-
url: "http://www.test.com",
|
|
34
|
-
})
|
|
35
|
-
expect(res.response.url).toEqual("http://www.test.com")
|
|
36
|
-
expect(res.response.method).toEqual("post")
|
|
37
|
-
expect(res.response.body).toEqual(
|
|
38
|
-
`{"platform":"budibase","value1":1,"value2":2,"value3":3,"value4":4,"value5":5,"name":"Adam","age":9}`
|
|
39
|
-
)
|
|
40
|
-
expect(res.success).toEqual(true)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it("should return a 400 if the JSON payload string is malformed", async () => {
|
|
44
|
-
const payload = `{ value1 1 }`
|
|
45
|
-
const res = await runStep(actions.zapier.stepId, {
|
|
46
|
-
value1: "ONE",
|
|
47
|
-
body: {
|
|
48
|
-
value: payload,
|
|
49
|
-
},
|
|
50
|
-
url: "http://www.test.com",
|
|
51
|
-
})
|
|
52
|
-
expect(res.httpStatus).toEqual(400)
|
|
53
|
-
expect(res.response).toEqual("Invalid payload JSON")
|
|
54
|
-
expect(res.success).toEqual(false)
|
|
55
|
-
})
|
|
56
|
-
})
|