pipebase-io-js
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

pipebase-io-js

NPM package for Pipebase.io

Usage

  1. If you don't have a Pipebase workspace, go create one (30 seconds, free): app.pipebase.io

  2. Note your workspace id and API key (See here on how to get them)

  3. Install the package

     npm install pipebase-io-js
    
  4. Initialize the library

    import {PipebaseClient} from 'pipebase-io-js';
    
    const pipebaseClient = new PipebaseClient({
       workspaceId: "<your workspace id>",
       apiKey: "<your API key>",
       defaultTable: 'demo-ingest-from-js',
       ingestConsoleLogs: true, // if true, will upload console logs to Pipebase
       suppressConsoleLogsToConsole: true // if true, will also suppress logs to console
    })
  5. Upload logs

    console.info("TEST this will be logged as info");
    console.warn("TEST this will be logged as warning");
    console.error("TEST this will be logged as error");
    console.log("TEST parameters will also be logged", { hello: "world" }   { anotherParam: 1 });
    
    await pipebaseClient.flushAsync(); // Can call flush to upload the logs (log   are flushed every second by default) 
    
    pipebaseClient.track({
       myEvent: "You can log anything you want",
       moreData: 1234
       }, "customTableName");
    
    await pipebaseClient.end(); // Flush and stop logging (will wait for logs t   upload for up to 10 seconds)
    
    console.log(`This log will not be uploaded to Pipebase.io`);
  6. You should see the logs in your workspace: uploaded logs

Development

  1. Install dependencies

     npm install
    
  2. Run build. This will generate the compiled code with type definitions in the dist folder.

     npm run build
    
  3. Formatting and linting.

     npm run lint
     npm run format
    
  4. Run tests

     npm test
    

Publish package

  1. If you don't have an npm account, create one on: https://www.npmjs.com/signup or run the command: npm adduser

  2. If you already have an account, login by running the following command:

     npm login
    
  3. When you're successfully logged-in. Publish the package:

     npm publish
    
  4. You should now be able to npm install your published package. There is an npm package called reference-package which is generated from this cookiecutter. There is a sample usage in example/index.js.

Credits

This repo was bootstrapped by following this tutorial.

Readme

Keywords

none

Package Sidebar

Install

npm i pipebase-io-js

Weekly Downloads

3

Version

0.1.6

License

ISC

Unpacked Size

14.9 kB

Total Files

4

Last publish

Collaborators

  • rcronco