@budibase/server 1.0.79-alpha.4 → 1.0.79-alpha.7
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.ca6b3e24.css → index.c57242d4.css} +2 -2
- package/builder/assets/index.ef62c13b.js +1288 -0
- package/builder/index.html +2 -2
- package/coverage/clover.xml +2261 -2213
- package/coverage/coverage-final.json +137 -136
- 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 +7 -7
- 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 +79 -64
- 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 +1 -1
- package/coverage/lcov-report/threads/index.js.html +10 -10
- package/coverage/lcov-report/threads/query.js.html +1 -1
- 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 +3088 -3012
- 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 +68 -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/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/package.json +8 -4
- package/dist/tests/utilities/TestConfiguration.js +25 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/workerRequests.js +50 -15
- package/package.json +9 -5
- package/scripts/integrations/postgres/init.sql +5 -3
- 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/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 +82 -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/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/tests/utilities/TestConfiguration.js +23 -2
- package/src/utilities/workerRequests.js +65 -16
- package/builder/assets/index.8bc78df5.js +0 -1287
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const rows_1 = __importDefault(require("../../controllers/public/rows"));
|
|
7
|
+
const Endpoint_1 = __importDefault(require("./utils/Endpoint"));
|
|
8
|
+
const validators_1 = require("../utils/validators");
|
|
9
|
+
const read = [], write = [];
|
|
10
|
+
/**
|
|
11
|
+
* @openapi
|
|
12
|
+
* /tables/{tableId}/rows:
|
|
13
|
+
* post:
|
|
14
|
+
* summary: Create a row
|
|
15
|
+
* description: Creates a row within the specified table.
|
|
16
|
+
* tags:
|
|
17
|
+
* - rows
|
|
18
|
+
* parameters:
|
|
19
|
+
* - $ref: '#/components/parameters/tableId'
|
|
20
|
+
* - $ref: '#/components/parameters/appId'
|
|
21
|
+
* requestBody:
|
|
22
|
+
* required: true
|
|
23
|
+
* content:
|
|
24
|
+
* application/json:
|
|
25
|
+
* schema:
|
|
26
|
+
* $ref: '#/components/schemas/row'
|
|
27
|
+
* examples:
|
|
28
|
+
* row:
|
|
29
|
+
* $ref: '#/components/examples/inputRow'
|
|
30
|
+
* responses:
|
|
31
|
+
* 200:
|
|
32
|
+
* description: Returns the created row, including the ID which has been generated for it.
|
|
33
|
+
* This can be found in the Budibase portal, viewed under the developer information.
|
|
34
|
+
* content:
|
|
35
|
+
* application/json:
|
|
36
|
+
* schema:
|
|
37
|
+
* $ref: '#/components/schemas/rowOutput'
|
|
38
|
+
* examples:
|
|
39
|
+
* row:
|
|
40
|
+
* $ref: '#/components/examples/row'
|
|
41
|
+
*/
|
|
42
|
+
write.push(new Endpoint_1.default("post", "/tables/:tableId/rows", rows_1.default.create));
|
|
43
|
+
/**
|
|
44
|
+
* @openapi
|
|
45
|
+
* /tables/{tableId}/rows/{rowId}:
|
|
46
|
+
* put:
|
|
47
|
+
* summary: Update a row
|
|
48
|
+
* description: Updates a row within the specified table.
|
|
49
|
+
* tags:
|
|
50
|
+
* - rows
|
|
51
|
+
* parameters:
|
|
52
|
+
* - $ref: '#/components/parameters/tableId'
|
|
53
|
+
* - $ref: '#/components/parameters/rowId'
|
|
54
|
+
* - $ref: '#/components/parameters/appId'
|
|
55
|
+
* requestBody:
|
|
56
|
+
* required: true
|
|
57
|
+
* content:
|
|
58
|
+
* application/json:
|
|
59
|
+
* schema:
|
|
60
|
+
* $ref: '#/components/schemas/row'
|
|
61
|
+
* examples:
|
|
62
|
+
* row:
|
|
63
|
+
* $ref: '#/components/examples/inputRow'
|
|
64
|
+
* responses:
|
|
65
|
+
* 200:
|
|
66
|
+
* description: Returns the created row, including the ID which has been generated for it.
|
|
67
|
+
* content:
|
|
68
|
+
* application/json:
|
|
69
|
+
* schema:
|
|
70
|
+
* $ref: '#/components/schemas/rowOutput'
|
|
71
|
+
* examples:
|
|
72
|
+
* row:
|
|
73
|
+
* $ref: '#/components/examples/row'
|
|
74
|
+
*/
|
|
75
|
+
write.push(new Endpoint_1.default("put", "/tables/:tableId/rows/:rowId", rows_1.default.update));
|
|
76
|
+
/**
|
|
77
|
+
* @openapi
|
|
78
|
+
* /tables/{tableId}/rows/{rowId}:
|
|
79
|
+
* delete:
|
|
80
|
+
* summary: Delete a row
|
|
81
|
+
* description: Deletes a row within the specified table.
|
|
82
|
+
* tags:
|
|
83
|
+
* - rows
|
|
84
|
+
* parameters:
|
|
85
|
+
* - $ref: '#/components/parameters/tableId'
|
|
86
|
+
* - $ref: '#/components/parameters/rowId'
|
|
87
|
+
* - $ref: '#/components/parameters/appId'
|
|
88
|
+
* responses:
|
|
89
|
+
* 200:
|
|
90
|
+
* description: Returns the deleted row, including the ID which has been generated for it.
|
|
91
|
+
* content:
|
|
92
|
+
* application/json:
|
|
93
|
+
* schema:
|
|
94
|
+
* $ref: '#/components/schemas/rowOutput'
|
|
95
|
+
* examples:
|
|
96
|
+
* row:
|
|
97
|
+
* $ref: '#/components/examples/row'
|
|
98
|
+
*/
|
|
99
|
+
write.push(new Endpoint_1.default("delete", "/tables/:tableId/rows/:rowId", rows_1.default.destroy));
|
|
100
|
+
/**
|
|
101
|
+
* @openapi
|
|
102
|
+
* /tables/{tableId}/rows/{rowId}:
|
|
103
|
+
* get:
|
|
104
|
+
* summary: Retrieve a row
|
|
105
|
+
* description: This gets a single row, it will be enriched with the full related rows, rather than
|
|
106
|
+
* the squashed "primaryDisplay" format returned by the search endpoint.
|
|
107
|
+
* tags:
|
|
108
|
+
* - rows
|
|
109
|
+
* parameters:
|
|
110
|
+
* - $ref: '#/components/parameters/tableId'
|
|
111
|
+
* - $ref: '#/components/parameters/rowId'
|
|
112
|
+
* - $ref: '#/components/parameters/appId'
|
|
113
|
+
* responses:
|
|
114
|
+
* 200:
|
|
115
|
+
* description: Returns the retrieved row.
|
|
116
|
+
* content:
|
|
117
|
+
* application/json:
|
|
118
|
+
* schema:
|
|
119
|
+
* $ref: '#/components/schemas/rowOutput'
|
|
120
|
+
* examples:
|
|
121
|
+
* enrichedRow:
|
|
122
|
+
* $ref: '#/components/examples/enrichedRow'
|
|
123
|
+
*/
|
|
124
|
+
read.push(new Endpoint_1.default("get", "/tables/:tableId/rows/:rowId", rows_1.default.read));
|
|
125
|
+
/**
|
|
126
|
+
* @openapi
|
|
127
|
+
* /tables/{tableId}/rows/search:
|
|
128
|
+
* post:
|
|
129
|
+
* summary: Search for rows
|
|
130
|
+
* tags:
|
|
131
|
+
* - rows
|
|
132
|
+
* parameters:
|
|
133
|
+
* - $ref: '#/components/parameters/tableId'
|
|
134
|
+
* - $ref: '#/components/parameters/appId'
|
|
135
|
+
* requestBody:
|
|
136
|
+
* required: true
|
|
137
|
+
* content:
|
|
138
|
+
* application/json:
|
|
139
|
+
* schema:
|
|
140
|
+
* type: object
|
|
141
|
+
* required:
|
|
142
|
+
* - query
|
|
143
|
+
* properties:
|
|
144
|
+
* query:
|
|
145
|
+
* type: object
|
|
146
|
+
* properties:
|
|
147
|
+
* string:
|
|
148
|
+
* type: object
|
|
149
|
+
* example:
|
|
150
|
+
* columnName1: value
|
|
151
|
+
* columnName2: value
|
|
152
|
+
* description: A map of field name to the string to search for,
|
|
153
|
+
* this will look for rows that have a value starting with the
|
|
154
|
+
* string value.
|
|
155
|
+
* additionalProperties:
|
|
156
|
+
* type: string
|
|
157
|
+
* description: The value to search for in the column.
|
|
158
|
+
* fuzzy:
|
|
159
|
+
* type: object
|
|
160
|
+
* description: A fuzzy search, only supported by internal tables.
|
|
161
|
+
* range:
|
|
162
|
+
* type: object
|
|
163
|
+
* description: Searches within a range, the format of this must be
|
|
164
|
+
* columnName -> [low, high].
|
|
165
|
+
* example:
|
|
166
|
+
* columnName1: [10, 20]
|
|
167
|
+
* equal:
|
|
168
|
+
* type: object
|
|
169
|
+
* description: Searches for rows that have a column value that is
|
|
170
|
+
* exactly the value set.
|
|
171
|
+
* notEqual:
|
|
172
|
+
* type: object
|
|
173
|
+
* description: Searches for any row which does not contain the specified
|
|
174
|
+
* column value.
|
|
175
|
+
* empty:
|
|
176
|
+
* type: object
|
|
177
|
+
* description: Searches for rows which do not contain the specified column.
|
|
178
|
+
* The object should simply contain keys of the column names, these
|
|
179
|
+
* can map to any value.
|
|
180
|
+
* example:
|
|
181
|
+
* columnName1: ""
|
|
182
|
+
* notEmpty:
|
|
183
|
+
* type: object
|
|
184
|
+
* description: Searches for rows which have the specified column.
|
|
185
|
+
* oneOf:
|
|
186
|
+
* type: object
|
|
187
|
+
* description: Searches for rows which have a column value that is any
|
|
188
|
+
* of the specified values. The format of this must be columnName -> [value1, value2].
|
|
189
|
+
* paginate:
|
|
190
|
+
* type: boolean
|
|
191
|
+
* description: Enables pagination, by default this is disabled.
|
|
192
|
+
* bookmark:
|
|
193
|
+
* oneOf:
|
|
194
|
+
* - type: string
|
|
195
|
+
* - type: integer
|
|
196
|
+
* description: If retrieving another page, the bookmark from the previous request must be supplied.
|
|
197
|
+
* limit:
|
|
198
|
+
* type: integer
|
|
199
|
+
* description: The maximum number of rows to return, useful when paginating, for internal tables this
|
|
200
|
+
* will be limited to 1000, for SQL tables it will be 5000.
|
|
201
|
+
* sort:
|
|
202
|
+
* type: object
|
|
203
|
+
* description: A set of parameters describing the sort behaviour of the search.
|
|
204
|
+
* properties:
|
|
205
|
+
* order:
|
|
206
|
+
* type: string
|
|
207
|
+
* enum: [ascending, descending]
|
|
208
|
+
* description: The order of the sort, by default this is ascending.
|
|
209
|
+
* column:
|
|
210
|
+
* type: string
|
|
211
|
+
* description: The name of the column by which the rows will be sorted.
|
|
212
|
+
* type:
|
|
213
|
+
* type: string
|
|
214
|
+
* enum: [string, number]
|
|
215
|
+
* description: Defines whether the column should be treated as a string
|
|
216
|
+
* or as numbers when sorting.
|
|
217
|
+
* responses:
|
|
218
|
+
* 200:
|
|
219
|
+
* description: The response will contain an array of rows that match the search parameters.
|
|
220
|
+
* content:
|
|
221
|
+
* application/json:
|
|
222
|
+
* schema:
|
|
223
|
+
* $ref: '#/components/schemas/searchOutput'
|
|
224
|
+
* examples:
|
|
225
|
+
* search:
|
|
226
|
+
* $ref: '#/components/examples/rows'
|
|
227
|
+
*/
|
|
228
|
+
read.push(new Endpoint_1.default("post", "/tables/:tableId/rows/search", rows_1.default.search).addMiddleware(validators_1.externalSearchValidator()));
|
|
229
|
+
exports.default = { read, write };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const tables_1 = __importDefault(require("../../controllers/public/tables"));
|
|
7
|
+
const Endpoint_1 = __importDefault(require("./utils/Endpoint"));
|
|
8
|
+
const validators_1 = require("../utils/validators");
|
|
9
|
+
const read = [], write = [];
|
|
10
|
+
/**
|
|
11
|
+
* @openapi
|
|
12
|
+
* /tables:
|
|
13
|
+
* post:
|
|
14
|
+
* summary: Create a table
|
|
15
|
+
* description: Create a table, this could be internal or external.
|
|
16
|
+
* tags:
|
|
17
|
+
* - tables
|
|
18
|
+
* parameters:
|
|
19
|
+
* - $ref: '#/components/parameters/appId'
|
|
20
|
+
* requestBody:
|
|
21
|
+
* content:
|
|
22
|
+
* application/json:
|
|
23
|
+
* schema:
|
|
24
|
+
* $ref: '#/components/schemas/table'
|
|
25
|
+
* examples:
|
|
26
|
+
* table:
|
|
27
|
+
* $ref: '#/components/examples/table'
|
|
28
|
+
* responses:
|
|
29
|
+
* 200:
|
|
30
|
+
* description: Returns the created table, including the ID which has been generated for it. This can be
|
|
31
|
+
* internal or external data sources.
|
|
32
|
+
* content:
|
|
33
|
+
* application/json:
|
|
34
|
+
* schema:
|
|
35
|
+
* $ref: '#/components/schemas/tableOutput'
|
|
36
|
+
* examples:
|
|
37
|
+
* table:
|
|
38
|
+
* $ref: '#/components/examples/table'
|
|
39
|
+
*/
|
|
40
|
+
write.push(new Endpoint_1.default("post", "/tables", tables_1.default.create).addMiddleware(validators_1.tableValidator()));
|
|
41
|
+
/**
|
|
42
|
+
* @openapi
|
|
43
|
+
* /tables/{tableId}:
|
|
44
|
+
* put:
|
|
45
|
+
* summary: Update a table
|
|
46
|
+
* description: Update a table, this could be internal or external.
|
|
47
|
+
* tags:
|
|
48
|
+
* - tables
|
|
49
|
+
* parameters:
|
|
50
|
+
* - $ref: '#/components/parameters/tableId'
|
|
51
|
+
* - $ref: '#/components/parameters/appId'
|
|
52
|
+
* requestBody:
|
|
53
|
+
* content:
|
|
54
|
+
* application/json:
|
|
55
|
+
* schema:
|
|
56
|
+
* $ref: '#/components/schemas/table'
|
|
57
|
+
* examples:
|
|
58
|
+
* table:
|
|
59
|
+
* $ref: '#/components/examples/table'
|
|
60
|
+
* responses:
|
|
61
|
+
* 200:
|
|
62
|
+
* description: Returns the updated table.
|
|
63
|
+
* content:
|
|
64
|
+
* application/json:
|
|
65
|
+
* schema:
|
|
66
|
+
* $ref: '#/components/schemas/tableOutput'
|
|
67
|
+
* examples:
|
|
68
|
+
* table:
|
|
69
|
+
* $ref: '#/components/examples/table'
|
|
70
|
+
*/
|
|
71
|
+
write.push(new Endpoint_1.default("put", "/tables/:tableId", tables_1.default.update).addMiddleware(validators_1.tableValidator()));
|
|
72
|
+
/**
|
|
73
|
+
* @openapi
|
|
74
|
+
* /tables/{tableId}:
|
|
75
|
+
* delete:
|
|
76
|
+
* summary: Delete a table
|
|
77
|
+
* description: Delete a table, this could be internal or external.
|
|
78
|
+
* tags:
|
|
79
|
+
* - tables
|
|
80
|
+
* parameters:
|
|
81
|
+
* - $ref: '#/components/parameters/tableId'
|
|
82
|
+
* - $ref: '#/components/parameters/appId'
|
|
83
|
+
* responses:
|
|
84
|
+
* 200:
|
|
85
|
+
* description: Returns the deleted table.
|
|
86
|
+
* content:
|
|
87
|
+
* application/json:
|
|
88
|
+
* schema:
|
|
89
|
+
* $ref: '#/components/schemas/tableOutput'
|
|
90
|
+
* examples:
|
|
91
|
+
* table:
|
|
92
|
+
* $ref: '#/components/examples/table'
|
|
93
|
+
*/
|
|
94
|
+
write.push(new Endpoint_1.default("delete", "/tables/:tableId", tables_1.default.destroy));
|
|
95
|
+
/**
|
|
96
|
+
* @openapi
|
|
97
|
+
* /tables/{tableId}:
|
|
98
|
+
* get:
|
|
99
|
+
* summary: Retrieve a table
|
|
100
|
+
* description: Lookup a table, this could be internal or external.
|
|
101
|
+
* tags:
|
|
102
|
+
* - tables
|
|
103
|
+
* parameters:
|
|
104
|
+
* - $ref: '#/components/parameters/tableId'
|
|
105
|
+
* - $ref: '#/components/parameters/appId'
|
|
106
|
+
* responses:
|
|
107
|
+
* 200:
|
|
108
|
+
* description: Returns the retrieved table.
|
|
109
|
+
* content:
|
|
110
|
+
* application/json:
|
|
111
|
+
* schema:
|
|
112
|
+
* $ref: '#/components/schemas/tableOutput'
|
|
113
|
+
* examples:
|
|
114
|
+
* table:
|
|
115
|
+
* $ref: '#/components/examples/table'
|
|
116
|
+
*/
|
|
117
|
+
read.push(new Endpoint_1.default("get", "/tables/:tableId", tables_1.default.read));
|
|
118
|
+
/**
|
|
119
|
+
* @openapi
|
|
120
|
+
* /tables/search:
|
|
121
|
+
* post:
|
|
122
|
+
* summary: Search for tables
|
|
123
|
+
* description: Based on table properties (currently only name) search for tables. This could be
|
|
124
|
+
* an internal or an external table.
|
|
125
|
+
* tags:
|
|
126
|
+
* - tables
|
|
127
|
+
* parameters:
|
|
128
|
+
* - $ref: '#/components/parameters/appId'
|
|
129
|
+
* requestBody:
|
|
130
|
+
* required: true
|
|
131
|
+
* content:
|
|
132
|
+
* application/json:
|
|
133
|
+
* schema:
|
|
134
|
+
* $ref: '#/components/schemas/nameSearch'
|
|
135
|
+
* responses:
|
|
136
|
+
* 200:
|
|
137
|
+
* description: Returns the found tables, based on the search parameters.
|
|
138
|
+
* content:
|
|
139
|
+
* application/json:
|
|
140
|
+
* schema:
|
|
141
|
+
* type: object
|
|
142
|
+
* required:
|
|
143
|
+
* - data
|
|
144
|
+
* properties:
|
|
145
|
+
* data:
|
|
146
|
+
* type: array
|
|
147
|
+
* items:
|
|
148
|
+
* $ref: '#/components/schemas/table'
|
|
149
|
+
* examples:
|
|
150
|
+
* tables:
|
|
151
|
+
* $ref: '#/components/examples/tables'
|
|
152
|
+
*/
|
|
153
|
+
read.push(new Endpoint_1.default("post", "/tables/search", tables_1.default.search).addMiddleware(validators_1.nameValidator()));
|
|
154
|
+
exports.default = { read, write };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const users_1 = __importDefault(require("../../controllers/public/users"));
|
|
7
|
+
const Endpoint_1 = __importDefault(require("./utils/Endpoint"));
|
|
8
|
+
const validators_1 = require("../utils/validators");
|
|
9
|
+
const read = [], write = [];
|
|
10
|
+
/**
|
|
11
|
+
* @openapi
|
|
12
|
+
* /users:
|
|
13
|
+
* post:
|
|
14
|
+
* summary: Create a user
|
|
15
|
+
* tags:
|
|
16
|
+
* - users
|
|
17
|
+
* requestBody:
|
|
18
|
+
* required: true
|
|
19
|
+
* content:
|
|
20
|
+
* application/json:
|
|
21
|
+
* schema:
|
|
22
|
+
* $ref: '#/components/schemas/user'
|
|
23
|
+
* responses:
|
|
24
|
+
* 200:
|
|
25
|
+
* description: Returns the created user.
|
|
26
|
+
* content:
|
|
27
|
+
* application/json:
|
|
28
|
+
* schema:
|
|
29
|
+
* $ref: '#/components/schemas/userOutput'
|
|
30
|
+
* examples:
|
|
31
|
+
* user:
|
|
32
|
+
* $ref: '#/components/examples/user'
|
|
33
|
+
*/
|
|
34
|
+
write.push(new Endpoint_1.default("post", "/users", users_1.default.create));
|
|
35
|
+
/**
|
|
36
|
+
* @openapi
|
|
37
|
+
* /users/{userId}:
|
|
38
|
+
* put:
|
|
39
|
+
* summary: Update a user
|
|
40
|
+
* tags:
|
|
41
|
+
* - users
|
|
42
|
+
* parameters:
|
|
43
|
+
* - $ref: '#/components/parameters/userId'
|
|
44
|
+
* requestBody:
|
|
45
|
+
* required: true
|
|
46
|
+
* content:
|
|
47
|
+
* application/json:
|
|
48
|
+
* schema:
|
|
49
|
+
* $ref: '#/components/schemas/user'
|
|
50
|
+
* responses:
|
|
51
|
+
* 200:
|
|
52
|
+
* description: Returns the updated user.
|
|
53
|
+
* content:
|
|
54
|
+
* application/json:
|
|
55
|
+
* schema:
|
|
56
|
+
* $ref: '#/components/schemas/userOutput'
|
|
57
|
+
* examples:
|
|
58
|
+
* user:
|
|
59
|
+
* $ref: '#/components/examples/user'
|
|
60
|
+
*/
|
|
61
|
+
write.push(new Endpoint_1.default("put", "/users/:userId", users_1.default.update));
|
|
62
|
+
/**
|
|
63
|
+
* @openapi
|
|
64
|
+
* /users/{userId}:
|
|
65
|
+
* delete:
|
|
66
|
+
* summary: Delete a user
|
|
67
|
+
* tags:
|
|
68
|
+
* - users
|
|
69
|
+
* parameters:
|
|
70
|
+
* - $ref: '#/components/parameters/userId'
|
|
71
|
+
* responses:
|
|
72
|
+
* 200:
|
|
73
|
+
* description: Returns the deleted user.
|
|
74
|
+
* content:
|
|
75
|
+
* application/json:
|
|
76
|
+
* schema:
|
|
77
|
+
* $ref: '#/components/schemas/userOutput'
|
|
78
|
+
* examples:
|
|
79
|
+
* user:
|
|
80
|
+
* $ref: '#/components/examples/user'
|
|
81
|
+
*/
|
|
82
|
+
write.push(new Endpoint_1.default("delete", "/users/:userId", users_1.default.destroy));
|
|
83
|
+
/**
|
|
84
|
+
* @openapi
|
|
85
|
+
* /users/{userId}:
|
|
86
|
+
* get:
|
|
87
|
+
* summary: Retrieve a user
|
|
88
|
+
* tags:
|
|
89
|
+
* - users
|
|
90
|
+
* parameters:
|
|
91
|
+
* - $ref: '#/components/parameters/userId'
|
|
92
|
+
* responses:
|
|
93
|
+
* 200:
|
|
94
|
+
* description: Returns the retrieved user.
|
|
95
|
+
* content:
|
|
96
|
+
* application/json:
|
|
97
|
+
* schema:
|
|
98
|
+
* $ref: '#/components/schemas/userOutput'
|
|
99
|
+
* examples:
|
|
100
|
+
* user:
|
|
101
|
+
* $ref: '#/components/examples/user'
|
|
102
|
+
*/
|
|
103
|
+
read.push(new Endpoint_1.default("get", "/users/:userId", users_1.default.read));
|
|
104
|
+
/**
|
|
105
|
+
* @openapi
|
|
106
|
+
* /users/search:
|
|
107
|
+
* post:
|
|
108
|
+
* summary: Search for users
|
|
109
|
+
* description: Based on user properties (currently only name) search for users.
|
|
110
|
+
* tags:
|
|
111
|
+
* - users
|
|
112
|
+
* requestBody:
|
|
113
|
+
* required: true
|
|
114
|
+
* content:
|
|
115
|
+
* application/json:
|
|
116
|
+
* schema:
|
|
117
|
+
* $ref: '#/components/schemas/nameSearch'
|
|
118
|
+
* responses:
|
|
119
|
+
* 200:
|
|
120
|
+
* description: Returns the found users based on search parameters.
|
|
121
|
+
* content:
|
|
122
|
+
* application/json:
|
|
123
|
+
* schema:
|
|
124
|
+
* type: object
|
|
125
|
+
* required:
|
|
126
|
+
* - data
|
|
127
|
+
* properties:
|
|
128
|
+
* data:
|
|
129
|
+
* type: array
|
|
130
|
+
* items:
|
|
131
|
+
* $ref: '#/components/schemas/user'
|
|
132
|
+
* examples:
|
|
133
|
+
* users:
|
|
134
|
+
* $ref: '#/components/examples/users'
|
|
135
|
+
*/
|
|
136
|
+
read.push(new Endpoint_1.default("post", "/users/search", users_1.default.search).addMiddleware(validators_1.nameValidator()));
|
|
137
|
+
exports.default = { read, write };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Endpoint {
|
|
4
|
+
constructor(method, url, controller) {
|
|
5
|
+
this.method = method;
|
|
6
|
+
this.url = url;
|
|
7
|
+
this.controller = controller;
|
|
8
|
+
this.middlewares = [];
|
|
9
|
+
this.outputMiddlewares = [];
|
|
10
|
+
}
|
|
11
|
+
addMiddleware(middleware) {
|
|
12
|
+
this.middlewares.push(middleware);
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
addOutputMiddleware(middleware) {
|
|
16
|
+
this.outputMiddlewares.push(middleware);
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
apply(router) {
|
|
20
|
+
const method = this.method, url = this.url;
|
|
21
|
+
const middlewares = this.middlewares, controller = this.controller, outputMiddlewares = this.outputMiddlewares;
|
|
22
|
+
// need a function to do nothing to stop the execution at the end
|
|
23
|
+
// middlewares are circular so if they always keep calling next, it'll just keep looping
|
|
24
|
+
const complete = () => { };
|
|
25
|
+
const params = [
|
|
26
|
+
url,
|
|
27
|
+
...middlewares,
|
|
28
|
+
controller,
|
|
29
|
+
...outputMiddlewares,
|
|
30
|
+
complete,
|
|
31
|
+
];
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
router[method](...params);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.default = Endpoint;
|
package/dist/api/routes/role.js
CHANGED
|
@@ -2,27 +2,11 @@
|
|
|
2
2
|
const Router = require("@koa/router");
|
|
3
3
|
const controller = require("../controllers/role");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const { BUILTIN_PERMISSION_IDS, BUILDER, PermissionLevels, } = require("@budibase/backend-core/permissions");
|
|
5
|
+
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
|
+
const { roleValidator } = require("./utils/validators");
|
|
8
7
|
const router = Router();
|
|
9
|
-
function generateValidator() {
|
|
10
|
-
const permLevelArray = Object.values(PermissionLevels);
|
|
11
|
-
// prettier-ignore
|
|
12
|
-
return joiValidator.body(Joi.object({
|
|
13
|
-
_id: Joi.string().optional(),
|
|
14
|
-
_rev: Joi.string().optional(),
|
|
15
|
-
name: Joi.string().required(),
|
|
16
|
-
// this is the base permission ID (for now a built in)
|
|
17
|
-
permissionId: Joi.string().valid(...Object.values(BUILTIN_PERMISSION_IDS)).required(),
|
|
18
|
-
permissions: Joi.object()
|
|
19
|
-
.pattern(/.*/, [Joi.string().valid(...permLevelArray)])
|
|
20
|
-
.optional(),
|
|
21
|
-
inherits: Joi.string().optional(),
|
|
22
|
-
}).unknown(true));
|
|
23
|
-
}
|
|
24
8
|
router
|
|
25
|
-
.post("/api/roles", authorized(BUILDER),
|
|
9
|
+
.post("/api/roles", authorized(BUILDER), roleValidator(), controller.save)
|
|
26
10
|
.get("/api/roles", authorized(BUILDER), controller.fetch)
|
|
27
11
|
.get("/api/roles/:roleId", authorized(BUILDER), controller.find)
|
|
28
12
|
.delete("/api/roles/:roleId/:rev", authorized(BUILDER), controller.destroy);
|
package/dist/api/routes/row.js
CHANGED
|
@@ -5,6 +5,7 @@ const authorized = require("../../middleware/authorized");
|
|
|
5
5
|
const usage = require("../../middleware/usageQuota");
|
|
6
6
|
const { paramResource, paramSubResource, } = require("../../middleware/resourceId");
|
|
7
7
|
const { PermissionLevels, PermissionTypes, } = require("@budibase/backend-core/permissions");
|
|
8
|
+
const { internalSearchValidator } = require("./utils/validators");
|
|
8
9
|
const router = Router();
|
|
9
10
|
router
|
|
10
11
|
/**
|
|
@@ -97,8 +98,6 @@ router
|
|
|
97
98
|
* "notEqual": {},
|
|
98
99
|
* "empty": {},
|
|
99
100
|
* "notEmpty": {},
|
|
100
|
-
* "contains": {},
|
|
101
|
-
* "notContains": {}
|
|
102
101
|
* "oneOf": {
|
|
103
102
|
* "columnName": ["value"]
|
|
104
103
|
* }
|
|
@@ -116,7 +115,7 @@ router
|
|
|
116
115
|
* @apiSuccess {string} bookmark The bookmark to be sent with the next request to get the next
|
|
117
116
|
* page.
|
|
118
117
|
*/
|
|
119
|
-
.post("/api/:tableId/search", paramResource("tableId"), authorized(PermissionTypes.TABLE, PermissionLevels.READ), rowController.search)
|
|
118
|
+
.post("/api/:tableId/search", internalSearchValidator(), paramResource("tableId"), authorized(PermissionTypes.TABLE, PermissionLevels.READ), rowController.search)
|
|
120
119
|
// DEPRECATED - this is an old API, but for backwards compat it needs to be
|
|
121
120
|
// supported still
|
|
122
121
|
.post("/api/search/:tableId/rows", paramResource("tableId"), authorized(PermissionTypes.TABLE, PermissionLevels.READ), rowController.search)
|
|
@@ -153,7 +152,7 @@ router
|
|
|
153
152
|
* @apiDescription This endpoint is identical to the row creation endpoint but instead it will
|
|
154
153
|
* error if an _id isn't provided, it will only function for existing rows.
|
|
155
154
|
*/
|
|
156
|
-
.patch("/api/:tableId/rows", paramResource("tableId"), authorized(PermissionTypes.TABLE, PermissionLevels.WRITE), rowController.patch)
|
|
155
|
+
.patch("/api/:tableId/rows", paramResource("tableId"), authorized(PermissionTypes.TABLE, PermissionLevels.WRITE), usage, rowController.patch)
|
|
157
156
|
/**
|
|
158
157
|
* @api {post} /api/:tableId/rows/validate Validate inputs for a row
|
|
159
158
|
* @apiName Validate inputs for a row
|
|
@@ -3,31 +3,10 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const controller = require("../controllers/screen");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
|
-
const
|
|
7
|
-
const Joi = require("joi");
|
|
6
|
+
const { screenValidator } = require("./utils/validators");
|
|
8
7
|
const router = Router();
|
|
9
|
-
function generateSaveValidation() {
|
|
10
|
-
// prettier-ignore
|
|
11
|
-
return joiValidator.body(Joi.object({
|
|
12
|
-
name: Joi.string().required(),
|
|
13
|
-
routing: Joi.object({
|
|
14
|
-
route: Joi.string().required(),
|
|
15
|
-
roleId: Joi.string().required().allow(""),
|
|
16
|
-
}).required().unknown(true),
|
|
17
|
-
props: Joi.object({
|
|
18
|
-
_id: Joi.string().required(),
|
|
19
|
-
_component: Joi.string().required(),
|
|
20
|
-
_children: Joi.array().required(),
|
|
21
|
-
_instanceName: Joi.string().required(),
|
|
22
|
-
_styles: Joi.object().required(),
|
|
23
|
-
type: Joi.string().optional(),
|
|
24
|
-
table: Joi.string().optional(),
|
|
25
|
-
layoutId: Joi.string().optional(),
|
|
26
|
-
}).required().unknown(true),
|
|
27
|
-
}).unknown(true));
|
|
28
|
-
}
|
|
29
8
|
router
|
|
30
9
|
.get("/api/screens", authorized(BUILDER), controller.fetch)
|
|
31
|
-
.post("/api/screens", authorized(BUILDER),
|
|
10
|
+
.post("/api/screens", authorized(BUILDER), screenValidator(), controller.save)
|
|
32
11
|
.delete("/api/screens/:screenId/:screenRev", authorized(BUILDER), controller.destroy);
|
|
33
12
|
module.exports = router;
|