@cedarplanters/reporting-contracts
v1.0.3
Published
Zero-runtime, zero-dependency TypeScript package. Defines every type that crosses the iframe boundary between the shell and view plugins.
Readme
@cedarplanters/reporting-contracts
Zero-runtime, zero-dependency TypeScript package.
Defines every type that crosses the iframe boundary between the shell app and view plugins.
Install
npm install @cedarplanters/reporting-contractsExports
| File | Export | Shell | View | Purpose |
|---|---|:---:|:---:|---|
| auth.ts | AuthToken | ✓ | ✓ | JWT payload — sent in INIT |
| theme.ts | DesignTokens | ✓ | ✓ | CSS token map |
| theme.ts | TokenKey | | ✓ | Type-safe var(--token-*) names |
| datasource.ts | ColumnSchema | ✓ | ✓ | Field type info in query results |
| datasource.ts | DatasourceParam | ✓ | | Param definition shape |
| datasource.ts | QueryResult | ✓ | ✓ | Typed query response |
| bridge.ts | ShellMessage | ✓ send | ✓ receive | Messages shell sends to iframe |
| bridge.ts | PluginMessage | ✓ receive | ✓ send | Messages view sends to shell |
| bridge.ts | InitPayload | ✓ | ✓ | INIT message payload |
| bridge.ts | QueryRequestPayload | ✓ | ✓ | QUERY_REQUEST payload |
| bridge.ts | QueryResponsePayload | ✓ | ✓ | QUERY_RESPONSE payload |
| bridge.ts | QueryLoadingPayload | ✓ | ✓ | QUERY_LOADING payload (loading state per request) |
| bridge.ts | ExportPayload | ✓ | ✓ | EXPORT message payload |
| bridge.ts | BridgeMessage | ✓ | ✓ | Union of all messages |
| bridge.ts | isShellMessage | | ✓ | Type guard for incoming messages |
| bridge.ts | isPluginMessage | ✓ | | Type guard for incoming messages |
Build
npm run buildUpdate & Publish Workflow
After making changes to any contract types:
# 1. Build the contracts
npm run build -w reporting-contracts
# 2. Bump the version (patch/minor/major)
cd reporting-contracts
npm version patch # e.g. 1.0.1 → 1.0.2
cd ..
# 3. Publish to the registry (run from inside reporting-contracts/)
cd reporting-contracts
npm publish --access public
cd ..
# 4. Update shell-app to use the new version
npm install -w shell-app @cedarplanters/reporting-contracts@latestLocal monorepo note: Since both packages live in the same repo using npm workspaces, the shell-app resolves contracts via the workspace link automatically. Steps 3–4 are only needed when publishing for external consumers. For local development, just rebuild contracts (
npm run build -w reporting-contracts) and the shell-app picks up changes immediately.
