Giter Site home page Giter Site logo

bugsplat-git / bugsplat-js-api-client Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 0.0 1.45 MB

โš™๏ธ๐Ÿงฉ๐Ÿง‘โ€๐Ÿ’ป TS/JS client for consuming BugSplat APIs

Home Page: https://docs.bugsplat.com/introduction/development/web-services/api

License: MIT License

TypeScript 99.53% JavaScript 0.41% Shell 0.06%
api apm bugsplat client crash error javascript reporting typescript

bugsplat-js-api-client's Introduction

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.

bugsplat-js-api-client's People

Contributors

bobbyg603 avatar daveplunkett avatar dependabot[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bugsplat-js-api-client's Issues

Add Emoji's to the chapter headers

To make our repo's stand out a bit more, let's give them a spice of life with some emoji's in the chapter text.

Here's an example from our production website ReadMe

### :blue_book: Documentation
Our private repository and documentation is available at GitHub. Visit https://docs.bugsplat.com/ for further info.

You can find all of the emoji's github allows here - https://gist.github.com/rxaviers/7360908

Add Updated Header Info to ReadMe

Update the readme to match the styles in the BugSplat Website ReadMe

![bugsplat-github-banner-basic-outline](https://user-images.githubusercontent.com/20464226/149019306-3186103c-5315-4dad-a499-4fd1df408475.png)
<br/><br/> 
# <div align="center">BugSplat</div> 
### **<div align="center">Crash and error reporting built for busy developers.</div>**
<div align="center"> <img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/bugsplatco?label=Follow%20BugSplat&style=social">  <img alt="Discord" src="https://img.shields.io/discord/664965194799251487?label=Join%20Discord&logo=Discord&style=social"> </div>

There's a whole world of shields (badges) we can add next to the Twitter and Discord ones. Maybe add a last commit or project size shield from - https://shields.io/category/rating.

Expose TableDataFormDataBuilder

This is a convenient way to build data table requests. Let's expose it here so that we don't have to duplicate it in bugsplat-web-app.

Should not depend on node.js core modules

Currently uploading symbols will not work in a browser environment because of dependencies on path, fs and util. Additionally, webpack 5 throws an error about node.js core polyfills not being added by default. The best course of action here is to support uploading symbols via a File object (browser), or and fs.ReadStream (node), but do not import fs, path or utils.

Add TeamCity Support

All publically facing builds should leverage protected branches. Let's tie this repo into TeamCity so that we can add branch protections.

Remove dependency on Fred in e2e tests

Remove the dependency on an event exists on this specific crash/stackKey. The solution is to get a list of crashes and stack keys at test time, pick one, add an event and verify the event was added successfully.

Originally posted by @bobbyg603 in #7 (comment)

Remove EventStream Mapping

In the interest of time we added a lot of extra stuff to convert the API Event object into our client's EventStream object. This code doesn't belong in the API client and should be torn out.

Package can't be imported in Angular project

  • Can't find the esm entry point as currently defined in package json and most be imported from '@bugsplat/js-api-client/dist/esm' currently
  • No export for VariableValuePair
  • No export for BugSplatResponse

Don't treat .zip files as Windows symbols

Abandon the bsv1 protocol as a workaround to the issue where Breakpad crashes are treated as Windows crashes. By bypassing the bsv1 protocol, the backend will not treat .zip as a Windows symbol format.

Remove Password from E2E tests

This password has been publically available forever on our website and is part of a sandboxed account but there's also no reason we shouldn't have this value as an environment variable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.