TypeScript SDK

SDK quickstart

Install @dsplane/core, configure an authenticated Fetch client, and list Business Application Studio Dev Spaces.

This example creates an authenticated client and fetches the Dev Spaces visible in one landscape.

Prerequisites

  • TypeScript.
  • A Business Application Studio landscape URL.
  • A valid JWT for that landscape.

Install the package

Create the client

import { DSPlaneCore } from '@dsplane/core';
import { createClient } from '@dsplane/core/client';

const landscapeUrl = 'https://example.applicationstudio.cloud.sap/';
const jwt = process.env.DSPLANE_JWT;

if (jwt == null || jwt.length === 0) {
  throw new Error('DSPLANE_JWT is required.');
}

const client = createClient({
  auth: () => (jwt.startsWith('Bearer ') ? jwt : `Bearer ${jwt}`),
  baseUrl: landscapeUrl,
  headers: {
    Accept: 'application/json, text/plain, */*',
  },
});

const dsplane = new DSPlaneCore({ client });

The SDK does not obtain or persist a JWT for you. Your application owns credential acquisition and storage.

List Dev Spaces

const environments = await dsplane.wsManager.fetchEnvironments();

for (const environment of environments ?? []) {
  console.log(
    environment.config.labels?.['ws-manager.devx.sap.com/displayname'],
  );
}

fetchEnvironments() returns the generated EnvironmentConfig[] response data. DS Plane CLI applies its own transformation before displaying the result.

Next steps