@budibase/server 1.0.80-alpha.1 → 1.0.80
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 +0 -1
- package/builder/assets/index.22a39cc9.js +1352 -0
- package/builder/assets/{index.c57242d4.css → index.c8d1e8f0.css} +2 -2
- package/builder/assets/{vendor.a7c6ad0a.js → vendor.20f80cec.js} +216 -190
- package/builder/index.html +3 -3
- package/coverage/clover.xml +2327 -2390
- package/coverage/coverage-final.json +137 -138
- 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 +149 -152
- 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 +82 -94
- 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 +44 -47
- 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 +27 -18
- package/coverage/lcov-report/api/index.html +10 -10
- package/coverage/lcov-report/api/index.js.html +28 -37
- 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 +109 -19
- 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 +156 -18
- 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 +32 -38
- 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 +58 -16
- package/coverage/lcov-report/api/routes/query.js.html +10 -10
- package/coverage/lcov-report/api/routes/role.js.html +78 -15
- package/coverage/lcov-report/api/routes/routing.js.html +8 -8
- package/coverage/lcov-report/api/routes/row.js.html +14 -17
- package/coverage/lcov-report/api/routes/screen.js.html +95 -14
- 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 +62 -17
- 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/view.js.html +10 -10
- package/coverage/lcov-report/api/routes/webhook.js.html +62 -14
- 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 +9 -12
- 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 +28 -40
- 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 +87 -123
- 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 +74 -89
- 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 +39 -123
- 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 +53 -200
- package/coverage/lcov.info +3233 -3332
- package/dist/api/controllers/application.js +0 -1
- package/dist/api/controllers/row/internal.js +1 -4
- package/dist/api/controllers/table/index.js +1 -2
- package/dist/api/controllers/webhook.js +5 -3
- package/dist/api/index.js +1 -3
- package/dist/api/routes/automation.js +31 -3
- package/dist/api/routes/datasource.js +50 -3
- package/dist/api/routes/index.js +0 -2
- package/dist/api/routes/permission.js +14 -4
- package/dist/api/routes/role.js +19 -3
- package/dist/api/routes/row.js +4 -3
- package/dist/api/routes/screen.js +23 -2
- package/dist/api/routes/table.js +17 -3
- package/dist/api/routes/tests/utilities/index.js +0 -23
- package/dist/api/routes/webhook.js +17 -2
- 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 +0 -3
- package/dist/db/utils.js +0 -11
- package/dist/environment.js +0 -1
- package/dist/integrations/googlesheets.js +0 -3
- package/dist/integrations/microsoftSqlServer.js +29 -35
- package/dist/integrations/mysql.js +0 -3
- package/dist/integrations/oracle.js +19 -14
- package/dist/integrations/postgres.js +28 -34
- package/dist/package.json +7 -11
- package/dist/tests/utilities/TestConfiguration.js +8 -25
- package/dist/threads/query.js +8 -33
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/workerRequests.js +15 -50
- package/package.json +8 -12
- package/scripts/integrations/oracle/oracle.md +2 -2
- package/scripts/integrations/postgres/init.sql +3 -5
- package/scripts/likeCypress.ts +6 -9
- package/scripts/proxy/generateProxyConfig.js +70 -0
- package/src/api/controllers/application.js +0 -1
- package/src/api/controllers/row/ExternalRequest.ts +1 -1
- package/src/api/controllers/row/internal.js +0 -4
- package/src/api/controllers/table/index.js +1 -2
- package/src/api/controllers/webhook.js +6 -3
- package/src/api/index.js +1 -4
- package/src/api/routes/automation.js +33 -3
- package/src/api/routes/datasource.js +52 -6
- package/src/api/routes/index.js +0 -2
- package/src/api/routes/permission.js +18 -4
- package/src/api/routes/role.js +24 -3
- package/src/api/routes/row.js +2 -3
- package/src/api/routes/screen.js +29 -2
- package/src/api/routes/table.js +19 -4
- package/src/api/routes/tests/utilities/index.js +0 -24
- package/src/api/routes/webhook.js +18 -2
- package/src/automations/steps/filter.js +2 -3
- package/src/automations/steps/queryRows.js +1 -1
- package/src/automations/utils.js +2 -2
- package/src/constants/index.js +0 -4
- package/src/db/utils.js +0 -12
- package/src/definitions/common.ts +0 -4
- package/src/environment.js +0 -1
- package/src/integrations/base/datasourcePlus.ts +0 -3
- package/src/integrations/googlesheets.ts +2 -5
- package/src/integrations/microsoftSqlServer.ts +33 -38
- package/src/integrations/mysql.ts +0 -4
- package/src/integrations/oracle.ts +35 -27
- package/src/integrations/postgres.ts +26 -33
- package/src/tests/utilities/TestConfiguration.js +2 -23
- package/src/threads/query.js +9 -37
- package/src/utilities/workerRequests.js +16 -65
- package/builder/assets/index.c0b657be.js +0 -1288
- package/coverage/lcov-report/api/routes/utils/index.html +0 -111
- package/coverage/lcov-report/api/routes/utils/validators.js.html +0 -737
- package/dist/api/controllers/public/applications.js +0 -94
- package/dist/api/controllers/public/mapping/applications.js +0 -29
- package/dist/api/controllers/public/mapping/index.js +0 -11
- package/dist/api/controllers/public/mapping/queries.js +0 -36
- package/dist/api/controllers/public/mapping/rows.js +0 -24
- package/dist/api/controllers/public/mapping/tables.js +0 -23
- package/dist/api/controllers/public/mapping/types.js +0 -2
- package/dist/api/controllers/public/mapping/users.js +0 -29
- package/dist/api/controllers/public/queries.js +0 -38
- package/dist/api/controllers/public/rows.js +0 -97
- package/dist/api/controllers/public/tables.js +0 -75
- package/dist/api/controllers/public/users.js +0 -95
- package/dist/api/controllers/public/utils.js +0 -49
- package/dist/api/routes/public/applications.js +0 -141
- package/dist/api/routes/public/index.js +0 -101
- package/dist/api/routes/public/middleware/mapper.js +0 -94
- package/dist/api/routes/public/queries.js +0 -77
- package/dist/api/routes/public/rows.js +0 -229
- package/dist/api/routes/public/tables.js +0 -154
- package/dist/api/routes/public/users.js +0 -137
- package/dist/api/routes/public/utils/Endpoint.js +0 -36
- package/dist/api/routes/utils/validators.js +0 -200
- package/dist/definitions/openapi.js +0 -6
- package/specs/generate.js +0 -83
- package/specs/openapi.json +0 -2222
- package/specs/openapi.yaml +0 -1530
- package/specs/parameters.js +0 -59
- package/specs/resources/application.js +0 -101
- package/specs/resources/index.js +0 -24
- package/specs/resources/misc.js +0 -12
- package/specs/resources/query.js +0 -189
- package/specs/resources/row.js +0 -125
- package/specs/resources/table.js +0 -191
- package/specs/resources/user.js +0 -126
- package/specs/resources/utils/Resource.js +0 -26
- package/specs/resources/utils/index.js +0 -11
- package/specs/security.js +0 -7
- package/src/api/controllers/public/applications.ts +0 -74
- package/src/api/controllers/public/mapping/applications.ts +0 -32
- package/src/api/controllers/public/mapping/index.ts +0 -13
- package/src/api/controllers/public/mapping/queries.ts +0 -39
- package/src/api/controllers/public/mapping/rows.ts +0 -31
- package/src/api/controllers/public/mapping/tables.ts +0 -26
- package/src/api/controllers/public/mapping/types.ts +0 -13
- package/src/api/controllers/public/mapping/users.ts +0 -32
- package/src/api/controllers/public/queries.ts +0 -20
- package/src/api/controllers/public/rows.ts +0 -77
- package/src/api/controllers/public/tables.ts +0 -56
- package/src/api/controllers/public/users.ts +0 -82
- package/src/api/controllers/public/utils.ts +0 -38
- package/src/api/routes/public/applications.ts +0 -156
- package/src/api/routes/public/index.ts +0 -118
- package/src/api/routes/public/middleware/mapper.ts +0 -81
- package/src/api/routes/public/queries.ts +0 -81
- package/src/api/routes/public/rows.ts +0 -242
- package/src/api/routes/public/tables.ts +0 -169
- package/src/api/routes/public/tests/compare.spec.js +0 -184
- package/src/api/routes/public/users.ts +0 -144
- package/src/api/routes/public/utils/Endpoint.ts +0 -51
- package/src/api/routes/utils/validators.js +0 -219
- package/src/definitions/openapi.ts +0 -943
|
@@ -1,242 +0,0 @@
|
|
|
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 }
|
|
@@ -1,169 +0,0 @@
|
|
|
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 }
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
const jestOpenAPI = require("jest-openapi").default
|
|
2
|
-
const generateSchema = require("../../../../../specs/generate")
|
|
3
|
-
const setup = require("../../tests/utilities")
|
|
4
|
-
const { checkSlashesInUrl } = require("../../../../utilities")
|
|
5
|
-
|
|
6
|
-
const yamlPath = generateSchema()
|
|
7
|
-
jestOpenAPI(yamlPath)
|
|
8
|
-
|
|
9
|
-
let request = setup.getRequest()
|
|
10
|
-
let config = setup.getConfig()
|
|
11
|
-
let apiKey, table, app
|
|
12
|
-
|
|
13
|
-
beforeAll(async () => {
|
|
14
|
-
app = await config.init()
|
|
15
|
-
table = await config.updateTable()
|
|
16
|
-
apiKey = await config.generateApiKey()
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
afterAll(setup.afterAll)
|
|
20
|
-
|
|
21
|
-
async function makeRequest(method, endpoint, body, appId = config.getAppId()) {
|
|
22
|
-
const extraHeaders = {
|
|
23
|
-
"x-budibase-api-key": apiKey,
|
|
24
|
-
}
|
|
25
|
-
if (appId) {
|
|
26
|
-
extraHeaders["x-budibase-app-id"] = appId
|
|
27
|
-
}
|
|
28
|
-
const req = request
|
|
29
|
-
[method](checkSlashesInUrl(`/api/public/v1/${endpoint}`))
|
|
30
|
-
.set(config.defaultHeaders(extraHeaders))
|
|
31
|
-
if (body) {
|
|
32
|
-
req.send(body)
|
|
33
|
-
}
|
|
34
|
-
const res = await req.expect("Content-Type", /json/).expect(200)
|
|
35
|
-
expect(res.body).toBeDefined()
|
|
36
|
-
return res
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
describe("check the applications endpoints", () => {
|
|
40
|
-
it("should allow retrieving applications through search", async () => {
|
|
41
|
-
const res = await makeRequest("post", "/applications/search")
|
|
42
|
-
expect(res).toSatisfyApiSpec()
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it("should allow creating an application", async () => {
|
|
46
|
-
const res = await makeRequest("post", "/applications", {
|
|
47
|
-
name: "new App"
|
|
48
|
-
}, null)
|
|
49
|
-
expect(res).toSatisfyApiSpec()
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it("should allow updating an application", async () => {
|
|
53
|
-
const app = config.getApp()
|
|
54
|
-
const appId = config.getAppId()
|
|
55
|
-
const res = await makeRequest("put", `/applications/${appId}`, {
|
|
56
|
-
...app,
|
|
57
|
-
name: "updated app name",
|
|
58
|
-
}, appId)
|
|
59
|
-
expect(res).toSatisfyApiSpec()
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
it("should allow retrieving an application", async () => {
|
|
63
|
-
const res = await makeRequest("get", `/applications/${config.getAppId()}`)
|
|
64
|
-
expect(res).toSatisfyApiSpec()
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
it("should allow deleting an application", async () => {
|
|
68
|
-
const res = await makeRequest("delete", `/applications/${config.getAppId()}`)
|
|
69
|
-
expect(res).toSatisfyApiSpec()
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
describe("check the tables endpoints", () => {
|
|
74
|
-
it("should allow retrieving tables through search", async () => {
|
|
75
|
-
await config.createApp("new app 1")
|
|
76
|
-
table = await config.updateTable()
|
|
77
|
-
const res = await makeRequest("post", "/tables/search")
|
|
78
|
-
expect(res).toSatisfyApiSpec()
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
it("should allow creating a table", async () => {
|
|
82
|
-
const res = await makeRequest("post", "/tables", {
|
|
83
|
-
name: "table name",
|
|
84
|
-
primaryDisplay: "column1",
|
|
85
|
-
schema: {
|
|
86
|
-
column1: {
|
|
87
|
-
type: "string",
|
|
88
|
-
constraints: {},
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
expect(res).toSatisfyApiSpec()
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
it("should allow updating a table", async () => {
|
|
96
|
-
const updated = { ...table, _rev: undefined, name: "new name" }
|
|
97
|
-
const res = await makeRequest("put", `/tables/${table._id}`, updated)
|
|
98
|
-
expect(res).toSatisfyApiSpec()
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
it("should allow retrieving a table", async () => {
|
|
102
|
-
const res = await makeRequest("get", `/tables/${table._id}`)
|
|
103
|
-
expect(res).toSatisfyApiSpec()
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
it("should allow deleting a table", async () => {
|
|
107
|
-
const res = await makeRequest("delete", `/tables/${table._id}`)
|
|
108
|
-
expect(res).toSatisfyApiSpec()
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
describe("check the rows endpoints", () => {
|
|
113
|
-
let row
|
|
114
|
-
it("should allow retrieving rows through search", async () => {
|
|
115
|
-
table = await config.updateTable()
|
|
116
|
-
const res = await makeRequest("post", `/tables/${table._id}/rows/search`, {
|
|
117
|
-
query: {
|
|
118
|
-
},
|
|
119
|
-
})
|
|
120
|
-
expect(res).toSatisfyApiSpec()
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
it("should allow creating a row", async () => {
|
|
124
|
-
const res = await makeRequest("post", `/tables/${table._id}/rows`, {
|
|
125
|
-
name: "test row",
|
|
126
|
-
})
|
|
127
|
-
expect(res).toSatisfyApiSpec()
|
|
128
|
-
row = res.body.data
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
it("should allow updating a row", async () => {
|
|
132
|
-
const res = await makeRequest("put", `/tables/${table._id}/rows/${row._id}`, {
|
|
133
|
-
name: "test row updated",
|
|
134
|
-
})
|
|
135
|
-
expect(res).toSatisfyApiSpec()
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
it("should allow retrieving a row", async () => {
|
|
139
|
-
const res = await makeRequest("get", `/tables/${table._id}/rows/${row._id}`)
|
|
140
|
-
expect(res).toSatisfyApiSpec()
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
it("should allow deleting a row", async () => {
|
|
144
|
-
const res = await makeRequest("delete", `/tables/${table._id}/rows/${row._id}`)
|
|
145
|
-
expect(res).toSatisfyApiSpec()
|
|
146
|
-
})
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
describe("check the users endpoints", () => {
|
|
150
|
-
let user
|
|
151
|
-
it("should allow retrieving users through search", async () => {
|
|
152
|
-
user = await config.createUser()
|
|
153
|
-
const res = await makeRequest("post", "/users/search")
|
|
154
|
-
expect(res).toSatisfyApiSpec()
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
it("should allow creating a user", async () => {
|
|
158
|
-
const res = await makeRequest("post", "/users")
|
|
159
|
-
expect(res).toSatisfyApiSpec()
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
it("should allow updating a user", async () => {
|
|
163
|
-
const res = await makeRequest("put", `/users/${user._id}`)
|
|
164
|
-
expect(res).toSatisfyApiSpec()
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
it("should allow retrieving a user", async () => {
|
|
168
|
-
const res = await makeRequest("get", `/users/${user._id}`)
|
|
169
|
-
expect(res).toSatisfyApiSpec()
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
it("should allow deleting a user", async () => {
|
|
173
|
-
const res = await makeRequest("delete", `/users/${user._id}`)
|
|
174
|
-
expect(res).toSatisfyApiSpec()
|
|
175
|
-
})
|
|
176
|
-
})
|
|
177
|
-
|
|
178
|
-
describe("check the queries endpoints", () => {
|
|
179
|
-
it("should allow retrieving queries through search", async () => {
|
|
180
|
-
const res = await makeRequest("post", "/queries/search")
|
|
181
|
-
expect(res).toSatisfyApiSpec()
|
|
182
|
-
})
|
|
183
|
-
})
|
|
184
|
-
|