@budibase/server 2.6.19-alpha.31 → 2.6.19-alpha.35

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.6.19-alpha.31",
4
+ "version": "2.6.19-alpha.35",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -46,12 +46,12 @@
46
46
  "license": "GPL-3.0",
47
47
  "dependencies": {
48
48
  "@apidevtools/swagger-parser": "10.0.3",
49
- "@budibase/backend-core": "2.6.19-alpha.31",
50
- "@budibase/client": "2.6.19-alpha.31",
51
- "@budibase/pro": "2.6.19-alpha.31",
52
- "@budibase/shared-core": "2.6.19-alpha.31",
53
- "@budibase/string-templates": "2.6.19-alpha.31",
54
- "@budibase/types": "2.6.19-alpha.31",
49
+ "@budibase/backend-core": "2.6.19-alpha.35",
50
+ "@budibase/client": "2.6.19-alpha.35",
51
+ "@budibase/pro": "2.6.19-alpha.35",
52
+ "@budibase/shared-core": "2.6.19-alpha.35",
53
+ "@budibase/string-templates": "2.6.19-alpha.35",
54
+ "@budibase/types": "2.6.19-alpha.35",
55
55
  "@bull-board/api": "3.7.0",
56
56
  "@bull-board/koa": "3.9.4",
57
57
  "@elastic/elasticsearch": "7.10.0",
@@ -196,5 +196,5 @@
196
196
  }
197
197
  }
198
198
  },
199
- "gitHead": "46abe5917ecc3ed921f10dfd9aff09f1970f80c3"
199
+ "gitHead": "2e6bc8435cb14649a8cc000a76d661fc121f21d1"
200
200
  }
@@ -9,8 +9,8 @@ import {
9
9
  checkDebounce,
10
10
  setDebounce,
11
11
  } from "../utilities/redis"
12
- import { db as dbCore, cache, permissions } from "@budibase/backend-core"
13
- import { BBContext, Database } from "@budibase/types"
12
+ import { db as dbCore, cache } from "@budibase/backend-core"
13
+ import { UserCtx, Database } from "@budibase/types"
14
14
 
15
15
  const DEBOUNCE_TIME_SEC = 30
16
16
 
@@ -23,7 +23,7 @@ const DEBOUNCE_TIME_SEC = 30
23
23
  * through the authorized middleware *
24
24
  ****************************************************/
25
25
 
26
- async function checkDevAppLocks(ctx: BBContext) {
26
+ async function checkDevAppLocks(ctx: UserCtx) {
27
27
  const appId = ctx.appId
28
28
 
29
29
  // if any public usage, don't proceed
@@ -42,7 +42,7 @@ async function checkDevAppLocks(ctx: BBContext) {
42
42
  }
43
43
  }
44
44
 
45
- async function updateAppUpdatedAt(ctx: BBContext) {
45
+ async function updateAppUpdatedAt(ctx: UserCtx) {
46
46
  const appId = ctx.appId
47
47
  // if debouncing skip this update
48
48
  // get methods also aren't updating
@@ -50,20 +50,29 @@ async function updateAppUpdatedAt(ctx: BBContext) {
50
50
  return
51
51
  }
52
52
  await dbCore.doWithDB(appId, async (db: Database) => {
53
- const metadata = await db.get(DocumentType.APP_METADATA)
54
- metadata.updatedAt = new Date().toISOString()
53
+ try {
54
+ const metadata = await db.get(DocumentType.APP_METADATA)
55
+ metadata.updatedAt = new Date().toISOString()
55
56
 
56
- metadata.updatedBy = getGlobalIDFromUserMetadataID(ctx.user?.userId!)
57
+ metadata.updatedBy = getGlobalIDFromUserMetadataID(ctx.user?.userId!)
57
58
 
58
- const response = await db.put(metadata)
59
- metadata._rev = response.rev
60
- await cache.app.invalidateAppMetadata(appId, metadata)
61
- // set a new debounce record with a short TTL
62
- await setDebounce(appId, DEBOUNCE_TIME_SEC)
59
+ const response = await db.put(metadata)
60
+ metadata._rev = response.rev
61
+ await cache.app.invalidateAppMetadata(appId, metadata)
62
+ // set a new debounce record with a short TTL
63
+ await setDebounce(appId, DEBOUNCE_TIME_SEC)
64
+ } catch (err: any) {
65
+ // if a 409 occurs, then multiple clients connected at the same time - ignore
66
+ if (err?.status === 409) {
67
+ return
68
+ } else {
69
+ throw err
70
+ }
71
+ }
63
72
  })
64
73
  }
65
74
 
66
- export default async function builder(ctx: BBContext) {
75
+ export default async function builder(ctx: UserCtx) {
67
76
  const appId = ctx.appId
68
77
  // this only functions within an app context
69
78
  if (!appId) {
@@ -31,6 +31,7 @@ import { WorkerCallback } from "./definitions"
31
31
  import { context, logging } from "@budibase/backend-core"
32
32
  import { processObject } from "@budibase/string-templates"
33
33
  import { cloneDeep } from "lodash/fp"
34
+ import { performance } from "perf_hooks"
34
35
  import * as sdkUtils from "../sdk/utils"
35
36
  import env from "../environment"
36
37
  const FILTER_STEP_ID = actions.BUILTIN_ACTION_DEFINITIONS.FILTER.stepId
@@ -477,7 +478,10 @@ class Orchestrator {
477
478
  const end = performance.now()
478
479
  const executionTime = end - start
479
480
 
480
- console.log(`Execution time: ${executionTime} milliseconds`)
481
+ console.info(`Execution time: ${executionTime} milliseconds`, {
482
+ _logKey: "automation",
483
+ executionTime,
484
+ })
481
485
 
482
486
  // store the logs for the automation run
483
487
  try {
@@ -35,10 +35,20 @@ export const getComponentLibraryManifest = async (library: string) => {
35
35
  const filename = "manifest.json"
36
36
 
37
37
  if (env.isDev() || env.isTest()) {
38
- const path = join(TOP_LEVEL_PATH, "packages/client", filename)
39
- // always load from new so that updates are refreshed
40
- delete require.cache[require.resolve(path)]
41
- return require(path)
38
+ const paths = [
39
+ join(TOP_LEVEL_PATH, "packages/client", filename),
40
+ join(process.cwd(), "client", filename),
41
+ ]
42
+ for (let path of paths) {
43
+ if (fs.existsSync(path)) {
44
+ // always load from new so that updates are refreshed
45
+ delete require.cache[require.resolve(path)]
46
+ return require(path)
47
+ }
48
+ }
49
+ throw new Error(
50
+ `Unable to find ${filename} in development environment (may need to build).`
51
+ )
42
52
  }
43
53
 
44
54
  if (!appId) {