Milestone 2: module/model docs (MD, Sphinx RST, PDF) and work log

74 source modules documented with extracted signatures, JSDoc params,
imports, and call graphs. 10 first-class models (PriceRule through
StatusResponse) have their own MD/RST/PDF. Sphinx HTML builds from
docs/sphinx. Per-module PDFs in docs/modules-pdf and docs/models-pdf.

Middleware gates 2–6 and 10 pass on MOCK_VERAE without NATS.

Learned: RST includes are relative to the RST file; keep one PDF per
module; Add Numbers remains the only push required tomorrow.
This commit is contained in:
George Lambert 2026-09-09 02:44:51 -04:00
parent b814501441
commit 10c663cc0c
347 changed files with 17200 additions and 14 deletions

View file

@ -0,0 +1,47 @@
# `verae-zapier-middleware/services/authService`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/services/authService.js`
**Lines:** 142
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`loginWithCredentials`, `loginWithApiKey`, `resolveAuthContext`, `validateSession`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `loginWithCredentials` | `{ username, password, tenant }` | params: `object`, params.username: `string`, params.password: `string`, params.tenant: `object` | `Promise<{ accessToken: string, expiresAt: string, tenant: object, user: object ` — >} | see Call graph |
| `loginWithApiKey` | `apiKey` | apiKey: `string` | `Promise<Awaited<ReturnType<typeof loginWithCredentials>>>` | see Call graph |
| `resolveAuthContext` | `rawToken` | rawToken: `string|null` | `Promise<{ tenantId: string, tenant: object, veraeToken: string, authMethod: string ` — >} | see Call graph |
| `validateSession` | `rawToken` | rawToken: `string` | `Promise<object>` | see Call graph |
## What it imports / requires
- `../clients/veraeClient.js`
- `../store/tenants.js`
- `../lib/tokens.js`
- `../errors.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `loginWithCredentials`, `debug`, `login`, `issueSessionToken`, `loginWithApiKey`, `getTenantByApiKey`, `resolveAuthContext`, `isApiKey`, `parseSessionToken`, `getTenant`, `parse`, `now`, `validateSession`, `validate`
Each identifier is a call site in this file. Follow the import list to see the defining module; open that modules MD for parameter and return types.
## Return values (how to read this)
- HTTP route handlers return Express `res.json(...)` bodies (see route docs).
- Zapier `perform` functions return a **single object** (creates) or an **array** (triggers/searches).
- Pricing functions return integer **cents** on `Quote.totalCents`.

View file

@ -0,0 +1,47 @@
# `verae-zapier-middleware/services/entitlementService`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/services/entitlementService.js`
**Lines:** 161
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`checkEntitlement`, `recordUsage`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `isUnlimited` | `value` | — | `unknown` | see Call graph |
| `quotaExceeded` | `{ limit, used, allowOverage }` | — | `unknown` | see Call graph |
| `checkEntitlement` | `tenantId, action, { amount = 1 } = {}` | tenantId: `string`, action: `'timestamp'|'verify'|'batch_timestamp'` | `{ tenant: object, limits: object, usage: object ` — } | see Call graph |
| `recordUsage` | `tenantId, action, { amount = 1 } = {}` | tenantId: `string`, action: `string` | `void` | see Call graph |
## What it imports / requires
- `../config.js`
- `../errors.js`
- `../store/tenants.js`
- `../store/usage.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `isUnlimited`, `quotaExceeded`, `checkEntitlement`, `getTenant`, `resolveLimits`, `getUsage`, `debug`, `recordUsage`, `incrementUsage`
Each identifier is a call site in this file. Follow the import list to see the defining module; open that modules MD for parameter and return types.
## Return values (how to read this)
- HTTP route handlers return Express `res.json(...)` bodies (see route docs).
- Zapier `perform` functions return a **single object** (creates) or an **array** (triggers/searches).
- Pricing functions return integer **cents** on `Quote.totalCents`.

View file

@ -0,0 +1,57 @@
# `verae-zapier-middleware/services/tenantService`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/services/tenantService.js`
**Lines:** 138
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`selfServeSignup`, `provisionTenant`, `listProvisionedTenants`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `slugify` | `value` | — | `unknown` | see Call graph |
| `validateVeraeCredentials` | `username, password` | — | `unknown` | see Call graph |
| `selfServeSignup` | `{ email, name, veraeUsername, veraePassword }` | — | `unknown` | see Call graph |
| `provisionTenant` | `{
id,
name,
plan,
veraeUsername,
veraePassword,
contract = null,
metadata = {},
audience = 'admin',
}` | — | `unknown` | see Call graph |
| `listProvisionedTenants` | `(none)` | — | `Array<object>` | see Call graph |
## What it imports / requires
- `node:crypto`
- `../store/tenants.js`
- `../clients/veraeClient.js`
- `../errors.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `slugify`, `toLowerCase`, `replace`, `slice`, `validateVeraeCredentials`, `login`, `selfServeSignup`, `randomUUID`, `createTenant`, `info`, `provision`, `provisionTenant`, `has`, `getTenant`, `listProvisionedTenants`, `listTenants`, `map`
Each identifier is a call site in this file. Follow the import list to see the defining module; open that modules MD for parameter and return types.
## Return values (how to read this)
- HTTP route handlers return Express `res.json(...)` bodies (see route docs).
- Zapier `perform` functions return a **single object** (creates) or an **array** (triggers/searches).
- Pricing functions return integer **cents** on `Quote.totalCents`.

View file

@ -0,0 +1,70 @@
# `verae-zapier-middleware/services/timestampService`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/services/timestampService.js`
**Lines:** 123
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`createTimestamp`, `createTimestampAndWait`, `createBatchTimestamp`, `getJobStatus`, `getBatchJobStatus`, `getJobVerification`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `enqueueWatchForJob` | `ctx, jobId` | ctx: `object`, jobId: `string` | `unknown` | see Call graph |
| `createTimestamp` | `ctx, body` | ctx: `object` | `Promise<{ jobId: string ` — >} | see Call graph |
| `createTimestampAndWait` | `ctx, body` | ctx: `object` | `Promise<object>` — StatusResponse | see Call graph |
| `createBatchTimestamp` | `ctx, body` | ctx: `object` | `unknown` | see Call graph |
| `getJobStatus` | `ctx, jobId` | ctx: `object`, jobId: `string` | `unknown` | see Call graph |
| `getBatchJobStatus` | `ctx, body` | ctx: `object` | `unknown` | see Call graph |
| `getJobVerification` | `ctx, jobId` | ctx: `object`, jobId: `string` | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `enqueueJob` | `{
tenantId: ctx.tenantId,
jobId,
veraeToken: ctx.veraeToken,
traceId,
}` |
| `checkEntitlement` | `ctx.tenantId, 'timestamp'` |
| `recordUsage` | `ctx.tenantId, 'timestamp'` |
| `recordUsage` | `ctx.tenantId, 'status'` |
| `checkEntitlement` | `ctx.tenantId, 'batch_timestamp', { amount: itemCount }` |
| `recordUsage` | `ctx.tenantId, 'batch_timestamp', { amount: itemCount }` |
| `recordUsage` | `ctx.tenantId, 'status'` |
| `recordUsage` | `ctx.tenantId, 'status', { amount: body.jobIds?.length ?? 1 }` |
| `recordUsage` | `ctx.tenantId, 'status'` |
## What it imports / requires
- `../config.js`
- `../clients/veraeClient.js`
- `../store/jobWatchers.js`
- `./entitlementService.js`
- `../debug/logger.js`
- `../debug/trace-context.js`
## Call graph (identifiers invoked)
`createDebugger`, `enqueueWatchForJob`, `getTraceId`, `import`, `enqueueWatch`, `debug`, `enqueueJob`, `createTimestamp`, `checkEntitlement`, `recordUsage`, `createTimestampAndWait`, `waitForJob`, `createBatchTimestamp`, `getJobStatus`, `getStatus`, `getBatchJobStatus`, `getBatchStatus`, `getJobVerification`
Each identifier is a call site in this file. Follow the import list to see the defining module; open that modules MD for parameter and return types.
## Return values (how to read this)
- HTTP route handlers return Express `res.json(...)` bodies (see route docs).
- Zapier `perform` functions return a **single object** (creates) or an **array** (triggers/searches).
- Pricing functions return integer **cents** on `Quote.totalCents`.

View file

@ -0,0 +1,52 @@
# `verae-zapier-middleware/services/verifyService`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/services/verifyService.js`
**Lines:** 35
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`verifyTimestamp`, `verifyBatch`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `verifyTimestamp` | `ctx, body` | ctx: `object` | `unknown` | see Call graph |
| `verifyBatch` | `ctx, body` | ctx: `object` | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `checkEntitlement` | `ctx.tenantId, 'verify'` |
| `recordUsage` | `ctx.tenantId, 'verify'` |
| `checkEntitlement` | `ctx.tenantId, 'verify', { amount }` |
| `recordUsage` | `ctx.tenantId, 'verify', { amount }` |
## What it imports / requires
- `../clients/veraeClient.js`
- `./entitlementService.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `verifyTimestamp`, `checkEntitlement`, `verify`, `recordUsage`, `debug`, `verifyBatch`
Each identifier is a call site in this file. Follow the import list to see the defining module; open that modules MD for parameter and return types.
## Return values (how to read this)
- HTTP route handlers return Express `res.json(...)` bodies (see route docs).
- Zapier `perform` functions return a **single object** (creates) or an **array** (triggers/searches).
- Pricing functions return integer **cents** on `Quote.totalCents`.

View file

@ -0,0 +1,43 @@
# `verae-zapier-middleware/services/webhookService`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/services/webhookService.js`
**Lines:** 71
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`subscribe`, `unsubscribe`, `deliverWebhook`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `subscribe` | `ctx, { targetUrl, event }` | ctx: `object` | `unknown` | see Call graph |
| `unsubscribe` | `ctx, { hookId, targetUrl }` | ctx: `object` | `unknown` | see Call graph |
| `deliverWebhook` | `targetUrl, payload` | targetUrl: `string`, payload: `object` | `Promise<{ ok: boolean, status: number ` — >} | see Call graph |
## What it imports / requires
- `../store/webhooks.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `subscribe`, `has`, `createWebhook`, `unsubscribe`, `deleteWebhook`, `deliverWebhook`, `debug`, `fetch`, `stringify`
Each identifier is a call site in this file. Follow the import list to see the defining module; open that modules MD for parameter and return types.
## Return values (how to read this)
- HTTP route handlers return Express `res.json(...)` bodies (see route docs).
- Zapier `perform` functions return a **single object** (creates) or an **array** (triggers/searches).
- Pricing functions return integer **cents** on `Quote.totalCents`.