@vielzeug/codex 26.11.24 → 26.11.25
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 +5 -4
- package/data/snapshot.json +1 -0
- package/dist/catalog.d.ts +35 -39
- package/dist/catalog.js +112 -139
- package/dist/catalog.js.map +1 -1
- package/dist/cli.js +25 -16
- package/dist/cli.js.map +1 -1
- package/dist/http.js +1 -1
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +9 -7
- package/dist/server.js +14 -6
- package/dist/server.js.map +1 -1
- package/dist/snapshot.d.ts +8 -22
- package/dist/snapshot.js +41 -176
- package/dist/snapshot.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/packages.js +49 -82
- package/dist/tools/packages.js.map +1 -1
- package/dist/tools/refine.d.ts +1 -2
- package/dist/tools/refine.js +90 -82
- package/dist/tools/refine.js.map +1 -1
- package/dist/tools/schema.d.ts +2 -1
- package/dist/tools/schema.js +9 -5
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/shared.d.ts +2 -2
- package/dist/types.d.ts +77 -64
- package/dist/types.js +6 -2
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/skills/vielzeug/SKILL.md +18 -20
- package/data/catalog.json +0 -2539
- package/data/llms-full.txt +0 -40978
- package/data/llms.txt +0 -60
- package/data/manifest.json +0 -4
- package/data/packages/archive.json +0 -87
- package/data/packages/arsenal.json +0 -270
- package/data/packages/assay.json +0 -52
- package/data/packages/atlas.json +0 -81
- package/data/packages/bard.json +0 -38
- package/data/packages/beacon.json +0 -51
- package/data/packages/clockwork.json +0 -69
- package/data/packages/codex.json +0 -37
- package/data/packages/coins.json +0 -99
- package/data/packages/conduit.json +0 -67
- package/data/packages/courier.json +0 -66
- package/data/packages/dnd.json +0 -60
- package/data/packages/familiar.json +0 -38
- package/data/packages/flux.json +0 -97
- package/data/packages/focus.json +0 -51
- package/data/packages/forge.json +0 -65
- package/data/packages/gesture.json +0 -65
- package/data/packages/herald.json +0 -80
- package/data/packages/illusionist.json +0 -132
- package/data/packages/ink.json +0 -41
- package/data/packages/keymap.json +0 -55
- package/data/packages/ledger.json +0 -60
- package/data/packages/lingua.json +0 -68
- package/data/packages/mesh.json +0 -52
- package/data/packages/necromancer.json +0 -55
- package/data/packages/orbit.json +0 -100
- package/data/packages/ore.json +0 -78
- package/data/packages/palette.json +0 -42
- package/data/packages/patchwork.json +0 -55
- package/data/packages/postmaster.json +0 -49
- package/data/packages/prism.json +0 -99
- package/data/packages/pulse.json +0 -71
- package/data/packages/refine.json +0 -36
- package/data/packages/ripple.json +0 -84
- package/data/packages/rune.json +0 -78
- package/data/packages/sandbox.json +0 -26
- package/data/packages/scout.json +0 -66
- package/data/packages/scribe.json +0 -57
- package/data/packages/scroll.json +0 -110
- package/data/packages/sentinel.json +0 -46
- package/data/packages/sigil.json +0 -52
- package/data/packages/sourcerer.json +0 -86
- package/data/packages/spell.json +0 -126
- package/data/packages/stage.json +0 -26
- package/data/packages/tabula.json +0 -39
- package/data/packages/tandem.json +0 -31
- package/data/packages/tavern.json +0 -34
- package/data/packages/tempo.json +0 -68
- package/data/packages/vault.json +0 -81
- package/data/packages/ward.json +0 -77
- package/data/packages/wayfinder.json +0 -126
- package/data/packages/wire.json +0 -51
- package/data/refine.json +0 -17277
- package/dist/consumer.d.ts +0 -17
- package/dist/consumer.js +0 -114
- package/dist/consumer.js.map +0 -1
- package/dist/port.d.ts +0 -2
- package/dist/port.js +0 -12
- package/dist/port.js.map +0 -1
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"apiSource": "// Public root surface of @vielzeug/patchwork. Every public export goes through this file.\nexport { PatchError, PatchPathError, PatchTestError } from './errors';\nexport { apply, diff, formatPointer, getIn, parsePointer, tryApply } from './patch';\nexport type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';\n",
|
|
3
|
-
"docs": {
|
|
4
|
-
"index": "---\ntitle: 'Patchwork: RFC 6902 JSON Patch'\ndescription: 'RFC 6902 JSON Patch: structural diff, immutable apply, and guarded tryApply for sync protocols.'\npackage: patchwork\ncategory: utilities\nkeywords: [json-patch, rfc-6902, rfc-6901, json-pointer, diff, patch, sync, collaboration, immutable]\nexports: [apply, tryApply, diff, getIn, parsePointer, formatPointer]\nrelated: [tandem, forge, vault]\nenvironments: [browser, node]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"patchwork\" />\n\n## Why Patchwork?\n\nOnce two places hold the same document, sending the whole document is the lazy answer that\nscales worst: bandwidth grows with document size, not with what changed, and blind writes\nclobber concurrent edits. JSON Patch is the wire format for the honest answer, and Patchwork\nimplements it with the two properties sync code actually needs: `apply` is **immutable with\nstructural sharing** (untouched subtrees keep their object identity, so React and every memo\nlayer work for free), and `diff` is **structural** (objects diff field-by-field, append-only\narrays stay one operation, and inserts land at exactly the right index).\n\n```ts\nimport { apply, diff } from '@vielzeug/patchwork';\n\nconst patch = diff(before, after); // [{ op: 'replace', path: '/user/address/zip', value: '1010' }]\nconst next = apply(before, patch); // before untouched; next.user.address is new, next.user.orders === before.user.orders\n```\n\nA failed `test` operation is an ordinary answer in protocol code, not an exception:\n`tryApply` returns `{ ok: false, error: { index, path, reason } }`, so conflict handling is\ndata you can log and reply to. Zero runtime dependencies, spec-exact pointers (`~0`/`~1`\nescaping, `-` append), and a browser-safe build.\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/patchwork\n```\n\n```sh [npm]\nnpm install @vielzeug/patchwork\n```\n\n```sh [yarn]\nyarn add @vielzeug/patchwork\n```\n\n:::\n\n## Quick Start\n\n```ts\nimport { apply, diff, tryApply } from '@vielzeug/patchwork';\n\nconst doc = { items: ['a'], title: 'Cart' };\nconst patch = diff(doc, { items: ['a', 'b'], title: 'Wagen' });\n// [{ op: 'add', path: '/items/-', value: 'b' }, { op: 'replace', path: '/title', value: 'Wagen' }]\n\nconst next = apply(doc, patch); // doc untouched; next.title changed, next.items is a new array (it grew)\n\ntryApply(doc, [{ op: 'test', path: '/title', value: 'Other' }, ...patch]);\n// { ok: false, error: { index: 0, reason: 'test', path: '/title', message: … } }\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- **`apply`**: immutable RFC 6902 — all six operations, copy-on-write with structural sharing.\n- **`tryApply`**: the same engine as data; a failed `test` or bad pointer returns a structured rejection with the failing operation index.\n- **`diff`**: per-field object patches, prefix/suffix-aligned arrays (appends, prepends, and middle inserts cost a single `add`), pointer-escaped keys.\n- **Pointer API**: `parsePointer`/`formatPointer` with `~0`/`~1` escaping and `getIn` for reads.\n- **Spec-exact edges**: `null` is a value not an absence, `replace` requires an existing target, array `add` inserts, `-` appends.\n- **Input isolation**: `add`/`copy` values are cloned in, so the caller's objects can never mutate a document afterwards.\n- **Hard JSON domain**: numbers, strings, booleans, null, arrays, objects — no functions, no prototypes, nothing to inherit.\n- **`@vielzeug/patchwork/merge`**: opt-in three-way merge — field-level reconciliation of diverged copies with `conflicts` as data.\n\n</div>\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Tandem](/tandem/): transports patches over the wire in sync protocols.\n- [Forge](/forge/): tracks the dirty fields whose changes become patches.\n- [Vault](/vault/): schemas that define what a patchable document may contain.\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
|
-
"api": "---\ntitle: 'Patchwork: API Reference'\ndescription: 'Public API of @vielzeug/patchwork: apply, tryApply, diff, pointer helpers, types, and errors.'\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution | Common gotcha |\n| --------------- | ------------------------------------------------------ | --------- | -------------------------------------------------------------- |\n| `apply` | Immutable RFC 6902 application with structural sharing | Sync | Throws on unresolvable pointer or failed `test` |\n| `tryApply` | Same engine, rejection as data | Sync | `error.index` is the failing operation, not the document size |\n| `diff` | Structural patch from `from` to `to` | Sync | Patch values reference `to`; clone if `to` keeps mutating |\n| `getIn` | Pointer read | Sync | Returns `undefined` both for missing and for non-JSON descents |\n| `parsePointer` | Pointer → decoded tokens | Sync | Throws `PatchPathError` on pointers not starting with `/` |\n| `formatPointer` | Tokens → pointer | Sync | `[]` formats to `''` (the whole document) |\n\n## Package Entry Point\n\n```ts\nimport { apply, diff, getIn, parsePointer, tryApply } from '@vielzeug/patchwork';\nimport { merge } from '@vielzeug/patchwork/merge'; // three-way merge subpath\n```\n\n## Functions\n\n### apply\n\n```ts\nfunction apply<T extends JsonValue>(doc: T, patch: JsonPatch): T;\n```\n\nApplies every operation in order, copy-on-write: untouched subtrees keep their identity, and\na fully no-op patch returns `doc` itself. `add` inserts into arrays (index may equal the\nlength), sets/overwrites object members, and supports `-` append; `remove` and `replace`\nrequire the target to exist; `move` removes the `from` location then adds at `path`; `copy`\nadds a `structuredClone`; `test` compares structurally. Values from `add`/`copy` are cloned\ninto the document.\n\nThrows `PatchPathError` when a pointer does not resolve or an index is out of bounds, and\n`PatchTestError` when a `test` operation does not match.\n\n### tryApply\n\n```ts\nfunction tryApply(doc: JsonValue, patch: JsonPatch): ApplyResult;\n```\n\nNever throws for patch failures: returns `{ ok: true, doc }` or\n`{ ok: false, error: { index, path, reason: 'path' | 'test', message } }`, where `path` is the\nexact pointer that failed — for `move`/`copy`, whichever side (source or target) was bad.\n\n### diff\n\n```ts\nfunction diff(from: JsonValue, to: JsonValue): JsonPatch;\n```\n\nComputes a patch that turns `from` into `to`. Objects diff per key; arrays align on their\ncommon prefix and suffix, recurse positionally through the middle, and emit ordered removals\nand indexed inserts around it (`-` only for true appends); anything else becomes one\n`replace` at the deepest shared pointer. The result always round-trips\n(`apply(from, diff(from, to))` deep-equals `to`) — verified by a seeded round-trip test.\n\n### getIn / parsePointer / formatPointer\n\n```ts\nfunction getIn(doc: JsonValue, pointer: JsonPointer): JsonValue | undefined;\nfunction parsePointer(pointer: JsonPointer): string[];\nfunction formatPointer(tokens: readonly string[]): JsonPointer;\n```\n\nRFC 6901 throughout: `~1` decodes to `/`, `~0` to `~`; the empty pointer is the whole\ndocument. `parsePointer('x')` throws — pointers start with `/` or are empty.\n\n### merge (subpath `@vielzeug/patchwork/merge`)\n\n```ts\nfunction merge(base: JsonValue, local: JsonValue, remote: JsonValue, options?: MergeOptions): MergeResult;\n```\n\nReconciles two diverged copies of `base` field-by-field. Returns `{ doc, conflicts }`:\n`doc` applies both sides where they do not collide, and `conflicts` lists every location\nwhere both sides changed the base differently (`{ base, local, path, remote }`, with\n`undefined` marking a deleted or never-present side). `options.resolution` picks the winner\n(`'remote'` default; `'local'` available) — conflicts are reported either way. Arrays: pure\nappends concatenate (local first), pure truncations take the shorter, anything else\nconflicts as a whole array. Types `MergeConflict`, `MergeOptions`, and `MergeResult` are\nexported from the subpath.\n\n## Types\n\n| Type | Purpose |\n| ---------------- | --------------------------------------------------------------- |\n| `JsonValue` | The JSON domain: null, boolean, number, string, arrays, objects |\n| `JsonObject` | `{ [key: string]: JsonValue }` |\n| `JsonPointer` | A string RFC 6901 pointer |\n| `PatchOperation` | Union of the six RFC 6902 operations |\n| `JsonPatch` | `readonly PatchOperation[]` |\n| `ApplyResult` | `{ ok: true, doc } \\| { ok: false, error: PatchErrorInfo }` |\n| `PatchErrorInfo` | `{ index, path, reason: 'path' \\| 'test', message }` |\n\nIndividual operation types (`AddOperation`, `RemoveOperation`, `ReplaceOperation`,\n`MoveOperation`, `CopyOperation`, `TestOperation`) are exported for building typed patch\nbuilders.\n\n## Errors\n\n| Error | Thrown when |\n| ---------------- | ----------------------------------------------------------------------------------------------------------------------------- |\n| `PatchError` | Base class for every patchwork error |\n| `PatchPathError` | A pointer does not resolve, an index is out of bounds, or a pointer is malformed; `error.pointer` names the offending pointer |\n| `PatchTestError` | A `test` operation did not match the document |\n",
|
|
6
|
-
"usage": "---\ntitle: 'Patchwork: Usage Guide'\ndescription: 'How to use @vielzeug/patchwork: applying patches, conflicts with tryApply, structural diff, pointers, and the JSON domain.'\n---\n\n[[toc]]\n\n## Basic Usage\n\nA patch is just an array of operations — build them by hand or compute them with `diff`, then\napply them immutably:\n\n```ts\nimport { apply, diff } from '@vielzeug/patchwork';\n\nconst cart = { items: [{ qty: 1, sku: 'a' }], meta: { rev: 7 }, total: '99' };\nconst edited = { items: [{ qty: 3, sku: 'a' }], meta: { rev: 8 }, total: '99' };\n\nconst patch = diff(cart, edited);\n// [{ op: 'replace', path: '/items/0/qty', value: 3 }, { op: 'replace', path: '/meta/rev', value: 8 }]\n\nconst next = apply(cart, patch);\nnext !== cart; // a new document\nnext.total === cart.total; // untouched subtrees keep their identity, so memoized\nnext.items !== cart.items; // selectors recompute only over the branches that changed\n```\n\n`apply` returns the same reference when a patch is a no-op (`[]`, or a `replace` with an\nequal value), so `Object.is(before, after)` is a reliable \"did anything change\" check.\n\n## Reading and Pointers\n\n```ts\nimport { formatPointer, getIn, parsePointer } from '@vielzeug/patchwork';\n\ngetIn(cart, '/items/0/sku'); // 'a'\ngetIn(cart, '/items/9'); // undefined — reads never throw\nparsePointer('/a~1b/c~0d'); // ['a/b', 'c~d']\nformatPointer(['a/b', 'c~d']); // '/a~1b/c~0d'\n```\n\n`null` is a value, not an absence: `getIn({ a: null }, '/a')` is `null`, while\n`getIn({ a: null }, '/b')` is `undefined`.\n\n## Conflicts as Data\n\nIn collaborative code a rejected patch is a normal message, not a crash. `apply` throws\n(`PatchPathError` for unresolvable pointers, `PatchTestError` for failed `test` operations);\n`tryApply` returns the same outcome as data:\n\n```ts\nimport { tryApply } from '@vielzeug/patchwork';\n\nconst result = tryApply(doc, [\n { op: 'test', path: '/rev', value: 41 }, // client last saw rev 41\n { op: 'replace', path: '/title', value: 'New' },\n]);\n\nif (!result.ok) {\n // { index: 0, path: '/rev', reason: 'test', message: … } — reply \"conflict, rebase on rev 42\"\n}\n```\n\nGuarding a write with a leading `test` is the whole optimistic-concurrency protocol: the\nserver `tryApply`s, and a failed test means someone else moved first.\n\n## What diff Emits\n\n- **Objects**: per-key `remove`s, `add`s, and recursive descent — changed fields cost one small operation each, regardless of document size.\n- **Arrays**: the common prefix and suffix are aligned and the middle walked positionally; appends become a single `{ op: 'add', path: '/x/-' }`, prepends and middle inserts a single indexed `add`, and surplus entries become ordered index removes.\n- **Different types or root changes**: one `replace` at the shared ancestor — patches stay short and always apply cleanly.\n\n`diff` optimizes for apply-safety and small steady-state payloads (edit-one-field,\nappend-one-row), which is exactly the traffic of form autosaves, live documents, and audit\ntrails. It is not an attempt at minimal-edit-count: reordering an array yields positional\nreplaces, which are correct, just not clever.\n\n## Three-Way Merge (Subpath)\n\nWhen two copies of a document diverge from a common ancestor, `@vielzeug/patchwork/merge`\nreconciles them field-by-field instead of one side overwriting the other:\n\n```ts\nimport { merge } from '@vielzeug/patchwork/merge';\n\nconst base = { price: 10, title: 'Doc', tags: ['a'] };\nconst local = { price: 10, title: 'My edit', tags: ['a', 'mine'] };\nconst remote = { price: 12, title: 'Doc', tags: ['a', 'theirs'] };\n\nconst { doc, conflicts } = merge(base, local, remote);\n// doc: { price: 12, title: 'My edit', tags: ['a', 'mine', 'theirs'] }\n// conflicts: [] — only same-field collisions conflict\n```\n\nThe policy is deliberately conservative: objects merge key-by-key to any depth, a delete\nbeats an untouched copy, both sides only appending an array concatenates (local first), and\nboth sides only truncating takes the shorter result. Anything else — a mid-list array edit,\nan append versus a truncate, different additions to the same key — is reported in\n`conflicts` and resolved by `options.resolution` (`'remote'` default, `'local'` opt-in),\nnever guessed. Ship the merged doc back to either side as an ordinary patch with\n`diff(side, doc)`.\n\nThis module is policy, not RFC 6902: the core entry point stays spec-only on purpose.\n\n## The JSON Domain\n\nDocuments are JSON: `null`, booleans, numbers, strings, arrays, and plain objects. `apply`\nclones every incoming `add`/`copy` value (`structuredClone`), so objects you built the patch\nfrom can be mutated freely afterwards without touching the document. `diff` treats the two\ndocuments read-only and never clones what it returns — `value`s in the patch point into `to`,\nso freeze `to` (or clone the patch) if you intend to keep mutating it.\n\n## Error Handling\n\nAll errors extend `PatchError`. `apply` throws at the first failing operation and leaves\nnothing behind (it builds the next document copy-on-write, so a throw discards it).\n`PatchErrorInfo.path` names the pointer the failing operation targeted — for `move`/`copy`\nthat is the `from` location when the source was missing.\n\n## Best Practices\n\n- Use `tryApply` at network boundaries and `apply` in pure local code — exceptions are for programmer errors, rejections are for protocol answers.\n- Prefix state-changing patches with a `{ op: 'test', path: '/rev', … }` operation instead of shipping whole documents; the patch is the lock.\n- Keep patches in your logs as data (they are JSON): replaying `apply` over an old snapshot reconstructs exactly what was sent.\n- Do not feed non-JSON values (functions, `undefined`, `Date`) through `apply`; validate documents with [Vault](/vault/) schemas at the edge and the domain stays clean.\n- In a sync engine, merge on the server with `{ resolution: 'remote' }` and show the `conflicts` array to the user — silent wins are how sync tools lose trust.\n",
|
|
7
|
-
"examples": "---\ntitle: 'Patchwork: Examples'\ndescription: Practical examples and recipes for @vielzeug/patchwork.\n---\n\n## Examples\n\n- [Diff and Apply](./examples/diff-and-apply.md)\n- [Optimistic Sync with test Operations](./examples/optimistic-sync.md)\n"
|
|
8
|
-
},
|
|
9
|
-
"examples": [
|
|
10
|
-
{
|
|
11
|
-
"id": "apply-basic",
|
|
12
|
-
"code": "import { apply, getIn, tryApply } from '@vielzeug/patchwork'\n\nconst doc = { items: ['a'], title: 'Cart' }\nconst next = apply(doc, [\n { op: 'replace', path: '/title', value: 'Wagen' },\n { op: 'add', path: '/items/-', value: 'b' },\n])\nconsole.log(JSON.stringify(next))\nconsole.log(getIn(next, '/items/1'))\n\nconst rejected = tryApply(doc, [{ op: 'test', path: '/title', value: 'Other' }])\nconsole.log(JSON.stringify(rejected))",
|
|
13
|
-
"name": "Apply - Immutable patches and guarded test"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"id": "diff-basic",
|
|
17
|
-
"code": "import { apply, diff } from '@vielzeug/patchwork'\n\nconst before = { address: { zip: '1010' }, items: ['a'], rev: 1 }\nconst after = { address: { zip: '1020' }, items: ['a', 'b'], rev: 2 }\n\nconst patch = diff(before, after)\nconsole.log(JSON.stringify(patch))\nconsole.log(JSON.stringify(apply(before, patch)))",
|
|
18
|
-
"name": "Diff - Structural patches"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"id": "merge-basic",
|
|
22
|
-
"code": "import { diff, apply } from '@vielzeug/patchwork'\nimport { merge } from '@vielzeug/patchwork/merge'\n\nconst base = { price: 10, title: 'Doc', tags: ['a'] }\nconst local = { price: 10, title: 'My edit', tags: ['a', 'mine'] }\nconst remote = { price: 12, title: 'Doc', tags: ['a', 'theirs'] }\n\nconst { doc, conflicts } = merge(base, local, remote)\nconsole.log(JSON.stringify(doc))\nconsole.log(conflicts.length)\nconsole.log(JSON.stringify(apply(local, diff(local, doc))))",
|
|
23
|
-
"name": "Merge - Three-way field-level reconciliation"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"id": "pointers-basic",
|
|
27
|
-
"code": "import { getIn, parsePointer, formatPointer } from '@vielzeug/patchwork'\n\nconst doc = { inventory: { 'iron/sword': { qty: 2 }, '~rare~': true } }\n\n// Read through a pointer without walking the object yourself\nconsole.log(getIn(doc, '/inventory/iron~1sword/qty'))\nconsole.log(getIn(doc, '/inventory/~0rare~0'))\nconsole.log(getIn(doc, '/inventory/missing'))\n\n// Pointers are data: split, transform, re-join\nconst tokens = parsePointer('/inventory/iron~1sword/qty')\nconsole.log(tokens.join(' -> '))\n\ntokens[1] = 'iron~1axe'\nconsole.log(formatPointer(tokens))",
|
|
28
|
-
"name": "getIn - JSON Pointer Round-Trips"
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
"typeSignatures": {
|
|
32
|
-
"PatchError": "export { PatchError, PatchPathError, PatchTestError } from './errors';",
|
|
33
|
-
"PatchPathError": "export { PatchError, PatchPathError, PatchTestError } from './errors';",
|
|
34
|
-
"PatchTestError": "export { PatchError, PatchPathError, PatchTestError } from './errors';",
|
|
35
|
-
"apply": "export { apply, diff, formatPointer, getIn, parsePointer, tryApply } from './patch';",
|
|
36
|
-
"diff": "export { apply, diff, formatPointer, getIn, parsePointer, tryApply } from './patch';",
|
|
37
|
-
"formatPointer": "export { apply, diff, formatPointer, getIn, parsePointer, tryApply } from './patch';",
|
|
38
|
-
"getIn": "export { apply, diff, formatPointer, getIn, parsePointer, tryApply } from './patch';",
|
|
39
|
-
"parsePointer": "export { apply, diff, formatPointer, getIn, parsePointer, tryApply } from './patch';",
|
|
40
|
-
"tryApply": "export { apply, diff, formatPointer, getIn, parsePointer, tryApply } from './patch';",
|
|
41
|
-
"AddOperation": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
42
|
-
"ApplyResult": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
43
|
-
"CopyOperation": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
44
|
-
"JsonObject": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
45
|
-
"JsonPatch": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
46
|
-
"JsonPointer": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
47
|
-
"JsonValue": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
48
|
-
"MoveOperation": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
49
|
-
"PatchErrorInfo": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
50
|
-
"PatchOperation": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
51
|
-
"RemoveOperation": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
52
|
-
"ReplaceOperation": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';",
|
|
53
|
-
"TestOperation": "export type {\n AddOperation,\n ApplyResult,\n CopyOperation,\n JsonObject,\n JsonPatch,\n JsonPointer,\n JsonValue,\n MoveOperation,\n PatchErrorInfo,\n PatchOperation,\n RemoveOperation,\n ReplaceOperation,\n TestOperation,\n} from './types';"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"apiSource": "export { defineJob } from './definitions.ts';\nexport { PostmasterDisposedError, PostmasterError, PostmasterJobError } from './errors.ts';\nexport { createPostmaster } from './postmaster.ts';\nexport type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';\n",
|
|
3
|
-
"docs": {
|
|
4
|
-
"index": "---\ntitle: 'Postmaster: Durable job outbox'\ndescription: Typed durable job outbox with leased processing, retries, and dead-letter recovery for browser applications.\npackage: postmaster\ncategory: Async\nkeywords: [durable, outbox, jobs, retry, dead-letter, idempotency, indexeddb, lease]\nrelated: [courier, vault, sentinel, familiar, ripple]\nexports:\n [\n createPostmaster,\n defineJob,\n createIndexedDbPostmasterStore,\n createMemoryPostmasterStore,\n PostmasterError,\n PostmasterDisposedError,\n PostmasterJobError,\n ]\nenvironments: [browser, node]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"postmaster\" />\n\n## Why Postmaster?\n\nApplication jobs that touch a remote service: posting a form, syncing state, sending analytics: must survive page reloads, resume later, retry according to an explicit policy, and retain terminal failures for recovery. Postmaster coordinates that delivery with typed job definitions, leased processing, and a dead-letter queue, all backed by IndexedDB.\n\n```ts\n// Before\nasync function createTodo(payload: { id: string; title: string }) {\n // Lost on reload. No retry. No recovery. Silent failure.\n await fetch('/api/todos', { method: 'POST', body: JSON.stringify(payload) });\n}\n\n// After\nimport { createPostmaster, defineJob } from '@vielzeug/postmaster';\nimport { createIndexedDbPostmasterStore } from '@vielzeug/postmaster/indexeddb';\nimport { s } from '@vielzeug/spell';\n\nconst jobs = {\n createTodo: defineJob({\n version: 1,\n validate: s.object({ id: s.string(), title: s.string() }),\n key: (p) => p.id,\n execute: async (payload, { key, signal }) => {\n await fetch('/api/todos', {\n method: 'POST',\n body: JSON.stringify(payload),\n headers: { 'Idempotency-Key': key },\n signal,\n });\n },\n }),\n};\n\nconst store = createIndexedDbPostmasterStore({ name: 'my-app-outbox' });\nconst postmaster = createPostmaster({ jobs, store });\n\nawait postmaster.enqueue('createTodo', { id: crypto.randomUUID(), title: 'Buy milk' });\npostmaster.start();\n```\n\n| Feature | Postmaster | Ad hoc outbox | Familiar |\n| --------------------------- | ------------------------------------------------ | -------------------------------------------- | ---------------------------------------------- |\n| Bundle size | <PackageInfo package=\"postmaster\" type=\"size\" /> | Application-defined | <PackageInfo package=\"familiar\" type=\"size\" /> |\n| Zero dependencies | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"check\" size=\"16\"></ore-icon> |\n| Survives page reload | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n| Leased cross-tab processing | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n| Dead-letter recovery | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n| Typed job payloads | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> | <ore-icon name=\"check\" size=\"16\"></ore-icon> |\n\n<div class=\"decision-callout\">\n\n**Use Postmaster when** application jobs must survive reloads, retry explicitly, and remain recoverable after terminal failure.\n\n**Consider Familiar when** jobs are CPU-bound, in-memory only, and never need to survive a page reload.\n\n</div>\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/postmaster\n```\n\n```sh [npm]\nnpm install @vielzeug/postmaster\n```\n\n```sh [yarn]\nyarn add @vielzeug/postmaster\n```\n\n:::\n\nFor browser persistence, also install `@vielzeug/vault` (a workspace peer of the IndexedDB adapter):\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/postmaster @vielzeug/vault\n```\n\n```sh [npm]\nnpm install @vielzeug/postmaster @vielzeug/vault\n```\n\n```sh [yarn]\nyarn add @vielzeug/postmaster @vielzeug/vault\n```\n\n:::\n\n## Quick Start\n\nDefine typed jobs, create a durable store, enqueue work, and start the processor. Dispose both the processor and the store when the page lifetime ends.\n\n```ts\nimport { createPostmaster, defineJob } from '@vielzeug/postmaster';\nimport { createIndexedDbPostmasterStore } from '@vielzeug/postmaster/indexeddb';\n\nconst jobs = {\n createTodo: defineJob({\n version: 1,\n validate: (v: unknown) => v as { id: string; title: string },\n key: (p) => p.id,\n execute: async (payload, { key, signal }) => {\n await fetch('/api/todos', {\n method: 'POST',\n body: JSON.stringify(payload),\n headers: { 'Idempotency-Key': key },\n signal,\n });\n },\n retry: { maxAttempts: 5, shouldRetry: () => true },\n }),\n};\n\nconst store = createIndexedDbPostmasterStore({ name: 'my-app-outbox' });\nconst postmaster = createPostmaster({ jobs, store });\n\nawait postmaster.enqueue('createTodo', { id: crypto.randomUUID(), title: 'Buy milk' });\npostmaster.start();\n\n// On page unload:\nawait postmaster.dispose();\nawait store.dispose();\n```\n\n<div class=\"features-grid\">\n\n## Features\n\n- `defineJob()`: Types one job definition; the payload type comes from the validator (or an explicit `defineJob<T>`) and flows into `execute`, `key`, and `enqueue`.\n- `createPostmaster()`: Processor with leased claims, heartbeat renewal, and crash recovery.\n- `enqueue()`: Persist a job and wake the processor, with optional delayed eligibility via `availableAt`.\n- `flush()`: Process every available job until the queue is empty.\n- `retry()` / `remove()`: Recover or discard dead-letter jobs.\n- `tap()`: Typed runtime events for enqueued, started, completed, retry-scheduled, dead-lettered, removed, lease-lost, and processor-error.\n- `createIndexedDbPostmasterStore()`: Durable browser store backed by Vault IndexedDB.\n- `createMemoryPostmasterStore()`: Deterministic in-memory store for tests.\n\n</div>\n\n<div class=\"doc-links\">\n\n## Documentation\n\n- [**Usage Guide**](./usage.md)\n- [**API Reference**](./api.md)\n- [**Examples**](./examples.md)\n- [**3.0 Migration Guide**](./migration.md)\n\n</div>\n\n<div class=\"see-also\">\n\n## See Also\n\n- [@vielzeug/courier](../courier/): Perform the HTTP requests Postmaster jobs coordinate.\n- [@vielzeug/sourcerer](../sourcerer/): Reload paginated collection state after durable jobs complete.\n- [@vielzeug/vault](../vault/): IndexedDB storage primitive backing the durable store.\n- [@vielzeug/sentinel](../sentinel/): Flush the outbox when the network returns.\n- [@vielzeug/familiar](../familiar/): In-memory Web Worker pool for CPU-bound tasks.\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
|
-
"api": "---\ntitle: 'Postmaster: API Reference'\ndescription: Job definitions, processor, store contracts, events, errors, and entry points for Postmaster.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution mode | Common gotcha |\n| ---------------------------------- | -------------------------------------- | -------------- | ---------------------------------------------------------------------- |\n| `defineJob()` | Types one job definition | Sync | Configuration is validated by `createPostmaster()` |\n| `createPostmaster()` | Processor with leased claims and retry | Sync | Store is borrowed, not disposed with the processor |\n| `createIndexedDbPostmasterStore()` | Durable browser store | Sync | Skips corrupt records and reports each issue through `onCorruptRecord` |\n| `createMemoryPostmasterStore()` | Deterministic in-memory store | Sync | Use for tests only |\n| `PostmasterError` | Base class for package errors | Sync | Catch a subtype when recovery is specific |\n\n## Package Entry Point\n\n| Import | Purpose |\n| -------------------------------- | ------------------------------------------------------------------- |\n| `@vielzeug/postmaster` | Job definitions, processor, events, errors |\n| `@vielzeug/postmaster/store` | Store-author interfaces (`StoredJob`, `StoreTx`, `PostmasterStore`) |\n| `@vielzeug/postmaster/indexeddb` | Durable browser store backed by Vault IndexedDB |\n| `@vielzeug/postmaster/testing` | Deterministic in-memory store and test helpers |\n\n## Factories\n\n### `defineJob()`\n\n```ts\nfunction defineJob<T>(spec: JobDefinition<T>): JobDefinition<T>;\n```\n\nTypes a single job definition. The payload type comes from `validate` when TypeScript can read it without context: a named validator, a `{ parse(value) }` validator object such as a Spell schema, or an inline arrow with an annotated `unknown` parameter (an annotated `execute` payload works the same way). Otherwise pass the type argument (`defineJob<Todo>({ ... })`) to stay independent of property order; with neither, payloads stay `unknown`. `createPostmaster()` validates every registered definition (versions, `execute`/`key`, retry `maxAttempts`, migration ranges) when it is constructed.\n\n| Parameter | Type | Description |\n| --------- | ------------------ | --------------------------------- |\n| `spec` | `JobDefinition<T>` | Definition with contextual typing |\n\n**Returns:** the same definition, typed for payload inference.\n\n**Example**\n\n```ts\nimport { defineJob } from '@vielzeug/postmaster';\n\nconst jobs = {\n createTodo: defineJob({\n version: 1,\n validate: (v: unknown) => v as { id: string; title: string },\n key: (p) => p.id,\n execute: async (payload, { key, signal }) => {\n await fetch('/api/todos', {\n method: 'POST',\n body: JSON.stringify(payload),\n headers: { 'Idempotency-Key': key },\n signal,\n });\n },\n }),\n};\n```\n\n---\n\n### `createPostmaster()`\n\n```ts\nfunction createPostmaster<J extends JobDefinitions>(options: CreatePostmasterOptions<J>): Postmaster<J>;\n```\n\nReturns a Postmaster processor that claims, executes, retries, and dead-letters jobs from the borrowed store.\n\n| Parameter | Type | Description |\n| ----------------------- | ----------------- | -------------------------------------------------- |\n| `options.jobs` | `J` | Map of job name to `defineJob()` definition |\n| `options.store` | `PostmasterStore` | Borrowed store; not disposed with the processor |\n| `options.leaseDuration` | `number` | Lease duration in ms (default 30000, minimum 1000) |\n| `options.clock` | `() => number` | Deterministic clock for tests (default `Date.now`) |\n| `options.signal` | `AbortSignal` | External signal that disposes the processor |\n\n**Returns:** `Postmaster<J>`.\n\n**Example**\n\n```ts\nimport { createPostmaster } from '@vielzeug/postmaster';\nimport { createIndexedDbPostmasterStore } from '@vielzeug/postmaster/indexeddb';\n\nconst store = createIndexedDbPostmasterStore({ name: 'outbox' });\nconst postmaster = createPostmaster({ jobs, store });\n\npostmaster.start();\nawait postmaster.dispose();\nawait store.dispose();\n```\n\n---\n\n### `createIndexedDbPostmasterStore()`\n\n```ts\nfunction createIndexedDbPostmasterStore(options: IndexedDbPostmasterStoreOptions): PostmasterStore;\n```\n\nReturns a durable Postmaster store backed by Vault IndexedDB. Uses one internal `jobs` table keyed by id; all operations run inside Vault transactions. Persisted records are validated before use; invalid records are skipped so they cannot block valid work.\n\n| Parameter | Type | Description |\n| ------------------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------- |\n| `options.name` | `string` | IndexedDB database name |\n| `options.onCorruptRecord` | `(record: CorruptStoredJob) => void` | Optional diagnostic called once for each distinct invalid-record issue; handler errors are ignored |\n\n**Returns:** `PostmasterStore`.\n\n**Example**\n\n```ts\nimport { createIndexedDbPostmasterStore } from '@vielzeug/postmaster/indexeddb';\n\nconst store = createIndexedDbPostmasterStore({\n name: 'my-app-outbox',\n onCorruptRecord: ({ id, reason }) => console.error('corrupt outbox record', id, reason),\n});\nawait store.dispose();\n```\n\n---\n\n### `createMemoryPostmasterStore()`\n\n```ts\nfunction createMemoryPostmasterStore(entries?: readonly StoredJob[]): PostmasterStore;\n```\n\nReturns a deterministic in-memory store for tests. Serializes all operations through a promise chain.\n\n| Parameter | Type | Description |\n| --------- | ---------------------- | ------------------------------- |\n| `entries` | `readonly StoredJob[]` | Initial records (default empty) |\n\n**Returns:** `PostmasterStore`.\n\n**Example**\n\n```ts\nimport { createMemoryPostmasterStore } from '@vielzeug/postmaster/testing';\n\nconst store = createMemoryPostmasterStore();\nawait store.dispose();\n```\n\n## Postmaster Methods\n\n### `enqueue()`\n\n```ts\nenqueue<K extends keyof J & string>(\n name: K,\n payload: InferJobPayload<J[K]>,\n options?: EnqueueOptions,\n): Promise<PostmasterEntry>;\n```\n\nValidates the payload (if `validate` is defined), derives the key, persists the job, and wakes the processor. Throws `PostmasterError` for an empty key, non-JSON-serializable payload, or invalid `availableAt`.\n\n| Parameter | Type | Description |\n| --------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |\n| `name` | `K` | Registered job name |\n| `payload` | `InferJobPayload<J[K]>` | Job payload (validated if `validate` is defined) |\n| `options.availableAt` | `number` | Earliest epoch timestamp (ms) the job may be claimed. Defaults to the Postmaster clock. Must be a finite non-negative safe integer. |\n\n**Delayed eligibility.** The job persists immediately but cannot be claimed before `availableAt`. Postmaster does not guarantee execution at that time: only that the job will not be claimed earlier. A live processor (`start()` or `flush()`) is required for execution. Past timestamps remain immediately eligible.\n\n**Example**\n\n```ts\nawait postmaster.enqueue('sendDigest', { userId }, { availableAt: Date.now() + 60_000 });\n```\n\n---\n\n### `start()`\n\n```ts\nstart(): void;\n```\n\nBegins background processing. Idempotent: returns immediately and kicks off the pump in the background. Use `flush()` when you need to await completion of all available work.\n\n---\n\n### `flush()`\n\n```ts\nflush(options?: { signal?: AbortSignal }): Promise<FlushResult>;\n```\n\nProcesses every available job until the queue is empty or the signal aborts. Concurrent `flush()` calls join the same drain. Returns counts of processed, completed, dead-lettered, and retry-scheduled jobs.\n\n---\n\n### `list()`\n\n```ts\nlist(filter?: EntryFilter): Promise<PostmasterEntry[]>;\n```\n\nReturns entries ordered by `createdAt`. Filter by `status` optionally.\n\n---\n\n### `stats()`\n\n```ts\nstats(): Promise<PostmasterStats>;\n```\n\nReturns counts of queued, running, and dead-letter jobs.\n\n---\n\n### `retry()`\n\n```ts\nrequeue(id: string): Promise<RequeueResult>;\n```\n\nMoves a dead-letter job back to queued. Returns a discriminated result: `requeued`, `not-found`, `not-dead-letter`, or `running`.\n\n---\n\n### `remove()`\n\n```ts\nremove(id: string): Promise<RemoveResult>;\n```\n\nDeletes a queued or dead-letter job. Returns a discriminated result: `removed`, `not-found`, or `running`.\n\n---\n\n### `tap()`\n\n```ts\ntap(handler: (event: PostmasterEvent) => void, options?: { signal?: AbortSignal }): () => void;\n```\n\nObserve runtime events (enqueued, started, completed, retry-scheduled, dead-lettered, removed, lease-lost, processor-error, dispose). Handler errors are swallowed: observability never affects processing. Returns an unsubscribe function. Pass `{ signal }` to auto-detach on abort.\n\n---\n\n### `dispose()`\n\n```ts\ndispose(): Promise<void>;\n[Symbol.asyncDispose](): Promise<void>;\n```\n\nAborts owned work, releases all active leases, and tears down subscriptions. Idempotent. Does not dispose the borrowed store.\n\n## Types\n\n### `EnqueueOptions`\n\n```ts\ninterface EnqueueOptions {\n readonly availableAt?: number;\n}\n```\n\nOptions for `enqueue()`. `availableAt` is the earliest epoch timestamp (ms) at which the job may be claimed. Defaults to the Postmaster clock at enqueue time. Past timestamps remain immediately eligible. Postmaster does not guarantee execution at the requested time: only that the job will not be claimed before it. A live processor is required for execution.\n\n---\n\n### `JobDefinition<T>`\n\n```ts\ninterface JobDefinition<T> {\n readonly version: number;\n readonly validate?: Validate<T>;\n readonly key: (payload: T) => string;\n readonly execute: (payload: T, context: JobContext) => Promise<void>;\n readonly retry?: RetryPolicy;\n readonly migrate?: VersionMigrations;\n}\n```\n\n`validate` is optional. Accepts a function `(value: unknown) => T` or any structural parser with `parse(value: unknown): T` (Spell schemas, Zod schemas, etc). Called once at enqueue. If omitted, payload trusted as-is.\n\n`migrate` declares contiguous version-step migrations keyed by the source version. Key `n` transforms a payload from version `n` to `n + 1`. The lowest key is the earliest supported stored version, and the highest key must lead into the current version. Omit `migrate` when only the current version is supported. Unsupported versions, thrown steps, and `undefined` migration output move the record to dead-letter.\n\n---\n\n### `Validate<T>`\n\n```ts\ntype Validate<T> = ((value: unknown) => T) | { parse(value: unknown): T };\n```\n\nAccepts either a plain validation function or any object with a `parse(value: unknown): T` method. Spell's `Schema` and `s.object(...)` satisfy this contract directly: no adapter needed.\n\n---\n\n### `VersionMigrations`\n\n```ts\ntype VersionMigrations = { readonly [fromVersion: number]: (payload: unknown) => unknown };\n```\n\nContiguous version-step migrations keyed by the source version. Key `n` transforms a payload from version `n` to `n + 1`. The lowest key declares the earliest supported stored version. The range must have no gaps and must end at the step entering the current job version.\n\n---\n\n### `IndexedDbPostmasterStoreOptions`\n\nAvailable from `@vielzeug/postmaster/indexeddb`.\n\n```ts\ntype IndexedDbPostmasterStoreOptions = {\n readonly name: string;\n readonly onCorruptRecord?: (record: CorruptStoredJob) => void;\n};\n```\n\n---\n\n### `CorruptStoredJob`\n\nAvailable from `@vielzeug/postmaster/indexeddb`.\n\n```ts\ninterface CorruptStoredJob {\n readonly id?: string;\n readonly reason: string;\n}\n```\n\n`id` is omitted when the malformed value contains no usable record identifier.\n\n---\n\n### `JobContext`\n\n```ts\ninterface JobContext {\n readonly attempt: number;\n readonly entryId: string;\n readonly key: string;\n readonly signal: AbortSignal;\n}\n```\n\n---\n\n### `RetryPolicy`\n\n```ts\ninterface RetryPolicy {\n readonly maxAttempts: number;\n readonly shouldRetry?: (error: unknown, attempt: number) => boolean;\n readonly delay?: (attempt: number) => number;\n}\n```\n\n`maxAttempts` is total executions including the first. When `shouldRetry` is omitted, any error retries until `maxAttempts` is reached. Default delay uses an exponential backoff cap (`min(1000 × 2ⁿ, 30_000)` ms).\n\n---\n\n### `StoredJob`\n\nAvailable from `@vielzeug/postmaster/store`.\n\n```ts\ninterface StoredJob {\n readonly id: string;\n readonly name: string;\n readonly version: number;\n readonly payload: JsonValue;\n readonly key: string;\n readonly status: 'queued' | 'running' | 'dead-letter';\n readonly attempts: number;\n readonly createdAt: number;\n readonly updatedAt: number;\n readonly availableAt: number;\n readonly ownerId?: string;\n readonly leaseExpiresAt?: number;\n readonly failure?: StoredFailure;\n}\n```\n\n---\n\n### `StoredFailure`\n\n```ts\ninterface StoredFailure {\n readonly name: string;\n readonly message: string;\n readonly occurredAt: number;\n}\n```\n\nOnly a bounded error name/message/timestamp is persisted. Never persist arbitrary error objects, response bodies, headers, or stacks.\n\n---\n\n### `PostmasterEntry`\n\n```ts\ntype PostmasterEntry = Pick<\n StoredJob,\n 'attempts' | 'availableAt' | 'createdAt' | 'failure' | 'id' | 'key' | 'name' | 'status' | 'updatedAt' | 'version'\n>;\n```\n\nThe public entry view excludes `payload`, `ownerId`, and `leaseExpiresAt`.\n\n---\n\n### `PostmasterStore`\n\nAvailable from `@vielzeug/postmaster/store`.\n\n```ts\ninterface PostmasterStore {\n transact<T>(fn: (tx: StoreTx) => Promise<T>): Promise<T>;\n list(filter?: EntryFilter): Promise<StoredJob[]>;\n subscribe(listener: () => void): () => void;\n dispose(): Promise<void>;\n readonly disposed: boolean;\n readonly disposalSignal: AbortSignal;\n [Symbol.asyncDispose](): Promise<void>;\n}\n\ninterface StoreTx {\n get(id: string): Promise<StoredJob | undefined>;\n put(entry: StoredJob): Promise<void>;\n delete(id: string): Promise<void>;\n findClaimable(now: number): Promise<StoredJob | undefined>;\n findNextWake(now: number): Promise<number | undefined>;\n countByStatus(): Promise<PostmasterStats>;\n}\n```\n\nThe store exposes transactional primitives. The processor owns all ownership and transition logic: stores implement storage, not the job state machine. `transact` wraps all operations in an atomic transaction. `findClaimable` returns the earliest eligible job (queued with `availableAt <= now`, or running with expired lease). `findNextWake` returns the earliest future wake time across queued and running jobs.\n\n---\n\n### `PostmasterEvent`\n\n```ts\ntype PostmasterEvent =\n | {\n readonly type: 'enqueued' | 'started' | 'completed' | 'retry-scheduled' | 'dead-lettered';\n readonly entry: PostmasterEntry;\n }\n | { readonly type: 'removed' | 'lease-lost'; readonly id: string }\n | { readonly type: 'processor-error'; readonly error: Error }\n | { readonly type: 'dispose' };\n```\n\n---\n\n### `FlushResult`\n\n```ts\ninterface FlushResult {\n readonly processed: number;\n readonly completed: number;\n readonly deadLettered: number;\n readonly retryScheduled: number;\n}\n```\n\n---\n\n### `RequeueResult` / `RemoveResult`\n\n```ts\ntype RequeueResult =\n | { readonly status: 'not-found' | 'not-dead-letter' | 'running' }\n | { readonly status: 'requeued'; readonly entry: PostmasterEntry };\n\ntype RemoveResult = { readonly status: 'not-found' | 'running' } | { readonly status: 'removed'; readonly id: string };\n```\n\n## Errors\n\n### `PostmasterError`\n\n```ts\nclass PostmasterError extends Error {\n constructor(message: string, options?: ErrorOptions);\n}\n```\n\nBase class for package-defined errors. Use `instanceof PostmasterError` to narrow to the hierarchy. Covers configuration errors, serialization errors, and store failures.\n\n---\n\n### `PostmasterDisposedError`\n\n```ts\nclass PostmasterDisposedError extends PostmasterError {}\n```\n\nThrown when a public method is called after disposal.\n\n---\n\n### `PostmasterJobError`\n\n```ts\nclass PostmasterJobError extends PostmasterError {}\n```\n\nThrown when a job definition is missing, a version is incompatible, or a migration fails. These errors move the job to dead-letter rather than rejecting the public call.\n",
|
|
6
|
-
"usage": "---\ntitle: 'Postmaster: Usage Guide'\ndescription: Define durable jobs, process them with leases, retry failures, and recover dead-letter work.\n---\n\n[[toc]]\n\n## Basic Usage\n\nDefine typed jobs, create a durable store, enqueue work, and start the processor. Dispose both handles when the owner ends.\n\n```ts\nimport { createPostmaster, defineJob } from '@vielzeug/postmaster';\nimport { createIndexedDbPostmasterStore } from '@vielzeug/postmaster/indexeddb';\n\nconst jobs = {\n createTodo: defineJob({\n version: 1,\n validate: (v: unknown) => v as { id: string; title: string },\n key: (p) => p.id,\n execute: async (payload, { key, signal }) => {\n await fetch('/api/todos', {\n method: 'POST',\n body: JSON.stringify(payload),\n headers: { 'Idempotency-Key': key },\n signal,\n });\n },\n }),\n};\n\nconst store = createIndexedDbPostmasterStore({ name: 'my-app-outbox' });\nconst postmaster = createPostmaster({ jobs, store });\n\nawait postmaster.enqueue('createTodo', { id: crypto.randomUUID(), title: 'Buy milk' });\npostmaster.start();\n\n// On page unload:\nawait postmaster.dispose();\nawait store.dispose();\n```\n\nThe store is borrowed by `createPostmaster()` and is not disposed with the processor. Dispose both explicitly.\n\n## At-least-once delivery and idempotency\n\nPostmaster provides **at-least-once delivery**. A crash after the remote write but before local completion can repeat the job. Every job must derive a stable idempotency key, and handlers must send or otherwise enforce that key.\n\n```ts\nconst jobs = {\n createTodo: defineJob({\n version: 1,\n validate: (v: unknown) => v as { id: string; title: string },\n key: (p) => p.id,\n execute: async (payload, { key, signal }) => {\n await fetch('/api/todos', {\n method: 'POST',\n body: JSON.stringify(payload),\n headers: { 'Idempotency-Key': key },\n signal,\n });\n },\n }),\n};\n```\n\nNever assume exactly-once execution. Design handlers so a repeated delivery is safe.\n\n## Postmaster jobs vs Courier requests\n\nCourier performs immediate HTTP transport. Postmaster coordinates durable delivery. Use Courier inside a Postmaster job when the write must survive reloads.\n\n```ts\nimport { createCourier, CourierNetworkError } from '@vielzeug/courier';\nimport { createPostmaster, defineJob } from '@vielzeug/postmaster';\n\nconst courier = createCourier({ baseUrl: 'https://api.example.com' });\n\nconst jobs = {\n createTodo: defineJob({\n version: 1,\n validate: (v: unknown) => v as { id: string; title: string },\n key: (p) => p.id,\n execute: async (payload, { key, signal }) => {\n await courier.request('/todos', {\n method: 'POST',\n body: payload,\n headers: { 'Idempotency-Key': key },\n signal,\n });\n },\n retry: { maxAttempts: 5, shouldRetry: (error) => error instanceof CourierNetworkError },\n }),\n};\n```\n\nPostmaster does not import Courier. The integration happens in your job definitions.\n\n## Payload and version migration\n\nEach job declares a `version` and an optional `validate` function. When a stored job's version is older than the registered version, Postmaster applies contiguous version-step migrations before validating. `migrate` is keyed by the source version: key `n` transforms version `n` into `n + 1`. The lowest key declares the earliest stored version you support, and the range must lead into the current version without gaps. Omit `migrate` when a job has no supported older records. `validate` accepts a plain function `(value: unknown) => T` or any structural parser with `parse(value: unknown): T`: Spell schemas work directly:\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst jobs = {\n createTodo: defineJob({\n version: 2,\n validate: s.object({ id: s.string(), title: s.string(), priority: s.number().optional() }),\n key: (p) => p.id,\n migrate: {\n 1: (payload) => ({ ...(payload as { id: string; title: string }), priority: 0 }),\n },\n execute: async (payload, { key, signal }) => {\n await fetch('/api/todos', {\n method: 'POST',\n body: JSON.stringify(payload),\n headers: { 'Idempotency-Key': key },\n signal,\n });\n },\n }),\n};\n```\n\nUnknown job names, unsupported versions, failed migrations, `undefined` migration output, and invalid migrated payloads move to dead-letter rather than being executed.\n\n## Corrupt persisted records\n\nThe IndexedDB adapter validates durable records before the processor uses them. It skips malformed records so one corrupt value cannot block valid jobs. Supply `onCorruptRecord` to surface each distinct issue to your diagnostics:\n\n```ts\nconst store = createIndexedDbPostmasterStore({\n name: 'my-app-outbox',\n onCorruptRecord: ({ id, reason }) => reportOutboxCorruption({ id, reason }),\n});\n```\n\nThe callback may omit `id` when the persisted value has no usable identifier. Handler errors are ignored. Repair or remove reported records with your application's storage recovery tooling; Postmaster never deletes corrupt durable data automatically.\n\n## Retry semantics\n\nRetries are opt-in and explicitly classified. No `retry` block means one attempt followed by dead-letter.\n\n```ts\nconst jobs = {\n syncTodo: defineJob({\n version: 1,\n validate: (v: unknown) => v as { id: string },\n key: (p) => p.id,\n execute: async (payload, { signal }) => {\n await fetch(`/api/todos/${payload.id}/sync`, { signal });\n },\n retry: {\n maxAttempts: 5,\n shouldRetry: (error) => error instanceof TypeError, // network errors only\n },\n }),\n};\n```\n\n- `maxAttempts` means total executions, including the first.\n- `shouldRetry` is required when retries are enabled. Postmaster never guesses whether a write is safe to repeat.\n- Default delay uses an exponential backoff cap (`min(1000 × 2ⁿ, 30_000)` ms). Override with `delay`.\n- Delay must be finite and non-negative.\n- Lifecycle aborts caused by disposal are not classified as job failures.\n\n## Delayed eligibility\n\n`enqueue()` accepts an optional `availableAt` timestamp. The job persists immediately but cannot be claimed before that time. Use this for scheduled writes, cooldowns, or any work that must survive a reload but should not run yet.\n\n```ts\nawait postmaster.enqueue('sendDigest', { userId }, { availableAt: Date.now() + 60_000 });\n```\n\nPostmaster does not guarantee execution at `availableAt`: only that the job will not be claimed earlier. A live processor (`start()` or `flush()`) is required for execution. In a browser, a closed page or suspended service worker will run the job when the processor next becomes active. Past timestamps remain immediately eligible. The same mechanism already backs retry delays, so delayed eligibility reuses the existing claim, wake, and persistence paths.\n\n## Dead-letter recovery\n\nJobs that exhaust retries or hit a terminal failure move to dead-letter. Inspect, retry, or remove them.\n\n```ts\nconst deadLettered = await postmaster.list({ status: 'dead-letter' });\n\nfor (const entry of deadLettered) {\n console.log(entry.id, entry.name, entry.failure);\n}\n\n// Retry a dead-letter job back into the queue.\nawait postmaster.requeue(entry.id);\n\n// Or remove it permanently.\nawait postmaster.remove(entry.id);\n```\n\n`retry()` and `remove()` return discriminated results so callers can distinguish `not-found`, `not-dead-letter`, `running`, and successful outcomes without exceptions.\n\n## Lifecycle and disposal\n\n`start()` begins background processing and returns immediately (synchronous, idempotent). `dispose()` stops claiming new work, aborts owned work, and is idempotent. `flush()` processes every available job and awaits completion.\n\n```ts\npostmaster.start();\n// ...on unload\nawait postmaster.dispose();\nawait store.dispose();\n```\n\nDisposal aborts owned work, releases the active lease, and is idempotent. A controlled disposal abort does not consume the attempt: the job returns to queued.\n\n## Events\n\nTap runtime events for observability. Handler errors are swallowed: observability never affects processing.\n\n```ts\nconst unsubscribe = postmaster.tap((event) => {\n switch (event.type) {\n case 'enqueued':\n console.log('enqueued', event.entry.id);\n break;\n case 'completed':\n console.log('completed', event.entry.id);\n break;\n case 'dead-lettered':\n console.error('dead-lettered', event.entry.id, event.entry.failure);\n break;\n case 'processor-error':\n console.error('processor error', event.error);\n break;\n }\n});\n```\n\nPass an `AbortSignal` to auto-detach:\n\n```ts\nconst controller = new AbortController();\npostmaster.tap(handler, { signal: controller.signal });\ncontroller.abort(); // stops tapping\n```\n\n## Testing\n\nUse the in-memory store for deterministic tests.\n\n```ts\nimport { createPostmaster, defineJob } from '@vielzeug/postmaster';\nimport { createMemoryPostmasterStore } from '@vielzeug/postmaster/testing';\n\nconst store = createMemoryPostmasterStore();\nconst postmaster = createPostmaster({\n jobs: {\n send: defineJob({\n version: 1,\n validate: (v: unknown) => String(v),\n key: (p) => p,\n execute: async () => {},\n }),\n },\n store,\n});\n\nawait postmaster.enqueue('send', 'hello');\nawait postmaster.flush();\nawait postmaster.dispose();\n```\n\nInject a deterministic clock to control retry scheduling.\n\n```ts\nlet now = 0;\nconst postmaster = createPostmaster({ clock: () => now, jobs, store });\n```\n\n## Framework Integration\n\nCreate the Postmaster after the component mounts, start processing, and dispose on unmount.\n\n::: code-group\n\n```tsx [React]\nimport { createIndexedDbPostmasterStore } from '@vielzeug/postmaster/indexeddb';\nimport { createPostmaster, defineJob, type Postmaster } from '@vielzeug/postmaster';\nimport { useEffect } from 'react';\n\nconst jobs = {\n sync: defineJob({\n version: 1,\n validate: (v: unknown) => v as { id: string },\n key: (p) => p.id,\n execute: async (payload, { signal }) => {\n await fetch(`/api/sync/${payload.id}`, { signal });\n },\n }),\n};\n\nexport function OutboxProvider() {\n useEffect(() => {\n const store = createIndexedDbPostmasterStore({ name: 'outbox' });\n const postmaster = createPostmaster({ jobs, store });\n postmaster.start();\n\n return () => {\n void postmaster.dispose();\n void store.dispose();\n };\n }, []);\n\n return null;\n}\n```\n\n```vue [Vue 3]\n<script setup lang=\"ts\">\nimport { createIndexedDbPostmasterStore } from '@vielzeug/postmaster/indexeddb';\nimport { createPostmaster, defineJob } from '@vielzeug/postmaster';\nimport { onMounted, onUnmounted } from 'vue';\n\nconst jobs = {\n sync: defineJob({\n version: 1,\n validate: (v: unknown) => v as { id: string },\n key: (p) => p.id,\n execute: async (payload, { signal }) => {\n await fetch(`/api/sync/${payload.id}`, { signal });\n },\n }),\n};\n\nlet postmaster: ReturnType<typeof createPostmaster> | undefined;\nlet store: ReturnType<typeof createIndexedDbPostmasterStore> | undefined;\n\nonMounted(() => {\n store = createIndexedDbPostmasterStore({ name: 'outbox' });\n postmaster = createPostmaster({ jobs, store });\n postmaster.start();\n});\n\nonUnmounted(() => {\n void postmaster?.dispose();\n void store?.dispose();\n});\n</script>\n\n<template>\n <slot />\n</template>\n```\n\n```svelte [Svelte]\n<script lang=\"ts\">\n import { createIndexedDbPostmasterStore } from '@vielzeug/postmaster/indexeddb';\n import { createPostmaster, defineJob } from '@vielzeug/postmaster';\n import { onMount } from 'svelte';\n\n const jobs = {\n sync: defineJob({\n version: 1,\n validate: (v: unknown) => v as { id: string },\n key: (p) => p.id,\n execute: async (payload, { signal }) => {\n await fetch(`/api/sync/${payload.id}`, { signal });\n },\n }),\n };\n\n onMount(() => {\n const store = createIndexedDbPostmasterStore({ name: 'outbox' });\n const postmaster = createPostmaster({ jobs, store });\n postmaster.start();\n\n return () => {\n void postmaster.dispose();\n void store.dispose();\n };\n });\n</script>\n\n<slot />\n```\n\n:::\n\n## Working with Other Vielzeug Libraries\n\n### Postmaster + Courier\n\nUse Courier inside job handlers for HTTP transport. Postmaster coordinates delivery; Courier performs the request.\n\n```ts\nimport { createCourier, CourierNetworkError } from '@vielzeug/courier';\nimport { createPostmaster, defineJob } from '@vielzeug/postmaster';\n\nconst courier = createCourier({ baseUrl: 'https://api.example.com' });\n\nconst jobs = {\n createTodo: defineJob({\n version: 1,\n validate: (v: unknown) => v as { id: string; title: string },\n key: (p) => p.id,\n execute: async (payload, { key, signal }) => {\n await courier.request('/todos', {\n method: 'POST',\n body: payload,\n headers: { 'Idempotency-Key': key },\n signal,\n });\n },\n retry: { maxAttempts: 5, shouldRetry: (e) => e instanceof CourierNetworkError },\n }),\n};\n```\n\n### Postmaster + Sentinel\n\nFlush the outbox when the network returns. Sentinel reports online state; Postmaster does the rest.\n\n```ts\nimport { createNetwork } from '@vielzeug/sentinel';\nimport { createPostmaster } from '@vielzeug/postmaster';\n\nconst network = createNetwork();\nconst postmaster = createPostmaster({ jobs, store });\n\nconst unsubscribe = network.subscribe(() => {\n if (network.getSnapshot().online) void postmaster.flush();\n});\n\n// On teardown:\nunsubscribe();\nnetwork.dispose();\nawait postmaster.dispose();\n```\n\n### Postmaster + Vault\n\nThe IndexedDB adapter is built on Vault. Use Vault directly for unrelated storage; the Postmaster store owns its own database name.\n\n## Best Practices\n\n- **Derive** a stable idempotency key from every job payload and send it with the remote write.\n- **Dispose** both the processor and the store explicitly; the processor does not own the store.\n- **Classify** retryable errors explicitly with `shouldRetry`; never let Postmaster guess.\n- **Migrate** persisted payloads when job versions change; test migrations against stored fixtures.\n- **Inspect** dead-letter jobs and report `onCorruptRecord` diagnostics to your recovery tooling.\n- **Avoid** persisting sensitive data in payloads or failure messages; IndexedDB is per-origin but not encrypted.\n- **Flush** the outbox when Sentinel reports the network returns.\n- **Test** with the in-memory store and a deterministic clock for reproducible retry timing.\n",
|
|
7
|
-
"examples": "---\ntitle: 'Postmaster: Examples'\ndescription: Durable outbox recipes for offline mutations, network recovery, delayed eligibility, and dead-letter handling.\n---\n\n## Examples\n\n- [Queue Offline Courier Requests](./examples/queue-offline-courier-mutations.md)\n- [Resume When Network Returns](./examples/resume-when-network-returns.md)\n- [Delayed Eligibility](./examples/delayed-eligibility.md)\n- [Recover Dead-Letter Jobs](./examples/recover-dead-letter-jobs.md)\n- [Service Worker Background Sync](./examples/service-worker-background-sync.md)\n"
|
|
8
|
-
},
|
|
9
|
-
"examples": [
|
|
10
|
-
{
|
|
11
|
-
"id": "define-jobs",
|
|
12
|
-
"code": "import { createPostmaster, defineJob } from '@vielzeug/postmaster'\nimport { createMemoryPostmasterStore } from '@vielzeug/postmaster/testing'\n\nconst jobs = {\n send: defineJob({\n version: 1,\n validate: (v: unknown) => String(v),\n key: (p) => `send:${p}`,\n execute: async (payload, { key, attempt }) => {\n console.log(`delivering \"${payload}\" (attempt ${attempt}, key ${key})`)\n },\n }),\n}\n\nconst store = createMemoryPostmasterStore()\nconst postmaster = createPostmaster({ jobs, store })\n\nawait postmaster.enqueue('send', 'hello')\nconst result = await postmaster.flush()\nconsole.log('flush result:', result)\nawait postmaster.dispose()",
|
|
13
|
-
"name": "defineJob - Basic Outbox"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"id": "delayed-enqueue",
|
|
17
|
-
"code": "import { createPostmaster, defineJob } from '@vielzeug/postmaster'\nimport { createMemoryPostmasterStore } from '@vielzeug/postmaster/testing'\n\nconst jobs = {\n send: defineJob({\n version: 1,\n validate: (v: unknown) => String(v),\n key: (p) => `send:${p}`,\n execute: async (payload, { key, attempt }) => {\n console.log(`delivering \"${payload}\" (attempt ${attempt}, key ${key})`)\n },\n }),\n}\n\nlet now = 0\nconst store = createMemoryPostmasterStore()\nconst postmaster = createPostmaster({ clock: () => now, jobs, store })\n\n// Persist now, but the job is not claimable until availableAt.\nconst entry = await postmaster.enqueue('send', 'hello', { availableAt: 60_000 })\nconsole.log('enqueued with availableAt:', entry.availableAt)\n\n// Nothing eligible yet.\nlet result = await postmaster.flush()\nconsole.log('flush before eligible:', result)\n\n// Advance the clock past availableAt.\nnow = 60_000\nresult = await postmaster.flush()\nconsole.log('flush after eligible:', result)\nawait postmaster.dispose()",
|
|
18
|
-
"name": "delayedEnqueue - Delayed Eligibility"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"typeSignatures": {
|
|
22
|
-
"defineJob": "export { defineJob } from './definitions.ts';",
|
|
23
|
-
"PostmasterDisposedError": "export { PostmasterDisposedError, PostmasterError, PostmasterJobError } from './errors.ts';",
|
|
24
|
-
"PostmasterError": "export { PostmasterDisposedError, PostmasterError, PostmasterJobError } from './errors.ts';",
|
|
25
|
-
"PostmasterJobError": "export { PostmasterDisposedError, PostmasterError, PostmasterJobError } from './errors.ts';",
|
|
26
|
-
"createPostmaster": "export { createPostmaster } from './postmaster.ts';",
|
|
27
|
-
"CreatePostmasterOptions": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
28
|
-
"EnqueueOptions": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
29
|
-
"EntryFilter": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
30
|
-
"EntryStatus": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
31
|
-
"FlushResult": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
32
|
-
"InferJobPayload": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
33
|
-
"JobContext": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
34
|
-
"JobDefinition": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
35
|
-
"JobDefinitions": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
36
|
-
"JsonPrimitive": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
37
|
-
"JsonValue": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
38
|
-
"Postmaster": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
39
|
-
"PostmasterEntry": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
40
|
-
"PostmasterEvent": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
41
|
-
"PostmasterStats": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
42
|
-
"RemoveResult": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
43
|
-
"RequeueResult": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
44
|
-
"RetryPolicy": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
45
|
-
"StoredFailure": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
46
|
-
"Validate": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';",
|
|
47
|
-
"VersionMigrations": "export type {\n CreatePostmasterOptions,\n EnqueueOptions,\n EntryFilter,\n EntryStatus,\n FlushResult,\n InferJobPayload,\n JobContext,\n JobDefinition,\n JobDefinitions,\n JsonPrimitive,\n JsonValue,\n Postmaster,\n PostmasterEntry,\n PostmasterEvent,\n PostmasterStats,\n RemoveResult,\n RequeueResult,\n RetryPolicy,\n StoredFailure,\n Validate,\n VersionMigrations,\n} from './types.ts';"
|
|
48
|
-
}
|
|
49
|
-
}
|