@budibase/worker 2.7.26-alpha.0 → 2.7.26

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.26-alpha.0",
4
+ "version": "2.7.26",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -38,23 +38,21 @@
38
38
  "author": "Budibase",
39
39
  "license": "GPL-3.0",
40
40
  "dependencies": {
41
- "@budibase/backend-core": "2.7.26-alpha.0",
42
- "@budibase/pro": "2.7.26-alpha.0",
43
- "@budibase/string-templates": "2.7.26-alpha.0",
44
- "@budibase/types": "2.7.26-alpha.0",
41
+ "@budibase/backend-core": "2.7.26",
42
+ "@budibase/pro": "2.7.26",
43
+ "@budibase/string-templates": "2.7.26",
44
+ "@budibase/types": "2.7.26",
45
45
  "@koa/router": "8.0.8",
46
46
  "@sentry/node": "6.17.7",
47
47
  "@techpass/passport-openidconnect": "0.3.2",
48
48
  "@types/global-agent": "2.1.1",
49
49
  "aws-sdk": "2.1030.0",
50
- "bcrypt": "5.1.0",
51
50
  "bcryptjs": "2.4.3",
52
51
  "dd-trace": "3.13.2",
53
52
  "dotenv": "8.6.0",
54
53
  "elastic-apm-node": "3.38.0",
55
54
  "global-agent": "3.0.0",
56
55
  "got": "11.8.3",
57
- "ical-generator": "4.1.0",
58
56
  "joi": "17.6.0",
59
57
  "koa": "2.13.4",
60
58
  "koa-body": "4.2.0",
@@ -105,5 +103,5 @@
105
103
  "typescript": "4.7.3",
106
104
  "update-dotenv": "1.1.1"
107
105
  },
108
- "gitHead": "34f80f74012ab90ac03a1605af352a6d5330da6f"
106
+ "gitHead": "5e717d1b72e72ff5acb422c0f553693a82a5b690"
109
107
  }
@@ -140,6 +140,7 @@ export const datasourcePreAuth = async (ctx: any, next: any) => {
140
140
  {
141
141
  provider,
142
142
  appId: ctx.query.appId,
143
+ datasourceId: ctx.query.datasourceId,
143
144
  },
144
145
  Cookie.DatasourceAuth
145
146
  )
@@ -14,7 +14,6 @@ export async function sendEmail(ctx: BBContext) {
14
14
  cc,
15
15
  bcc,
16
16
  automation,
17
- invite,
18
17
  } = ctx.request.body
19
18
  let user
20
19
  if (userId) {
@@ -30,7 +29,6 @@ export async function sendEmail(ctx: BBContext) {
30
29
  cc,
31
30
  bcc,
32
31
  automation,
33
- invite,
34
32
  })
35
33
  ctx.body = {
36
34
  ...response,
@@ -38,7 +38,7 @@ const MAX_USERS_UPLOAD_LIMIT = 1000
38
38
 
39
39
  export const save = async (ctx: UserCtx<User, SaveUserResponse>) => {
40
40
  try {
41
- const currentUserId = ctx.user?._id
41
+ const currentUserId = ctx.user._id
42
42
  const requestUser = ctx.request.body
43
43
 
44
44
  const user = await userSdk.save(requestUser, { currentUserId })
@@ -1,10 +1,9 @@
1
- import { Ctx } from "@budibase/types"
1
+ import { BBContext } from "@budibase/types"
2
2
  import env from "../../../environment"
3
3
 
4
- export const fetch = async (ctx: Ctx) => {
4
+ export const fetch = async (ctx: BBContext) => {
5
5
  ctx.body = {
6
6
  multiTenancy: !!env.MULTI_TENANCY,
7
- offlineMode: !!env.OFFLINE_MODE,
8
7
  cloud: !env.SELF_HOSTED,
9
8
  accountPortalUrl: env.ACCOUNT_PORTAL_URL,
10
9
  disableAccountPortal: env.DISABLE_ACCOUNT_PORTAL,
@@ -24,7 +24,6 @@ describe("/api/system/environment", () => {
24
24
  isDev: false,
25
25
  multiTenancy: true,
26
26
  baseUrl: "http://localhost:10000",
27
- offlineMode: false,
28
27
  })
29
28
  })
30
29
  })
@@ -61,7 +61,6 @@ const environment = {
61
61
  CHECKLIST_CACHE_TTL: parseIntSafe(process.env.CHECKLIST_CACHE_TTL) || 3600,
62
62
  SESSION_UPDATE_PERIOD: process.env.SESSION_UPDATE_PERIOD,
63
63
  ENCRYPTED_TEST_PUBLIC_API_KEY: process.env.ENCRYPTED_TEST_PUBLIC_API_KEY,
64
- OFFLINE_MODE: process.env.OFFLINE_MODE,
65
64
  /**
66
65
  * Mock the email service in use - links to ethereal hosted emails are logged instead.
67
66
  */
@@ -4,11 +4,28 @@ 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, SendEmailOpts, SMTPInnerConfig } from "@budibase/types"
7
+ import { User, SMTPInnerConfig } from "@budibase/types"
8
8
  import { configs } from "@budibase/backend-core"
9
- import ical from "ical-generator"
10
9
  const nodemailer = require("nodemailer")
11
10
 
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
+
12
29
  const TEST_MODE = env.ENABLE_EMAIL_TEST_MODE && env.isDev()
13
30
  const TYPE = TemplateType.EMAIL
14
31
 
@@ -183,26 +200,6 @@ export async function sendEmail(
183
200
  context
184
201
  )
185
202
  }
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
-
206
203
  const response = await transport.sendMail(message)
207
204
  if (TEST_MODE) {
208
205
  console.log("Test email URL: " + nodemailer.getTestMessageUrl(response))