A Node.js SDK for integrating with Pangea services. Supports Node.js v20 and v22.
Via npm:
$ npm install pangea-node-sdkVia yarn:
$ yarn add pangea-node-sdkPre-release versions may be available with the beta denotation in the version
number. These releases serve to preview beta services and APIs. Per Semantic
Versioning, they are considered unstable and do not carry the same compatibility
guarantees as stable releases. Beta changelog.
Via npm:
$ npm install pangea-node-sdk@5.2.0-beta.3Via yarn:
$ yarn add pangea-node-sdk@5.2.0-beta.3General usage would be to create a token for a service through the Pangea Console and then construct an API client for that respective service. The below example shows how this can be done for Secure Audit Log to log a simple event:
import process from "node:process";
import { PangeaConfig, AuditService } from "pangea-node-sdk";
// Load client configuration from environment variables `PANGEA_AUDIT_TOKEN` and
// `PANGEA_DOMAIN`.
const token = process.env.PANGEA_AUDIT_TOKEN;
const config = new PangeaConfig({ domain: process.env.PANGEA_DOMAIN });
// Create a Secure Audit Log client.
const audit = new AuditService(token, config);
// Log a basic event.
const response = await audit.log({ message: "Hello, World!" });The SDK supports the following configuration options via PangeaConfig:
baseUrlTemplate— Template for constructing the base URL for API requests. The placeholder{SERVICE_NAME}will be replaced with the service name slug. This is a more powerful version ofdomainthat allows for setting more than just the host of the API server. Defaults tohttps://{SERVICE_NAME}.aws.us.pangea.cloud.domain— Base domain for API requests. This is a weaker version ofbaseUrlTemplatethat only allows for setting the host of the API server. UsebaseUrlTemplatefor more control over the URL, such as setting service-specific paths. Defaults toaws.us.pangea.cloud.requestRetries— How many times a request should be retried on failure. Defaults to3.requestTimeout— Maximum allowed time (in milliseconds) for a request to complete. Defaults to5000.queuedRetryEnabled— Whether or not queued request retries are enabled. Defaults totrue.queuedRetries— How many queued request retries there should be on failure. Defaults to4.pollResultTimeoutMs— Timeout for polling results after a HTTP/202 (in milliseconds). Defaults to120 * 1000.customUserAgent— User-Agent string to append to the default one.