@budibase/server 1.0.80-alpha.3 → 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/base/sql.js +1 -16
- package/dist/integrations/base/sqlTable.js +4 -8
- package/dist/integrations/googlesheets.js +0 -3
- package/dist/integrations/microsoftSqlServer.js +43 -60
- package/dist/integrations/mysql.js +0 -3
- package/dist/integrations/oracle.js +19 -14
- package/dist/integrations/postgres.js +28 -34
- package/dist/integrations/utils.js +15 -32
- 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/mssql/data/setup.sql +1 -18
- package/scripts/integrations/oracle/oracle.md +2 -2
- package/scripts/integrations/postgres/init.sql +3 -11
- 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/definitions/datasource.ts +0 -1
- package/src/environment.js +0 -1
- package/src/integrations/base/datasourcePlus.ts +0 -3
- package/src/integrations/base/sql.ts +1 -16
- package/src/integrations/base/sqlTable.ts +7 -11
- package/src/integrations/googlesheets.ts +2 -5
- package/src/integrations/microsoftSqlServer.ts +61 -86
- package/src/integrations/mysql.ts +0 -4
- package/src/integrations/oracle.ts +35 -27
- package/src/integrations/postgres.ts +26 -33
- package/src/integrations/utils.ts +15 -43
- 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.f8c92447.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 -94
- package/specs/openapi.json +0 -2232
- package/specs/openapi.yaml +0 -1538
- 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,141 +0,0 @@
|
|
|
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 applications_1 = __importDefault(require("../../controllers/public/applications"));
|
|
7
|
-
const Endpoint_1 = __importDefault(require("./utils/Endpoint"));
|
|
8
|
-
const { nameValidator, applicationValidator } = require("../utils/validators");
|
|
9
|
-
const read = [], write = [];
|
|
10
|
-
/**
|
|
11
|
-
* @openapi
|
|
12
|
-
* /applications:
|
|
13
|
-
* post:
|
|
14
|
-
* summary: Create an application
|
|
15
|
-
* tags:
|
|
16
|
-
* - applications
|
|
17
|
-
* parameters:
|
|
18
|
-
* - $ref: '#/components/parameters/appId'
|
|
19
|
-
* requestBody:
|
|
20
|
-
* required: true
|
|
21
|
-
* content:
|
|
22
|
-
* application/json:
|
|
23
|
-
* schema:
|
|
24
|
-
* $ref: '#/components/schemas/application'
|
|
25
|
-
* responses:
|
|
26
|
-
* 200:
|
|
27
|
-
* description: Returns the created application.
|
|
28
|
-
* content:
|
|
29
|
-
* application/json:
|
|
30
|
-
* schema:
|
|
31
|
-
* $ref: '#/components/schemas/applicationOutput'
|
|
32
|
-
* examples:
|
|
33
|
-
* application:
|
|
34
|
-
* $ref: '#/components/examples/application'
|
|
35
|
-
*/
|
|
36
|
-
write.push(new Endpoint_1.default("post", "/applications", applications_1.default.create).addMiddleware(applicationValidator()));
|
|
37
|
-
/**
|
|
38
|
-
* @openapi
|
|
39
|
-
* /applications/{appId}:
|
|
40
|
-
* put:
|
|
41
|
-
* summary: Update an application
|
|
42
|
-
* tags:
|
|
43
|
-
* - applications
|
|
44
|
-
* parameters:
|
|
45
|
-
* - $ref: '#/components/parameters/appIdUrl'
|
|
46
|
-
* requestBody:
|
|
47
|
-
* required: true
|
|
48
|
-
* content:
|
|
49
|
-
* application/json:
|
|
50
|
-
* schema:
|
|
51
|
-
* $ref: '#/components/schemas/application'
|
|
52
|
-
* responses:
|
|
53
|
-
* 200:
|
|
54
|
-
* description: Returns the updated application.
|
|
55
|
-
* content:
|
|
56
|
-
* application/json:
|
|
57
|
-
* schema:
|
|
58
|
-
* $ref: '#/components/schemas/applicationOutput'
|
|
59
|
-
* examples:
|
|
60
|
-
* application:
|
|
61
|
-
* $ref: '#/components/examples/application'
|
|
62
|
-
*/
|
|
63
|
-
write.push(new Endpoint_1.default("put", "/applications/:appId", applications_1.default.update).addMiddleware(applicationValidator()));
|
|
64
|
-
/**
|
|
65
|
-
* @openapi
|
|
66
|
-
* /applications/{appId}:
|
|
67
|
-
* delete:
|
|
68
|
-
* summary: Delete an application
|
|
69
|
-
* tags:
|
|
70
|
-
* - applications
|
|
71
|
-
* parameters:
|
|
72
|
-
* - $ref: '#/components/parameters/appIdUrl'
|
|
73
|
-
* responses:
|
|
74
|
-
* 200:
|
|
75
|
-
* description: Returns the deleted application.
|
|
76
|
-
* content:
|
|
77
|
-
* application/json:
|
|
78
|
-
* schema:
|
|
79
|
-
* $ref: '#/components/schemas/applicationOutput'
|
|
80
|
-
* examples:
|
|
81
|
-
* application:
|
|
82
|
-
* $ref: '#/components/examples/application'
|
|
83
|
-
*/
|
|
84
|
-
write.push(new Endpoint_1.default("delete", "/applications/:appId", applications_1.default.destroy));
|
|
85
|
-
/**
|
|
86
|
-
* @openapi
|
|
87
|
-
* /applications/{appId}:
|
|
88
|
-
* get:
|
|
89
|
-
* summary: Retrieve an application
|
|
90
|
-
* tags:
|
|
91
|
-
* - applications
|
|
92
|
-
* parameters:
|
|
93
|
-
* - $ref: '#/components/parameters/appIdUrl'
|
|
94
|
-
* responses:
|
|
95
|
-
* 200:
|
|
96
|
-
* description: Returns the retrieved application.
|
|
97
|
-
* content:
|
|
98
|
-
* application/json:
|
|
99
|
-
* schema:
|
|
100
|
-
* $ref: '#/components/schemas/applicationOutput'
|
|
101
|
-
* examples:
|
|
102
|
-
* application:
|
|
103
|
-
* $ref: '#/components/examples/application'
|
|
104
|
-
*/
|
|
105
|
-
read.push(new Endpoint_1.default("get", "/applications/:appId", applications_1.default.read));
|
|
106
|
-
/**
|
|
107
|
-
* @openapi
|
|
108
|
-
* /applications/search:
|
|
109
|
-
* post:
|
|
110
|
-
* summary: Search for applications
|
|
111
|
-
* description: Based on application properties (currently only name) search for applications.
|
|
112
|
-
* tags:
|
|
113
|
-
* - applications
|
|
114
|
-
* parameters:
|
|
115
|
-
* - $ref: '#/components/parameters/appId'
|
|
116
|
-
* requestBody:
|
|
117
|
-
* required: true
|
|
118
|
-
* content:
|
|
119
|
-
* application/json:
|
|
120
|
-
* schema:
|
|
121
|
-
* $ref: '#/components/schemas/nameSearch'
|
|
122
|
-
* responses:
|
|
123
|
-
* 200:
|
|
124
|
-
* description: Returns the applications that were found based on the search parameters.
|
|
125
|
-
* content:
|
|
126
|
-
* application/json:
|
|
127
|
-
* schema:
|
|
128
|
-
* type: object
|
|
129
|
-
* required:
|
|
130
|
-
* - data
|
|
131
|
-
* properties:
|
|
132
|
-
* data:
|
|
133
|
-
* type: array
|
|
134
|
-
* items:
|
|
135
|
-
* $ref: '#/components/schemas/application'
|
|
136
|
-
* examples:
|
|
137
|
-
* applications:
|
|
138
|
-
* $ref: '#/components/examples/applications'
|
|
139
|
-
*/
|
|
140
|
-
read.push(new Endpoint_1.default("post", "/applications/search", applications_1.default.search).addMiddleware(nameValidator()));
|
|
141
|
-
exports.default = { read, write };
|
|
@@ -1,101 +0,0 @@
|
|
|
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 applications_1 = __importDefault(require("./applications"));
|
|
7
|
-
const queries_1 = __importDefault(require("./queries"));
|
|
8
|
-
const tables_1 = __importDefault(require("./tables"));
|
|
9
|
-
const rows_1 = __importDefault(require("./rows"));
|
|
10
|
-
const users_1 = __importDefault(require("./users"));
|
|
11
|
-
const usageQuota_1 = __importDefault(require("../../../middleware/usageQuota"));
|
|
12
|
-
const authorized_1 = __importDefault(require("../../../middleware/authorized"));
|
|
13
|
-
const resourceId_1 = require("../../../middleware/resourceId");
|
|
14
|
-
const mapper_1 = __importDefault(require("./middleware/mapper"));
|
|
15
|
-
const environment_1 = __importDefault(require("../../../environment"));
|
|
16
|
-
// below imports don't have declaration files
|
|
17
|
-
const Router = require("@koa/router");
|
|
18
|
-
const { RateLimit, Stores } = require("koa2-ratelimit");
|
|
19
|
-
const { PermissionLevels, PermissionTypes, } = require("@budibase/backend-core/permissions");
|
|
20
|
-
const { getRedisOptions } = require("@budibase/backend-core/redis").utils;
|
|
21
|
-
const PREFIX = "/api/public/v1";
|
|
22
|
-
// allow a lot more requests when in test
|
|
23
|
-
const DEFAULT_API_REQ_LIMIT_PER_SEC = environment_1.default.isTest() ? 100 : 10;
|
|
24
|
-
function getApiLimitPerSecond() {
|
|
25
|
-
if (!environment_1.default.API_REQ_LIMIT_PER_SEC) {
|
|
26
|
-
return DEFAULT_API_REQ_LIMIT_PER_SEC;
|
|
27
|
-
}
|
|
28
|
-
return parseInt(environment_1.default.API_REQ_LIMIT_PER_SEC);
|
|
29
|
-
}
|
|
30
|
-
if (!environment_1.default.isTest()) {
|
|
31
|
-
const REDIS_OPTS = getRedisOptions();
|
|
32
|
-
RateLimit.defaultOptions({
|
|
33
|
-
store: new Stores.Redis({
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
socket: {
|
|
36
|
-
host: REDIS_OPTS.host,
|
|
37
|
-
port: REDIS_OPTS.port,
|
|
38
|
-
},
|
|
39
|
-
password: REDIS_OPTS.opts.password,
|
|
40
|
-
database: 1,
|
|
41
|
-
}),
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
// rate limiting, allows for 2 requests per second
|
|
45
|
-
const limiter = RateLimit.middleware({
|
|
46
|
-
interval: { sec: 1 },
|
|
47
|
-
// per ip, per interval
|
|
48
|
-
max: getApiLimitPerSecond(),
|
|
49
|
-
});
|
|
50
|
-
const publicRouter = new Router({
|
|
51
|
-
prefix: PREFIX,
|
|
52
|
-
});
|
|
53
|
-
publicRouter.use(limiter);
|
|
54
|
-
function addMiddleware(endpoints, middleware, opts = { output: false }) {
|
|
55
|
-
if (!endpoints) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (!Array.isArray(endpoints)) {
|
|
59
|
-
endpoints = [endpoints];
|
|
60
|
-
}
|
|
61
|
-
for (let endpoint of endpoints) {
|
|
62
|
-
if (opts === null || opts === void 0 ? void 0 : opts.output) {
|
|
63
|
-
endpoint.addOutputMiddleware(middleware);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
endpoint.addMiddleware(middleware);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function addToRouter(endpoints) {
|
|
71
|
-
if (endpoints) {
|
|
72
|
-
for (let endpoint of endpoints) {
|
|
73
|
-
endpoint.apply(publicRouter);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function applyRoutes(endpoints, permType, resource, subResource) {
|
|
78
|
-
const paramMiddleware = subResource
|
|
79
|
-
? resourceId_1.paramSubResource(resource, subResource)
|
|
80
|
-
: resourceId_1.paramResource(resource);
|
|
81
|
-
// add the parameter capture middleware
|
|
82
|
-
addMiddleware(endpoints.read, paramMiddleware);
|
|
83
|
-
addMiddleware(endpoints.write, paramMiddleware);
|
|
84
|
-
// add the authorization middleware, using the correct perm type
|
|
85
|
-
addMiddleware(endpoints.read, authorized_1.default(permType, PermissionLevels.READ));
|
|
86
|
-
addMiddleware(endpoints.write, authorized_1.default(permType, PermissionLevels.WRITE));
|
|
87
|
-
// add the usage quota middleware
|
|
88
|
-
addMiddleware(endpoints.write, usageQuota_1.default);
|
|
89
|
-
// add the output mapper middleware
|
|
90
|
-
addMiddleware(endpoints.read, mapper_1.default, { output: true });
|
|
91
|
-
addMiddleware(endpoints.write, mapper_1.default, { output: true });
|
|
92
|
-
addToRouter(endpoints.read);
|
|
93
|
-
addToRouter(endpoints.write);
|
|
94
|
-
}
|
|
95
|
-
applyRoutes(applications_1.default, PermissionTypes.APP, "appId");
|
|
96
|
-
applyRoutes(tables_1.default, PermissionTypes.TABLE, "tableId");
|
|
97
|
-
applyRoutes(users_1.default, PermissionTypes.USER, "userId");
|
|
98
|
-
applyRoutes(queries_1.default, PermissionTypes.QUERY, "queryId");
|
|
99
|
-
// needs to be applied last for routing purposes, don't override other endpoints
|
|
100
|
-
applyRoutes(rows_1.default, PermissionTypes.TABLE, "tableId", "rowId");
|
|
101
|
-
module.exports = publicRouter;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const mapping_1 = __importDefault(require("../../../controllers/public/mapping"));
|
|
16
|
-
var Resources;
|
|
17
|
-
(function (Resources) {
|
|
18
|
-
Resources["APPLICATION"] = "applications";
|
|
19
|
-
Resources["TABLES"] = "tables";
|
|
20
|
-
Resources["ROWS"] = "rows";
|
|
21
|
-
Resources["USERS"] = "users";
|
|
22
|
-
Resources["QUERIES"] = "queries";
|
|
23
|
-
Resources["SEARCH"] = "search";
|
|
24
|
-
})(Resources || (Resources = {}));
|
|
25
|
-
function isArrayResponse(ctx) {
|
|
26
|
-
return ctx.url.endsWith(Resources.SEARCH) || Array.isArray(ctx.body);
|
|
27
|
-
}
|
|
28
|
-
function processApplications(ctx) {
|
|
29
|
-
if (isArrayResponse(ctx)) {
|
|
30
|
-
return mapping_1.default.mapApplications(ctx);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return mapping_1.default.mapApplication(ctx);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function processTables(ctx) {
|
|
37
|
-
if (isArrayResponse(ctx)) {
|
|
38
|
-
return mapping_1.default.mapTables(ctx);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return mapping_1.default.mapTable(ctx);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function processRows(ctx) {
|
|
45
|
-
if (isArrayResponse(ctx)) {
|
|
46
|
-
return mapping_1.default.mapRowSearch(ctx);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
return mapping_1.default.mapRow(ctx);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function processUsers(ctx) {
|
|
53
|
-
if (isArrayResponse(ctx)) {
|
|
54
|
-
return mapping_1.default.mapUsers(ctx);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
return mapping_1.default.mapUser(ctx);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function processQueries(ctx) {
|
|
61
|
-
if (isArrayResponse(ctx)) {
|
|
62
|
-
return mapping_1.default.mapQueries(ctx);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
return mapping_1.default.mapQueryExecution(ctx);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.default = (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
-
let urlParts = ctx.url.split("/");
|
|
70
|
-
urlParts = urlParts.slice(4, urlParts.length);
|
|
71
|
-
let body = {};
|
|
72
|
-
switch (urlParts[0]) {
|
|
73
|
-
case Resources.APPLICATION:
|
|
74
|
-
body = processApplications(ctx);
|
|
75
|
-
break;
|
|
76
|
-
case Resources.TABLES:
|
|
77
|
-
if (urlParts[2] === Resources.ROWS) {
|
|
78
|
-
body = processRows(ctx);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
body = processTables(ctx);
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
case Resources.USERS:
|
|
85
|
-
body = processUsers(ctx);
|
|
86
|
-
break;
|
|
87
|
-
case Resources.QUERIES:
|
|
88
|
-
body = processQueries(ctx);
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
// update the body based on what has occurred in the mapper
|
|
92
|
-
ctx.body = body;
|
|
93
|
-
yield next();
|
|
94
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
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 queries_1 = __importDefault(require("../../controllers/public/queries"));
|
|
7
|
-
const Endpoint_1 = __importDefault(require("./utils/Endpoint"));
|
|
8
|
-
const validators_1 = require("../utils/validators");
|
|
9
|
-
const read = [], write = [];
|
|
10
|
-
/**
|
|
11
|
-
* @openapi
|
|
12
|
-
* /queries/{queryId}:
|
|
13
|
-
* post:
|
|
14
|
-
* summary: Execute a query
|
|
15
|
-
* description: Queries which have been created within a Budibase app can be executed using this,
|
|
16
|
-
* tags:
|
|
17
|
-
* - queries
|
|
18
|
-
* parameters:
|
|
19
|
-
* - $ref: '#/components/parameters/queryId'
|
|
20
|
-
* - $ref: '#/components/parameters/appId'
|
|
21
|
-
* requestBody:
|
|
22
|
-
* required: true
|
|
23
|
-
* content:
|
|
24
|
-
* application/json:
|
|
25
|
-
* schema:
|
|
26
|
-
* $ref: '#/components/schemas/executeQuery'
|
|
27
|
-
* responses:
|
|
28
|
-
* 200:
|
|
29
|
-
* description: Returns the result of the query execution.
|
|
30
|
-
* content:
|
|
31
|
-
* application/json:
|
|
32
|
-
* schema:
|
|
33
|
-
* $ref: '#/components/schemas/executeQueryOutput'
|
|
34
|
-
* examples:
|
|
35
|
-
* REST:
|
|
36
|
-
* $ref: '#/components/examples/restResponse'
|
|
37
|
-
* SQL:
|
|
38
|
-
* $ref: '#/components/examples/sqlResponse'
|
|
39
|
-
*
|
|
40
|
-
*/
|
|
41
|
-
write.push(new Endpoint_1.default("post", "/queries/:queryId", queries_1.default.execute));
|
|
42
|
-
/**
|
|
43
|
-
* @openapi
|
|
44
|
-
* /queries/search:
|
|
45
|
-
* post:
|
|
46
|
-
* summary: Search for queries
|
|
47
|
-
* description: Based on query properties (currently only name) search for queries.
|
|
48
|
-
* tags:
|
|
49
|
-
* - queries
|
|
50
|
-
* parameters:
|
|
51
|
-
* - $ref: '#/components/parameters/appId'
|
|
52
|
-
* requestBody:
|
|
53
|
-
* required: true
|
|
54
|
-
* content:
|
|
55
|
-
* application/json:
|
|
56
|
-
* schema:
|
|
57
|
-
* $ref: '#/components/schemas/nameSearch'
|
|
58
|
-
* responses:
|
|
59
|
-
* 200:
|
|
60
|
-
* description: Returns the queries found based on the search parameters.
|
|
61
|
-
* content:
|
|
62
|
-
* application/json:
|
|
63
|
-
* schema:
|
|
64
|
-
* type: object
|
|
65
|
-
* required:
|
|
66
|
-
* - data
|
|
67
|
-
* properties:
|
|
68
|
-
* data:
|
|
69
|
-
* type: array
|
|
70
|
-
* items:
|
|
71
|
-
* $ref: '#/components/schemas/query'
|
|
72
|
-
* examples:
|
|
73
|
-
* queries:
|
|
74
|
-
* $ref: '#/components/examples/queries'
|
|
75
|
-
*/
|
|
76
|
-
read.push(new Endpoint_1.default("post", "/queries/search", queries_1.default.search).addMiddleware(validators_1.nameValidator()));
|
|
77
|
-
exports.default = { read, write };
|
|
@@ -1,229 +0,0 @@
|
|
|
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 };
|