Returns true if the the length of the given value
is equal to the given length
. Can be used as a block or inline helper.
Returns the length of the given string or array.
\n" }, "lengthEqual": { @@ -272,7 +272,7 @@ "options" ], "numArgs": 3, - "example": "{{equalsLength [1, 2, 3] 3}} -> true", + "example": "{{equalsLength '[1,2,3]' 3}} -> true", "description": "Returns true if the the length of the given value
is equal to the given length
. Can be used as a block or inline helper.
Format a date using moment.js date formatting.
\n" + "example": "{{date now \"DD-MM-YYYY\" \"America/New_York\" }} -> 21-01-2021", + "description": "Format a date using moment.js date formatting - the timezone is optional and uses the tz database.
\n" }, "duration": { "args": [ diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index b1dc7e9a25..dda3bdaddc 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.42", + "version": "0.9.45", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", @@ -20,7 +20,7 @@ "manifest": "node ./scripts/gen-collection-info.js" }, "dependencies": { - "@budibase/handlebars-helpers": "^0.11.3", + "@budibase/handlebars-helpers": "^0.11.4", "dayjs": "^1.10.4", "handlebars": "^4.7.6", "handlebars-utils": "^1.0.6", diff --git a/packages/string-templates/test/helpers.spec.js b/packages/string-templates/test/helpers.spec.js index d460708798..e43bb5fbe1 100644 --- a/packages/string-templates/test/helpers.spec.js +++ b/packages/string-templates/test/helpers.spec.js @@ -305,6 +305,17 @@ describe("Test the object/array helper", () => { const output = await processString("{{ literal ( sum ( pluck items 'price' ) ) }}", context) expect(output).toBe(50) }) + + it("should allow use of the length helper", async () => { + const array = [1, 2, 3] + const output = await processString("{{ length array }}", { array }) + expect(output).toBe("3") + }) + + it("should allow use of the length helper inline", async () => { + const output = await processString(`{{ length '[1, 2, 3]' }}`, {}) + expect(output).toBe("3") + }) }) describe("Test the literal helper", () => { diff --git a/packages/string-templates/yarn.lock b/packages/string-templates/yarn.lock index 64534884b0..0188a9ec1d 100644 --- a/packages/string-templates/yarn.lock +++ b/packages/string-templates/yarn.lock @@ -270,10 +270,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/handlebars-helpers@^0.11.3": - version "0.11.3" - resolved "https://registry.yarnpkg.com/@budibase/handlebars-helpers/-/handlebars-helpers-0.11.3.tgz#b6e5c91b83e8906e7d7ff10ddde277a3d561016e" - integrity sha512-MS1ptZEYq8o9J3tNLM7cZ2RGSSJIer4GiMIUHtbBI3sC9UKqZebao1JYNfmZKpNjntuqhZKgjqc5GfnVIEjsYQ== +"@budibase/handlebars-helpers@^0.11.4": + version "0.11.4" + resolved "https://registry.yarnpkg.com/@budibase/handlebars-helpers/-/handlebars-helpers-0.11.4.tgz#8acfa2ee84134f7be4b2906e710fce6d25c5d000" + integrity sha512-AJNJYlJnxZmn9QJ8tBl8nrm4YxbwHP4AR0pbiVGK+EoOylkNBlUnZ/QDL1VyqM5fTkAE/Z2IZVLKrrG3kxuWLA== dependencies: arr-flatten "^1.1.0" array-sort "^0.1.4" diff --git a/packages/worker/package.json b/packages/worker/package.json index db15ad4f6b..c7ec372824 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.42", + "version": "0.9.45", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.42", - "@budibase/string-templates": "^0.9.42", + "@budibase/auth": "^0.9.45", + "@budibase/string-templates": "^0.9.45", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", diff --git a/packages/worker/src/utilities/email.js b/packages/worker/src/utilities/email.js index 4e48844843..534456fe15 100644 --- a/packages/worker/src/utilities/email.js +++ b/packages/worker/src/utilities/email.js @@ -20,11 +20,16 @@ const FULL_EMAIL_PURPOSES = [ function createSMTPTransport(config) { let options + let secure = config.secure + // default it if not specified + if (secure == null) { + secure = config.port === 465 + } if (!TEST_MODE) { options = { port: config.port, host: config.host, - secure: config.secure || false, + secure: secure, auth: config.auth, } options.tls = {