npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bugsplat/js-api-client

v9.5.0

Published

JS client for consuming the BugSplat API

Downloads

1,037

Readme

bugsplat-github-banner-basic-outline

BugSplat

Crash and error reporting built for busy developers.

👋 Introduction

@bugsplat/js-api-client is a set of JavaScript client libraries for consuming the BugSplat API. This package is compatible in both browser and node environments as it provides ESM and CommonJS builds for each environment respectively. Additionally this package is implemented in TypeScript and the distributed builds include definition files and source maps.

🏗 Installation

Install @bugsplat/js-api-client via npm. This package currently requires Node.js 18 or later.

npm i @bugsplat/js-api-client

If you need to use a version of Node.js that's older than 18, you can install @bugsplat/[email protected].

⚙️ Configuration

Import BugSplatApiClient and Environment from @bugsplat\js-api-client

import { BugSplatApiClient, Environment } from '@bugsplat/js-api-client';

Create an authenticated BugSplatApiClient following the steps below. Authentication is slightly different depending on if you are use @bugsplat/js-api-client in a Node.js or Web Browser environment. The method used to authenticate also depends on if you already have access to the user's email and password, or if you have to prompt for it at a later time.

The host value used to create a new instance of BugSplatApiClient is https://app.bugsplat.com for most scenarios. When using this library to upload a crash reports the host value will be https://{{database}}.bugsplat.com.

Node.js

The static factory function createAuthenticatedClientForNode can be used to return an authenticated instance of BugSplatApiClient in Node.js environments.

const bugsplat = await BugSplatApiClient.createAuthenticatedClientForNode(email, password, host);

If you need to authenticate at a later time, you can create an instance of BugSplatApiClient and call login manually.

const bugsplat = new BugSplatApiClient(host, Environment.Node);
await bugsplat.login(email, password);

Web Browser

The static factory function createAuthenticatedClientForWebBrowser can be used to return an authenticated instance of BugSplatApiClient.

const bugsplat = await BugSplatApiClient.createAuthenticatedClientForBrowser(email, password, host);

If you need to authenticate at a later time, you can create an instance of BugSplatApiClient and call login manually.

const bugsplat = new BugSplatApiClient(host, Environment.WebBrowser);
await bugsplat.login(email, password);

⌨️ Usage

Create an instance of CrashApiClient or any of the API clients and pass a reference to the BugSplatApiClient instance

const client = new CrashApiClient(bugsplat);

The API clients are built to automatically parse responses from BugSplat into objects that can be used by your application

const database = 'Fred';
const id = 100389;
const crash = await client.getCrashById(database, id);

for (const stackFrame of crash.thread.stackFrames) {
  console.log(stackFrame);
}

// StackFrame {
//     fileName: 'C:\\BugSplat\\samples\\myConsoleCrasher\\myConsoleCrasher.cpp',
//     functionName: 'myConsoleCrasher!MemoryException',
//     lineNumber: 150,
//     stackFrameLevel: 1,
//     arguments: [],
//     locals: []
// }
// StackFrame {
//     fileName: 'C:\\BugSplat\\samples\\myConsoleCrasher\\myConsoleCrasher.cpp',
//     functionName: 'myConsoleCrasher!wmain',
//     lineNumber: 84,
//     stackFrameLevel: 2,
//     arguments: [
//       { variable: 'int argc', value: '0n2' },
//       { variable: 'wchar_t ** argv', value: '0x0125ef20' }
//     ],
//     locals: [
//       { variable: 'int i', value: '0n1' },
//       { variable: 'int argc', value: '0n2' },
//       { variable: 'wchar_t ** argv', value: '0x0125ef20' }
//     ]
// }
// ...

🧑‍💻 Contributing

BugSplat ❤️s open source! If you feel that this package can be improved, please open an Issue. If you have an awesome new feature you'd like to implement, we'd love to merge your Pull Request. You can also send us an email, join us on Discord, or message us via the in-app chat on bugsplat.com.