@budibase/worker 2.7.24 → 2.7.25-alpha.1
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.7.
|
|
4
|
+
"version": "2.7.25-alpha.1",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"author": "Budibase",
|
|
39
39
|
"license": "GPL-3.0",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@budibase/backend-core": "2.7.
|
|
42
|
-
"@budibase/pro": "2.7.
|
|
43
|
-
"@budibase/string-templates": "2.7.
|
|
44
|
-
"@budibase/types": "2.7.
|
|
41
|
+
"@budibase/backend-core": "2.7.25-alpha.1",
|
|
42
|
+
"@budibase/pro": "2.7.25-alpha.1",
|
|
43
|
+
"@budibase/string-templates": "2.7.25-alpha.1",
|
|
44
|
+
"@budibase/types": "2.7.25-alpha.1",
|
|
45
45
|
"@koa/router": "8.0.8",
|
|
46
46
|
"@sentry/node": "6.17.7",
|
|
47
47
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"elastic-apm-node": "3.38.0",
|
|
54
54
|
"global-agent": "3.0.0",
|
|
55
55
|
"got": "11.8.3",
|
|
56
|
+
"ical-generator": "4.1.0",
|
|
56
57
|
"joi": "17.6.0",
|
|
57
58
|
"koa": "2.13.4",
|
|
58
59
|
"koa-body": "4.2.0",
|
|
@@ -103,5 +104,5 @@
|
|
|
103
104
|
"typescript": "4.7.3",
|
|
104
105
|
"update-dotenv": "1.1.1"
|
|
105
106
|
},
|
|
106
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "ce958697b009fec9b9e6c303eb94138fdb36270f"
|
|
107
108
|
}
|
|
@@ -14,6 +14,7 @@ export async function sendEmail(ctx: BBContext) {
|
|
|
14
14
|
cc,
|
|
15
15
|
bcc,
|
|
16
16
|
automation,
|
|
17
|
+
invite,
|
|
17
18
|
} = ctx.request.body
|
|
18
19
|
let user
|
|
19
20
|
if (userId) {
|
|
@@ -29,6 +30,7 @@ export async function sendEmail(ctx: BBContext) {
|
|
|
29
30
|
cc,
|
|
30
31
|
bcc,
|
|
31
32
|
automation,
|
|
33
|
+
invite,
|
|
32
34
|
})
|
|
33
35
|
ctx.body = {
|
|
34
36
|
...response,
|
package/src/utilities/email.ts
CHANGED
|
@@ -4,28 +4,11 @@ import { getTemplateByPurpose, EmailTemplates } from "../constants/templates"
|
|
|
4
4
|
import { getSettingsTemplateContext } from "./templates"
|
|
5
5
|
import { processString } from "@budibase/string-templates"
|
|
6
6
|
import { getResetPasswordCode, getInviteCode } from "./redis"
|
|
7
|
-
import { User, SMTPInnerConfig } from "@budibase/types"
|
|
7
|
+
import { User, SendEmailOpts, SMTPInnerConfig } from "@budibase/types"
|
|
8
8
|
import { configs } from "@budibase/backend-core"
|
|
9
|
+
import ical from "ical-generator"
|
|
9
10
|
const nodemailer = require("nodemailer")
|
|
10
11
|
|
|
11
|
-
type SendEmailOpts = {
|
|
12
|
-
// workspaceId If finer grain controls being used then this will lookup config for workspace.
|
|
13
|
-
workspaceId?: string
|
|
14
|
-
// user If sending to an existing user the object can be provided, this is used in the context.
|
|
15
|
-
user: User
|
|
16
|
-
// from If sending from an address that is not what is configured in the SMTP config.
|
|
17
|
-
from?: string
|
|
18
|
-
// contents If sending a custom email then can supply contents which will be added to it.
|
|
19
|
-
contents?: string
|
|
20
|
-
// subject A custom subject can be specified if the config one is not desired.
|
|
21
|
-
subject?: string
|
|
22
|
-
// info Pass in a structure of information to be stored alongside the invitation.
|
|
23
|
-
info?: any
|
|
24
|
-
cc?: boolean
|
|
25
|
-
bcc?: boolean
|
|
26
|
-
automation?: boolean
|
|
27
|
-
}
|
|
28
|
-
|
|
29
12
|
const TEST_MODE = env.ENABLE_EMAIL_TEST_MODE && env.isDev()
|
|
30
13
|
const TYPE = TemplateType.EMAIL
|
|
31
14
|
|
|
@@ -200,6 +183,26 @@ export async function sendEmail(
|
|
|
200
183
|
context
|
|
201
184
|
)
|
|
202
185
|
}
|
|
186
|
+
if (opts?.invite) {
|
|
187
|
+
const calendar = ical({
|
|
188
|
+
name: "Invite",
|
|
189
|
+
})
|
|
190
|
+
calendar.createEvent({
|
|
191
|
+
start: opts.invite.startTime,
|
|
192
|
+
end: opts.invite.endTime,
|
|
193
|
+
summary: opts.invite.summary,
|
|
194
|
+
location: opts.invite.location,
|
|
195
|
+
url: opts.invite.url,
|
|
196
|
+
})
|
|
197
|
+
message = {
|
|
198
|
+
...message,
|
|
199
|
+
icalEvent: {
|
|
200
|
+
method: "request",
|
|
201
|
+
content: calendar.toString(),
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
203
206
|
const response = await transport.sendMail(message)
|
|
204
207
|
if (TEST_MODE) {
|
|
205
208
|
console.log("Test email URL: " + nodemailer.getTestMessageUrl(response))
|