master-zapier-plan-draft/docs/developer/modules/workers.md
George Lambert b4150c8250 Milestone 0: import zappier billing, Verae middleware, and Zapier research
Compose-ready workspace: packages/zappier (rate card, portal, Stripe),
packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier
(CLI app), vendor/zapier-platform, and research/zapier vendor corpus.

Gate 0 structure checks pass. Product code and research are not yet wired.
2026-09-09 02:37:36 -04:00

35 lines
1,002 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Module: `workers`
**Path:** `verae-zapier-middleware/src/workers/`
**Phases:** 6 (in-process), 89 (NATS)
## Files
| File | Phase | Purpose |
|------|-------|---------|
| `inProcessJobPoller.js` | 6 | Fallback poller when `NATS_ENABLED=false` |
| `jobPollerWorker.js` | 8 | JetStream job watch consumer |
| `webhookWorker.js` | 8 | JetStream webhook deliver consumer |
## `startJobPollerWorker()`
| | |
|--|--|
| **For** | Poll Verae until job terminal; publish events |
| **Input** | none (uses NATS + config) |
| **Output** | `Promise<{ stop: () => Promise<void> }>` |
| **Debug** | `jobs`, `http`, `nats` |
## `startWebhookWorker()`
| | |
|--|--|
| **For** | POST completion payloads to Zapier hook URLs |
| **Output** | `Promise<{ stop: () => Promise<void> }>` |
| **Debug** | `webhooks`, `nats` |
## Rules
- Only one of in-process poller **or** NATS job worker should run.
- Never log raw JWTs or full webhook secrets.
- Queue groups allow horizontal scale without double delivery.