@budibase/server 1.0.79 → 1.0.80-alpha.2
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.c8d1e8f0.css → index.c57242d4.css} +2 -2
- package/builder/assets/index.f3e82852.js +1288 -0
- package/builder/assets/{vendor.20f80cec.js → vendor.a7c6ad0a.js} +190 -216
- package/builder/index.html +3 -3
- package/coverage/clover.xml +2399 -2336
- package/coverage/coverage-final.json +138 -137
- package/coverage/lcov-report/api/controllers/analytics.js.html +6 -6
- package/coverage/lcov-report/api/controllers/apikeys.js.html +6 -6
- package/coverage/lcov-report/api/controllers/application.js.html +152 -149
- package/coverage/lcov-report/api/controllers/auth.js.html +7 -7
- package/coverage/lcov-report/api/controllers/automation.js.html +21 -21
- package/coverage/lcov-report/api/controllers/backup.js.html +3 -3
- package/coverage/lcov-report/api/controllers/cloud.js.html +11 -11
- package/coverage/lcov-report/api/controllers/component.js.html +5 -5
- package/coverage/lcov-report/api/controllers/datasource.js.html +16 -16
- package/coverage/lcov-report/api/controllers/dev.js.html +19 -19
- package/coverage/lcov-report/api/controllers/index.html +16 -16
- package/coverage/lcov-report/api/controllers/integration.js.html +4 -4
- package/coverage/lcov-report/api/controllers/layout.js.html +6 -6
- package/coverage/lcov-report/api/controllers/metadata.js.html +9 -9
- package/coverage/lcov-report/api/controllers/migrations.js.html +4 -4
- package/coverage/lcov-report/api/controllers/permission.js.html +15 -15
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.js.html +26 -26
- package/coverage/lcov-report/api/controllers/query/validation.js.html +10 -10
- package/coverage/lcov-report/api/controllers/role.js.html +9 -9
- package/coverage/lcov-report/api/controllers/routing.js.html +9 -9
- package/coverage/lcov-report/api/controllers/row/external.js.html +16 -16
- package/coverage/lcov-report/api/controllers/row/index.html +27 -27
- package/coverage/lcov-report/api/controllers/row/index.js.html +46 -46
- package/coverage/lcov-report/api/controllers/row/internal.js.html +94 -82
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +204 -204
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +24 -24
- package/coverage/lcov-report/api/controllers/row/utils.js.html +29 -29
- package/coverage/lcov-report/api/controllers/screen.js.html +7 -7
- package/coverage/lcov-report/api/controllers/script.js.html +4 -4
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +49 -49
- package/coverage/lcov-report/api/controllers/table/external.js.html +12 -12
- package/coverage/lcov-report/api/controllers/table/index.html +11 -11
- package/coverage/lcov-report/api/controllers/table/index.js.html +47 -44
- package/coverage/lcov-report/api/controllers/table/internal.js.html +50 -50
- package/coverage/lcov-report/api/controllers/table/utils.js.html +80 -80
- package/coverage/lcov-report/api/controllers/templates.js.html +5 -5
- package/coverage/lcov-report/api/controllers/user.js.html +19 -19
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +4 -4
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +14 -14
- package/coverage/lcov-report/api/controllers/view/utils.js.html +12 -12
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +7 -7
- package/coverage/lcov-report/api/controllers/webhook.js.html +18 -27
- package/coverage/lcov-report/api/index.html +10 -10
- package/coverage/lcov-report/api/index.js.html +37 -28
- package/coverage/lcov-report/api/routes/analytics.js.html +6 -6
- package/coverage/lcov-report/api/routes/apikeys.js.html +8 -8
- package/coverage/lcov-report/api/routes/application.js.html +9 -9
- package/coverage/lcov-report/api/routes/auth.js.html +6 -6
- package/coverage/lcov-report/api/routes/automation.js.html +19 -109
- package/coverage/lcov-report/api/routes/backup.js.html +8 -8
- package/coverage/lcov-report/api/routes/cloud.js.html +8 -8
- package/coverage/lcov-report/api/routes/component.js.html +8 -8
- package/coverage/lcov-report/api/routes/datasource.js.html +18 -156
- package/coverage/lcov-report/api/routes/deploy.js.html +8 -8
- package/coverage/lcov-report/api/routes/dev.js.html +13 -13
- package/coverage/lcov-report/api/routes/index.html +35 -35
- package/coverage/lcov-report/api/routes/index.js.html +38 -32
- package/coverage/lcov-report/api/routes/integration.js.html +8 -8
- package/coverage/lcov-report/api/routes/layout.js.html +8 -8
- package/coverage/lcov-report/api/routes/metadata.js.html +9 -9
- package/coverage/lcov-report/api/routes/migrations.js.html +7 -7
- package/coverage/lcov-report/api/routes/permission.js.html +16 -58
- package/coverage/lcov-report/api/routes/query.js.html +10 -10
- package/coverage/lcov-report/api/routes/role.js.html +15 -78
- package/coverage/lcov-report/api/routes/routing.js.html +8 -8
- package/coverage/lcov-report/api/routes/row.js.html +17 -14
- package/coverage/lcov-report/api/routes/screen.js.html +14 -95
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +13 -13
- package/coverage/lcov-report/api/routes/table.js.html +17 -62
- package/coverage/lcov-report/api/routes/templates.js.html +8 -8
- package/coverage/lcov-report/api/routes/user.js.html +8 -8
- package/coverage/lcov-report/api/routes/utils/index.html +111 -0
- package/coverage/lcov-report/api/routes/utils/validators.js.html +737 -0
- package/coverage/lcov-report/api/routes/view.js.html +10 -10
- package/coverage/lcov-report/api/routes/webhook.js.html +14 -62
- package/coverage/lcov-report/automations/actions.js.html +24 -24
- package/coverage/lcov-report/automations/automationUtils.js.html +5 -5
- package/coverage/lcov-report/automations/bullboard.js.html +16 -16
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +7 -7
- package/coverage/lcov-report/automations/steps/bash.js.html +6 -6
- package/coverage/lcov-report/automations/steps/createRow.js.html +7 -7
- package/coverage/lcov-report/automations/steps/delay.js.html +4 -4
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +7 -7
- package/coverage/lcov-report/automations/steps/discord.js.html +7 -7
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +6 -6
- package/coverage/lcov-report/automations/steps/executeScript.js.html +6 -6
- package/coverage/lcov-report/automations/steps/filter.js.html +12 -9
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +5 -5
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +8 -8
- package/coverage/lcov-report/automations/steps/queryRows.js.html +11 -11
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +5 -5
- package/coverage/lcov-report/automations/steps/serverLog.js.html +3 -3
- package/coverage/lcov-report/automations/steps/slack.js.html +5 -5
- package/coverage/lcov-report/automations/steps/updateRow.js.html +6 -6
- package/coverage/lcov-report/automations/steps/utils.js.html +3 -3
- package/coverage/lcov-report/automations/steps/zapier.js.html +5 -5
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +8 -8
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +2 -2
- package/coverage/lcov-report/automations/triggers.js.html +26 -26
- package/coverage/lcov-report/automations/utils.js.html +35 -35
- package/coverage/lcov-report/constants/index.html +5 -5
- package/coverage/lcov-report/constants/index.js.html +40 -28
- package/coverage/lcov-report/constants/layouts.js.html +5 -5
- package/coverage/lcov-report/constants/screens.js.html +4 -4
- package/coverage/lcov-report/db/client.js.html +18 -18
- package/coverage/lcov-report/db/inMemoryView.js.html +7 -7
- package/coverage/lcov-report/db/index.html +15 -15
- package/coverage/lcov-report/db/index.js.html +3 -3
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +21 -21
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +36 -36
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +30 -30
- package/coverage/lcov-report/db/newid.js.html +4 -4
- package/coverage/lcov-report/db/utils.js.html +123 -87
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +8 -8
- package/coverage/lcov-report/events/utils.js.html +18 -18
- package/coverage/lcov-report/index.html +89 -74
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +5 -5
- package/coverage/lcov-report/middleware/authorized.js.html +29 -29
- package/coverage/lcov-report/middleware/builder.js.html +16 -16
- package/coverage/lcov-report/middleware/currentapp.js.html +44 -44
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +14 -14
- package/coverage/lcov-report/middleware/resourceId.js.html +29 -29
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +17 -17
- package/coverage/lcov-report/middleware/utils.js.html +4 -4
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +19 -19
- package/coverage/lcov-report/threads/index.js.html +10 -10
- package/coverage/lcov-report/threads/query.js.html +123 -39
- package/coverage/lcov-report/threads/utils.js.html +14 -14
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +7 -7
- package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
- package/coverage/lcov-report/utilities/csvParser.js.html +6 -6
- package/coverage/lcov-report/utilities/global.js.html +28 -28
- package/coverage/lcov-report/utilities/index.html +18 -18
- package/coverage/lcov-report/utilities/index.js.html +24 -24
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +9 -9
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +6 -6
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +60 -60
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +13 -13
- package/coverage/lcov-report/utilities/scriptRunner.js.html +5 -5
- package/coverage/lcov-report/utilities/security.js.html +8 -8
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.js.html +12 -12
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +8 -8
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +5 -5
- package/coverage/lcov-report/utilities/workerRequests.js.html +200 -53
- package/coverage/lcov.info +3323 -3224
- package/dist/api/controllers/application.js +1 -0
- package/dist/api/controllers/public/applications.js +94 -0
- package/dist/api/controllers/public/mapping/applications.js +29 -0
- package/dist/api/controllers/public/mapping/index.js +11 -0
- package/dist/api/controllers/public/mapping/queries.js +36 -0
- package/dist/api/controllers/public/mapping/rows.js +24 -0
- package/dist/api/controllers/public/mapping/tables.js +23 -0
- package/dist/api/controllers/public/mapping/types.js +2 -0
- package/dist/api/controllers/public/mapping/users.js +29 -0
- package/dist/api/controllers/public/queries.js +38 -0
- package/dist/api/controllers/public/rows.js +97 -0
- package/dist/api/controllers/public/tables.js +75 -0
- package/dist/api/controllers/public/users.js +95 -0
- package/dist/api/controllers/public/utils.js +49 -0
- package/dist/api/controllers/row/internal.js +4 -1
- package/dist/api/controllers/table/index.js +2 -1
- package/dist/api/controllers/webhook.js +3 -5
- package/dist/api/index.js +3 -1
- package/dist/api/routes/automation.js +3 -31
- package/dist/api/routes/datasource.js +3 -50
- package/dist/api/routes/index.js +2 -0
- package/dist/api/routes/permission.js +4 -14
- package/dist/api/routes/public/applications.js +141 -0
- package/dist/api/routes/public/index.js +101 -0
- package/dist/api/routes/public/middleware/mapper.js +94 -0
- package/dist/api/routes/public/queries.js +77 -0
- package/dist/api/routes/public/rows.js +229 -0
- package/dist/api/routes/public/tables.js +154 -0
- package/dist/api/routes/public/users.js +137 -0
- package/dist/api/routes/public/utils/Endpoint.js +36 -0
- package/dist/api/routes/role.js +3 -19
- package/dist/api/routes/row.js +3 -4
- package/dist/api/routes/screen.js +2 -23
- package/dist/api/routes/table.js +3 -17
- package/dist/api/routes/tests/utilities/index.js +23 -0
- package/dist/api/routes/utils/validators.js +200 -0
- package/dist/api/routes/webhook.js +2 -17
- package/dist/automations/steps/filter.js +2 -2
- package/dist/automations/steps/queryRows.js +1 -1
- package/dist/automations/utils.js +2 -2
- package/dist/constants/index.js +3 -0
- package/dist/db/utils.js +11 -0
- package/dist/definitions/openapi.js +6 -0
- package/dist/environment.js +1 -0
- package/dist/integrations/base/sql.js +16 -1
- package/dist/integrations/base/sqlTable.js +8 -4
- package/dist/integrations/googlesheets.js +3 -0
- package/dist/integrations/microsoftSqlServer.js +60 -43
- package/dist/integrations/mysql.js +3 -0
- package/dist/integrations/oracle.js +14 -19
- package/dist/integrations/postgres.js +34 -28
- package/dist/integrations/utils.js +32 -15
- package/dist/package.json +11 -7
- package/dist/tests/utilities/TestConfiguration.js +25 -8
- package/dist/threads/query.js +33 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/workerRequests.js +50 -15
- package/package.json +12 -8
- package/scripts/integrations/mssql/data/setup.sql +18 -1
- package/scripts/integrations/oracle/oracle.md +2 -2
- package/scripts/integrations/postgres/init.sql +11 -3
- package/scripts/likeCypress.ts +9 -6
- package/specs/generate.js +83 -0
- package/specs/openapi.json +2222 -0
- package/specs/openapi.yaml +1530 -0
- package/specs/parameters.js +59 -0
- package/specs/resources/application.js +101 -0
- package/specs/resources/index.js +24 -0
- package/specs/resources/misc.js +12 -0
- package/specs/resources/query.js +189 -0
- package/specs/resources/row.js +125 -0
- package/specs/resources/table.js +191 -0
- package/specs/resources/user.js +126 -0
- package/specs/resources/utils/Resource.js +26 -0
- package/specs/resources/utils/index.js +11 -0
- package/specs/security.js +7 -0
- package/src/api/controllers/application.js +1 -0
- package/src/api/controllers/public/applications.ts +74 -0
- package/src/api/controllers/public/mapping/applications.ts +32 -0
- package/src/api/controllers/public/mapping/index.ts +13 -0
- package/src/api/controllers/public/mapping/queries.ts +39 -0
- package/src/api/controllers/public/mapping/rows.ts +31 -0
- package/src/api/controllers/public/mapping/tables.ts +26 -0
- package/src/api/controllers/public/mapping/types.ts +13 -0
- package/src/api/controllers/public/mapping/users.ts +32 -0
- package/src/api/controllers/public/queries.ts +20 -0
- package/src/api/controllers/public/rows.ts +77 -0
- package/src/api/controllers/public/tables.ts +56 -0
- package/src/api/controllers/public/users.ts +82 -0
- package/src/api/controllers/public/utils.ts +38 -0
- package/src/api/controllers/row/ExternalRequest.ts +1 -1
- package/src/api/controllers/row/internal.js +4 -0
- package/src/api/controllers/table/index.js +2 -1
- package/src/api/controllers/webhook.js +3 -6
- package/src/api/index.js +4 -1
- package/src/api/routes/automation.js +3 -33
- package/src/api/routes/datasource.js +6 -52
- package/src/api/routes/index.js +2 -0
- package/src/api/routes/permission.js +4 -18
- package/src/api/routes/public/applications.ts +156 -0
- package/src/api/routes/public/index.ts +118 -0
- package/src/api/routes/public/middleware/mapper.ts +81 -0
- package/src/api/routes/public/queries.ts +81 -0
- package/src/api/routes/public/rows.ts +242 -0
- package/src/api/routes/public/tables.ts +169 -0
- package/src/api/routes/public/tests/compare.spec.js +184 -0
- package/src/api/routes/public/users.ts +144 -0
- package/src/api/routes/public/utils/Endpoint.ts +51 -0
- package/src/api/routes/role.js +3 -24
- package/src/api/routes/row.js +3 -2
- package/src/api/routes/screen.js +2 -29
- package/src/api/routes/table.js +4 -19
- package/src/api/routes/tests/utilities/index.js +24 -0
- package/src/api/routes/utils/validators.js +219 -0
- package/src/api/routes/webhook.js +2 -18
- package/src/automations/steps/filter.js +3 -2
- package/src/automations/steps/queryRows.js +1 -1
- package/src/automations/utils.js +2 -2
- package/src/constants/index.js +4 -0
- package/src/db/utils.js +12 -0
- package/src/definitions/common.ts +4 -0
- package/src/definitions/datasource.ts +1 -0
- package/src/definitions/openapi.ts +943 -0
- package/src/environment.js +1 -0
- package/src/integrations/base/datasourcePlus.ts +3 -0
- package/src/integrations/base/sql.ts +16 -1
- package/src/integrations/base/sqlTable.ts +11 -7
- package/src/integrations/googlesheets.ts +5 -2
- package/src/integrations/microsoftSqlServer.ts +86 -61
- package/src/integrations/mysql.ts +4 -0
- package/src/integrations/oracle.ts +27 -35
- package/src/integrations/postgres.ts +33 -26
- package/src/integrations/utils.ts +43 -15
- package/src/tests/utilities/TestConfiguration.js +23 -2
- package/src/threads/query.js +37 -9
- package/src/utilities/workerRequests.js +65 -16
- package/builder/assets/index.f28c5d54.js +0 -1352
- package/scripts/proxy/generateProxyConfig.js +0 -70
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
exports.tableId = {
|
|
2
|
+
in: "path",
|
|
3
|
+
name: "tableId",
|
|
4
|
+
required: true,
|
|
5
|
+
description: "The ID of the table which this request is targeting.",
|
|
6
|
+
schema: {
|
|
7
|
+
type: "string",
|
|
8
|
+
},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.rowId = {
|
|
12
|
+
in: "path",
|
|
13
|
+
name: "rowId",
|
|
14
|
+
required: true,
|
|
15
|
+
description: "The ID of the row which this request is targeting.",
|
|
16
|
+
schema: {
|
|
17
|
+
type: "string",
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.appId = {
|
|
22
|
+
in: "header",
|
|
23
|
+
name: "x-budibase-app-id",
|
|
24
|
+
required: true,
|
|
25
|
+
description: "The ID of the app which this request is targeting.",
|
|
26
|
+
schema: {
|
|
27
|
+
type: "string",
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exports.appIdUrl = {
|
|
32
|
+
in: "path",
|
|
33
|
+
name: "appId",
|
|
34
|
+
required: true,
|
|
35
|
+
description: "The ID of the app which this request is targeting.",
|
|
36
|
+
schema: {
|
|
37
|
+
type: "string",
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.queryId = {
|
|
42
|
+
in: "path",
|
|
43
|
+
name: "queryId",
|
|
44
|
+
required: true,
|
|
45
|
+
description: "The ID of the query which this request is targeting.",
|
|
46
|
+
schema: {
|
|
47
|
+
type: "string",
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
exports.userId = {
|
|
52
|
+
in: "path",
|
|
53
|
+
name: "userId",
|
|
54
|
+
required: true,
|
|
55
|
+
description: "The ID of the user which this request is targeting.",
|
|
56
|
+
schema: {
|
|
57
|
+
type: "string",
|
|
58
|
+
},
|
|
59
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const userResource = require("./user")
|
|
2
|
+
const { object } = require("./utils")
|
|
3
|
+
const Resource = require("./utils/Resource")
|
|
4
|
+
|
|
5
|
+
const application = {
|
|
6
|
+
_id: "app_metadata",
|
|
7
|
+
appId: "app_dev_957b12f943d348faa61db7e18e088d0f",
|
|
8
|
+
version: "1.0.58-alpha.0",
|
|
9
|
+
name: "App name",
|
|
10
|
+
url: "/app-url",
|
|
11
|
+
tenantId: "default",
|
|
12
|
+
updatedAt: "2022-02-22T13:00:54.035Z",
|
|
13
|
+
createdAt: "2022-02-11T18:02:26.961Z",
|
|
14
|
+
status: "development",
|
|
15
|
+
lockedBy: userResource.getExamples().user.value.user,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const base = {
|
|
19
|
+
name: {
|
|
20
|
+
description: "The name of the app.",
|
|
21
|
+
type: "string",
|
|
22
|
+
},
|
|
23
|
+
url: {
|
|
24
|
+
description:
|
|
25
|
+
"The URL by which the app is accessed, this must be URL encoded.",
|
|
26
|
+
type: "string",
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const applicationSchema = object(base, { required: ["name", "url"] })
|
|
31
|
+
|
|
32
|
+
const applicationOutputSchema = object(
|
|
33
|
+
{
|
|
34
|
+
...base,
|
|
35
|
+
_id: {
|
|
36
|
+
description: "The ID of the app.",
|
|
37
|
+
type: "string",
|
|
38
|
+
},
|
|
39
|
+
status: {
|
|
40
|
+
description:
|
|
41
|
+
"The status of the app, stating it if is the development or published version.",
|
|
42
|
+
type: "string",
|
|
43
|
+
enum: ["development", "published"],
|
|
44
|
+
},
|
|
45
|
+
createdAt: {
|
|
46
|
+
description:
|
|
47
|
+
"States when the app was created, will be constant. Stored in ISO format.",
|
|
48
|
+
type: "string",
|
|
49
|
+
},
|
|
50
|
+
updatedAt: {
|
|
51
|
+
description:
|
|
52
|
+
"States the last time the app was updated - stored in ISO format.",
|
|
53
|
+
type: "string",
|
|
54
|
+
},
|
|
55
|
+
version: {
|
|
56
|
+
description:
|
|
57
|
+
"States the version of the Budibase client this app is currently based on.",
|
|
58
|
+
type: "string",
|
|
59
|
+
},
|
|
60
|
+
tenantId: {
|
|
61
|
+
description:
|
|
62
|
+
"In a multi-tenant environment this will state the tenant this app is within.",
|
|
63
|
+
type: "string",
|
|
64
|
+
},
|
|
65
|
+
lockedBy: {
|
|
66
|
+
description: "The user this app is currently being built by.",
|
|
67
|
+
type: "object",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
required: [
|
|
72
|
+
"_id",
|
|
73
|
+
"name",
|
|
74
|
+
"url",
|
|
75
|
+
"status",
|
|
76
|
+
"createdAt",
|
|
77
|
+
"updatedAt",
|
|
78
|
+
"version",
|
|
79
|
+
],
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
module.exports = new Resource()
|
|
84
|
+
.setExamples({
|
|
85
|
+
application: {
|
|
86
|
+
value: {
|
|
87
|
+
data: application,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
applications: {
|
|
91
|
+
value: {
|
|
92
|
+
data: [application],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
.setSchemas({
|
|
97
|
+
application: applicationSchema,
|
|
98
|
+
applicationOutput: object({
|
|
99
|
+
data: applicationOutputSchema,
|
|
100
|
+
}),
|
|
101
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const application = require("./application")
|
|
2
|
+
const row = require("./row")
|
|
3
|
+
const table = require("./table")
|
|
4
|
+
const query = require("./query")
|
|
5
|
+
const user = require("./user")
|
|
6
|
+
const misc = require("./misc")
|
|
7
|
+
|
|
8
|
+
exports.examples = {
|
|
9
|
+
...application.getExamples(),
|
|
10
|
+
...row.getExamples(),
|
|
11
|
+
...table.getExamples(),
|
|
12
|
+
...query.getExamples(),
|
|
13
|
+
...user.getExamples(),
|
|
14
|
+
...misc.getExamples(),
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.schemas = {
|
|
18
|
+
...application.getSchemas(),
|
|
19
|
+
...row.getSchemas(),
|
|
20
|
+
...table.getSchemas(),
|
|
21
|
+
...query.getSchemas(),
|
|
22
|
+
...user.getSchemas(),
|
|
23
|
+
...misc.getSchemas(),
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const { object } = require("./utils")
|
|
2
|
+
const Resource = require("./utils/Resource")
|
|
3
|
+
|
|
4
|
+
module.exports = new Resource().setSchemas({
|
|
5
|
+
nameSearch: object({
|
|
6
|
+
name: {
|
|
7
|
+
type: "string",
|
|
8
|
+
description:
|
|
9
|
+
"The name to be used when searching - this will be used in a case insensitive starts with match.",
|
|
10
|
+
},
|
|
11
|
+
}),
|
|
12
|
+
})
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
const Resource = require("./utils/Resource")
|
|
2
|
+
const { object } = require("./utils")
|
|
3
|
+
const { BaseQueryVerbs } = require("../../src/constants")
|
|
4
|
+
|
|
5
|
+
const query = {
|
|
6
|
+
_id: "query_datasource_plus_4d8be0c506b9465daf4bf84d890fdab6_454854487c574d45bc4029b1e153219e",
|
|
7
|
+
datasourceId: "datasource_plus_4d8be0c506b9465daf4bf84d890fdab6",
|
|
8
|
+
parameters: [],
|
|
9
|
+
fields: {
|
|
10
|
+
sql: "select * from persons",
|
|
11
|
+
},
|
|
12
|
+
queryVerb: "read",
|
|
13
|
+
name: "Help",
|
|
14
|
+
schema: {
|
|
15
|
+
personid: {
|
|
16
|
+
name: "personid",
|
|
17
|
+
type: "string",
|
|
18
|
+
},
|
|
19
|
+
lastname: {
|
|
20
|
+
name: "lastname",
|
|
21
|
+
type: "string",
|
|
22
|
+
},
|
|
23
|
+
firstname: {
|
|
24
|
+
name: "firstname",
|
|
25
|
+
type: "string",
|
|
26
|
+
},
|
|
27
|
+
address: {
|
|
28
|
+
name: "address",
|
|
29
|
+
type: "string",
|
|
30
|
+
},
|
|
31
|
+
city: {
|
|
32
|
+
name: "city",
|
|
33
|
+
type: "string",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
transformer: "return data",
|
|
37
|
+
readable: true,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const restResponse = {
|
|
41
|
+
value: {
|
|
42
|
+
data: [
|
|
43
|
+
{
|
|
44
|
+
value: "<html lang='en-GB'></html>",
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
pagination: {
|
|
48
|
+
cursor: "2",
|
|
49
|
+
},
|
|
50
|
+
raw: "<html lang='en-GB'></html>",
|
|
51
|
+
headers: {
|
|
52
|
+
"content-type": "text/html; charset=ISO-8859-1",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const sqlResponse = {
|
|
58
|
+
value: {
|
|
59
|
+
data: [
|
|
60
|
+
{
|
|
61
|
+
personid: 1,
|
|
62
|
+
lastname: "Hughes",
|
|
63
|
+
firstname: "Mike",
|
|
64
|
+
address: "123 Fake Street",
|
|
65
|
+
city: "Belfast",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
personid: 2,
|
|
69
|
+
lastname: "Smith",
|
|
70
|
+
firstname: "John",
|
|
71
|
+
address: "64 Updown Road",
|
|
72
|
+
city: "Dublin",
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const querySchema = object(
|
|
79
|
+
{
|
|
80
|
+
_id: {
|
|
81
|
+
description: "The ID of the query.",
|
|
82
|
+
type: "string",
|
|
83
|
+
},
|
|
84
|
+
datasourceId: {
|
|
85
|
+
description: "The ID of the data source the query belongs to.",
|
|
86
|
+
type: "string",
|
|
87
|
+
},
|
|
88
|
+
parameters: {
|
|
89
|
+
description: "The bindings which are required to perform this query.",
|
|
90
|
+
type: "array",
|
|
91
|
+
items: {
|
|
92
|
+
type: "string",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
fields: {
|
|
96
|
+
description:
|
|
97
|
+
"The fields that are used to perform this query, e.g. the sql statement",
|
|
98
|
+
type: "object",
|
|
99
|
+
},
|
|
100
|
+
queryVerb: {
|
|
101
|
+
description: "The verb that describes this query.",
|
|
102
|
+
enum: Object.values(BaseQueryVerbs),
|
|
103
|
+
},
|
|
104
|
+
name: {
|
|
105
|
+
description: "The name of the query.",
|
|
106
|
+
type: "string",
|
|
107
|
+
},
|
|
108
|
+
schema: {
|
|
109
|
+
description:
|
|
110
|
+
"The schema of the data returned when the query is executed.",
|
|
111
|
+
type: "object",
|
|
112
|
+
},
|
|
113
|
+
transformer: {
|
|
114
|
+
description:
|
|
115
|
+
"The JavaScript transformer function, applied after the query responds with data.",
|
|
116
|
+
type: "string",
|
|
117
|
+
},
|
|
118
|
+
readable: {
|
|
119
|
+
description: "Whether the query has readable data.",
|
|
120
|
+
type: "boolean",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{ required: ["name", "schema", "_id"] }
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
const executeQuerySchema = {
|
|
127
|
+
description:
|
|
128
|
+
"The query body must contain the required parameters for the query, this depends on query type, setup and bindings.",
|
|
129
|
+
type: "object",
|
|
130
|
+
additionalProperties: {
|
|
131
|
+
description:
|
|
132
|
+
"Key value properties of any type, depending on the query output schema.",
|
|
133
|
+
},
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const executeQueryOutputSchema = object(
|
|
137
|
+
{
|
|
138
|
+
data: {
|
|
139
|
+
description: "The data response from the query.",
|
|
140
|
+
type: "array",
|
|
141
|
+
items: {
|
|
142
|
+
type: "object",
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
extra: {
|
|
146
|
+
description:
|
|
147
|
+
"Extra information that is not part of the main data, e.g. headers.",
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
headers: {
|
|
151
|
+
description:
|
|
152
|
+
"If carrying out a REST request, this will contain the response headers.",
|
|
153
|
+
type: "object",
|
|
154
|
+
},
|
|
155
|
+
raw: {
|
|
156
|
+
description: "The raw query response, as a string.",
|
|
157
|
+
type: "string",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
pagination: {
|
|
162
|
+
description:
|
|
163
|
+
"If pagination is supported, this will contain the bookmark/anchor information for it.",
|
|
164
|
+
type: "object",
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{ required: ["data"] }
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
module.exports = new Resource()
|
|
171
|
+
.setExamples({
|
|
172
|
+
query: {
|
|
173
|
+
value: {
|
|
174
|
+
data: query,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
queries: {
|
|
178
|
+
value: {
|
|
179
|
+
data: [query],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
restResponse,
|
|
183
|
+
sqlResponse,
|
|
184
|
+
})
|
|
185
|
+
.setSchemas({
|
|
186
|
+
executeQuery: executeQuerySchema,
|
|
187
|
+
executeQueryOutput: executeQueryOutputSchema,
|
|
188
|
+
query: querySchema,
|
|
189
|
+
})
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
const { object } = require("./utils")
|
|
2
|
+
const Resource = require("./utils/Resource")
|
|
3
|
+
|
|
4
|
+
const baseRow = {
|
|
5
|
+
_id: "ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4",
|
|
6
|
+
type: "row",
|
|
7
|
+
tableId: "ta_5b1649e42a5b41dea4ef7742a36a7a70",
|
|
8
|
+
name: "Mike",
|
|
9
|
+
age: 30,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const inputRow = {
|
|
13
|
+
...baseRow,
|
|
14
|
+
relationship: ["ro_ta_..."],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const row = {
|
|
18
|
+
...baseRow,
|
|
19
|
+
relationship: [
|
|
20
|
+
{
|
|
21
|
+
primaryDisplay: "Joe",
|
|
22
|
+
_id: "ro_ta_...",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const enrichedRow = {
|
|
28
|
+
_id: "ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4",
|
|
29
|
+
name: "eg",
|
|
30
|
+
tableId: "ta_5b1649e42a5b41dea4ef7742a36a7a70",
|
|
31
|
+
type: "row",
|
|
32
|
+
relationship: [
|
|
33
|
+
{
|
|
34
|
+
_id: "ro_ta_users_us_8f3d717147d74d759d8cef5b6712062f",
|
|
35
|
+
name: "Joe",
|
|
36
|
+
tableId: "ta_users",
|
|
37
|
+
internal: [
|
|
38
|
+
{
|
|
39
|
+
_id: "ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4",
|
|
40
|
+
primaryDisplay: "eg",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const rowSchema = {
|
|
48
|
+
description: "The row to be created/updated, based on the table schema.",
|
|
49
|
+
type: "object",
|
|
50
|
+
additionalProperties: {
|
|
51
|
+
description:
|
|
52
|
+
"Key value properties of any type, depending on the table schema.",
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const rowOutputSchema = {
|
|
57
|
+
...rowSchema,
|
|
58
|
+
properties: {
|
|
59
|
+
...rowSchema.properties,
|
|
60
|
+
_id: {
|
|
61
|
+
description: "The ID of the row.",
|
|
62
|
+
type: "string",
|
|
63
|
+
},
|
|
64
|
+
tableId: {
|
|
65
|
+
description: "The ID of the table this row comes from.",
|
|
66
|
+
type: "string",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
required: ["tableId", "_id"],
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const searchOutputSchema = {
|
|
73
|
+
type: "object",
|
|
74
|
+
required: ["data"],
|
|
75
|
+
properties: {
|
|
76
|
+
data: {
|
|
77
|
+
description:
|
|
78
|
+
"An array of rows, these will each contain an _id field which can be used to update or delete them.",
|
|
79
|
+
type: "array",
|
|
80
|
+
items: {
|
|
81
|
+
type: "object",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
bookmark: {
|
|
85
|
+
description: "If pagination in use, this should be provided.",
|
|
86
|
+
oneOf: [{ type: "string" }, { type: "integer" }],
|
|
87
|
+
},
|
|
88
|
+
hasNextPage: {
|
|
89
|
+
description:
|
|
90
|
+
"If pagination in use, this will determine if there is another page to fetch.",
|
|
91
|
+
type: "boolean",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
module.exports = new Resource()
|
|
97
|
+
.setExamples({
|
|
98
|
+
inputRow: {
|
|
99
|
+
value: inputRow,
|
|
100
|
+
},
|
|
101
|
+
row: {
|
|
102
|
+
value: {
|
|
103
|
+
data: row,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
enrichedRow: {
|
|
107
|
+
value: {
|
|
108
|
+
data: enrichedRow,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
rows: {
|
|
112
|
+
value: {
|
|
113
|
+
data: [row],
|
|
114
|
+
hasNextPage: true,
|
|
115
|
+
bookmark: 10,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
})
|
|
119
|
+
.setSchemas({
|
|
120
|
+
row: rowSchema,
|
|
121
|
+
searchOutput: searchOutputSchema,
|
|
122
|
+
rowOutput: object({
|
|
123
|
+
data: rowOutputSchema,
|
|
124
|
+
}),
|
|
125
|
+
})
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
const {
|
|
2
|
+
FieldTypes,
|
|
3
|
+
RelationshipTypes,
|
|
4
|
+
FormulaTypes,
|
|
5
|
+
} = require("../../src/constants")
|
|
6
|
+
const { object } = require("./utils")
|
|
7
|
+
const Resource = require("./utils/Resource")
|
|
8
|
+
|
|
9
|
+
const table = {
|
|
10
|
+
_id: "ta_5b1649e42a5b41dea4ef7742a36a7a70",
|
|
11
|
+
name: "People",
|
|
12
|
+
schema: {
|
|
13
|
+
name: {
|
|
14
|
+
type: "string",
|
|
15
|
+
name: "name",
|
|
16
|
+
},
|
|
17
|
+
age: {
|
|
18
|
+
type: "number",
|
|
19
|
+
name: "age",
|
|
20
|
+
},
|
|
21
|
+
relationship: {
|
|
22
|
+
type: "link",
|
|
23
|
+
name: "relationship",
|
|
24
|
+
tableId: "ta_...",
|
|
25
|
+
fieldName: "relatedColumn",
|
|
26
|
+
relationshipType: "many-to-many",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const baseColumnDef = {
|
|
32
|
+
type: {
|
|
33
|
+
type: "string",
|
|
34
|
+
enum: Object.values(FieldTypes),
|
|
35
|
+
description:
|
|
36
|
+
"Defines the type of the column, most explain themselves, a link column is a relationship.",
|
|
37
|
+
},
|
|
38
|
+
constraints: {
|
|
39
|
+
type: "object",
|
|
40
|
+
description:
|
|
41
|
+
"A constraint can be applied to the column which will be validated against when a row is saved.",
|
|
42
|
+
properties: {
|
|
43
|
+
type: {
|
|
44
|
+
type: "string",
|
|
45
|
+
enum: ["string", "number", "object", "boolean"],
|
|
46
|
+
},
|
|
47
|
+
presence: {
|
|
48
|
+
type: "boolean",
|
|
49
|
+
description: "Defines whether the column is required or not.",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
name: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "The name of the column.",
|
|
56
|
+
},
|
|
57
|
+
autocolumn: {
|
|
58
|
+
type: "boolean",
|
|
59
|
+
description: "Defines whether the column is automatically generated.",
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const tableSchema = {
|
|
64
|
+
description: "The table to be created/updated.",
|
|
65
|
+
type: "object",
|
|
66
|
+
required: ["name", "schema"],
|
|
67
|
+
properties: {
|
|
68
|
+
name: {
|
|
69
|
+
description: "The name of the table.",
|
|
70
|
+
type: "string",
|
|
71
|
+
},
|
|
72
|
+
primaryDisplay: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description:
|
|
75
|
+
"The name of the column which should be used in relationship tags when relating to this table.",
|
|
76
|
+
},
|
|
77
|
+
schema: {
|
|
78
|
+
type: "object",
|
|
79
|
+
additionalProperties: {
|
|
80
|
+
oneOf: [
|
|
81
|
+
// relationship
|
|
82
|
+
{
|
|
83
|
+
type: "object",
|
|
84
|
+
properties: {
|
|
85
|
+
...baseColumnDef,
|
|
86
|
+
type: {
|
|
87
|
+
type: "string",
|
|
88
|
+
enum: [FieldTypes.LINK],
|
|
89
|
+
description: "A relationship column.",
|
|
90
|
+
},
|
|
91
|
+
fieldName: {
|
|
92
|
+
type: "string",
|
|
93
|
+
description:
|
|
94
|
+
"The name of the column which a relationship column is related to in another table.",
|
|
95
|
+
},
|
|
96
|
+
tableId: {
|
|
97
|
+
type: "string",
|
|
98
|
+
description:
|
|
99
|
+
"The ID of the table which a relationship column is related to.",
|
|
100
|
+
},
|
|
101
|
+
relationshipType: {
|
|
102
|
+
type: "string",
|
|
103
|
+
enum: Object.values(RelationshipTypes),
|
|
104
|
+
description:
|
|
105
|
+
"Defines the type of relationship that this column will be used for.",
|
|
106
|
+
},
|
|
107
|
+
through: {
|
|
108
|
+
type: "string",
|
|
109
|
+
description:
|
|
110
|
+
"When using a SQL table that contains many to many relationships this defines the table the relationships are linked through.",
|
|
111
|
+
},
|
|
112
|
+
foreignKey: {
|
|
113
|
+
type: "string",
|
|
114
|
+
description:
|
|
115
|
+
"When using a SQL table that contains a one to many relationship this defines the foreign key.",
|
|
116
|
+
},
|
|
117
|
+
throughFrom: {
|
|
118
|
+
type: "string",
|
|
119
|
+
description:
|
|
120
|
+
"When using a SQL table that utilises a through table, this defines the primary key in the through table for this table.",
|
|
121
|
+
},
|
|
122
|
+
throughTo: {
|
|
123
|
+
type: "string",
|
|
124
|
+
description:
|
|
125
|
+
"When using a SQL table that utilises a through table, this defines the primary key in the through table for the related table.",
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
type: "object",
|
|
131
|
+
properties: {
|
|
132
|
+
...baseColumnDef,
|
|
133
|
+
type: {
|
|
134
|
+
type: "string",
|
|
135
|
+
enum: [FieldTypes.FORMULA],
|
|
136
|
+
description: "A formula column.",
|
|
137
|
+
},
|
|
138
|
+
formula: {
|
|
139
|
+
type: "string",
|
|
140
|
+
description:
|
|
141
|
+
"Defines a Handlebars or JavaScript formula to use, note that Javascript formulas are expected to be provided in the base64 format.",
|
|
142
|
+
},
|
|
143
|
+
formulaType: {
|
|
144
|
+
type: "string",
|
|
145
|
+
enum: Object.values(FormulaTypes),
|
|
146
|
+
description:
|
|
147
|
+
"Defines whether this is a static or dynamic formula.",
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
type: "object",
|
|
153
|
+
properties: baseColumnDef,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const tableOutputSchema = {
|
|
162
|
+
...tableSchema,
|
|
163
|
+
properties: {
|
|
164
|
+
...tableSchema.properties,
|
|
165
|
+
_id: {
|
|
166
|
+
description: "The ID of the table.",
|
|
167
|
+
type: "string",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
required: [...tableSchema.required, "_id"],
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
module.exports = new Resource()
|
|
174
|
+
.setExamples({
|
|
175
|
+
table: {
|
|
176
|
+
value: {
|
|
177
|
+
data: table,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
tables: {
|
|
181
|
+
value: {
|
|
182
|
+
data: [table],
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
})
|
|
186
|
+
.setSchemas({
|
|
187
|
+
table: tableSchema,
|
|
188
|
+
tableOutput: object({
|
|
189
|
+
data: tableOutputSchema,
|
|
190
|
+
}),
|
|
191
|
+
})
|