@budibase/server 1.0.79 → 1.0.80-alpha.0
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/__mocks__/node-fetch.ts +1 -0
- package/builder/assets/index.b37e0ebb.js +1288 -0
- package/builder/assets/{index.c8d1e8f0.css → index.c57242d4.css} +2 -2
- package/builder/assets/{vendor.20f80cec.js → vendor.a7c6ad0a.js} +190 -216
- package/builder/index.html +3 -3
- package/coverage/clover.xml +2399 -2336
- package/coverage/coverage-final.json +138 -137
- package/coverage/lcov-report/api/controllers/analytics.js.html +6 -6
- package/coverage/lcov-report/api/controllers/apikeys.js.html +6 -6
- package/coverage/lcov-report/api/controllers/application.js.html +152 -149
- package/coverage/lcov-report/api/controllers/auth.js.html +7 -7
- package/coverage/lcov-report/api/controllers/automation.js.html +21 -21
- package/coverage/lcov-report/api/controllers/backup.js.html +3 -3
- package/coverage/lcov-report/api/controllers/cloud.js.html +11 -11
- package/coverage/lcov-report/api/controllers/component.js.html +5 -5
- package/coverage/lcov-report/api/controllers/datasource.js.html +16 -16
- package/coverage/lcov-report/api/controllers/dev.js.html +19 -19
- package/coverage/lcov-report/api/controllers/index.html +16 -16
- package/coverage/lcov-report/api/controllers/integration.js.html +4 -4
- package/coverage/lcov-report/api/controllers/layout.js.html +6 -6
- package/coverage/lcov-report/api/controllers/metadata.js.html +9 -9
- package/coverage/lcov-report/api/controllers/migrations.js.html +4 -4
- package/coverage/lcov-report/api/controllers/permission.js.html +15 -15
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.js.html +26 -26
- package/coverage/lcov-report/api/controllers/query/validation.js.html +10 -10
- package/coverage/lcov-report/api/controllers/role.js.html +9 -9
- package/coverage/lcov-report/api/controllers/routing.js.html +9 -9
- package/coverage/lcov-report/api/controllers/row/external.js.html +16 -16
- package/coverage/lcov-report/api/controllers/row/index.html +27 -27
- package/coverage/lcov-report/api/controllers/row/index.js.html +46 -46
- package/coverage/lcov-report/api/controllers/row/internal.js.html +94 -82
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +204 -204
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +24 -24
- package/coverage/lcov-report/api/controllers/row/utils.js.html +29 -29
- package/coverage/lcov-report/api/controllers/screen.js.html +7 -7
- package/coverage/lcov-report/api/controllers/script.js.html +4 -4
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +49 -49
- package/coverage/lcov-report/api/controllers/table/external.js.html +12 -12
- package/coverage/lcov-report/api/controllers/table/index.html +11 -11
- package/coverage/lcov-report/api/controllers/table/index.js.html +47 -44
- package/coverage/lcov-report/api/controllers/table/internal.js.html +50 -50
- package/coverage/lcov-report/api/controllers/table/utils.js.html +80 -80
- package/coverage/lcov-report/api/controllers/templates.js.html +5 -5
- package/coverage/lcov-report/api/controllers/user.js.html +19 -19
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +4 -4
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +14 -14
- package/coverage/lcov-report/api/controllers/view/utils.js.html +12 -12
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +7 -7
- package/coverage/lcov-report/api/controllers/webhook.js.html +18 -27
- package/coverage/lcov-report/api/index.html +10 -10
- package/coverage/lcov-report/api/index.js.html +37 -28
- package/coverage/lcov-report/api/routes/analytics.js.html +6 -6
- package/coverage/lcov-report/api/routes/apikeys.js.html +8 -8
- package/coverage/lcov-report/api/routes/application.js.html +9 -9
- package/coverage/lcov-report/api/routes/auth.js.html +6 -6
- package/coverage/lcov-report/api/routes/automation.js.html +19 -109
- package/coverage/lcov-report/api/routes/backup.js.html +8 -8
- package/coverage/lcov-report/api/routes/cloud.js.html +8 -8
- package/coverage/lcov-report/api/routes/component.js.html +8 -8
- package/coverage/lcov-report/api/routes/datasource.js.html +18 -156
- package/coverage/lcov-report/api/routes/deploy.js.html +8 -8
- package/coverage/lcov-report/api/routes/dev.js.html +13 -13
- package/coverage/lcov-report/api/routes/index.html +35 -35
- package/coverage/lcov-report/api/routes/index.js.html +38 -32
- package/coverage/lcov-report/api/routes/integration.js.html +8 -8
- package/coverage/lcov-report/api/routes/layout.js.html +8 -8
- package/coverage/lcov-report/api/routes/metadata.js.html +9 -9
- package/coverage/lcov-report/api/routes/migrations.js.html +7 -7
- package/coverage/lcov-report/api/routes/permission.js.html +16 -58
- package/coverage/lcov-report/api/routes/query.js.html +10 -10
- package/coverage/lcov-report/api/routes/role.js.html +15 -78
- package/coverage/lcov-report/api/routes/routing.js.html +8 -8
- package/coverage/lcov-report/api/routes/row.js.html +17 -14
- package/coverage/lcov-report/api/routes/screen.js.html +14 -95
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +13 -13
- package/coverage/lcov-report/api/routes/table.js.html +17 -62
- package/coverage/lcov-report/api/routes/templates.js.html +8 -8
- package/coverage/lcov-report/api/routes/user.js.html +8 -8
- package/coverage/lcov-report/api/routes/utils/index.html +111 -0
- package/coverage/lcov-report/api/routes/utils/validators.js.html +737 -0
- package/coverage/lcov-report/api/routes/view.js.html +10 -10
- package/coverage/lcov-report/api/routes/webhook.js.html +14 -62
- package/coverage/lcov-report/automations/actions.js.html +24 -24
- package/coverage/lcov-report/automations/automationUtils.js.html +5 -5
- package/coverage/lcov-report/automations/bullboard.js.html +16 -16
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +7 -7
- package/coverage/lcov-report/automations/steps/bash.js.html +6 -6
- package/coverage/lcov-report/automations/steps/createRow.js.html +7 -7
- package/coverage/lcov-report/automations/steps/delay.js.html +4 -4
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +7 -7
- package/coverage/lcov-report/automations/steps/discord.js.html +7 -7
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +6 -6
- package/coverage/lcov-report/automations/steps/executeScript.js.html +6 -6
- package/coverage/lcov-report/automations/steps/filter.js.html +12 -9
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +5 -5
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +8 -8
- package/coverage/lcov-report/automations/steps/queryRows.js.html +11 -11
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +5 -5
- package/coverage/lcov-report/automations/steps/serverLog.js.html +3 -3
- package/coverage/lcov-report/automations/steps/slack.js.html +5 -5
- package/coverage/lcov-report/automations/steps/updateRow.js.html +6 -6
- package/coverage/lcov-report/automations/steps/utils.js.html +3 -3
- package/coverage/lcov-report/automations/steps/zapier.js.html +5 -5
- 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 +26 -26
- package/coverage/lcov-report/automations/utils.js.html +35 -35
- package/coverage/lcov-report/constants/index.html +5 -5
- package/coverage/lcov-report/constants/index.js.html +40 -28
- package/coverage/lcov-report/constants/layouts.js.html +5 -5
- package/coverage/lcov-report/constants/screens.js.html +4 -4
- package/coverage/lcov-report/db/client.js.html +18 -18
- package/coverage/lcov-report/db/inMemoryView.js.html +7 -7
- package/coverage/lcov-report/db/index.html +15 -15
- package/coverage/lcov-report/db/index.js.html +3 -3
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +21 -21
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +36 -36
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +30 -30
- package/coverage/lcov-report/db/newid.js.html +4 -4
- package/coverage/lcov-report/db/utils.js.html +123 -87
- 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 +8 -8
- package/coverage/lcov-report/events/utils.js.html +18 -18
- package/coverage/lcov-report/index.html +89 -74
- 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 +5 -5
- package/coverage/lcov-report/middleware/authorized.js.html +29 -29
- package/coverage/lcov-report/middleware/builder.js.html +16 -16
- package/coverage/lcov-report/middleware/currentapp.js.html +44 -44
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +14 -14
- package/coverage/lcov-report/middleware/resourceId.js.html +29 -29
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +17 -17
- package/coverage/lcov-report/middleware/utils.js.html +4 -4
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +19 -19
- package/coverage/lcov-report/threads/index.js.html +10 -10
- package/coverage/lcov-report/threads/query.js.html +123 -39
- package/coverage/lcov-report/threads/utils.js.html +14 -14
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +7 -7
- package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
- package/coverage/lcov-report/utilities/csvParser.js.html +6 -6
- package/coverage/lcov-report/utilities/global.js.html +28 -28
- package/coverage/lcov-report/utilities/index.html +18 -18
- package/coverage/lcov-report/utilities/index.js.html +24 -24
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +9 -9
- 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 +6 -6
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +60 -60
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +13 -13
- package/coverage/lcov-report/utilities/scriptRunner.js.html +5 -5
- package/coverage/lcov-report/utilities/security.js.html +8 -8
- 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 +12 -12
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +8 -8
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +5 -5
- package/coverage/lcov-report/utilities/workerRequests.js.html +200 -53
- package/coverage/lcov.info +3323 -3224
- package/dist/api/controllers/application.js +1 -0
- package/dist/api/controllers/public/applications.js +94 -0
- package/dist/api/controllers/public/mapping/applications.js +29 -0
- package/dist/api/controllers/public/mapping/index.js +11 -0
- package/dist/api/controllers/public/mapping/queries.js +36 -0
- package/dist/api/controllers/public/mapping/rows.js +24 -0
- package/dist/api/controllers/public/mapping/tables.js +23 -0
- package/dist/api/controllers/public/mapping/types.js +2 -0
- package/dist/api/controllers/public/mapping/users.js +29 -0
- package/dist/api/controllers/public/queries.js +38 -0
- package/dist/api/controllers/public/rows.js +97 -0
- package/dist/api/controllers/public/tables.js +75 -0
- package/dist/api/controllers/public/users.js +95 -0
- package/dist/api/controllers/public/utils.js +49 -0
- package/dist/api/controllers/row/internal.js +4 -1
- package/dist/api/controllers/table/index.js +2 -1
- package/dist/api/controllers/webhook.js +3 -5
- package/dist/api/index.js +3 -1
- package/dist/api/routes/automation.js +3 -31
- package/dist/api/routes/datasource.js +3 -50
- package/dist/api/routes/index.js +2 -0
- package/dist/api/routes/permission.js +4 -14
- package/dist/api/routes/public/applications.js +141 -0
- package/dist/api/routes/public/index.js +101 -0
- package/dist/api/routes/public/middleware/mapper.js +94 -0
- package/dist/api/routes/public/queries.js +77 -0
- package/dist/api/routes/public/rows.js +229 -0
- package/dist/api/routes/public/tables.js +154 -0
- package/dist/api/routes/public/users.js +137 -0
- package/dist/api/routes/public/utils/Endpoint.js +36 -0
- package/dist/api/routes/role.js +3 -19
- package/dist/api/routes/row.js +3 -4
- package/dist/api/routes/screen.js +2 -23
- package/dist/api/routes/table.js +3 -17
- package/dist/api/routes/tests/utilities/index.js +23 -0
- package/dist/api/routes/utils/validators.js +200 -0
- package/dist/api/routes/webhook.js +2 -17
- package/dist/automations/steps/filter.js +2 -2
- package/dist/automations/steps/queryRows.js +1 -1
- package/dist/automations/utils.js +2 -2
- package/dist/constants/index.js +3 -0
- package/dist/db/utils.js +11 -0
- package/dist/definitions/openapi.js +6 -0
- package/dist/environment.js +1 -0
- package/dist/integrations/googlesheets.js +3 -0
- package/dist/integrations/microsoftSqlServer.js +35 -29
- package/dist/integrations/mysql.js +3 -0
- package/dist/integrations/oracle.js +14 -19
- package/dist/integrations/postgres.js +34 -28
- package/dist/package.json +11 -7
- package/dist/tests/utilities/TestConfiguration.js +25 -8
- package/dist/threads/query.js +33 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/workerRequests.js +50 -15
- package/package.json +12 -8
- package/scripts/integrations/oracle/oracle.md +2 -2
- package/scripts/integrations/postgres/init.sql +5 -3
- package/scripts/likeCypress.ts +9 -6
- package/specs/generate.js +83 -0
- package/specs/openapi.json +2222 -0
- package/specs/openapi.yaml +1530 -0
- package/specs/parameters.js +59 -0
- package/specs/resources/application.js +101 -0
- package/specs/resources/index.js +24 -0
- package/specs/resources/misc.js +12 -0
- package/specs/resources/query.js +189 -0
- package/specs/resources/row.js +125 -0
- package/specs/resources/table.js +191 -0
- package/specs/resources/user.js +126 -0
- package/specs/resources/utils/Resource.js +26 -0
- package/specs/resources/utils/index.js +11 -0
- package/specs/security.js +7 -0
- package/src/api/controllers/application.js +1 -0
- package/src/api/controllers/public/applications.ts +74 -0
- package/src/api/controllers/public/mapping/applications.ts +32 -0
- package/src/api/controllers/public/mapping/index.ts +13 -0
- package/src/api/controllers/public/mapping/queries.ts +39 -0
- package/src/api/controllers/public/mapping/rows.ts +31 -0
- package/src/api/controllers/public/mapping/tables.ts +26 -0
- package/src/api/controllers/public/mapping/types.ts +13 -0
- package/src/api/controllers/public/mapping/users.ts +32 -0
- package/src/api/controllers/public/queries.ts +20 -0
- package/src/api/controllers/public/rows.ts +77 -0
- package/src/api/controllers/public/tables.ts +56 -0
- package/src/api/controllers/public/users.ts +82 -0
- package/src/api/controllers/public/utils.ts +38 -0
- package/src/api/controllers/row/ExternalRequest.ts +1 -1
- package/src/api/controllers/row/internal.js +4 -0
- package/src/api/controllers/table/index.js +2 -1
- package/src/api/controllers/webhook.js +3 -6
- package/src/api/index.js +4 -1
- package/src/api/routes/automation.js +3 -33
- package/src/api/routes/datasource.js +6 -52
- package/src/api/routes/index.js +2 -0
- package/src/api/routes/permission.js +4 -18
- package/src/api/routes/public/applications.ts +156 -0
- package/src/api/routes/public/index.ts +118 -0
- package/src/api/routes/public/middleware/mapper.ts +81 -0
- package/src/api/routes/public/queries.ts +81 -0
- package/src/api/routes/public/rows.ts +242 -0
- package/src/api/routes/public/tables.ts +169 -0
- package/src/api/routes/public/tests/compare.spec.js +184 -0
- package/src/api/routes/public/users.ts +144 -0
- package/src/api/routes/public/utils/Endpoint.ts +51 -0
- package/src/api/routes/role.js +3 -24
- package/src/api/routes/row.js +3 -2
- package/src/api/routes/screen.js +2 -29
- package/src/api/routes/table.js +4 -19
- package/src/api/routes/tests/utilities/index.js +24 -0
- package/src/api/routes/utils/validators.js +219 -0
- package/src/api/routes/webhook.js +2 -18
- package/src/automations/steps/filter.js +3 -2
- package/src/automations/steps/queryRows.js +1 -1
- package/src/automations/utils.js +2 -2
- package/src/constants/index.js +4 -0
- package/src/db/utils.js +12 -0
- package/src/definitions/common.ts +4 -0
- package/src/definitions/openapi.ts +943 -0
- package/src/environment.js +1 -0
- package/src/integrations/base/datasourcePlus.ts +3 -0
- package/src/integrations/googlesheets.ts +5 -2
- package/src/integrations/microsoftSqlServer.ts +38 -33
- package/src/integrations/mysql.ts +4 -0
- package/src/integrations/oracle.ts +27 -35
- package/src/integrations/postgres.ts +33 -26
- package/src/tests/utilities/TestConfiguration.js +23 -2
- package/src/threads/query.js +37 -9
- package/src/utilities/workerRequests.js +65 -16
- package/builder/assets/index.f28c5d54.js +0 -1352
- package/scripts/proxy/generateProxyConfig.js +0 -70
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import mapping from "../../../controllers/public/mapping"
|
|
2
|
+
|
|
3
|
+
enum Resources {
|
|
4
|
+
APPLICATION = "applications",
|
|
5
|
+
TABLES = "tables",
|
|
6
|
+
ROWS = "rows",
|
|
7
|
+
USERS = "users",
|
|
8
|
+
QUERIES = "queries",
|
|
9
|
+
SEARCH = "search",
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function isArrayResponse(ctx: any) {
|
|
13
|
+
return ctx.url.endsWith(Resources.SEARCH) || Array.isArray(ctx.body)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function processApplications(ctx: any) {
|
|
17
|
+
if (isArrayResponse(ctx)) {
|
|
18
|
+
return mapping.mapApplications(ctx)
|
|
19
|
+
} else {
|
|
20
|
+
return mapping.mapApplication(ctx)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function processTables(ctx: any) {
|
|
25
|
+
if (isArrayResponse(ctx)) {
|
|
26
|
+
return mapping.mapTables(ctx)
|
|
27
|
+
} else {
|
|
28
|
+
return mapping.mapTable(ctx)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function processRows(ctx: any) {
|
|
33
|
+
if (isArrayResponse(ctx)) {
|
|
34
|
+
return mapping.mapRowSearch(ctx)
|
|
35
|
+
} else {
|
|
36
|
+
return mapping.mapRow(ctx)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function processUsers(ctx: any) {
|
|
41
|
+
if (isArrayResponse(ctx)) {
|
|
42
|
+
return mapping.mapUsers(ctx)
|
|
43
|
+
} else {
|
|
44
|
+
return mapping.mapUser(ctx)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function processQueries(ctx: any) {
|
|
49
|
+
if (isArrayResponse(ctx)) {
|
|
50
|
+
return mapping.mapQueries(ctx)
|
|
51
|
+
} else {
|
|
52
|
+
return mapping.mapQueryExecution(ctx)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default async (ctx: any, next: any) => {
|
|
57
|
+
let urlParts = ctx.url.split("/")
|
|
58
|
+
urlParts = urlParts.slice(4, urlParts.length)
|
|
59
|
+
let body = {}
|
|
60
|
+
switch (urlParts[0]) {
|
|
61
|
+
case Resources.APPLICATION:
|
|
62
|
+
body = processApplications(ctx)
|
|
63
|
+
break
|
|
64
|
+
case Resources.TABLES:
|
|
65
|
+
if (urlParts[2] === Resources.ROWS) {
|
|
66
|
+
body = processRows(ctx)
|
|
67
|
+
} else {
|
|
68
|
+
body = processTables(ctx)
|
|
69
|
+
}
|
|
70
|
+
break
|
|
71
|
+
case Resources.USERS:
|
|
72
|
+
body = processUsers(ctx)
|
|
73
|
+
break
|
|
74
|
+
case Resources.QUERIES:
|
|
75
|
+
body = processQueries(ctx)
|
|
76
|
+
break
|
|
77
|
+
}
|
|
78
|
+
// update the body based on what has occurred in the mapper
|
|
79
|
+
ctx.body = body
|
|
80
|
+
await next()
|
|
81
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import controller from "../../controllers/public/queries"
|
|
2
|
+
import Endpoint from "./utils/Endpoint"
|
|
3
|
+
import { nameValidator } from "../utils/validators"
|
|
4
|
+
|
|
5
|
+
const read = [],
|
|
6
|
+
write = []
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @openapi
|
|
10
|
+
* /queries/{queryId}:
|
|
11
|
+
* post:
|
|
12
|
+
* summary: Execute a query
|
|
13
|
+
* description: Queries which have been created within a Budibase app can be executed using this,
|
|
14
|
+
* tags:
|
|
15
|
+
* - queries
|
|
16
|
+
* parameters:
|
|
17
|
+
* - $ref: '#/components/parameters/queryId'
|
|
18
|
+
* - $ref: '#/components/parameters/appId'
|
|
19
|
+
* requestBody:
|
|
20
|
+
* required: true
|
|
21
|
+
* content:
|
|
22
|
+
* application/json:
|
|
23
|
+
* schema:
|
|
24
|
+
* $ref: '#/components/schemas/executeQuery'
|
|
25
|
+
* responses:
|
|
26
|
+
* 200:
|
|
27
|
+
* description: Returns the result of the query execution.
|
|
28
|
+
* content:
|
|
29
|
+
* application/json:
|
|
30
|
+
* schema:
|
|
31
|
+
* $ref: '#/components/schemas/executeQueryOutput'
|
|
32
|
+
* examples:
|
|
33
|
+
* REST:
|
|
34
|
+
* $ref: '#/components/examples/restResponse'
|
|
35
|
+
* SQL:
|
|
36
|
+
* $ref: '#/components/examples/sqlResponse'
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
write.push(new Endpoint("post", "/queries/:queryId", controller.execute))
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @openapi
|
|
43
|
+
* /queries/search:
|
|
44
|
+
* post:
|
|
45
|
+
* summary: Search for queries
|
|
46
|
+
* description: Based on query properties (currently only name) search for queries.
|
|
47
|
+
* tags:
|
|
48
|
+
* - queries
|
|
49
|
+
* parameters:
|
|
50
|
+
* - $ref: '#/components/parameters/appId'
|
|
51
|
+
* requestBody:
|
|
52
|
+
* required: true
|
|
53
|
+
* content:
|
|
54
|
+
* application/json:
|
|
55
|
+
* schema:
|
|
56
|
+
* $ref: '#/components/schemas/nameSearch'
|
|
57
|
+
* responses:
|
|
58
|
+
* 200:
|
|
59
|
+
* description: Returns the queries found based on the search parameters.
|
|
60
|
+
* content:
|
|
61
|
+
* application/json:
|
|
62
|
+
* schema:
|
|
63
|
+
* type: object
|
|
64
|
+
* required:
|
|
65
|
+
* - data
|
|
66
|
+
* properties:
|
|
67
|
+
* data:
|
|
68
|
+
* type: array
|
|
69
|
+
* items:
|
|
70
|
+
* $ref: '#/components/schemas/query'
|
|
71
|
+
* examples:
|
|
72
|
+
* queries:
|
|
73
|
+
* $ref: '#/components/examples/queries'
|
|
74
|
+
*/
|
|
75
|
+
read.push(
|
|
76
|
+
new Endpoint("post", "/queries/search", controller.search).addMiddleware(
|
|
77
|
+
nameValidator()
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
export default { read, write }
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import controller from "../../controllers/public/rows"
|
|
2
|
+
import Endpoint from "./utils/Endpoint"
|
|
3
|
+
import { externalSearchValidator } from "../utils/validators"
|
|
4
|
+
|
|
5
|
+
const read = [],
|
|
6
|
+
write = []
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @openapi
|
|
10
|
+
* /tables/{tableId}/rows:
|
|
11
|
+
* post:
|
|
12
|
+
* summary: Create a row
|
|
13
|
+
* description: Creates a row within the specified table.
|
|
14
|
+
* tags:
|
|
15
|
+
* - rows
|
|
16
|
+
* parameters:
|
|
17
|
+
* - $ref: '#/components/parameters/tableId'
|
|
18
|
+
* - $ref: '#/components/parameters/appId'
|
|
19
|
+
* requestBody:
|
|
20
|
+
* required: true
|
|
21
|
+
* content:
|
|
22
|
+
* application/json:
|
|
23
|
+
* schema:
|
|
24
|
+
* $ref: '#/components/schemas/row'
|
|
25
|
+
* examples:
|
|
26
|
+
* row:
|
|
27
|
+
* $ref: '#/components/examples/inputRow'
|
|
28
|
+
* responses:
|
|
29
|
+
* 200:
|
|
30
|
+
* description: Returns the created row, including the ID which has been generated for it.
|
|
31
|
+
* This can be found in the Budibase portal, viewed under the developer information.
|
|
32
|
+
* content:
|
|
33
|
+
* application/json:
|
|
34
|
+
* schema:
|
|
35
|
+
* $ref: '#/components/schemas/rowOutput'
|
|
36
|
+
* examples:
|
|
37
|
+
* row:
|
|
38
|
+
* $ref: '#/components/examples/row'
|
|
39
|
+
*/
|
|
40
|
+
write.push(new Endpoint("post", "/tables/:tableId/rows", controller.create))
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @openapi
|
|
44
|
+
* /tables/{tableId}/rows/{rowId}:
|
|
45
|
+
* put:
|
|
46
|
+
* summary: Update a row
|
|
47
|
+
* description: Updates a row within the specified table.
|
|
48
|
+
* tags:
|
|
49
|
+
* - rows
|
|
50
|
+
* parameters:
|
|
51
|
+
* - $ref: '#/components/parameters/tableId'
|
|
52
|
+
* - $ref: '#/components/parameters/rowId'
|
|
53
|
+
* - $ref: '#/components/parameters/appId'
|
|
54
|
+
* requestBody:
|
|
55
|
+
* required: true
|
|
56
|
+
* content:
|
|
57
|
+
* application/json:
|
|
58
|
+
* schema:
|
|
59
|
+
* $ref: '#/components/schemas/row'
|
|
60
|
+
* examples:
|
|
61
|
+
* row:
|
|
62
|
+
* $ref: '#/components/examples/inputRow'
|
|
63
|
+
* responses:
|
|
64
|
+
* 200:
|
|
65
|
+
* description: Returns the created row, including the ID which has been generated for it.
|
|
66
|
+
* content:
|
|
67
|
+
* application/json:
|
|
68
|
+
* schema:
|
|
69
|
+
* $ref: '#/components/schemas/rowOutput'
|
|
70
|
+
* examples:
|
|
71
|
+
* row:
|
|
72
|
+
* $ref: '#/components/examples/row'
|
|
73
|
+
*/
|
|
74
|
+
write.push(
|
|
75
|
+
new Endpoint("put", "/tables/:tableId/rows/:rowId", controller.update)
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @openapi
|
|
80
|
+
* /tables/{tableId}/rows/{rowId}:
|
|
81
|
+
* delete:
|
|
82
|
+
* summary: Delete a row
|
|
83
|
+
* description: Deletes a row within the specified table.
|
|
84
|
+
* tags:
|
|
85
|
+
* - rows
|
|
86
|
+
* parameters:
|
|
87
|
+
* - $ref: '#/components/parameters/tableId'
|
|
88
|
+
* - $ref: '#/components/parameters/rowId'
|
|
89
|
+
* - $ref: '#/components/parameters/appId'
|
|
90
|
+
* responses:
|
|
91
|
+
* 200:
|
|
92
|
+
* description: Returns the deleted row, including the ID which has been generated for it.
|
|
93
|
+
* content:
|
|
94
|
+
* application/json:
|
|
95
|
+
* schema:
|
|
96
|
+
* $ref: '#/components/schemas/rowOutput'
|
|
97
|
+
* examples:
|
|
98
|
+
* row:
|
|
99
|
+
* $ref: '#/components/examples/row'
|
|
100
|
+
*/
|
|
101
|
+
write.push(
|
|
102
|
+
new Endpoint("delete", "/tables/:tableId/rows/:rowId", controller.destroy)
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @openapi
|
|
107
|
+
* /tables/{tableId}/rows/{rowId}:
|
|
108
|
+
* get:
|
|
109
|
+
* summary: Retrieve a row
|
|
110
|
+
* description: This gets a single row, it will be enriched with the full related rows, rather than
|
|
111
|
+
* the squashed "primaryDisplay" format returned by the search endpoint.
|
|
112
|
+
* tags:
|
|
113
|
+
* - rows
|
|
114
|
+
* parameters:
|
|
115
|
+
* - $ref: '#/components/parameters/tableId'
|
|
116
|
+
* - $ref: '#/components/parameters/rowId'
|
|
117
|
+
* - $ref: '#/components/parameters/appId'
|
|
118
|
+
* responses:
|
|
119
|
+
* 200:
|
|
120
|
+
* description: Returns the retrieved row.
|
|
121
|
+
* content:
|
|
122
|
+
* application/json:
|
|
123
|
+
* schema:
|
|
124
|
+
* $ref: '#/components/schemas/rowOutput'
|
|
125
|
+
* examples:
|
|
126
|
+
* enrichedRow:
|
|
127
|
+
* $ref: '#/components/examples/enrichedRow'
|
|
128
|
+
*/
|
|
129
|
+
read.push(new Endpoint("get", "/tables/:tableId/rows/:rowId", controller.read))
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @openapi
|
|
133
|
+
* /tables/{tableId}/rows/search:
|
|
134
|
+
* post:
|
|
135
|
+
* summary: Search for rows
|
|
136
|
+
* tags:
|
|
137
|
+
* - rows
|
|
138
|
+
* parameters:
|
|
139
|
+
* - $ref: '#/components/parameters/tableId'
|
|
140
|
+
* - $ref: '#/components/parameters/appId'
|
|
141
|
+
* requestBody:
|
|
142
|
+
* required: true
|
|
143
|
+
* content:
|
|
144
|
+
* application/json:
|
|
145
|
+
* schema:
|
|
146
|
+
* type: object
|
|
147
|
+
* required:
|
|
148
|
+
* - query
|
|
149
|
+
* properties:
|
|
150
|
+
* query:
|
|
151
|
+
* type: object
|
|
152
|
+
* properties:
|
|
153
|
+
* string:
|
|
154
|
+
* type: object
|
|
155
|
+
* example:
|
|
156
|
+
* columnName1: value
|
|
157
|
+
* columnName2: value
|
|
158
|
+
* description: A map of field name to the string to search for,
|
|
159
|
+
* this will look for rows that have a value starting with the
|
|
160
|
+
* string value.
|
|
161
|
+
* additionalProperties:
|
|
162
|
+
* type: string
|
|
163
|
+
* description: The value to search for in the column.
|
|
164
|
+
* fuzzy:
|
|
165
|
+
* type: object
|
|
166
|
+
* description: A fuzzy search, only supported by internal tables.
|
|
167
|
+
* range:
|
|
168
|
+
* type: object
|
|
169
|
+
* description: Searches within a range, the format of this must be
|
|
170
|
+
* columnName -> [low, high].
|
|
171
|
+
* example:
|
|
172
|
+
* columnName1: [10, 20]
|
|
173
|
+
* equal:
|
|
174
|
+
* type: object
|
|
175
|
+
* description: Searches for rows that have a column value that is
|
|
176
|
+
* exactly the value set.
|
|
177
|
+
* notEqual:
|
|
178
|
+
* type: object
|
|
179
|
+
* description: Searches for any row which does not contain the specified
|
|
180
|
+
* column value.
|
|
181
|
+
* empty:
|
|
182
|
+
* type: object
|
|
183
|
+
* description: Searches for rows which do not contain the specified column.
|
|
184
|
+
* The object should simply contain keys of the column names, these
|
|
185
|
+
* can map to any value.
|
|
186
|
+
* example:
|
|
187
|
+
* columnName1: ""
|
|
188
|
+
* notEmpty:
|
|
189
|
+
* type: object
|
|
190
|
+
* description: Searches for rows which have the specified column.
|
|
191
|
+
* oneOf:
|
|
192
|
+
* type: object
|
|
193
|
+
* description: Searches for rows which have a column value that is any
|
|
194
|
+
* of the specified values. The format of this must be columnName -> [value1, value2].
|
|
195
|
+
* paginate:
|
|
196
|
+
* type: boolean
|
|
197
|
+
* description: Enables pagination, by default this is disabled.
|
|
198
|
+
* bookmark:
|
|
199
|
+
* oneOf:
|
|
200
|
+
* - type: string
|
|
201
|
+
* - type: integer
|
|
202
|
+
* description: If retrieving another page, the bookmark from the previous request must be supplied.
|
|
203
|
+
* limit:
|
|
204
|
+
* type: integer
|
|
205
|
+
* description: The maximum number of rows to return, useful when paginating, for internal tables this
|
|
206
|
+
* will be limited to 1000, for SQL tables it will be 5000.
|
|
207
|
+
* sort:
|
|
208
|
+
* type: object
|
|
209
|
+
* description: A set of parameters describing the sort behaviour of the search.
|
|
210
|
+
* properties:
|
|
211
|
+
* order:
|
|
212
|
+
* type: string
|
|
213
|
+
* enum: [ascending, descending]
|
|
214
|
+
* description: The order of the sort, by default this is ascending.
|
|
215
|
+
* column:
|
|
216
|
+
* type: string
|
|
217
|
+
* description: The name of the column by which the rows will be sorted.
|
|
218
|
+
* type:
|
|
219
|
+
* type: string
|
|
220
|
+
* enum: [string, number]
|
|
221
|
+
* description: Defines whether the column should be treated as a string
|
|
222
|
+
* or as numbers when sorting.
|
|
223
|
+
* responses:
|
|
224
|
+
* 200:
|
|
225
|
+
* description: The response will contain an array of rows that match the search parameters.
|
|
226
|
+
* content:
|
|
227
|
+
* application/json:
|
|
228
|
+
* schema:
|
|
229
|
+
* $ref: '#/components/schemas/searchOutput'
|
|
230
|
+
* examples:
|
|
231
|
+
* search:
|
|
232
|
+
* $ref: '#/components/examples/rows'
|
|
233
|
+
*/
|
|
234
|
+
read.push(
|
|
235
|
+
new Endpoint(
|
|
236
|
+
"post",
|
|
237
|
+
"/tables/:tableId/rows/search",
|
|
238
|
+
controller.search
|
|
239
|
+
).addMiddleware(externalSearchValidator())
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
export default { read, write }
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import controller from "../../controllers/public/tables"
|
|
2
|
+
import Endpoint from "./utils/Endpoint"
|
|
3
|
+
import { tableValidator, nameValidator } from "../utils/validators"
|
|
4
|
+
|
|
5
|
+
const read = [],
|
|
6
|
+
write = []
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @openapi
|
|
10
|
+
* /tables:
|
|
11
|
+
* post:
|
|
12
|
+
* summary: Create a table
|
|
13
|
+
* description: Create a table, this could be internal or external.
|
|
14
|
+
* tags:
|
|
15
|
+
* - tables
|
|
16
|
+
* parameters:
|
|
17
|
+
* - $ref: '#/components/parameters/appId'
|
|
18
|
+
* requestBody:
|
|
19
|
+
* content:
|
|
20
|
+
* application/json:
|
|
21
|
+
* schema:
|
|
22
|
+
* $ref: '#/components/schemas/table'
|
|
23
|
+
* examples:
|
|
24
|
+
* table:
|
|
25
|
+
* $ref: '#/components/examples/table'
|
|
26
|
+
* responses:
|
|
27
|
+
* 200:
|
|
28
|
+
* description: Returns the created table, including the ID which has been generated for it. This can be
|
|
29
|
+
* internal or external data sources.
|
|
30
|
+
* content:
|
|
31
|
+
* application/json:
|
|
32
|
+
* schema:
|
|
33
|
+
* $ref: '#/components/schemas/tableOutput'
|
|
34
|
+
* examples:
|
|
35
|
+
* table:
|
|
36
|
+
* $ref: '#/components/examples/table'
|
|
37
|
+
*/
|
|
38
|
+
write.push(
|
|
39
|
+
new Endpoint("post", "/tables", controller.create).addMiddleware(
|
|
40
|
+
tableValidator()
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @openapi
|
|
46
|
+
* /tables/{tableId}:
|
|
47
|
+
* put:
|
|
48
|
+
* summary: Update a table
|
|
49
|
+
* description: Update a table, this could be internal or external.
|
|
50
|
+
* tags:
|
|
51
|
+
* - tables
|
|
52
|
+
* parameters:
|
|
53
|
+
* - $ref: '#/components/parameters/tableId'
|
|
54
|
+
* - $ref: '#/components/parameters/appId'
|
|
55
|
+
* requestBody:
|
|
56
|
+
* content:
|
|
57
|
+
* application/json:
|
|
58
|
+
* schema:
|
|
59
|
+
* $ref: '#/components/schemas/table'
|
|
60
|
+
* examples:
|
|
61
|
+
* table:
|
|
62
|
+
* $ref: '#/components/examples/table'
|
|
63
|
+
* responses:
|
|
64
|
+
* 200:
|
|
65
|
+
* description: Returns the updated table.
|
|
66
|
+
* content:
|
|
67
|
+
* application/json:
|
|
68
|
+
* schema:
|
|
69
|
+
* $ref: '#/components/schemas/tableOutput'
|
|
70
|
+
* examples:
|
|
71
|
+
* table:
|
|
72
|
+
* $ref: '#/components/examples/table'
|
|
73
|
+
*/
|
|
74
|
+
write.push(
|
|
75
|
+
new Endpoint("put", "/tables/:tableId", controller.update).addMiddleware(
|
|
76
|
+
tableValidator()
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @openapi
|
|
82
|
+
* /tables/{tableId}:
|
|
83
|
+
* delete:
|
|
84
|
+
* summary: Delete a table
|
|
85
|
+
* description: Delete a table, this could be internal or external.
|
|
86
|
+
* tags:
|
|
87
|
+
* - tables
|
|
88
|
+
* parameters:
|
|
89
|
+
* - $ref: '#/components/parameters/tableId'
|
|
90
|
+
* - $ref: '#/components/parameters/appId'
|
|
91
|
+
* responses:
|
|
92
|
+
* 200:
|
|
93
|
+
* description: Returns the deleted table.
|
|
94
|
+
* content:
|
|
95
|
+
* application/json:
|
|
96
|
+
* schema:
|
|
97
|
+
* $ref: '#/components/schemas/tableOutput'
|
|
98
|
+
* examples:
|
|
99
|
+
* table:
|
|
100
|
+
* $ref: '#/components/examples/table'
|
|
101
|
+
*/
|
|
102
|
+
write.push(new Endpoint("delete", "/tables/:tableId", controller.destroy))
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @openapi
|
|
106
|
+
* /tables/{tableId}:
|
|
107
|
+
* get:
|
|
108
|
+
* summary: Retrieve a table
|
|
109
|
+
* description: Lookup a table, this could be internal or external.
|
|
110
|
+
* tags:
|
|
111
|
+
* - tables
|
|
112
|
+
* parameters:
|
|
113
|
+
* - $ref: '#/components/parameters/tableId'
|
|
114
|
+
* - $ref: '#/components/parameters/appId'
|
|
115
|
+
* responses:
|
|
116
|
+
* 200:
|
|
117
|
+
* description: Returns the retrieved table.
|
|
118
|
+
* content:
|
|
119
|
+
* application/json:
|
|
120
|
+
* schema:
|
|
121
|
+
* $ref: '#/components/schemas/tableOutput'
|
|
122
|
+
* examples:
|
|
123
|
+
* table:
|
|
124
|
+
* $ref: '#/components/examples/table'
|
|
125
|
+
*/
|
|
126
|
+
read.push(new Endpoint("get", "/tables/:tableId", controller.read))
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @openapi
|
|
130
|
+
* /tables/search:
|
|
131
|
+
* post:
|
|
132
|
+
* summary: Search for tables
|
|
133
|
+
* description: Based on table properties (currently only name) search for tables. This could be
|
|
134
|
+
* an internal or an external table.
|
|
135
|
+
* tags:
|
|
136
|
+
* - tables
|
|
137
|
+
* parameters:
|
|
138
|
+
* - $ref: '#/components/parameters/appId'
|
|
139
|
+
* requestBody:
|
|
140
|
+
* required: true
|
|
141
|
+
* content:
|
|
142
|
+
* application/json:
|
|
143
|
+
* schema:
|
|
144
|
+
* $ref: '#/components/schemas/nameSearch'
|
|
145
|
+
* responses:
|
|
146
|
+
* 200:
|
|
147
|
+
* description: Returns the found tables, based on the search parameters.
|
|
148
|
+
* content:
|
|
149
|
+
* application/json:
|
|
150
|
+
* schema:
|
|
151
|
+
* type: object
|
|
152
|
+
* required:
|
|
153
|
+
* - data
|
|
154
|
+
* properties:
|
|
155
|
+
* data:
|
|
156
|
+
* type: array
|
|
157
|
+
* items:
|
|
158
|
+
* $ref: '#/components/schemas/table'
|
|
159
|
+
* examples:
|
|
160
|
+
* tables:
|
|
161
|
+
* $ref: '#/components/examples/tables'
|
|
162
|
+
*/
|
|
163
|
+
read.push(
|
|
164
|
+
new Endpoint("post", "/tables/search", controller.search).addMiddleware(
|
|
165
|
+
nameValidator()
|
|
166
|
+
)
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
export default { read, write }
|