@budibase/server 1.0.91-alpha.6 → 1.0.93
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.8392b564.js → index.4494eb63.js} +212 -212
- package/builder/assets/{index.248a239b.css → index.7c8961b4.css} +1 -1
- package/builder/index.html +2 -2
- package/coverage/clover.xml +291 -295
- package/coverage/coverage-final.json +11 -11
- package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/application.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +2 -2
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +10 -10
- package/coverage/lcov-report/api/controllers/row/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +7 -19
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +6 -6
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- 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/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- 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 +1 -1
- 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/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.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 +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +11 -11
- package/coverage/lcov-report/automations/index.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/automations/utils.js.html +9 -6
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +11 -11
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +7 -7
- package/coverage/lcov-report/db/newid.js.html +2 -2
- package/coverage/lcov-report/db/utils.js.html +2 -2
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +25 -25
- 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 +1 -1
- package/coverage/lcov-report/middleware/authorized.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/threads/automation.js.html +9 -30
- package/coverage/lcov-report/threads/index.html +15 -15
- package/coverage/lcov-report/threads/index.js.html +1 -1
- package/coverage/lcov-report/threads/query.js.html +1 -1
- package/coverage/lcov-report/threads/utils.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +12 -12
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +8 -8
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +452 -460
- package/dist/api/controllers/query/import/index.js +1 -2
- package/dist/api/controllers/query/import/sources/base/index.js +1 -12
- package/dist/api/controllers/query/import/sources/curl.js +2 -2
- package/dist/api/controllers/row/internal.js +1 -2
- package/dist/automations/utils.js +1 -0
- package/dist/definitions/datasource.js +0 -1
- package/dist/integrations/base/sql.js +9 -16
- package/dist/integrations/index.js +0 -3
- package/dist/package.json +4 -5
- package/dist/threads/automation.js +1 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -6
- package/src/api/controllers/query/import/index.ts +1 -2
- package/src/api/controllers/query/import/sources/base/index.ts +2 -12
- package/src/api/controllers/query/import/sources/curl.ts +2 -2
- package/src/api/controllers/query/import/tests/index.spec.js +0 -43
- package/src/api/controllers/row/internal.js +1 -5
- package/src/automations/utils.js +1 -0
- package/src/definitions/datasource.ts +0 -1
- package/src/integrations/base/sql.ts +9 -14
- package/src/integrations/index.ts +0 -3
- package/src/integrations/tests/sql.spec.js +0 -51
- package/src/threads/automation.js +1 -8
- package/dist/api/controllers/query/import/sources/openapi3.js +0 -174
- package/dist/api/controllers/query/import/sources/tests/openapi3/data/crud/crud.json +0 -253
- package/dist/api/controllers/query/import/sources/tests/openapi3/data/petstore/petstore.json +0 -1225
- package/dist/integrations/firebase.js +0 -192
- package/src/api/controllers/query/import/sources/openapi3.ts +0 -205
- package/src/api/controllers/query/import/sources/tests/openapi3/data/crud/crud.json +0 -253
- package/src/api/controllers/query/import/sources/tests/openapi3/data/crud/crud.yaml +0 -153
- package/src/api/controllers/query/import/sources/tests/openapi3/data/petstore/petstore.json +0 -1225
- package/src/api/controllers/query/import/sources/tests/openapi3/data/petstore/petstore.yaml +0 -804
- package/src/api/controllers/query/import/sources/tests/openapi3/openapi3.spec.js +0 -240
- package/src/integrations/firebase.ts +0 -205
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.93",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -71,13 +71,12 @@
|
|
|
71
71
|
"license": "GPL-3.0",
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@apidevtools/swagger-parser": "^10.0.3",
|
|
74
|
-
"@budibase/backend-core": "^1.0.
|
|
75
|
-
"@budibase/client": "^1.0.
|
|
76
|
-
"@budibase/string-templates": "^1.0.
|
|
74
|
+
"@budibase/backend-core": "^1.0.93",
|
|
75
|
+
"@budibase/client": "^1.0.93",
|
|
76
|
+
"@budibase/string-templates": "^1.0.93",
|
|
77
77
|
"@bull-board/api": "^3.7.0",
|
|
78
78
|
"@bull-board/koa": "^3.7.0",
|
|
79
79
|
"@elastic/elasticsearch": "7.10.0",
|
|
80
|
-
"@google-cloud/firestore": "^5.0.2",
|
|
81
80
|
"@koa/router": "8.0.0",
|
|
82
81
|
"@sendgrid/mail": "7.1.1",
|
|
83
82
|
"@sentry/node": "^6.0.0",
|
|
@@ -176,5 +175,5 @@
|
|
|
176
175
|
"optionalDependencies": {
|
|
177
176
|
"oracledb": "^5.3.0"
|
|
178
177
|
},
|
|
179
|
-
"gitHead": "
|
|
178
|
+
"gitHead": "38f53a4148845f1aded8a72311363032c177d2c6"
|
|
180
179
|
}
|
|
@@ -2,7 +2,6 @@ import { queryValidation } from "../validation"
|
|
|
2
2
|
import { generateQueryID } from "../../../../db/utils"
|
|
3
3
|
import { ImportInfo, ImportSource } from "./sources/base"
|
|
4
4
|
import { OpenAPI2 } from "./sources/openapi2"
|
|
5
|
-
import { OpenAPI3 } from "./sources/openapi3"
|
|
6
5
|
import { Query } from "./../../../../definitions/common"
|
|
7
6
|
import { Curl } from "./sources/curl"
|
|
8
7
|
// @ts-ignore
|
|
@@ -19,7 +18,7 @@ export class RestImporter {
|
|
|
19
18
|
|
|
20
19
|
constructor(data: string) {
|
|
21
20
|
this.data = data
|
|
22
|
-
this.sources = [new OpenAPI2(), new
|
|
21
|
+
this.sources = [new OpenAPI2(), new Curl()]
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
init = async () => {
|
|
@@ -23,7 +23,7 @@ export abstract class ImportSource {
|
|
|
23
23
|
name: string,
|
|
24
24
|
method: string,
|
|
25
25
|
path: string,
|
|
26
|
-
url: URL
|
|
26
|
+
url: URL,
|
|
27
27
|
queryString: string,
|
|
28
28
|
headers: object = {},
|
|
29
29
|
parameters: QueryParameter[] = [],
|
|
@@ -34,17 +34,7 @@ export abstract class ImportSource {
|
|
|
34
34
|
const transformer = "return data"
|
|
35
35
|
const schema = {}
|
|
36
36
|
path = this.processPath(path)
|
|
37
|
-
|
|
38
|
-
if (typeof url === "string") {
|
|
39
|
-
path = `${url}/${path}`
|
|
40
|
-
} else {
|
|
41
|
-
let href = url.href
|
|
42
|
-
if (href.endsWith("/")) {
|
|
43
|
-
href = href.slice(0, -1)
|
|
44
|
-
}
|
|
45
|
-
path = `${href}/${path}`
|
|
46
|
-
}
|
|
47
|
-
}
|
|
37
|
+
path = `${url.origin}/${path}`
|
|
48
38
|
queryString = this.processQuery(queryString)
|
|
49
39
|
const requestBody = JSON.stringify(body, null, 2)
|
|
50
40
|
|
|
@@ -74,7 +74,7 @@ export class Curl extends ImportSource {
|
|
|
74
74
|
getQueries = async (datasourceId: string): Promise<Query[]> => {
|
|
75
75
|
const url = this.getUrl()
|
|
76
76
|
const name = url.pathname
|
|
77
|
-
const path = url.
|
|
77
|
+
const path = url.pathname
|
|
78
78
|
const method = this.curl.method
|
|
79
79
|
const queryString = url.search
|
|
80
80
|
const headers = this.curl.headers
|
|
@@ -90,7 +90,7 @@ export class Curl extends ImportSource {
|
|
|
90
90
|
name,
|
|
91
91
|
method,
|
|
92
92
|
path,
|
|
93
|
-
|
|
93
|
+
url,
|
|
94
94
|
queryString,
|
|
95
95
|
headers,
|
|
96
96
|
[],
|
|
@@ -23,27 +23,14 @@ const oapi2CrudYaml = getData("openapi2/data/crud/crud.json")
|
|
|
23
23
|
const oapi2PetstoreJson = getData("openapi2/data/petstore/petstore.json")
|
|
24
24
|
const oapi2PetstoreYaml = getData("openapi2/data/petstore/petstore.json")
|
|
25
25
|
|
|
26
|
-
// openapi3
|
|
27
|
-
const oapi3CrudJson = getData("openapi3/data/crud/crud.json")
|
|
28
|
-
const oapi3CrudYaml = getData("openapi3/data/crud/crud.json")
|
|
29
|
-
const oapi3PetstoreJson = getData("openapi3/data/petstore/petstore.json")
|
|
30
|
-
const oapi3PetstoreYaml = getData("openapi3/data/petstore/petstore.json")
|
|
31
|
-
|
|
32
26
|
// curl
|
|
33
27
|
const curl = getData("curl/data/post.txt")
|
|
34
28
|
|
|
35
29
|
const datasets = {
|
|
36
|
-
// openapi2 (swagger)
|
|
37
30
|
oapi2CrudJson,
|
|
38
31
|
oapi2CrudYaml,
|
|
39
32
|
oapi2PetstoreJson,
|
|
40
33
|
oapi2PetstoreYaml,
|
|
41
|
-
// openapi3
|
|
42
|
-
oapi3CrudJson,
|
|
43
|
-
oapi3CrudYaml,
|
|
44
|
-
oapi3PetstoreJson,
|
|
45
|
-
oapi3PetstoreYaml,
|
|
46
|
-
// curl
|
|
47
34
|
curl
|
|
48
35
|
}
|
|
49
36
|
|
|
@@ -69,7 +56,6 @@ describe("Rest Importer", () => {
|
|
|
69
56
|
|
|
70
57
|
it("gets info", async () => {
|
|
71
58
|
const assertions = {
|
|
72
|
-
// openapi2 (swagger)
|
|
73
59
|
"oapi2CrudJson" : {
|
|
74
60
|
name: "CRUD",
|
|
75
61
|
},
|
|
@@ -82,20 +68,6 @@ describe("Rest Importer", () => {
|
|
|
82
68
|
"oapi2PetstoreYaml" :{
|
|
83
69
|
name: "Swagger Petstore",
|
|
84
70
|
},
|
|
85
|
-
// openapi3
|
|
86
|
-
"oapi3CrudJson" : {
|
|
87
|
-
name: "CRUD",
|
|
88
|
-
},
|
|
89
|
-
"oapi3CrudYaml" : {
|
|
90
|
-
name: "CRUD",
|
|
91
|
-
},
|
|
92
|
-
"oapi3PetstoreJson" : {
|
|
93
|
-
name: "Swagger Petstore - OpenAPI 3.0",
|
|
94
|
-
},
|
|
95
|
-
"oapi3PetstoreYaml" :{
|
|
96
|
-
name: "Swagger Petstore - OpenAPI 3.0",
|
|
97
|
-
},
|
|
98
|
-
// curl
|
|
99
71
|
"curl": {
|
|
100
72
|
name: "example.com",
|
|
101
73
|
}
|
|
@@ -117,7 +89,6 @@ describe("Rest Importer", () => {
|
|
|
117
89
|
// simple sanity assertions that the whole dataset
|
|
118
90
|
// makes it through the importer
|
|
119
91
|
const assertions = {
|
|
120
|
-
// openapi2 (swagger)
|
|
121
92
|
"oapi2CrudJson" : {
|
|
122
93
|
count: 6,
|
|
123
94
|
},
|
|
@@ -130,20 +101,6 @@ describe("Rest Importer", () => {
|
|
|
130
101
|
"oapi2PetstoreYaml" :{
|
|
131
102
|
count: 20,
|
|
132
103
|
},
|
|
133
|
-
// openapi3
|
|
134
|
-
"oapi3CrudJson" : {
|
|
135
|
-
count: 6,
|
|
136
|
-
},
|
|
137
|
-
"oapi3CrudYaml" :{
|
|
138
|
-
count: 6,
|
|
139
|
-
},
|
|
140
|
-
"oapi3PetstoreJson" : {
|
|
141
|
-
count: 19,
|
|
142
|
-
},
|
|
143
|
-
"oapi3PetstoreYaml" :{
|
|
144
|
-
count: 19,
|
|
145
|
-
},
|
|
146
|
-
// curl
|
|
147
104
|
"curl": {
|
|
148
105
|
count: 1
|
|
149
106
|
}
|
|
@@ -85,11 +85,7 @@ exports.patch = async ctx => {
|
|
|
85
85
|
const isUserTable = tableId === InternalTables.USER_METADATA
|
|
86
86
|
let oldRow
|
|
87
87
|
try {
|
|
88
|
-
|
|
89
|
-
oldRow = await outputProcessing(
|
|
90
|
-
dbTable,
|
|
91
|
-
await findRow(ctx, tableId, inputs._id)
|
|
92
|
-
)
|
|
88
|
+
oldRow = await db.get(inputs._id)
|
|
93
89
|
} catch (err) {
|
|
94
90
|
if (isUserTable) {
|
|
95
91
|
// don't include the rev, it'll be the global rev
|
package/src/automations/utils.js
CHANGED
|
@@ -27,8 +27,11 @@ function parse(input: any) {
|
|
|
27
27
|
if (typeof input !== "string") {
|
|
28
28
|
return input
|
|
29
29
|
}
|
|
30
|
-
if (input === MAX_ISO_DATE
|
|
31
|
-
return
|
|
30
|
+
if (input === MAX_ISO_DATE) {
|
|
31
|
+
return new Date(8640000000000000)
|
|
32
|
+
}
|
|
33
|
+
if (input === MIN_ISO_DATE) {
|
|
34
|
+
return new Date(-8640000000000000)
|
|
32
35
|
}
|
|
33
36
|
if (isIsoDateString(input)) {
|
|
34
37
|
return new Date(input)
|
|
@@ -127,19 +130,11 @@ class InternalBuilder {
|
|
|
127
130
|
}
|
|
128
131
|
if (filters.range) {
|
|
129
132
|
iterate(filters.range, (key, value) => {
|
|
130
|
-
if (value.
|
|
131
|
-
|
|
132
|
-
const fnc = allOr ? "orWhereBetween" : "whereBetween"
|
|
133
|
-
query = query[fnc](key, [value.low, value.high])
|
|
134
|
-
} else if (value.low) {
|
|
135
|
-
// Use just a single greater than operator if we only have a low
|
|
136
|
-
const fnc = allOr ? "orWhere" : "where"
|
|
137
|
-
query = query[fnc](key, ">", value.low)
|
|
138
|
-
} else if (value.high) {
|
|
139
|
-
// Use just a single less than operator if we only have a high
|
|
140
|
-
const fnc = allOr ? "orWhere" : "where"
|
|
141
|
-
query = query[fnc](key, "<", value.high)
|
|
133
|
+
if (!value.high || !value.low) {
|
|
134
|
+
return
|
|
142
135
|
}
|
|
136
|
+
const fnc = allOr ? "orWhereBetween" : "whereBetween"
|
|
137
|
+
query = query[fnc](key, [value.low, value.high])
|
|
143
138
|
})
|
|
144
139
|
}
|
|
145
140
|
if (filters.equal) {
|
|
@@ -10,7 +10,6 @@ const mysql = require("./mysql")
|
|
|
10
10
|
const arangodb = require("./arangodb")
|
|
11
11
|
const rest = require("./rest")
|
|
12
12
|
const googlesheets = require("./googlesheets")
|
|
13
|
-
const firebase = require("./firebase")
|
|
14
13
|
const { SourceNames } = require("../definitions/datasource")
|
|
15
14
|
const environment = require("../environment")
|
|
16
15
|
|
|
@@ -26,7 +25,6 @@ const DEFINITIONS = {
|
|
|
26
25
|
[SourceNames.MYSQL]: mysql.schema,
|
|
27
26
|
[SourceNames.ARANGODB]: arangodb.schema,
|
|
28
27
|
[SourceNames.REST]: rest.schema,
|
|
29
|
-
[SourceNames.FIREBASE]: firebase.schema,
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
const INTEGRATIONS = {
|
|
@@ -41,7 +39,6 @@ const INTEGRATIONS = {
|
|
|
41
39
|
[SourceNames.MYSQL]: mysql.integration,
|
|
42
40
|
[SourceNames.ARANGODB]: arangodb.integration,
|
|
43
41
|
[SourceNames.REST]: rest.integration,
|
|
44
|
-
[SourceNames.FIREBASE]: firebase.integration,
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
// optionally add oracle integration if the oracle binary can be installed
|
|
@@ -187,55 +187,4 @@ describe("SQL query builder", () => {
|
|
|
187
187
|
sql: `select * from (select * from \`${TABLE_NAME}\` limit ?) as \`${TABLE_NAME}\``
|
|
188
188
|
})
|
|
189
189
|
})
|
|
190
|
-
|
|
191
|
-
it("should use greater than when only low range specified", () => {
|
|
192
|
-
const date = new Date()
|
|
193
|
-
const query = sql._query(generateReadJson({
|
|
194
|
-
filters: {
|
|
195
|
-
range: {
|
|
196
|
-
property: {
|
|
197
|
-
low: date,
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}))
|
|
202
|
-
expect(query).toEqual({
|
|
203
|
-
bindings: [date, limit],
|
|
204
|
-
sql: `select * from (select * from "${TABLE_NAME}" where "${TABLE_NAME}"."property" > $1 limit $2) as "${TABLE_NAME}"`
|
|
205
|
-
})
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
it("should use less than when only high range specified", () => {
|
|
209
|
-
const date = new Date()
|
|
210
|
-
const query = sql._query(generateReadJson({
|
|
211
|
-
filters: {
|
|
212
|
-
range: {
|
|
213
|
-
property: {
|
|
214
|
-
high: date,
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}))
|
|
219
|
-
expect(query).toEqual({
|
|
220
|
-
bindings: [date, limit],
|
|
221
|
-
sql: `select * from (select * from "${TABLE_NAME}" where "${TABLE_NAME}"."property" < $1 limit $2) as "${TABLE_NAME}"`
|
|
222
|
-
})
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
it("should use greater than when only low range specified", () => {
|
|
226
|
-
const date = new Date()
|
|
227
|
-
const query = sql._query(generateReadJson({
|
|
228
|
-
filters: {
|
|
229
|
-
range: {
|
|
230
|
-
property: {
|
|
231
|
-
low: date,
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}))
|
|
236
|
-
expect(query).toEqual({
|
|
237
|
-
bindings: [date, limit],
|
|
238
|
-
sql: `select * from (select * from "${TABLE_NAME}" where "${TABLE_NAME}"."property" > $1 limit $2) as "${TABLE_NAME}"`
|
|
239
|
-
})
|
|
240
|
-
})
|
|
241
190
|
})
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
require("./utils").threadSetup()
|
|
2
|
-
const env = require("../environment")
|
|
3
2
|
const actions = require("../automations/actions")
|
|
4
3
|
const automationUtils = require("../automations/automationUtils")
|
|
5
4
|
const AutomationEmitter = require("../events/AutomationEmitter")
|
|
6
5
|
const { processObject } = require("@budibase/string-templates")
|
|
7
6
|
const { DEFAULT_TENANT_ID } = require("@budibase/backend-core/constants")
|
|
8
|
-
const { DocumentTypes
|
|
7
|
+
const { DocumentTypes } = require("../db/utils")
|
|
9
8
|
const { doInTenant } = require("@budibase/backend-core/tenancy")
|
|
10
|
-
const usage = require("../utilities/usageQuota")
|
|
11
9
|
const { definitions: triggerDefs } = require("../automations/triggerInfo")
|
|
12
10
|
const { doInAppContext, getAppDB } = require("@budibase/backend-core/context")
|
|
13
11
|
|
|
@@ -120,11 +118,6 @@ class Orchestrator {
|
|
|
120
118
|
return err
|
|
121
119
|
}
|
|
122
120
|
}
|
|
123
|
-
|
|
124
|
-
// Increment quota for automation runs
|
|
125
|
-
if (!env.SELF_HOSTED && !isDevAppID(this._appId)) {
|
|
126
|
-
await usage.update(usage.Properties.AUTOMATION, 1)
|
|
127
|
-
}
|
|
128
121
|
return this.executionOutput
|
|
129
122
|
}
|
|
130
123
|
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.OpenAPI3 = void 0;
|
|
13
|
-
const openapi_types_1 = require("openapi-types");
|
|
14
|
-
const openapi_1 = require("./base/openapi");
|
|
15
|
-
const url_1 = require("url");
|
|
16
|
-
const parameterNotRef = (param) => {
|
|
17
|
-
// all refs are deferenced by parser library
|
|
18
|
-
return true;
|
|
19
|
-
};
|
|
20
|
-
const requestBodyNotRef = (param) => {
|
|
21
|
-
// all refs are deferenced by parser library
|
|
22
|
-
return param !== undefined;
|
|
23
|
-
};
|
|
24
|
-
const schemaNotRef = (param) => {
|
|
25
|
-
// all refs are deferenced by parser library
|
|
26
|
-
return param !== undefined;
|
|
27
|
-
};
|
|
28
|
-
const isOpenAPI3 = (document) => {
|
|
29
|
-
return document.openapi.includes("3.0");
|
|
30
|
-
};
|
|
31
|
-
const methods = Object.values(openapi_types_1.OpenAPIV3.HttpMethods);
|
|
32
|
-
const isOperation = (key, pathItem) => {
|
|
33
|
-
return methods.includes(key);
|
|
34
|
-
};
|
|
35
|
-
const isParameter = (key, pathItem) => {
|
|
36
|
-
return !isOperation(key, pathItem);
|
|
37
|
-
};
|
|
38
|
-
const getRequestBody = (operation) => {
|
|
39
|
-
if (requestBodyNotRef(operation.requestBody)) {
|
|
40
|
-
const request = operation.requestBody;
|
|
41
|
-
const supportedMimeTypes = getMimeTypes(operation);
|
|
42
|
-
if (supportedMimeTypes.length > 0) {
|
|
43
|
-
const mimeType = supportedMimeTypes[0];
|
|
44
|
-
// try get example from request
|
|
45
|
-
const content = request.content[mimeType];
|
|
46
|
-
if (content.example) {
|
|
47
|
-
return content.example;
|
|
48
|
-
}
|
|
49
|
-
// try get example from schema
|
|
50
|
-
if (schemaNotRef(content.schema)) {
|
|
51
|
-
const schema = content.schema;
|
|
52
|
-
if (schema.example) {
|
|
53
|
-
return schema.example;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return undefined;
|
|
59
|
-
};
|
|
60
|
-
const getMimeTypes = (operation) => {
|
|
61
|
-
if (requestBodyNotRef(operation.requestBody)) {
|
|
62
|
-
const request = operation.requestBody;
|
|
63
|
-
return Object.keys(request.content);
|
|
64
|
-
}
|
|
65
|
-
return [];
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* OpenAPI Version 3.0
|
|
69
|
-
* https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md
|
|
70
|
-
*/
|
|
71
|
-
class OpenAPI3 extends openapi_1.OpenAPISource {
|
|
72
|
-
constructor() {
|
|
73
|
-
super(...arguments);
|
|
74
|
-
this.isSupported = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
try {
|
|
76
|
-
const document = yield this.parseData(data);
|
|
77
|
-
if (isOpenAPI3(document)) {
|
|
78
|
-
this.document = document;
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
this.getInfo = () => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
const name = this.document.info.title || "OpenAPI Import";
|
|
91
|
-
return {
|
|
92
|
-
name,
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
this.getQueries = (datasourceId) => __awaiter(this, void 0, void 0, function* () {
|
|
96
|
-
var _a;
|
|
97
|
-
let url;
|
|
98
|
-
if ((_a = this.document.servers) === null || _a === void 0 ? void 0 : _a.length) {
|
|
99
|
-
url = this.document.servers[0].url;
|
|
100
|
-
try {
|
|
101
|
-
url = new url_1.URL(url);
|
|
102
|
-
}
|
|
103
|
-
catch (err) {
|
|
104
|
-
// unable to construct url, e.g. with variables
|
|
105
|
-
// proceed with string form of url
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
const queries = [];
|
|
109
|
-
for (let [path, pathItemObject] of Object.entries(this.document.paths)) {
|
|
110
|
-
// parameters that apply to every operation in the path
|
|
111
|
-
let pathParams = [];
|
|
112
|
-
// pathItemObject can be undefined
|
|
113
|
-
if (!pathItemObject) {
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
for (let [key, opOrParams] of Object.entries(pathItemObject)) {
|
|
117
|
-
if (isParameter(key, opOrParams)) {
|
|
118
|
-
const pathParameters = opOrParams;
|
|
119
|
-
pathParams.push(...pathParameters);
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
// can not be a parameter, must be an operation
|
|
123
|
-
const operation = opOrParams;
|
|
124
|
-
const methodName = key;
|
|
125
|
-
const name = operation.operationId || path;
|
|
126
|
-
let queryString = "";
|
|
127
|
-
const headers = {};
|
|
128
|
-
let requestBody = getRequestBody(operation);
|
|
129
|
-
const parameters = [];
|
|
130
|
-
const mimeTypes = getMimeTypes(operation);
|
|
131
|
-
if (mimeTypes.length > 0) {
|
|
132
|
-
headers["Content-Type"] = mimeTypes[0];
|
|
133
|
-
}
|
|
134
|
-
// combine the path parameters with the operation parameters
|
|
135
|
-
const operationParams = operation.parameters || [];
|
|
136
|
-
const allParams = [...pathParams, ...operationParams];
|
|
137
|
-
for (let param of allParams) {
|
|
138
|
-
if (parameterNotRef(param)) {
|
|
139
|
-
switch (param.in) {
|
|
140
|
-
case "query":
|
|
141
|
-
let prefix = "";
|
|
142
|
-
if (queryString) {
|
|
143
|
-
prefix = "&";
|
|
144
|
-
}
|
|
145
|
-
queryString = `${queryString}${prefix}${param.name}={{${param.name}}}`;
|
|
146
|
-
break;
|
|
147
|
-
case "header":
|
|
148
|
-
headers[param.name] = `{{${param.name}}}`;
|
|
149
|
-
break;
|
|
150
|
-
case "path":
|
|
151
|
-
// do nothing: param is already in the path
|
|
152
|
-
break;
|
|
153
|
-
case "formData":
|
|
154
|
-
// future enhancement
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
// add the parameter if it can be bound in our config
|
|
158
|
-
if (["query", "header", "path"].includes(param.in)) {
|
|
159
|
-
parameters.push({
|
|
160
|
-
name: param.name,
|
|
161
|
-
default: "",
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
const query = this.constructQuery(datasourceId, name, methodName, path, url, queryString, headers, parameters, requestBody);
|
|
167
|
-
queries.push(query);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return queries;
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
exports.OpenAPI3 = OpenAPI3;
|