@axium/email 0.1.0 → 0.1.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.
@@ -1,5 +1,5 @@
1
1
  import { config, hostname } from '@axium/server/config';
2
- import { database } from '@axium/server/database';
2
+ import { connect, database } from '@axium/server/database';
3
3
  import { program } from 'commander';
4
4
  import * as io from 'ioium/node';
5
5
  import { createPrivateKey, createPublicKey } from 'node:crypto';
@@ -41,6 +41,7 @@ cli.command('queue')
41
41
  .option('-a, --all', 'Include delivered and failed messages', false)
42
42
  .option('--retry', 'Retry failed messages now', false)
43
43
  .action(async (opt) => {
44
+ connect();
44
45
  if (opt.retry) {
45
46
  const retried = await database
46
47
  .updateTable('email_outbound')
@@ -48,6 +48,11 @@ export async function deliver(userId, folder, data, attachments = []) {
48
48
  userId,
49
49
  folder,
50
50
  ...data,
51
+ // jsonb columns must be serialized since node-postgres treats plain arrays as Postgres arrays
52
+ from: JSON.stringify(data.from),
53
+ to: JSON.stringify(data.to),
54
+ cc: JSON.stringify(data.cc),
55
+ bcc: JSON.stringify(data.bcc),
51
56
  threadId: await threadFor(userId, data.inReplyTo),
52
57
  snippet: makeSnippet(data.text),
53
58
  read: folder == 'sent' || folder == 'drafts',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/email",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Email for Axium",
6
6
  "funding": {