@budibase/worker 2.13.5 → 2.13.6

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/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.13.5",
4
+ "version": "2.13.6",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -37,10 +37,10 @@
37
37
  "author": "Budibase",
38
38
  "license": "GPL-3.0",
39
39
  "dependencies": {
40
- "@budibase/backend-core": "2.13.5",
41
- "@budibase/pro": "2.13.5",
42
- "@budibase/string-templates": "2.13.5",
43
- "@budibase/types": "2.13.5",
40
+ "@budibase/backend-core": "2.13.6",
41
+ "@budibase/pro": "2.13.6",
42
+ "@budibase/string-templates": "2.13.6",
43
+ "@budibase/types": "2.13.6",
44
44
  "@koa/router": "8.0.8",
45
45
  "@techpass/passport-openidconnect": "0.3.2",
46
46
  "@types/global-agent": "2.1.1",
@@ -107,5 +107,5 @@
107
107
  }
108
108
  }
109
109
  },
110
- "gitHead": "102cee5498fa828d611e7cf0e31b732092dd1584"
110
+ "gitHead": "0341f7a92e6a98e010819a68ac3b91ecfcf51b61"
111
111
  }
@@ -56,12 +56,12 @@ export async function getTemplates({
56
56
  id,
57
57
  }: { ownerId?: string; type?: string; id?: string } = {}) {
58
58
  const db = tenancy.getGlobalDB()
59
- const response = await db.allDocs(
59
+ const response = await db.allDocs<Template>(
60
60
  dbCore.getTemplateParams(ownerId || GLOBAL_OWNER, id, {
61
61
  include_docs: true,
62
62
  })
63
63
  )
64
- let templates = response.rows.map(row => row.doc)
64
+ let templates = response.rows.map(row => row.doc!)
65
65
  // should only be one template with ID
66
66
  if (id) {
67
67
  return templates[0]
@@ -73,6 +73,6 @@ export async function getTemplates({
73
73
  }
74
74
 
75
75
  export async function getTemplateByPurpose(type: string, purpose: string) {
76
- const templates = await getTemplates({ type })
76
+ const templates = (await getTemplates({ type })) as Template[]
77
77
  return templates.find((template: Template) => template.purpose === purpose)
78
78
  }
@@ -99,8 +99,6 @@ async function buildEmail(
99
99
  if (!base || !body || !core) {
100
100
  throw "Unable to build email, missing base components"
101
101
  }
102
- base = base.contents
103
- body = body.contents
104
102
 
105
103
  let name = user ? user.name : undefined
106
104
  if (user && !name && user.firstName) {
@@ -114,15 +112,10 @@ async function buildEmail(
114
112
  user: user || {},
115
113
  }
116
114
 
117
- // Prepend the core template
118
- const fullBody = core + body
119
-
120
- body = await processString(fullBody, context)
121
-
122
115
  // this should now be the core email HTML
123
- return processString(base, {
116
+ return processString(base.contents, {
124
117
  ...context,
125
- body,
118
+ body: await processString(core + body?.contents, context),
126
119
  })
127
120
  }
128
121