@budibase/worker 2.11.37 → 2.11.38

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.11.37",
4
+ "version": "2.11.38",
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.11.37",
42
- "@budibase/pro": "2.11.37",
43
- "@budibase/string-templates": "2.11.37",
44
- "@budibase/types": "2.11.37",
41
+ "@budibase/backend-core": "2.11.38",
42
+ "@budibase/pro": "2.11.38",
43
+ "@budibase/string-templates": "2.11.38",
44
+ "@budibase/types": "2.11.38",
45
45
  "@koa/router": "8.0.8",
46
46
  "@techpass/passport-openidconnect": "0.3.2",
47
47
  "@types/global-agent": "2.1.1",
@@ -107,5 +107,5 @@
107
107
  }
108
108
  }
109
109
  },
110
- "gitHead": "735961cf9cbfe40adbb1c983976a21ee18ba2433"
110
+ "gitHead": "ec768a59f56e7aabc38e2e8bf0defe9e91a3f7e6"
111
111
  }
@@ -71,12 +71,12 @@ async function getLinkCode(
71
71
 
72
72
  /**
73
73
  * Builds an email using handlebars and the templates found in the system (default or otherwise).
74
- * @param {string} purpose the purpose of the email being built, e.g. invitation, password reset.
75
- * @param {string} email the address which it is being sent to for contextual purposes.
76
- * @param {object} context the context which is being used for building the email (hbs context).
77
- * @param {object|null} user if being sent to an existing user then the object can be provided for context.
78
- * @param {string|null} contents if using a custom template can supply contents for context.
79
- * @return {Promise<string>} returns the built email HTML if all provided parameters were valid.
74
+ * @param purpose the purpose of the email being built, e.g. invitation, password reset.
75
+ * @param email the address which it is being sent to for contextual purposes.
76
+ * @param context the context which is being used for building the email (hbs context).
77
+ * @param user if being sent to an existing user then the object can be provided for context.
78
+ * @param contents if using a custom template can supply contents for context.
79
+ * @return returns the built email HTML if all provided parameters were valid.
80
80
  */
81
81
  async function buildEmail(
82
82
  purpose: EmailTemplatePurpose,
@@ -128,7 +128,7 @@ async function buildEmail(
128
128
 
129
129
  /**
130
130
  * Checks if a SMTP config exists based on passed in parameters.
131
- * @return {Promise<boolean>} returns true if there is a configuration that can be used.
131
+ * @return returns true if there is a configuration that can be used.
132
132
  */
133
133
  export async function isEmailConfigured() {
134
134
  // when "testing" or smtp fallback is enabled simply return true
@@ -142,10 +142,10 @@ export async function isEmailConfigured() {
142
142
  /**
143
143
  * Given an email address and an email purpose this will retrieve the SMTP configuration and
144
144
  * send an email using it.
145
- * @param {string} email The email address to send to.
146
- * @param {string} purpose The purpose of the email being sent (e.g. reset password).
147
- * @param {object} opts The options for sending the email.
148
- * @return {Promise<object>} returns details about the attempt to send email, e.g. if it is successful; based on
145
+ * @param email The email address to send to.
146
+ * @param purpose The purpose of the email being sent (e.g. reset password).
147
+ * @param opts The options for sending the email.
148
+ * @return returns details about the attempt to send email, e.g. if it is successful; based on
149
149
  * nodemailer response.
150
150
  */
151
151
  export async function sendEmail(
@@ -212,8 +212,8 @@ export async function sendEmail(
212
212
 
213
213
  /**
214
214
  * Given an SMTP configuration this runs it through nodemailer to see if it is in fact functional.
215
- * @param {object} config an SMTP configuration - this is based on the nodemailer API.
216
- * @return {Promise<boolean>} returns true if the configuration is valid.
215
+ * @param config an SMTP configuration - this is based on the nodemailer API.
216
+ * @return returns true if the configuration is valid.
217
217
  */
218
218
  export async function verifyConfig(config: SMTPInnerConfig) {
219
219
  const transport = createSMTPTransport(config)
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Makes sure that a URL has the correct number of slashes, while maintaining the
3
3
  * http(s):// double slashes.
4
- * @param {string} url The URL to test and remove any extra double slashes.
5
- * @return {string} The updated url.
4
+ * @param url The URL to test and remove any extra double slashes.
5
+ * @return The updated url.
6
6
  */
7
7
  export function checkSlashesInUrl(url: string) {
8
8
  return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2")
@@ -37,8 +37,8 @@ async function updateACode(db: string, code: string, value: any) {
37
37
 
38
38
  /**
39
39
  * Given an invite code and invite body, allow the update an existing/valid invite in redis
40
- * @param {string} inviteCode The invite code for an invite in redis
41
- * @param {object} value The body of the updated user invitation
40
+ * @param inviteCode The invite code for an invite in redis
41
+ * @param value The body of the updated user invitation
42
42
  */
43
43
  export async function updateInviteCode(inviteCode: string, value: string) {
44
44
  await updateACode(redis.utils.Databases.INVITATIONS, inviteCode, value)
@@ -77,9 +77,9 @@ export async function shutdown() {
77
77
  /**
78
78
  * Given a user ID this will store a code (that is returned) for an hour in redis.
79
79
  * The user can then return this code for resetting their password (through their reset link).
80
- * @param {string} userId the ID of the user which is to be reset.
81
- * @param {object} info Info about the user/the reset process.
82
- * @return {Promise<string>} returns the code that was stored to redis.
80
+ * @param userId the ID of the user which is to be reset.
81
+ * @param info Info about the user/the reset process.
82
+ * @return returns the code that was stored to redis.
83
83
  */
84
84
  export async function getResetPasswordCode(userId: string, info: any) {
85
85
  return writeACode(redis.utils.Databases.PW_RESETS, { userId, info })
@@ -87,9 +87,9 @@ export async function getResetPasswordCode(userId: string, info: any) {
87
87
 
88
88
  /**
89
89
  * Given a reset code this will lookup to redis, check if the code is valid and delete if required.
90
- * @param {string} resetCode The code provided via the email link.
91
- * @param {boolean} deleteCode If the code is used/finished with this will delete it - defaults to true.
92
- * @return {Promise<string>} returns the user ID if it is found
90
+ * @param resetCode The code provided via the email link.
91
+ * @param deleteCode If the code is used/finished with this will delete it - defaults to true.
92
+ * @return returns the user ID if it is found
93
93
  */
94
94
  export async function checkResetPasswordCode(
95
95
  resetCode: string,
@@ -104,9 +104,9 @@ export async function checkResetPasswordCode(
104
104
 
105
105
  /**
106
106
  * Generates an invitation code and writes it to redis - which can later be checked for user creation.
107
- * @param {string} email the email address which the code is being sent to (for use later).
108
- * @param {object|null} info Information to be carried along with the invitation.
109
- * @return {Promise<string>} returns the code that was stored to redis.
107
+ * @param email the email address which the code is being sent to (for use later).
108
+ * @param info Information to be carried along with the invitation.
109
+ * @return returns the code that was stored to redis.
110
110
  */
111
111
  export async function getInviteCode(email: string, info: any) {
112
112
  return writeACode(redis.utils.Databases.INVITATIONS, { email, info })
@@ -114,9 +114,9 @@ export async function getInviteCode(email: string, info: any) {
114
114
 
115
115
  /**
116
116
  * Checks that the provided invite code is valid - will return the email address of user that was invited.
117
- * @param {string} inviteCode the invite code that was provided as part of the link.
118
- * @param {boolean} deleteCode whether or not the code should be deleted after retrieval - defaults to true.
119
- * @return {Promise<object>} If the code is valid then an email address will be returned.
117
+ * @param inviteCode the invite code that was provided as part of the link.
118
+ * @param deleteCode whether or not the code should be deleted after retrieval - defaults to true.
119
+ * @return If the code is valid then an email address will be returned.
120
120
  */
121
121
  export async function checkInviteCode(
122
122
  inviteCode: string,