Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/identity-client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@epilot/identity-client": minor
---

Add `@epilot/identity-client` for the epilot Identity API ("Sign in with epilot"): operator client registry and 360 session endpoints.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Full API documentation: [https://docs.epilot.io/api](https://docs.epilot.io/api)
| `epilot.eventCatalog` | `@epilot/sdk/event-catalog` | [docs](./packages/epilot-sdk-v2/docs/event-catalog.md) |
| `epilot.file` | `@epilot/sdk/file` | [docs](./packages/epilot-sdk-v2/docs/file.md) |
| `epilot.iban` | `@epilot/sdk/iban` | [docs](./packages/epilot-sdk-v2/docs/iban.md) |
| `epilot.identity` | `@epilot/sdk/identity` | [docs](./packages/epilot-sdk-v2/docs/identity.md) |
| `epilot.integrationToolkit` | `@epilot/sdk/integration-toolkit` | [docs](./packages/epilot-sdk-v2/docs/integration-toolkit.md) |
| `epilot.journey` | `@epilot/sdk/journey` | [docs](./packages/epilot-sdk-v2/docs/journey.md) |
| `epilot.kanban` | `@epilot/sdk/kanban` | [docs](./packages/epilot-sdk-v2/docs/kanban.md) |
Expand Down
2 changes: 2 additions & 0 deletions clients/identity-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.js
!webpack.config.js
1 change: 1 addition & 0 deletions clients/identity-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @epilot/identity-client
21 changes: 21 additions & 0 deletions clients/identity-client/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2026 epilot GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
38 changes: 38 additions & 0 deletions clients/identity-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# @epilot/identity-client

[![CI](https://github.com/epilot-dev/sdk-js/workflows/CI/badge.svg)](https://github.com/epilot-dev/sdk-js/actions?query=workflow%3ACI)
[![npm version](https://img.shields.io/npm/v/@epilot/identity-client.svg)](https://www.npmjs.com/package/@epilot/identity-client)
[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/epilot-dev/sdk-js/blob/main/LICENSE)

Client library for the epilot [Identity API](https://docs.epilot.io/api/identity): epilot as an OpenID Connect
provider ("Sign in with epilot").

The client covers the epilot-specific endpoints: the platform-operator client registry (partner applications and
the organizations enabled on them) and the 360 session endpoint used by the portal. The standard OpenID Connect
endpoints are described by the discovery document at `https://id.epilot.cloud/.well-known/openid-configuration`.

Uses [`openapi-client-axios`](https://github.com/openapistack/openapi-client-axios)

## Installation

```bash
npm install --save @epilot/identity-client
```

## Usage

```typescript
import { getClient } from "@epilot/identity-client";

const identityClient = getClient();
// operator API: admin-portal internal-auth bearer required
const { data: clients } = await identityClient.listClients({ partner_key: "babelforce" });
```

Register and look up applications with `identityClient.createOidcClient()` and
`identityClient.getOidcClient()`. The package's `getClient()` and `createClient()` helpers
return SDK HTTP client instances.

## Documentation:

https://docs.epilot.io/api/identity
74 changes: 74 additions & 0 deletions clients/identity-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "@epilot/identity-client",
"version": "0.0.0",
"description": "Client for epilot Identity API (Sign in with epilot: operator client registry and 360 session hop)",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": "epilot GmbH",
"license": "MIT",
"private": false,
"repository": {
"type": "git",
"url": "git+https://github.com/epilot-dev/sdk-js.git",
"directory": "clients/identity-client"
},
"bugs": {
"url": "https://github.com/epilot-dev/sdk-js/issues"
},
"homepage": "https://github.com/epilot-dev/sdk-js/tree/main/clients/identity-client#readme",
"keywords": [
"epilot",
"identity",
"oidc",
"openid-connect",
"sso"
],
"scripts": {
"test": "vitest",
"bundle-definition": "webpack",
"openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/identity.yaml",
"openapi:local": "node ../../scripts/update-openapi.js ../../../auth/identity-api/openapi.yml",
"typegen": "openapi typegen src/openapi.json --client > src/openapi.d.ts",
"build": "tsc && npm run build:patch && npm run bundle-definition",
"build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
"build:watch": "npm run build && tsc -w",
"prepublishOnly": "npm run typegen && npm run build",
"lint": "biome check src"
},
"files": [
"*.js",
"*.d.ts",
"**/*.js",
"**/*.d.ts",
"**/*.json",
"!*.test.*",
"!**/*.test.*",
"!node_modules",
"!src",
"!src/**",
"!*.config.js"
],
"peerDependencies": {
"axios": "^1.0.0 || >=0.25.0 <1.0.0"
},
"dependencies": {
"@dazn/lambda-powertools-correlation-ids": "^1.28.1",
"buffer": "^6.0.3",
"https-browserify": "^1.0.0",
"openapi-client-axios": "^7.8.0",
"stream-http": "^3.1.1",
"url": "^0.11.0",
"util": "^0.12.3"
},
"devDependencies": {
"axios": "^1.11.0",
"copy-webpack-plugin": "^7.0.0",
"json-loader": "^0.5.7",
"openapicmd": "^2.9.2",
"ts-loader": "^8.0.14",
"ts-node": "^10.9.1",
"typescript": "^4.1.3",
"webpack": "^5.18.0",
"webpack-cli": "^4.4.0"
}
}
25 changes: 25 additions & 0 deletions clients/identity-client/src/client.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { getClient } from './client';

describe('client', () => {
describe('getClient', () => {
it('should inititalise and return client', async () => {
const client = getClient();

expect(client.api.initialized).toBe(true);
});

it('should have operations', async () => {
const client = getClient();

const operations = client.api.getOperations();

expect(operations.length).toBeGreaterThan(0);
});

it('should have a default server defined', async () => {
const client = getClient();

expect(client.defaults.baseURL).toBeDefined();
});
});
});
30 changes: 30 additions & 0 deletions clients/identity-client/src/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import CorrelationIds from '@dazn/lambda-powertools-correlation-ids';
import OpenAPIClientAxios from 'openapi-client-axios';

import definition from './definition';
import type { Client } from './openapi';

let client: Client;
export const getClient = () => {
if (!client) {
client = createClient();
}

return client;
};

export const createClient = () => {
const api = new OpenAPIClientAxios({
definition,
quick: true,
});

const apiClient = api.initSync<Client>();

apiClient.defaults.headers.common = {
...(apiClient.defaults.headers.common ?? {}),
...(CorrelationIds.get() || {}),
};

return apiClient;
};
5 changes: 5 additions & 0 deletions clients/identity-client/src/definition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { Document } from 'openapi-client-axios';

import definition from './openapi-runtime.json';

export default definition as unknown as Document;
5 changes: 5 additions & 0 deletions clients/identity-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type { Document, OpenAPIClient, OpenAPIClientAxios } from 'openapi-client-axios';
export type { Client, Components, OperationMethods, Paths, PathsDictionary } from './openapi';

export * from './client';
export * from './openapi';
Loading
Loading