@budibase/worker 2.24.1 → 2.25.0
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.
|
|
4
|
+
"version": "2.25.0",
|
|
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.
|
|
41
|
-
"@budibase/pro": "2.
|
|
42
|
-
"@budibase/string-templates": "2.
|
|
43
|
-
"@budibase/types": "2.
|
|
40
|
+
"@budibase/backend-core": "2.25.0",
|
|
41
|
+
"@budibase/pro": "2.25.0",
|
|
42
|
+
"@budibase/string-templates": "2.25.0",
|
|
43
|
+
"@budibase/types": "2.25.0",
|
|
44
44
|
"@koa/router": "8.0.8",
|
|
45
45
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
46
46
|
"@types/global-agent": "2.1.1",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "75d949ef66bf20519446d3999c3412e106ef561d"
|
|
112
112
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
jest.unmock("node-fetch")
|
|
2
|
-
jest.unmock("aws-sdk")
|
|
3
2
|
import { TestConfiguration } from "../../../../tests"
|
|
4
3
|
import { EmailTemplatePurpose } from "../../../../constants"
|
|
5
|
-
import { objectStoreTestProviders } from "@budibase/backend-core/tests"
|
|
6
4
|
import { objectStore } from "@budibase/backend-core"
|
|
7
5
|
import tk from "timekeeper"
|
|
8
6
|
import { EmailAttachment } from "@budibase/types"
|
|
@@ -19,12 +17,10 @@ describe("/api/global/email", () => {
|
|
|
19
17
|
|
|
20
18
|
beforeAll(async () => {
|
|
21
19
|
tk.reset()
|
|
22
|
-
await objectStoreTestProviders.minio.start()
|
|
23
20
|
await config.beforeAll()
|
|
24
21
|
})
|
|
25
22
|
|
|
26
23
|
afterAll(async () => {
|
|
27
|
-
await objectStoreTestProviders.minio.stop()
|
|
28
24
|
await config.afterAll()
|
|
29
25
|
})
|
|
30
26
|
|
|
@@ -55,6 +55,7 @@ describe("/api/global/self", () => {
|
|
|
55
55
|
const res = await config.api.self
|
|
56
56
|
.updateSelf(user, {
|
|
57
57
|
onboardedAt: "2023-03-07T14:10:54.869Z",
|
|
58
|
+
freeTrialConfirmedAt: "2024-03-17T14:10:54.869Z",
|
|
58
59
|
})
|
|
59
60
|
.expect(200)
|
|
60
61
|
|
|
@@ -63,6 +64,7 @@ describe("/api/global/self", () => {
|
|
|
63
64
|
user._rev = dbUser._rev
|
|
64
65
|
user.dayPassRecordedAt = mocks.date.MOCK_DATE.toISOString()
|
|
65
66
|
expect(dbUser.onboardedAt).toBe("2023-03-07T14:10:54.869Z")
|
|
67
|
+
expect(dbUser.freeTrialConfirmedAt).toBe("2024-03-17T14:10:54.869Z")
|
|
66
68
|
expect(res.body._id).toBe(user._id)
|
|
67
69
|
})
|
|
68
70
|
})
|
|
@@ -26,6 +26,7 @@ export const buildSelfSaveValidation = () => {
|
|
|
26
26
|
firstName: OPTIONAL_STRING,
|
|
27
27
|
lastName: OPTIONAL_STRING,
|
|
28
28
|
onboardedAt: Joi.string().optional(),
|
|
29
|
+
freeTrialConfirmedAt: Joi.string().optional(),
|
|
29
30
|
appFavourites: Joi.array().optional(),
|
|
30
31
|
tours: Joi.object().optional(),
|
|
31
32
|
}
|
package/src/utilities/email.ts
CHANGED
|
@@ -6,8 +6,7 @@ import { processString } from "@budibase/string-templates"
|
|
|
6
6
|
import { User, SendEmailOpts, SMTPInnerConfig } from "@budibase/types"
|
|
7
7
|
import { configs, cache, objectStore } from "@budibase/backend-core"
|
|
8
8
|
import ical from "ical-generator"
|
|
9
|
-
import
|
|
10
|
-
import path from "path"
|
|
9
|
+
import _ from "lodash"
|
|
11
10
|
|
|
12
11
|
const nodemailer = require("nodemailer")
|
|
13
12
|
|
|
@@ -165,39 +164,12 @@ export async function sendEmail(
|
|
|
165
164
|
}),
|
|
166
165
|
}
|
|
167
166
|
if (opts?.attachments) {
|
|
168
|
-
|
|
169
|
-
opts.attachments?.map(
|
|
170
|
-
const isFullyFormedUrl =
|
|
171
|
-
attachment.url.startsWith("http://") ||
|
|
172
|
-
attachment.url.startsWith("https://")
|
|
173
|
-
if (isFullyFormedUrl) {
|
|
174
|
-
const response = await fetch(attachment.url)
|
|
175
|
-
if (!response.ok) {
|
|
176
|
-
throw new Error(`unexpected response ${response.statusText}`)
|
|
177
|
-
}
|
|
178
|
-
const fallbackFilename = path.basename(
|
|
179
|
-
new URL(attachment.url).pathname
|
|
180
|
-
)
|
|
181
|
-
return {
|
|
182
|
-
filename: attachment.filename || fallbackFilename,
|
|
183
|
-
content: response?.body,
|
|
184
|
-
}
|
|
185
|
-
} else {
|
|
186
|
-
const url = attachment.url
|
|
187
|
-
const result = objectStore.extractBucketAndPath(url)
|
|
188
|
-
if (result === null) {
|
|
189
|
-
throw new Error("Invalid signed URL")
|
|
190
|
-
}
|
|
191
|
-
const { bucket, path } = result
|
|
192
|
-
const readStream = await objectStore.getReadStream(bucket, path)
|
|
193
|
-
const fallbackFilename = path.split("/").pop() || ""
|
|
194
|
-
return {
|
|
195
|
-
filename: attachment.filename || fallbackFilename,
|
|
196
|
-
content: readStream,
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
})
|
|
167
|
+
let attachments = await Promise.all(
|
|
168
|
+
opts.attachments?.map(objectStore.processAutomationAttachment)
|
|
200
169
|
)
|
|
170
|
+
attachments = attachments.map(attachment => {
|
|
171
|
+
return _.omit(attachment, "path")
|
|
172
|
+
})
|
|
201
173
|
message = { ...message, attachments }
|
|
202
174
|
}
|
|
203
175
|
|