master-zapier-plan-draft/docs/sphinx/modules/zappier/billing-nats.md
George Lambert 1b199ca4d4
Some checks are pending
offline / test (push) Waiting to run
Separate Zapier, web, API, and leaf access planes with NATS authz
Zapier is one ingress. Direct web, customer API, and S2S leaf nodes are their own services. Every hop to an internal subject must pass verae.access.authz.check (default deny by plane).
2026-09-11 16:05:05 -04:00

66 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

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

# `zappier/billing-nats`
**Package:** `zappier`
**Source:** `packages/zappier/src/billing-nats.ts`
**Lines:** 130
## What this module is
Implementation module in `zappier`. The tables below are extracted from the source (signatures + JSDoc).
## Exports
`BILLING_SUBJECTS`, `AUTHZ_CHECK`, `AccessPlane`, `BillingStatement`, `natsStatement`, `natsAdjust`, `natsPublish`
## Types / interfaces / classes
| Kind | Name |
|------|------|
| type | `AccessPlane` |
| type | `BillingStatement` |
| type | `Nc` |
## Functions
| Name | Parameters | Param types (JSDoc) | Returns | Calls (same file / helpers) |
|------|------------|---------------------|---------|-----------------------------|
| `nc` | `(none)` | — | `unknown` | see Call graph |
| `encode` | `obj: unknown` | — | `unknown` | see Call graph |
| `decode` | `buf: Uint8Array` | — | `unknown` | see Call graph |
| `authzAllow` | `plane: AccessPlane,
subject: string,
extra: { principal?: string; kind?: string } = {},` | — | `unknown` | see Call graph |
| `natsStatement` | `customerId: string,
plane: AccessPlane = 'web',` | — | `unknown` | see Call graph |
| `natsAdjust` | `payload: {
customerId: string;
cents: number;
reason: string;
agent: string;
kind?: string;
},
plane: AccessPlane = 'staff',` | — | `unknown` | see Call graph |
| `natsPublish` | `subject: string, payload: unknown, plane: AccessPlane = 'api'` | — | `unknown` | see Call graph |
## Methods (class / object)
| Name | Parameters |
|------|------------|
| `void` | `async (` |
## What it imports / requires
_No imports detected._
## Call graph (identifiers invoked)
`unset`, `nc`, `async`, `import`, `connect`, `split`, `encode`, `stringify`, `decode`, `parse`, `authzAllow`, `request`, `fetch`, `replace`, `json`, `natsStatement`, `natsAdjust`, `natsPublish`, `void`, `publish`
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`.