billerapi-projection
v0.1.0
Published
BillerAPI public projection envelope validation and presentation
Readme
billerapi-projection
Public BillerAPI projection envelope validators, helpers, types and presentation. Supports Node 18.20+, browser bundlers and mobile JavaScript without Node globals. The only runtime dependency is Zod 3.25.58. Hermes acceptance remains a release gate.
import { ProjectionEnvelopeV2Schema, composeProjectionPresentation } from 'billerapi-projection';
const validated = ProjectionEnvelopeV2Schema.safeParse(response.envelope);
const presentation = composeProjectionPresentation(response.envelope);Both CommonJS require('billerapi-projection') and native ESM imports have public
entries and declarations. The package root, /webhook-contracts, and
/error-catalog are public entrypoints; generated internals are not.
Unknown/malformed envelopes fail closed to UNKNOWN rather than claiming
completeness. Validation retains producer tuple, claim, generation and combined
byte-budget refinements.
Producer build and verification
The nine files under src/generated/ are committed inputs. pnpm run build
consumes them through tsup, pnpm run type-check checks them with TypeScript,
and prepack builds. Neither local command regenerates or checks producer
freshness. The separate gateway exporter with --projection-only generates or
checks those inputs without Nest application bootstrap/config/environment
loading. Check mode writes nothing.
Installed consumers receive only built code/types and never invoke the producer generator.
The canonical inputs are products/billerapi/packages/operator-contracts/src/projection-envelope.ts
and the two exported common schemas OperatorIdSchema/OperatorTimestampSchema
from products/billerapi/packages/operator-contracts/src/common.ts. Generation copies the complete
envelope implementation and original common initializers; it rewrites only the
common import. Never edit generated source or reconstruct validators from JSON
Schema. PROJECTION_SOURCE_PROVENANCE records deterministic SHA-256 input and
exporter hashes. No timestamps, local paths or credentials enter the artifact.
The owner-local suites in test/ load only this package's compiled public
CommonJS entries, using the product-local ../../jest.base.cjs. They reuse the
existing public envelope assertions, independent 432-state presentation oracle,
UTF-8 budgets, malformed-input and negative controls. Tests require an existing
build; they have no private-source or silent generation fallback.
Private legacy outer-freshness helpers, the v1 bridge cases and their coupled
absence control stay in the complete canonical producer suite. Its canonical
source/provenance checks remain separate. test:artifact and
test:webhook-artifact run these local suites with declared owner tools.
Canonical producer artifact-mode suites run separately when BillerAPI is selected,
after its successful owner build; unrelated website changes do not add that work.
The canonical producer checks bind envelope, common and exporter source,
tracked generated inputs, package/build configuration and toolchain/lock inputs.
Owner checks run directly; generated source is tracked input and dist is output.
Do not add a private producer package as a runtime dependency to establish order.
Before publication: execute generation/check and stale-input controls, the shared artifact suite, clean build/type checks, packed CJS/native ESM/declaration imports, private-import/closure and package-size checks, Node floor, browser and Hermes validation/presentation/UTF-8 byte-budget checks. Publish and verify the exact artifact before retargeting BillEBox consumers; this source packet does not make the package released or remove private operator/payment boundary blockers.
Unpublished webhook validator subpath
The additive billerapi-projection/webhook-contracts candidate exports
parseReadinessManifest, the ReadinessManifest type,
LinkFailureReasonCorrectedWebhookSchema, BillUpdatedChange, and
LinkDisconnectedReason. The package-root exports are unchanged.
This packages existing wire behavior; it adds no protocol, authentication or
signature capability. Version 0.1.0 remains unpublished and unapproved for normal
BillEBox consumption pending ownership/license and release acceptance.
The same producer generation step copies the complete import-free
packages/event-bus/src/readiness-manifest.ts and extracts exactly seven canonical
const statements from packages/event-bus/src/catalog/payloads/link.payloads.ts:
isoDateString, both CORRECTABLE_LINK_*_REASONS arrays, both
correctable*Reason schemas, linkFailureReasonCorrectedWebhookBase, and
LinkFailureReasonCorrectedWebhookSchema. Original initializer/body text and
Zod's default key stripping are retained. No internal event schema is exported.
Additional helper/import references fail generation until explicitly reviewed.
The packed subpath has dist/webhook-contracts.js, .mjs, and .d.ts entries
(plus build-produced maps/declarations). dist/webhook-contracts.provenance.json
binds the two event-bus producer files and exporter by SHA-256. It is packed data,
not a new runtime export/import. The root's existing three-input provenance
contract stays intact. The tsup config's Node file copy runs only during build;
emitted runtime dependencies remain Zod only.
The owner-local webhook suites reuse the exact readiness-manifest assertions and the public correction schema's accepted, historical and refusal cases. Internal event schemas and producer-Zod documentation reflection stay in the canonical event-bus suite. The local positive correction case omits compatibility id/object fields, preserving the existing proof that those fields are optional. These focused tests do not replace the event-bus coverage campaign or required producer freshness and compatibility checks. Root/integration must additionally enroll both event-bus source inputs in cache, selection and release hashes, the subpath assets/exports in the public contract, and the artifact-mode environment in the existing test cohort. Own-root install, build, packed CJS/native ESM/types, dependency closure, Node-floor, browser/Hermes, owner/license approval and verified released-artifact gates remain mandatory.
The nine files under src/generated/ are committed public source inputs produced
by the canonical gateway exporter. The owner build and type check consume them
locally; neither command regenerates from private sibling source. Producer
updates require genuine generation under normal admission, review and commit of
the resulting files. From the complete repository, the existing command is
pnpm --dir apps/billerapi/backend/api-gateway run generate:openapi --projection-only.
Do not hand-author wire contracts or bypass admission to refresh them.
Canonical CI separately runs check:openapi --projection-only before owner
checks and refuses stale or missing bytes without writing them. Producer-side
source, private helper and artifact compatibility checks remain separate from
these portable public assertions. Independent root commands execute directly
without Turbo caching. A sibling-absent export still needs its own real
install/build/test/type-check/lint proof; source review is not acceptance.
Publication and BillEBox adoption remain gated separately.
Release status and distribution terms
[email protected] is the reviewed first release, with root,
./webhook-contracts, and ./error-catalog exports. It is not yet
published: no version of billerapi-projection is on the public npm registry.
On 2026-10-25 the owner approved public npm distribution under the BillerAPI SDK
License (license: "SEE LICENSE IN LICENSE"). That license file is byte-identical
to the one shipped by the published billerapi, billerapi-js,
billerapi-react and billerapi-cli packages. The license is proprietary: the
public access field allows anyone to download the package, but it grants no
rights beyond the license. The manifest declares
publishConfig.access: public, Node >=18.20, and only [email protected] at
runtime.
config/projection-release-intent.json records the release. The only
publication path is .github/workflows/publish-npm.yml from main. That
workflow builds and packs, checks that the archive holds exactly the 23 members
in config/projection-candidate-contract.json, and writes the release-set
receipt. It then runs the browser and Hermes proofs at the same SHA. Each proof
is a --full candidate proof, so it also re-runs the producer freshness check.
The validator accepts a proof only when its receipt is VALID and certifies the
same tarball SHA-256 as the release receipt. The publish job needs both proofs
to pass, then publishes the verified tarball with OIDC trusted publishing. Each
run needs its own npm-publish deployment approval from the release owner. A
direct npm publish or pnpm publish from this folder fails in
prepublishOnly.
After publication, independently refetch that version with
refetch-public-proof.mjs --cohort projection --live-registry --full before any
consumer retargets to it. Keep existing BillEBox imports until the refetched
artifact resolves in an isolated consumer. Record the old consumer dependency
and lockfile as the rollback target; a failed rollout restores that target and
rechecks its resolver. Do not rely on unpublishing, mutable tags, or a source
checkout as rollback. A later fixed archive requires a new version and its own
approval and proof.
Source inspection can confirm the declared export paths and producer hashes, but cannot prove the packed CJS/native ESM/type entrypoints, the Node 18.20 floor, browser bundling/behavior, Hermes/mobile behavior, or sibling-absent dependency closure. Those require current-head producer freshness, an admitted pack and clean installed-consumer probes, including validation, presentation, and UTF-8 byte-budget behavior in browser and Hermes. The existing Chromium candidate proof is Chromium-only; it does not satisfy Hermes. Bind all results to the exact archive and consumer version before release approval.
Unpublished error catalogue subpath
The additive billerapi-projection/error-catalog source candidate exports the
complete APPLICATION_ERROR_CODES data table and the ApplicationErrorCode,
ApplicationErrorCodeEntry, and ErrorType types. Each entry contains exactly
code, type, retryable, numeric httpStatus, hint, and docs_url, already
used by the canonical HTTP error contract. It adds no error capability, dynamic
messages, request data, diagnostics, server helpers or Nest runtime imports.
The separate gateway ERROR_CATALOG is not merged into this registry.
The existing --projection-only generator evaluates only the canonical
products/billerapi/packages/application-error-codes/src/application-error-codes.ts source (whose
producer-only dependency is Nest's HttpStatus), validates the exact public
fields, and serializes the complete registry as data. It does not load the
server-helper barrel or bootstrap/configure Nest. Other wire generation keeps
its existing path. The packed error-catalog.provenance.json records registry
and exporter hashes plus the canonical data digest. Before accepting archive
provenance, the proof runs the existing producer check:openapi --projection-only
path and captures the digest from its verified producer output, separately from
the untrusted archive/installation. Missing or stale producer output refuses,
including prepacked/no-build diagnostics. Installed CJS/ESM probes check the exact
export/type surfaces, complete canonical code inventory, six-field shape and
that independently captured digest. A candidate cannot choose its own expected
digest by rewriting its table and provenance together.
The tracked generated source has recorded producer provenance. Actual packed
artifact, Node-floor and clean-export verification remain separate requirements.
The root export surface, package version/license and publication authority stay unchanged. Existing ownership/license, registry, clean-export, Node-floor, browser/Hermes and released-artifact gates still apply. BillEBox must retain its current imports until an approved published artifact is independently verified and pinned; this candidate does not authorize consumer cutover.
