Integration guide / ESM first
Install deliberately. Verify the boundary.
The documentation targets a fictional Node.js SDK and modern browser simulator. Only the static simulator is implemented in this repository.
Runtime compatibility
| Environment | Reference target | Notes |
|---|---|---|
| Node.js server | 20 or newer | Native fetch and AbortController assumed |
| TypeScript | 5.4 or newer | Strict mode and NodeNext module resolution |
| Browser playground | Current evergreen browsers | No token, bundle or external imports |
| Edge runtimes | Web-standard APIs | Avoid Node-specific filesystem assumptions |
Illustrative package setup
# Fictional package examples — not required by this repository.
npm install --save-exact @pulseflow/cloud-sdk@2.4.0
# Equivalent examples:
pnpm add --save-exact @pulseflow/cloud-sdk@2.4.0
yarn add --exact @pulseflow/cloud-sdk@2.4.0In a real integration, verify package provenance, publisher identity, license and the lockfile before installation. Pin a reviewed version and use an immutable install in CI. Do not use an unpinned download script as a production bootstrap mechanism.
Module and compiler configuration
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noUncheckedIndexedAccess": true
}
}The reference API uses named ESM exports. A server entry point should validate configuration at startup, create one client per process and flush buffered events during an orderly shutdown. Never instantiate a new connection or exporter for every span.
Run the implemented demo
git clone https://github.com/harishs2k26-art/pulseflow-sdk-js.git
cd pulseflow-sdk-js
python3 -m http.server 8000Open http://localhost:8000/, generate a trace, toggle the synthetic error and reset the form. The script uses text rendering rather than HTML insertion. The workflow name stays in browser memory, is never sent to a server and disappears when the page is reloaded.
Configuration precedence in the reference design
- Explicit constructor options override environment-derived defaults.
- The selected region determines the ingestion endpoint; it must match the workspace.
- The token comes from a server-side secret source, not a checked-in configuration file.
- A bounded queue and timeout protect the application from exporter stalls.
Document configuration precedence in your application so an environment variable cannot silently move telemetry to the wrong region. Reject an empty workspace ID rather than falling back to another team's workspace.
Smoke tests before rollout
- Validate a minimal envelope and a deliberately malformed one.
- Abort an in-flight operation and verify the caller receives cancellation.
- Exercise a 429 with Retry-After and confirm retry limits are bounded.
- Check that server-only token variables are absent from browser bundles.
- Drain pending events within the process termination budget.
Continue to authentication and error handling. Consult the changelog for the 2.3-to-2.4 compatibility checklist.