@bumail/queue 0.9.0 → 0.11.0
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/README.md +30 -2
- package/dist/chunks/{index-9yp15arf.js → index-t6q7zxgj.js} +27 -4
- package/dist/chunks/index-t6q7zxgj.js.map +14 -0
- package/dist/contract/checks.d.ts +4 -0
- package/dist/contract/checks.d.ts.map +1 -1
- package/dist/contract/dsn-checks.d.ts.map +1 -1
- package/dist/contract/queue-store.d.ts +15 -7
- package/dist/contract/queue-store.d.ts.map +1 -1
- package/dist/contract/types.d.ts +5 -0
- package/dist/contract/types.d.ts.map +1 -1
- package/dist/dsn/delivered.d.ts +2 -16
- package/dist/dsn/delivered.d.ts.map +1 -1
- package/dist/dsn/failed.d.ts +29 -0
- package/dist/dsn/failed.d.ts.map +1 -0
- package/dist/dsn/for.d.ts +26 -0
- package/dist/dsn/for.d.ts.map +1 -0
- package/dist/dsn/policy.d.ts +2 -0
- package/dist/dsn/policy.d.ts.map +1 -1
- package/dist/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +99 -42
- package/dist/index.js.map +10 -8
- package/dist/memory/index.js +10 -6
- package/dist/memory/index.js.map +3 -3
- package/dist/memory/store.d.ts +2 -2
- package/dist/memory/store.d.ts.map +1 -1
- package/dist/postgres/complete.d.ts +13 -0
- package/dist/postgres/complete.d.ts.map +1 -0
- package/dist/postgres/index.js +85 -74
- package/dist/postgres/index.js.map +6 -5
- package/dist/postgres/store.d.ts +2 -2
- package/dist/postgres/store.d.ts.map +1 -1
- package/dist/queue/deliver.d.ts.map +1 -1
- package/dist/queue/notify.d.ts +35 -6
- package/dist/queue/notify.d.ts.map +1 -1
- package/dist/queue/settings/limits.d.ts.map +1 -1
- package/dist/redis/complete.d.ts +11 -0
- package/dist/redis/complete.d.ts.map +1 -0
- package/dist/redis/index.js +133 -110
- package/dist/redis/index.js.map +7 -6
- package/dist/redis/scripts.d.ts +8 -5
- package/dist/redis/scripts.d.ts.map +1 -1
- package/dist/redis/store.d.ts +2 -2
- package/dist/redis/store.d.ts.map +1 -1
- package/dist/sqlite/index.js +29 -20
- package/dist/sqlite/index.js.map +5 -4
- package/dist/sqlite/insert.d.ts +5 -0
- package/dist/sqlite/insert.d.ts.map +1 -0
- package/dist/sqlite/store.d.ts +2 -2
- package/dist/sqlite/store.d.ts.map +1 -1
- package/docs/guide.md +59 -0
- package/docs/roadmap.md +36 -10
- package/docs/troubleshooting.md +67 -3
- package/package.json +4 -4
- package/dist/chunks/index-9yp15arf.js.map +0 -14
package/dist/sqlite/index.js.map
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/sqlite/open.ts", "../src/sqlite/schema.ts", "../src/sqlite/rows.ts", "../src/sqlite/store.ts"],
|
|
3
|
+
"sources": ["../src/sqlite/insert.ts", "../src/sqlite/open.ts", "../src/sqlite/schema.ts", "../src/sqlite/rows.ts", "../src/sqlite/store.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
+
"import type { Database } from 'bun:sqlite';\nimport { dsnColumn } from '../contract/dsn-column';\nimport type { QueueItem } from '../contract/types';\n\n/** Stores a new item and its message; the caller holds the transaction. */\nexport function insertItem(\n\tdb: Database,\n\tadded: QueueItem,\n\tmessage: Uint8Array,\n): void {\n\tdb.query(\n\t\t`INSERT INTO items (id, sender, recipients, size, created_at,\n\t\tnext_attempt_at, attempts, delay_notified, dsn)\n\t\tVALUES ($id, $sender, $recipients, $size, $created_at,\n\t\t$next_attempt_at, 0, 0, $dsn)`,\n\t).run({\n\t\tid: added.id,\n\t\tsender: added.from,\n\t\trecipients: JSON.stringify(added.recipients),\n\t\tsize: added.size,\n\t\tcreated_at: added.createdAt,\n\t\tnext_attempt_at: added.nextAttemptAt,\n\t\tdsn: dsnColumn(added),\n\t});\n\tdb.query('INSERT INTO messages (item_id, content) VALUES (?, ?)').run(\n\t\tadded.id,\n\t\tmessage,\n\t);\n}\n",
|
|
5
6
|
"import { Database } from 'bun:sqlite';\nimport { chmodSync, existsSync, mkdirSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { QueueError } from '../errors';\nimport type { SqliteQueueStoreOptions } from './options';\nimport { migrate } from './schema';\n\n/**\n * The queue's files, and the directory when the store makes it: its\n * owner's alone, as mail is. A directory that already exists keeps its\n * mode — it is the operator's, who may share it with a group on purpose.\n */\nconst PRIVATE_DIRECTORY = 0o700;\nconst PRIVATE_FILE = 0o600;\n\n/**\n * Several processes may share the database: WAL lets readers go on while\n * one writes, and a writer waits up to `busy_timeout` for another. Every\n * write is flushed before it is acknowledged.\n */\nfunction configure(db: Database, busyTimeout: number): void {\n\tdb.exec(`PRAGMA busy_timeout = ${busyTimeout}`);\n\tdb.exec('PRAGMA journal_mode = WAL');\n\tdb.exec('PRAGMA synchronous = FULL');\n\t// On macOS a plain fsync leaves the data in the drive's cache.\n\tdb.exec('PRAGMA fullfsync = ON');\n\tdb.exec('PRAGMA foreign_keys = ON');\n}\n\nfunction keepPrivate(file: string): void {\n\tfor (const path of [file, `${file}-wal`, `${file}-shm`]) {\n\t\tif (existsSync(path)) chmodSync(path, PRIVATE_FILE);\n\t}\n}\n\nfunction busyTimeoutOf(value: unknown): number {\n\tif (value === undefined) return 5000;\n\tif (typeof value !== 'number' || !Number.isInteger(value) || value < 0) {\n\t\tthrow new QueueError(\n\t\t\t'INVALID',\n\t\t\t`busyTimeout must be an integer of at least 0, not ${value}`,\n\t\t);\n\t}\n\treturn value;\n}\n\nconst messageOf = (error: unknown) =>\n\terror instanceof Error ? error.message : String(error);\n\n/**\n * Opens the queue's database in `directory`, at the last migration.\n * Whatever fails is `INVALID`, naming the directory.\n */\nexport function openDatabase(options: SqliteQueueStoreOptions): Database {\n\tconst directory = (options as SqliteQueueStoreOptions | undefined)?.directory;\n\tif (typeof directory !== 'string' || directory === '') {\n\t\tthrow new QueueError('INVALID', 'A SQLite queue store needs a directory');\n\t}\n\tconst busyTimeout = busyTimeoutOf(options.busyTimeout);\n\tlet db: Database | undefined;\n\ttry {\n\t\tif (!existsSync(directory)) {\n\t\t\tmkdirSync(directory, { recursive: true, mode: PRIVATE_DIRECTORY });\n\t\t\t// The mode given to mkdir is narrowed by the umask, never widened: set it.\n\t\t\tchmodSync(directory, PRIVATE_DIRECTORY);\n\t\t}\n\t\tconst file = join(directory, 'queue.sqlite');\n\t\tdb = new Database(file, { create: true, readwrite: true, strict: true });\n\t\tconfigure(db, busyTimeout);\n\t\tkeepPrivate(file);\n\t\tmigrate(db);\n\t\treturn db;\n\t} catch (error) {\n\t\tdb?.close();\n\t\tif (error instanceof QueueError) throw error;\n\t\tthrow new QueueError(\n\t\t\t'INVALID',\n\t\t\t`The queue at \"${directory}\" cannot be opened: ${messageOf(error)}`,\n\t\t);\n\t}\n}\n",
|
|
6
7
|
"import type { Database } from 'bun:sqlite';\nimport { QueueError } from '../errors';\n\n/**\n * The migrations, in order: the database's `PRAGMA user_version` is how many\n * of them it has run. A migration is never edited once released; a change\n * is a new one at the end.\n */\nexport const MIGRATIONS: readonly string[] = [\n\t// 1: the items, and their messages in a table of their own.\n\t`\n\tCREATE TABLE items (\n\t\tseq INTEGER PRIMARY KEY,\n\t\tid TEXT NOT NULL UNIQUE,\n\t\tsender TEXT NOT NULL,\n\t\trecipients TEXT NOT NULL CHECK (json_valid(recipients)),\n\t\tsize INTEGER NOT NULL,\n\t\tcreated_at REAL NOT NULL,\n\t\tnext_attempt_at REAL NOT NULL,\n\t\tattempts INTEGER NOT NULL,\n\t\tdelay_notified INTEGER NOT NULL,\n\t\tlease_owner TEXT,\n\t\tlease_expires_at REAL,\n\t\tCHECK ((lease_owner IS NULL) = (lease_expires_at IS NULL))\n\t) STRICT;\n\tCREATE INDEX items_due ON items (next_attempt_at, seq);\n\n\tCREATE TABLE messages (\n\t\titem_id TEXT PRIMARY KEY REFERENCES items (id) ON DELETE CASCADE,\n\t\tcontent BLOB NOT NULL\n\t) STRICT;\n\t`,\n\t// 2: the item's DSN parameters (RET, ENVID) as JSON; NULL for the rows of before.\n\t`ALTER TABLE items ADD COLUMN dsn TEXT CHECK (dsn IS NULL OR json_valid(dsn))`,\n];\n\n/**\n * Brings the database to the last migration, in one transaction: a\n * migration that fails leaves the database as it was. A database written\n * by a newer store, with more migrations than this one knows, is refused.\n */\nexport function migrate(db: Database): void {\n\tdb.transaction(() => {\n\t\tconst { user_version: version } = db\n\t\t\t.query<{ user_version: number }, []>('PRAGMA user_version')\n\t\t\t.get() as { user_version: number };\n\t\tif (version > MIGRATIONS.length) {\n\t\t\tthrow new QueueError(\n\t\t\t\t'INVALID',\n\t\t\t\t`The database is at schema version ${version}, newer than this store's ${MIGRATIONS.length}`,\n\t\t\t);\n\t\t}\n\t\tfor (const sql of MIGRATIONS.slice(version)) db.exec(sql);\n\t\tif (version < MIGRATIONS.length) {\n\t\t\tdb.exec(`PRAGMA user_version = ${MIGRATIONS.length}`);\n\t\t}\n\t}).immediate();\n}\n",
|
|
7
8
|
"import { dsnParams } from '../contract/dsn-column';\nimport type { QueueItem, RecipientState } from '../contract/types';\n\n/** A row of `items`, as `bun:sqlite` reads it. */\nexport interface ItemRow {\n\treadonly id: string;\n\treadonly sender: string;\n\treadonly recipients: string;\n\treadonly size: number;\n\treadonly created_at: number;\n\treadonly next_attempt_at: number;\n\treadonly attempts: number;\n\treadonly delay_notified: number;\n\treadonly lease_owner: string | null;\n\treadonly lease_expires_at: number | null;\n\treadonly dsn: string | null;\n}\n\n/** The columns a query reads to build an item. */\nexport const COLUMNS =\n\t'id, sender, recipients, size, created_at, next_attempt_at, attempts, delay_notified, lease_owner, lease_expires_at, dsn';\n\nexport function itemOf(row: ItemRow): QueueItem {\n\tconst item: QueueItem = {\n\t\tid: row.id,\n\t\tfrom: row.sender,\n\t\trecipients: JSON.parse(row.recipients) as RecipientState[],\n\t\tsize: row.size,\n\t\tcreatedAt: row.created_at,\n\t\tnextAttemptAt: row.next_attempt_at,\n\t\tattempts: row.attempts,\n\t\tdelayNotified: row.delay_notified === 1,\n\t\t...dsnParams(row.dsn),\n\t};\n\tif (row.lease_owner === null || row.lease_expires_at === null) return item;\n\treturn {\n\t\t...item,\n\t\tlease: { owner: row.lease_owner, expiresAt: row.lease_expires_at },\n\t};\n}\n\n/** The named parameters that write an item's state back. */\nexport function stateOf(item: QueueItem) {\n\treturn {\n\t\tid: item.id,\n\t\trecipients: JSON.stringify(item.recipients),\n\t\tnext_attempt_at: item.nextAttemptAt,\n\t\tattempts: item.attempts,\n\t\tdelay_notified: item.delayNotified ? 1 : 0,\n\t\tlease_owner: item.lease?.owner ?? null,\n\t\tlease_expires_at: item.lease?.expiresAt ?? null,\n\t};\n}\n",
|
|
8
|
-
"import type { Database } from 'bun:sqlite';\nimport {\n\tapplyAttempt,\n\tcheckClaim,\n\tcheckList,\n\tcheckMaxItems,\n\tcheckNewItem,\n\tcheckOwner,\n\
|
|
9
|
+
"import type { Database } from 'bun:sqlite';\nimport {\n\tapplyAttempt,\n\tcheckClaim,\n\tcheckComplete,\n\tcheckList,\n\tcheckMaxItems,\n\tcheckNewItem,\n\tcheckOwner,\n\tcheckTime,\n\tisDone,\n\tnewItem,\n} from '../contract/checks';\nimport type { QueueStore } from '../contract/queue-store';\nimport type {\n\tAddOptions,\n\tAttemptResult,\n\tClaimRequest,\n\tCompleted,\n\tNewQueueItem,\n\tQueueItem,\n\tQueueListOptions,\n} from '../contract/types';\nimport { QueueError } from '../errors';\nimport { insertItem } from './insert';\nimport { openDatabase } from './open';\nimport type { SqliteQueueStoreOptions } from './options';\nimport { COLUMNS, type ItemRow, itemOf, stateOf } from './rows';\n\nexport type { SqliteQueueStoreOptions } from './options';\n\nconst DUE = `next_attempt_at <= $now\n\tAND (lease_owner IS NULL OR lease_expires_at <= $now)`;\n\n/**\n * A `QueueStore` on `bun:sqlite`: one directory holding `queue.sqlite`,\n * which several processes on one machine may open together. Every\n * operation is one transaction — a claim is a single `UPDATE … RETURNING`\n * — so two workers never take the same item. Messages live in a table of\n * their own, dropped with their item.\n */\nexport class SqliteQueueStore implements QueueStore {\n\treadonly #db: Database;\n\t#closed = false;\n\n\tprivate constructor(db: Database) {\n\t\tthis.#db = db;\n\t}\n\n\t/** Opens the store in `directory`, creating it if need be; what fails is `INVALID`. */\n\tstatic open(options: SqliteQueueStoreOptions): SqliteQueueStore {\n\t\treturn new SqliteQueueStore(openDatabase(options));\n\t}\n\n\t/** Lets go of the database; closing twice is fine. */\n\tclose(): void {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tthis.#db.close();\n\t}\n\n\tget #open(): Database {\n\t\tif (this.#closed) {\n\t\t\tthrow new QueueError('CLOSED', 'The queue store is closed');\n\t\t}\n\t\treturn this.#db;\n\t}\n\n\t#row(id: string, owner?: string): ItemRow | null {\n\t\tconst db = this.#open;\n\t\tif (owner === undefined) {\n\t\t\treturn db\n\t\t\t\t.query<ItemRow, [string]>(`SELECT ${COLUMNS} FROM items WHERE id = ?`)\n\t\t\t\t.get(id);\n\t\t}\n\t\treturn db\n\t\t\t.query<ItemRow, [string, string]>(\n\t\t\t\t`SELECT ${COLUMNS} FROM items WHERE id = ? AND lease_owner = ?`,\n\t\t\t)\n\t\t\t.get(id, owner);\n\t}\n\n\t#write(item: QueueItem): void {\n\t\tthis.#open\n\t\t\t.query(\n\t\t\t\t`UPDATE items SET recipients = $recipients,\n\t\t\t\tnext_attempt_at = $next_attempt_at, attempts = $attempts,\n\t\t\t\tdelay_notified = $delay_notified, lease_owner = $lease_owner,\n\t\t\t\tlease_expires_at = $lease_expires_at WHERE id = $id`,\n\t\t\t)\n\t\t\t.run(stateOf(item));\n\t}\n\n\tasync add(item: NewQueueItem, options: AddOptions = {}): Promise<QueueItem> {\n\t\tcheckNewItem(item);\n\t\tconst max = checkMaxItems(options.maxItems);\n\t\tconst db = this.#open;\n\t\tconst added = newItem(crypto.randomUUID(), item);\n\t\tdb.transaction(() => {\n\t\t\tif (max !== undefined) {\n\t\t\t\tconst { n } = db\n\t\t\t\t\t.query<{ n: number }, []>('SELECT count(*) AS n FROM items')\n\t\t\t\t\t.get() as { n: number };\n\t\t\t\tif (n >= max) {\n\t\t\t\t\tthrow new QueueError(\n\t\t\t\t\t\t'QUEUE_FULL',\n\t\t\t\t\t\t`The queue holds ${n} items, its limit`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tinsertItem(db, added, item.message);\n\t\t}).immediate();\n\t\treturn added;\n\t}\n\n\tasync get(id: string): Promise<QueueItem | undefined> {\n\t\tconst row = this.#row(id);\n\t\treturn row ? itemOf(row) : undefined;\n\t}\n\n\tasync list(options?: QueueListOptions): Promise<QueueItem[]> {\n\t\tconst { offset, limit } = checkList(options);\n\t\treturn this.#open\n\t\t\t.query<ItemRow, [number, number]>(\n\t\t\t\t`SELECT ${COLUMNS} FROM items ORDER BY next_attempt_at, seq\n\t\t\t\tLIMIT ? OFFSET ?`,\n\t\t\t)\n\t\t\t.all(limit, offset)\n\t\t\t.map(itemOf);\n\t}\n\n\tasync count(): Promise<number> {\n\t\tconst row = this.#open\n\t\t\t.query<{ n: number }, []>('SELECT count(*) AS n FROM items')\n\t\t\t.get();\n\t\treturn row?.n ?? 0;\n\t}\n\n\tasync readMessage(id: string): Promise<Uint8Array | undefined> {\n\t\tconst row = this.#open\n\t\t\t.query<{ content: Uint8Array }, [string]>(\n\t\t\t\t'SELECT content FROM messages WHERE item_id = ?',\n\t\t\t)\n\t\t\t.get(id);\n\t\treturn row ? new Uint8Array(row.content) : undefined;\n\t}\n\n\tasync claim(request: ClaimRequest): Promise<QueueItem | undefined> {\n\t\tcheckClaim(request);\n\t\tconst row = this.#open\n\t\t\t.query<ItemRow, Record<string, string | number>>(\n\t\t\t\t`UPDATE items SET lease_owner = $owner, lease_expires_at = $expires\n\t\t\t\tWHERE seq = (SELECT seq FROM items WHERE ${DUE}\n\t\t\t\t\tORDER BY next_attempt_at, seq LIMIT 1)\n\t\t\t\tRETURNING ${COLUMNS}`,\n\t\t\t)\n\t\t\t.get({\n\t\t\t\towner: request.owner,\n\t\t\t\tnow: request.now,\n\t\t\t\texpires: request.now + request.leaseMs,\n\t\t\t});\n\t\treturn row ? itemOf(row) : undefined;\n\t}\n\n\tasync renew(id: string, owner: string, expiresAt: number): Promise<boolean> {\n\t\tcheckOwner(owner);\n\t\tcheckTime('expiresAt', expiresAt);\n\t\tconst { changes } = this.#open\n\t\t\t.query(\n\t\t\t\t'UPDATE items SET lease_expires_at = ? WHERE id = ? AND lease_owner = ?',\n\t\t\t)\n\t\t\t.run(expiresAt, id, owner);\n\t\treturn changes > 0;\n\t}\n\n\tasync complete(\n\t\tid: string,\n\t\towner: string,\n\t\tresult: AttemptResult,\n\t\tdsns: readonly NewQueueItem[],\n\t): Promise<Completed | undefined> {\n\t\tcheckComplete(owner, result, dsns);\n\t\tconst db = this.#open;\n\t\treturn db\n\t\t\t.transaction((): Completed | undefined => {\n\t\t\t\tconst row = this.#row(id, owner);\n\t\t\t\tif (!row) return undefined;\n\t\t\t\tconst item = applyAttempt(itemOf(row), result);\n\t\t\t\tif (isDone(item)) {\n\t\t\t\t\tdb.query('DELETE FROM items WHERE id = ?').run(id);\n\t\t\t\t} else {\n\t\t\t\t\tthis.#write(item);\n\t\t\t\t}\n\t\t\t\tconst added = dsns.map((dsn) => {\n\t\t\t\t\tconst stored = newItem(crypto.randomUUID(), dsn);\n\t\t\t\t\tinsertItem(db, stored, dsn.message);\n\t\t\t\t\treturn stored;\n\t\t\t\t});\n\t\t\t\treturn { item, dsns: added };\n\t\t\t})\n\t\t\t.immediate();\n\t}\n\n\tasync reschedule(id: string, at: number, owner?: string): Promise<boolean> {\n\t\tcheckTime('at', at);\n\t\tconst db = this.#open;\n\t\tif (owner === undefined) {\n\t\t\treturn (\n\t\t\t\tdb\n\t\t\t\t\t.query('UPDATE items SET next_attempt_at = ? WHERE id = ?')\n\t\t\t\t\t.run(at, id).changes > 0\n\t\t\t);\n\t\t}\n\t\tcheckOwner(owner);\n\t\tconst { changes } = db\n\t\t\t.query(\n\t\t\t\t`UPDATE items SET next_attempt_at = ?, lease_owner = NULL,\n\t\t\t\tlease_expires_at = NULL WHERE id = ? AND lease_owner = ?`,\n\t\t\t)\n\t\t\t.run(at, id, owner);\n\t\treturn changes > 0;\n\t}\n\n\tasync cancel(id: string): Promise<QueueItem | undefined> {\n\t\tconst db = this.#open;\n\t\treturn db\n\t\t\t.transaction(() => {\n\t\t\t\tconst row = this.#row(id);\n\t\t\t\tif (!row) return undefined;\n\t\t\t\tdb.query('DELETE FROM items WHERE id = ?').run(id);\n\t\t\t\treturn itemOf(row);\n\t\t\t})\n\t\t\t.immediate();\n\t}\n}\n"
|
|
9
10
|
],
|
|
10
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;;;ACMO,IAAM,aAAgC;AAAA,EAE5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBA;AACD;AAOO,SAAS,OAAO,CAAC,IAAoB;AAAA,EAC3C,GAAG,YAAY,MAAM;AAAA,IACpB,QAAQ,cAAc,YAAY,GAChC,MAAoC,qBAAqB,EACzD,IAAI;AAAA,IACN,IAAI,UAAU,WAAW,QAAQ;AAAA,MAChC,MAAM,IAAI,YACT,WACA,qCAAqC,oCAAoC,WAAW,QACrF;AAAA,IACD;AAAA,IACA,WAAW,OAAO,WAAW,MAAM,OAAO;AAAA,MAAG,GAAG,KAAK,GAAG;AAAA,IACxD,IAAI,UAAU,WAAW,QAAQ;AAAA,MAChC,GAAG,KAAK,yBAAyB,WAAW,QAAQ;AAAA,IACrD;AAAA,GACA,EAAE,UAAU;AAAA;;;AD5Cd,IAAM,oBAAoB;AAC1B,IAAM,eAAe;AAOrB,SAAS,SAAS,CAAC,IAAc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AI,CAAC,QAAQ;AAAA,QAC/B,MAAM,SAAS,QAAQ,OAAO,WAAW,GAAG,GAAG;AAAA,QAC/C,WAAW,IAAI,QAAQ,IAAI,OAAO;AAAA,QAClC,OAAO;AAAA,OACP;AAAA,MACD,OAAO,EAAE,MAAM,MAAM,MAAM;AAAA,KAC3B,EACA,UAAU;AAAA;AAAA,QAGP,UAAU,CAAC,IAAY,IAAY,OAAkC;AAAA,IAC1E,UAAU,MAAM,EAAE;AAAA,IAClB,MAAM,KAAK,KAAK;AAAA,IAChB,IAAI,UAAU,WAAW;AAAA,MACxB,OACC,GACE,MAAM,mDAAmD,EACzD,IAAI,IAAI,EAAE,EAAE,UAAU;AAAA,IAE1B;AAAA,IACA,WAAW,KAAK;AAAA,IAChB,QAAQ,YAAY,GAClB,MACA;AAAA,6DAED,EACC,IAAI,IAAI,IAAI,KAAK;AAAA,IACnB,OAAO,UAAU;AAAA;AAAA,QAGZ,MAAM,CAAC,IAA4C;AAAA,IACxD,MAAM,KAAK,KAAK;AAAA,IAChB,OAAO,GACL,YAAY,MAAM;AAAA,MAClB,MAAM,MAAM,KAAK,KAAK,EAAE;AAAA,MACxB,IAAI,CAAC;AAAA,QAAK;AAAA,MACV,GAAG,MAAM,gCAAgC,EAAE,IAAI,EAAE;AAAA,MACjD,OAAO,OAAO,GAAG;AAAA,KACjB,EACA,UAAU;AAAA;AAEd;",
|
|
12
|
+
"debugId": "69534685BB7970EA64756E2164756E21",
|
|
12
13
|
"names": []
|
|
13
14
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Database } from 'bun:sqlite';
|
|
2
|
+
import type { QueueItem } from '../contract/types';
|
|
3
|
+
/** Stores a new item and its message; the caller holds the transaction. */
|
|
4
|
+
export declare function insertItem(db: Database, added: QueueItem, message: Uint8Array): void;
|
|
5
|
+
//# sourceMappingURL=insert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../src/sqlite/insert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,2EAA2E;AAC3E,wBAAgB,UAAU,CACzB,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,UAAU,GACjB,IAAI,CAmBN"}
|
package/dist/sqlite/store.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { QueueStore } from '../contract/queue-store';
|
|
2
|
-
import type { AddOptions, AttemptResult, ClaimRequest, NewQueueItem, QueueItem, QueueListOptions } from '../contract/types';
|
|
2
|
+
import type { AddOptions, AttemptResult, ClaimRequest, Completed, NewQueueItem, QueueItem, QueueListOptions } from '../contract/types';
|
|
3
3
|
import type { SqliteQueueStoreOptions } from './options';
|
|
4
4
|
export type { SqliteQueueStoreOptions } from './options';
|
|
5
5
|
/**
|
|
@@ -23,7 +23,7 @@ export declare class SqliteQueueStore implements QueueStore {
|
|
|
23
23
|
readMessage(id: string): Promise<Uint8Array | undefined>;
|
|
24
24
|
claim(request: ClaimRequest): Promise<QueueItem | undefined>;
|
|
25
25
|
renew(id: string, owner: string, expiresAt: number): Promise<boolean>;
|
|
26
|
-
complete(id: string, owner: string, result: AttemptResult): Promise<
|
|
26
|
+
complete(id: string, owner: string, result: AttemptResult, dsns: readonly NewQueueItem[]): Promise<Completed | undefined>;
|
|
27
27
|
reschedule(id: string, at: number, owner?: string): Promise<boolean>;
|
|
28
28
|
cancel(id: string): Promise<QueueItem | undefined>;
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/sqlite/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/sqlite/store.ts"],"names":[],"mappings":"AAaA,OAAO,KA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AM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAoBpE,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CAWxD"}
|
package/docs/guide.md
CHANGED
|
@@ -296,6 +296,21 @@ ran, and nothing was recorded. An item that is gone along with its
|
|
|
296
296
|
message (cancelled, or finished by another worker) is left alone, as
|
|
297
297
|
before.
|
|
298
298
|
|
|
299
|
+
The DSNs of an outcome are built before `complete` and stored by it, in
|
|
300
|
+
the same step as the outcome, so a crash or a store error cannot leave
|
|
301
|
+
the outcome recorded without its failure, relayed or delay DSN. They are
|
|
302
|
+
delivered at least once: a DSN stored by `complete` is an item like any
|
|
303
|
+
other, and a worker that crashes after the step but before the `dsn` event
|
|
304
|
+
only misses the event. When a DSN cannot be built (a `MimeError`, say),
|
|
305
|
+
the outcome is recorded without it and the `error` event says so, once the
|
|
306
|
+
outcome is recorded; a delayed DSN that cannot be built leaves
|
|
307
|
+
`delayNotified` set, since building it again would fail the same way. When
|
|
308
|
+
the store's write of a DSN fails, `complete` throws, nothing is recorded
|
|
309
|
+
and the item is redelivered after its lease expires. The `delivered` and
|
|
310
|
+
`failed` DSNs an application writes for a local delivery are its own
|
|
311
|
+
`enqueue`: a crash between the delivery and that call gives a duplicate
|
|
312
|
+
message, not a lost DSN.
|
|
313
|
+
|
|
299
314
|
A store keeps an item from being claimed before its message can be read
|
|
300
315
|
— the message written first, or both in one step — so a message missing
|
|
301
316
|
at a claim is always damage, never an add still under way. Every store
|
|
@@ -419,6 +434,36 @@ It returns `undefined` when there is nothing to send: the reverse-path is
|
|
|
419
434
|
null, or no recipient asked for `SUCCESS`. Only the recipients that asked
|
|
420
435
|
are listed.
|
|
421
436
|
|
|
437
|
+
### The `failed` DSN of a local recipient
|
|
438
|
+
|
|
439
|
+
A recipient the application cannot deliver locally is reported with
|
|
440
|
+
`failedDsn()`, which takes the `reply` to show for each recipient and the
|
|
441
|
+
message's `ret`. It returns `undefined` for a null reverse-path, or when no
|
|
442
|
+
recipient asked for failures (`NOTIFY=NEVER`, or a list without `FAILURE`):
|
|
443
|
+
|
|
444
|
+
```ts
|
|
445
|
+
import { failedDsn } from '@bumail/queue';
|
|
446
|
+
|
|
447
|
+
const dsn = failedDsn({
|
|
448
|
+
reportingMta: 'mail.example.net',
|
|
449
|
+
from: 'postmaster@example.net',
|
|
450
|
+
to: envelope.from, // the reverse-path of the message
|
|
451
|
+
arrival: received,
|
|
452
|
+
recipients: [
|
|
453
|
+
{
|
|
454
|
+
address: 'joe@example.net',
|
|
455
|
+
notify: ['FAILURE'],
|
|
456
|
+
orcpt,
|
|
457
|
+
reply: { code: 550, status: '5.1.1', text: 'mailbox no longer exists' },
|
|
458
|
+
},
|
|
459
|
+
],
|
|
460
|
+
envid,
|
|
461
|
+
ret: 'FULL', // the whole message in `original`, up to `maxReturn` (DEFAULT_MAX_RETURN, 64 KiB); else the headers
|
|
462
|
+
original: message,
|
|
463
|
+
});
|
|
464
|
+
if (dsn) await queue.enqueue(dsn, { from: '', to: envelope.from });
|
|
465
|
+
```
|
|
466
|
+
|
|
422
467
|
Nothing from outside reaches a header field raw: a reply's text, a host
|
|
423
468
|
name and an address have their control characters taken out (CR and LF
|
|
424
469
|
included), the `message/delivery-status` part is 7-bit (a UTF-8 address
|
|
@@ -962,6 +1007,20 @@ codes, and keeps its promises:
|
|
|
962
1007
|
of the lease, in one step and only for the lease's owner; a final
|
|
963
1008
|
status is never changed; an item whose every recipient is final is
|
|
964
1009
|
dropped with its message.
|
|
1010
|
+
- `complete(id, owner, result, dsns)` stores the DSN items the outcome
|
|
1011
|
+
calls for (`dsns`, each a `NewQueueItem` as `add` takes it) in the same
|
|
1012
|
+
step as the outcome, and returns `{ item, dsns }` (`Completed`): the item
|
|
1013
|
+
as it now stands, and the items inserted, in the order given. All or
|
|
1014
|
+
nothing: a lost lease (not the owner, or the item gone) returns
|
|
1015
|
+
`undefined` and writes no DSN; a DSN the store cannot keep throws and
|
|
1016
|
+
leaves the item as it was, lease held, so it is redelivered once the
|
|
1017
|
+
lease expires. A bad DSN is refused as `INVALID` before the store opens
|
|
1018
|
+
a connection or a transaction. DSNs ignore `limits.maxItems`: a full
|
|
1019
|
+
queue still bounces, and the count may exceed the limit by the DSNs it
|
|
1020
|
+
holds. A store that returns the bare item, as stores written
|
|
1021
|
+
before 0.11 do, still runs, but its DSNs are added one by one, outside
|
|
1022
|
+
the step (see [Queue store
|
|
1023
|
+
outdated](./troubleshooting.md#queueerror-queue-store-outdated-complete-returned-the-item-alone-not--item-dsns--its-dsns-are-added-one-by-one-outside-the-step-that-records-the-outcome)).
|
|
965
1024
|
- `complete` records a recipient's `mayHaveReachedMx: true` and
|
|
966
1025
|
`mayHaveReachedFallback: true` (on its `RecipientUpdate`) and keeps
|
|
967
1026
|
them: `get`, `list` and `claim` return it on
|
package/docs/roadmap.md
CHANGED
|
@@ -6,7 +6,7 @@ only number on it.
|
|
|
6
6
|
|
|
7
7
|
## Now
|
|
8
8
|
|
|
9
|
-
Nothing
|
|
9
|
+
Nothing under way.
|
|
10
10
|
|
|
11
11
|
## Next
|
|
12
12
|
|
|
@@ -20,9 +20,6 @@ Nothing is under way besides what is marked shipped below.
|
|
|
20
20
|
connections.
|
|
21
21
|
- **The contract's specs, exported**, so a store written outside this
|
|
22
22
|
package can hold itself to them.
|
|
23
|
-
- **A DSN that cannot be lost on a crash** — today a crash between
|
|
24
|
-
recording a failure and enqueuing its DSN loses that DSN; the store
|
|
25
|
-
will take both in one step.
|
|
26
23
|
|
|
27
24
|
## Later
|
|
28
25
|
|
|
@@ -49,7 +46,27 @@ Nothing is under way besides what is marked shipped below.
|
|
|
49
46
|
|
|
50
47
|
## Shipped
|
|
51
48
|
|
|
52
|
-
###
|
|
49
|
+
### 0.11.0
|
|
50
|
+
|
|
51
|
+
- **A DSN recorded in the same step as the outcome** — the failure, relayed
|
|
52
|
+
and delay DSNs are written in the same store step as the outcome they
|
|
53
|
+
report, in the memory, SQLite, PostgreSQL and Redis stores, so a crash or
|
|
54
|
+
a failed add no longer loses them. Breaking for a custom `QueueStore`:
|
|
55
|
+
`complete(id, owner, result, dsns)` returns `{ item, dsns }`; a store that
|
|
56
|
+
answers the old shape is reported on the `error` event and its DSNs fall
|
|
57
|
+
back to `add`. The `delivered` and `failed` DSNs a server writes for a
|
|
58
|
+
local delivery are not this gap: a crash there gives a duplicate, not a
|
|
59
|
+
loss.
|
|
60
|
+
|
|
61
|
+
### 0.10.0
|
|
62
|
+
|
|
63
|
+
- **`failedDsn()`** — builds the `failed` DSN of a recipient the
|
|
64
|
+
application could not deliver locally, the counterpart of `deliveredDsn()`:
|
|
65
|
+
it follows `NOTIFY` (none for `NEVER` or a list without `FAILURE`, none for
|
|
66
|
+
a null reverse-path), `ORCPT`, `ENVID` and `RET`; `DEFAULT_MAX_RETURN` (64
|
|
67
|
+
KiB) is the default of what a DSN returns of the original.
|
|
68
|
+
|
|
69
|
+
### 0.9.0
|
|
53
70
|
|
|
54
71
|
- **DSN requests (RFC 3461)**: the queue honours a sender's `NOTIFY`, `RET`,
|
|
55
72
|
`ENVID` and `ORCPT` given at enqueue. `NOTIFY=NEVER` silences failure
|
|
@@ -58,22 +75,31 @@ Nothing is under way besides what is marked shipped below.
|
|
|
58
75
|
`Original-Recipient`; and `deliveredDsn()` builds the `delivered` DSN for
|
|
59
76
|
a local delivery. The SQLite and PostgreSQL stores run migration 2: stop
|
|
60
77
|
every old worker before starting the new ones.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
stays on the MX until `retry.giveUpAfter` (a `4.4.7` DSN that says so),
|
|
65
|
-
and the `deferred` and `failed` events carry the mark.
|
|
78
|
+
|
|
79
|
+
### 0.8.0
|
|
80
|
+
|
|
66
81
|
- **The fallback smarthost's doubt is remembered** — a recipient whose
|
|
67
82
|
session by the fallback smarthost ended after the final dot with no reply
|
|
68
83
|
is marked `mayHaveReachedFallback`, kept by every store: later attempts
|
|
69
84
|
skip the MX for it and go to the smarthost again, until
|
|
70
85
|
`retry.giveUpAfter` (a `4.4.7` DSN that says so), and the `deferred` and
|
|
71
86
|
`failed` events carry the mark.
|
|
87
|
+
|
|
88
|
+
### 0.7.1
|
|
89
|
+
|
|
72
90
|
- **Only the recipients the MX did not refuse are in doubt** — in a session that
|
|
73
91
|
failed after the final dot, a recipient the MX refused at `RCPT` is
|
|
74
92
|
settled from its own reply (5xx failed, 4xx deferred) and not marked, so
|
|
75
93
|
it may fall back to the smarthost.
|
|
76
94
|
|
|
95
|
+
### 0.7.0
|
|
96
|
+
|
|
97
|
+
- **The MX's doubt is remembered** — a recipient whose session by MX ended
|
|
98
|
+
after the final dot with no reply is marked `mayHaveReachedMx`, kept by
|
|
99
|
+
every store: no later attempt falls back to the smarthost on its own, it
|
|
100
|
+
stays on the MX until `retry.giveUpAfter` (a `4.4.7` DSN that says so),
|
|
101
|
+
and the `deferred` and `failed` events carry the mark.
|
|
102
|
+
|
|
77
103
|
### 0.5.0
|
|
78
104
|
|
|
79
105
|
- **A fallback smarthost** — `fallback`: a recipient
|
package/docs/troubleshooting.md
CHANGED
|
@@ -31,6 +31,7 @@ parts shown as … vary.
|
|
|
31
31
|
- [`QueueError: dsn.returnContent must be 'headers' or 'full', not …`](#queueerror-dsnreturncontent-must-be-headers-or-full-not-)
|
|
32
32
|
- [`QueueError: createQueue() takes an options object`](#queueerror-createqueue-takes-an-options-object)
|
|
33
33
|
- [`QueueError: owner must be a non-empty string`](#queueerror-owner-must-be-a-non-empty-string)
|
|
34
|
+
- [`QueueError: dsns must be an array`](#queueerror-dsns-must-be-an-array)
|
|
34
35
|
|
|
35
36
|
**The `error` event**
|
|
36
37
|
|
|
@@ -39,6 +40,8 @@ parts shown as … vary.
|
|
|
39
40
|
- [`QueueError: The lease on … expired before its outcome was recorded, and the item is gone: lost to another worker that finished it, the message then sent twice, or cancelled`](#queueerror-the-lease-on--expired-before-its-outcome-was-recorded-and-the-item-is-gone-lost-to-another-worker-that-finished-it-the-message-then-sent-twice-or-cancelled)
|
|
40
41
|
- [`QueueError: The lease on … was lost while it was delivered, and the item is gone: finished by the worker that took it, the message then sent twice, or cancelled`](#queueerror-the-lease-on--was-lost-while-it-was-delivered-and-the-item-is-gone-finished-by-the-worker-that-took-it-the-message-then-sent-twice-or-cancelled)
|
|
41
42
|
- [`QueueError: The message of … is unreadable: the store holds the item but not its message, so every pending recipient failed`](#queueerror-the-message-of--is-unreadable-the-store-holds-the-item-but-not-its-message-so-every-pending-recipient-failed)
|
|
43
|
+
- [`QueueError: Queue store outdated: complete returned the item alone, not { item, dsns }; its DSNs are added one by one, outside the step that records the outcome`](#queueerror-queue-store-outdated-complete-returned-the-item-alone-not--item-dsns--its-dsns-are-added-one-by-one-outside-the-step-that-records-the-outcome)
|
|
44
|
+
- [`QueueError: The queue store stored … of the … DSNs of …: a … DSN to … is lost`](#queueerror-the-queue-store-stored--of-the--dsns-of--a--dsn-to--is-lost)
|
|
42
45
|
- [`SmtpError: sendMail(): …` (`INVALID_OPTION`), with recipients deferred as `4.3.5`](#smtperror-sendmail--invalid_option-with-recipients-deferred-as-435)
|
|
43
46
|
- [`SQLiteError: database is locked`, or another store error, during a delivery](#sqliteerror-database-is-locked-or-another-store-error-during-a-delivery)
|
|
44
47
|
- [`PostgresError: …`, or a connection error, during a delivery](#postgreserror--or-a-connection-error-during-a-delivery)
|
|
@@ -165,8 +168,9 @@ checked at `enqueue`, and by every store at `add`, never at delivery:
|
|
|
165
168
|
`NEVER` alone, or a non-empty list without repeats.
|
|
166
169
|
- `orcpt of … must be { type, address }`: both strings, the address not
|
|
167
170
|
empty, or the type is not a token (letters, digits, hyphens).
|
|
168
|
-
- `orcpt of … is over 500 characters once encoded`: `type;` and the
|
|
169
|
-
|
|
171
|
+
- `orcpt of … is over 500 characters once encoded`: `type;` and the address
|
|
172
|
+
as sent (xtext; for `utf-8` its RFC 6533 unitext form: raw UTF-8 octets,
|
|
173
|
+
`\x{HH}` = 6) take at most 500 characters (RFC 3461 §4.2).
|
|
170
174
|
|
|
171
175
|
```ts
|
|
172
176
|
await queue.enqueue(message, {
|
|
@@ -301,6 +305,21 @@ or `… must be a number from … to …, not …`. A number option out of its r
|
|
|
301
305
|
|
|
302
306
|
**Code:** `INVALID`.
|
|
303
307
|
|
|
308
|
+
### `QueueError: dsns must be an array`
|
|
309
|
+
|
|
310
|
+
**Code:** `INVALID`.
|
|
311
|
+
**When:** `complete(id, owner, result, dsns)` of a store of this package
|
|
312
|
+
was called with something other than an array as `dsns`, typically by a
|
|
313
|
+
caller of the store that still uses the three-argument form.
|
|
314
|
+
**Why:** since 0.11 `complete` takes the DSN items the outcome calls for
|
|
315
|
+
(an empty array for none); the store checks them before it opens a
|
|
316
|
+
connection or a transaction, so nothing was written.
|
|
317
|
+
**Fix:** pass an array, `[]` when the outcome calls for no DSN:
|
|
318
|
+
|
|
319
|
+
```ts
|
|
320
|
+
await store.complete(id, owner, result, []);
|
|
321
|
+
```
|
|
322
|
+
|
|
304
323
|
### `QueueError: owner must be a non-empty string`
|
|
305
324
|
|
|
306
325
|
**Code:** `INVALID`, also as
|
|
@@ -394,6 +413,51 @@ guide's [Redis](guide.md#redis)); never delete a queue's keys or rows by
|
|
|
394
413
|
hand, `cancel(id)` drops an item with its message. The sender has the
|
|
395
414
|
DSN and may send again.
|
|
396
415
|
|
|
416
|
+
### `QueueError: Queue store outdated: complete returned the item alone, not { item, dsns }; its DSNs are added one by one, outside the step that records the outcome`
|
|
417
|
+
|
|
418
|
+
**Code:** `INVALID`, on the `error` event, with the item's `id`.
|
|
419
|
+
**When:** a custom `QueueStore` still answers `complete` as before 0.11,
|
|
420
|
+
with the bare `QueueItem`, and an
|
|
421
|
+
outcome calls for a DSN (a failure, a `relayed` or a delay).
|
|
422
|
+
**Why:** since 0.11 the queue hands the DSNs to `complete`, which stores
|
|
423
|
+
them in the same step as the outcome and returns `{ item, dsns }`. A store
|
|
424
|
+
that answers with the item alone has stored none of them: the queue adds
|
|
425
|
+
each one with `add` afterwards, as it did before, so a crash or an `add`
|
|
426
|
+
error between the two steps still loses a DSN, and an `add` that fails is
|
|
427
|
+
one more `error` event. The stores of this package are not affected.
|
|
428
|
+
**Fix:** port the store's `complete`: take `dsns`, insert them in the
|
|
429
|
+
transaction (or script) that records the outcome, and return them (the
|
|
430
|
+
`this.*` calls are your store's own helpers, a sketch):
|
|
431
|
+
|
|
432
|
+
```ts
|
|
433
|
+
async complete(id, owner, result, dsns) {
|
|
434
|
+
return this.transaction(async () => {
|
|
435
|
+
const item = await this.apply(id, owner, result);
|
|
436
|
+
if (!item) return undefined; // lease lost: no DSN written
|
|
437
|
+
const stored = [];
|
|
438
|
+
for (const dsn of dsns) stored.push(await this.insert(dsn)); // in order
|
|
439
|
+
return { item, dsns: stored };
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
See [Writing a store](./guide.md#writing-a-store).
|
|
445
|
+
|
|
446
|
+
### `QueueError: The queue store stored … of the … DSNs of …: a … DSN to … is lost`
|
|
447
|
+
|
|
448
|
+
**Code:** `INVALID`, on the `error` event, with the item's `id`.
|
|
449
|
+
**When:** a custom `QueueStore`'s `complete` returned `{ item, dsns }` with
|
|
450
|
+
fewer DSNs than it was given, and an outcome called for them (a failure, a
|
|
451
|
+
`relayed` or a delay).
|
|
452
|
+
**Why:** the queue matches the returned DSNs to the ones it asked for, in
|
|
453
|
+
order. A DSN with no stored counterpart was not kept, so its notice to the
|
|
454
|
+
sender is lost: no `dsn` event is emitted for it. The stores of this
|
|
455
|
+
package return every DSN or throw.
|
|
456
|
+
**Fix:** make `complete` return one stored item per DSN, in the order
|
|
457
|
+
given, or throw to leave the item leased (see the sketch under
|
|
458
|
+
[Queue store outdated](#queueerror-queue-store-outdated-complete-returned-the-item-alone-not--item-dsns--its-dsns-are-added-one-by-one-outside-the-step-that-records-the-outcome)
|
|
459
|
+
and [Writing a store](./guide.md#writing-a-store)).
|
|
460
|
+
|
|
397
461
|
### `SmtpError: sendMail(): …` (`INVALID_OPTION`), with recipients deferred as `4.3.5`
|
|
398
462
|
|
|
399
463
|
**When:** `sendMail` refused the options of a session — the route, the
|
|
@@ -719,7 +783,7 @@ queue's own outcomes always have one.
|
|
|
719
783
|
await store.complete(id, owner, {
|
|
720
784
|
...result,
|
|
721
785
|
recipients: [{ address, status: 'deferred', reply: { status: '4.4.1', text: 'No answer' } }],
|
|
722
|
-
});
|
|
786
|
+
}, []); // the DSN items the outcome calls for, none here
|
|
723
787
|
```
|
|
724
788
|
|
|
725
789
|
### `QueueError: reply.status must be a string`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bumail/queue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "The outbound mail queue of a mail server: every recipient's state, retries with back-off, delivery status notifications (RFC 3464), leases for several workers, and a memory, a bun:sqlite, a PostgreSQL (Bun.sql) and a Redis (Bun.redis) store, delivering through @bumail/smtp/client",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@bumail/dns": "^0.2.
|
|
68
|
+
"@bumail/dns": "^0.2.2",
|
|
69
69
|
"@bumail/mime": "^0.2.0",
|
|
70
|
-
"@bumail/smtp": "^0.
|
|
70
|
+
"@bumail/smtp": "^0.11.1",
|
|
71
71
|
"@types/bun": "^1.4.2"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@bumail/mime": "^0.2.0",
|
|
75
|
-
"@bumail/smtp": "^0.
|
|
75
|
+
"@bumail/smtp": "^0.11.1",
|
|
76
76
|
"typescript": "^6.0.3 || ^7.0.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependenciesMeta": {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/text.ts", "../src/errors.ts", "../src/contract/storable.ts", "../src/contract/dsn-checks.ts", "../src/contract/checks.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/** Text from the other side, made safe to keep and to write in a header field. */\n\n/** C0, DEL and C1: every control character, CR, LF and TAB included. */\nconst isControl = (code: number) =>\n\tcode < 0x20 || (code >= 0x7f && code <= 0x9f);\n\n/** Whether the text holds a control character. */\nexport function hasControl(text: string): boolean {\n\tfor (let i = 0; i < text.length; i++) {\n\t\tif (isControl(text.charCodeAt(i))) return true;\n\t}\n\treturn false;\n}\n\n/** Each control character replaced by `by`. */\nexport function replaceControls(text: string, by: string): string {\n\tlet out = '';\n\tfor (let i = 0; i < text.length; i++) {\n\t\tout += isControl(text.charCodeAt(i)) ? by : (text[i] as string);\n\t}\n\treturn out;\n}\n\n/**\n * Every control character (CR and LF included) as a space, a lone\n * surrogate as U+FFFD, runs of space as one, cut at `max` characters with\n * `...`, never inside a surrogate pair: what a reply leaves in an item,\n * an event and a DSN.\n */\nexport function cleanText(text: string, max: number): string {\n\tconst clean = replaceControls(text.toWellFormed(), ' ')\n\t\t.replace(/ {2,}/g, ' ')\n\t\t.trim();\n\treturn clean.length > max ? `${cut(clean, max - 3)}...` : clean;\n}\n\n/**\n * The first `length` UTF-16 units, never ending inside a surrogate pair:\n * a lone surrogate is text no store can keep (PostgreSQL's `jsonb` refuses\n * it), nor any UTF-8 encode.\n */\nfunction cut(text: string, length: number): string {\n\tconst head = text.slice(0, length);\n\tconst last = head.charCodeAt(head.length - 1);\n\treturn last >= 0xd800 && last <= 0xdbff ? head.slice(0, -1) : head;\n}\n\n/**\n * Text every store can keep: no NUL (PostgreSQL's `text` and `jsonb` hold\n * none) and no lone surrogate. `cleanText`'s output always is.\n */\nexport const isStorable = (text: string): boolean =>\n\ttext.isWellFormed() && !text.includes('\\0');\n\n/** `cleanText`, then anything not printable ASCII as `?`: for a `message/delivery-status` field. */\nexport const asciiText = (text: string, max: number): string =>\n\tcleanText(text, max).replace(/[^ -~]/g, '?');\n",
|
|
6
|
-
"/**\n * Why the queue or a store refused a call. `INVALID`: an option or an\n * argument it cannot take. `MESSAGE_TOO_BIG`, `TOO_MANY_RECIPIENTS` and\n * `QUEUE_FULL`: a limit `enqueue` enforces. `CLOSED`: a store used after\n * `close()`. `LEASE_LOST`: given to the `error` event when another worker\n * took an item before its outcome was recorded — or, once the lease's\n * expiry passed, when the item is gone: lost or cancelled.\n * `MESSAGE_UNREADABLE`: given to the `error` event when the store holds an\n * item but not its message, whose pending recipients then fail.\n */\nexport type QueueErrorCode =\n\t| 'INVALID'\n\t| 'MESSAGE_TOO_BIG'\n\t| 'TOO_MANY_RECIPIENTS'\n\t| 'QUEUE_FULL'\n\t| 'CLOSED'\n\t| 'LEASE_LOST'\n\t| 'MESSAGE_UNREADABLE';\n\n/** Thrown by the queue and by every store, whichever answers the contract, with the same codes. */\nexport class QueueError extends Error {\n\toverride readonly name = 'QueueError';\n\treadonly code: QueueErrorCode;\n\n\tconstructor(code: QueueErrorCode, message: string) {\n\t\tsuper(message);\n\t\tthis.code = code;\n\t}\n}\n\n/** `INVALID`, for an option or an argument. */\nexport const invalid = (message: string) => new QueueError('INVALID', message);\n",
|
|
7
|
-
"import { invalid } from '../errors';\nimport { isStorable } from '../text';\n\n/**\n * Text a store keeps: refused, the same way by every store, when it holds\n * a NUL or a lone surrogate, which PostgreSQL cannot keep and no UTF-8\n * encode can carry.\n */\nexport function checkStorable(name: string, text: string): void {\n\tif (!isStorable(text)) {\n\t\tthrow invalid(\n\t\t\t`${name} holds a NUL or a lone surrogate, which a store cannot keep`,\n\t\t);\n\t}\n}\n",
|
|
8
|
-
"// The value rules repeat packages/smtp/src/server/dsn-params.ts, packages/smtp/src/client/dsn.ts and\n// packages/jmap/src/submission/dsn.ts (AGENTS.md, Deliberate duplications); this copy guards the contract.\nimport { invalid } from '../errors';\nimport { checkStorable } from './storable';\nimport type { NewQueueItem, RecipientDsn } from './types';\n\nconst EVENTS: readonly unknown[] = ['SUCCESS', 'FAILURE', 'DELAY'];\n\n/**\n * The length the xtext of `text` takes on the wire (RFC 3461 §4): one\n * character for each byte of its UTF-8 form in `!` to `~` but `+` and `=`,\n * three for any other.\n */\nfunction xtextLength(text: string): number {\n\tlet length = 0;\n\tfor (const byte of new TextEncoder().encode(text)) {\n\t\tlength +=\n\t\t\tbyte >= 33 && byte <= 126 && byte !== 0x2b && byte !== 0x3d ? 1 : 3;\n\t}\n\treturn length;\n}\n\n/** One recipient's `NOTIFY` (RFC 3461 §4.1) and `ORCPT` (§4.2). */\nfunction checkRecipientDsn(entry: RecipientDsn, to: readonly string[]): void {\n\tconst { address, notify, orcpt } = entry ?? {};\n\tif (typeof address !== 'string' || !to.includes(address)) {\n\t\tthrow invalid(\n\t\t\t`recipients names ${JSON.stringify(address)}, which is not in to`,\n\t\t);\n\t}\n\tif (notify !== undefined && notify !== 'NEVER') {\n\t\tconst events: readonly unknown[] = Array.isArray(notify) ? notify : [];\n\t\tif (\n\t\t\tevents.length === 0 ||\n\t\t\tevents.some((e, i) => !EVENTS.includes(e) || events.indexOf(e) !== i)\n\t\t) {\n\t\t\tthrow invalid(\n\t\t\t\t`notify of ${address} must be 'NEVER' or a list of 'SUCCESS', 'FAILURE', 'DELAY', each once`,\n\t\t\t);\n\t\t}\n\t}\n\tif (orcpt === undefined) return;\n\tif (\n\t\ttypeof orcpt !== 'object' ||\n\t\torcpt === null ||\n\t\ttypeof orcpt.type !== 'string' ||\n\t\t!/^[A-Za-z0-9-]+$/.test(orcpt.type) ||\n\t\ttypeof orcpt.address !== 'string' ||\n\t\torcpt.address === ''\n\t) {\n\t\tthrow invalid(`orcpt of ${address} must be { type, address }`);\n\t}\n\t// RFC 3461 §4.2: \"The entire ORCPT parameter MAY be up to 500 characters in length\", as sent.\n\tif (orcpt.type.length + 1 + xtextLength(orcpt.address) > 500) {\n\t\tthrow invalid(`orcpt of ${address} is over 500 characters once encoded`);\n\t}\n\tcheckStorable('orcpt.type', orcpt.type);\n\tcheckStorable('orcpt.address', orcpt.address);\n}\n\n/** `ret`, `envid` and `recipients` of a new item. */\nexport function checkDsnParams(item: NewQueueItem): void {\n\tconst { ret, envid, recipients } = item;\n\tif (ret !== undefined && ret !== 'FULL' && ret !== 'HDRS') {\n\t\tthrow invalid(`ret must be 'FULL' or 'HDRS', not ${String(ret)}`);\n\t}\n\tif (\n\t\tenvid !== undefined &&\n\t\t(typeof envid !== 'string' ||\n\t\t\t!/^[ -~]{1,100}$/.test(envid) ||\n\t\t\t// RFC 3461 §4.4: \"The ENVID parameter MAY be up to 100 characters in length\", as sent.\n\t\t\txtextLength(envid) > 100)\n\t) {\n\t\tthrow invalid(\n\t\t\t'envid must be 1 to 100 printable ASCII characters, at most 100 once encoded as xtext',\n\t\t);\n\t}\n\tif (recipients === undefined) return;\n\tif (!Array.isArray(recipients)) {\n\t\tthrow invalid('recipients must be an array of { address, notify, orcpt }');\n\t}\n\tconst seen = new Set<string>();\n\tfor (const entry of recipients) {\n\t\tcheckRecipientDsn(entry, item.to);\n\t\tif (seen.has(entry.address)) {\n\t\t\tthrow invalid(`recipients names ${entry.address} twice`);\n\t\t}\n\t\tseen.add(entry.address);\n\t}\n}\n",
|
|
9
|
-
"import { invalid } from '../errors';\nimport { checkDsnParams } from './dsn-checks';\nimport { checkStorable } from './storable';\n\nexport { checkStorable };\n\nimport type {\n\tAttemptResult,\n\tClaimRequest,\n\tDiagnostic,\n\tNewQueueItem,\n\tQueueItem,\n\tQueueListOptions,\n\tRecipientState,\n\tRecipientUpdate,\n} from './types';\n\n/** What every store checks the same way, so each refuses the same input with the same error. */\n\nconst isTime = (value: unknown): value is number =>\n\ttypeof value === 'number' && Number.isFinite(value);\n\n/** A time in milliseconds since the epoch, or `INVALID` naming it. */\nexport function checkTime(name: string, value: unknown): number {\n\tif (!isTime(value)) throw invalid(`${name} must be a finite number`);\n\treturn value;\n}\n\n/** A lease owner: a non-empty string. */\nexport function checkOwner(owner: unknown): string {\n\tif (typeof owner !== 'string' || owner === '') {\n\t\tthrow invalid('owner must be a non-empty string');\n\t}\n\tcheckStorable('owner', owner);\n\treturn owner;\n}\n\n/** Every text of a recipient's outcome. */\nfunction checkUpdate(update: RecipientUpdate): void {\n\tcheckStorable('A recipient', update.address);\n\tfor (const key of ['mayHaveReachedMx', 'mayHaveReachedFallback'] as const) {\n\t\tconst mark = update[key] as unknown;\n\t\tif (mark !== undefined && mark !== true) {\n\t\t\tthrow invalid(`${key} must be true or absent`);\n\t\t}\n\t}\n\tconst reply = update.reply as Partial<Diagnostic> | undefined;\n\tif (reply === undefined) return;\n\tif (\n\t\ttypeof reply !== 'object' ||\n\t\treply === null ||\n\t\ttypeof reply.text !== 'string'\n\t) {\n\t\tthrow invalid('A reply is an object with a text');\n\t}\n\tcheckStorable('reply.text', reply.text);\n\tfor (const name of ['status', 'host'] as const) {\n\t\tconst value = reply[name];\n\t\tif (value === undefined) continue;\n\t\tif (typeof value !== 'string')\n\t\t\tthrow invalid(`reply.${name} must be a string`);\n\t\tcheckStorable(`reply.${name}`, value);\n\t}\n}\n\nexport function checkNewItem(item: NewQueueItem): void {\n\tif (typeof item !== 'object' || item === null) {\n\t\tthrow invalid('A new item is an object');\n\t}\n\tif (typeof item.from !== 'string') throw invalid('from must be a string');\n\tcheckStorable('from', item.from);\n\tconst to = item.to as unknown;\n\tif (\n\t\t!Array.isArray(to) ||\n\t\tto.length === 0 ||\n\t\t!to.every((a) => typeof a === 'string' && a !== '')\n\t) {\n\t\tthrow invalid('to must be a non-empty array of addresses');\n\t}\n\tfor (const address of to as string[]) checkStorable('A recipient', address);\n\tif (!(item.message instanceof Uint8Array)) {\n\t\tthrow invalid('message must be a Uint8Array');\n\t}\n\tcheckTime('createdAt', item.createdAt);\n\tcheckDsnParams(item);\n}\n\n/** `maxItems`: a positive integer, or nothing. */\nexport function checkMaxItems(max: unknown): number | undefined {\n\tif (max === undefined) return undefined;\n\tif (typeof max !== 'number' || !Number.isInteger(max) || max < 1) {\n\t\tthrow invalid(`maxItems must be an integer of at least 1, not ${max}`);\n\t}\n\treturn max;\n}\n\nexport function checkClaim(request: ClaimRequest): void {\n\tif (typeof request !== 'object' || request === null) {\n\t\tthrow invalid('A claim is an object');\n\t}\n\tcheckOwner(request.owner);\n\tcheckTime('now', request.now);\n\tif (!isTime(request.leaseMs) || request.leaseMs <= 0) {\n\t\tthrow invalid('leaseMs must be a positive number');\n\t}\n}\n\nexport function checkResult(result: AttemptResult): void {\n\tif (typeof result !== 'object' || result === null) {\n\t\tthrow invalid('An attempt result is an object');\n\t}\n\tcheckTime('now', result.now);\n\tcheckTime('nextAttemptAt', result.nextAttemptAt);\n\tif (!Number.isInteger(result.attempts) || result.attempts < 0) {\n\t\tthrow invalid('attempts must be an integer of at least 0');\n\t}\n\tif (typeof result.delayNotified !== 'boolean') {\n\t\tthrow invalid('delayNotified must be true or false');\n\t}\n\tconst statuses = ['delivered', 'deferred', 'failed'];\n\tif (\n\t\t!Array.isArray(result.recipients) ||\n\t\t!result.recipients.every(\n\t\t\t(u) => typeof u?.address === 'string' && statuses.includes(u.status),\n\t\t)\n\t) {\n\t\tthrow invalid(\n\t\t\t'recipients must be an array of { address, status: delivered, deferred or failed }',\n\t\t);\n\t}\n\tfor (const update of result.recipients) checkUpdate(update);\n}\n\n/** The offset and limit of a list: integers, the limit 1 to 1000. */\nexport function checkList(options: QueueListOptions = {}): {\n\toffset: number;\n\tlimit: number;\n} {\n\tconst offset = options.offset ?? 0;\n\tconst limit = options.limit ?? 100;\n\tif (!Number.isInteger(offset) || offset < 0) {\n\t\tthrow invalid(`offset must be an integer of at least 0, not ${offset}`);\n\t}\n\tif (!Number.isInteger(limit) || limit < 1 || limit > 1000) {\n\t\tthrow invalid(`limit must be an integer from 1 to 1000, not ${limit}`);\n\t}\n\treturn { offset, limit };\n}\n\n/** Every recipient is `delivered` or `failed`. */\nexport const isDone = (item: Pick<QueueItem, 'recipients'>): boolean =>\n\titem.recipients.every(\n\t\t(r) => r.status === 'delivered' || r.status === 'failed',\n\t);\n\n/**\n * The item once an attempt is recorded: its recipients' outcomes, a final\n * state never changed again, the schedule, and no lease.\n */\nexport function applyAttempt(\n\titem: QueueItem,\n\tresult: AttemptResult,\n): QueueItem {\n\tconst updates = new Map(result.recipients.map((u) => [u.address, u]));\n\tconst recipients = item.recipients.map((r): RecipientState => {\n\t\tconst update = updates.get(r.address);\n\t\tif (!update || r.status === 'delivered' || r.status === 'failed') return r;\n\t\treturn {\n\t\t\taddress: r.address,\n\t\t\tstatus: update.status,\n\t\t\t...(r.notify === undefined ? {} : { notify: r.notify }),\n\t\t\t...(r.orcpt === undefined ? {} : { orcpt: r.orcpt }),\n\t\t\t...(update.reply ? { reply: update.reply } : {}),\n\t\t\tupdatedAt: result.now,\n\t\t\t...(r.mayHaveReachedMx || update.mayHaveReachedMx\n\t\t\t\t? { mayHaveReachedMx: true as const }\n\t\t\t\t: {}),\n\t\t\t...(r.mayHaveReachedFallback || update.mayHaveReachedFallback\n\t\t\t\t? { mayHaveReachedFallback: true as const }\n\t\t\t\t: {}),\n\t\t};\n\t});\n\tconst { lease: _, ...rest } = item;\n\treturn {\n\t\t...rest,\n\t\trecipients,\n\t\tnextAttemptAt: result.nextAttemptAt,\n\t\tattempts: result.attempts,\n\t\tdelayNotified: result.delayNotified,\n\t};\n}\n\n/** A new item as a store first keeps it. */\nexport function newItem(id: string, item: NewQueueItem): QueueItem {\n\tconst dsn = new Map(item.recipients?.map((r) => [r.address, r]));\n\treturn {\n\t\tid,\n\t\tfrom: item.from,\n\t\trecipients: item.to.map((address): RecipientState => {\n\t\t\tconst { notify, orcpt } = dsn.get(address) ?? {};\n\t\t\treturn {\n\t\t\t\taddress,\n\t\t\t\tstatus: 'pending',\n\t\t\t\t...(notify === undefined\n\t\t\t\t\t? {}\n\t\t\t\t\t: { notify: notify === 'NEVER' ? notify : [...notify] }),\n\t\t\t\t...(orcpt === undefined\n\t\t\t\t\t? {}\n\t\t\t\t\t: { orcpt: { type: orcpt.type, address: orcpt.address } }),\n\t\t\t};\n\t\t}),\n\t\tsize: item.message.length,\n\t\tcreatedAt: item.createdAt,\n\t\tnextAttemptAt: item.createdAt,\n\t\tattempts: 0,\n\t\tdelayNotified: false,\n\t\t...(item.ret === undefined ? {} : { ret: item.ret }),\n\t\t...(item.envid === undefined ? {} : { envid: item.envid }),\n\t};\n}\n\n/** Whether a lease, if any, leaves the item free to claim at `now`. */\nexport const claimable = (item: QueueItem, now: number): boolean =>\n\titem.nextAttemptAt <= now &&\n\t(item.lease === undefined || item.lease.expiresAt <= now);\n"
|
|
10
|
-
],
|
|
11
|
-
"mappings": ";AAGA,IAAM,YAAY,CAAC,SAClB,OAAO,MAAS,QAAQ,OAAQ,QAAQ;AAGlC,SAAS,UAAU,CAAC,MAAuB;AAAA,EACjD,SAAS,IAAI,EAAG,IAAI,KAAK,QAAQ,KAAK;AAAA,IACrC,IAAI,UAAU,KAAK,WAAW,CAAC,CAAC;AAAA,MAAG,OAAO;AAAA,EAC3C;AAAA,EACA,OAAO;AAAA;AAID,SAAS,eAAe,CAAC,MAAc,IAAoB;AAAA,EACjE,IAAI,MAAM;AAAA,EACV,SAAS,IAAI,EAAG,IAAI,KAAK,QAAQ,KAAK;AAAA,IACrC,OAAO,UAAU,KAAK,WAAW,CAAC,CAAC,IAAI,KAAM,KAAK;AAAA,EACnD;AAAA,EACA,OAAO;AAAA;AASD,SAAS,SAAS,CAAC,MAAc,KAAqB;AAAA,EAC5D,MAAM,QAAQ,gBAAgB,KAAK,aAAa,GAAG,GAAG,EACpD,QAAQ,UAAU,GAAG,EACrB,KAAK;AAAA,EACP,OAAO,MAAM,SAAS,MAAM,GAAG,IAAI,OAAO,MAAM,CAAC,SAAS;AAAA;AAQ3D,SAAS,GAAG,CAAC,MAAc,QAAwB;AAAA,EAClD,MAAM,OAAO,KAAK,MAAM,GAAG,MAAM;AAAA,EACjC,MAAM,OAAO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