TypeScript SDK

Install and start using the TypeScript SDK.

Intro

The Decionis Policy Evaluation API SDK provides access to the Decionis Policy Evaluation API REST APIs.

Decionis evaluates captured execution intent against versioned policies before the caller performs the action. SDKs delegate policy judgment to this service and locally enforce the signed decision. New SDK API keys can be associated with an industry so Decionis provisions a starter encoded policy binding server-side; applications do not receive or implement policy logic.

Installation

The SDK compiles to dist/ before it can be referenced — run its build script once in the SDK folder, then add it to your project by path:

Terminal
npm install <path-to-sdk>

Quick Start

Create one client and reuse it. Configure its behaviour through ClientOptions.

TypeScript
import { DecionisPolicyEvaluationApiClient } from "decionis-policy-evaluation-api";

const client = new DecionisPolicyEvaluationApiClient({
  apiKeyAuth: "YOUR_BEARER_TOKEN",
  operatorEntraAuth: "YOUR_BEARER_TOKEN",
  accountSessionCookie: "YOUR_API_KEY",
  hostedGatewayTcpRouteCredential: "YOUR_BEARER_TOKEN",
  hostedGatewayTcpBrokerAuth: "YOUR_BEARER_TOKEN",
  hostedGatewayWorkerAuth: "YOUR_BEARER_TOKEN",
  protocolServiceAuth: "YOUR_BEARER_TOKEN",
  commerceAccountsOAuth: "YOUR_BEARER_TOKEN",
  commerceConnectedTransport: "YOUR_BEARER_TOKEN",
  accountsWorkspaceCredentialService: "YOUR_BEARER_TOKEN",
  accountsNativeEnrollmentService: "YOUR_BEARER_TOKEN",
  drupalSiteKey: "YOUR_BEARER_TOKEN",
});

Nothing in ClientOptions is required — new DecionisPolicyEvaluationApiClient() compiles — and each option left out falls back to its default. This API declares one environment, so there is no environment to select and no host to state at the construction site.

From CommonJS

The package ships both dialects from a single entry, so require works with full types. In a TypeScript CommonJS file use the import ... = require(...) form — a plain destructuring require runs fine but gives you any.

TypeScript
import sdk = require("decionis-policy-evaluation-api");

const client = new sdk.DecionisPolicyEvaluationApiClient({
  apiKeyAuth: "YOUR_BEARER_TOKEN",
  operatorEntraAuth: "YOUR_BEARER_TOKEN",
  accountSessionCookie: "YOUR_API_KEY",
  hostedGatewayTcpRouteCredential: "YOUR_BEARER_TOKEN",
  hostedGatewayTcpBrokerAuth: "YOUR_BEARER_TOKEN",
  hostedGatewayWorkerAuth: "YOUR_BEARER_TOKEN",
  protocolServiceAuth: "YOUR_BEARER_TOKEN",
  commerceAccountsOAuth: "YOUR_BEARER_TOKEN",
  commerceConnectedTransport: "YOUR_BEARER_TOKEN",
  accountsWorkspaceCredentialService: "YOUR_BEARER_TOKEN",
  accountsNativeEnrollmentService: "YOUR_BEARER_TOKEN",
  drupalSiteKey: "YOUR_BEARER_TOKEN",
});

On this page