open-index/open-npm huggingface dataset:
npm package: @resonant/biome-config
Description: A shared Biome linter configuration for Resonant projects.
Author: Kitware, Inc.
Latest version: 0.3.1

# resonant-biome-config
[![npm (scoped)](https://img.shields.io/npm/v/@resonant/biome-config)](https://www.npmjs.com/package/@resonant/biome-config)

A shared Biome linter configuration for Resonant projects.

## Installation
```bash
npm install --save-dev @biomejs/biome @resonant/biome-config
```

In `biome.json`:
```json
{
  "$schema": "https://biomejs.dev/schemas/2.3.10/schema.json",
  "extends": ["@resonant/biome-config"]
}
```
npm package: @resonant/oauth-client
Description: A TypeScript library for performing OAuth2 login to a Resonant server.
Author: Kitware, Inc.
Latest version: 1.0.4

# resonant-oauth-client
[![npm (scoped)](https://img.shields.io/npm/v/@resonant/oauth-client)](https://www.npmjs.com/package/@resonant/oauth-client)

A TypeScript library for performing OAuth login to a Resonant server.

## Description
This provides support for authenticating with Resonant servers,
using the OAuth2.0 Authorization Code Grant with PKCE flow.

## Usage
* Install the library:

  ```bash
  npm install @resonant/oauth-client
  ```

* Instantiate an `OauthClient` with your application-specific configuration:
  ```typescript
  import OauthClient from '@resonant/oauth-client';

  const oauthClient = new OauthClient(
    new URL(process.env.OAUTH_API_ROOT), // e.g. 'http://localhost:8000/oauth/'
    process.env.OAUTH_CLIENT_ID, // e.g. 'Qir0Aq7AKIsAkMDLQe9MEfORbHEBKsViNhAKJf1A'
  );
  ```

* Call `redirectToLogin` when it's time to start a login flow:
  ```typescript
  document.querySelector('#sign-in-link').addEventListener('click', async (event) => {
    event.preventDefault();
    await oauthClient.redirectToLogin();
    // This will redirect away from the current page
  });
  ```

* At the start of *every* page load, unconditionally call `maybeRestoreLogin`, to attempt to
  restore a login state; this will no-op if no login is present. Afterwards, get and store HTTP
  headers for authentication from `authHeaders`.
  ```typescript
  await oauthClient.maybeRestoreLogin();
  const { authHeaders } = oauthClient;
  ```

* Include these headers with every Ajax API request:
  ```typescript
  fetch('http://localhost:8000/api/files', {
    headers: authHeaders,
  });
  ```

* The login state will persist across page refreshes. Call `logout` to clear any active login:
  ```typescript
  document.querySelector('#sign-out-link').addEventListener('click', async (event) => {
    event.preventDefault();
    await oauthClient.logout()
    authHeaders = oauthClient.authHeaders;
  });
  ```

## Development
To develop the library using the example app:
```bash
# From the root of the repository
npm install
npm run watch
```
In another terminal:
```bash
# From the root of the repository
cd example
npm install
npm run serve
```