0.3.6 • Published 2 years ago

node-pangea v0.3.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

documentation Discord

Pangea Node SDK

A javascript SDK for using Pangea APIs in a Node application.

This package is provided with support for ESM and CommonJS.

Installation

yarn add node-pangea
# or
npm install node-pangea

Usage

Check our interactive guide on https://pangea.cloud/docs/admin-guide/getting-started/integrate/

import { PangeaConfig, AuditService } from "node-pangea";

const domain = process.env.PANGEA_DOMAIN;
const token = process.env.PANGEA_TOKEN;
const configId = process.env.AUDIT_CONFIG_ID;
const config = new PangeaConfig({ domain: domain, configId: configId });
const audit = new AuditService(token, config);

// log an audit event
const data = {
  actor: "user@mail.com",
  action: "update",
  status: "success",
  message: "delete record",
};
const logResponse = await audit.log(data);

// search an audit log
const searchResponse = await audit.search("message:delete", {
  limit: 10,
  verify: true,
});

searchResponse.result.events.forEach((row) => {
  console.log(
    row.event.received_at,
    row.event.actor,
    row.event.action,
    row.event.status,
    row.event.message,
    row.event.membership_proof,
    row.event.consistency_proof
  );
});

Contributing

Currently, the setup scripts only have support for Mac/ZSH environments. Future support is incoming.

To install our linters, simply run ./dev/setup_repo.sh These linters will run on every git commit operation.

Generate SDK Documentation

Overview

Throughout the SDK, there are jsdoc strings that serve as the source of our SDK docs.

The documentation pipeline here looks like:

  1. Write jsdoc strings throughout your code. Please refer to existing jsdoc strings as an example of what and how to document.
  2. Make your pull request.
  3. After the pull request is merged, go ahead and run yarn generate:docs to generate the JSON docs uses for rendering.
  4. Copy the contents of the file docs.json and overwrite the existing js_sdk.json file in the docs repo. File is located in platform/docs/sdk/js_sdk.json in the Pangea monorepo. Save this and make a merge request to update the Python SDK docs in the Pangea monorepo.

Running the autogen sdk doc script

Make sure you have all the dependencies installed. From the root of the node-pangea repo run:

yarn install

Now run the script

yarn run generate:docs

That will output a new file: docs.json at the root of the Node.js SDK repo.

0.3.6

2 years ago

0.3.0

2 years ago

0.3.5

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.2.7

2 years ago

0.2.5

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago