peakflow-api
v0.0.13
Published
JavaScript client for Peakflow error reporting with browser, Node, and Expo/React Native support.
Readme
peakflow
JavaScript client for Peakflow error reporting with browser, Node, and Expo/React Native support.
Install
npm install peakflowUsage
import {BugReporting, debuggerInstance} from "peakflow"
const bugReporting = new BugReporting({authToken: "your-token"})
bugReporting.connect()Request transport
By default, BugReporting uses XMLHttpRequest when available, otherwise it falls back to fetch. If neither is available, you must provide a request class.
import {BugReporting, NodeRequest} from "peakflow"
const bugReporting = new BugReporting({
authToken: "your-token",
RequestClass: NodeRequest
})Browser error listeners
import {BugReporting} from "peakflow"
const bugReporting = new BugReporting({authToken: "your-token"})
// Optional: enable source map parsing for script tags in web apps.
bugReporting.enableSourceMapsLoader()
bugReporting.connectOnError()
bugReporting.connectUnhandledRejection()Node error listeners
import {BugReporting} from "peakflow"
const bugReporting = new BugReporting({authToken: "your-token"})
bugReporting.connectNodeUncaughtException()
bugReporting.connectNodeUnhandledRejection()Expo / React Native error listeners
import {BugReporting} from "peakflow"
const bugReporting = new BugReporting({authToken: "your-token"})
bugReporting.connectExpoErrorHandlers()CLI
npx peakflow-api login
npx peakflow-api build-logs --latest-build-group --failinglogin uses browser approval by default: it prints a Peakflow URL, you approve the request while signed in (including GitHub-authenticated users), and the CLI stores credentials automatically.
The CLI stores credentials in .peakflow-api/credentials.json at the git root and uses the current branch by default.
For manual token login, pass --auth-token (or PEAKFLOW_API_AUTH_TOKEN):
npx peakflow-api login --host https://peakflow.example --repo owner/name --auth-token your-project-auth-tokenFor legacy password login, pass --password (and optionally --email, or PEAKFLOW_API_EMAIL / PEAKFLOW_API_PASSWORD):
npx peakflow-api login --host https://peakflow.example --repo owner/name --email [email protected] --password your-password