@budibase/server 2.5.6-alpha.33 → 2.5.6-alpha.34

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.5.6-alpha.33",
4
+ "version": "2.5.6-alpha.34",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -45,12 +45,12 @@
45
45
  "license": "GPL-3.0",
46
46
  "dependencies": {
47
47
  "@apidevtools/swagger-parser": "10.0.3",
48
- "@budibase/backend-core": "2.5.6-alpha.33",
49
- "@budibase/client": "2.5.6-alpha.33",
50
- "@budibase/pro": "2.5.6-alpha.32",
51
- "@budibase/shared-core": "2.5.6-alpha.33",
52
- "@budibase/string-templates": "2.5.6-alpha.33",
53
- "@budibase/types": "2.5.6-alpha.33",
48
+ "@budibase/backend-core": "2.5.6-alpha.34",
49
+ "@budibase/client": "2.5.6-alpha.34",
50
+ "@budibase/pro": "2.5.6-alpha.33",
51
+ "@budibase/shared-core": "2.5.6-alpha.34",
52
+ "@budibase/string-templates": "2.5.6-alpha.34",
53
+ "@budibase/types": "2.5.6-alpha.34",
54
54
  "@bull-board/api": "3.7.0",
55
55
  "@bull-board/koa": "3.9.4",
56
56
  "@elastic/elasticsearch": "7.10.0",
@@ -176,5 +176,5 @@
176
176
  "optionalDependencies": {
177
177
  "oracledb": "5.3.0"
178
178
  },
179
- "gitHead": "145bbc2667e43ab4c67e3403b29d3af02936756f"
179
+ "gitHead": "7968ddb9253cdc7176f68a50923262f47711811d"
180
180
  }
@@ -12,7 +12,15 @@ import { getIntegration } from "../../integrations"
12
12
  import { getDatasourceAndQuery } from "./row/utils"
13
13
  import { invalidateDynamicVariables } from "../../threads/utils"
14
14
  import { db as dbCore, context, events } from "@budibase/backend-core"
15
- import { UserCtx, Datasource, Row } from "@budibase/types"
15
+ import {
16
+ UserCtx,
17
+ Datasource,
18
+ Row,
19
+ CreateDatasourceResponse,
20
+ UpdateDatasourceResponse,
21
+ UpdateDatasourceRequest,
22
+ CreateDatasourceRequest,
23
+ } from "@budibase/types"
16
24
  import sdk from "../../sdk"
17
25
 
18
26
  export async function fetch(ctx: UserCtx) {
@@ -146,7 +154,7 @@ async function invalidateVariables(
146
154
  await invalidateDynamicVariables(toInvalidate)
147
155
  }
148
156
 
149
- export async function update(ctx: UserCtx) {
157
+ export async function update(ctx: UserCtx<any, UpdateDatasourceResponse>) {
150
158
  const db = context.getAppDB()
151
159
  const datasourceId = ctx.params.datasourceId
152
160
  let datasource = await sdk.datasources.get(datasourceId)
@@ -187,15 +195,17 @@ export async function update(ctx: UserCtx) {
187
195
  }
188
196
  }
189
197
 
190
- export async function save(ctx: UserCtx) {
198
+ export async function save(
199
+ ctx: UserCtx<CreateDatasourceRequest, CreateDatasourceResponse>
200
+ ) {
191
201
  const db = context.getAppDB()
192
202
  const plus = ctx.request.body.datasource.plus
193
203
  const fetchSchema = ctx.request.body.fetchSchema
194
204
 
195
205
  const datasource = {
196
206
  _id: generateDatasourceID({ plus }),
197
- type: plus ? DocumentType.DATASOURCE_PLUS : DocumentType.DATASOURCE,
198
207
  ...ctx.request.body.datasource,
208
+ type: plus ? DocumentType.DATASOURCE_PLUS : DocumentType.DATASOURCE,
199
209
  }
200
210
 
201
211
  let schemaError = null
@@ -218,7 +228,7 @@ export async function save(ctx: UserCtx) {
218
228
  }
219
229
  }
220
230
 
221
- const response: any = {
231
+ const response: CreateDatasourceResponse = {
222
232
  datasource: await sdk.datasources.removeSecretSingle(datasource),
223
233
  }
224
234
  if (schemaError) {
@@ -349,7 +349,7 @@ describe("row api - postgres", () => {
349
349
  },
350
350
  plus: true,
351
351
  source: "POSTGRES",
352
- type: "datasource",
352
+ type: "datasource_plus",
353
353
  _id: expect.any(String),
354
354
  _rev: expect.any(String),
355
355
  createdAt: expect.any(String),