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

78
docs/modules/README.md Normal file
View file

@ -0,0 +1,78 @@
# Module documentation index
One MD file per source module.
- [zappier/accounts](zappier/accounts.md)
- [zappier/admin-users](zappier/admin-users.md)
- [zappier/admin](zappier/admin.md)
- [zappier/app](zappier/app.md)
- [zappier/auth](zappier/auth.md)
- [zappier/billing/credit](zappier/billing/credit.md)
- [zappier/billing/reload](zappier/billing/reload.md)
- [zappier/billing/stripe](zappier/billing/stripe.md)
- [zappier/db/admin-user-repo](zappier/db/admin-user-repo.md)
- [zappier/db/billing-repo](zappier/db/billing-repo.md)
- [zappier/db/customer-repo](zappier/db/customer-repo.md)
- [zappier/db/invoice-repo](zappier/db/invoice-repo.md)
- [zappier/db/pricing-store](zappier/db/pricing-store.md)
- [zappier/db/session-repo](zappier/db/session-repo.md)
- [zappier/db/usage-repo](zappier/db/usage-repo.md)
- [zappier/index](zappier/index.md)
- [zappier/invoicing](zappier/invoicing.md)
- [zappier/jobs/report-usage](zappier/jobs/report-usage.md)
- [zappier/meter](zappier/meter.md)
- [zappier/paths](zappier/paths.md)
- [zappier/portal](zappier/portal.md)
- [zappier/pricing](zappier/pricing.md)
- [zappier/reports](zappier/reports.md)
- [zappier/usage](zappier/usage.md)
- [verae-zapier-middleware/app](verae-zapier-middleware/app.md)
- [verae-zapier-middleware/clients/veraeClient](verae-zapier-middleware/clients/veraeClient.md)
- [verae-zapier-middleware/config](verae-zapier-middleware/config.md)
- [verae-zapier-middleware/debug/config](verae-zapier-middleware/debug/config.md)
- [verae-zapier-middleware/debug/index](verae-zapier-middleware/debug/index.md)
- [verae-zapier-middleware/debug/logger](verae-zapier-middleware/debug/logger.md)
- [verae-zapier-middleware/debug/redact](verae-zapier-middleware/debug/redact.md)
- [verae-zapier-middleware/debug/trace-context](verae-zapier-middleware/debug/trace-context.md)
- [verae-zapier-middleware/debug/trace](verae-zapier-middleware/debug/trace.md)
- [verae-zapier-middleware/errors](verae-zapier-middleware/errors.md)
- [verae-zapier-middleware/index](verae-zapier-middleware/index.md)
- [verae-zapier-middleware/lib/tokens](verae-zapier-middleware/lib/tokens.md)
- [verae-zapier-middleware/middleware/authenticate](verae-zapier-middleware/middleware/authenticate.md)
- [verae-zapier-middleware/middleware/rateLimit](verae-zapier-middleware/middleware/rateLimit.md)
- [verae-zapier-middleware/nats/connection](verae-zapier-middleware/nats/connection.md)
- [verae-zapier-middleware/nats/publishers](verae-zapier-middleware/nats/publishers.md)
- [verae-zapier-middleware/nats/subjects](verae-zapier-middleware/nats/subjects.md)
- [verae-zapier-middleware/routes/authRoutes](verae-zapier-middleware/routes/authRoutes.md)
- [verae-zapier-middleware/routes/index](verae-zapier-middleware/routes/index.md)
- [verae-zapier-middleware/routes/statusRoutes](verae-zapier-middleware/routes/statusRoutes.md)
- [verae-zapier-middleware/routes/tenantRoutes](verae-zapier-middleware/routes/tenantRoutes.md)
- [verae-zapier-middleware/routes/timestampRoutes](verae-zapier-middleware/routes/timestampRoutes.md)
- [verae-zapier-middleware/routes/verifyRoutes](verae-zapier-middleware/routes/verifyRoutes.md)
- [verae-zapier-middleware/routes/webhookRoutes](verae-zapier-middleware/routes/webhookRoutes.md)
- [verae-zapier-middleware/services/authService](verae-zapier-middleware/services/authService.md)
- [verae-zapier-middleware/services/entitlementService](verae-zapier-middleware/services/entitlementService.md)
- [verae-zapier-middleware/services/tenantService](verae-zapier-middleware/services/tenantService.md)
- [verae-zapier-middleware/services/timestampService](verae-zapier-middleware/services/timestampService.md)
- [verae-zapier-middleware/services/verifyService](verae-zapier-middleware/services/verifyService.md)
- [verae-zapier-middleware/services/webhookService](verae-zapier-middleware/services/webhookService.md)
- [verae-zapier-middleware/store/db](verae-zapier-middleware/store/db.md)
- [verae-zapier-middleware/store/jobWatchers](verae-zapier-middleware/store/jobWatchers.md)
- [verae-zapier-middleware/store/tenants](verae-zapier-middleware/store/tenants.md)
- [verae-zapier-middleware/store/usage](verae-zapier-middleware/store/usage.md)
- [verae-zapier-middleware/store/webhooks](verae-zapier-middleware/store/webhooks.md)
- [verae-zapier-middleware/workers/inProcessJobPoller](verae-zapier-middleware/workers/inProcessJobPoller.md)
- [verae-zapier-middleware/workers/jobPollerWorker](verae-zapier-middleware/workers/jobPollerWorker.md)
- [verae-zapier-middleware/workers/webhookWorker](verae-zapier-middleware/workers/webhookWorker.md)
- [verae-activate/authentication](verae-activate/authentication.md)
- [verae-activate/creates/add_numbers](verae-activate/creates/add_numbers.md)
- [verae-activate/index](verae-activate/index.md)
- [verae-zapier/authentication](verae-zapier/authentication.md)
- [verae-zapier/creates/add_numbers](verae-zapier/creates/add_numbers.md)
- [verae-zapier/creates/batch_timestamp](verae-zapier/creates/batch_timestamp.md)
- [verae-zapier/creates/create_timestamp](verae-zapier/creates/create_timestamp.md)
- [verae-zapier/creates/timestamp_and_wait](verae-zapier/creates/timestamp_and_wait.md)
- [verae-zapier/creates/verify_timestamp](verae-zapier/creates/verify_timestamp.md)
- [verae-zapier/index](verae-zapier/index.md)
- [verae-zapier/searches/job_status](verae-zapier/searches/job_status.md)
- [verae-zapier/triggers/timestamp_completed](verae-zapier/triggers/timestamp_completed.md)

View file

@ -0,0 +1,40 @@
# `verae-activate/authentication`
**Package:** `verae-activate`
**Source:** `packages/verae-activate/authentication.js`
**Lines:** 58
## What this module is
Implementation module in `verae-activate`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`type`, `fields`, `key`, `required`, `false`, `label`, `helpText`, `Later`, `https`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `testAuth` | `z, bundle` | z: `object`, bundle: `object` | `Promise<{ok: boolean, mode: string, label: string` — >} | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`async`, `replace`, `request`
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,41 @@
# `verae-activate/creates/add_numbers`
**Package:** `verae-activate`
**Source:** `packages/verae-activate/creates/add_numbers.js`
**Lines:** 95
## What this module is
Implementation module in `verae-activate`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`key`, `noun`, `display`, `label`, `description`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `toFiniteNumber` | `value, name` | value: `unknown`, name: `string` | `number` | see Call graph |
| `perform` | `z, bundle` | z: `object`, bundle: `object`, bundle.inputData: `object`, bundle.inputData.number1: `string|number`, bundle.inputData.number2: `string|number`, bundle.authData: `object` | `Promise<{number1: number, number2: number, sum: number, mode: string` — >} | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`number2`, `toFiniteNumber`, `isFinite`, `async`, `replace`, `request`
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,39 @@
# `verae-activate/index`
**Package:** `verae-activate`
**Source:** `packages/verae-activate/index.js`
**Lines:** 21
## What this module is
Implementation module in `verae-activate`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`version`, `platformVersion`, `authentication`, `creates`, `addNumbers`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## What it imports / requires
- `./authentication`
- `./creates/add_numbers`
- `./package.json`
- `zapier-platform-core`
## Call graph (identifiers invoked)
_No local call identifiers extracted._
## 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,45 @@
# `verae-zapier-middleware/app`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/app.js`
**Lines:** 51
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`createApp`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `createApp` | `options = {}` | — | `import('express').Express` | see Call graph |
## What it imports / requires
- `express`
- `./errors.js`
- `./debug/logger.js`
- `./debug/trace.js`
- `./routes/index.js`
- `./store/db.js`
## Call graph (identifiers invoked)
`createDebugger`, `app`, `import`, `createApp`, `loadStore`, `express`, `disable`, `use`, `json`, `get`, `sendError`, `info`
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,66 @@
# `verae-zapier-middleware/clients/veraeClient`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/clients/veraeClient.js`
**Lines:** 288
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`veraeClient`, `clearMockJobs`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `delay` | `ms` | ms: `number` | `Promise<void>` | see Call graph |
| `mockLogin` | `{ username, password }` | ms: `number` | `Promise<void>` | see Call graph |
| `mockValidate` | `token` | — | `unknown` | see Call graph |
| `mockCreateTimestamp` | `{ data, hashAlg }` | — | `unknown` | see Call graph |
| `mockGetStatus` | `jobId` | — | `unknown` | see Call graph |
| `mockVerify` | `{ certificate }` | — | `unknown` | see Call graph |
| `request` | `path, { method = 'GET', token, body } = {}` | path: `string` | `Promise<any>` | see Call graph |
| `clearMockJobs` | `(none)` | — | `void` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `setTimeout` | `(` |
| `login` | `credentials` |
| `validate` | `token` |
| `createTimestamp` | `token, body` |
| `createBatchTimestamp` | `token, body` |
| `getStatus` | `token, jobId` |
| `getBatchStatus` | `token, body` |
| `verify` | `token, body` |
| `verifyBatch` | `token, body` |
| `getJobVerification` | `token, jobId` |
| `waitForJob` | `token, jobId, { maxAttempts, intervalMs }` |
## What it imports / requires
- `node:crypto`
- `../config.js`
- `../errors.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`net`, `createDebugger`, `delay`, `setTimeout`, `mockLogin`, `now`, `toISOString`, `randomUUID`, `includes`, `mockValidate`, `startsWith`, `replace`, `mockCreateTimestamp`, `set`, `get`, `mockGetStatus`, `mockVerify`, `request`, `debug`, `fetch`, `stringify`, `text`, `parse`, `error`, `client`, `login`, `validate`, `createTimestamp`, `createBatchTimestamp`, `push`, `getStatus`, `encodeURIComponent`, `getBatchStatus`, `verify`, `verifyBatch`, `getJobVerification`, `waitForJob`, `jobs`, `clearMockJobs`, `clear`
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,45 @@
# `verae-zapier-middleware/config`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/config.js`
**Lines:** 143
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`loadEnvFile`, `config`, `PLAN_LIMITS`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `loadEnvFile` | `(none)` | — | `void` | see Call graph |
| `bool` | `value, fallback = false` | value: `string|undefined`, fallback: `boolean` | `boolean` | see Call graph |
| `int` | `value, fallback` | value: `string|undefined`, fallback: `number` | `number` | see Call graph |
## What it imports / requires
- `node:fs`
- `node:path`
- `node:url`
- `./debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `dirname`, `fileURLToPath`, `resolve`, `loadEnvFile`, `existsSync`, `readFileSync`, `split`, `trim`, `startsWith`, `indexOf`, `slice`, `bool`, `includes`, `toLowerCase`, `int`, `parseInt`, `isFinite`, `replace`, `info`
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/debug/config`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/debug/config.js`
**Lines:** 107
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`parseDebugVeraeEnv`, `parseLevel`, `loadDebugConfig`, `shouldLog`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `parseDebugVeraeEnv` | `raw` | raw: `string|undefined` | `{ enabled: boolean, namespaces: Set<string>|null ` — } | see Call graph |
| `parseLevel` | `raw, fallback = 'debug'` | raw: `string|undefined`, fallback: `'debug'|'info'|'warn'|'error'` | `'debug'|'info'|'warn'|'error'` | see Call graph |
| `loadDebugConfig` | `env = process.env` | env: `NodeJS.ProcessEnv` | `DebugConfig` | see Call graph |
| `shouldLog` | `config, namespace, messageLevel` | config: `DebugConfig`, namespace: `string`, messageLevel: `'debug'|'info'|'warn'|'error'` | `boolean` | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`value`, `parseDebugVeraeEnv`, `trim`, `toLowerCase`, `split`, `map`, `filter`, `parseLevel`, `namespaces`, `loadDebugConfig`, `namespace`, `shouldLog`, `has`
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,39 @@
# `verae-zapier-middleware/debug/index`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/debug/index.js`
**Lines:** 25
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
_No named `export` / `module.exports` keys detected._
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## What it imports / requires
- `./config.js`
- `./logger.js`
- `./redact.js`
- `./trace.js`
## Call graph (identifiers invoked)
_No local call identifiers extracted._
## 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/debug/logger`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/debug/logger.js`
**Lines:** 122
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`setDebugTestSink`, `formatLogLine`, `createDebugger`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `setDebugTestSink` | `sink` | sink: `null|((line: string) => void)` | `void` | see Call graph |
| `formatLogLine` | `{ level, namespace, message, meta, traceId }` | parts: `object`, parts.level: `string`, parts.namespace: `string`, parts.message: `string`, parts.meta: `Record<string, unknown>|undefined`, parts.traceId: `string|null` | `string` | see Call graph |
| `emit` | `line, filePath` | line: `string`, filePath: `string|null` | `void` | see Call graph |
| `createDebugger` | `namespace` | namespace: `string` | `Debugger` — Logger with debug/info/warn/error methods. | see Call graph |
| `write` | `level, message, meta` | level: `'debug'|'info'|'warn'|'error'`, message: `string`, meta: `Record<string, unknown>` | `unknown` | see Call graph |
## What it imports / requires
- `node:fs`
- `./config.js`
- `./redact.js`
- `./trace-context.js`
## Call graph (identifiers invoked)
`setDebugTestSink`, `formatLogLine`, `toISOString`, `keys`, `stringify`, `redact`, `toUpperCase`, `emit`, `testSink`, `error`, `appendFileSync`, `createDebugger`, `debug`, `toLowerCase`, `write`, `loadDebugConfig`, `shouldLog`, `getTraceId`
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,41 @@
# `verae-zapier-middleware/debug/redact`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/debug/redact.js`
**Lines:** 94
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`redactString`, `redact`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `redactString` | `value` | value: `string` | `string` — Original or `[REDACTED]`. | see Call graph |
| `redact` | `input, depth = 0` | input: `unknown`, depth: `number` | `unknown` — Redacted structure safe for logging. | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`redactString`, `test`, `redact`, `isArray`, `map`, `entries`, `has`, `toLowerCase`
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/debug/trace-context`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/debug/trace-context.js`
**Lines:** 40
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`traceStorage`, `generateTraceId`, `getTraceId`, `getTraceContext`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `generateTraceId` | `(none)` | — | `string` | see Call graph |
| `getTraceId` | `(none)` | — | `string|null` | see Call graph |
| `getTraceContext` | `(none)` | — | `TraceContext|null` | see Call graph |
## What it imports / requires
- `node:async_hooks`
- `node:crypto`
## Call graph (identifiers invoked)
`context`, `id`, `generateTraceId`, `randomBytes`, `toString`, `getTraceId`, `getStore`, `getTraceContext`
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,48 @@
# `verae-zapier-middleware/debug/trace`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/debug/trace.js`
**Lines:** 96
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`withTrace`, `traceMiddleware`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `withTrace` | `options, fn` | options: `object|(() => T|Promise<T>)`, options.traceId: `string`, options.span: `string`, fn: `() => T|Promise<T>` | `T|Promise<T>` — Return value of `fn`. | see Call graph |
| `traceMiddleware` | `req, res, next` | req: `import('express').Request`, res: `import('express').Response`, next: `import('express').NextFunction` | `void` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `withTrace` | `{ traceId, span: `${req.method} ${req.path}` }, (` |
## What it imports / requires
- `./logger.js`
- `./trace-context.js`
## Call graph (identifiers invoked)
`createDebugger`, `id`, `span`, `withTrace`, `async`, `getTraceId`, `getStore`, `generateTraceId`, `run`, `debug`, `callback`, `then`, `import`, `traceMiddleware`, `trim`, `setHeader`, `next`
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,51 @@
# `verae-zapier-middleware/errors`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/errors.js`
**Lines:** 76
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`AppError`, `asyncHandler`, `sendError`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| class | `AppError` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `asyncHandler` | `fn` | fn: `(req: import('express').Request, res: import('express').Response, next: import('express').NextFunction) => Promise<unknown>` | `import('express').RequestHandler` | see Call graph |
| `sendError` | `res, err` | res: `import('express').Response`, err: `Error|AppError` | `void` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `constructor` | `message, { status = 500, code = 'INTERNAL_ERROR', details } = {}` |
| `return` | `req, res, next` |
## What it imports / requires
- `./debug/logger.js`
- `./debug/trace-context.js`
## Call graph (identifiers invoked)
`createDebugger`, `details`, `constructor`, `import`, `asyncHandler`, `resolve`, `fn`, `sendError`, `getTraceId`, `error`, `debug`, `status`, `json`
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/index`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/index.js`
**Lines:** 52
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`startServer`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `startServer` | `(none)` | — | `import('http').Server` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `startServer` | `(none)` |
## What it imports / requires
- `./app.js`
- `./config.js`
- `./debug/logger.js`
- `./workers/inProcessJobPoller.js`
- `./nats/connection.js`
- `./workers/jobPollerWorker.js`
- `./workers/webhookWorker.js`
## Call graph (identifiers invoked)
`createDebugger`, `import`, `startServer`, `createApp`, `connectNats`, `then`, `ensureStreams`, `all`, `startJobPollerWorker`, `startWebhookWorker`, `info`, `error`, `startInProcessJobPoller`, `listen`, `log`, `includes`
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,46 @@
# `verae-zapier-middleware/lib/tokens`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/lib/tokens.js`
**Lines:** 98
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`issueSessionToken`, `parseSessionToken`, `generateApiKey`, `isApiKey`, `extractBearerToken`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `sign` | `payload` | payload: `string` | `string` | see Call graph |
| `issueSessionToken` | `{ tenantId, veraeToken, expiresAt }` | params: `object`, params.tenantId: `string`, params.veraeToken: `string`, params.expiresAt: `string` | `string` — Token string starting with `zmt_` | see Call graph |
| `parseSessionToken` | `token` | token: `string` | `{ tenantId: string, veraeToken: string, expiresAt?: string, nonce?: string ` — |null} | see Call graph |
| `generateApiKey` | `(none)` | — | `string` | see Call graph |
| `isApiKey` | `value` | value: `unknown` | `boolean` | see Call graph |
| `extractBearerToken` | `header` | header: `string|undefined` | `string|null` | see Call graph |
## What it imports / requires
- `node:crypto`
- `../config.js`
## Call graph (identifiers invoked)
`sign`, `createHmac`, `update`, `digest`, `issueSessionToken`, `from`, `stringify`, `randomBytes`, `toString`, `parseSessionToken`, `startsWith`, `slice`, `lastIndexOf`, `timingSafeEqual`, `parse`, `key`, `generateApiKey`, `isApiKey`, `extractBearerToken`, `match`
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/middleware/authenticate`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/middleware/authenticate.js`
**Lines:** 28
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`authenticate`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `next` | `(none)` |
## What it imports / requires
- `../lib/tokens.js`
- `../services/authService.js`
- `../errors.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `asyncHandler`, `async`, `extractBearerToken`, `resolveAuthContext`, `debug`, `next`
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,48 @@
# `verae-zapier-middleware/middleware/rateLimit`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/middleware/rateLimit.js`
**Lines:** 57
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`resetRateLimitWindows`, `rateLimit`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `resetRateLimitWindows` | `(none)` | — | `void` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `next` | `(none)` |
## What it imports / requires
- `../errors.js`
- `../store/tenants.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `windows`, `resetRateLimitWindows`, `clear`, `asyncHandler`, `async`, `next`, `getTenant`, `resolveLimits`, `now`, `get`, `set`, `debug`
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,46 @@
# `verae-zapier-middleware/nats/connection`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/nats/connection.js`
**Lines:** 112
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`connectNats`, `ensureStreams`, `closeNats`, `getJetStream`, `isNatsConnected`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `connectNats` | `url = config.natsUrl` | url: `string` | `Promise<{ nc: import('nats').NatsConnection, js: import('nats').JetStreamClient, jsm: import('nats').JetStreamManager ` — >} | see Call graph |
| `ensureStreams` | `manager` | manager: `import('nats').JetStreamManager` | `Promise<void>` | see Call graph |
| `closeNats` | `(none)` | — | `Promise<void>` | see Call graph |
| `getJetStream` | `(none)` | — | `import('nats').JetStreamClient|null` | see Call graph |
| `isNatsConnected` | `(none)` | — | `boolean` | see Call graph |
## What it imports / requires
- `../debug/logger.js`
- `../config.js`
- `./subjects.js`
## Call graph (identifiers invoked)
`createDebugger`, `import`, `connectNats`, `debug`, `disabled`, `info`, `connect`, `jetstream`, `jetstreamManager`, `ensureStreams`, `add`, `closeNats`, `drain`, `getJetStream`, `isNatsConnected`, `isClosed`
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,46 @@
# `verae-zapier-middleware/nats/publishers`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/nats/publishers.js`
**Lines:** 96
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`enqueueWatch`, `publishJobEvent`, `enqueueWebhook`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `requireJs` | `(none)` | — | `Promise<import('nats').JetStreamClient>` | see Call graph |
| `enqueueWatch` | `partial` | partial: `object` | `Promise<{ seq: number ` — >} | see Call graph |
| `publishJobEvent` | `partial` | partial: `object` | `Promise<{ seq: number ` — >} | see Call graph |
| `enqueueWebhook` | `partial` | partial: `object` | `Promise<{ seq: number ` — >} | see Call graph |
## What it imports / requires
- `../debug/logger.js`
- `../debug/trace-context.js`
- `./subjects.js`
- `./connection.js`
## Call graph (identifiers invoked)
`createDebugger`, `import`, `requireJs`, `getJetStream`, `connectNats`, `enqueueWatch`, `toISOString`, `getTraceId`, `debug`, `publish`, `stringify`, `publishJobEvent`, `enqueueWebhook`
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,38 @@
# `verae-zapier-middleware/nats/subjects`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/nats/subjects.js`
**Lines:** 44
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`SUBJECTS`, `STREAMS`, `CONSUMERS`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`freeze`, `names`
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,50 @@
# `verae-zapier-middleware/routes/authRoutes`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/routes/authRoutes.js`
**Lines:** 58
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`authRoutes`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `asyncHandler` | `async (req, res` |
| `asyncHandler` | `async (req, res` |
## What it imports / requires
- `express`
- `../errors.js`
- `../services/authService.js`
- `../store/usage.js`
- `../store/tenants.js`
- `../lib/tokens.js`
## Call graph (identifiers invoked)
`post`, `asyncHandler`, `async`, `loginWithApiKey`, `json`, `loginWithCredentials`, `get`, `extractBearerToken`, `validateSession`, `getTenant`, `getUsageSummary`
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,46 @@
# `verae-zapier-middleware/routes/index`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/routes/index.js`
**Lines:** 34
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`apiRoutes`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## What it imports / requires
- `express`
- `./authRoutes.js`
- `./timestampRoutes.js`
- `./verifyRoutes.js`
- `./statusRoutes.js`
- `./webhookRoutes.js`
- `./tenantRoutes.js`
- `../middleware/authenticate.js`
- `../middleware/rateLimit.js`
## Call graph (identifiers invoked)
`use`
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,48 @@
# `verae-zapier-middleware/routes/statusRoutes`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/routes/statusRoutes.js`
**Lines:** 47
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`statusRoutes`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `asyncHandler` | `async (req, res` |
| `asyncHandler` | `async (req, res` |
| `asyncHandler` | `async (req, res` |
## What it imports / requires
- `express`
- `../errors.js`
- `../services/timestampService.js`
## Call graph (identifiers invoked)
`post`, `asyncHandler`, `async`, `isArray`, `getBatchJobStatus`, `json`, `get`, `getJobVerification`, `getJobStatus`
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,50 @@
# `verae-zapier-middleware/routes/tenantRoutes`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/routes/tenantRoutes.js`
**Lines:** 47
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`publicTenantRoutes`, `adminTenantRoutes`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `asyncHandler` | `async (req, res` |
| `next` | `(none)` |
| `asyncHandler` | `async (req, res` |
| `asyncHandler` | `async (_req, res` |
## What it imports / requires
- `express`
- `../errors.js`
- `../services/tenantService.js`
- `../config.js`
## Call graph (identifiers invoked)
`post`, `asyncHandler`, `async`, `selfServeSignup`, `status`, `json`, `use`, `next`, `provisionTenant`, `get`, `listProvisionedTenants`
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,48 @@
# `verae-zapier-middleware/routes/timestampRoutes`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/routes/timestampRoutes.js`
**Lines:** 50
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`timestampRoutes`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `asyncHandler` | `async (req, res` |
| `asyncHandler` | `async (req, res` |
| `asyncHandler` | `async (req, res` |
## What it imports / requires
- `express`
- `../errors.js`
- `../services/timestampService.js`
## Call graph (identifiers invoked)
`post`, `asyncHandler`, `async`, `createTimestamp`, `status`, `json`, `createTimestampAndWait`, `isArray`, `createBatchTimestamp`
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/routes/verifyRoutes`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/routes/verifyRoutes.js`
**Lines:** 37
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`verifyRoutes`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `asyncHandler` | `async (req, res` |
| `asyncHandler` | `async (req, res` |
## What it imports / requires
- `express`
- `../errors.js`
- `../services/verifyService.js`
## Call graph (identifiers invoked)
`post`, `asyncHandler`, `async`, `verifyTimestamp`, `json`, `isArray`, `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,49 @@
# `verae-zapier-middleware/routes/webhookRoutes`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/routes/webhookRoutes.js`
**Lines:** 45
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`webhookRoutes`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `asyncHandler` | `async (req, res` |
| `asyncHandler` | `async (req, res` |
| `asyncHandler` | `async (req, res` |
## What it imports / requires
- `express`
- `../errors.js`
- `../services/webhookService.js`
- `../store/webhooks.js`
## Call graph (identifiers invoked)
`post`, `asyncHandler`, `async`, `subscribe`, `status`, `json`, `delete`, `unsubscribe`, `get`, `listWebhooksForTenant`
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/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`.

View file

@ -0,0 +1,54 @@
# `verae-zapier-middleware/store/db`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/store/db.js`
**Lines:** 115
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`emptyStore`, `loadStore`, `getStore`, `setStoreForTests`, `persist`, `reloadStore`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `emptyStore` | `(none)` | — | `StoreShape` | see Call graph |
| `loadStore` | `path = config.storePath` | path: `string` | `StoreShape` | see Call graph |
| `getStore` | `(none)` | — | `StoreShape` | see Call graph |
| `setStoreForTests` | `next` | next: `StoreShape|null` | `void` | see Call graph |
| `persist` | `path = config.storePath` | path: `string` | `void` | see Call graph |
| `reloadStore` | `path = config.storePath` | path: `string` | `StoreShape` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `writeFileSync` | `path, JSON.stringify(data, null, 2` |
## What it imports / requires
- `node:fs`
- `node:path`
- `../config.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`store`, `createDebugger`, `emptyStore`, `memory`, `loadStore`, `existsSync`, `readFileSync`, `parse`, `isArray`, `debug`, `keys`, `error`, `getStore`, `setStoreForTests`, `persist`, `dirname`, `mkdirSync`, `writeFileSync`, `stringify`, `disk`, `reloadStore`
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,53 @@
# `verae-zapier-middleware/store/jobWatchers`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/store/jobWatchers.js`
**Lines:** 90
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`enqueueJob`, `listPendingJobs`, `updateJobWatcher`, `removeJobWatcher`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `enqueueJob` | `{ tenantId, jobId, veraeToken, traceId }` | params: `object`, params.tenantId: `string`, params.jobId: `string`, params.veraeToken: `string`, params.traceId: `string` | `JobWatcher` | see Call graph |
| `listPendingJobs` | `(none)` | — | `JobWatcher[]` | see Call graph |
| `updateJobWatcher` | `id, patch` | id: `string`, patch: `Partial<JobWatcher>` | `JobWatcher|null` | see Call graph |
| `removeJobWatcher` | `id` | id: `string` | `void` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `persist` | `(none)` |
| `persist` | `(none)` |
| `persist` | `(none)` |
## What it imports / requires
- `node:crypto`
- `./db.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`queue`, `createDebugger`, `enqueueJob`, `randomUUID`, `toISOString`, `getStore`, `push`, `persist`, `debug`, `listPendingJobs`, `filter`, `updateJobWatcher`, `findIndex`, `removeJobWatcher`
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/store/tenants`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/store/tenants.js`
**Lines:** 138
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`getTenant`, `getTenantByApiKey`, `listTenants`, `upsertTenant`, `createTenant`, `resolveLimits`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `getTenant` | `tenantId` | tenantId: `string` | `Tenant|null` | see Call graph |
| `getTenantByApiKey` | `apiKey` | apiKey: `string` | `Tenant|null` | see Call graph |
| `listTenants` | `(none)` | — | `Tenant[]` | see Call graph |
| `upsertTenant` | `tenant` | tenant: `Tenant` | `Tenant` | see Call graph |
| `createTenant` | `{
id,
name,
plan = 'free',
veraeUsername,
veraePassword,
contract = null,
apiKey = generateApiKey(` | params: `object`, params.id: `string`, params.name: `string`, params.plan: `string`, params.veraeUsername: `string`, params.veraePassword: `string`, params.contract: `object|null`, params.apiKey: `string`, params.metadata: `object` | `{ tenant: Tenant, apiKey: string ` — } | see Call graph |
| `resolveLimits` | `tenant` | tenant: `Tenant` | `{
* timestamps: number|null,
* verifications: number|null,
* batch: boolean,
* batchMaxItems: number|null,
* requestsPerMinute: number,
* allowOverage: boolean,
* overageRates: object
* ` — } | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `persist` | `(none)` |
| `persist` | `(none)` |
## What it imports / requires
- `./db.js`
- `../lib/tokens.js`
- `../config.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `getTenant`, `getStore`, `getTenantByApiKey`, `listTenants`, `values`, `upsertTenant`, `persist`, `debug`, `createTenant`, `generateApiKey`, `toISOString`, `info`, `tenant`, `resolveLimits`
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,53 @@
# `verae-zapier-middleware/store/usage`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/store/usage.js`
**Lines:** 103
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`getUsage`, `getUsageSummary`, `incrementUsage`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `currentPeriod` | `(none)` | — | `string` — YYYY-MM period key | see Call graph |
| `emptyUsage` | `tenantId` | tenantId: `string` | `{ period: string, timestamps: number, verifications: number, statusChecks: number, batchTimestamps: number, overage: object ` — } | see Call graph |
| `getUsage` | `tenantId` | tenantId: `string` | `ReturnType<typeof emptyUsage>` | see Call graph |
| `getUsageSummary` | `tenantId` | tenantId: `string` | `object` | see Call graph |
| `incrementUsage` | `tenantId, metric, amount = 1` | tenantId: `string`, metric: `string`, amount: `number` | `void` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `getStore` | `(none)` |
| `persist` | `(none)` |
## What it imports / requires
- `./db.js`
- `./tenants.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `currentPeriod`, `getUTCFullYear`, `getUTCMonth`, `padStart`, `emptyUsage`, `getUsage`, `getStore`, `getUsageSummary`, `getTenant`, `resolveLimits`, `incrementUsage`, `startsWith`, `slice`, `persist`, `debug`
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,51 @@
# `verae-zapier-middleware/store/webhooks`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/store/webhooks.js`
**Lines:** 92
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`createWebhook`, `deleteWebhook`, `getActiveWebhooks`, `listWebhooksForTenant`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `createWebhook` | `{ tenantId, targetUrl, event }` | params: `object`, params.tenantId: `string`, params.targetUrl: `string`, params.event: `string` | `Webhook` | see Call graph |
| `deleteWebhook` | `{ tenantId, hookId, targetUrl }` | params: `object`, params.tenantId: `string`, params.hookId: `string`, params.targetUrl: `string` | `boolean` — True if at least one webhook was removed. | see Call graph |
| `getActiveWebhooks` | `tenantId, event` | tenantId: `string`, event: `string` | `Webhook[]` | see Call graph |
| `listWebhooksForTenant` | `tenantId` | tenantId: `string` | `Webhook[]` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `persist` | `(none)` |
## What it imports / requires
- `node:crypto`
- `./db.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `createWebhook`, `randomUUID`, `toISOString`, `getStore`, `push`, `persist`, `info`, `deleteWebhook`, `filter`, `getActiveWebhooks`, `listWebhooksForTenant`
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/workers/inProcessJobPoller`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/workers/inProcessJobPoller.js`
**Lines:** 109
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`startInProcessJobPoller`, `stopInProcessJobPoller`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `processJob` | `job` | job: `import('../store/jobWatchers.js').JobWatcher` | `unknown` | see Call graph |
| `tick` | `(none)` | — | `unknown` | see Call graph |
| `startInProcessJobPoller` | `(none)` | — | `void` | see Call graph |
| `stopInProcessJobPoller` | `(none)` | — | `void` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `updateJobWatcher` | `job.id, { attempts }` |
| `updateJobWatcher` | `job.id, { status: status.status }` |
| `removeJobWatcher` | `job.id` |
| `clearInterval` | `timer` |
## What it imports / requires
- `../config.js`
- `../clients/veraeClient.js`
- `../store/jobWatchers.js`
- `../store/webhooks.js`
- `../services/webhookService.js`
- `../debug/logger.js`
## Call graph (identifiers invoked)
`createDebugger`, `import`, `processJob`, `updateJobWatcher`, `removeJobWatcher`, `warn`, `getStatus`, `debug`, `getActiveWebhooks`, `deliverWebhook`, `error`, `tick`, `listPendingJobs`, `all`, `map`, `poller`, `startInProcessJobPoller`, `info`, `skipped`, `setInterval`, `stopInProcessJobPoller`, `clearInterval`
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,50 @@
# `verae-zapier-middleware/workers/jobPollerWorker`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/workers/jobPollerWorker.js`
**Lines:** 159
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`startJobPollerWorker`, `stopJobPollerWorker`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `resolveVeraeToken` | `msg` | msg: `object` | `Promise<string>` | see Call graph |
| `handleWatch` | `data, ctrl` | data: `object` | `unknown` | see Call graph |
| `startJobPollerWorker` | `(none)` | — | `Promise<{ stop: () => Promise<void> ` — >} | see Call graph |
| `stopJobPollerWorker` | `(none)` | — | `Promise<void>` | see Call graph |
## What it imports / requires
- `../debug/logger.js`
- `../config.js`
- `../nats/subjects.js`
- `../nats/connection.js`
- `../nats/publishers.js`
- `../clients/veraeClient.js`
- `../store/tenants.js`
- `../debug/trace.js`
## Call graph (identifiers invoked)
`createDebugger`, `polling`, `resolveVeraeToken`, `getTenant`, `login`, `handleWatch`, `withTrace`, `async`, `publishJobEvent`, `ack`, `getStatus`, `debug`, `nak`, `startJobPollerWorker`, `stopJobPollerWorker`, `connectNats`, `ensureStreams`, `consumer`, `add`, `get`, `info`, `consume`, `parse`, `string`, `error`, `abort`
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,55 @@
# `verae-zapier-middleware/workers/webhookWorker`
**Package:** `verae-zapier-middleware`
**Source:** `packages/verae-zapier-middleware/src/workers/webhookWorker.js`
**Lines:** 139
## What this module is
Implementation module in `verae-zapier-middleware`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`startWebhookWorker`, `stopWebhookWorker`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `handleDeliver` | `data, ctrl` | data: `object` | `unknown` | see Call graph |
| `startWebhookWorker` | `(none)` | — | `Promise<{ stop: () => Promise<void> ` — >} | see Call graph |
| `stopWebhookWorker` | `(none)` | — | `Promise<void>` | see Call graph |
| `runConsumer` | `stream, durable` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `runConsumer` | `STREAMS.ZAPIER_EVENTS, CONSUMERS.EVENT_WEBHOOK_ROUTER` |
| `runConsumer` | `STREAMS.ZAPIER_WEBHOOKS, CONSUMERS.WEBHOOK_DELIVER` |
## What it imports / requires
- `../debug/logger.js`
- `../nats/subjects.js`
- `../nats/connection.js`
- `../services/webhookService.js`
- `../store/webhooks.js`
- `../debug/trace.js`
## Call graph (identifiers invoked)
`createDebugger`, `messages`, `handleDeliver`, `withTrace`, `async`, `getActiveWebhooks`, `deliverWebhook`, `ack`, `warn`, `keys`, `debug`, `nak`, `worker`, `startWebhookWorker`, `stopWebhookWorker`, `connectNats`, `ensureStreams`, `add`, `info`, `get`, `consume`, `parse`, `string`, `error`, `runConsumer`, `abort`
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,41 @@
# `verae-zapier/authentication`
**Package:** `verae-zapier`
**Source:** `packages/verae-zapier/authentication.js`
**Lines:** 39
## What this module is
Implementation module in `verae-zapier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`type`, `fields`, `key`, `required`, `true`, `label`, `helpText`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `middlewareBase` | `(none)` | — | `unknown` | see Call graph |
| `testAuth` | `z, bundle` | z: `object`, bundle: `object` | `unknown` | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`async`, `request`, `middlewareBase`, `key`
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,36 @@
# `verae-zapier/creates/add_numbers`
**Package:** `verae-zapier`
**Source:** `packages/verae-zapier/creates/add_numbers.js`
**Lines:** 3
## What this module is
Implementation module in `verae-zapier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
_No named `export` / `module.exports` keys detected._
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## What it imports / requires
- `../../verae-activate/creates/add_numbers`
## Call graph (identifiers invoked)
_No local call identifiers extracted._
## 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,41 @@
# `verae-zapier/creates/batch_timestamp`
**Package:** `verae-zapier`
**Source:** `packages/verae-zapier/creates/batch_timestamp.js`
**Lines:** 40
## What this module is
Implementation module in `verae-zapier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`key`, `noun`, `display`, `label`, `description`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `base` | `(none)` | — | `unknown` | see Call graph |
| `perform` | `z, bundle` | — | `unknown` | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`async`, `split`, `map`, `trim`, `filter`, `request`, `base`, `timestamping`
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,41 @@
# `verae-zapier/creates/create_timestamp`
**Package:** `verae-zapier`
**Source:** `packages/verae-zapier/creates/create_timestamp.js`
**Lines:** 38
## What this module is
Implementation module in `verae-zapier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`key`, `noun`, `display`, `label`, `description`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `base` | `(none)` | — | `unknown` | see Call graph |
| `perform` | `z, bundle` | — | `unknown` | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`async`, `request`, `base`
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,41 @@
# `verae-zapier/creates/timestamp_and_wait`
**Package:** `verae-zapier`
**Source:** `packages/verae-zapier/creates/timestamp_and_wait.js`
**Lines:** 55
## What this module is
Implementation module in `verae-zapier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`key`, `noun`, `display`, `label`, `description`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `base` | `(none)` | — | `unknown` | see Call graph |
| `perform` | `z, bundle` | — | `unknown` | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`async`, `request`, `base`
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,41 @@
# `verae-zapier/creates/verify_timestamp`
**Package:** `verae-zapier`
**Source:** `packages/verae-zapier/creates/verify_timestamp.js`
**Lines:** 37
## What this module is
Implementation module in `verae-zapier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`key`, `noun`, `display`, `label`, `description`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `base` | `(none)` | — | `unknown` | see Call graph |
| `perform` | `z, bundle` | — | `unknown` | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`async`, `request`, `base`
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,48 @@
# `verae-zapier/index`
**Package:** `verae-zapier`
**Source:** `packages/verae-zapier/index.js`
**Lines:** 79
## What this module is
Implementation module in `verae-zapier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`version`, `platformVersion`, `authentication`, `beforeRequest`, `afterResponse`, `triggers`, `timestampCompleted`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `addApiKey` | `request, _z, bundle` | request: `object`, _z: `object`, bundle: `object` | `unknown` | see Call graph |
| `mapMiddlewareErrors` | `response, z` | response: `object`, z: `object` | `unknown` | see Call graph |
## What it imports / requires
- `./authentication`
- `./creates/timestamp_and_wait`
- `./creates/create_timestamp`
- `./creates/verify_timestamp`
- `./creates/batch_timestamp`
- `./creates/add_numbers`
- `./searches/job_status`
- `./triggers/timestamp_completed`
- `zapier-platform-core`
- `./package.json`
## Call graph (identifiers invoked)
_No local call identifiers extracted._
## 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,41 @@
# `verae-zapier/searches/job_status`
**Package:** `verae-zapier`
**Source:** `packages/verae-zapier/searches/job_status.js`
**Lines:** 34
## What this module is
Implementation module in `verae-zapier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`key`, `noun`, `display`, `label`, `description`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `base` | `(none)` | — | `unknown` | see Call graph |
| `perform` | `z, bundle` | — | `unknown` | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`async`, `request`, `base`, `encodeURIComponent`
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,44 @@
# `verae-zapier/triggers/timestamp_completed`
**Package:** `verae-zapier`
**Source:** `packages/verae-zapier/triggers/timestamp_completed.js`
**Lines:** 54
## What this module is
Implementation module in `verae-zapier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`key`, `noun`, `display`, `label`, `description`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `base` | `(none)` | — | `unknown` | see Call graph |
| `subscribeHook` | `z, bundle` | — | `unknown` | see Call graph |
| `unsubscribeHook` | `z, bundle` | — | `unknown` | see Call graph |
| `perform` | `z, bundle` | — | `unknown` | see Call graph |
| `performList` | `(none)` | — | `unknown` | see Call graph |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`async`, `request`, `base`
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,71 @@
# `zappier/accounts`
**Package:** `zappier`
**Source:** `packages/zappier/src/accounts.ts`
**Lines:** 166
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`hashPassword`, `verifyPassword`, `base32Encode`, `base32Decode`, `hotp`, `totp`, `verifyTotp`, `generateTotpSecret`, `totpUri`, `PortalSession`, `SessionRepo`, `newSessionToken`, `InMemorySessionRepo`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `PortalSession` |
| interface | `SessionRepo` |
| class | `InMemorySessionRepo` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `hashPassword` | `password: string` | — | `unknown` | see Call graph |
| | _Format: scrypt:N:r:p:<salt b64>:<hash b64>_ | | | |
| `verifyPassword` | `password: string, stored: string` | — | `unknown` | see Call graph |
| `base32Encode` | `buf: Buffer` | — | `unknown` | see Call graph |
| `base32Decode` | `s: string` | — | `unknown` | see Call graph |
| `hotp` | `secret: string, counter: number, digits = 6` | — | `unknown` | see Call graph |
| `totp` | `secret: string, atMs: number, stepSec = 30, digits = 6` | — | `unknown` | see Call graph |
| `verifyTotp` | `secret: string,
code: string,
atMs: number,
window = 1,` | — | `unknown` | see Call graph |
| `generateTotpSecret` | `(none)` | — | `unknown` | see Call graph |
| | _160-bit secret, base32 without padding (authenticator-app standard)._ | | | |
| `totpUri` | `secret: string, email: string, issuer = 'Zappier'` | — | `unknown` | see Call graph |
| | _160-bit secret, base32 without padding (authenticator-app standard)._ | | | |
| `newSessionToken` | `(none)` | — | `unknown` | see Call graph |
| | _Returns the session, or undefined when unknown or expired at nowMs._ | | | |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `create` | `customerId: string, ttlMs: number` |
| `get` | `token: string, nowMs?: number` |
| `delete` | `token: string` |
| `create` | `customerId: string, ttlMs: number` |
| `get` | `token: string, nowMs = Date.now(` |
| `delete` | `token: string` |
## What it imports / requires
- `crypto`
## Call graph (identifiers invoked)
`hashing`, `secrets`, `hashPassword`, `randomBytes`, `scryptSync`, `toString`, `verifyPassword`, `split`, `from`, `timingSafeEqual`, `base32`, `base32Encode`, `base32Decode`, `toUpperCase`, `replace`, `indexOf`, `push`, `hotp`, `alloc`, `writeBigUInt64BE`, `createHmac`, `update`, `digest`, `padStart`, `totp`, `floor`, `verifyTotp`, `test`, `padding`, `generateTotpSecret`, `totpUri`, `encodeURIComponent`, `create`, `get`, `delete`, `newSessionToken`, `now`, `set`
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,59 @@
# `zappier/admin-users`
**Package:** `zappier`
**Source:** `packages/zappier/src/admin-users.ts`
**Lines:** 76
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`AdminUser`, `AdminUserRepo`, `newAdminUserId`, `seedAdminUsersFromEnv`, `makeAdminUser`, `InMemoryAdminUserRepo`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `AdminUser` |
| interface | `AdminUserRepo` |
| class | `InMemoryAdminUserRepo` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `newAdminUserId` | `(none)` | — | `unknown` | see Call graph |
| `seedAdminUsersFromEnv` | `(none)` | — | `unknown` | see Call graph |
| | _The env-backed seed accounts (preserved from the pre-table behavior)._ | | | |
| `makeAdminUser` | `username: string, password: string` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `list` | `(none)` |
| `findByUsername` | `username: string` |
| `save` | `user: AdminUser` |
| `list` | `(none)` |
| `findByUsername` | `username: string` |
| `save` | `user: AdminUser` |
## What it imports / requires
- `crypto`
- `./accounts`
## Call graph (identifiers invoked)
`list`, `findByUsername`, `save`, `newAdminUserId`, `randomBytes`, `toString`, `accounts`, `seedAdminUsersFromEnv`, `makeAdminUser`, `hashPassword`, `now`, `constructor`, `map`, `seeded`, `find`, `findIndex`, `push`
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,73 @@
# `zappier/admin`
**Package:** `zappier`
**Source:** `packages/zappier/src/admin.ts`
**Lines:** 486
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`adminLoginRouter`, `adminAuth`, `AccountingDeps`, `renderInvoiceHtml`, `adminRouter`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `AccountingDeps` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `adminLoginRouter` | `users: AdminUserRepo` | — | `unknown` | see Call graph |
| `adminAuth` | `(none)` | — | `unknown` | see Call graph |
| `isValidRule` | `rule: unknown` | — | `unknown` | see Call graph |
| `isValidTier` | `tier: unknown` | — | `unknown` | see Call graph |
| `periodWindow` | `period: string` | — | `unknown` | see Call graph |
| `parseDate` | `value: unknown` | — | `unknown` | see Call graph |
| `escapeHtml` | `s: string` | — | `unknown` | see Call graph |
| `renderInvoiceHtml` | `invoice: Invoice, customerName: string` | — | `unknown` | see Call graph |
| `adminRouter` | `store: PricingStore,
customers: CustomerRepo,
accounting: AccountingDeps,` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `return` | `req, res, next` |
| `return` | `typeof t.name === 'string' &&
typeof t.multiplier === 'number' &&
typeof t.monthlyCreditCents === 'number' &&
(t.defaultRule === undefined || isValidRule(t.defaultRule` |
## What it imports / requires
- `crypto`
- `fs`
- `path`
- `express`
- `./accounts`
- `./admin-users`
- `./auth`
- `./invoicing`
- `./pricing`
- `./paths`
- `./reports`
- `./usage`
## Call graph (identifiers invoked)
`tokens`, `adminLoginRouter`, `post`, `status`, `json`, `findByUsername`, `verifyPassword`, `randomBytes`, `toString`, `set`, `now`, `adminAuth`, `header`, `next`, `startsWith`, `slice`, `has`, `isValidRule`, `every`, `isValidTier`, `periodWindow`, `split`, `map`, `parseDate`, `trim`, `isNaN`, `getTime`, `escapeHtml`, `replace`, `toFixed`, `renderInvoiceHtml`, `dollars`, `join`, `toISOString`, `toUpperCase`, `adminRouter`, `get`, `getRateCard`, `getTiers`, `put`, `upsertEndpoint`, `delete`, `deleteEndpoint`, `upsertTier`, `deleteTier`, `list`, `randomUUID`, `save`, `find`, `test`, `push`, `listFor`, `filter`, `buildInvoice`, `nextSequence`, `type`, `send`, `untouched`, `flatMap`, `billingRows`
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,59 @@
# `zappier/app`
**Package:** `zappier`
**Source:** `packages/zappier/src/app.ts`
**Lines:** 203
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`StoredItem`, `DEFAULT_CUSTOMERS`, `AppDeps`, `buildApp`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `StoredItem` |
| interface | `AppDeps` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `buildApp` | `deps: AppDeps = {}` | — | `unknown` | see Call graph |
## What it imports / requires
- `path`
- `crypto`
- `express`
- `express-openapi-validator`
- `swagger-ui-express`
- `yamljs`
- `./auth`
- `./meter`
- `./billing/credit`
- `./pricing`
- `./usage`
- `./admin`
- `./admin-users`
- `./accounts`
- `./invoicing`
- `./paths`
- `./portal`
## Call graph (identifiers invoked)
`join`, `next`, `parse`, `status`, `json`, `buildApp`, `seeded`, `seedAdminUsersFromEnv`, `rateCard`, `getRateCard`, `tiers`, `getTiers`, `express`, `use`, `load`, `setup`, `adminLoginRouter`, `adminAuth`, `adminRouter`, `static`, `async`, `import`, `toDataURL`, `portalRouter`, `apiKeyAuth`, `middleware`, `get`, `meter`, `post`, `toUpperCase`, `isFinite`, `randomUUID`, `map`, `toISOString`, `unshift`, `filter`, `setUTCDate`, `setUTCHours`, `summaryFor`, `find`, `applyMonthlyCredit`
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,60 @@
# `zappier/auth`
**Package:** `zappier`
**Source:** `packages/zappier/src/auth.ts`
**Lines:** 84
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`BillingType`, `Customer`, `CustomerRepo`, `InMemoryCustomerRepo`, `apiKeyAuth`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `Customer` |
| interface | `CustomerRepo` |
| type | `BillingType` |
| class | `InMemoryCustomerRepo` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `apiKeyAuth` | `repo: CustomerRepo` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `findByApiKey` | `apiKey: string` |
| `findByEmail` | `email: string` |
| `list` | `(none)` |
| `save` | `customer: Customer` |
| `constructor` | `customers: Customer[] = []` |
| `findByApiKey` | `apiKey: string` |
| `findByEmail` | `email: string` |
| `list` | `(none)` |
| `save` | `customer: Customer` |
| `return` | `req, res, next` |
## What it imports / requires
- `express`
## Call graph (identifiers invoked)
`findByApiKey`, `findByEmail`, `list`, `save`, `constructor`, `arrays`, `map`, `find`, `toLowerCase`, `findIndex`, `push`, `apiKeyAuth`, `header`, `status`, `json`, `next`
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,44 @@
# `zappier/billing/credit`
**Package:** `zappier`
**Source:** `packages/zappier/src/billing/credit.ts`
**Lines:** 20
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`BilledSummary`, `applyMonthlyCredit`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `BilledSummary` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `applyMonthlyCredit` | `summary: UsageSummary,
tier: TierConfig,` | — | `unknown` | see Call graph |
## What it imports / requires
- `../pricing`
- `../usage`
## Call graph (identifiers invoked)
`applyMonthlyCredit`, `min`
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 @@
# `zappier/billing/reload`
**Package:** `zappier`
**Source:** `packages/zappier/src/billing/reload.ts`
**Lines:** 32
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`stripePaymentClient`, `hasRealStripeKey`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `stripePaymentClient` | `secretKey: string` | — | `unknown` | see Call graph |
| `hasRealStripeKey` | `key: string \| undefined` | — | `unknown` | see Call graph |
| | _True when the key looks usable (not empty / not the setup placeholder)._ | | | |
## What it imports / requires
- `stripe`
- `../portal`
## Call graph (identifiers invoked)
`confirms`, `stripePaymentClient`, `async`, `create`, `usable`, `hasRealStripeKey`, `startsWith`
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,60 @@
# `zappier/billing/stripe`
**Package:** `zappier`
**Source:** `packages/zappier/src/billing/stripe.ts`
**Lines:** 42
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`METER_EVENT_NAME`, `MeterEventClient`, `computeBillableCents`, `computeDelta`, `reportUsage`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `MeterEventClient` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `computeBillableCents` | `entries: UsageEntry[], monthlyCreditCents: number` | — | `unknown` | see Call graph |
| | _Stripe-side dedup key; events with the same identifier are dropped._ | | | |
| `computeDelta` | `billableCents: number, previouslyReportedCents: number` | — | `unknown` | see Call graph |
| `reportUsage` | `client: MeterEventClient,
stripeCustomerId: string,
entries: UsageEntry[],
monthlyCreditCents: number,` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `createMeterEvent` | `params: {
eventName: string;
customerId: string;
value: string;
/** Stripe-side dedup key; events with the same identifier are dropped. */
identifier?: string;
}` |
## What it imports / requires
- `../usage`
## Call graph (identifiers invoked)
`createMeterEvent`, `computeBillableCents`, `reduce`, `max`, `computeDelta`, `ts`, `reportUsage`
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,51 @@
# `zappier/db/admin-user-repo`
**Package:** `zappier`
**Source:** `packages/zappier/src/db/admin-user-repo.ts`
**Lines:** 72
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`SqliteAdminUserRepo`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| class | `SqliteAdminUserRepo` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `toAdminUser` | `r: Record<string, unknown>` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `list` | `(none)` |
| `findByUsername` | `username: string` |
| `save` | `user: AdminUser` |
## What it imports / requires
- `better-sqlite3`
- `../admin-users`
## Call graph (identifiers invoked)
`constructor`, `exec`, `admin_users`, `seeded`, `prepare`, `get`, `save`, `makeAdminUser`, `list`, `all`, `map`, `findByUsername`, `toAdminUser`, `run`
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 @@
# `zappier/db/billing-repo`
**Package:** `zappier`
**Source:** `packages/zappier/src/db/billing-repo.ts`
**Lines:** 69
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`BillingReportRepo`, `JobLockRepo`, `SqliteBillingReportRepo`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `BillingReportRepo` |
| interface | `JobLockRepo` |
| class | `SqliteBillingReportRepo` |
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `getReportedCents` | `customerId: string, period: string` |
| `upsertReportedCents` | `customerId: string, period: string, cumulativeCents: number` |
| `tryAcquireLock` | `name: string, ttlMs: number` |
| `releaseLock` | `name: string` |
| `constructor` | `private db: Database.Database,
private now: (` |
| `getReportedCents` | `customerId: string, period: string` |
| `upsertReportedCents` | `customerId: string, period: string, cumulativeCents: number` |
| `tryAcquireLock` | `name: string, ttlMs: number` |
| `releaseLock` | `name: string` |
## What it imports / requires
- `better-sqlite3`
## Call graph (identifiers invoked)
`getReportedCents`, `upsertReportedCents`, `tryAcquireLock`, `releaseLock`, `constructor`, `exec`, `billing_reports`, `job_locks`, `prepare`, `get`, `run`, `now`
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,53 @@
# `zappier/db/customer-repo`
**Package:** `zappier`
**Source:** `packages/zappier/src/db/customer-repo.ts`
**Lines:** 113
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`SqliteCustomerRepo`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| class | `SqliteCustomerRepo` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `toCustomer` | `r: Record<string, unknown>` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `constructor` | `private db: Database.Database, seed: Customer[] = []` |
| `findByApiKey` | `apiKey: string` |
| `findByEmail` | `email: string` |
| `list` | `(none)` |
| `save` | `customer: Customer` |
## What it imports / requires
- `better-sqlite3`
- `../auth`
## Call graph (identifiers invoked)
`constructor`, `exec`, `customers`, `ensureColumn`, `prepare`, `get`, `save`, `table_info`, `all`, `some`, `findByApiKey`, `toCustomer`, `findByEmail`, `lower`, `list`, `map`, `run`
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,51 @@
# `zappier/db/invoice-repo`
**Package:** `zappier`
**Source:** `packages/zappier/src/db/invoice-repo.ts`
**Lines:** 120
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`SqliteInvoiceRepo`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| class | `SqliteInvoiceRepo` |
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `constructor` | `private db: Database.Database` |
| `save` | `invoice: Invoice` |
| `get` | `id: string` |
| `list` | `filter: { customerId?: string; period?: string; status?: Invoice['status'] }` |
| `nextSequence` | `period: string` |
## What it imports / requires
- `better-sqlite3`
- `../invoicing`
## Call graph (identifiers invoked)
`constructor`, `exec`, `invoices`, `invoice_lines`, `save`, `prepare`, `run`, `get`, `toInvoice`, `list`, `push`, `join`, `all`, `map`, `nextSequence`
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,55 @@
# `zappier/db/pricing-store`
**Package:** `zappier`
**Source:** `packages/zappier/src/db/pricing-store.ts`
**Lines:** 107
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`SqlitePricingStore`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| class | `SqlitePricingStore` |
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `constructor` | `private db: Database.Database,
seedCard: RateCard = DEFAULT_RATE_CARD,
seedTiers: TierConfig[] = DEFAULT_TIERS,` |
| `getRateCard` | `(none)` |
| `getTiers` | `(none)` |
| `upsertEndpoint` | `endpointId: string, rule: PriceRule` |
| `deleteEndpoint` | `endpointId: string` |
| `upsertTier` | `tier: TierConfig` |
| `deleteTier` | `tierId: string` |
## What it imports / requires
- `better-sqlite3`
- `../pricing`
## Call graph (identifiers invoked)
`constructor`, `exec`, `price_endpoints`, `tiers`, `prepare`, `get`, `entries`, `upsertEndpoint`, `upsertTier`, `getRateCard`, `all`, `parse`, `getTiers`, `map`, `run`, `stringify`, `deleteEndpoint`, `deleteTier`
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,50 @@
# `zappier/db/session-repo`
**Package:** `zappier`
**Source:** `packages/zappier/src/db/session-repo.ts`
**Lines:** 52
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`SqliteSessionRepo`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| class | `SqliteSessionRepo` |
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `constructor` | `private db: Database.Database` |
| `create` | `customerId: string, ttlMs: number` |
| `get` | `token: string, nowMs = Date.now(` |
| `delete` | `token: string` |
## What it imports / requires
- `better-sqlite3`
- `../accounts`
## Call graph (identifiers invoked)
`constructor`, `exec`, `portal_sessions`, `create`, `now`, `newSessionToken`, `prepare`, `run`, `get`, `delete`
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,50 @@
# `zappier/db/usage-repo`
**Package:** `zappier`
**Source:** `packages/zappier/src/db/usage-repo.ts`
**Lines:** 62
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`SqliteUsageRepo`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| class | `SqliteUsageRepo` |
## Functions
_No top-level functions extracted._
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `constructor` | `private db: Database.Database` |
| `record` | `entry: UsageEntry` |
| `listFor` | `customerId: string, since?: Date` |
| `summaryFor` | `customerId: string, since?: Date` |
## What it imports / requires
- `better-sqlite3`
- `../usage`
## Call graph (identifiers invoked)
`constructor`, `exec`, `usage_entries`, `record`, `prepare`, `run`, `getTime`, `listFor`, `all`, `map`, `summaryFor`, `summarize`
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,51 @@
# `zappier/index`
**Package:** `zappier`
**Source:** `packages/zappier/src/index.ts`
**Lines:** 42
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
_No named `export` / `module.exports` keys detected._
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## What it imports / requires
- `path`
- `better-sqlite3`
- `dotenv`
- `./app`
- `./admin-users`
- `./billing/reload`
- `./db/admin-user-repo`
- `./db/customer-repo`
- `./db/invoice-repo`
- `./db/pricing-store`
- `./db/session-repo`
- `./db/usage-repo`
- `./paths`
- `./portal`
## Call graph (identifiers invoked)
`loadEnv`, `join`, `seeded`, `seedAdminUsersFromEnv`, `immediately`, `hasRealStripeKey`, `stripePaymentClient`, `async`, `buildApp`, `listen`, `log`
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,75 @@
# `zappier/invoicing`
**Package:** `zappier`
**Source:** `packages/zappier/src/invoicing.ts`
**Lines:** 107
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`InvoiceLine`, `Invoice`, `InvoiceRepo`, `InMemoryInvoiceRepo`, `buildInvoice`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `InvoiceLine` |
| interface | `Invoice` |
| interface | `InvoiceRepo` |
| class | `InMemoryInvoiceRepo` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `buildInvoice` | `args: {
customer: Customer;
period: string;
sequence: number;
entries: UsageEntry[];
tier: TierConfig;
poNumber?: string;
}` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `save` | `invoice: Invoice` |
| `get` | `id: string` |
| `list` | `filter: {
customerId?: string;
period?: string;
status?: Invoice['status'];
}` |
| `nextSequence` | `period: string` |
| `save` | `invoice: Invoice` |
| `get` | `id: string` |
| `list` | `filter: {
customerId?: string;
period?: string;
status?: Invoice['status'];
}` |
| `nextSequence` | `period: string` |
## What it imports / requires
- `./auth`
- `./pricing`
- `./usage`
## Call graph (identifiers invoked)
`cents`, `save`, `get`, `list`, `nextSequence`, `set`, `map`, `values`, `filter`, `sort`, `localeCompare`, `buildInvoice`, `reduce`, `min`, `padStart`
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,63 @@
# `zappier/jobs/report-usage`
**Package:** `zappier`
**Source:** `packages/zappier/src/jobs/report-usage.ts`
**Lines:** 130
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`ReportUsageDeps`, `REPORT_USAGE_LOCK`, `firstOfMonthUtc`, `reportMonthlyUsage`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `ReportUsageDeps` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `firstOfMonthUtc` | `now: Date` | — | `unknown` | see Call graph |
| `reportMonthlyUsage` | `deps: ReportUsageDeps` | — | `unknown` | see Call graph |
| `main` | `(none)` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `loadEnv` | `{ path: path.join(PROJECT_ROOT, '.env'` |
| `main` | `(none)` |
## What it imports / requires
- `better-sqlite3`
- `path`
- `stripe`
- `../app`
- `../auth`
- `../billing/stripe`
- `../db/billing-repo`
- `../db/customer-repo`
- `../db/pricing-store`
- `../db/usage-repo`
- `../paths`
- `../pricing`
- `../usage`
## Call graph (identifiers invoked)
`firstOfMonthUtc`, `setUTCDate`, `setUTCHours`, `reportMonthlyUsage`, `tryAcquireLock`, `log`, `toISOString`, `slice`, `list`, `find`, `warn`, `listFor`, `computeBillableCents`, `getReportedCents`, `computeDelta`, `createMeterEvent`, `upsertReportedCents`, `releaseLock`, `main`, `import`, `loadEnv`, `join`, `async`, `create`, `getTiers`, `error`, `exit`
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,50 @@
# `zappier/meter`
**Package:** `zappier`
**Source:** `packages/zappier/src/meter.ts`
**Lines:** 49
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`meter`
## Types / interfaces / classes
_None extracted._
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `meter` | `endpointId: string,
repo: UsageRepo,
pricing: PricingContext,` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `return` | `req, res, next` |
## What it imports / requires
- `express`
- `./pricing`
- `./usage`
## Call graph (identifiers invoked)
`meter`, `status`, `json`, `byteLength`, `stringify`, `reduce`, `quoteCall`, `record`, `next`
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,38 @@
# `zappier/paths`
**Package:** `zappier`
**Source:** `packages/zappier/src/paths.ts`
**Lines:** 10
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`PROJECT_ROOT`
## Types / interfaces / classes
_None extracted._
## Functions
_No top-level functions extracted._
## What it imports / requires
- `path`
## Call graph (identifiers invoked)
`directory`, `join`
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,63 @@
# `zappier/portal`
**Package:** `zappier`
**Source:** `packages/zappier/src/portal.ts`
**Lines:** 285
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`PaymentResult`, `PaymentClient`, `PortalDeps`, `portalRouter`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `PaymentResult` |
| interface | `PaymentClient` |
| interface | `PortalDeps` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `publicProfile` | `c: Customer` | — | `unknown` | see Call graph |
| | _Profile payload safe to return to the customer (no hashes/secrets)._ | | | |
| `sessionAuth` | `deps: PortalDeps` | — | `unknown` | see Call graph |
| `save` | `deps: PortalDeps, customer: Customer` | — | `unknown` | see Call graph |
| `portalRouter` | `deps: PortalDeps` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `reload` | `customer: Customer, amountCents: number` |
| `return` | `req, res, next` |
## What it imports / requires
- `crypto`
- `express`
- `./accounts`
- `./admin`
- `./auth`
- `./billing/credit`
- `./invoicing`
- `./pricing`
- `./usage`
## Call graph (identifiers invoked)
`now`, `reload`, `customer`, `publicProfile`, `sessionAuth`, `header`, `startsWith`, `slice`, `get`, `list`, `find`, `status`, `json`, `next`, `save`, `portalRouter`, `post`, `trim`, `test`, `hashPassword`, `findByEmail`, `randomBytes`, `toString`, `create`, `verifyPassword`, `verifyTotp`, `use`, `delete`, `setUTCDate`, `setUTCHours`, `summaryFor`, `tiers`, `applyMonthlyCredit`, `rateCard`, `type`, `send`, `renderInvoiceHtml`, `async`, `generateTotpSecret`, `totpUri`, `qr`, `isInteger`, `put`
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,78 @@
# `zappier/pricing`
**Package:** `zappier`
**Source:** `packages/zappier/src/pricing.ts`
**Lines:** 171
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`PriceRule`, `TierConfig`, `RateCard`, `TierCatalog`, `ConfigTierCatalog`, `CallUsage`, `Quote`, `PricingContext`, `PricingStore`, `DEFAULT_RATE_CARD`, `DEFAULT_TIERS`, `DEFAULT_PRICING`, `InMemoryPricingStore`, `quoteCall`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `TierConfig` |
| interface | `RateCard` |
| interface | `TierCatalog` |
| interface | `CallUsage` |
| interface | `Quote` |
| interface | `PricingContext` |
| interface | `PricingStore` |
| type | `PriceRule` |
| class | `ConfigTierCatalog` |
| class | `InMemoryPricingStore` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `quoteCall` | `pricing: PricingContext,
tierId: string,
endpointId: string,
usage: CallUsage,
multiplierOverride?: number,` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `find` | `id: string` |
| `list` | `(none)` |
| `constructor` | `private tiers: TierConfig[]` |
| `find` | `id: string` |
| `list` | `(none)` |
| `getRateCard` | `(none)` |
| `getTiers` | `(none)` |
| `upsertEndpoint` | `endpointId: string, rule: PriceRule` |
| `deleteEndpoint` | `endpointId: string` |
| `upsertTier` | `tier: TierConfig` |
| `deleteTier` | `tierId: string` |
| `constructor` | `rateCard: RateCard = DEFAULT_RATE_CARD, tiers: TierConfig[] = DEFAULT_TIERS` |
| `getRateCard` | `(none)` |
| `getTiers` | `(none)` |
| `upsertEndpoint` | `endpointId: string, rule: PriceRule` |
| `deleteEndpoint` | `endpointId: string` |
| `upsertTier` | `tier: TierConfig` |
| `deleteTier` | `tierId: string` |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`find`, `list`, `constructor`, `getRateCard`, `getTiers`, `upsertEndpoint`, `deleteEndpoint`, `upsertTier`, `deleteTier`, `findIndex`, `push`, `filter`, `quoteCall`, `ceil`, `round`
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,56 @@
# `zappier/reports`
**Package:** `zappier`
**Source:** `packages/zappier/src/reports.ts`
**Lines:** 99
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`BillingRow`, `billingRows`, `TrendPoint`, `usageTrend`, `CsvColumn`, `toCsv`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `BillingRow` |
| interface | `TrendPoint` |
| interface | `CsvColumn` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `billingRows` | `args: {
entries: UsageEntry[];
customers: Customer[];
tiers: TierConfig[];
from?: Date;
to?: Date;
customerId?: string;
billingType?: BillingType;
}` | — | `unknown` | see Call graph |
| `usageTrend` | `entries: UsageEntry[], bucket: 'day' \| 'week'` | — | `unknown` | see Call graph |
| | _Day bucket: YYYY-MM-DD. Week bucket: the Monday (UTC) of that week, YYYY-MM-DD._ | | | |
## What it imports / requires
- `./auth`
- `./pricing`
- `./usage`
## Call graph (identifiers invoked)
`billingRows`, `filter`, `map`, `reduce`, `find`, `min`, `usageTrend`, `setUTCHours`, `getUTCDay`, `setUTCDate`, `getUTCDate`, `toISOString`, `slice`, `key`, `get`, `set`, `values`, `sort`, `localeCompare`, `test`, `replace`, `cell`, `join`, `push`
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,56 @@
# `zappier/usage`
**Package:** `zappier`
**Source:** `packages/zappier/src/usage.ts`
**Lines:** 55
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`UsageEntry`, `UsageSummary`, `summarize`, `UsageRepo`, `InMemoryUsageRepo`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| interface | `UsageEntry` |
| interface | `UsageSummary` |
| interface | `UsageRepo` |
| class | `InMemoryUsageRepo` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `summarize` | `customerId: string, list: UsageEntry[]` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `record` | `entry: UsageEntry` |
| `listFor` | `customerId: string, since?: Date` |
| `summaryFor` | `customerId: string, since?: Date` |
| `record` | `entry: UsageEntry` |
| `listFor` | `customerId: string, since?: Date` |
| `summaryFor` | `customerId: string, since?: Date` |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`summarize`, `reduce`, `record`, `listFor`, `summaryFor`, `push`, `filter`
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`.