@budibase/server 2.4.42-alpha.3 → 2.4.42

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.
Files changed (60) hide show
  1. package/__mocks__/node-fetch.ts +1 -6
  2. package/builder/assets/favicon.e7fc7733.png +0 -0
  3. package/builder/assets/{index.7fec1a6d.js → index.3d64bc07.js} +384 -384
  4. package/builder/assets/index.b0e3aca6.css +6 -0
  5. package/builder/index.html +7 -7
  6. package/dist/api/controllers/application.js +24 -28
  7. package/dist/api/controllers/row/external.js +0 -15
  8. package/dist/api/controllers/row/utils.js +3 -4
  9. package/dist/api/controllers/static/index.js +24 -84
  10. package/dist/api/controllers/static/templates/BudibaseApp.svelte +10 -33
  11. package/dist/api/controllers/table/utils.js +1 -0
  12. package/dist/api/routes/public/index.js +0 -8
  13. package/dist/app.js +0 -1
  14. package/dist/integrations/redis.js +1 -1
  15. package/dist/package.json +12 -13
  16. package/dist/sdk/users/utils.js +1 -2
  17. package/dist/tsconfig.build.tsbuildinfo +1 -1
  18. package/dist/utilities/global.js +7 -17
  19. package/jest.config.ts +0 -1
  20. package/package.json +13 -14
  21. package/scripts/test.sh +3 -3
  22. package/specs/openapi.json +0 -39
  23. package/specs/openapi.yaml +0 -169
  24. package/specs/resources/application.ts +0 -11
  25. package/specs/resources/index.ts +0 -2
  26. package/src/api/controllers/application.ts +21 -20
  27. package/src/api/controllers/row/external.ts +0 -14
  28. package/src/api/controllers/row/utils.ts +3 -4
  29. package/src/api/controllers/static/index.ts +26 -69
  30. package/src/api/controllers/static/templates/BudibaseApp.svelte +10 -33
  31. package/src/api/controllers/table/utils.ts +1 -0
  32. package/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap +48 -48
  33. package/src/api/routes/public/index.ts +1 -10
  34. package/src/api/routes/tests/__snapshots__/datasource.spec.ts.snap +22 -22
  35. package/src/api/routes/tests/__snapshots__/view.spec.js.snap +5 -5
  36. package/src/api/routes/tests/internalSearch.spec.js +7 -8
  37. package/src/app.ts +1 -2
  38. package/src/automations/automationUtils.ts +1 -1
  39. package/src/automations/tests/automation.spec.js +84 -0
  40. package/src/definitions/openapi.ts +0 -15
  41. package/src/integration-test/postgres.spec.ts +52 -46
  42. package/src/integrations/redis.ts +1 -1
  43. package/src/integrations/tests/googlesheets.spec.ts +13 -13
  44. package/src/integrations/tests/redis.spec.ts +5 -9
  45. package/src/middleware/currentapp.ts +2 -2
  46. package/src/sdk/users/utils.ts +1 -4
  47. package/src/tests/jestEnv.ts +0 -1
  48. package/src/tests/jestSetup.ts +1 -5
  49. package/src/tests/utilities/TestConfiguration.ts +0 -13
  50. package/src/tests/utilities/structures.ts +1 -13
  51. package/src/utilities/global.ts +9 -21
  52. package/builder/assets/index.3cb1022d.css +0 -6
  53. package/dist/api/controllers/public/metrics.js +0 -113
  54. package/dist/api/routes/public/metrics.js +0 -30
  55. package/specs/resources/metrics.ts +0 -81
  56. package/src/api/controllers/public/metrics.ts +0 -251
  57. package/src/api/routes/public/metrics.ts +0 -28
  58. package/src/api/routes/public/tests/metrics.spec.js +0 -34
  59. package/src/api/routes/tests/appSync.spec.ts +0 -31
  60. package/src/automations/tests/automation.spec.ts +0 -99
@@ -11,12 +11,10 @@ import {
11
11
  } from "../../../utilities/fileSystem"
12
12
  import env from "../../../environment"
13
13
  import { DocumentType } from "../../../db/utils"
14
- import { context, objectStore, utils, configs } from "@budibase/backend-core"
14
+ import { context, objectStore, utils } from "@budibase/backend-core"
15
15
  import AWS from "aws-sdk"
16
16
  import fs from "fs"
17
17
  import sdk from "../../../sdk"
18
- import * as pro from "@budibase/pro"
19
-
20
18
  const send = require("koa-send")
21
19
 
22
20
  async function prepareUpload({ s3Key, bucket, metadata, file }: any) {
@@ -100,74 +98,33 @@ export const deleteObjects = async function (ctx: any) {
100
98
  }
101
99
 
102
100
  export const serveApp = async function (ctx: any) {
103
- //Public Settings
104
- const { config } = await configs.getSettingsConfigDoc()
105
- const branding = await pro.branding.getBrandingConfig(config)
106
-
107
- let db
108
- try {
109
- db = context.getAppDB({ skip_setup: true })
110
- const appInfo = await db.get(DocumentType.APP_METADATA)
111
- let appId = context.getAppId()
101
+ const db = context.getAppDB({ skip_setup: true })
102
+ const appInfo = await db.get(DocumentType.APP_METADATA)
103
+ let appId = context.getAppId()
112
104
 
113
- if (!env.isJest()) {
114
- const App = require("./templates/BudibaseApp.svelte").default
115
- const plugins = objectStore.enrichPluginURLs(appInfo.usedPlugins)
116
- const { head, html, css } = App.render({
117
- metaImage:
118
- branding?.metaImageUrl ||
119
- "https://res.cloudinary.com/daog6scxm/image/upload/v1666109324/meta-images/budibase-meta-image_uukc1m.png",
120
- metaDescription: branding?.metaDescription || "",
121
- metaTitle:
122
- branding?.metaTitle || `${appInfo.name} - built with Budibase`,
123
- title: appInfo.name,
124
- production: env.isProd(),
125
- appId,
126
- clientLibPath: objectStore.clientLibraryUrl(appId!, appInfo.version),
127
- usedPlugins: plugins,
128
- favicon:
129
- branding.faviconUrl !== ""
130
- ? objectStore.getGlobalFileUrl("settings", "faviconUrl")
131
- : "",
132
- logo:
133
- config?.logoUrl !== ""
134
- ? objectStore.getGlobalFileUrl("settings", "logoUrl")
135
- : "",
136
- })
137
- const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)
138
- ctx.body = await processString(appHbs, {
139
- head,
140
- body: html,
141
- style: css.code,
142
- appId,
143
- })
144
- } else {
145
- // just return the app info for jest to assert on
146
- ctx.body = appInfo
147
- }
148
- } catch (error) {
149
- if (!env.isJest()) {
150
- const App = require("./templates/BudibaseApp.svelte").default
151
- const { head, html, css } = App.render({
152
- title: branding?.metaTitle,
153
- metaTitle: branding?.metaTitle,
154
- metaImage:
155
- branding?.metaImageUrl ||
156
- "https://res.cloudinary.com/daog6scxm/image/upload/v1666109324/meta-images/budibase-meta-image_uukc1m.png",
157
- metaDescription: branding?.metaDescription || "",
158
- favicon:
159
- branding.faviconUrl !== ""
160
- ? objectStore.getGlobalFileUrl("settings", "faviconUrl")
161
- : "",
162
- })
105
+ if (!env.isJest()) {
106
+ const App = require("./templates/BudibaseApp.svelte").default
107
+ const plugins = objectStore.enrichPluginURLs(appInfo.usedPlugins)
108
+ const { head, html, css } = App.render({
109
+ metaImage:
110
+ "https://res.cloudinary.com/daog6scxm/image/upload/v1666109324/meta-images/budibase-meta-image_uukc1m.png",
111
+ title: appInfo.name,
112
+ production: env.isProd(),
113
+ appId,
114
+ clientLibPath: objectStore.clientLibraryUrl(appId!, appInfo.version),
115
+ usedPlugins: plugins,
116
+ })
163
117
 
164
- const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)
165
- ctx.body = await processString(appHbs, {
166
- head,
167
- body: html,
168
- style: css.code,
169
- })
170
- }
118
+ const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)
119
+ ctx.body = await processString(appHbs, {
120
+ head,
121
+ body: html,
122
+ style: css.code,
123
+ appId,
124
+ })
125
+ } else {
126
+ // just return the app info for jest to assert on
127
+ ctx.body = appInfo
171
128
  }
172
129
  }
173
130
 
@@ -1,10 +1,7 @@
1
1
  <script>
2
2
  export let title = ""
3
3
  export let favicon = ""
4
-
5
4
  export let metaImage = ""
6
- export let metaTitle = ""
7
- export let metaDescription = ""
8
5
 
9
6
  export let clientLibPath
10
7
  export let usedPlugins
@@ -16,33 +13,18 @@
16
13
  name="viewport"
17
14
  content="width=device-width, initial-scale=1.0, viewport-fit=cover"
18
15
  />
19
-
20
- <!-- Primary Meta Tags -->
21
- <meta name="title" content={metaTitle} />
22
- <meta name="description" content={metaDescription} />
23
-
24
16
  <!-- Opengraph Meta Tags -->
17
+ <meta name="twitter:card" content="summary_large_image" />
18
+ <meta name="twitter:site" content="@budibase" />
19
+ <meta name="twitter:image" content={metaImage} />
20
+ <meta name="twitter:title" content="{title} - built with Budibase" />
25
21
  <meta property="og:site_name" content="Budibase" />
26
22
  <meta property="og:title" content="{title} - built with Budibase" />
27
- <meta property="og:description" content={metaDescription} />
28
23
  <meta property="og:type" content="website" />
29
24
  <meta property="og:image" content={metaImage} />
30
25
 
31
- <!-- Twitter -->
32
- <meta property="twitter:card" content="summary_large_image" />
33
- <meta property="twitter:site" content="@budibase" />
34
- <meta property="twitter:image" content={metaImage} />
35
- <meta property="twitter:image:alt" content="{title} - built with Budibase" />
36
- <meta property="twitter:title" content="{title} - built with Budibase" />
37
- <meta property="twitter:description" content={metaDescription} />
38
-
39
26
  <title>{title}</title>
40
- {#if favicon !== ""}
41
- <link rel="icon" type="image/png" href={favicon} />
42
- {:else}
43
- <link rel="icon" type="image/png" href="https://i.imgur.com/Xhdt1YP.png" />
44
- {/if}
45
-
27
+ <link rel="icon" type="image/png" href={favicon} />
46
28
  <link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
47
29
  <link rel="preconnect" href="https://fonts.gstatic.com" />
48
30
  <link
@@ -101,16 +83,11 @@
101
83
 
102
84
  <body id="app">
103
85
  <div id="error">
104
- {#if clientLibPath}
105
- <h1>There was an error loading your app</h1>
106
- <h2>
107
- The Budibase client library could not be loaded. Try republishing your
108
- app.
109
- </h2>
110
- {:else}
111
- <h2>We couldn't find that application</h2>
112
- <p />
113
- {/if}
86
+ <h1>There was an error loading your app</h1>
87
+ <h2>
88
+ The Budibase client library could not be loaded. Try republishing your
89
+ app.
90
+ </h2>
114
91
  </div>
115
92
  <script type="application/javascript">
116
93
  window.INIT_TIME = Date.now()
@@ -109,6 +109,7 @@ export function importToRows(data: any, table: any, user: any = {}) {
109
109
  noAutoRelationships: true,
110
110
  })
111
111
  row = processed.row
112
+ table = processed.table
112
113
 
113
114
  let fieldName: any
114
115
  let schema: any
@@ -1,48 +1,48 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`viewBuilder Calculate and filter creates a view with the calculation statistics and filter schema 1`] = `
4
- {
4
+ Object {
5
5
  "map": "function (doc) {
6
- if ((doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" && !(
7
- doc["myField"] === undefined ||
8
- doc["myField"] === null ||
9
- doc["myField"] === "" ||
10
- (Array.isArray(doc["myField"]) && doc["myField"].length === 0)
11
- )) && (doc["age"] > 17)) {
12
- emit(doc["_id"], doc["myField"]);
6
+ if ((doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && !(
7
+ doc[\\"myField\\"] === undefined ||
8
+ doc[\\"myField\\"] === null ||
9
+ doc[\\"myField\\"] === \\"\\" ||
10
+ (Array.isArray(doc[\\"myField\\"]) && doc[\\"myField\\"].length === 0)
11
+ )) && (doc[\\"age\\"] > 17)) {
12
+ emit(doc[\\"_id\\"], doc[\\"myField\\"]);
13
13
  }
14
14
  }",
15
- "meta": {
15
+ "meta": Object {
16
16
  "calculation": "stats",
17
17
  "field": "myField",
18
- "filters": [
19
- {
18
+ "filters": Array [
19
+ Object {
20
20
  "condition": "MT",
21
21
  "key": "age",
22
22
  "value": 17,
23
23
  },
24
24
  ],
25
25
  "groupBy": undefined,
26
- "schema": {
27
- "avg": {
26
+ "schema": Object {
27
+ "avg": Object {
28
28
  "type": "number",
29
29
  },
30
- "count": {
30
+ "count": Object {
31
31
  "type": "number",
32
32
  },
33
- "field": {
33
+ "field": Object {
34
34
  "type": "string",
35
35
  },
36
- "max": {
36
+ "max": Object {
37
37
  "type": "number",
38
38
  },
39
- "min": {
39
+ "min": Object {
40
40
  "type": "number",
41
41
  },
42
- "sum": {
42
+ "sum": Object {
43
43
  "type": "number",
44
44
  },
45
- "sumsqr": {
45
+ "sumsqr": Object {
46
46
  "type": "number",
47
47
  },
48
48
  },
@@ -53,42 +53,42 @@ exports[`viewBuilder Calculate and filter creates a view with the calculation st
53
53
  `;
54
54
 
55
55
  exports[`viewBuilder Calculate creates a view with the calculation statistics schema 1`] = `
56
- {
56
+ Object {
57
57
  "map": "function (doc) {
58
- if ((doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" && !(
59
- doc["myField"] === undefined ||
60
- doc["myField"] === null ||
61
- doc["myField"] === "" ||
62
- (Array.isArray(doc["myField"]) && doc["myField"].length === 0)
58
+ if ((doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && !(
59
+ doc[\\"myField\\"] === undefined ||
60
+ doc[\\"myField\\"] === null ||
61
+ doc[\\"myField\\"] === \\"\\" ||
62
+ (Array.isArray(doc[\\"myField\\"]) && doc[\\"myField\\"].length === 0)
63
63
  )) ) {
64
- emit(doc["_id"], doc["myField"]);
64
+ emit(doc[\\"_id\\"], doc[\\"myField\\"]);
65
65
  }
66
66
  }",
67
- "meta": {
67
+ "meta": Object {
68
68
  "calculation": "stats",
69
69
  "field": "myField",
70
- "filters": [],
70
+ "filters": Array [],
71
71
  "groupBy": undefined,
72
- "schema": {
73
- "avg": {
72
+ "schema": Object {
73
+ "avg": Object {
74
74
  "type": "number",
75
75
  },
76
- "count": {
76
+ "count": Object {
77
77
  "type": "number",
78
78
  },
79
- "field": {
79
+ "field": Object {
80
80
  "type": "string",
81
81
  },
82
- "max": {
82
+ "max": Object {
83
83
  "type": "number",
84
84
  },
85
- "min": {
85
+ "min": Object {
86
86
  "type": "number",
87
87
  },
88
- "sum": {
88
+ "sum": Object {
89
89
  "type": "number",
90
90
  },
91
- "sumsqr": {
91
+ "sumsqr": Object {
92
92
  "type": "number",
93
93
  },
94
94
  },
@@ -99,22 +99,22 @@ exports[`viewBuilder Calculate creates a view with the calculation statistics sc
99
99
  `;
100
100
 
101
101
  exports[`viewBuilder Filter creates a view with multiple filters and conjunctions 1`] = `
102
- {
102
+ Object {
103
103
  "map": "function (doc) {
104
- if (doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" && (doc["Name"] === "Test" || doc["Yes"] > "Value")) {
105
- emit(doc["_id"], doc["undefined"]);
104
+ if (doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && (doc[\\"Name\\"] === \\"Test\\" || doc[\\"Yes\\"] > \\"Value\\")) {
105
+ emit(doc[\\"_id\\"], doc[\\"undefined\\"]);
106
106
  }
107
107
  }",
108
- "meta": {
108
+ "meta": Object {
109
109
  "calculation": undefined,
110
110
  "field": undefined,
111
- "filters": [
112
- {
111
+ "filters": Array [
112
+ Object {
113
113
  "condition": "EQUALS",
114
114
  "key": "Name",
115
115
  "value": "Test",
116
116
  },
117
- {
117
+ Object {
118
118
  "condition": "MT",
119
119
  "conjunction": "OR",
120
120
  "key": "Yes",
@@ -129,16 +129,16 @@ exports[`viewBuilder Filter creates a view with multiple filters and conjunction
129
129
  `;
130
130
 
131
131
  exports[`viewBuilder Group By creates a view emitting the group by field 1`] = `
132
- {
132
+ Object {
133
133
  "map": "function (doc) {
134
- if (doc.tableId === "14f1c4e94d6a47b682ce89d35d4c78b0" ) {
135
- emit(doc["age"], doc["score"]);
134
+ if (doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" ) {
135
+ emit(doc[\\"age\\"], doc[\\"score\\"]);
136
136
  }
137
137
  }",
138
- "meta": {
138
+ "meta": Object {
139
139
  "calculation": undefined,
140
140
  "field": "score",
141
- "filters": [],
141
+ "filters": Array [],
142
142
  "groupBy": "age",
143
143
  "schema": null,
144
144
  "tableId": "14f1c4e94d6a47b682ce89d35d4c78b0",
@@ -1,5 +1,4 @@
1
1
  import appEndpoints from "./applications"
2
- import metricEndpoints from "./metrics"
3
2
  import queryEndpoints from "./queries"
4
3
  import tableEndpoints from "./tables"
5
4
  import rowEndpoints from "./rows"
@@ -13,7 +12,7 @@ import env from "../../../environment"
13
12
  // below imports don't have declaration files
14
13
  const Router = require("@koa/router")
15
14
  const { RateLimit, Stores } = require("koa2-ratelimit")
16
- import { middleware, redis, permissions } from "@budibase/backend-core"
15
+ import { redis, permissions } from "@budibase/backend-core"
17
16
  const { PermissionType, PermissionLevel } = permissions
18
17
 
19
18
  const PREFIX = "/api/public/v1"
@@ -92,13 +91,6 @@ function addToRouter(endpoints: any) {
92
91
  }
93
92
  }
94
93
 
95
- function applyAdminRoutes(endpoints: any) {
96
- addMiddleware(endpoints.read, middleware.builderOrAdmin)
97
- addMiddleware(endpoints.write, middleware.builderOrAdmin)
98
- addToRouter(endpoints.read)
99
- addToRouter(endpoints.write)
100
- }
101
-
102
94
  function applyRoutes(
103
95
  endpoints: any,
104
96
  permType: string,
@@ -127,7 +119,6 @@ function applyRoutes(
127
119
  addToRouter(endpoints.write)
128
120
  }
129
121
 
130
- applyAdminRoutes(metricEndpoints)
131
122
  applyRoutes(appEndpoints, PermissionType.APP, "appId")
132
123
  applyRoutes(tableEndpoints, PermissionType.TABLE, "tableId")
133
124
  applyRoutes(userEndpoints, PermissionType.USER, "userId")
@@ -1,21 +1,21 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`/datasources fetch returns all the datasources from the server 1`] = `
4
- [
5
- {
6
- "config": {},
7
- "entities": [
8
- {
4
+ Array [
5
+ Object {
6
+ "config": Object {},
7
+ "entities": Array [
8
+ Object {
9
9
  "_id": "ta_users",
10
10
  "_rev": "1-2375e1bc58aeec664dc1b1f04ad43e44",
11
11
  "createdAt": "2020-01-01T00:00:00.000Z",
12
12
  "name": "Users",
13
13
  "primaryDisplay": "email",
14
- "schema": {
15
- "email": {
16
- "constraints": {
14
+ "schema": Object {
15
+ "email": Object {
16
+ "constraints": Object {
17
17
  "email": true,
18
- "length": {
18
+ "length": Object {
19
19
  "maximum": "",
20
20
  },
21
21
  "presence": true,
@@ -25,8 +25,8 @@ exports[`/datasources fetch returns all the datasources from the server 1`] = `
25
25
  "name": "email",
26
26
  "type": "string",
27
27
  },
28
- "firstName": {
29
- "constraints": {
28
+ "firstName": Object {
29
+ "constraints": Object {
30
30
  "presence": false,
31
31
  "type": "string",
32
32
  },
@@ -34,8 +34,8 @@ exports[`/datasources fetch returns all the datasources from the server 1`] = `
34
34
  "name": "firstName",
35
35
  "type": "string",
36
36
  },
37
- "lastName": {
38
- "constraints": {
37
+ "lastName": Object {
38
+ "constraints": Object {
39
39
  "presence": false,
40
40
  "type": "string",
41
41
  },
@@ -43,9 +43,9 @@ exports[`/datasources fetch returns all the datasources from the server 1`] = `
43
43
  "name": "lastName",
44
44
  "type": "string",
45
45
  },
46
- "roleId": {
47
- "constraints": {
48
- "inclusion": [
46
+ "roleId": Object {
47
+ "constraints": Object {
48
+ "inclusion": Array [
49
49
  "ADMIN",
50
50
  "POWER",
51
51
  "BASIC",
@@ -58,9 +58,9 @@ exports[`/datasources fetch returns all the datasources from the server 1`] = `
58
58
  "name": "roleId",
59
59
  "type": "options",
60
60
  },
61
- "status": {
62
- "constraints": {
63
- "inclusion": [
61
+ "status": Object {
62
+ "constraints": Object {
63
+ "inclusion": Array [
64
64
  "active",
65
65
  "inactive",
66
66
  ],
@@ -74,15 +74,15 @@ exports[`/datasources fetch returns all the datasources from the server 1`] = `
74
74
  },
75
75
  "type": "table",
76
76
  "updatedAt": "2020-01-01T00:00:00.000Z",
77
- "views": {},
77
+ "views": Object {},
78
78
  },
79
79
  ],
80
80
  "name": "Budibase DB",
81
81
  "source": "BUDIBASE",
82
82
  "type": "budibase",
83
83
  },
84
- {
85
- "config": {},
84
+ Object {
85
+ "config": Object {},
86
86
  "createdAt": "2020-01-01T00:00:00.000Z",
87
87
  "name": "Test",
88
88
  "source": "POSTGRES",
@@ -1,8 +1,8 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`/views query returns data for the created view 1`] = `
4
- [
5
- {
4
+ Array [
5
+ Object {
6
6
  "avg": 2333.3333333333335,
7
7
  "count": 3,
8
8
  "group": null,
@@ -15,8 +15,8 @@ exports[`/views query returns data for the created view 1`] = `
15
15
  `;
16
16
 
17
17
  exports[`/views query returns data for the created view using a group by 1`] = `
18
- [
19
- {
18
+ Array [
19
+ Object {
20
20
  "avg": 1500,
21
21
  "count": 2,
22
22
  "group": "One",
@@ -25,7 +25,7 @@ exports[`/views query returns data for the created view using a group by 1`] = `
25
25
  "sum": 3000,
26
26
  "sumsqr": 5000000,
27
27
  },
28
- {
28
+ Object {
29
29
  "avg": 4000,
30
30
  "count": 1,
31
31
  "group": "Two",
@@ -1,7 +1,6 @@
1
- const fetch = require("node-fetch")
2
- fetch.mockSearch()
3
1
  const search = require("../../controllers/row/internalSearch")
4
2
  // this will be mocked out for _search endpoint
3
+ const fetch = require("node-fetch")
5
4
  const PARAMS = {
6
5
  tableId: "ta_12345679abcdef",
7
6
  version: "1",
@@ -21,7 +20,7 @@ function checkLucene(resp, expected, params = PARAMS) {
21
20
  expect(json.bookmark).toBe(PARAMS.bookmark)
22
21
  }
23
22
  expect(json.include_docs).toBe(true)
24
- expect(json.q).toBe(`${expected} AND tableId:"${params.tableId}"`)
23
+ expect(json.q).toBe(`(${expected}) AND tableId:"${params.tableId}"`)
25
24
  expect(json.limit).toBe(params.limit || 50)
26
25
  }
27
26
 
@@ -60,7 +59,7 @@ describe("internal search", () => {
60
59
  "column": "1",
61
60
  }
62
61
  }, PARAMS)
63
- checkLucene(response, `(column:"2" OR !column:"1")`)
62
+ checkLucene(response, `column:"2" OR !column:"1"`)
64
63
  })
65
64
 
66
65
  it("test AND query", async () => {
@@ -72,7 +71,7 @@ describe("internal search", () => {
72
71
  "column": "1",
73
72
  }
74
73
  }, PARAMS)
75
- checkLucene(response, `(*:* AND column:"2" AND !column:"1")`)
74
+ checkLucene(response, `*:* AND column:"2" AND !column:"1"`)
76
75
  })
77
76
 
78
77
  it("test pagination query", async () => {
@@ -133,7 +132,7 @@ describe("internal search", () => {
133
132
  "colArr": [1, 2, 3],
134
133
  },
135
134
  }, PARAMS)
136
- checkLucene(response, `(*:* AND column:a AND colArr:(1 AND 2 AND 3))`, PARAMS)
135
+ checkLucene(response, `*:* AND column:a AND colArr:(1 AND 2 AND 3)`, PARAMS)
137
136
  })
138
137
 
139
138
  it("test multiple of same column", async () => {
@@ -145,7 +144,7 @@ describe("internal search", () => {
145
144
  "3:column": "c",
146
145
  },
147
146
  }, PARAMS)
148
- checkLucene(response, `(column:"a" OR column:"b" OR column:"c")`, PARAMS)
147
+ checkLucene(response, `column:"a" OR column:"b" OR column:"c"`, PARAMS)
149
148
  })
150
149
 
151
150
  it("check a weird case for lucene building", async () => {
@@ -192,6 +191,6 @@ describe("internal search", () => {
192
191
  expect(json.bookmark).toBe(PARAMS.bookmark)
193
192
  }
194
193
  expect(json.include_docs).toBe(true)
195
- expect(json.q).toBe(`*:* AND column:"1" AND tableId:${PARAMS.tableId}`)
194
+ expect(json.q).toBe(`(*:* AND column:"1") AND tableId:${PARAMS.tableId}`)
196
195
  })
197
196
  })
package/src/app.ts CHANGED
@@ -27,7 +27,7 @@ import * as api from "./api"
27
27
  import * as automations from "./automations"
28
28
  import { Thread } from "./threads"
29
29
  import * as redis from "./utilities/redis"
30
- import { events, logging, middleware, timers } from "@budibase/backend-core"
30
+ import { events, logging, middleware } from "@budibase/backend-core"
31
31
  import { initialise as initialiseWebsockets } from "./websocket"
32
32
  import { startup } from "./startup"
33
33
  const Sentry = require("@sentry/node")
@@ -84,7 +84,6 @@ server.on("close", async () => {
84
84
  }
85
85
  shuttingDown = true
86
86
  console.log("Server Closed")
87
- timers.cleanup()
88
87
  await automations.shutdown()
89
88
  await redis.shutdown()
90
89
  events.shutdown()
@@ -23,7 +23,7 @@ import { LoopStep, LoopStepType, LoopInput } from "../definitions/automations"
23
23
  * @returns {object} The inputs object which has had all the various types supported by this function converted to their
24
24
  * primitive types.
25
25
  */
26
- export function cleanInputValues(inputs: Record<string, any>, schema?: any) {
26
+ export function cleanInputValues(inputs: Record<string, any>, schema: any) {
27
27
  if (schema == null) {
28
28
  return inputs
29
29
  }