The chat responses are generated using Generative AI technology for intuitive search and may not be entirely accurate. They are not intended as professional advice. For full details, including our use rights, privacy practices and potential export control restrictions, please refer to our Generative AI Service Privacy Information. As this is a test version, please let us know if something irritating comes up. Like you get recommended a chocolate fudge ice cream instead of an energy managing application. If that occurs, please use the feedback button in our contact form!
Skip to content

Install the SDK

2612

The Polarion Application SDK is the npm package polarion-app-sdk. It is small (one module, no dependencies) and provides the communication layer between your view and the Polarion host page.

Where the package comes from

The SDK is not published to the public npm registry. Every Polarion 2612 server serves the package from its SDK folder:

https://<polarion-host>/polarion/sdk/applications/polarion-app-sdk-0.5.2-preview.tgz

Open https://<polarion-host>/polarion/sdk/applications/ in a browser to see the versions available on your server. Using the package from the server you deploy to guarantees that the SDK and the host bridge speak the same protocol version.

Install from the server URL

npm install https://polarion.example.com/polarion/sdk/applications/polarion-app-sdk-0.5.2-preview.tgz

npm downloads the tarball and records the URL in package.json:

"dependencies": {
  "polarion-app-sdk": "https://polarion.example.com/polarion/sdk/applications/polarion-app-sdk-0.5.2-preview.tgz"
}

Every later npm install (for example in CI) fetches it from the same URL, so the build machine needs HTTPS access to the Polarion server. The server's certificate must be trusted by Node.js; a self-signed certificate makes npm fail with SELF_SIGNED_CERT_IN_CHAIN. In that case either add the CA to NODE_EXTRA_CA_CERTS or use the local file variant below.

Install from a local file

Download the .tgz once and keep it next to the project (or in a shared folder of your repository):

npm install ./polarion-app-sdk-0.5.2-preview.tgz
"dependencies": {
  "polarion-app-sdk": "file:polarion-app-sdk-0.5.2-preview.tgz"
}

The examples in this guide use this variant with the tarball vendored under examples/_sdk/, so that they build without network access.

Import

The package ships ES module and CommonJS builds plus TypeScript declarations. In a Vite project:

import {
  fetchContext,
  events,
  destroy,
  EventTypes,
  type PolarionContext,
  type SelectionChangedData,
} from 'polarion-app-sdk';

Plain JavaScript:

import { fetchContext, events, destroy, EventTypes } from 'polarion-app-sdk';

CommonJS (for tools that still need it):

const { fetchContext, events, destroy, EventTypes } = require('polarion-app-sdk');

What is inside

  • node_modules/polarion-app-sdk/
    • package.json
    • README.md
    • dist/
      • HostBridge.js ES module entry
      • HostBridge.cjs CommonJS entry
      • HostBridge.d.ts public API types
      • ApplicationGateway.d.ts
      • Constants.d.ts
      • types/
        • PolarionContext.d.ts
        • SelectionChangedData.d.ts
        • ApplicationGatewayProtocol.d.ts

Only the exports of HostBridge are public API: fetchContext, events, destroy, EventTypes and the types PolarionContext and SelectionChangedData. The gateway and protocol files are internal.

Upgrading

When a server is upgraded, check /polarion/sdk/applications/ for a newer tarball, install it, rebuild and re-upload. The SDK version is printed in package.json of the installed package and in the README.md shipped with it.