pipebase-io-js v0.1.6
pipebase-io-js
NPM package for Pipebase.io
Usage
If you don't have a Pipebase workspace, go create one (30 seconds, free): app.pipebase.io
Note your
workspace idandAPI key(See here on how to get them)Install the package
npm install pipebase-io-jsInitialize 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 })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`);
Development
Install dependencies
npm installRun build. This will generate the compiled code with type definitions in the
distfolder.npm run buildFormatting and linting.
npm run lint npm run formatRun tests
npm test
Publish package
If you don't have an npm account, create one on: https://www.npmjs.com/signup or run the command:
npm adduserIf you already have an account, login by running the following command:
npm loginWhen you're successfully logged-in. Publish the package:
npm publishYou should now be able to
npm installyour 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.
