waibu 1.2.1 → 1.2.2

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.
Files changed (2) hide show
  1. package/index.js +6 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -138,7 +138,7 @@ async function factory (pkgName) {
138
138
  this.instance.close()
139
139
  }
140
140
 
141
- findRoute (route) {
141
+ findRoute = (route) => {
142
142
  const { outmatch } = this.lib
143
143
  const { find } = this.lib._
144
144
  const { breakNsPath } = this.app.bajo
@@ -291,8 +291,9 @@ async function factory (pkgName) {
291
291
  return url
292
292
  }
293
293
 
294
- sendMail = async (tpl, { to, cc, bcc, from, subject, data = {}, conn, options = {} }) => {
295
- if (!this.app.masohiMail) return
294
+ sendMail = async (tpl, { to, cc, bcc, from, subject, data = {}, conn, source, options = {} }) => {
295
+ conn = conn ?? 'masohiMail:default'
296
+ if (!this.app.masohi || !this.app.masohiMail) return
296
297
  const { get, isString } = this.lib._
297
298
  const { generateId } = this.app.bajo
298
299
  const { render } = this.app.bajoTemplate
@@ -304,8 +305,8 @@ async function factory (pkgName) {
304
305
  }
305
306
  const message = await render(tpl[0], locals, opts)
306
307
  if (tpl[1]) opts.messageText = await render(tpl[1], locals, opts)
307
- const payload = { type: 'object', data: { to, cc, bcc, from, subject, message, conn, options: opts } }
308
- await this.app.masohi.send({ payload, source: this.name }, false) // mail sent through worker
308
+ const payload = { type: 'object', data: { to, cc, bcc, from, subject, message, options: opts } }
309
+ await this.app.masohi.send({ payload, source: source ?? this.name, conn }) // mail sent through worker
309
310
  }
310
311
 
311
312
  unescapeBlock = (content, start, end, startReplacer, endReplacer) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Web Framework for Bajo",
5
5
  "main": "index.js",
6
6
  "scripts": {