diff --git a/.fern/metadata.json b/.fern/metadata.json new file mode 100644 index 00000000..fc8806cf --- /dev/null +++ b/.fern/metadata.json @@ -0,0 +1,18 @@ +{ + "cliVersion": "3.85.2", + "generatorName": "fernapi/fern-typescript-node-sdk", + "generatorVersion": "3.49.3", + "generatorConfig": { + "namespaceExport": "Corti", + "noSerdeLayer": false, + "enableInlineTypes": false, + "streamType": "web", + "shouldGenerateWebsocketClients": true, + "generateSubpackageExports": true, + "inlinePathParameters": false, + "extraDevDependencies": { + "@faker-js/faker": "^9.9.0" + } + }, + "sdkVersion": "0.10.1" +} diff --git a/.fernignore b/.fernignore index 47e21c2f..084a8ebb 100644 --- a/.fernignore +++ b/.fernignore @@ -1,26 +1 @@ -# All custom code -src/custom - -# Custom imports from custom code that replaces generated one -src/index.ts -src/api/index.ts - -# Patch: fetcher respects CortiClient withCredentials via global config -src/core/fetcher/Fetcher.ts - -# Documentation -README.md -AUTHENTICATION.md -reference.md -PROXYING.md - -# Integration tests -tests/custom -jest.integration.config.mjs -.github/workflows/integration-tests.yml - -# Issue templates -.github/ISSUE_TEMPLATE - -# Updated release workflow -.github/workflows/ci.yml +# Specify files that shouldn't be modified by Fern diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index c3abcfb3..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -name: Bug Report -about: Create a report to help us improve -title: "[BUG] " -labels: ["bug"] -assignees: "" ---- - -## 1. Summary - -Provide a clear and concise description of the issue. - -## 2. Steps to Reproduce - -List the steps to reproduce the issue: - -1. Go to '...' -2. Click on '...' -3. Scroll down to '...' -4. See error - -## 3. Expected Behavior - -What should have happened? - -## 4. Actual Behavior - -What actually happened? - -## 5. Screenshots or Logs (if applicable) - -Attach screenshots, recordings, or logs that help clarify the problem. - -## 6. Environment - -- **Platform** (Web, iOS, Android, etc.): -- **Browser/Device version**: -- **User role** (if applicable): - -## 7. Priority Level - -- [ ] 🔴 Blocker (prevents work/usage entirely) -- [ ] 🟠 High (critical path disrupted) -- [ ] 🟡 Medium (can work around it) -- [ ] 🟢 Low (cosmetic/minor inconvenience) - -## 8. Additional Context - -Anything else that might be useful for diagnosing or fixing the issue. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 3f4b005e..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -name: Feature Request -about: Suggest an idea for this project -title: "[FEATURE] " -labels: ["enhancement"] -assignees: "" ---- - -## 1. What is the problem you're trying to solve? - -Describe the user pain point or limitation clearly. - -## 2. Describe the proposed solution - -How would you like the system to behave? - -## 3. Who would benefit from this feature? - -List the user roles or personas affected (e.g., end users, support, QA). - -## 4. Why is this feature important? - -Explain the business or user value of implementing this feature. - -## 5. Priority Level - -- [ ] 🔴 Must-have -- [ ] 🟠 Should-have -- [ ] 🟡 Nice-to-have -- [ ] 🟢 Exploratory/Idea-stage - -## 6. Acceptance Criteria - -Define success criteria or how we'll know the feature is working correctly. Use Gherkin-style if helpful: - -``` -Given [context] -When [action] -Then [expected outcome] -``` - -## 7. Alternatives Considered - -Have you tried any workarounds or alternative solutions? - -## 8. Additional Context / Mockups - -Attach diagrams, mockups, references, or similar feature links if available. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01a81611..83610699 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,84 +3,76 @@ name: ci on: [push] jobs: - compile: - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set up node - uses: actions/setup-node@v4 - # with: - # node-version: "18.18.0" - - - name: Setup yarn - run: npm install -g yarn - - - name: Install dependencies - run: yarn install - - - name: Compile - run: yarn build - - test: - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set up node - uses: actions/setup-node@v4 - # with: - # node-version: "18.18.0" - - - name: Setup yarn - run: npm install -g yarn - - - name: Install dependencies - run: yarn install - -# - name: Check for formatting issues -# run: yarn prettier . --check --ignore-unknown - - - name: Run tests - run: yarn test - - publish: - needs: [compile, test] - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - permissions: - id-token: write - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set up node - uses: actions/setup-node@v4 - # with: - # node-version: "18.18.0" - - - name: Setup yarn - run: npm install -g yarn - - - name: Install dependencies - run: yarn install - - - name: Build - run: yarn build - - - name: Publish to npm - run: | - publish() { - npx -y npm@latest publish "$@" - } - if [[ ${GITHUB_REF} == *alpha* ]]; then - publish --access public --tag alpha - elif [[ ${GITHUB_REF} == *beta* ]]; then - publish --access public --tag beta - elif [[ ${GITHUB_REF} == *rc* ]]; then - publish --tag rc - else - publish --access public - fi + compile: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Set up node + uses: actions/setup-node@v6 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Compile + run: pnpm build + + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Set up node + uses: actions/setup-node@v6 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Test + run: pnpm test + + publish: + needs: [ compile, test ] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Set up node + uses: actions/setup-node@v6 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm build + + - name: Publish to npm + run: | + npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} + publish() { # use latest npm to ensure OIDC support + npx -y npm@latest publish "$@" + } + if [[ ${GITHUB_REF} == *alpha* ]]; then + publish --access public --tag alpha + elif [[ ${GITHUB_REF} == *beta* ]]; then + publish --access public --tag beta + else + publish --access public + fi + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml deleted file mode 100644 index b1d2110a..00000000 --- a/.github/workflows/integration-tests.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: integration-tests - -on: [pull_request] - -concurrency: - group: integration-tests - cancel-in-progress: true - -jobs: - integration-tests: - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set up node - uses: actions/setup-node@v3 - - - name: Install dependencies - run: yarn - - - name: Run integration tests - run: yarn jest --config jest.integration.config.mjs - env: - CORTI_ENVIRONMENT: ${{ vars.CORTI_ENVIRONMENT }} - CORTI_TENANT_NAME: ${{ vars.CORTI_TENANT_NAME }} - CORTI_CLIENT_ID: ${{ vars.CORTI_CLIENT_ID }} - CORTI_CLIENT_SECRET: ${{ secrets.CORTI_CLIENT_SECRET }} diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 6db0876c..00000000 --- a/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -node_modules -src -tests -.gitignore -.github -.fernignore -.prettierrc.yml -tsconfig.json -yarn.lock \ No newline at end of file diff --git a/.prettierrc.yml b/.prettierrc.yml deleted file mode 100644 index 0c06786b..00000000 --- a/.prettierrc.yml +++ /dev/null @@ -1,2 +0,0 @@ -tabWidth: 4 -printWidth: 120 diff --git a/AUTHENTICATION.md b/AUTHENTICATION.md deleted file mode 100644 index 3a22915c..00000000 --- a/AUTHENTICATION.md +++ /dev/null @@ -1,495 +0,0 @@ -# Authentication Guide - -The Corti TypeScript SDK supports multiple authentication methods to provide flexibility for different use cases. This guide covers all available authentication options and their usage. - -## Overview - -The SDK supports five main authentication methods: - -1. **Client Credentials (OAuth2)** - Traditional OAuth2 client credentials flow (Backend only) -2. **Bearer Token** - Direct token usage with optional refresh capability (Frontend & Backend) -3. **Authorization Code Flow without PKCE (OAuth2)** - Full OAuth2 authorization code flow for user authentication (Frontend & Backend) -4. **Authorization Code Flow with PKCE (OAuth2)** - OAuth2 authorization code flow with PKCE for enhanced security (Frontend & Backend) -5. **Resource Owner Password Credentials (ROPC)** - OAuth2 ROPC flow for username/password authentication (Frontend & Backend, requires server endpoint) - -## Client Credentials Authentication - -**⚠️ Backend Only** - This method should only be used in server-side applications where client secrets can be securely stored. - -This is the most common authentication method for server-to-server applications. The SDK handles the OAuth2 token exchange and refresh automatically, ensuring your application always has valid credentials. - -For detailed information about Client Credentials flow, see the [official Corti documentation](https://docs.corti.ai/about/oauth#4-client-credentials-grant-used-for-api-integrations). - -> **⚠️ Security Note**: Client Credentials tokens are multi-user tokens that provide access to all data within the same API Client. If you need to use the SDK from the frontend, consider implementing a proxy or using scoped tokens. See the [Proxying Guide](./PROXYING.md) for detailed information about securing frontend implementations. - -### Basic Usage - -> Note: The `codeChallenge` must be generated by applying SHA-256 to the verifier and encoding with URL-safe Base64. - -```typescript -import { CortiEnvironment, CortiClient } from "@corti/sdk"; - -const client = new CortiClient({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", - auth: { - clientId: "YOUR_CLIENT_ID", - clientSecret: "YOUR_CLIENT_SECRET", - }, -}); -``` - -## Bearer Token Authentication - -**✅ Frontend & Backend** - This method can be used in both client-side and server-side applications. - -Use this method when you already have an access token from another source or want to manage tokens externally. - -### Generating Bearer Tokens (Backend) - -You can generate bearer tokens on your **backend server** using `CortiAuth`: - -```typescript -import { CortiAuth, CortiEnvironment } from "@corti/sdk"; - -const auth = new CortiAuth({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", -}); - -// Generate tokens using client credentials -const tokenResponse = await auth.getToken({ - clientId: "YOUR_CLIENT_ID", - clientSecret: "YOUR_CLIENT_SECRET", -}); - -/** -interface GetTokenResponse { - accessToken: string; - tokenType?: string; // Optional: Token type (defaults to "Bearer") - expiresIn: number; - refreshToken?: string; - refreshExpiresIn?: number; -} -*/ -``` - -### Basic Bearer Token - -Use the token data received from your backend server (from the `getToken` call above) to initialize the client: - -```typescript -const client = new CortiClient({ - auth: { - accessToken: "YOUR_ACCESS_TOKEN", - // Optional: expiration can be extracted from token. Provide only when straight from server - expiresIn: 3600, - }, -}); -``` - -You can spread the token response directly from your backend: - -```typescript -const client = new CortiClient({ - auth: { - ...tokenResponse, // Spread the token object received from your backend - }, -}); -``` - -### Bearer Token With Refresh Token Support - -You can use a refresh function to automatically refresh tokens when they expire. You can provide an initial access token or start with just the refresh function: - -**With initial access and refresh tokens:** - -```typescript -const client = new CortiClient({ - auth: { - accessToken: "YOUR_ACCESS_TOKEN", - refreshToken: "YOUR_REFRESH_TOKEN", - refreshAccessToken: async (refreshToken?: string) => { - // Your custom logic to get a new access token - const response = await fetch("https://your-auth-server/refresh", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ refreshToken }), - }); - - // Response must return a valid token object: - // { - // accessToken: string; // Required: The new access token - // expiresIn?: number; // Optional: Seconds until token expires - // refreshToken?: string; // Optional: New refresh token if rotated - // refreshExpiresIn?: number; // Optional: Seconds until refresh token expires - // tokenType?: string; // Optional: Token type (defaults to "Bearer") - // } - return response.json(); - }, - }, -}); -``` - -**Without initial access token (refreshToken will be undefined for the first call):** - -```typescript -const client = new CortiClient({ - auth: { - // refreshToken will be undefined for the first call, then it will be the refreshToken returned from the previous token request - refreshAccessToken: async (refreshToken?: string) => { - // Your custom logic to get a new access token - const response = await fetch("https://your-auth-server/token", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ refreshToken }), - }); - - // Response must return a valid token object: - // { - // accessToken: string; // Required: The new access token - // expiresIn?: number; // Optional: Seconds until token expires - // refreshToken?: string; // Optional: New refresh token if rotated - // refreshExpiresIn?: number; // Optional: Seconds until refresh token expires - // tokenType?: string; // Optional: Token type (defaults to "Bearer") - // } - return response.json(); - }, - }, -}); -``` - -## Authorization Code Flow - -**✅ Client-Side or Backend** - This method can be fully handled on the client side, or tokens can be exchanged on the backend. The SDK handles all authentication steps. - -**Note**: CORS is enabled for this flow. Requests must come from the same origin as specified in your redirect URIs configuration. - -The Authorization Code Flow is the standard OAuth2 flow for user authentication. This flow is implemented through the `CortiAuth` class and is available when enabled for your client. - -For detailed information about Authorization Code Flow, see the [official Corti documentation](https://docs.corti.ai/about/oauth#2-authorization-code-flow-without-pkce). - -### Basic Flow Overview - -1. **Redirect user to authorization URL** - User is redirected to Corti's login page -2. **User authenticates** - User logs in and authorizes your application -3. **Receive authorization code** - User is redirected back with an authorization code -4. **Exchange code for tokens** - Exchange the authorization code for access and refresh tokens using SDK (client-side) -5. **Use tokens** - Pass the tokens to a new `CortiClient` instance to make authenticated API calls, refresh when needed - -### Step 1: Create Authorization URL - -```typescript -import { CortiAuth, CortiEnvironment } from "@corti/sdk"; - -const auth = new CortiAuth({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", -}); - -// Generate authorization URL -const authUrl = await auth.authorizeURL({ - clientId: "YOUR_CLIENT_ID", - redirectUri: "https://your-app.com/callback", -}); // Automatically redirects to authorization URL - -// To prevent automatic redirect and get URL only: -const authUrlNoRedirect = await auth.authorizeURL( - { - clientId: "YOUR_CLIENT_ID", - redirectUri: "https://your-app.com/callback", - }, - { skipRedirect: true }, -); -``` - -### Step 2: Handle the Callback and Exchange Code for Tokens - -When the user is redirected back to your application, you'll receive an authorization code in the URL parameters. Exchange it for tokens directly on the client using the SDK: - -```typescript -// Extract the authorization code from URL parameters -const urlParams = new URLSearchParams(window.location.search); -const code = urlParams.get("code"); -const error = urlParams.get("error"); - -if (error) { - console.error("Authorization failed:", error); - return; -} - -if (code) { - // Exchange the authorization code for tokens using SDK (client-side) - const tokenResponse = await auth.getCodeFlowToken({ - clientId: "YOUR_CLIENT_ID", - clientSecret: "YOUR_CLIENT_SECRET", - redirectUri: "https://your-app.com/callback", - code: code, - }); - - const { accessToken, refreshToken } = tokenResponse; -} -``` - -### Step 3: Use the Tokens - -Once you have the tokens, you can create a `CortiClient` instance: - -```typescript -// Create CortiClient with tokens -const client = new CortiClient({ - auth: { - accessToken: accessToken, - refreshToken: refreshToken, - refreshAccessToken: async (refreshToken: string) => { - // Custom refresh logic -- get new access_token from server - const response = await fetch("https://your-auth-server/refresh", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ refreshToken: refreshToken }), - }); - - // Response must return a valid token object: - // { - // accessToken: string; // Required: The new access token - // expiresIn?: number; // Optional: Seconds until token expires - // refreshToken?: string; // Optional: New refresh token if rotated - // refreshExpiresIn?: number; // Optional: Seconds until refresh token expires - // tokenType?: string; // Optional: Token type (defaults to "Bearer") - // } - return response.json(); - }, - }, -}); - -// Now you can use the client for API calls -try { - const interactions = await client.interactions.list(); - console.log("Interactions:", interactions); -} catch (error) { - console.error("API call failed:", error); -} -``` - -## Authorization Code Flow with PKCE - -**✅ Client-Side or Backend** - This method can be fully handled on the client side, or tokens can be exchanged on the backend. This flow is secure, interactive, and doesn't require a client secret (ideal for public clients). Proof Key for Code Exchange (PKCE) protects against code interception attacks. - -**Note**: CORS is enabled for this flow. Requests must come from the same origin as specified in your redirect URIs configuration. - -The Authorization Code Flow with PKCE is ideal for: - -- Native apps -- Single Page Applications (SPAs) -- Browser-based integration where a user is present - -For detailed information about PKCE flow, see the [official Corti documentation](https://docs.corti.ai/about/oauth#1-authorization-code-flow-with-pkce-recommended-for-corti-assistant). - -### Basic Flow Overview - -1. **Generate code verifier and challenge** - Create a code verifier and compute its challenge -2. **Redirect user to authorization URL** - User is redirected to Corti's login page with code challenge -3. **User authenticates** - User logs in and authorizes your application -4. **Receive authorization code** - User is redirected back with an authorization code -5. **Exchange code for tokens with code verifier** - Exchange the authorization code for access and refresh tokens using the code verifier -6. **Use tokens** - Pass the tokens to a new `CortiClient` instance to make authenticated API calls - -### Step 1: Generate Authorization URL (Frontend) - -**Recommended: Use `authorizePkceUrl()`** - The SDK handles code verifier generation and storage automatically: - -```typescript -import { CortiAuth, CortiEnvironment } from "@corti/sdk"; - -const auth = new CortiAuth({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", -}); - -// SDK automatically generates code verifier and stores it in localStorage -const authUrl = await auth.authorizePkceUrl({ - clientId: "YOUR_CLIENT_ID", - redirectUri: "https://your-app.com/callback", -}); - -// To prevent automatic redirect and get URL only: -const authUrlNoRedirect = await auth.authorizePkceUrl( - { - clientId: "YOUR_CLIENT_ID", - redirectUri: "https://your-app.com/callback", - }, - { skipRedirect: true }, -); -``` - -**Alternative: Manual Generation** - If you need more control over the process: - -```typescript -const auth = new CortiAuth({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", -}); - -const codeVerifier = "your-precomputed-verifier"; // Use high-entropy value -const codeChallenge = "your-precomputed-challenge"; // base64url(SHA-256(codeVerifier)) - -const authUrl = await auth.authorizeURL( - { - clientId: "YOUR_CLIENT_ID", - redirectUri: "https://your-app.com/callback", - codeChallenge, - }, - { skipRedirect: true }, -); -``` - -### Step 2: Handle the Callback and Exchange Code for Tokens - -```typescript -// Extract the authorization code from URL parameters -const urlParams = new URLSearchParams(window.location.search); -const code = urlParams.get("code"); -const error = urlParams.get("error"); - -if (error) { - console.error("Authorization failed:", error); - return; -} - -if (code) { - // Retrieve codeVerifier from SDK if you used authorizePkceUrl (automatically stored) - // Otherwise, you need to pass it manually if you generated it yourself - const codeVerifier = auth.getCodeVerifier(); - - if (!codeVerifier) { - console.error("Code verifier not found"); - return; - } - - // Exchange the authorization code for tokens using SDK (client-side) - const tokenResponse = await auth.getPkceFlowToken({ - clientId: "YOUR_CLIENT_ID", - redirectUri: "https://your-app.com/callback", - code: code, - codeVerifier: codeVerifier, - }); - - const { accessToken, refreshToken } = tokenResponse; -} -``` - -### Step 3: Use the Tokens - -Once you have the tokens, you can create a `CortiClient` instance: - -```typescript -// Create CortiClient with tokens -const client = new CortiClient({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", - auth: { - accessToken: accessToken, - refreshToken: refreshToken, - refreshAccessToken: async (refreshToken: string) => { - // Custom refresh logic -- get new access_token from server - const response = await fetch("https://your-auth-server/refresh", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ refreshToken: refreshToken }), - }); - - // Response must return a valid token object: - // { - // accessToken: string; // Required: The new access token - // expiresIn?: number; // Optional: Seconds until token expires - // refreshToken?: string; // Optional: New refresh token if rotated - // refreshExpiresIn?: number; // Optional: Seconds until refresh token expires - // tokenType?: string; // Optional: Token type (defaults to "Bearer") - // } - return response.json(); - }, - }, -}); - -// Now you can use the client for API calls -try { - const interactions = await client.interactions.list(); - console.log("Interactions:", interactions); -} catch (error) { - console.error("API call failed:", error); -} -``` - -## Resource Owner Password Credentials (ROPC) Flow - -**⚠️ Backend Only** - This method should only be used in server-side applications. The ROPC flow allows users to authenticate directly with their username and password using the SDK. - -**⚠️ Security Note**: ROPC flow requires sending credentials directly. This should only be used for: - -- Trusted applications (e.g., first-party mobile apps, backend services) -- Testing and development -- Internal tools - -**For production web applications, use PKCE flow instead.** - -For detailed information about ROPC flow, see the [official Corti documentation](https://docs.corti.ai/about/oauth#3-resource-owner-password-credentials-ropc-grant-use-with-caution). - -### Basic Usage - -```typescript -import { CortiAuth, CortiClient, CortiEnvironment } from "@corti/sdk"; - -const CLIENT_ID = "YOUR_CLIENT_ID"; -const USERNAME = "user@example.com"; -const PASSWORD = "your-password"; - -// Step 1: Exchange credentials for tokens using ROPC flow -const auth = new CortiAuth({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", -}); - -const tokenResponse = await auth.getRopcFlowToken({ - clientId: CLIENT_ID, - username: USERNAME, - password: PASSWORD, -}); - -const { accessToken, refreshToken } = tokenResponse; - -// Step 2: Create CortiClient with tokens -const client = new CortiClient({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", - auth: { - accessToken: accessToken, - refreshToken: refreshToken, - refreshAccessToken: async (refreshToken: string) => { - // Custom refresh logic -- get new access_token from server - const response = await fetch("https://your-auth-server/refresh", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ refreshToken: refreshToken }), - }); - - // Response must return a valid token object: - // { - // accessToken: string; // Required: The new access token - // expiresIn?: number; // Optional: Seconds until token expires - // refreshToken?: string; // Optional: New refresh token if rotated - // refreshExpiresIn?: number; // Optional: Seconds until refresh token expires - // tokenType?: string; // Optional: Token type (defaults to "Bearer") - // } - return response.json(); - }, - }, -}); - -// Step 3: Make API calls -try { - const interactions = await client.interactions.list(); - console.log("Interactions:", interactions); -} catch (error) { - console.error("API call failed:", error); -} -``` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..fe5bc2f7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,133 @@ +# Contributing + +Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project. + +## Getting Started + +### Prerequisites + +- Node.js 20 or higher +- pnpm package manager + +### Installation + +Install the project dependencies: + +```bash +pnpm install +``` + +### Building + +Build the project: + +```bash +pnpm build +``` + +### Testing + +Run the test suite: + +```bash +pnpm test +``` + +Run specific test types: +- `pnpm test:unit` - Run unit tests +- `pnpm test:wire` - Run wire/integration tests + +### Linting and Formatting + +Check code style: + +```bash +pnpm run lint +pnpm run format:check +``` + +Fix code style issues: + +```bash +pnpm run lint:fix +pnpm run format:fix +``` + +Or use the combined check command: + +```bash +pnpm run check:fix +``` + +## About Generated Code + +**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated. + +### Generated Files + +The following directories contain generated code: +- `src/api/` - API client classes and types +- `src/serialization/` - Serialization/deserialization logic +- Most TypeScript files in `src/` + +### How to Customize + +If you need to customize the SDK, you have two options: + +#### Option 1: Use `.fernignore` + +For custom code that should persist across SDK regenerations: + +1. Create a `.fernignore` file in the project root +2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax) +3. Add your custom code to those files + +Files listed in `.fernignore` will not be overwritten when the SDK is regenerated. + +For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code). + +#### Option 2: Contribute to the Generator + +If you want to change how code is generated for all users of this SDK: + +1. The TypeScript SDK generator lives in the [Fern repository](https://github.com/fern-api/fern) +2. Generator code is located at `generators/typescript/sdk/` +3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md) +4. Submit a pull request with your changes to the generator + +This approach is best for: +- Bug fixes in generated code +- New features that would benefit all users +- Improvements to code generation patterns + +## Making Changes + +### Workflow + +1. Create a new branch for your changes +2. Make your modifications +3. Run tests to ensure nothing breaks: `pnpm test` +4. Run linting and formatting: `pnpm run check:fix` +5. Build the project: `pnpm build` +6. Commit your changes with a clear commit message +7. Push your branch and create a pull request + +### Commit Messages + +Write clear, descriptive commit messages that explain what changed and why. + +### Code Style + +This project uses automated code formatting and linting. Run `pnpm run check:fix` before committing to ensure your code meets the project's style guidelines. + +## Questions or Issues? + +If you have questions or run into issues: + +1. Check the [Fern documentation](https://buildwithfern.com) +2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues) +3. Open a new issue if your question hasn't been addressed + +## License + +By contributing to this project, you agree that your contributions will be licensed under the same license as the project. diff --git a/PROXYING.md b/PROXYING.md deleted file mode 100644 index a956a37e..00000000 --- a/PROXYING.md +++ /dev/null @@ -1,343 +0,0 @@ -# Proxying Guide - -This guide explains how to use proxying with the Corti JavaScript SDK to securely handle authentication in frontend applications and protect sensitive credentials. - -## Why Proxying? - -When using **Client Credentials** authentication, the token you receive is a **service account user token** that provides access to all data created within the same API Client. This means: - -- **Data isolation is your responsibility** - You must implement access control logic to ensure users can only access their own data -- **Frontend exposure risk** - If you expose a Client Credentials token in your frontend application, it could be used to access all data associated with that API Client, not just the current user's data - -### Security Best Practice - -**Our general recommendation when Client Credentials is used is to use the SDK (or other calls to Corti API) only on the backend** where you can: - -- Securely store client credentials -- Implement proper access control checks -- Validate user permissions before making API calls -- Call from the frontend only your own backend methods - -However, if you need to use the SDK directly from the frontend while maintaining security, proxying provides a solution. - -For more information about Client Credentials authentication, see the [Authentication Guide - Client Credentials](./AUTHENTICATION.md#client-credentials-authentication). - -## Using Proxying with baseUrl and environments - -If you're implementing a proxy instead of your own backend methods, you can leverage the SDK's types and endpoint structures by using the `baseUrl` and `environments` options for both `CortiClient` and `CortiAuth`. - -### Using baseUrl - -The `baseUrl` option allows you to point the SDK to your own proxy server instead of directly to Corti's API. All requests will be routed through your proxy. - -#### Example: CortiClient with baseUrl - -```typescript -import { CortiClient } from "@corti/sdk"; - -// Point the client to your proxy server -const client = new CortiClient({ - baseUrl: "https://your-proxy-server.com/api/corti_proxy", - // Optional: You can omit the `auth` option if your proxy handles authentication. - // If provided, it will add the header: `Authorization: Bearer {accessToken}` - auth: { - accessToken: "YOUR_TOKEN", - }, - // Optional: You can add custom headers here. These headers will be included in every request sent by the client. - headers: { - 'X-Custom-Header': "CUSTOM_HEADER_VALUE", - } -}); - -// All API calls will go to your proxy -const interactions = await client.interactions.list(); -// Under the hood: GET https://your-proxy-server.com/api/corti_proxy/interactions -``` - -#### Example: CortiAuth with baseUrl - -```typescript -import { CortiAuth } from "@corti/sdk"; - -const auth = new CortiAuth({ - baseUrl: "https://your-proxy-server.com/auth/corti_proxy", -}); - -// Token requests will go to your proxy -const tokenResponse = await auth.getToken({ - clientId: "YOUR_CLIENT_ID", - clientSecret: "YOUR_CLIENT_SECRET", -}); -// Under the hood: POST https://your-proxy-server.com/auth/corti_proxy/{tenantName}/protocol/openid-connect/token -// Under the hood if tenantName is empty: POST https://your-proxy-server.com/auth/corti_proxy/protocol/openid-connect/token -``` - -### Using Custom Environments - -Instead of using `baseUrl`, you can provide a custom environment object that defines all the endpoints your proxy uses. This gives you fine-grained control over where different types of requests are routed. - -#### Environment Object Structure - -The environment object has the following structure: - -```typescript -interface CortiEnvironmentUrls { - base: string; // Base URL for REST API calls (e.g., "https://your-proxy.com/api/v2/corti_proxy") - wss: string; // WebSocket URL for stream/transcribe connections (e.g., "wss://your-proxy.com/corti_proxy") - login: string; // Authentication endpoint base URL (e.g., "https://your-proxy.com/auth/realms/corti_proxy") - agents: string; // Agents API base URL (e.g., "https://your-proxy.com/api/corti_proxy") -} -``` - -#### Example: CortiClient with Custom Environment - -```typescript -import { CortiClient } from "@corti/sdk"; - -const customEnvironment = { - base: "https://your-proxy-server.com/api/corti_proxy", - wss: "wss://your-proxy-server.com/corti_proxy", - login: "https://your-proxy-server.com/auth/corti_proxy", - agents: "https://your-proxy-server.com/agents/corti_proxy", -}; - -const client = new CortiClient({ - environment: customEnvironment, - // Optional: You can omit the `auth` option if your proxy handles authentication. - // If provided, it will add the header: `Authorization: Bearer {accessToken}` - auth: { - accessToken: "YOUR_TOKEN", - }, - // Optional: You can add custom headers here. These headers will be included in every request sent by the client. - headers: { - 'X-Custom-Header': "CUSTOM_HEADER_VALUE", - } -}); - -// REST API calls use environment.base -const interactions = await client.interactions.list(); -// Under the hood: GET https://your-proxy-server.com/api/corti_proxy/interactions - -// WebSocket connections use environment.wss -const socket = await client.stream.connect({ id: "interaction-id" }); -// Under the hood: Connects to wss://your-proxy-server.com/corti_proxy/interactions/{interaction-id}/stream -``` - -#### Example: CortiAuth with Custom Environment - -```typescript -import { CortiAuth } from "@corti/sdk"; - -const customEnvironment = { - base: "https://your-proxy-server.com/api/corti_proxy", - wss: "wss://your-proxy-server.com/corti_proxy", - login: "https://your-proxy-server.com/auth/corti_proxy", - agents: "https://your-proxy-server.com/agents/corti_proxy", -}; - -const auth = new CortiAuth({ - environment: customEnvironment, -}); - -// Token requests use environment.login -const tokenResponse = await auth.getToken({ - clientId: "YOUR_CLIENT_ID", - clientSecret: "YOUR_CLIENT_SECRET", -}); -// Under the hood: POST https://your-proxy-server.com/auth/corti_proxy/{tenantName}/protocol/openid-connect/token -// Under the hood when tenantName is empty: POST https://your-proxy-server.com/auth/corti_proxy/protocol/openid-connect/token -``` - -### What Gets Called Under the Hood - -When you use `baseUrl` or a custom environment: - -1. **REST API calls** - All HTTP requests (GET, POST, PUT, DELETE, etc.) are sent to your proxy's base URL -2. **Authentication requests** - Token requests are sent to your proxy's login endpoint -3. **WebSocket connections** - WebSocket connections are established to your proxy's WebSocket URL - -Your proxy server should: - -- Forward requests to the appropriate Corti API endpoints -- Handle authentication and add the necessary tokens -- Implement access control and data filtering -- Return responses in the same format as Corti's API - -## WebSocket Proxying with CortiWebSocketProxyClient - -For WebSocket connections (stream and transcribe), the SDK provides `CortiWebSocketProxyClient` to make proxying even easier. This client handles all the logic around managing sockets, parsing messages, and sending configuration automatically, while allowing you to connect to your own WebSocket proxy endpoint. - -### Basic Usage - -```typescript -import { CortiWebSocketProxyClient } from "@corti/sdk"; - -// Connect to stream through your proxy -const streamSocket = await CortiWebSocketProxyClient.stream.connect({ - proxy: { - url: "wss://your-proxy-server.com/corti_proxy/steam", - // Optional: specify WebSocket subprotocols - protocols: ["stream-protocol"], - // Optional: add query parameters - queryParameters: { - interactionId: "interaction-id", - }, - }, - // Optional: stream configuration - configuration: { - // ... your stream configuration - }, -}); - -// Listen for messages -streamSocket.on("message", (data) => { - console.log("Received:", data); -}); - -// Send messages -streamSocket.send({ type: "message", content: "Hello" }); - -// Connect to transcribe through your proxy -const transcribeSocket = await CortiWebSocketProxyClient.transcribe.connect({ - proxy: { - url: "wss://your-proxy-server.com/corti_proxy/transcribe", - queryParameters: { - interactionId: "interaction-id", - }, - }, - // Optional: transcribe configuration - configuration: { - // ... your transcribe configuration - }, -}); -``` - -### Proxy Options - -The `proxy` parameter accepts the following options: - -- **`url`** (required): The WebSocket URL of your proxy server -- **`protocols`** (optional): WebSocket subprotocols. Pass an **array** to use it as-is on the WebSocket handshake. Pass an **object** (e.g. `{ "Custom-Header": value }`) to have it encoded the same way as headers (name, `encodeURIComponent(value)`, ...); values can be strings or suppliers (e.g. functions). -- **`queryParameters`** (optional): Query parameters to append to the WebSocket URL - -### Encoding custom headers as WebSocket protocols - -You can use **`encodeHeadersAsWsProtocols`** whenever you pass `headers` on **`CortiClient`**; it only makes sense when you use the same client with a proxy for **both** REST API and WebSocket (stream/transcribe). In that case, the client encodes those headers as **WebSocket subprotocols** (each header as two strings: name, then `encodeURIComponent(value)`), since browsers do not allow arbitrary HTTP headers on the WebSocket handshake. Your proxy can read them from `Sec-WebSocket-Protocol` and use or forward them. - -If you only use WebSocket through a proxy (e.g. with `CortiWebSocketProxyClient`) or you don't need the same headers on the WS handshake, pass protocols as usual via **`proxy.protocols`** when calling `stream.connect` or `transcribe.connect`. - -#### Example: CortiClient with encodeHeadersAsWsProtocols - -```typescript -import { CortiClient } from "@corti/sdk"; - -const client = new CortiClient({ - baseUrl: "https://your-proxy-server.com/api/corti_proxy", - encodeHeadersAsWsProtocols: true, - headers: { - "Custom-Header": customValue, - "Custom-Protocol": () => getLatestProtocolValue(), // suppliers (e.g. functions) are resolved when connecting - }, -}); - -// When connecting, Sec-WebSocket-Protocol will include the encoded headers -const socket = await client.stream.connect({ - id: "interaction-id", -}); -// Under the hood: protocols sent as e.g. ["Custom-Header", "", "Custom-Protocol", ""] -``` - -Your proxy should parse the `Sec-WebSocket-Protocol` header to extract these name/value pairs (split by comma, then decode and pair them) and use or forward them as required. - -### Benefits - -Using `CortiWebSocketProxyClient` provides: - -- **Configuration handling** - Configuration messages are automatically sent when connecting -- **Reconnection logic** - Built-in reconnection handling with configurable attempts -- **Type safety** - Full TypeScript support for all message types and configurations -- **Event handling** - Standard WebSocket event interface (message, error, close, open) - -## Scoped Tokens (Alternative to Proxying) - -If exposing an `accessToken` for WebSockets is absolutely necessary and a proxy cannot be implemented, you can use **scoped tokens** to limit the token's access. By passing additional scopes to authentication methods, you can issue a token that only grants access to specific endpoints, preventing the token from being used to access other data. - -### Available Scopes - -Currently available scopes: - -- **`"transcribe"`** - Grants access only to the transcribe WebSocket endpoint -- **`"stream"`** - Grants access only to the stream WebSocket endpoint - -### Using Scopes with Client Credentials - -```typescript -import { CortiAuth, CortiEnvironment } from "@corti/sdk"; - -const auth = new CortiAuth({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", -}); - -// Request a token with only stream scope -const streamToken = await auth.getToken({ - clientId: "YOUR_CLIENT_ID", - clientSecret: "YOUR_CLIENT_SECRET", - scopes: ["stream"], -}); - -// Request a token with only transcribe scope -const transcribeToken = await auth.getToken({ - clientId: "YOUR_CLIENT_ID", - clientSecret: "YOUR_CLIENT_SECRET", - scopes: ["transcribe"], -}); - -// Request a token with both scopes -const bothScopesToken = await auth.getToken({ - clientId: "YOUR_CLIENT_ID", - clientSecret: "YOUR_CLIENT_SECRET", - scopes: ["stream", "transcribe"], -}); -``` - -### Important Notes on Scoped Tokens - -- **Limited access** - Scoped tokens can only be used for the specified endpoints (stream or transcribe WebSocket connections) -- **Cannot access REST API** - Scoped tokens cannot be used to make REST API calls to access data -- **Security consideration** - While scoped tokens limit access, they still provide access to WebSocket endpoints. Proxying remains the recommended approach for maximum security -- **Token validation** - The Corti API will reject requests made with scoped tokens to endpoints outside their scope - -### Using Scoped Tokens with WebSocket Clients - -```typescript -import { CortiClient, CortiEnvironment } from "@corti/sdk"; - -// Create client with scoped token (stream scope only) -const client = new CortiClient({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", - auth: { - accessToken: streamToken.accessToken, // Token with "stream" scope - }, -}); - -// This will work - stream is within the token's scope -const streamSocket = await client.stream.connect({ id: "interaction-id" }); - -// This will fail - transcribe is not within the token's scope -// await client.transcribe.connect({ id: "interaction-id" }); // ❌ Error - -// This will fail - REST API calls are not within the token's scope -// await client.interactions.list(); // ❌ Error -``` - -## Summary - -- **Proxying is recommended** when using Client Credentials in frontend applications to protect sensitive tokens and implement proper access control -- **Use `baseUrl` or custom environments** to route SDK requests through your proxy server while maintaining type safety -- **Use `CortiWebSocketProxyClient`** for simplified WebSocket proxying with automatic message handling -- **Use `encodeHeadersAsWsProtocols`** on `CortiClient` only when using the same client with a proxy for both API and WebSocket and you need the same headers on the WS handshake; otherwise pass **`proxy.protocols`** as usual -- **Scoped tokens** provide an alternative when proxying isn't possible, but limit access to specific WebSocket endpoints only - -For more information about authentication methods, see the [Authentication Guide](./AUTHENTICATION.md). diff --git a/README.md b/README.md index 8f0dc3f2..e69de29b 100644 --- a/README.md +++ b/README.md @@ -1,266 +0,0 @@ -# Corti JavaScript SDK - -[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fcorticph%2Fcorti-sdk-javascript) -[![npm shield](https://img.shields.io/npm/v/@corti/sdk)](https://www.npmjs.com/package/@corti/sdk) - -> This is a **Beta version** of the Corti JavaScript SDK. We are treating it as stable for production use, but -> there may still be breaking changes before we reach version 1.0. We're actively working to improve the SDK and would greatly -> appreciate any feedback if you encounter any inconsistencies or issues 💚 - -The Corti JavaScript SDK provides convenient access to the Corti API from JavaScript. - -## Installation - -```sh -npm i -s @corti/sdk -``` - -## Reference - -For detailed authentication instructions, see the [Authentication Guide](./AUTHENTICATION.md). - -For information about proxying and securing frontend implementations, see the [Proxying Guide](./PROXYING.md). - -## Usage - -Instantiate and use the client with the following: - -```typescript -import { CortiEnvironment, CortiClient } from "@corti/sdk"; - -// Using client credentials (OAuth2) -const client = new CortiClient({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", - auth: { - clientId: "YOUR_CLIENT_ID", - clientSecret: "YOUR_CLIENT_SECRET", - }, -}); - -// Or using a bearer token -const client = new CortiClient({ - auth: { - accessToken: "YOUR_ACCESS_TOKEN", - }, -}); - -// Or using just a refresh function (no initial access token needed) -const client = new CortiClient({ - auth: { - // refreshToken will be undefined for the first call, then it will be the refreshToken returned from the previous token request - refreshAccessToken: async (refreshToken?: string) => { - // Your custom logic to get a new access token - const response = await fetch("https://your-auth-server/token", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ refreshToken }), - }); - - return response.json(); - }, - }, -}); - -// For user authentication, you can use: -// - Authorization Code Flow -// - Authorization Code Flow with PKCE -// - Resource Owner Password Credentials (ROPC) flow -// See the Authentication Guide for detailed instructions - -await client.interactions.create({ - encounter: { - identifier: "identifier", - status: "planned", - type: "first_consultation", - }, -}); -``` - -## Request And Response Types - -The SDK exports all request and response types as TypeScript interfaces. Simply import them with the -following namespace: - -```typescript -import { Corti } from "@corti/sdk"; - -const request: Corti.InteractionsListRequest = { - ... -}; -``` - -## Exception Handling - -Depending on the type of error, the SDK will throw one of the following: - -- **CortiError**: Thrown when the API returns a non-success status code (4xx or 5xx response). This is the base error for API-related issues. -- **ParseError**: Thrown when parsing input data fails schema validation. This typically occurs when the data you provide does not match the expected schema. -- **JsonError**: Thrown when serializing data to JSON fails schema validation. This typically occurs when converting parsed data to JSON for transmission or storage fails validation. -- **CortiSDKError**: Base class for SDK-specific runtime issues (e.g., internal helpers, environment detection). Provides an optional `code` and `cause` for debugging. - -Example usage: - -```typescript -import { CortiError, ParseError, JsonError, CortiSDKError } from "@corti/sdk"; - -try { - await client.interactions.create(...); -} catch (err) { - if (err instanceof CortiError) { - // Handle API errors - console.log(err.statusCode); - console.log(err.message); - console.log(err.body); - console.log(err.rawResponse); - } - if (err instanceof ParseError) { - // Handle schema validation errors during parsing - console.error("Parse validation error details:", err.errors); - } - if (err instanceof JsonError) { - // Handle schema validation errors during serialization - console.error("JSON validation error details:", err.errors); - } - if (err instanceof CortiSDKError) { - // Handle other SDK-level errors that expose extra context - console.error("SDK error code:", err.code); - console.error("SDK error cause:", err.cause); - if (err.code === "local_storage_error") { - console.error("LocalStorage operation failed:", err.message); - } - } -} -``` - -## Pagination - -List endpoints are paginated. The SDK provides an iterator so that you can simply loop over the items: - -```typescript -import { CortiEnvironment, CortiClient } from "@corti/sdk"; - -const client = new CortiClient({ - environment: CortiEnvironment.Eu, - tenantName: "YOUR_TENANT_NAME", - auth: { - clientId: "YOUR_CLIENT_ID", - clientSecret: "YOUR_CLIENT_SECRET", - }, -}); -const response = await client.interactions.list(); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.interactions.list(); -while (page.hasNextPage()) { - page = page.getNextPage(); -} -``` - -## Advanced - -### Additional Headers - -If you would like to send additional headers as part of the request, use the `headers` request option. - -```typescript -const response = await client.interactions.create(..., { - headers: { - 'X-Custom-Header': 'custom value' - } -}); -``` - -### Retries - -The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long -as the request is deemed retryable and the number of retry attempts has not grown larger than the configured -retry limit (default: 2). - -A request is deemed retryable when any of the following HTTP status codes is returned: - -- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) -- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) - -Use the `maxRetries` request option to configure this behavior. - -```typescript -const response = await client.interactions.create(..., { - maxRetries: 0 // override maxRetries at the request level -}); -``` - -### Timeouts - -The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior. - -```typescript -const response = await client.interactions.create(..., { - timeoutInSeconds: 30 // override timeout to 30s -}); -``` - -### Aborting Requests - -The SDK allows users to abort requests at any point by passing in an abort signal. - -```typescript -const controller = new AbortController(); -const response = await client.interactions.create(..., { - abortSignal: controller.signal -}); -controller.abort(); // aborts the request -``` - -### Access Raw Response Data - -The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method. -The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property. - -```typescript -const { data, rawResponse } = await client.interactions.create(...).withRawResponse(); - -console.log(data); -console.log(rawResponse.headers['X-My-Header']); -``` - -### Runtime Compatibility - -The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following -runtimes: - -- Node.js 18+ -- Modern browsers -- Vercel -- Cloudflare Workers -- Deno v1.25+ -- Bun 1.0+ -- React Native - -### Customizing Fetch Client - -The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an -unsupported environment, this provides a way for you to break glass and ensure the SDK works. - -```typescript -import { CortiClient } from "@corti/sdk"; - -const client = new CortiClient({ - ... - fetcher: // provide your implementation here -}); -``` - -## Contributing - -While we value open-source contributions to this SDK, this repo is (mostly) generated programmatically. -Additions made directly to this code would have to be moved over to our generation code, -otherwise they would be overwritten upon the next generated release. Feel free to open a PR as -a proof of concept, but know that we will not be able to merge it as-is. We suggest opening -an issue first to discuss with us! - -On the other hand, contributions to the README are always very welcome! diff --git a/biome.json b/biome.json new file mode 100644 index 00000000..5084b70a --- /dev/null +++ b/biome.json @@ -0,0 +1,74 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.4.3/schema.json", + "root": true, + "vcs": { + "enabled": false + }, + "files": { + "ignoreUnknown": true, + "includes": [ + "**", + "!!dist", + "!!**/dist", + "!!lib", + "!!**/lib", + "!!_tmp_*", + "!!**/_tmp_*", + "!!*.tmp", + "!!**/*.tmp", + "!!.tmp/", + "!!**/.tmp/", + "!!*.log", + "!!**/*.log", + "!!**/.DS_Store", + "!!**/Thumbs.db" + ] + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 4, + "lineWidth": 120 + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + }, + "assist": { + "enabled": true, + "actions": { + "source": { + "organizeImports": "on" + } + } + }, + "linter": { + "rules": { + "style": { + "useNodejsImportProtocol": "off" + }, + "suspicious": { + "noAssignInExpressions": "warn", + "noUselessEscapeInString": { + "level": "warn", + "fix": "none", + "options": {} + }, + "noThenProperty": "warn", + "useIterableCallbackReturn": "warn", + "noShadowRestrictedNames": "warn", + "noTsIgnore": { + "level": "warn", + "fix": "none", + "options": {} + }, + "noConfusingVoidType": { + "level": "warn", + "fix": "none", + "options": {} + } + } + } + } +} diff --git a/jest.config.mjs b/jest.config.mjs deleted file mode 100644 index b6927007..00000000 --- a/jest.config.mjs +++ /dev/null @@ -1,42 +0,0 @@ -/** @type {import('jest').Config} */ -export default { - preset: "ts-jest", - testEnvironment: "node", - projects: [ - { - displayName: "unit", - preset: "ts-jest", - testEnvironment: "node", - moduleNameMapper: { - "^(\.{1,2}/.*)\.js$": "$1", - }, - roots: ["/tests"], - testPathIgnorePatterns: ["\.browser\.(spec|test)\.[jt]sx?$", "/tests/wire/"], - setupFilesAfterEnv: [], - }, - { - displayName: "browser", - preset: "ts-jest", - testEnvironment: "/tests/BrowserTestEnvironment.ts", - moduleNameMapper: { - "^(\.{1,2}/.*)\.js$": "$1", - }, - roots: ["/tests"], - testMatch: ["/tests/unit/**/?(*.)+(browser).(spec|test).[jt]s?(x)"], - setupFilesAfterEnv: [], - }, - , - { - displayName: "wire", - preset: "ts-jest", - testEnvironment: "node", - moduleNameMapper: { - "^(\.{1,2}/.*)\.js$": "$1", - }, - roots: ["/tests/wire"], - setupFilesAfterEnv: ["/tests/mock-server/setup.ts"], - }, - ], - workerThreads: false, - passWithNoTests: true, -}; diff --git a/jest.integration.config.mjs b/jest.integration.config.mjs deleted file mode 100644 index 1b5c68b7..00000000 --- a/jest.integration.config.mjs +++ /dev/null @@ -1,16 +0,0 @@ -/** @type {import('jest').Config} */ -export default { - preset: "ts-jest", - testEnvironment: "node", - displayName: "integration", - moduleNameMapper: { - "^(\\.{1,2}/.*)\\.js$": "$1", - }, - roots: ["/tests/custom", "/src"], - testMatch: ["**/*.integration.ts"], - setupFilesAfterEnv: [], - testTimeout: 120000, // 2 minute TTL - maxWorkers: 1, // Run tests one by one (no concurrent execution) - workerThreads: false, - passWithNoTests: true, -}; diff --git a/package.json b/package.json index 60fa5c9a..e598b09b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,10 @@ "name": "@corti/sdk", "version": "0.10.1", "private": false, - "repository": "github:corticph/corti-sdk-javascript", + "repository": { + "type": "git", + "url": "git+https://github.com/corticph/corti-sdk-javascript.git" + }, "license": "MIT", "type": "commonjs", "main": "./dist/cjs/index.js", @@ -33,6 +36,126 @@ }, "default": "./dist/cjs/serialization/index.js" }, + "./interactions": { + "types": "./dist/cjs/api/resources/interactions/exports.d.ts", + "import": { + "types": "./dist/esm/api/resources/interactions/exports.d.mts", + "default": "./dist/esm/api/resources/interactions/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/interactions/exports.d.ts", + "default": "./dist/cjs/api/resources/interactions/exports.js" + }, + "default": "./dist/cjs/api/resources/interactions/exports.js" + }, + "./recordings": { + "types": "./dist/cjs/api/resources/recordings/exports.d.ts", + "import": { + "types": "./dist/esm/api/resources/recordings/exports.d.mts", + "default": "./dist/esm/api/resources/recordings/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/recordings/exports.d.ts", + "default": "./dist/cjs/api/resources/recordings/exports.js" + }, + "default": "./dist/cjs/api/resources/recordings/exports.js" + }, + "./transcripts": { + "types": "./dist/cjs/api/resources/transcripts/exports.d.ts", + "import": { + "types": "./dist/esm/api/resources/transcripts/exports.d.mts", + "default": "./dist/esm/api/resources/transcripts/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/transcripts/exports.d.ts", + "default": "./dist/cjs/api/resources/transcripts/exports.js" + }, + "default": "./dist/cjs/api/resources/transcripts/exports.js" + }, + "./facts": { + "types": "./dist/cjs/api/resources/facts/exports.d.ts", + "import": { + "types": "./dist/esm/api/resources/facts/exports.d.mts", + "default": "./dist/esm/api/resources/facts/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/facts/exports.d.ts", + "default": "./dist/cjs/api/resources/facts/exports.js" + }, + "default": "./dist/cjs/api/resources/facts/exports.js" + }, + "./documents": { + "types": "./dist/cjs/api/resources/documents/exports.d.ts", + "import": { + "types": "./dist/esm/api/resources/documents/exports.d.mts", + "default": "./dist/esm/api/resources/documents/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/documents/exports.d.ts", + "default": "./dist/cjs/api/resources/documents/exports.js" + }, + "default": "./dist/cjs/api/resources/documents/exports.js" + }, + "./templates": { + "types": "./dist/cjs/api/resources/templates/exports.d.ts", + "import": { + "types": "./dist/esm/api/resources/templates/exports.d.mts", + "default": "./dist/esm/api/resources/templates/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/templates/exports.d.ts", + "default": "./dist/cjs/api/resources/templates/exports.js" + }, + "default": "./dist/cjs/api/resources/templates/exports.js" + }, + "./codes": { + "types": "./dist/cjs/api/resources/codes/exports.d.ts", + "import": { + "types": "./dist/esm/api/resources/codes/exports.d.mts", + "default": "./dist/esm/api/resources/codes/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/codes/exports.d.ts", + "default": "./dist/cjs/api/resources/codes/exports.js" + }, + "default": "./dist/cjs/api/resources/codes/exports.js" + }, + "./agents": { + "types": "./dist/cjs/api/resources/agents/exports.d.ts", + "import": { + "types": "./dist/esm/api/resources/agents/exports.d.mts", + "default": "./dist/esm/api/resources/agents/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/agents/exports.d.ts", + "default": "./dist/cjs/api/resources/agents/exports.js" + }, + "default": "./dist/cjs/api/resources/agents/exports.js" + }, + "./stream": { + "types": "./dist/cjs/api/resources/stream/exports.d.ts", + "import": { + "types": "./dist/esm/api/resources/stream/exports.d.mts", + "default": "./dist/esm/api/resources/stream/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/stream/exports.d.ts", + "default": "./dist/cjs/api/resources/stream/exports.js" + }, + "default": "./dist/cjs/api/resources/stream/exports.js" + }, + "./transcribe": { + "types": "./dist/cjs/api/resources/transcribe/exports.d.ts", + "import": { + "types": "./dist/esm/api/resources/transcribe/exports.d.mts", + "default": "./dist/esm/api/resources/transcribe/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/transcribe/exports.d.ts", + "default": "./dist/cjs/api/resources/transcribe/exports.js" + }, + "default": "./dist/cjs/api/resources/transcribe/exports.js" + }, "./package.json": "./package.json" }, "files": [ @@ -42,14 +165,18 @@ "LICENSE" ], "scripts": { - "format": "prettier . --write --ignore-unknown", - "build": "yarn build:cjs && yarn build:esm", + "format": "biome format --write --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "format:check": "biome format --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "lint": "biome lint --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "lint:fix": "biome lint --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "check": "biome check --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "check:fix": "biome check --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "build": "pnpm build:cjs && pnpm build:esm", "build:cjs": "tsc --project ./tsconfig.cjs.json", "build:esm": "tsc --project ./tsconfig.esm.json && node scripts/rename-to-esm-files.js dist/esm", - "test": "jest --config jest.config.mjs", - "test:unit": "jest --selectProjects unit", - "test:browser": "jest --selectProjects browser", - "test:wire": "jest --selectProjects wire" + "test": "vitest", + "test:unit": "vitest --project unit", + "test:wire": "vitest --project wire" }, "dependencies": { "ws": "^8.16.0" @@ -58,15 +185,11 @@ "webpack": "^5.97.1", "ts-loader": "^9.5.1", "@types/ws": "^8.5.10", - "jest": "^29.7.0", - "@jest/globals": "^29.7.0", - "@types/jest": "^29.5.14", - "ts-jest": "^29.3.4", - "jest-environment-jsdom": "^29.7.0", - "msw": "^2.8.4", + "vitest": "^3.2.4", + "msw": "2.11.2", "@types/node": "^18.19.70", - "prettier": "^3.4.2", "typescript": "~5.7.2", + "@biomejs/biome": "2.4.3", "@faker-js/faker": "^9.9.0" }, "browser": { @@ -75,7 +198,7 @@ "path": false, "stream": false }, - "packageManager": "yarn@1.22.22", + "packageManager": "pnpm@10.20.0", "engines": { "node": ">=18.0.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 00000000..6196346a --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,2202 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + ws: + specifier: ^8.16.0 + version: 8.19.0 + devDependencies: + '@biomejs/biome': + specifier: 2.4.3 + version: 2.4.3 + '@faker-js/faker': + specifier: ^9.9.0 + version: 9.9.0 + '@types/node': + specifier: ^18.19.70 + version: 18.19.130 + '@types/ws': + specifier: ^8.5.10 + version: 8.18.1 + msw: + specifier: 2.11.2 + version: 2.11.2(@types/node@18.19.130)(typescript@5.7.3) + ts-loader: + specifier: ^9.5.1 + version: 9.5.4(typescript@5.7.3)(webpack@5.105.2) + typescript: + specifier: ~5.7.2 + version: 5.7.3 + vitest: + specifier: ^3.2.4 + version: 3.2.4(@types/node@18.19.130)(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(terser@5.46.0) + webpack: + specifier: ^5.97.1 + version: 5.105.2 + +packages: + + '@biomejs/biome@2.4.3': + resolution: {integrity: sha512-cBrjf6PNF6yfL8+kcNl85AjiK2YHNsbU0EvDOwiZjBPbMbQ5QcgVGFpjD0O52p8nec5O8NYw7PKw3xUR7fPAkQ==} + engines: {node: '>=14.21.3'} + hasBin: true + + '@biomejs/cli-darwin-arm64@2.4.3': + resolution: {integrity: sha512-eOafSFlI/CF4id2tlwq9CVHgeEqvTL5SrhWff6ZORp6S3NL65zdsR3ugybItkgF8Pf4D9GSgtbB6sE3UNgOM9w==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [darwin] + + '@biomejs/cli-darwin-x64@2.4.3': + resolution: {integrity: sha512-V2+av4ilbWcBMNufTtMMXVW00nPwyIjI5qf7n9wSvUaZ+tt0EvMGk46g9sAFDJBEDOzSyoRXiSP6pCvKTOEbPA==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [darwin] + + '@biomejs/cli-linux-arm64-musl@2.4.3': + resolution: {integrity: sha512-QuFzvsGo8BA4Xm7jGX5idkw6BqFblcCPySMTvq0AhGYnhUej5VJIDJbmTKfHqwjHepZiC4fA+T5i6wmiZolZNw==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + + '@biomejs/cli-linux-arm64@2.4.3': + resolution: {integrity: sha512-0m+O0x9FgK99FAwDK+fiDtjs2wnqq7bvfj17KJVeCkTwT/liI+Q9njJG7lwXK0iSJVXeFNRIxukpVI3SifMYAA==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + + '@biomejs/cli-linux-x64-musl@2.4.3': + resolution: {integrity: sha512-qEc0OCpj/uytruQ4wLM0yWNJLZy0Up8H1Er5MW3SrstqM6J2d4XqdNA86xzCy8MQCHpoVZ3lFye3GBlIL4/ljw==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + + '@biomejs/cli-linux-x64@2.4.3': + resolution: {integrity: sha512-NVqh0saIU0u5OfOp/0jFdlKRE59+XyMvWmtx0f6Nm/2OpdxBl04coRIftBbY9d1gfu+23JVv4CItAqPYrjYh5w==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + + '@biomejs/cli-win32-arm64@2.4.3': + resolution: {integrity: sha512-gRO96vrIARilv/Cp2ZnmNNL5LSZg3RO75GPp13hsLO3N4YVpE7saaMDp2bcyV48y2N2Pbit1brkGVGta0yd6VQ==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [win32] + + '@biomejs/cli-win32-x64@2.4.3': + resolution: {integrity: sha512-vSm/vOJe06pf14aGHfHl3Ar91Nlx4YYmohElDJ+17UbRwe99n987S/MhAlQOkONqf1utJor04ChkCPmKb8SWdw==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [win32] + + '@bundled-es-modules/cookie@2.0.1': + resolution: {integrity: sha512-8o+5fRPLNbjbdGRRmJj3h6Hh1AQJf2dk3qQ/5ZFb+PXkRNiSoMGGUKlsgLfrxneb72axVJyIYji64E2+nNfYyw==} + + '@bundled-es-modules/statuses@1.0.1': + resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==} + + '@esbuild/aix-ppc64@0.27.3': + resolution: {integrity: sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.27.3': + resolution: {integrity: sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.27.3': + resolution: {integrity: sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.27.3': + resolution: {integrity: sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.27.3': + resolution: {integrity: sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.27.3': + resolution: {integrity: sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.27.3': + resolution: {integrity: sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.27.3': + resolution: {integrity: sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.27.3': + resolution: {integrity: sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.27.3': + resolution: {integrity: sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.27.3': + resolution: {integrity: sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.27.3': + resolution: {integrity: sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.27.3': + resolution: {integrity: sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.27.3': + resolution: {integrity: sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.27.3': + resolution: {integrity: sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.27.3': + resolution: {integrity: sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.27.3': + resolution: {integrity: sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.27.3': + resolution: {integrity: sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.27.3': + resolution: {integrity: sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.27.3': + resolution: {integrity: sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.27.3': + resolution: {integrity: sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.27.3': + resolution: {integrity: sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.27.3': + resolution: {integrity: sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.27.3': + resolution: {integrity: sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.27.3': + resolution: {integrity: sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.27.3': + resolution: {integrity: sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@faker-js/faker@9.9.0': + resolution: {integrity: sha512-OEl393iCOoo/z8bMezRlJu+GlRGlsKbUAN7jKB6LhnKoqKve5DXRpalbItIIcwnCjs1k/FOPjFzcA6Qn+H+YbA==} + engines: {node: '>=18.0.0', npm: '>=9.0.0'} + + '@inquirer/ansi@1.0.2': + resolution: {integrity: sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ==} + engines: {node: '>=18'} + + '@inquirer/confirm@5.1.21': + resolution: {integrity: sha512-KR8edRkIsUayMXV+o3Gv+q4jlhENF9nMYUZs9PA2HzrXeHI8M5uDag70U7RJn9yyiMZSbtF5/UexBtAVtZGSbQ==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/core@10.3.2': + resolution: {integrity: sha512-43RTuEbfP8MbKzedNqBrlhhNKVwoK//vUFNW3Q3vZ88BLcrs4kYpGg+B2mm5p2K/HfygoCxuKwJJiv8PbGmE0A==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/figures@1.0.15': + resolution: {integrity: sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g==} + engines: {node: '>=18'} + + '@inquirer/type@3.0.10': + resolution: {integrity: sha512-BvziSRxfz5Ov8ch0z/n3oijRSEcEsHnhggm4xFZe93DHcUCTlutlq9Ox4SVENAfcRD22UQq7T/atg9Wr3k09eA==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@jridgewell/gen-mapping@0.3.13': + resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/source-map@0.3.11': + resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==} + + '@jridgewell/sourcemap-codec@1.5.5': + resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} + + '@jridgewell/trace-mapping@0.3.31': + resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + + '@mswjs/interceptors@0.39.8': + resolution: {integrity: sha512-2+BzZbjRO7Ct61k8fMNHEtoKjeWI9pIlHFTqBwZ5icHpqszIgEZbjb1MW5Z0+bITTCTl3gk4PDBxs9tA/csXvA==} + engines: {node: '>=18'} + + '@open-draft/deferred-promise@2.2.0': + resolution: {integrity: sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==} + + '@open-draft/logger@0.3.0': + resolution: {integrity: sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==} + + '@open-draft/until@2.1.0': + resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==} + + '@rollup/rollup-android-arm-eabi@4.59.0': + resolution: {integrity: sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==} + cpu: [arm] + os: [android] + + '@rollup/rollup-android-arm64@4.59.0': + resolution: {integrity: sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.59.0': + resolution: {integrity: sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.59.0': + resolution: {integrity: sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-freebsd-arm64@4.59.0': + resolution: {integrity: sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==} + cpu: [arm64] + os: [freebsd] + + '@rollup/rollup-freebsd-x64@4.59.0': + resolution: {integrity: sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==} + cpu: [x64] + os: [freebsd] + + '@rollup/rollup-linux-arm-gnueabihf@4.59.0': + resolution: {integrity: sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm-musleabihf@4.59.0': + resolution: {integrity: sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm64-gnu@4.59.0': + resolution: {integrity: sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-arm64-musl@4.59.0': + resolution: {integrity: sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-loong64-gnu@4.59.0': + resolution: {integrity: sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-loong64-musl@4.59.0': + resolution: {integrity: sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-ppc64-gnu@4.59.0': + resolution: {integrity: sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-ppc64-musl@4.59.0': + resolution: {integrity: sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-riscv64-gnu@4.59.0': + resolution: {integrity: sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-riscv64-musl@4.59.0': + resolution: {integrity: sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-s390x-gnu@4.59.0': + resolution: {integrity: sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==} + cpu: [s390x] + os: [linux] + + '@rollup/rollup-linux-x64-gnu@4.59.0': + resolution: {integrity: sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-linux-x64-musl@4.59.0': + resolution: {integrity: sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-openbsd-x64@4.59.0': + resolution: {integrity: sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==} + cpu: [x64] + os: [openbsd] + + '@rollup/rollup-openharmony-arm64@4.59.0': + resolution: {integrity: sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==} + cpu: [arm64] + os: [openharmony] + + '@rollup/rollup-win32-arm64-msvc@4.59.0': + resolution: {integrity: sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.59.0': + resolution: {integrity: sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-gnu@4.59.0': + resolution: {integrity: sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==} + cpu: [x64] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.59.0': + resolution: {integrity: sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==} + cpu: [x64] + os: [win32] + + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/cookie@0.6.0': + resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + + '@types/eslint-scope@3.7.7': + resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==} + + '@types/eslint@9.6.1': + resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==} + + '@types/estree@1.0.8': + resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} + + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/node@18.19.130': + resolution: {integrity: sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==} + + '@types/statuses@2.0.6': + resolution: {integrity: sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA==} + + '@types/ws@8.18.1': + resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==} + + '@vitest/expect@3.2.4': + resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==} + + '@vitest/mocker@3.2.4': + resolution: {integrity: sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@3.2.4': + resolution: {integrity: sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==} + + '@vitest/runner@3.2.4': + resolution: {integrity: sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==} + + '@vitest/snapshot@3.2.4': + resolution: {integrity: sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==} + + '@vitest/spy@3.2.4': + resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==} + + '@vitest/utils@3.2.4': + resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==} + + '@webassemblyjs/ast@1.14.1': + resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} + + '@webassemblyjs/floating-point-hex-parser@1.13.2': + resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==} + + '@webassemblyjs/helper-api-error@1.13.2': + resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==} + + '@webassemblyjs/helper-buffer@1.14.1': + resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==} + + '@webassemblyjs/helper-numbers@1.13.2': + resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==} + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': + resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==} + + '@webassemblyjs/helper-wasm-section@1.14.1': + resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==} + + '@webassemblyjs/ieee754@1.13.2': + resolution: {integrity: sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==} + + '@webassemblyjs/leb128@1.13.2': + resolution: {integrity: sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==} + + '@webassemblyjs/utf8@1.13.2': + resolution: {integrity: sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==} + + '@webassemblyjs/wasm-edit@1.14.1': + resolution: {integrity: sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==} + + '@webassemblyjs/wasm-gen@1.14.1': + resolution: {integrity: sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==} + + '@webassemblyjs/wasm-opt@1.14.1': + resolution: {integrity: sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==} + + '@webassemblyjs/wasm-parser@1.14.1': + resolution: {integrity: sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==} + + '@webassemblyjs/wast-printer@1.14.1': + resolution: {integrity: sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==} + + '@xtuc/ieee754@1.2.0': + resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} + + '@xtuc/long@4.2.2': + resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} + + acorn-import-phases@1.0.4: + resolution: {integrity: sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==} + engines: {node: '>=10.13.0'} + peerDependencies: + acorn: ^8.14.0 + + acorn@8.16.0: + resolution: {integrity: sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==} + engines: {node: '>=0.4.0'} + hasBin: true + + ajv-formats@2.1.1: + resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + + ajv-keywords@5.1.0: + resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==} + peerDependencies: + ajv: ^8.8.2 + + ajv@8.18.0: + resolution: {integrity: sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + + baseline-browser-mapping@2.10.0: + resolution: {integrity: sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA==} + engines: {node: '>=6.0.0'} + hasBin: true + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + + browserslist@4.28.1: + resolution: {integrity: sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + + caniuse-lite@1.0.30001774: + resolution: {integrity: sha512-DDdwPGz99nmIEv216hKSgLD+D4ikHQHjBC/seF98N9CPqRX4M5mSxT9eTV6oyisnJcuzxtZy4n17yKKQYmYQOA==} + + chai@5.3.3: + resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==} + engines: {node: '>=18'} + + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + + check-error@2.1.3: + resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==} + engines: {node: '>= 16'} + + chrome-trace-event@1.0.4: + resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} + engines: {node: '>=6.0'} + + cli-width@4.1.0: + resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==} + engines: {node: '>= 12'} + + cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + + cookie@0.7.2: + resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} + engines: {node: '>= 0.6'} + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + + electron-to-chromium@1.5.302: + resolution: {integrity: sha512-sM6HAN2LyK82IyPBpznDRqlTQAtuSaO+ShzFiWTvoMJLHyZ+Y39r8VMfHzwbU8MVBzQ4Wdn85+wlZl2TLGIlwg==} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + enhanced-resolve@5.19.0: + resolution: {integrity: sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==} + engines: {node: '>=10.13.0'} + + es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} + + es-module-lexer@2.0.0: + resolution: {integrity: sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==} + + esbuild@0.27.3: + resolution: {integrity: sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==} + engines: {node: '>=18'} + hasBin: true + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + eslint-scope@5.1.1: + resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} + engines: {node: '>=8.0.0'} + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@4.3.0: + resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + + expect-type@1.3.0: + resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==} + engines: {node: '>=12.0.0'} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-uri@3.1.0: + resolution: {integrity: sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==} + + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + glob-to-regexp@0.4.1: + resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + graphql@16.12.0: + resolution: {integrity: sha512-DKKrynuQRne0PNpEbzuEdHlYOMksHSUI8Zc9Unei5gTsMNA2/vMpoMz/yKba50pejK56qj98qM0SjYxAKi13gQ==} + engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + headers-polyfill@4.0.3: + resolution: {integrity: sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-node-process@1.2.0: + resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + jest-worker@27.5.1: + resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} + engines: {node: '>= 10.13.0'} + + js-tokens@9.0.1: + resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==} + + json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + + loader-runner@4.3.1: + resolution: {integrity: sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==} + engines: {node: '>=6.11.5'} + + loupe@3.2.1: + resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==} + + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + msw@2.11.2: + resolution: {integrity: sha512-MI54hLCsrMwiflkcqlgYYNJJddY5/+S0SnONvhv1owOplvqohKSQyGejpNdUGyCwgs4IH7PqaNbPw/sKOEze9Q==} + engines: {node: '>=18'} + hasBin: true + peerDependencies: + typescript: '>= 4.8.x' + peerDependenciesMeta: + typescript: + optional: true + + mute-stream@2.0.0: + resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} + engines: {node: ^18.17.0 || >=20.5.0} + + nanoid@3.3.11: + resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + + node-releases@2.0.27: + resolution: {integrity: sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==} + + outvariant@1.4.3: + resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==} + + path-to-regexp@6.3.0: + resolution: {integrity: sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==} + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + + pathval@2.0.1: + resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==} + engines: {node: '>= 14.16'} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + + picomatch@4.0.3: + resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} + engines: {node: '>=12'} + + postcss@8.5.6: + resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} + engines: {node: ^10 || ^12 || >=14} + + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + + rettime@0.7.0: + resolution: {integrity: sha512-LPRKoHnLKd/r3dVxcwO7vhCW+orkOGj9ViueosEBK6ie89CijnfRlhaDhHq/3Hxu4CkWQtxwlBG0mzTQY6uQjw==} + + rollup@4.59.0: + resolution: {integrity: sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + schema-utils@4.3.3: + resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} + engines: {node: '>= 10.13.0'} + + semver@7.7.4: + resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==} + engines: {node: '>=10'} + hasBin: true + + serialize-javascript@6.0.2: + resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} + + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + source-map@0.7.6: + resolution: {integrity: sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==} + engines: {node: '>= 12'} + + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + statuses@2.0.2: + resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} + engines: {node: '>= 0.8'} + + std-env@3.10.0: + resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} + + strict-event-emitter@0.5.1: + resolution: {integrity: sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-literal@3.1.0: + resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + tapable@2.3.0: + resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} + engines: {node: '>=6'} + + terser-webpack-plugin@5.3.16: + resolution: {integrity: sha512-h9oBFCWrq78NyWWVcSwZarJkZ01c2AyGrzs1crmHZO3QUg9D61Wu4NPjBy69n7JqylFF5y+CsUZYmYEIZ3mR+Q==} + engines: {node: '>= 10.13.0'} + peerDependencies: + '@swc/core': '*' + esbuild: '*' + uglify-js: '*' + webpack: ^5.1.0 + peerDependenciesMeta: + '@swc/core': + optional: true + esbuild: + optional: true + uglify-js: + optional: true + + terser@5.46.0: + resolution: {integrity: sha512-jTwoImyr/QbOWFFso3YoU3ik0jBBDJ6JTOQiy/J2YxVJdZCc+5u7skhNwiOR3FQIygFqVUPHl7qbbxtjW2K3Qg==} + engines: {node: '>=10'} + hasBin: true + + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + + tinyglobby@0.2.15: + resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} + engines: {node: '>=12.0.0'} + + tinypool@1.1.1: + resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@2.0.0: + resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} + engines: {node: '>=14.0.0'} + + tinyspy@4.0.4: + resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==} + engines: {node: '>=14.0.0'} + + tldts-core@7.0.23: + resolution: {integrity: sha512-0g9vrtDQLrNIiCj22HSe9d4mLVG3g5ph5DZ8zCKBr4OtrspmNB6ss7hVyzArAeE88ceZocIEGkyW1Ime7fxPtQ==} + + tldts@7.0.23: + resolution: {integrity: sha512-ASdhgQIBSay0R/eXggAkQ53G4nTJqTXqC2kbaBbdDwM7SkjyZyO0OaaN1/FH7U/yCeqOHDwFO5j8+Os/IS1dXw==} + hasBin: true + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + tough-cookie@6.0.0: + resolution: {integrity: sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w==} + engines: {node: '>=16'} + + ts-loader@9.5.4: + resolution: {integrity: sha512-nCz0rEwunlTZiy6rXFByQU1kVVpCIgUpc/psFiKVrUwrizdnIbRFu8w7bxhUF0X613DYwT4XzrZHpVyMe758hQ==} + engines: {node: '>=12.0.0'} + peerDependencies: + typescript: '*' + webpack: ^5.0.0 + + type-fest@4.41.0: + resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} + engines: {node: '>=16'} + + typescript@5.7.3: + resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + + update-browserslist-db@1.2.3: + resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + + vite-node@3.2.4: + resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + + vite@7.3.1: + resolution: {integrity: sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + jiti: '>=1.21.0' + less: ^4.0.0 + lightningcss: ^1.21.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + + vitest@3.2.4: + resolution: {integrity: sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/debug': ^4.1.12 + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + '@vitest/browser': 3.2.4 + '@vitest/ui': 3.2.4 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/debug': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + + watchpack@2.5.1: + resolution: {integrity: sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==} + engines: {node: '>=10.13.0'} + + webpack-sources@3.3.4: + resolution: {integrity: sha512-7tP1PdV4vF+lYPnkMR0jMY5/la2ub5Fc/8VQrrU+lXkiM6C4TjVfGw7iKfyhnTQOsD+6Q/iKw0eFciziRgD58Q==} + engines: {node: '>=10.13.0'} + + webpack@5.105.2: + resolution: {integrity: sha512-dRXm0a2qcHPUBEzVk8uph0xWSjV/xZxenQQbLwnwP7caQCYpqG1qddwlyEkIDkYn0K8tvmcrZ+bOrzoQ3HxCDw==} + engines: {node: '>=10.13.0'} + hasBin: true + peerDependencies: + webpack-cli: '*' + peerDependenciesMeta: + webpack-cli: + optional: true + + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + + wrap-ansi@6.2.0: + resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} + engines: {node: '>=8'} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + ws@8.19.0: + resolution: {integrity: sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + + yargs@17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} + + yoctocolors-cjs@2.1.3: + resolution: {integrity: sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==} + engines: {node: '>=18'} + +snapshots: + + '@biomejs/biome@2.4.3': + optionalDependencies: + '@biomejs/cli-darwin-arm64': 2.4.3 + '@biomejs/cli-darwin-x64': 2.4.3 + '@biomejs/cli-linux-arm64': 2.4.3 + '@biomejs/cli-linux-arm64-musl': 2.4.3 + '@biomejs/cli-linux-x64': 2.4.3 + '@biomejs/cli-linux-x64-musl': 2.4.3 + '@biomejs/cli-win32-arm64': 2.4.3 + '@biomejs/cli-win32-x64': 2.4.3 + + '@biomejs/cli-darwin-arm64@2.4.3': + optional: true + + '@biomejs/cli-darwin-x64@2.4.3': + optional: true + + '@biomejs/cli-linux-arm64-musl@2.4.3': + optional: true + + '@biomejs/cli-linux-arm64@2.4.3': + optional: true + + '@biomejs/cli-linux-x64-musl@2.4.3': + optional: true + + '@biomejs/cli-linux-x64@2.4.3': + optional: true + + '@biomejs/cli-win32-arm64@2.4.3': + optional: true + + '@biomejs/cli-win32-x64@2.4.3': + optional: true + + '@bundled-es-modules/cookie@2.0.1': + dependencies: + cookie: 0.7.2 + + '@bundled-es-modules/statuses@1.0.1': + dependencies: + statuses: 2.0.2 + + '@esbuild/aix-ppc64@0.27.3': + optional: true + + '@esbuild/android-arm64@0.27.3': + optional: true + + '@esbuild/android-arm@0.27.3': + optional: true + + '@esbuild/android-x64@0.27.3': + optional: true + + '@esbuild/darwin-arm64@0.27.3': + optional: true + + '@esbuild/darwin-x64@0.27.3': + optional: true + + '@esbuild/freebsd-arm64@0.27.3': + optional: true + + '@esbuild/freebsd-x64@0.27.3': + optional: true + + '@esbuild/linux-arm64@0.27.3': + optional: true + + '@esbuild/linux-arm@0.27.3': + optional: true + + '@esbuild/linux-ia32@0.27.3': + optional: true + + '@esbuild/linux-loong64@0.27.3': + optional: true + + '@esbuild/linux-mips64el@0.27.3': + optional: true + + '@esbuild/linux-ppc64@0.27.3': + optional: true + + '@esbuild/linux-riscv64@0.27.3': + optional: true + + '@esbuild/linux-s390x@0.27.3': + optional: true + + '@esbuild/linux-x64@0.27.3': + optional: true + + '@esbuild/netbsd-arm64@0.27.3': + optional: true + + '@esbuild/netbsd-x64@0.27.3': + optional: true + + '@esbuild/openbsd-arm64@0.27.3': + optional: true + + '@esbuild/openbsd-x64@0.27.3': + optional: true + + '@esbuild/openharmony-arm64@0.27.3': + optional: true + + '@esbuild/sunos-x64@0.27.3': + optional: true + + '@esbuild/win32-arm64@0.27.3': + optional: true + + '@esbuild/win32-ia32@0.27.3': + optional: true + + '@esbuild/win32-x64@0.27.3': + optional: true + + '@faker-js/faker@9.9.0': {} + + '@inquirer/ansi@1.0.2': {} + + '@inquirer/confirm@5.1.21(@types/node@18.19.130)': + dependencies: + '@inquirer/core': 10.3.2(@types/node@18.19.130) + '@inquirer/type': 3.0.10(@types/node@18.19.130) + optionalDependencies: + '@types/node': 18.19.130 + + '@inquirer/core@10.3.2(@types/node@18.19.130)': + dependencies: + '@inquirer/ansi': 1.0.2 + '@inquirer/figures': 1.0.15 + '@inquirer/type': 3.0.10(@types/node@18.19.130) + cli-width: 4.1.0 + mute-stream: 2.0.0 + signal-exit: 4.1.0 + wrap-ansi: 6.2.0 + yoctocolors-cjs: 2.1.3 + optionalDependencies: + '@types/node': 18.19.130 + + '@inquirer/figures@1.0.15': {} + + '@inquirer/type@3.0.10(@types/node@18.19.130)': + optionalDependencies: + '@types/node': 18.19.130 + + '@jridgewell/gen-mapping@0.3.13': + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/source-map@0.3.11': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/sourcemap-codec@1.5.5': {} + + '@jridgewell/trace-mapping@0.3.31': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.5 + + '@mswjs/interceptors@0.39.8': + dependencies: + '@open-draft/deferred-promise': 2.2.0 + '@open-draft/logger': 0.3.0 + '@open-draft/until': 2.1.0 + is-node-process: 1.2.0 + outvariant: 1.4.3 + strict-event-emitter: 0.5.1 + + '@open-draft/deferred-promise@2.2.0': {} + + '@open-draft/logger@0.3.0': + dependencies: + is-node-process: 1.2.0 + outvariant: 1.4.3 + + '@open-draft/until@2.1.0': {} + + '@rollup/rollup-android-arm-eabi@4.59.0': + optional: true + + '@rollup/rollup-android-arm64@4.59.0': + optional: true + + '@rollup/rollup-darwin-arm64@4.59.0': + optional: true + + '@rollup/rollup-darwin-x64@4.59.0': + optional: true + + '@rollup/rollup-freebsd-arm64@4.59.0': + optional: true + + '@rollup/rollup-freebsd-x64@4.59.0': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.59.0': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.59.0': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.59.0': + optional: true + + '@rollup/rollup-linux-loong64-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-loong64-musl@4.59.0': + optional: true + + '@rollup/rollup-linux-ppc64-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-ppc64-musl@4.59.0': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-riscv64-musl@4.59.0': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-x64-musl@4.59.0': + optional: true + + '@rollup/rollup-openbsd-x64@4.59.0': + optional: true + + '@rollup/rollup-openharmony-arm64@4.59.0': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.59.0': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.59.0': + optional: true + + '@rollup/rollup-win32-x64-gnu@4.59.0': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.59.0': + optional: true + + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/cookie@0.6.0': {} + + '@types/deep-eql@4.0.2': {} + + '@types/eslint-scope@3.7.7': + dependencies: + '@types/eslint': 9.6.1 + '@types/estree': 1.0.8 + + '@types/eslint@9.6.1': + dependencies: + '@types/estree': 1.0.8 + '@types/json-schema': 7.0.15 + + '@types/estree@1.0.8': {} + + '@types/json-schema@7.0.15': {} + + '@types/node@18.19.130': + dependencies: + undici-types: 5.26.5 + + '@types/statuses@2.0.6': {} + + '@types/ws@8.18.1': + dependencies: + '@types/node': 18.19.130 + + '@vitest/expect@3.2.4': + dependencies: + '@types/chai': 5.2.3 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 + chai: 5.3.3 + tinyrainbow: 2.0.0 + + '@vitest/mocker@3.2.4(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(vite@7.3.1(@types/node@18.19.130)(terser@5.46.0))': + dependencies: + '@vitest/spy': 3.2.4 + estree-walker: 3.0.3 + magic-string: 0.30.21 + optionalDependencies: + msw: 2.11.2(@types/node@18.19.130)(typescript@5.7.3) + vite: 7.3.1(@types/node@18.19.130)(terser@5.46.0) + + '@vitest/pretty-format@3.2.4': + dependencies: + tinyrainbow: 2.0.0 + + '@vitest/runner@3.2.4': + dependencies: + '@vitest/utils': 3.2.4 + pathe: 2.0.3 + strip-literal: 3.1.0 + + '@vitest/snapshot@3.2.4': + dependencies: + '@vitest/pretty-format': 3.2.4 + magic-string: 0.30.21 + pathe: 2.0.3 + + '@vitest/spy@3.2.4': + dependencies: + tinyspy: 4.0.4 + + '@vitest/utils@3.2.4': + dependencies: + '@vitest/pretty-format': 3.2.4 + loupe: 3.2.1 + tinyrainbow: 2.0.0 + + '@webassemblyjs/ast@1.14.1': + dependencies: + '@webassemblyjs/helper-numbers': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + + '@webassemblyjs/floating-point-hex-parser@1.13.2': {} + + '@webassemblyjs/helper-api-error@1.13.2': {} + + '@webassemblyjs/helper-buffer@1.14.1': {} + + '@webassemblyjs/helper-numbers@1.13.2': + dependencies: + '@webassemblyjs/floating-point-hex-parser': 1.13.2 + '@webassemblyjs/helper-api-error': 1.13.2 + '@xtuc/long': 4.2.2 + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': {} + + '@webassemblyjs/helper-wasm-section@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/wasm-gen': 1.14.1 + + '@webassemblyjs/ieee754@1.13.2': + dependencies: + '@xtuc/ieee754': 1.2.0 + + '@webassemblyjs/leb128@1.13.2': + dependencies: + '@xtuc/long': 4.2.2 + + '@webassemblyjs/utf8@1.13.2': {} + + '@webassemblyjs/wasm-edit@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/helper-wasm-section': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-opt': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + '@webassemblyjs/wast-printer': 1.14.1 + + '@webassemblyjs/wasm-gen@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wasm-opt@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + + '@webassemblyjs/wasm-parser@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-api-error': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wast-printer@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@xtuc/long': 4.2.2 + + '@xtuc/ieee754@1.2.0': {} + + '@xtuc/long@4.2.2': {} + + acorn-import-phases@1.0.4(acorn@8.16.0): + dependencies: + acorn: 8.16.0 + + acorn@8.16.0: {} + + ajv-formats@2.1.1(ajv@8.18.0): + optionalDependencies: + ajv: 8.18.0 + + ajv-keywords@5.1.0(ajv@8.18.0): + dependencies: + ajv: 8.18.0 + fast-deep-equal: 3.1.3 + + ajv@8.18.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-uri: 3.1.0 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + + ansi-regex@5.0.1: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + assertion-error@2.0.1: {} + + baseline-browser-mapping@2.10.0: {} + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + browserslist@4.28.1: + dependencies: + baseline-browser-mapping: 2.10.0 + caniuse-lite: 1.0.30001774 + electron-to-chromium: 1.5.302 + node-releases: 2.0.27 + update-browserslist-db: 1.2.3(browserslist@4.28.1) + + buffer-from@1.1.2: {} + + cac@6.7.14: {} + + caniuse-lite@1.0.30001774: {} + + chai@5.3.3: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.3 + deep-eql: 5.0.2 + loupe: 3.2.1 + pathval: 2.0.1 + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + check-error@2.1.3: {} + + chrome-trace-event@1.0.4: {} + + cli-width@4.1.0: {} + + cliui@8.0.1: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + + commander@2.20.3: {} + + cookie@0.7.2: {} + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + deep-eql@5.0.2: {} + + electron-to-chromium@1.5.302: {} + + emoji-regex@8.0.0: {} + + enhanced-resolve@5.19.0: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.3.0 + + es-module-lexer@1.7.0: {} + + es-module-lexer@2.0.0: {} + + esbuild@0.27.3: + optionalDependencies: + '@esbuild/aix-ppc64': 0.27.3 + '@esbuild/android-arm': 0.27.3 + '@esbuild/android-arm64': 0.27.3 + '@esbuild/android-x64': 0.27.3 + '@esbuild/darwin-arm64': 0.27.3 + '@esbuild/darwin-x64': 0.27.3 + '@esbuild/freebsd-arm64': 0.27.3 + '@esbuild/freebsd-x64': 0.27.3 + '@esbuild/linux-arm': 0.27.3 + '@esbuild/linux-arm64': 0.27.3 + '@esbuild/linux-ia32': 0.27.3 + '@esbuild/linux-loong64': 0.27.3 + '@esbuild/linux-mips64el': 0.27.3 + '@esbuild/linux-ppc64': 0.27.3 + '@esbuild/linux-riscv64': 0.27.3 + '@esbuild/linux-s390x': 0.27.3 + '@esbuild/linux-x64': 0.27.3 + '@esbuild/netbsd-arm64': 0.27.3 + '@esbuild/netbsd-x64': 0.27.3 + '@esbuild/openbsd-arm64': 0.27.3 + '@esbuild/openbsd-x64': 0.27.3 + '@esbuild/openharmony-arm64': 0.27.3 + '@esbuild/sunos-x64': 0.27.3 + '@esbuild/win32-arm64': 0.27.3 + '@esbuild/win32-ia32': 0.27.3 + '@esbuild/win32-x64': 0.27.3 + + escalade@3.2.0: {} + + eslint-scope@5.1.1: + dependencies: + esrecurse: 4.3.0 + estraverse: 4.3.0 + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@4.3.0: {} + + estraverse@5.3.0: {} + + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.8 + + events@3.3.0: {} + + expect-type@1.3.0: {} + + fast-deep-equal@3.1.3: {} + + fast-uri@3.1.0: {} + + fdir@6.5.0(picomatch@4.0.3): + optionalDependencies: + picomatch: 4.0.3 + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + fsevents@2.3.3: + optional: true + + get-caller-file@2.0.5: {} + + glob-to-regexp@0.4.1: {} + + graceful-fs@4.2.11: {} + + graphql@16.12.0: {} + + has-flag@4.0.0: {} + + headers-polyfill@4.0.3: {} + + is-fullwidth-code-point@3.0.0: {} + + is-node-process@1.2.0: {} + + is-number@7.0.0: {} + + jest-worker@27.5.1: + dependencies: + '@types/node': 18.19.130 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + js-tokens@9.0.1: {} + + json-parse-even-better-errors@2.3.1: {} + + json-schema-traverse@1.0.0: {} + + loader-runner@4.3.1: {} + + loupe@3.2.1: {} + + magic-string@0.30.21: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + + merge-stream@2.0.0: {} + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + + mime-db@1.52.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + ms@2.1.3: {} + + msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3): + dependencies: + '@bundled-es-modules/cookie': 2.0.1 + '@bundled-es-modules/statuses': 1.0.1 + '@inquirer/confirm': 5.1.21(@types/node@18.19.130) + '@mswjs/interceptors': 0.39.8 + '@open-draft/deferred-promise': 2.2.0 + '@open-draft/until': 2.1.0 + '@types/cookie': 0.6.0 + '@types/statuses': 2.0.6 + graphql: 16.12.0 + headers-polyfill: 4.0.3 + is-node-process: 1.2.0 + outvariant: 1.4.3 + path-to-regexp: 6.3.0 + picocolors: 1.1.1 + rettime: 0.7.0 + strict-event-emitter: 0.5.1 + tough-cookie: 6.0.0 + type-fest: 4.41.0 + yargs: 17.7.2 + optionalDependencies: + typescript: 5.7.3 + transitivePeerDependencies: + - '@types/node' + + mute-stream@2.0.0: {} + + nanoid@3.3.11: {} + + neo-async@2.6.2: {} + + node-releases@2.0.27: {} + + outvariant@1.4.3: {} + + path-to-regexp@6.3.0: {} + + pathe@2.0.3: {} + + pathval@2.0.1: {} + + picocolors@1.1.1: {} + + picomatch@2.3.1: {} + + picomatch@4.0.3: {} + + postcss@8.5.6: + dependencies: + nanoid: 3.3.11 + picocolors: 1.1.1 + source-map-js: 1.2.1 + + randombytes@2.1.0: + dependencies: + safe-buffer: 5.2.1 + + require-directory@2.1.1: {} + + require-from-string@2.0.2: {} + + rettime@0.7.0: {} + + rollup@4.59.0: + dependencies: + '@types/estree': 1.0.8 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.59.0 + '@rollup/rollup-android-arm64': 4.59.0 + '@rollup/rollup-darwin-arm64': 4.59.0 + '@rollup/rollup-darwin-x64': 4.59.0 + '@rollup/rollup-freebsd-arm64': 4.59.0 + '@rollup/rollup-freebsd-x64': 4.59.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.59.0 + '@rollup/rollup-linux-arm-musleabihf': 4.59.0 + '@rollup/rollup-linux-arm64-gnu': 4.59.0 + '@rollup/rollup-linux-arm64-musl': 4.59.0 + '@rollup/rollup-linux-loong64-gnu': 4.59.0 + '@rollup/rollup-linux-loong64-musl': 4.59.0 + '@rollup/rollup-linux-ppc64-gnu': 4.59.0 + '@rollup/rollup-linux-ppc64-musl': 4.59.0 + '@rollup/rollup-linux-riscv64-gnu': 4.59.0 + '@rollup/rollup-linux-riscv64-musl': 4.59.0 + '@rollup/rollup-linux-s390x-gnu': 4.59.0 + '@rollup/rollup-linux-x64-gnu': 4.59.0 + '@rollup/rollup-linux-x64-musl': 4.59.0 + '@rollup/rollup-openbsd-x64': 4.59.0 + '@rollup/rollup-openharmony-arm64': 4.59.0 + '@rollup/rollup-win32-arm64-msvc': 4.59.0 + '@rollup/rollup-win32-ia32-msvc': 4.59.0 + '@rollup/rollup-win32-x64-gnu': 4.59.0 + '@rollup/rollup-win32-x64-msvc': 4.59.0 + fsevents: 2.3.3 + + safe-buffer@5.2.1: {} + + schema-utils@4.3.3: + dependencies: + '@types/json-schema': 7.0.15 + ajv: 8.18.0 + ajv-formats: 2.1.1(ajv@8.18.0) + ajv-keywords: 5.1.0(ajv@8.18.0) + + semver@7.7.4: {} + + serialize-javascript@6.0.2: + dependencies: + randombytes: 2.1.0 + + siginfo@2.0.0: {} + + signal-exit@4.1.0: {} + + source-map-js@1.2.1: {} + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + source-map@0.7.6: {} + + stackback@0.0.2: {} + + statuses@2.0.2: {} + + std-env@3.10.0: {} + + strict-event-emitter@0.5.1: {} + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-literal@3.1.0: + dependencies: + js-tokens: 9.0.1 + + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + tapable@2.3.0: {} + + terser-webpack-plugin@5.3.16(webpack@5.105.2): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + jest-worker: 27.5.1 + schema-utils: 4.3.3 + serialize-javascript: 6.0.2 + terser: 5.46.0 + webpack: 5.105.2 + + terser@5.46.0: + dependencies: + '@jridgewell/source-map': 0.3.11 + acorn: 8.16.0 + commander: 2.20.3 + source-map-support: 0.5.21 + + tinybench@2.9.0: {} + + tinyexec@0.3.2: {} + + tinyglobby@0.2.15: + dependencies: + fdir: 6.5.0(picomatch@4.0.3) + picomatch: 4.0.3 + + tinypool@1.1.1: {} + + tinyrainbow@2.0.0: {} + + tinyspy@4.0.4: {} + + tldts-core@7.0.23: {} + + tldts@7.0.23: + dependencies: + tldts-core: 7.0.23 + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + tough-cookie@6.0.0: + dependencies: + tldts: 7.0.23 + + ts-loader@9.5.4(typescript@5.7.3)(webpack@5.105.2): + dependencies: + chalk: 4.1.2 + enhanced-resolve: 5.19.0 + micromatch: 4.0.8 + semver: 7.7.4 + source-map: 0.7.6 + typescript: 5.7.3 + webpack: 5.105.2 + + type-fest@4.41.0: {} + + typescript@5.7.3: {} + + undici-types@5.26.5: {} + + update-browserslist-db@1.2.3(browserslist@4.28.1): + dependencies: + browserslist: 4.28.1 + escalade: 3.2.0 + picocolors: 1.1.1 + + vite-node@3.2.4(@types/node@18.19.130)(terser@5.46.0): + dependencies: + cac: 6.7.14 + debug: 4.4.3 + es-module-lexer: 1.7.0 + pathe: 2.0.3 + vite: 7.3.1(@types/node@18.19.130)(terser@5.46.0) + transitivePeerDependencies: + - '@types/node' + - jiti + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + vite@7.3.1(@types/node@18.19.130)(terser@5.46.0): + dependencies: + esbuild: 0.27.3 + fdir: 6.5.0(picomatch@4.0.3) + picomatch: 4.0.3 + postcss: 8.5.6 + rollup: 4.59.0 + tinyglobby: 0.2.15 + optionalDependencies: + '@types/node': 18.19.130 + fsevents: 2.3.3 + terser: 5.46.0 + + vitest@3.2.4(@types/node@18.19.130)(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(terser@5.46.0): + dependencies: + '@types/chai': 5.2.3 + '@vitest/expect': 3.2.4 + '@vitest/mocker': 3.2.4(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(vite@7.3.1(@types/node@18.19.130)(terser@5.46.0)) + '@vitest/pretty-format': 3.2.4 + '@vitest/runner': 3.2.4 + '@vitest/snapshot': 3.2.4 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 + chai: 5.3.3 + debug: 4.4.3 + expect-type: 1.3.0 + magic-string: 0.30.21 + pathe: 2.0.3 + picomatch: 4.0.3 + std-env: 3.10.0 + tinybench: 2.9.0 + tinyexec: 0.3.2 + tinyglobby: 0.2.15 + tinypool: 1.1.1 + tinyrainbow: 2.0.0 + vite: 7.3.1(@types/node@18.19.130)(terser@5.46.0) + vite-node: 3.2.4(@types/node@18.19.130)(terser@5.46.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 18.19.130 + transitivePeerDependencies: + - jiti + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + watchpack@2.5.1: + dependencies: + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + + webpack-sources@3.3.4: {} + + webpack@5.105.2: + dependencies: + '@types/eslint-scope': 3.7.7 + '@types/estree': 1.0.8 + '@types/json-schema': 7.0.15 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/wasm-edit': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + acorn: 8.16.0 + acorn-import-phases: 1.0.4(acorn@8.16.0) + browserslist: 4.28.1 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.19.0 + es-module-lexer: 2.0.0 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.1 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 4.3.3 + tapable: 2.3.0 + terser-webpack-plugin: 5.3.16(webpack@5.105.2) + watchpack: 2.5.1 + webpack-sources: 3.3.4 + transitivePeerDependencies: + - '@swc/core' + - esbuild + - uglify-js + + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + + wrap-ansi@6.2.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + ws@8.19.0: {} + + y18n@5.0.8: {} + + yargs-parser@21.1.1: {} + + yargs@17.7.2: + dependencies: + cliui: 8.0.1 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 + + yoctocolors-cjs@2.1.3: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 00000000..6e4c3951 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1 @@ +packages: ['.'] \ No newline at end of file diff --git a/reference.md b/reference.md new file mode 100644 index 00000000..e9cdd875 --- /dev/null +++ b/reference.md @@ -0,0 +1,2624 @@ +# Reference +## Interactions +
client.interactions.list({ ...params }) -> core.Page<Corti.InteractionsGetResponse, Corti.InteractionsListResponse> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all existing interactions. Results can be filtered by encounter status and patient identifier. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const pageableResponse = await client.interactions.list(); +for await (const item of pageableResponse) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.interactions.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} + +// You can also access the underlying response +const response = page.response; + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Corti.InteractionsListRequest` + +
+
+ +
+
+ +**requestOptions:** `InteractionsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.interactions.create({ ...params }) -> Corti.InteractionsCreateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.interactions.create({ + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation" + } +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Corti.InteractionsCreateRequest` + +
+
+ +
+
+ +**requestOptions:** `InteractionsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.interactions.get(id) -> Corti.InteractionsGetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a previously recorded interaction by its unique identifier (interaction ID). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.interactions.get("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `InteractionsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.interactions.delete(id) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an existing interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.interactions.delete("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `InteractionsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.interactions.update(id, { ...params }) -> Corti.InteractionsGetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Modifies an existing interaction by updating specific fields without overwriting the entire record. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.interactions.update("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**request:** `Corti.InteractionsUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `InteractionsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +## Recordings +
client.recordings.list(id) -> Corti.RecordingsListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a list of recordings for a given interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.recordings.list("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `RecordingsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.recordings.get(id, recordingId) -> core.BinaryResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a specific recording for a given interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.recordings.get("id", "recordingId"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**recordingId:** `Corti.Uuid` — The unique identifier of the recording. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `RecordingsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.recordings.delete(id, recordingId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a specific recording for a given interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.recordings.delete("f47ac10b-58cc-4372-a567-0e02b2c3d479", "f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**recordingId:** `Corti.Uuid` — The unique identifier of the recording. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `RecordingsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +## Transcripts +
client.transcripts.list(id, { ...params }) -> Corti.TranscriptsListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of transcripts for a given interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.transcripts.list("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**request:** `Corti.TranscriptsListRequest` + +
+
+ +
+
+ +**requestOptions:** `TranscriptsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.transcripts.create(id, { ...params }) -> Corti.TranscriptsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a transcript from an audio file attached, via `/recordings` endpoint, to the interaction.
Each interaction may have more than one audio file and transcript associated with it. While audio files up to 60min in total duration, or 150MB in total size, may be attached to an interaction, synchronous processing is only supported for audio files less than ~2min in duration.

If an audio file takes longer to transcribe than the 25sec synchronous processing timeout, then it will continue to process asynchronously. In this scenario, an incomplete or empty transcript with `status=processing` will be returned with a location header that can be used to retrieve the final transcript.

The client can poll the Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/status`) for transcript status changes:
- `200 OK` with status `processing`, `completed`, or `failed`
- `404 Not Found` if the `interactionId` or `transcriptId` are invalid

The completed transcript can be retrieved via the Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/`).
+
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.transcripts.create("f47ac10b-58cc-4372-a567-0e02b2c3d479", { + recordingId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + primaryLanguage: "en" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**request:** `Corti.TranscriptsCreateRequest` + +
+
+ +
+
+ +**requestOptions:** `TranscriptsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.transcripts.get(id, transcriptId) -> Corti.TranscriptsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a transcript from a specific interaction.
Each interaction may have more than one transcript associated with it. Use the List Transcript request (`GET /interactions/{id}/transcripts/`) to see all transcriptIds available for the interaction.

The client can poll this Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/status`) for transcript status changes:
- `200 OK` with status `processing`, `completed`, or `failed`
- `404 Not Found` if the `interactionId` or `transcriptId` are invalid

Status of `completed` indicates the transcript is finalized. If the transcript is retrieved while status is `processing`, then it will be incomplete.
+
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.transcripts.get("f47ac10b-58cc-4372-a567-0e02b2c3d479", "f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**transcriptId:** `Corti.Uuid` — The unique identifier of the transcript. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `TranscriptsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.transcripts.delete(id, transcriptId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a specific transcript associated with an interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.transcripts.delete("f47ac10b-58cc-4372-a567-0e02b2c3d479", "f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**transcriptId:** `Corti.Uuid` — The unique identifier of the transcript. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `TranscriptsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.transcripts.getStatus(id, transcriptId) -> Corti.TranscriptsStatusResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Poll for transcript creation status.
Status of `completed` indicates the transcript is finalized.
If the transcript is retrieved while status is `processing`, then it will be incomplete.
Status of `failed` indicate the transcript was not created successfully; please retry.
+
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.transcripts.getStatus("f47ac10b-58cc-4372-a567-0e02b2c3d479", "f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**transcriptId:** `Corti.Uuid` — The unique identifier of the transcript. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `TranscriptsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +## Facts +
client.facts.factGroupsList() -> Corti.FactsFactGroupsListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of available fact groups, used to categorize facts associated with an interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.facts.factGroupsList(); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `FactsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.facts.list(id) -> Corti.FactsListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of facts for a given interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.facts.list("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `FactsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.facts.create(id, { ...params }) -> Corti.FactsCreateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds new facts to an interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.facts.create("f47ac10b-58cc-4372-a567-0e02b2c3d479", { + facts: [{ + text: "text", + group: "other" + }] +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**request:** `Corti.FactsCreateRequest` + +
+
+ +
+
+ +**requestOptions:** `FactsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.facts.batchUpdate(id, { ...params }) -> Corti.FactsBatchUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates multiple facts associated with an interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.facts.batchUpdate("f47ac10b-58cc-4372-a567-0e02b2c3d479", { + facts: [{ + factId: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08" + }] +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**request:** `Corti.FactsBatchUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `FactsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.facts.update(id, factId, { ...params }) -> Corti.FactsUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an existing fact associated with a specific interaction. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.facts.update("f47ac10b-58cc-4372-a567-0e02b2c3d479", "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**factId:** `string` — The unique identifier of the fact to update. Must be a valid UUID. + +
+
+ +
+
+ +**request:** `Corti.FactsUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `FactsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.facts.extract({ ...params }) -> Corti.FactsExtractResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Extract facts from provided text, without storing them. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.facts.extract({ + context: [{ + type: "text", + text: "text" + }], + outputLanguage: "outputLanguage" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Corti.FactsExtractRequest` + +
+
+ +
+
+ +**requestOptions:** `FactsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +## Documents +
client.documents.list(id) -> Corti.DocumentsListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List Documents +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.documents.list("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `DocumentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.documents.create(id, { ...params }) -> Corti.DocumentsGetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint offers different ways to generate a document. Find guides to document generation [here](/textgen/documents-standard). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.documents.create("f47ac10b-58cc-4372-a567-0e02b2c3d479", { + context: [{ + type: "facts", + data: [{ + text: "text", + source: "core" + }] + }], + templateKey: "templateKey", + outputLanguage: "outputLanguage" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**request:** `Corti.DocumentsCreateRequest` + +
+
+ +
+
+ +**requestOptions:** `DocumentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.documents.get(id, documentId) -> Corti.DocumentsGetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get Document. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.documents.get("f47ac10b-58cc-4372-a567-0e02b2c3d479", "f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**documentId:** `Corti.Uuid` — The document ID representing the context for the request. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `DocumentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.documents.delete(id, documentId) -> void +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.documents.delete("f47ac10b-58cc-4372-a567-0e02b2c3d479", "f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**documentId:** `Corti.Uuid` — The document ID representing the context for the request. Must be a valid UUID. + +
+
+ +
+
+ +**requestOptions:** `DocumentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.documents.update(id, documentId, { ...params }) -> Corti.DocumentsGetResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.documents.update("f47ac10b-58cc-4372-a567-0e02b2c3d479", "f47ac10b-58cc-4372-a567-0e02b2c3d479"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `Corti.Uuid` — The unique identifier of the interaction. Must be a valid UUID. + +
+
+ +
+
+ +**documentId:** `Corti.Uuid` — The document ID representing the context for the request. Must be a valid UUID. + +
+
+ +
+
+ +**request:** `Corti.DocumentsUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `DocumentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +## Templates +
client.templates.sectionList({ ...params }) -> Corti.TemplatesSectionListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of template sections with optional filters for organization and language. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.templates.sectionList(); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Corti.TemplatesSectionListRequest` + +
+
+ +
+
+ +**requestOptions:** `TemplatesClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.templates.list({ ...params }) -> Corti.TemplatesListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of templates with optional filters for organization, language, and status. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.templates.list(); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Corti.TemplatesListRequest` + +
+
+ +
+
+ +**requestOptions:** `TemplatesClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.templates.get(key) -> Corti.TemplatesItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves template by key. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.templates.get("key"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**key:** `string` — The key of the template + +
+
+ +
+
+ +**requestOptions:** `TemplatesClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +## Codes +
client.codes.predict({ ...params }) -> Corti.CodesGeneralResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Predict medical codes from provided context.
This is a stateless endpoint, designed to predict ICD-10-CM, ICD-10-PCS, and CPT codes based on input text string or documentId.

More than one code system may be defined in a single request, and the maximum number of codes to return per system can also be defined.

Code prediction requests have two possible values for context:
- `text`: One set of code prediction results will be returned based on all input text defined.
- `documentId`: Code prediction will be based on that defined document only.

The response includes two sets of results:
- `Codes`: Highest confidence bundle of codes, as selected by the code prediction model
- `Candidates`: Full list of candidate codes as predicted by the model, rank sorted by model confidence with maximum possible value of 50.

All predicted code results are based on input context defined in the request only (not other external data or assets associated with an interaction).
+
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.codes.predict({ + system: ["icd10cm", "cpt"], + context: [{ + type: "text", + text: "Short arm splint applied in ED for pain control." + }], + maxCandidates: 5 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Corti.CodesGeneralPredictRequest` + +
+
+ +
+
+ +**requestOptions:** `CodesClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +## Agents +
client.agents.list({ ...params }) -> Corti.AgentsAgentResponse[] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint retrieves a list of all agents that can be called by the Corti Agent Framework. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.agents.list(); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Corti.AgentsListRequest` + +
+
+ +
+
+ +**requestOptions:** `AgentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.agents.create({ ...params }) -> Corti.AgentsAgent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint allows the creation of a new agent that can be utilized in the `POST /agents/{id}/v1/message:send` endpoint. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.agents.create({ + name: "name", + description: "description" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Corti.AgentsCreateAgent` + +
+
+ +
+
+ +**requestOptions:** `AgentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.agents.get(id) -> Corti.AgentsAgentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint retrieves an agent by its identifier. The agent contains information about its capabilities and the experts it can call. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.agents.get("12345678-90ab-cdef-gh12-34567890abc"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — The identifier of the agent associated with the context. + +
+
+ +
+
+ +**requestOptions:** `AgentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.agents.delete(id) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint deletes an agent by its identifier. Once deleted, the agent can no longer be used in threads. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.agents.delete("12345678-90ab-cdef-gh12-34567890abc"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — The identifier of the agent associated with the context. + +
+
+ +
+
+ +**requestOptions:** `AgentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.agents.update(id, { ...params }) -> Corti.AgentsAgent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint updates an existing agent. Only the fields provided in the request body will be updated; other fields will remain unchanged. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.agents.update("12345678-90ab-cdef-gh12-34567890abc", { + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — The identifier of the agent associated with the context. + +
+
+ +
+
+ +**request:** `Corti.AgentsAgent` + +
+
+ +
+
+ +**requestOptions:** `AgentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.agents.getCard(id) -> Corti.AgentsAgentCard +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint retrieves the agent card in JSON format, which provides metadata about the agent, including its name, description, and the experts it can call. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.agents.getCard("12345678-90ab-cdef-gh12-34567890abc"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — The identifier of the agent associated with the context. + +
+
+ +
+
+ +**requestOptions:** `AgentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.agents.messageSend(id, { ...params }) -> Corti.AgentsMessageSendResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint sends a message to the specified agent to start or continue a task. The agent processes the message and returns a response. If the message contains a task ID that matches an ongoing task, the agent will continue that task; otherwise, it will start a new task. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.agents.messageSend("12345678-90ab-cdef-gh12-34567890abc", { + message: { + role: "user", + parts: [{ + kind: "text", + text: "text" + }], + messageId: "messageId", + kind: "message" + } +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — The identifier of the agent associated with the context. + +
+
+ +
+
+ +**request:** `Corti.AgentsMessageSendParams` + +
+
+ +
+
+ +**requestOptions:** `AgentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.agents.getTask(id, taskId, { ...params }) -> Corti.AgentsTask +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint retrieves the status and details of a specific task associated with the given agent. It provides information about the task's current state, history, and any artifacts produced during its execution. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.agents.getTask("12345678-90ab-cdef-gh12-34567890abc", "taskId"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — The identifier of the agent associated with the context. + +
+
+ +
+
+ +**taskId:** `string` — The identifier of the task to retrieve. + +
+
+ +
+
+ +**request:** `Corti.AgentsGetTaskRequest` + +
+
+ +
+
+ +**requestOptions:** `AgentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.agents.getContext(id, contextId, { ...params }) -> Corti.AgentsContext +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint retrieves all tasks and top-level messages associated with a specific context for the given agent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.agents.getContext("12345678-90ab-cdef-gh12-34567890abc", "contextId"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — The identifier of the agent associated with the context. + +
+
+ +
+
+ +**contextId:** `string` — The identifier of the context (thread) to retrieve tasks for. + +
+
+ +
+
+ +**request:** `Corti.AgentsGetContextRequest` + +
+
+ +
+
+ +**requestOptions:** `AgentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.agents.getRegistryExperts({ ...params }) -> Corti.AgentsRegistryExpertsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint retrieves the experts registry, which contains information about all available experts that can be referenced when creating agents through the AgentsCreateExpertReference schema. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.agents.getRegistryExperts({ + limit: 100, + offset: 0 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Corti.AgentsGetRegistryExpertsRequest` + +
+
+ +
+
+ +**requestOptions:** `AgentsClient.RequestOptions` + +
+
+
+
+ + +
+
+
diff --git a/src/BaseClient.ts b/src/BaseClient.ts new file mode 100644 index 00000000..c392baa0 --- /dev/null +++ b/src/BaseClient.ts @@ -0,0 +1,90 @@ +// This file was auto-generated by Fern from our API Definition. + +import { BearerAuthProvider } from "./auth/BearerAuthProvider.js"; +import { mergeHeaders } from "./core/headers.js"; +import * as core from "./core/index.js"; +import type * as environments from "./environments.js"; + +export type BaseClientOptions = { + environment: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + /** Override the Tenant-Name header */ + tenantName: core.Supplier; + /** Additional headers to include in requests. */ + headers?: Record | null | undefined>; + /** The default maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The default number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */ + fetch?: typeof fetch; + /** Configure logging for the client. */ + logging?: core.logging.LogConfig | core.logging.Logger; +} & BearerAuthProvider.AuthOptions; + +export interface BaseRequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Tenant-Name header */ + tenantName?: string; + /** Additional query string parameters to include in the request. */ + queryParams?: Record; + /** Additional headers to include in the request. */ + headers?: Record | null | undefined>; +} + +export type NormalizedClientOptions = T & { + logging: core.logging.Logger; + authProvider?: core.AuthProvider; +}; + +export type NormalizedClientOptionsWithAuth = + NormalizedClientOptions & { + authProvider: core.AuthProvider; + }; + +export function normalizeClientOptions( + options: T, +): NormalizedClientOptions { + const headers = mergeHeaders( + { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@corti/sdk", + "X-Fern-SDK-Version": "0.10.1", + "User-Agent": "@corti/sdk/0.10.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + "Tenant-Name": options?.tenantName, + }, + options?.headers, + ); + + return { + ...options, + logging: core.logging.createLogger(options?.logging), + headers, + } as NormalizedClientOptions; +} + +export function normalizeClientOptionsWithAuth( + options: T, +): NormalizedClientOptionsWithAuth { + const normalized = normalizeClientOptions(options) as NormalizedClientOptionsWithAuth; + const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized); + normalized.authProvider ??= new BearerAuthProvider(normalizedWithNoOpAuthProvider); + return normalized; +} + +function withNoOpAuthProvider( + options: NormalizedClientOptions, +): NormalizedClientOptionsWithAuth { + return { + ...options, + authProvider: new core.NoOpAuthProvider(), + }; +} diff --git a/src/Client.ts b/src/Client.ts index 68a57f06..d4393819 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -1,165 +1,78 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as environments from "./environments.js"; -import * as core from "./core/index.js"; -import { Auth } from "./api/resources/auth/client/Client.js"; -import { mergeHeaders } from "./core/headers.js"; -import { Interactions } from "./api/resources/interactions/client/Client.js"; -import { Recordings } from "./api/resources/recordings/client/Client.js"; -import { Transcripts } from "./api/resources/transcripts/client/Client.js"; -import { Facts } from "./api/resources/facts/client/Client.js"; -import { Documents } from "./api/resources/documents/client/Client.js"; -import { Templates } from "./api/resources/templates/client/Client.js"; -import { Codes } from "./api/resources/codes/client/Client.js"; -import { Agents } from "./api/resources/agents/client/Client.js"; -import { Stream } from "./api/resources/stream/client/Client.js"; -import { Transcribe } from "./api/resources/transcribe/client/Client.js"; +// This file was auto-generated by Fern from our API Definition. + +import { AgentsClient } from "./api/resources/agents/client/Client.js"; +import { CodesClient } from "./api/resources/codes/client/Client.js"; +import { DocumentsClient } from "./api/resources/documents/client/Client.js"; +import { FactsClient } from "./api/resources/facts/client/Client.js"; +import { InteractionsClient } from "./api/resources/interactions/client/Client.js"; +import { RecordingsClient } from "./api/resources/recordings/client/Client.js"; +import { StreamClient } from "./api/resources/stream/client/Client.js"; +import { TemplatesClient } from "./api/resources/templates/client/Client.js"; +import { TranscribeClient } from "./api/resources/transcribe/client/Client.js"; +import { TranscriptsClient } from "./api/resources/transcripts/client/Client.js"; +import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "./BaseClient.js"; export declare namespace CortiClient { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - clientId: core.Supplier; - clientSecret: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } + export type Options = BaseClientOptions; - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } export class CortiClient { - protected readonly _options: CortiClient.Options; - private readonly _oauthTokenProvider: core.OAuthTokenProvider; - protected _interactions: Interactions | undefined; - protected _recordings: Recordings | undefined; - protected _transcripts: Transcripts | undefined; - protected _facts: Facts | undefined; - protected _documents: Documents | undefined; - protected _templates: Templates | undefined; - protected _codes: Codes | undefined; - protected _auth: Auth | undefined; - protected _agents: Agents | undefined; - protected _stream: Stream | undefined; - protected _transcribe: Transcribe | undefined; - - constructor(_options: CortiClient.Options) { - this._options = { - ..._options, - headers: mergeHeaders( - { - "Tenant-Name": _options?.tenantName, - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "@corti/sdk", - "X-Fern-SDK-Version": "0.10.1", - "User-Agent": "@corti/sdk/0.10.1", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - }, - _options?.headers, - ), - }; - - this._oauthTokenProvider = new core.OAuthTokenProvider({ - clientId: this._options.clientId, - clientSecret: this._options.clientSecret, - authClient: new Auth({ - ...this._options, - environment: this._options.environment, - }), - }); - } - - public get interactions(): Interactions { - return (this._interactions ??= new Interactions({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + protected readonly _options: NormalizedClientOptionsWithAuth; + protected _interactions: InteractionsClient | undefined; + protected _recordings: RecordingsClient | undefined; + protected _transcripts: TranscriptsClient | undefined; + protected _facts: FactsClient | undefined; + protected _documents: DocumentsClient | undefined; + protected _templates: TemplatesClient | undefined; + protected _codes: CodesClient | undefined; + protected _agents: AgentsClient | undefined; + protected _stream: StreamClient | undefined; + protected _transcribe: TranscribeClient | undefined; + + constructor(options: CortiClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); } - public get recordings(): Recordings { - return (this._recordings ??= new Recordings({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + public get interactions(): InteractionsClient { + return (this._interactions ??= new InteractionsClient(this._options)); } - public get transcripts(): Transcripts { - return (this._transcripts ??= new Transcripts({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + public get recordings(): RecordingsClient { + return (this._recordings ??= new RecordingsClient(this._options)); } - public get facts(): Facts { - return (this._facts ??= new Facts({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + public get transcripts(): TranscriptsClient { + return (this._transcripts ??= new TranscriptsClient(this._options)); } - public get documents(): Documents { - return (this._documents ??= new Documents({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + public get facts(): FactsClient { + return (this._facts ??= new FactsClient(this._options)); } - public get templates(): Templates { - return (this._templates ??= new Templates({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + public get documents(): DocumentsClient { + return (this._documents ??= new DocumentsClient(this._options)); } - public get codes(): Codes { - return (this._codes ??= new Codes({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + public get templates(): TemplatesClient { + return (this._templates ??= new TemplatesClient(this._options)); } - public get auth(): Auth { - return (this._auth ??= new Auth({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + public get codes(): CodesClient { + return (this._codes ??= new CodesClient(this._options)); } - public get agents(): Agents { - return (this._agents ??= new Agents({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + public get agents(): AgentsClient { + return (this._agents ??= new AgentsClient(this._options)); } - public get stream(): Stream { - return (this._stream ??= new Stream({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + public get stream(): StreamClient { + return (this._stream ??= new StreamClient(this._options)); } - public get transcribe(): Transcribe { - return (this._transcribe ??= new Transcribe({ - ...this._options, - token: async () => await this._oauthTokenProvider.getToken(), - })); + public get transcribe(): TranscribeClient { + return (this._transcribe ??= new TranscribeClient(this._options)); } } diff --git a/src/api/errors/BadGatewayError.ts b/src/api/errors/BadGatewayError.ts index 93c6cd52..e8b6b269 100644 --- a/src/api/errors/BadGatewayError.ts +++ b/src/api/errors/BadGatewayError.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as Corti from "../index.js"; -import * as core from "../../core/index.js"; +import type * as Corti from "../index.js"; export class BadGatewayError extends errors.CortiError { constructor(body: Corti.ErrorResponse, rawResponse?: core.RawResponse) { @@ -14,6 +12,11 @@ export class BadGatewayError extends errors.CortiError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, BadGatewayError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = this.constructor.name; } } diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts index 7dccc76b..f3993f98 100644 --- a/src/api/errors/BadRequestError.ts +++ b/src/api/errors/BadRequestError.ts @@ -1,9 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as core from "../../core/index.js"; export class BadRequestError extends errors.CortiError { constructor(body?: unknown, rawResponse?: core.RawResponse) { @@ -13,6 +11,11 @@ export class BadRequestError extends errors.CortiError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, BadRequestError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = this.constructor.name; } } diff --git a/src/api/errors/ForbiddenError.ts b/src/api/errors/ForbiddenError.ts index 3a058174..948b7672 100644 --- a/src/api/errors/ForbiddenError.ts +++ b/src/api/errors/ForbiddenError.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as Corti from "../index.js"; -import * as core from "../../core/index.js"; +import type * as Corti from "../index.js"; export class ForbiddenError extends errors.CortiError { constructor(body: Corti.ErrorResponse, rawResponse?: core.RawResponse) { @@ -14,6 +12,11 @@ export class ForbiddenError extends errors.CortiError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, ForbiddenError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = this.constructor.name; } } diff --git a/src/api/errors/GatewayTimeoutError.ts b/src/api/errors/GatewayTimeoutError.ts index c57fe019..c211296b 100644 --- a/src/api/errors/GatewayTimeoutError.ts +++ b/src/api/errors/GatewayTimeoutError.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as Corti from "../index.js"; -import * as core from "../../core/index.js"; +import type * as Corti from "../index.js"; export class GatewayTimeoutError extends errors.CortiError { constructor(body: Corti.ErrorResponse, rawResponse?: core.RawResponse) { @@ -14,6 +12,11 @@ export class GatewayTimeoutError extends errors.CortiError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, GatewayTimeoutError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = this.constructor.name; } } diff --git a/src/api/errors/InternalServerError.ts b/src/api/errors/InternalServerError.ts index cc81905b..a5705c14 100644 --- a/src/api/errors/InternalServerError.ts +++ b/src/api/errors/InternalServerError.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as Corti from "../index.js"; -import * as core from "../../core/index.js"; +import type * as Corti from "../index.js"; export class InternalServerError extends errors.CortiError { constructor(body: Corti.ErrorResponse, rawResponse?: core.RawResponse) { @@ -14,6 +12,11 @@ export class InternalServerError extends errors.CortiError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, InternalServerError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = this.constructor.name; } } diff --git a/src/api/errors/NotFoundError.ts b/src/api/errors/NotFoundError.ts index 1e9bf21c..e8f9c5be 100644 --- a/src/api/errors/NotFoundError.ts +++ b/src/api/errors/NotFoundError.ts @@ -1,9 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as core from "../../core/index.js"; export class NotFoundError extends errors.CortiError { constructor(body?: unknown, rawResponse?: core.RawResponse) { @@ -13,6 +11,11 @@ export class NotFoundError extends errors.CortiError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, NotFoundError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = this.constructor.name; } } diff --git a/src/api/errors/UnauthorizedError.ts b/src/api/errors/UnauthorizedError.ts index be3cea18..eecf170a 100644 --- a/src/api/errors/UnauthorizedError.ts +++ b/src/api/errors/UnauthorizedError.ts @@ -1,9 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as core from "../../core/index.js"; export class UnauthorizedError extends errors.CortiError { constructor(body?: unknown, rawResponse?: core.RawResponse) { @@ -13,6 +11,11 @@ export class UnauthorizedError extends errors.CortiError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, UnauthorizedError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = this.constructor.name; } } diff --git a/src/api/errors/index.ts b/src/api/errors/index.ts index cfb88dde..20780f20 100644 --- a/src/api/errors/index.ts +++ b/src/api/errors/index.ts @@ -1,7 +1,7 @@ +export * from "./BadGatewayError.js"; +export * from "./BadRequestError.js"; export * from "./ForbiddenError.js"; export * from "./GatewayTimeoutError.js"; -export * from "./BadRequestError.js"; export * from "./InternalServerError.js"; export * from "./NotFoundError.js"; export * from "./UnauthorizedError.js"; -export * from "./BadGatewayError.js"; diff --git a/src/api/index.ts b/src/api/index.ts index 390dbe0e..6ed44b0b 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,7 +1,3 @@ +export * from "./errors/index.js"; export * from "./resources/index.js"; export * from "./types/index.js"; -export * from "./errors/index.js"; -/** - * Patch: including custom types to main export of types - */ -export * from "../custom/index.js"; diff --git a/src/api/resources/agents/client/Client.ts b/src/api/resources/agents/client/Client.ts index a2cc934a..1dcd9df6 100644 --- a/src/api/resources/agents/client/Client.ts +++ b/src/api/resources/agents/client/Client.ts @@ -1,52 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as serializers from "../../../../serialization/index.js"; +import * as core from "../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as serializers from "../../../../serialization/index.js"; +import * as Corti from "../../../index.js"; -export declare namespace Agents { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace AgentsClient { + export type Options = BaseClientOptions; - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Agents { - protected readonly _options: Agents.Options; +export class AgentsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Agents.Options) { - this._options = _options; + constructor(options: AgentsClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); } /** * This endpoint retrieves a list of all agents that can be called by the Corti Agent Framework. * * @param {Corti.AgentsListRequest} request - * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -56,29 +36,28 @@ export class Agents { */ public list( request: Corti.AgentsListRequest = {}, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); } private async __list( request: Corti.AgentsListRequest = {}, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): Promise> { const { limit, offset, ephemeral } = request; - const _queryParams: Record = {}; - if (limit !== undefined) { - _queryParams["limit"] = limit?.toString() ?? null; - } - - if (offset !== undefined) { - _queryParams["offset"] = offset?.toString() ?? null; - } - - if (ephemeral !== undefined) { - _queryParams["ephemeral"] = ephemeral?.toString() ?? null; - } - + const _queryParams: Record = { + limit, + offset, + ephemeral, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -86,18 +65,13 @@ export class Agents { "agents", ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -127,28 +101,14 @@ export class Agents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /agents."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/agents"); } /** * This endpoint allows the creation of a new agent that can be utilized in the `POST /agents/{id}/v1/message:send` endpoint. * * @param {Corti.AgentsCreateAgent} request - * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -161,21 +121,26 @@ export class Agents { */ public create( request: Corti.AgentsCreateAgent, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); } private async __create( request: Corti.AgentsCreateAgent, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): Promise> { const { ephemeral, ..._body } = request; - const _queryParams: Record = {}; - if (ephemeral !== undefined) { - _queryParams["ephemeral"] = ephemeral?.toString() ?? null; - } - + const _queryParams: Record = { + ephemeral, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -183,24 +148,19 @@ export class Agents { "agents", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: serializers.AgentsCreateAgent.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -230,28 +190,14 @@ export class Agents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling POST /agents."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/agents"); } /** * This endpoint retrieves an agent by its identifier. The agent contains information about its capabilities and the experts it can call. * * @param {string} id - The identifier of the agent associated with the context. - * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -262,33 +208,36 @@ export class Agents { */ public get( id: string, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions)); } private async __get( id: string, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).agents, - `agents/${encodeURIComponent(id)}`, + `agents/${core.url.encodePathParam(id)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -320,28 +269,14 @@ export class Agents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/agents/{id}"); } /** * This endpoint deletes an agent by its identifier. Once deleted, the agent can no longer be used in threads. * * @param {string} id - The identifier of the agent associated with the context. - * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -350,29 +285,35 @@ export class Agents { * @example * await client.agents.delete("12345678-90ab-cdef-gh12-34567890abc") */ - public delete(id: string, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise { + public delete(id: string, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions)); } - private async __delete(id: string, requestOptions?: Agents.RequestOptions): Promise> { + private async __delete( + id: string, + requestOptions?: AgentsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).agents, - `agents/${encodeURIComponent(id)}`, + `agents/${core.url.encodePathParam(id)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: undefined, rawResponse: _response.rawResponse }; @@ -395,21 +336,7 @@ export class Agents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling DELETE /agents/{id}."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/agents/{id}"); } /** @@ -417,7 +344,7 @@ export class Agents { * * @param {string} id - The identifier of the agent associated with the context. * @param {Corti.AgentsAgent} request - * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -434,7 +361,7 @@ export class Agents { public update( id: string, request: Corti.AgentsAgent, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions)); } @@ -442,32 +369,35 @@ export class Agents { private async __update( id: string, request: Corti.AgentsAgent, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).agents, - `agents/${encodeURIComponent(id)}`, + `agents/${core.url.encodePathParam(id)}`, ), method: "PATCH", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.AgentsAgent.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -499,28 +429,14 @@ export class Agents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling PATCH /agents/{id}."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/agents/{id}"); } /** * This endpoint retrieves the agent card in JSON format, which provides metadata about the agent, including its name, description, and the experts it can call. * * @param {string} id - The identifier of the agent associated with the context. - * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -531,33 +447,36 @@ export class Agents { */ public getCard( id: string, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getCard(id, requestOptions)); } private async __getCard( id: string, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).agents, - `agents/${encodeURIComponent(id)}/agent-card.json`, + `agents/${core.url.encodePathParam(id)}/agent-card.json`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -589,21 +508,7 @@ export class Agents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}/agent-card.json."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/agents/{id}/agent-card.json"); } /** @@ -611,7 +516,7 @@ export class Agents { * * @param {string} id - The identifier of the agent associated with the context. * @param {Corti.AgentsMessageSendParams} request - * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -633,7 +538,7 @@ export class Agents { public messageSend( id: string, request: Corti.AgentsMessageSendParams, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__messageSend(id, request, requestOptions)); } @@ -641,32 +546,35 @@ export class Agents { private async __messageSend( id: string, request: Corti.AgentsMessageSendParams, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).agents, - `agents/${encodeURIComponent(id)}/v1/message:send`, + `agents/${core.url.encodePathParam(id)}/v1/message:send`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.AgentsMessageSendParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -698,21 +606,7 @@ export class Agents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling POST /agents/{id}/v1/message:send."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/agents/{id}/v1/message:send"); } /** @@ -721,7 +615,7 @@ export class Agents { * @param {string} id - The identifier of the agent associated with the context. * @param {string} taskId - The identifier of the task to retrieve. * @param {Corti.AgentsGetTaskRequest} request - * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -734,7 +628,7 @@ export class Agents { id: string, taskId: string, request: Corti.AgentsGetTaskRequest = {}, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getTask(id, taskId, request, requestOptions)); } @@ -743,33 +637,33 @@ export class Agents { id: string, taskId: string, request: Corti.AgentsGetTaskRequest = {}, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): Promise> { const { historyLength } = request; - const _queryParams: Record = {}; - if (historyLength !== undefined) { - _queryParams["historyLength"] = historyLength?.toString() ?? null; - } - + const _queryParams: Record = { + historyLength, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).agents, - `agents/${encodeURIComponent(id)}/v1/tasks/${encodeURIComponent(taskId)}`, + `agents/${core.url.encodePathParam(id)}/v1/tasks/${core.url.encodePathParam(taskId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -801,21 +695,12 @@ export class Agents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}/v1/tasks/{taskId}."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/agents/{id}/v1/tasks/{taskId}", + ); } /** @@ -824,7 +709,7 @@ export class Agents { * @param {string} id - The identifier of the agent associated with the context. * @param {string} contextId - The identifier of the context (thread) to retrieve tasks for. * @param {Corti.AgentsGetContextRequest} request - * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -837,7 +722,7 @@ export class Agents { id: string, contextId: string, request: Corti.AgentsGetContextRequest = {}, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getContext(id, contextId, request, requestOptions)); } @@ -846,37 +731,34 @@ export class Agents { id: string, contextId: string, request: Corti.AgentsGetContextRequest = {}, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): Promise> { const { limit, offset } = request; - const _queryParams: Record = {}; - if (limit !== undefined) { - _queryParams["limit"] = limit?.toString() ?? null; - } - - if (offset !== undefined) { - _queryParams["offset"] = offset?.toString() ?? null; - } - + const _queryParams: Record = { + limit, + offset, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).agents, - `agents/${encodeURIComponent(id)}/v1/contexts/${encodeURIComponent(contextId)}`, + `agents/${core.url.encodePathParam(id)}/v1/contexts/${core.url.encodePathParam(contextId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -908,30 +790,19 @@ export class Agents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling GET /agents/{id}/v1/contexts/{contextId}.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/agents/{id}/v1/contexts/{contextId}", + ); } /** * This endpoint retrieves the experts registry, which contains information about all available experts that can be referenced when creating agents through the AgentsCreateExpertReference schema. * * @param {Corti.AgentsGetRegistryExpertsRequest} request - * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -944,25 +815,27 @@ export class Agents { */ public getRegistryExperts( request: Corti.AgentsGetRegistryExpertsRequest = {}, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getRegistryExperts(request, requestOptions)); } private async __getRegistryExperts( request: Corti.AgentsGetRegistryExpertsRequest = {}, - requestOptions?: Agents.RequestOptions, + requestOptions?: AgentsClient.RequestOptions, ): Promise> { const { limit, offset } = request; - const _queryParams: Record = {}; - if (limit !== undefined) { - _queryParams["limit"] = limit?.toString() ?? null; - } - - if (offset !== undefined) { - _queryParams["offset"] = offset?.toString() ?? null; - } - + const _queryParams: Record = { + limit, + offset, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -970,18 +843,13 @@ export class Agents { "agents/registry/experts", ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -1011,29 +879,6 @@ export class Agents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /agents/registry/experts."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/agents/registry/experts"); } } diff --git a/src/api/resources/agents/client/index.ts b/src/api/resources/agents/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/agents/client/index.ts +++ b/src/api/resources/agents/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/agents/client/requests/AgentsCreateAgent.ts b/src/api/resources/agents/client/requests/AgentsCreateAgent.ts index f723f65e..42c96a76 100644 --- a/src/api/resources/agents/client/requests/AgentsCreateAgent.ts +++ b/src/api/resources/agents/client/requests/AgentsCreateAgent.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example @@ -12,10 +10,8 @@ import * as Corti from "../../../../index.js"; * } */ export interface AgentsCreateAgent { - /** - * If set to true, the agent will be created as ephemeral, it won't be listed in the agents_list but can still be fetched by ID. Ephemeral agents will be deleted periodically. - */ - ephemeral?: boolean | null; + /** If set to true, the agent will be created as ephemeral, it won't be listed in the agents_list but can still be fetched by ID. Ephemeral agents will be deleted periodically. */ + ephemeral?: boolean; /** The name of the agent. */ name: string; /** Optional type of agent. */ diff --git a/src/api/resources/agents/client/requests/AgentsGetContextRequest.ts b/src/api/resources/agents/client/requests/AgentsGetContextRequest.ts index 8eac4f90..aa60df6e 100644 --- a/src/api/resources/agents/client/requests/AgentsGetContextRequest.ts +++ b/src/api/resources/agents/client/requests/AgentsGetContextRequest.ts @@ -1,18 +1,12 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface AgentsGetContextRequest { - /** - * The maximum number of tasks and messages to return. If not specified all history is returned. - */ - limit?: number | null; - /** - * The number of tasks and messages to skip before starting to collect the result set. Default is 0. - */ - offset?: number | null; + /** The maximum number of tasks and messages to return. If not specified all history is returned. */ + limit?: number; + /** The number of tasks and messages to skip before starting to collect the result set. Default is 0. */ + offset?: number; } diff --git a/src/api/resources/agents/client/requests/AgentsGetRegistryExpertsRequest.ts b/src/api/resources/agents/client/requests/AgentsGetRegistryExpertsRequest.ts index 299644db..8fcaf74f 100644 --- a/src/api/resources/agents/client/requests/AgentsGetRegistryExpertsRequest.ts +++ b/src/api/resources/agents/client/requests/AgentsGetRegistryExpertsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -10,12 +8,8 @@ * } */ export interface AgentsGetRegistryExpertsRequest { - /** - * The maximum number of items to return. If not specified, a default number of items will be returned. - */ - limit?: number | null; - /** - * The number of items to skip before starting to collect the result set. Default is 0. - */ - offset?: number | null; + /** The maximum number of items to return. If not specified, a default number of items will be returned. */ + limit?: number; + /** The number of items to skip before starting to collect the result set. Default is 0. */ + offset?: number; } diff --git a/src/api/resources/agents/client/requests/AgentsGetTaskRequest.ts b/src/api/resources/agents/client/requests/AgentsGetTaskRequest.ts index ff6ecc75..0d3dee98 100644 --- a/src/api/resources/agents/client/requests/AgentsGetTaskRequest.ts +++ b/src/api/resources/agents/client/requests/AgentsGetTaskRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface AgentsGetTaskRequest { - /** - * The number of previous messages to include in the context for the agent when retrieving this task. Default is all messages. - */ - historyLength?: number | null; + /** The number of previous messages to include in the context for the agent when retrieving this task. Default is all messages. */ + historyLength?: number; } diff --git a/src/api/resources/agents/client/requests/AgentsListRequest.ts b/src/api/resources/agents/client/requests/AgentsListRequest.ts index 0d7ea137..efafb427 100644 --- a/src/api/resources/agents/client/requests/AgentsListRequest.ts +++ b/src/api/resources/agents/client/requests/AgentsListRequest.ts @@ -1,22 +1,14 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface AgentsListRequest { - /** - * The maximum number of agents to return. If not specified, all agents will be returned. - */ - limit?: number | null; - /** - * The number of agents to skip before starting to collect the result set. Default is 0. - */ - offset?: number | null; - /** - * If set to true, ephemeral agents will be included in the response. Default is false. - */ - ephemeral?: boolean | null; + /** The maximum number of agents to return. If not specified, all agents will be returned. */ + limit?: number; + /** The number of agents to skip before starting to collect the result set. Default is 0. */ + offset?: number; + /** If set to true, ephemeral agents will be included in the response. Default is false. */ + ephemeral?: boolean; } diff --git a/src/api/resources/agents/client/requests/AgentsMessageSendParams.ts b/src/api/resources/agents/client/requests/AgentsMessageSendParams.ts index 49b6ca9c..53f9cf2e 100644 --- a/src/api/resources/agents/client/requests/AgentsMessageSendParams.ts +++ b/src/api/resources/agents/client/requests/AgentsMessageSendParams.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example diff --git a/src/api/resources/agents/client/requests/index.ts b/src/api/resources/agents/client/requests/index.ts index c153c97f..272e18a0 100644 --- a/src/api/resources/agents/client/requests/index.ts +++ b/src/api/resources/agents/client/requests/index.ts @@ -1,6 +1,6 @@ -export { type AgentsListRequest } from "./AgentsListRequest.js"; -export { type AgentsCreateAgent } from "./AgentsCreateAgent.js"; -export { type AgentsMessageSendParams } from "./AgentsMessageSendParams.js"; -export { type AgentsGetTaskRequest } from "./AgentsGetTaskRequest.js"; -export { type AgentsGetContextRequest } from "./AgentsGetContextRequest.js"; -export { type AgentsGetRegistryExpertsRequest } from "./AgentsGetRegistryExpertsRequest.js"; +export type { AgentsCreateAgent } from "./AgentsCreateAgent.js"; +export type { AgentsGetContextRequest } from "./AgentsGetContextRequest.js"; +export type { AgentsGetRegistryExpertsRequest } from "./AgentsGetRegistryExpertsRequest.js"; +export type { AgentsGetTaskRequest } from "./AgentsGetTaskRequest.js"; +export type { AgentsListRequest } from "./AgentsListRequest.js"; +export type { AgentsMessageSendParams } from "./AgentsMessageSendParams.js"; diff --git a/src/api/resources/agents/exports.ts b/src/api/resources/agents/exports.ts new file mode 100644 index 00000000..b468a638 --- /dev/null +++ b/src/api/resources/agents/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { AgentsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/agents/index.ts b/src/api/resources/agents/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/agents/index.ts +++ b/src/api/resources/agents/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/agents/types/AgentsCreateAgentAgentType.ts b/src/api/resources/agents/types/AgentsCreateAgentAgentType.ts index 33a0c81a..745a52e8 100644 --- a/src/api/resources/agents/types/AgentsCreateAgentAgentType.ts +++ b/src/api/resources/agents/types/AgentsCreateAgentAgentType.ts @@ -1,13 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Optional type of agent. - */ -export type AgentsCreateAgentAgentType = "expert" | "orchestrator" | "interviewing-expert"; +/** Optional type of agent. */ export const AgentsCreateAgentAgentType = { Expert: "expert", Orchestrator: "orchestrator", InterviewingExpert: "interviewing-expert", } as const; +export type AgentsCreateAgentAgentType = (typeof AgentsCreateAgentAgentType)[keyof typeof AgentsCreateAgentAgentType]; diff --git a/src/api/resources/agents/types/AgentsCreateAgentExpertsItem.ts b/src/api/resources/agents/types/AgentsCreateAgentExpertsItem.ts index 5e2d015a..9a1278ed 100644 --- a/src/api/resources/agents/types/AgentsCreateAgentExpertsItem.ts +++ b/src/api/resources/agents/types/AgentsCreateAgentExpertsItem.ts @@ -1,7 +1,5 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../index.js"; +import type * as Corti from "../../../index.js"; export type AgentsCreateAgentExpertsItem = Corti.AgentsCreateExpert | Corti.AgentsCreateExpertReference; diff --git a/src/api/resources/agents/types/AgentsMessageSendResponse.ts b/src/api/resources/agents/types/AgentsMessageSendResponse.ts index 791d7a91..daa55406 100644 --- a/src/api/resources/agents/types/AgentsMessageSendResponse.ts +++ b/src/api/resources/agents/types/AgentsMessageSendResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../index.js"; +import type * as Corti from "../../../index.js"; export interface AgentsMessageSendResponse { message?: Corti.AgentsMessage; diff --git a/src/api/resources/auth/client/Client.ts b/src/api/resources/auth/client/Client.ts deleted file mode 100644 index 852b864d..00000000 --- a/src/api/resources/auth/client/Client.ts +++ /dev/null @@ -1,145 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as serializers from "../../../../serialization/index.js"; -import * as errors from "../../../../errors/index.js"; - -export declare namespace Auth { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } - - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } -} - -export class Auth { - protected readonly _options: Auth.Options; - - constructor(_options: Auth.Options) { - this._options = _options; - } - - /** - * Obtain an OAuth2 access token using client credentials - * - * @param {Corti.AuthGetTokenRequest} request - * @param {Auth.RequestOptions} requestOptions - Request-specific configuration. - * - * @example - * await client.auth.getToken({ - * clientId: "client_id_123", - * clientSecret: "my_secret_value" - * }) - */ - public getToken( - request: Corti.AuthGetTokenRequest, - requestOptions?: Auth.RequestOptions, - ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__getToken(request, requestOptions)); - } - - private async __getToken( - request: Corti.AuthGetTokenRequest, - requestOptions?: Auth.RequestOptions, - ): Promise> { - const _response = await core.fetcher({ - url: core.url.join( - (await core.Supplier.get(this._options.baseUrl)) ?? - (await core.Supplier.get(this._options.environment)).login, - "protocol/openid-connect/token", - ), - method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - contentType: "application/x-www-form-urlencoded", - requestType: "json", - body: { - ...serializers.AuthGetTokenRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }), - scope: "openid", - grant_type: "client_credentials", - }, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.GetTokenResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - rawResponse: _response.rawResponse, - }); - } - - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling POST /protocol/openid-connect/token.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; - } -} diff --git a/src/api/resources/auth/client/index.ts b/src/api/resources/auth/client/index.ts deleted file mode 100644 index 82648c6f..00000000 --- a/src/api/resources/auth/client/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -export * from "./requests/index.js"; diff --git a/src/api/resources/auth/client/requests/AuthGetTokenRequest.ts b/src/api/resources/auth/client/requests/AuthGetTokenRequest.ts deleted file mode 100644 index fb7b849d..00000000 --- a/src/api/resources/auth/client/requests/AuthGetTokenRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * @example - * { - * clientId: "client_id_123", - * clientSecret: "my_secret_value" - * } - */ -export interface AuthGetTokenRequest { - clientId: string; - /** Optional secret for confidential clients and Authorization code flow */ - clientSecret?: string; -} diff --git a/src/api/resources/auth/client/requests/index.ts b/src/api/resources/auth/client/requests/index.ts deleted file mode 100644 index db82948f..00000000 --- a/src/api/resources/auth/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { type AuthGetTokenRequest } from "./AuthGetTokenRequest.js"; diff --git a/src/api/resources/auth/index.ts b/src/api/resources/auth/index.ts deleted file mode 100644 index f095e147..00000000 --- a/src/api/resources/auth/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./types/index.js"; -export * from "./client/index.js"; diff --git a/src/api/resources/auth/types/GetTokenResponse.ts b/src/api/resources/auth/types/GetTokenResponse.ts deleted file mode 100644 index 63db812e..00000000 --- a/src/api/resources/auth/types/GetTokenResponse.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface GetTokenResponse { - accessToken: string; - tokenType: string; - expiresIn: number; - refreshToken?: string; - refreshExpiresIn?: number; -} diff --git a/src/api/resources/auth/types/index.ts b/src/api/resources/auth/types/index.ts deleted file mode 100644 index cecadafd..00000000 --- a/src/api/resources/auth/types/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./GetTokenResponse.js"; diff --git a/src/api/resources/codes/client/Client.ts b/src/api/resources/codes/client/Client.ts index 3a1df8d1..e0bc1660 100644 --- a/src/api/resources/codes/client/Client.ts +++ b/src/api/resources/codes/client/Client.ts @@ -1,52 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as serializers from "../../../../serialization/index.js"; +import * as core from "../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as serializers from "../../../../serialization/index.js"; +import * as Corti from "../../../index.js"; -export declare namespace Codes { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace CodesClient { + export type Options = BaseClientOptions; - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Codes { - protected readonly _options: Codes.Options; +export class CodesClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Codes.Options) { - this._options = _options; + constructor(options: CodesClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Predict medical codes from provided context.
This is a stateless endpoint, designed to predict ICD-10-CM, ICD-10-PCS, and CPT codes based on input text string or documentId.

More than one code system may be defined in a single request, and the maximum number of codes to return per system can also be defined.

Code prediction requests have two possible values for context:
- `text`: One set of code prediction results will be returned based on all input text defined.
- `documentId`: Code prediction will be based on that defined document only.

The response includes two sets of results:
- `Codes`: Highest confidence bundle of codes, as selected by the code prediction model
- `Candidates`: Full list of candidate codes as predicted by the model, rank sorted by model confidence with maximum possible value of 50.

All predicted code results are based on input context defined in the request only (not other external data or assets associated with an interaction).
* * @param {Corti.CodesGeneralPredictRequest} request - * @param {Codes.RequestOptions} requestOptions - Request-specific configuration. + * @param {CodesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.ForbiddenError} @@ -66,15 +46,22 @@ export class Codes { */ public predict( request: Corti.CodesGeneralPredictRequest, - requestOptions?: Codes.RequestOptions, + requestOptions?: CodesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__predict(request, requestOptions)); } private async __predict( request: Corti.CodesGeneralPredictRequest, - requestOptions?: Codes.RequestOptions, + requestOptions?: CodesClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -82,23 +69,19 @@ export class Codes { "tools/coding/", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.CodesGeneralPredictRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -170,29 +153,6 @@ export class Codes { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling POST /tools/coding/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/tools/coding/"); } } diff --git a/src/api/resources/codes/client/index.ts b/src/api/resources/codes/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/codes/client/index.ts +++ b/src/api/resources/codes/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/codes/client/requests/CodesGeneralPredictRequest.ts b/src/api/resources/codes/client/requests/CodesGeneralPredictRequest.ts index dc4faed3..53682522 100644 --- a/src/api/resources/codes/client/requests/CodesGeneralPredictRequest.ts +++ b/src/api/resources/codes/client/requests/CodesGeneralPredictRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example diff --git a/src/api/resources/codes/client/requests/index.ts b/src/api/resources/codes/client/requests/index.ts index 94f0625c..e326f9e4 100644 --- a/src/api/resources/codes/client/requests/index.ts +++ b/src/api/resources/codes/client/requests/index.ts @@ -1 +1 @@ -export { type CodesGeneralPredictRequest } from "./CodesGeneralPredictRequest.js"; +export type { CodesGeneralPredictRequest } from "./CodesGeneralPredictRequest.js"; diff --git a/src/api/resources/codes/exports.ts b/src/api/resources/codes/exports.ts new file mode 100644 index 00000000..c70f5e4b --- /dev/null +++ b/src/api/resources/codes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CodesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/documents/client/Client.ts b/src/api/resources/documents/client/Client.ts index 56f35de7..3077a0f5 100644 --- a/src/api/resources/documents/client/Client.ts +++ b/src/api/resources/documents/client/Client.ts @@ -1,52 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as serializers from "../../../../serialization/index.js"; +import * as core from "../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as serializers from "../../../../serialization/index.js"; +import * as Corti from "../../../index.js"; -export declare namespace Documents { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace DocumentsClient { + export type Options = BaseClientOptions; - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Documents { - protected readonly _options: Documents.Options; +export class DocumentsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Documents.Options) { - this._options = _options; + constructor(options: DocumentsClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); } /** * List Documents * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. - * @param {Documents.RequestOptions} requestOptions - Request-specific configuration. + * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.ForbiddenError} @@ -58,33 +38,36 @@ export class Documents { */ public list( id: Corti.Uuid, - requestOptions?: Documents.RequestOptions, + requestOptions?: DocumentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__list(id, requestOptions)); } private async __list( id: Corti.Uuid, - requestOptions?: Documents.RequestOptions, + requestOptions?: DocumentsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/documents/`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/documents/`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -145,21 +128,7 @@ export class Documents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /interactions/{id}/documents/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/interactions/{id}/documents/"); } /** @@ -167,7 +136,7 @@ export class Documents { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.DocumentsCreateRequest} request - * @param {Documents.RequestOptions} requestOptions - Request-specific configuration. + * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.ForbiddenError} @@ -190,7 +159,7 @@ export class Documents { public create( id: Corti.Uuid, request: Corti.DocumentsCreateRequest, - requestOptions?: Documents.RequestOptions, + requestOptions?: DocumentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(id, request, requestOptions)); } @@ -198,32 +167,35 @@ export class Documents { private async __create( id: Corti.Uuid, request: Corti.DocumentsCreateRequest, - requestOptions?: Documents.RequestOptions, + requestOptions?: DocumentsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/documents/`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/documents/`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.DocumentsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -284,21 +256,12 @@ export class Documents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling POST /interactions/{id}/documents/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/interactions/{id}/documents/", + ); } /** @@ -306,7 +269,7 @@ export class Documents { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.Uuid} documentId - The document ID representing the context for the request. Must be a valid UUID. - * @param {Documents.RequestOptions} requestOptions - Request-specific configuration. + * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.ForbiddenError} @@ -319,7 +282,7 @@ export class Documents { public get( id: Corti.Uuid, documentId: Corti.Uuid, - requestOptions?: Documents.RequestOptions, + requestOptions?: DocumentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__get(id, documentId, requestOptions)); } @@ -327,26 +290,29 @@ export class Documents { private async __get( id: Corti.Uuid, documentId: Corti.Uuid, - requestOptions?: Documents.RequestOptions, + requestOptions?: DocumentsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/documents/${encodeURIComponent(serializers.Uuid.jsonOrThrow(documentId, { omitUndefined: true }))}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/documents/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(documentId, { omitUndefined: true }))}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -407,29 +373,18 @@ export class Documents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling GET /interactions/{id}/documents/{documentId}.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/interactions/{id}/documents/{documentId}", + ); } /** * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.Uuid} documentId - The document ID representing the context for the request. Must be a valid UUID. - * @param {Documents.RequestOptions} requestOptions - Request-specific configuration. + * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.ForbiddenError} * @throws {@link Corti.NotFoundError} @@ -442,7 +397,7 @@ export class Documents { public delete( id: Corti.Uuid, documentId: Corti.Uuid, - requestOptions?: Documents.RequestOptions, + requestOptions?: DocumentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__delete(id, documentId, requestOptions)); } @@ -450,26 +405,29 @@ export class Documents { private async __delete( id: Corti.Uuid, documentId: Corti.Uuid, - requestOptions?: Documents.RequestOptions, + requestOptions?: DocumentsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/documents/${encodeURIComponent(serializers.Uuid.jsonOrThrow(documentId, { omitUndefined: true }))}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/documents/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(documentId, { omitUndefined: true }))}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: undefined, rawResponse: _response.rawResponse }; @@ -521,30 +479,19 @@ export class Documents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling DELETE /interactions/{id}/documents/{documentId}.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/interactions/{id}/documents/{documentId}", + ); } /** * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.Uuid} documentId - The document ID representing the context for the request. Must be a valid UUID. * @param {Corti.DocumentsUpdateRequest} request - * @param {Documents.RequestOptions} requestOptions - Request-specific configuration. + * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.ForbiddenError} @@ -558,7 +505,7 @@ export class Documents { id: Corti.Uuid, documentId: Corti.Uuid, request: Corti.DocumentsUpdateRequest = {}, - requestOptions?: Documents.RequestOptions, + requestOptions?: DocumentsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__update(id, documentId, request, requestOptions)); } @@ -567,32 +514,35 @@ export class Documents { id: Corti.Uuid, documentId: Corti.Uuid, request: Corti.DocumentsUpdateRequest = {}, - requestOptions?: Documents.RequestOptions, + requestOptions?: DocumentsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/documents/${encodeURIComponent(serializers.Uuid.jsonOrThrow(documentId, { omitUndefined: true }))}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/documents/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(documentId, { omitUndefined: true }))}`, ), method: "PATCH", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.DocumentsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -653,31 +603,11 @@ export class Documents { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling PATCH /interactions/{id}/documents/{documentId}.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "PATCH", + "/interactions/{id}/documents/{documentId}", + ); } } diff --git a/src/api/resources/documents/client/index.ts b/src/api/resources/documents/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/documents/client/index.ts +++ b/src/api/resources/documents/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/documents/client/requests/DocumentsUpdateRequest.ts b/src/api/resources/documents/client/requests/DocumentsUpdateRequest.ts index c3836133..20c1b75e 100644 --- a/src/api/resources/documents/client/requests/DocumentsUpdateRequest.ts +++ b/src/api/resources/documents/client/requests/DocumentsUpdateRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example diff --git a/src/api/resources/documents/client/requests/index.ts b/src/api/resources/documents/client/requests/index.ts index 3a81e0fb..d86bd2d7 100644 --- a/src/api/resources/documents/client/requests/index.ts +++ b/src/api/resources/documents/client/requests/index.ts @@ -1 +1 @@ -export { type DocumentsUpdateRequest } from "./DocumentsUpdateRequest.js"; +export type { DocumentsUpdateRequest } from "./DocumentsUpdateRequest.js"; diff --git a/src/api/resources/documents/exports.ts b/src/api/resources/documents/exports.ts new file mode 100644 index 00000000..221bb09c --- /dev/null +++ b/src/api/resources/documents/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { DocumentsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/facts/client/Client.ts b/src/api/resources/facts/client/Client.ts index d023b2ad..684f256e 100644 --- a/src/api/resources/facts/client/Client.ts +++ b/src/api/resources/facts/client/Client.ts @@ -1,51 +1,31 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as serializers from "../../../../serialization/index.js"; +import * as core from "../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as serializers from "../../../../serialization/index.js"; +import * as Corti from "../../../index.js"; -export declare namespace Facts { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace FactsClient { + export type Options = BaseClientOptions; - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Facts { - protected readonly _options: Facts.Options; +export class FactsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Facts.Options) { - this._options = _options; + constructor(options: FactsClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Returns a list of available fact groups, used to categorize facts associated with an interaction. * - * @param {Facts.RequestOptions} requestOptions - Request-specific configuration. + * @param {FactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.InternalServerError} * @@ -53,14 +33,21 @@ export class Facts { * await client.facts.factGroupsList() */ public factGroupsList( - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__factGroupsList(requestOptions)); } private async __factGroupsList( - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -68,17 +55,13 @@ export class Facts { "factgroups/", ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -115,28 +98,14 @@ export class Facts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /factgroups/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/factgroups/"); } /** * Retrieves a list of facts for a given interaction. * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. - * @param {Facts.RequestOptions} requestOptions - Request-specific configuration. + * @param {FactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.GatewayTimeoutError} * @@ -145,33 +114,36 @@ export class Facts { */ public list( id: Corti.Uuid, - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__list(id, requestOptions)); } private async __list( id: Corti.Uuid, - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/facts/`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/facts/`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -208,21 +180,7 @@ export class Facts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /interactions/{id}/facts/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/interactions/{id}/facts/"); } /** @@ -230,7 +188,7 @@ export class Facts { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.FactsCreateRequest} request - * @param {Facts.RequestOptions} requestOptions - Request-specific configuration. + * @param {FactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.GatewayTimeoutError} * @@ -245,7 +203,7 @@ export class Facts { public create( id: Corti.Uuid, request: Corti.FactsCreateRequest, - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(id, request, requestOptions)); } @@ -253,32 +211,35 @@ export class Facts { private async __create( id: Corti.Uuid, request: Corti.FactsCreateRequest, - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/facts/`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/facts/`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.FactsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -315,21 +276,7 @@ export class Facts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling POST /interactions/{id}/facts/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/interactions/{id}/facts/"); } /** @@ -337,7 +284,7 @@ export class Facts { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.FactsBatchUpdateRequest} request - * @param {Facts.RequestOptions} requestOptions - Request-specific configuration. + * @param {FactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.GatewayTimeoutError} * @@ -351,7 +298,7 @@ export class Facts { public batchUpdate( id: Corti.Uuid, request: Corti.FactsBatchUpdateRequest, - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__batchUpdate(id, request, requestOptions)); } @@ -359,32 +306,35 @@ export class Facts { private async __batchUpdate( id: Corti.Uuid, request: Corti.FactsBatchUpdateRequest, - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/facts/`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/facts/`, ), method: "PATCH", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.FactsBatchUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -421,21 +371,7 @@ export class Facts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling PATCH /interactions/{id}/facts/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/interactions/{id}/facts/"); } /** @@ -444,7 +380,7 @@ export class Facts { * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {string} factId - The unique identifier of the fact to update. Must be a valid UUID. * @param {Corti.FactsUpdateRequest} request - * @param {Facts.RequestOptions} requestOptions - Request-specific configuration. + * @param {FactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.GatewayTimeoutError} * @@ -455,7 +391,7 @@ export class Facts { id: Corti.Uuid, factId: string, request: Corti.FactsUpdateRequest = {}, - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__update(id, factId, request, requestOptions)); } @@ -464,32 +400,35 @@ export class Facts { id: Corti.Uuid, factId: string, request: Corti.FactsUpdateRequest = {}, - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/facts/${encodeURIComponent(factId)}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/facts/${core.url.encodePathParam(factId)}`, ), method: "PATCH", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.FactsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -526,30 +465,19 @@ export class Facts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling PATCH /interactions/{id}/facts/{factId}.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "PATCH", + "/interactions/{id}/facts/{factId}", + ); } /** * Extract facts from provided text, without storing them. * * @param {Corti.FactsExtractRequest} request - * @param {Facts.RequestOptions} requestOptions - Request-specific configuration. + * @param {FactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.GatewayTimeoutError} * @@ -564,15 +492,22 @@ export class Facts { */ public extract( request: Corti.FactsExtractRequest, - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__extract(request, requestOptions)); } private async __extract( request: Corti.FactsExtractRequest, - requestOptions?: Facts.RequestOptions, + requestOptions?: FactsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -580,23 +515,19 @@ export class Facts { "tools/extract-facts", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.FactsExtractRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -633,29 +564,6 @@ export class Facts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling POST /tools/extract-facts."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/tools/extract-facts"); } } diff --git a/src/api/resources/facts/client/index.ts b/src/api/resources/facts/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/facts/client/index.ts +++ b/src/api/resources/facts/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/facts/client/requests/FactsBatchUpdateRequest.ts b/src/api/resources/facts/client/requests/FactsBatchUpdateRequest.ts index 4e1d1097..30d79bdf 100644 --- a/src/api/resources/facts/client/requests/FactsBatchUpdateRequest.ts +++ b/src/api/resources/facts/client/requests/FactsBatchUpdateRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example diff --git a/src/api/resources/facts/client/requests/FactsCreateRequest.ts b/src/api/resources/facts/client/requests/FactsCreateRequest.ts index 0d77d7fa..17a9c3a2 100644 --- a/src/api/resources/facts/client/requests/FactsCreateRequest.ts +++ b/src/api/resources/facts/client/requests/FactsCreateRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example diff --git a/src/api/resources/facts/client/requests/FactsExtractRequest.ts b/src/api/resources/facts/client/requests/FactsExtractRequest.ts index 29bc6cb4..f20eeec9 100644 --- a/src/api/resources/facts/client/requests/FactsExtractRequest.ts +++ b/src/api/resources/facts/client/requests/FactsExtractRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example diff --git a/src/api/resources/facts/client/requests/FactsUpdateRequest.ts b/src/api/resources/facts/client/requests/FactsUpdateRequest.ts index 63196a68..3dff4961 100644 --- a/src/api/resources/facts/client/requests/FactsUpdateRequest.ts +++ b/src/api/resources/facts/client/requests/FactsUpdateRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example diff --git a/src/api/resources/facts/client/requests/index.ts b/src/api/resources/facts/client/requests/index.ts index f6557284..c5c6a0cb 100644 --- a/src/api/resources/facts/client/requests/index.ts +++ b/src/api/resources/facts/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type FactsCreateRequest } from "./FactsCreateRequest.js"; -export { type FactsBatchUpdateRequest } from "./FactsBatchUpdateRequest.js"; -export { type FactsUpdateRequest } from "./FactsUpdateRequest.js"; -export { type FactsExtractRequest } from "./FactsExtractRequest.js"; +export type { FactsBatchUpdateRequest } from "./FactsBatchUpdateRequest.js"; +export type { FactsCreateRequest } from "./FactsCreateRequest.js"; +export type { FactsExtractRequest } from "./FactsExtractRequest.js"; +export type { FactsUpdateRequest } from "./FactsUpdateRequest.js"; diff --git a/src/api/resources/facts/exports.ts b/src/api/resources/facts/exports.ts new file mode 100644 index 00000000..0a59bbd5 --- /dev/null +++ b/src/api/resources/facts/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { FactsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 12628de3..8aeea717 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,22 +1,19 @@ -export * as interactions from "./interactions/index.js"; -export * from "./interactions/types/index.js"; -export * as auth from "./auth/index.js"; -export * from "./auth/types/index.js"; +export * from "./agents/client/requests/index.js"; export * as agents from "./agents/index.js"; export * from "./agents/types/index.js"; -export * as stream from "./stream/index.js"; -export * as transcribe from "./transcribe/index.js"; -export * as recordings from "./recordings/index.js"; -export * as transcripts from "./transcripts/index.js"; -export * as facts from "./facts/index.js"; -export * as documents from "./documents/index.js"; -export * as templates from "./templates/index.js"; +export * from "./codes/client/requests/index.js"; export * as codes from "./codes/index.js"; -export * from "./interactions/client/requests/index.js"; -export * from "./transcripts/client/requests/index.js"; -export * from "./facts/client/requests/index.js"; export * from "./documents/client/requests/index.js"; +export * as documents from "./documents/index.js"; +export * from "./facts/client/requests/index.js"; +export * as facts from "./facts/index.js"; +export * from "./interactions/client/requests/index.js"; +export * as interactions from "./interactions/index.js"; +export * from "./interactions/types/index.js"; +export * as recordings from "./recordings/index.js"; +export * as stream from "./stream/index.js"; export * from "./templates/client/requests/index.js"; -export * from "./codes/client/requests/index.js"; -export * from "./auth/client/requests/index.js"; -export * from "./agents/client/requests/index.js"; +export * as templates from "./templates/index.js"; +export * as transcribe from "./transcribe/index.js"; +export * from "./transcripts/client/requests/index.js"; +export * as transcripts from "./transcripts/index.js"; diff --git a/src/api/resources/interactions/client/Client.ts b/src/api/resources/interactions/client/Client.ts index 8cb2d2d7..0ae59459 100644 --- a/src/api/resources/interactions/client/Client.ts +++ b/src/api/resources/interactions/client/Client.ts @@ -1,52 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; -import * as serializers from "../../../../serialization/index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as serializers from "../../../../serialization/index.js"; +import * as Corti from "../../../index.js"; -export declare namespace Interactions { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace InteractionsClient { + export type Options = BaseClientOptions; - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Interactions { - protected readonly _options: Interactions.Options; +export class InteractionsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Interactions.Options) { - this._options = _options; + constructor(options: InteractionsClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Lists all existing interactions. Results can be filtered by encounter status and patient identifier. * * @param {Corti.InteractionsListRequest} request - * @param {Interactions.RequestOptions} requestOptions - Request-specific configuration. + * @param {InteractionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.ForbiddenError} * @throws {@link Corti.GatewayTimeoutError} @@ -56,50 +36,52 @@ export class Interactions { */ public async list( request: Corti.InteractionsListRequest = {}, - requestOptions?: Interactions.RequestOptions, - ): Promise> { + requestOptions?: InteractionsClient.RequestOptions, + ): Promise> { const list = core.HttpResponsePromise.interceptFunction( async ( request: Corti.InteractionsListRequest, ): Promise> => { const { sort, direction, pageSize, index, encounterStatus, patient } = request; - const _queryParams: Record = {}; - if (sort !== undefined) { - _queryParams["sort"] = serializers.InteractionsListRequestSort.jsonOrThrow(sort, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }); - } - if (direction !== undefined) { - _queryParams["direction"] = serializers.CommonSortingDirectionEnum.jsonOrThrow(direction, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }); - } - if (pageSize !== undefined) { - _queryParams["pageSize"] = pageSize?.toString() ?? null; - } - if (index !== undefined) { - _queryParams["index"] = index?.toString() ?? null; - } - if (encounterStatus != null) { - if (Array.isArray(encounterStatus)) { - _queryParams["encounterStatus"] = encounterStatus.map((item) => - serializers.InteractionsEncounterStatusEnum.jsonOrThrow(item, { + const _queryParams: Record = { + sort: + sort != null + ? serializers.InteractionsListRequestSort.jsonOrThrow(sort, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }) + : undefined, + direction: + direction != null + ? serializers.CommonSortingDirectionEnum.jsonOrThrow(direction, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }) + : undefined, + pageSize, + index, + encounterStatus: Array.isArray(encounterStatus) + ? encounterStatus.map((item) => + serializers.InteractionsEncounterStatusEnum.jsonOrThrow(item, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + ) + : encounterStatus != null + ? serializers.InteractionsEncounterStatusEnum.jsonOrThrow(encounterStatus, { unrecognizedObjectKeys: "strip", omitUndefined: true, - }), - ); - } else { - _queryParams["encounterStatus"] = serializers.InteractionsEncounterStatusEnum.jsonOrThrow( - encounterStatus, - { unrecognizedObjectKeys: "strip", omitUndefined: true }, - ); - } - } - if (patient !== undefined) { - _queryParams["patient"] = patient; - } + }) + : undefined, + patient, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -107,19 +89,13 @@ export class Interactions { "interactions/", ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: - requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -165,26 +141,12 @@ export class Interactions { }); } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /interactions/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/interactions/"); }, ); let _offset = request?.index != null ? request?.index : 1; const dataWithRawResponse = await list(request).withRawResponse(); - return new core.Pageable({ + return new core.Page({ response: dataWithRawResponse.data, rawResponse: dataWithRawResponse.rawResponse, hasNextPage: (response) => (response?.interactions ?? []).length > 0, @@ -200,7 +162,7 @@ export class Interactions { * Creates a new interaction. * * @param {Corti.InteractionsCreateRequest} request - * @param {Interactions.RequestOptions} requestOptions - Request-specific configuration. + * @param {InteractionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.ForbiddenError} @@ -218,15 +180,22 @@ export class Interactions { */ public create( request: Corti.InteractionsCreateRequest, - requestOptions?: Interactions.RequestOptions, + requestOptions?: InteractionsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); } private async __create( request: Corti.InteractionsCreateRequest, - requestOptions?: Interactions.RequestOptions, + requestOptions?: InteractionsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -234,23 +203,19 @@ export class Interactions { "interactions/", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.InteractionsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -311,28 +276,14 @@ export class Interactions { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling POST /interactions/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/interactions/"); } /** * Retrieves a previously recorded interaction by its unique identifier (interaction ID). * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. - * @param {Interactions.RequestOptions} requestOptions - Request-specific configuration. + * @param {InteractionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.ForbiddenError} * @throws {@link Corti.GatewayTimeoutError} @@ -342,33 +293,36 @@ export class Interactions { */ public get( id: Corti.Uuid, - requestOptions?: Interactions.RequestOptions, + requestOptions?: InteractionsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions)); } private async __get( id: Corti.Uuid, - requestOptions?: Interactions.RequestOptions, + requestOptions?: InteractionsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -416,28 +370,14 @@ export class Interactions { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /interactions/{id}."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/interactions/{id}"); } /** * Deletes an existing interaction. * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. - * @param {Interactions.RequestOptions} requestOptions - Request-specific configuration. + * @param {InteractionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.ForbiddenError} * @throws {@link Corti.GatewayTimeoutError} @@ -445,32 +385,35 @@ export class Interactions { * @example * await client.interactions.delete("f47ac10b-58cc-4372-a567-0e02b2c3d479") */ - public delete(id: Corti.Uuid, requestOptions?: Interactions.RequestOptions): core.HttpResponsePromise { + public delete(id: Corti.Uuid, requestOptions?: InteractionsClient.RequestOptions): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions)); } private async __delete( id: Corti.Uuid, - requestOptions?: Interactions.RequestOptions, + requestOptions?: InteractionsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: undefined, rawResponse: _response.rawResponse }; @@ -509,21 +452,7 @@ export class Interactions { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling DELETE /interactions/{id}."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/interactions/{id}"); } /** @@ -531,7 +460,7 @@ export class Interactions { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.InteractionsUpdateRequest} request - * @param {Interactions.RequestOptions} requestOptions - Request-specific configuration. + * @param {InteractionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.ForbiddenError} * @throws {@link Corti.GatewayTimeoutError} @@ -542,7 +471,7 @@ export class Interactions { public update( id: Corti.Uuid, request: Corti.InteractionsUpdateRequest = {}, - requestOptions?: Interactions.RequestOptions, + requestOptions?: InteractionsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions)); } @@ -550,32 +479,35 @@ export class Interactions { private async __update( id: Corti.Uuid, request: Corti.InteractionsUpdateRequest = {}, - requestOptions?: Interactions.RequestOptions, + requestOptions?: InteractionsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}`, ), method: "PATCH", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.InteractionsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -623,29 +555,6 @@ export class Interactions { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling PATCH /interactions/{id}."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/interactions/{id}"); } } diff --git a/src/api/resources/interactions/client/index.ts b/src/api/resources/interactions/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/interactions/client/index.ts +++ b/src/api/resources/interactions/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/interactions/client/requests/InteractionsCreateRequest.ts b/src/api/resources/interactions/client/requests/InteractionsCreateRequest.ts index deea4b43..4840bd7f 100644 --- a/src/api/resources/interactions/client/requests/InteractionsCreateRequest.ts +++ b/src/api/resources/interactions/client/requests/InteractionsCreateRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example diff --git a/src/api/resources/interactions/client/requests/InteractionsListRequest.ts b/src/api/resources/interactions/client/requests/InteractionsListRequest.ts index c06164fc..d91d520e 100644 --- a/src/api/resources/interactions/client/requests/InteractionsListRequest.ts +++ b/src/api/resources/interactions/client/requests/InteractionsListRequest.ts @@ -1,36 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example * {} */ export interface InteractionsListRequest { - /** - * Field used to sort interactions. Default is createdAt. - */ - sort?: Corti.InteractionsListRequestSort | null; - /** - * Sorting order. Allowed values: [asc, desc]. Default is desc. - */ - direction?: Corti.CommonSortingDirectionEnum | null; - /** - * Number of interactions to return per page. Must be greater than 0. Default is 10. - */ - pageSize?: number | null; - /** - * Page number to retrieve. Starts at 1. For example, index=2 with pageSize=10 will return interactions 11–20. Must be greater than 0. Default is 1. - */ - index?: number | null; - /** - * The status of the encounter. To filter on multiple statuses, pass the same parameter again. - */ + /** Field used to sort interactions. Default is createdAt. */ + sort?: Corti.InteractionsListRequestSort; + /** Sorting order. Allowed values: [asc, desc]. Default is desc. */ + direction?: Corti.CommonSortingDirectionEnum; + /** Number of interactions to return per page. Must be greater than 0. Default is 10. */ + pageSize?: number; + /** Page number to retrieve. Starts at 1. For example, index=2 with pageSize=10 will return interactions 11–20. Must be greater than 0. Default is 1. */ + index?: number; + /** The status of the encounter. To filter on multiple statuses, pass the same parameter again. */ encounterStatus?: Corti.InteractionsEncounterStatusEnum | Corti.InteractionsEncounterStatusEnum[]; - /** - * A unique identifier for the patient. - */ - patient?: string | null; + /** A unique identifier for the patient. */ + patient?: string; } diff --git a/src/api/resources/interactions/client/requests/InteractionsUpdateRequest.ts b/src/api/resources/interactions/client/requests/InteractionsUpdateRequest.ts index cff15102..59433ec3 100644 --- a/src/api/resources/interactions/client/requests/InteractionsUpdateRequest.ts +++ b/src/api/resources/interactions/client/requests/InteractionsUpdateRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example diff --git a/src/api/resources/interactions/client/requests/index.ts b/src/api/resources/interactions/client/requests/index.ts index 1a6b0840..83043afc 100644 --- a/src/api/resources/interactions/client/requests/index.ts +++ b/src/api/resources/interactions/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type InteractionsListRequest } from "./InteractionsListRequest.js"; -export { type InteractionsCreateRequest } from "./InteractionsCreateRequest.js"; -export { type InteractionsUpdateRequest } from "./InteractionsUpdateRequest.js"; +export type { InteractionsCreateRequest } from "./InteractionsCreateRequest.js"; +export type { InteractionsListRequest } from "./InteractionsListRequest.js"; +export type { InteractionsUpdateRequest } from "./InteractionsUpdateRequest.js"; diff --git a/src/api/resources/interactions/exports.ts b/src/api/resources/interactions/exports.ts new file mode 100644 index 00000000..5938caa4 --- /dev/null +++ b/src/api/resources/interactions/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { InteractionsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/interactions/index.ts b/src/api/resources/interactions/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/interactions/index.ts +++ b/src/api/resources/interactions/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/interactions/types/InteractionsListRequestSort.ts b/src/api/resources/interactions/types/InteractionsListRequestSort.ts index 563c04f4..9a7f4db1 100644 --- a/src/api/resources/interactions/types/InteractionsListRequestSort.ts +++ b/src/api/resources/interactions/types/InteractionsListRequestSort.ts @@ -1,11 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Field used to sort interactions. Default is createdAt. - */ -export type InteractionsListRequestSort = "id" | "assignedUserId" | "patient" | "createdAt" | "endedAt" | "updatedAt"; +/** Field used to sort interactions. Default is createdAt. */ export const InteractionsListRequestSort = { Id: "id", AssignedUserId: "assignedUserId", @@ -14,3 +9,5 @@ export const InteractionsListRequestSort = { EndedAt: "endedAt", UpdatedAt: "updatedAt", } as const; +export type InteractionsListRequestSort = + (typeof InteractionsListRequestSort)[keyof typeof InteractionsListRequestSort]; diff --git a/src/api/resources/recordings/client/Client.ts b/src/api/resources/recordings/client/Client.ts index 72570e63..f7365c2e 100644 --- a/src/api/resources/recordings/client/Client.ts +++ b/src/api/resources/recordings/client/Client.ts @@ -1,52 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as serializers from "../../../../serialization/index.js"; +import * as core from "../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as serializers from "../../../../serialization/index.js"; +import * as Corti from "../../../index.js"; -export declare namespace Recordings { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace RecordingsClient { + export type Options = BaseClientOptions; - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Recordings { - protected readonly _options: Recordings.Options; +export class RecordingsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Recordings.Options) { - this._options = _options; + constructor(options: RecordingsClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Retrieve a list of recordings for a given interaction. * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. - * @param {Recordings.RequestOptions} requestOptions - Request-specific configuration. + * @param {RecordingsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.ForbiddenError} @@ -58,33 +38,36 @@ export class Recordings { */ public list( id: Corti.Uuid, - requestOptions?: Recordings.RequestOptions, + requestOptions?: RecordingsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__list(id, requestOptions)); } private async __list( id: Corti.Uuid, - requestOptions?: Recordings.RequestOptions, + requestOptions?: RecordingsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/recordings/`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/recordings/`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -145,21 +128,12 @@ export class Recordings { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /interactions/{id}/recordings/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/interactions/{id}/recordings/", + ); } /** @@ -167,7 +141,7 @@ export class Recordings { * * @param {core.file.Uploadable} uploadable * @param {Corti.Uuid} id - * @param {Recordings.RequestOptions} requestOptions - Request-specific configuration. + * @param {RecordingsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.ForbiddenError} @@ -177,7 +151,7 @@ export class Recordings { public upload( uploadable: core.file.Uploadable, id: Corti.Uuid, - requestOptions?: Recordings.RequestOptions, + requestOptions?: RecordingsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__upload(uploadable, id, requestOptions)); } @@ -185,32 +159,35 @@ export class Recordings { private async __upload( uploadable: core.file.Uploadable, id: Corti.Uuid, - requestOptions?: Recordings.RequestOptions, + requestOptions?: RecordingsClient.RequestOptions, ): Promise> { const _binaryUploadRequest = await core.file.toBinaryUploadRequest(uploadable); + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + _binaryUploadRequest.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/recordings/`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/recordings/`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - _binaryUploadRequest.headers, - requestOptions?.headers, - ), + headers: _headers, contentType: "application/octet-stream", + queryParameters: requestOptions?.queryParams, requestType: "bytes", duplex: "half", body: _binaryUploadRequest.body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -271,23 +248,12 @@ export class Recordings { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling POST /interactions/{id}/recordings/.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/interactions/{id}/recordings/", + ); } /** @@ -301,7 +267,7 @@ export class Recordings { public get( id: Corti.Uuid, recordingId: Corti.Uuid, - requestOptions?: Recordings.RequestOptions, + requestOptions?: RecordingsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__get(id, recordingId, requestOptions)); } @@ -309,27 +275,30 @@ export class Recordings { private async __get( id: Corti.Uuid, recordingId: Corti.Uuid, - requestOptions?: Recordings.RequestOptions, + requestOptions?: RecordingsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/recordings/${encodeURIComponent(serializers.Uuid.jsonOrThrow(recordingId, { omitUndefined: true }))}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/recordings/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(recordingId, { omitUndefined: true }))}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, + queryParameters: requestOptions?.queryParams, responseType: "binary-response", - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body, rawResponse: _response.rawResponse }; @@ -383,23 +352,12 @@ export class Recordings { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling GET /interactions/{id}/recordings/{recordingId}.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/interactions/{id}/recordings/{recordingId}", + ); } /** @@ -407,7 +365,7 @@ export class Recordings { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.Uuid} recordingId - The unique identifier of the recording. Must be a valid UUID. - * @param {Recordings.RequestOptions} requestOptions - Request-specific configuration. + * @param {RecordingsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.ForbiddenError} * @throws {@link Corti.NotFoundError} @@ -420,7 +378,7 @@ export class Recordings { public delete( id: Corti.Uuid, recordingId: Corti.Uuid, - requestOptions?: Recordings.RequestOptions, + requestOptions?: RecordingsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__delete(id, recordingId, requestOptions)); } @@ -428,26 +386,29 @@ export class Recordings { private async __delete( id: Corti.Uuid, recordingId: Corti.Uuid, - requestOptions?: Recordings.RequestOptions, + requestOptions?: RecordingsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/recordings/${encodeURIComponent(serializers.Uuid.jsonOrThrow(recordingId, { omitUndefined: true }))}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/recordings/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(recordingId, { omitUndefined: true }))}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: undefined, rawResponse: _response.rawResponse }; @@ -499,31 +460,11 @@ export class Recordings { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling DELETE /interactions/{id}/recordings/{recordingId}.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/interactions/{id}/recordings/{recordingId}", + ); } } diff --git a/src/api/resources/recordings/exports.ts b/src/api/resources/recordings/exports.ts new file mode 100644 index 00000000..20bc0f0c --- /dev/null +++ b/src/api/resources/recordings/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { RecordingsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/stream/client/Client.ts b/src/api/resources/stream/client/Client.ts index ab27d87b..97ff899c 100644 --- a/src/api/resources/stream/client/Client.ts +++ b/src/api/resources/stream/client/Client.ts @@ -1,27 +1,19 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptions, normalizeClientOptions } from "../../../../BaseClient.js"; import * as core from "../../../../core/index.js"; import { StreamSocket } from "./Socket.js"; -export declare namespace Stream { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace StreamClient { + export type Options = BaseClientOptions; export interface ConnectArgs { id: string; tenantName: string; token: string; + /** Additional query parameters to send with the websocket connect request. */ + queryParams?: Record; /** Arbitrary headers to send with the websocket connect request. */ headers?: Record; /** Enable debug mode on the websocket. Defaults to false. */ @@ -31,41 +23,31 @@ export declare namespace Stream { } } -export class Stream { - protected readonly _options: Stream.Options; +export class StreamClient { + protected readonly _options: NormalizedClientOptions; - constructor(_options: Stream.Options) { - this._options = _options; + constructor(options: StreamClient.Options) { + this._options = normalizeClientOptions(options); } - public async connect(args: Stream.ConnectArgs): Promise { - const { id, tenantName, token, headers, debug, reconnectAttempts } = args; - const _queryParams: Record = {}; - _queryParams["tenant-name"] = tenantName; - _queryParams["token"] = token; - let _headers: Record = { - ...headers, + public async connect(args: StreamClient.ConnectArgs): Promise { + const { id, tenantName, token, queryParams, headers, debug, reconnectAttempts } = args; + const _queryParams: Record = { + "tenant-name": tenantName, + token, }; + const _headers: Record = { ...headers }; const socket = new core.ReconnectingWebSocket({ url: core.url.join( - (await core.Supplier.get(this._options["baseUrl"])) ?? - (await core.Supplier.get(this._options["environment"])).wss, - `/interactions/${encodeURIComponent(id)}/streams`, + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).wss, + `/interactions/${core.url.encodePathParam(id)}/streams`, ), protocols: [], - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...queryParams }, headers: _headers, options: { debug: debug ?? false, maxRetries: reconnectAttempts ?? 30 }, }); return new StreamSocket({ socket }); } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; - } } diff --git a/src/api/resources/stream/client/Socket.ts b/src/api/resources/stream/client/Socket.ts index 312e73fd..cb2d5711 100644 --- a/src/api/resources/stream/client/Socket.ts +++ b/src/api/resources/stream/client/Socket.ts @@ -1,14 +1,12 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; -import { StreamConfigMessage } from "../../../../serialization/types/StreamConfigMessage.js"; -import { StreamFlushMessage } from "../../../../serialization/types/StreamFlushMessage.js"; -import { StreamEndMessage } from "../../../../serialization/types/StreamEndMessage.js"; import { fromJson } from "../../../../core/json.js"; import * as serializers from "../../../../serialization/index.js"; +import { StreamConfigMessage } from "../../../../serialization/types/StreamConfigMessage.js"; +import { StreamEndMessage } from "../../../../serialization/types/StreamEndMessage.js"; +import { StreamFlushMessage } from "../../../../serialization/types/StreamFlushMessage.js"; +import type * as Corti from "../../../index.js"; export declare namespace StreamSocket { export interface Args { @@ -84,7 +82,7 @@ export class StreamSocket { * }); * ``` */ - public on(event: T, callback: StreamSocket.EventHandlers[T]) { + public on(event: T, callback: StreamSocket.EventHandlers[T]): void { this.eventHandlers[event] = callback; } @@ -100,18 +98,9 @@ export class StreamSocket { this.socket.send(JSON.stringify(jsonPayload)); } - public sendAudio(message: string): void { + public sendAudio(message: ArrayBufferLike | Blob | ArrayBufferView): void { this.assertSocketIsOpen(); - const jsonPayload = core.serialization - .string() - .jsonOrThrow(message, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - omitUndefined: true, - }); - this.socket.send(JSON.stringify(jsonPayload)); + this.sendBinary(message); } public sendFlush(message: Corti.StreamFlushMessage): void { diff --git a/src/api/resources/stream/exports.ts b/src/api/resources/stream/exports.ts new file mode 100644 index 00000000..be24cd48 --- /dev/null +++ b/src/api/resources/stream/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { StreamClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/templates/client/Client.ts b/src/api/resources/templates/client/Client.ts index f3fbbfd8..3a109232 100644 --- a/src/api/resources/templates/client/Client.ts +++ b/src/api/resources/templates/client/Client.ts @@ -1,52 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as serializers from "../../../../serialization/index.js"; +import * as core from "../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as serializers from "../../../../serialization/index.js"; +import * as Corti from "../../../index.js"; -export declare namespace Templates { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace TemplatesClient { + export type Options = BaseClientOptions; - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Templates { - protected readonly _options: Templates.Options; +export class TemplatesClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Templates.Options) { - this._options = _options; + constructor(options: TemplatesClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Retrieves a list of template sections with optional filters for organization and language. * * @param {Corti.TemplatesSectionListRequest} request - * @param {Templates.RequestOptions} requestOptions - Request-specific configuration. + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.UnauthorizedError} * @throws {@link Corti.InternalServerError} @@ -56,33 +36,27 @@ export class Templates { */ public sectionList( request: Corti.TemplatesSectionListRequest = {}, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__sectionList(request, requestOptions)); } private async __sectionList( request: Corti.TemplatesSectionListRequest = {}, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): Promise> { const { org, lang } = request; - const _queryParams: Record = {}; - if (org != null) { - if (Array.isArray(org)) { - _queryParams["org"] = org.map((item) => item); - } else { - _queryParams["org"] = org; - } - } - - if (lang != null) { - if (Array.isArray(lang)) { - _queryParams["lang"] = lang.map((item) => item); - } else { - _queryParams["lang"] = lang; - } - } - + const _queryParams: Record = { + org, + lang, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -90,18 +64,13 @@ export class Templates { "templateSections/", ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -140,28 +109,14 @@ export class Templates { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /templateSections/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/templateSections/"); } /** * Retrieves a list of templates with optional filters for organization, language, and status. * * @param {Corti.TemplatesListRequest} request - * @param {Templates.RequestOptions} requestOptions - Request-specific configuration. + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.UnauthorizedError} * @throws {@link Corti.InternalServerError} @@ -171,41 +126,28 @@ export class Templates { */ public list( request: Corti.TemplatesListRequest = {}, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); } private async __list( request: Corti.TemplatesListRequest = {}, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): Promise> { const { org, lang, status } = request; - const _queryParams: Record = {}; - if (org != null) { - if (Array.isArray(org)) { - _queryParams["org"] = org.map((item) => item); - } else { - _queryParams["org"] = org; - } - } - - if (lang != null) { - if (Array.isArray(lang)) { - _queryParams["lang"] = lang.map((item) => item); - } else { - _queryParams["lang"] = lang; - } - } - - if (status != null) { - if (Array.isArray(status)) { - _queryParams["status"] = status.map((item) => item); - } else { - _queryParams["status"] = status; - } - } - + const _queryParams: Record = { + org, + lang, + status, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -213,18 +155,13 @@ export class Templates { "templates/", ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -263,28 +200,14 @@ export class Templates { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /templates/."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/templates/"); } /** * Retrieves template by key. * * @param {string} key - The key of the template - * @param {Templates.RequestOptions} requestOptions - Request-specific configuration. + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.UnauthorizedError} * @throws {@link Corti.InternalServerError} @@ -292,32 +215,38 @@ export class Templates { * @example * await client.templates.get("key") */ - public get(key: string, requestOptions?: Templates.RequestOptions): core.HttpResponsePromise { + public get( + key: string, + requestOptions?: TemplatesClient.RequestOptions, + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__get(key, requestOptions)); } private async __get( key: string, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `templates/${encodeURIComponent(key)}`, + `templates/${core.url.encodePathParam(key)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -356,29 +285,6 @@ export class Templates { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /templates/{key}."); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/templates/{key}"); } } diff --git a/src/api/resources/templates/client/index.ts b/src/api/resources/templates/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/templates/client/index.ts +++ b/src/api/resources/templates/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/templates/client/requests/TemplatesListRequest.ts b/src/api/resources/templates/client/requests/TemplatesListRequest.ts index f2b8d6d1..abc1c28c 100644 --- a/src/api/resources/templates/client/requests/TemplatesListRequest.ts +++ b/src/api/resources/templates/client/requests/TemplatesListRequest.ts @@ -1,22 +1,14 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface TemplatesListRequest { - /** - * Filter templates by organization. - */ + /** Filter templates by organization. */ org?: string | string[]; - /** - * Filter templates by language. - */ + /** Filter templates by language. */ lang?: string | string[]; - /** - * Filter templates by their status. - */ + /** Filter templates by their status. */ status?: string | string[]; } diff --git a/src/api/resources/templates/client/requests/TemplatesSectionListRequest.ts b/src/api/resources/templates/client/requests/TemplatesSectionListRequest.ts index 891a3c2b..d0768d63 100644 --- a/src/api/resources/templates/client/requests/TemplatesSectionListRequest.ts +++ b/src/api/resources/templates/client/requests/TemplatesSectionListRequest.ts @@ -1,18 +1,12 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface TemplatesSectionListRequest { - /** - * Filter template sections by organization. - */ + /** Filter template sections by organization. */ org?: string | string[]; - /** - * Filter template sections by language. - */ + /** Filter template sections by language. */ lang?: string | string[]; } diff --git a/src/api/resources/templates/client/requests/index.ts b/src/api/resources/templates/client/requests/index.ts index 9a86ad52..d2764071 100644 --- a/src/api/resources/templates/client/requests/index.ts +++ b/src/api/resources/templates/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type TemplatesSectionListRequest } from "./TemplatesSectionListRequest.js"; -export { type TemplatesListRequest } from "./TemplatesListRequest.js"; +export type { TemplatesListRequest } from "./TemplatesListRequest.js"; +export type { TemplatesSectionListRequest } from "./TemplatesSectionListRequest.js"; diff --git a/src/api/resources/templates/exports.ts b/src/api/resources/templates/exports.ts new file mode 100644 index 00000000..3d66c02d --- /dev/null +++ b/src/api/resources/templates/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TemplatesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/transcribe/client/Client.ts b/src/api/resources/transcribe/client/Client.ts index 52ef7f80..38f15974 100644 --- a/src/api/resources/transcribe/client/Client.ts +++ b/src/api/resources/transcribe/client/Client.ts @@ -1,26 +1,18 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptions, normalizeClientOptions } from "../../../../BaseClient.js"; import * as core from "../../../../core/index.js"; import { TranscribeSocket } from "./Socket.js"; -export declare namespace Transcribe { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace TranscribeClient { + export type Options = BaseClientOptions; export interface ConnectArgs { tenantName: string; token: string; + /** Additional query parameters to send with the websocket connect request. */ + queryParams?: Record; /** Arbitrary headers to send with the websocket connect request. */ headers?: Record; /** Enable debug mode on the websocket. Defaults to false. */ @@ -30,41 +22,31 @@ export declare namespace Transcribe { } } -export class Transcribe { - protected readonly _options: Transcribe.Options; +export class TranscribeClient { + protected readonly _options: NormalizedClientOptions; - constructor(_options: Transcribe.Options) { - this._options = _options; + constructor(options: TranscribeClient.Options) { + this._options = normalizeClientOptions(options); } - public async connect(args: Transcribe.ConnectArgs): Promise { - const { tenantName, token, headers, debug, reconnectAttempts } = args; - const _queryParams: Record = {}; - _queryParams["tenant-name"] = tenantName; - _queryParams["token"] = token; - let _headers: Record = { - ...headers, + public async connect(args: TranscribeClient.ConnectArgs): Promise { + const { tenantName, token, queryParams, headers, debug, reconnectAttempts } = args; + const _queryParams: Record = { + "tenant-name": tenantName, + token, }; + const _headers: Record = { ...headers }; const socket = new core.ReconnectingWebSocket({ url: core.url.join( - (await core.Supplier.get(this._options["baseUrl"])) ?? - (await core.Supplier.get(this._options["environment"])).wss, + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).wss, "/transcribe", ), protocols: [], - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...queryParams }, headers: _headers, options: { debug: debug ?? false, maxRetries: reconnectAttempts ?? 30 }, }); return new TranscribeSocket({ socket }); } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; - } } diff --git a/src/api/resources/transcribe/client/Socket.ts b/src/api/resources/transcribe/client/Socket.ts index d69b8184..ee1555f8 100644 --- a/src/api/resources/transcribe/client/Socket.ts +++ b/src/api/resources/transcribe/client/Socket.ts @@ -1,14 +1,12 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; -import { TranscribeConfigMessage } from "../../../../serialization/types/TranscribeConfigMessage.js"; -import { TranscribeFlushMessage } from "../../../../serialization/types/TranscribeFlushMessage.js"; -import { TranscribeEndMessage } from "../../../../serialization/types/TranscribeEndMessage.js"; import { fromJson } from "../../../../core/json.js"; import * as serializers from "../../../../serialization/index.js"; +import { TranscribeConfigMessage } from "../../../../serialization/types/TranscribeConfigMessage.js"; +import { TranscribeEndMessage } from "../../../../serialization/types/TranscribeEndMessage.js"; +import { TranscribeFlushMessage } from "../../../../serialization/types/TranscribeFlushMessage.js"; +import type * as Corti from "../../../index.js"; export declare namespace TranscribeSocket { export interface Args { @@ -84,7 +82,10 @@ export class TranscribeSocket { * }); * ``` */ - public on(event: T, callback: TranscribeSocket.EventHandlers[T]) { + public on( + event: T, + callback: TranscribeSocket.EventHandlers[T], + ): void { this.eventHandlers[event] = callback; } @@ -100,18 +101,9 @@ export class TranscribeSocket { this.socket.send(JSON.stringify(jsonPayload)); } - public sendAudio(message: string): void { + public sendAudio(message: ArrayBufferLike | Blob | ArrayBufferView): void { this.assertSocketIsOpen(); - const jsonPayload = core.serialization - .string() - .jsonOrThrow(message, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - omitUndefined: true, - }); - this.socket.send(JSON.stringify(jsonPayload)); + this.sendBinary(message); } public sendFlush(message: Corti.TranscribeFlushMessage): void { diff --git a/src/api/resources/transcribe/exports.ts b/src/api/resources/transcribe/exports.ts new file mode 100644 index 00000000..db22ba1b --- /dev/null +++ b/src/api/resources/transcribe/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TranscribeClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/transcripts/client/Client.ts b/src/api/resources/transcripts/client/Client.ts index 3ba8772c..8a1efa4f 100644 --- a/src/api/resources/transcripts/client/Client.ts +++ b/src/api/resources/transcripts/client/Client.ts @@ -1,45 +1,25 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Corti from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as serializers from "../../../../serialization/index.js"; +import * as core from "../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as serializers from "../../../../serialization/index.js"; +import * as Corti from "../../../index.js"; -export declare namespace Transcripts { - export interface Options { - environment: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace TranscriptsClient { + export type Options = BaseClientOptions; - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Transcripts { - protected readonly _options: Transcripts.Options; +export class TranscriptsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Transcripts.Options) { - this._options = _options; + constructor(options: TranscriptsClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -47,7 +27,7 @@ export class Transcripts { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.TranscriptsListRequest} request - * @param {Transcripts.RequestOptions} requestOptions - Request-specific configuration. + * @param {TranscriptsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -61,7 +41,7 @@ export class Transcripts { public list( id: Corti.Uuid, request: Corti.TranscriptsListRequest = {}, - requestOptions?: Transcripts.RequestOptions, + requestOptions?: TranscriptsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__list(id, request, requestOptions)); } @@ -69,33 +49,33 @@ export class Transcripts { private async __list( id: Corti.Uuid, request: Corti.TranscriptsListRequest = {}, - requestOptions?: Transcripts.RequestOptions, + requestOptions?: TranscriptsClient.RequestOptions, ): Promise> { const { full } = request; - const _queryParams: Record = {}; - if (full !== undefined) { - _queryParams["full"] = full?.toString() ?? null; - } - + const _queryParams: Record = { + full, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -158,23 +138,12 @@ export class Transcripts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling GET /interactions/{id}/transcripts/.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/interactions/{id}/transcripts/", + ); } /** @@ -182,7 +151,7 @@ export class Transcripts { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.TranscriptsCreateRequest} request - * @param {Transcripts.RequestOptions} requestOptions - Request-specific configuration. + * @param {TranscriptsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -199,7 +168,7 @@ export class Transcripts { public create( id: Corti.Uuid, request: Corti.TranscriptsCreateRequest, - requestOptions?: Transcripts.RequestOptions, + requestOptions?: TranscriptsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(id, request, requestOptions)); } @@ -207,32 +176,35 @@ export class Transcripts { private async __create( id: Corti.Uuid, request: Corti.TranscriptsCreateRequest, - requestOptions?: Transcripts.RequestOptions, + requestOptions?: TranscriptsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: serializers.TranscriptsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -295,23 +267,12 @@ export class Transcripts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling POST /interactions/{id}/transcripts/.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/interactions/{id}/transcripts/", + ); } /** @@ -319,7 +280,7 @@ export class Transcripts { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.Uuid} transcriptId - The unique identifier of the transcript. Must be a valid UUID. - * @param {Transcripts.RequestOptions} requestOptions - Request-specific configuration. + * @param {TranscriptsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -333,7 +294,7 @@ export class Transcripts { public get( id: Corti.Uuid, transcriptId: Corti.Uuid, - requestOptions?: Transcripts.RequestOptions, + requestOptions?: TranscriptsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__get(id, transcriptId, requestOptions)); } @@ -341,26 +302,29 @@ export class Transcripts { private async __get( id: Corti.Uuid, transcriptId: Corti.Uuid, - requestOptions?: Transcripts.RequestOptions, + requestOptions?: TranscriptsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/${encodeURIComponent(serializers.Uuid.jsonOrThrow(transcriptId, { omitUndefined: true }))}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(transcriptId, { omitUndefined: true }))}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -423,23 +387,12 @@ export class Transcripts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling GET /interactions/{id}/transcripts/{transcriptId}.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/interactions/{id}/transcripts/{transcriptId}", + ); } /** @@ -447,7 +400,7 @@ export class Transcripts { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.Uuid} transcriptId - The unique identifier of the transcript. Must be a valid UUID. - * @param {Transcripts.RequestOptions} requestOptions - Request-specific configuration. + * @param {TranscriptsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.BadRequestError} * @throws {@link Corti.UnauthorizedError} @@ -461,7 +414,7 @@ export class Transcripts { public delete( id: Corti.Uuid, transcriptId: Corti.Uuid, - requestOptions?: Transcripts.RequestOptions, + requestOptions?: TranscriptsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__delete(id, transcriptId, requestOptions)); } @@ -469,26 +422,29 @@ export class Transcripts { private async __delete( id: Corti.Uuid, transcriptId: Corti.Uuid, - requestOptions?: Transcripts.RequestOptions, + requestOptions?: TranscriptsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/${encodeURIComponent(serializers.Uuid.jsonOrThrow(transcriptId, { omitUndefined: true }))}`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(transcriptId, { omitUndefined: true }))}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: undefined, rawResponse: _response.rawResponse }; @@ -542,23 +498,12 @@ export class Transcripts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling DELETE /interactions/{id}/transcripts/{transcriptId}.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/interactions/{id}/transcripts/{transcriptId}", + ); } /** @@ -566,7 +511,7 @@ export class Transcripts { * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.Uuid} transcriptId - The unique identifier of the transcript. Must be a valid UUID. - * @param {Transcripts.RequestOptions} requestOptions - Request-specific configuration. + * @param {TranscriptsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.NotFoundError} * @@ -576,7 +521,7 @@ export class Transcripts { public getStatus( id: Corti.Uuid, transcriptId: Corti.Uuid, - requestOptions?: Transcripts.RequestOptions, + requestOptions?: TranscriptsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getStatus(id, transcriptId, requestOptions)); } @@ -584,26 +529,29 @@ export class Transcripts { private async __getStatus( id: Corti.Uuid, transcriptId: Corti.Uuid, - requestOptions?: Transcripts.RequestOptions, + requestOptions?: TranscriptsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)).base, - `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/${encodeURIComponent(serializers.Uuid.jsonOrThrow(transcriptId, { omitUndefined: true }))}/status`, + `interactions/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/${core.url.encodePathParam(serializers.Uuid.jsonOrThrow(transcriptId, { omitUndefined: true }))}/status`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - Authorization: await this._getAuthorizationHeader(), - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -631,31 +579,11 @@ export class Transcripts { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling GET /interactions/{id}/transcripts/{transcriptId}/status.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getAuthorizationHeader(): Promise { - const bearer = await core.Supplier.get(this._options.token); - if (bearer != null) { - return `Bearer ${bearer}`; - } - - return undefined; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/interactions/{id}/transcripts/{transcriptId}/status", + ); } } diff --git a/src/api/resources/transcripts/client/index.ts b/src/api/resources/transcripts/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/transcripts/client/index.ts +++ b/src/api/resources/transcripts/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/transcripts/client/requests/TranscriptsCreateRequest.ts b/src/api/resources/transcripts/client/requests/TranscriptsCreateRequest.ts index c6eb58b9..bedda24e 100644 --- a/src/api/resources/transcripts/client/requests/TranscriptsCreateRequest.ts +++ b/src/api/resources/transcripts/client/requests/TranscriptsCreateRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../../../../index.js"; +import type * as Corti from "../../../../index.js"; /** * @example diff --git a/src/api/resources/transcripts/client/requests/TranscriptsListRequest.ts b/src/api/resources/transcripts/client/requests/TranscriptsListRequest.ts index 318c748e..30294927 100644 --- a/src/api/resources/transcripts/client/requests/TranscriptsListRequest.ts +++ b/src/api/resources/transcripts/client/requests/TranscriptsListRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface TranscriptsListRequest { - /** - * Display full transcripts in listing - */ - full?: boolean | null; + /** Display full transcripts in listing */ + full?: boolean; } diff --git a/src/api/resources/transcripts/client/requests/index.ts b/src/api/resources/transcripts/client/requests/index.ts index 4895649b..f3082818 100644 --- a/src/api/resources/transcripts/client/requests/index.ts +++ b/src/api/resources/transcripts/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type TranscriptsListRequest } from "./TranscriptsListRequest.js"; -export { type TranscriptsCreateRequest } from "./TranscriptsCreateRequest.js"; +export type { TranscriptsCreateRequest } from "./TranscriptsCreateRequest.js"; +export type { TranscriptsListRequest } from "./TranscriptsListRequest.js"; diff --git a/src/api/resources/transcripts/exports.ts b/src/api/resources/transcripts/exports.ts new file mode 100644 index 00000000..37c90609 --- /dev/null +++ b/src/api/resources/transcripts/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TranscriptsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/types/AgentsAgent.ts b/src/api/types/AgentsAgent.ts index 94b4532b..3de35752 100644 --- a/src/api/types/AgentsAgent.ts +++ b/src/api/types/AgentsAgent.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsAgent { /** The unique identifier of the agent. */ diff --git a/src/api/types/AgentsAgentCapabilities.ts b/src/api/types/AgentsAgentCapabilities.ts index b3adb3a4..1421c537 100644 --- a/src/api/types/AgentsAgentCapabilities.ts +++ b/src/api/types/AgentsAgentCapabilities.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsAgentCapabilities { /** Indicates whether the agent supports streaming responses. */ diff --git a/src/api/types/AgentsAgentCard.ts b/src/api/types/AgentsAgentCard.ts index 98957701..1ab605f7 100644 --- a/src/api/types/AgentsAgentCard.ts +++ b/src/api/types/AgentsAgentCard.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsAgentCard { /** The version of the A2A protocol this agents supports. */ diff --git a/src/api/types/AgentsAgentCardSignature.ts b/src/api/types/AgentsAgentCardSignature.ts index 22d1f282..d80738a0 100644 --- a/src/api/types/AgentsAgentCardSignature.ts +++ b/src/api/types/AgentsAgentCardSignature.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface AgentsAgentCardSignature { /** The protected header of the JWS, base64url-encoded. */ diff --git a/src/api/types/AgentsAgentExpertsItem.ts b/src/api/types/AgentsAgentExpertsItem.ts index 7a219b8c..f8a9a698 100644 --- a/src/api/types/AgentsAgentExpertsItem.ts +++ b/src/api/types/AgentsAgentExpertsItem.ts @@ -1,7 +1,5 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export type AgentsAgentExpertsItem = Corti.AgentsExpert | Corti.AgentsExpertReference; diff --git a/src/api/types/AgentsAgentExtension.ts b/src/api/types/AgentsAgentExtension.ts index fe7c384c..05d29ff3 100644 --- a/src/api/types/AgentsAgentExtension.ts +++ b/src/api/types/AgentsAgentExtension.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface AgentsAgentExtension { /** The URI that identifies the extension. */ diff --git a/src/api/types/AgentsAgentInterface.ts b/src/api/types/AgentsAgentInterface.ts index 52e32b3c..0dcf9151 100644 --- a/src/api/types/AgentsAgentInterface.ts +++ b/src/api/types/AgentsAgentInterface.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface AgentsAgentInterface { /** The URL where the agent can be reached using the specified protocol. */ diff --git a/src/api/types/AgentsAgentProvider.ts b/src/api/types/AgentsAgentProvider.ts index 66f4d6af..2359af07 100644 --- a/src/api/types/AgentsAgentProvider.ts +++ b/src/api/types/AgentsAgentProvider.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface AgentsAgentProvider { /** The name of the organization providing the agent. */ diff --git a/src/api/types/AgentsAgentReference.ts b/src/api/types/AgentsAgentReference.ts index c5dd3c0c..d00c8c29 100644 --- a/src/api/types/AgentsAgentReference.ts +++ b/src/api/types/AgentsAgentReference.ts @@ -1,12 +1,12 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; /** * A reference to an agent, either id or name must be provided. If both are passed, the id will be used. */ export interface AgentsAgentReference { - type: "reference"; + type: Corti.AgentsAgentReferenceType; /** The unique identifier of the agent. */ id?: string; /** The name of the agent. */ diff --git a/src/api/types/AgentsAgentReferenceType.ts b/src/api/types/AgentsAgentReferenceType.ts new file mode 100644 index 00000000..0f7dc386 --- /dev/null +++ b/src/api/types/AgentsAgentReferenceType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const AgentsAgentReferenceType = { + Reference: "reference", +} as const; +export type AgentsAgentReferenceType = (typeof AgentsAgentReferenceType)[keyof typeof AgentsAgentReferenceType]; diff --git a/src/api/types/AgentsAgentResponse.ts b/src/api/types/AgentsAgentResponse.ts index 20bca0ed..6cdfbabc 100644 --- a/src/api/types/AgentsAgentResponse.ts +++ b/src/api/types/AgentsAgentResponse.ts @@ -1,7 +1,5 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export type AgentsAgentResponse = Corti.AgentsAgent | Corti.AgentsAgentReference; diff --git a/src/api/types/AgentsAgentSkill.ts b/src/api/types/AgentsAgentSkill.ts index f4a2fb09..f7cc0579 100644 --- a/src/api/types/AgentsAgentSkill.ts +++ b/src/api/types/AgentsAgentSkill.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsAgentSkill { /** Unique identifier for the skill. */ diff --git a/src/api/types/AgentsArtifact.ts b/src/api/types/AgentsArtifact.ts index a901127f..f04e2c8f 100644 --- a/src/api/types/AgentsArtifact.ts +++ b/src/api/types/AgentsArtifact.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsArtifact { /** Unique identifier for the artifact. */ diff --git a/src/api/types/AgentsContext.ts b/src/api/types/AgentsContext.ts index 6080e2a7..f3daeff2 100644 --- a/src/api/types/AgentsContext.ts +++ b/src/api/types/AgentsContext.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsContext { /** The context ID. */ diff --git a/src/api/types/AgentsContextItemsItem.ts b/src/api/types/AgentsContextItemsItem.ts index 6252d781..2a2affbe 100644 --- a/src/api/types/AgentsContextItemsItem.ts +++ b/src/api/types/AgentsContextItemsItem.ts @@ -1,7 +1,5 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export type AgentsContextItemsItem = Corti.AgentsTask | Corti.AgentsMessage; diff --git a/src/api/types/AgentsCreateExpert.ts b/src/api/types/AgentsCreateExpert.ts index 329899de..0ee8760a 100644 --- a/src/api/types/AgentsCreateExpert.ts +++ b/src/api/types/AgentsCreateExpert.ts @@ -1,11 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsCreateExpert { - type: "new"; + type: Corti.AgentsCreateExpertType; /** The name of the expert. Must be unique. */ name: string; /** A brief description of the expert's capabilities. */ diff --git a/src/api/types/AgentsCreateExpertReference.ts b/src/api/types/AgentsCreateExpertReference.ts index 8501545d..733a6184 100644 --- a/src/api/types/AgentsCreateExpertReference.ts +++ b/src/api/types/AgentsCreateExpertReference.ts @@ -1,12 +1,12 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; /** * A reference to a registry expert when creating an agent, either id or name must be provided. If both are passed, the id will be used. */ export interface AgentsCreateExpertReference { - type: "reference"; + type: Corti.AgentsCreateExpertReferenceType; /** The unique identifier of the expert. */ id?: string; /** The name of the expert. */ diff --git a/src/api/types/AgentsCreateExpertReferenceType.ts b/src/api/types/AgentsCreateExpertReferenceType.ts new file mode 100644 index 00000000..5b760a87 --- /dev/null +++ b/src/api/types/AgentsCreateExpertReferenceType.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export const AgentsCreateExpertReferenceType = { + Reference: "reference", +} as const; +export type AgentsCreateExpertReferenceType = + (typeof AgentsCreateExpertReferenceType)[keyof typeof AgentsCreateExpertReferenceType]; diff --git a/src/api/types/AgentsCreateExpertType.ts b/src/api/types/AgentsCreateExpertType.ts new file mode 100644 index 00000000..0e984eb3 --- /dev/null +++ b/src/api/types/AgentsCreateExpertType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const AgentsCreateExpertType = { + New: "new", +} as const; +export type AgentsCreateExpertType = (typeof AgentsCreateExpertType)[keyof typeof AgentsCreateExpertType]; diff --git a/src/api/types/AgentsCreateMcpServer.ts b/src/api/types/AgentsCreateMcpServer.ts index ccd17b1f..1ec5d267 100644 --- a/src/api/types/AgentsCreateMcpServer.ts +++ b/src/api/types/AgentsCreateMcpServer.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsCreateMcpServer { /** Name of the MCP server. */ diff --git a/src/api/types/AgentsCreateMcpServerAuthorizationType.ts b/src/api/types/AgentsCreateMcpServerAuthorizationType.ts index 10ca9a7b..ca4518e9 100644 --- a/src/api/types/AgentsCreateMcpServerAuthorizationType.ts +++ b/src/api/types/AgentsCreateMcpServerAuthorizationType.ts @@ -1,14 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Type of authorization used by the MCP server. - */ -export type AgentsCreateMcpServerAuthorizationType = "none" | "bearer" | "inherit" | "oauth2.0"; +/** Type of authorization used by the MCP server. */ export const AgentsCreateMcpServerAuthorizationType = { None: "none", Bearer: "bearer", Inherit: "inherit", Oauth20: "oauth2.0", } as const; +export type AgentsCreateMcpServerAuthorizationType = + (typeof AgentsCreateMcpServerAuthorizationType)[keyof typeof AgentsCreateMcpServerAuthorizationType]; diff --git a/src/api/types/AgentsCreateMcpServerTransportType.ts b/src/api/types/AgentsCreateMcpServerTransportType.ts index 3ad5e658..37aef0b9 100644 --- a/src/api/types/AgentsCreateMcpServerTransportType.ts +++ b/src/api/types/AgentsCreateMcpServerTransportType.ts @@ -1,13 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Type of transport used by the MCP server. - */ -export type AgentsCreateMcpServerTransportType = "stdio" | "streamable_http" | "sse"; +/** Type of transport used by the MCP server. */ export const AgentsCreateMcpServerTransportType = { Stdio: "stdio", StreamableHttp: "streamable_http", Sse: "sse", } as const; +export type AgentsCreateMcpServerTransportType = + (typeof AgentsCreateMcpServerTransportType)[keyof typeof AgentsCreateMcpServerTransportType]; diff --git a/src/api/types/AgentsDataPart.ts b/src/api/types/AgentsDataPart.ts index b7b47bcf..1223b959 100644 --- a/src/api/types/AgentsDataPart.ts +++ b/src/api/types/AgentsDataPart.ts @@ -1,10 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface AgentsDataPart { /** The kind of the part, always "data". */ - kind: "data"; + kind: Corti.AgentsDataPartKind; /** JSON data payload. */ data: Record; /** Additional metadata for the data part. */ diff --git a/src/api/types/AgentsDataPartKind.ts b/src/api/types/AgentsDataPartKind.ts new file mode 100644 index 00000000..7713b079 --- /dev/null +++ b/src/api/types/AgentsDataPartKind.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The kind of the part, always "data". */ +export const AgentsDataPartKind = { + Data: "data", +} as const; +export type AgentsDataPartKind = (typeof AgentsDataPartKind)[keyof typeof AgentsDataPartKind]; diff --git a/src/api/types/AgentsExpert.ts b/src/api/types/AgentsExpert.ts index 81c05f83..7117e0c9 100644 --- a/src/api/types/AgentsExpert.ts +++ b/src/api/types/AgentsExpert.ts @@ -1,11 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsExpert { - type: "expert"; + type: Corti.AgentsExpertType; /** The unique identifier of the expert. */ id: string; /** The name of the expert. Must be unique. */ diff --git a/src/api/types/AgentsExpertReference.ts b/src/api/types/AgentsExpertReference.ts index 42ea2eb9..c5d5dd72 100644 --- a/src/api/types/AgentsExpertReference.ts +++ b/src/api/types/AgentsExpertReference.ts @@ -1,12 +1,12 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; /** * A reference to an expert returned by the API. The expert's id and name are always provided. systemPrompt is included only when a registry expert was created with a custom system prompt. */ export interface AgentsExpertReference { - type: "reference"; + type: Corti.AgentsExpertReferenceType; /** The unique identifier of the expert. */ id: string; /** The name of the expert. */ diff --git a/src/api/types/AgentsExpertReferenceType.ts b/src/api/types/AgentsExpertReferenceType.ts new file mode 100644 index 00000000..f9677db7 --- /dev/null +++ b/src/api/types/AgentsExpertReferenceType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const AgentsExpertReferenceType = { + Reference: "reference", +} as const; +export type AgentsExpertReferenceType = (typeof AgentsExpertReferenceType)[keyof typeof AgentsExpertReferenceType]; diff --git a/src/api/types/AgentsExpertType.ts b/src/api/types/AgentsExpertType.ts new file mode 100644 index 00000000..cef31a43 --- /dev/null +++ b/src/api/types/AgentsExpertType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const AgentsExpertType = { + Expert: "expert", +} as const; +export type AgentsExpertType = (typeof AgentsExpertType)[keyof typeof AgentsExpertType]; diff --git a/src/api/types/AgentsFilePart.ts b/src/api/types/AgentsFilePart.ts index c8930175..64794dfc 100644 --- a/src/api/types/AgentsFilePart.ts +++ b/src/api/types/AgentsFilePart.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsFilePart { /** The kind of the part, always "file". */ - kind: "file"; + kind: Corti.AgentsFilePartKind; file?: Corti.AgentsFilePartFile; /** Additional metadata for the file part. */ metadata?: Record; diff --git a/src/api/types/AgentsFilePartFile.ts b/src/api/types/AgentsFilePartFile.ts index 184bdb5b..8ab63935 100644 --- a/src/api/types/AgentsFilePartFile.ts +++ b/src/api/types/AgentsFilePartFile.ts @@ -1,7 +1,5 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export type AgentsFilePartFile = Corti.AgentsFileWithUri | Corti.AgentsFileWithBytes; diff --git a/src/api/types/AgentsFilePartKind.ts b/src/api/types/AgentsFilePartKind.ts new file mode 100644 index 00000000..0bb2ac0e --- /dev/null +++ b/src/api/types/AgentsFilePartKind.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The kind of the part, always "file". */ +export const AgentsFilePartKind = { + File: "file", +} as const; +export type AgentsFilePartKind = (typeof AgentsFilePartKind)[keyof typeof AgentsFilePartKind]; diff --git a/src/api/types/AgentsFileWithBytes.ts b/src/api/types/AgentsFileWithBytes.ts index 5c69dfae..b58af3f6 100644 --- a/src/api/types/AgentsFileWithBytes.ts +++ b/src/api/types/AgentsFileWithBytes.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface AgentsFileWithBytes { /** The byte content of the file. */ diff --git a/src/api/types/AgentsFileWithUri.ts b/src/api/types/AgentsFileWithUri.ts index f1ff4bed..9919157a 100644 --- a/src/api/types/AgentsFileWithUri.ts +++ b/src/api/types/AgentsFileWithUri.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface AgentsFileWithUri { /** The URI of the file. */ diff --git a/src/api/types/AgentsMcpServer.ts b/src/api/types/AgentsMcpServer.ts index a0c5f7b4..57fabed5 100644 --- a/src/api/types/AgentsMcpServer.ts +++ b/src/api/types/AgentsMcpServer.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsMcpServer { /** Unique identifier for the MCP server. */ diff --git a/src/api/types/AgentsMcpServerAuthorizationType.ts b/src/api/types/AgentsMcpServerAuthorizationType.ts index 46157090..36d6daef 100644 --- a/src/api/types/AgentsMcpServerAuthorizationType.ts +++ b/src/api/types/AgentsMcpServerAuthorizationType.ts @@ -1,14 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Type of authorization used by the MCP server. - */ -export type AgentsMcpServerAuthorizationType = "none" | "bearer" | "inherit" | "oauth2.0"; +/** Type of authorization used by the MCP server. */ export const AgentsMcpServerAuthorizationType = { None: "none", Bearer: "bearer", Inherit: "inherit", Oauth20: "oauth2.0", } as const; +export type AgentsMcpServerAuthorizationType = + (typeof AgentsMcpServerAuthorizationType)[keyof typeof AgentsMcpServerAuthorizationType]; diff --git a/src/api/types/AgentsMcpServerTransportType.ts b/src/api/types/AgentsMcpServerTransportType.ts index 10c1f4e4..198e8c44 100644 --- a/src/api/types/AgentsMcpServerTransportType.ts +++ b/src/api/types/AgentsMcpServerTransportType.ts @@ -1,12 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Type of transport used by the MCP server. - */ -export type AgentsMcpServerTransportType = "stdio" | "streamable_http"; +/** Type of transport used by the MCP server. */ export const AgentsMcpServerTransportType = { Stdio: "stdio", StreamableHttp: "streamable_http", } as const; +export type AgentsMcpServerTransportType = + (typeof AgentsMcpServerTransportType)[keyof typeof AgentsMcpServerTransportType]; diff --git a/src/api/types/AgentsMessage.ts b/src/api/types/AgentsMessage.ts index 35e3f514..08b1d045 100644 --- a/src/api/types/AgentsMessage.ts +++ b/src/api/types/AgentsMessage.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsMessage { /** The role of the message sender. */ @@ -22,5 +20,5 @@ export interface AgentsMessage { /** Identifier for the context (thread) in which the message is sent. */ contextId?: string; /** The kind of the object, always "message". */ - kind: "message"; + kind: Corti.AgentsMessageKind; } diff --git a/src/api/types/AgentsMessageKind.ts b/src/api/types/AgentsMessageKind.ts new file mode 100644 index 00000000..33024a17 --- /dev/null +++ b/src/api/types/AgentsMessageKind.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The kind of the object, always "message". */ +export const AgentsMessageKind = { + Message: "message", +} as const; +export type AgentsMessageKind = (typeof AgentsMessageKind)[keyof typeof AgentsMessageKind]; diff --git a/src/api/types/AgentsMessageRole.ts b/src/api/types/AgentsMessageRole.ts index c3e12702..c2e2164f 100644 --- a/src/api/types/AgentsMessageRole.ts +++ b/src/api/types/AgentsMessageRole.ts @@ -1,12 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * The role of the message sender. - */ -export type AgentsMessageRole = "user" | "agent"; +/** The role of the message sender. */ export const AgentsMessageRole = { User: "user", Agent: "agent", } as const; +export type AgentsMessageRole = (typeof AgentsMessageRole)[keyof typeof AgentsMessageRole]; diff --git a/src/api/types/AgentsMessageSendConfiguration.ts b/src/api/types/AgentsMessageSendConfiguration.ts index 6b007844..f85cc4fd 100644 --- a/src/api/types/AgentsMessageSendConfiguration.ts +++ b/src/api/types/AgentsMessageSendConfiguration.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsMessageSendConfiguration { /** A list of output MIME types the client is prepared to accept in the response. */ diff --git a/src/api/types/AgentsPart.ts b/src/api/types/AgentsPart.ts index c3a6f69b..dbde9135 100644 --- a/src/api/types/AgentsPart.ts +++ b/src/api/types/AgentsPart.ts @@ -1,7 +1,5 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export type AgentsPart = Corti.AgentsTextPart | Corti.AgentsFilePart | Corti.AgentsDataPart; diff --git a/src/api/types/AgentsPushNotificationAuthenticationInfo.ts b/src/api/types/AgentsPushNotificationAuthenticationInfo.ts index 44d4f945..5769026a 100644 --- a/src/api/types/AgentsPushNotificationAuthenticationInfo.ts +++ b/src/api/types/AgentsPushNotificationAuthenticationInfo.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface AgentsPushNotificationAuthenticationInfo { /** A list of supported authentication schemes (e.g. 'Basic', 'Bearer'). */ diff --git a/src/api/types/AgentsPushNotificationConfig.ts b/src/api/types/AgentsPushNotificationConfig.ts index 40574731..9c5f9cc4 100644 --- a/src/api/types/AgentsPushNotificationConfig.ts +++ b/src/api/types/AgentsPushNotificationConfig.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsPushNotificationConfig { /** Unique identifier for the push notification configuration. */ diff --git a/src/api/types/AgentsRegistryExpert.ts b/src/api/types/AgentsRegistryExpert.ts index dac8ca31..5486ddc1 100644 --- a/src/api/types/AgentsRegistryExpert.ts +++ b/src/api/types/AgentsRegistryExpert.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsRegistryExpert { /** The name of the expert. */ diff --git a/src/api/types/AgentsRegistryExpertsResponse.ts b/src/api/types/AgentsRegistryExpertsResponse.ts index 6c1cd705..f923bb1d 100644 --- a/src/api/types/AgentsRegistryExpertsResponse.ts +++ b/src/api/types/AgentsRegistryExpertsResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsRegistryExpertsResponse { /** A list of all available experts in the experts registry. */ diff --git a/src/api/types/AgentsRegistryMcpServer.ts b/src/api/types/AgentsRegistryMcpServer.ts index 3166cfae..0236f42b 100644 --- a/src/api/types/AgentsRegistryMcpServer.ts +++ b/src/api/types/AgentsRegistryMcpServer.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsRegistryMcpServer { /** Name of the MCP server. */ diff --git a/src/api/types/AgentsRegistryMcpServerAuthorizationType.ts b/src/api/types/AgentsRegistryMcpServerAuthorizationType.ts index 0344e7a8..e2764042 100644 --- a/src/api/types/AgentsRegistryMcpServerAuthorizationType.ts +++ b/src/api/types/AgentsRegistryMcpServerAuthorizationType.ts @@ -1,14 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Type of authorization used by the MCP server. - */ -export type AgentsRegistryMcpServerAuthorizationType = "none" | "bearer" | "inherit" | "oauth2.0"; +/** Type of authorization used by the MCP server. */ export const AgentsRegistryMcpServerAuthorizationType = { None: "none", Bearer: "bearer", Inherit: "inherit", Oauth20: "oauth2.0", } as const; +export type AgentsRegistryMcpServerAuthorizationType = + (typeof AgentsRegistryMcpServerAuthorizationType)[keyof typeof AgentsRegistryMcpServerAuthorizationType]; diff --git a/src/api/types/AgentsTask.ts b/src/api/types/AgentsTask.ts index 2510a1b6..2bd6389f 100644 --- a/src/api/types/AgentsTask.ts +++ b/src/api/types/AgentsTask.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsTask { /** Unique identifier for the task. */ @@ -17,5 +15,5 @@ export interface AgentsTask { /** Additional metadata for the task. */ metadata?: Record; /** The kind of the object, always "task". */ - kind: "task"; + kind: Corti.AgentsTaskKind; } diff --git a/src/api/types/AgentsTaskKind.ts b/src/api/types/AgentsTaskKind.ts new file mode 100644 index 00000000..51fc3dda --- /dev/null +++ b/src/api/types/AgentsTaskKind.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The kind of the object, always "task". */ +export const AgentsTaskKind = { + Task: "task", +} as const; +export type AgentsTaskKind = (typeof AgentsTaskKind)[keyof typeof AgentsTaskKind]; diff --git a/src/api/types/AgentsTaskStatus.ts b/src/api/types/AgentsTaskStatus.ts index df5ea44c..c9f055ed 100644 --- a/src/api/types/AgentsTaskStatus.ts +++ b/src/api/types/AgentsTaskStatus.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface AgentsTaskStatus { /** The current state of the task. */ diff --git a/src/api/types/AgentsTaskStatusState.ts b/src/api/types/AgentsTaskStatusState.ts index d6098a16..7e186848 100644 --- a/src/api/types/AgentsTaskStatusState.ts +++ b/src/api/types/AgentsTaskStatusState.ts @@ -1,20 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * The current state of the task. - */ -export type AgentsTaskStatusState = - | "submitted" - | "working" - | "input-required" - | "completed" - | "canceled" - | "failed" - | "rejected" - | "auth-required" - | "unknown"; +/** The current state of the task. */ export const AgentsTaskStatusState = { Submitted: "submitted", Working: "working", @@ -26,3 +12,4 @@ export const AgentsTaskStatusState = { AuthRequired: "auth-required", Unknown: "unknown", } as const; +export type AgentsTaskStatusState = (typeof AgentsTaskStatusState)[keyof typeof AgentsTaskStatusState]; diff --git a/src/api/types/AgentsTextPart.ts b/src/api/types/AgentsTextPart.ts index 6a4bcab9..b0fda0cf 100644 --- a/src/api/types/AgentsTextPart.ts +++ b/src/api/types/AgentsTextPart.ts @@ -1,10 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface AgentsTextPart { /** The kind of the part, always "text". */ - kind: "text"; + kind: Corti.AgentsTextPartKind; /** The text content of the part. */ text: string; /** Additional metadata for the text part. */ diff --git a/src/api/types/AgentsTextPartKind.ts b/src/api/types/AgentsTextPartKind.ts new file mode 100644 index 00000000..3366f180 --- /dev/null +++ b/src/api/types/AgentsTextPartKind.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The kind of the part, always "text". */ +export const AgentsTextPartKind = { + Text: "text", +} as const; +export type AgentsTextPartKind = (typeof AgentsTextPartKind)[keyof typeof AgentsTextPartKind]; diff --git a/src/api/types/CodesGeneralReadResponse.ts b/src/api/types/CodesGeneralReadResponse.ts index e4234348..ecf9381d 100644 --- a/src/api/types/CodesGeneralReadResponse.ts +++ b/src/api/types/CodesGeneralReadResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; /** * Predicted or candidate code record. diff --git a/src/api/types/CodesGeneralReadResponseEvidencesItem.ts b/src/api/types/CodesGeneralReadResponseEvidencesItem.ts index 5d4b0707..44b0034a 100644 --- a/src/api/types/CodesGeneralReadResponseEvidencesItem.ts +++ b/src/api/types/CodesGeneralReadResponseEvidencesItem.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface CodesGeneralReadResponseEvidencesItem { /** Index from the context input array */ diff --git a/src/api/types/CodesGeneralResponse.ts b/src/api/types/CodesGeneralResponse.ts index 8890a642..27c1c08d 100644 --- a/src/api/types/CodesGeneralResponse.ts +++ b/src/api/types/CodesGeneralResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface CodesGeneralResponse { /** Highest confidence bundle of codes, preselected by the code prediction model */ diff --git a/src/api/types/CommonAiContext.ts b/src/api/types/CommonAiContext.ts index fa69191e..7d597c08 100644 --- a/src/api/types/CommonAiContext.ts +++ b/src/api/types/CommonAiContext.ts @@ -1,7 +1,5 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export type CommonAiContext = Corti.CommonTextContext | Corti.CommonDocumentIdContext; diff --git a/src/api/types/CommonCodingSystemEnum.ts b/src/api/types/CommonCodingSystemEnum.ts index dd34a283..64d4d789 100644 --- a/src/api/types/CommonCodingSystemEnum.ts +++ b/src/api/types/CommonCodingSystemEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -export type CommonCodingSystemEnum = "icd10cm" | "icd10pcs" | "cpt"; export const CommonCodingSystemEnum = { Icd10Cm: "icd10cm", Icd10Pcs: "icd10pcs", Cpt: "cpt", } as const; +export type CommonCodingSystemEnum = (typeof CommonCodingSystemEnum)[keyof typeof CommonCodingSystemEnum]; diff --git a/src/api/types/CommonDocumentIdContext.ts b/src/api/types/CommonDocumentIdContext.ts index f5ceb79c..bcb354c4 100644 --- a/src/api/types/CommonDocumentIdContext.ts +++ b/src/api/types/CommonDocumentIdContext.ts @@ -1,10 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface CommonDocumentIdContext { /** The type of context, always "documentId" in this context. */ - type: "documentId"; + type: Corti.CommonDocumentIdContextType; /** A referenced document ID to be used as input to the model. */ documentId: string; } diff --git a/src/api/types/CommonDocumentIdContextType.ts b/src/api/types/CommonDocumentIdContextType.ts new file mode 100644 index 00000000..46adc0b0 --- /dev/null +++ b/src/api/types/CommonDocumentIdContextType.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The type of context, always "documentId" in this context. */ +export const CommonDocumentIdContextType = { + DocumentId: "documentId", +} as const; +export type CommonDocumentIdContextType = + (typeof CommonDocumentIdContextType)[keyof typeof CommonDocumentIdContextType]; diff --git a/src/api/types/CommonSortingDirectionEnum.ts b/src/api/types/CommonSortingDirectionEnum.ts index 0d8efe0c..b81a9b6b 100644 --- a/src/api/types/CommonSortingDirectionEnum.ts +++ b/src/api/types/CommonSortingDirectionEnum.ts @@ -1,9 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -export type CommonSortingDirectionEnum = "asc" | "desc"; export const CommonSortingDirectionEnum = { Asc: "asc", Desc: "desc", } as const; +export type CommonSortingDirectionEnum = (typeof CommonSortingDirectionEnum)[keyof typeof CommonSortingDirectionEnum]; diff --git a/src/api/types/CommonSourceEnum.ts b/src/api/types/CommonSourceEnum.ts index bd679e7d..e38194f1 100644 --- a/src/api/types/CommonSourceEnum.ts +++ b/src/api/types/CommonSourceEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -export type CommonSourceEnum = "core" | "system" | "user"; export const CommonSourceEnum = { Core: "core", System: "system", User: "user", } as const; +export type CommonSourceEnum = (typeof CommonSourceEnum)[keyof typeof CommonSourceEnum]; diff --git a/src/api/types/CommonTextContext.ts b/src/api/types/CommonTextContext.ts index fc34c227..f6109d2b 100644 --- a/src/api/types/CommonTextContext.ts +++ b/src/api/types/CommonTextContext.ts @@ -1,10 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface CommonTextContext { /** The type of context, always "text" in this context. */ - type: "text"; + type: Corti.CommonTextContextType; /** A text string to be used as input to the model. */ text: string; } diff --git a/src/api/types/CommonTextContextType.ts b/src/api/types/CommonTextContextType.ts new file mode 100644 index 00000000..3ab87830 --- /dev/null +++ b/src/api/types/CommonTextContextType.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The type of context, always "text" in this context. */ +export const CommonTextContextType = { + Text: "text", +} as const; +export type CommonTextContextType = (typeof CommonTextContextType)[keyof typeof CommonTextContextType]; diff --git a/src/api/types/CommonTranscriptRequest.ts b/src/api/types/CommonTranscriptRequest.ts index 1de3c43f..7a816c84 100644 --- a/src/api/types/CommonTranscriptRequest.ts +++ b/src/api/types/CommonTranscriptRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface CommonTranscriptRequest { /** The channel associated with this phrase/utterance. */ diff --git a/src/api/types/CommonTranscriptResponse.ts b/src/api/types/CommonTranscriptResponse.ts index 4aecce1c..9a18874f 100644 --- a/src/api/types/CommonTranscriptResponse.ts +++ b/src/api/types/CommonTranscriptResponse.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface CommonTranscriptResponse { /** The channel associated with this phrase/utterance. */ diff --git a/src/api/types/CommonUsageInfo.ts b/src/api/types/CommonUsageInfo.ts index fe707329..ee1f0492 100644 --- a/src/api/types/CommonUsageInfo.ts +++ b/src/api/types/CommonUsageInfo.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Credits consumed for this request. diff --git a/src/api/types/DocumentsContext.ts b/src/api/types/DocumentsContext.ts index de98fad4..fe3496ad 100644 --- a/src/api/types/DocumentsContext.ts +++ b/src/api/types/DocumentsContext.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export type DocumentsContext = | Corti.DocumentsContextWithFacts diff --git a/src/api/types/DocumentsContextWithFacts.ts b/src/api/types/DocumentsContextWithFacts.ts index 9b9a0f7e..642853f0 100644 --- a/src/api/types/DocumentsContextWithFacts.ts +++ b/src/api/types/DocumentsContextWithFacts.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface DocumentsContextWithFacts { /** The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`. */ - type: "facts"; + type: Corti.DocumentsContextWithFactsType; /** An array of facts. See [guide](/textgen/documents-standard##generate-document-from-facts-as-input). */ data: Corti.FactsContext[]; } diff --git a/src/api/types/DocumentsContextWithFactsType.ts b/src/api/types/DocumentsContextWithFactsType.ts new file mode 100644 index 00000000..fb531db9 --- /dev/null +++ b/src/api/types/DocumentsContextWithFactsType.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`. */ +export const DocumentsContextWithFactsType = { + Facts: "facts", +} as const; +export type DocumentsContextWithFactsType = + (typeof DocumentsContextWithFactsType)[keyof typeof DocumentsContextWithFactsType]; diff --git a/src/api/types/DocumentsContextWithString.ts b/src/api/types/DocumentsContextWithString.ts index 83a2db5e..566a5b0e 100644 --- a/src/api/types/DocumentsContextWithString.ts +++ b/src/api/types/DocumentsContextWithString.ts @@ -1,10 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface DocumentsContextWithString { /** The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`. */ - type: "string"; + type: Corti.DocumentsContextWithStringType; /** String data can include any text to be reasoned over for document generation: Transcript text, facts, or other narrative information. */ data: string; } diff --git a/src/api/types/DocumentsContextWithStringType.ts b/src/api/types/DocumentsContextWithStringType.ts new file mode 100644 index 00000000..a3620d52 --- /dev/null +++ b/src/api/types/DocumentsContextWithStringType.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`. */ +export const DocumentsContextWithStringType = { + String: "string", +} as const; +export type DocumentsContextWithStringType = + (typeof DocumentsContextWithStringType)[keyof typeof DocumentsContextWithStringType]; diff --git a/src/api/types/DocumentsContextWithTranscript.ts b/src/api/types/DocumentsContextWithTranscript.ts index 4ad559db..eb1ad2b4 100644 --- a/src/api/types/DocumentsContextWithTranscript.ts +++ b/src/api/types/DocumentsContextWithTranscript.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface DocumentsContextWithTranscript { /** The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`. */ - type: "transcript"; + type: Corti.DocumentsContextWithTranscriptType; /** The transcript `data.text` object can accept the full transcript in one string, alternatively pass each transcript segment into a `context` object - [see guide](/textgen/documents-standard#generate-document-from-transcript-as-input). */ data: Corti.CommonTranscriptRequest; } diff --git a/src/api/types/DocumentsContextWithTranscriptType.ts b/src/api/types/DocumentsContextWithTranscriptType.ts new file mode 100644 index 00000000..91ca07d4 --- /dev/null +++ b/src/api/types/DocumentsContextWithTranscriptType.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`. */ +export const DocumentsContextWithTranscriptType = { + Transcript: "transcript", +} as const; +export type DocumentsContextWithTranscriptType = + (typeof DocumentsContextWithTranscriptType)[keyof typeof DocumentsContextWithTranscriptType]; diff --git a/src/api/types/DocumentsCreateRequest.ts b/src/api/types/DocumentsCreateRequest.ts index e61c566b..5bc014d4 100644 --- a/src/api/types/DocumentsCreateRequest.ts +++ b/src/api/types/DocumentsCreateRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export type DocumentsCreateRequest = /** diff --git a/src/api/types/DocumentsCreateRequestWithTemplate.ts b/src/api/types/DocumentsCreateRequestWithTemplate.ts index 943aaa0a..69357041 100644 --- a/src/api/types/DocumentsCreateRequestWithTemplate.ts +++ b/src/api/types/DocumentsCreateRequestWithTemplate.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface DocumentsCreateRequestWithTemplate { /** An array of context objects. Currently only accepts multiple objects when of type `transcript`. See [guide](/textgen/documents-standard#generate-document-from-transcript-as-input). */ diff --git a/src/api/types/DocumentsCreateRequestWithTemplateKey.ts b/src/api/types/DocumentsCreateRequestWithTemplateKey.ts index d7a3a94a..f8133d1e 100644 --- a/src/api/types/DocumentsCreateRequestWithTemplateKey.ts +++ b/src/api/types/DocumentsCreateRequestWithTemplateKey.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface DocumentsCreateRequestWithTemplateKey { /** An array of context objects. Currently only accepts multiple objects when of type `transcript`. See [guide](/textgen/documents-standard#generate-document-from-transcript-as-input). */ diff --git a/src/api/types/DocumentsGetResponse.ts b/src/api/types/DocumentsGetResponse.ts index d786f3d6..1d79cd9f 100644 --- a/src/api/types/DocumentsGetResponse.ts +++ b/src/api/types/DocumentsGetResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface DocumentsGetResponse { /** Unique ID of the generated document */ diff --git a/src/api/types/DocumentsListResponse.ts b/src/api/types/DocumentsListResponse.ts index dc8bb1d0..3720187f 100644 --- a/src/api/types/DocumentsListResponse.ts +++ b/src/api/types/DocumentsListResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface DocumentsListResponse { data: Corti.DocumentsGetResponse[]; diff --git a/src/api/types/DocumentsSection.ts b/src/api/types/DocumentsSection.ts index a7364114..21e4fca4 100644 --- a/src/api/types/DocumentsSection.ts +++ b/src/api/types/DocumentsSection.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface DocumentsSection { /** Document section key */ diff --git a/src/api/types/DocumentsSectionInput.ts b/src/api/types/DocumentsSectionInput.ts index b8975a9d..91c2ea5c 100644 --- a/src/api/types/DocumentsSectionInput.ts +++ b/src/api/types/DocumentsSectionInput.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface DocumentsSectionInput { key: string; diff --git a/src/api/types/DocumentsSectionOverride.ts b/src/api/types/DocumentsSectionOverride.ts index 259097fc..9b6ef591 100644 --- a/src/api/types/DocumentsSectionOverride.ts +++ b/src/api/types/DocumentsSectionOverride.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface DocumentsSectionOverride { /** The key that references the section to use for document generation. */ diff --git a/src/api/types/DocumentsTemplate.ts b/src/api/types/DocumentsTemplate.ts index af732607..78857ecd 100644 --- a/src/api/types/DocumentsTemplate.ts +++ b/src/api/types/DocumentsTemplate.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export type DocumentsTemplate = /** diff --git a/src/api/types/DocumentsTemplateWithSectionKeys.ts b/src/api/types/DocumentsTemplateWithSectionKeys.ts index 3cca13c8..68947606 100644 --- a/src/api/types/DocumentsTemplateWithSectionKeys.ts +++ b/src/api/types/DocumentsTemplateWithSectionKeys.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface DocumentsTemplateWithSectionKeys { /** An array of section keys. */ diff --git a/src/api/types/DocumentsTemplateWithSections.ts b/src/api/types/DocumentsTemplateWithSections.ts index 2718aad0..5e730f25 100644 --- a/src/api/types/DocumentsTemplateWithSections.ts +++ b/src/api/types/DocumentsTemplateWithSections.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface DocumentsTemplateWithSections { sections: Corti.DocumentsSectionOverride[]; diff --git a/src/api/types/ErrorResponse.ts b/src/api/types/ErrorResponse.ts index 7733d0a5..0a123e93 100644 --- a/src/api/types/ErrorResponse.ts +++ b/src/api/types/ErrorResponse.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface ErrorResponse { requestid: string; diff --git a/src/api/types/FactsBatchUpdateInput.ts b/src/api/types/FactsBatchUpdateInput.ts index 53340cdf..289dbda1 100644 --- a/src/api/types/FactsBatchUpdateInput.ts +++ b/src/api/types/FactsBatchUpdateInput.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface FactsBatchUpdateInput { /** The unique identifier of the fact to be updated. */ diff --git a/src/api/types/FactsBatchUpdateItem.ts b/src/api/types/FactsBatchUpdateItem.ts index dd1beaca..13fabbec 100644 --- a/src/api/types/FactsBatchUpdateItem.ts +++ b/src/api/types/FactsBatchUpdateItem.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsBatchUpdateItem { /** The unique identifier of the updated fact. */ diff --git a/src/api/types/FactsBatchUpdateResponse.ts b/src/api/types/FactsBatchUpdateResponse.ts index a1d42040..0e065668 100644 --- a/src/api/types/FactsBatchUpdateResponse.ts +++ b/src/api/types/FactsBatchUpdateResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsBatchUpdateResponse { /** A list of updated facts. */ diff --git a/src/api/types/FactsContext.ts b/src/api/types/FactsContext.ts index dc3d11bc..c55a0dea 100644 --- a/src/api/types/FactsContext.ts +++ b/src/api/types/FactsContext.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsContext { /** The text of the fact. */ diff --git a/src/api/types/FactsCreateInput.ts b/src/api/types/FactsCreateInput.ts index 7ab1ebb2..54e38b1b 100644 --- a/src/api/types/FactsCreateInput.ts +++ b/src/api/types/FactsCreateInput.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsCreateInput { /** The text content of the fact. */ diff --git a/src/api/types/FactsCreateItem.ts b/src/api/types/FactsCreateItem.ts index aeb96891..4f839430 100644 --- a/src/api/types/FactsCreateItem.ts +++ b/src/api/types/FactsCreateItem.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsCreateItem { /** The unique identifier of the newly created fact. */ diff --git a/src/api/types/FactsCreateResponse.ts b/src/api/types/FactsCreateResponse.ts index cf433b5b..b94e4b28 100644 --- a/src/api/types/FactsCreateResponse.ts +++ b/src/api/types/FactsCreateResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsCreateResponse { /** A list of successfully created facts. */ diff --git a/src/api/types/FactsEvidence.ts b/src/api/types/FactsEvidence.ts index 5275982d..989784de 100644 --- a/src/api/types/FactsEvidence.ts +++ b/src/api/types/FactsEvidence.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface FactsEvidence { /** The category of evidence. */ diff --git a/src/api/types/FactsExtractResponse.ts b/src/api/types/FactsExtractResponse.ts index 17ab97f8..4ac3c494 100644 --- a/src/api/types/FactsExtractResponse.ts +++ b/src/api/types/FactsExtractResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsExtractResponse { /** List of extracted facts based on the provided input context. */ diff --git a/src/api/types/FactsExtractResponseFactsItem.ts b/src/api/types/FactsExtractResponseFactsItem.ts index 6ee1a56f..db2b3b0c 100644 --- a/src/api/types/FactsExtractResponseFactsItem.ts +++ b/src/api/types/FactsExtractResponseFactsItem.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface FactsExtractResponseFactsItem { /** The fact group key the fact belongs to. */ diff --git a/src/api/types/FactsFactGroupsItem.ts b/src/api/types/FactsFactGroupsItem.ts index 43dce1db..f71fb28c 100644 --- a/src/api/types/FactsFactGroupsItem.ts +++ b/src/api/types/FactsFactGroupsItem.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsFactGroupsItem { id?: Corti.Uuid; diff --git a/src/api/types/FactsFactGroupsItemTranslationsItem.ts b/src/api/types/FactsFactGroupsItemTranslationsItem.ts index 3289875e..9889285a 100644 --- a/src/api/types/FactsFactGroupsItemTranslationsItem.ts +++ b/src/api/types/FactsFactGroupsItemTranslationsItem.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface FactsFactGroupsItemTranslationsItem { id?: number; diff --git a/src/api/types/FactsFactGroupsListResponse.ts b/src/api/types/FactsFactGroupsListResponse.ts index 350a8da5..32f68282 100644 --- a/src/api/types/FactsFactGroupsListResponse.ts +++ b/src/api/types/FactsFactGroupsListResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsFactGroupsListResponse { data: Corti.FactsFactGroupsItem[]; diff --git a/src/api/types/FactsListItem.ts b/src/api/types/FactsListItem.ts index c5f87db8..d7a301e9 100644 --- a/src/api/types/FactsListItem.ts +++ b/src/api/types/FactsListItem.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsListItem { /** The unique identifier of the fact. */ diff --git a/src/api/types/FactsListResponse.ts b/src/api/types/FactsListResponse.ts index 64126b07..895c0c1f 100644 --- a/src/api/types/FactsListResponse.ts +++ b/src/api/types/FactsListResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsListResponse { /** A list of facts associated with the interaction. */ diff --git a/src/api/types/FactsUpdateResponse.ts b/src/api/types/FactsUpdateResponse.ts index a0920962..a4e1f939 100644 --- a/src/api/types/FactsUpdateResponse.ts +++ b/src/api/types/FactsUpdateResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface FactsUpdateResponse { /** The unique identifier of the fact. */ diff --git a/src/api/types/InteractionsCreateResponse.ts b/src/api/types/InteractionsCreateResponse.ts index 7a49f6ec..829582d8 100644 --- a/src/api/types/InteractionsCreateResponse.ts +++ b/src/api/types/InteractionsCreateResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface InteractionsCreateResponse { /** Unique identifier for the interaction. */ diff --git a/src/api/types/InteractionsEncounterCreateRequest.ts b/src/api/types/InteractionsEncounterCreateRequest.ts index 4f942dbf..b69be463 100644 --- a/src/api/types/InteractionsEncounterCreateRequest.ts +++ b/src/api/types/InteractionsEncounterCreateRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface InteractionsEncounterCreateRequest { /** A unique identifier for the encounter, essential for tracking and referencing specific patient interactions. */ diff --git a/src/api/types/InteractionsEncounterPeriod.ts b/src/api/types/InteractionsEncounterPeriod.ts index 73b1ac5c..5525b5cc 100644 --- a/src/api/types/InteractionsEncounterPeriod.ts +++ b/src/api/types/InteractionsEncounterPeriod.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface InteractionsEncounterPeriod { /** The start date/time of the encounter. (UTC) */ diff --git a/src/api/types/InteractionsEncounterResponse.ts b/src/api/types/InteractionsEncounterResponse.ts index f3585783..a3ef3f5d 100644 --- a/src/api/types/InteractionsEncounterResponse.ts +++ b/src/api/types/InteractionsEncounterResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface InteractionsEncounterResponse { /** A unique identifier for the encounter, essential for tracking and referencing specific patient interactions. */ diff --git a/src/api/types/InteractionsEncounterStatusEnum.ts b/src/api/types/InteractionsEncounterStatusEnum.ts index 2b9ffe90..97ea40c5 100644 --- a/src/api/types/InteractionsEncounterStatusEnum.ts +++ b/src/api/types/InteractionsEncounterStatusEnum.ts @@ -1,14 +1,5 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -export type InteractionsEncounterStatusEnum = - | "planned" - | "in-progress" - | "on-hold" - | "completed" - | "cancelled" - | "deleted"; export const InteractionsEncounterStatusEnum = { Planned: "planned", InProgress: "in-progress", @@ -17,3 +8,5 @@ export const InteractionsEncounterStatusEnum = { Cancelled: "cancelled", Deleted: "deleted", } as const; +export type InteractionsEncounterStatusEnum = + (typeof InteractionsEncounterStatusEnum)[keyof typeof InteractionsEncounterStatusEnum]; diff --git a/src/api/types/InteractionsEncounterTypeEnum.ts b/src/api/types/InteractionsEncounterTypeEnum.ts index 53377c76..67ef5c74 100644 --- a/src/api/types/InteractionsEncounterTypeEnum.ts +++ b/src/api/types/InteractionsEncounterTypeEnum.ts @@ -1,13 +1,5 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -export type InteractionsEncounterTypeEnum = - | "first_consultation" - | "consultation" - | "emergency" - | "inpatient" - | "outpatient"; export const InteractionsEncounterTypeEnum = { FirstConsultation: "first_consultation", Consultation: "consultation", @@ -15,3 +7,5 @@ export const InteractionsEncounterTypeEnum = { Inpatient: "inpatient", Outpatient: "outpatient", } as const; +export type InteractionsEncounterTypeEnum = + (typeof InteractionsEncounterTypeEnum)[keyof typeof InteractionsEncounterTypeEnum]; diff --git a/src/api/types/InteractionsEncounterUpdateRequest.ts b/src/api/types/InteractionsEncounterUpdateRequest.ts index 8781a199..e46049d5 100644 --- a/src/api/types/InteractionsEncounterUpdateRequest.ts +++ b/src/api/types/InteractionsEncounterUpdateRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface InteractionsEncounterUpdateRequest { /** A unique identifier for the encounter, essential for tracking and referencing specific patient interactions. */ diff --git a/src/api/types/InteractionsGenderEnum.ts b/src/api/types/InteractionsGenderEnum.ts index 989d4bdd..ae0344bd 100644 --- a/src/api/types/InteractionsGenderEnum.ts +++ b/src/api/types/InteractionsGenderEnum.ts @@ -1,11 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -export type InteractionsGenderEnum = "male" | "female" | "unknown" | "other"; export const InteractionsGenderEnum = { Male: "male", Female: "female", Unknown: "unknown", Other: "other", } as const; +export type InteractionsGenderEnum = (typeof InteractionsGenderEnum)[keyof typeof InteractionsGenderEnum]; diff --git a/src/api/types/InteractionsGetResponse.ts b/src/api/types/InteractionsGetResponse.ts index f48f22b1..74e26f09 100644 --- a/src/api/types/InteractionsGetResponse.ts +++ b/src/api/types/InteractionsGetResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface InteractionsGetResponse { /** Unique identifier for the interaction. */ diff --git a/src/api/types/InteractionsListResponse.ts b/src/api/types/InteractionsListResponse.ts index 24df42d6..8a5de3da 100644 --- a/src/api/types/InteractionsListResponse.ts +++ b/src/api/types/InteractionsListResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface InteractionsListResponse { interactions: Corti.InteractionsGetResponse[]; diff --git a/src/api/types/InteractionsPatient.ts b/src/api/types/InteractionsPatient.ts index e933a81d..14c48fa6 100644 --- a/src/api/types/InteractionsPatient.ts +++ b/src/api/types/InteractionsPatient.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface InteractionsPatient { /** FHIR reference to patient identifier. */ diff --git a/src/api/types/RecordingsCreateResponse.ts b/src/api/types/RecordingsCreateResponse.ts index 3922c107..2b62ee09 100644 --- a/src/api/types/RecordingsCreateResponse.ts +++ b/src/api/types/RecordingsCreateResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface RecordingsCreateResponse { /** The unique identifier for the created recording. */ diff --git a/src/api/types/RecordingsListResponse.ts b/src/api/types/RecordingsListResponse.ts index 17f9667b..e9affced 100644 --- a/src/api/types/RecordingsListResponse.ts +++ b/src/api/types/RecordingsListResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface RecordingsListResponse { /** A list of recordings for the interaction. */ diff --git a/src/api/types/StreamConfig.ts b/src/api/types/StreamConfig.ts index d60c199a..2d041e77 100644 --- a/src/api/types/StreamConfig.ts +++ b/src/api/types/StreamConfig.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface StreamConfig { transcription: Corti.StreamConfigTranscription; diff --git a/src/api/types/StreamConfigMessage.ts b/src/api/types/StreamConfigMessage.ts index 46a1ac0f..4a05d18d 100644 --- a/src/api/types/StreamConfigMessage.ts +++ b/src/api/types/StreamConfigMessage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface StreamConfigMessage { - type: "config"; + type: Corti.StreamConfigMessageType; configuration: Corti.StreamConfig; } diff --git a/src/api/types/StreamConfigMessageType.ts b/src/api/types/StreamConfigMessageType.ts new file mode 100644 index 00000000..9ed7e32f --- /dev/null +++ b/src/api/types/StreamConfigMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const StreamConfigMessageType = { + Config: "config", +} as const; +export type StreamConfigMessageType = (typeof StreamConfigMessageType)[keyof typeof StreamConfigMessageType]; diff --git a/src/api/types/StreamConfigMode.ts b/src/api/types/StreamConfigMode.ts index 78976b06..5ec39b72 100644 --- a/src/api/types/StreamConfigMode.ts +++ b/src/api/types/StreamConfigMode.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface StreamConfigMode { /** Processing mode */ diff --git a/src/api/types/StreamConfigModeType.ts b/src/api/types/StreamConfigModeType.ts index 2c2dd409..2ec3ceb8 100644 --- a/src/api/types/StreamConfigModeType.ts +++ b/src/api/types/StreamConfigModeType.ts @@ -1,12 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Processing mode - */ -export type StreamConfigModeType = "facts" | "transcription"; +/** Processing mode */ export const StreamConfigModeType = { Facts: "facts", Transcription: "transcription", } as const; +export type StreamConfigModeType = (typeof StreamConfigModeType)[keyof typeof StreamConfigModeType]; diff --git a/src/api/types/StreamConfigParticipant.ts b/src/api/types/StreamConfigParticipant.ts index ca45df9b..6df615c9 100644 --- a/src/api/types/StreamConfigParticipant.ts +++ b/src/api/types/StreamConfigParticipant.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface StreamConfigParticipant { /** Audio channel number (e.g. 0 or 1) */ diff --git a/src/api/types/StreamConfigParticipantRole.ts b/src/api/types/StreamConfigParticipantRole.ts index 0586c14e..0491b35a 100644 --- a/src/api/types/StreamConfigParticipantRole.ts +++ b/src/api/types/StreamConfigParticipantRole.ts @@ -1,13 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Role of the participant (e.g., doctor, patient, or multiple) - */ -export type StreamConfigParticipantRole = "doctor" | "patient" | "multiple"; +/** Role of the participant (e.g., doctor, patient, or multiple) */ export const StreamConfigParticipantRole = { Doctor: "doctor", Patient: "patient", Multiple: "multiple", } as const; +export type StreamConfigParticipantRole = + (typeof StreamConfigParticipantRole)[keyof typeof StreamConfigParticipantRole]; diff --git a/src/api/types/StreamConfigStatusMessage.ts b/src/api/types/StreamConfigStatusMessage.ts index 2a1d66cc..32a32c1a 100644 --- a/src/api/types/StreamConfigStatusMessage.ts +++ b/src/api/types/StreamConfigStatusMessage.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface StreamConfigStatusMessage { /** Configuration status result */ diff --git a/src/api/types/StreamConfigStatusMessageType.ts b/src/api/types/StreamConfigStatusMessageType.ts index 32c1ec7f..4c9db82e 100644 --- a/src/api/types/StreamConfigStatusMessageType.ts +++ b/src/api/types/StreamConfigStatusMessageType.ts @@ -1,17 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Configuration status result - */ -export type StreamConfigStatusMessageType = - | "CONFIG_ACCEPTED" - | "CONFIG_DENIED" - | "CONFIG_MISSING" - | "CONFIG_NOT_PROVIDED" - | "CONFIG_ALREADY_RECEIVED" - | "CONFIG_TIMEOUT"; +/** Configuration status result */ export const StreamConfigStatusMessageType = { ConfigAccepted: "CONFIG_ACCEPTED", ConfigDenied: "CONFIG_DENIED", @@ -20,3 +9,5 @@ export const StreamConfigStatusMessageType = { ConfigAlreadyReceived: "CONFIG_ALREADY_RECEIVED", ConfigTimeout: "CONFIG_TIMEOUT", } as const; +export type StreamConfigStatusMessageType = + (typeof StreamConfigStatusMessageType)[keyof typeof StreamConfigStatusMessageType]; diff --git a/src/api/types/StreamConfigTranscription.ts b/src/api/types/StreamConfigTranscription.ts index 0f543513..8a61d252 100644 --- a/src/api/types/StreamConfigTranscription.ts +++ b/src/api/types/StreamConfigTranscription.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface StreamConfigTranscription { /** Primary spoken language for transcription */ diff --git a/src/api/types/StreamEndMessage.ts b/src/api/types/StreamEndMessage.ts index cb816658..f948f485 100644 --- a/src/api/types/StreamEndMessage.ts +++ b/src/api/types/StreamEndMessage.ts @@ -1,7 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface StreamEndMessage { - type: "end"; + type: Corti.StreamEndMessageType; } diff --git a/src/api/types/StreamEndMessageType.ts b/src/api/types/StreamEndMessageType.ts new file mode 100644 index 00000000..a004874a --- /dev/null +++ b/src/api/types/StreamEndMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const StreamEndMessageType = { + End: "end", +} as const; +export type StreamEndMessageType = (typeof StreamEndMessageType)[keyof typeof StreamEndMessageType]; diff --git a/src/api/types/StreamEndedMessage.ts b/src/api/types/StreamEndedMessage.ts index 83a22eb7..d55dc3eb 100644 --- a/src/api/types/StreamEndedMessage.ts +++ b/src/api/types/StreamEndedMessage.ts @@ -1,7 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface StreamEndedMessage { - type: "ENDED"; + type: Corti.StreamEndedMessageType; } diff --git a/src/api/types/StreamEndedMessageType.ts b/src/api/types/StreamEndedMessageType.ts new file mode 100644 index 00000000..335ed883 --- /dev/null +++ b/src/api/types/StreamEndedMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const StreamEndedMessageType = { + Ended: "ENDED", +} as const; +export type StreamEndedMessageType = (typeof StreamEndedMessageType)[keyof typeof StreamEndedMessageType]; diff --git a/src/api/types/StreamErrorDetail.ts b/src/api/types/StreamErrorDetail.ts index f7d9f9f3..988c5aed 100644 --- a/src/api/types/StreamErrorDetail.ts +++ b/src/api/types/StreamErrorDetail.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface StreamErrorDetail { /** Error identifier */ diff --git a/src/api/types/StreamErrorMessage.ts b/src/api/types/StreamErrorMessage.ts index 5a55a719..a399930e 100644 --- a/src/api/types/StreamErrorMessage.ts +++ b/src/api/types/StreamErrorMessage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface StreamErrorMessage { - type: "error"; + type: Corti.StreamErrorMessageType; error: Corti.StreamErrorDetail; } diff --git a/src/api/types/StreamErrorMessageType.ts b/src/api/types/StreamErrorMessageType.ts new file mode 100644 index 00000000..878f65d3 --- /dev/null +++ b/src/api/types/StreamErrorMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const StreamErrorMessageType = { + Error: "error", +} as const; +export type StreamErrorMessageType = (typeof StreamErrorMessageType)[keyof typeof StreamErrorMessageType]; diff --git a/src/api/types/StreamFact.ts b/src/api/types/StreamFact.ts index 64cb1cb9..473ac6e3 100644 --- a/src/api/types/StreamFact.ts +++ b/src/api/types/StreamFact.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface StreamFact { /** Unique identifier for the fact */ diff --git a/src/api/types/StreamFactsMessage.ts b/src/api/types/StreamFactsMessage.ts index 8dcbe032..f163683f 100644 --- a/src/api/types/StreamFactsMessage.ts +++ b/src/api/types/StreamFactsMessage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface StreamFactsMessage { - type: "facts"; + type: Corti.StreamFactsMessageType; fact: Corti.StreamFact[]; } diff --git a/src/api/types/StreamFactsMessageType.ts b/src/api/types/StreamFactsMessageType.ts new file mode 100644 index 00000000..80a3ac66 --- /dev/null +++ b/src/api/types/StreamFactsMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const StreamFactsMessageType = { + Facts: "facts", +} as const; +export type StreamFactsMessageType = (typeof StreamFactsMessageType)[keyof typeof StreamFactsMessageType]; diff --git a/src/api/types/StreamFlushMessage.ts b/src/api/types/StreamFlushMessage.ts index a74f60b8..527646c4 100644 --- a/src/api/types/StreamFlushMessage.ts +++ b/src/api/types/StreamFlushMessage.ts @@ -1,7 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface StreamFlushMessage { - type: "flush"; + type: Corti.StreamFlushMessageType; } diff --git a/src/api/types/StreamFlushMessageType.ts b/src/api/types/StreamFlushMessageType.ts new file mode 100644 index 00000000..80cf0d27 --- /dev/null +++ b/src/api/types/StreamFlushMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const StreamFlushMessageType = { + Flush: "flush", +} as const; +export type StreamFlushMessageType = (typeof StreamFlushMessageType)[keyof typeof StreamFlushMessageType]; diff --git a/src/api/types/StreamFlushedMessage.ts b/src/api/types/StreamFlushedMessage.ts index c0e04f41..c8bccca5 100644 --- a/src/api/types/StreamFlushedMessage.ts +++ b/src/api/types/StreamFlushedMessage.ts @@ -1,7 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface StreamFlushedMessage { - type: "flushed"; + type: Corti.StreamFlushedMessageType; } diff --git a/src/api/types/StreamFlushedMessageType.ts b/src/api/types/StreamFlushedMessageType.ts new file mode 100644 index 00000000..37200df0 --- /dev/null +++ b/src/api/types/StreamFlushedMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const StreamFlushedMessageType = { + Flushed: "flushed", +} as const; +export type StreamFlushedMessageType = (typeof StreamFlushedMessageType)[keyof typeof StreamFlushedMessageType]; diff --git a/src/api/types/StreamParticipant.ts b/src/api/types/StreamParticipant.ts index 618e6099..1771e496 100644 --- a/src/api/types/StreamParticipant.ts +++ b/src/api/types/StreamParticipant.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface StreamParticipant { /** Audio channel number (e.g. 0 or 1) */ diff --git a/src/api/types/StreamSupportedLanguage.ts b/src/api/types/StreamSupportedLanguage.ts index 13ee8746..c98e879d 100644 --- a/src/api/types/StreamSupportedLanguage.ts +++ b/src/api/types/StreamSupportedLanguage.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Supported language codes diff --git a/src/api/types/StreamTranscript.ts b/src/api/types/StreamTranscript.ts index 0f4ac686..e55e700c 100644 --- a/src/api/types/StreamTranscript.ts +++ b/src/api/types/StreamTranscript.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface StreamTranscript { /** Interaction ID that the transcript segments are associated with */ diff --git a/src/api/types/StreamTranscriptMessage.ts b/src/api/types/StreamTranscriptMessage.ts index da98ab78..0069e9bf 100644 --- a/src/api/types/StreamTranscriptMessage.ts +++ b/src/api/types/StreamTranscriptMessage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface StreamTranscriptMessage { - type: "transcript"; + type: Corti.StreamTranscriptMessageType; data: Corti.StreamTranscript[]; } diff --git a/src/api/types/StreamTranscriptMessageType.ts b/src/api/types/StreamTranscriptMessageType.ts new file mode 100644 index 00000000..f78d7abc --- /dev/null +++ b/src/api/types/StreamTranscriptMessageType.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export const StreamTranscriptMessageType = { + Transcript: "transcript", +} as const; +export type StreamTranscriptMessageType = + (typeof StreamTranscriptMessageType)[keyof typeof StreamTranscriptMessageType]; diff --git a/src/api/types/StreamTranscriptTime.ts b/src/api/types/StreamTranscriptTime.ts index e11722e1..2bee128d 100644 --- a/src/api/types/StreamTranscriptTime.ts +++ b/src/api/types/StreamTranscriptTime.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface StreamTranscriptTime { /** Start time of the transcript segment */ diff --git a/src/api/types/StreamUsageMessage.ts b/src/api/types/StreamUsageMessage.ts index 07a52ff4..4dcc4c4c 100644 --- a/src/api/types/StreamUsageMessage.ts +++ b/src/api/types/StreamUsageMessage.ts @@ -1,9 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface StreamUsageMessage { - type: "usage"; + type: Corti.StreamUsageMessageType; /** The amount of credits used for this stream. */ credits: number; } diff --git a/src/api/types/StreamUsageMessageType.ts b/src/api/types/StreamUsageMessageType.ts new file mode 100644 index 00000000..2ab61edc --- /dev/null +++ b/src/api/types/StreamUsageMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const StreamUsageMessageType = { + Usage: "usage", +} as const; +export type StreamUsageMessageType = (typeof StreamUsageMessageType)[keyof typeof StreamUsageMessageType]; diff --git a/src/api/types/TemplatesDocumentationModeEnum.ts b/src/api/types/TemplatesDocumentationModeEnum.ts index b62e6407..78b67203 100644 --- a/src/api/types/TemplatesDocumentationModeEnum.ts +++ b/src/api/types/TemplatesDocumentationModeEnum.ts @@ -1,12 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Configures the approach and underlying system prompt that govern how the LLM generates documentation. - */ -export type TemplatesDocumentationModeEnum = "global_sequential" | "routed_parallel"; +/** Configures the approach and underlying system prompt that govern how the LLM generates documentation. */ export const TemplatesDocumentationModeEnum = { GlobalSequential: "global_sequential", RoutedParallel: "routed_parallel", } as const; +export type TemplatesDocumentationModeEnum = + (typeof TemplatesDocumentationModeEnum)[keyof typeof TemplatesDocumentationModeEnum]; diff --git a/src/api/types/TemplatesFormatRule.ts b/src/api/types/TemplatesFormatRule.ts index cb8a07f9..d39df0dc 100644 --- a/src/api/types/TemplatesFormatRule.ts +++ b/src/api/types/TemplatesFormatRule.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface TemplatesFormatRule { /** Name of the format rule. */ - name?: string | null; + name: string | null; } diff --git a/src/api/types/TemplatesItem.ts b/src/api/types/TemplatesItem.ts index 8b3b8680..0a056f6a 100644 --- a/src/api/types/TemplatesItem.ts +++ b/src/api/types/TemplatesItem.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TemplatesItem { /** The timestamp when the template was updated. */ diff --git a/src/api/types/TemplatesListResponse.ts b/src/api/types/TemplatesListResponse.ts index 5b3cf670..8c723d3b 100644 --- a/src/api/types/TemplatesListResponse.ts +++ b/src/api/types/TemplatesListResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TemplatesListResponse { /** List of filtered templates */ diff --git a/src/api/types/TemplatesSection.ts b/src/api/types/TemplatesSection.ts index 2c65e619..55b8d960 100644 --- a/src/api/types/TemplatesSection.ts +++ b/src/api/types/TemplatesSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TemplatesSection { /** The timestamp when the section was updated. */ diff --git a/src/api/types/TemplatesSectionListResponse.ts b/src/api/types/TemplatesSectionListResponse.ts index 6f77eb9f..5b652126 100644 --- a/src/api/types/TemplatesSectionListResponse.ts +++ b/src/api/types/TemplatesSectionListResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TemplatesSectionListResponse { /** List of filtered template sections */ diff --git a/src/api/types/TemplatesSectionSorted.ts b/src/api/types/TemplatesSectionSorted.ts index e99b4771..102c6622 100644 --- a/src/api/types/TemplatesSectionSorted.ts +++ b/src/api/types/TemplatesSectionSorted.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TemplatesSectionSorted { /** Sort order of the section within the template. */ diff --git a/src/api/types/TemplatesSectionTranslation.ts b/src/api/types/TemplatesSectionTranslation.ts index 6a364605..7c0549ca 100644 --- a/src/api/types/TemplatesSectionTranslation.ts +++ b/src/api/types/TemplatesSectionTranslation.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface TemplatesSectionTranslation { /** Language code. */ diff --git a/src/api/types/TemplatesTranslation.ts b/src/api/types/TemplatesTranslation.ts index d50ea0c5..74034914 100644 --- a/src/api/types/TemplatesTranslation.ts +++ b/src/api/types/TemplatesTranslation.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface TemplatesTranslation { /** Language code. */ diff --git a/src/api/types/TemplatesWritingStyle.ts b/src/api/types/TemplatesWritingStyle.ts index b962ad5d..ca08d733 100644 --- a/src/api/types/TemplatesWritingStyle.ts +++ b/src/api/types/TemplatesWritingStyle.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface TemplatesWritingStyle { /** Name of the writing style. */ diff --git a/src/api/types/TranscribeCommand.ts b/src/api/types/TranscribeCommand.ts index 71d0160b..7a418c27 100644 --- a/src/api/types/TranscribeCommand.ts +++ b/src/api/types/TranscribeCommand.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscribeCommand { /** To identify the command when it gets detected and returned over the WebSocket */ diff --git a/src/api/types/TranscribeCommandData.ts b/src/api/types/TranscribeCommandData.ts index 66a17899..af5a9a11 100644 --- a/src/api/types/TranscribeCommandData.ts +++ b/src/api/types/TranscribeCommandData.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface TranscribeCommandData { /** To identify the command when it gets detected and returned over the WebSocket */ id: string; /** The variables identified */ - variables?: Record | null; + variables?: Record | null; /** The raw transcript without spoken punctuation applied and without command phrases removed */ rawTranscriptText: string; /** Start time of the transcript segment in seconds */ diff --git a/src/api/types/TranscribeCommandMessage.ts b/src/api/types/TranscribeCommandMessage.ts index f1d0ce5a..8cede78f 100644 --- a/src/api/types/TranscribeCommandMessage.ts +++ b/src/api/types/TranscribeCommandMessage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscribeCommandMessage { - type: "command"; + type: Corti.TranscribeCommandMessageType; data: Corti.TranscribeCommandData; } diff --git a/src/api/types/TranscribeCommandMessageType.ts b/src/api/types/TranscribeCommandMessageType.ts new file mode 100644 index 00000000..99829f02 --- /dev/null +++ b/src/api/types/TranscribeCommandMessageType.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export const TranscribeCommandMessageType = { + Command: "command", +} as const; +export type TranscribeCommandMessageType = + (typeof TranscribeCommandMessageType)[keyof typeof TranscribeCommandMessageType]; diff --git a/src/api/types/TranscribeCommandVariable.ts b/src/api/types/TranscribeCommandVariable.ts index 003a0d84..511fbb26 100644 --- a/src/api/types/TranscribeCommandVariable.ts +++ b/src/api/types/TranscribeCommandVariable.ts @@ -1,12 +1,12 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface TranscribeCommandVariable { /** Variable key identifier */ key: string; /** Variable type */ - type: "enum"; + type: Corti.TranscribeCommandVariableType; /** Enum values for the variable */ enum: string[]; } diff --git a/src/api/types/TranscribeCommandVariableType.ts b/src/api/types/TranscribeCommandVariableType.ts new file mode 100644 index 00000000..ff26f363 --- /dev/null +++ b/src/api/types/TranscribeCommandVariableType.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** Variable type */ +export const TranscribeCommandVariableType = { + Enum: "enum", +} as const; +export type TranscribeCommandVariableType = + (typeof TranscribeCommandVariableType)[keyof typeof TranscribeCommandVariableType]; diff --git a/src/api/types/TranscribeConfig.ts b/src/api/types/TranscribeConfig.ts index 9a8b17e2..bf8dbd61 100644 --- a/src/api/types/TranscribeConfig.ts +++ b/src/api/types/TranscribeConfig.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscribeConfig { /** The locale of the primary spoken language. */ diff --git a/src/api/types/TranscribeConfigMessage.ts b/src/api/types/TranscribeConfigMessage.ts index d15d0285..1a0f95c7 100644 --- a/src/api/types/TranscribeConfigMessage.ts +++ b/src/api/types/TranscribeConfigMessage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscribeConfigMessage { - type: "config"; + type: Corti.TranscribeConfigMessageType; configuration: Corti.TranscribeConfig; } diff --git a/src/api/types/TranscribeConfigMessageType.ts b/src/api/types/TranscribeConfigMessageType.ts new file mode 100644 index 00000000..2e563b8e --- /dev/null +++ b/src/api/types/TranscribeConfigMessageType.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export const TranscribeConfigMessageType = { + Config: "config", +} as const; +export type TranscribeConfigMessageType = + (typeof TranscribeConfigMessageType)[keyof typeof TranscribeConfigMessageType]; diff --git a/src/api/types/TranscribeConfigStatusMessage.ts b/src/api/types/TranscribeConfigStatusMessage.ts index 69801cc0..765dcd6f 100644 --- a/src/api/types/TranscribeConfigStatusMessage.ts +++ b/src/api/types/TranscribeConfigStatusMessage.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscribeConfigStatusMessage { /** Configuration status result */ diff --git a/src/api/types/TranscribeConfigStatusMessageType.ts b/src/api/types/TranscribeConfigStatusMessageType.ts index 817ac87b..bded7c6c 100644 --- a/src/api/types/TranscribeConfigStatusMessageType.ts +++ b/src/api/types/TranscribeConfigStatusMessageType.ts @@ -1,13 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Configuration status result - */ -export type TranscribeConfigStatusMessageType = "CONFIG_ACCEPTED" | "CONFIG_DENIED" | "CONFIG_TIMEOUT"; +/** Configuration status result */ export const TranscribeConfigStatusMessageType = { ConfigAccepted: "CONFIG_ACCEPTED", ConfigDenied: "CONFIG_DENIED", ConfigTimeout: "CONFIG_TIMEOUT", } as const; +export type TranscribeConfigStatusMessageType = + (typeof TranscribeConfigStatusMessageType)[keyof typeof TranscribeConfigStatusMessageType]; diff --git a/src/api/types/TranscribeEndMessage.ts b/src/api/types/TranscribeEndMessage.ts index b008d92d..6a9a4bf7 100644 --- a/src/api/types/TranscribeEndMessage.ts +++ b/src/api/types/TranscribeEndMessage.ts @@ -1,7 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface TranscribeEndMessage { - type: "end"; + type: Corti.TranscribeEndMessageType; } diff --git a/src/api/types/TranscribeEndMessageType.ts b/src/api/types/TranscribeEndMessageType.ts new file mode 100644 index 00000000..240401fa --- /dev/null +++ b/src/api/types/TranscribeEndMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const TranscribeEndMessageType = { + End: "end", +} as const; +export type TranscribeEndMessageType = (typeof TranscribeEndMessageType)[keyof typeof TranscribeEndMessageType]; diff --git a/src/api/types/TranscribeEndedMessage.ts b/src/api/types/TranscribeEndedMessage.ts index a33a4675..8f8a1fee 100644 --- a/src/api/types/TranscribeEndedMessage.ts +++ b/src/api/types/TranscribeEndedMessage.ts @@ -1,7 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface TranscribeEndedMessage { - type: "ended"; + type: Corti.TranscribeEndedMessageType; } diff --git a/src/api/types/TranscribeEndedMessageType.ts b/src/api/types/TranscribeEndedMessageType.ts new file mode 100644 index 00000000..c4db7637 --- /dev/null +++ b/src/api/types/TranscribeEndedMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const TranscribeEndedMessageType = { + Ended: "ended", +} as const; +export type TranscribeEndedMessageType = (typeof TranscribeEndedMessageType)[keyof typeof TranscribeEndedMessageType]; diff --git a/src/api/types/TranscribeErrorMessage.ts b/src/api/types/TranscribeErrorMessage.ts index c2ea333e..ac5fe934 100644 --- a/src/api/types/TranscribeErrorMessage.ts +++ b/src/api/types/TranscribeErrorMessage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscribeErrorMessage { - type: "error"; + type: Corti.TranscribeErrorMessageType; error: Corti.TranscribeErrorMessageError; } diff --git a/src/api/types/TranscribeErrorMessageError.ts b/src/api/types/TranscribeErrorMessageError.ts index c1948b1b..067e054b 100644 --- a/src/api/types/TranscribeErrorMessageError.ts +++ b/src/api/types/TranscribeErrorMessageError.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface TranscribeErrorMessageError { /** Unique error identifier */ diff --git a/src/api/types/TranscribeErrorMessageType.ts b/src/api/types/TranscribeErrorMessageType.ts new file mode 100644 index 00000000..1e8198bd --- /dev/null +++ b/src/api/types/TranscribeErrorMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const TranscribeErrorMessageType = { + Error: "error", +} as const; +export type TranscribeErrorMessageType = (typeof TranscribeErrorMessageType)[keyof typeof TranscribeErrorMessageType]; diff --git a/src/api/types/TranscribeFlushMessage.ts b/src/api/types/TranscribeFlushMessage.ts index d347f9dd..f01121ae 100644 --- a/src/api/types/TranscribeFlushMessage.ts +++ b/src/api/types/TranscribeFlushMessage.ts @@ -1,7 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface TranscribeFlushMessage { - type: "flush"; + type: Corti.TranscribeFlushMessageType; } diff --git a/src/api/types/TranscribeFlushMessageType.ts b/src/api/types/TranscribeFlushMessageType.ts new file mode 100644 index 00000000..f7154265 --- /dev/null +++ b/src/api/types/TranscribeFlushMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const TranscribeFlushMessageType = { + Flush: "flush", +} as const; +export type TranscribeFlushMessageType = (typeof TranscribeFlushMessageType)[keyof typeof TranscribeFlushMessageType]; diff --git a/src/api/types/TranscribeFlushedMessage.ts b/src/api/types/TranscribeFlushedMessage.ts index bd8d916e..86894143 100644 --- a/src/api/types/TranscribeFlushedMessage.ts +++ b/src/api/types/TranscribeFlushedMessage.ts @@ -1,7 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface TranscribeFlushedMessage { - type: "flushed"; + type: Corti.TranscribeFlushedMessageType; } diff --git a/src/api/types/TranscribeFlushedMessageType.ts b/src/api/types/TranscribeFlushedMessageType.ts new file mode 100644 index 00000000..6111d76f --- /dev/null +++ b/src/api/types/TranscribeFlushedMessageType.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export const TranscribeFlushedMessageType = { + Flushed: "flushed", +} as const; +export type TranscribeFlushedMessageType = + (typeof TranscribeFlushedMessageType)[keyof typeof TranscribeFlushedMessageType]; diff --git a/src/api/types/TranscribeFormatting.ts b/src/api/types/TranscribeFormatting.ts index 1dea11e8..d34efe52 100644 --- a/src/api/types/TranscribeFormatting.ts +++ b/src/api/types/TranscribeFormatting.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscribeFormatting { /** Formatting for dates. */ diff --git a/src/api/types/TranscribeFormattingDates.ts b/src/api/types/TranscribeFormattingDates.ts index 73af2aaa..fc6601aa 100644 --- a/src/api/types/TranscribeFormattingDates.ts +++ b/src/api/types/TranscribeFormattingDates.ts @@ -1,11 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Formatting for dates. - */ -export type TranscribeFormattingDates = "as_dictated" | "eu_slash" | "iso_compact" | "long_text" | "us_slash"; +/** Formatting for dates. */ export const TranscribeFormattingDates = { AsDictated: "as_dictated", EuSlash: "eu_slash", @@ -13,3 +8,4 @@ export const TranscribeFormattingDates = { LongText: "long_text", UsSlash: "us_slash", } as const; +export type TranscribeFormattingDates = (typeof TranscribeFormattingDates)[keyof typeof TranscribeFormattingDates]; diff --git a/src/api/types/TranscribeFormattingMeasurements.ts b/src/api/types/TranscribeFormattingMeasurements.ts index 351f5de8..cff51a5a 100644 --- a/src/api/types/TranscribeFormattingMeasurements.ts +++ b/src/api/types/TranscribeFormattingMeasurements.ts @@ -1,12 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Formatting for measurements. - */ -export type TranscribeFormattingMeasurements = "abbreviated" | "as_dictated"; +/** Formatting for measurements. */ export const TranscribeFormattingMeasurements = { Abbreviated: "abbreviated", AsDictated: "as_dictated", } as const; +export type TranscribeFormattingMeasurements = + (typeof TranscribeFormattingMeasurements)[keyof typeof TranscribeFormattingMeasurements]; diff --git a/src/api/types/TranscribeFormattingNumbers.ts b/src/api/types/TranscribeFormattingNumbers.ts index 110b0934..f56341aa 100644 --- a/src/api/types/TranscribeFormattingNumbers.ts +++ b/src/api/types/TranscribeFormattingNumbers.ts @@ -1,13 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Formatting for numbers. - */ -export type TranscribeFormattingNumbers = "as_dictated" | "numerals" | "numerals_above_nine"; +/** Formatting for numbers. */ export const TranscribeFormattingNumbers = { AsDictated: "as_dictated", Numerals: "numerals", NumeralsAboveNine: "numerals_above_nine", } as const; +export type TranscribeFormattingNumbers = + (typeof TranscribeFormattingNumbers)[keyof typeof TranscribeFormattingNumbers]; diff --git a/src/api/types/TranscribeFormattingNumericRanges.ts b/src/api/types/TranscribeFormattingNumericRanges.ts index 917fe792..016f9775 100644 --- a/src/api/types/TranscribeFormattingNumericRanges.ts +++ b/src/api/types/TranscribeFormattingNumericRanges.ts @@ -1,12 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Formatting for numeric ranges. - */ -export type TranscribeFormattingNumericRanges = "as_dictated" | "numerals"; +/** Formatting for numeric ranges. */ export const TranscribeFormattingNumericRanges = { AsDictated: "as_dictated", Numerals: "numerals", } as const; +export type TranscribeFormattingNumericRanges = + (typeof TranscribeFormattingNumericRanges)[keyof typeof TranscribeFormattingNumericRanges]; diff --git a/src/api/types/TranscribeFormattingOrdinals.ts b/src/api/types/TranscribeFormattingOrdinals.ts index be5557e4..6db15561 100644 --- a/src/api/types/TranscribeFormattingOrdinals.ts +++ b/src/api/types/TranscribeFormattingOrdinals.ts @@ -1,12 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Formatting for ordinals. - */ -export type TranscribeFormattingOrdinals = "as_dictated" | "numerals"; +/** Formatting for ordinals. */ export const TranscribeFormattingOrdinals = { AsDictated: "as_dictated", Numerals: "numerals", } as const; +export type TranscribeFormattingOrdinals = + (typeof TranscribeFormattingOrdinals)[keyof typeof TranscribeFormattingOrdinals]; diff --git a/src/api/types/TranscribeFormattingTimes.ts b/src/api/types/TranscribeFormattingTimes.ts index 0a8aaa78..cdc30da7 100644 --- a/src/api/types/TranscribeFormattingTimes.ts +++ b/src/api/types/TranscribeFormattingTimes.ts @@ -1,13 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Formatting for times. - */ -export type TranscribeFormattingTimes = "as_dictated" | "h12" | "h24"; +/** Formatting for times. */ export const TranscribeFormattingTimes = { AsDictated: "as_dictated", H12: "h12", H24: "h24", } as const; +export type TranscribeFormattingTimes = (typeof TranscribeFormattingTimes)[keyof typeof TranscribeFormattingTimes]; diff --git a/src/api/types/TranscribeSupportedLanguage.ts b/src/api/types/TranscribeSupportedLanguage.ts index 839d6448..8f7d582e 100644 --- a/src/api/types/TranscribeSupportedLanguage.ts +++ b/src/api/types/TranscribeSupportedLanguage.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Supported language codes for transcription diff --git a/src/api/types/TranscribeTranscriptData.ts b/src/api/types/TranscribeTranscriptData.ts index 45bfbb5a..be3aa39a 100644 --- a/src/api/types/TranscribeTranscriptData.ts +++ b/src/api/types/TranscribeTranscriptData.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface TranscribeTranscriptData { /** Transcript segment with punctuations applied and command phrases removed */ diff --git a/src/api/types/TranscribeTranscriptMessage.ts b/src/api/types/TranscribeTranscriptMessage.ts index 62bec432..eecc7bb6 100644 --- a/src/api/types/TranscribeTranscriptMessage.ts +++ b/src/api/types/TranscribeTranscriptMessage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscribeTranscriptMessage { - type: "transcript"; + type: Corti.TranscribeTranscriptMessageType; data: Corti.TranscribeTranscriptData; } diff --git a/src/api/types/TranscribeTranscriptMessageType.ts b/src/api/types/TranscribeTranscriptMessageType.ts new file mode 100644 index 00000000..aa02c2b4 --- /dev/null +++ b/src/api/types/TranscribeTranscriptMessageType.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export const TranscribeTranscriptMessageType = { + Transcript: "transcript", +} as const; +export type TranscribeTranscriptMessageType = + (typeof TranscribeTranscriptMessageType)[keyof typeof TranscribeTranscriptMessageType]; diff --git a/src/api/types/TranscribeUsageMessage.ts b/src/api/types/TranscribeUsageMessage.ts index a3649c3d..300e7623 100644 --- a/src/api/types/TranscribeUsageMessage.ts +++ b/src/api/types/TranscribeUsageMessage.ts @@ -1,9 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; export interface TranscribeUsageMessage { - type: "usage"; + type: Corti.TranscribeUsageMessageType; /** The amount of credits used for this stream. */ credits: number; } diff --git a/src/api/types/TranscribeUsageMessageType.ts b/src/api/types/TranscribeUsageMessageType.ts new file mode 100644 index 00000000..cc765cc1 --- /dev/null +++ b/src/api/types/TranscribeUsageMessageType.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export const TranscribeUsageMessageType = { + Usage: "usage", +} as const; +export type TranscribeUsageMessageType = (typeof TranscribeUsageMessageType)[keyof typeof TranscribeUsageMessageType]; diff --git a/src/api/types/TranscriptsData.ts b/src/api/types/TranscriptsData.ts index 679c9ced..1d4dafe9 100644 --- a/src/api/types/TranscriptsData.ts +++ b/src/api/types/TranscriptsData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscriptsData { /** Additional information about the participants involved in the transcript. */ diff --git a/src/api/types/TranscriptsListItem.ts b/src/api/types/TranscriptsListItem.ts index eaaf84b9..f45d67b7 100644 --- a/src/api/types/TranscriptsListItem.ts +++ b/src/api/types/TranscriptsListItem.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscriptsListItem { /** The unique identifier of the transcript. */ diff --git a/src/api/types/TranscriptsListResponse.ts b/src/api/types/TranscriptsListResponse.ts index fc99e04a..1e7b8412 100644 --- a/src/api/types/TranscriptsListResponse.ts +++ b/src/api/types/TranscriptsListResponse.ts @@ -1,9 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscriptsListResponse { - transcripts?: Corti.TranscriptsListItem[] | null; + transcripts: Corti.TranscriptsListItem[] | null; } diff --git a/src/api/types/TranscriptsMetadata.ts b/src/api/types/TranscriptsMetadata.ts index 85f705bf..750e2153 100644 --- a/src/api/types/TranscriptsMetadata.ts +++ b/src/api/types/TranscriptsMetadata.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscriptsMetadata { participantsRoles?: Corti.TranscriptsParticipant[] | null; diff --git a/src/api/types/TranscriptsParticipant.ts b/src/api/types/TranscriptsParticipant.ts index e93d6f8b..6cfa4654 100644 --- a/src/api/types/TranscriptsParticipant.ts +++ b/src/api/types/TranscriptsParticipant.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscriptsParticipant { /** The audio channel to associate with a participant role. */ diff --git a/src/api/types/TranscriptsParticipantRoleEnum.ts b/src/api/types/TranscriptsParticipantRoleEnum.ts index f64ffa23..677b2305 100644 --- a/src/api/types/TranscriptsParticipantRoleEnum.ts +++ b/src/api/types/TranscriptsParticipantRoleEnum.ts @@ -1,10 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -export type TranscriptsParticipantRoleEnum = "doctor" | "patient" | "multiple"; export const TranscriptsParticipantRoleEnum = { Doctor: "doctor", Patient: "patient", Multiple: "multiple", } as const; +export type TranscriptsParticipantRoleEnum = + (typeof TranscriptsParticipantRoleEnum)[keyof typeof TranscriptsParticipantRoleEnum]; diff --git a/src/api/types/TranscriptsResponse.ts b/src/api/types/TranscriptsResponse.ts index 968063d3..122cf417 100644 --- a/src/api/types/TranscriptsResponse.ts +++ b/src/api/types/TranscriptsResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscriptsResponse { /** The unique identifier of the transcript. */ @@ -10,7 +8,7 @@ export interface TranscriptsResponse { /** Additional information about the participants involved in the transcript. */ metadata: Corti.TranscriptsMetadata; /** An array of transcripts. */ - transcripts?: Corti.CommonTranscriptResponse[] | null; + transcripts: Corti.CommonTranscriptResponse[] | null; usageInfo: Corti.CommonUsageInfo; /** The unique identifier for the associated recording. */ recordingId: Corti.Uuid; diff --git a/src/api/types/TranscriptsStatusEnum.ts b/src/api/types/TranscriptsStatusEnum.ts index b6249578..f43dff9f 100644 --- a/src/api/types/TranscriptsStatusEnum.ts +++ b/src/api/types/TranscriptsStatusEnum.ts @@ -1,13 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Possible values for transcript processing status. - */ -export type TranscriptsStatusEnum = "completed" | "processing" | "failed"; +/** Possible values for transcript processing status. */ export const TranscriptsStatusEnum = { Completed: "completed", Processing: "processing", Failed: "failed", } as const; +export type TranscriptsStatusEnum = (typeof TranscriptsStatusEnum)[keyof typeof TranscriptsStatusEnum]; diff --git a/src/api/types/TranscriptsStatusResponse.ts b/src/api/types/TranscriptsStatusResponse.ts index 84c982a3..ca349972 100644 --- a/src/api/types/TranscriptsStatusResponse.ts +++ b/src/api/types/TranscriptsStatusResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Corti from "../index.js"; +import type * as Corti from "../index.js"; export interface TranscriptsStatusResponse { /** The current status of the transcript processing. */ diff --git a/src/api/types/Uuid.ts b/src/api/types/Uuid.ts index 5412d87a..e33bd68e 100644 --- a/src/api/types/Uuid.ts +++ b/src/api/types/Uuid.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type Uuid = string; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index f52afcf8..e5a292a5 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,168 +1,202 @@ +export * from "./AgentsAgent.js"; +export * from "./AgentsAgentCapabilities.js"; +export * from "./AgentsAgentCard.js"; +export * from "./AgentsAgentCardSignature.js"; +export * from "./AgentsAgentExpertsItem.js"; +export * from "./AgentsAgentExtension.js"; +export * from "./AgentsAgentInterface.js"; +export * from "./AgentsAgentProvider.js"; +export * from "./AgentsAgentReference.js"; +export * from "./AgentsAgentReferenceType.js"; +export * from "./AgentsAgentResponse.js"; +export * from "./AgentsAgentSkill.js"; +export * from "./AgentsArtifact.js"; +export * from "./AgentsContext.js"; +export * from "./AgentsContextItemsItem.js"; +export * from "./AgentsCreateExpert.js"; +export * from "./AgentsCreateExpertReference.js"; +export * from "./AgentsCreateExpertReferenceType.js"; +export * from "./AgentsCreateExpertType.js"; +export * from "./AgentsCreateMcpServer.js"; +export * from "./AgentsCreateMcpServerAuthorizationType.js"; +export * from "./AgentsCreateMcpServerTransportType.js"; +export * from "./AgentsDataPart.js"; +export * from "./AgentsDataPartKind.js"; +export * from "./AgentsExpert.js"; +export * from "./AgentsExpertReference.js"; +export * from "./AgentsExpertReferenceType.js"; +export * from "./AgentsExpertType.js"; +export * from "./AgentsFilePart.js"; +export * from "./AgentsFilePartFile.js"; +export * from "./AgentsFilePartKind.js"; +export * from "./AgentsFileWithBytes.js"; +export * from "./AgentsFileWithUri.js"; +export * from "./AgentsMcpServer.js"; +export * from "./AgentsMcpServerAuthorizationType.js"; +export * from "./AgentsMcpServerTransportType.js"; +export * from "./AgentsMessage.js"; +export * from "./AgentsMessageKind.js"; +export * from "./AgentsMessageRole.js"; +export * from "./AgentsMessageSendConfiguration.js"; +export * from "./AgentsPart.js"; +export * from "./AgentsPushNotificationAuthenticationInfo.js"; +export * from "./AgentsPushNotificationConfig.js"; +export * from "./AgentsRegistryExpert.js"; +export * from "./AgentsRegistryExpertsResponse.js"; +export * from "./AgentsRegistryMcpServer.js"; +export * from "./AgentsRegistryMcpServerAuthorizationType.js"; +export * from "./AgentsTask.js"; +export * from "./AgentsTaskKind.js"; +export * from "./AgentsTaskStatus.js"; +export * from "./AgentsTaskStatusState.js"; +export * from "./AgentsTextPart.js"; +export * from "./AgentsTextPartKind.js"; +export * from "./CodesGeneralReadResponse.js"; +export * from "./CodesGeneralReadResponseEvidencesItem.js"; +export * from "./CodesGeneralResponse.js"; +export * from "./CommonAiContext.js"; export * from "./CommonCodingSystemEnum.js"; +export * from "./CommonDocumentIdContext.js"; +export * from "./CommonDocumentIdContextType.js"; +export * from "./CommonSortingDirectionEnum.js"; +export * from "./CommonSourceEnum.js"; +export * from "./CommonTextContext.js"; +export * from "./CommonTextContextType.js"; +export * from "./CommonTranscriptRequest.js"; +export * from "./CommonTranscriptResponse.js"; +export * from "./CommonUsageInfo.js"; export * from "./DocumentsContext.js"; export * from "./DocumentsContextWithFacts.js"; -export * from "./DocumentsContextWithTranscript.js"; +export * from "./DocumentsContextWithFactsType.js"; export * from "./DocumentsContextWithString.js"; +export * from "./DocumentsContextWithStringType.js"; +export * from "./DocumentsContextWithTranscript.js"; +export * from "./DocumentsContextWithTranscriptType.js"; +export * from "./DocumentsCreateRequest.js"; +export * from "./DocumentsCreateRequestWithTemplate.js"; +export * from "./DocumentsCreateRequestWithTemplateKey.js"; +export * from "./DocumentsGetResponse.js"; +export * from "./DocumentsListResponse.js"; export * from "./DocumentsSection.js"; +export * from "./DocumentsSectionInput.js"; export * from "./DocumentsSectionOverride.js"; export * from "./DocumentsTemplate.js"; export * from "./DocumentsTemplateWithSectionKeys.js"; export * from "./DocumentsTemplateWithSections.js"; -export * from "./InteractionsEncounterCreateRequest.js"; -export * from "./InteractionsEncounterUpdateRequest.js"; -export * from "./InteractionsEncounterResponse.js"; -export * from "./InteractionsEncounterPeriod.js"; export * from "./ErrorResponse.js"; +export * from "./FactsBatchUpdateInput.js"; +export * from "./FactsBatchUpdateItem.js"; +export * from "./FactsBatchUpdateResponse.js"; export * from "./FactsContext.js"; -export * from "./FactsFactGroupsItemTranslationsItem.js"; -export * from "./FactsFactGroupsItem.js"; -export * from "./InteractionsPatient.js"; -export * from "./DocumentsCreateRequest.js"; -export * from "./DocumentsCreateRequestWithTemplateKey.js"; -export * from "./DocumentsCreateRequestWithTemplate.js"; -export * from "./DocumentsSectionInput.js"; -export * from "./CommonDocumentIdContext.js"; -export * from "./CommonTextContext.js"; -export * from "./CommonAiContext.js"; export * from "./FactsCreateInput.js"; -export * from "./FactsBatchUpdateInput.js"; -export * from "./TranscriptsParticipant.js"; -export * from "./TemplatesSectionListResponse.js"; -export * from "./TemplatesListResponse.js"; -export * from "./DocumentsListResponse.js"; -export * from "./DocumentsGetResponse.js"; -export * from "./FactsListItem.js"; export * from "./FactsCreateItem.js"; +export * from "./FactsCreateResponse.js"; export * from "./FactsEvidence.js"; +export * from "./FactsExtractResponse.js"; +export * from "./FactsExtractResponseFactsItem.js"; +export * from "./FactsFactGroupsItem.js"; +export * from "./FactsFactGroupsItemTranslationsItem.js"; export * from "./FactsFactGroupsListResponse.js"; -export * from "./FactsUpdateResponse.js"; -export * from "./FactsCreateResponse.js"; +export * from "./FactsListItem.js"; export * from "./FactsListResponse.js"; -export * from "./FactsBatchUpdateResponse.js"; -export * from "./FactsBatchUpdateItem.js"; -export * from "./CodesGeneralResponse.js"; -export * from "./CodesGeneralReadResponseEvidencesItem.js"; -export * from "./CodesGeneralReadResponse.js"; -export * from "./FactsExtractResponseFactsItem.js"; -export * from "./FactsExtractResponse.js"; -export * from "./InteractionsGetResponse.js"; +export * from "./FactsUpdateResponse.js"; export * from "./InteractionsCreateResponse.js"; -export * from "./InteractionsListResponse.js"; -export * from "./TranscriptsMetadata.js"; -export * from "./RecordingsCreateResponse.js"; -export * from "./RecordingsListResponse.js"; -export * from "./TranscriptsResponse.js"; -export * from "./TranscriptsListResponse.js"; -export * from "./TranscriptsListItem.js"; -export * from "./TranscriptsData.js"; -export * from "./TranscriptsStatusResponse.js"; -export * from "./TranscriptsStatusEnum.js"; -export * from "./TemplatesSection.js"; -export * from "./CommonSortingDirectionEnum.js"; -export * from "./TemplatesDocumentationModeEnum.js"; -export * from "./TemplatesItem.js"; -export * from "./TemplatesSectionSorted.js"; -export * from "./CommonTranscriptRequest.js"; -export * from "./CommonTranscriptResponse.js"; -export * from "./Uuid.js"; -export * from "./CommonUsageInfo.js"; +export * from "./InteractionsEncounterCreateRequest.js"; +export * from "./InteractionsEncounterPeriod.js"; +export * from "./InteractionsEncounterResponse.js"; export * from "./InteractionsEncounterStatusEnum.js"; export * from "./InteractionsEncounterTypeEnum.js"; +export * from "./InteractionsEncounterUpdateRequest.js"; export * from "./InteractionsGenderEnum.js"; -export * from "./CommonSourceEnum.js"; -export * from "./TranscriptsParticipantRoleEnum.js"; -export * from "./TemplatesWritingStyle.js"; -export * from "./TemplatesFormatRule.js"; -export * from "./TemplatesSectionTranslation.js"; -export * from "./TemplatesTranslation.js"; -export * from "./StreamConfigMessage.js"; +export * from "./InteractionsGetResponse.js"; +export * from "./InteractionsListResponse.js"; +export * from "./InteractionsPatient.js"; +export * from "./RecordingsCreateResponse.js"; +export * from "./RecordingsListResponse.js"; export * from "./StreamConfig.js"; -export * from "./StreamConfigTranscription.js"; -export * from "./StreamConfigModeType.js"; +export * from "./StreamConfigMessage.js"; +export * from "./StreamConfigMessageType.js"; export * from "./StreamConfigMode.js"; -export * from "./StreamConfigStatusMessageType.js"; +export * from "./StreamConfigModeType.js"; +export * from "./StreamConfigParticipant.js"; +export * from "./StreamConfigParticipantRole.js"; export * from "./StreamConfigStatusMessage.js"; +export * from "./StreamConfigStatusMessageType.js"; +export * from "./StreamConfigTranscription.js"; export * from "./StreamEndedMessage.js"; -export * from "./StreamFlushedMessage.js"; -export * from "./StreamUsageMessage.js"; -export * from "./StreamErrorMessage.js"; +export * from "./StreamEndedMessageType.js"; +export * from "./StreamEndMessage.js"; +export * from "./StreamEndMessageType.js"; export * from "./StreamErrorDetail.js"; -export * from "./StreamTranscriptMessage.js"; -export * from "./StreamTranscript.js"; -export * from "./StreamParticipant.js"; -export * from "./StreamConfigParticipantRole.js"; -export * from "./StreamConfigParticipant.js"; -export * from "./StreamTranscriptTime.js"; -export * from "./StreamFactsMessage.js"; +export * from "./StreamErrorMessage.js"; +export * from "./StreamErrorMessageType.js"; export * from "./StreamFact.js"; -export * from "./StreamEndMessage.js"; +export * from "./StreamFactsMessage.js"; +export * from "./StreamFactsMessageType.js"; +export * from "./StreamFlushedMessage.js"; +export * from "./StreamFlushedMessageType.js"; export * from "./StreamFlushMessage.js"; +export * from "./StreamFlushMessageType.js"; +export * from "./StreamParticipant.js"; export * from "./StreamSupportedLanguage.js"; -export * from "./TranscribeSupportedLanguage.js"; -export * from "./TranscribeConfig.js"; -export * from "./TranscribeConfigMessage.js"; +export * from "./StreamTranscript.js"; +export * from "./StreamTranscriptMessage.js"; +export * from "./StreamTranscriptMessageType.js"; +export * from "./StreamTranscriptTime.js"; +export * from "./StreamUsageMessage.js"; +export * from "./StreamUsageMessageType.js"; +export * from "./TemplatesDocumentationModeEnum.js"; +export * from "./TemplatesFormatRule.js"; +export * from "./TemplatesItem.js"; +export * from "./TemplatesListResponse.js"; +export * from "./TemplatesSection.js"; +export * from "./TemplatesSectionListResponse.js"; +export * from "./TemplatesSectionSorted.js"; +export * from "./TemplatesSectionTranslation.js"; +export * from "./TemplatesTranslation.js"; +export * from "./TemplatesWritingStyle.js"; export * from "./TranscribeCommand.js"; +export * from "./TranscribeCommandData.js"; +export * from "./TranscribeCommandMessage.js"; +export * from "./TranscribeCommandMessageType.js"; export * from "./TranscribeCommandVariable.js"; -export * from "./TranscribeConfigStatusMessageType.js"; +export * from "./TranscribeCommandVariableType.js"; +export * from "./TranscribeConfig.js"; +export * from "./TranscribeConfigMessage.js"; +export * from "./TranscribeConfigMessageType.js"; export * from "./TranscribeConfigStatusMessage.js"; -export * from "./TranscribeEndMessage.js"; -export * from "./TranscribeFlushMessage.js"; -export * from "./TranscribeUsageMessage.js"; +export * from "./TranscribeConfigStatusMessageType.js"; export * from "./TranscribeEndedMessage.js"; -export * from "./TranscribeFlushedMessage.js"; -export * from "./TranscribeErrorMessageError.js"; +export * from "./TranscribeEndedMessageType.js"; +export * from "./TranscribeEndMessage.js"; +export * from "./TranscribeEndMessageType.js"; export * from "./TranscribeErrorMessage.js"; -export * from "./TranscribeTranscriptData.js"; -export * from "./TranscribeCommandData.js"; -export * from "./TranscribeTranscriptMessage.js"; -export * from "./TranscribeCommandMessage.js"; +export * from "./TranscribeErrorMessageError.js"; +export * from "./TranscribeErrorMessageType.js"; +export * from "./TranscribeFlushedMessage.js"; +export * from "./TranscribeFlushedMessageType.js"; +export * from "./TranscribeFlushMessage.js"; +export * from "./TranscribeFlushMessageType.js"; +export * from "./TranscribeFormatting.js"; export * from "./TranscribeFormattingDates.js"; -export * from "./TranscribeFormattingTimes.js"; -export * from "./TranscribeFormattingNumbers.js"; export * from "./TranscribeFormattingMeasurements.js"; +export * from "./TranscribeFormattingNumbers.js"; export * from "./TranscribeFormattingNumericRanges.js"; export * from "./TranscribeFormattingOrdinals.js"; -export * from "./TranscribeFormatting.js"; -export * from "./AgentsTaskStatusState.js"; -export * from "./AgentsTaskStatus.js"; -export * from "./AgentsTextPart.js"; -export * from "./AgentsFileWithUri.js"; -export * from "./AgentsFileWithBytes.js"; -export * from "./AgentsFilePartFile.js"; -export * from "./AgentsFilePart.js"; -export * from "./AgentsDataPart.js"; -export * from "./AgentsPart.js"; -export * from "./AgentsMessageRole.js"; -export * from "./AgentsMessage.js"; -export * from "./AgentsArtifact.js"; -export * from "./AgentsTask.js"; -export * from "./AgentsPushNotificationAuthenticationInfo.js"; -export * from "./AgentsPushNotificationConfig.js"; -export * from "./AgentsMessageSendConfiguration.js"; -export * from "./AgentsCreateMcpServerTransportType.js"; -export * from "./AgentsCreateMcpServerAuthorizationType.js"; -export * from "./AgentsCreateMcpServer.js"; -export * from "./AgentsMcpServerTransportType.js"; -export * from "./AgentsMcpServerAuthorizationType.js"; -export * from "./AgentsMcpServer.js"; -export * from "./AgentsRegistryMcpServerAuthorizationType.js"; -export * from "./AgentsRegistryMcpServer.js"; -export * from "./AgentsAgentExpertsItem.js"; -export * from "./AgentsAgent.js"; -export * from "./AgentsAgentReference.js"; -export * from "./AgentsCreateExpert.js"; -export * from "./AgentsCreateExpertReference.js"; -export * from "./AgentsExpert.js"; -export * from "./AgentsExpertReference.js"; -export * from "./AgentsAgentResponse.js"; -export * from "./AgentsAgentInterface.js"; -export * from "./AgentsAgentProvider.js"; -export * from "./AgentsAgentCapabilities.js"; -export * from "./AgentsAgentExtension.js"; -export * from "./AgentsAgentSkill.js"; -export * from "./AgentsAgentCardSignature.js"; -export * from "./AgentsAgentCard.js"; -export * from "./AgentsContextItemsItem.js"; -export * from "./AgentsContext.js"; -export * from "./AgentsRegistryExpert.js"; -export * from "./AgentsRegistryExpertsResponse.js"; +export * from "./TranscribeFormattingTimes.js"; +export * from "./TranscribeSupportedLanguage.js"; +export * from "./TranscribeTranscriptData.js"; +export * from "./TranscribeTranscriptMessage.js"; +export * from "./TranscribeTranscriptMessageType.js"; +export * from "./TranscribeUsageMessage.js"; +export * from "./TranscribeUsageMessageType.js"; +export * from "./TranscriptsData.js"; +export * from "./TranscriptsListItem.js"; +export * from "./TranscriptsListResponse.js"; +export * from "./TranscriptsMetadata.js"; +export * from "./TranscriptsParticipant.js"; +export * from "./TranscriptsParticipantRoleEnum.js"; +export * from "./TranscriptsResponse.js"; +export * from "./TranscriptsStatusEnum.js"; +export * from "./TranscriptsStatusResponse.js"; +export * from "./Uuid.js"; diff --git a/src/auth/BearerAuthProvider.ts b/src/auth/BearerAuthProvider.ts new file mode 100644 index 00000000..996587c5 --- /dev/null +++ b/src/auth/BearerAuthProvider.ts @@ -0,0 +1,47 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as core from "../core/index.js"; +import * as errors from "../errors/index.js"; + +const TOKEN_PARAM = "token" as const; + +export class BearerAuthProvider implements core.AuthProvider { + private readonly options: BearerAuthProvider.Options; + + constructor(options: BearerAuthProvider.Options) { + this.options = options; + } + + public static canCreate(options: Partial): boolean { + return options?.[TOKEN_PARAM] != null; + } + + public async getAuthRequest({ + endpointMetadata, + }: { + endpointMetadata?: core.EndpointMetadata; + } = {}): Promise { + const token = await core.Supplier.get(this.options[TOKEN_PARAM]); + if (token == null) { + throw new errors.CortiError({ + message: BearerAuthProvider.AUTH_CONFIG_ERROR_MESSAGE, + }); + } + + return { + headers: { Authorization: `Bearer ${token}` }, + }; + } +} + +export namespace BearerAuthProvider { + export const AUTH_SCHEME = "bearer-token" as const; + export const AUTH_CONFIG_ERROR_MESSAGE: string = + `Please provide '${TOKEN_PARAM}' when initializing the client` as const; + export type Options = AuthOptions; + export type AuthOptions = { [TOKEN_PARAM]: core.Supplier }; + + export function createInstance(options: Options): core.AuthProvider { + return new BearerAuthProvider(options); + } +} diff --git a/src/auth/index.ts b/src/auth/index.ts new file mode 100644 index 00000000..0ecb12b7 --- /dev/null +++ b/src/auth/index.ts @@ -0,0 +1 @@ +export { BearerAuthProvider } from "./BearerAuthProvider.js"; diff --git a/src/core/auth/AuthProvider.ts b/src/core/auth/AuthProvider.ts new file mode 100644 index 00000000..895a50ff --- /dev/null +++ b/src/core/auth/AuthProvider.ts @@ -0,0 +1,6 @@ +import type { EndpointMetadata } from "../fetcher/EndpointMetadata.js"; +import type { AuthRequest } from "./AuthRequest.js"; + +export interface AuthProvider { + getAuthRequest(arg?: { endpointMetadata?: EndpointMetadata }): Promise; +} diff --git a/src/core/auth/AuthRequest.ts b/src/core/auth/AuthRequest.ts new file mode 100644 index 00000000..f6218b42 --- /dev/null +++ b/src/core/auth/AuthRequest.ts @@ -0,0 +1,9 @@ +/** + * Request parameters for authentication requests. + */ +export interface AuthRequest { + /** + * The headers to be included in the request. + */ + headers: Record; +} diff --git a/src/core/auth/BasicAuth.ts b/src/core/auth/BasicAuth.ts index 1c0d8835..a6423591 100644 --- a/src/core/auth/BasicAuth.ts +++ b/src/core/auth/BasicAuth.ts @@ -18,7 +18,8 @@ export const BasicAuth = { fromAuthorizationHeader: (header: string): BasicAuth => { const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, ""); const decoded = base64Decode(credentials); - const [username, password] = decoded.split(":", 2); + const [username, ...passwordParts] = decoded.split(":"); + const password = passwordParts.length > 0 ? passwordParts.join(":") : undefined; if (username == null || password == null) { throw new Error("Invalid basic auth"); diff --git a/src/core/auth/BearerToken.ts b/src/core/auth/BearerToken.ts index fe987fc9..c44a06c3 100644 --- a/src/core/auth/BearerToken.ts +++ b/src/core/auth/BearerToken.ts @@ -2,13 +2,18 @@ export type BearerToken = string; const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i; -export const BearerToken = { - toAuthorizationHeader: (token: BearerToken | undefined): string | undefined => { - if (token == null) { - return undefined; - } - return `Bearer ${token}`; - }, +function toAuthorizationHeader(token: string | undefined): string | undefined { + if (token == null) { + return undefined; + } + return `Bearer ${token}`; +} + +export const BearerToken: { + toAuthorizationHeader: typeof toAuthorizationHeader; + fromAuthorizationHeader: (header: string) => BearerToken; +} = { + toAuthorizationHeader: toAuthorizationHeader, fromAuthorizationHeader: (header: string): BearerToken => { return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim() as BearerToken; }, diff --git a/src/core/auth/NoOpAuthProvider.ts b/src/core/auth/NoOpAuthProvider.ts new file mode 100644 index 00000000..5b7acfd2 --- /dev/null +++ b/src/core/auth/NoOpAuthProvider.ts @@ -0,0 +1,8 @@ +import type { AuthProvider } from "./AuthProvider.js"; +import type { AuthRequest } from "./AuthRequest.js"; + +export class NoOpAuthProvider implements AuthProvider { + public getAuthRequest(): Promise { + return Promise.resolve({ headers: {} }); + } +} diff --git a/src/core/auth/OAuthTokenProvider.ts b/src/core/auth/OAuthTokenProvider.ts deleted file mode 100644 index 88cae0be..00000000 --- a/src/core/auth/OAuthTokenProvider.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as core from "../../core/index.js"; -import { Auth } from "../../api/resources/auth/client/Client.js"; - -/** - * The OAuthTokenProvider retrieves an OAuth access token, refreshing it as needed. - * The access token is then used as the bearer token in every authenticated request. - */ -export class OAuthTokenProvider { - private readonly BUFFER_IN_MINUTES = 2; - private readonly _clientId: core.Supplier; - private readonly _clientSecret: core.Supplier; - private readonly _authClient: Auth; - private _accessToken: string | undefined; - private _expiresAt: Date; - - constructor({ - clientId, - clientSecret, - authClient, - }: { - clientId: core.Supplier; - clientSecret: core.Supplier; - authClient: Auth; - }) { - this._clientId = clientId; - this._clientSecret = clientSecret; - this._authClient = authClient; - this._expiresAt = new Date(); - } - - public async getToken(): Promise { - if (this._accessToken && this._expiresAt > new Date()) { - return this._accessToken; - } - return this.refresh(); - } - - private async refresh(): Promise { - const tokenResponse = await this._authClient.getToken({ - clientId: await core.Supplier.get(this._clientId), - clientSecret: await core.Supplier.get(this._clientSecret), - }); - - this._accessToken = tokenResponse.accessToken; - this._expiresAt = this.getExpiresAt(tokenResponse.expiresIn, this.BUFFER_IN_MINUTES); - return this._accessToken; - } - - private getExpiresAt(expiresInSeconds: number, bufferInMinutes: number): Date { - const now = new Date(); - return new Date(now.getTime() + expiresInSeconds * 1000 - bufferInMinutes * 60 * 1000); - } -} diff --git a/src/core/auth/index.ts b/src/core/auth/index.ts index 1ec5eb4b..2215b227 100644 --- a/src/core/auth/index.ts +++ b/src/core/auth/index.ts @@ -1,3 +1,5 @@ +export type { AuthProvider } from "./AuthProvider.js"; +export type { AuthRequest } from "./AuthRequest.js"; export { BasicAuth } from "./BasicAuth.js"; export { BearerToken } from "./BearerToken.js"; -export { OAuthTokenProvider } from "./OAuthTokenProvider.js"; +export { NoOpAuthProvider } from "./NoOpAuthProvider.js"; diff --git a/src/core/exports.ts b/src/core/exports.ts index e415a8f6..3c60fd49 100644 --- a/src/core/exports.ts +++ b/src/core/exports.ts @@ -1 +1,4 @@ export * from "./file/exports.js"; +export * from "./logging/exports.js"; +export * from "./pagination/exports.js"; +export * from "./websocket/exports.js"; diff --git a/src/core/fetcher/APIResponse.ts b/src/core/fetcher/APIResponse.ts index dd4b9466..97ab83c2 100644 --- a/src/core/fetcher/APIResponse.ts +++ b/src/core/fetcher/APIResponse.ts @@ -1,4 +1,4 @@ -import { RawResponse } from "./RawResponse.js"; +import type { RawResponse } from "./RawResponse.js"; /** * The response of an API call. diff --git a/src/core/fetcher/BinaryResponse.ts b/src/core/fetcher/BinaryResponse.ts index 614cb59b..bca7f4c7 100644 --- a/src/core/fetcher/BinaryResponse.ts +++ b/src/core/fetcher/BinaryResponse.ts @@ -1,25 +1,23 @@ -import { ResponseWithBody } from "./ResponseWithBody.js"; - export type BinaryResponse = { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */ - bodyUsed: boolean; + bodyUsed: Response["bodyUsed"]; /** * Returns a ReadableStream of the response body. * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */ - stream: () => ReadableStream; + stream: () => Response["body"]; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */ - arrayBuffer: () => Promise; + arrayBuffer: () => ReturnType; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */ - blob: () => Promise; + blob: () => ReturnType; /** * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) * Some versions of the Fetch API may not support this method. */ - bytes?(): Promise; + bytes?(): ReturnType; }; -export function getBinaryResponse(response: ResponseWithBody): BinaryResponse { +export function getBinaryResponse(response: Response): BinaryResponse { const binaryResponse: BinaryResponse = { get bodyUsed() { return response.bodyUsed; diff --git a/src/core/fetcher/EndpointMetadata.ts b/src/core/fetcher/EndpointMetadata.ts new file mode 100644 index 00000000..998d68f5 --- /dev/null +++ b/src/core/fetcher/EndpointMetadata.ts @@ -0,0 +1,13 @@ +export type SecuritySchemeKey = string; +/** + * A collection of security schemes, where the key is the name of the security scheme and the value is the list of scopes required for that scheme. + * All schemes in the collection must be satisfied for authentication to be successful. + */ +export type SecuritySchemeCollection = Record; +export type AuthScope = string; +export type EndpointMetadata = { + /** + * An array of security scheme collections. Each collection represents an alternative way to authenticate. + */ + security?: SecuritySchemeCollection[]; +}; diff --git a/src/core/fetcher/EndpointSupplier.ts b/src/core/fetcher/EndpointSupplier.ts new file mode 100644 index 00000000..aad81f0d --- /dev/null +++ b/src/core/fetcher/EndpointSupplier.ts @@ -0,0 +1,14 @@ +import type { EndpointMetadata } from "./EndpointMetadata.js"; +import type { Supplier } from "./Supplier.js"; + +type EndpointSupplierFn = (arg: { endpointMetadata?: EndpointMetadata }) => T | Promise; +export type EndpointSupplier = Supplier | EndpointSupplierFn; +export const EndpointSupplier = { + get: async (supplier: EndpointSupplier, arg: { endpointMetadata?: EndpointMetadata }): Promise => { + if (typeof supplier === "function") { + return (supplier as EndpointSupplierFn)(arg); + } else { + return supplier; + } + }, +}; diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index 14c61917..5e5058a9 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -1,19 +1,17 @@ -/** - * Patch: respect CortiClient withCredentials. When args.withCredentials is undefined, - * use the global default set by CortiClient (see src/custom/withCredentialsConfig.ts). - */ import { toJson } from "../json.js"; -import { APIResponse } from "./APIResponse.js"; -import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; -import { Supplier } from "./Supplier.js"; +import { createLogger, type LogConfig, type Logger } from "../logging/logger.js"; +import type { APIResponse } from "./APIResponse.js"; import { createRequestUrl } from "./createRequestUrl.js"; +import type { EndpointMetadata } from "./EndpointMetadata.js"; +import { EndpointSupplier } from "./EndpointSupplier.js"; import { getErrorResponseBody } from "./getErrorResponseBody.js"; import { getFetchFn } from "./getFetchFn.js"; import { getRequestBody } from "./getRequestBody.js"; import { getResponseBody } from "./getResponseBody.js"; +import { Headers } from "./Headers.js"; import { makeRequest } from "./makeRequest.js"; +import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; import { requestWithRetries } from "./requestWithRetries.js"; -import { getDefaultWithCredentials } from "../../custom/utils/withCredentialsConfig.js"; export type FetchFunction = (args: Fetcher.Args) => Promise>; @@ -22,19 +20,22 @@ export declare namespace Fetcher { url: string; method: string; contentType?: string; - headers?: Record | undefined>; - queryParameters?: Record; + headers?: Record; + queryParameters?: Record; body?: unknown; timeoutMs?: number; maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; - requestType?: "json" | "file" | "bytes"; + requestType?: "json" | "file" | "bytes" | "form" | "other"; responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer" | "binary-response"; duplex?: "half"; + endpointMetadata?: EndpointMetadata; + fetchFn?: typeof fetch; + logging?: LogConfig | Logger; } - export type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError; + export type Error = FailedStatusCodeError | NonJsonError | BodyIsNullError | TimeoutError | UnknownError; export interface FailedStatusCodeError { reason: "status-code"; @@ -48,6 +49,11 @@ export declare namespace Fetcher { rawBody: string; } + export interface BodyIsNullError { + reason: "body-is-null"; + statusCode: number; + } + export interface TimeoutError { reason: "timeout"; } @@ -58,10 +64,170 @@ export declare namespace Fetcher { } } -async function getHeaders(args: Fetcher.Args): Promise> { - const newHeaders: Record = {}; +const SENSITIVE_HEADERS = new Set([ + "authorization", + "www-authenticate", + "x-api-key", + "api-key", + "apikey", + "x-api-token", + "x-auth-token", + "auth-token", + "cookie", + "set-cookie", + "proxy-authorization", + "proxy-authenticate", + "x-csrf-token", + "x-xsrf-token", + "x-session-token", + "x-access-token", +]); + +function redactHeaders(headers: Headers | Record): Record { + const filtered: Record = {}; + for (const [key, value] of headers instanceof Headers ? headers.entries() : Object.entries(headers)) { + if (SENSITIVE_HEADERS.has(key.toLowerCase())) { + filtered[key] = "[REDACTED]"; + } else { + filtered[key] = value; + } + } + return filtered; +} + +const SENSITIVE_QUERY_PARAMS = new Set([ + "api_key", + "api-key", + "apikey", + "token", + "access_token", + "access-token", + "auth_token", + "auth-token", + "password", + "passwd", + "secret", + "api_secret", + "api-secret", + "apisecret", + "key", + "session", + "session_id", + "session-id", +]); + +function redactQueryParameters(queryParameters?: Record): Record | undefined { + if (queryParameters == null) { + return queryParameters; + } + const redacted: Record = {}; + for (const [key, value] of Object.entries(queryParameters)) { + if (SENSITIVE_QUERY_PARAMS.has(key.toLowerCase())) { + redacted[key] = "[REDACTED]"; + } else { + redacted[key] = value; + } + } + return redacted; +} + +function redactUrl(url: string): string { + const protocolIndex = url.indexOf("://"); + if (protocolIndex === -1) return url; + + const afterProtocol = protocolIndex + 3; + + // Find the first delimiter that marks the end of the authority section + const pathStart = url.indexOf("/", afterProtocol); + let queryStart = url.indexOf("?", afterProtocol); + let fragmentStart = url.indexOf("#", afterProtocol); + + const firstDelimiter = Math.min( + pathStart === -1 ? url.length : pathStart, + queryStart === -1 ? url.length : queryStart, + fragmentStart === -1 ? url.length : fragmentStart, + ); + + // Find the LAST @ before the delimiter (handles multiple @ in credentials) + let atIndex = -1; + for (let i = afterProtocol; i < firstDelimiter; i++) { + if (url[i] === "@") { + atIndex = i; + } + } + + if (atIndex !== -1) { + url = `${url.slice(0, afterProtocol)}[REDACTED]@${url.slice(atIndex + 1)}`; + } + + // Recalculate queryStart since url might have changed + queryStart = url.indexOf("?"); + if (queryStart === -1) return url; + + fragmentStart = url.indexOf("#", queryStart); + const queryEnd = fragmentStart !== -1 ? fragmentStart : url.length; + const queryString = url.slice(queryStart + 1, queryEnd); + + if (queryString.length === 0) return url; + + // FAST PATH: Quick check if any sensitive keywords present + // Using indexOf is faster than regex for simple substring matching + const lower = queryString.toLowerCase(); + const hasSensitive = + lower.includes("token") || + lower.includes("key") || + lower.includes("password") || + lower.includes("passwd") || + lower.includes("secret") || + lower.includes("session") || + lower.includes("auth"); + + if (!hasSensitive) { + return url; + } + + // SLOW PATH: Parse and redact + const redactedParams: string[] = []; + const params = queryString.split("&"); + + for (const param of params) { + const equalIndex = param.indexOf("="); + if (equalIndex === -1) { + redactedParams.push(param); + continue; + } + + const key = param.slice(0, equalIndex); + let shouldRedact = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()); + + if (!shouldRedact && key.includes("%")) { + try { + const decodedKey = decodeURIComponent(key); + shouldRedact = SENSITIVE_QUERY_PARAMS.has(decodedKey.toLowerCase()); + } catch {} + } + + redactedParams.push(shouldRedact ? `${key}=[REDACTED]` : param); + } + + return url.slice(0, queryStart + 1) + redactedParams.join("&") + url.slice(queryEnd); +} + +async function getHeaders(args: Fetcher.Args): Promise { + const newHeaders: Headers = new Headers(); + + newHeaders.set( + "Accept", + args.responseType === "json" + ? "application/json" + : args.responseType === "text" + ? "text/plain" + : args.responseType === "sse" + ? "text/event-stream" + : "*/*", + ); if (args.body !== undefined && args.contentType != null) { - newHeaders["Content-Type"] = args.contentType; + newHeaders.set("Content-Type", args.contentType); } if (args.headers == null) { @@ -69,15 +235,15 @@ async function getHeaders(args: Fetcher.Args): Promise> { } for (const [key, value] of Object.entries(args.headers)) { - const result = await Supplier.get(value); + const result = await EndpointSupplier.get(value, { endpointMetadata: args.endpointMetadata ?? {} }); if (typeof result === "string") { - newHeaders[key] = result; + newHeaders.set(key, result); continue; } if (result == null) { continue; } - newHeaders[key] = `${result}`; + newHeaders.set(key, `${result}`); } return newHeaders; } @@ -86,9 +252,22 @@ export async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise= 200 && response.status < 400) { + if (logger.isDebug()) { + const metadata = { + method: args.method, + url: redactUrl(url), + statusCode: response.status, + responseHeaders: redactHeaders(response.headers), + }; + logger.debug("HTTP request succeeded", metadata); + } + const body = await getResponseBody(response, args.responseType); return { ok: true, - body: (await getResponseBody(response, args.responseType)) as R, + body: body as R, headers: response.headers, rawResponse: toRawResponse(response), }; } else { + if (logger.isError()) { + const metadata = { + method: args.method, + url: redactUrl(url), + statusCode: response.status, + responseHeaders: redactHeaders(Object.fromEntries(response.headers.entries())), + }; + logger.error("HTTP request failed with error status", metadata); + } return { ok: false, error: { @@ -126,7 +324,14 @@ export async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise; -}; - -export function isResponseWithBody(response: Response): response is ResponseWithBody { - return (response as ResponseWithBody).body != null; -} diff --git a/src/core/fetcher/getErrorResponseBody.ts b/src/core/fetcher/getErrorResponseBody.ts index 450424bd..7cf4e623 100644 --- a/src/core/fetcher/getErrorResponseBody.ts +++ b/src/core/fetcher/getErrorResponseBody.ts @@ -16,9 +16,10 @@ export async function getErrorResponseBody(response: Response): Promise case "application/ld+json": case "application/problem+json": case "application/vnd.api+json": - case "text/json": + case "text/json": { const text = await response.text(); return text.length > 0 ? fromJson(text) : undefined; + } default: if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) { const text = await response.text(); diff --git a/src/core/fetcher/getRequestBody.ts b/src/core/fetcher/getRequestBody.ts index e38457c5..91d9d81f 100644 --- a/src/core/fetcher/getRequestBody.ts +++ b/src/core/fetcher/getRequestBody.ts @@ -1,13 +1,17 @@ import { toJson } from "../json.js"; +import { toQueryString } from "../url/qs.js"; export declare namespace GetRequestBody { interface Args { body: unknown; - type: "json" | "file" | "bytes" | "other"; + type: "json" | "file" | "bytes" | "form" | "other"; } } export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type === "form") { + return toQueryString(body, { arrayFormat: "repeat", encode: true }); + } if (type.includes("json")) { return toJson(body); } else { diff --git a/src/core/fetcher/getResponseBody.ts b/src/core/fetcher/getResponseBody.ts index 7ca8b3d2..708d5572 100644 --- a/src/core/fetcher/getResponseBody.ts +++ b/src/core/fetcher/getResponseBody.ts @@ -1,11 +1,7 @@ -import { getBinaryResponse } from "./BinaryResponse.js"; -import { isResponseWithBody } from "./ResponseWithBody.js"; import { fromJson } from "../json.js"; +import { getBinaryResponse } from "./BinaryResponse.js"; export async function getResponseBody(response: Response, responseType?: string): Promise { - if (!isResponseWithBody(response)) { - return undefined; - } switch (responseType) { case "binary-response": return getBinaryResponse(response); @@ -14,8 +10,27 @@ export async function getResponseBody(response: Response, responseType?: string) case "arrayBuffer": return await response.arrayBuffer(); case "sse": + if (response.body == null) { + return { + ok: false, + error: { + reason: "body-is-null", + statusCode: response.status, + }, + }; + } return response.body; case "streaming": + if (response.body == null) { + return { + ok: false, + error: { + reason: "body-is-null", + statusCode: response.status, + }, + }; + } + return response.body; case "text": @@ -26,9 +41,9 @@ export async function getResponseBody(response: Response, responseType?: string) const text = await response.text(); if (text.length > 0) { try { - let responseBody = fromJson(text); + const responseBody = fromJson(text); return responseBody; - } catch (err) { + } catch (_err) { return { ok: false, error: { diff --git a/src/core/fetcher/index.ts b/src/core/fetcher/index.ts index 49e13932..c3bc6da2 100644 --- a/src/core/fetcher/index.ts +++ b/src/core/fetcher/index.ts @@ -1,9 +1,11 @@ export type { APIResponse } from "./APIResponse.js"; -export { fetcher } from "./Fetcher.js"; +export type { BinaryResponse } from "./BinaryResponse.js"; +export type { EndpointMetadata } from "./EndpointMetadata.js"; +export { EndpointSupplier } from "./EndpointSupplier.js"; export type { Fetcher, FetchFunction } from "./Fetcher.js"; +export { fetcher } from "./Fetcher.js"; export { getHeader } from "./getHeader.js"; -export { Supplier } from "./Supplier.js"; -export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; -export type { RawResponse, WithRawResponse } from "./RawResponse.js"; export { HttpResponsePromise } from "./HttpResponsePromise.js"; -export { BinaryResponse } from "./BinaryResponse.js"; +export type { RawResponse, WithRawResponse } from "./RawResponse.js"; +export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; +export { Supplier } from "./Supplier.js"; diff --git a/src/core/fetcher/makeRequest.ts b/src/core/fetcher/makeRequest.ts index 1a5ffd3c..921565eb 100644 --- a/src/core/fetcher/makeRequest.ts +++ b/src/core/fetcher/makeRequest.ts @@ -4,7 +4,7 @@ export const makeRequest = async ( fetchFn: (url: string, init: RequestInit) => Promise, url: string, method: string, - headers: Record, + headers: Headers | Record, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, @@ -13,19 +13,17 @@ export const makeRequest = async ( ): Promise => { const signals: AbortSignal[] = []; - // Add timeout signal - let timeoutAbortId: NodeJS.Timeout | undefined = undefined; + let timeoutAbortId: ReturnType | undefined; if (timeoutMs != null) { const { signal, abortId } = getTimeoutSignal(timeoutMs); timeoutAbortId = abortId; signals.push(signal); } - // Add arbitrary signal if (abortSignal != null) { signals.push(abortSignal); } - let newSignals = anySignal(signals); + const newSignals = anySignal(signals); const response = await fetchFn(url, { method: method, headers, diff --git a/src/core/fetcher/requestWithRetries.ts b/src/core/fetcher/requestWithRetries.ts index add3cce0..1f689688 100644 --- a/src/core/fetcher/requestWithRetries.ts +++ b/src/core/fetcher/requestWithRetries.ts @@ -3,12 +3,47 @@ const MAX_RETRY_DELAY = 60000; // in milliseconds const DEFAULT_MAX_RETRIES = 2; const JITTER_FACTOR = 0.2; // 20% random jitter -function addJitter(delay: number): number { - // Generate a random value between -JITTER_FACTOR and +JITTER_FACTOR - const jitterMultiplier = 1 + (Math.random() * 2 - 1) * JITTER_FACTOR; +function addPositiveJitter(delay: number): number { + const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR; return delay * jitterMultiplier; } +function addSymmetricJitter(delay: number): number { + const jitterMultiplier = 1 + (Math.random() - 0.5) * JITTER_FACTOR; + return delay * jitterMultiplier; +} + +function getRetryDelayFromHeaders(response: Response, retryAttempt: number): number { + const retryAfter = response.headers.get("Retry-After"); + if (retryAfter) { + const retryAfterSeconds = parseInt(retryAfter, 10); + if (!Number.isNaN(retryAfterSeconds) && retryAfterSeconds > 0) { + return Math.min(retryAfterSeconds * 1000, MAX_RETRY_DELAY); + } + + const retryAfterDate = new Date(retryAfter); + if (!Number.isNaN(retryAfterDate.getTime())) { + const delay = retryAfterDate.getTime() - Date.now(); + if (delay > 0) { + return Math.min(Math.max(delay, 0), MAX_RETRY_DELAY); + } + } + } + + const rateLimitReset = response.headers.get("X-RateLimit-Reset"); + if (rateLimitReset) { + const resetTime = parseInt(rateLimitReset, 10); + if (!Number.isNaN(resetTime)) { + const delay = resetTime * 1000 - Date.now(); + if (delay > 0) { + return addPositiveJitter(Math.min(delay, MAX_RETRY_DELAY)); + } + } + } + + return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * 2 ** retryAttempt, MAX_RETRY_DELAY)); +} + export async function requestWithRetries( requestFn: () => Promise, maxRetries: number = DEFAULT_MAX_RETRIES, @@ -17,13 +52,9 @@ export async function requestWithRetries( for (let i = 0; i < maxRetries; ++i) { if ([408, 429].includes(response.status) || response.status >= 500) { - // Calculate base delay using exponential backoff (in milliseconds) - const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY); - - // Add jitter to the delay - const delayWithJitter = addJitter(baseDelay); + const delay = getRetryDelayFromHeaders(response, i); - await new Promise((resolve) => setTimeout(resolve, delayWithJitter)); + await new Promise((resolve) => setTimeout(resolve, delay)); response = await requestFn(); } else { break; diff --git a/src/core/fetcher/signals.ts b/src/core/fetcher/signals.ts index a8d32a2e..7bd3757e 100644 --- a/src/core/fetcher/signals.ts +++ b/src/core/fetcher/signals.ts @@ -1,34 +1,22 @@ const TIMEOUT = "timeout"; -export function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abortId: NodeJS.Timeout } { +export function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abortId: ReturnType } { const controller = new AbortController(); const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs); return { signal: controller.signal, abortId }; } -/** - * Returns an abort signal that is getting aborted when - * at least one of the specified abort signals is aborted. - * - * Requires at least node.js 18. - */ export function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal { - // Allowing signals to be passed either as array - // of signals or as multiple arguments. const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args) as AbortSignal[]; const controller = new AbortController(); for (const signal of signals) { if (signal.aborted) { - // Exiting early if one of the signals - // is already aborted. controller.abort((signal as any)?.reason); break; } - // Listening for signals and removing the listeners - // when at least one symbol is aborted. signal.addEventListener("abort", () => controller.abort((signal as any)?.reason), { signal: controller.signal, }); diff --git a/src/core/file/exports.ts b/src/core/file/exports.ts index acda0367..3b0b3967 100644 --- a/src/core/file/exports.ts +++ b/src/core/file/exports.ts @@ -1 +1 @@ -export { Uploadable } from "./types.js"; +export type { Uploadable } from "./types.js"; diff --git a/src/core/file/file.ts b/src/core/file/file.ts index bc4b7e50..0bacc484 100644 --- a/src/core/file/file.ts +++ b/src/core/file/file.ts @@ -1,4 +1,4 @@ -import { Uploadable } from "./types.js"; +import type { Uploadable } from "./types.js"; export async function toBinaryUploadRequest( file: Uploadable, @@ -20,19 +20,40 @@ export async function toBinaryUploadRequest( return request; } -async function getFileWithMetadata(file: Uploadable): Promise { +export async function toMultipartDataPart( + file: Uploadable, +): Promise<{ data: Uploadable.FileLike; filename?: string; contentType?: string }> { + const { data, filename, contentType } = await getFileWithMetadata(file, { + noSniffFileSize: true, + }); + return { + data, + filename, + contentType, + }; +} + +async function getFileWithMetadata( + file: Uploadable, + { noSniffFileSize }: { noSniffFileSize?: boolean } = {}, +): Promise { if (isFileLike(file)) { - return getFileWithMetadata({ - data: file, - }); + return getFileWithMetadata( + { + data: file, + }, + { noSniffFileSize }, + ); } + if ("path" in file) { const fs = await import("fs"); if (!fs || !fs.createReadStream) { throw new Error("File path uploads are not supported in this environment."); } const data = fs.createReadStream(file.path); - const contentLength = file.contentLength ?? (await tryGetFileSizeFromPath(file.path)); + const contentLength = + file.contentLength ?? (noSniffFileSize === true ? undefined : await tryGetFileSizeFromPath(file.path)); const filename = file.filename ?? getNameFromPath(file.path); return { data, @@ -43,7 +64,11 @@ async function getFileWithMetadata(file: Uploadable): Promise } const fileStat = await fs.promises.stat(path); return fileStat.size; - } catch (fallbackError) { + } catch (_fallbackError) { return undefined; } } @@ -92,7 +117,10 @@ function tryGetNameFromFileLike(data: Uploadable.FileLike): string | undefined { return undefined; } -async function tryGetContentLengthFromFileLike(data: Uploadable.FileLike): Promise { +async function tryGetContentLengthFromFileLike( + data: Uploadable.FileLike, + { noSniffFileSize }: { noSniffFileSize?: boolean } = {}, +): Promise { if (isBuffer(data)) { return data.length; } @@ -108,6 +136,9 @@ async function tryGetContentLengthFromFileLike(data: Uploadable.FileLike): Promi if (isFile(data)) { return data.size; } + if (noSniffFileSize === true) { + return undefined; + } if (isPathedValue(data)) { return await tryGetFileSizeFromPath(data.path.toString()); } diff --git a/src/core/headers.ts b/src/core/headers.ts index 561314d2..be45c455 100644 --- a/src/core/headers.ts +++ b/src/core/headers.ts @@ -1,17 +1,14 @@ -import * as core from "./index.js"; - -export function mergeHeaders( - ...headersArray: (Record | undefined> | undefined)[] -): Record> { - const result: Record> = {}; +export function mergeHeaders(...headersArray: (Record | null | undefined)[]): Record { + const result: Record = {}; for (const [key, value] of headersArray .filter((headers) => headers != null) .flatMap((headers) => Object.entries(headers))) { + const insensitiveKey = key.toLowerCase(); if (value != null) { - result[key] = value; - } else if (key in result) { - delete result[key]; + result[insensitiveKey] = value; + } else if (insensitiveKey in result) { + delete result[insensitiveKey]; } } @@ -19,15 +16,16 @@ export function mergeHeaders( } export function mergeOnlyDefinedHeaders( - ...headersArray: (Record | undefined> | undefined)[] -): Record> { - const result: Record> = {}; + ...headersArray: (Record | null | undefined)[] +): Record { + const result: Record = {}; for (const [key, value] of headersArray .filter((headers) => headers != null) .flatMap((headers) => Object.entries(headers))) { + const insensitiveKey = key.toLowerCase(); if (value != null) { - result[key] = value; + result[insensitiveKey] = value; } } diff --git a/src/core/index.ts b/src/core/index.ts index 8a48e319..e2aca287 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,10 +1,11 @@ export * from "./auth/index.js"; +export * from "./base64.js"; export * from "./fetcher/index.js"; +export * as file from "./file/index.js"; +export * as logging from "./logging/index.js"; +export * from "./pagination/index.js"; export * from "./runtime/index.js"; -export * as url from "./url/index.js"; export * as serialization from "./schemas/index.js"; -export * from "./websocket/index.js"; -export * from "./base64.js"; +export * as url from "./url/index.js"; export * from "./utils/index.js"; -export * from "./pagination/index.js"; -export * as file from "./file/index.js"; +export * from "./websocket/index.js"; diff --git a/src/core/logging/exports.ts b/src/core/logging/exports.ts new file mode 100644 index 00000000..88f6c00d --- /dev/null +++ b/src/core/logging/exports.ts @@ -0,0 +1,19 @@ +import * as logger from "./logger.js"; + +export namespace logging { + /** + * Configuration for logger instances. + */ + export type LogConfig = logger.LogConfig; + export type LogLevel = logger.LogLevel; + export const LogLevel: typeof logger.LogLevel = logger.LogLevel; + export type ILogger = logger.ILogger; + /** + * Console logger implementation that outputs to the console. + */ + export type ConsoleLogger = logger.ConsoleLogger; + /** + * Console logger implementation that outputs to the console. + */ + export const ConsoleLogger: typeof logger.ConsoleLogger = logger.ConsoleLogger; +} diff --git a/src/core/logging/index.ts b/src/core/logging/index.ts new file mode 100644 index 00000000..d81cc32c --- /dev/null +++ b/src/core/logging/index.ts @@ -0,0 +1 @@ +export * from "./logger.js"; diff --git a/src/core/logging/logger.ts b/src/core/logging/logger.ts new file mode 100644 index 00000000..a3f3673c --- /dev/null +++ b/src/core/logging/logger.ts @@ -0,0 +1,203 @@ +export const LogLevel = { + Debug: "debug", + Info: "info", + Warn: "warn", + Error: "error", +} as const; +export type LogLevel = (typeof LogLevel)[keyof typeof LogLevel]; +const logLevelMap: Record = { + [LogLevel.Debug]: 1, + [LogLevel.Info]: 2, + [LogLevel.Warn]: 3, + [LogLevel.Error]: 4, +}; + +export interface ILogger { + /** + * Logs a debug message. + * @param message - The message to log + * @param args - Additional arguments to log + */ + debug(message: string, ...args: unknown[]): void; + /** + * Logs an info message. + * @param message - The message to log + * @param args - Additional arguments to log + */ + info(message: string, ...args: unknown[]): void; + /** + * Logs a warning message. + * @param message - The message to log + * @param args - Additional arguments to log + */ + warn(message: string, ...args: unknown[]): void; + /** + * Logs an error message. + * @param message - The message to log + * @param args - Additional arguments to log + */ + error(message: string, ...args: unknown[]): void; +} + +/** + * Configuration for logger initialization. + */ +export interface LogConfig { + /** + * Minimum log level to output. + * @default LogLevel.Info + */ + level?: LogLevel; + /** + * Logger implementation to use. + * @default new ConsoleLogger() + */ + logger?: ILogger; + /** + * Whether logging should be silenced. + * @default true + */ + silent?: boolean; +} + +/** + * Default console-based logger implementation. + */ +export class ConsoleLogger implements ILogger { + debug(message: string, ...args: unknown[]): void { + console.debug(message, ...args); + } + info(message: string, ...args: unknown[]): void { + console.info(message, ...args); + } + warn(message: string, ...args: unknown[]): void { + console.warn(message, ...args); + } + error(message: string, ...args: unknown[]): void { + console.error(message, ...args); + } +} + +/** + * Logger class that provides level-based logging functionality. + */ +export class Logger { + private readonly level: number; + private readonly logger: ILogger; + private readonly silent: boolean; + + /** + * Creates a new logger instance. + * @param config - Logger configuration + */ + constructor(config: Required) { + this.level = logLevelMap[config.level]; + this.logger = config.logger; + this.silent = config.silent; + } + + /** + * Checks if a log level should be output based on configuration. + * @param level - The log level to check + * @returns True if the level should be logged + */ + public shouldLog(level: LogLevel): boolean { + return !this.silent && this.level <= logLevelMap[level]; + } + + /** + * Checks if debug logging is enabled. + * @returns True if debug logs should be output + */ + public isDebug(): boolean { + return this.shouldLog(LogLevel.Debug); + } + + /** + * Logs a debug message if debug logging is enabled. + * @param message - The message to log + * @param args - Additional arguments to log + */ + public debug(message: string, ...args: unknown[]): void { + if (this.isDebug()) { + this.logger.debug(message, ...args); + } + } + + /** + * Checks if info logging is enabled. + * @returns True if info logs should be output + */ + public isInfo(): boolean { + return this.shouldLog(LogLevel.Info); + } + + /** + * Logs an info message if info logging is enabled. + * @param message - The message to log + * @param args - Additional arguments to log + */ + public info(message: string, ...args: unknown[]): void { + if (this.isInfo()) { + this.logger.info(message, ...args); + } + } + + /** + * Checks if warning logging is enabled. + * @returns True if warning logs should be output + */ + public isWarn(): boolean { + return this.shouldLog(LogLevel.Warn); + } + + /** + * Logs a warning message if warning logging is enabled. + * @param message - The message to log + * @param args - Additional arguments to log + */ + public warn(message: string, ...args: unknown[]): void { + if (this.isWarn()) { + this.logger.warn(message, ...args); + } + } + + /** + * Checks if error logging is enabled. + * @returns True if error logs should be output + */ + public isError(): boolean { + return this.shouldLog(LogLevel.Error); + } + + /** + * Logs an error message if error logging is enabled. + * @param message - The message to log + * @param args - Additional arguments to log + */ + public error(message: string, ...args: unknown[]): void { + if (this.isError()) { + this.logger.error(message, ...args); + } + } +} + +export function createLogger(config?: LogConfig | Logger): Logger { + if (config == null) { + return defaultLogger; + } + if (config instanceof Logger) { + return config; + } + config = config ?? {}; + config.level ??= LogLevel.Info; + config.logger ??= new ConsoleLogger(); + config.silent ??= true; + return new Logger(config as Required); +} + +const defaultLogger: Logger = new Logger({ + level: LogLevel.Info, + logger: new ConsoleLogger(), + silent: true, +}); diff --git a/src/core/pagination/CustomPager.ts b/src/core/pagination/CustomPager.ts new file mode 100644 index 00000000..f9bb9186 --- /dev/null +++ b/src/core/pagination/CustomPager.ts @@ -0,0 +1,194 @@ +import type { BaseRequestOptions, NormalizedClientOptions } from "../../BaseClient.js"; +import type { APIResponse } from "../fetcher/APIResponse.js"; +import type { Fetcher } from "../fetcher/Fetcher.js"; +import type { RawResponse } from "../fetcher/index.js"; + +/** + * + * @template TItem The type of the items in the page. + * @template TResponse The type of the API response. + */ +export class CustomPager implements AsyncIterable { + /** The items from the current page */ + public data: TItem[]; + /** The raw HTTP response */ + public rawResponse: RawResponse; + /** The parsed response object */ + public response: TResponse; + + private sendRequest: (request: Fetcher.Args) => Promise>; + private nextRequest?: Fetcher.Args; + private previousRequest?: Fetcher.Args; + private _hasNextPage: boolean; + private _hasPreviousPage: boolean; + + constructor(args: { + response: TResponse; + rawResponse: RawResponse; + items: TItem[]; + hasNextPage: boolean; + hasPreviousPage: boolean; + nextRequest?: Fetcher.Args; + previousRequest?: Fetcher.Args; + sendRequest: (request: Fetcher.Args) => Promise>; + }) { + this.response = args.response; + this.rawResponse = args.rawResponse; + this.data = args.items; + this._hasNextPage = args.hasNextPage; + this._hasPreviousPage = args.hasPreviousPage; + this.nextRequest = args.nextRequest; + this.previousRequest = args.previousRequest; + this.sendRequest = args.sendRequest; + } + + /** + * @returns whether there is a next page to load + */ + public hasNextPage(): boolean { + return this._hasNextPage; + } + + /** + * @returns whether there is a previous page to load + */ + public hasPreviousPage(): boolean { + return this._hasPreviousPage; + } + + /** + * Returns the current page data. + * This is an alias for the `data` property for consistency with other pagination APIs. + * + * @returns the items from the current page + */ + public getCurrentPage(): TItem[] { + return this.data; + } + + /** + * Retrieves the next page of results. + * @returns this pager with updated data + * @throws Error if there is no next page + */ + public async getNextPage(): Promise { + if (!this._hasNextPage || !this.nextRequest) { + throw new Error("No next page available"); + } + const response = await this.sendRequest(this.nextRequest); + if (!response.ok) { + const reason = + response.error.reason === "status-code" ? `HTTP ${response.error.statusCode}` : response.error.reason; + throw new Error(`Failed to fetch next page: ${reason}`); + } + const data = response.body; + const rawResponse = response.rawResponse; + const parsed = await parse({ request: this.nextRequest, data, rawResponse }); + this.response = data; + this.rawResponse = rawResponse; + this.data = parsed.items; + this._hasNextPage = parsed.hasNextPage; + this._hasPreviousPage = parsed.hasPreviousPage; + this.nextRequest = parsed.nextRequest; + this.previousRequest = parsed.previousRequest; + return this; + } + + /** + * Retrieves the previous page of results. + * @returns this pager with updated data + * @throws Error if there is no previous page + */ + public async getPreviousPage(): Promise { + if (!this._hasPreviousPage || !this.previousRequest) { + throw new Error("No previous page available"); + } + const response = await this.sendRequest(this.previousRequest); + if (!response.ok) { + const reason = + response.error.reason === "status-code" ? `HTTP ${response.error.statusCode}` : response.error.reason; + throw new Error(`Failed to fetch previous page: ${reason}`); + } + const data = response.body; + const rawResponse = response.rawResponse; + const parsed = await parse({ request: this.previousRequest, data, rawResponse }); + this.response = data; + this.rawResponse = rawResponse; + this.data = parsed.items; + this._hasNextPage = parsed.hasNextPage; + this._hasPreviousPage = parsed.hasPreviousPage; + this.nextRequest = parsed.nextRequest; + this.previousRequest = parsed.previousRequest; + return this; + } + + private async *iterMessages(): AsyncGenerator { + for (const item of this.data) { + yield item; + } + + while (this.hasNextPage()) { + await this.getNextPage(); + for (const item of this.data) { + yield item; + } + } + } + + async *[Symbol.asyncIterator](): AsyncIterator { + for await (const message of this.iterMessages()) { + yield message; + } + } +} + +export async function createCustomPager({ + sendRequest, + initialHttpRequest, + clientOptions, +}: { + sendRequest: (request: Fetcher.Args) => Promise>; + initialHttpRequest: Fetcher.Args; + clientOptions: NormalizedClientOptions; + requestOptions?: BaseRequestOptions; +}): Promise> { + const response = await sendRequest(initialHttpRequest); + if (!response.ok) { + const reason = + response.error.reason === "status-code" ? `HTTP ${response.error.statusCode}` : response.error.reason; + throw new Error(`Failed to fetch initial page: ${reason}`); + } + const data = response.body; + const rawResponse = response.rawResponse; + const parsed = await parse({ request: initialHttpRequest, data, rawResponse }); + return new CustomPager({ + response: data, + rawResponse, + items: parsed.items, + hasNextPage: parsed.hasNextPage, + hasPreviousPage: parsed.hasPreviousPage, + nextRequest: parsed.nextRequest, + previousRequest: parsed.previousRequest, + sendRequest: sendRequest, + }); +} + +async function parse(_args: { + request: Fetcher.Args; + data: TResponse; + rawResponse: RawResponse; +}): Promise<{ + nextRequest?: Fetcher.Args; + hasNextPage: boolean; + previousRequest?: Fetcher.Args; + hasPreviousPage: boolean; + items: TItem[]; +}> { + // Placeholder implementation. + // TODO: Replace this with actual parsing logic. + return { + items: [], + hasNextPage: false, + hasPreviousPage: false, + }; +} diff --git a/src/core/pagination/Page.ts b/src/core/pagination/Page.ts index 307989ef..6621a6f1 100644 --- a/src/core/pagination/Page.ts +++ b/src/core/pagination/Page.ts @@ -1,18 +1,19 @@ -import { HttpResponsePromise, RawResponse } from "../fetcher/index.js"; +import type { HttpResponsePromise, RawResponse } from "../fetcher/index.js"; /** * A page of results from a paginated API. * * @template T The type of the items in the page. + * @template R The type of the API response. */ -export class Page implements AsyncIterable { +export class Page implements AsyncIterable { public data: T[]; public rawResponse: RawResponse; + public response: R; - private response: unknown; - private _hasNextPage: (response: unknown) => boolean; - private getItems: (response: unknown) => T[]; - private loadNextPage: (response: unknown) => HttpResponsePromise; + private _hasNextPage: (response: R) => boolean; + private getItems: (response: R) => T[]; + private loadNextPage: (response: R) => HttpResponsePromise; constructor({ response, @@ -21,11 +22,11 @@ export class Page implements AsyncIterable { getItems, loadPage, }: { - response: unknown; + response: R; rawResponse: RawResponse; - hasNextPage: (response: unknown) => boolean; - getItems: (response: unknown) => T[]; - loadPage: (response: unknown) => HttpResponsePromise; + hasNextPage: (response: R) => boolean; + getItems: (response: R) => T[]; + loadPage: (response: R) => HttpResponsePromise; }) { this.response = response; this.rawResponse = rawResponse; diff --git a/src/core/pagination/Pageable.ts b/src/core/pagination/Pageable.ts deleted file mode 100644 index faec8642..00000000 --- a/src/core/pagination/Pageable.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { RawResponse } from "../fetcher/index.js"; -import { Page } from "./Page.js"; - -export declare namespace Pageable { - interface Args { - response: Response; - rawResponse: RawResponse; - hasNextPage: (response: Response) => boolean; - getItems: (response: Response) => Item[]; - loadPage: (response: Response) => Promise; - } -} - -export class Pageable extends Page { - constructor(args: Pageable.Args) { - super(args as any); - } -} diff --git a/src/core/pagination/exports.ts b/src/core/pagination/exports.ts new file mode 100644 index 00000000..d3acc60b --- /dev/null +++ b/src/core/pagination/exports.ts @@ -0,0 +1 @@ +export type { Page } from "./Page.js"; diff --git a/src/core/pagination/index.ts b/src/core/pagination/index.ts index b0cd68fa..fe9dc949 100644 --- a/src/core/pagination/index.ts +++ b/src/core/pagination/index.ts @@ -1,2 +1,2 @@ +export { CustomPager, createCustomPager } from "./CustomPager.js"; export { Page } from "./Page.js"; -export { Pageable } from "./Pageable.js"; diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts index 08fd2563..56ebbb87 100644 --- a/src/core/runtime/runtime.ts +++ b/src/core/runtime/runtime.ts @@ -99,6 +99,18 @@ function evaluateRuntime(): Runtime { }; } + /** + * A constant that indicates whether the environment the code is running is in React-Native. + * This check should come before Node.js detection since React Native may have a process polyfill. + * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js + */ + const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; + if (isReactNative) { + return { + type: "react-native", + }; + } + /** * A constant that indicates whether the environment the code is running is Node.JS. */ @@ -116,17 +128,6 @@ function evaluateRuntime(): Runtime { }; } - /** - * A constant that indicates whether the environment the code is running is in React-Native. - * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js - */ - const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; - if (isReactNative) { - return { - type: "react-native", - }; - } - return { type: "unknown", }; diff --git a/src/core/schemas/Schema.ts b/src/core/schemas/Schema.ts index 5216437c..4cd8b1d9 100644 --- a/src/core/schemas/Schema.ts +++ b/src/core/schemas/Schema.ts @@ -1,4 +1,4 @@ -import { SchemaUtils } from "./builders/index.js"; +import type { SchemaUtils } from "./builders/index.js"; export type Schema = BaseSchema & SchemaUtils; @@ -24,6 +24,7 @@ export const SchemaType = { NUMBER: "number", STRING: "string", UNKNOWN: "unknown", + NEVER: "never", RECORD: "record", SET: "set", UNION: "union", @@ -32,6 +33,7 @@ export const SchemaType = { OPTIONAL: "optional", OPTIONAL_NULLABLE: "optionalNullable", } as const; + export type SchemaType = (typeof SchemaType)[keyof typeof SchemaType]; export type MaybeValid = Valid | Invalid; diff --git a/src/core/schemas/builders/bigint/bigint.ts b/src/core/schemas/builders/bigint/bigint.ts index 098b4bf9..2c7c74c5 100644 --- a/src/core/schemas/builders/bigint/bigint.ts +++ b/src/core/schemas/builders/bigint/bigint.ts @@ -1,4 +1,4 @@ -import { BaseSchema, Schema, SchemaType } from "../../Schema.js"; +import { type BaseSchema, type Schema, SchemaType } from "../../Schema.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation.js"; import { getSchemaUtils } from "../schema-utils/index.js"; diff --git a/src/core/schemas/builders/date/date.ts b/src/core/schemas/builders/date/date.ts index 5afaa49b..f02e3367 100644 --- a/src/core/schemas/builders/date/date.ts +++ b/src/core/schemas/builders/date/date.ts @@ -1,4 +1,4 @@ -import { BaseSchema, Schema, SchemaType } from "../../Schema.js"; +import { type BaseSchema, type Schema, SchemaType } from "../../Schema.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation.js"; import { getSchemaUtils } from "../schema-utils/index.js"; diff --git a/src/core/schemas/builders/enum/enum.ts b/src/core/schemas/builders/enum/enum.ts index b8921867..ccae24bc 100644 --- a/src/core/schemas/builders/enum/enum.ts +++ b/src/core/schemas/builders/enum/enum.ts @@ -1,4 +1,4 @@ -import { Schema, SchemaType } from "../../Schema.js"; +import { type Schema, SchemaType } from "../../Schema.js"; import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; diff --git a/src/core/schemas/builders/lazy/index.ts b/src/core/schemas/builders/lazy/index.ts index e346ac9d..e8ca4099 100644 --- a/src/core/schemas/builders/lazy/index.ts +++ b/src/core/schemas/builders/lazy/index.ts @@ -1,3 +1,3 @@ -export { lazy } from "./lazy.js"; export type { SchemaGetter } from "./lazy.js"; +export { lazy } from "./lazy.js"; export { lazyObject } from "./lazyObject.js"; diff --git a/src/core/schemas/builders/lazy/lazy.ts b/src/core/schemas/builders/lazy/lazy.ts index c3ec78fe..37f28871 100644 --- a/src/core/schemas/builders/lazy/lazy.ts +++ b/src/core/schemas/builders/lazy/lazy.ts @@ -1,4 +1,4 @@ -import { BaseSchema, Schema } from "../../Schema.js"; +import type { BaseSchema, Schema } from "../../Schema.js"; import { getSchemaUtils } from "../schema-utils/index.js"; export type SchemaGetter> = () => SchemaType; diff --git a/src/core/schemas/builders/lazy/lazyObject.ts b/src/core/schemas/builders/lazy/lazyObject.ts index 0971f921..192c90e5 100644 --- a/src/core/schemas/builders/lazy/lazyObject.ts +++ b/src/core/schemas/builders/lazy/lazyObject.ts @@ -1,8 +1,8 @@ import { getObjectUtils } from "../object/index.js"; +import type { BaseObjectSchema, ObjectSchema } from "../object/types.js"; import { getObjectLikeUtils } from "../object-like/index.js"; -import { BaseObjectSchema, ObjectSchema } from "../object/types.js"; import { getSchemaUtils } from "../schema-utils/index.js"; -import { SchemaGetter, constructLazyBaseSchema, getMemoizedSchema } from "./lazy.js"; +import { constructLazyBaseSchema, getMemoizedSchema, type SchemaGetter } from "./lazy.js"; export function lazyObject(getter: SchemaGetter>): ObjectSchema { const baseSchema: BaseObjectSchema = { diff --git a/src/core/schemas/builders/list/list.ts b/src/core/schemas/builders/list/list.ts index 4cee68ee..b3c0bdfc 100644 --- a/src/core/schemas/builders/list/list.ts +++ b/src/core/schemas/builders/list/list.ts @@ -1,4 +1,4 @@ -import { BaseSchema, MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema.js"; +import { type BaseSchema, type MaybeValid, type Schema, SchemaType, type ValidationError } from "../../Schema.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation.js"; import { getSchemaUtils } from "../schema-utils/index.js"; @@ -44,30 +44,20 @@ function validateAndTransformArray( }; } - const maybeValidItems = value.map((item, index) => transformItem(item, index)); + const result: Parsed[] = []; + const errors: ValidationError[] = []; - return maybeValidItems.reduce>( - (acc, item) => { - if (acc.ok && item.ok) { - return { - ok: true, - value: [...acc.value, item.value], - }; - } - - const errors: ValidationError[] = []; - if (!acc.ok) { - errors.push(...acc.errors); - } - if (!item.ok) { - errors.push(...item.errors); - } + for (let i = 0; i < value.length; i++) { + const item = transformItem(value[i], i); + if (item.ok) { + result.push(item.value); + } else { + errors.push(...item.errors); + } + } - return { - ok: false, - errors, - }; - }, - { ok: true, value: [] }, - ); + if (errors.length === 0) { + return { ok: true, value: result }; + } + return { ok: false, errors }; } diff --git a/src/core/schemas/builders/literals/booleanLiteral.ts b/src/core/schemas/builders/literals/booleanLiteral.ts index 0bebfb5b..db5d2c7a 100644 --- a/src/core/schemas/builders/literals/booleanLiteral.ts +++ b/src/core/schemas/builders/literals/booleanLiteral.ts @@ -1,4 +1,4 @@ -import { Schema, SchemaType } from "../../Schema.js"; +import { type Schema, SchemaType } from "../../Schema.js"; import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; diff --git a/src/core/schemas/builders/literals/index.ts b/src/core/schemas/builders/literals/index.ts index fb172c47..4a4ab39d 100644 --- a/src/core/schemas/builders/literals/index.ts +++ b/src/core/schemas/builders/literals/index.ts @@ -1,2 +1,2 @@ -export { stringLiteral } from "./stringLiteral.js"; export { booleanLiteral } from "./booleanLiteral.js"; +export { stringLiteral } from "./stringLiteral.js"; diff --git a/src/core/schemas/builders/literals/stringLiteral.ts b/src/core/schemas/builders/literals/stringLiteral.ts index e3efa7bb..ce6e20ca 100644 --- a/src/core/schemas/builders/literals/stringLiteral.ts +++ b/src/core/schemas/builders/literals/stringLiteral.ts @@ -1,4 +1,4 @@ -import { Schema, SchemaType } from "../../Schema.js"; +import { type Schema, SchemaType } from "../../Schema.js"; import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; diff --git a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts index 124a0828..5fdc8023 100644 --- a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts +++ b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts @@ -1,9 +1,12 @@ -import { BaseSchema } from "../../Schema.js"; +import type { BaseSchema } from "../../Schema.js"; import { filterObject } from "../../utils/filterObject.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; import { isPlainObject } from "../../utils/isPlainObject.js"; import { getSchemaUtils } from "../schema-utils/index.js"; -import { ObjectLikeSchema, ObjectLikeUtils } from "./types.js"; +import type { ObjectLikeSchema, ObjectLikeUtils } from "./types.js"; + +// eslint-disable-next-line @typescript-eslint/unbound-method +const _hasOwn = Object.prototype.hasOwnProperty; export function getObjectLikeUtils(schema: BaseSchema): ObjectLikeUtils { return { @@ -26,15 +29,14 @@ export function withParsedProperties>( - (processed, [key, value]) => { - return { - ...processed, - [key]: typeof value === "function" ? value(parsedObject.value) : value, - }; - }, - {}, - ); + const additionalProperties: Record = {}; + for (const key in properties) { + if (_hasOwn.call(properties, key)) { + const value = properties[key as keyof Properties]; + additionalProperties[key] = + typeof value === "function" ? (value as Function)(parsedObject.value) : value; + } + } return { ok: true, diff --git a/src/core/schemas/builders/object-like/types.ts b/src/core/schemas/builders/object-like/types.ts index 5a49242a..44b96691 100644 --- a/src/core/schemas/builders/object-like/types.ts +++ b/src/core/schemas/builders/object-like/types.ts @@ -1,11 +1,13 @@ -import { BaseSchema, Schema } from "../../Schema.js"; +import type { BaseSchema, Schema } from "../../Schema.js"; export type ObjectLikeSchema = Schema & BaseSchema & ObjectLikeUtils; export interface ObjectLikeUtils { - withParsedProperties: >(properties: { - [K in keyof T]: T[K] | ((parsed: Parsed) => T[K]); - }) => ObjectLikeSchema; + withParsedProperties: >( + properties: { + [K in keyof T]: T[K] | ((parsed: Parsed) => T[K]); + }, + ) => ObjectLikeSchema; } diff --git a/src/core/schemas/builders/object/index.ts b/src/core/schemas/builders/object/index.ts index a6337fac..c6611aaa 100644 --- a/src/core/schemas/builders/object/index.ts +++ b/src/core/schemas/builders/object/index.ts @@ -1,11 +1,11 @@ export { getObjectUtils, object } from "./object.js"; -export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties.js"; export type { inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas, inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas, } from "./objectWithoutOptionalProperties.js"; -export { isProperty, property } from "./property.js"; +export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties.js"; export type { Property } from "./property.js"; +export { isProperty, property } from "./property.js"; export type { BaseObjectSchema, inferObjectSchemaFromPropertySchemas, diff --git a/src/core/schemas/builders/object/object.ts b/src/core/schemas/builders/object/object.ts index bdb8c89c..0db7f49a 100644 --- a/src/core/schemas/builders/object/object.ts +++ b/src/core/schemas/builders/object/object.ts @@ -1,4 +1,4 @@ -import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema.js"; +import { type MaybeValid, type Schema, SchemaType, type ValidationError } from "../../Schema.js"; import { entries } from "../../utils/entries.js"; import { filterObject } from "../../utils/filterObject.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; @@ -9,16 +9,19 @@ import { partition } from "../../utils/partition.js"; import { getObjectLikeUtils } from "../object-like/index.js"; import { getSchemaUtils } from "../schema-utils/index.js"; import { isProperty } from "./property.js"; -import { +import type { BaseObjectSchema, - ObjectSchema, - ObjectUtils, - PropertySchemas, inferObjectSchemaFromPropertySchemas, inferParsedObjectFromPropertySchemas, inferRawObjectFromPropertySchemas, + ObjectSchema, + ObjectUtils, + PropertySchemas, } from "./types.js"; +// eslint-disable-next-line @typescript-eslint/unbound-method +const _hasOwn = Object.prototype.hasOwnProperty; + interface ObjectPropertyWithRawKey { rawKey: string; parsedKey: string; @@ -28,79 +31,128 @@ interface ObjectPropertyWithRawKey { export function object>( schemas: T, ): inferObjectSchemaFromPropertySchemas { - const baseSchema: BaseObjectSchema< - inferRawObjectFromPropertySchemas, - inferParsedObjectFromPropertySchemas - > = { - _getRawProperties: () => - Object.entries(schemas).map(([parsedKey, propertySchema]) => - isProperty(propertySchema) ? propertySchema.rawKey : parsedKey, - ) as unknown as (keyof inferRawObjectFromPropertySchemas)[], - _getParsedProperties: () => keys(schemas) as unknown as (keyof inferParsedObjectFromPropertySchemas)[], + // All property metadata is lazily computed on first use. + // This keeps schema construction free of iteration, which matters when + // many schemas are defined but only some are exercised at runtime. + // Required-key computation is also deferred because lazy() schemas may + // not be resolved at construction time. - parse: (raw, opts) => { - const rawKeyToProperty: Record = {}; - const requiredKeys: string[] = []; + let _rawKeyToProperty: Record | undefined; + function getRawKeyToProperty(): Record { + if (_rawKeyToProperty == null) { + _rawKeyToProperty = {}; for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { - const rawKey = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey; + const rawKey = isProperty(schemaOrObjectProperty) + ? schemaOrObjectProperty.rawKey + : (parsedKey as string); const valueSchema: Schema = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.valueSchema : schemaOrObjectProperty; - const property: ObjectPropertyWithRawKey = { + _rawKeyToProperty[rawKey] = { rawKey, parsedKey: parsedKey as string, valueSchema, }; + } + } + return _rawKeyToProperty; + } - rawKeyToProperty[rawKey] = property; + let _parseRequiredKeys: string[] | undefined; + let _jsonRequiredKeys: string[] | undefined; + let _parseRequiredKeysSet: Set | undefined; + let _jsonRequiredKeysSet: Set | undefined; + function getParseRequiredKeys(): string[] { + if (_parseRequiredKeys == null) { + _parseRequiredKeys = []; + _jsonRequiredKeys = []; + for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { + const rawKey = isProperty(schemaOrObjectProperty) + ? schemaOrObjectProperty.rawKey + : (parsedKey as string); + const valueSchema: Schema = isProperty(schemaOrObjectProperty) + ? schemaOrObjectProperty.valueSchema + : schemaOrObjectProperty; if (isSchemaRequired(valueSchema)) { - requiredKeys.push(rawKey); + _parseRequiredKeys.push(rawKey); + _jsonRequiredKeys.push(parsedKey as string); } } + _parseRequiredKeysSet = new Set(_parseRequiredKeys); + _jsonRequiredKeysSet = new Set(_jsonRequiredKeys); + } + return _parseRequiredKeys; + } + + function getJsonRequiredKeys(): string[] { + if (_jsonRequiredKeys == null) { + getParseRequiredKeys(); + } + return _jsonRequiredKeys!; + } + + function getParseRequiredKeysSet(): Set { + if (_parseRequiredKeysSet == null) { + getParseRequiredKeys(); + } + return _parseRequiredKeysSet!; + } + function getJsonRequiredKeysSet(): Set { + if (_jsonRequiredKeysSet == null) { + getParseRequiredKeys(); + } + return _jsonRequiredKeysSet!; + } + + const baseSchema: BaseObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectFromPropertySchemas + > = { + _getRawProperties: () => + Object.entries(schemas).map(([parsedKey, propertySchema]) => + isProperty(propertySchema) ? propertySchema.rawKey : parsedKey, + ) as unknown as (keyof inferRawObjectFromPropertySchemas)[], + _getParsedProperties: () => keys(schemas) as unknown as (keyof inferParsedObjectFromPropertySchemas)[], + + parse: (raw, opts) => { + const breadcrumbsPrefix = opts?.breadcrumbsPrefix ?? []; return validateAndTransformObject({ value: raw, - requiredKeys, + requiredKeys: getParseRequiredKeys(), + requiredKeysSet: getParseRequiredKeysSet(), getProperty: (rawKey) => { - const property = rawKeyToProperty[rawKey]; + const property = getRawKeyToProperty()[rawKey]; if (property == null) { return undefined; } return { transformedKey: property.parsedKey, - transform: (propertyValue) => - property.valueSchema.parse(propertyValue, { + transform: (propertyValue) => { + const childBreadcrumbs = [...breadcrumbsPrefix, rawKey]; + return property.valueSchema.parse(propertyValue, { ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), rawKey], - }), + breadcrumbsPrefix: childBreadcrumbs, + }); + }, }; }, unrecognizedObjectKeys: opts?.unrecognizedObjectKeys, skipValidation: opts?.skipValidation, - breadcrumbsPrefix: opts?.breadcrumbsPrefix, + breadcrumbsPrefix, omitUndefined: opts?.omitUndefined, }); }, json: (parsed, opts) => { - const requiredKeys: string[] = []; - - for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { - const valueSchema: Schema = isProperty(schemaOrObjectProperty) - ? schemaOrObjectProperty.valueSchema - : schemaOrObjectProperty; - - if (isSchemaRequired(valueSchema)) { - requiredKeys.push(parsedKey as string); - } - } - + const breadcrumbsPrefix = opts?.breadcrumbsPrefix ?? []; return validateAndTransformObject({ value: parsed, - requiredKeys, + requiredKeys: getJsonRequiredKeys(), + requiredKeysSet: getJsonRequiredKeysSet(), getProperty: ( parsedKey, ): { transformedKey: string; transform: (propertyValue: object) => MaybeValid } | undefined => { @@ -114,26 +166,30 @@ export function object - property.valueSchema.json(propertyValue, { + transform: (propertyValue) => { + const childBreadcrumbs = [...breadcrumbsPrefix, parsedKey]; + return property.valueSchema.json(propertyValue, { ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedKey], - }), + breadcrumbsPrefix: childBreadcrumbs, + }); + }, }; } else { return { transformedKey: parsedKey, - transform: (propertyValue) => - property.json(propertyValue, { + transform: (propertyValue) => { + const childBreadcrumbs = [...breadcrumbsPrefix, parsedKey]; + return property.json(propertyValue, { ...opts, - breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedKey], - }), + breadcrumbsPrefix: childBreadcrumbs, + }); + }, }; } }, unrecognizedObjectKeys: opts?.unrecognizedObjectKeys, skipValidation: opts?.skipValidation, - breadcrumbsPrefix: opts?.breadcrumbsPrefix, + breadcrumbsPrefix, omitUndefined: opts?.omitUndefined, }); }, @@ -152,6 +208,7 @@ export function object({ value, requiredKeys, + requiredKeysSet, getProperty, unrecognizedObjectKeys = "fail", skipValidation = false, @@ -159,6 +216,7 @@ function validateAndTransformObject({ }: { value: unknown; requiredKeys: string[]; + requiredKeysSet: Set; getProperty: ( preTransformedKey: string, ) => { transformedKey: string; transform: (propertyValue: object) => MaybeValid } | undefined; @@ -179,15 +237,23 @@ function validateAndTransformObject({ }; } - const missingRequiredKeys = new Set(requiredKeys); + // Track which required keys have been seen. + // Use a counter instead of copying the Set to avoid per-call allocation. + let missingRequiredCount = requiredKeys.length; const errors: ValidationError[] = []; const transformed: Record = {}; - for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) { + for (const preTransformedKey in value) { + if (!_hasOwn.call(value, preTransformedKey)) { + continue; + } + const preTransformedItemValue = value[preTransformedKey]; const property = getProperty(preTransformedKey); if (property != null) { - missingRequiredKeys.delete(preTransformedKey); + if (missingRequiredCount > 0 && requiredKeysSet.has(preTransformedKey)) { + missingRequiredCount--; + } const value = property.transform(preTransformedItemValue as object); if (value.ok) { @@ -213,14 +279,16 @@ function validateAndTransformObject({ } } - errors.push( - ...requiredKeys - .filter((key) => missingRequiredKeys.has(key)) - .map((key) => ({ - path: breadcrumbsPrefix, - message: `Missing required key "${key}"`, - })), - ); + if (missingRequiredCount > 0) { + for (const key of requiredKeys) { + if (!(key in (value as Record))) { + errors.push({ + path: breadcrumbsPrefix, + message: `Missing required key "${key}"`, + }); + } + } + } if (errors.length === 0 || skipValidation) { return { @@ -244,17 +312,19 @@ export function getObjectUtils(schema: BaseObjectSchema { return validateAndTransformExtendedObject({ extensionKeys: extension._getRawProperties(), - value: raw as object, + value: raw, transformBase: (rawBase) => schema.parse(rawBase, opts), transformExtension: (rawExtension) => extension.parse(rawExtension, opts), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, }); }, json: (parsed, opts) => { return validateAndTransformExtendedObject({ extensionKeys: extension._getParsedProperties(), - value: parsed as object, + value: parsed, transformBase: (parsedBase) => schema.json(parsedBase, opts), transformExtension: (parsedExtension) => extension.json(parsedExtension, opts), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, }); }, getType: () => SchemaType.OBJECT, @@ -268,6 +338,8 @@ export function getObjectUtils(schema: BaseObjectSchema { + const knownRawKeys = new Set(schema._getRawProperties() as string[]); + const knownParsedKeys = new Set(schema._getParsedProperties() as string[]); const baseSchema: BaseObjectSchema = { _getParsedProperties: () => schema._getParsedProperties(), @@ -277,10 +349,18 @@ export function getObjectUtils(schema: BaseObjectSchema = {}; + if (typeof raw === "object" && raw != null) { + for (const [key, value] of Object.entries(raw)) { + if (!knownRawKeys.has(key)) { + extraProperties[key] = value; + } + } + } return { ok: true, value: { - ...(raw as any), + ...extraProperties, ...transformed.value, }, }; @@ -290,10 +370,18 @@ export function getObjectUtils(schema: BaseObjectSchema = {}; + if (typeof parsed === "object" && parsed != null) { + for (const [key, value] of Object.entries(parsed)) { + if (!knownParsedKeys.has(key)) { + extraProperties[key] = value; + } + } + } return { ok: true, value: { - ...(parsed as any), + ...extraProperties, ...transformed.value, }, }; @@ -316,12 +404,26 @@ function validateAndTransformExtendedObject MaybeValid; transformExtension: (value: object) => MaybeValid; + breadcrumbsPrefix?: string[]; }): MaybeValid { + if (!isPlainObject(value)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "object"), + }, + ], + }; + } + const extensionPropertiesSet = new Set(extensionKeys); const [extensionProperties, baseProperties] = partition(keys(value), (key) => extensionPropertiesSet.has(key as keyof PreTransformedExtension), diff --git a/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts index 5c852bef..4d39c862 100644 --- a/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts +++ b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts @@ -1,9 +1,9 @@ import { object } from "./object.js"; -import { - ObjectSchema, - PropertySchemas, +import type { inferParsedPropertySchema, inferRawObjectFromPropertySchemas, + ObjectSchema, + PropertySchemas, } from "./types.js"; export function objectWithoutOptionalProperties>( diff --git a/src/core/schemas/builders/object/property.ts b/src/core/schemas/builders/object/property.ts index 4c684fdd..d1f9f386 100644 --- a/src/core/schemas/builders/object/property.ts +++ b/src/core/schemas/builders/object/property.ts @@ -1,4 +1,4 @@ -import { Schema } from "../../Schema.js"; +import type { Schema } from "../../Schema.js"; export function property( rawKey: RawKey, diff --git a/src/core/schemas/builders/object/types.ts b/src/core/schemas/builders/object/types.ts index 4c7aa687..384ae873 100644 --- a/src/core/schemas/builders/object/types.ts +++ b/src/core/schemas/builders/object/types.ts @@ -1,8 +1,8 @@ -import { BaseSchema, Schema, inferParsed, inferRaw } from "../../Schema.js"; -import { addQuestionMarksToNullableProperties } from "../../utils/addQuestionMarksToNullableProperties.js"; -import { ObjectLikeUtils } from "../object-like/index.js"; -import { SchemaUtils } from "../schema-utils/index.js"; -import { Property } from "./property.js"; +import type { BaseSchema, inferParsed, inferRaw, Schema } from "../../Schema.js"; +import type { addQuestionMarksToNullableProperties } from "../../utils/addQuestionMarksToNullableProperties.js"; +import type { ObjectLikeUtils } from "../object-like/index.js"; +import type { SchemaUtils } from "../schema-utils/index.js"; +import type { Property } from "./property.js"; export type ObjectSchema = BaseObjectSchema & ObjectLikeUtils & diff --git a/src/core/schemas/builders/primitives/any.ts b/src/core/schemas/builders/primitives/any.ts index bff7c042..bc4d47fa 100644 --- a/src/core/schemas/builders/primitives/any.ts +++ b/src/core/schemas/builders/primitives/any.ts @@ -1,4 +1,7 @@ -import { SchemaType } from "../../Schema.js"; +import { type Schema, SchemaType } from "../../Schema.js"; import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator.js"; -export const any = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ ok: true, value })); +export const any: () => Schema = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ + ok: true, + value, +})); diff --git a/src/core/schemas/builders/primitives/boolean.ts b/src/core/schemas/builders/primitives/boolean.ts index 6d93becd..78c3c362 100644 --- a/src/core/schemas/builders/primitives/boolean.ts +++ b/src/core/schemas/builders/primitives/boolean.ts @@ -1,8 +1,8 @@ -import { SchemaType } from "../../Schema.js"; +import { type Schema, SchemaType } from "../../Schema.js"; import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; -export const boolean = createIdentitySchemaCreator( +export const boolean: () => Schema = createIdentitySchemaCreator( SchemaType.BOOLEAN, (value, { breadcrumbsPrefix = [] } = {}) => { if (typeof value === "boolean") { diff --git a/src/core/schemas/builders/primitives/index.ts b/src/core/schemas/builders/primitives/index.ts index 462a6d11..7a3ee015 100644 --- a/src/core/schemas/builders/primitives/index.ts +++ b/src/core/schemas/builders/primitives/index.ts @@ -1,5 +1,6 @@ export { any } from "./any.js"; export { boolean } from "./boolean.js"; +export { never } from "./never.js"; export { number } from "./number.js"; export { string } from "./string.js"; export { unknown } from "./unknown.js"; diff --git a/src/core/schemas/builders/primitives/never.ts b/src/core/schemas/builders/primitives/never.ts new file mode 100644 index 00000000..91f85d74 --- /dev/null +++ b/src/core/schemas/builders/primitives/never.ts @@ -0,0 +1,15 @@ +import { type Schema, SchemaType } from "../../Schema.js"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator.js"; + +export const never: () => Schema = createIdentitySchemaCreator( + SchemaType.NEVER, + (_value, { breadcrumbsPrefix = [] } = {}) => ({ + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: "Expected never", + }, + ], + }), +); diff --git a/src/core/schemas/builders/primitives/number.ts b/src/core/schemas/builders/primitives/number.ts index a927539e..6f16cd46 100644 --- a/src/core/schemas/builders/primitives/number.ts +++ b/src/core/schemas/builders/primitives/number.ts @@ -1,8 +1,8 @@ -import { SchemaType } from "../../Schema.js"; +import { type Schema, SchemaType } from "../../Schema.js"; import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; -export const number = createIdentitySchemaCreator( +export const number: () => Schema = createIdentitySchemaCreator( SchemaType.NUMBER, (value, { breadcrumbsPrefix = [] } = {}) => { if (typeof value === "number") { diff --git a/src/core/schemas/builders/primitives/string.ts b/src/core/schemas/builders/primitives/string.ts index fac9cd71..b29d72ae 100644 --- a/src/core/schemas/builders/primitives/string.ts +++ b/src/core/schemas/builders/primitives/string.ts @@ -1,8 +1,8 @@ -import { SchemaType } from "../../Schema.js"; +import { type Schema, SchemaType } from "../../Schema.js"; import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; -export const string = createIdentitySchemaCreator( +export const string: () => Schema = createIdentitySchemaCreator( SchemaType.STRING, (value, { breadcrumbsPrefix = [] } = {}) => { if (typeof value === "string") { diff --git a/src/core/schemas/builders/primitives/unknown.ts b/src/core/schemas/builders/primitives/unknown.ts index 4df0a6ce..04514160 100644 --- a/src/core/schemas/builders/primitives/unknown.ts +++ b/src/core/schemas/builders/primitives/unknown.ts @@ -1,4 +1,7 @@ -import { SchemaType } from "../../Schema.js"; +import { type Schema, SchemaType } from "../../Schema.js"; import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator.js"; -export const unknown = createIdentitySchemaCreator(SchemaType.UNKNOWN, (value) => ({ ok: true, value })); +export const unknown: () => Schema = createIdentitySchemaCreator( + SchemaType.UNKNOWN, + (value) => ({ ok: true, value }), +); diff --git a/src/core/schemas/builders/record/record.ts b/src/core/schemas/builders/record/record.ts index de1d7e13..f107fbab 100644 --- a/src/core/schemas/builders/record/record.ts +++ b/src/core/schemas/builders/record/record.ts @@ -1,10 +1,12 @@ -import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema.js"; -import { entries } from "../../utils/entries.js"; +import { type MaybeValid, type Schema, SchemaType, type ValidationError } from "../../Schema.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; import { isPlainObject } from "../../utils/isPlainObject.js"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation.js"; import { getSchemaUtils } from "../schema-utils/index.js"; -import { BaseRecordSchema, RecordSchema } from "./types.js"; +import type { BaseRecordSchema, RecordSchema } from "./types.js"; + +// eslint-disable-next-line @typescript-eslint/unbound-method +const _hasOwn = Object.prototype.hasOwnProperty; export function record( keySchema: Schema, @@ -79,51 +81,42 @@ function validateAndTransformRecord>>( - (accPromise, [stringKey, value]) => { - if (value === undefined) { - return accPromise; - } - - const acc = accPromise; - - let key: string | number = stringKey; - if (isKeyNumeric) { - const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN; - if (!isNaN(numberKey)) { - key = numberKey; - } - } - const transformedKey = transformKey(key); + const result = {} as Record; + const errors: ValidationError[] = []; - const transformedValue = transformValue(value, key); + for (const stringKey in value) { + if (!_hasOwn.call(value, stringKey)) { + continue; + } + const entryValue = (value as Record)[stringKey]; + if (entryValue === undefined) { + continue; + } - if (acc.ok && transformedKey.ok && transformedValue.ok) { - return { - ok: true, - value: { - ...acc.value, - [transformedKey.value]: transformedValue.value, - }, - }; + let key: string | number = stringKey; + if (isKeyNumeric) { + const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN; + if (!Number.isNaN(numberKey)) { + key = numberKey; } + } + const transformedKey = transformKey(key); + const transformedValue = transformValue(entryValue, key); - const errors: ValidationError[] = []; - if (!acc.ok) { - errors.push(...acc.errors); - } + if (transformedKey.ok && transformedValue.ok) { + result[transformedKey.value] = transformedValue.value; + } else { if (!transformedKey.ok) { errors.push(...transformedKey.errors); } if (!transformedValue.ok) { errors.push(...transformedValue.errors); } + } + } - return { - ok: false, - errors, - }; - }, - { ok: true, value: {} as Record }, - ); + if (errors.length === 0) { + return { ok: true, value: result }; + } + return { ok: false, errors }; } diff --git a/src/core/schemas/builders/record/types.ts b/src/core/schemas/builders/record/types.ts index e629d5be..5950b4cb 100644 --- a/src/core/schemas/builders/record/types.ts +++ b/src/core/schemas/builders/record/types.ts @@ -1,5 +1,5 @@ -import { BaseSchema } from "../../Schema.js"; -import { SchemaUtils } from "../schema-utils/index.js"; +import type { BaseSchema } from "../../Schema.js"; +import type { SchemaUtils } from "../schema-utils/index.js"; export type RecordSchema< RawKey extends string | number, diff --git a/src/core/schemas/builders/schema-utils/JsonError.ts b/src/core/schemas/builders/schema-utils/JsonError.ts index 14adcb70..daee3dc7 100644 --- a/src/core/schemas/builders/schema-utils/JsonError.ts +++ b/src/core/schemas/builders/schema-utils/JsonError.ts @@ -1,4 +1,4 @@ -import { ValidationError } from "../../Schema.js"; +import type { ValidationError } from "../../Schema.js"; import { stringifyValidationError } from "./stringifyValidationErrors.js"; export class JsonError extends Error { diff --git a/src/core/schemas/builders/schema-utils/ParseError.ts b/src/core/schemas/builders/schema-utils/ParseError.ts index 052a1d31..9facf061 100644 --- a/src/core/schemas/builders/schema-utils/ParseError.ts +++ b/src/core/schemas/builders/schema-utils/ParseError.ts @@ -1,4 +1,4 @@ -import { ValidationError } from "../../Schema.js"; +import type { ValidationError } from "../../Schema.js"; import { stringifyValidationError } from "./stringifyValidationErrors.js"; export class ParseError extends Error { diff --git a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts index 0087b66b..3ceaf4e0 100644 --- a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts +++ b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts @@ -1,4 +1,4 @@ -import { BaseSchema, Schema, SchemaOptions, SchemaType } from "../../Schema.js"; +import { type BaseSchema, type Schema, type SchemaOptions, SchemaType } from "../../Schema.js"; import { JsonError } from "./JsonError.js"; import { ParseError } from "./ParseError.js"; diff --git a/src/core/schemas/builders/schema-utils/index.ts b/src/core/schemas/builders/schema-utils/index.ts index 43ea0082..efb3b0c4 100644 --- a/src/core/schemas/builders/schema-utils/index.ts +++ b/src/core/schemas/builders/schema-utils/index.ts @@ -1,4 +1,4 @@ -export { getSchemaUtils, optional, transform } from "./getSchemaUtils.js"; export type { SchemaUtils } from "./getSchemaUtils.js"; +export { getSchemaUtils, optional, transform } from "./getSchemaUtils.js"; export { JsonError } from "./JsonError.js"; export { ParseError } from "./ParseError.js"; diff --git a/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts b/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts index 4252fb22..d36a4900 100644 --- a/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts +++ b/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts @@ -1,4 +1,4 @@ -import { ValidationError } from "../../Schema.js"; +import type { ValidationError } from "../../Schema.js"; export function stringifyValidationError(error: ValidationError): string { if (error.path.length === 0) { diff --git a/src/core/schemas/builders/set/set.ts b/src/core/schemas/builders/set/set.ts index 8cce5526..2013cdb4 100644 --- a/src/core/schemas/builders/set/set.ts +++ b/src/core/schemas/builders/set/set.ts @@ -1,4 +1,4 @@ -import { BaseSchema, Schema, SchemaType } from "../../Schema.js"; +import { type BaseSchema, type Schema, SchemaType } from "../../Schema.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation.js"; import { list } from "../list/index.js"; diff --git a/src/core/schemas/builders/undiscriminated-union/types.ts b/src/core/schemas/builders/undiscriminated-union/types.ts index ec6ad439..0d5096fa 100644 --- a/src/core/schemas/builders/undiscriminated-union/types.ts +++ b/src/core/schemas/builders/undiscriminated-union/types.ts @@ -1,4 +1,4 @@ -import { Schema, inferParsed, inferRaw } from "../../Schema.js"; +import type { inferParsed, inferRaw, Schema } from "../../Schema.js"; export type UndiscriminatedUnionSchema = Schema< inferRawUnidiscriminatedUnionSchema, diff --git a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts index f5fdb157..07591b4d 100644 --- a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts +++ b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts @@ -1,7 +1,14 @@ -import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType, ValidationError } from "../../Schema.js"; +import { + type BaseSchema, + type MaybeValid, + type Schema, + type SchemaOptions, + SchemaType, + type ValidationError, +} from "../../Schema.js"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation.js"; import { getSchemaUtils } from "../schema-utils/index.js"; -import { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema } from "./types.js"; +import type { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema } from "./types.js"; export function undiscriminatedUnion, ...Schema[]]>( schemas: Schemas, diff --git a/src/core/schemas/builders/union/index.ts b/src/core/schemas/builders/union/index.ts index 7b487752..6bc29ba9 100644 --- a/src/core/schemas/builders/union/index.ts +++ b/src/core/schemas/builders/union/index.ts @@ -1,5 +1,5 @@ -export { discriminant } from "./discriminant.js"; export type { Discriminant } from "./discriminant.js"; +export { discriminant } from "./discriminant.js"; export type { inferParsedDiscriminant, inferParsedUnion, diff --git a/src/core/schemas/builders/union/types.ts b/src/core/schemas/builders/union/types.ts index bf19fa27..7bfdd636 100644 --- a/src/core/schemas/builders/union/types.ts +++ b/src/core/schemas/builders/union/types.ts @@ -1,5 +1,5 @@ -import { ObjectSchema, inferParsedObject, inferRawObject } from "../object/index.js"; -import { Discriminant } from "./discriminant.js"; +import type { inferParsedObject, inferRawObject, ObjectSchema } from "../object/index.js"; +import type { Discriminant } from "./discriminant.js"; export type UnionSubtypes = { [K in DiscriminantValues]: ObjectSchema; diff --git a/src/core/schemas/builders/union/union.ts b/src/core/schemas/builders/union/union.ts index df33568d..fa993fdc 100644 --- a/src/core/schemas/builders/union/union.ts +++ b/src/core/schemas/builders/union/union.ts @@ -1,21 +1,24 @@ -import { BaseSchema, MaybeValid, SchemaType } from "../../Schema.js"; +import { type BaseSchema, type MaybeValid, SchemaType } from "../../Schema.js"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType.js"; import { isPlainObject } from "../../utils/isPlainObject.js"; import { keys } from "../../utils/keys.js"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation.js"; import { enum_ } from "../enum/index.js"; -import { ObjectSchema } from "../object/index.js"; -import { ObjectLikeSchema, getObjectLikeUtils } from "../object-like/index.js"; +import type { ObjectSchema } from "../object/index.js"; +import { getObjectLikeUtils, type ObjectLikeSchema } from "../object-like/index.js"; import { getSchemaUtils } from "../schema-utils/index.js"; -import { Discriminant } from "./discriminant.js"; -import { - UnionSubtypes, +import type { Discriminant } from "./discriminant.js"; +import type { inferParsedDiscriminant, inferParsedUnion, inferRawDiscriminant, inferRawUnion, + UnionSubtypes, } from "./types.js"; +// eslint-disable-next-line @typescript-eslint/unbound-method +const _hasOwn = Object.prototype.hasOwnProperty; + export function union, U extends UnionSubtypes>( discriminant: D, union: U, @@ -112,7 +115,13 @@ function transformAndValidateUnion< }; } - const { [discriminant]: discriminantValue, ...additionalProperties } = value; + const discriminantValue = value[discriminant]; + const additionalProperties: Record = {}; + for (const key in value) { + if (_hasOwn.call(value, key) && key !== discriminant) { + additionalProperties[key] = value[key]; + } + } if (discriminantValue == null) { return { diff --git a/src/core/schemas/utils/createIdentitySchemaCreator.ts b/src/core/schemas/utils/createIdentitySchemaCreator.ts index 729c51c0..9aa4ed50 100644 --- a/src/core/schemas/utils/createIdentitySchemaCreator.ts +++ b/src/core/schemas/utils/createIdentitySchemaCreator.ts @@ -1,5 +1,5 @@ -import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType } from "../Schema.js"; import { getSchemaUtils } from "../builders/schema-utils/index.js"; +import type { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType } from "../Schema.js"; import { maybeSkipValidation } from "./maybeSkipValidation.js"; export function createIdentitySchemaCreator( diff --git a/src/core/schemas/utils/isPlainObject.ts b/src/core/schemas/utils/isPlainObject.ts index db82a722..32a17e05 100644 --- a/src/core/schemas/utils/isPlainObject.ts +++ b/src/core/schemas/utils/isPlainObject.ts @@ -4,14 +4,11 @@ export function isPlainObject(value: unknown): value is Record return false; } - if (Object.getPrototypeOf(value) === null) { + const proto = Object.getPrototypeOf(value); + if (proto === null) { return true; } - let proto = value; - while (Object.getPrototypeOf(proto) !== null) { - proto = Object.getPrototypeOf(proto); - } - - return Object.getPrototypeOf(value) === proto; + // Check that the prototype chain has exactly one level (i.e., proto is Object.prototype) + return Object.getPrototypeOf(proto) === null; } diff --git a/src/core/schemas/utils/maybeSkipValidation.ts b/src/core/schemas/utils/maybeSkipValidation.ts index c7fd6d93..f32d4525 100644 --- a/src/core/schemas/utils/maybeSkipValidation.ts +++ b/src/core/schemas/utils/maybeSkipValidation.ts @@ -1,4 +1,4 @@ -import { BaseSchema, MaybeValid, SchemaOptions } from "../Schema.js"; +import type { BaseSchema, MaybeValid, SchemaOptions } from "../Schema.js"; export function maybeSkipValidation, Raw, Parsed>(schema: S): S { return { diff --git a/src/core/url/encodePathParam.ts b/src/core/url/encodePathParam.ts new file mode 100644 index 00000000..19b90124 --- /dev/null +++ b/src/core/url/encodePathParam.ts @@ -0,0 +1,18 @@ +export function encodePathParam(param: unknown): string { + if (param === null) { + return "null"; + } + const typeofParam = typeof param; + switch (typeofParam) { + case "undefined": + return "undefined"; + case "string": + case "number": + case "boolean": + break; + default: + param = String(param); + break; + } + return encodeURIComponent(param as string | number | boolean); +} diff --git a/src/core/url/index.ts b/src/core/url/index.ts index ed5aa0ff..f2e0fa2d 100644 --- a/src/core/url/index.ts +++ b/src/core/url/index.ts @@ -1,2 +1,3 @@ +export { encodePathParam } from "./encodePathParam.js"; export { join } from "./join.js"; export { toQueryString } from "./qs.js"; diff --git a/src/core/url/join.ts b/src/core/url/join.ts index 200426be..7ca7daef 100644 --- a/src/core/url/join.ts +++ b/src/core/url/join.ts @@ -12,12 +12,11 @@ export function join(base: string, ...segments: string[]): string { try { url = new URL(base); } catch { - // Fallback to path joining if URL is malformed return joinPath(base, ...segments); } const lastSegment = segments[segments.length - 1]; - const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/"); + const shouldPreserveTrailingSlash = lastSegment?.endsWith("/"); for (const segment of segments) { const cleanSegment = trimSlashes(segment); @@ -44,7 +43,7 @@ function joinPath(base: string, ...segments: string[]): string { let result = base; const lastSegment = segments[segments.length - 1]; - const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/"); + const shouldPreserveTrailingSlash = lastSegment?.endsWith("/"); for (const segment of segments) { const cleanSegment = trimSlashes(segment); @@ -64,7 +63,7 @@ function joinPathSegments(left: string, right: string): string { if (left.endsWith("/")) { return left + right; } - return left + "/" + right; + return `${left}/${right}`; } function trimSlashes(str: string): string { diff --git a/src/core/websocket/exports.ts b/src/core/websocket/exports.ts new file mode 100644 index 00000000..91271654 --- /dev/null +++ b/src/core/websocket/exports.ts @@ -0,0 +1,9 @@ +import type * as events from "./events.js"; +import type * as ws from "./ws.js"; + +export type ReconnectingWebSocket = typeof ws.ReconnectingWebSocket; +export declare namespace ReconnectingWebSocket { + export type Event = events.Event; + export type CloseEvent = events.CloseEvent; + export type ErrorEvent = events.ErrorEvent; +} diff --git a/src/core/websocket/ws.ts b/src/core/websocket/ws.ts index b068af14..60895584 100644 --- a/src/core/websocket/ws.ts +++ b/src/core/websocket/ws.ts @@ -28,8 +28,8 @@ export declare namespace ReconnectingWebSocket { url: string; protocols?: string | string[]; options?: ReconnectingWebSocket.Options; - headers?: Record; - queryParameters?: Record; + headers?: Record; + queryParameters?: Record; } export type Options = { @@ -104,31 +104,15 @@ export class ReconnectingWebSocket { this._connect(); } - static get CONNECTING() { - return 0; - } - static get OPEN() { - return 1; - } - static get CLOSING() { - return 2; - } - static get CLOSED() { - return 3; - } + public static readonly CONNECTING = 0; + public static readonly OPEN = 1; + public static readonly CLOSING = 2; + public static readonly CLOSED = 3; - get CONNECTING() { - return ReconnectingWebSocket.CONNECTING; - } - get OPEN() { - return ReconnectingWebSocket.OPEN; - } - get CLOSING() { - return ReconnectingWebSocket.CLOSING; - } - get CLOSED() { - return ReconnectingWebSocket.CLOSED; - } + public readonly CONNECTING: typeof ReconnectingWebSocket.CONNECTING = ReconnectingWebSocket.CONNECTING; + public readonly OPEN: typeof ReconnectingWebSocket.OPEN = ReconnectingWebSocket.OPEN; + public readonly CLOSING: typeof ReconnectingWebSocket.CLOSING = ReconnectingWebSocket.CLOSING; + public readonly CLOSED: typeof ReconnectingWebSocket.CLOSED = ReconnectingWebSocket.CLOSED; get binaryType() { return this._ws ? this._ws.binaryType : this._binaryType; @@ -227,7 +211,7 @@ export class ReconnectingWebSocket { * Closes the WebSocket connection or connection attempt, if any. If the connection is already * CLOSED, this method does nothing */ - public close(code = 1000, reason?: string) { + public close(code = 1000, reason?: string): void { this._closeCalled = true; this._shouldReconnect = false; this._clearTimeouts(); @@ -246,7 +230,7 @@ export class ReconnectingWebSocket { * Closes the WebSocket connection or connection attempt and connects again. * Resets retry counter; */ - public reconnect(code?: number, reason?: string) { + public reconnect(code?: number, reason?: string): void { this._shouldReconnect = true; this._closeCalled = false; this._retryCount = -1; @@ -261,7 +245,7 @@ export class ReconnectingWebSocket { /** * Enqueue specified data to be transmitted to the server over the WebSocket connection */ - public send(data: ReconnectingWebSocket.Message) { + public send(data: ReconnectingWebSocket.Message): void { if (this._ws && this._ws.readyState === this.OPEN) { this._debug("send", data); this._ws.send(data); @@ -330,7 +314,7 @@ export class ReconnectingWebSocket { } = this._options; let delay = 0; if (this._retryCount > 0) { - delay = minReconnectionDelay * Math.pow(reconnectionDelayGrowFactor, this._retryCount - 1); + delay = minReconnectionDelay * reconnectionDelayGrowFactor ** (this._retryCount - 1); if (delay > maxReconnectionDelay) { delay = maxReconnectionDelay; } @@ -425,7 +409,7 @@ export class ReconnectingWebSocket { try { this._ws.close(code, reason); this._handleClose(new Events.CloseEvent(code, reason, this)); - } catch (error) { + } catch (_error) { // ignore } } diff --git a/src/custom/CortiAuth.ts b/src/custom/CortiAuth.ts deleted file mode 100644 index 85189587..00000000 --- a/src/custom/CortiAuth.ts +++ /dev/null @@ -1,385 +0,0 @@ -/** - * This file is implementation of the Auth client that can be used in 2 scenarios: - * 1. Under the hood by the package when Client credentials are used - * 2. Directly imported by the user to implement Authorization code flow - * - * Locally based on the auto-generated Auth client (src/api/resources/auth/client/Client.ts), but with some changes: - * 1. Token request sends proper `application/x-www-form-urlencoded` content type instead of `application/json` - * 2. Token request accepts additional parameters to support Authorization code flow - * 3. Additional methods to support Authorization code flow - * - * All methods are re-implemented, but class still extends the auto-generated one to make sure that we keep the same interface - * and to maybe remove some of the re-implementations in the future when `x-www-form-urlencoded` is supported - */ - -import { Auth as FernAuth } from "../api/resources/auth/client/Client.js"; -import * as core from "../core/index.js"; -import * as Corti from "../api/index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../core/headers.js"; -import * as serializers from "../serialization/index.js"; -import * as errors from "../errors/index.js"; -import { Environment, CortiInternalEnvironment, getEnvironment } from "./utils/getEnvironmentFromString.js"; -import { ParseError } from "../core/schemas/builders/schema-utils/ParseError.js"; -import { getLocalStorageItem, setLocalStorageItem } from "./utils/localStorage.js"; -import { generateCodeChallenge, generateCodeVerifier } from "./utils/pkce.js"; -import { buildTokenRequestBody } from "./utils/tokenRequest.js"; - -const CODE_VERIFIER_KEY = "corti_js_sdk_code_verifier"; - -/** - * Patch: added codeChallenge to the AuthorizationCodeClient interface to support PKCE flow - */ -interface AuthorizationCodeClient { - clientId: string; - redirectUri: string; - codeChallenge?: string; - scopes?: string[]; -} - -/** - * Patch: renamed AuthorizationCodeClient to AuthorizationCode as it can be used for both(server and client) flows - */ -interface AuthorizationCode { - clientId: string; - clientSecret: string; - redirectUri: string; - code: string; - scopes?: string[]; -} - -/** - * Patch: added type for AuthorizationPkce request - */ -interface AuthorizationPkce { - clientId: string; - redirectUri: string; - code: string; - codeVerifier?: string; - scopes?: string[]; -} - -/** - * Patch: added type for AuthorizationRopc request - */ -interface AuthorizationRopcServer { - clientId: string; - username: string; - password: string; - scopes?: string[]; -} - -interface AuthorizationRefreshServer { - clientId: string; - /** - * Patch: added optional clientSecret for ROPC and PKCE flow - */ - clientSecret?: string; - refreshToken: string; - scopes?: string[]; -} - -interface Options { - skipRedirect?: boolean; -} - -type AuthOptionsBase = Omit; - -// When baseUrl is provided, environment and tenantName are optional -type AuthOptionsWithBaseUrl = AuthOptionsBase & { - baseUrl: core.Supplier; - environment?: Environment; - tenantName?: core.Supplier; -}; - -// When environment is an object, tenantName is optional -type AuthOptionsWithObjectEnvironment = AuthOptionsBase & { - baseUrl?: core.Supplier; - environment: CortiInternalEnvironment; - tenantName?: core.Supplier; -}; - -// When environment is a string, tenantName is required -type AuthOptionsWithStringEnvironment = AuthOptionsBase & { - baseUrl?: core.Supplier; - environment: string; - tenantName: core.Supplier; -}; - -type AuthOptions = AuthOptionsWithBaseUrl | AuthOptionsWithObjectEnvironment | AuthOptionsWithStringEnvironment; - -export class Auth extends FernAuth { - /** - * Patch: use custom AuthOptions type to support string-based environment - * When baseUrl is provided, environment and tenantName become optional - */ - constructor(_options: AuthOptions) { - super({ - ..._options, - tenantName: _options.tenantName || "", - environment: getEnvironment(_options.environment), - }); - } - - /** - * Patch: Generate PKCE authorization URL with automatic code verifier generation - */ - public async authorizePkceUrl( - { clientId, redirectUri, scopes }: AuthorizationCodeClient, - options?: Options, - ): Promise { - const codeVerifier = generateCodeVerifier(); - setLocalStorageItem(CODE_VERIFIER_KEY, codeVerifier); - - const codeChallenge = await generateCodeChallenge(codeVerifier); - - return this.authorizeURL( - { - clientId, - redirectUri, - codeChallenge, - scopes, - }, - options, - ); - } - - /** - * Patch: Get the stored PKCE code verifier - */ - public getCodeVerifier(): string | null { - return getLocalStorageItem(CODE_VERIFIER_KEY); - } - - /** - * Patch: called custom implementation this.__getToken_custom instead of this.__getToken - * Extended to support additional scopes - */ - public getToken( - request: Corti.AuthGetTokenRequest & { scopes?: string[] }, - requestOptions?: FernAuth.RequestOptions, - ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__getToken_custom(request, requestOptions)); - } - - /** - * Patch: added method to get Authorization URL for Authorization code flow and PKCE flow - */ - public async authorizeURL( - { clientId, redirectUri, codeChallenge, scopes }: AuthorizationCodeClient, - options?: Options, - ): Promise { - const authUrl = new URL( - core.url.join( - (await core.Supplier.get(this._options.baseUrl)) ?? - (await core.Supplier.get(this._options.environment)).login, - await core.Supplier.get(this._options.tenantName), - "protocol/openid-connect/auth", - ), - ); - - authUrl.searchParams.set("response_type", "code"); - - // Build scope string: always include "openid profile", add any additional scopes - const allScopes = ["openid", "profile", ...(scopes || [])]; - const scopeString = [...new Set(allScopes)].join(" "); - - authUrl.searchParams.set("scope", scopeString); - - if (clientId !== undefined) { - authUrl.searchParams.set("client_id", clientId); - } - - if (redirectUri !== undefined) { - authUrl.searchParams.set("redirect_uri", redirectUri); - } - - if (codeChallenge !== undefined) { - authUrl.searchParams.set("code_challenge", codeChallenge); - authUrl.searchParams.set("code_challenge_method", "S256"); - } - - const authUrlString = authUrl.toString(); - - if (typeof window !== "undefined" && !options?.skipRedirect) { - window.location.href = authUrlString; - return authUrlString; - } - - return authUrlString; - } - - /** - * Patch: calls __getToken_custom with additional fields to support Authorization code flow - */ - public getCodeFlowToken( - request: AuthorizationCode, - requestOptions?: FernAuth.RequestOptions, - ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise( - this.__getToken_custom( - { - ...request, - grantType: "authorization_code", - }, - requestOptions, - ), - ); - } - - /** - * Patch: PKCE-specific method - */ - public getPkceFlowToken( - request: AuthorizationPkce, - requestOptions?: FernAuth.RequestOptions, - ): core.HttpResponsePromise { - const codeVerifier = request.codeVerifier || this.getCodeVerifier(); - - if (!codeVerifier) { - throw new ParseError([ - { - path: ["codeVerifier"], - message: "Code verifier was not provided and not found in localStorage.", - }, - ]); - } - - return core.HttpResponsePromise.fromPromise( - this.__getToken_custom( - { - ...request, - codeVerifier: codeVerifier, - grantType: "authorization_code", - }, - requestOptions, - ), - ); - } - - /** - * Patch: ROPC-specific method - */ - public getRopcFlowToken( - request: AuthorizationRopcServer, - requestOptions?: FernAuth.RequestOptions, - ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise( - this.__getToken_custom( - { - ...request, - grantType: "password", - }, - requestOptions, - ), - ); - } - - /** - * Patch: copy of this.__getToken with patches - */ - private async __getToken_custom( - /** - * Patch: added additional fields to request to support Authorization PKCE and ROPC flow - */ - request: Corti.AuthGetTokenRequest & - Partial<{ - grantType: "client_credentials" | "authorization_code" | "refresh_token" | "password"; - code: string; - redirectUri: string; - refreshToken: string; - codeVerifier: string; - username: string; - password: string; - scopes: string[]; - }>, - requestOptions?: FernAuth.RequestOptions, - ): Promise> { - const _response = await core.fetcher({ - url: core.url.join( - (await core.Supplier.get(this._options.baseUrl)) ?? - (await core.Supplier.get(this._options.environment)).login, - /** - * Patch: use tenantName as path parameter - * (consider to be generated from the spec in the future) - */ - await core.Supplier.get(this._options.tenantName), - "protocol/openid-connect/token", - ), - method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - /** - * Patch: Removed `Authorization` header, as it is not needed for getting the token - */ - "Tenant-Name": requestOptions?.tenantName, - }), - requestOptions?.headers, - ), - contentType: "application/x-www-form-urlencoded", - /** - * Patch: removed `requestType: "json"`, made body a URLSearchParams object - */ - body: buildTokenRequestBody(request), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { - data: serializers.GetTokenResponse.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - rawResponse: _response.rawResponse, - }; - } - - if (_response.error.reason === "status-code") { - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - rawResponse: _response.rawResponse, - }); - } - - switch (_response.error.reason) { - case "non-json": - throw new errors.CortiError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.CortiTimeoutError( - "Timeout exceeded when calling POST /protocol/openid-connect/token.", - ); - case "unknown": - throw new errors.CortiError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - /** - * Patch: calls __getToken_custom with additional fields to support Refresh token flow - */ - public refreshToken( - request: AuthorizationRefreshServer, - requestOptions?: FernAuth.RequestOptions, - ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise( - this.__getToken_custom( - { - ...request, - grantType: "refresh_token", - }, - requestOptions, - ), - ); - } -} diff --git a/src/custom/CortiClient.ts b/src/custom/CortiClient.ts deleted file mode 100644 index 79f3cb92..00000000 --- a/src/custom/CortiClient.ts +++ /dev/null @@ -1,315 +0,0 @@ -/** - * This file is the custom implementation of the main CortiClient class (src/Client.ts) - * - * It's (almost) handwritten, and it replaces the auto-generated version, and here is why: - * - * 1. The auto-generated version uses direct client imports -> we can not always easily replace them without a patch in Main client - * 2. The auto-generated version produces TypeScript error when initializes authClient in `_oauthTokenProvider` - * 3. `_oauthTokenProvider` is a private field in the auto-generated version, - * so we cannot easily rewrite it in the custom implementation. We can use another field for OAuthProvider, - * but then we need to rewrite all the methods anyway => it will be easier to forget, - * since it would exist in the class, but not properly implemented - * - * => Must be manually synced with src/Client.ts (which is auto-generated). - * - * All the patches marked with `// Patch: ...` comments. - */ - -import * as environments from "../environments.js"; -import * as core from "../core/index.js"; -/** - * Patch: changed import to custom Auth implementation - */ -import { Auth } from "./CortiAuth.js"; -import { mergeHeaders } from "../core/headers.js"; -import { Interactions } from "../api/resources/interactions/client/Client.js"; -import { Recordings } from "../api/resources/recordings/client/Client.js"; -import { Transcripts } from "../api/resources/transcripts/client/Client.js"; -import { Facts } from "../api/resources/facts/client/Client.js"; -import { Documents } from "../api/resources/documents/client/Client.js"; -import { Templates } from "../api/resources/templates/client/Client.js"; -import { Agents } from "../api/resources/agents/client/Client.js"; -import { Codes } from "../api/resources/codes/client/Client.js"; - -/** - * Patch: changed import to custom Stream and Transcribe implementations - */ -import { Stream } from "./CustomStream.js"; -import { Transcribe } from "./CustomTranscribe.js"; - -/** - * Patch: added SDK_VERSION import and custom code imports - */ -import { SDK_VERSION } from "../version.js"; -import { getEnvironment, Environment, CortiInternalEnvironment } from "./utils/getEnvironmentFromString.js"; -import { resolveClientOptions } from "./utils/resolveClientOptions.js"; -import { BearerOptions, RefreshBearerProvider } from "./RefreshBearerProvider.js"; -import { setDefaultWithCredentials } from "./utils/withCredentialsConfig.js"; - -export declare namespace CortiClient { - /** - * Patch: added new public type for `Options` + internal interfaces to create it - */ - - /** Patch: exported headers type for options.headers and WS protocol encoding. */ - export type HeadersRecord = Record | undefined>; - - interface ClientCredentials { - clientId: core.Supplier; - clientSecret: core.Supplier; - } - - interface BaseOptions { - /** Additional headers to include in requests. */ - headers?: HeadersRecord; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - /** Patch: added new option to encode headers as WebSocket protocols for streaming resources (for proxy scenarios) */ - encodeHeadersAsWsProtocols?: boolean; - /** Patch: when true, fetcher sends credentials (cookies, auth headers) on cross-origin requests; sets global default used by core fetcher when not passed per-request */ - withCredentials?: boolean; - } - - interface OptionsWithClientCredentials extends BaseOptions { - /** - * Patch: allow to pass a custom string-based environment - * */ - environment: Environment; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - auth: ClientCredentials; - } - - interface OptionsWithBearerToken extends BaseOptions { - /** - * Patch: allow to pass a custom string-based environment - * */ - environment?: Environment; - /** Override the Tenant-Name header */ - tenantName?: core.Supplier; - auth: BearerOptions; - } - - // When baseUrl is provided, auth becomes optional (for proxying scenarios) - interface OptionsWithBaseUrl extends BaseOptions { - baseUrl: core.Supplier; - environment?: Environment; - tenantName?: core.Supplier; - auth?: ClientCredentials | BearerOptions; - } - - // When environment is an object, auth becomes optional (for proxying scenarios) - interface OptionsWithObjectEnvironment extends BaseOptions { - environment: CortiInternalEnvironment; - tenantName?: core.Supplier; - auth?: ClientCredentials | BearerOptions; - } - - export type Options = - | OptionsWithClientCredentials - | OptionsWithBearerToken - | OptionsWithBaseUrl - | OptionsWithObjectEnvironment; - - /** - * Patch: - * - renamed `Options` to `InternalOptions` - * - added `token` field to support BearerProvider - * - made clientId and clientSecret optional - * - updated environment type to CortiInternalEnvironment - * - added `encodeHeadersAsWsProtocols` - * - added `withCredentials` - */ - interface InternalOptions { - environment: CortiInternalEnvironment; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - clientId?: core.Supplier; - clientSecret?: core.Supplier; - token?: core.Supplier; - /** Override the Tenant-Name header */ - tenantName: core.Supplier; - /** Additional headers to include in requests. */ - headers?: HeadersRecord; - encodeHeadersAsWsProtocols?: boolean; - withCredentials?: boolean; - } - - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Override the Tenant-Name header */ - tenantName?: string; - /** Additional headers to include in the request. */ - headers?: HeadersRecord; - } -} - -export class CortiClient { - /** - * Patch: this._options is now of type `CortiClient.InternalOptions` (which matches generated implementation) - */ - protected readonly _options: CortiClient.InternalOptions; - /** - * Patch: extended `_oauthTokenProvider` to support both `RefreshBearerProvider` and `OAuthTokenProvider` options - * Optional - not created when auth is not provided (proxying scenarios) - */ - private readonly _oauthTokenProvider?: core.OAuthTokenProvider | RefreshBearerProvider; - protected _interactions: Interactions | undefined; - protected _recordings: Recordings | undefined; - protected _transcripts: Transcripts | undefined; - protected _facts: Facts | undefined; - protected _templates: Templates | undefined; - protected _documents: Documents | undefined; - protected _agents: Agents | undefined; - /** - * Patch: removed `auth` field - * `_oauthTokenProvider` uses Auth module directly to get the token, - * and our client also don't need to use it within the main client. - * For other cases they can use `CortiAuth` module directly. - */ - protected _stream: Stream | undefined; - protected _transcribe: Transcribe | undefined; - protected _codes: Codes | undefined; - - constructor(_options: CortiClient.Options) { - /** - * Patch: resolve tenantName and environment from options or token - */ - const { tenantName, environment, initialTokenResponse } = resolveClientOptions(_options); - - /** - * Patch: redefining options based on new schema - */ - this._options = { - ..._options, - headers: mergeHeaders( - { - "Tenant-Name": tenantName, - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "@corti/sdk", - /** - * Patch: replaced hardcoded SDK version with imported one - */ - "X-Fern-SDK-Version": SDK_VERSION, - "User-Agent": `@corti/sdk/${SDK_VERSION}`, - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - }, - _options?.headers, - ), - clientId: _options.auth && "clientId" in _options.auth ? _options.auth.clientId : undefined, - clientSecret: _options.auth && "clientSecret" in _options.auth ? _options.auth.clientSecret : undefined, - token: _options.auth && "accessToken" in _options.auth ? _options.auth.accessToken : undefined, - tenantName, - environment: getEnvironment(environment), - withCredentials: _options.withCredentials, - }; - - /** - * Patch: set global default for fetcher withCredentials when passed on CortiClient - */ - if (_options.withCredentials !== undefined) { - setDefaultWithCredentials(_options.withCredentials); - } - - /** - * Patch: if `clientId` is provided, use OAuthTokenProvider, otherwise use BearerProvider - * Only create token provider when auth is provided - */ - if (_options.auth) { - this._oauthTokenProvider = - "clientId" in _options.auth - ? new core.OAuthTokenProvider({ - clientId: _options.auth.clientId, - clientSecret: _options.auth.clientSecret, - /** - * Patch: provide whole `options` object to the Auth client, since it depends on both tenantName and environment - */ - authClient: new Auth(this._options), - }) - : new RefreshBearerProvider({ - ..._options.auth, - initialTokenResponse, - }); - } - } - - public get interactions(): Interactions { - return (this._interactions ??= new Interactions({ - ...this._options, - token: this._oauthTokenProvider ? async () => await this._oauthTokenProvider!.getToken() : undefined, - })); - } - - public get recordings(): Recordings { - return (this._recordings ??= new Recordings({ - ...this._options, - token: this._oauthTokenProvider ? async () => await this._oauthTokenProvider!.getToken() : undefined, - })); - } - - public get transcripts(): Transcripts { - return (this._transcripts ??= new Transcripts({ - ...this._options, - token: this._oauthTokenProvider ? async () => await this._oauthTokenProvider!.getToken() : undefined, - })); - } - - public get facts(): Facts { - return (this._facts ??= new Facts({ - ...this._options, - token: this._oauthTokenProvider ? async () => await this._oauthTokenProvider!.getToken() : undefined, - })); - } - - public get documents(): Documents { - return (this._documents ??= new Documents({ - ...this._options, - token: this._oauthTokenProvider ? async () => await this._oauthTokenProvider!.getToken() : undefined, - })); - } - - public get templates(): Templates { - return (this._templates ??= new Templates({ - ...this._options, - token: this._oauthTokenProvider ? async () => await this._oauthTokenProvider!.getToken() : undefined, - })); - } - - public get agents(): Agents { - return (this._agents ??= new Agents({ - ...this._options, - token: this._oauthTokenProvider ? async () => await this._oauthTokenProvider!.getToken() : undefined, - })); - } - - public get stream(): Stream { - return (this._stream ??= new Stream({ - ...this._options, - token: this._oauthTokenProvider ? async () => await this._oauthTokenProvider!.getToken() : undefined, - })); - } - - public get transcribe(): Transcribe { - return (this._transcribe ??= new Transcribe({ - ...this._options, - token: this._oauthTokenProvider ? async () => await this._oauthTokenProvider!.getToken() : undefined, - })); - } - - public get codes(): Codes { - return (this._codes ??= new Codes({ - ...this._options, - token: this._oauthTokenProvider ? async () => await this._oauthTokenProvider!.getToken() : undefined, - })); - } - - /** - * Patch: removed `auth` getter - */ -} diff --git a/src/custom/CortiSDKError.ts b/src/custom/CortiSDKError.ts deleted file mode 100644 index d40a811a..00000000 --- a/src/custom/CortiSDKError.ts +++ /dev/null @@ -1,26 +0,0 @@ -export interface CortiSDKErrorOptions { - code: CortiSDKErrorCodes; - cause?: unknown; -} - -export enum CortiSDKErrorCodes { - LOCAL_STORAGE_ERROR = "local_storage_error", -} - -export class CortiSDKError extends Error { - public readonly code: CortiSDKErrorCodes; - public readonly cause?: unknown; - - constructor( - message = "An unexpected error occurred in the Corti SDK.", - options: CortiSDKErrorOptions = { code: CortiSDKErrorCodes.LOCAL_STORAGE_ERROR }, - ) { - super(message); - this.name = "CortiSDKError"; - this.code = options.code; - if ("cause" in options) { - this.cause = options.cause; - } - Object.setPrototypeOf(this, CortiSDKError.prototype); - } -} diff --git a/src/custom/CortiWebSocketProxyClient.ts b/src/custom/CortiWebSocketProxyClient.ts deleted file mode 100644 index f137c094..00000000 --- a/src/custom/CortiWebSocketProxyClient.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Patch: Lightweight proxy client with only WebSocket resources (stream and transcribe). - * Use this when you need direct WebSocket connections through your own proxy backend. - * - * No environment or tenantName required - proxy is required in connect(). - */ - -import { CustomProxyStream } from "./proxy/CustomProxyStream.js"; -import { CustomProxyTranscribe } from "./proxy/CustomProxyTranscribe.js"; - -export class CortiWebSocketProxyClient { - private static _stream: CustomProxyStream | undefined; - private static _transcribe: CustomProxyTranscribe | undefined; - - public static get stream(): CustomProxyStream { - return (this._stream ??= new CustomProxyStream()); - } - - public static get transcribe(): CustomProxyTranscribe { - return (this._transcribe ??= new CustomProxyTranscribe()); - } -} diff --git a/src/custom/CustomStream.ts b/src/custom/CustomStream.ts deleted file mode 100644 index 21448eae..00000000 --- a/src/custom/CustomStream.ts +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Patch: use custom Stream implementation to support passing _options parameters to connection function - */ -import { Stream as FernStream } from "../api/resources/stream/client/Client.js"; - -import * as core from "../core/index.js"; - -/** - * Patch: added import for types and message parsing logic - */ -import * as api from "../api/index.js"; -import { fromJson } from "../core/json.js"; -import * as serializers from "../serialization/index.js"; -import { ErrorEvent } from "../core/websocket/events.js"; - -/** - * Patch: changed import to custom StreamSocket implementation - */ -import { StreamSocket } from "./CustomStreamSocket.js"; -/** - * Patch: import getWsProtocols for building WS protocols from headers when encodeHeadersAsWsProtocols is set. - */ -import { getWsProtocols } from "./utils/encodeHeadersAsWsProtocols.js"; -import type { CortiClient } from "./CortiClient.js"; - -/** Patch: options type extended with encodeHeadersAsWsProtocols (set by CortiClient). */ -type StreamOptionsWithEncode = FernStream["_options"] & { encodeHeadersAsWsProtocols?: boolean }; - -export class Stream extends FernStream { - /** Patch: narrow type so encodeHeadersAsWsProtocols is available when client is CortiClient. */ - protected readonly _options: StreamOptionsWithEncode; - - /** Patch: constructor accepts extended options so _options is correctly typed. */ - constructor(_options: StreamOptionsWithEncode) { - super(_options); - this._options = _options; - } - - /** - * Patch: use custom connect method to support passing _options parameters. - * Patch: optional proxy parameter for direct WebSocket connection (proxy scenarios). - * Patch: use proxy path when proxy is passed or encodeHeadersAsWsProtocols is set. - * Patch: protocols from getWsProtocols; queryParameters from proxy or empty. - */ - public async connect({ - configuration, - proxy, - ...args - }: Omit & { - configuration?: api.StreamConfig; - /** Patch: proxy connection options - bypasses normal URL construction. protocols: array passed as-is, object encoded like headers. */ - proxy?: { - url?: string; - protocols?: string[] | CortiClient.HeadersRecord; - queryParameters?: Record; - }; - }): Promise { - const useProxyPath = proxy || this._options.encodeHeadersAsWsProtocols; - const protocols = await getWsProtocols(this._options, proxy?.protocols); - - const socket = useProxyPath - ? new core.ReconnectingWebSocket({ - url: - proxy?.url || - core.url.join( - (await core.Supplier.get(this._options["baseUrl"])) ?? - (await core.Supplier.get(this._options["environment"])).wss, - `/interactions/${encodeURIComponent(args.id)}/streams` - ), - protocols, - queryParameters: proxy?.queryParameters ?? {}, - headers: args.headers ?? {}, - options: { debug: args.debug ?? false, maxRetries: args.reconnectAttempts ?? 30 }, - }) - : ( - await super.connect({ - ...args, - token: (await this._getAuthorizationHeader()) || "", - tenantName: await core.Supplier.get(this._options.tenantName), - }) - ).socket; - - const ws = new StreamSocket({ socket }); - - if (!configuration) { - return ws; - } - - ws.socket.addEventListener("open", () => { - ws.sendConfiguration({ - type: "config", - configuration, - }); - }); - - ws.socket.addEventListener("message", (event) => { - const data = fromJson(event.data); - - const parsedResponse = serializers.StreamSocketResponse.parse(data, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - omitUndefined: true, - }); - - if (parsedResponse.ok && parsedResponse.value.type === "CONFIG_ACCEPTED") { - return; - } - - if ( - parsedResponse.ok && - (parsedResponse.value.type === "CONFIG_DENIED" || - parsedResponse.value.type === "CONFIG_MISSING" || - parsedResponse.value.type === "CONFIG_TIMEOUT" || - parsedResponse.value.type === "CONFIG_NOT_PROVIDED") - ) { - ws.socket.dispatchEvent( - new ErrorEvent( - { - name: parsedResponse.value.type, - message: JSON.stringify(parsedResponse.value), - }, - "", - ), - ); - - ws.close(); - return; - } - - if (parsedResponse.ok && parsedResponse.value.type === "error") { - ws.socket.dispatchEvent( - new ErrorEvent( - { - name: "error", - message: JSON.stringify(parsedResponse.value), - }, - "", - ), - ); - - ws.close(); - return; - } - - if (parsedResponse.ok && parsedResponse.value.type === "ENDED") { - ws.close(); - return; - } - }); - - return ws; - } -} diff --git a/src/custom/CustomStreamSocket.ts b/src/custom/CustomStreamSocket.ts deleted file mode 100644 index 74f27cb2..00000000 --- a/src/custom/CustomStreamSocket.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Patch: file patches disability of auto-generating binary data methods for sending data to the socket - */ -import { StreamSocket as FernStreamSocket } from "../api/resources/stream/client/Socket.js"; -import * as core from "../core/index.js"; -import { ReconnectingWebSocket } from "../core/index.js"; - -export class StreamSocket extends FernStreamSocket { - public sendAudio(message: ArrayBufferLike | Blob | ArrayBufferView | string): void { - if (typeof message === "string") { - return super.sendAudio(message); - } - - this.__assertSocketIsOpen(); - super.sendBinary(message); - } - - /** - * Patch: have to repeat this method, because it is private in the base class - */ - private __assertSocketIsOpen(): void { - if (!this.socket) { - throw new Error("Socket is not connected."); - } - - if (this.socket.readyState !== core.ReconnectingWebSocket.OPEN) { - throw new Error("Socket is not open."); - } - } - - /** - * Patch: added ability to remove event handlers - */ - public off(event: T, callback?: FernStreamSocket.EventHandlers[T]) { - if (!callback || callback === this.eventHandlers[event]) { - delete this.eventHandlers[event]; - } - } - - /** - * Patch: expose underlying socket send method for direct access - */ - public send(data: ReconnectingWebSocket.Message): void { - this.socket.send(data); - } -} diff --git a/src/custom/CustomTranscribe.ts b/src/custom/CustomTranscribe.ts deleted file mode 100644 index a5a9db0e..00000000 --- a/src/custom/CustomTranscribe.ts +++ /dev/null @@ -1,152 +0,0 @@ -/** - * Patch: use custom Transcribe implementation to support passing _options parameters to connection function - */ -import { Transcribe as FernTranscribe } from "../api/resources/transcribe/client/Client.js"; - -import * as core from "../core/index.js"; - -/** - * Patch: added import for types and message parsing logic - */ -import * as api from "../api/index.js"; -import { fromJson } from "../core/json.js"; -import * as serializers from "../serialization/index.js"; -import { ErrorEvent } from "../core/websocket/events.js"; - -/** - * Patch: changed import to custom TranscribeSocket implementation - */ -import { TranscribeSocket } from "./CustomTranscribeSocket.js"; -/** - * Patch: import getWsProtocols for building WS protocols from headers when encodeHeadersAsWsProtocols is set. - */ -import { getWsProtocols } from "./utils/encodeHeadersAsWsProtocols.js"; -import type { CortiClient } from "./CortiClient.js"; - -/** Patch: options type extended with encodeHeadersAsWsProtocols (set by CortiClient). */ -type TranscribeOptionsWithEncode = FernTranscribe["_options"] & { encodeHeadersAsWsProtocols?: boolean }; - -export class Transcribe extends FernTranscribe { - /** Patch: narrow type so encodeHeadersAsWsProtocols is available when client is CortiClient. */ - protected readonly _options: TranscribeOptionsWithEncode; - - /** Patch: constructor accepts extended options so _options is correctly typed. */ - constructor(_options: TranscribeOptionsWithEncode) { - super(_options); - this._options = _options; - } - - /** - * Patch: use custom connect method to support passing _options parameters. - * Patch: optional proxy parameter for direct WebSocket connection (proxy scenarios). - * Patch: use proxy path when proxy is passed or encodeHeadersAsWsProtocols is set. - * Patch: protocols from getWsProtocols; queryParameters from proxy or empty. - */ - public async connect({ - configuration, - proxy, - ...args - }: Omit & { - configuration?: api.TranscribeConfig; - /** Patch: proxy connection options - bypasses normal URL construction. protocols: array passed as-is, object encoded like headers. */ - proxy?: { - url?: string; - protocols?: string[] | CortiClient.HeadersRecord; - queryParameters?: Record; - }; - } = {}): Promise { - const useProxyPath = proxy || this._options.encodeHeadersAsWsProtocols; - const protocols = await getWsProtocols(this._options, proxy?.protocols); - - const socket = useProxyPath - ? new core.ReconnectingWebSocket({ - url: - proxy?.url || - core.url.join( - (await core.Supplier.get(this._options["baseUrl"])) ?? - (await core.Supplier.get(this._options["environment"])).wss, - "/transcribe" - ), - protocols, - queryParameters: proxy?.queryParameters ?? {}, - headers: args.headers ?? {}, - options: { debug: args.debug ?? false, maxRetries: args.reconnectAttempts ?? 30 }, - }) - : ( - await super.connect({ - ...args, - token: (await this._getAuthorizationHeader()) || "", - tenantName: await core.Supplier.get(this._options.tenantName), - }) - ).socket; - - const ws = new TranscribeSocket({ socket }); - - if (!configuration) { - return ws; - } - - ws.socket.addEventListener("open", () => { - ws.sendConfiguration({ - type: "config", - configuration, - }); - }); - - ws.socket.addEventListener("message", (event) => { - const data = fromJson(event.data); - - const parsedResponse = serializers.TranscribeSocketResponse.parse(data, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - omitUndefined: true, - }); - - if (parsedResponse.ok && parsedResponse.value.type === "CONFIG_ACCEPTED") { - return; - } - - if ( - parsedResponse.ok && - (parsedResponse.value.type === "CONFIG_DENIED" || parsedResponse.value.type === "CONFIG_TIMEOUT") - ) { - ws.socket.dispatchEvent( - new ErrorEvent( - { - name: parsedResponse.value.type, - message: JSON.stringify(parsedResponse.value), - }, - "", - ), - ); - - ws.close(); - return; - } - - if (parsedResponse.ok && parsedResponse.value.type === "error") { - ws.socket.dispatchEvent( - new ErrorEvent( - { - name: "error", - message: JSON.stringify(parsedResponse.value), - }, - "", - ), - ); - - ws.close(); - return; - } - - if (parsedResponse.ok && parsedResponse.value.type === "ended") { - ws.close(); - return; - } - }); - - return ws; - } -} diff --git a/src/custom/CustomTranscribeSocket.ts b/src/custom/CustomTranscribeSocket.ts deleted file mode 100644 index 1cb493e7..00000000 --- a/src/custom/CustomTranscribeSocket.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Patch: file patches disability of auto-generating binary data methods for sending data to the socket - */ -import { TranscribeSocket as FernTranscribeSocket } from "../api/resources/transcribe/client/Socket.js"; -import * as core from "../core/index.js"; -import { ReconnectingWebSocket } from "../core/index.js"; - -export class TranscribeSocket extends FernTranscribeSocket { - public sendAudio(message: ArrayBufferLike | Blob | ArrayBufferView | string): void { - if (typeof message === "string") { - return super.sendAudio(message); - } - - this.__assertSocketIsOpen(); - super.sendBinary(message); - } - - /** - * Patch: have to repeat this method, because it is private in the base class - */ - private __assertSocketIsOpen(): void { - if (!this.socket) { - throw new Error("Socket is not connected."); - } - - if (this.socket.readyState !== core.ReconnectingWebSocket.OPEN) { - throw new Error("Socket is not open."); - } - } - - /** - * Patch: added ability to remove event handlers - */ - public off( - event: T, - callback?: FernTranscribeSocket.EventHandlers[T], - ) { - if (!callback || callback === this.eventHandlers[event]) { - delete this.eventHandlers[event]; - } - } - - /** - * Patch: expose underlying socket send method for direct access - */ - public send(data: ReconnectingWebSocket.Message): void { - this.socket.send(data); - } -} diff --git a/src/custom/RefreshBearerProvider.ts b/src/custom/RefreshBearerProvider.ts deleted file mode 100644 index 15c90e43..00000000 --- a/src/custom/RefreshBearerProvider.ts +++ /dev/null @@ -1,129 +0,0 @@ -/** - * RefreshBearerProvider used as a replacement of OAuthTokenProvider, in case when accessToken from outside of library was used instead of Client credentials. - */ - -import * as core from "../core/index.js"; -import * as api from "../api/index.js"; -import { decodeToken } from "./utils/decodeToken.js"; - -export type ExpectedTokenResponse = Omit & { - tokenType?: string; - expiresIn?: number; -}; -type RefreshAccessTokenFunction = (refreshToken?: string) => Promise | ExpectedTokenResponse; - -export type BearerOptions = Partial> & - ( - | { - refreshAccessToken?: RefreshAccessTokenFunction; - accessToken: string; - } - | { - refreshAccessToken: RefreshAccessTokenFunction; - accessToken?: string; - } - ); - -export class RefreshBearerProvider { - private readonly BUFFER_IN_MINUTES = 2; - - private _accessToken: string; - private _refreshToken: string | undefined; - - private _refreshAccessToken: RefreshAccessTokenFunction | undefined; - - private _expiresAt: Date; - private _refreshExpiresAt: Date; - private _initialTokenResponse: Promise | undefined; - - constructor({ - accessToken, - refreshAccessToken, - refreshToken, - refreshExpiresIn, - expiresIn, - initialTokenResponse, - }: BearerOptions & { - initialTokenResponse?: Promise; - }) { - this._accessToken = accessToken || "no_token"; - this._refreshToken = refreshToken; - this._initialTokenResponse = initialTokenResponse; - - this._expiresAt = this.getExpiresAt(expiresIn, this._accessToken, this.BUFFER_IN_MINUTES); - this._refreshExpiresAt = this.getExpiresAt(refreshExpiresIn, this._refreshToken, 0); - - this._refreshAccessToken = refreshAccessToken; - } - - public async getToken(): Promise { - if (this._accessToken && this._accessToken !== "no_token" && this._expiresAt > new Date()) { - return core.Supplier.get(this._accessToken); - } - - if (this._initialTokenResponse) { - const tokenResponse = await this._initialTokenResponse; - this._initialTokenResponse = undefined; - - this._accessToken = tokenResponse.accessToken; - this._expiresAt = this.getExpiresAt( - tokenResponse.expiresIn, - tokenResponse.accessToken, - this.BUFFER_IN_MINUTES, - ); - - this._refreshToken = tokenResponse.refreshToken; - this._refreshExpiresAt = this.getExpiresAt(tokenResponse.refreshExpiresIn, this._refreshToken, 0); - - return this.getToken(); - } - - return this.refresh(); - } - - private async refresh(): Promise { - if (!this._refreshAccessToken || (this._refreshToken && this._refreshExpiresAt < new Date())) { - return core.Supplier.get(this._accessToken); - } - - const tokenResponse = await this._refreshAccessToken(this._refreshToken); - - this._accessToken = tokenResponse.accessToken; - this._expiresAt = this.getExpiresAt(tokenResponse.expiresIn, tokenResponse.accessToken, this.BUFFER_IN_MINUTES); - - this._refreshToken = tokenResponse.refreshToken; - this._refreshExpiresAt = this.getExpiresAt(tokenResponse.refreshExpiresIn, this._refreshToken, 0); - - return this._accessToken; - } - - private getExpiresAt( - expiresIn: number | undefined, - token: string | undefined, - bufferInMinutes: number = this.BUFFER_IN_MINUTES, - ): Date { - if (typeof expiresIn === "number") { - const now = new Date(); - - return new Date(now.getTime() + expiresIn * 1000 - bufferInMinutes * 60 * 1000); - } - - return this.parseTokenExpiry(token, bufferInMinutes) || this.getExpiresAt(0, token, bufferInMinutes); - } - - private parseTokenExpiry(token: string | undefined, bufferInMinutes: number): Date | undefined { - if (!token || token === "no_token") { - return; - } - - try { - const decoded = decodeToken(token); - - if (decoded && typeof decoded.expiresAt === "number") { - const ms = decoded.expiresAt * 1000 - bufferInMinutes * 60 * 1000; - - return new Date(ms); - } - } catch {} - } -} diff --git a/src/custom/index.ts b/src/custom/index.ts deleted file mode 100644 index 49d89d60..00000000 --- a/src/custom/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./RefreshBearerProvider.js"; diff --git a/src/custom/proxy/CustomProxyStream.ts b/src/custom/proxy/CustomProxyStream.ts deleted file mode 100644 index bb114a4d..00000000 --- a/src/custom/proxy/CustomProxyStream.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Patch: Proxy-specific Stream wrapper that enforces `proxy` as required. - * - * Reuses the underlying CustomStream class to preserve the logic we added on top - * of generated sockets (e.g., sending configuration messages, handling responses). - */ - -import * as environments from "../../environments.js"; -import * as api from "../../api/index.js"; -import { Stream } from "../CustomStream.js"; -import { StreamSocket } from "../CustomStreamSocket.js"; -import type { CortiClient } from "../CortiClient.js"; - -export type ProxyOptions = { - url: string; - /** Array passed as-is to WS; object encoded like headers (name, encodeURIComponent(value), ...). */ - protocols?: string[] | CortiClient.HeadersRecord; - queryParameters?: Record; -}; - -export class CustomProxyStream { - private _stream: Stream; - - constructor() { - this._stream = new Stream({ - environment: environments.CortiEnvironment.Eu, - tenantName: "", - }); - } - - public connect(args: { - proxy: ProxyOptions; - configuration?: api.StreamConfig; - debug?: boolean; - reconnectAttempts?: number; - }): Promise { - // id is not used in proxy mode, but required by the underlying type - return this._stream.connect({ ...args, id: "" }); - } -} diff --git a/src/custom/proxy/CustomProxyTranscribe.ts b/src/custom/proxy/CustomProxyTranscribe.ts deleted file mode 100644 index a9e14556..00000000 --- a/src/custom/proxy/CustomProxyTranscribe.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Patch: Proxy-specific Transcribe wrapper that enforces `proxy` as required. - * - * Reuses the underlying CustomTranscribe class to preserve the logic we added on top - * of generated sockets (e.g., sending configuration messages, handling responses). - */ - -import * as environments from "../../environments.js"; -import * as api from "../../api/index.js"; -import { Transcribe } from "../CustomTranscribe.js"; -import { TranscribeSocket } from "../CustomTranscribeSocket.js"; -import type { CortiClient } from "../CortiClient.js"; - -export type ProxyOptions = { - url: string; - /** Array passed as-is to WS; object encoded like headers (name, encodeURIComponent(value), ...). */ - protocols?: string[] | CortiClient.HeadersRecord; - queryParameters?: Record; -}; - -export class CustomProxyTranscribe { - private _transcribe: Transcribe; - - constructor() { - this._transcribe = new Transcribe({ - environment: environments.CortiEnvironment.Eu, - tenantName: "", - }); - } - - public connect(args: { - proxy: ProxyOptions; - configuration?: api.TranscribeConfig; - debug?: boolean; - reconnectAttempts?: number; - }): Promise { - return this._transcribe.connect(args); - } -} diff --git a/src/custom/utils/decodeToken.ts b/src/custom/utils/decodeToken.ts deleted file mode 100644 index 770010f5..00000000 --- a/src/custom/utils/decodeToken.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Decodes a JWT token and extracts environment and tenant details from its issuer URL. - * - * This function assumes the JWT token follows the standard header.payload.signature format. - * It decodes the payload from base64 URL format, parses it as JSON, and then uses a regex - * to extract the `environment` and `tenant` from the issuer URL (iss field) if it matches the pattern: - * https://keycloak.{environment}.corti.app/realms/{tenant}. - * - * @param token - A JSON Web Token (JWT) string. - * @returns An object containing: - * - `environment`: The extracted environment from the issuer URL. - * - `tenant`: The extracted tenant from the issuer URL. - * - `accessToken`: The original token string. - * If the issuer URL doesn't match the expected format, the function returns the full decoded token details. - * - * @throws Will throw an error if: - * - The token format is invalid. - * - The base64 decoding or URI decoding fails. - * - The JSON payload is invalid. - * - The token payload does not contain an issuer (iss) field. - */ -export function decodeToken(token: string) { - // Validate the token structure (should contain at least header and payload parts) - const parts = token ? token.split(".") : ""; - - if (parts.length < 2) { - return null; - } - - // Retrieve the payload (second part) of the JWT token - const base64Url = parts[1]; - - // Replace URL-safe characters to match standard base64 encoding - const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); - - // Decode the base64 string into a JSON string - let jsonPayload: string; - try { - jsonPayload = decodeURIComponent( - atob(base64) - .split("") - .map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)) - .join(""), - ); - } catch (error) { - return null; - } - - // Parse the JSON string to obtain token details - let tokenDetails: { iss: string; [key: string]: unknown }; - try { - tokenDetails = JSON.parse(jsonPayload); - } catch (error) { - return null; - } - - // Extract the issuer URL from the token details - const issuerUrl: string = tokenDetails.iss; - - if (!issuerUrl) { - return null; - } - - // Regex to extract environment and tenant from issuer URL: - // Expected format: https://keycloak.{environment}.corti.app/realms/{tenant} - // Note: Unnecessary escapes in character classes have been removed. - const regex = /^https:\/\/(keycloak|auth)\.([^.]+)\.corti\.app\/realms\/([^/]+)/; - const match = issuerUrl.match(regex); - - // If the issuer URL matches the expected pattern, return the extracted values along with the token - if (match) { - const expiresAt = tokenDetails.exp && typeof tokenDetails.exp === "number" ? tokenDetails.exp : undefined; - - return { - environment: match[2], - tenantName: match[3], - accessToken: token, - expiresAt, - }; - } - - return null; -} diff --git a/src/custom/utils/encodeHeadersAsWsProtocols.ts b/src/custom/utils/encodeHeadersAsWsProtocols.ts deleted file mode 100644 index 28c930a7..00000000 --- a/src/custom/utils/encodeHeadersAsWsProtocols.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Patch: utilities to encode client headers as WebSocket subprotocols (for proxy scenarios). - * Format: [headerName1, encodeURIComponent(value1), headerName2, encodeURIComponent(value2), ...] - */ - -import * as core from "../../core/index.js"; -import type { CortiClient } from "../CortiClient.js"; - -/** Patch: headers added by the SDK; exclude these when filterSdkHeaders is true (e.g. merged client headers). */ -const SDK_HEADER_NAMES = new Set([ - "Tenant-Name", - "X-Fern-Language", - "X-Fern-SDK-Name", - "X-Fern-SDK-Version", - "User-Agent", - "X-Fern-Runtime", - "X-Fern-Runtime-Version", -]); - -/** - * Patch: resolves header values (including suppliers/functions) and returns a flat array - * of [name, encodeURIComponent(value)] for each header, skipping undefined/empty values. - * When filterSdkHeaders is true, SDK-added headers are excluded (use for merged client headers). - */ -export async function buildProtocolsFromHeaders( - headers: CortiClient.HeadersRecord | undefined, - filterSdkHeaders = false -): Promise { - if (!headers || Object.keys(headers).length === 0) { - return []; - } - const protocols: string[] = []; - for (const [name, valueOrSupplier] of Object.entries(headers)) { - if (filterSdkHeaders && SDK_HEADER_NAMES.has(name)) { - continue; - } - const value = await core.Supplier.get(valueOrSupplier); - if (value != null && value !== "") { - protocols.push(name, encodeURIComponent(value)); - } - } - return protocols; -} - -/** Patch: options shape for getWsProtocols (encodeHeadersAsWsProtocols + headers). */ -export type WsProtocolsOptions = { - encodeHeadersAsWsProtocols?: boolean; - headers?: CortiClient.HeadersRecord; -}; - -/** Patch: proxy protocols as array (pass-through) or object (encoded like headers). */ -export type ProxyProtocolsInput = string[] | CortiClient.HeadersRecord; - -/** - * Patch: returns WebSocket protocols array for connect (header-derived + proxy protocols). - * proxyProtocols: array is passed as-is; object is encoded like headers (name, encodeURIComponent(value), ...). - */ -export async function getWsProtocols( - options: WsProtocolsOptions, - proxyProtocols?: ProxyProtocolsInput -): Promise { - const headerProtocols = - options.encodeHeadersAsWsProtocols && options.headers - ? await buildProtocolsFromHeaders(options.headers, true) - : []; - const resolvedProxy = - proxyProtocols == null - ? [] - : Array.isArray(proxyProtocols) - ? proxyProtocols - : await buildProtocolsFromHeaders(proxyProtocols, false); - const combined = [...headerProtocols, ...resolvedProxy]; - return combined.length > 0 ? combined : []; -} diff --git a/src/custom/utils/getEnvironmentFromString.ts b/src/custom/utils/getEnvironmentFromString.ts deleted file mode 100644 index 1c1b89d8..00000000 --- a/src/custom/utils/getEnvironmentFromString.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as core from "../../core/index.js"; -import * as environments from "../../environments.js"; - -export type Environment = CortiInternalEnvironment | string; -export type CortiInternalEnvironment = core.Supplier; - -export function getEnvironment(environment: Environment = "eu"): CortiInternalEnvironment { - return typeof environment === "string" - ? { - base: `https://api.${environment}.corti.app/v2`, - wss: `wss://api.${environment}.corti.app/audio-bridge/v2`, - login: `https://auth.${environment}.corti.app/realms`, - agents: `https://api.${environment}.corti.app`, - } - : environment; -} diff --git a/src/custom/utils/localStorage.ts b/src/custom/utils/localStorage.ts deleted file mode 100644 index af93415c..00000000 --- a/src/custom/utils/localStorage.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { CortiSDKError, CortiSDKErrorCodes } from "../CortiSDKError.js"; - -export const LOCAL_STORAGE_ERROR_CODE = "local_storage_error" as const; - -export const requireLocalStorage = (): Storage => { - if (typeof window === "undefined" || !window.localStorage) { - throw new CortiSDKError("LocalStorage operation failed: storage is not available in this environment.", { - code: CortiSDKErrorCodes.LOCAL_STORAGE_ERROR, - }); - } - - return window.localStorage; -}; - -export const setLocalStorageItem = (key: string, value: string): void => { - const storage = requireLocalStorage(); - - try { - storage.setItem(key, value); - } catch (error) { - throw new CortiSDKError("LocalStorage set operation failed.", { - code: CortiSDKErrorCodes.LOCAL_STORAGE_ERROR, - cause: error, - }); - } -}; - -export const getLocalStorageItem = (key: string): string | null => { - const storage = requireLocalStorage(); - - try { - return storage.getItem(key); - } catch (error) { - throw new CortiSDKError("LocalStorage get operation failed.", { - code: CortiSDKErrorCodes.LOCAL_STORAGE_ERROR, - cause: error, - }); - } -}; diff --git a/src/custom/utils/pkce.ts b/src/custom/utils/pkce.ts deleted file mode 100644 index 5f393c28..00000000 --- a/src/custom/utils/pkce.ts +++ /dev/null @@ -1,17 +0,0 @@ -const base64URLEncode = (buffer: Uint8Array): string => { - const base64 = btoa(String.fromCharCode(...buffer)); - return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""); -}; - -export const generateCodeVerifier = (): string => { - const array = new Uint8Array(32); - crypto.getRandomValues(array); - return base64URLEncode(array); -}; - -export const generateCodeChallenge = async (verifier: string): Promise => { - const encoder = new TextEncoder(); - const data = encoder.encode(verifier); - const hash = await crypto.subtle.digest("SHA-256", data); - return base64URLEncode(new Uint8Array(hash)); -}; diff --git a/src/custom/utils/resolveClientOptions.ts b/src/custom/utils/resolveClientOptions.ts deleted file mode 100644 index c3e0e5d9..00000000 --- a/src/custom/utils/resolveClientOptions.ts +++ /dev/null @@ -1,105 +0,0 @@ -import * as core from "../../core/index.js"; -import { decodeToken } from "./decodeToken.js"; -import { CortiClient } from "../CortiClient.js"; -import { ParseError } from "../../core/schemas/index.js"; -import { Environment, getEnvironment } from "./getEnvironmentFromString.js"; -import { ExpectedTokenResponse } from "../RefreshBearerProvider.js"; - -type ResolvedClientOptions = { - environment: Environment; - tenantName: core.Supplier; - initialTokenResponse?: Promise; -}; - -function isClientCredentialsOptions(options: CortiClient.Options): options is CortiClient.OptionsWithClientCredentials { - return !!options.auth && "clientId" in options.auth; -} - -export function resolveClientOptions(options: CortiClient.Options): ResolvedClientOptions { - if (isClientCredentialsOptions(options)) { - return { - tenantName: options.tenantName, - environment: options.environment, - }; - } - - // When auth is not provided (baseUrl-only or environment-object scenario), use provided values or defaults - if (!options.auth) { - return { - tenantName: options.tenantName || "", - environment: options.environment || "", - }; - } - - if ("accessToken" in options.auth) { - const decoded = decodeToken(options.auth.accessToken || ""); - - /** - * Do not throw an error when we have some proxying: - * baseUrl is set - * or - * environment is explicitly provided (not string-generated) - */ - if (!decoded && !options.baseUrl && typeof options.environment !== "object") { - throw new ParseError([ - { - path: ["auth", "accessToken"], - message: "Invalid access token format", - }, - ]); - } - - return { - tenantName: options.tenantName || decoded?.tenantName || "", - environment: options.environment || decoded?.environment || "", - }; - } - - /** - * This branch -- is when we have "refreshAccessToken" defined but no accessToken. - * Trying to avoid initial request at all cost - */ - if (options.tenantName && options.environment) { - return { - tenantName: options.tenantName, - environment: options.environment, - }; - } - - // At this point, auth exists and has refreshAccessToken (BearerOptions without accessToken) - const auth = options.auth as { refreshAccessToken: () => Promise }; - - const tokenResponsePromise = (async () => { - const tokenResponse = await core.Supplier.get(auth.refreshAccessToken); - const decoded = decodeToken(tokenResponse.accessToken); - - /** - * Do not throw an error when we have some proxying: - * baseUrl is set - * or - * environment is explicitly provided (not string-generated) - */ - if (!decoded && !options.baseUrl && typeof options.environment !== "object") { - throw new ParseError([ - { - path: ["auth", "refreshAccessToken"], - message: "Returned invalid access token format", - }, - ]); - } - - return { - tokenResponse, - tenantName: decoded?.tenantName || "", - environment: decoded?.environment || "", - }; - })(); - - return { - tenantName: options.tenantName || tokenResponsePromise.then(({ tenantName }) => tenantName), - environment: - options.environment || - tokenResponsePromise.then(({ environment }) => core.Supplier.get(getEnvironment(environment))), - initialTokenResponse: tokenResponsePromise.then((result) => result.tokenResponse), - }; -} diff --git a/src/custom/utils/tokenRequest.ts b/src/custom/utils/tokenRequest.ts deleted file mode 100644 index d1eaa549..00000000 --- a/src/custom/utils/tokenRequest.ts +++ /dev/null @@ -1,64 +0,0 @@ -import * as Corti from "../../api/index.js"; -import * as serializers from "../../serialization/index.js"; - -export type TokenRequest = Corti.AuthGetTokenRequest & - Partial<{ - grantType: "client_credentials" | "authorization_code" | "refresh_token" | "password"; - code: string; - redirectUri: string; - refreshToken: string; - codeVerifier: string; - username: string; - password: string; - scopes: string[]; - }>; - -export const buildTokenRequestBody = (request: TokenRequest): URLSearchParams => { - type TokenRequestBody = Record; - const serializedRequest = serializers.AuthGetTokenRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - omitUndefined: true, - }); - - // Build scope string: always include "openid", add any additional scopes - const allScopes = ["openid", ...(request.scopes || [])]; - const scopeString = [...new Set(allScopes)].join(" "); - - const tokenRequestBody: TokenRequestBody = { - scope: scopeString, - grant_type: request.grantType || "client_credentials", - }; - - Object.entries(serializedRequest).forEach(([key, value]) => { - if (value != null) { - tokenRequestBody[key] = String(value); - } - }); - - if (request.grantType === "authorization_code") { - if (request.code != null) { - tokenRequestBody.code = request.code; - } - if (request.redirectUri != null) { - tokenRequestBody.redirect_uri = request.redirectUri; - } - if (request.codeVerifier != null) { - tokenRequestBody.code_verifier = request.codeVerifier; - } - } - - if (request.grantType === "refresh_token" && request.refreshToken != null) { - tokenRequestBody.refresh_token = request.refreshToken; - } - - if (request.grantType === "password") { - if (request.username != null) { - tokenRequestBody.username = request.username; - } - if (request.password != null) { - tokenRequestBody.password = request.password; - } - } - - return new URLSearchParams(tokenRequestBody); -}; diff --git a/src/custom/utils/withCredentialsConfig.ts b/src/custom/utils/withCredentialsConfig.ts deleted file mode 100644 index cdca8f1c..00000000 --- a/src/custom/utils/withCredentialsConfig.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Global default for fetcher withCredentials. Set by CortiClient when withCredentials - * is passed in options; the core fetcher reads this when args.withCredentials is undefined. - */ -let defaultWithCredentials: boolean | undefined = undefined; - -export function getDefaultWithCredentials(): boolean | undefined { - return defaultWithCredentials; -} - -export function setDefaultWithCredentials(value: boolean | undefined): void { - defaultWithCredentials = value; -} diff --git a/src/environments.ts b/src/environments.ts index 50a2c927..9cdf107e 100644 --- a/src/environments.ts +++ b/src/environments.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface CortiEnvironmentUrls { base: string; diff --git a/src/errors/CortiError.ts b/src/errors/CortiError.ts index f8a40423..ee06b977 100644 --- a/src/errors/CortiError.ts +++ b/src/errors/CortiError.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as core from "../core/index.js"; +import type * as core from "../core/index.js"; import { toJson } from "../core/json.js"; export class CortiError extends Error { @@ -22,7 +20,12 @@ export class CortiError extends Error { rawResponse?: core.RawResponse; }) { super(buildMessage({ message, statusCode, body })); - Object.setPrototypeOf(this, CortiError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = this.constructor.name; this.statusCode = statusCode; this.body = body; this.rawResponse = rawResponse; @@ -38,7 +41,7 @@ function buildMessage({ statusCode: number | undefined; body: unknown | undefined; }): string { - let lines: string[] = []; + const lines: string[] = []; if (message != null) { lines.push(message); } diff --git a/src/errors/CortiTimeoutError.ts b/src/errors/CortiTimeoutError.ts index 81808d54..cc24d075 100644 --- a/src/errors/CortiTimeoutError.ts +++ b/src/errors/CortiTimeoutError.ts @@ -1,10 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export class CortiTimeoutError extends Error { constructor(message: string) { super(message); - Object.setPrototypeOf(this, CortiTimeoutError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = this.constructor.name; } } diff --git a/src/errors/handleNonStatusCodeError.ts b/src/errors/handleNonStatusCodeError.ts new file mode 100644 index 00000000..4d734aeb --- /dev/null +++ b/src/errors/handleNonStatusCodeError.ts @@ -0,0 +1,37 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as core from "../core/index.js"; +import * as errors from "./index.js"; + +export function handleNonStatusCodeError( + error: core.Fetcher.Error, + rawResponse: core.RawResponse, + method: string, + path: string, +): never { + switch (error.reason) { + case "non-json": + throw new errors.CortiError({ + statusCode: error.statusCode, + body: error.rawBody, + rawResponse: rawResponse, + }); + case "body-is-null": + throw new errors.CortiError({ + statusCode: error.statusCode, + rawResponse: rawResponse, + }); + case "timeout": + throw new errors.CortiTimeoutError(`Timeout exceeded when calling ${method} ${path}.`); + case "unknown": + throw new errors.CortiError({ + message: error.errorMessage, + rawResponse: rawResponse, + }); + default: + throw new errors.CortiError({ + message: "Unknown error", + rawResponse: rawResponse, + }); + } +} diff --git a/src/index.ts b/src/index.ts index 19219175..248ff159 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,30 +1,7 @@ export * as Corti from "./api/index.js"; +export type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js"; +export { CortiClient } from "./Client.js"; +export { CortiEnvironment, type CortiEnvironmentUrls } from "./environments.js"; export { CortiError, CortiTimeoutError } from "./errors/index.js"; +export * from "./exports.js"; export * as serialization from "./serialization/index.js"; -/** - * Patch: use custom CortiClient instead of the generated one. - */ -export { CortiClient } from "./custom/CortiClient.js"; -/** - * Patch: lightweight proxy client with only WebSocket resources. - */ -export { CortiWebSocketProxyClient } from "./custom/CortiWebSocketProxyClient.js"; -export { CortiEnvironment, CortiEnvironmentUrls } from "./environments.js"; - -/** - * Patch: added new export to provide Authorization code flow support. - */ -export { Auth as CortiAuth } from "./custom/CortiAuth.js"; -/** - * Patch: added new exports to provide schema validation errors. - */ -export { JsonError } from "./core/schemas/builders/schema-utils/JsonError.js"; -export { ParseError } from "./core/schemas/builders/schema-utils/ParseError.js"; -/** - * Patch: added new export to provide SDK-level error handling. - */ -export { CortiSDKError } from "./custom/CortiSDKError.js"; -/** - * Patch: added new export to expose environment resolution utility. - */ -export { getEnvironment } from "./custom/utils/getEnvironmentFromString.js"; diff --git a/src/serialization/resources/agents/client/list.ts b/src/serialization/resources/agents/client/list.ts index 63f5bbf1..9866ad37 100644 --- a/src/serialization/resources/agents/client/list.ts +++ b/src/serialization/resources/agents/client/list.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../index.js"; -import * as Corti from "../../../../api/index.js"; +import type * as Corti from "../../../../api/index.js"; import * as core from "../../../../core/index.js"; +import type * as serializers from "../../../index.js"; import { AgentsAgentResponse } from "../../../types/AgentsAgentResponse.js"; export const Response: core.serialization.Schema = diff --git a/src/serialization/resources/agents/client/requests/AgentsCreateAgent.ts b/src/serialization/resources/agents/client/requests/AgentsCreateAgent.ts index e3bbcf31..38b6a31b 100644 --- a/src/serialization/resources/agents/client/requests/AgentsCreateAgent.ts +++ b/src/serialization/resources/agents/client/requests/AgentsCreateAgent.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; import { AgentsCreateAgentAgentType } from "../../types/AgentsCreateAgentAgentType.js"; import { AgentsCreateAgentExpertsItem } from "../../types/AgentsCreateAgentExpertsItem.js"; diff --git a/src/serialization/resources/agents/client/requests/AgentsMessageSendParams.ts b/src/serialization/resources/agents/client/requests/AgentsMessageSendParams.ts index 45d60745..24247fb7 100644 --- a/src/serialization/resources/agents/client/requests/AgentsMessageSendParams.ts +++ b/src/serialization/resources/agents/client/requests/AgentsMessageSendParams.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; import { AgentsMessage } from "../../../../types/AgentsMessage.js"; import { AgentsMessageSendConfiguration } from "../../../../types/AgentsMessageSendConfiguration.js"; diff --git a/src/serialization/resources/agents/index.ts b/src/serialization/resources/agents/index.ts index f095e147..d9adb1af 100644 --- a/src/serialization/resources/agents/index.ts +++ b/src/serialization/resources/agents/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/serialization/resources/agents/types/AgentsCreateAgentAgentType.ts b/src/serialization/resources/agents/types/AgentsCreateAgentAgentType.ts index 8417470d..831b82a0 100644 --- a/src/serialization/resources/agents/types/AgentsCreateAgentAgentType.ts +++ b/src/serialization/resources/agents/types/AgentsCreateAgentAgentType.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../index.js"; -import * as Corti from "../../../../api/index.js"; +import type * as Corti from "../../../../api/index.js"; import * as core from "../../../../core/index.js"; +import type * as serializers from "../../../index.js"; export const AgentsCreateAgentAgentType: core.serialization.Schema< serializers.AgentsCreateAgentAgentType.Raw, diff --git a/src/serialization/resources/agents/types/AgentsCreateAgentExpertsItem.ts b/src/serialization/resources/agents/types/AgentsCreateAgentExpertsItem.ts index b425cb04..8e113572 100644 --- a/src/serialization/resources/agents/types/AgentsCreateAgentExpertsItem.ts +++ b/src/serialization/resources/agents/types/AgentsCreateAgentExpertsItem.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../index.js"; -import * as Corti from "../../../../api/index.js"; +import type * as Corti from "../../../../api/index.js"; import * as core from "../../../../core/index.js"; +import type * as serializers from "../../../index.js"; import { AgentsCreateExpert } from "../../../types/AgentsCreateExpert.js"; import { AgentsCreateExpertReference } from "../../../types/AgentsCreateExpertReference.js"; diff --git a/src/serialization/resources/agents/types/AgentsMessageSendResponse.ts b/src/serialization/resources/agents/types/AgentsMessageSendResponse.ts index 13ec08fa..9e7b74db 100644 --- a/src/serialization/resources/agents/types/AgentsMessageSendResponse.ts +++ b/src/serialization/resources/agents/types/AgentsMessageSendResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../index.js"; -import * as Corti from "../../../../api/index.js"; +import type * as Corti from "../../../../api/index.js"; import * as core from "../../../../core/index.js"; +import type * as serializers from "../../../index.js"; import { AgentsMessage } from "../../../types/AgentsMessage.js"; import { AgentsTask } from "../../../types/AgentsTask.js"; diff --git a/src/serialization/resources/auth/client/index.ts b/src/serialization/resources/auth/client/index.ts deleted file mode 100644 index 195f9aa8..00000000 --- a/src/serialization/resources/auth/client/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./requests/index.js"; diff --git a/src/serialization/resources/auth/client/requests/AuthGetTokenRequest.ts b/src/serialization/resources/auth/client/requests/AuthGetTokenRequest.ts deleted file mode 100644 index ac3c8586..00000000 --- a/src/serialization/resources/auth/client/requests/AuthGetTokenRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; -import * as core from "../../../../../core/index.js"; - -export const AuthGetTokenRequest: core.serialization.Schema< - serializers.AuthGetTokenRequest.Raw, - Corti.AuthGetTokenRequest -> = core.serialization.object({ - clientId: core.serialization.property("client_id", core.serialization.string()), - clientSecret: core.serialization.property("client_secret", core.serialization.string().optional()), -}); - -export declare namespace AuthGetTokenRequest { - export interface Raw { - client_id: string; - client_secret?: string | null; - } -} diff --git a/src/serialization/resources/auth/client/requests/index.ts b/src/serialization/resources/auth/client/requests/index.ts deleted file mode 100644 index 6ccec97d..00000000 --- a/src/serialization/resources/auth/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { AuthGetTokenRequest } from "./AuthGetTokenRequest.js"; diff --git a/src/serialization/resources/auth/index.ts b/src/serialization/resources/auth/index.ts deleted file mode 100644 index f095e147..00000000 --- a/src/serialization/resources/auth/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./types/index.js"; -export * from "./client/index.js"; diff --git a/src/serialization/resources/auth/types/GetTokenResponse.ts b/src/serialization/resources/auth/types/GetTokenResponse.ts deleted file mode 100644 index f09aa775..00000000 --- a/src/serialization/resources/auth/types/GetTokenResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../index.js"; -import * as Corti from "../../../../api/index.js"; -import * as core from "../../../../core/index.js"; - -export const GetTokenResponse: core.serialization.ObjectSchema< - serializers.GetTokenResponse.Raw, - Corti.GetTokenResponse -> = core.serialization.object({ - accessToken: core.serialization.property("access_token", core.serialization.string()), - tokenType: core.serialization.property("token_type", core.serialization.string()), - expiresIn: core.serialization.property("expires_in", core.serialization.number()), - refreshToken: core.serialization.property("refresh_token", core.serialization.string().optional()), - refreshExpiresIn: core.serialization.property("refresh_expires_in", core.serialization.number().optional()), -}); - -export declare namespace GetTokenResponse { - export interface Raw { - access_token: string; - token_type: string; - expires_in: number; - refresh_token?: string | null; - refresh_expires_in?: number | null; - } -} diff --git a/src/serialization/resources/auth/types/index.ts b/src/serialization/resources/auth/types/index.ts deleted file mode 100644 index cecadafd..00000000 --- a/src/serialization/resources/auth/types/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./GetTokenResponse.js"; diff --git a/src/serialization/resources/codes/client/requests/CodesGeneralPredictRequest.ts b/src/serialization/resources/codes/client/requests/CodesGeneralPredictRequest.ts index 21a40a58..5298aab0 100644 --- a/src/serialization/resources/codes/client/requests/CodesGeneralPredictRequest.ts +++ b/src/serialization/resources/codes/client/requests/CodesGeneralPredictRequest.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; -import { CommonCodingSystemEnum } from "../../../../types/CommonCodingSystemEnum.js"; +import type * as serializers from "../../../../index.js"; import { CommonAiContext } from "../../../../types/CommonAiContext.js"; +import { CommonCodingSystemEnum } from "../../../../types/CommonCodingSystemEnum.js"; export const CodesGeneralPredictRequest: core.serialization.Schema< serializers.CodesGeneralPredictRequest.Raw, diff --git a/src/serialization/resources/documents/client/requests/DocumentsUpdateRequest.ts b/src/serialization/resources/documents/client/requests/DocumentsUpdateRequest.ts index b5ab6788..bf1bf144 100644 --- a/src/serialization/resources/documents/client/requests/DocumentsUpdateRequest.ts +++ b/src/serialization/resources/documents/client/requests/DocumentsUpdateRequest.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; import { DocumentsSectionInput } from "../../../../types/DocumentsSectionInput.js"; export const DocumentsUpdateRequest: core.serialization.Schema< diff --git a/src/serialization/resources/facts/client/requests/FactsBatchUpdateRequest.ts b/src/serialization/resources/facts/client/requests/FactsBatchUpdateRequest.ts index 66a16fee..ca29f0ab 100644 --- a/src/serialization/resources/facts/client/requests/FactsBatchUpdateRequest.ts +++ b/src/serialization/resources/facts/client/requests/FactsBatchUpdateRequest.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; import { FactsBatchUpdateInput } from "../../../../types/FactsBatchUpdateInput.js"; export const FactsBatchUpdateRequest: core.serialization.Schema< diff --git a/src/serialization/resources/facts/client/requests/FactsCreateRequest.ts b/src/serialization/resources/facts/client/requests/FactsCreateRequest.ts index f8590277..3ff375df 100644 --- a/src/serialization/resources/facts/client/requests/FactsCreateRequest.ts +++ b/src/serialization/resources/facts/client/requests/FactsCreateRequest.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; import { FactsCreateInput } from "../../../../types/FactsCreateInput.js"; export const FactsCreateRequest: core.serialization.Schema< diff --git a/src/serialization/resources/facts/client/requests/FactsExtractRequest.ts b/src/serialization/resources/facts/client/requests/FactsExtractRequest.ts index 09699141..ceb6246c 100644 --- a/src/serialization/resources/facts/client/requests/FactsExtractRequest.ts +++ b/src/serialization/resources/facts/client/requests/FactsExtractRequest.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; import { CommonTextContext } from "../../../../types/CommonTextContext.js"; export const FactsExtractRequest: core.serialization.Schema< diff --git a/src/serialization/resources/facts/client/requests/FactsUpdateRequest.ts b/src/serialization/resources/facts/client/requests/FactsUpdateRequest.ts index 2ebf8f60..5feb287f 100644 --- a/src/serialization/resources/facts/client/requests/FactsUpdateRequest.ts +++ b/src/serialization/resources/facts/client/requests/FactsUpdateRequest.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; import { CommonSourceEnum } from "../../../../types/CommonSourceEnum.js"; export const FactsUpdateRequest: core.serialization.Schema< diff --git a/src/serialization/resources/facts/client/requests/index.ts b/src/serialization/resources/facts/client/requests/index.ts index 0022b155..ee9e5d91 100644 --- a/src/serialization/resources/facts/client/requests/index.ts +++ b/src/serialization/resources/facts/client/requests/index.ts @@ -1,4 +1,4 @@ -export { FactsCreateRequest } from "./FactsCreateRequest.js"; export { FactsBatchUpdateRequest } from "./FactsBatchUpdateRequest.js"; -export { FactsUpdateRequest } from "./FactsUpdateRequest.js"; +export { FactsCreateRequest } from "./FactsCreateRequest.js"; export { FactsExtractRequest } from "./FactsExtractRequest.js"; +export { FactsUpdateRequest } from "./FactsUpdateRequest.js"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index cc54e02a..69b81428 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -1,21 +1,18 @@ -export * as stream from "./stream/index.js"; -export * from "./stream/client/socket/index.js"; -export * as transcribe from "./transcribe/index.js"; -export * from "./transcribe/client/socket/index.js"; -export * as interactions from "./interactions/index.js"; -export * from "./interactions/types/index.js"; -export * as auth from "./auth/index.js"; -export * from "./auth/types/index.js"; +export * from "./agents/client/requests/index.js"; export * as agents from "./agents/index.js"; export * from "./agents/types/index.js"; +export * from "./codes/client/requests/index.js"; +export * as codes from "./codes/index.js"; +export * from "./documents/client/requests/index.js"; +export * as documents from "./documents/index.js"; +export * from "./facts/client/requests/index.js"; +export * as facts from "./facts/index.js"; export * from "./interactions/client/requests/index.js"; -export * as transcripts from "./transcripts/index.js"; +export * as interactions from "./interactions/index.js"; +export * from "./interactions/types/index.js"; +export * from "./stream/client/socket/index.js"; +export * as stream from "./stream/index.js"; +export * from "./transcribe/client/socket/index.js"; +export * as transcribe from "./transcribe/index.js"; export * from "./transcripts/client/requests/index.js"; -export * as facts from "./facts/index.js"; -export * from "./facts/client/requests/index.js"; -export * as documents from "./documents/index.js"; -export * from "./documents/client/requests/index.js"; -export * as codes from "./codes/index.js"; -export * from "./codes/client/requests/index.js"; -export * from "./auth/client/requests/index.js"; -export * from "./agents/client/requests/index.js"; +export * as transcripts from "./transcripts/index.js"; diff --git a/src/serialization/resources/interactions/client/requests/InteractionsCreateRequest.ts b/src/serialization/resources/interactions/client/requests/InteractionsCreateRequest.ts index d5ad0960..def31f5f 100644 --- a/src/serialization/resources/interactions/client/requests/InteractionsCreateRequest.ts +++ b/src/serialization/resources/interactions/client/requests/InteractionsCreateRequest.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; -import { Uuid } from "../../../../types/Uuid.js"; +import type * as serializers from "../../../../index.js"; import { InteractionsEncounterCreateRequest } from "../../../../types/InteractionsEncounterCreateRequest.js"; import { InteractionsPatient } from "../../../../types/InteractionsPatient.js"; +import { Uuid } from "../../../../types/Uuid.js"; export const InteractionsCreateRequest: core.serialization.Schema< serializers.InteractionsCreateRequest.Raw, diff --git a/src/serialization/resources/interactions/client/requests/InteractionsUpdateRequest.ts b/src/serialization/resources/interactions/client/requests/InteractionsUpdateRequest.ts index 17990d27..19d78173 100644 --- a/src/serialization/resources/interactions/client/requests/InteractionsUpdateRequest.ts +++ b/src/serialization/resources/interactions/client/requests/InteractionsUpdateRequest.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; -import { Uuid } from "../../../../types/Uuid.js"; +import type * as serializers from "../../../../index.js"; import { InteractionsEncounterUpdateRequest } from "../../../../types/InteractionsEncounterUpdateRequest.js"; import { InteractionsPatient } from "../../../../types/InteractionsPatient.js"; +import { Uuid } from "../../../../types/Uuid.js"; export const InteractionsUpdateRequest: core.serialization.Schema< serializers.InteractionsUpdateRequest.Raw, diff --git a/src/serialization/resources/interactions/index.ts b/src/serialization/resources/interactions/index.ts index f095e147..d9adb1af 100644 --- a/src/serialization/resources/interactions/index.ts +++ b/src/serialization/resources/interactions/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/serialization/resources/interactions/types/InteractionsListRequestSort.ts b/src/serialization/resources/interactions/types/InteractionsListRequestSort.ts index 7fed8b7b..c4ca7aff 100644 --- a/src/serialization/resources/interactions/types/InteractionsListRequestSort.ts +++ b/src/serialization/resources/interactions/types/InteractionsListRequestSort.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../index.js"; -import * as Corti from "../../../../api/index.js"; +import type * as Corti from "../../../../api/index.js"; import * as core from "../../../../core/index.js"; +import type * as serializers from "../../../index.js"; export const InteractionsListRequestSort: core.serialization.Schema< serializers.InteractionsListRequestSort.Raw, diff --git a/src/serialization/resources/stream/client/socket/StreamSocketResponse.ts b/src/serialization/resources/stream/client/socket/StreamSocketResponse.ts index e533dd1a..da48f3cb 100644 --- a/src/serialization/resources/stream/client/socket/StreamSocketResponse.ts +++ b/src/serialization/resources/stream/client/socket/StreamSocketResponse.ts @@ -1,17 +1,15 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; import { StreamConfigStatusMessage } from "../../../../types/StreamConfigStatusMessage.js"; -import { StreamTranscriptMessage } from "../../../../types/StreamTranscriptMessage.js"; +import { StreamEndedMessage } from "../../../../types/StreamEndedMessage.js"; +import { StreamErrorMessage } from "../../../../types/StreamErrorMessage.js"; import { StreamFactsMessage } from "../../../../types/StreamFactsMessage.js"; import { StreamFlushedMessage } from "../../../../types/StreamFlushedMessage.js"; -import { StreamEndedMessage } from "../../../../types/StreamEndedMessage.js"; +import { StreamTranscriptMessage } from "../../../../types/StreamTranscriptMessage.js"; import { StreamUsageMessage } from "../../../../types/StreamUsageMessage.js"; -import { StreamErrorMessage } from "../../../../types/StreamErrorMessage.js"; export const StreamSocketResponse: core.serialization.Schema< serializers.StreamSocketResponse.Raw, diff --git a/src/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.ts b/src/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.ts index 6fd04b71..1bcca04d 100644 --- a/src/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.ts +++ b/src/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.ts @@ -1,17 +1,15 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; +import { TranscribeCommandMessage } from "../../../../types/TranscribeCommandMessage.js"; import { TranscribeConfigStatusMessage } from "../../../../types/TranscribeConfigStatusMessage.js"; -import { TranscribeUsageMessage } from "../../../../types/TranscribeUsageMessage.js"; -import { TranscribeFlushedMessage } from "../../../../types/TranscribeFlushedMessage.js"; import { TranscribeEndedMessage } from "../../../../types/TranscribeEndedMessage.js"; import { TranscribeErrorMessage } from "../../../../types/TranscribeErrorMessage.js"; +import { TranscribeFlushedMessage } from "../../../../types/TranscribeFlushedMessage.js"; import { TranscribeTranscriptMessage } from "../../../../types/TranscribeTranscriptMessage.js"; -import { TranscribeCommandMessage } from "../../../../types/TranscribeCommandMessage.js"; +import { TranscribeUsageMessage } from "../../../../types/TranscribeUsageMessage.js"; export const TranscribeSocketResponse: core.serialization.Schema< serializers.TranscribeSocketResponse.Raw, diff --git a/src/serialization/resources/transcripts/client/requests/TranscriptsCreateRequest.ts b/src/serialization/resources/transcripts/client/requests/TranscriptsCreateRequest.ts index 06372a22..2c78933f 100644 --- a/src/serialization/resources/transcripts/client/requests/TranscriptsCreateRequest.ts +++ b/src/serialization/resources/transcripts/client/requests/TranscriptsCreateRequest.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../../../../index.js"; -import * as Corti from "../../../../../api/index.js"; +import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; -import { Uuid } from "../../../../types/Uuid.js"; +import type * as serializers from "../../../../index.js"; import { TranscriptsParticipant } from "../../../../types/TranscriptsParticipant.js"; +import { Uuid } from "../../../../types/Uuid.js"; export const TranscriptsCreateRequest: core.serialization.Schema< serializers.TranscriptsCreateRequest.Raw, diff --git a/src/serialization/types/AgentsAgent.ts b/src/serialization/types/AgentsAgent.ts index c80ecc79..9289d227 100644 --- a/src/serialization/types/AgentsAgent.ts +++ b/src/serialization/types/AgentsAgent.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsAgentExpertsItem } from "./AgentsAgentExpertsItem.js"; export const AgentsAgent: core.serialization.ObjectSchema = diff --git a/src/serialization/types/AgentsAgentCapabilities.ts b/src/serialization/types/AgentsAgentCapabilities.ts index e8f5f589..93e62f14 100644 --- a/src/serialization/types/AgentsAgentCapabilities.ts +++ b/src/serialization/types/AgentsAgentCapabilities.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsAgentExtension } from "./AgentsAgentExtension.js"; export const AgentsAgentCapabilities: core.serialization.ObjectSchema< @@ -22,6 +20,6 @@ export declare namespace AgentsAgentCapabilities { streaming?: boolean | null; pushNotifications?: boolean | null; stateTransitionHistory?: boolean | null; - extensions?: (AgentsAgentExtension.Raw[] | null) | null; + extensions?: (AgentsAgentExtension.Raw[] | null | undefined) | null; } } diff --git a/src/serialization/types/AgentsAgentCard.ts b/src/serialization/types/AgentsAgentCard.ts index d2b31171..b07ecc9c 100644 --- a/src/serialization/types/AgentsAgentCard.ts +++ b/src/serialization/types/AgentsAgentCard.ts @@ -1,15 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { AgentsAgentCapabilities } from "./AgentsAgentCapabilities.js"; +import { AgentsAgentCardSignature } from "./AgentsAgentCardSignature.js"; import { AgentsAgentInterface } from "./AgentsAgentInterface.js"; import { AgentsAgentProvider } from "./AgentsAgentProvider.js"; -import { AgentsAgentCapabilities } from "./AgentsAgentCapabilities.js"; import { AgentsAgentSkill } from "./AgentsAgentSkill.js"; -import { AgentsAgentCardSignature } from "./AgentsAgentCardSignature.js"; export const AgentsAgentCard: core.serialization.ObjectSchema = core.serialization.object({ @@ -43,19 +41,19 @@ export declare namespace AgentsAgentCard { name: string; description: string; url: string; - preferredTransport?: (string | null) | null; - additionalInterfaces?: (AgentsAgentInterface.Raw[] | null) | null; - iconUrl?: (string | null) | null; - documentationUrl?: (string | null) | null; + preferredTransport?: (string | null | undefined) | null; + additionalInterfaces?: (AgentsAgentInterface.Raw[] | null | undefined) | null; + iconUrl?: (string | null | undefined) | null; + documentationUrl?: (string | null | undefined) | null; provider?: AgentsAgentProvider.Raw | null; version: string; capabilities: AgentsAgentCapabilities.Raw; - securitySchemes?: (Record | null) | null; - security?: (Record | null) | null; + securitySchemes?: (Record | null | undefined) | null; + security?: (Record | null | undefined) | null; defaultInputModes: string[]; defaultOutputModes: string[]; skills: AgentsAgentSkill.Raw[]; - supportsAuthenticatedExtendedCard?: (boolean | null) | null; - signatures?: (AgentsAgentCardSignature.Raw[] | null) | null; + supportsAuthenticatedExtendedCard?: (boolean | null | undefined) | null; + signatures?: (AgentsAgentCardSignature.Raw[] | null | undefined) | null; } } diff --git a/src/serialization/types/AgentsAgentCardSignature.ts b/src/serialization/types/AgentsAgentCardSignature.ts index 3b495cd9..b9bd1fd0 100644 --- a/src/serialization/types/AgentsAgentCardSignature.ts +++ b/src/serialization/types/AgentsAgentCardSignature.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsAgentCardSignature: core.serialization.ObjectSchema< serializers.AgentsAgentCardSignature.Raw, diff --git a/src/serialization/types/AgentsAgentExpertsItem.ts b/src/serialization/types/AgentsAgentExpertsItem.ts index 379ccb1a..1978ab11 100644 --- a/src/serialization/types/AgentsAgentExpertsItem.ts +++ b/src/serialization/types/AgentsAgentExpertsItem.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsExpert } from "./AgentsExpert.js"; import { AgentsExpertReference } from "./AgentsExpertReference.js"; diff --git a/src/serialization/types/AgentsAgentExtension.ts b/src/serialization/types/AgentsAgentExtension.ts index dc09a4c9..f3dfb95c 100644 --- a/src/serialization/types/AgentsAgentExtension.ts +++ b/src/serialization/types/AgentsAgentExtension.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsAgentExtension: core.serialization.ObjectSchema< serializers.AgentsAgentExtension.Raw, diff --git a/src/serialization/types/AgentsAgentInterface.ts b/src/serialization/types/AgentsAgentInterface.ts index 7117567f..f8c7187e 100644 --- a/src/serialization/types/AgentsAgentInterface.ts +++ b/src/serialization/types/AgentsAgentInterface.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsAgentInterface: core.serialization.ObjectSchema< serializers.AgentsAgentInterface.Raw, diff --git a/src/serialization/types/AgentsAgentProvider.ts b/src/serialization/types/AgentsAgentProvider.ts index 204efdb5..8915c8ef 100644 --- a/src/serialization/types/AgentsAgentProvider.ts +++ b/src/serialization/types/AgentsAgentProvider.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsAgentProvider: core.serialization.ObjectSchema< serializers.AgentsAgentProvider.Raw, diff --git a/src/serialization/types/AgentsAgentReference.ts b/src/serialization/types/AgentsAgentReference.ts index 46cb2c58..6a96a179 100644 --- a/src/serialization/types/AgentsAgentReference.ts +++ b/src/serialization/types/AgentsAgentReference.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { AgentsAgentReferenceType } from "./AgentsAgentReferenceType.js"; export const AgentsAgentReference: core.serialization.ObjectSchema< serializers.AgentsAgentReference.Raw, Corti.AgentsAgentReference > = core.serialization.object({ - type: core.serialization.stringLiteral("reference"), + type: AgentsAgentReferenceType, id: core.serialization.string().optional(), name: core.serialization.string().optional(), }); export declare namespace AgentsAgentReference { export interface Raw { - type: "reference"; + type: AgentsAgentReferenceType.Raw; id?: string | null; name?: string | null; } diff --git a/src/serialization/types/AgentsAgentReferenceType.ts b/src/serialization/types/AgentsAgentReferenceType.ts new file mode 100644 index 00000000..687b73af --- /dev/null +++ b/src/serialization/types/AgentsAgentReferenceType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const AgentsAgentReferenceType: core.serialization.Schema< + serializers.AgentsAgentReferenceType.Raw, + Corti.AgentsAgentReferenceType +> = core.serialization.enum_(["reference"]); + +export declare namespace AgentsAgentReferenceType { + export type Raw = "reference"; +} diff --git a/src/serialization/types/AgentsAgentResponse.ts b/src/serialization/types/AgentsAgentResponse.ts index 28918a51..bd90f605 100644 --- a/src/serialization/types/AgentsAgentResponse.ts +++ b/src/serialization/types/AgentsAgentResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsAgent } from "./AgentsAgent.js"; import { AgentsAgentReference } from "./AgentsAgentReference.js"; diff --git a/src/serialization/types/AgentsAgentSkill.ts b/src/serialization/types/AgentsAgentSkill.ts index ef2f1a2b..789396d3 100644 --- a/src/serialization/types/AgentsAgentSkill.ts +++ b/src/serialization/types/AgentsAgentSkill.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsMessage } from "./AgentsMessage.js"; export const AgentsAgentSkill: core.serialization.ObjectSchema< @@ -27,9 +25,9 @@ export declare namespace AgentsAgentSkill { name: string; description: string; tags: string[]; - examples?: (AgentsMessage.Raw[] | null) | null; - inputModes?: (string[] | null) | null; - outputModes?: (string[] | null) | null; - security?: (Record | null) | null; + examples?: (AgentsMessage.Raw[] | null | undefined) | null; + inputModes?: (string[] | null | undefined) | null; + outputModes?: (string[] | null | undefined) | null; + security?: (Record | null | undefined) | null; } } diff --git a/src/serialization/types/AgentsArtifact.ts b/src/serialization/types/AgentsArtifact.ts index 2118e27e..63d29168 100644 --- a/src/serialization/types/AgentsArtifact.ts +++ b/src/serialization/types/AgentsArtifact.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsPart } from "./AgentsPart.js"; export const AgentsArtifact: core.serialization.ObjectSchema = diff --git a/src/serialization/types/AgentsContext.ts b/src/serialization/types/AgentsContext.ts index d5e31f08..aea565d3 100644 --- a/src/serialization/types/AgentsContext.ts +++ b/src/serialization/types/AgentsContext.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsContextItemsItem } from "./AgentsContextItemsItem.js"; export const AgentsContext: core.serialization.ObjectSchema = diff --git a/src/serialization/types/AgentsContextItemsItem.ts b/src/serialization/types/AgentsContextItemsItem.ts index ff87461d..51296ae8 100644 --- a/src/serialization/types/AgentsContextItemsItem.ts +++ b/src/serialization/types/AgentsContextItemsItem.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { AgentsTask } from "./AgentsTask.js"; +import type * as serializers from "../index.js"; import { AgentsMessage } from "./AgentsMessage.js"; +import { AgentsTask } from "./AgentsTask.js"; export const AgentsContextItemsItem: core.serialization.Schema< serializers.AgentsContextItemsItem.Raw, diff --git a/src/serialization/types/AgentsCreateExpert.ts b/src/serialization/types/AgentsCreateExpert.ts index 98aec015..fb98856f 100644 --- a/src/serialization/types/AgentsCreateExpert.ts +++ b/src/serialization/types/AgentsCreateExpert.ts @@ -1,17 +1,16 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { AgentsCreateExpertType } from "./AgentsCreateExpertType.js"; import { AgentsCreateMcpServer } from "./AgentsCreateMcpServer.js"; export const AgentsCreateExpert: core.serialization.ObjectSchema< serializers.AgentsCreateExpert.Raw, Corti.AgentsCreateExpert > = core.serialization.object({ - type: core.serialization.stringLiteral("new"), + type: AgentsCreateExpertType, name: core.serialization.string(), description: core.serialization.string(), systemPrompt: core.serialization.string().optional(), @@ -20,7 +19,7 @@ export const AgentsCreateExpert: core.serialization.ObjectSchema< export declare namespace AgentsCreateExpert { export interface Raw { - type: "new"; + type: AgentsCreateExpertType.Raw; name: string; description: string; systemPrompt?: string | null; diff --git a/src/serialization/types/AgentsCreateExpertReference.ts b/src/serialization/types/AgentsCreateExpertReference.ts index 8aef1637..535bdd16 100644 --- a/src/serialization/types/AgentsCreateExpertReference.ts +++ b/src/serialization/types/AgentsCreateExpertReference.ts @@ -1,16 +1,15 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { AgentsCreateExpertReferenceType } from "./AgentsCreateExpertReferenceType.js"; export const AgentsCreateExpertReference: core.serialization.ObjectSchema< serializers.AgentsCreateExpertReference.Raw, Corti.AgentsCreateExpertReference > = core.serialization.object({ - type: core.serialization.stringLiteral("reference"), + type: AgentsCreateExpertReferenceType, id: core.serialization.string().optional(), name: core.serialization.string().optional(), systemPrompt: core.serialization.string().optional(), @@ -18,7 +17,7 @@ export const AgentsCreateExpertReference: core.serialization.ObjectSchema< export declare namespace AgentsCreateExpertReference { export interface Raw { - type: "reference"; + type: AgentsCreateExpertReferenceType.Raw; id?: string | null; name?: string | null; systemPrompt?: string | null; diff --git a/src/serialization/types/AgentsCreateExpertReferenceType.ts b/src/serialization/types/AgentsCreateExpertReferenceType.ts new file mode 100644 index 00000000..818e4eaf --- /dev/null +++ b/src/serialization/types/AgentsCreateExpertReferenceType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const AgentsCreateExpertReferenceType: core.serialization.Schema< + serializers.AgentsCreateExpertReferenceType.Raw, + Corti.AgentsCreateExpertReferenceType +> = core.serialization.enum_(["reference"]); + +export declare namespace AgentsCreateExpertReferenceType { + export type Raw = "reference"; +} diff --git a/src/serialization/types/AgentsCreateExpertType.ts b/src/serialization/types/AgentsCreateExpertType.ts new file mode 100644 index 00000000..bde62982 --- /dev/null +++ b/src/serialization/types/AgentsCreateExpertType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const AgentsCreateExpertType: core.serialization.Schema< + serializers.AgentsCreateExpertType.Raw, + Corti.AgentsCreateExpertType +> = core.serialization.enum_(["new"]); + +export declare namespace AgentsCreateExpertType { + export type Raw = "new"; +} diff --git a/src/serialization/types/AgentsCreateMcpServer.ts b/src/serialization/types/AgentsCreateMcpServer.ts index 70106275..a3a17f4b 100644 --- a/src/serialization/types/AgentsCreateMcpServer.ts +++ b/src/serialization/types/AgentsCreateMcpServer.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { AgentsCreateMcpServerTransportType } from "./AgentsCreateMcpServerTransportType.js"; +import type * as serializers from "../index.js"; import { AgentsCreateMcpServerAuthorizationType } from "./AgentsCreateMcpServerAuthorizationType.js"; +import { AgentsCreateMcpServerTransportType } from "./AgentsCreateMcpServerTransportType.js"; export const AgentsCreateMcpServer: core.serialization.ObjectSchema< serializers.AgentsCreateMcpServer.Raw, diff --git a/src/serialization/types/AgentsCreateMcpServerAuthorizationType.ts b/src/serialization/types/AgentsCreateMcpServerAuthorizationType.ts index 18e224c1..9447f5d6 100644 --- a/src/serialization/types/AgentsCreateMcpServerAuthorizationType.ts +++ b/src/serialization/types/AgentsCreateMcpServerAuthorizationType.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsCreateMcpServerAuthorizationType: core.serialization.Schema< serializers.AgentsCreateMcpServerAuthorizationType.Raw, diff --git a/src/serialization/types/AgentsCreateMcpServerTransportType.ts b/src/serialization/types/AgentsCreateMcpServerTransportType.ts index 5ace911f..8e91252c 100644 --- a/src/serialization/types/AgentsCreateMcpServerTransportType.ts +++ b/src/serialization/types/AgentsCreateMcpServerTransportType.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsCreateMcpServerTransportType: core.serialization.Schema< serializers.AgentsCreateMcpServerTransportType.Raw, diff --git a/src/serialization/types/AgentsDataPart.ts b/src/serialization/types/AgentsDataPart.ts index 05d1049e..5dae00cb 100644 --- a/src/serialization/types/AgentsDataPart.ts +++ b/src/serialization/types/AgentsDataPart.ts @@ -1,21 +1,20 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { AgentsDataPartKind } from "./AgentsDataPartKind.js"; export const AgentsDataPart: core.serialization.ObjectSchema = core.serialization.object({ - kind: core.serialization.stringLiteral("data"), + kind: AgentsDataPartKind, data: core.serialization.record(core.serialization.string(), core.serialization.unknown()), metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), }); export declare namespace AgentsDataPart { export interface Raw { - kind: "data"; + kind: AgentsDataPartKind.Raw; data: Record; metadata?: Record | null; } diff --git a/src/serialization/types/AgentsDataPartKind.ts b/src/serialization/types/AgentsDataPartKind.ts new file mode 100644 index 00000000..3f364751 --- /dev/null +++ b/src/serialization/types/AgentsDataPartKind.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const AgentsDataPartKind: core.serialization.Schema< + serializers.AgentsDataPartKind.Raw, + Corti.AgentsDataPartKind +> = core.serialization.enum_(["data"]); + +export declare namespace AgentsDataPartKind { + export type Raw = "data"; +} diff --git a/src/serialization/types/AgentsExpert.ts b/src/serialization/types/AgentsExpert.ts index 298c4b4c..1b03e633 100644 --- a/src/serialization/types/AgentsExpert.ts +++ b/src/serialization/types/AgentsExpert.ts @@ -1,15 +1,14 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { AgentsExpertType } from "./AgentsExpertType.js"; import { AgentsMcpServer } from "./AgentsMcpServer.js"; export const AgentsExpert: core.serialization.ObjectSchema = core.serialization.object({ - type: core.serialization.stringLiteral("expert"), + type: AgentsExpertType, id: core.serialization.string(), name: core.serialization.string(), description: core.serialization.string(), @@ -19,7 +18,7 @@ export const AgentsExpert: core.serialization.ObjectSchema = core.serialization.object({ - type: core.serialization.stringLiteral("reference"), + type: AgentsExpertReferenceType, id: core.serialization.string(), name: core.serialization.string(), systemPrompt: core.serialization.string().optional(), @@ -18,7 +17,7 @@ export const AgentsExpertReference: core.serialization.ObjectSchema< export declare namespace AgentsExpertReference { export interface Raw { - type: "reference"; + type: AgentsExpertReferenceType.Raw; id: string; name: string; systemPrompt?: string | null; diff --git a/src/serialization/types/AgentsExpertReferenceType.ts b/src/serialization/types/AgentsExpertReferenceType.ts new file mode 100644 index 00000000..f6c6d1ea --- /dev/null +++ b/src/serialization/types/AgentsExpertReferenceType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const AgentsExpertReferenceType: core.serialization.Schema< + serializers.AgentsExpertReferenceType.Raw, + Corti.AgentsExpertReferenceType +> = core.serialization.enum_(["reference"]); + +export declare namespace AgentsExpertReferenceType { + export type Raw = "reference"; +} diff --git a/src/serialization/types/AgentsExpertType.ts b/src/serialization/types/AgentsExpertType.ts new file mode 100644 index 00000000..28daa1b9 --- /dev/null +++ b/src/serialization/types/AgentsExpertType.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const AgentsExpertType: core.serialization.Schema = + core.serialization.enum_(["expert"]); + +export declare namespace AgentsExpertType { + export type Raw = "expert"; +} diff --git a/src/serialization/types/AgentsFilePart.ts b/src/serialization/types/AgentsFilePart.ts index 0f059301..8f4d1cea 100644 --- a/src/serialization/types/AgentsFilePart.ts +++ b/src/serialization/types/AgentsFilePart.ts @@ -1,22 +1,21 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsFilePartFile } from "./AgentsFilePartFile.js"; +import { AgentsFilePartKind } from "./AgentsFilePartKind.js"; export const AgentsFilePart: core.serialization.ObjectSchema = core.serialization.object({ - kind: core.serialization.stringLiteral("file"), + kind: AgentsFilePartKind, file: AgentsFilePartFile.optional(), metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), }); export declare namespace AgentsFilePart { export interface Raw { - kind: "file"; + kind: AgentsFilePartKind.Raw; file?: AgentsFilePartFile.Raw | null; metadata?: Record | null; } diff --git a/src/serialization/types/AgentsFilePartFile.ts b/src/serialization/types/AgentsFilePartFile.ts index 8572ae9b..827a1b4c 100644 --- a/src/serialization/types/AgentsFilePartFile.ts +++ b/src/serialization/types/AgentsFilePartFile.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { AgentsFileWithUri } from "./AgentsFileWithUri.js"; +import type * as serializers from "../index.js"; import { AgentsFileWithBytes } from "./AgentsFileWithBytes.js"; +import { AgentsFileWithUri } from "./AgentsFileWithUri.js"; export const AgentsFilePartFile: core.serialization.Schema< serializers.AgentsFilePartFile.Raw, diff --git a/src/serialization/types/AgentsFilePartKind.ts b/src/serialization/types/AgentsFilePartKind.ts new file mode 100644 index 00000000..77d4cd42 --- /dev/null +++ b/src/serialization/types/AgentsFilePartKind.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const AgentsFilePartKind: core.serialization.Schema< + serializers.AgentsFilePartKind.Raw, + Corti.AgentsFilePartKind +> = core.serialization.enum_(["file"]); + +export declare namespace AgentsFilePartKind { + export type Raw = "file"; +} diff --git a/src/serialization/types/AgentsFileWithBytes.ts b/src/serialization/types/AgentsFileWithBytes.ts index a501a7b7..6bf82871 100644 --- a/src/serialization/types/AgentsFileWithBytes.ts +++ b/src/serialization/types/AgentsFileWithBytes.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsFileWithBytes: core.serialization.ObjectSchema< serializers.AgentsFileWithBytes.Raw, diff --git a/src/serialization/types/AgentsFileWithUri.ts b/src/serialization/types/AgentsFileWithUri.ts index 0e753c49..f6025b3e 100644 --- a/src/serialization/types/AgentsFileWithUri.ts +++ b/src/serialization/types/AgentsFileWithUri.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsFileWithUri: core.serialization.ObjectSchema< serializers.AgentsFileWithUri.Raw, diff --git a/src/serialization/types/AgentsMcpServer.ts b/src/serialization/types/AgentsMcpServer.ts index 7f85a4a4..32d26f86 100644 --- a/src/serialization/types/AgentsMcpServer.ts +++ b/src/serialization/types/AgentsMcpServer.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { AgentsMcpServerTransportType } from "./AgentsMcpServerTransportType.js"; +import type * as serializers from "../index.js"; import { AgentsMcpServerAuthorizationType } from "./AgentsMcpServerAuthorizationType.js"; +import { AgentsMcpServerTransportType } from "./AgentsMcpServerTransportType.js"; export const AgentsMcpServer: core.serialization.ObjectSchema = core.serialization.object({ @@ -27,6 +25,6 @@ export declare namespace AgentsMcpServer { authorizationType: AgentsMcpServerAuthorizationType.Raw; authorizationScope?: string | null; url: string; - redirectUrl?: (string | null) | null; + redirectUrl?: (string | null | undefined) | null; } } diff --git a/src/serialization/types/AgentsMcpServerAuthorizationType.ts b/src/serialization/types/AgentsMcpServerAuthorizationType.ts index 79d29ce9..ea666a01 100644 --- a/src/serialization/types/AgentsMcpServerAuthorizationType.ts +++ b/src/serialization/types/AgentsMcpServerAuthorizationType.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsMcpServerAuthorizationType: core.serialization.Schema< serializers.AgentsMcpServerAuthorizationType.Raw, diff --git a/src/serialization/types/AgentsMcpServerTransportType.ts b/src/serialization/types/AgentsMcpServerTransportType.ts index 679cd63c..1b050cca 100644 --- a/src/serialization/types/AgentsMcpServerTransportType.ts +++ b/src/serialization/types/AgentsMcpServerTransportType.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsMcpServerTransportType: core.serialization.Schema< serializers.AgentsMcpServerTransportType.Raw, diff --git a/src/serialization/types/AgentsMessage.ts b/src/serialization/types/AgentsMessage.ts index 0d94a8db..0f50d4cc 100644 --- a/src/serialization/types/AgentsMessage.ts +++ b/src/serialization/types/AgentsMessage.ts @@ -1,10 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { AgentsMessageKind } from "./AgentsMessageKind.js"; import { AgentsMessageRole } from "./AgentsMessageRole.js"; import { AgentsPart } from "./AgentsPart.js"; @@ -18,7 +17,7 @@ export const AgentsMessage: core.serialization.ObjectSchema = + core.serialization.enum_(["message"]); + +export declare namespace AgentsMessageKind { + export type Raw = "message"; +} diff --git a/src/serialization/types/AgentsMessageRole.ts b/src/serialization/types/AgentsMessageRole.ts index 006c605d..4c3115f9 100644 --- a/src/serialization/types/AgentsMessageRole.ts +++ b/src/serialization/types/AgentsMessageRole.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsMessageRole: core.serialization.Schema = core.serialization.enum_(["user", "agent"]); diff --git a/src/serialization/types/AgentsMessageSendConfiguration.ts b/src/serialization/types/AgentsMessageSendConfiguration.ts index b0f2bb16..e3bd0a73 100644 --- a/src/serialization/types/AgentsMessageSendConfiguration.ts +++ b/src/serialization/types/AgentsMessageSendConfiguration.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsPushNotificationConfig } from "./AgentsPushNotificationConfig.js"; export const AgentsMessageSendConfiguration: core.serialization.ObjectSchema< diff --git a/src/serialization/types/AgentsPart.ts b/src/serialization/types/AgentsPart.ts index 5a9f895d..cba88209 100644 --- a/src/serialization/types/AgentsPart.ts +++ b/src/serialization/types/AgentsPart.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { AgentsTextPart } from "./AgentsTextPart.js"; -import { AgentsFilePart } from "./AgentsFilePart.js"; +import type * as serializers from "../index.js"; import { AgentsDataPart } from "./AgentsDataPart.js"; +import { AgentsFilePart } from "./AgentsFilePart.js"; +import { AgentsTextPart } from "./AgentsTextPart.js"; export const AgentsPart: core.serialization.Schema = core.serialization.undiscriminatedUnion([AgentsTextPart, AgentsFilePart, AgentsDataPart]); diff --git a/src/serialization/types/AgentsPushNotificationAuthenticationInfo.ts b/src/serialization/types/AgentsPushNotificationAuthenticationInfo.ts index a055bdbb..eb0b5742 100644 --- a/src/serialization/types/AgentsPushNotificationAuthenticationInfo.ts +++ b/src/serialization/types/AgentsPushNotificationAuthenticationInfo.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsPushNotificationAuthenticationInfo: core.serialization.ObjectSchema< serializers.AgentsPushNotificationAuthenticationInfo.Raw, diff --git a/src/serialization/types/AgentsPushNotificationConfig.ts b/src/serialization/types/AgentsPushNotificationConfig.ts index 61f8f7cf..5c809ea9 100644 --- a/src/serialization/types/AgentsPushNotificationConfig.ts +++ b/src/serialization/types/AgentsPushNotificationConfig.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsPushNotificationAuthenticationInfo } from "./AgentsPushNotificationAuthenticationInfo.js"; export const AgentsPushNotificationConfig: core.serialization.ObjectSchema< diff --git a/src/serialization/types/AgentsRegistryExpert.ts b/src/serialization/types/AgentsRegistryExpert.ts index 872a69c4..5a2a27a6 100644 --- a/src/serialization/types/AgentsRegistryExpert.ts +++ b/src/serialization/types/AgentsRegistryExpert.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsRegistryMcpServer } from "./AgentsRegistryMcpServer.js"; export const AgentsRegistryExpert: core.serialization.ObjectSchema< diff --git a/src/serialization/types/AgentsRegistryExpertsResponse.ts b/src/serialization/types/AgentsRegistryExpertsResponse.ts index a16e89bc..a2654f1f 100644 --- a/src/serialization/types/AgentsRegistryExpertsResponse.ts +++ b/src/serialization/types/AgentsRegistryExpertsResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsRegistryExpert } from "./AgentsRegistryExpert.js"; export const AgentsRegistryExpertsResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/AgentsRegistryMcpServer.ts b/src/serialization/types/AgentsRegistryMcpServer.ts index 7b8db826..7b771629 100644 --- a/src/serialization/types/AgentsRegistryMcpServer.ts +++ b/src/serialization/types/AgentsRegistryMcpServer.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { AgentsRegistryMcpServerAuthorizationType } from "./AgentsRegistryMcpServerAuthorizationType.js"; export const AgentsRegistryMcpServer: core.serialization.ObjectSchema< diff --git a/src/serialization/types/AgentsRegistryMcpServerAuthorizationType.ts b/src/serialization/types/AgentsRegistryMcpServerAuthorizationType.ts index ffcbd24b..29d87c55 100644 --- a/src/serialization/types/AgentsRegistryMcpServerAuthorizationType.ts +++ b/src/serialization/types/AgentsRegistryMcpServerAuthorizationType.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsRegistryMcpServerAuthorizationType: core.serialization.Schema< serializers.AgentsRegistryMcpServerAuthorizationType.Raw, diff --git a/src/serialization/types/AgentsTask.ts b/src/serialization/types/AgentsTask.ts index b89efa0a..7e1fa68d 100644 --- a/src/serialization/types/AgentsTask.ts +++ b/src/serialization/types/AgentsTask.ts @@ -1,13 +1,12 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { AgentsTaskStatus } from "./AgentsTaskStatus.js"; -import { AgentsMessage } from "./AgentsMessage.js"; +import type * as serializers from "../index.js"; import { AgentsArtifact } from "./AgentsArtifact.js"; +import { AgentsMessage } from "./AgentsMessage.js"; +import { AgentsTaskKind } from "./AgentsTaskKind.js"; +import { AgentsTaskStatus } from "./AgentsTaskStatus.js"; export const AgentsTask: core.serialization.ObjectSchema = core.serialization.object({ @@ -17,7 +16,7 @@ export const AgentsTask: core.serialization.ObjectSchema | null; - kind: "task"; + kind: AgentsTaskKind.Raw; } } diff --git a/src/serialization/types/AgentsTaskKind.ts b/src/serialization/types/AgentsTaskKind.ts new file mode 100644 index 00000000..dc91c875 --- /dev/null +++ b/src/serialization/types/AgentsTaskKind.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const AgentsTaskKind: core.serialization.Schema = + core.serialization.enum_(["task"]); + +export declare namespace AgentsTaskKind { + export type Raw = "task"; +} diff --git a/src/serialization/types/AgentsTaskStatus.ts b/src/serialization/types/AgentsTaskStatus.ts index cdcaa6c8..4511659b 100644 --- a/src/serialization/types/AgentsTaskStatus.ts +++ b/src/serialization/types/AgentsTaskStatus.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { AgentsTaskStatusState } from "./AgentsTaskStatusState.js"; +import type * as serializers from "../index.js"; import { AgentsMessage } from "./AgentsMessage.js"; +import { AgentsTaskStatusState } from "./AgentsTaskStatusState.js"; export const AgentsTaskStatus: core.serialization.ObjectSchema< serializers.AgentsTaskStatus.Raw, diff --git a/src/serialization/types/AgentsTaskStatusState.ts b/src/serialization/types/AgentsTaskStatusState.ts index f0224368..24e1e1d4 100644 --- a/src/serialization/types/AgentsTaskStatusState.ts +++ b/src/serialization/types/AgentsTaskStatusState.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const AgentsTaskStatusState: core.serialization.Schema< serializers.AgentsTaskStatusState.Raw, diff --git a/src/serialization/types/AgentsTextPart.ts b/src/serialization/types/AgentsTextPart.ts index 1335d71c..79c24b59 100644 --- a/src/serialization/types/AgentsTextPart.ts +++ b/src/serialization/types/AgentsTextPart.ts @@ -1,21 +1,20 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { AgentsTextPartKind } from "./AgentsTextPartKind.js"; export const AgentsTextPart: core.serialization.ObjectSchema = core.serialization.object({ - kind: core.serialization.stringLiteral("text"), + kind: AgentsTextPartKind, text: core.serialization.string(), metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), }); export declare namespace AgentsTextPart { export interface Raw { - kind: "text"; + kind: AgentsTextPartKind.Raw; text: string; metadata?: Record | null; } diff --git a/src/serialization/types/AgentsTextPartKind.ts b/src/serialization/types/AgentsTextPartKind.ts new file mode 100644 index 00000000..202e1895 --- /dev/null +++ b/src/serialization/types/AgentsTextPartKind.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const AgentsTextPartKind: core.serialization.Schema< + serializers.AgentsTextPartKind.Raw, + Corti.AgentsTextPartKind +> = core.serialization.enum_(["text"]); + +export declare namespace AgentsTextPartKind { + export type Raw = "text"; +} diff --git a/src/serialization/types/CodesGeneralReadResponse.ts b/src/serialization/types/CodesGeneralReadResponse.ts index 059871c5..f87c64b3 100644 --- a/src/serialization/types/CodesGeneralReadResponse.ts +++ b/src/serialization/types/CodesGeneralReadResponse.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { CommonCodingSystemEnum } from "./CommonCodingSystemEnum.js"; +import type * as serializers from "../index.js"; import { CodesGeneralReadResponseEvidencesItem } from "./CodesGeneralReadResponseEvidencesItem.js"; +import { CommonCodingSystemEnum } from "./CommonCodingSystemEnum.js"; export const CodesGeneralReadResponse: core.serialization.ObjectSchema< serializers.CodesGeneralReadResponse.Raw, diff --git a/src/serialization/types/CodesGeneralReadResponseEvidencesItem.ts b/src/serialization/types/CodesGeneralReadResponseEvidencesItem.ts index 851f7285..cff7d330 100644 --- a/src/serialization/types/CodesGeneralReadResponseEvidencesItem.ts +++ b/src/serialization/types/CodesGeneralReadResponseEvidencesItem.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const CodesGeneralReadResponseEvidencesItem: core.serialization.ObjectSchema< serializers.CodesGeneralReadResponseEvidencesItem.Raw, diff --git a/src/serialization/types/CodesGeneralResponse.ts b/src/serialization/types/CodesGeneralResponse.ts index 005719b7..6125550e 100644 --- a/src/serialization/types/CodesGeneralResponse.ts +++ b/src/serialization/types/CodesGeneralResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { CodesGeneralReadResponse } from "./CodesGeneralReadResponse.js"; import { CommonUsageInfo } from "./CommonUsageInfo.js"; diff --git a/src/serialization/types/CommonAiContext.ts b/src/serialization/types/CommonAiContext.ts index 98d3042d..3a57f2cb 100644 --- a/src/serialization/types/CommonAiContext.ts +++ b/src/serialization/types/CommonAiContext.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { CommonTextContext } from "./CommonTextContext.js"; +import type * as serializers from "../index.js"; import { CommonDocumentIdContext } from "./CommonDocumentIdContext.js"; +import { CommonTextContext } from "./CommonTextContext.js"; export const CommonAiContext: core.serialization.Schema = core.serialization.undiscriminatedUnion([CommonTextContext, CommonDocumentIdContext]); diff --git a/src/serialization/types/CommonCodingSystemEnum.ts b/src/serialization/types/CommonCodingSystemEnum.ts index d03e68fa..7b5f1a4c 100644 --- a/src/serialization/types/CommonCodingSystemEnum.ts +++ b/src/serialization/types/CommonCodingSystemEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const CommonCodingSystemEnum: core.serialization.Schema< serializers.CommonCodingSystemEnum.Raw, diff --git a/src/serialization/types/CommonDocumentIdContext.ts b/src/serialization/types/CommonDocumentIdContext.ts index eac9eeed..7e57d498 100644 --- a/src/serialization/types/CommonDocumentIdContext.ts +++ b/src/serialization/types/CommonDocumentIdContext.ts @@ -1,22 +1,21 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { CommonDocumentIdContextType } from "./CommonDocumentIdContextType.js"; export const CommonDocumentIdContext: core.serialization.ObjectSchema< serializers.CommonDocumentIdContext.Raw, Corti.CommonDocumentIdContext > = core.serialization.object({ - type: core.serialization.stringLiteral("documentId"), + type: CommonDocumentIdContextType, documentId: core.serialization.string(), }); export declare namespace CommonDocumentIdContext { export interface Raw { - type: "documentId"; + type: CommonDocumentIdContextType.Raw; documentId: string; } } diff --git a/src/serialization/types/CommonDocumentIdContextType.ts b/src/serialization/types/CommonDocumentIdContextType.ts new file mode 100644 index 00000000..4f3dbe6a --- /dev/null +++ b/src/serialization/types/CommonDocumentIdContextType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const CommonDocumentIdContextType: core.serialization.Schema< + serializers.CommonDocumentIdContextType.Raw, + Corti.CommonDocumentIdContextType +> = core.serialization.enum_(["documentId"]); + +export declare namespace CommonDocumentIdContextType { + export type Raw = "documentId"; +} diff --git a/src/serialization/types/CommonSortingDirectionEnum.ts b/src/serialization/types/CommonSortingDirectionEnum.ts index 8c7ed9d1..fc9e2d34 100644 --- a/src/serialization/types/CommonSortingDirectionEnum.ts +++ b/src/serialization/types/CommonSortingDirectionEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const CommonSortingDirectionEnum: core.serialization.Schema< serializers.CommonSortingDirectionEnum.Raw, diff --git a/src/serialization/types/CommonSourceEnum.ts b/src/serialization/types/CommonSourceEnum.ts index 5243d837..ca6ae27c 100644 --- a/src/serialization/types/CommonSourceEnum.ts +++ b/src/serialization/types/CommonSourceEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const CommonSourceEnum: core.serialization.Schema = core.serialization.enum_(["core", "system", "user"]); diff --git a/src/serialization/types/CommonTextContext.ts b/src/serialization/types/CommonTextContext.ts index 6e731bcc..37e4d2f8 100644 --- a/src/serialization/types/CommonTextContext.ts +++ b/src/serialization/types/CommonTextContext.ts @@ -1,22 +1,21 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { CommonTextContextType } from "./CommonTextContextType.js"; export const CommonTextContext: core.serialization.ObjectSchema< serializers.CommonTextContext.Raw, Corti.CommonTextContext > = core.serialization.object({ - type: core.serialization.stringLiteral("text"), + type: CommonTextContextType, text: core.serialization.string(), }); export declare namespace CommonTextContext { export interface Raw { - type: "text"; + type: CommonTextContextType.Raw; text: string; } } diff --git a/src/serialization/types/CommonTextContextType.ts b/src/serialization/types/CommonTextContextType.ts new file mode 100644 index 00000000..7b045c8d --- /dev/null +++ b/src/serialization/types/CommonTextContextType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const CommonTextContextType: core.serialization.Schema< + serializers.CommonTextContextType.Raw, + Corti.CommonTextContextType +> = core.serialization.enum_(["text"]); + +export declare namespace CommonTextContextType { + export type Raw = "text"; +} diff --git a/src/serialization/types/CommonTranscriptRequest.ts b/src/serialization/types/CommonTranscriptRequest.ts index dceb4b68..8efc4be5 100644 --- a/src/serialization/types/CommonTranscriptRequest.ts +++ b/src/serialization/types/CommonTranscriptRequest.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const CommonTranscriptRequest: core.serialization.ObjectSchema< serializers.CommonTranscriptRequest.Raw, diff --git a/src/serialization/types/CommonTranscriptResponse.ts b/src/serialization/types/CommonTranscriptResponse.ts index c156474b..b47d9b4d 100644 --- a/src/serialization/types/CommonTranscriptResponse.ts +++ b/src/serialization/types/CommonTranscriptResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const CommonTranscriptResponse: core.serialization.ObjectSchema< serializers.CommonTranscriptResponse.Raw, diff --git a/src/serialization/types/CommonUsageInfo.ts b/src/serialization/types/CommonUsageInfo.ts index 0df329b4..d69190b6 100644 --- a/src/serialization/types/CommonUsageInfo.ts +++ b/src/serialization/types/CommonUsageInfo.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const CommonUsageInfo: core.serialization.ObjectSchema = core.serialization.object({ diff --git a/src/serialization/types/DocumentsContext.ts b/src/serialization/types/DocumentsContext.ts index 10f2e75f..1085537b 100644 --- a/src/serialization/types/DocumentsContext.ts +++ b/src/serialization/types/DocumentsContext.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { DocumentsContextWithFacts } from "./DocumentsContextWithFacts.js"; -import { DocumentsContextWithTranscript } from "./DocumentsContextWithTranscript.js"; import { DocumentsContextWithString } from "./DocumentsContextWithString.js"; +import { DocumentsContextWithTranscript } from "./DocumentsContextWithTranscript.js"; export const DocumentsContext: core.serialization.Schema = core.serialization.undiscriminatedUnion([ diff --git a/src/serialization/types/DocumentsContextWithFacts.ts b/src/serialization/types/DocumentsContextWithFacts.ts index 5f7bf473..86476e6a 100644 --- a/src/serialization/types/DocumentsContextWithFacts.ts +++ b/src/serialization/types/DocumentsContextWithFacts.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { DocumentsContextWithFactsType } from "./DocumentsContextWithFactsType.js"; import { FactsContext } from "./FactsContext.js"; export const DocumentsContextWithFacts: core.serialization.ObjectSchema< serializers.DocumentsContextWithFacts.Raw, Corti.DocumentsContextWithFacts > = core.serialization.object({ - type: core.serialization.stringLiteral("facts"), + type: DocumentsContextWithFactsType, data: core.serialization.list(FactsContext), }); export declare namespace DocumentsContextWithFacts { export interface Raw { - type: "facts"; + type: DocumentsContextWithFactsType.Raw; data: FactsContext.Raw[]; } } diff --git a/src/serialization/types/DocumentsContextWithFactsType.ts b/src/serialization/types/DocumentsContextWithFactsType.ts new file mode 100644 index 00000000..3b63cf95 --- /dev/null +++ b/src/serialization/types/DocumentsContextWithFactsType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const DocumentsContextWithFactsType: core.serialization.Schema< + serializers.DocumentsContextWithFactsType.Raw, + Corti.DocumentsContextWithFactsType +> = core.serialization.enum_(["facts"]); + +export declare namespace DocumentsContextWithFactsType { + export type Raw = "facts"; +} diff --git a/src/serialization/types/DocumentsContextWithString.ts b/src/serialization/types/DocumentsContextWithString.ts index 1ab1d4ea..cb700baa 100644 --- a/src/serialization/types/DocumentsContextWithString.ts +++ b/src/serialization/types/DocumentsContextWithString.ts @@ -1,22 +1,21 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { DocumentsContextWithStringType } from "./DocumentsContextWithStringType.js"; export const DocumentsContextWithString: core.serialization.ObjectSchema< serializers.DocumentsContextWithString.Raw, Corti.DocumentsContextWithString > = core.serialization.object({ - type: core.serialization.stringLiteral("string"), + type: DocumentsContextWithStringType, data: core.serialization.string(), }); export declare namespace DocumentsContextWithString { export interface Raw { - type: "string"; + type: DocumentsContextWithStringType.Raw; data: string; } } diff --git a/src/serialization/types/DocumentsContextWithStringType.ts b/src/serialization/types/DocumentsContextWithStringType.ts new file mode 100644 index 00000000..aefb35ab --- /dev/null +++ b/src/serialization/types/DocumentsContextWithStringType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const DocumentsContextWithStringType: core.serialization.Schema< + serializers.DocumentsContextWithStringType.Raw, + Corti.DocumentsContextWithStringType +> = core.serialization.enum_(["string"]); + +export declare namespace DocumentsContextWithStringType { + export type Raw = "string"; +} diff --git a/src/serialization/types/DocumentsContextWithTranscript.ts b/src/serialization/types/DocumentsContextWithTranscript.ts index eb23238b..732bd5fb 100644 --- a/src/serialization/types/DocumentsContextWithTranscript.ts +++ b/src/serialization/types/DocumentsContextWithTranscript.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { CommonTranscriptRequest } from "./CommonTranscriptRequest.js"; +import { DocumentsContextWithTranscriptType } from "./DocumentsContextWithTranscriptType.js"; export const DocumentsContextWithTranscript: core.serialization.ObjectSchema< serializers.DocumentsContextWithTranscript.Raw, Corti.DocumentsContextWithTranscript > = core.serialization.object({ - type: core.serialization.stringLiteral("transcript"), + type: DocumentsContextWithTranscriptType, data: CommonTranscriptRequest, }); export declare namespace DocumentsContextWithTranscript { export interface Raw { - type: "transcript"; + type: DocumentsContextWithTranscriptType.Raw; data: CommonTranscriptRequest.Raw; } } diff --git a/src/serialization/types/DocumentsContextWithTranscriptType.ts b/src/serialization/types/DocumentsContextWithTranscriptType.ts new file mode 100644 index 00000000..207b5693 --- /dev/null +++ b/src/serialization/types/DocumentsContextWithTranscriptType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const DocumentsContextWithTranscriptType: core.serialization.Schema< + serializers.DocumentsContextWithTranscriptType.Raw, + Corti.DocumentsContextWithTranscriptType +> = core.serialization.enum_(["transcript"]); + +export declare namespace DocumentsContextWithTranscriptType { + export type Raw = "transcript"; +} diff --git a/src/serialization/types/DocumentsCreateRequest.ts b/src/serialization/types/DocumentsCreateRequest.ts index 06aeec2d..62b9db55 100644 --- a/src/serialization/types/DocumentsCreateRequest.ts +++ b/src/serialization/types/DocumentsCreateRequest.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { DocumentsCreateRequestWithTemplateKey } from "./DocumentsCreateRequestWithTemplateKey.js"; +import type * as serializers from "../index.js"; import { DocumentsCreateRequestWithTemplate } from "./DocumentsCreateRequestWithTemplate.js"; +import { DocumentsCreateRequestWithTemplateKey } from "./DocumentsCreateRequestWithTemplateKey.js"; export const DocumentsCreateRequest: core.serialization.Schema< serializers.DocumentsCreateRequest.Raw, diff --git a/src/serialization/types/DocumentsCreateRequestWithTemplate.ts b/src/serialization/types/DocumentsCreateRequestWithTemplate.ts index 9de28248..9b17b98c 100644 --- a/src/serialization/types/DocumentsCreateRequestWithTemplate.ts +++ b/src/serialization/types/DocumentsCreateRequestWithTemplate.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { DocumentsContext } from "./DocumentsContext.js"; import { DocumentsTemplate } from "./DocumentsTemplate.js"; import { TemplatesDocumentationModeEnum } from "./TemplatesDocumentationModeEnum.js"; diff --git a/src/serialization/types/DocumentsCreateRequestWithTemplateKey.ts b/src/serialization/types/DocumentsCreateRequestWithTemplateKey.ts index 38b27598..b4cc6ea4 100644 --- a/src/serialization/types/DocumentsCreateRequestWithTemplateKey.ts +++ b/src/serialization/types/DocumentsCreateRequestWithTemplateKey.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { DocumentsContext } from "./DocumentsContext.js"; import { TemplatesDocumentationModeEnum } from "./TemplatesDocumentationModeEnum.js"; diff --git a/src/serialization/types/DocumentsGetResponse.ts b/src/serialization/types/DocumentsGetResponse.ts index 695d568e..2eebf07a 100644 --- a/src/serialization/types/DocumentsGetResponse.ts +++ b/src/serialization/types/DocumentsGetResponse.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { Uuid } from "./Uuid.js"; -import { DocumentsSection } from "./DocumentsSection.js"; +import type * as serializers from "../index.js"; import { CommonUsageInfo } from "./CommonUsageInfo.js"; +import { DocumentsSection } from "./DocumentsSection.js"; +import { Uuid } from "./Uuid.js"; export const DocumentsGetResponse: core.serialization.ObjectSchema< serializers.DocumentsGetResponse.Raw, diff --git a/src/serialization/types/DocumentsListResponse.ts b/src/serialization/types/DocumentsListResponse.ts index f8c53aec..d4966afc 100644 --- a/src/serialization/types/DocumentsListResponse.ts +++ b/src/serialization/types/DocumentsListResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { DocumentsGetResponse } from "./DocumentsGetResponse.js"; export const DocumentsListResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/DocumentsSection.ts b/src/serialization/types/DocumentsSection.ts index 08235ad0..b2803f8b 100644 --- a/src/serialization/types/DocumentsSection.ts +++ b/src/serialization/types/DocumentsSection.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const DocumentsSection: core.serialization.ObjectSchema< serializers.DocumentsSection.Raw, diff --git a/src/serialization/types/DocumentsSectionInput.ts b/src/serialization/types/DocumentsSectionInput.ts index 688508d5..0e454878 100644 --- a/src/serialization/types/DocumentsSectionInput.ts +++ b/src/serialization/types/DocumentsSectionInput.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const DocumentsSectionInput: core.serialization.ObjectSchema< serializers.DocumentsSectionInput.Raw, diff --git a/src/serialization/types/DocumentsSectionOverride.ts b/src/serialization/types/DocumentsSectionOverride.ts index 54f079ff..2a78560e 100644 --- a/src/serialization/types/DocumentsSectionOverride.ts +++ b/src/serialization/types/DocumentsSectionOverride.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const DocumentsSectionOverride: core.serialization.ObjectSchema< serializers.DocumentsSectionOverride.Raw, diff --git a/src/serialization/types/DocumentsTemplate.ts b/src/serialization/types/DocumentsTemplate.ts index ebd6c6ab..faf1ccb3 100644 --- a/src/serialization/types/DocumentsTemplate.ts +++ b/src/serialization/types/DocumentsTemplate.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { DocumentsTemplateWithSections } from "./DocumentsTemplateWithSections.js"; +import type * as serializers from "../index.js"; import { DocumentsTemplateWithSectionKeys } from "./DocumentsTemplateWithSectionKeys.js"; +import { DocumentsTemplateWithSections } from "./DocumentsTemplateWithSections.js"; export const DocumentsTemplate: core.serialization.Schema = core.serialization.undiscriminatedUnion([DocumentsTemplateWithSections, DocumentsTemplateWithSectionKeys]); diff --git a/src/serialization/types/DocumentsTemplateWithSectionKeys.ts b/src/serialization/types/DocumentsTemplateWithSectionKeys.ts index baf98322..4b5d13d5 100644 --- a/src/serialization/types/DocumentsTemplateWithSectionKeys.ts +++ b/src/serialization/types/DocumentsTemplateWithSectionKeys.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const DocumentsTemplateWithSectionKeys: core.serialization.ObjectSchema< serializers.DocumentsTemplateWithSectionKeys.Raw, diff --git a/src/serialization/types/DocumentsTemplateWithSections.ts b/src/serialization/types/DocumentsTemplateWithSections.ts index 48fe22b3..0d379f6e 100644 --- a/src/serialization/types/DocumentsTemplateWithSections.ts +++ b/src/serialization/types/DocumentsTemplateWithSections.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { DocumentsSectionOverride } from "./DocumentsSectionOverride.js"; export const DocumentsTemplateWithSections: core.serialization.ObjectSchema< diff --git a/src/serialization/types/ErrorResponse.ts b/src/serialization/types/ErrorResponse.ts index 4851d538..42f4eb72 100644 --- a/src/serialization/types/ErrorResponse.ts +++ b/src/serialization/types/ErrorResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const ErrorResponse: core.serialization.ObjectSchema = core.serialization.object({ diff --git a/src/serialization/types/FactsBatchUpdateInput.ts b/src/serialization/types/FactsBatchUpdateInput.ts index fc30a5fc..b984db6f 100644 --- a/src/serialization/types/FactsBatchUpdateInput.ts +++ b/src/serialization/types/FactsBatchUpdateInput.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const FactsBatchUpdateInput: core.serialization.ObjectSchema< serializers.FactsBatchUpdateInput.Raw, diff --git a/src/serialization/types/FactsBatchUpdateItem.ts b/src/serialization/types/FactsBatchUpdateItem.ts index bd339a35..493abfbb 100644 --- a/src/serialization/types/FactsBatchUpdateItem.ts +++ b/src/serialization/types/FactsBatchUpdateItem.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { Uuid } from "./Uuid.js"; +import type * as serializers from "../index.js"; import { CommonSourceEnum } from "./CommonSourceEnum.js"; +import { Uuid } from "./Uuid.js"; export const FactsBatchUpdateItem: core.serialization.ObjectSchema< serializers.FactsBatchUpdateItem.Raw, diff --git a/src/serialization/types/FactsBatchUpdateResponse.ts b/src/serialization/types/FactsBatchUpdateResponse.ts index be2370d6..4d0f4cab 100644 --- a/src/serialization/types/FactsBatchUpdateResponse.ts +++ b/src/serialization/types/FactsBatchUpdateResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { FactsBatchUpdateItem } from "./FactsBatchUpdateItem.js"; export const FactsBatchUpdateResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/FactsContext.ts b/src/serialization/types/FactsContext.ts index a00966ba..f22cd996 100644 --- a/src/serialization/types/FactsContext.ts +++ b/src/serialization/types/FactsContext.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { CommonSourceEnum } from "./CommonSourceEnum.js"; export const FactsContext: core.serialization.ObjectSchema = diff --git a/src/serialization/types/FactsCreateInput.ts b/src/serialization/types/FactsCreateInput.ts index 1a4a1713..7e31b51b 100644 --- a/src/serialization/types/FactsCreateInput.ts +++ b/src/serialization/types/FactsCreateInput.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { CommonSourceEnum } from "./CommonSourceEnum.js"; export const FactsCreateInput: core.serialization.ObjectSchema< diff --git a/src/serialization/types/FactsCreateItem.ts b/src/serialization/types/FactsCreateItem.ts index a9c750c2..9ae5e667 100644 --- a/src/serialization/types/FactsCreateItem.ts +++ b/src/serialization/types/FactsCreateItem.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { Uuid } from "./Uuid.js"; +import type * as serializers from "../index.js"; import { CommonSourceEnum } from "./CommonSourceEnum.js"; +import { Uuid } from "./Uuid.js"; export const FactsCreateItem: core.serialization.ObjectSchema = core.serialization.object({ diff --git a/src/serialization/types/FactsCreateResponse.ts b/src/serialization/types/FactsCreateResponse.ts index a38c26bf..311f4375 100644 --- a/src/serialization/types/FactsCreateResponse.ts +++ b/src/serialization/types/FactsCreateResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { FactsCreateItem } from "./FactsCreateItem.js"; export const FactsCreateResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/FactsEvidence.ts b/src/serialization/types/FactsEvidence.ts index bfba9204..c1592bfe 100644 --- a/src/serialization/types/FactsEvidence.ts +++ b/src/serialization/types/FactsEvidence.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const FactsEvidence: core.serialization.ObjectSchema = core.serialization.object({ diff --git a/src/serialization/types/FactsExtractResponse.ts b/src/serialization/types/FactsExtractResponse.ts index b0eb6891..f66008f2 100644 --- a/src/serialization/types/FactsExtractResponse.ts +++ b/src/serialization/types/FactsExtractResponse.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { FactsExtractResponseFactsItem } from "./FactsExtractResponseFactsItem.js"; +import type * as serializers from "../index.js"; import { CommonUsageInfo } from "./CommonUsageInfo.js"; +import { FactsExtractResponseFactsItem } from "./FactsExtractResponseFactsItem.js"; export const FactsExtractResponse: core.serialization.ObjectSchema< serializers.FactsExtractResponse.Raw, diff --git a/src/serialization/types/FactsExtractResponseFactsItem.ts b/src/serialization/types/FactsExtractResponseFactsItem.ts index d4c1077c..5dc87d54 100644 --- a/src/serialization/types/FactsExtractResponseFactsItem.ts +++ b/src/serialization/types/FactsExtractResponseFactsItem.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const FactsExtractResponseFactsItem: core.serialization.ObjectSchema< serializers.FactsExtractResponseFactsItem.Raw, diff --git a/src/serialization/types/FactsFactGroupsItem.ts b/src/serialization/types/FactsFactGroupsItem.ts index 363c8675..9fe17a8d 100644 --- a/src/serialization/types/FactsFactGroupsItem.ts +++ b/src/serialization/types/FactsFactGroupsItem.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { Uuid } from "./Uuid.js"; +import type * as serializers from "../index.js"; import { FactsFactGroupsItemTranslationsItem } from "./FactsFactGroupsItemTranslationsItem.js"; +import { Uuid } from "./Uuid.js"; export const FactsFactGroupsItem: core.serialization.ObjectSchema< serializers.FactsFactGroupsItem.Raw, diff --git a/src/serialization/types/FactsFactGroupsItemTranslationsItem.ts b/src/serialization/types/FactsFactGroupsItemTranslationsItem.ts index 0e0b08b2..de72bef8 100644 --- a/src/serialization/types/FactsFactGroupsItemTranslationsItem.ts +++ b/src/serialization/types/FactsFactGroupsItemTranslationsItem.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const FactsFactGroupsItemTranslationsItem: core.serialization.ObjectSchema< serializers.FactsFactGroupsItemTranslationsItem.Raw, diff --git a/src/serialization/types/FactsFactGroupsListResponse.ts b/src/serialization/types/FactsFactGroupsListResponse.ts index b5804e8a..74947df8 100644 --- a/src/serialization/types/FactsFactGroupsListResponse.ts +++ b/src/serialization/types/FactsFactGroupsListResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { FactsFactGroupsItem } from "./FactsFactGroupsItem.js"; export const FactsFactGroupsListResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/FactsListItem.ts b/src/serialization/types/FactsListItem.ts index 42483cd8..33c9ea65 100644 --- a/src/serialization/types/FactsListItem.ts +++ b/src/serialization/types/FactsListItem.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { Uuid } from "./Uuid.js"; +import type * as serializers from "../index.js"; import { CommonSourceEnum } from "./CommonSourceEnum.js"; import { FactsEvidence } from "./FactsEvidence.js"; +import { Uuid } from "./Uuid.js"; export const FactsListItem: core.serialization.ObjectSchema = core.serialization.object({ diff --git a/src/serialization/types/FactsListResponse.ts b/src/serialization/types/FactsListResponse.ts index 91c19ee1..7c84d431 100644 --- a/src/serialization/types/FactsListResponse.ts +++ b/src/serialization/types/FactsListResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { FactsListItem } from "./FactsListItem.js"; export const FactsListResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/FactsUpdateResponse.ts b/src/serialization/types/FactsUpdateResponse.ts index 51ab9597..e3916568 100644 --- a/src/serialization/types/FactsUpdateResponse.ts +++ b/src/serialization/types/FactsUpdateResponse.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { Uuid } from "./Uuid.js"; +import type * as serializers from "../index.js"; import { CommonSourceEnum } from "./CommonSourceEnum.js"; +import { Uuid } from "./Uuid.js"; export const FactsUpdateResponse: core.serialization.ObjectSchema< serializers.FactsUpdateResponse.Raw, diff --git a/src/serialization/types/InteractionsCreateResponse.ts b/src/serialization/types/InteractionsCreateResponse.ts index cdf5c222..08ab99a4 100644 --- a/src/serialization/types/InteractionsCreateResponse.ts +++ b/src/serialization/types/InteractionsCreateResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { Uuid } from "./Uuid.js"; export const InteractionsCreateResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/InteractionsEncounterCreateRequest.ts b/src/serialization/types/InteractionsEncounterCreateRequest.ts index 776e612f..a744e275 100644 --- a/src/serialization/types/InteractionsEncounterCreateRequest.ts +++ b/src/serialization/types/InteractionsEncounterCreateRequest.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { InteractionsEncounterPeriod } from "./InteractionsEncounterPeriod.js"; import { InteractionsEncounterStatusEnum } from "./InteractionsEncounterStatusEnum.js"; import { InteractionsEncounterTypeEnum } from "./InteractionsEncounterTypeEnum.js"; -import { InteractionsEncounterPeriod } from "./InteractionsEncounterPeriod.js"; export const InteractionsEncounterCreateRequest: core.serialization.ObjectSchema< serializers.InteractionsEncounterCreateRequest.Raw, @@ -26,6 +24,6 @@ export declare namespace InteractionsEncounterCreateRequest { status: InteractionsEncounterStatusEnum.Raw; type: InteractionsEncounterTypeEnum.Raw; period?: InteractionsEncounterPeriod.Raw | null; - title?: (string | null) | null; + title?: (string | null | undefined) | null; } } diff --git a/src/serialization/types/InteractionsEncounterPeriod.ts b/src/serialization/types/InteractionsEncounterPeriod.ts index 494e4eb6..1942e1cd 100644 --- a/src/serialization/types/InteractionsEncounterPeriod.ts +++ b/src/serialization/types/InteractionsEncounterPeriod.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const InteractionsEncounterPeriod: core.serialization.ObjectSchema< serializers.InteractionsEncounterPeriod.Raw, @@ -17,6 +15,6 @@ export const InteractionsEncounterPeriod: core.serialization.ObjectSchema< export declare namespace InteractionsEncounterPeriod { export interface Raw { startedAt: string; - endedAt?: (string | null) | null; + endedAt?: (string | null | undefined) | null; } } diff --git a/src/serialization/types/InteractionsEncounterResponse.ts b/src/serialization/types/InteractionsEncounterResponse.ts index 9aba1e9c..682d9816 100644 --- a/src/serialization/types/InteractionsEncounterResponse.ts +++ b/src/serialization/types/InteractionsEncounterResponse.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { InteractionsEncounterPeriod } from "./InteractionsEncounterPeriod.js"; import { InteractionsEncounterStatusEnum } from "./InteractionsEncounterStatusEnum.js"; import { InteractionsEncounterTypeEnum } from "./InteractionsEncounterTypeEnum.js"; -import { InteractionsEncounterPeriod } from "./InteractionsEncounterPeriod.js"; export const InteractionsEncounterResponse: core.serialization.ObjectSchema< serializers.InteractionsEncounterResponse.Raw, @@ -26,6 +24,6 @@ export declare namespace InteractionsEncounterResponse { status: InteractionsEncounterStatusEnum.Raw; type: InteractionsEncounterTypeEnum.Raw; period: InteractionsEncounterPeriod.Raw; - title?: (string | null) | null; + title?: (string | null | undefined) | null; } } diff --git a/src/serialization/types/InteractionsEncounterStatusEnum.ts b/src/serialization/types/InteractionsEncounterStatusEnum.ts index b2be6623..2ea507af 100644 --- a/src/serialization/types/InteractionsEncounterStatusEnum.ts +++ b/src/serialization/types/InteractionsEncounterStatusEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const InteractionsEncounterStatusEnum: core.serialization.Schema< serializers.InteractionsEncounterStatusEnum.Raw, diff --git a/src/serialization/types/InteractionsEncounterTypeEnum.ts b/src/serialization/types/InteractionsEncounterTypeEnum.ts index a537bf32..8abed470 100644 --- a/src/serialization/types/InteractionsEncounterTypeEnum.ts +++ b/src/serialization/types/InteractionsEncounterTypeEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const InteractionsEncounterTypeEnum: core.serialization.Schema< serializers.InteractionsEncounterTypeEnum.Raw, diff --git a/src/serialization/types/InteractionsEncounterUpdateRequest.ts b/src/serialization/types/InteractionsEncounterUpdateRequest.ts index 41758c7b..01102315 100644 --- a/src/serialization/types/InteractionsEncounterUpdateRequest.ts +++ b/src/serialization/types/InteractionsEncounterUpdateRequest.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { InteractionsEncounterPeriod } from "./InteractionsEncounterPeriod.js"; import { InteractionsEncounterStatusEnum } from "./InteractionsEncounterStatusEnum.js"; import { InteractionsEncounterTypeEnum } from "./InteractionsEncounterTypeEnum.js"; -import { InteractionsEncounterPeriod } from "./InteractionsEncounterPeriod.js"; export const InteractionsEncounterUpdateRequest: core.serialization.ObjectSchema< serializers.InteractionsEncounterUpdateRequest.Raw, @@ -26,6 +24,6 @@ export declare namespace InteractionsEncounterUpdateRequest { status?: InteractionsEncounterStatusEnum.Raw | null; type?: InteractionsEncounterTypeEnum.Raw | null; period?: InteractionsEncounterPeriod.Raw | null; - title?: (string | null) | null; + title?: (string | null | undefined) | null; } } diff --git a/src/serialization/types/InteractionsGenderEnum.ts b/src/serialization/types/InteractionsGenderEnum.ts index e3b28064..e3cae371 100644 --- a/src/serialization/types/InteractionsGenderEnum.ts +++ b/src/serialization/types/InteractionsGenderEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const InteractionsGenderEnum: core.serialization.Schema< serializers.InteractionsGenderEnum.Raw, diff --git a/src/serialization/types/InteractionsGetResponse.ts b/src/serialization/types/InteractionsGetResponse.ts index ab6d5898..e7b0a2c0 100644 --- a/src/serialization/types/InteractionsGetResponse.ts +++ b/src/serialization/types/InteractionsGetResponse.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { Uuid } from "./Uuid.js"; +import type * as serializers from "../index.js"; import { InteractionsEncounterResponse } from "./InteractionsEncounterResponse.js"; import { InteractionsPatient } from "./InteractionsPatient.js"; +import { Uuid } from "./Uuid.js"; export const InteractionsGetResponse: core.serialization.ObjectSchema< serializers.InteractionsGetResponse.Raw, @@ -30,7 +28,7 @@ export declare namespace InteractionsGetResponse { assignedUserId: Uuid.Raw; encounter: InteractionsEncounterResponse.Raw; patient: InteractionsPatient.Raw; - endedAt?: (string | null) | null; + endedAt?: (string | null | undefined) | null; createdAt: string; updatedAt: string; websocketUrl: string; diff --git a/src/serialization/types/InteractionsListResponse.ts b/src/serialization/types/InteractionsListResponse.ts index b9e2a35d..8d3b6950 100644 --- a/src/serialization/types/InteractionsListResponse.ts +++ b/src/serialization/types/InteractionsListResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { InteractionsGetResponse } from "./InteractionsGetResponse.js"; export const InteractionsListResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/InteractionsPatient.ts b/src/serialization/types/InteractionsPatient.ts index 0cb14248..7ab9980b 100644 --- a/src/serialization/types/InteractionsPatient.ts +++ b/src/serialization/types/InteractionsPatient.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { InteractionsGenderEnum } from "./InteractionsGenderEnum.js"; export const InteractionsPatient: core.serialization.ObjectSchema< @@ -21,9 +19,9 @@ export const InteractionsPatient: core.serialization.ObjectSchema< export declare namespace InteractionsPatient { export interface Raw { identifier: string; - name?: (string | null) | null; + name?: (string | null | undefined) | null; gender?: InteractionsGenderEnum.Raw | null; - birthDate?: (string | null) | null; - pronouns?: (string | null) | null; + birthDate?: (string | null | undefined) | null; + pronouns?: (string | null | undefined) | null; } } diff --git a/src/serialization/types/RecordingsCreateResponse.ts b/src/serialization/types/RecordingsCreateResponse.ts index 343bd795..0cf50b8c 100644 --- a/src/serialization/types/RecordingsCreateResponse.ts +++ b/src/serialization/types/RecordingsCreateResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { Uuid } from "./Uuid.js"; export const RecordingsCreateResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/RecordingsListResponse.ts b/src/serialization/types/RecordingsListResponse.ts index 3f546662..ab134cf6 100644 --- a/src/serialization/types/RecordingsListResponse.ts +++ b/src/serialization/types/RecordingsListResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { Uuid } from "./Uuid.js"; export const RecordingsListResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/StreamConfig.ts b/src/serialization/types/StreamConfig.ts index ccb98f40..a39b6664 100644 --- a/src/serialization/types/StreamConfig.ts +++ b/src/serialization/types/StreamConfig.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { StreamConfigTranscription } from "./StreamConfigTranscription.js"; +import type * as serializers from "../index.js"; import { StreamConfigMode } from "./StreamConfigMode.js"; +import { StreamConfigTranscription } from "./StreamConfigTranscription.js"; export const StreamConfig: core.serialization.ObjectSchema = core.serialization.object({ diff --git a/src/serialization/types/StreamConfigMessage.ts b/src/serialization/types/StreamConfigMessage.ts index ed35d913..c3c893f5 100644 --- a/src/serialization/types/StreamConfigMessage.ts +++ b/src/serialization/types/StreamConfigMessage.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { StreamConfig } from "./StreamConfig.js"; +import { StreamConfigMessageType } from "./StreamConfigMessageType.js"; export const StreamConfigMessage: core.serialization.ObjectSchema< serializers.StreamConfigMessage.Raw, Corti.StreamConfigMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("config"), + type: StreamConfigMessageType, configuration: StreamConfig, }); export declare namespace StreamConfigMessage { export interface Raw { - type: "config"; + type: StreamConfigMessageType.Raw; configuration: StreamConfig.Raw; } } diff --git a/src/serialization/types/StreamConfigMessageType.ts b/src/serialization/types/StreamConfigMessageType.ts new file mode 100644 index 00000000..372f8ae9 --- /dev/null +++ b/src/serialization/types/StreamConfigMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StreamConfigMessageType: core.serialization.Schema< + serializers.StreamConfigMessageType.Raw, + Corti.StreamConfigMessageType +> = core.serialization.enum_(["config"]); + +export declare namespace StreamConfigMessageType { + export type Raw = "config"; +} diff --git a/src/serialization/types/StreamConfigMode.ts b/src/serialization/types/StreamConfigMode.ts index 0fb88bad..fe7b58d4 100644 --- a/src/serialization/types/StreamConfigMode.ts +++ b/src/serialization/types/StreamConfigMode.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { StreamConfigModeType } from "./StreamConfigModeType.js"; import { StreamSupportedLanguage } from "./StreamSupportedLanguage.js"; diff --git a/src/serialization/types/StreamConfigModeType.ts b/src/serialization/types/StreamConfigModeType.ts index 4d12ce85..7c004047 100644 --- a/src/serialization/types/StreamConfigModeType.ts +++ b/src/serialization/types/StreamConfigModeType.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const StreamConfigModeType: core.serialization.Schema< serializers.StreamConfigModeType.Raw, diff --git a/src/serialization/types/StreamConfigParticipant.ts b/src/serialization/types/StreamConfigParticipant.ts index 4c7aaafd..eb384c47 100644 --- a/src/serialization/types/StreamConfigParticipant.ts +++ b/src/serialization/types/StreamConfigParticipant.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { StreamConfigParticipantRole } from "./StreamConfigParticipantRole.js"; export const StreamConfigParticipant: core.serialization.ObjectSchema< diff --git a/src/serialization/types/StreamConfigParticipantRole.ts b/src/serialization/types/StreamConfigParticipantRole.ts index 19948650..5ba09d2d 100644 --- a/src/serialization/types/StreamConfigParticipantRole.ts +++ b/src/serialization/types/StreamConfigParticipantRole.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const StreamConfigParticipantRole: core.serialization.Schema< serializers.StreamConfigParticipantRole.Raw, diff --git a/src/serialization/types/StreamConfigStatusMessage.ts b/src/serialization/types/StreamConfigStatusMessage.ts index dcad2498..cf1b8e11 100644 --- a/src/serialization/types/StreamConfigStatusMessage.ts +++ b/src/serialization/types/StreamConfigStatusMessage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { StreamConfigStatusMessageType } from "./StreamConfigStatusMessageType.js"; export const StreamConfigStatusMessage: core.serialization.ObjectSchema< diff --git a/src/serialization/types/StreamConfigStatusMessageType.ts b/src/serialization/types/StreamConfigStatusMessageType.ts index 014af96d..3c9b378b 100644 --- a/src/serialization/types/StreamConfigStatusMessageType.ts +++ b/src/serialization/types/StreamConfigStatusMessageType.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const StreamConfigStatusMessageType: core.serialization.Schema< serializers.StreamConfigStatusMessageType.Raw, diff --git a/src/serialization/types/StreamConfigTranscription.ts b/src/serialization/types/StreamConfigTranscription.ts index d4f7c36d..a07bf536 100644 --- a/src/serialization/types/StreamConfigTranscription.ts +++ b/src/serialization/types/StreamConfigTranscription.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { StreamSupportedLanguage } from "./StreamSupportedLanguage.js"; +import type * as serializers from "../index.js"; import { StreamConfigParticipant } from "./StreamConfigParticipant.js"; +import { StreamSupportedLanguage } from "./StreamSupportedLanguage.js"; export const StreamConfigTranscription: core.serialization.ObjectSchema< serializers.StreamConfigTranscription.Raw, diff --git a/src/serialization/types/StreamEndMessage.ts b/src/serialization/types/StreamEndMessage.ts index 981f8a61..9757ba3c 100644 --- a/src/serialization/types/StreamEndMessage.ts +++ b/src/serialization/types/StreamEndMessage.ts @@ -1,20 +1,19 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { StreamEndMessageType } from "./StreamEndMessageType.js"; export const StreamEndMessage: core.serialization.ObjectSchema< serializers.StreamEndMessage.Raw, Corti.StreamEndMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("end"), + type: StreamEndMessageType, }); export declare namespace StreamEndMessage { export interface Raw { - type: "end"; + type: StreamEndMessageType.Raw; } } diff --git a/src/serialization/types/StreamEndMessageType.ts b/src/serialization/types/StreamEndMessageType.ts new file mode 100644 index 00000000..3e6eb2fe --- /dev/null +++ b/src/serialization/types/StreamEndMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StreamEndMessageType: core.serialization.Schema< + serializers.StreamEndMessageType.Raw, + Corti.StreamEndMessageType +> = core.serialization.enum_(["end"]); + +export declare namespace StreamEndMessageType { + export type Raw = "end"; +} diff --git a/src/serialization/types/StreamEndedMessage.ts b/src/serialization/types/StreamEndedMessage.ts index 2ff74444..bede8b6c 100644 --- a/src/serialization/types/StreamEndedMessage.ts +++ b/src/serialization/types/StreamEndedMessage.ts @@ -1,20 +1,19 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { StreamEndedMessageType } from "./StreamEndedMessageType.js"; export const StreamEndedMessage: core.serialization.ObjectSchema< serializers.StreamEndedMessage.Raw, Corti.StreamEndedMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("ENDED"), + type: StreamEndedMessageType, }); export declare namespace StreamEndedMessage { export interface Raw { - type: "ENDED"; + type: StreamEndedMessageType.Raw; } } diff --git a/src/serialization/types/StreamEndedMessageType.ts b/src/serialization/types/StreamEndedMessageType.ts new file mode 100644 index 00000000..d3066c2f --- /dev/null +++ b/src/serialization/types/StreamEndedMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StreamEndedMessageType: core.serialization.Schema< + serializers.StreamEndedMessageType.Raw, + Corti.StreamEndedMessageType +> = core.serialization.enum_(["ENDED"]); + +export declare namespace StreamEndedMessageType { + export type Raw = "ENDED"; +} diff --git a/src/serialization/types/StreamErrorDetail.ts b/src/serialization/types/StreamErrorDetail.ts index eaaa0c1e..153dca11 100644 --- a/src/serialization/types/StreamErrorDetail.ts +++ b/src/serialization/types/StreamErrorDetail.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const StreamErrorDetail: core.serialization.ObjectSchema< serializers.StreamErrorDetail.Raw, diff --git a/src/serialization/types/StreamErrorMessage.ts b/src/serialization/types/StreamErrorMessage.ts index e182559c..832edbcb 100644 --- a/src/serialization/types/StreamErrorMessage.ts +++ b/src/serialization/types/StreamErrorMessage.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { StreamErrorDetail } from "./StreamErrorDetail.js"; +import { StreamErrorMessageType } from "./StreamErrorMessageType.js"; export const StreamErrorMessage: core.serialization.ObjectSchema< serializers.StreamErrorMessage.Raw, Corti.StreamErrorMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("error"), + type: StreamErrorMessageType, error: StreamErrorDetail, }); export declare namespace StreamErrorMessage { export interface Raw { - type: "error"; + type: StreamErrorMessageType.Raw; error: StreamErrorDetail.Raw; } } diff --git a/src/serialization/types/StreamErrorMessageType.ts b/src/serialization/types/StreamErrorMessageType.ts new file mode 100644 index 00000000..407a4d58 --- /dev/null +++ b/src/serialization/types/StreamErrorMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StreamErrorMessageType: core.serialization.Schema< + serializers.StreamErrorMessageType.Raw, + Corti.StreamErrorMessageType +> = core.serialization.enum_(["error"]); + +export declare namespace StreamErrorMessageType { + export type Raw = "error"; +} diff --git a/src/serialization/types/StreamFact.ts b/src/serialization/types/StreamFact.ts index ab456de0..7f67465f 100644 --- a/src/serialization/types/StreamFact.ts +++ b/src/serialization/types/StreamFact.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const StreamFact: core.serialization.ObjectSchema = core.serialization.object({ diff --git a/src/serialization/types/StreamFactsMessage.ts b/src/serialization/types/StreamFactsMessage.ts index 8ca75483..5eb31f46 100644 --- a/src/serialization/types/StreamFactsMessage.ts +++ b/src/serialization/types/StreamFactsMessage.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { StreamFact } from "./StreamFact.js"; +import { StreamFactsMessageType } from "./StreamFactsMessageType.js"; export const StreamFactsMessage: core.serialization.ObjectSchema< serializers.StreamFactsMessage.Raw, Corti.StreamFactsMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("facts"), + type: StreamFactsMessageType, fact: core.serialization.list(StreamFact), }); export declare namespace StreamFactsMessage { export interface Raw { - type: "facts"; + type: StreamFactsMessageType.Raw; fact: StreamFact.Raw[]; } } diff --git a/src/serialization/types/StreamFactsMessageType.ts b/src/serialization/types/StreamFactsMessageType.ts new file mode 100644 index 00000000..20252269 --- /dev/null +++ b/src/serialization/types/StreamFactsMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StreamFactsMessageType: core.serialization.Schema< + serializers.StreamFactsMessageType.Raw, + Corti.StreamFactsMessageType +> = core.serialization.enum_(["facts"]); + +export declare namespace StreamFactsMessageType { + export type Raw = "facts"; +} diff --git a/src/serialization/types/StreamFlushMessage.ts b/src/serialization/types/StreamFlushMessage.ts index f1707ac1..8d4edb53 100644 --- a/src/serialization/types/StreamFlushMessage.ts +++ b/src/serialization/types/StreamFlushMessage.ts @@ -1,20 +1,19 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { StreamFlushMessageType } from "./StreamFlushMessageType.js"; export const StreamFlushMessage: core.serialization.ObjectSchema< serializers.StreamFlushMessage.Raw, Corti.StreamFlushMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("flush"), + type: StreamFlushMessageType, }); export declare namespace StreamFlushMessage { export interface Raw { - type: "flush"; + type: StreamFlushMessageType.Raw; } } diff --git a/src/serialization/types/StreamFlushMessageType.ts b/src/serialization/types/StreamFlushMessageType.ts new file mode 100644 index 00000000..30850327 --- /dev/null +++ b/src/serialization/types/StreamFlushMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StreamFlushMessageType: core.serialization.Schema< + serializers.StreamFlushMessageType.Raw, + Corti.StreamFlushMessageType +> = core.serialization.enum_(["flush"]); + +export declare namespace StreamFlushMessageType { + export type Raw = "flush"; +} diff --git a/src/serialization/types/StreamFlushedMessage.ts b/src/serialization/types/StreamFlushedMessage.ts index cf022c17..cefcdd07 100644 --- a/src/serialization/types/StreamFlushedMessage.ts +++ b/src/serialization/types/StreamFlushedMessage.ts @@ -1,20 +1,19 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { StreamFlushedMessageType } from "./StreamFlushedMessageType.js"; export const StreamFlushedMessage: core.serialization.ObjectSchema< serializers.StreamFlushedMessage.Raw, Corti.StreamFlushedMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("flushed"), + type: StreamFlushedMessageType, }); export declare namespace StreamFlushedMessage { export interface Raw { - type: "flushed"; + type: StreamFlushedMessageType.Raw; } } diff --git a/src/serialization/types/StreamFlushedMessageType.ts b/src/serialization/types/StreamFlushedMessageType.ts new file mode 100644 index 00000000..3c1a51dc --- /dev/null +++ b/src/serialization/types/StreamFlushedMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StreamFlushedMessageType: core.serialization.Schema< + serializers.StreamFlushedMessageType.Raw, + Corti.StreamFlushedMessageType +> = core.serialization.enum_(["flushed"]); + +export declare namespace StreamFlushedMessageType { + export type Raw = "flushed"; +} diff --git a/src/serialization/types/StreamParticipant.ts b/src/serialization/types/StreamParticipant.ts index db5cdae1..d4fb6e90 100644 --- a/src/serialization/types/StreamParticipant.ts +++ b/src/serialization/types/StreamParticipant.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const StreamParticipant: core.serialization.ObjectSchema< serializers.StreamParticipant.Raw, diff --git a/src/serialization/types/StreamSupportedLanguage.ts b/src/serialization/types/StreamSupportedLanguage.ts index 733e9421..1068fcb0 100644 --- a/src/serialization/types/StreamSupportedLanguage.ts +++ b/src/serialization/types/StreamSupportedLanguage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const StreamSupportedLanguage: core.serialization.Schema< serializers.StreamSupportedLanguage.Raw, diff --git a/src/serialization/types/StreamTranscript.ts b/src/serialization/types/StreamTranscript.ts index ffb8829e..6c9e1e4e 100644 --- a/src/serialization/types/StreamTranscript.ts +++ b/src/serialization/types/StreamTranscript.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { StreamParticipant } from "./StreamParticipant.js"; import { StreamTranscriptTime } from "./StreamTranscriptTime.js"; diff --git a/src/serialization/types/StreamTranscriptMessage.ts b/src/serialization/types/StreamTranscriptMessage.ts index 541cf6af..5e1c5b6d 100644 --- a/src/serialization/types/StreamTranscriptMessage.ts +++ b/src/serialization/types/StreamTranscriptMessage.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { StreamTranscript } from "./StreamTranscript.js"; +import { StreamTranscriptMessageType } from "./StreamTranscriptMessageType.js"; export const StreamTranscriptMessage: core.serialization.ObjectSchema< serializers.StreamTranscriptMessage.Raw, Corti.StreamTranscriptMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("transcript"), + type: StreamTranscriptMessageType, data: core.serialization.list(StreamTranscript), }); export declare namespace StreamTranscriptMessage { export interface Raw { - type: "transcript"; + type: StreamTranscriptMessageType.Raw; data: StreamTranscript.Raw[]; } } diff --git a/src/serialization/types/StreamTranscriptMessageType.ts b/src/serialization/types/StreamTranscriptMessageType.ts new file mode 100644 index 00000000..c6c75d1c --- /dev/null +++ b/src/serialization/types/StreamTranscriptMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StreamTranscriptMessageType: core.serialization.Schema< + serializers.StreamTranscriptMessageType.Raw, + Corti.StreamTranscriptMessageType +> = core.serialization.enum_(["transcript"]); + +export declare namespace StreamTranscriptMessageType { + export type Raw = "transcript"; +} diff --git a/src/serialization/types/StreamTranscriptTime.ts b/src/serialization/types/StreamTranscriptTime.ts index a0674f2a..66153dc2 100644 --- a/src/serialization/types/StreamTranscriptTime.ts +++ b/src/serialization/types/StreamTranscriptTime.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const StreamTranscriptTime: core.serialization.ObjectSchema< serializers.StreamTranscriptTime.Raw, diff --git a/src/serialization/types/StreamUsageMessage.ts b/src/serialization/types/StreamUsageMessage.ts index 3a184b4a..89b40165 100644 --- a/src/serialization/types/StreamUsageMessage.ts +++ b/src/serialization/types/StreamUsageMessage.ts @@ -1,22 +1,21 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { StreamUsageMessageType } from "./StreamUsageMessageType.js"; export const StreamUsageMessage: core.serialization.ObjectSchema< serializers.StreamUsageMessage.Raw, Corti.StreamUsageMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("usage"), + type: StreamUsageMessageType, credits: core.serialization.number(), }); export declare namespace StreamUsageMessage { export interface Raw { - type: "usage"; + type: StreamUsageMessageType.Raw; credits: number; } } diff --git a/src/serialization/types/StreamUsageMessageType.ts b/src/serialization/types/StreamUsageMessageType.ts new file mode 100644 index 00000000..e384429a --- /dev/null +++ b/src/serialization/types/StreamUsageMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StreamUsageMessageType: core.serialization.Schema< + serializers.StreamUsageMessageType.Raw, + Corti.StreamUsageMessageType +> = core.serialization.enum_(["usage"]); + +export declare namespace StreamUsageMessageType { + export type Raw = "usage"; +} diff --git a/src/serialization/types/TemplatesDocumentationModeEnum.ts b/src/serialization/types/TemplatesDocumentationModeEnum.ts index 653866ae..70cd3303 100644 --- a/src/serialization/types/TemplatesDocumentationModeEnum.ts +++ b/src/serialization/types/TemplatesDocumentationModeEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TemplatesDocumentationModeEnum: core.serialization.Schema< serializers.TemplatesDocumentationModeEnum.Raw, diff --git a/src/serialization/types/TemplatesFormatRule.ts b/src/serialization/types/TemplatesFormatRule.ts index 492c972b..6838a354 100644 --- a/src/serialization/types/TemplatesFormatRule.ts +++ b/src/serialization/types/TemplatesFormatRule.ts @@ -1,20 +1,18 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TemplatesFormatRule: core.serialization.ObjectSchema< serializers.TemplatesFormatRule.Raw, Corti.TemplatesFormatRule > = core.serialization.object({ - name: core.serialization.string().optionalNullable(), + name: core.serialization.string().nullable(), }); export declare namespace TemplatesFormatRule { export interface Raw { - name?: (string | null) | null; + name?: string | null; } } diff --git a/src/serialization/types/TemplatesItem.ts b/src/serialization/types/TemplatesItem.ts index 7c84b2f9..72e829cd 100644 --- a/src/serialization/types/TemplatesItem.ts +++ b/src/serialization/types/TemplatesItem.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TemplatesDocumentationModeEnum } from "./TemplatesDocumentationModeEnum.js"; import { TemplatesSectionSorted } from "./TemplatesSectionSorted.js"; import { TemplatesTranslation } from "./TemplatesTranslation.js"; @@ -24,10 +22,10 @@ export const TemplatesItem: core.serialization.ObjectSchema = core.serialization.object({ id: core.serialization.string(), variables: core.serialization - .record(core.serialization.string(), core.serialization.string().optionalNullable()) + .record(core.serialization.string(), core.serialization.string().nullable()) .optionalNullable(), rawTranscriptText: core.serialization.string(), start: core.serialization.number(), @@ -22,7 +20,7 @@ export const TranscribeCommandData: core.serialization.ObjectSchema< export declare namespace TranscribeCommandData { export interface Raw { id: string; - variables?: (Record | null) | null; + variables?: (Record | null | undefined) | null; rawTranscriptText: string; start: number; end: number; diff --git a/src/serialization/types/TranscribeCommandMessage.ts b/src/serialization/types/TranscribeCommandMessage.ts index 8b6665f1..85c37e59 100644 --- a/src/serialization/types/TranscribeCommandMessage.ts +++ b/src/serialization/types/TranscribeCommandMessage.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TranscribeCommandData } from "./TranscribeCommandData.js"; +import { TranscribeCommandMessageType } from "./TranscribeCommandMessageType.js"; export const TranscribeCommandMessage: core.serialization.ObjectSchema< serializers.TranscribeCommandMessage.Raw, Corti.TranscribeCommandMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("command"), + type: TranscribeCommandMessageType, data: TranscribeCommandData, }); export declare namespace TranscribeCommandMessage { export interface Raw { - type: "command"; + type: TranscribeCommandMessageType.Raw; data: TranscribeCommandData.Raw; } } diff --git a/src/serialization/types/TranscribeCommandMessageType.ts b/src/serialization/types/TranscribeCommandMessageType.ts new file mode 100644 index 00000000..8c24da23 --- /dev/null +++ b/src/serialization/types/TranscribeCommandMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TranscribeCommandMessageType: core.serialization.Schema< + serializers.TranscribeCommandMessageType.Raw, + Corti.TranscribeCommandMessageType +> = core.serialization.enum_(["command"]); + +export declare namespace TranscribeCommandMessageType { + export type Raw = "command"; +} diff --git a/src/serialization/types/TranscribeCommandVariable.ts b/src/serialization/types/TranscribeCommandVariable.ts index c344d506..549c96e3 100644 --- a/src/serialization/types/TranscribeCommandVariable.ts +++ b/src/serialization/types/TranscribeCommandVariable.ts @@ -1,24 +1,23 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TranscribeCommandVariableType } from "./TranscribeCommandVariableType.js"; export const TranscribeCommandVariable: core.serialization.ObjectSchema< serializers.TranscribeCommandVariable.Raw, Corti.TranscribeCommandVariable > = core.serialization.object({ key: core.serialization.string(), - type: core.serialization.stringLiteral("enum"), + type: TranscribeCommandVariableType, enum: core.serialization.list(core.serialization.string()), }); export declare namespace TranscribeCommandVariable { export interface Raw { key: string; - type: "enum"; + type: TranscribeCommandVariableType.Raw; enum: string[]; } } diff --git a/src/serialization/types/TranscribeCommandVariableType.ts b/src/serialization/types/TranscribeCommandVariableType.ts new file mode 100644 index 00000000..654e11ca --- /dev/null +++ b/src/serialization/types/TranscribeCommandVariableType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TranscribeCommandVariableType: core.serialization.Schema< + serializers.TranscribeCommandVariableType.Raw, + Corti.TranscribeCommandVariableType +> = core.serialization.enum_(["enum"]); + +export declare namespace TranscribeCommandVariableType { + export type Raw = "enum"; +} diff --git a/src/serialization/types/TranscribeConfig.ts b/src/serialization/types/TranscribeConfig.ts index 9c644218..ceedea52 100644 --- a/src/serialization/types/TranscribeConfig.ts +++ b/src/serialization/types/TranscribeConfig.ts @@ -1,13 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { TranscribeSupportedLanguage } from "./TranscribeSupportedLanguage.js"; +import type * as serializers from "../index.js"; import { TranscribeCommand } from "./TranscribeCommand.js"; import { TranscribeFormatting } from "./TranscribeFormatting.js"; +import { TranscribeSupportedLanguage } from "./TranscribeSupportedLanguage.js"; export const TranscribeConfig: core.serialization.ObjectSchema< serializers.TranscribeConfig.Raw, diff --git a/src/serialization/types/TranscribeConfigMessage.ts b/src/serialization/types/TranscribeConfigMessage.ts index 9014768c..236c8be0 100644 --- a/src/serialization/types/TranscribeConfigMessage.ts +++ b/src/serialization/types/TranscribeConfigMessage.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TranscribeConfig } from "./TranscribeConfig.js"; +import { TranscribeConfigMessageType } from "./TranscribeConfigMessageType.js"; export const TranscribeConfigMessage: core.serialization.ObjectSchema< serializers.TranscribeConfigMessage.Raw, Corti.TranscribeConfigMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("config"), + type: TranscribeConfigMessageType, configuration: TranscribeConfig, }); export declare namespace TranscribeConfigMessage { export interface Raw { - type: "config"; + type: TranscribeConfigMessageType.Raw; configuration: TranscribeConfig.Raw; } } diff --git a/src/serialization/types/TranscribeConfigMessageType.ts b/src/serialization/types/TranscribeConfigMessageType.ts new file mode 100644 index 00000000..55b423dd --- /dev/null +++ b/src/serialization/types/TranscribeConfigMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TranscribeConfigMessageType: core.serialization.Schema< + serializers.TranscribeConfigMessageType.Raw, + Corti.TranscribeConfigMessageType +> = core.serialization.enum_(["config"]); + +export declare namespace TranscribeConfigMessageType { + export type Raw = "config"; +} diff --git a/src/serialization/types/TranscribeConfigStatusMessage.ts b/src/serialization/types/TranscribeConfigStatusMessage.ts index ddadc2ef..d5afff35 100644 --- a/src/serialization/types/TranscribeConfigStatusMessage.ts +++ b/src/serialization/types/TranscribeConfigStatusMessage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TranscribeConfigStatusMessageType } from "./TranscribeConfigStatusMessageType.js"; export const TranscribeConfigStatusMessage: core.serialization.ObjectSchema< diff --git a/src/serialization/types/TranscribeConfigStatusMessageType.ts b/src/serialization/types/TranscribeConfigStatusMessageType.ts index d486699e..a5a9fdbe 100644 --- a/src/serialization/types/TranscribeConfigStatusMessageType.ts +++ b/src/serialization/types/TranscribeConfigStatusMessageType.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscribeConfigStatusMessageType: core.serialization.Schema< serializers.TranscribeConfigStatusMessageType.Raw, diff --git a/src/serialization/types/TranscribeEndMessage.ts b/src/serialization/types/TranscribeEndMessage.ts index c4c40e2e..febe83b7 100644 --- a/src/serialization/types/TranscribeEndMessage.ts +++ b/src/serialization/types/TranscribeEndMessage.ts @@ -1,20 +1,19 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TranscribeEndMessageType } from "./TranscribeEndMessageType.js"; export const TranscribeEndMessage: core.serialization.ObjectSchema< serializers.TranscribeEndMessage.Raw, Corti.TranscribeEndMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("end"), + type: TranscribeEndMessageType, }); export declare namespace TranscribeEndMessage { export interface Raw { - type: "end"; + type: TranscribeEndMessageType.Raw; } } diff --git a/src/serialization/types/TranscribeEndMessageType.ts b/src/serialization/types/TranscribeEndMessageType.ts new file mode 100644 index 00000000..7919e166 --- /dev/null +++ b/src/serialization/types/TranscribeEndMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TranscribeEndMessageType: core.serialization.Schema< + serializers.TranscribeEndMessageType.Raw, + Corti.TranscribeEndMessageType +> = core.serialization.enum_(["end"]); + +export declare namespace TranscribeEndMessageType { + export type Raw = "end"; +} diff --git a/src/serialization/types/TranscribeEndedMessage.ts b/src/serialization/types/TranscribeEndedMessage.ts index b6677e96..00dcf0c8 100644 --- a/src/serialization/types/TranscribeEndedMessage.ts +++ b/src/serialization/types/TranscribeEndedMessage.ts @@ -1,20 +1,19 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TranscribeEndedMessageType } from "./TranscribeEndedMessageType.js"; export const TranscribeEndedMessage: core.serialization.ObjectSchema< serializers.TranscribeEndedMessage.Raw, Corti.TranscribeEndedMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("ended"), + type: TranscribeEndedMessageType, }); export declare namespace TranscribeEndedMessage { export interface Raw { - type: "ended"; + type: TranscribeEndedMessageType.Raw; } } diff --git a/src/serialization/types/TranscribeEndedMessageType.ts b/src/serialization/types/TranscribeEndedMessageType.ts new file mode 100644 index 00000000..cee35939 --- /dev/null +++ b/src/serialization/types/TranscribeEndedMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TranscribeEndedMessageType: core.serialization.Schema< + serializers.TranscribeEndedMessageType.Raw, + Corti.TranscribeEndedMessageType +> = core.serialization.enum_(["ended"]); + +export declare namespace TranscribeEndedMessageType { + export type Raw = "ended"; +} diff --git a/src/serialization/types/TranscribeErrorMessage.ts b/src/serialization/types/TranscribeErrorMessage.ts index d7506b25..454f7964 100644 --- a/src/serialization/types/TranscribeErrorMessage.ts +++ b/src/serialization/types/TranscribeErrorMessage.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TranscribeErrorMessageError } from "./TranscribeErrorMessageError.js"; +import { TranscribeErrorMessageType } from "./TranscribeErrorMessageType.js"; export const TranscribeErrorMessage: core.serialization.ObjectSchema< serializers.TranscribeErrorMessage.Raw, Corti.TranscribeErrorMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("error"), + type: TranscribeErrorMessageType, error: TranscribeErrorMessageError, }); export declare namespace TranscribeErrorMessage { export interface Raw { - type: "error"; + type: TranscribeErrorMessageType.Raw; error: TranscribeErrorMessageError.Raw; } } diff --git a/src/serialization/types/TranscribeErrorMessageError.ts b/src/serialization/types/TranscribeErrorMessageError.ts index b15ac32b..9c37d1e4 100644 --- a/src/serialization/types/TranscribeErrorMessageError.ts +++ b/src/serialization/types/TranscribeErrorMessageError.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscribeErrorMessageError: core.serialization.ObjectSchema< serializers.TranscribeErrorMessageError.Raw, diff --git a/src/serialization/types/TranscribeErrorMessageType.ts b/src/serialization/types/TranscribeErrorMessageType.ts new file mode 100644 index 00000000..f6cb3c23 --- /dev/null +++ b/src/serialization/types/TranscribeErrorMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TranscribeErrorMessageType: core.serialization.Schema< + serializers.TranscribeErrorMessageType.Raw, + Corti.TranscribeErrorMessageType +> = core.serialization.enum_(["error"]); + +export declare namespace TranscribeErrorMessageType { + export type Raw = "error"; +} diff --git a/src/serialization/types/TranscribeFlushMessage.ts b/src/serialization/types/TranscribeFlushMessage.ts index ba633dd0..33c73a0e 100644 --- a/src/serialization/types/TranscribeFlushMessage.ts +++ b/src/serialization/types/TranscribeFlushMessage.ts @@ -1,20 +1,19 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TranscribeFlushMessageType } from "./TranscribeFlushMessageType.js"; export const TranscribeFlushMessage: core.serialization.ObjectSchema< serializers.TranscribeFlushMessage.Raw, Corti.TranscribeFlushMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("flush"), + type: TranscribeFlushMessageType, }); export declare namespace TranscribeFlushMessage { export interface Raw { - type: "flush"; + type: TranscribeFlushMessageType.Raw; } } diff --git a/src/serialization/types/TranscribeFlushMessageType.ts b/src/serialization/types/TranscribeFlushMessageType.ts new file mode 100644 index 00000000..05db82e7 --- /dev/null +++ b/src/serialization/types/TranscribeFlushMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TranscribeFlushMessageType: core.serialization.Schema< + serializers.TranscribeFlushMessageType.Raw, + Corti.TranscribeFlushMessageType +> = core.serialization.enum_(["flush"]); + +export declare namespace TranscribeFlushMessageType { + export type Raw = "flush"; +} diff --git a/src/serialization/types/TranscribeFlushedMessage.ts b/src/serialization/types/TranscribeFlushedMessage.ts index 3869d579..59769fdd 100644 --- a/src/serialization/types/TranscribeFlushedMessage.ts +++ b/src/serialization/types/TranscribeFlushedMessage.ts @@ -1,20 +1,19 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TranscribeFlushedMessageType } from "./TranscribeFlushedMessageType.js"; export const TranscribeFlushedMessage: core.serialization.ObjectSchema< serializers.TranscribeFlushedMessage.Raw, Corti.TranscribeFlushedMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("flushed"), + type: TranscribeFlushedMessageType, }); export declare namespace TranscribeFlushedMessage { export interface Raw { - type: "flushed"; + type: TranscribeFlushedMessageType.Raw; } } diff --git a/src/serialization/types/TranscribeFlushedMessageType.ts b/src/serialization/types/TranscribeFlushedMessageType.ts new file mode 100644 index 00000000..177bb35e --- /dev/null +++ b/src/serialization/types/TranscribeFlushedMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TranscribeFlushedMessageType: core.serialization.Schema< + serializers.TranscribeFlushedMessageType.Raw, + Corti.TranscribeFlushedMessageType +> = core.serialization.enum_(["flushed"]); + +export declare namespace TranscribeFlushedMessageType { + export type Raw = "flushed"; +} diff --git a/src/serialization/types/TranscribeFormatting.ts b/src/serialization/types/TranscribeFormatting.ts index 5eb4737b..4b5b9b6d 100644 --- a/src/serialization/types/TranscribeFormatting.ts +++ b/src/serialization/types/TranscribeFormatting.ts @@ -1,16 +1,14 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TranscribeFormattingDates } from "./TranscribeFormattingDates.js"; -import { TranscribeFormattingTimes } from "./TranscribeFormattingTimes.js"; -import { TranscribeFormattingNumbers } from "./TranscribeFormattingNumbers.js"; import { TranscribeFormattingMeasurements } from "./TranscribeFormattingMeasurements.js"; +import { TranscribeFormattingNumbers } from "./TranscribeFormattingNumbers.js"; import { TranscribeFormattingNumericRanges } from "./TranscribeFormattingNumericRanges.js"; import { TranscribeFormattingOrdinals } from "./TranscribeFormattingOrdinals.js"; +import { TranscribeFormattingTimes } from "./TranscribeFormattingTimes.js"; export const TranscribeFormatting: core.serialization.ObjectSchema< serializers.TranscribeFormatting.Raw, diff --git a/src/serialization/types/TranscribeFormattingDates.ts b/src/serialization/types/TranscribeFormattingDates.ts index 3fb4e071..9c228389 100644 --- a/src/serialization/types/TranscribeFormattingDates.ts +++ b/src/serialization/types/TranscribeFormattingDates.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscribeFormattingDates: core.serialization.Schema< serializers.TranscribeFormattingDates.Raw, diff --git a/src/serialization/types/TranscribeFormattingMeasurements.ts b/src/serialization/types/TranscribeFormattingMeasurements.ts index 697745a3..f94bd733 100644 --- a/src/serialization/types/TranscribeFormattingMeasurements.ts +++ b/src/serialization/types/TranscribeFormattingMeasurements.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscribeFormattingMeasurements: core.serialization.Schema< serializers.TranscribeFormattingMeasurements.Raw, diff --git a/src/serialization/types/TranscribeFormattingNumbers.ts b/src/serialization/types/TranscribeFormattingNumbers.ts index 5731907c..bfc1886e 100644 --- a/src/serialization/types/TranscribeFormattingNumbers.ts +++ b/src/serialization/types/TranscribeFormattingNumbers.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscribeFormattingNumbers: core.serialization.Schema< serializers.TranscribeFormattingNumbers.Raw, diff --git a/src/serialization/types/TranscribeFormattingNumericRanges.ts b/src/serialization/types/TranscribeFormattingNumericRanges.ts index 01f59346..d64f27b4 100644 --- a/src/serialization/types/TranscribeFormattingNumericRanges.ts +++ b/src/serialization/types/TranscribeFormattingNumericRanges.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscribeFormattingNumericRanges: core.serialization.Schema< serializers.TranscribeFormattingNumericRanges.Raw, diff --git a/src/serialization/types/TranscribeFormattingOrdinals.ts b/src/serialization/types/TranscribeFormattingOrdinals.ts index a2077405..cfc7a766 100644 --- a/src/serialization/types/TranscribeFormattingOrdinals.ts +++ b/src/serialization/types/TranscribeFormattingOrdinals.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscribeFormattingOrdinals: core.serialization.Schema< serializers.TranscribeFormattingOrdinals.Raw, diff --git a/src/serialization/types/TranscribeFormattingTimes.ts b/src/serialization/types/TranscribeFormattingTimes.ts index 76f56cac..740e0505 100644 --- a/src/serialization/types/TranscribeFormattingTimes.ts +++ b/src/serialization/types/TranscribeFormattingTimes.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscribeFormattingTimes: core.serialization.Schema< serializers.TranscribeFormattingTimes.Raw, diff --git a/src/serialization/types/TranscribeSupportedLanguage.ts b/src/serialization/types/TranscribeSupportedLanguage.ts index dc85dade..1ad617f9 100644 --- a/src/serialization/types/TranscribeSupportedLanguage.ts +++ b/src/serialization/types/TranscribeSupportedLanguage.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscribeSupportedLanguage: core.serialization.Schema< serializers.TranscribeSupportedLanguage.Raw, diff --git a/src/serialization/types/TranscribeTranscriptData.ts b/src/serialization/types/TranscribeTranscriptData.ts index c2860ce3..c7c59b88 100644 --- a/src/serialization/types/TranscribeTranscriptData.ts +++ b/src/serialization/types/TranscribeTranscriptData.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscribeTranscriptData: core.serialization.ObjectSchema< serializers.TranscribeTranscriptData.Raw, diff --git a/src/serialization/types/TranscribeTranscriptMessage.ts b/src/serialization/types/TranscribeTranscriptMessage.ts index 21f7f5e1..4d6e19ef 100644 --- a/src/serialization/types/TranscribeTranscriptMessage.ts +++ b/src/serialization/types/TranscribeTranscriptMessage.ts @@ -1,23 +1,22 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TranscribeTranscriptData } from "./TranscribeTranscriptData.js"; +import { TranscribeTranscriptMessageType } from "./TranscribeTranscriptMessageType.js"; export const TranscribeTranscriptMessage: core.serialization.ObjectSchema< serializers.TranscribeTranscriptMessage.Raw, Corti.TranscribeTranscriptMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("transcript"), + type: TranscribeTranscriptMessageType, data: TranscribeTranscriptData, }); export declare namespace TranscribeTranscriptMessage { export interface Raw { - type: "transcript"; + type: TranscribeTranscriptMessageType.Raw; data: TranscribeTranscriptData.Raw; } } diff --git a/src/serialization/types/TranscribeTranscriptMessageType.ts b/src/serialization/types/TranscribeTranscriptMessageType.ts new file mode 100644 index 00000000..f63479b3 --- /dev/null +++ b/src/serialization/types/TranscribeTranscriptMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TranscribeTranscriptMessageType: core.serialization.Schema< + serializers.TranscribeTranscriptMessageType.Raw, + Corti.TranscribeTranscriptMessageType +> = core.serialization.enum_(["transcript"]); + +export declare namespace TranscribeTranscriptMessageType { + export type Raw = "transcript"; +} diff --git a/src/serialization/types/TranscribeUsageMessage.ts b/src/serialization/types/TranscribeUsageMessage.ts index 660cd9b4..d9cc1e1d 100644 --- a/src/serialization/types/TranscribeUsageMessage.ts +++ b/src/serialization/types/TranscribeUsageMessage.ts @@ -1,22 +1,21 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TranscribeUsageMessageType } from "./TranscribeUsageMessageType.js"; export const TranscribeUsageMessage: core.serialization.ObjectSchema< serializers.TranscribeUsageMessage.Raw, Corti.TranscribeUsageMessage > = core.serialization.object({ - type: core.serialization.stringLiteral("usage"), + type: TranscribeUsageMessageType, credits: core.serialization.number(), }); export declare namespace TranscribeUsageMessage { export interface Raw { - type: "usage"; + type: TranscribeUsageMessageType.Raw; credits: number; } } diff --git a/src/serialization/types/TranscribeUsageMessageType.ts b/src/serialization/types/TranscribeUsageMessageType.ts new file mode 100644 index 00000000..74ca73bd --- /dev/null +++ b/src/serialization/types/TranscribeUsageMessageType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TranscribeUsageMessageType: core.serialization.Schema< + serializers.TranscribeUsageMessageType.Raw, + Corti.TranscribeUsageMessageType +> = core.serialization.enum_(["usage"]); + +export declare namespace TranscribeUsageMessageType { + export type Raw = "usage"; +} diff --git a/src/serialization/types/TranscriptsData.ts b/src/serialization/types/TranscriptsData.ts index d368d168..4a580b1b 100644 --- a/src/serialization/types/TranscriptsData.ts +++ b/src/serialization/types/TranscriptsData.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { TranscriptsMetadata } from "./TranscriptsMetadata.js"; +import type * as serializers from "../index.js"; import { CommonTranscriptResponse } from "./CommonTranscriptResponse.js"; +import { TranscriptsMetadata } from "./TranscriptsMetadata.js"; export const TranscriptsData: core.serialization.ObjectSchema = core.serialization.object({ diff --git a/src/serialization/types/TranscriptsListItem.ts b/src/serialization/types/TranscriptsListItem.ts index 331861da..505f8956 100644 --- a/src/serialization/types/TranscriptsListItem.ts +++ b/src/serialization/types/TranscriptsListItem.ts @@ -1,12 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { Uuid } from "./Uuid.js"; +import type * as serializers from "../index.js"; import { TranscriptsData } from "./TranscriptsData.js"; +import { Uuid } from "./Uuid.js"; export const TranscriptsListItem: core.serialization.ObjectSchema< serializers.TranscriptsListItem.Raw, diff --git a/src/serialization/types/TranscriptsListResponse.ts b/src/serialization/types/TranscriptsListResponse.ts index f54029bf..0dd1a3ea 100644 --- a/src/serialization/types/TranscriptsListResponse.ts +++ b/src/serialization/types/TranscriptsListResponse.ts @@ -1,21 +1,19 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TranscriptsListItem } from "./TranscriptsListItem.js"; export const TranscriptsListResponse: core.serialization.ObjectSchema< serializers.TranscriptsListResponse.Raw, Corti.TranscriptsListResponse > = core.serialization.object({ - transcripts: core.serialization.list(TranscriptsListItem).optionalNullable(), + transcripts: core.serialization.list(TranscriptsListItem).nullable(), }); export declare namespace TranscriptsListResponse { export interface Raw { - transcripts?: (TranscriptsListItem.Raw[] | null) | null; + transcripts?: TranscriptsListItem.Raw[] | null; } } diff --git a/src/serialization/types/TranscriptsMetadata.ts b/src/serialization/types/TranscriptsMetadata.ts index 9b84afe5..4f188255 100644 --- a/src/serialization/types/TranscriptsMetadata.ts +++ b/src/serialization/types/TranscriptsMetadata.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TranscriptsParticipant } from "./TranscriptsParticipant.js"; export const TranscriptsMetadata: core.serialization.ObjectSchema< @@ -16,6 +14,6 @@ export const TranscriptsMetadata: core.serialization.ObjectSchema< export declare namespace TranscriptsMetadata { export interface Raw { - participantsRoles?: (TranscriptsParticipant.Raw[] | null) | null; + participantsRoles?: (TranscriptsParticipant.Raw[] | null | undefined) | null; } } diff --git a/src/serialization/types/TranscriptsParticipant.ts b/src/serialization/types/TranscriptsParticipant.ts index 92158ca3..0d75a19e 100644 --- a/src/serialization/types/TranscriptsParticipant.ts +++ b/src/serialization/types/TranscriptsParticipant.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TranscriptsParticipantRoleEnum } from "./TranscriptsParticipantRoleEnum.js"; export const TranscriptsParticipant: core.serialization.ObjectSchema< diff --git a/src/serialization/types/TranscriptsParticipantRoleEnum.ts b/src/serialization/types/TranscriptsParticipantRoleEnum.ts index 412bb211..10e90f47 100644 --- a/src/serialization/types/TranscriptsParticipantRoleEnum.ts +++ b/src/serialization/types/TranscriptsParticipantRoleEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscriptsParticipantRoleEnum: core.serialization.Schema< serializers.TranscriptsParticipantRoleEnum.Raw, diff --git a/src/serialization/types/TranscriptsResponse.ts b/src/serialization/types/TranscriptsResponse.ts index 1ff66348..c7e4e0af 100644 --- a/src/serialization/types/TranscriptsResponse.ts +++ b/src/serialization/types/TranscriptsResponse.ts @@ -1,15 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; -import { Uuid } from "./Uuid.js"; -import { TranscriptsMetadata } from "./TranscriptsMetadata.js"; +import type * as serializers from "../index.js"; import { CommonTranscriptResponse } from "./CommonTranscriptResponse.js"; import { CommonUsageInfo } from "./CommonUsageInfo.js"; +import { TranscriptsMetadata } from "./TranscriptsMetadata.js"; import { TranscriptsStatusEnum } from "./TranscriptsStatusEnum.js"; +import { Uuid } from "./Uuid.js"; export const TranscriptsResponse: core.serialization.ObjectSchema< serializers.TranscriptsResponse.Raw, @@ -17,7 +15,7 @@ export const TranscriptsResponse: core.serialization.ObjectSchema< > = core.serialization.object({ id: Uuid, metadata: TranscriptsMetadata, - transcripts: core.serialization.list(CommonTranscriptResponse).optionalNullable(), + transcripts: core.serialization.list(CommonTranscriptResponse).nullable(), usageInfo: CommonUsageInfo, recordingId: Uuid, status: TranscriptsStatusEnum, @@ -27,7 +25,7 @@ export declare namespace TranscriptsResponse { export interface Raw { id: Uuid.Raw; metadata: TranscriptsMetadata.Raw; - transcripts?: (CommonTranscriptResponse.Raw[] | null) | null; + transcripts?: CommonTranscriptResponse.Raw[] | null; usageInfo: CommonUsageInfo.Raw; recordingId: Uuid.Raw; status: TranscriptsStatusEnum.Raw; diff --git a/src/serialization/types/TranscriptsStatusEnum.ts b/src/serialization/types/TranscriptsStatusEnum.ts index e269f08d..029db38c 100644 --- a/src/serialization/types/TranscriptsStatusEnum.ts +++ b/src/serialization/types/TranscriptsStatusEnum.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const TranscriptsStatusEnum: core.serialization.Schema< serializers.TranscriptsStatusEnum.Raw, diff --git a/src/serialization/types/TranscriptsStatusResponse.ts b/src/serialization/types/TranscriptsStatusResponse.ts index 4e775690..03797c1a 100644 --- a/src/serialization/types/TranscriptsStatusResponse.ts +++ b/src/serialization/types/TranscriptsStatusResponse.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; import { TranscriptsStatusEnum } from "./TranscriptsStatusEnum.js"; export const TranscriptsStatusResponse: core.serialization.ObjectSchema< diff --git a/src/serialization/types/Uuid.ts b/src/serialization/types/Uuid.ts index 86322c94..125a4add 100644 --- a/src/serialization/types/Uuid.ts +++ b/src/serialization/types/Uuid.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as serializers from "../index.js"; -import * as Corti from "../../api/index.js"; +import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; export const Uuid: core.serialization.Schema = core.serialization.string(); diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index f52afcf8..e5a292a5 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -1,168 +1,202 @@ +export * from "./AgentsAgent.js"; +export * from "./AgentsAgentCapabilities.js"; +export * from "./AgentsAgentCard.js"; +export * from "./AgentsAgentCardSignature.js"; +export * from "./AgentsAgentExpertsItem.js"; +export * from "./AgentsAgentExtension.js"; +export * from "./AgentsAgentInterface.js"; +export * from "./AgentsAgentProvider.js"; +export * from "./AgentsAgentReference.js"; +export * from "./AgentsAgentReferenceType.js"; +export * from "./AgentsAgentResponse.js"; +export * from "./AgentsAgentSkill.js"; +export * from "./AgentsArtifact.js"; +export * from "./AgentsContext.js"; +export * from "./AgentsContextItemsItem.js"; +export * from "./AgentsCreateExpert.js"; +export * from "./AgentsCreateExpertReference.js"; +export * from "./AgentsCreateExpertReferenceType.js"; +export * from "./AgentsCreateExpertType.js"; +export * from "./AgentsCreateMcpServer.js"; +export * from "./AgentsCreateMcpServerAuthorizationType.js"; +export * from "./AgentsCreateMcpServerTransportType.js"; +export * from "./AgentsDataPart.js"; +export * from "./AgentsDataPartKind.js"; +export * from "./AgentsExpert.js"; +export * from "./AgentsExpertReference.js"; +export * from "./AgentsExpertReferenceType.js"; +export * from "./AgentsExpertType.js"; +export * from "./AgentsFilePart.js"; +export * from "./AgentsFilePartFile.js"; +export * from "./AgentsFilePartKind.js"; +export * from "./AgentsFileWithBytes.js"; +export * from "./AgentsFileWithUri.js"; +export * from "./AgentsMcpServer.js"; +export * from "./AgentsMcpServerAuthorizationType.js"; +export * from "./AgentsMcpServerTransportType.js"; +export * from "./AgentsMessage.js"; +export * from "./AgentsMessageKind.js"; +export * from "./AgentsMessageRole.js"; +export * from "./AgentsMessageSendConfiguration.js"; +export * from "./AgentsPart.js"; +export * from "./AgentsPushNotificationAuthenticationInfo.js"; +export * from "./AgentsPushNotificationConfig.js"; +export * from "./AgentsRegistryExpert.js"; +export * from "./AgentsRegistryExpertsResponse.js"; +export * from "./AgentsRegistryMcpServer.js"; +export * from "./AgentsRegistryMcpServerAuthorizationType.js"; +export * from "./AgentsTask.js"; +export * from "./AgentsTaskKind.js"; +export * from "./AgentsTaskStatus.js"; +export * from "./AgentsTaskStatusState.js"; +export * from "./AgentsTextPart.js"; +export * from "./AgentsTextPartKind.js"; +export * from "./CodesGeneralReadResponse.js"; +export * from "./CodesGeneralReadResponseEvidencesItem.js"; +export * from "./CodesGeneralResponse.js"; +export * from "./CommonAiContext.js"; export * from "./CommonCodingSystemEnum.js"; +export * from "./CommonDocumentIdContext.js"; +export * from "./CommonDocumentIdContextType.js"; +export * from "./CommonSortingDirectionEnum.js"; +export * from "./CommonSourceEnum.js"; +export * from "./CommonTextContext.js"; +export * from "./CommonTextContextType.js"; +export * from "./CommonTranscriptRequest.js"; +export * from "./CommonTranscriptResponse.js"; +export * from "./CommonUsageInfo.js"; export * from "./DocumentsContext.js"; export * from "./DocumentsContextWithFacts.js"; -export * from "./DocumentsContextWithTranscript.js"; +export * from "./DocumentsContextWithFactsType.js"; export * from "./DocumentsContextWithString.js"; +export * from "./DocumentsContextWithStringType.js"; +export * from "./DocumentsContextWithTranscript.js"; +export * from "./DocumentsContextWithTranscriptType.js"; +export * from "./DocumentsCreateRequest.js"; +export * from "./DocumentsCreateRequestWithTemplate.js"; +export * from "./DocumentsCreateRequestWithTemplateKey.js"; +export * from "./DocumentsGetResponse.js"; +export * from "./DocumentsListResponse.js"; export * from "./DocumentsSection.js"; +export * from "./DocumentsSectionInput.js"; export * from "./DocumentsSectionOverride.js"; export * from "./DocumentsTemplate.js"; export * from "./DocumentsTemplateWithSectionKeys.js"; export * from "./DocumentsTemplateWithSections.js"; -export * from "./InteractionsEncounterCreateRequest.js"; -export * from "./InteractionsEncounterUpdateRequest.js"; -export * from "./InteractionsEncounterResponse.js"; -export * from "./InteractionsEncounterPeriod.js"; export * from "./ErrorResponse.js"; +export * from "./FactsBatchUpdateInput.js"; +export * from "./FactsBatchUpdateItem.js"; +export * from "./FactsBatchUpdateResponse.js"; export * from "./FactsContext.js"; -export * from "./FactsFactGroupsItemTranslationsItem.js"; -export * from "./FactsFactGroupsItem.js"; -export * from "./InteractionsPatient.js"; -export * from "./DocumentsCreateRequest.js"; -export * from "./DocumentsCreateRequestWithTemplateKey.js"; -export * from "./DocumentsCreateRequestWithTemplate.js"; -export * from "./DocumentsSectionInput.js"; -export * from "./CommonDocumentIdContext.js"; -export * from "./CommonTextContext.js"; -export * from "./CommonAiContext.js"; export * from "./FactsCreateInput.js"; -export * from "./FactsBatchUpdateInput.js"; -export * from "./TranscriptsParticipant.js"; -export * from "./TemplatesSectionListResponse.js"; -export * from "./TemplatesListResponse.js"; -export * from "./DocumentsListResponse.js"; -export * from "./DocumentsGetResponse.js"; -export * from "./FactsListItem.js"; export * from "./FactsCreateItem.js"; +export * from "./FactsCreateResponse.js"; export * from "./FactsEvidence.js"; +export * from "./FactsExtractResponse.js"; +export * from "./FactsExtractResponseFactsItem.js"; +export * from "./FactsFactGroupsItem.js"; +export * from "./FactsFactGroupsItemTranslationsItem.js"; export * from "./FactsFactGroupsListResponse.js"; -export * from "./FactsUpdateResponse.js"; -export * from "./FactsCreateResponse.js"; +export * from "./FactsListItem.js"; export * from "./FactsListResponse.js"; -export * from "./FactsBatchUpdateResponse.js"; -export * from "./FactsBatchUpdateItem.js"; -export * from "./CodesGeneralResponse.js"; -export * from "./CodesGeneralReadResponseEvidencesItem.js"; -export * from "./CodesGeneralReadResponse.js"; -export * from "./FactsExtractResponseFactsItem.js"; -export * from "./FactsExtractResponse.js"; -export * from "./InteractionsGetResponse.js"; +export * from "./FactsUpdateResponse.js"; export * from "./InteractionsCreateResponse.js"; -export * from "./InteractionsListResponse.js"; -export * from "./TranscriptsMetadata.js"; -export * from "./RecordingsCreateResponse.js"; -export * from "./RecordingsListResponse.js"; -export * from "./TranscriptsResponse.js"; -export * from "./TranscriptsListResponse.js"; -export * from "./TranscriptsListItem.js"; -export * from "./TranscriptsData.js"; -export * from "./TranscriptsStatusResponse.js"; -export * from "./TranscriptsStatusEnum.js"; -export * from "./TemplatesSection.js"; -export * from "./CommonSortingDirectionEnum.js"; -export * from "./TemplatesDocumentationModeEnum.js"; -export * from "./TemplatesItem.js"; -export * from "./TemplatesSectionSorted.js"; -export * from "./CommonTranscriptRequest.js"; -export * from "./CommonTranscriptResponse.js"; -export * from "./Uuid.js"; -export * from "./CommonUsageInfo.js"; +export * from "./InteractionsEncounterCreateRequest.js"; +export * from "./InteractionsEncounterPeriod.js"; +export * from "./InteractionsEncounterResponse.js"; export * from "./InteractionsEncounterStatusEnum.js"; export * from "./InteractionsEncounterTypeEnum.js"; +export * from "./InteractionsEncounterUpdateRequest.js"; export * from "./InteractionsGenderEnum.js"; -export * from "./CommonSourceEnum.js"; -export * from "./TranscriptsParticipantRoleEnum.js"; -export * from "./TemplatesWritingStyle.js"; -export * from "./TemplatesFormatRule.js"; -export * from "./TemplatesSectionTranslation.js"; -export * from "./TemplatesTranslation.js"; -export * from "./StreamConfigMessage.js"; +export * from "./InteractionsGetResponse.js"; +export * from "./InteractionsListResponse.js"; +export * from "./InteractionsPatient.js"; +export * from "./RecordingsCreateResponse.js"; +export * from "./RecordingsListResponse.js"; export * from "./StreamConfig.js"; -export * from "./StreamConfigTranscription.js"; -export * from "./StreamConfigModeType.js"; +export * from "./StreamConfigMessage.js"; +export * from "./StreamConfigMessageType.js"; export * from "./StreamConfigMode.js"; -export * from "./StreamConfigStatusMessageType.js"; +export * from "./StreamConfigModeType.js"; +export * from "./StreamConfigParticipant.js"; +export * from "./StreamConfigParticipantRole.js"; export * from "./StreamConfigStatusMessage.js"; +export * from "./StreamConfigStatusMessageType.js"; +export * from "./StreamConfigTranscription.js"; export * from "./StreamEndedMessage.js"; -export * from "./StreamFlushedMessage.js"; -export * from "./StreamUsageMessage.js"; -export * from "./StreamErrorMessage.js"; +export * from "./StreamEndedMessageType.js"; +export * from "./StreamEndMessage.js"; +export * from "./StreamEndMessageType.js"; export * from "./StreamErrorDetail.js"; -export * from "./StreamTranscriptMessage.js"; -export * from "./StreamTranscript.js"; -export * from "./StreamParticipant.js"; -export * from "./StreamConfigParticipantRole.js"; -export * from "./StreamConfigParticipant.js"; -export * from "./StreamTranscriptTime.js"; -export * from "./StreamFactsMessage.js"; +export * from "./StreamErrorMessage.js"; +export * from "./StreamErrorMessageType.js"; export * from "./StreamFact.js"; -export * from "./StreamEndMessage.js"; +export * from "./StreamFactsMessage.js"; +export * from "./StreamFactsMessageType.js"; +export * from "./StreamFlushedMessage.js"; +export * from "./StreamFlushedMessageType.js"; export * from "./StreamFlushMessage.js"; +export * from "./StreamFlushMessageType.js"; +export * from "./StreamParticipant.js"; export * from "./StreamSupportedLanguage.js"; -export * from "./TranscribeSupportedLanguage.js"; -export * from "./TranscribeConfig.js"; -export * from "./TranscribeConfigMessage.js"; +export * from "./StreamTranscript.js"; +export * from "./StreamTranscriptMessage.js"; +export * from "./StreamTranscriptMessageType.js"; +export * from "./StreamTranscriptTime.js"; +export * from "./StreamUsageMessage.js"; +export * from "./StreamUsageMessageType.js"; +export * from "./TemplatesDocumentationModeEnum.js"; +export * from "./TemplatesFormatRule.js"; +export * from "./TemplatesItem.js"; +export * from "./TemplatesListResponse.js"; +export * from "./TemplatesSection.js"; +export * from "./TemplatesSectionListResponse.js"; +export * from "./TemplatesSectionSorted.js"; +export * from "./TemplatesSectionTranslation.js"; +export * from "./TemplatesTranslation.js"; +export * from "./TemplatesWritingStyle.js"; export * from "./TranscribeCommand.js"; +export * from "./TranscribeCommandData.js"; +export * from "./TranscribeCommandMessage.js"; +export * from "./TranscribeCommandMessageType.js"; export * from "./TranscribeCommandVariable.js"; -export * from "./TranscribeConfigStatusMessageType.js"; +export * from "./TranscribeCommandVariableType.js"; +export * from "./TranscribeConfig.js"; +export * from "./TranscribeConfigMessage.js"; +export * from "./TranscribeConfigMessageType.js"; export * from "./TranscribeConfigStatusMessage.js"; -export * from "./TranscribeEndMessage.js"; -export * from "./TranscribeFlushMessage.js"; -export * from "./TranscribeUsageMessage.js"; +export * from "./TranscribeConfigStatusMessageType.js"; export * from "./TranscribeEndedMessage.js"; -export * from "./TranscribeFlushedMessage.js"; -export * from "./TranscribeErrorMessageError.js"; +export * from "./TranscribeEndedMessageType.js"; +export * from "./TranscribeEndMessage.js"; +export * from "./TranscribeEndMessageType.js"; export * from "./TranscribeErrorMessage.js"; -export * from "./TranscribeTranscriptData.js"; -export * from "./TranscribeCommandData.js"; -export * from "./TranscribeTranscriptMessage.js"; -export * from "./TranscribeCommandMessage.js"; +export * from "./TranscribeErrorMessageError.js"; +export * from "./TranscribeErrorMessageType.js"; +export * from "./TranscribeFlushedMessage.js"; +export * from "./TranscribeFlushedMessageType.js"; +export * from "./TranscribeFlushMessage.js"; +export * from "./TranscribeFlushMessageType.js"; +export * from "./TranscribeFormatting.js"; export * from "./TranscribeFormattingDates.js"; -export * from "./TranscribeFormattingTimes.js"; -export * from "./TranscribeFormattingNumbers.js"; export * from "./TranscribeFormattingMeasurements.js"; +export * from "./TranscribeFormattingNumbers.js"; export * from "./TranscribeFormattingNumericRanges.js"; export * from "./TranscribeFormattingOrdinals.js"; -export * from "./TranscribeFormatting.js"; -export * from "./AgentsTaskStatusState.js"; -export * from "./AgentsTaskStatus.js"; -export * from "./AgentsTextPart.js"; -export * from "./AgentsFileWithUri.js"; -export * from "./AgentsFileWithBytes.js"; -export * from "./AgentsFilePartFile.js"; -export * from "./AgentsFilePart.js"; -export * from "./AgentsDataPart.js"; -export * from "./AgentsPart.js"; -export * from "./AgentsMessageRole.js"; -export * from "./AgentsMessage.js"; -export * from "./AgentsArtifact.js"; -export * from "./AgentsTask.js"; -export * from "./AgentsPushNotificationAuthenticationInfo.js"; -export * from "./AgentsPushNotificationConfig.js"; -export * from "./AgentsMessageSendConfiguration.js"; -export * from "./AgentsCreateMcpServerTransportType.js"; -export * from "./AgentsCreateMcpServerAuthorizationType.js"; -export * from "./AgentsCreateMcpServer.js"; -export * from "./AgentsMcpServerTransportType.js"; -export * from "./AgentsMcpServerAuthorizationType.js"; -export * from "./AgentsMcpServer.js"; -export * from "./AgentsRegistryMcpServerAuthorizationType.js"; -export * from "./AgentsRegistryMcpServer.js"; -export * from "./AgentsAgentExpertsItem.js"; -export * from "./AgentsAgent.js"; -export * from "./AgentsAgentReference.js"; -export * from "./AgentsCreateExpert.js"; -export * from "./AgentsCreateExpertReference.js"; -export * from "./AgentsExpert.js"; -export * from "./AgentsExpertReference.js"; -export * from "./AgentsAgentResponse.js"; -export * from "./AgentsAgentInterface.js"; -export * from "./AgentsAgentProvider.js"; -export * from "./AgentsAgentCapabilities.js"; -export * from "./AgentsAgentExtension.js"; -export * from "./AgentsAgentSkill.js"; -export * from "./AgentsAgentCardSignature.js"; -export * from "./AgentsAgentCard.js"; -export * from "./AgentsContextItemsItem.js"; -export * from "./AgentsContext.js"; -export * from "./AgentsRegistryExpert.js"; -export * from "./AgentsRegistryExpertsResponse.js"; +export * from "./TranscribeFormattingTimes.js"; +export * from "./TranscribeSupportedLanguage.js"; +export * from "./TranscribeTranscriptData.js"; +export * from "./TranscribeTranscriptMessage.js"; +export * from "./TranscribeTranscriptMessageType.js"; +export * from "./TranscribeUsageMessage.js"; +export * from "./TranscribeUsageMessageType.js"; +export * from "./TranscriptsData.js"; +export * from "./TranscriptsListItem.js"; +export * from "./TranscriptsListResponse.js"; +export * from "./TranscriptsMetadata.js"; +export * from "./TranscriptsParticipant.js"; +export * from "./TranscriptsParticipantRoleEnum.js"; +export * from "./TranscriptsResponse.js"; +export * from "./TranscriptsStatusEnum.js"; +export * from "./TranscriptsStatusResponse.js"; +export * from "./Uuid.js"; diff --git a/tests/BrowserTestEnvironment.ts b/tests/BrowserTestEnvironment.ts deleted file mode 100644 index 0f32bf7b..00000000 --- a/tests/BrowserTestEnvironment.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { TestEnvironment } from "jest-environment-jsdom"; - -class BrowserTestEnvironment extends TestEnvironment { - async setup() { - await super.setup(); - this.global.Request = Request; - this.global.Response = Response; - this.global.ReadableStream = ReadableStream; - this.global.TextEncoder = TextEncoder; - this.global.TextDecoder = TextDecoder; - this.global.FormData = FormData; - this.global.File = File; - this.global.Blob = Blob; - } -} - -export default BrowserTestEnvironment; diff --git a/tests/custom/agents.create.integration.ts b/tests/custom/agents.create.integration.ts deleted file mode 100644 index 49297e70..00000000 --- a/tests/custom/agents.create.integration.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, cleanupAgents, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.agents.create", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdAgentIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdAgentIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupAgents(cortiClient, createdAgentIds); - createdAgentIds = []; - }); - - describe("should create agent with only required values", () => { - it("should create agent with only name and description without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.create({ - name: faker.lorem.words(3), - description: faker.lorem.sentence(), - }); - - createdAgentIds.push(result.id); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should create agent with all optional values", () => { - it("should create agent with systemPrompt without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.create({ - name: faker.lorem.words(3), - description: faker.lorem.sentence(), - systemPrompt: faker.lorem.paragraph(), - }); - - createdAgentIds.push(result.id); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create agent with ephemeral set to true without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.create({ - name: faker.lorem.words(3), - description: faker.lorem.sentence(), - ephemeral: true, - }); - - createdAgentIds.push(result.id); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create agent with all optional parameters without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.create({ - name: faker.lorem.words(3), - description: faker.lorem.sentence(), - systemPrompt: faker.lorem.paragraph(), - ephemeral: false, - }); - - createdAgentIds.push(result.id); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should handle errors when required parameters are missing", () => { - it("should throw error when name is missing", async () => { - expect.assertions(1); - - await expect( - cortiClient.agents.create({ - description: faker.lorem.sentence(), - } as any), - ).rejects.toThrow('Missing required key "name"'); - }); - - it("should throw error when description is missing", async () => { - expect.assertions(1); - - await expect( - cortiClient.agents.create({ - name: faker.lorem.words(3), - } as any), - ).rejects.toThrow('Missing required key "description"'); - }); - }); -}); diff --git a/tests/custom/agents.delete.integration.ts b/tests/custom/agents.delete.integration.ts deleted file mode 100644 index 8cdd06ea..00000000 --- a/tests/custom/agents.delete.integration.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestAgent, cleanupAgents, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.agents.delete", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdAgentIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdAgentIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupAgents(cortiClient, createdAgentIds); - createdAgentIds = []; - }); - - describe("should delete agent with only required values", () => { - it("should successfully delete an existing agent without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const result = await cortiClient.agents.delete(agent.id); - - expect(result).toBeUndefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should throw error when required parameters are missing", () => { - it("should throw error when agent ID is missing", async () => { - expect.assertions(1); - - await expect(cortiClient.agents.delete(undefined as any)).rejects.toThrow(); - }); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when agent ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.agents.delete("invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when agent ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.agents.delete(faker.string.uuid())).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/agents.get.integration.ts b/tests/custom/agents.get.integration.ts deleted file mode 100644 index 26e9e497..00000000 --- a/tests/custom/agents.get.integration.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestAgent, cleanupAgents, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.agents.get", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdAgentIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdAgentIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupAgents(cortiClient, createdAgentIds); - createdAgentIds = []; - }); - - describe("should retrieve agent with only required values", () => { - it("should successfully retrieve an existing agent without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const result = await cortiClient.agents.get(agent.id); - - expect(result.id).toBe(agent.id); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should throw error when required parameters are missing", () => { - it("should throw error when agent ID is missing", async () => { - expect.assertions(1); - - await expect(cortiClient.agents.get(undefined as any)).rejects.toThrow(); - }); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when agent ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.agents.get("invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when agent ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.agents.get(faker.string.uuid())).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/agents.getCard.integration.ts b/tests/custom/agents.getCard.integration.ts deleted file mode 100644 index 23db8854..00000000 --- a/tests/custom/agents.getCard.integration.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestAgent, cleanupAgents, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.agents.getCard", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdAgentIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdAgentIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupAgents(cortiClient, createdAgentIds); - createdAgentIds = []; - }); - - it("should successfully retrieve an agent card without errors or warnings", async () => { - expect.assertions(3); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const result = await cortiClient.agents.getCard(agent.id); - - expect(result).toBeDefined(); - expect(result.name).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when agent ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.agents.getCard("invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when agent ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.agents.getCard(faker.string.uuid())).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/agents.getContext.integration.ts b/tests/custom/agents.getContext.integration.ts deleted file mode 100644 index 7575cd1c..00000000 --- a/tests/custom/agents.getContext.integration.ts +++ /dev/null @@ -1,157 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestAgent, - cleanupAgents, - setupConsoleWarnSpy, - sendTestMessage, -} from "./testUtils"; - -describe("cortiClient.agents.getContext", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdAgentIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdAgentIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupAgents(cortiClient, createdAgentIds); - createdAgentIds = []; - }); - - describe("should retrieve context with only required values", () => { - it("should successfully retrieve a context without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - const messageResponse = await sendTestMessage(cortiClient, agent.id); - const contextId = messageResponse.task?.contextId; - - if (!contextId) { - throw new Error("No context ID returned from message send"); - } - - const result = await cortiClient.agents.getContext(agent.id, contextId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - it("should retrieve context with limit parameter without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - const messageResponse = await sendTestMessage(cortiClient, agent.id); - const contextId = messageResponse.task?.contextId; - - if (!contextId) { - throw new Error("No context ID returned from message send"); - } - - const result = await cortiClient.agents.getContext(agent.id, contextId, { - limit: faker.number.int({ min: 1, max: 100 }), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should retrieve context with offset parameter without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - const messageResponse = await sendTestMessage(cortiClient, agent.id); - const contextId = messageResponse.task?.contextId; - - if (!contextId) { - throw new Error("No context ID returned from message send"); - } - - const result = await cortiClient.agents.getContext(agent.id, contextId, { - offset: faker.number.int({ min: 0, max: 100 }), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should retrieve context with all optional parameters without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - const messageResponse = await sendTestMessage(cortiClient, agent.id); - const contextId = messageResponse.task?.contextId; - - if (!contextId) { - throw new Error("No context ID returned from message send"); - } - - const result = await cortiClient.agents.getContext(agent.id, contextId, { - limit: faker.number.int({ min: 1, max: 100 }), - offset: faker.number.int({ min: 0, max: 100 }), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when agent ID is invalid format", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - const messageResponse = await sendTestMessage(cortiClient, agent.id); - const contextId = messageResponse.task?.contextId; - - if (!contextId) { - throw new Error("No context ID returned from message send"); - } - - await expect(cortiClient.agents.getContext("invalid-uuid", contextId)).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when context ID is invalid format", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect(cortiClient.agents.getContext(agent.id, "invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when agent ID does not exist", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - const messageResponse = await sendTestMessage(cortiClient, agent.id); - const contextId = messageResponse.task?.contextId; - - if (!contextId) { - throw new Error("No context ID returned from message send"); - } - - await expect(cortiClient.agents.getContext(faker.string.uuid(), contextId)).rejects.toThrow( - "Status code: 404", - ); - }); - - it("should throw error when context ID does not exist", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect(cortiClient.agents.getContext(agent.id, faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - }); -}); diff --git a/tests/custom/agents.getRegistryExperts.integration.ts b/tests/custom/agents.getRegistryExperts.integration.ts deleted file mode 100644 index 7d9d75b0..00000000 --- a/tests/custom/agents.getRegistryExperts.integration.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.agents.getRegistryExperts", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - it("should return registry experts without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.getRegistryExperts(); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return registry experts with limit parameter without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.getRegistryExperts({ - limit: faker.number.int({ min: 1, max: 100 }), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return registry experts with offset parameter without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.getRegistryExperts({ - offset: faker.number.int({ min: 0, max: 100 }), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return registry experts with all optional parameters without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.getRegistryExperts({ - limit: faker.number.int({ min: 1, max: 100 }), - offset: faker.number.int({ min: 0, max: 100 }), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); -}); diff --git a/tests/custom/agents.getTask.integration.ts b/tests/custom/agents.getTask.integration.ts deleted file mode 100644 index 89befa0b..00000000 --- a/tests/custom/agents.getTask.integration.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestAgent, - cleanupAgents, - setupConsoleWarnSpy, - sendTestMessage, -} from "./testUtils"; - -describe("cortiClient.agents.getTask", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdAgentIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdAgentIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupAgents(cortiClient, createdAgentIds); - createdAgentIds = []; - }); - - it("should successfully retrieve a task without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - const messageResponse = await sendTestMessage(cortiClient, agent.id); - - const taskId = messageResponse.task?.id; - - if (!taskId) { - throw new Error("No task ID returned from message send"); - } - - const result = await cortiClient.agents.getTask(agent.id, taskId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should retrieve task with historyLength parameter without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - const messageResponse = await sendTestMessage(cortiClient, agent.id); - const taskId = messageResponse.task?.id; - - if (!taskId) { - throw new Error("No task ID returned from message send"); - } - - const result = await cortiClient.agents.getTask(agent.id, taskId, { - historyLength: faker.number.int({ min: 1, max: 100 }), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - // FIXME: re-enable when validation is implemented - it.skip("should throw error when agent ID is invalid format", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - const messageResponse = await sendTestMessage(cortiClient, agent.id); - const taskId = messageResponse.task?.id; - - if (!taskId) { - throw new Error("No task ID returned from message send"); - } - - await expect(cortiClient.agents.getTask("invalid-uuid", taskId)).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when task ID is invalid format", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect(cortiClient.agents.getTask(agent.id, "invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - // FIXME: re-enable when proper error handling is implemented - it.skip("should throw error when agent ID does not exist", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - const messageResponse = await sendTestMessage(cortiClient, agent.id); - const taskId = messageResponse.task?.id; - - if (!taskId) { - throw new Error("No task ID returned from message send"); - } - - await expect(cortiClient.agents.getTask(faker.string.uuid(), taskId)).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when task ID does not exist", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect(cortiClient.agents.getTask(agent.id, faker.string.uuid())).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/agents.list.integration.ts b/tests/custom/agents.list.integration.ts deleted file mode 100644 index 641bf061..00000000 --- a/tests/custom/agents.list.integration.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestAgent, cleanupAgents, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.agents.list", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdAgentIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdAgentIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupAgents(cortiClient, createdAgentIds); - createdAgentIds = []; - }); - - // FIXME: re-enable when deletion issues are resolved - it.skip("should return empty list when no agents exist", async () => { - expect.assertions(2); - - const existingAgents = await cortiClient.agents.list(); - const agentIds: string[] = []; - - for (const agent of existingAgents) { - if ("id" in agent && agent.id) { - agentIds.push(agent.id); - } - } - - if (agentIds.length > 0) { - await cleanupAgents(cortiClient, agentIds); - } - - const result = await cortiClient.agents.list(); - - expect(result.length).toBe(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should list agents with only required values", () => { - it("should return created agent in list without errors or warnings", async () => { - expect.assertions(3); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const result = await cortiClient.agents.list(); - - expect(result.length).toBeGreaterThan(0); - expect(result.some((listAgent: any) => listAgent.id === agent.id)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should return list with optional parameters", () => { - it("should return list with limit parameter without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.list({ - limit: faker.number.int({ min: 1, max: 10 }), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return list with offset parameter without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.list({ - offset: faker.number.int({ min: 0, max: 10 }), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return list with ephemeral parameter without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.list({ - ephemeral: false, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return list with all optional parameters without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.agents.list({ - limit: faker.number.int({ min: 1, max: 10 }), - offset: faker.number.int({ min: 0, max: 10 }), - ephemeral: false, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); -}); diff --git a/tests/custom/agents.messageSend.integration.ts b/tests/custom/agents.messageSend.integration.ts deleted file mode 100644 index 09114f4c..00000000 --- a/tests/custom/agents.messageSend.integration.ts +++ /dev/null @@ -1,399 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestAgent, cleanupAgents, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.agents.messageSend", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdAgentIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdAgentIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupAgents(cortiClient, createdAgentIds); - createdAgentIds = []; - }); - - describe("should send message with minimal fields", () => { - it("should send message with only required fields without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const result = await cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should send message with agent role without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const result = await cortiClient.agents.messageSend(agent.id, { - message: { - role: "agent", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should send message with all optional fields", () => { - it("should send message with metadata without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const result = await cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - metadata: { - testKey: faker.lorem.word(), - }, - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should send message with extensions without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const result = await cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - extensions: [faker.lorem.word()], - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - // FIXME: We need to be able to get a task in not final state, otherwise error is valid - it.skip("should send message with taskId and contextId without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const firstMessage = await cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - }, - }); - - const taskId = firstMessage.task?.id; - const contextId = firstMessage.task?.contextId; - - const result = await cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - taskId: taskId, - contextId: contextId, - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should send message with referenceTaskIds without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const result = await cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - referenceTaskIds: [faker.string.uuid()], - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - // FIXME: We need to be able to get a task in not final state, otherwise error is valid - it.skip("should send message with all optional parameters without errors or warnings", async () => { - expect.assertions(2); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const firstMessage = await cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - }, - }); - - const taskId = firstMessage.task?.id; - const contextId = firstMessage.task?.contextId; - - const result = await cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - metadata: { - testKey: faker.lorem.word(), - }, - extensions: [faker.lorem.word()], - taskId: taskId, - contextId: contextId, - referenceTaskIds: [faker.string.uuid()], - }, - configuration: { - blocking: true, - }, - metadata: { - testMetadata: faker.lorem.word(), - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should throw error when required parameters are missing", () => { - it("should throw error when message is missing", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect(cortiClient.agents.messageSend(agent.id, {} as any)).rejects.toThrow( - 'Missing required key "message"', - ); - }); - - it("should throw error when role is missing", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.messageSend(agent.id, { - message: { - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - } as any, - }), - ).rejects.toThrow('Missing required key "role"'); - }); - - it("should throw error when parts is missing", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - messageId: faker.string.uuid(), - kind: "message", - } as any, - }), - ).rejects.toThrow('Missing required key "parts"'); - }); - - it("should throw error when messageId is missing", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - kind: "message", - } as any, - }), - ).rejects.toThrow('Missing required key "messageId"'); - }); - - it("should throw error when kind is missing", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - } as any, - }), - ).rejects.toThrow('Missing required key "kind"'); - }); - - it("should throw error when text is missing in text part", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.messageSend(agent.id, { - message: { - role: "user", - parts: [ - { - kind: "text", - } as any, - ], - messageId: faker.string.uuid(), - kind: "message", - }, - }), - ).rejects.toThrow('Missing required key "text"'); - }); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when agent ID is invalid format", async () => { - expect.assertions(1); - - await expect( - cortiClient.agents.messageSend("invalid-uuid", { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - }, - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when agent ID does not exist", async () => { - expect.assertions(1); - - await expect( - cortiClient.agents.messageSend(faker.string.uuid(), { - message: { - role: "user", - parts: [ - { - kind: "text", - text: faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - }, - }), - ).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/agents.update.integration.ts b/tests/custom/agents.update.integration.ts deleted file mode 100644 index 874e09d8..00000000 --- a/tests/custom/agents.update.integration.ts +++ /dev/null @@ -1,198 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestAgent, cleanupAgents, setupConsoleWarnSpy } from "./testUtils"; - -// FIXME : Skipping until update agent functionality is restored -describe.skip("cortiClient.agents.update", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdAgentIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdAgentIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupAgents(cortiClient, createdAgentIds); - createdAgentIds = []; - }); - - describe("should update agent with minimal fields", () => { - it("should update agent with only name without errors or warnings", async () => { - expect.assertions(4); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const newName = faker.lorem.words(3); - - const result = await cortiClient.agents.update(agent.id, { - id: agent.id, - name: newName, - description: agent.description, - systemPrompt: agent.systemPrompt, - }); - - expect(result).toBeDefined(); - expect(result.name).toBe(newName); - expect(result.name).not.toBe(agent.name); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update agent with only description without errors or warnings", async () => { - expect.assertions(4); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const newDescription = faker.lorem.sentence(); - - const result = await cortiClient.agents.update(agent.id, { - id: agent.id, - name: agent.name, - description: newDescription, - systemPrompt: agent.systemPrompt, - }); - - expect(result).toBeDefined(); - expect(result.description).toBe(newDescription); - expect(result.description).not.toBe(agent.description); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update agent with only systemPrompt without errors or warnings", async () => { - expect.assertions(3); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const newSystemPrompt = faker.lorem.paragraph(); - - const result = await cortiClient.agents.update(agent.id, { - id: agent.id, - name: agent.name, - description: agent.description, - systemPrompt: newSystemPrompt, - }); - - expect(result).toBeDefined(); - expect(result.systemPrompt).toBe(newSystemPrompt); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - it("should update agent with all possible parameters without errors or warnings", async () => { - expect.assertions(6); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - const newName = faker.lorem.words(4); - const newDescription = faker.lorem.sentence(); - const newSystemPrompt = faker.lorem.paragraph(); - - const result = await cortiClient.agents.update(agent.id, { - id: agent.id, - name: newName, - description: newDescription, - systemPrompt: newSystemPrompt, - }); - - expect(result).toBeDefined(); - expect(result.name).toBe(newName); - expect(result.name).not.toBe(agent.name); - expect(result.description).toBe(newDescription); - expect(result.description).not.toBe(agent.description); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when agent ID is invalid", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.update("invalid-uuid", { - id: agent.id, - name: agent.name, - description: agent.description, - systemPrompt: agent.systemPrompt, - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when agent ID does not exist", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.update(faker.string.uuid(), { - id: agent.id, - name: agent.name, - description: agent.description, - systemPrompt: agent.systemPrompt, - }), - ).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when id is missing", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.update(agent.id, { - name: agent.name, - description: agent.description, - systemPrompt: agent.systemPrompt, - } as any), - ).rejects.toThrow('Missing required key "id"'); - }); - - it("should throw error when name is missing", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.update(agent.id, { - id: agent.id, - description: agent.description, - systemPrompt: agent.systemPrompt, - } as any), - ).rejects.toThrow('Missing required key "name"'); - }); - - it("should throw error when description is missing", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.update(agent.id, { - id: agent.id, - name: agent.name, - systemPrompt: agent.systemPrompt, - } as any), - ).rejects.toThrow('Missing required key "description"'); - }); - - it("should throw error when systemPrompt is missing", async () => { - expect.assertions(1); - - const agent = await createTestAgent(cortiClient, createdAgentIds); - - await expect( - cortiClient.agents.update(agent.id, { - id: agent.id, - name: agent.name, - description: agent.description, - } as any), - ).rejects.toThrow('Missing required key "systemPrompt"'); - }); - }); -}); diff --git a/tests/custom/codes.predict.integration.ts b/tests/custom/codes.predict.integration.ts deleted file mode 100644 index 8365c3c2..00000000 --- a/tests/custom/codes.predict.integration.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestDocument, createTestInteraction, cleanupInteractions, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.codes.predict", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - describe("should predict codes with only required values", () => { - it("should predict codes with text context without errors or warnings", async () => { - expect.assertions(4); - - const result = await cortiClient.codes.predict({ - system: ["icd10cm"], - context: [ - { - type: "text", - text: faker.lorem.sentence(), - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.codes).toBeDefined(); - expect(Array.isArray(result.codes)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should predict codes with all optional parameters", () => { - it("should predict codes with maxCandidates without errors or warnings", async () => { - expect.assertions(5); - - const result = await cortiClient.codes.predict({ - system: ["icd10cm"], - context: [ - { - type: "text", - text: faker.lorem.sentence(), - }, - ], - maxCandidates: faker.number.int({ min: 1, max: 10 }), - }); - - expect(result).toBeDefined(); - expect(result.codes).toBeDefined(); - expect(result.candidates).toBeDefined(); - expect(Array.isArray(result.candidates)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should predict codes with all system enum values", () => { - it("should predict codes with system icd10cm without errors or warnings", async () => { - expect.assertions(4); - - const result = await cortiClient.codes.predict({ - system: ["icd10cm"], - context: [{ type: "text", text: faker.lorem.sentence() }], - }); - - expect(result).toBeDefined(); - expect(result.codes).toBeDefined(); - expect(result.candidates).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should predict codes with system icd10pcs without errors or warnings", async () => { - expect.assertions(4); - - const result = await cortiClient.codes.predict({ - system: ["icd10pcs"], - context: [{ type: "text", text: faker.lorem.sentence() }], - }); - - expect(result).toBeDefined(); - expect(result.codes).toBeDefined(); - expect(result.candidates).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should predict codes with system cpt without errors or warnings", async () => { - expect.assertions(4); - - const result = await cortiClient.codes.predict({ - system: ["cpt"], - context: [{ type: "text", text: faker.lorem.sentence() }], - }); - - expect(result).toBeDefined(); - expect(result.codes).toBeDefined(); - expect(result.candidates).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should predict codes with documentId context", () => { - const createdInteractionIds: string[] = []; - - afterEach(async () => { - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds.length = 0; - }); - - it("should predict codes when context is documentId without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - const result = await cortiClient.codes.predict({ - system: ["icd10cm"], - context: [ - { - type: "documentId", - documentId, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.codes).toBeDefined(); - expect(Array.isArray(result.codes)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should return response with expected shape", () => { - it("should return codes and candidates arrays", async () => { - expect.assertions(4); - - const result = await cortiClient.codes.predict({ - system: ["icd10cm"], - context: [{ type: "text", text: faker.lorem.sentence() }], - }); - - expect(result).toHaveProperty("codes"); - expect(result).toHaveProperty("candidates"); - expect(Array.isArray(result.codes)).toBe(true); - expect(Array.isArray(result.candidates)).toBe(true); - }); - }); - - describe("should throw error when required parameters are missing", () => { - it("should throw error when system is missing", async () => { - expect.assertions(1); - - await expect( - cortiClient.codes.predict({ - context: [{ type: "text", text: faker.lorem.sentence() }], - } as any), - ).rejects.toThrow(); - }); - - // FIXME: doesn't throw error when context is empty array, but it should - it.skip("should throw error when context is missing", async () => { - expect.assertions(1); - - await expect( - cortiClient.codes.predict({ - system: ["icd10cm"], - context: [], - }), - ).rejects.toThrow(); - }); - - it("should throw error when text is missing in text context", async () => { - expect.assertions(1); - - await expect( - cortiClient.codes.predict({ - system: ["icd10cm"], - context: [{ type: "text" }] as any, - }), - ).rejects.toThrow(); - }); - - it("should throw error when documentId is missing in documentId context", async () => { - expect.assertions(1); - - await expect( - cortiClient.codes.predict({ - system: ["icd10cm"], - context: [{ type: "documentId" }] as any, - }), - ).rejects.toThrow(); - }); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when system is empty", async () => { - expect.assertions(1); - - await expect( - cortiClient.codes.predict({ - system: [], - context: [{ type: "text", text: faker.lorem.sentence() }], - } as any), - ).rejects.toThrow(); - }); - - it("should throw error when documentId does not exist", async () => { - expect.assertions(1); - - await expect( - cortiClient.codes.predict({ - system: ["icd10cm"], - context: [ - { - type: "documentId", - documentId: faker.string.uuid(), - }, - ], - }), - ).rejects.toThrow(); - }); - }); -}); diff --git a/tests/custom/documents.create.integration.ts b/tests/custom/documents.create.integration.ts deleted file mode 100644 index b74da4aa..00000000 --- a/tests/custom/documents.create.integration.ts +++ /dev/null @@ -1,1342 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - cleanupInteractions, - setupConsoleWarnSpy, - getValidTemplateKeyAndLanguage, - getValidFactGroups, - getValidSectionKeys, -} from "./testUtils"; - -describe("cortiClient.documents.create", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - let templateKey: string; - let outputLanguage: string; - let validFactGroups: string[] = []; - let validSectionKeys: string[] = []; - - beforeAll(async () => { - cortiClient = createTestCortiClient(); - const templateData = await getValidTemplateKeyAndLanguage(cortiClient); - templateKey = templateData.templateKey; - outputLanguage = templateData.outputLanguage; - validFactGroups = await getValidFactGroups(cortiClient); - validSectionKeys = await getValidSectionKeys(cortiClient); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - describe("should create document with only required values", () => { - it("should create document with DocumentsCreateRequestWithTemplateKey using facts context", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - source: "user", - }, - ], - }, - ], - templateKey, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplateKey using transcript context", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "transcript", - data: { - text: faker.lorem.paragraphs(2), - start: faker.number.int({ min: 0, max: 1000 }), - end: faker.number.int({ min: 1001, max: 5000 }), - channel: faker.number.int({ min: 0, max: 1 }), - participant: faker.number.int({ min: 0, max: 1 }), - speakerId: faker.number.int({ min: 1, max: 10 }), - }, - }, - ], - templateKey, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplateKey using string context", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - templateKey, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplate using facts context and sectionKeys", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - source: "user", - }, - ], - }, - ], - template: { - sectionKeys: [faker.helpers.arrayElement(validSectionKeys)], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplate using transcript context and sectionKeys", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "transcript", - data: { - text: faker.lorem.paragraphs(2), - start: faker.number.int({ min: 0, max: 1000 }), - end: faker.number.int({ min: 1001, max: 5000 }), - channel: faker.number.int({ min: 0, max: 1 }), - participant: faker.number.int({ min: 0, max: 1 }), - speakerId: faker.number.int({ min: 1, max: 10 }), - }, - }, - ], - template: { - sectionKeys: [faker.helpers.arrayElement(validSectionKeys)], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplate using string context and sectionKeys", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sectionKeys: [faker.helpers.arrayElement(validSectionKeys)], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should create document with all optional values", () => { - it("should create document with DocumentsCreateRequestWithTemplateKey using facts context", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "user", - }, - ], - }, - ], - templateKey, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplateKey using transcript context", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "transcript", - data: { - text: faker.lorem.paragraphs(2), - start: faker.number.int({ min: 0, max: 1000 }), - end: faker.number.int({ min: 1001, max: 5000 }), - channel: faker.number.int({ min: 0, max: 1 }), - participant: faker.number.int({ min: 0, max: 1 }), - speakerId: faker.number.int({ min: 1, max: 10 }), - }, - }, - ], - templateKey, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplateKey using string context", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - templateKey, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplate using facts context", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "user", - }, - ], - }, - ], - template: { - documentName: faker.lorem.words(3), - additionalInstructions: faker.lorem.sentence(), - sectionKeys: [ - faker.helpers.arrayElement(validSectionKeys), - faker.helpers.arrayElement(validSectionKeys), - ], - }, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplate using transcript context", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "transcript", - data: { - text: faker.lorem.paragraphs(2), - start: faker.number.int({ min: 0, max: 1000 }), - end: faker.number.int({ min: 1001, max: 5000 }), - channel: faker.number.int({ min: 0, max: 1 }), - participant: faker.number.int({ min: 0, max: 1 }), - speakerId: faker.number.int({ min: 1, max: 10 }), - }, - }, - ], - template: { - documentName: faker.lorem.words(3), - additionalInstructions: faker.lorem.sentence(), - sectionKeys: [ - faker.helpers.arrayElement(validSectionKeys), - faker.helpers.arrayElement(validSectionKeys), - ], - }, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplate using string context", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - documentName: faker.lorem.words(3), - additionalInstructions: faker.lorem.sentence(), - sectionKeys: [ - faker.helpers.arrayElement(validSectionKeys), - faker.helpers.arrayElement(validSectionKeys), - ], - }, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should create document with all source enum values in facts context", () => { - it("should create document with DocumentsCreateRequestWithTemplateKey using source: core", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "core", - }, - ], - }, - ], - templateKey, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplateKey using source: system", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "system", - }, - ], - }, - ], - templateKey, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplateKey using source: user", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "user", - }, - ], - }, - ], - templateKey, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplate using source: core", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "core", - }, - ], - }, - ], - template: { - documentName: faker.lorem.words(3), - additionalInstructions: faker.lorem.sentence(), - sectionKeys: [ - faker.helpers.arrayElement(validSectionKeys), - faker.helpers.arrayElement(validSectionKeys), - ], - }, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplate using source: system", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "system", - }, - ], - }, - ], - template: { - documentName: faker.lorem.words(3), - additionalInstructions: faker.lorem.sentence(), - sectionKeys: [ - faker.helpers.arrayElement(validSectionKeys), - faker.helpers.arrayElement(validSectionKeys), - ], - }, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with DocumentsCreateRequestWithTemplate using source: user", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "user", - }, - ], - }, - ], - template: { - documentName: faker.lorem.words(3), - additionalInstructions: faker.lorem.sentence(), - sectionKeys: [ - faker.helpers.arrayElement(validSectionKeys), - faker.helpers.arrayElement(validSectionKeys), - ], - }, - name: faker.lorem.words(3), - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should create document with DocumentsTemplateWithSections", () => { - it("should create document with sections array with single section", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - }, - ], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with sections array with multiple sections", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - }, - { - key: faker.helpers.arrayElement(validSectionKeys), - }, - ], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with sections array with nameOverride", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - nameOverride: faker.lorem.words(2), - }, - ], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with sections array with writingStyleOverride", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - writingStyleOverride: "Use bullet points and short sentences", - }, - ], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with sections array with formatRuleOverride", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - formatRuleOverride: "Format as numbered list", - }, - ], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with sections array with additionalInstructionsOverride", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - additionalInstructionsOverride: faker.lorem.sentence(), - }, - ], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with sections array with contentOverride", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - contentOverride: faker.lorem.sentence(), - }, - ], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with sections array with all overrides", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - nameOverride: faker.lorem.words(2), - writingStyleOverride: "Use formal medical terminology", - formatRuleOverride: "Use headers and subheaders", - additionalInstructionsOverride: faker.lorem.sentence(), - contentOverride: faker.lorem.sentence(), - }, - ], - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with sections array with template description", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - }, - ], - description: faker.lorem.sentence(), - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with sections array with template additionalInstructionsOverride", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - }, - ], - additionalInstructionsOverride: faker.lorem.sentence(), - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with sections array with all template-level options", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - nameOverride: faker.lorem.words(2), - }, - { - key: faker.helpers.arrayElement(validSectionKeys), - writingStyleOverride: faker.lorem.sentence(), - }, - ], - description: faker.lorem.sentence(), - additionalInstructionsOverride: faker.lorem.sentence(), - }, - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should create document with documentationMode", () => { - it("should create document with documentationMode: global_sequential using templateKey", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - templateKey, - outputLanguage: "en", - documentationMode: "global_sequential", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with documentationMode: global_sequential using template with sectionKeys", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sectionKeys: [faker.helpers.arrayElement(validSectionKeys)], - }, - outputLanguage: "en", - documentationMode: "global_sequential", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with documentationMode: routed_parallel using template with sectionKeys", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sectionKeys: [faker.helpers.arrayElement(validSectionKeys)], - }, - outputLanguage: "en", - documentationMode: "routed_parallel", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with documentationMode: global_sequential using template with sections", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - }, - ], - }, - outputLanguage: "en", - documentationMode: "global_sequential", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create document with documentationMode: routed_parallel using template with sections", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: faker.helpers.arrayElement(validSectionKeys), - }, - ], - }, - outputLanguage: "en", - documentationMode: "routed_parallel", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should throw error for invalid documentationMode requests", () => { - it("should throw error when documentationMode is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - templateKey, - outputLanguage: "en", - documentationMode: "invalid_mode" as any, - }), - ).rejects.toThrow(); - }); - }); - - describe("should handle templateKey vs template mutual exclusion", () => { - it("should create document when both templateKey and template provided (templateKey takes precedence)", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - // API should accept this - templateKey takes precedence over template - const result = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - templateKey, - template: { - sectionKeys: [faker.helpers.arrayElement(validSectionKeys)], - }, - outputLanguage: "en", - } as any); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should throw error for invalid DocumentsTemplateWithSections requests", () => { - it("should throw error when sections array is empty", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [], - }, - outputLanguage: "en", - }), - ).rejects.toThrow("BadRequestError"); - }); - - it("should throw error when section key is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - {} as any, - ], - }, - outputLanguage: "en", - }), - ).rejects.toThrow(); - }); - - it("should throw error when section key is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - template: { - sections: [ - { - key: "invalid_section_key_that_does_not_exist", - }, - ], - }, - outputLanguage: "en", - }), - ).rejects.toThrow("Status code: 404"); - }); - }); - - describe("should handle errors when required parameters are missing", () => { - it("should throw error when context is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - templateKey, - outputLanguage: "en", - } as any), - ).rejects.toThrow('Missing required key "context"'); - }); - - it("should throw error when context is empty array", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [], - templateKey, - outputLanguage: "en", - }), - ).rejects.toThrow("BadRequestError"); - }); - - it("should throw error when outputLanguage is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "user", - }, - ], - }, - ], - templateKey, - } as any), - ).rejects.toThrow('Missing required key "outputLanguage"'); - }); - - it("should throw error when templateKey is missing for DocumentsCreateRequestWithTemplateKey", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "user", - }, - ], - }, - ], - outputLanguage: "en", - } as any), - ).rejects.toThrow('Missing required key "templateKey"'); - }); - - it("should throw error when text is missing in facts context", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - group: faker.helpers.arrayElement(validFactGroups), - source: "user", - }, - ], - }, - ], - templateKey, - outputLanguage: "en", - } as any), - ).rejects.toThrow('Missing required key "text"'); - }); - - it("should throw error when source is missing in facts context", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - }, - ], - }, - ], - templateKey, - outputLanguage: "en", - } as any), - ).rejects.toThrow('Missing required key "source"'); - }); - - it("should throw error when transcript text is missing in transcript context", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "transcript", - data: { - start: faker.number.int({ min: 0, max: 1000 }), - end: faker.number.int({ min: 1001, max: 5000 }), - channel: faker.number.int({ min: 0, max: 1 }), - participant: faker.number.int({ min: 0, max: 1 }), - speakerId: faker.number.int({ min: 1, max: 10 }), - }, - }, - ], - templateKey, - outputLanguage: "en", - } as any), - ).rejects.toThrow('Missing required key "text"'); - }); - - it("should throw error when string data is missing in string context", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: undefined, - }, - ], - templateKey, - outputLanguage: "en", - } as any), - ).rejects.toThrow("Expected string. Received undefined."); - }); - - it("should throw error when template is missing for DocumentsCreateRequestWithTemplate", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "user", - }, - ], - }, - ], - outputLanguage: "en", - } as any), - ).rejects.toThrow('Missing required key "template"'); - }); - - it("should throw error when context type is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "invalid_type", - data: "some data", - }, - ], - templateKey, - outputLanguage: "en", - } as any), - ).rejects.toThrow('Received "invalid_type"'); - }); - - it("should throw error when outputLanguage is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.create(interactionId, { - context: [ - { - type: "facts", - data: [ - { - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - source: "user", - }, - ], - }, - ], - templateKey, - outputLanguage: "invalid_language", - }), - ).rejects.toThrow("BadRequestError"); - }); - }); -}); \ No newline at end of file diff --git a/tests/custom/documents.delete.integration.ts b/tests/custom/documents.delete.integration.ts deleted file mode 100644 index 26e11c6e..00000000 --- a/tests/custom/documents.delete.integration.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestInteraction, createTestDocument, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.documents.delete", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - const createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - it("should successfully delete an existing document without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - const result = await cortiClient.documents.delete(interactionId, documentId); - - expect(result).toBeUndefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.documents.delete("invalid-uuid", faker.string.uuid())).rejects.toThrow( - "Status code: 400", - ); - }); - - it("should throw error when document ID is invalid format", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.documents.delete(interactionId, "invalid-uuid")).rejects.toThrow( - "Status code: 400", - ); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.documents.delete(faker.string.uuid(), faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - }); -}); diff --git a/tests/custom/documents.get.integration.ts b/tests/custom/documents.get.integration.ts deleted file mode 100644 index 8016bf0f..00000000 --- a/tests/custom/documents.get.integration.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestInteraction, createTestDocument, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.documents.get", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - const createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - it("should successfully retrieve an existing document without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - const result = await cortiClient.documents.get(interactionId, documentId); - - expect(result.id).toBe(documentId); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.documents.get("invalid-uuid", faker.string.uuid())).rejects.toThrow( - "Status code: 400", - ); - }); - - it("should throw error when document ID is invalid format", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.documents.get(interactionId, "invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.documents.get(faker.string.uuid(), faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - - it("should throw error when document ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.documents.get(interactionId, faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - }); -}); diff --git a/tests/custom/documents.list.integration.ts b/tests/custom/documents.list.integration.ts deleted file mode 100644 index 48917d88..00000000 --- a/tests/custom/documents.list.integration.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestInteraction, createTestDocument, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.documents.list", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - const createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - it("should return empty list when interaction has no documents", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.documents.list(interactionId); - - expect(result.data.length).toBe(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return documents when interaction has documents", async () => { - expect.assertions(3); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - const result = await cortiClient.documents.list(interactionId); - - expect(result.data.length).toBeGreaterThan(0); - expect(result.data.some((doc: any) => doc.id === documentId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.documents.list("invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.documents.list(faker.string.uuid())).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/documents.update.integration.ts b/tests/custom/documents.update.integration.ts deleted file mode 100644 index 0e7474bf..00000000 --- a/tests/custom/documents.update.integration.ts +++ /dev/null @@ -1,255 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - createTestDocument, - cleanupInteractions, - setupConsoleWarnSpy, - getValidSectionKeys, -} from "./testUtils"; - -describe("cortiClient.documents.update", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - let validSectionKeys: string[] = []; - - beforeAll(async () => { - cortiClient = createTestCortiClient(); - validSectionKeys = await getValidSectionKeys(cortiClient); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - describe("should update document with minimal fields", () => { - it("should update document with empty request (no changes) without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - const result = await cortiClient.documents.update(interactionId, documentId, {}); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update document with only name without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - const originalDocument = await cortiClient.documents.get(interactionId, documentId); - const originalName = originalDocument.name; - - const newName = faker.lorem.words(3); - - const result = await cortiClient.documents.update(interactionId, documentId, { - name: newName, - }); - - expect(result).toBeDefined(); - expect(result.name).toBe(newName); - expect(result.name).not.toBe(originalName); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update document with only sections without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - const sectionKey = faker.helpers.arrayElement(validSectionKeys); - - const result = await cortiClient.documents.update(interactionId, documentId, { - sections: [ - { - key: sectionKey, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.sections).toBeDefined(); - expect(result.sections.some((section) => section.key === sectionKey)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should update document with section variations", () => { - it("should update document with section containing all optional fields without errors or warnings", async () => { - expect.assertions(7); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - const originalDocument = await cortiClient.documents.get(interactionId, documentId); - - const sectionKey = faker.helpers.arrayElement(validSectionKeys); - const sectionName = faker.lorem.words(3); - const sectionText = faker.lorem.paragraphs(3); - - const result = await cortiClient.documents.update(interactionId, documentId, { - sections: [ - { - key: sectionKey, - name: sectionName, - text: sectionText, - sort: 0, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.sections).toBeDefined(); - - const updatedSection = result.sections.find((section) => section.key === sectionKey); - const originalSection = originalDocument.sections.find((section) => section.key === sectionKey); - - expect(updatedSection).toBeDefined(); - expect(updatedSection?.name).toBe(sectionName); - expect(updatedSection?.text).toBe(sectionText); - - const hasChanged = - !originalSection || - updatedSection?.name !== originalSection.name || - updatedSection?.text !== originalSection.text; - expect(hasChanged).toBe(true); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update document with empty sections array without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - const result = await cortiClient.documents.update(interactionId, documentId, { - sections: [], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - it("should update document with all possible optional parameters without errors or warnings", async () => { - expect.assertions(8); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - const originalDocument = await cortiClient.documents.get(interactionId, documentId); - const originalName = originalDocument.name; - - const newName = faker.lorem.words(4); - const sectionKey = faker.helpers.arrayElement(validSectionKeys); - const sectionName = faker.lorem.words(3); - const sectionText = faker.lorem.paragraphs(2); - - const result = await cortiClient.documents.update(interactionId, documentId, { - name: newName, - sections: [ - { - key: sectionKey, - name: sectionName, - text: sectionText, - sort: 0, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.name).toBe(newName); - expect(result.name).not.toBe(originalName); - expect(result.sections).toBeDefined(); - - const updatedSection = result.sections.find((section) => section.key === sectionKey); - expect(updatedSection).toBeDefined(); - expect(updatedSection?.name).toBe(sectionName); - expect(updatedSection?.text).toBe(sectionText); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - await expect( - cortiClient.documents.update("invalid-uuid", documentId, { - name: faker.lorem.words(3), - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when document ID is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.update(interactionId, "invalid-uuid", { - name: faker.lorem.words(3), - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - await expect( - cortiClient.documents.update(faker.string.uuid(), documentId, { - name: faker.lorem.words(3), - }), - ).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when document ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.documents.update(interactionId, faker.string.uuid(), { - name: faker.lorem.words(3), - }), - ).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when section key is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const documentId = await createTestDocument(cortiClient, interactionId); - - await expect( - cortiClient.documents.update(interactionId, documentId, { - sections: [ - { - name: faker.lorem.words(2), - text: faker.lorem.paragraph(), - }, - ], - } as any), - ).rejects.toThrow('Missing required key "key"'); - }); - }); -}); diff --git a/tests/custom/facts.batchUpdate.integration.ts b/tests/custom/facts.batchUpdate.integration.ts deleted file mode 100644 index 10b84f09..00000000 --- a/tests/custom/facts.batchUpdate.integration.ts +++ /dev/null @@ -1,372 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - createTestFacts, - cleanupInteractions, - setupConsoleWarnSpy, - getValidFactGroups, -} from "./testUtils"; - -describe("cortiClient.facts.batchUpdate", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - let validFactGroups: string[] = []; - - beforeAll(async () => { - cortiClient = createTestCortiClient(); - validFactGroups = await getValidFactGroups(cortiClient); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - describe("should batch update facts with minimal fields", () => { - it("should batch update single fact with empty request (no changes) without errors or warnings", async () => { - expect.assertions(3); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - - const result = await cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: factIds[0], - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.facts).toHaveLength(1); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should batch update single fact with only text without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const newText = faker.lorem.sentence(); - - const result = await cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: factIds[0], - text: newText, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.facts).toHaveLength(1); - expect(result.facts[0].text).toBe(newText); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should batch update single fact with only group without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const newGroup = faker.helpers.arrayElement(validFactGroups); - - const result = await cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: factIds[0], - group: newGroup, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.facts).toHaveLength(1); - expect(result.facts[0].group).toBe(newGroup); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should batch update single fact with only isDiscarded without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - - const result = await cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: factIds[0], - isDiscarded: true, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.facts).toHaveLength(1); - expect(result.facts[0].isDiscarded).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should batch update multiple facts", () => { - it("should batch update multiple facts with different fields without errors or warnings", async () => { - expect.assertions(6); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 3); - const newText1 = faker.lorem.sentence(); - const newGroup2 = faker.helpers.arrayElement(validFactGroups); - - const result = await cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: factIds[0], - text: newText1, - }, - { - factId: factIds[1], - group: newGroup2, - }, - { - factId: factIds[2], - isDiscarded: true, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.facts).toHaveLength(3); - expect(result.facts[0].text).toBe(newText1); - expect(result.facts[1].group).toBe(newGroup2); - expect(result.facts[2].isDiscarded).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should batch update multiple facts with all fields without errors or warnings", async () => { - expect.assertions(9); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 2); - const newText1 = faker.lorem.sentence(); - const newGroup1 = faker.helpers.arrayElement(validFactGroups); - const newText2 = faker.lorem.sentence(); - const newGroup2 = faker.helpers.arrayElement(validFactGroups); - - const result = await cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: factIds[0], - text: newText1, - group: newGroup1, - isDiscarded: false, - }, - { - factId: factIds[1], - text: newText2, - group: newGroup2, - isDiscarded: true, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.facts).toHaveLength(2); - expect(result.facts[0].text).toBe(newText1); - expect(result.facts[0].group).toBe(newGroup1); - expect(result.facts[0].isDiscarded).toBe(false); - expect(result.facts[1].text).toBe(newText2); - expect(result.facts[1].group).toBe(newGroup2); - expect(result.facts[1].isDiscarded).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should batch update facts with isDiscarded boolean values", () => { - it("should batch update fact with isDiscarded set to true without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - - const result = await cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: factIds[0], - isDiscarded: true, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.facts).toHaveLength(1); - expect(result.facts[0].isDiscarded).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should batch update fact with isDiscarded set to false without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - - const result = await cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: factIds[0], - isDiscarded: false, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.facts).toHaveLength(1); - expect(result.facts[0].isDiscarded).toBe(false); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - it("should batch update facts with all optional parameters without errors or warnings", async () => { - expect.assertions(7); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 2); - const newText1 = faker.lorem.sentence(); - const newGroup1 = faker.helpers.arrayElement(validFactGroups); - const newText2 = faker.lorem.sentence(); - const newGroup2 = faker.helpers.arrayElement(validFactGroups); - - const result = await cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: factIds[0], - text: newText1, - group: newGroup1, - isDiscarded: true, - }, - { - factId: factIds[1], - text: newText2, - group: newGroup2, - isDiscarded: false, - }, - ], - }); - - expect(result).toBeDefined(); - expect(result.facts).toHaveLength(2); - expect(result.facts[0].text).toBe(newText1); - expect(result.facts[0].group).toBe(newGroup1); - expect(result.facts[0].isDiscarded).toBe(true); - expect(result.facts[1].isDiscarded).toBe(false); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - - await expect( - cortiClient.facts.batchUpdate("invalid-uuid", { - facts: [ - { - factId: factIds[0], - text: faker.lorem.sentence(), - }, - ], - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when fact ID is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: "invalid-uuid", - text: faker.lorem.sentence(), - }, - ], - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - - await expect( - cortiClient.facts.batchUpdate(faker.string.uuid(), { - facts: [ - { - factId: factIds[0], - text: faker.lorem.sentence(), - }, - ], - }), - ).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when fact ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - factId: faker.string.uuid(), - text: faker.lorem.sentence(), - }, - ], - }), - ).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when facts array is empty", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.facts.batchUpdate(interactionId, { - facts: [], - }), - ).rejects.toThrow(); - }); - - it("should throw error when factId is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.facts.batchUpdate(interactionId, { - facts: [ - { - text: faker.lorem.sentence(), - }, - ], - } as any), - ).rejects.toThrow('Missing required key "factId"'); - }); - }); -}); diff --git a/tests/custom/facts.create.integration.ts b/tests/custom/facts.create.integration.ts deleted file mode 100644 index 492ccf46..00000000 --- a/tests/custom/facts.create.integration.ts +++ /dev/null @@ -1,249 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - cleanupInteractions, - setupConsoleWarnSpy, - getValidFactGroups, -} from "./testUtils"; - -describe("cortiClient.facts.create", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - let validFactGroups: string[] = []; - - beforeAll(async () => { - cortiClient = createTestCortiClient(); - validFactGroups = await getValidFactGroups(cortiClient); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - - await cleanupInteractions(cortiClient, createdInteractionIds); - - createdInteractionIds = []; - }); - - const getValidFactGroup = (): string => { - return faker.helpers.arrayElement(validFactGroups); - }; - - describe("should create facts with only required values", () => { - it("should create single fact with only required fields without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.facts.create(interactionId, { - facts: [ - { - text: faker.lorem.sentence(), - group: getValidFactGroup(), - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create multiple facts with only required fields without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.facts.create(interactionId, { - facts: [ - { - text: faker.lorem.sentence(), - group: getValidFactGroup(), - }, - { - text: faker.lorem.sentence(), - group: getValidFactGroup(), - }, - { - text: faker.lorem.sentence(), - group: getValidFactGroup(), - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should create facts with all source enum values", () => { - it('should create fact with source "core"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.facts.create(interactionId, { - facts: [ - { - text: faker.lorem.sentence(), - group: getValidFactGroup(), - source: "core", - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create fact with source "system"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.facts.create(interactionId, { - facts: [ - { - text: faker.lorem.sentence(), - group: getValidFactGroup(), - source: "system", - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create fact with source "user"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.facts.create(interactionId, { - facts: [ - { - text: faker.lorem.sentence(), - group: getValidFactGroup(), - source: "user", - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - it("should create facts with all optional parameters without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.facts.create(interactionId, { - facts: [ - { - text: faker.lorem.paragraph(), - group: getValidFactGroup(), - source: "user", - }, - { - text: faker.lorem.paragraph(), - group: getValidFactGroup(), - source: "system", - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when required fields are missing", () => { - it("should throw error when facts array is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.facts.create(interactionId, {} as any)).rejects.toThrow( - 'Missing required key "facts"', - ); - }); - - it("should throw error when facts array is empty", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.facts.create(interactionId, { facts: [] })).rejects.toThrow(); - }); - - it("should throw error when fact text is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.facts.create(interactionId, { - facts: [ - { - group: getValidFactGroup(), - } as any, - ], - }), - ).rejects.toThrow('Missing required key "text"'); - }); - - it("should throw error when fact group is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.facts.create(interactionId, { - facts: [ - { - text: faker.lorem.sentence(), - } as any, - ], - }), - ).rejects.toThrow('Missing required key "group"'); - }); - - it("should throw error when interaction ID is invalid", async () => { - expect.assertions(1); - - await expect( - cortiClient.facts.create("invalid-uuid", { - facts: [ - { - text: faker.lorem.sentence(), - group: getValidFactGroup(), - }, - ], - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect( - cortiClient.facts.create(faker.string.uuid(), { - facts: [ - { - text: faker.lorem.sentence(), - group: getValidFactGroup(), - }, - ], - }), - ).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/facts.extract.integration.ts b/tests/custom/facts.extract.integration.ts deleted file mode 100644 index 88250c53..00000000 --- a/tests/custom/facts.extract.integration.ts +++ /dev/null @@ -1,304 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.facts.extract", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - describe("should extract facts with only required values", () => { - it("should extract facts with single text context without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.facts.extract({ - context: [ - { - type: "text", - text: faker.lorem.paragraph(), - }, - ], - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - // FIXME : Temporarily skip this test until multiple contexts are supported - it.skip("should extract facts with multiple text contexts without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.facts.extract({ - context: [ - { - type: "text", - text: faker.lorem.paragraph(), - }, - { - type: "text", - text: faker.lorem.paragraph(), - }, - { - type: "text", - text: faker.lorem.paragraph(), - }, - ], - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should extract facts with different output languages", () => { - it("should extract facts with English output language without errors or warnings", async () => { - expect.assertions(3); - - const result = await cortiClient.facts.extract({ - context: [ - { - type: "text", - text: faker.lorem.paragraph(), - }, - ], - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(result.outputLanguage).toBe("en"); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should extract facts with Danish output language without errors or warnings", async () => { - expect.assertions(3); - - const result = await cortiClient.facts.extract({ - context: [ - { - type: "text", - text: faker.lorem.paragraph(), - }, - ], - outputLanguage: "da", - }); - - expect(result).toBeDefined(); - expect(result.outputLanguage).toBe("da"); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should extract facts with German output language without errors or warnings", async () => { - expect.assertions(3); - - const result = await cortiClient.facts.extract({ - context: [ - { - type: "text", - text: faker.lorem.paragraph(), - }, - ], - outputLanguage: "de", - }); - - expect(result).toBeDefined(); - expect(result.outputLanguage).toBe("de"); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should extract facts with meaningful medical text", () => { - it("should extract facts from medical context text without errors or warnings", async () => { - expect.assertions(2); - - const medicalText = - "Patient presents with chest pain, shortness of breath, and elevated blood pressure of 140/90. Patient has a history of hypertension and diabetes."; - - const result = await cortiClient.facts.extract({ - context: [ - { - type: "text", - text: medicalText, - }, - ], - outputLanguage: "en", - }); - - expect(result.facts).not.toEqual([]); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should extract facts from another medical text without errors or warnings", async () => { - expect.assertions(2); - - const medicalText = "Patient has fever of 38.5 degrees Celsius and cough for 3 days."; - - const result = await cortiClient.facts.extract({ - context: [ - { - type: "text", - text: medicalText, - }, - ], - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should extract facts with minimal text", () => { - it("should handle extraction with minimal text without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.facts.extract({ - context: [ - { - type: "text", - text: faker.lorem.word(), - }, - ], - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should extract facts with long text", () => { - it("should extract facts from long text without errors or warnings", async () => { - expect.assertions(2); - - const longText = faker.lorem.paragraphs(10); - - const result = await cortiClient.facts.extract({ - context: [ - { - type: "text", - text: longText, - }, - ], - outputLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should throw error when required parameters are missing", () => { - it("should throw error when context is missing", async () => { - expect.assertions(1); - - await expect( - cortiClient.facts.extract({ - outputLanguage: "en", - } as any), - ).rejects.toThrow('Missing required key "context"'); - }); - - it("should throw error when outputLanguage is missing", async () => { - expect.assertions(1); - - await expect( - cortiClient.facts.extract({ - context: [ - { - type: "text", - text: faker.lorem.paragraph(), - }, - ], - } as any), - ).rejects.toThrow('Missing required key "outputLanguage"'); - }); - - it("should throw error when context item is missing type", async () => { - expect.assertions(1); - - await expect( - cortiClient.facts.extract({ - context: [ - { - text: faker.lorem.paragraph(), - }, - ] as any, - outputLanguage: "en", - }), - ).rejects.toThrow(); - }); - - it("should throw error when context item is missing text", async () => { - expect.assertions(1); - - await expect( - cortiClient.facts.extract({ - context: [ - { - type: "text", - }, - ] as any, - outputLanguage: "en", - }), - ).rejects.toThrow(); - }); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when context is empty array", async () => { - expect.assertions(1); - - await expect( - cortiClient.facts.extract({ - context: [], - outputLanguage: "en", - }), - ).rejects.toThrow(); - }); - - it("should throw error when context text is empty", async () => { - expect.assertions(1); - - await expect( - cortiClient.facts.extract({ - context: [ - { - type: "text", - text: "", - }, - ], - outputLanguage: "en", - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when context item has incorrect type value", async () => { - expect.assertions(1); - - await expect( - cortiClient.facts.extract({ - context: [ - { - type: "invalid-type", - text: faker.lorem.paragraph(), - }, - ] as any, - outputLanguage: "en", - }), - ).rejects.toThrow(); - }); - }); -}); diff --git a/tests/custom/facts.factGroupsList.integration.ts b/tests/custom/facts.factGroupsList.integration.ts deleted file mode 100644 index a23a00bc..00000000 --- a/tests/custom/facts.factGroupsList.integration.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { CortiClient } from "../../src"; -import { createTestCortiClient, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.facts.factGroupsList", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - it("should successfully retrieve fact groups list without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.facts.factGroupsList(); - - expect(result.data.length).toBeGreaterThan(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); -}); diff --git a/tests/custom/facts.list.integration.ts b/tests/custom/facts.list.integration.ts deleted file mode 100644 index 87718a43..00000000 --- a/tests/custom/facts.list.integration.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestInteraction, createTestFacts, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.facts.list", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - const createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - it("should return empty list when interaction has no facts", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.facts.list(interactionId); - - expect(result.facts.length).toBe(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return facts when interaction has facts", async () => { - expect.assertions(3); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.list(interactionId); - - expect(result.facts.length).toBeGreaterThan(0); - expect(result.facts.some((fact: any) => fact.id === factId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.facts.list("invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.facts.list(faker.string.uuid())).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/facts.update.integration.ts b/tests/custom/facts.update.integration.ts deleted file mode 100644 index 51b11092..00000000 --- a/tests/custom/facts.update.integration.ts +++ /dev/null @@ -1,248 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - createTestFacts, - cleanupInteractions, - setupConsoleWarnSpy, - getValidFactGroups, -} from "./testUtils"; - -describe("cortiClient.facts.update", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - let validFactGroups: string[] = []; - - beforeAll(async () => { - cortiClient = createTestCortiClient(); - validFactGroups = await getValidFactGroups(cortiClient); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - const getValidFactGroup = (): string => { - return faker.helpers.arrayElement(validFactGroups); - }; - - describe("should update fact with minimal fields", () => { - it("should update fact with empty request (no changes) without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.update(interactionId, factId, {}); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update fact with only text without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.update(interactionId, factId, { - text: faker.lorem.sentence(), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update fact with only group without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.update(interactionId, factId, { - group: getValidFactGroup(), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update fact with only isDiscarded without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.update(interactionId, factId, { - isDiscarded: true, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should update fact with all source enum values", () => { - it('should update fact with source "core"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.update(interactionId, factId, { - source: "core", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update fact with source "system"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.update(interactionId, factId, { - source: "system", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update fact with source "user"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.update(interactionId, factId, { - source: "user", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should update fact with isDiscarded boolean values", () => { - it("should update fact with isDiscarded set to true without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.update(interactionId, factId, { - isDiscarded: true, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update fact with isDiscarded set to false without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.update(interactionId, factId, { - isDiscarded: false, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - it("should update fact with all optional parameters without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - const result = await cortiClient.facts.update(interactionId, factId, { - text: faker.lorem.sentence(), - group: getValidFactGroup(), - source: "user", - isDiscarded: faker.datatype.boolean(), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - await expect( - cortiClient.facts.update("invalid-uuid", factId, { - text: faker.lorem.sentence(), - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when fact ID is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.facts.update(interactionId, "invalid-uuid", { - text: faker.lorem.sentence(), - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const factIds = await createTestFacts(cortiClient, interactionId, 1); - const factId = factIds[0]; - - await expect( - cortiClient.facts.update(faker.string.uuid(), factId, { - text: faker.lorem.sentence(), - }), - ).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when fact ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.facts.update(interactionId, faker.string.uuid(), { - text: faker.lorem.sentence(), - }), - ).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/interactions.create.integration.ts b/tests/custom/interactions.create.integration.ts deleted file mode 100644 index a5a0bed5..00000000 --- a/tests/custom/interactions.create.integration.ts +++ /dev/null @@ -1,440 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, cleanupInteractions, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.interactions.create", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - describe("should create interaction with only required values", () => { - it("should create interaction with only encounter required fields without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "first_consultation", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create interaction with patient having only required identifier without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "first_consultation", - }, - patient: { - identifier: faker.string.alphanumeric(15), - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should create interaction with all status enum values", () => { - it('should create interaction with status "planned"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "first_consultation", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with status "in-progress"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "in-progress", - type: "first_consultation", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with status "on-hold"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "on-hold", - type: "first_consultation", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with status "completed"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "completed", - type: "first_consultation", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with status "cancelled"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "cancelled", - type: "first_consultation", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with status "deleted"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "deleted", - type: "first_consultation", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should create interaction with all type enum values", () => { - it('should create interaction with type "first_consultation"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "first_consultation", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with type "consultation"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "consultation", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with type "emergency"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "emergency", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with type "inpatient"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "inpatient", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with type "outpatient"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "outpatient", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should create interaction with all gender enum values", () => { - it('should create interaction with gender "male"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "first_consultation", - }, - patient: { - identifier: faker.string.alphanumeric(15), - gender: "male", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with gender "female"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "first_consultation", - }, - patient: { - identifier: faker.string.alphanumeric(15), - gender: "female", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with gender "unknown"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "first_consultation", - }, - patient: { - identifier: faker.string.alphanumeric(15), - gender: "unknown", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create interaction with gender "other"', async () => { - expect.assertions(2); - - const result = await cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "first_consultation", - }, - patient: { - identifier: faker.string.alphanumeric(15), - gender: "other", - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - it("should create interaction with all optional parameters without errors or warnings", async () => { - expect.assertions(2); - - const startDate = faker.date.recent(); - const endDate = faker.date.future({ refDate: startDate }); - const birthDate = faker.date.birthdate({ min: 18, max: 100, mode: "age" }); - - const result = await cortiClient.interactions.create({ - assignedUserId: faker.string.uuid(), - encounter: { - identifier: faker.string.alphanumeric(20), - status: "in-progress", - type: "consultation", - title: faker.lorem.sentence(), - period: { - startedAt: startDate, - endedAt: endDate, - }, - }, - patient: { - identifier: faker.string.alphanumeric(15), - name: faker.person.fullName(), - gender: "male", - birthDate: birthDate, - pronouns: faker.helpers.arrayElement(["he/him", "she/her", "they/them"]), - }, - }); - - createdInteractionIds.push(result.interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when required fields are missing", () => { - it("should throw error when encounter is missing", async () => { - expect.assertions(1); - - await expect(cortiClient.interactions.create({} as any)).rejects.toThrow( - 'Missing required key "encounter"', - ); - }); - - it("should throw error when encounter.identifier is missing", async () => { - expect.assertions(1); - - await expect( - cortiClient.interactions.create({ - encounter: { - status: "planned", - type: "first_consultation", - } as any, - }), - ).rejects.toThrow('Missing required key "identifier"'); - }); - - it("should throw error when encounter.status is missing", async () => { - expect.assertions(1); - - await expect( - cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - type: "first_consultation", - } as any, - }), - ).rejects.toThrow('Missing required key "status"'); - }); - - it("should throw error when encounter.type is missing", async () => { - expect.assertions(1); - - await expect( - cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - } as any, - }), - ).rejects.toThrow('Missing required key "type"'); - }); - - it("should throw error when patient.identifier is missing", async () => { - expect.assertions(1); - - await expect( - cortiClient.interactions.create({ - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "first_consultation", - }, - patient: { - name: faker.person.fullName(), - } as any, - }), - ).rejects.toThrow('Missing required key "identifier"'); - }); - }); -}); diff --git a/tests/custom/interactions.delete.integration.ts b/tests/custom/interactions.delete.integration.ts deleted file mode 100644 index fda80fc5..00000000 --- a/tests/custom/interactions.delete.integration.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestInteraction, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.interactions.delete", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - it("should successfully delete an existing interaction without errors or warnings", async () => { - expect.assertions(2); - - const createdInteractionIds: string[] = []; - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.delete(interactionId); - - expect(result).toBeUndefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.interactions.delete("invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.interactions.delete(faker.string.uuid())).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/interactions.get.integration.ts b/tests/custom/interactions.get.integration.ts deleted file mode 100644 index 89a118c3..00000000 --- a/tests/custom/interactions.get.integration.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestInteraction, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.interactions.get", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - const createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - it("should successfully retrieve an existing interaction without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.get(interactionId); - - expect(result.id).toBe(interactionId); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.interactions.get("invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.interactions.get(faker.string.uuid())).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/interactions.list.integration.ts b/tests/custom/interactions.list.integration.ts deleted file mode 100644 index abd7f088..00000000 --- a/tests/custom/interactions.list.integration.ts +++ /dev/null @@ -1,684 +0,0 @@ -import { CortiClient } from "../../src"; -import { createTestCortiClient, setupConsoleWarnSpy, cleanupInteractions, createTestInteraction } from "./testUtils"; -import { faker } from "@faker-js/faker"; - -describe("cortiClient.interactions.list", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - const createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds.length = 0; - }); - - describe("should list interactions with only required values", () => { - it("should return empty result when no interactions exist", async () => { - expect.assertions(3); - - const response = await cortiClient.interactions.list(); - const interactionIds: string[] = []; - - for await (const interaction of response) { - interactionIds.push(interaction.id); - } - - if (interactionIds.length > 0) { - await cleanupInteractions(cortiClient, interactionIds); - } - - const result = await cortiClient.interactions.list(); - - expect(result.data).toEqual([]); - expect(result.hasNextPage()).toBe(false); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return interactions when they exist without errors or warnings", async () => { - expect.assertions(4); - - const interactionId1 = await createTestInteraction(cortiClient, createdInteractionIds); - const interactionId2 = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.list(); - - expect(result.data.length).toBeGreaterThanOrEqual(2); - expect(result.data.some((interaction) => interaction.id === interactionId1)).toBe(true); - expect(result.data.some((interaction) => interaction.id === interactionId2)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("filtering by patient", () => { - it("should return only interactions for specified patient", async () => { - expect.assertions(5); - - const patient1Id = faker.string.alphanumeric(15); - const patient2Id = faker.string.alphanumeric(15); - const patient3Id = faker.string.alphanumeric(15); - - const interaction1Id = await createTestInteraction(cortiClient, createdInteractionIds, { - patient: { identifier: patient1Id }, - }); - - const interaction2Id = await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { type: "consultation" }, - patient: { identifier: patient1Id }, - }); - - await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { type: "outpatient" }, - patient: { identifier: patient2Id }, - }); - - await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "in-progress", type: "emergency" }, - patient: { identifier: patient3Id }, - }); - - const result = await cortiClient.interactions.list({ patient: patient1Id }); - - expect(result.data.length).toBe(2); - expect(result.data.every((interaction) => interaction.patient?.identifier === patient1Id)).toBe(true); - expect(result.data.some((interaction) => interaction.id === interaction1Id)).toBe(true); - expect(result.data.some((interaction) => interaction.id === interaction2Id)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return empty result for non-existent patient", async () => { - expect.assertions(3); - - await createTestInteraction(cortiClient, createdInteractionIds, { - patient: { identifier: faker.string.alphanumeric(15) }, - }); - - await createTestInteraction(cortiClient, createdInteractionIds, { - patient: { identifier: faker.string.alphanumeric(15) }, - }); - - const nonExistentPatientId = faker.string.alphanumeric(15); - const result = await cortiClient.interactions.list({ patient: nonExistentPatientId }); - - expect(result.data).toEqual([]); - expect(result.data.length).toBe(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("filtering by encounterStatus", () => { - it("should filter by single encounterStatus string", async () => { - expect.assertions(4); - - const plannedId = await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "planned" }, - }); - - await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "in-progress" }, - }); - - await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "completed" }, - }); - - const result = await cortiClient.interactions.list({ encounterStatus: "planned" }); - - expect(result.data.length).toBeGreaterThanOrEqual(1); - expect(result.data.every((interaction) => interaction.encounter?.status === "planned")).toBe(true); - expect(result.data.some((interaction) => interaction.id === plannedId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - // FIXME Doesn't work on API side https://linear.app/corti/issue/TGT-399/fix-db-code-to-accept-multiple-params-as-per-spec - it.skip("should filter by multiple encounterStatus array", async () => { - expect.assertions(5); - - const plannedId = await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "planned" }, - }); - - const inProgressId = await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "in-progress" }, - }); - - await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "completed" }, - }); - - await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "cancelled" }, - }); - - const result = await cortiClient.interactions.list({ - encounterStatus: ["planned", "in-progress"], - }); - - expect(result.data.length).toBeGreaterThanOrEqual(2); - expect( - result.data.every((interaction) => - ["planned", "in-progress"].includes(interaction.encounter?.status || ""), - ), - ).toBe(true); - expect(result.data.some((interaction) => interaction.id === plannedId)).toBe(true); - expect(result.data.some((interaction) => interaction.id === inProgressId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should find interactions for all valid status enum values", () => { - it("should find planned interactions", async () => { - expect.assertions(3); - - const plannedId = await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "planned" }, - }); - - const result = await cortiClient.interactions.list({ encounterStatus: "planned" }); - - expect(result.data.length).toBeGreaterThanOrEqual(1); - expect(result.data.some((interaction) => interaction.id === plannedId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should find in-progress interactions", async () => { - expect.assertions(3); - - const inProgressId = await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "in-progress" }, - }); - - const result = await cortiClient.interactions.list({ encounterStatus: "in-progress" }); - - expect(result.data.length).toBeGreaterThanOrEqual(1); - expect(result.data.some((interaction) => interaction.id === inProgressId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should find on-hold interactions", async () => { - expect.assertions(3); - - const onHoldId = await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "on-hold" }, - }); - - const result = await cortiClient.interactions.list({ encounterStatus: "on-hold" }); - - expect(result.data.length).toBeGreaterThanOrEqual(1); - expect(result.data.some((interaction) => interaction.id === onHoldId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should find completed interactions", async () => { - expect.assertions(3); - - const completedId = await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "completed" }, - }); - - const result = await cortiClient.interactions.list({ encounterStatus: "completed" }); - - expect(result.data.length).toBeGreaterThanOrEqual(1); - expect(result.data.some((interaction) => interaction.id === completedId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should find cancelled interactions", async () => { - expect.assertions(3); - - const cancelledId = await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "cancelled" }, - }); - - const result = await cortiClient.interactions.list({ encounterStatus: "cancelled" }); - - expect(result.data.length).toBeGreaterThanOrEqual(1); - expect(result.data.some((interaction) => interaction.id === cancelledId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should find deleted interactions", async () => { - expect.assertions(3); - - const deletedId = await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "deleted" }, - }); - - const result = await cortiClient.interactions.list({ encounterStatus: "deleted" }); - - expect(result.data.length).toBeGreaterThanOrEqual(1); - expect(result.data.some((interaction) => interaction.id === deletedId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error for invalid encounterStatus", async () => { - expect.assertions(1); - - await createTestInteraction(cortiClient, createdInteractionIds, { - encounter: { status: "planned" }, - }); - - await expect( - cortiClient.interactions.list({ - encounterStatus: "non-existent-status" as any, - }), - ).rejects.toThrow('Expected enum. Received "non-existent-status".'); - }); - }); - - describe("sorting", () => { - it("should sort by default (createdAt desc) when no sort parameters provided", async () => { - expect.assertions(3); - - const firstId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const secondId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const thirdId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.list(); - - const ourInteractions = result.data.filter((interaction) => - [firstId, secondId, thirdId].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(3); - expect(ourInteractions[0].id).toBe(thirdId); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("sort by createdAt", () => { - it("should sort by createdAt desc", async () => { - expect.assertions(4); - - const firstId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const secondId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const thirdId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.list({ - sort: "createdAt", - direction: "desc", - }); - - const ourInteractions = result.data.filter((interaction) => - [firstId, secondId, thirdId].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(3); - expect(ourInteractions[0].id).toBe(thirdId); - expect(ourInteractions[2].id).toBe(firstId); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should sort by createdAt asc", async () => { - expect.assertions(4); - - const firstId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const secondId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const thirdId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.list({ - sort: "createdAt", - direction: "asc", - }); - - const ourInteractions = result.data.filter((interaction) => - [firstId, secondId, thirdId].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(3); - expect(ourInteractions[0].id).toBe(firstId); - expect(ourInteractions[2].id).toBe(thirdId); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should sort by createdAt with default direction (desc) when direction not specified", async () => { - expect.assertions(3); - - const firstId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const secondId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.list({ sort: "createdAt" }); - - const ourInteractions = result.data.filter((interaction) => - [firstId, secondId].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(2); - expect(ourInteractions[0].id).toBe(secondId); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("sort by updatedAt", () => { - it("should sort by updatedAt desc", async () => { - expect.assertions(4); - - const firstId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const secondId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const thirdId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.list({ - sort: "updatedAt", - direction: "desc", - }); - - const ourInteractions = result.data.filter((interaction) => - [firstId, secondId, thirdId].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(3); - expect(ourInteractions[0].id).toBe(thirdId); - expect(ourInteractions[2].id).toBe(firstId); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should sort by updatedAt asc", async () => { - expect.assertions(4); - - const firstId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const secondId = await createTestInteraction(cortiClient, createdInteractionIds); - await new Promise((resolve) => setTimeout(resolve, 100)); - - const thirdId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.list({ - sort: "updatedAt", - direction: "asc", - }); - - const ourInteractions = result.data.filter((interaction) => - [firstId, secondId, thirdId].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(3); - expect(ourInteractions[0].id).toBe(firstId); - expect(ourInteractions[2].id).toBe(thirdId); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("sort by id", () => { - it("should sort by id desc", async () => { - expect.assertions(4); - - const firstId = await createTestInteraction(cortiClient, createdInteractionIds); - const secondId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.list({ - sort: "id", - direction: "desc", - }); - - const ourInteractions = result.data.filter((interaction) => - [firstId, secondId].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(2); - const expectedFirst = firstId > secondId ? firstId : secondId; - const expectedSecond = firstId === expectedFirst ? secondId : firstId; - expect(ourInteractions[0].id).toBe(expectedFirst); - expect(ourInteractions[1].id).toBe(expectedSecond); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should sort by id asc", async () => { - expect.assertions(4); - - const firstId = await createTestInteraction(cortiClient, createdInteractionIds); - const secondId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.list({ - sort: "id", - direction: "asc", - }); - - const ourInteractions = result.data.filter((interaction) => - [firstId, secondId].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(2); - const expectedFirst = firstId < secondId ? firstId : secondId; - const expectedSecond = firstId === expectedFirst ? secondId : firstId; - expect(ourInteractions[0].id).toBe(expectedFirst); - expect(ourInteractions[1].id).toBe(expectedSecond); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("sort by assignedUserId", () => { - it("should sort by assignedUserId desc", async () => { - expect.assertions(4); - - const userA = faker.string.uuid(); - const userB = faker.string.uuid(); - - const interactionA = await createTestInteraction(cortiClient, createdInteractionIds, { - assignedUserId: userA, - }); - - const interactionB = await createTestInteraction(cortiClient, createdInteractionIds, { - assignedUserId: userB, - }); - - const result = await cortiClient.interactions.list({ - sort: "assignedUserId", - direction: "desc", - }); - - const ourInteractions = result.data.filter((interaction) => - [interactionA, interactionB].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(2); - const expectedFirst = userA > userB ? userA : userB; - const expectedSecond = userA === expectedFirst ? userB : userA; - expect(ourInteractions[0].assignedUserId).toBe(expectedFirst); - expect(ourInteractions[1].assignedUserId).toBe(expectedSecond); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should sort by assignedUserId asc", async () => { - expect.assertions(4); - - const userA = faker.string.uuid(); - const userB = faker.string.uuid(); - - const interactionA = await createTestInteraction(cortiClient, createdInteractionIds, { - assignedUserId: userA, - }); - - const interactionB = await createTestInteraction(cortiClient, createdInteractionIds, { - assignedUserId: userB, - }); - - const result = await cortiClient.interactions.list({ - sort: "assignedUserId", - direction: "asc", - }); - - const ourInteractions = result.data.filter((interaction) => - [interactionA, interactionB].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(2); - const expectedFirst = userA < userB ? userA : userB; - const expectedSecond = userA === expectedFirst ? userB : userA; - expect(ourInteractions[0].assignedUserId).toBe(expectedFirst); - expect(ourInteractions[1].assignedUserId).toBe(expectedSecond); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - // FIXME Should work, but return different results every time - describe.skip("sort by patient", () => { - it("should sort by patient desc", async () => { - expect.assertions(4); - - const patientA = "a-" + faker.string.alphanumeric(15); - const patientB = "b-" + faker.string.alphanumeric(15); - - const interactionA = await createTestInteraction(cortiClient, createdInteractionIds, { - patient: { identifier: patientA }, - }); - - const interactionB = await createTestInteraction(cortiClient, createdInteractionIds, { - patient: { identifier: patientB }, - }); - - const result = await cortiClient.interactions.list({ - sort: "patient", - direction: "desc", - }); - - const ourInteractions = result.data.filter((interaction) => - [interactionA, interactionB].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(2); - - const expectedFirst = patientA > patientB ? patientA : patientB; - const expectedSecond = patientA === expectedFirst ? patientB : patientA; - - expect(ourInteractions[0].patient?.identifier).toBe(expectedFirst); - expect(ourInteractions[1].patient?.identifier).toBe(expectedSecond); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should sort by patient asc", async () => { - expect.assertions(4); - - const patientA = "a-" + faker.string.alphanumeric(15); - const patientB = "b-" + faker.string.alphanumeric(15); - - const interactionA = await createTestInteraction(cortiClient, createdInteractionIds, { - patient: { identifier: patientA }, - }); - - const interactionB = await createTestInteraction(cortiClient, createdInteractionIds, { - patient: { identifier: patientB }, - }); - - const result = await cortiClient.interactions.list({ - sort: "patient", - direction: "asc", - }); - - const ourInteractions = result.data.filter((interaction) => - [interactionA, interactionB].includes(interaction.id), - ); - - expect(ourInteractions.length).toBe(2); - - const expectedFirst = patientA < patientB ? patientA : patientB; - const expectedSecond = patientA === expectedFirst ? patientB : patientA; - - expect(ourInteractions[0].patient?.identifier).toBe(expectedFirst); - expect(ourInteractions[1].patient?.identifier).toBe(expectedSecond); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - }); - - describe("pagination", () => { - it("should iterate through all interactions using async iterator", async () => { - expect.assertions(4); - - const createdIds: string[] = []; - for (let i = 0; i < 15; i++) { - const id = await createTestInteraction(cortiClient, createdInteractionIds); - createdIds.push(id); - } - - const response = await cortiClient.interactions.list({ pageSize: 5 }); - const collectedInteractions: string[] = []; - - expect(response.data.length).toBeLessThanOrEqual(5); - - for await (const interaction of response) { - if (createdIds.includes(interaction.id)) { - collectedInteractions.push(interaction.id); - } - } - - expect(collectedInteractions.length).toBe(15); - expect(createdIds.every((id) => collectedInteractions.includes(id))).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should iterate through pages manually using hasNextPage and getNextPage", async () => { - expect.assertions(4); - - const createdIds: string[] = []; - for (let i = 0; i < 12; i++) { - const id = await createTestInteraction(cortiClient, createdInteractionIds); - createdIds.push(id); - } - - let page = await cortiClient.interactions.list({ pageSize: 4 }); - const collectedInteractions: string[] = []; - - expect(page.data.length).toBeLessThanOrEqual(4); - - page.data.forEach((interaction) => { - if (createdIds.includes(interaction.id)) { - collectedInteractions.push(interaction.id); - } - }); - - while (page.hasNextPage()) { - page = await page.getNextPage(); - page.data.forEach((interaction) => { - if (createdIds.includes(interaction.id)) { - collectedInteractions.push(interaction.id); - } - }); - } - - expect(collectedInteractions.length).toBe(12); - expect(createdIds.every((id) => collectedInteractions.includes(id))).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should use default pageSize when not specified", async () => { - expect.assertions(2); - - for (let i = 0; i < 5; i++) { - await createTestInteraction(cortiClient, createdInteractionIds); - } - - const result = await cortiClient.interactions.list(); - - expect(result.data.length).toBeLessThanOrEqual(10); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); -}); diff --git a/tests/custom/interactions.update.integration.ts b/tests/custom/interactions.update.integration.ts deleted file mode 100644 index 64e81dad..00000000 --- a/tests/custom/interactions.update.integration.ts +++ /dev/null @@ -1,370 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, createTestInteraction, cleanupInteractions, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.interactions.update", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - describe("should update interaction with minimal fields", () => { - it("should update interaction with empty request (no changes) without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, {}); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update interaction with only assignedUserId without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - assignedUserId: faker.string.uuid(), - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update interaction with only encounter identifier without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - identifier: faker.string.alphanumeric(20), - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should update interaction with only patient identifier without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - patient: { - identifier: faker.string.alphanumeric(15), - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should update interaction with all status enum values", () => { - it('should update interaction with status "planned"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - status: "planned", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with status "in-progress"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - status: "in-progress", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with status "on-hold"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - status: "on-hold", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with status "completed"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - status: "completed", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with status "cancelled"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - status: "cancelled", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with status "deleted"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - status: "deleted", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should update interaction with all type enum values", () => { - it('should update interaction with type "first_consultation"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - type: "first_consultation", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with type "consultation"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - type: "consultation", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with type "emergency"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - type: "emergency", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with type "inpatient"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - type: "inpatient", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with type "outpatient"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - encounter: { - type: "outpatient", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should update interaction with all gender enum values", () => { - it('should update interaction with gender "male"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - patient: { - identifier: faker.string.alphanumeric(15), - gender: "male", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with gender "female"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - patient: { - identifier: faker.string.alphanumeric(15), - gender: "female", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with gender "unknown"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - patient: { - identifier: faker.string.alphanumeric(15), - gender: "unknown", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should update interaction with gender "other"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.interactions.update(interactionId, { - patient: { - identifier: faker.string.alphanumeric(15), - gender: "other", - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - it("should update interaction with all optional parameters without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const startDate = faker.date.recent(); - const endDate = faker.date.future({ refDate: startDate }); - const birthDate = faker.date.birthdate({ min: 18, max: 100, mode: "age" }); - - const result = await cortiClient.interactions.update(interactionId, { - assignedUserId: faker.string.uuid(), - encounter: { - identifier: faker.string.alphanumeric(20), - status: "in-progress", - type: "consultation", - title: faker.lorem.sentence(), - period: { - startedAt: startDate, - endedAt: endDate, - }, - }, - patient: { - identifier: faker.string.alphanumeric(15), - name: faker.person.fullName(), - gender: "male", - birthDate: birthDate, - pronouns: faker.helpers.arrayElement(["he/him", "she/her", "they/them"]), - }, - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid", async () => { - expect.assertions(1); - - await expect( - cortiClient.interactions.update("invalid-uuid", { - assignedUserId: faker.string.uuid(), - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect( - cortiClient.interactions.update(faker.string.uuid(), { - assignedUserId: faker.string.uuid(), - }), - ).rejects.toThrow("Status code: 404"); - }); - }); -}); diff --git a/tests/custom/recordings.delete.integration.ts b/tests/custom/recordings.delete.integration.ts deleted file mode 100644 index 9123bd5d..00000000 --- a/tests/custom/recordings.delete.integration.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - createTestRecording, - setupConsoleWarnSpy, - cleanupInteractions, -} from "./testUtils"; - -describe("cortiClient.recordings.delete", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - const createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds.length = 0; - }); - - it("should successfully delete an existing recording without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const result = await cortiClient.recordings.delete(interactionId, recordingId); - - expect(result).toBeUndefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should not throw error when recording ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.recordings.delete(interactionId, faker.string.uuid())).resolves.toBe(undefined); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.delete("invalid-uuid", faker.string.uuid())).rejects.toThrow( - "Status code: 400", - ); - }); - - it("should throw error when recording ID is invalid format", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.recordings.delete(interactionId, "invalid-uuid")).rejects.toThrow( - "Status code: 400", - ); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.delete(faker.string.uuid(), faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - - it("should throw error when interaction ID is null", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.delete(null as any, faker.string.uuid())).rejects.toThrow( - "Expected string. Received null.", - ); - }); - - it("should throw error when recording ID is null", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.recordings.delete(interactionId, null as any)).rejects.toThrow( - "Expected string. Received null.", - ); - }); - - it("should throw error when interaction ID is undefined", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.delete(undefined as any, faker.string.uuid())).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - - it("should throw error when recording ID is undefined", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.recordings.delete(interactionId, undefined as any)).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - }); -}); diff --git a/tests/custom/recordings.get.integration.ts b/tests/custom/recordings.get.integration.ts deleted file mode 100644 index f5b92697..00000000 --- a/tests/custom/recordings.get.integration.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createReadStream, readFileSync, createWriteStream } from "fs"; -import { Readable } from "stream"; -import { - createTestCortiClient, - createTestInteraction, - createTestRecording, - cleanupInteractions, - setupConsoleWarnSpy, -} from "./testUtils"; - -describe("cortiClient.recordings.get", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - describe("should get recording from server-side", () => { - it("should get recording using stream() method without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const getResponse = await cortiClient.recordings.get(interactionId, recordingId); - - expect(getResponse).toBeDefined(); - expect(getResponse.bodyUsed).toBe(false); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - - const webStream = getResponse.stream() as ReadableStream; - expect(webStream).toBeInstanceOf(ReadableStream); - }); - - it("should get recording using blob() method without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const getResponse = await cortiClient.recordings.get(interactionId, recordingId); - - expect(getResponse).toBeDefined(); - expect(getResponse.bodyUsed).toBe(false); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - - const blob = await getResponse.blob(); - expect(blob).toBeInstanceOf(Blob); - }); - - it("should get recording using arrayBuffer() method without errors or warnings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const getResponse = await cortiClient.recordings.get(interactionId, recordingId); - - expect(getResponse).toBeDefined(); - expect(getResponse.bodyUsed).toBe(false); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - - const arrayBuffer = await getResponse.arrayBuffer(); - expect(arrayBuffer).toBeInstanceOf(ArrayBuffer); - }); - - it("should verify downloaded file is not corrupted", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const getResponse = await cortiClient.recordings.get(interactionId, recordingId); - - const originalFileBuffer = readFileSync("tests/custom/trouble-breathing.mp3"); - const originalSize = originalFileBuffer.length; - - const downloadedArrayBuffer = await getResponse.arrayBuffer(); - const downloadedSize = downloadedArrayBuffer.byteLength; - - expect(getResponse).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - expect(downloadedSize).toBe(originalSize); - expect(downloadedSize).toBeGreaterThan(0); - }); - }); - - describe("should handle get errors", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.get("invalid-uuid", faker.string.uuid())).rejects.toThrow( - "Status code: 400", - ); - }); - - it("should throw error when recording ID is invalid format", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.recordings.get(interactionId, "invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.get(faker.string.uuid(), faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - - it("should throw error when recording ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.recordings.get(interactionId, faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - - it("should throw error when interaction ID is null", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.get(null as any, faker.string.uuid())).rejects.toThrow( - "Expected string. Received null.", - ); - }); - - it("should throw error when recording ID is null", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.recordings.get(interactionId, null as any)).rejects.toThrow( - "Expected string. Received null.", - ); - }); - - it("should throw error when interaction ID is undefined", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.get(undefined as any, faker.string.uuid())).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - - it("should throw error when recording ID is undefined", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.recordings.get(interactionId, undefined as any)).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - }); -}); diff --git a/tests/custom/recordings.list.integration.ts b/tests/custom/recordings.list.integration.ts deleted file mode 100644 index 0f0d881e..00000000 --- a/tests/custom/recordings.list.integration.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - createTestRecording, - setupConsoleWarnSpy, - cleanupInteractions, -} from "./testUtils"; - -describe("cortiClient.recordings.list", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - const createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds.length = 0; - }); - - it("should return empty list when interaction has no recordings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.recordings.list(interactionId); - - expect(result.recordings.length).toBe(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return recordings when interaction has recordings", async () => { - expect.assertions(3); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const result = await cortiClient.recordings.list(interactionId); - - expect(result.recordings.length).toBeGreaterThan(0); - expect(result.recordings.includes(recordingId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return multiple recordings when interaction has multiple recordings", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId1 = await createTestRecording(cortiClient, interactionId); - const recordingId2 = await createTestRecording(cortiClient, interactionId); - - const result = await cortiClient.recordings.list(interactionId); - - expect(result.recordings.length).toBeGreaterThanOrEqual(2); - expect(result.recordings.includes(recordingId1)).toBe(true); - expect(result.recordings.includes(recordingId2)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.list("invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.list(faker.string.uuid())).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when interaction ID is null", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.list(null as any)).rejects.toThrow("Expected string. Received null."); - }); - - it("should throw error when interaction ID is undefined", async () => { - expect.assertions(1); - - await expect(cortiClient.recordings.list(undefined as any)).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - }); -}); diff --git a/tests/custom/recordings.upload.integration.ts b/tests/custom/recordings.upload.integration.ts deleted file mode 100644 index cd2b39d8..00000000 --- a/tests/custom/recordings.upload.integration.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createReadStream, readFileSync } from "fs"; -import { createTestCortiClient, createTestInteraction, cleanupInteractions, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.recordings.upload", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - describe("should upload recording from server-side file stream", () => { - it("should upload trouble-breathing.mp3 using createReadStream without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const file = createReadStream("tests/custom/trouble-breathing.mp3", { - autoClose: true, - }); - - const result = await cortiClient.recordings.upload(file, interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should upload trouble-breathing.mp3 using File object without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const fileBuffer = readFileSync("tests/custom/trouble-breathing.mp3"); - - // Create a File object (simulating browser environment) - const file = new File([fileBuffer], "trouble-breathing.mp3", { - type: "audio/mpeg", - }); - - const result = await cortiClient.recordings.upload(file, interactionId); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should handle upload errors", () => { - it("should throw error when uploading to non-existent interaction", async () => { - expect.assertions(1); - - const nonExistentInteractionId = faker.string.uuid(); - const file = createReadStream("tests/custom/trouble-breathing.mp3", { - autoClose: true, - }); - - await expect(cortiClient.recordings.upload(file, nonExistentInteractionId)).rejects.toThrow( - "Status code: 404", - ); - }); - - it("should throw error when uploading with invalid interaction ID format", async () => { - expect.assertions(1); - - const invalidInteractionId = "invalid-uuid-format"; - const file = createReadStream("tests/custom/trouble-breathing.mp3", { - autoClose: true, - }); - - await expect(cortiClient.recordings.upload(file, invalidInteractionId)).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when uploading with null interaction ID", async () => { - expect.assertions(1); - - const file = createReadStream("tests/custom/trouble-breathing.mp3", { - autoClose: true, - }); - - await expect(cortiClient.recordings.upload(file, null as any)).rejects.toThrow( - "Expected string. Received null.", - ); - }); - - it("should throw error when uploading with undefined interaction ID", async () => { - expect.assertions(1); - - const file = createReadStream("tests/custom/trouble-breathing.mp3", { - autoClose: true, - }); - - await expect(cortiClient.recordings.upload(file, undefined as any)).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - }); -}); diff --git a/tests/custom/stream.connect.integration.ts b/tests/custom/stream.connect.integration.ts deleted file mode 100644 index 8bc14a10..00000000 --- a/tests/custom/stream.connect.integration.ts +++ /dev/null @@ -1,569 +0,0 @@ -import { CortiClient } from "../../src/custom/CortiClient"; -import { faker } from "@faker-js/faker"; -import fs from "fs"; -import path from "path"; -import { - createTestCortiClient, - createTestInteraction, - cleanupInteractions, - setupConsoleWarnSpy, - waitForWebSocketMessage, -} from "./testUtils"; - -describe("cortiClient.stream.connect", () => { - let cortiClient: CortiClient; - let createdInteractionIds: string[]; - let consoleWarnSpy: jest.SpyInstance; - let activeSockets: any[] = []; - - beforeAll(async () => { - cortiClient = createTestCortiClient(); - createdInteractionIds = []; - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - activeSockets = []; - }); - - afterEach(async () => { - // Close all active sockets to ensure cleanup - activeSockets.forEach((socket) => { - if (socket && typeof socket.close === "function") { - try { - socket.close(); - } catch (error) { - // Ignore errors during cleanup - } - } - }); - activeSockets = []; - - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - describe("should connect with minimal configuration", () => { - // FIXME Mismatch with types: outputLocale is optional in FactsModeConfig but required in fact - it.skip("should connect with minimal configuration passed to connect", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "en", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "doctor", - }, - ], - }, - mode: { - type: "facts", - }, - }, - }); - activeSockets.push(streamSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { messages, rejectOnWrongMessage: true }); - - expect(streamSocket).toBeDefined(); - expect(streamSocket.socket).toBeDefined(); - expect(streamSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - // FIXME Mismatch with types: outputLocale is optional in FactsModeConfig but required in fact - it.skip("should connect and send configuration manually on open event", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - }); - activeSockets.push(streamSocket); - - streamSocket.on("open", () => { - streamSocket.sendConfiguration({ - type: "config", - configuration: { - transcription: { - primaryLanguage: "en", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "doctor", - }, - ], - }, - mode: { - type: "facts", - }, - }, - }); - }); - - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { rejectOnWrongMessage: true }); - - expect(streamSocket).toBeDefined(); - expect(streamSocket.socket).toBeDefined(); - expect(streamSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should connect with full configuration", () => { - it("should connect with full configuration passed to connect", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "en", - isDiarization: true, - isMultichannel: true, - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "doctor", - }, - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "patient", - }, - ], - }, - mode: { - type: "facts", - outputLocale: "en", - }, - }, - }); - activeSockets.push(streamSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { messages, rejectOnWrongMessage: true }); - - expect(streamSocket).toBeDefined(); - expect(streamSocket.socket).toBeDefined(); - expect(streamSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect and send full configuration manually on open event", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - }); - activeSockets.push(streamSocket); - - streamSocket.on("open", () => { - streamSocket.sendConfiguration({ - type: "config", - configuration: { - transcription: { - primaryLanguage: "en", - isDiarization: true, - isMultichannel: true, - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "doctor", - }, - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "patient", - }, - ], - }, - mode: { - type: "facts", - outputLocale: "en", - }, - }, - }); - }); - - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { rejectOnWrongMessage: true }); - - expect(streamSocket).toBeDefined(); - expect(streamSocket.socket).toBeDefined(); - expect(streamSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should connect with different participant roles", () => { - it("should connect with doctor role", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "en", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "doctor", - }, - ], - }, - mode: { - type: "facts", - outputLocale: "en" - }, - }, - }); - activeSockets.push(streamSocket); - - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { rejectOnWrongMessage: true }); - - expect(streamSocket).toBeDefined(); - expect(streamSocket.socket).toBeDefined(); - expect(streamSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect with patient role", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "en", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "patient", - }, - ], - }, - mode: { - type: "facts", - outputLocale: "en" - }, - }, - }); - activeSockets.push(streamSocket); - - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { rejectOnWrongMessage: true }); - - expect(streamSocket).toBeDefined(); - expect(streamSocket.socket).toBeDefined(); - expect(streamSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect with multiple role", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "en", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "multiple", - }, - ], - }, - mode: { - type: "facts", - outputLocale: "en" - }, - }, - }); - activeSockets.push(streamSocket); - - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { rejectOnWrongMessage: true }); - - expect(streamSocket).toBeDefined(); - expect(streamSocket.socket).toBeDefined(); - expect(streamSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should connect with different mode types", () => { - it("should connect with facts mode", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "en", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "doctor", - }, - ], - }, - mode: { - type: "facts", - outputLocale: "en" - }, - }, - }); - activeSockets.push(streamSocket); - - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { rejectOnWrongMessage: true }); - - expect(streamSocket).toBeDefined(); - expect(streamSocket.socket).toBeDefined(); - expect(streamSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect with transcription mode", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "en", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "doctor", - }, - ], - }, - mode: { - type: "transcription", - }, - }, - }); - activeSockets.push(streamSocket); - - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { rejectOnWrongMessage: true }); - - expect(streamSocket).toBeDefined(); - expect(streamSocket.socket).toBeDefined(); - expect(streamSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should handle transcription scenario with audio", () => { - it("should process audio and receive transcription messages", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "en", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "doctor", - }, - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "patient", - }, - ], - }, - mode: { - type: "transcription", - }, - }, - }); - activeSockets.push(streamSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { messages, rejectOnWrongMessage: true }); - - const audioFilePath = path.join(__dirname, "trouble-breathing.mp3"); - const audioBuffer = fs.readFileSync(audioFilePath); - - for (let i = 0; i < 3; i++) { - const chunk = audioBuffer.subarray(i * 60 * 1024, (i + 1) * 60 * 1024); - streamSocket.sendAudio(chunk); - } - - streamSocket.sendFlush({ type: "flush" }); - - await waitForWebSocketMessage(streamSocket, "transcript", { messages, timeoutMs: 30000 }); - - streamSocket.sendEnd({ type: "end" }); - - await waitForWebSocketMessage(streamSocket, "usage", { messages }); - - await waitForWebSocketMessage(streamSocket, "ENDED", { messages }); - - expect([2, 3]).toContain(streamSocket.socket.readyState); // CLOSING or CLOSED - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - // FIXME takes too much time to have facts - it.skip("should process audio and receive facts messages", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "en", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "doctor", - }, - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "patient", - }, - ], - }, - mode: { - type: "facts", - }, - }, - }); - activeSockets.push(streamSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(streamSocket, "CONFIG_ACCEPTED", { messages, rejectOnWrongMessage: true }); - - const audioFilePath = path.join(__dirname, "trouble-breathing.mp3"); - const audioBuffer = fs.readFileSync(audioFilePath); - - for (let i = 0; i < 6; i++) { - const chunk = audioBuffer.subarray(i * 60 * 1024, (i + 1) * 60 * 1024); - streamSocket.sendAudio(chunk); - } - - await waitForWebSocketMessage(streamSocket, "transcript", { messages, timeoutMs: 30000 }); - await waitForWebSocketMessage(streamSocket, "facts", { messages, timeoutMs: 60000 }); - - streamSocket.sendEnd({ type: "end" }); - - await waitForWebSocketMessage(streamSocket, "usage", { messages }); - - await waitForWebSocketMessage(streamSocket, "ENDED", { messages }); - - expect([2, 3]).toContain(streamSocket.socket.readyState); // CLOSING or CLOSED - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should handle configuration errors", () => { - it("should reject invalid configuration", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "invalid_language", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "doctor", - }, - ], - }, - mode: { - type: "transcription", - }, - }, - }); - activeSockets.push(streamSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(streamSocket, "CONFIG_DENIED", { messages, rejectOnWrongMessage: true }); - - expect([2, 3]).toContain(streamSocket.socket.readyState); // CLOSING or CLOSED - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - // FIXME no message received from WS - it.skip("should reject missing configuration", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - }); - activeSockets.push(streamSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(streamSocket, "CONFIG_MISSING", { - messages, - rejectOnWrongMessage: true, - timeoutMs: 60000, - }); - - expect([2, 3]).toContain(streamSocket.socket.readyState); // CLOSING or CLOSED - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should reject configuration with invalid participant role", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const streamSocket = await cortiClient.stream.connect({ - id: interactionId, - configuration: { - transcription: { - primaryLanguage: "en", - participants: [ - { - channel: faker.number.int({ min: 0, max: 10 }), - role: "invalid_role" as any, - }, - ], - }, - mode: { - type: "transcription", - }, - }, - }); - activeSockets.push(streamSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(streamSocket, "CONFIG_DENIED", { messages, rejectOnWrongMessage: true }); - - expect([2, 3]).toContain(streamSocket.socket.readyState); // CLOSING or CLOSED - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); -}); diff --git a/tests/custom/templates.get.integration.ts b/tests/custom/templates.get.integration.ts deleted file mode 100644 index 62ea1b1a..00000000 --- a/tests/custom/templates.get.integration.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createTestCortiClient, getValidTemplateKeyAndLanguage, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.templates.get", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - describe("should retrieve template with only required values", () => { - it("should successfully retrieve an existing template without errors or warnings", async () => { - expect.assertions(2); - - const templateData = await getValidTemplateKeyAndLanguage(cortiClient); - - const result = await cortiClient.templates.get(templateData.templateKey); - - expect(result.key).toBe(templateData.templateKey); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should return template with section defaultFormatRule", () => { - it("should return section with defaultFormatRule field", async () => { - expect.assertions(3); - - const templateData = await getValidTemplateKeyAndLanguage(cortiClient); - - const result = await cortiClient.templates.get(templateData.templateKey); - const section = result.templateSections[0]?.section; - - expect(section).toBeDefined(); - expect("defaultFormatRule" in section || section.defaultFormatRule === undefined).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return defaultFormatRule with name field if present", async () => { - expect.assertions(2); - - const templateData = await getValidTemplateKeyAndLanguage(cortiClient); - - const result = await cortiClient.templates.get(templateData.templateKey); - const section = result.templateSections[0]?.section; - - if (section.defaultFormatRule) { - expect("name" in section.defaultFormatRule).toBe(true); - } else { - expect(section.defaultFormatRule).toBeUndefined(); - } - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should throw error when required parameters are missing", () => { - it("should throw error when template key is missing", async () => { - expect.assertions(1); - - await expect(cortiClient.templates.get(undefined as any)).rejects.toThrow(); - }); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when template key does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.templates.get(faker.lorem.word())).rejects.toThrow("Status code: 500"); - }); - }); -}); diff --git a/tests/custom/templates.list.integration.ts b/tests/custom/templates.list.integration.ts deleted file mode 100644 index b8446110..00000000 --- a/tests/custom/templates.list.integration.ts +++ /dev/null @@ -1,164 +0,0 @@ -import { CortiClient } from "../../src"; -import { createTestCortiClient, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.templates.list", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - describe("should list templates with only required values", () => { - it("should retrieve templates without parameters without errors or warnings", async () => { - expect.assertions(2); - - const result = await cortiClient.templates.list(); - - expect(result.data.length).toBeGreaterThan(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("language filtering (lang parameter)", () => { - // FIXME Skipped because of https://linear.app/corti/issue/TGT-383/get-templates-endpoint-returns-inconsistent-results - it.skip('should filter templates by single language (lang: "en")', async () => { - expect.assertions(4); - - const unfilteredResult = await cortiClient.templates.list(); - - const filteredResult = await cortiClient.templates.list({ lang: "en" }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(filteredResult.data.length).toBeGreaterThan(0); - - expect(JSON.stringify(unfilteredResult.data)).not.toBe(JSON.stringify(filteredResult.data)); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - // FIXME Skipped because of https://linear.app/corti/issue/TGT-383/get-templates-endpoint-returns-inconsistent-results - it.skip('should filter templates by multiple languages (lang: ["da", "en"])', async () => { - expect.assertions(5); - - const unfilteredResult = await cortiClient.templates.list(); - const singleLangResult = await cortiClient.templates.list({ lang: "en" }); - const multiLangResult = await cortiClient.templates.list({ lang: ["da", "en"] }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(multiLangResult.data.length).toBeGreaterThan(0); - - expect(JSON.stringify(unfilteredResult.data)).not.toBe(JSON.stringify(multiLangResult.data)); - expect(JSON.stringify(singleLangResult.data)).not.toBe(JSON.stringify(multiLangResult.data)); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("organization filtering (org parameter)", () => { - // FIXME Skipped because of https://linear.app/corti/issue/TGT-383/get-templates-endpoint-returns-inconsistent-results - it.skip('should filter templates by single organization (org: "corti")', async () => { - expect.assertions(3); - - const unfilteredResult = await cortiClient.templates.list(); - - const filteredResult = await cortiClient.templates.list({ org: "corti" }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(filteredResult.data.length).toBeGreaterThan(0); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - // FIXME Skipped because of https://linear.app/corti/issue/TGT-383/get-templates-endpoint-returns-inconsistent-results - it.skip('should filter templates by multiple organizations (org: ["corti", "another-org"])', async () => { - expect.assertions(3); - - const unfilteredResult = await cortiClient.templates.list(); - const multiOrgResult = await cortiClient.templates.list({ org: ["corti", "another-org"] }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(multiOrgResult.data.length).toBeGreaterThan(0); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return empty or filtered results for non-existent organization", async () => { - expect.assertions(2); - - const filteredResult = await cortiClient.templates.list({ org: "nonexistent-org" }); - - expect(filteredResult.data.length).toBeGreaterThanOrEqual(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("status filtering (status parameter)", () => { - // FIXME Skipped because of https://linear.app/corti/issue/TGT-383/get-templates-endpoint-returns-inconsistent-results - it.skip('should filter templates by single status (status: "published")', async () => { - expect.assertions(4); - - const unfilteredResult = await cortiClient.templates.list(); - - const filteredResult = await cortiClient.templates.list({ status: "published" }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(filteredResult.data.length).toBe(unfilteredResult.data.length); - - expect(JSON.stringify(unfilteredResult.data)).toBe(JSON.stringify(filteredResult.data)); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - // FIXME Skipped because of https://linear.app/corti/issue/TGT-383/get-templates-endpoint-returns-inconsistent-results - it.skip('should filter templates by multiple statuses (status: ["published", "draft"])', async () => { - expect.assertions(4); - - const unfilteredResult = await cortiClient.templates.list(); - const multiStatusResult = await cortiClient.templates.list({ status: ["published", "draft"] }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(multiStatusResult.data.length).toBeGreaterThanOrEqual(unfilteredResult.data.length); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return empty or filtered results for non-existent status", async () => { - expect.assertions(2); - - const filteredResult = await cortiClient.templates.list({ status: "nonexistent-status" }); - - expect(filteredResult.data.length).toBeGreaterThanOrEqual(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - // FIXME Skipped because of https://linear.app/corti/issue/TGT-383/get-templates-endpoint-returns-inconsistent-results - describe.skip("combined filtering (lang, org, and status parameters)", () => { - it("should filter templates using all parameters together", async () => { - expect.assertions(4); - - const unfilteredResult = await cortiClient.templates.list(); - const combinedResult = await cortiClient.templates.list({ - lang: ["da", "en"], - org: ["corti", "another-org"], - status: ["published", "draft"], - }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(combinedResult.data.length).toBeGreaterThan(0); - - expect(JSON.stringify(unfilteredResult.data)).not.toBe(JSON.stringify(combinedResult.data)); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); -}); diff --git a/tests/custom/templates.sectionList.integration.ts b/tests/custom/templates.sectionList.integration.ts deleted file mode 100644 index a501de77..00000000 --- a/tests/custom/templates.sectionList.integration.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { CortiClient } from "../../src"; -import { createTestCortiClient, setupConsoleWarnSpy } from "./testUtils"; - -describe("cortiClient.templates.sectionList", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(() => { - consoleWarnSpy.mockRestore(); - }); - - it("should retrieve template sections without parameters", async () => { - expect.assertions(2); - - const result = await cortiClient.templates.sectionList(); - - expect(result.data.length).toBeGreaterThan(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("language filtering (lang parameter)", () => { - it('should filter template sections by single language (lang: "en")', async () => { - expect.assertions(4); - - const unfilteredResult = await cortiClient.templates.sectionList(); - - const filteredResult = await cortiClient.templates.sectionList({ lang: "en" }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(filteredResult.data.length).toBeGreaterThan(0); - - expect(JSON.stringify(unfilteredResult.data)).not.toBe(JSON.stringify(filteredResult.data)); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should filter template sections by multiple languages (lang: ["da", "en"])', async () => { - expect.assertions(5); - - const unfilteredResult = await cortiClient.templates.sectionList(); - const singleLangResult = await cortiClient.templates.sectionList({ lang: "en" }); - const multiLangResult = await cortiClient.templates.sectionList({ lang: ["da", "en"] }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(multiLangResult.data.length).toBeGreaterThan(0); - - expect(JSON.stringify(unfilteredResult.data)).not.toBe(JSON.stringify(multiLangResult.data)); - expect(JSON.stringify(singleLangResult.data)).not.toBe(JSON.stringify(multiLangResult.data)); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("organization filtering (org parameter)", () => { - it('should filter template sections by single organization (org: "corti")', async () => { - expect.assertions(3); - - const unfilteredResult = await cortiClient.templates.sectionList(); - - const filteredResult = await cortiClient.templates.sectionList({ org: "corti" }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(filteredResult.data.length).toBeGreaterThan(0); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should filter template sections by multiple organizations (org: ["corti", "another-org"])', async () => { - expect.assertions(3); - - const unfilteredResult = await cortiClient.templates.sectionList(); - const multiOrgResult = await cortiClient.templates.sectionList({ org: ["corti", "another-org"] }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(multiOrgResult.data.length).toBeGreaterThan(0); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return empty results for non-existent organization", async () => { - expect.assertions(2); - - const filteredResult = await cortiClient.templates.sectionList({ org: "nonexistent-org" }); - - expect(filteredResult.data.length).toBeGreaterThanOrEqual(0); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("combined filtering (lang and org parameters)", () => { - it("should filter template sections using both language and organization parameters", async () => { - expect.assertions(4); - - const unfilteredResult = await cortiClient.templates.sectionList(); - const combinedResult = await cortiClient.templates.sectionList({ - lang: ["da", "en"], - org: ["corti", "another-org"], - }); - - expect(unfilteredResult.data.length).toBeGreaterThan(0); - expect(combinedResult.data.length).toBeGreaterThan(0); - - expect(JSON.stringify(unfilteredResult.data)).not.toBe(JSON.stringify(combinedResult.data)); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); -}); diff --git a/tests/custom/testUtils.ts b/tests/custom/testUtils.ts deleted file mode 100644 index bf295a5b..00000000 --- a/tests/custom/testUtils.ts +++ /dev/null @@ -1,352 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { createReadStream } from "fs"; -import { StreamSocket } from "../../src/custom/CustomStreamSocket"; -import { TranscribeSocket } from "../../src/custom/CustomTranscribeSocket"; - -/** - * Creates a CortiClient instance configured for testing - */ -export function createTestCortiClient(): CortiClient { - if ( - !process.env.CORTI_ENVIRONMENT || - !process.env.CORTI_TENANT_NAME || - !process.env.CORTI_CLIENT_ID || - !process.env.CORTI_CLIENT_SECRET - ) { - throw new Error("Missing required environment variables for CortiClient"); - } - - return new CortiClient({ - environment: process.env.CORTI_ENVIRONMENT, - tenantName: process.env.CORTI_TENANT_NAME, - auth: { - clientId: process.env.CORTI_CLIENT_ID, - clientSecret: process.env.CORTI_CLIENT_SECRET, - }, - }); -} - -/** - * Creates a test interaction using faker data - * Optionally pushes the created interactionId to the provided array - * Allows overriding default interaction data - */ -export async function createTestInteraction( - cortiClient: CortiClient, - createdInteractionIds?: string[], - overrideData?: any, -): Promise { - const defaultData = { - encounter: { - identifier: faker.string.alphanumeric(20), - status: "planned", - type: "first_consultation", - }, - }; - - const interactionData = overrideData - ? { - ...defaultData, - ...overrideData, - encounter: overrideData.encounter - ? { ...defaultData.encounter, ...overrideData.encounter } - : defaultData.encounter, - } - : defaultData; - - const interaction = await cortiClient.interactions.create(interactionData); - - if (createdInteractionIds) { - createdInteractionIds.push(interaction.interactionId); - } - - await pause(); - - return interaction.interactionId; -} - -/** - * Cleans up interactions by deleting them (this will cascade delete all associated resources) - */ -export async function cleanupInteractions(cortiClient: CortiClient, interactionIds: string[]): Promise { - for (const interactionId of interactionIds) { - try { - await cortiClient.interactions.delete(interactionId); - } catch (error) { - console.warn(`Failed to clean up interaction ${interactionId}:`, error); - } - } -} - -/** - * Sets up console.warn spy for tests - */ -export function setupConsoleWarnSpy(): jest.SpyInstance { - return jest.spyOn(console, "warn").mockImplementation(() => {}); -} - -/** - * Adds a pause to ensure backend processing is complete - * @param ms - Duration to pause in milliseconds (default: 1000ms) - */ -export function pause(ms: number = 1000): Promise { - return new Promise((resolve) => setTimeout(resolve, ms)); -} - -/** - * Gets valid fact groups from the API, with fallback to 'other' - */ -export async function getValidFactGroups(cortiClient: CortiClient): Promise { - const factGroupsResponse = await cortiClient.facts.factGroupsList(); - const factGroups = factGroupsResponse.data - .map((factGroup) => factGroup.key) - .filter((key): key is string => key !== undefined); - - return [...new Set(factGroups)]; -} - -export async function getValidSectionKeys(cortiClient: CortiClient): Promise { - const sectionsResponse = await cortiClient.templates.sectionList(); - const sectionKeys = sectionsResponse.data - .map((section) => section.key) - .filter((key): key is string => key !== undefined); - - return [...new Set(sectionKeys)]; -} - -/** - * Gets a valid template key and output language from the API for document tests - */ -export async function getValidTemplateKeyAndLanguage( - cortiClient: CortiClient, -): Promise<{ templateKey: string; outputLanguage: string }> { - const templatesList = await cortiClient.templates.list(); - const first = templatesList.data?.[0]; - - if (!first) { - throw new Error("No templates available for testing"); - } - - const outputLanguage = first.translations?.[0]?.languageId || "en"; - - return { templateKey: first.key, outputLanguage }; -} - -/** - * Creates test facts using faker data and returns their IDs - * Used for testing facts.update functionality - */ -export async function createTestFacts( - cortiClient: CortiClient, - interactionId: string, - count: number = 1, -): Promise { - const validFactGroups = await getValidFactGroups(cortiClient); - - const factsToCreate = Array.from({ length: count }, () => ({ - text: faker.lorem.sentence(), - group: faker.helpers.arrayElement(validFactGroups), - })); - - const response = await cortiClient.facts.create(interactionId, { - facts: factsToCreate, - }); - - const factIds = response.facts.map((fact) => fact.id).filter((id): id is string => id !== undefined); - - await pause(); - - return factIds; -} - -/** - * Creates a single test document using faker data and returns its ID - * Used for testing documents functionality - */ -export async function createTestDocument(cortiClient: CortiClient, interactionId: string): Promise { - const templateData = await getValidTemplateKeyAndLanguage(cortiClient); - - const response = await cortiClient.documents.create(interactionId, { - context: [ - { - type: "string", - data: faker.lorem.paragraph(), - }, - ], - templateKey: templateData.templateKey, - outputLanguage: templateData.outputLanguage, - }); - - if (!response.id) { - throw new Error("Document creation failed - no ID returned."); - } - - await pause(); - - return response.id; -} - -/** - * Creates a test recording using the trouble-breathing.mp3 file - * Optionally pushes the created recordingId to the provided array - * Used for testing recordings functionality - */ -export async function createTestRecording( - cortiClient: CortiClient, - interactionId: string, - createdRecordingIds?: string[], -): Promise { - const uploadFile = createReadStream("tests/custom/trouble-breathing.mp3", { - autoClose: true, - }); - - const uploadResult = await cortiClient.recordings.upload(uploadFile, interactionId); - - if (createdRecordingIds) { - createdRecordingIds.push(uploadResult.recordingId); - } - - await pause(); - - return uploadResult.recordingId; -} - -/** - * Creates a test transcript for a given interaction and recording - * Used for testing transcripts functionality - * Note: This requires a valid language/model combination to work - */ -export async function createTestTranscript( - cortiClient: CortiClient, - interactionId: string, - recordingId: string, -): Promise { - // Note: Using a supported language/model combination - // This may need to be updated based on actual supported languages - const transcriptResult = await cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - }); - - if (!transcriptResult.id) { - throw new Error("Transcript creation failed - no ID returned."); - } - - await pause(); - - return transcriptResult.id; -} - -/** - * Creates a promise that waits for a specific WebSocket message type - * Used for testing WebSocket message handling in stream tests - */ -export function waitForWebSocketMessage( - streamSocket: StreamSocket | TranscribeSocket, - expectedMessageType: string, - options: { - messages?: any[]; - rejectOnWrongMessage?: boolean; - timeoutMs?: number; - } = {}, -): Promise { - return new Promise((resolve, reject) => { - const { messages = [], rejectOnWrongMessage = false, timeoutMs = 10000 } = options; - - const timeout = setTimeout(() => { - reject(new Error(`Timeout waiting for message type: ${expectedMessageType}`)); - }, timeoutMs); - - // Check if message already exists in the array - if (messages.some((msg: any) => msg.type === expectedMessageType)) { - clearTimeout(timeout); - resolve(); - return; - } - - const messageHandler = (data: any) => { - console.log("incoming message", data); - - // Add message to the array - messages.push(data); - - if (data.type === expectedMessageType) { - clearTimeout(timeout); - resolve(); - } else if (rejectOnWrongMessage) { - clearTimeout(timeout); - reject(new Error(`Unexpected message type: ${data.type}, expected: ${expectedMessageType}`)); - } - }; - - streamSocket.on("message", messageHandler); - - streamSocket.on("error", (error: any) => { - clearTimeout(timeout); - reject(new Error(`WebSocket error: ${error.message}`)); - }); - }); -} - -/** - * Creates a test agent using faker data and returns its ID - * Optionally pushes the created agentId to the provided array - * Used for testing agents functionality - */ -export async function createTestAgent(cortiClient: CortiClient, createdAgentIds?: string[]): Promise { - const agent = await cortiClient.agents.create({ - name: faker.lorem.words(3), - description: faker.lorem.sentence(), - }); - - if (!agent.id) { - throw new Error("Agent creation failed - no ID returned."); - } - - if (createdAgentIds) { - createdAgentIds.push(agent.id); - } - - await pause(); - - return agent; -} - -/** - * Cleans up agents by deleting them - */ -export async function cleanupAgents(cortiClient: CortiClient, agentIds: string[]): Promise { - for (const agentId of agentIds) { - try { - console.log(`Cleanup agent ${agentId}`); - await cortiClient.agents.delete(agentId); - } catch (error) { - console.warn(`Failed to clean up agent ${agentId}:`, error); - } - } -} - -/** - * Sends a test message to an agent and returns the response - * Used for testing agents.messageSend functionality - */ -export async function sendTestMessage(cortiClient: CortiClient, agentId: string, messageText?: string) { - const message = await cortiClient.agents.messageSend(agentId, { - message: { - role: "user", - parts: [ - { - kind: "text", - text: messageText || faker.lorem.sentence(), - }, - ], - messageId: faker.string.uuid(), - kind: "message", - }, - }); - - await pause(); - - return message; -} diff --git a/tests/custom/transcribe.connect.integration.ts b/tests/custom/transcribe.connect.integration.ts deleted file mode 100644 index e3f0ec6d..00000000 --- a/tests/custom/transcribe.connect.integration.ts +++ /dev/null @@ -1,444 +0,0 @@ -import { CortiClient } from "../../src/custom/CortiClient"; -import { faker } from "@faker-js/faker"; -import * as fs from "fs"; -import * as path from "path"; -import { createTestCortiClient, setupConsoleWarnSpy, waitForWebSocketMessage } from "./testUtils"; - -describe("cortiClient.transcribe.connect", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let activeSockets: any[] = []; - - beforeAll(async () => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - activeSockets = []; - }); - - afterEach(() => { - // Close all active sockets to ensure cleanup - activeSockets.forEach((socket) => { - if (socket && typeof socket.close === "function") { - try { - socket.close(); - } catch (error) { - // Ignore errors during cleanup - } - } - }); - activeSockets = []; - }); - - describe("should connect with minimal configuration", () => { - it("should connect with minimal configuration passed to connect", async () => { - expect.assertions(4); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect and send configuration manually on open event", async () => { - expect.assertions(4); - - const transcribeSocket = await cortiClient.transcribe.connect(); - activeSockets.push(transcribeSocket); - - transcribeSocket.on("open", () => { - transcribeSocket.sendConfiguration({ - type: "config", - configuration: { - primaryLanguage: "en", - }, - }); - }); - - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { rejectOnWrongMessage: true }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should connect with full configuration", () => { - it("should connect with full configuration passed to connect", async () => { - expect.assertions(4); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - interimResults: true, - spokenPunctuation: true, - automaticPunctuation: true, - commands: [ - { - id: faker.string.alphanumeric(8), - phrases: ["stop recording", "end session"], - }, - ], - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect and send full configuration manually on open event", async () => { - expect.assertions(4); - - const transcribeSocket = await cortiClient.transcribe.connect(); - activeSockets.push(transcribeSocket); - - transcribeSocket.on("open", () => { - transcribeSocket.sendConfiguration({ - type: "config", - configuration: { - primaryLanguage: "en", - interimResults: true, - spokenPunctuation: true, - automaticPunctuation: true, - commands: [ - { - id: faker.string.alphanumeric(8), - phrases: ["stop recording", "end session"], - }, - ], - }, - }); - }); - - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { rejectOnWrongMessage: true }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect with full configuration including command variables", async () => { - expect.assertions(4); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - interimResults: true, - spokenPunctuation: true, - automaticPunctuation: true, - commands: [ - { - id: faker.string.alphanumeric(8), - phrases: ["set status to", "change status to"], - variables: [ - { - key: "status", - type: "enum", - enum: ["active", "inactive", "pending", "completed"], - }, - ], - }, - ], - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); // OPEN - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should handle transcription scenario with audio", () => { - it("should process audio and receive transcription messages", async () => { - expect.assertions(1); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - const audioFilePath = path.join(__dirname, "trouble-breathing.mp3"); - const audioBuffer = fs.readFileSync(audioFilePath); - - for (let i = 0; i < 3; i++) { - const chunk = audioBuffer.subarray(i * 60 * 1024, (i + 1) * 60 * 1024); - transcribeSocket.sendAudio(chunk); - } - - await waitForWebSocketMessage(transcribeSocket, "transcript", { messages, timeoutMs: 30000 }); - - transcribeSocket.sendEnd({ type: "end" }); - - // FIXME skip this part of the test since it takes too long on production to get these messages - // await waitForWebSocketMessage(transcribeSocket, 'usage', { messages }); - // - // await waitForWebSocketMessage(transcribeSocket, 'ended', { messages }); - - // expect([2, 3]).toContain(transcribeSocket.socket.readyState); // CLOSING or CLOSED - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should handle configuration errors", () => { - it("should reject invalid configuration", async () => { - expect.assertions(2); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "invalid_language", - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_DENIED", { messages, rejectOnWrongMessage: true }); - - expect([2, 3]).toContain(transcribeSocket.socket.readyState); // CLOSING or CLOSED - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should reject missing configuration", async () => { - expect.assertions(1); - - const transcribeSocket = await cortiClient.transcribe.connect(); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_TIMEOUT", { - messages, - rejectOnWrongMessage: true, - timeoutMs: 60000, - }); - - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should reject configuration with invalid command", async () => { - expect.assertions(2); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - commands: [ - { - id: "", - phrases: [], - } as any, - ], - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_DENIED", { messages, rejectOnWrongMessage: true }); - - expect([2, 3]).toContain(transcribeSocket.socket.readyState); // CLOSING or CLOSED - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should connect with formatting configuration", () => { - it("should connect with dates formatting", async () => { - expect.assertions(3); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - formatting: { dates: "long_text" }, - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect with times formatting", async () => { - expect.assertions(3); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - formatting: { times: "h12" }, - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect with numbers formatting", async () => { - expect.assertions(3); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - formatting: { numbers: "numerals" }, - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect with measurements formatting", async () => { - expect.assertions(3); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - formatting: { measurements: "abbreviated" }, - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect with numeric ranges formatting", async () => { - expect.assertions(3); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - formatting: { numericRanges: "numerals" }, - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect with ordinals formatting", async () => { - expect.assertions(3); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - formatting: { ordinals: "numerals" }, - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should connect with full formatting configuration", async () => { - expect.assertions(3); - - const transcribeSocket = await cortiClient.transcribe.connect({ - configuration: { - primaryLanguage: "en", - formatting: { - dates: "long_text", - times: "h12", - numbers: "numerals", - measurements: "abbreviated", - numericRanges: "numerals", - ordinals: "numerals", - }, - }, - }); - activeSockets.push(transcribeSocket); - - const messages: any[] = []; - await waitForWebSocketMessage(transcribeSocket, "CONFIG_ACCEPTED", { - messages, - rejectOnWrongMessage: true, - }); - - expect(transcribeSocket).toBeDefined(); - expect(transcribeSocket.socket.readyState).toBe(1); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); -}); diff --git a/tests/custom/transcripts.create.integration.ts b/tests/custom/transcripts.create.integration.ts deleted file mode 100644 index 620f669e..00000000 --- a/tests/custom/transcripts.create.integration.ts +++ /dev/null @@ -1,337 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - createTestRecording, - cleanupInteractions, - setupConsoleWarnSpy, -} from "./testUtils"; - -describe("cortiClient.transcripts.create", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - describe("should create transcript with only required values", () => { - it("should create transcript with only required fields without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const result = await cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should create transcript with all participant role enum values", () => { - it('should create transcript with participant role "doctor"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const result = await cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - participants: [ - { - channel: 0, - role: "doctor", - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create transcript with participant role "patient"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const result = await cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - participants: [ - { - channel: 0, - role: "patient", - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it('should create transcript with participant role "multiple"', async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const result = await cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - participants: [ - { - channel: 0, - role: "multiple", - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should create transcript with multiple participants", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const result = await cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - participants: [ - { - channel: 0, - role: "doctor", - }, - { - channel: 1, - role: "patient", - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - it("should create transcript with all optional parameters without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - const isMultichannel = faker.datatype.boolean(); - const diarize = isMultichannel ? faker.datatype.boolean() : false; // diarize can only be true if isMultichannel is true - - const result = await cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - isDictation: faker.datatype.boolean(), - isMultichannel, - diarize, - participants: [ - { - channel: faker.number.int({ min: 0, max: 1 }), - role: faker.helpers.arrayElement(["doctor", "patient", "multiple"]), - }, - ], - }); - - expect(result).toBeDefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when required fields are missing", () => { - it("should throw error when recordingId is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.transcripts.create(interactionId, { - primaryLanguage: "en", - } as any), - ).rejects.toThrow('Missing required key "recordingId"'); - }); - - it("should throw error when primaryLanguage is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - await expect( - cortiClient.transcripts.create(interactionId, { - recordingId, - } as any), - ).rejects.toThrow('Missing required key "primaryLanguage"'); - }); - - it("should throw error when participant channel is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - await expect( - cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - participants: [ - { - role: "doctor", - } as any, - ], - }), - ).rejects.toThrow('Missing required key "channel"'); - }); - - it("should throw error when participant role is missing", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - await expect( - cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - participants: [ - { - channel: 0, - } as any, - ], - }), - ).rejects.toThrow('Missing required key "role"'); - }); - - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - const recordingId = faker.string.uuid(); - - await expect( - cortiClient.transcripts.create("invalid-uuid", { - recordingId, - primaryLanguage: "en", - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - const recordingId = faker.string.uuid(); - - await expect( - cortiClient.transcripts.create(faker.string.uuid(), { - recordingId, - primaryLanguage: "en", - }), - ).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when recordingId does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.transcripts.create(interactionId, { - recordingId: faker.string.uuid(), - primaryLanguage: "en", - }), - ).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when recordingId is invalid format", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect( - cortiClient.transcripts.create(interactionId, { - recordingId: "invalid-uuid", - primaryLanguage: "en", - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when primaryLanguage is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - await expect( - cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "invalid-language", - }), - ).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when participant role is invalid", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - await expect( - cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - participants: [ - { - channel: 0, - role: "invalid-role" as any, - }, - ], - }), - ).rejects.toThrow('Expected enum. Received "invalid-role"'); - }); - - it("should throw error when diarize is true but isMultichannel is false", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - await expect( - cortiClient.transcripts.create(interactionId, { - recordingId, - primaryLanguage: "en", - isMultichannel: false, - diarize: true, - participants: [ - { - channel: faker.number.int({ min: 0, max: 1 }), - role: faker.helpers.arrayElement(["doctor", "patient", "multiple"]), - }, - ], - }), - ).rejects.toThrow("BadRequestError"); - }); - }); -}); diff --git a/tests/custom/transcripts.delete.integration.ts b/tests/custom/transcripts.delete.integration.ts deleted file mode 100644 index ed0f6da1..00000000 --- a/tests/custom/transcripts.delete.integration.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - createTestRecording, - createTestTranscript, - setupConsoleWarnSpy, - cleanupInteractions, -} from "./testUtils"; - -describe("cortiClient.transcripts.delete", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - const createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds.length = 0; - }); - - it("should successfully delete an existing transcript without errors or warnings", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - const transcriptId = await createTestTranscript(cortiClient, interactionId, recordingId); - - const result = await cortiClient.transcripts.delete(interactionId, transcriptId); - - expect(result).toBeUndefined(); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.delete("invalid-uuid", faker.string.uuid())).rejects.toThrow( - "Status code: 400", - ); - }); - - it("should throw error when transcript ID is invalid format", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.transcripts.delete(interactionId, "invalid-uuid")).rejects.toThrow( - "Status code: 400", - ); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.delete(faker.string.uuid(), faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - - it("should throw error when interaction ID is null", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.delete(null as any, faker.string.uuid())).rejects.toThrow( - "Expected string. Received null.", - ); - }); - - it("should throw error when transcript ID is null", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.transcripts.delete(interactionId, null as any)).rejects.toThrow( - "Expected string. Received null.", - ); - }); - - it("should throw error when interaction ID is undefined", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.delete(undefined as any, faker.string.uuid())).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - - it("should throw error when transcript ID is undefined", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.transcripts.delete(interactionId, undefined as any)).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - - it("should throw error when transcript ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.transcripts.delete(interactionId, faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - }); -}); diff --git a/tests/custom/transcripts.get.integration.ts b/tests/custom/transcripts.get.integration.ts deleted file mode 100644 index 02ccd83d..00000000 --- a/tests/custom/transcripts.get.integration.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - createTestRecording, - createTestTranscript, - cleanupInteractions, - setupConsoleWarnSpy, -} from "./testUtils"; - -describe("cortiClient.transcripts.get", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - let createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - createdInteractionIds = []; - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds = []; - }); - - it("should successfully retrieve an existing transcript without errors or warnings", async () => { - expect.assertions(3); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - const transcriptId = await createTestTranscript(cortiClient, interactionId, recordingId); - - const result = await cortiClient.transcripts.get(interactionId, transcriptId); - - expect(result).toBeDefined(); - expect(result.id).toBe(transcriptId); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("should handle get errors", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.get("invalid-uuid", faker.string.uuid())).rejects.toThrow( - "Status code: 400", - ); - }); - - it("should throw error when transcript ID is invalid format", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.transcripts.get(interactionId, "invalid-uuid")).rejects.toThrow( - "Status code: 400", - ); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.get(faker.string.uuid(), faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - - it("should throw error when transcript ID does not exist", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.transcripts.get(interactionId, faker.string.uuid())).rejects.toThrow( - "Status code: 404", - ); - }); - - it("should throw error when interaction ID is null", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.get(null as any, faker.string.uuid())).rejects.toThrow( - "Expected string. Received null.", - ); - }); - - it("should throw error when transcript ID is null", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.transcripts.get(interactionId, null as any)).rejects.toThrow( - "Expected string. Received null.", - ); - }); - - it("should throw error when interaction ID is undefined", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.get(undefined as any, faker.string.uuid())).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - - it("should throw error when transcript ID is undefined", async () => { - expect.assertions(1); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - await expect(cortiClient.transcripts.get(interactionId, undefined as any)).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - }); -}); diff --git a/tests/custom/transcripts.list.integration.ts b/tests/custom/transcripts.list.integration.ts deleted file mode 100644 index 597d97eb..00000000 --- a/tests/custom/transcripts.list.integration.ts +++ /dev/null @@ -1,147 +0,0 @@ -import { CortiClient } from "../../src"; -import { faker } from "@faker-js/faker"; -import { - createTestCortiClient, - createTestInteraction, - createTestRecording, - createTestTranscript, - setupConsoleWarnSpy, - cleanupInteractions, -} from "./testUtils"; - -describe("cortiClient.transcripts.list", () => { - let cortiClient: CortiClient; - let consoleWarnSpy: jest.SpyInstance; - const createdInteractionIds: string[] = []; - - beforeAll(() => { - cortiClient = createTestCortiClient(); - }); - - beforeEach(() => { - consoleWarnSpy = setupConsoleWarnSpy(); - }); - - afterEach(async () => { - consoleWarnSpy.mockRestore(); - await cleanupInteractions(cortiClient, createdInteractionIds); - createdInteractionIds.length = 0; - }); - - it("should return empty list when interaction has no transcripts", async () => { - expect.assertions(2); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - - const result = await cortiClient.transcripts.list(interactionId); - - expect(result.transcripts).toBe(null); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return transcripts when interaction has transcripts", async () => { - expect.assertions(3); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - const transcriptId = await createTestTranscript(cortiClient, interactionId, recordingId); - - const result = await cortiClient.transcripts.list(interactionId); - - expect(result.transcripts?.length || 0).toBeGreaterThan(0); - expect(result.transcripts?.some((transcript) => transcript.id === transcriptId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return multiple transcripts when interaction has multiple transcripts", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId1 = await createTestRecording(cortiClient, interactionId); - const recordingId2 = await createTestRecording(cortiClient, interactionId); - const transcriptId1 = await createTestTranscript(cortiClient, interactionId, recordingId1); - const transcriptId2 = await createTestTranscript(cortiClient, interactionId, recordingId2); - - const result = await cortiClient.transcripts.list(interactionId); - - expect(result.transcripts?.length || 0).toBeGreaterThanOrEqual(2); - expect(result.transcripts?.some((transcript) => transcript.id === transcriptId1)).toBe(true); - expect(result.transcripts?.some((transcript) => transcript.id === transcriptId2)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - describe("full parameter tests", () => { - it("should return transcripts with full parameter set to true", async () => { - expect.assertions(3); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - const transcriptId = await createTestTranscript(cortiClient, interactionId, recordingId); - - const result = await cortiClient.transcripts.list(interactionId, { full: true }); - - expect(result.transcripts?.length || 0).toBeGreaterThan(0); - expect(result.transcripts?.some((transcript) => transcript.id === transcriptId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return transcripts with full parameter set to false", async () => { - expect.assertions(3); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - const transcriptId = await createTestTranscript(cortiClient, interactionId, recordingId); - - const result = await cortiClient.transcripts.list(interactionId, { full: false }); - - expect(result.transcripts?.length || 0).toBeGreaterThan(0); - expect(result.transcripts?.some((transcript) => transcript.id === transcriptId)).toBe(true); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - - it("should return different responses when full parameter is true vs false", async () => { - expect.assertions(4); - - const interactionId = await createTestInteraction(cortiClient, createdInteractionIds); - const recordingId = await createTestRecording(cortiClient, interactionId); - - await createTestTranscript(cortiClient, interactionId, recordingId); - - const resultFull = await cortiClient.transcripts.list(interactionId, { full: true }); - const resultBasic = await cortiClient.transcripts.list(interactionId, { full: false }); - - expect(resultFull.transcripts?.length || 0).toBeGreaterThan(0); - expect(resultBasic.transcripts?.length || 0).toBeGreaterThan(0); - expect(JSON.stringify(resultFull)).not.toBe(JSON.stringify(resultBasic)); - expect(consoleWarnSpy).not.toHaveBeenCalled(); - }); - }); - - describe("should throw error when invalid parameters are provided", () => { - it("should throw error when interaction ID is invalid format", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.list("invalid-uuid")).rejects.toThrow("Status code: 400"); - }); - - it("should throw error when interaction ID does not exist", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.list(faker.string.uuid())).rejects.toThrow("Status code: 404"); - }); - - it("should throw error when interaction ID is null", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.list(null as any)).rejects.toThrow("Expected string. Received null."); - }); - - it("should throw error when interaction ID is undefined", async () => { - expect.assertions(1); - - await expect(cortiClient.transcripts.list(undefined as any)).rejects.toThrow( - "Expected string. Received undefined.", - ); - }); - }); -}); diff --git a/tests/custom/trouble-breathing.mp3 b/tests/custom/trouble-breathing.mp3 deleted file mode 100644 index 5dab309d..00000000 Binary files a/tests/custom/trouble-breathing.mp3 and /dev/null differ diff --git a/tests/mock-server/MockServer.ts b/tests/mock-server/MockServer.ts index 6e258f17..95487215 100644 --- a/tests/mock-server/MockServer.ts +++ b/tests/mock-server/MockServer.ts @@ -1,4 +1,4 @@ -import { RequestHandlerOptions } from "msw"; +import type { RequestHandlerOptions } from "msw"; import type { SetupServer } from "msw/node"; import { mockEndpointBuilder } from "./mockEndpointBuilder"; @@ -19,7 +19,7 @@ export class MockServer { public mockEndpoint(options?: RequestHandlerOptions): ReturnType { const builder = mockEndpointBuilder({ - once: options?.once, + once: options?.once ?? true, onBuild: (handler) => { this.server.use(handler); }, diff --git a/tests/mock-server/MockServerPool.ts b/tests/mock-server/MockServerPool.ts index 81608069..e1a90f7f 100644 --- a/tests/mock-server/MockServerPool.ts +++ b/tests/mock-server/MockServerPool.ts @@ -22,7 +22,7 @@ async function formatHttpRequest(request: Request, id?: string): Promise } else if (clone.body) { body = await clone.text(); } - } catch (e) { + } catch (_e) { body = "(unable to parse body)"; } @@ -48,7 +48,7 @@ async function formatHttpResponse(response: Response, id?: string): Promise { const formattedRequest = await formatHttpRequest(request, requestId); - console.debug("request:start\n" + formattedRequest); + console.debug(`request:start\n${formattedRequest}`); }); mswServer.events.on("request:unhandled", async ({ request, requestId }) => { const formattedRequest = await formatHttpRequest(request, requestId); - console.debug("request:unhandled\n" + formattedRequest); + console.debug(`request:unhandled\n${formattedRequest}`); }); mswServer.events.on("response:mocked", async ({ request, response, requestId }) => { const formattedResponse = await formatHttpResponse(response, requestId); - console.debug("response:mocked\n" + formattedResponse); + console.debug(`response:mocked\n${formattedResponse}`); }); } } diff --git a/tests/mock-server/mockEndpointBuilder.ts b/tests/mock-server/mockEndpointBuilder.ts index 76ed83cb..78985e72 100644 --- a/tests/mock-server/mockEndpointBuilder.ts +++ b/tests/mock-server/mockEndpointBuilder.ts @@ -1,9 +1,10 @@ -import { DefaultBodyType, HttpHandler, HttpResponse, HttpResponseResolver, http } from "msw"; +import { type DefaultBodyType, type HttpHandler, HttpResponse, type HttpResponseResolver, http } from "msw"; import { url } from "../../src/core"; import { toJson } from "../../src/core/json"; +import { withFormUrlEncoded } from "./withFormUrlEncoded"; import { withHeaders } from "./withHeaders"; -import { withJson } from "./withJson"; +import { type WithJsonOptions, withJson } from "./withJson"; type HttpMethod = "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head"; @@ -25,7 +26,8 @@ interface RequestHeadersStage extends RequestBodyStage, ResponseStage { } interface RequestBodyStage extends ResponseStage { - jsonBody(body: unknown): ResponseStage; + jsonBody(body: unknown, options?: WithJsonOptions): ResponseStage; + formUrlEncodedBody(body: unknown): ResponseStage; } interface ResponseStage { @@ -127,8 +129,21 @@ class RequestBuilder implements MethodStage, RequestHeadersStage, RequestBodySta return this; } - jsonBody(body: unknown): ResponseStage { - this.predicates.push((resolver) => withJson(body, resolver)); + jsonBody(body: unknown, options?: WithJsonOptions): ResponseStage { + if (body === undefined) { + throw new Error("Undefined is not valid JSON. Do not call jsonBody if you want an empty body."); + } + this.predicates.push((resolver) => withJson(body, resolver, options)); + return this; + } + + formUrlEncodedBody(body: unknown): ResponseStage { + if (body === undefined) { + throw new Error( + "Undefined is not valid for form-urlencoded. Do not call formUrlEncodedBody if you want an empty body.", + ); + } + this.predicates.push((resolver) => withFormUrlEncoded(body, resolver)); return this; } @@ -179,16 +194,24 @@ class ResponseBuilder implements ResponseStatusStage, ResponseHeaderStage, Respo } public jsonBody(body: unknown): BuildStage { + if (body === undefined) { + throw new Error("Undefined is not valid JSON. Do not call jsonBody if you expect an empty body."); + } this.responseBody = toJson(body); return this; } public build(): HttpHandler { const responseResolver: HttpResponseResolver = () => { - return new HttpResponse(this.responseBody, { + const response = new HttpResponse(this.responseBody, { status: this.responseStatusCode, headers: this.responseHeaders, }); + // if no Content-Type header is set, delete the default text content type that is set + if (Object.keys(this.responseHeaders).some((key) => key.toLowerCase() === "content-type") === false) { + response.headers.delete("Content-Type"); + } + return response; }; const finalResolver = this.requestPredicates.reduceRight((acc, predicate) => predicate(acc), responseResolver); diff --git a/tests/mock-server/setup.ts b/tests/mock-server/setup.ts index c216d607..aeb3a95a 100644 --- a/tests/mock-server/setup.ts +++ b/tests/mock-server/setup.ts @@ -1,4 +1,4 @@ -import { afterAll, beforeAll } from "@jest/globals"; +import { afterAll, beforeAll } from "vitest"; import { mockServerPool } from "./MockServerPool"; diff --git a/tests/mock-server/withFormUrlEncoded.ts b/tests/mock-server/withFormUrlEncoded.ts new file mode 100644 index 00000000..e250cb3c --- /dev/null +++ b/tests/mock-server/withFormUrlEncoded.ts @@ -0,0 +1,89 @@ +import { type HttpResponseResolver, passthrough } from "msw"; + +import { toJson } from "../../src/core/json"; + +/** + * Creates a request matcher that validates if the request form-urlencoded body exactly matches the expected object + * @param expectedBody - The exact body object to match against + * @param resolver - Response resolver to execute if body matches + */ +export function withFormUrlEncoded(expectedBody: unknown, resolver: HttpResponseResolver): HttpResponseResolver { + return async (args) => { + const { request } = args; + + let clonedRequest: Request; + let bodyText: string | undefined; + let actualBody: Record; + try { + clonedRequest = request.clone(); + bodyText = await clonedRequest.text(); + if (bodyText === "") { + // Empty body is valid if expected body is also empty + const isExpectedEmpty = + expectedBody != null && + typeof expectedBody === "object" && + Object.keys(expectedBody as Record).length === 0; + if (!isExpectedEmpty) { + console.error("Request body is empty, expected a form-urlencoded body."); + return passthrough(); + } + actualBody = {}; + } else { + const params = new URLSearchParams(bodyText); + actualBody = {}; + for (const [key, value] of params.entries()) { + actualBody[key] = value; + } + } + } catch (error) { + console.error(`Error processing form-urlencoded request body:\n\tError: ${error}\n\tBody: ${bodyText}`); + return passthrough(); + } + + const mismatches = findMismatches(actualBody, expectedBody); + if (Object.keys(mismatches).length > 0) { + console.error("Form-urlencoded body mismatch:", toJson(mismatches, undefined, 2)); + return passthrough(); + } + + return resolver(args); + }; +} + +function findMismatches(actual: any, expected: any): Record { + const mismatches: Record = {}; + + if (typeof actual !== typeof expected) { + return { value: { actual, expected } }; + } + + if (typeof actual !== "object" || actual === null || expected === null) { + if (actual !== expected) { + return { value: { actual, expected } }; + } + return {}; + } + + const actualKeys = Object.keys(actual); + const expectedKeys = Object.keys(expected); + + const allKeys = new Set([...actualKeys, ...expectedKeys]); + + for (const key of allKeys) { + if (!expectedKeys.includes(key)) { + if (actual[key] === undefined) { + continue; + } + mismatches[key] = { actual: actual[key], expected: undefined }; + } else if (!actualKeys.includes(key)) { + if (expected[key] === undefined) { + continue; + } + mismatches[key] = { actual: undefined, expected: expected[key] }; + } else if (actual[key] !== expected[key]) { + mismatches[key] = { actual: actual[key], expected: expected[key] }; + } + } + + return mismatches; +} diff --git a/tests/mock-server/withHeaders.ts b/tests/mock-server/withHeaders.ts index e77c837d..6599d2b4 100644 --- a/tests/mock-server/withHeaders.ts +++ b/tests/mock-server/withHeaders.ts @@ -1,4 +1,4 @@ -import { HttpResponseResolver, passthrough } from "msw"; +import { type HttpResponseResolver, passthrough } from "msw"; /** * Creates a request matcher that validates if request headers match specified criteria diff --git a/tests/mock-server/withJson.ts b/tests/mock-server/withJson.ts index 44e3eb83..3e8800a0 100644 --- a/tests/mock-server/withJson.ts +++ b/tests/mock-server/withJson.ts @@ -1,28 +1,49 @@ -import { HttpResponseResolver, passthrough } from "msw"; +import { type HttpResponseResolver, passthrough } from "msw"; import { fromJson, toJson } from "../../src/core/json"; +export interface WithJsonOptions { + /** + * List of field names to ignore when comparing request bodies. + * This is useful for pagination cursor fields that change between requests. + */ + ignoredFields?: string[]; +} + /** * Creates a request matcher that validates if the request JSON body exactly matches the expected object * @param expectedBody - The exact body object to match against * @param resolver - Response resolver to execute if body matches + * @param options - Optional configuration including fields to ignore */ -export function withJson(expectedBody: unknown, resolver: HttpResponseResolver): HttpResponseResolver { +export function withJson( + expectedBody: unknown, + resolver: HttpResponseResolver, + options?: WithJsonOptions, +): HttpResponseResolver { + const ignoredFields = options?.ignoredFields ?? []; return async (args) => { const { request } = args; let clonedRequest: Request; + let bodyText: string | undefined; let actualBody: unknown; try { clonedRequest = request.clone(); - actualBody = fromJson(await clonedRequest.text()); + bodyText = await clonedRequest.text(); + if (bodyText === "") { + console.error("Request body is empty, expected a JSON object."); + return passthrough(); + } + actualBody = fromJson(bodyText); } catch (error) { - console.error("Error processing request body:", error); + console.error(`Error processing request body:\n\tError: ${error}\n\tBody: ${bodyText}`); return passthrough(); } const mismatches = findMismatches(actualBody, expectedBody); - if (Object.keys(mismatches).length > 0) { + const filteredMismatches = Object.keys(mismatches).filter((key) => !ignoredFields.includes(key)); + if (filteredMismatches.length > 0) { console.error("JSON body mismatch:", toJson(mismatches, undefined, 2)); return passthrough(); } @@ -61,7 +82,7 @@ function findMismatches(actual: any, expected: any): Record 0) { for (const [mismatchKey, mismatchValue] of Object.entries(itemMismatches)) { - arrayMismatches[`[${i}]${mismatchKey === "value" ? "" : "." + mismatchKey}`] = mismatchValue; + arrayMismatches[`[${i}]${mismatchKey === "value" ? "" : `.${mismatchKey}`}`] = mismatchValue; } } } @@ -93,7 +114,7 @@ function findMismatches(actual: any, expected: any): Record 0) { for (const [nestedKey, nestedValue] of Object.entries(nestedMismatches)) { - mismatches[`${key}${nestedKey === "value" ? "" : "." + nestedKey}`] = nestedValue; + mismatches[`${key}${nestedKey === "value" ? "" : `.${nestedKey}`}`] = nestedValue; } } } else if (actual[key] !== expected[key]) { diff --git a/tests/setup.ts b/tests/setup.ts new file mode 100644 index 00000000..a5651f81 --- /dev/null +++ b/tests/setup.ts @@ -0,0 +1,80 @@ +import { expect } from "vitest"; + +interface CustomMatchers { + toContainHeaders(expectedHeaders: Record): R; +} + +declare module "vitest" { + interface Assertion extends CustomMatchers {} + interface AsymmetricMatchersContaining extends CustomMatchers {} +} + +expect.extend({ + toContainHeaders(actual: unknown, expectedHeaders: Record) { + const isHeaders = actual instanceof Headers; + const isPlainObject = typeof actual === "object" && actual !== null && !Array.isArray(actual); + + if (!isHeaders && !isPlainObject) { + throw new TypeError("Received value must be an instance of Headers or a plain object!"); + } + + if (typeof expectedHeaders !== "object" || expectedHeaders === null || Array.isArray(expectedHeaders)) { + throw new TypeError("Expected headers must be a plain object!"); + } + + const missingHeaders: string[] = []; + const mismatchedHeaders: Array<{ key: string; expected: string; actual: string | null }> = []; + + for (const [key, value] of Object.entries(expectedHeaders)) { + let actualValue: string | null = null; + + if (isHeaders) { + // Headers.get() is already case-insensitive + actualValue = (actual as Headers).get(key); + } else { + // For plain objects, do case-insensitive lookup + const actualObj = actual as Record; + const lowerKey = key.toLowerCase(); + const foundKey = Object.keys(actualObj).find((k) => k.toLowerCase() === lowerKey); + actualValue = foundKey ? actualObj[foundKey] : null; + } + + if (actualValue === null || actualValue === undefined) { + missingHeaders.push(key); + } else if (actualValue !== value) { + mismatchedHeaders.push({ key, expected: value, actual: actualValue }); + } + } + + const pass = missingHeaders.length === 0 && mismatchedHeaders.length === 0; + + const actualType = isHeaders ? "Headers" : "object"; + + if (pass) { + return { + message: () => `expected ${actualType} not to contain ${this.utils.printExpected(expectedHeaders)}`, + pass: true, + }; + } else { + const messages: string[] = []; + + if (missingHeaders.length > 0) { + messages.push(`Missing headers: ${this.utils.printExpected(missingHeaders.join(", "))}`); + } + + if (mismatchedHeaders.length > 0) { + const mismatches = mismatchedHeaders.map( + ({ key, expected, actual }) => + `${key}: expected ${this.utils.printExpected(expected)} but got ${this.utils.printReceived(actual)}`, + ); + messages.push(mismatches.join("\n")); + } + + return { + message: () => + `expected ${actualType} to contain ${this.utils.printExpected(expectedHeaders)}\n\n${messages.join("\n")}`, + pass: false, + }; + } + }, +}); diff --git a/tests/tsconfig.json b/tests/tsconfig.json index 10185ed2..a477df47 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "outDir": null, "rootDir": "..", - "baseUrl": ".." + "baseUrl": "..", + "types": ["vitest/globals"] }, "include": ["../src", "../tests"], "exclude": [] diff --git a/tests/unit/auth/BasicAuth.test.ts b/tests/unit/auth/BasicAuth.test.ts index 79ef9799..9b512336 100644 --- a/tests/unit/auth/BasicAuth.test.ts +++ b/tests/unit/auth/BasicAuth.test.ts @@ -1,21 +1,91 @@ import { BasicAuth } from "../../../src/core/auth/BasicAuth"; describe("BasicAuth", () => { + interface ToHeaderTestCase { + description: string; + input: { username: string; password: string }; + expected: string; + } + + interface FromHeaderTestCase { + description: string; + input: string; + expected: { username: string; password: string }; + } + + interface ErrorTestCase { + description: string; + input: string; + expectedError: string; + } + describe("toAuthorizationHeader", () => { - it("correctly converts to header", () => { - expect( - BasicAuth.toAuthorizationHeader({ - username: "username", - password: "password", - }), - ).toBe("Basic dXNlcm5hbWU6cGFzc3dvcmQ="); + const toHeaderTests: ToHeaderTestCase[] = [ + { + description: "correctly converts to header", + input: { username: "username", password: "password" }, + expected: "Basic dXNlcm5hbWU6cGFzc3dvcmQ=", + }, + ]; + + toHeaderTests.forEach(({ description, input, expected }) => { + it(description, () => { + expect(BasicAuth.toAuthorizationHeader(input)).toBe(expected); + }); }); }); + describe("fromAuthorizationHeader", () => { - it("correctly parses header", () => { - expect(BasicAuth.fromAuthorizationHeader("Basic dXNlcm5hbWU6cGFzc3dvcmQ=")).toEqual({ - username: "username", - password: "password", + const fromHeaderTests: FromHeaderTestCase[] = [ + { + description: "correctly parses header", + input: "Basic dXNlcm5hbWU6cGFzc3dvcmQ=", + expected: { username: "username", password: "password" }, + }, + { + description: "handles password with colons", + input: "Basic dXNlcjpwYXNzOndvcmQ=", + expected: { username: "user", password: "pass:word" }, + }, + { + description: "handles empty username and password (just colon)", + input: "Basic Og==", + expected: { username: "", password: "" }, + }, + { + description: "handles empty username", + input: "Basic OnBhc3N3b3Jk", + expected: { username: "", password: "password" }, + }, + { + description: "handles empty password", + input: "Basic dXNlcm5hbWU6", + expected: { username: "username", password: "" }, + }, + ]; + + fromHeaderTests.forEach(({ description, input, expected }) => { + it(description, () => { + expect(BasicAuth.fromAuthorizationHeader(input)).toEqual(expected); + }); + }); + + const errorTests: ErrorTestCase[] = [ + { + description: "throws error for completely empty credentials", + input: "Basic ", + expectedError: "Invalid basic auth", + }, + { + description: "throws error for credentials without colon", + input: "Basic dXNlcm5hbWU=", + expectedError: "Invalid basic auth", + }, + ]; + + errorTests.forEach(({ description, input, expectedError }) => { + it(description, () => { + expect(() => BasicAuth.fromAuthorizationHeader(input)).toThrow(expectedError); }); }); }); diff --git a/tests/unit/fetcher/Fetcher.test.ts b/tests/unit/fetcher/Fetcher.test.ts index a9bd945d..6c176242 100644 --- a/tests/unit/fetcher/Fetcher.test.ts +++ b/tests/unit/fetcher/Fetcher.test.ts @@ -1,9 +1,8 @@ import fs from "fs"; -import stream from "stream"; import { join } from "path"; - -import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; -import { BinaryResponse } from "../../../src/core"; +import stream from "stream"; +import type { BinaryResponse } from "../../../src/core"; +import { type Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; describe("Test fetcherImpl", () => { it("should handle successful request", async () => { @@ -14,10 +13,11 @@ describe("Test fetcherImpl", () => { body: { data: "test" }, contentType: "application/json", requestType: "json", + maxRetries: 0, responseType: "json", }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response(JSON.stringify({ data: "test" }), { status: 200, statusText: "OK", @@ -34,7 +34,7 @@ describe("Test fetcherImpl", () => { "https://httpbin.org/post", expect.objectContaining({ method: "POST", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), body: JSON.stringify({ data: "test" }), }), ); @@ -48,11 +48,12 @@ describe("Test fetcherImpl", () => { headers: { "X-Test": "x-test-header" }, contentType: "application/octet-stream", requestType: "bytes", + maxRetries: 0, responseType: "json", body: fs.createReadStream(join(__dirname, "test-file.txt")), }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response(JSON.stringify({ data: "test" }), { status: 200, statusText: "OK", @@ -65,7 +66,7 @@ describe("Test fetcherImpl", () => { url, expect.objectContaining({ method: "POST", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), body: expect.any(fs.ReadStream), }), ); @@ -81,10 +82,11 @@ describe("Test fetcherImpl", () => { url, method: "GET", headers: { "X-Test": "x-test-header" }, + maxRetries: 0, responseType: "binary-response", }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response( stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, { @@ -100,7 +102,7 @@ describe("Test fetcherImpl", () => { url, expect.objectContaining({ method: "GET", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), }), ); expect(result.ok).toBe(true); @@ -111,11 +113,12 @@ describe("Test fetcherImpl", () => { expect(typeof body.stream).toBe("function"); const stream = body.stream(); expect(stream).toBeInstanceOf(ReadableStream); - const reader = stream.getReader(); + const readableStream = stream as ReadableStream; + const reader = readableStream.getReader(); const { value } = await reader.read(); const decoder = new TextDecoder(); const streamContent = decoder.decode(value); - expect(streamContent).toBe("This is a test file!\n"); + expect(streamContent.trim()).toBe("This is a test file!"); expect(body.bodyUsed).toBe(true); } }); @@ -126,10 +129,11 @@ describe("Test fetcherImpl", () => { url, method: "GET", headers: { "X-Test": "x-test-header" }, + maxRetries: 0, responseType: "binary-response", }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response( stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, { @@ -145,7 +149,7 @@ describe("Test fetcherImpl", () => { url, expect.objectContaining({ method: "GET", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), }), ); expect(result.ok).toBe(true); @@ -160,7 +164,7 @@ describe("Test fetcherImpl", () => { const { value } = await reader.read(); const decoder = new TextDecoder(); const streamContent = decoder.decode(value); - expect(streamContent).toBe("This is a test file!\n"); + expect(streamContent.trim()).toBe("This is a test file!"); expect(body.bodyUsed).toBe(true); } }); @@ -171,10 +175,11 @@ describe("Test fetcherImpl", () => { url, method: "GET", headers: { "X-Test": "x-test-header" }, + maxRetries: 0, responseType: "binary-response", }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response( stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, { @@ -190,7 +195,7 @@ describe("Test fetcherImpl", () => { url, expect.objectContaining({ method: "GET", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), }), ); expect(result.ok).toBe(true); @@ -203,7 +208,7 @@ describe("Test fetcherImpl", () => { expect(arrayBuffer).toBeInstanceOf(ArrayBuffer); const decoder = new TextDecoder(); const streamContent = decoder.decode(new Uint8Array(arrayBuffer)); - expect(streamContent).toBe("This is a test file!\n"); + expect(streamContent.trim()).toBe("This is a test file!"); expect(body.bodyUsed).toBe(true); } }); @@ -214,10 +219,11 @@ describe("Test fetcherImpl", () => { url, method: "GET", headers: { "X-Test": "x-test-header" }, + maxRetries: 0, responseType: "binary-response", }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response( stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, { @@ -233,7 +239,7 @@ describe("Test fetcherImpl", () => { url, expect.objectContaining({ method: "GET", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), }), ); expect(result.ok).toBe(true); @@ -249,7 +255,7 @@ describe("Test fetcherImpl", () => { expect(bytes).toBeInstanceOf(Uint8Array); const decoder = new TextDecoder(); const streamContent = decoder.decode(bytes); - expect(streamContent).toBe("This is a test file!\n"); + expect(streamContent.trim()).toBe("This is a test file!"); expect(body.bodyUsed).toBe(true); } }); diff --git a/tests/unit/fetcher/HttpResponsePromise.test.ts b/tests/unit/fetcher/HttpResponsePromise.test.ts index 2216a33e..2ec008e5 100644 --- a/tests/unit/fetcher/HttpResponsePromise.test.ts +++ b/tests/unit/fetcher/HttpResponsePromise.test.ts @@ -1,7 +1,7 @@ -import { beforeEach, describe, expect, it, jest } from "@jest/globals"; +import { beforeEach, describe, expect, it, vi } from "vitest"; import { HttpResponsePromise } from "../../../src/core/fetcher/HttpResponsePromise"; -import { RawResponse, WithRawResponse } from "../../../src/core/fetcher/RawResponse"; +import type { RawResponse, WithRawResponse } from "../../../src/core/fetcher/RawResponse"; describe("HttpResponsePromise", () => { const mockRawResponse: RawResponse = { @@ -20,7 +20,7 @@ describe("HttpResponsePromise", () => { describe("fromFunction", () => { it("should create an HttpResponsePromise from a function", async () => { - const mockFn = jest + const mockFn = vi .fn<(arg1: string, arg2: string) => Promise>>() .mockResolvedValue(mockWithRawResponse); @@ -111,7 +111,7 @@ describe("HttpResponsePromise", () => { reject(new Error("Test error")); }); - const catchSpy = jest.fn(); + const catchSpy = vi.fn(); await errorResponsePromise.catch(catchSpy); expect(catchSpy).toHaveBeenCalled(); @@ -121,7 +121,7 @@ describe("HttpResponsePromise", () => { }); it("should support finally() method", async () => { - const finallySpy = jest.fn(); + const finallySpy = vi.fn(); await responsePromise.finally(finallySpy); expect(finallySpy).toHaveBeenCalled(); diff --git a/tests/unit/fetcher/RawResponse.test.ts b/tests/unit/fetcher/RawResponse.test.ts index 9ccd5e1e..375ee3f3 100644 --- a/tests/unit/fetcher/RawResponse.test.ts +++ b/tests/unit/fetcher/RawResponse.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it } from "@jest/globals"; +import { describe, expect, it } from "vitest"; import { toRawResponse } from "../../../src/core/fetcher/RawResponse"; diff --git a/tests/unit/fetcher/createRequestUrl.test.ts b/tests/unit/fetcher/createRequestUrl.test.ts index 06e03b2c..a92f1b5e 100644 --- a/tests/unit/fetcher/createRequestUrl.test.ts +++ b/tests/unit/fetcher/createRequestUrl.test.ts @@ -1,160 +1,163 @@ import { createRequestUrl } from "../../../src/core/fetcher/createRequestUrl"; describe("Test createRequestUrl", () => { - it("should return the base URL when no query parameters are provided", () => { - const baseUrl = "https://api.example.com"; - expect(createRequestUrl(baseUrl)).toBe(baseUrl); - }); - - it("should append simple query parameters", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { key: "value", another: "param" }; - expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?key=value&another=param"); - }); - - it("should handle array query parameters", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { items: ["a", "b", "c"] }; - expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?items=a&items=b&items=c"); - }); - - it("should handle object query parameters", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { filter: { name: "John", age: 30 } }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30", - ); - }); - - it("should handle mixed types of query parameters", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - simple: "value", - array: ["x", "y"], - object: { key: "value" }, - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value", - ); - }); - - it("should handle empty query parameters object", () => { - const baseUrl = "https://api.example.com"; - expect(createRequestUrl(baseUrl, {})).toBe(baseUrl); - }); - - it("should encode special characters in query parameters", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { special: "a&b=c d" }; - expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?special=a%26b%3Dc%20d"); - }); - - // Additional tests for edge cases and different value types - it("should handle numeric values", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { count: 42, price: 19.99, active: 1, inactive: 0 }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?count=42&price=19.99&active=1&inactive=0", - ); - }); - - it("should handle boolean values", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { enabled: true, disabled: false }; - expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?enabled=true&disabled=false"); - }); - - it("should handle null and undefined values", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - valid: "value", - nullValue: null, - undefinedValue: undefined, - emptyString: "", - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?valid=value&nullValue=&emptyString=", - ); - }); - - it("should handle deeply nested objects", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - user: { - profile: { - name: "John", - settings: { theme: "dark" }, + const BASE_URL = "https://api.example.com"; + + interface TestCase { + description: string; + baseUrl: string; + queryParams?: Record; + expected: string; + } + + const testCases: TestCase[] = [ + { + description: "should return the base URL when no query parameters are provided", + baseUrl: BASE_URL, + expected: BASE_URL, + }, + { + description: "should append simple query parameters", + baseUrl: BASE_URL, + queryParams: { key: "value", another: "param" }, + expected: "https://api.example.com?key=value&another=param", + }, + { + description: "should handle array query parameters", + baseUrl: BASE_URL, + queryParams: { items: ["a", "b", "c"] }, + expected: "https://api.example.com?items=a&items=b&items=c", + }, + { + description: "should handle object query parameters", + baseUrl: BASE_URL, + queryParams: { filter: { name: "John", age: 30 } }, + expected: "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30", + }, + { + description: "should handle mixed types of query parameters", + baseUrl: BASE_URL, + queryParams: { + simple: "value", + array: ["x", "y"], + object: { key: "value" }, + }, + expected: "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value", + }, + { + description: "should handle empty query parameters object", + baseUrl: BASE_URL, + queryParams: {}, + expected: BASE_URL, + }, + { + description: "should encode special characters in query parameters", + baseUrl: BASE_URL, + queryParams: { special: "a&b=c d" }, + expected: "https://api.example.com?special=a%26b%3Dc%20d", + }, + { + description: "should handle numeric values", + baseUrl: BASE_URL, + queryParams: { count: 42, price: 19.99, active: 1, inactive: 0 }, + expected: "https://api.example.com?count=42&price=19.99&active=1&inactive=0", + }, + { + description: "should handle boolean values", + baseUrl: BASE_URL, + queryParams: { enabled: true, disabled: false }, + expected: "https://api.example.com?enabled=true&disabled=false", + }, + { + description: "should handle null and undefined values", + baseUrl: BASE_URL, + queryParams: { + valid: "value", + nullValue: null, + undefinedValue: undefined, + emptyString: "", + }, + expected: "https://api.example.com?valid=value&nullValue=&emptyString=", + }, + { + description: "should handle deeply nested objects", + baseUrl: BASE_URL, + queryParams: { + user: { + profile: { + name: "John", + settings: { theme: "dark" }, + }, }, }, - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?user%5Bprofile%5D%5Bname%5D=John&user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark", - ); - }); - - it("should handle arrays of objects", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - users: [ - { name: "John", age: 30 }, - { name: "Jane", age: 25 }, - ], - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?users%5Bname%5D=John&users%5Bage%5D=30&users%5Bname%5D=Jane&users%5Bage%5D=25", - ); - }); - - it("should handle mixed arrays", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - mixed: ["string", 42, true, { key: "value" }], - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?mixed=string&mixed=42&mixed=true&mixed%5Bkey%5D=value", - ); - }); - - it("should handle empty arrays", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { emptyArray: [] }; - expect(createRequestUrl(baseUrl, queryParams)).toBe(baseUrl); - }); - - it("should handle empty objects", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { emptyObject: {} }; - expect(createRequestUrl(baseUrl, queryParams)).toBe(baseUrl); - }); - - it("should handle special characters in keys", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { "key with spaces": "value", "key[with]brackets": "value" }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?key%20with%20spaces=value&key%5Bwith%5Dbrackets=value", - ); - }); - - it("should handle URL with existing query parameters", () => { - const baseUrl = "https://api.example.com?existing=param"; - const queryParams = { new: "value" }; - expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?existing=param?new=value"); - }); - - it("should handle complex nested structures", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - filters: { - status: ["active", "pending"], - category: { - type: "electronics", - subcategories: ["phones", "laptops"], + expected: + "https://api.example.com?user%5Bprofile%5D%5Bname%5D=John&user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark", + }, + { + description: "should handle arrays of objects", + baseUrl: BASE_URL, + queryParams: { + users: [ + { name: "John", age: 30 }, + { name: "Jane", age: 25 }, + ], + }, + expected: + "https://api.example.com?users%5Bname%5D=John&users%5Bage%5D=30&users%5Bname%5D=Jane&users%5Bage%5D=25", + }, + { + description: "should handle mixed arrays", + baseUrl: BASE_URL, + queryParams: { + mixed: ["string", 42, true, { key: "value" }], + }, + expected: "https://api.example.com?mixed=string&mixed=42&mixed=true&mixed%5Bkey%5D=value", + }, + { + description: "should handle empty arrays", + baseUrl: BASE_URL, + queryParams: { emptyArray: [] }, + expected: BASE_URL, + }, + { + description: "should handle empty objects", + baseUrl: BASE_URL, + queryParams: { emptyObject: {} }, + expected: BASE_URL, + }, + { + description: "should handle special characters in keys", + baseUrl: BASE_URL, + queryParams: { "key with spaces": "value", "key[with]brackets": "value" }, + expected: "https://api.example.com?key%20with%20spaces=value&key%5Bwith%5Dbrackets=value", + }, + { + description: "should handle URL with existing query parameters", + baseUrl: "https://api.example.com?existing=param", + queryParams: { new: "value" }, + expected: "https://api.example.com?existing=param?new=value", + }, + { + description: "should handle complex nested structures", + baseUrl: BASE_URL, + queryParams: { + filters: { + status: ["active", "pending"], + category: { + type: "electronics", + subcategories: ["phones", "laptops"], + }, }, + sort: { field: "name", direction: "asc" }, }, - sort: { field: "name", direction: "asc" }, - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?filters%5Bstatus%5D=active&filters%5Bstatus%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", - ); + expected: + "https://api.example.com?filters%5Bstatus%5D=active&filters%5Bstatus%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", + }, + ]; + + testCases.forEach(({ description, baseUrl, queryParams, expected }) => { + it(description, () => { + expect(createRequestUrl(baseUrl, queryParams)).toBe(expected); + }); }); }); diff --git a/tests/unit/fetcher/getRequestBody.test.ts b/tests/unit/fetcher/getRequestBody.test.ts index e864c8b5..8a6c3a57 100644 --- a/tests/unit/fetcher/getRequestBody.test.ts +++ b/tests/unit/fetcher/getRequestBody.test.ts @@ -2,15 +2,117 @@ import { getRequestBody } from "../../../src/core/fetcher/getRequestBody"; import { RUNTIME } from "../../../src/core/runtime"; describe("Test getRequestBody", () => { - it("should stringify body if not FormData in Node environment", async () => { - if (RUNTIME.type === "node") { - const body = { key: "value" }; + interface TestCase { + description: string; + input: any; + type: "json" | "form" | "file" | "bytes" | "other"; + expected: any; + skipCondition?: () => boolean; + } + + const testCases: TestCase[] = [ + { + description: "should stringify body if not FormData in Node environment", + input: { key: "value" }, + type: "json", + expected: '{"key":"value"}', + skipCondition: () => RUNTIME.type !== "node", + }, + { + description: "should stringify body if not FormData in browser environment", + input: { key: "value" }, + type: "json", + expected: '{"key":"value"}', + skipCondition: () => RUNTIME.type !== "browser", + }, + { + description: "should return the Uint8Array", + input: new Uint8Array([1, 2, 3]), + type: "bytes", + expected: new Uint8Array([1, 2, 3]), + }, + { + description: "should serialize objects for form-urlencoded content type", + input: { username: "johndoe", email: "john@example.com" }, + type: "form", + expected: "username=johndoe&email=john%40example.com", + }, + { + description: "should serialize complex nested objects and arrays for form-urlencoded content type", + input: { + user: { + profile: { + name: "John Doe", + settings: { + theme: "dark", + notifications: true, + }, + }, + tags: ["admin", "user"], + contacts: [ + { type: "email", value: "john@example.com" }, + { type: "phone", value: "+1234567890" }, + ], + }, + filters: { + status: ["active", "pending"], + metadata: { + created: "2024-01-01", + categories: ["electronics", "books"], + }, + }, + preferences: ["notifications", "updates"], + }, + type: "form", + expected: + "user%5Bprofile%5D%5Bname%5D=John%20Doe&" + + "user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark&" + + "user%5Bprofile%5D%5Bsettings%5D%5Bnotifications%5D=true&" + + "user%5Btags%5D=admin&" + + "user%5Btags%5D=user&" + + "user%5Bcontacts%5D%5Btype%5D=email&" + + "user%5Bcontacts%5D%5Bvalue%5D=john%40example.com&" + + "user%5Bcontacts%5D%5Btype%5D=phone&" + + "user%5Bcontacts%5D%5Bvalue%5D=%2B1234567890&" + + "filters%5Bstatus%5D=active&" + + "filters%5Bstatus%5D=pending&" + + "filters%5Bmetadata%5D%5Bcreated%5D=2024-01-01&" + + "filters%5Bmetadata%5D%5Bcategories%5D=electronics&" + + "filters%5Bmetadata%5D%5Bcategories%5D=books&" + + "preferences=notifications&" + + "preferences=updates", + }, + { + description: "should return the input for pre-serialized form-urlencoded strings", + input: "key=value&another=param", + type: "other", + expected: "key=value&another=param", + }, + { + description: "should JSON stringify objects", + input: { key: "value" }, + type: "json", + expected: '{"key":"value"}', + }, + ]; + + testCases.forEach(({ description, input, type, expected, skipCondition }) => { + it(description, async () => { + if (skipCondition?.()) { + return; + } + const result = await getRequestBody({ - body, - type: "json", + body: input, + type, }); - expect(result).toBe('{"key":"value"}'); - } + + if (input instanceof Uint8Array) { + expect(result).toBe(input); + } else { + expect(result).toBe(expected); + } + }); }); it("should return FormData in browser environment", async () => { @@ -24,42 +126,4 @@ describe("Test getRequestBody", () => { expect(result).toBe(formData); } }); - - it("should stringify body if not FormData in browser environment", async () => { - if (RUNTIME.type === "browser") { - const body = { key: "value" }; - const result = await getRequestBody({ - body, - type: "json", - }); - expect(result).toBe('{"key":"value"}'); - } - }); - - it("should return the Uint8Array", async () => { - const input = new Uint8Array([1, 2, 3]); - const result = await getRequestBody({ - body: input, - type: "bytes", - }); - expect(result).toBe(input); - }); - - it("should return the input for content-type 'application/x-www-form-urlencoded'", async () => { - const input = "key=value&another=param"; - const result = await getRequestBody({ - body: input, - type: "other", - }); - expect(result).toBe(input); - }); - - it("should JSON stringify objects", async () => { - const input = { key: "value" }; - const result = await getRequestBody({ - body: input, - type: "json", - }); - expect(result).toBe('{"key":"value"}'); - }); }); diff --git a/tests/unit/fetcher/getResponseBody.test.ts b/tests/unit/fetcher/getResponseBody.test.ts index 400782f5..ad6be7fc 100644 --- a/tests/unit/fetcher/getResponseBody.test.ts +++ b/tests/unit/fetcher/getResponseBody.test.ts @@ -1,7 +1,61 @@ -import { RUNTIME } from "../../../src/core/runtime"; import { getResponseBody } from "../../../src/core/fetcher/getResponseBody"; +import { RUNTIME } from "../../../src/core/runtime"; + describe("Test getResponseBody", () => { + interface SimpleTestCase { + description: string; + responseData: string | Record; + responseType?: "blob" | "sse" | "streaming" | "text"; + expected: any; + skipCondition?: () => boolean; + } + + const simpleTestCases: SimpleTestCase[] = [ + { + description: "should handle text response type", + responseData: "test text", + responseType: "text", + expected: "test text", + }, + { + description: "should handle JSON response", + responseData: { key: "value" }, + expected: { key: "value" }, + }, + { + description: "should handle empty response", + responseData: "", + expected: undefined, + }, + { + description: "should handle non-JSON response", + responseData: "invalid json", + expected: { + ok: false, + error: { + reason: "non-json", + statusCode: 200, + rawBody: "invalid json", + }, + }, + }, + ]; + + simpleTestCases.forEach(({ description, responseData, responseType, expected, skipCondition }) => { + it(description, async () => { + if (skipCondition?.()) { + return; + } + + const mockResponse = new Response( + typeof responseData === "string" ? responseData : JSON.stringify(responseData), + ); + const result = await getResponseBody(mockResponse, responseType); + expect(result).toEqual(expected); + }); + }); + it("should handle blob response type", async () => { const mockBlob = new Blob(["test"], { type: "text/plain" }); const mockResponse = new Response(mockBlob); @@ -20,7 +74,6 @@ describe("Test getResponseBody", () => { }); it("should handle streaming response type", async () => { - // Create a ReadableStream with some test data const encoder = new TextEncoder(); const testData = "test stream data"; const mockStream = new ReadableStream({ @@ -35,43 +88,10 @@ describe("Test getResponseBody", () => { expect(result).toBeInstanceOf(ReadableStream); - // Read and verify the stream content const reader = result.getReader(); const decoder = new TextDecoder(); const { value } = await reader.read(); const streamContent = decoder.decode(value); expect(streamContent).toBe(testData); }); - - it("should handle text response type", async () => { - const mockResponse = new Response("test text"); - const result = await getResponseBody(mockResponse, "text"); - expect(result).toBe("test text"); - }); - - it("should handle JSON response", async () => { - const mockJson = { key: "value" }; - const mockResponse = new Response(JSON.stringify(mockJson)); - const result = await getResponseBody(mockResponse); - expect(result).toEqual(mockJson); - }); - - it("should handle empty response", async () => { - const mockResponse = new Response(""); - const result = await getResponseBody(mockResponse); - expect(result).toBeUndefined(); - }); - - it("should handle non-JSON response", async () => { - const mockResponse = new Response("invalid json"); - const result = await getResponseBody(mockResponse); - expect(result).toEqual({ - ok: false, - error: { - reason: "non-json", - statusCode: 200, - rawBody: "invalid json", - }, - }); - }); }); diff --git a/tests/unit/fetcher/logging.test.ts b/tests/unit/fetcher/logging.test.ts new file mode 100644 index 00000000..366c9b6c --- /dev/null +++ b/tests/unit/fetcher/logging.test.ts @@ -0,0 +1,517 @@ +import { fetcherImpl } from "../../../src/core/fetcher/Fetcher"; + +function createMockLogger() { + return { + debug: vi.fn(), + info: vi.fn(), + warn: vi.fn(), + error: vi.fn(), + }; +} + +function mockSuccessResponse(data: unknown = { data: "test" }, status = 200, statusText = "OK") { + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify(data), { + status, + statusText, + }), + ); +} + +function mockErrorResponse(data: unknown = { error: "Error" }, status = 404, statusText = "Not Found") { + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify(data), { + status, + statusText, + }), + ); +} + +describe("Fetcher Logging Integration", () => { + describe("Request Logging", () => { + it("should log successful request at debug level", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "POST", + headers: { "Content-Type": "application/json" }, + body: { test: "data" }, + contentType: "application/json", + requestType: "json", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + method: "POST", + url: "https://example.com/api", + headers: expect.toContainHeaders({ + "Content-Type": "application/json", + }), + hasBody: true, + }), + ); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "HTTP request succeeded", + expect.objectContaining({ + method: "POST", + url: "https://example.com/api", + statusCode: 200, + }), + ); + }); + + it("should not log debug messages at info level for successful requests", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "info", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + }); + + it("should log request with body flag", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "POST", + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + hasBody: true, + }), + ); + }); + + it("should log request without body flag", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + hasBody: false, + }), + ); + }); + + it("should not log when silent mode is enabled", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: true, + }, + }); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + expect(mockLogger.warn).not.toHaveBeenCalled(); + expect(mockLogger.error).not.toHaveBeenCalled(); + }); + + it("should not log when no logging config is provided", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + }); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + }); + }); + + describe("Error Logging", () => { + it("should log 4xx errors at error level", async () => { + const mockLogger = createMockLogger(); + mockErrorResponse({ error: "Not found" }, 404, "Not Found"); + + const result = await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(result.ok).toBe(false); + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request failed with error status", + expect.objectContaining({ + method: "GET", + url: "https://example.com/api", + statusCode: 404, + }), + ); + }); + + it("should log 5xx errors at error level", async () => { + const mockLogger = createMockLogger(); + mockErrorResponse({ error: "Internal error" }, 500, "Internal Server Error"); + + const result = await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(result.ok).toBe(false); + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request failed with error status", + expect.objectContaining({ + method: "GET", + url: "https://example.com/api", + statusCode: 500, + }), + ); + }); + + it("should log aborted request errors", async () => { + const mockLogger = createMockLogger(); + + const abortController = new AbortController(); + abortController.abort(); + + global.fetch = vi.fn().mockRejectedValue(new Error("Aborted")); + + const result = await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + abortSignal: abortController.signal, + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(result.ok).toBe(false); + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request was aborted", + expect.objectContaining({ + method: "GET", + url: "https://example.com/api", + }), + ); + }); + + it("should log timeout errors", async () => { + const mockLogger = createMockLogger(); + + const timeoutError = new Error("Request timeout"); + timeoutError.name = "AbortError"; + + global.fetch = vi.fn().mockRejectedValue(timeoutError); + + const result = await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(result.ok).toBe(false); + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request timed out", + expect.objectContaining({ + method: "GET", + url: "https://example.com/api", + timeoutMs: undefined, + }), + ); + }); + + it("should log unknown errors", async () => { + const mockLogger = createMockLogger(); + + const unknownError = new Error("Unknown error"); + + global.fetch = vi.fn().mockRejectedValue(unknownError); + + const result = await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(result.ok).toBe(false); + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request failed with error", + expect.objectContaining({ + method: "GET", + url: "https://example.com/api", + errorMessage: "Unknown error", + }), + ); + }); + }); + + describe("Logging with Redaction", () => { + it("should redact sensitive data in error logs", async () => { + const mockLogger = createMockLogger(); + mockErrorResponse({ error: "Unauthorized" }, 401, "Unauthorized"); + + await fetcherImpl({ + url: "https://example.com/api?api_key=secret", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request failed with error status", + expect.objectContaining({ + url: "https://example.com/api?api_key=[REDACTED]", + }), + ); + }); + }); + + describe("Different HTTP Methods", () => { + it("should log GET requests", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + method: "GET", + }), + ); + }); + + it("should log POST requests", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse({ data: "test" }, 201, "Created"); + + await fetcherImpl({ + url: "https://example.com/api", + method: "POST", + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + method: "POST", + }), + ); + }); + + it("should log PUT requests", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "PUT", + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + method: "PUT", + }), + ); + }); + + it("should log DELETE requests", async () => { + const mockLogger = createMockLogger(); + global.fetch = vi.fn().mockResolvedValue( + new Response(null, { + status: 200, + statusText: "OK", + }), + ); + + await fetcherImpl({ + url: "https://example.com/api", + method: "DELETE", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + method: "DELETE", + }), + ); + }); + }); + + describe("Status Code Logging", () => { + it("should log 2xx success status codes", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse({ data: "test" }, 201, "Created"); + + await fetcherImpl({ + url: "https://example.com/api", + method: "POST", + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "HTTP request succeeded", + expect.objectContaining({ + statusCode: 201, + }), + ); + }); + + it("should log 3xx redirect status codes as success", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse({ data: "test" }, 301, "Moved Permanently"); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "HTTP request succeeded", + expect.objectContaining({ + statusCode: 301, + }), + ); + }); + }); +}); diff --git a/tests/unit/fetcher/makeRequest.test.ts b/tests/unit/fetcher/makeRequest.test.ts index 43ed9d11..ea49466a 100644 --- a/tests/unit/fetcher/makeRequest.test.ts +++ b/tests/unit/fetcher/makeRequest.test.ts @@ -1,3 +1,4 @@ +import type { Mock } from "vitest"; import { makeRequest } from "../../../src/core/fetcher/makeRequest"; describe("Test makeRequest", () => { @@ -6,10 +7,10 @@ describe("Test makeRequest", () => { const mockHeaders = { "Content-Type": "application/json" }; const mockBody = JSON.stringify({ key: "value" }); - let mockFetch: jest.Mock; + let mockFetch: Mock; beforeEach(() => { - mockFetch = jest.fn(); + mockFetch = vi.fn(); mockFetch.mockResolvedValue(new Response(JSON.stringify({ test: "successful" }), { status: 200 })); }); diff --git a/tests/unit/fetcher/redacting.test.ts b/tests/unit/fetcher/redacting.test.ts new file mode 100644 index 00000000..d599376b --- /dev/null +++ b/tests/unit/fetcher/redacting.test.ts @@ -0,0 +1,1115 @@ +import { fetcherImpl } from "../../../src/core/fetcher/Fetcher"; + +function createMockLogger() { + return { + debug: vi.fn(), + info: vi.fn(), + warn: vi.fn(), + error: vi.fn(), + }; +} + +function mockSuccessResponse(data: unknown = { data: "test" }, status = 200, statusText = "OK") { + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify(data), { + status, + statusText, + }), + ); +} + +describe("Redacting Logic", () => { + describe("Header Redaction", () => { + it("should redact authorization header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { Authorization: "Bearer secret-token-12345" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + Authorization: "[REDACTED]", + }), + }), + ); + }); + + it("should redact api-key header (case-insensitive)", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "X-API-KEY": "secret-api-key" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "X-API-KEY": "[REDACTED]", + }), + }), + ); + }); + + it("should redact cookie header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { Cookie: "session=abc123; token=xyz789" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + Cookie: "[REDACTED]", + }), + }), + ); + }); + + it("should redact x-auth-token header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "x-auth-token": "auth-token-12345" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "x-auth-token": "[REDACTED]", + }), + }), + ); + }); + + it("should redact proxy-authorization header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "Proxy-Authorization": "Basic credentials" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "Proxy-Authorization": "[REDACTED]", + }), + }), + ); + }); + + it("should redact x-csrf-token header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "X-CSRF-Token": "csrf-token-abc" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "X-CSRF-Token": "[REDACTED]", + }), + }), + ); + }); + + it("should redact www-authenticate header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "WWW-Authenticate": "Bearer realm=example" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "WWW-Authenticate": "[REDACTED]", + }), + }), + ); + }); + + it("should redact x-session-token header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "X-Session-Token": "session-token-xyz" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "X-Session-Token": "[REDACTED]", + }), + }), + ); + }); + + it("should not redact non-sensitive headers", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { + "Content-Type": "application/json", + "User-Agent": "Test/1.0", + Accept: "application/json", + }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "Content-Type": "application/json", + "User-Agent": "Test/1.0", + Accept: "application/json", + }), + }), + ); + }); + + it("should redact multiple sensitive headers at once", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { + Authorization: "Bearer token", + "X-API-Key": "api-key", + Cookie: "session=123", + "Content-Type": "application/json", + }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + Authorization: "[REDACTED]", + "X-API-Key": "[REDACTED]", + Cookie: "[REDACTED]", + "Content-Type": "application/json", + }), + }), + ); + }); + }); + + describe("Response Header Redaction", () => { + it("should redact Set-Cookie in response headers", async () => { + const mockLogger = createMockLogger(); + + const mockHeaders = new Headers(); + mockHeaders.set("Set-Cookie", "session=abc123; HttpOnly; Secure"); + mockHeaders.set("Content-Type", "application/json"); + + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify({ data: "test" }), { + status: 200, + statusText: "OK", + headers: mockHeaders, + }), + ); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "HTTP request succeeded", + expect.objectContaining({ + responseHeaders: expect.toContainHeaders({ + "set-cookie": "[REDACTED]", + "content-type": "application/json", + }), + }), + ); + }); + + it("should redact authorization in response headers", async () => { + const mockLogger = createMockLogger(); + + const mockHeaders = new Headers(); + mockHeaders.set("Authorization", "Bearer token-123"); + mockHeaders.set("Content-Type", "application/json"); + + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify({ data: "test" }), { + status: 200, + statusText: "OK", + headers: mockHeaders, + }), + ); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "HTTP request succeeded", + expect.objectContaining({ + responseHeaders: expect.toContainHeaders({ + authorization: "[REDACTED]", + "content-type": "application/json", + }), + }), + ); + }); + + it("should redact response headers in error responses", async () => { + const mockLogger = createMockLogger(); + + const mockHeaders = new Headers(); + mockHeaders.set("WWW-Authenticate", "Bearer realm=example"); + mockHeaders.set("Content-Type", "application/json"); + + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify({ error: "Unauthorized" }), { + status: 401, + statusText: "Unauthorized", + headers: mockHeaders, + }), + ); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request failed with error status", + expect.objectContaining({ + responseHeaders: expect.toContainHeaders({ + "www-authenticate": "[REDACTED]", + "content-type": "application/json", + }), + }), + ); + }); + }); + + describe("Query Parameter Redaction", () => { + it("should redact api_key query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { api_key: "secret-key" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + api_key: "[REDACTED]", + }), + }), + ); + }); + + it("should redact token query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { token: "secret-token" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + token: "[REDACTED]", + }), + }), + ); + }); + + it("should redact access_token query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { access_token: "secret-access-token" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + access_token: "[REDACTED]", + }), + }), + ); + }); + + it("should redact password query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { password: "secret-password" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + password: "[REDACTED]", + }), + }), + ); + }); + + it("should redact secret query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { secret: "secret-value" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + secret: "[REDACTED]", + }), + }), + ); + }); + + it("should redact session_id query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { session_id: "session-123" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + session_id: "[REDACTED]", + }), + }), + ); + }); + + it("should not redact non-sensitive query parameters", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { + page: "1", + limit: "10", + sort: "name", + }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + page: "1", + limit: "10", + sort: "name", + }), + }), + ); + }); + + it("should not redact parameters containing 'auth' substring like 'author'", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { + author: "john", + authenticate: "false", + authorization_level: "user", + }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + author: "john", + authenticate: "false", + authorization_level: "user", + }), + }), + ); + }); + + it("should handle undefined query parameters", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: undefined, + }), + ); + }); + + it("should redact case-insensitive query parameters", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { API_KEY: "secret-key", Token: "secret-token" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + API_KEY: "[REDACTED]", + Token: "[REDACTED]", + }), + }), + ); + }); + }); + + describe("URL Redaction", () => { + it("should redact credentials in URL", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://user:password@example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://[REDACTED]@example.com/api", + }), + ); + }); + + it("should redact api_key in query string", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?api_key=secret-key&page=1", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?api_key=[REDACTED]&page=1", + }), + ); + }); + + it("should redact token in query string", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?token=secret-token", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?token=[REDACTED]", + }), + ); + }); + + it("should redact password in query string", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?username=user&password=secret", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?username=user&password=[REDACTED]", + }), + ); + }); + + it("should not redact non-sensitive query strings", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?page=1&limit=10&sort=name", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?page=1&limit=10&sort=name", + }), + ); + }); + + it("should not redact URL parameters containing 'auth' substring like 'author'", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?author=john&authenticate=false&page=1", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?author=john&authenticate=false&page=1", + }), + ); + }); + + it("should handle URL with fragment", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?token=secret#section", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?token=[REDACTED]#section", + }), + ); + }); + + it("should redact URL-encoded query parameters", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?api%5Fkey=secret", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?api%5Fkey=[REDACTED]", + }), + ); + }); + + it("should handle URL without query string", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api", + }), + ); + }); + + it("should handle empty query string", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?", + }), + ); + }); + + it("should redact multiple sensitive parameters in URL", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?api_key=secret1&token=secret2&page=1", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?api_key=[REDACTED]&token=[REDACTED]&page=1", + }), + ); + }); + + it("should redact both credentials and query parameters", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://user:pass@example.com/api?token=secret", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://[REDACTED]@example.com/api?token=[REDACTED]", + }), + ); + }); + + it("should use fast path for URLs without sensitive keywords", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?page=1&limit=10&sort=name&filter=value", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?page=1&limit=10&sort=name&filter=value", + }), + ); + }); + + it("should handle query parameter without value", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?flag&token=secret", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?flag&token=[REDACTED]", + }), + ); + }); + + it("should handle URL with multiple @ symbols in credentials", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://user@example.com:pass@host.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://[REDACTED]@host.com/api", + }), + ); + }); + + it("should handle URL with @ in query parameter but not in credentials", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?email=user@example.com", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?email=user@example.com", + }), + ); + }); + + it("should handle URL with both credentials and @ in path", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://user:pass@example.com/users/@username", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://[REDACTED]@example.com/users/@username", + }), + ); + }); + }); +}); diff --git a/tests/unit/fetcher/requestWithRetries.test.ts b/tests/unit/fetcher/requestWithRetries.test.ts index 3cdaa40a..d2266136 100644 --- a/tests/unit/fetcher/requestWithRetries.test.ts +++ b/tests/unit/fetcher/requestWithRetries.test.ts @@ -1,28 +1,43 @@ +import type { Mock, MockInstance } from "vitest"; import { requestWithRetries } from "../../../src/core/fetcher/requestWithRetries"; describe("requestWithRetries", () => { - let mockFetch: jest.Mock; + let mockFetch: Mock; let originalMathRandom: typeof Math.random; - let setTimeoutSpy: jest.SpyInstance; + let setTimeoutSpy: MockInstance; beforeEach(() => { - mockFetch = jest.fn(); + mockFetch = vi.fn(); originalMathRandom = Math.random; - // Mock Math.random for consistent jitter - Math.random = jest.fn(() => 0.5); - - jest.useFakeTimers({ doNotFake: ["nextTick"] }); + Math.random = vi.fn(() => 0.5); + + vi.useFakeTimers({ + toFake: [ + "setTimeout", + "clearTimeout", + "setInterval", + "clearInterval", + "setImmediate", + "clearImmediate", + "Date", + "performance", + "requestAnimationFrame", + "cancelAnimationFrame", + "requestIdleCallback", + "cancelIdleCallback", + ], + }); }); afterEach(() => { Math.random = originalMathRandom; - jest.clearAllMocks(); - jest.clearAllTimers(); + vi.clearAllMocks(); + vi.clearAllTimers(); }); it("should retry on retryable status codes", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -38,7 +53,7 @@ describe("requestWithRetries", () => { }); const responsePromise = requestWithRetries(() => mockFetch(), retryableStatuses.length); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); const response = await responsePromise; expect(mockFetch).toHaveBeenCalledTimes(retryableStatuses.length + 1); @@ -46,7 +61,7 @@ describe("requestWithRetries", () => { }); it("should respect maxRetries limit", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -55,7 +70,7 @@ describe("requestWithRetries", () => { mockFetch.mockResolvedValue(new Response("", { status: 500 })); const responsePromise = requestWithRetries(() => mockFetch(), maxRetries); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); const response = await responsePromise; expect(mockFetch).toHaveBeenCalledTimes(maxRetries + 1); @@ -63,7 +78,7 @@ describe("requestWithRetries", () => { }); it("should not retry on success status codes", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -76,7 +91,7 @@ describe("requestWithRetries", () => { mockFetch.mockResolvedValueOnce(new Response("", { status })); const responsePromise = requestWithRetries(() => mockFetch(), 3); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); await responsePromise; expect(mockFetch).toHaveBeenCalledTimes(1); @@ -84,8 +99,69 @@ describe("requestWithRetries", () => { } }); + interface RetryHeaderTestCase { + description: string; + headerName: string; + headerValue: string | (() => string); + expectedDelayMin: number; + expectedDelayMax: number; + } + + const retryHeaderTests: RetryHeaderTestCase[] = [ + { + description: "should respect retry-after header with seconds value", + headerName: "retry-after", + headerValue: "5", + expectedDelayMin: 4000, + expectedDelayMax: 6000, + }, + { + description: "should respect retry-after header with HTTP date value", + headerName: "retry-after", + headerValue: () => new Date(Date.now() + 3000).toUTCString(), + expectedDelayMin: 2000, + expectedDelayMax: 4000, + }, + { + description: "should respect x-ratelimit-reset header", + headerName: "x-ratelimit-reset", + headerValue: () => Math.floor((Date.now() + 4000) / 1000).toString(), + expectedDelayMin: 3000, + expectedDelayMax: 6000, + }, + ]; + + retryHeaderTests.forEach(({ description, headerName, headerValue, expectedDelayMin, expectedDelayMax }) => { + it(description, async () => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + const value = typeof headerValue === "function" ? headerValue() : headerValue; + mockFetch + .mockResolvedValueOnce( + new Response("", { + status: 429, + headers: new Headers({ [headerName]: value }), + }), + ) + .mockResolvedValueOnce(new Response("", { status: 200 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 1); + await vi.runAllTimersAsync(); + const response = await responsePromise; + + expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), expect.any(Number)); + const actualDelay = setTimeoutSpy.mock.calls[0][1]; + expect(actualDelay).toBeGreaterThan(expectedDelayMin); + expect(actualDelay).toBeLessThan(expectedDelayMax); + expect(response.status).toBe(200); + }); + }); + it("should apply correct exponential backoff with jitter", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -95,10 +171,9 @@ describe("requestWithRetries", () => { const expectedDelays = [1000, 2000, 4000]; const responsePromise = requestWithRetries(() => mockFetch(), maxRetries); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); await responsePromise; - // Verify setTimeout calls expect(setTimeoutSpy).toHaveBeenCalledTimes(expectedDelays.length); expectedDelays.forEach((delay, index) => { @@ -109,7 +184,7 @@ describe("requestWithRetries", () => { }); it("should handle concurrent retries independently", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -123,10 +198,33 @@ describe("requestWithRetries", () => { const promise1 = requestWithRetries(() => mockFetch(), 1); const promise2 = requestWithRetries(() => mockFetch(), 1); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); const [response1, response2] = await Promise.all([promise1, promise2]); expect(response1.status).toBe(200); expect(response2.status).toBe(200); }); + + it("should cap delay at MAX_RETRY_DELAY for large header values", async () => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + mockFetch + .mockResolvedValueOnce( + new Response("", { + status: 429, + headers: new Headers({ "retry-after": "120" }), // 120 seconds = 120000ms > MAX_RETRY_DELAY (60000ms) + }), + ) + .mockResolvedValueOnce(new Response("", { status: 200 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 1); + await vi.runAllTimersAsync(); + const response = await responsePromise; + + expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 60000); + expect(response.status).toBe(200); + }); }); diff --git a/tests/unit/fetcher/signals.test.ts b/tests/unit/fetcher/signals.test.ts index 9cabfa07..d7b6d1e6 100644 --- a/tests/unit/fetcher/signals.test.ts +++ b/tests/unit/fetcher/signals.test.ts @@ -2,11 +2,11 @@ import { anySignal, getTimeoutSignal } from "../../../src/core/fetcher/signals"; describe("Test getTimeoutSignal", () => { beforeEach(() => { - jest.useFakeTimers(); + vi.useFakeTimers(); }); afterEach(() => { - jest.useRealTimers(); + vi.useRealTimers(); }); it("should return an object with signal and abortId", () => { @@ -24,10 +24,10 @@ describe("Test getTimeoutSignal", () => { expect(signal.aborted).toBe(false); - jest.advanceTimersByTime(timeoutMs - 1); + vi.advanceTimersByTime(timeoutMs - 1); expect(signal.aborted).toBe(false); - jest.advanceTimersByTime(1); + vi.advanceTimersByTime(1); expect(signal.aborted).toBe(true); }); }); diff --git a/tests/unit/file/file.test.ts b/tests/unit/file/file.test.ts index 0bc7c879..6cd65090 100644 --- a/tests/unit/file/file.test.ts +++ b/tests/unit/file/file.test.ts @@ -1,13 +1,14 @@ import fs from "fs"; import { join } from "path"; import { Readable } from "stream"; -import { toBinaryUploadRequest, Uploadable } from "../../../src/core/file/index"; +import { toBinaryUploadRequest, type Uploadable } from "../../../src/core/file/index"; describe("toBinaryUploadRequest", () => { - const TEST_FILE_PATH = join(__dirname, "test-file.txt"); + const TEST_FILE_PATH = join(__dirname, "..", "test-file.txt"); + const TEST_FILE_SIZE = fs.statSync(TEST_FILE_PATH).size.toString(); beforeEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); describe("Buffer input", () => { @@ -377,7 +378,7 @@ describe("toBinaryUploadRequest", () => { expect(result.headers).toEqual({ "Content-Disposition": 'attachment; filename="test-file.txt"', // Should extract from path "Content-Type": "text/plain", - "Content-Length": "21", // Should determine from file system (test file is 21 bytes) + "Content-Length": TEST_FILE_SIZE, // Should determine from file system (OS-agnostic) }); }); @@ -391,51 +392,9 @@ describe("toBinaryUploadRequest", () => { expect(result.body).toBeInstanceOf(fs.ReadStream); expect(result.headers).toEqual({ "Content-Disposition": 'attachment; filename="test-file.txt"', // Should extract from path - "Content-Length": "21", // Should determine from file system (test file is 21 bytes) + "Content-Length": TEST_FILE_SIZE, // Should determine from file system (OS-agnostic) }); }); - - it("should handle Windows-style paths", async () => { - const input: Uploadable.FromPath = { - path: "C:\\Users\\test\\file.txt", - }; - - // Mock fs methods to avoid actual file system access - const mockStats = { size: 123 }; - const mockReadStream = {} as fs.ReadStream; - - const createReadStreamSpy = jest.spyOn(fs, "createReadStream").mockReturnValue(mockReadStream); - const statSpy = jest.spyOn(fs.promises, "stat").mockResolvedValue(mockStats as fs.Stats); - - const result = await toBinaryUploadRequest(input); - - expect(result.body).toBe(mockReadStream); - expect(result.headers).toEqual({ - "Content-Disposition": 'attachment; filename="file.txt"', // Should extract from Windows path - "Content-Length": "123", - }); - - // Restore mocks - createReadStreamSpy.mockRestore(); - statSpy.mockRestore(); - }); - - it("should handle file path when fs is not available", async () => { - const input: Uploadable.FromPath = { - path: TEST_FILE_PATH, - }; - - // Mock import to simulate environment without fs - const originalImport = jest.requireActual("fs"); - jest.doMock("fs", () => null); - - await expect(toBinaryUploadRequest(input)).rejects.toThrow( - "File path uploads are not supported in this environment.", - ); - - // Restore fs - jest.doMock("fs", () => originalImport); - }); }); describe("ArrayBufferView input", () => { diff --git a/tests/unit/logging/logger.test.ts b/tests/unit/logging/logger.test.ts new file mode 100644 index 00000000..2e0b5fe5 --- /dev/null +++ b/tests/unit/logging/logger.test.ts @@ -0,0 +1,454 @@ +import { ConsoleLogger, createLogger, Logger, LogLevel } from "../../../src/core/logging/logger"; + +function createMockLogger() { + return { + debug: vi.fn(), + info: vi.fn(), + warn: vi.fn(), + error: vi.fn(), + }; +} + +describe("Logger", () => { + describe("LogLevel", () => { + it("should have correct log levels", () => { + expect(LogLevel.Debug).toBe("debug"); + expect(LogLevel.Info).toBe("info"); + expect(LogLevel.Warn).toBe("warn"); + expect(LogLevel.Error).toBe("error"); + }); + }); + + describe("ConsoleLogger", () => { + let consoleLogger: ConsoleLogger; + let consoleSpy: { + debug: ReturnType; + info: ReturnType; + warn: ReturnType; + error: ReturnType; + }; + + beforeEach(() => { + consoleLogger = new ConsoleLogger(); + consoleSpy = { + debug: vi.spyOn(console, "debug").mockImplementation(() => {}), + info: vi.spyOn(console, "info").mockImplementation(() => {}), + warn: vi.spyOn(console, "warn").mockImplementation(() => {}), + error: vi.spyOn(console, "error").mockImplementation(() => {}), + }; + }); + + afterEach(() => { + consoleSpy.debug.mockRestore(); + consoleSpy.info.mockRestore(); + consoleSpy.warn.mockRestore(); + consoleSpy.error.mockRestore(); + }); + + it("should log debug messages", () => { + consoleLogger.debug("debug message", { data: "test" }); + expect(consoleSpy.debug).toHaveBeenCalledWith("debug message", { data: "test" }); + }); + + it("should log info messages", () => { + consoleLogger.info("info message", { data: "test" }); + expect(consoleSpy.info).toHaveBeenCalledWith("info message", { data: "test" }); + }); + + it("should log warn messages", () => { + consoleLogger.warn("warn message", { data: "test" }); + expect(consoleSpy.warn).toHaveBeenCalledWith("warn message", { data: "test" }); + }); + + it("should log error messages", () => { + consoleLogger.error("error message", { data: "test" }); + expect(consoleSpy.error).toHaveBeenCalledWith("error message", { data: "test" }); + }); + + it("should handle multiple arguments", () => { + consoleLogger.debug("message", "arg1", "arg2", { key: "value" }); + expect(consoleSpy.debug).toHaveBeenCalledWith("message", "arg1", "arg2", { key: "value" }); + }); + }); + + describe("Logger with level filtering", () => { + let mockLogger: { + debug: ReturnType; + info: ReturnType; + warn: ReturnType; + error: ReturnType; + }; + + beforeEach(() => { + mockLogger = createMockLogger(); + }); + + describe("Debug level", () => { + it("should log all levels when set to debug", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); + + expect(mockLogger.debug).toHaveBeenCalledWith("debug"); + expect(mockLogger.info).toHaveBeenCalledWith("info"); + expect(mockLogger.warn).toHaveBeenCalledWith("warn"); + expect(mockLogger.error).toHaveBeenCalledWith("error"); + }); + + it("should report correct level checks", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + expect(logger.isDebug()).toBe(true); + expect(logger.isInfo()).toBe(true); + expect(logger.isWarn()).toBe(true); + expect(logger.isError()).toBe(true); + }); + }); + + describe("Info level", () => { + it("should log info, warn, and error when set to info", () => { + const logger = new Logger({ + level: LogLevel.Info, + logger: mockLogger, + silent: false, + }); + + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).toHaveBeenCalledWith("info"); + expect(mockLogger.warn).toHaveBeenCalledWith("warn"); + expect(mockLogger.error).toHaveBeenCalledWith("error"); + }); + + it("should report correct level checks", () => { + const logger = new Logger({ + level: LogLevel.Info, + logger: mockLogger, + silent: false, + }); + + expect(logger.isDebug()).toBe(false); + expect(logger.isInfo()).toBe(true); + expect(logger.isWarn()).toBe(true); + expect(logger.isError()).toBe(true); + }); + }); + + describe("Warn level", () => { + it("should log warn and error when set to warn", () => { + const logger = new Logger({ + level: LogLevel.Warn, + logger: mockLogger, + silent: false, + }); + + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + expect(mockLogger.warn).toHaveBeenCalledWith("warn"); + expect(mockLogger.error).toHaveBeenCalledWith("error"); + }); + + it("should report correct level checks", () => { + const logger = new Logger({ + level: LogLevel.Warn, + logger: mockLogger, + silent: false, + }); + + expect(logger.isDebug()).toBe(false); + expect(logger.isInfo()).toBe(false); + expect(logger.isWarn()).toBe(true); + expect(logger.isError()).toBe(true); + }); + }); + + describe("Error level", () => { + it("should only log error when set to error", () => { + const logger = new Logger({ + level: LogLevel.Error, + logger: mockLogger, + silent: false, + }); + + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + expect(mockLogger.warn).not.toHaveBeenCalled(); + expect(mockLogger.error).toHaveBeenCalledWith("error"); + }); + + it("should report correct level checks", () => { + const logger = new Logger({ + level: LogLevel.Error, + logger: mockLogger, + silent: false, + }); + + expect(logger.isDebug()).toBe(false); + expect(logger.isInfo()).toBe(false); + expect(logger.isWarn()).toBe(false); + expect(logger.isError()).toBe(true); + }); + }); + + describe("Silent mode", () => { + it("should not log anything when silent is true", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: true, + }); + + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + expect(mockLogger.warn).not.toHaveBeenCalled(); + expect(mockLogger.error).not.toHaveBeenCalled(); + }); + + it("should report all level checks as false when silent", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: true, + }); + + expect(logger.isDebug()).toBe(false); + expect(logger.isInfo()).toBe(false); + expect(logger.isWarn()).toBe(false); + expect(logger.isError()).toBe(false); + }); + }); + + describe("shouldLog", () => { + it("should correctly determine if level should be logged", () => { + const logger = new Logger({ + level: LogLevel.Info, + logger: mockLogger, + silent: false, + }); + + expect(logger.shouldLog(LogLevel.Debug)).toBe(false); + expect(logger.shouldLog(LogLevel.Info)).toBe(true); + expect(logger.shouldLog(LogLevel.Warn)).toBe(true); + expect(logger.shouldLog(LogLevel.Error)).toBe(true); + }); + + it("should return false for all levels when silent", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: true, + }); + + expect(logger.shouldLog(LogLevel.Debug)).toBe(false); + expect(logger.shouldLog(LogLevel.Info)).toBe(false); + expect(logger.shouldLog(LogLevel.Warn)).toBe(false); + expect(logger.shouldLog(LogLevel.Error)).toBe(false); + }); + }); + + describe("Multiple arguments", () => { + it("should pass multiple arguments to logger", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + logger.debug("message", "arg1", { key: "value" }, 123); + expect(mockLogger.debug).toHaveBeenCalledWith("message", "arg1", { key: "value" }, 123); + }); + }); + }); + + describe("createLogger", () => { + it("should return default logger when no config provided", () => { + const logger = createLogger(); + expect(logger).toBeInstanceOf(Logger); + }); + + it("should return same logger instance when Logger is passed", () => { + const customLogger = new Logger({ + level: LogLevel.Debug, + logger: new ConsoleLogger(), + silent: false, + }); + + const result = createLogger(customLogger); + expect(result).toBe(customLogger); + }); + + it("should create logger with custom config", () => { + const mockLogger = createMockLogger(); + + const logger = createLogger({ + level: LogLevel.Warn, + logger: mockLogger, + silent: false, + }); + + expect(logger).toBeInstanceOf(Logger); + logger.warn("test"); + expect(mockLogger.warn).toHaveBeenCalledWith("test"); + }); + + it("should use default values for missing config", () => { + const logger = createLogger({}); + expect(logger).toBeInstanceOf(Logger); + }); + + it("should override default level", () => { + const mockLogger = createMockLogger(); + + const logger = createLogger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + logger.debug("test"); + expect(mockLogger.debug).toHaveBeenCalledWith("test"); + }); + + it("should override default silent mode", () => { + const mockLogger = createMockLogger(); + + const logger = createLogger({ + logger: mockLogger, + silent: false, + }); + + logger.info("test"); + expect(mockLogger.info).toHaveBeenCalledWith("test"); + }); + + it("should use provided logger implementation", () => { + const customLogger = createMockLogger(); + + const logger = createLogger({ + logger: customLogger, + level: LogLevel.Debug, + silent: false, + }); + + logger.debug("test"); + expect(customLogger.debug).toHaveBeenCalledWith("test"); + }); + + it("should default to silent: true", () => { + const mockLogger = createMockLogger(); + + const logger = createLogger({ + logger: mockLogger, + level: LogLevel.Debug, + }); + + logger.debug("test"); + expect(mockLogger.debug).not.toHaveBeenCalled(); + }); + }); + + describe("Default logger", () => { + it("should have silent: true by default", () => { + const logger = createLogger(); + expect(logger.shouldLog(LogLevel.Info)).toBe(false); + }); + + it("should not log when using default logger", () => { + const logger = createLogger(); + + logger.info("test"); + expect(logger.isInfo()).toBe(false); + }); + }); + + describe("Edge cases", () => { + it("should handle empty message", () => { + const mockLogger = createMockLogger(); + + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + logger.debug(""); + expect(mockLogger.debug).toHaveBeenCalledWith(""); + }); + + it("should handle no arguments", () => { + const mockLogger = createMockLogger(); + + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + logger.debug("message"); + expect(mockLogger.debug).toHaveBeenCalledWith("message"); + }); + + it("should handle complex objects", () => { + const mockLogger = createMockLogger(); + + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + const complexObject = { + nested: { key: "value" }, + array: [1, 2, 3], + fn: () => "test", + }; + + logger.debug("message", complexObject); + expect(mockLogger.debug).toHaveBeenCalledWith("message", complexObject); + }); + + it("should handle errors as arguments", () => { + const mockLogger = createMockLogger(); + + const logger = new Logger({ + level: LogLevel.Error, + logger: mockLogger, + silent: false, + }); + + const error = new Error("Test error"); + logger.error("Error occurred", error); + expect(mockLogger.error).toHaveBeenCalledWith("Error occurred", error); + }); + }); +}); diff --git a/tests/unit/schemas/lazy/lazy.test.ts b/tests/unit/schemas/lazy/lazy.test.ts index 3a5a338d..a82ace4a 100644 --- a/tests/unit/schemas/lazy/lazy.test.ts +++ b/tests/unit/schemas/lazy/lazy.test.ts @@ -1,5 +1,5 @@ -import { Schema } from "../../../../src/core/schemas/Schema"; import { lazy, list, object, string } from "../../../../src/core/schemas/builders"; +import type { Schema } from "../../../../src/core/schemas/Schema"; import { itSchemaIdentity } from "../utils/itSchema"; describe("lazy", () => { @@ -37,7 +37,7 @@ describe("lazy", () => { { foo: "hello" }, ); - // eslint-disable-next-line jest/expect-expect + // eslint-disable-next-line vi/expect-expect it("self-referencial schema doesn't compile", () => { () => { // @ts-expect-error @@ -45,7 +45,7 @@ describe("lazy", () => { }; }); - // eslint-disable-next-line jest/expect-expect + // eslint-disable-next-line vi/expect-expect it("self-referencial compiles with explicit type", () => { () => { interface TreeNode { diff --git a/tests/unit/schemas/object-like/withParsedProperties.test.ts b/tests/unit/schemas/object-like/withParsedProperties.test.ts index 9f5dd0ed..b18bc9d3 100644 --- a/tests/unit/schemas/object-like/withParsedProperties.test.ts +++ b/tests/unit/schemas/object-like/withParsedProperties.test.ts @@ -44,7 +44,7 @@ describe("withParsedProperties", () => { }); describe("compile", () => { - // eslint-disable-next-line jest/expect-expect + // eslint-disable-next-line vi/expect-expect it("doesn't compile with non-object schema", () => { () => object({ diff --git a/tests/unit/schemas/object/extend.test.ts b/tests/unit/schemas/object/extend.test.ts index 10954713..b6c2920f 100644 --- a/tests/unit/schemas/object/extend.test.ts +++ b/tests/unit/schemas/object/extend.test.ts @@ -76,7 +76,7 @@ describe("extend", () => { ); describe("compile", () => { - // eslint-disable-next-line jest/expect-expect + // eslint-disable-next-line vi/expect-expect it("doesn't compile with non-object schema", () => { () => object({ diff --git a/tests/unit/schemas/primitives/never.test.ts b/tests/unit/schemas/primitives/never.test.ts new file mode 100644 index 00000000..1d18eba0 --- /dev/null +++ b/tests/unit/schemas/primitives/never.test.ts @@ -0,0 +1,54 @@ +import { never } from "../../../../src/core/schemas/builders"; + +describe("never", () => { + it("always fails to parse", () => { + const schema = never(); + const result = schema.parse("test"); + expect(result.ok).toBe(false); + if (!result.ok) { + expect(result.errors).toHaveLength(1); + expect(result.errors[0]?.message).toBe("Expected never"); + } + }); + + it("always fails to json", () => { + const schema = never(); + const result = schema.json("test"); + expect(result.ok).toBe(false); + if (!result.ok) { + expect(result.errors).toHaveLength(1); + expect(result.errors[0]?.message).toBe("Expected never"); + } + }); + + it("fails with any value including undefined", () => { + const schema = never(); + expect(schema.parse(undefined).ok).toBe(false); + expect(schema.parse(null).ok).toBe(false); + expect(schema.parse(0).ok).toBe(false); + expect(schema.parse("").ok).toBe(false); + expect(schema.parse({}).ok).toBe(false); + expect(schema.parse([]).ok).toBe(false); + }); + + it("works when called without options parameter", () => { + const schema = never(); + // This tests that the default = {} parameter works correctly + const result = schema.parse("test"); + expect(result.ok).toBe(false); + if (!result.ok) { + expect(result.errors).toHaveLength(1); + expect(result.errors[0]?.message).toBe("Expected never"); + expect(result.errors[0]?.path).toEqual([]); + } + }); + + it("succeeds with skipValidation", () => { + const schema = never(); + const result = schema.parse("test", { skipValidation: true }); + expect(result.ok).toBe(true); + if (result.ok) { + expect(result.value).toBe("test"); + } + }); +}); diff --git a/tests/unit/schemas/schema-utils/getSchemaUtils.test.ts b/tests/unit/schemas/schema-utils/getSchemaUtils.test.ts index 09d594d0..822c3ca4 100644 --- a/tests/unit/schemas/schema-utils/getSchemaUtils.test.ts +++ b/tests/unit/schemas/schema-utils/getSchemaUtils.test.ts @@ -18,7 +18,7 @@ describe("getSchemaUtils", () => { itSchema( "transform and untransform run correctly", string().transform({ - transform: (x) => x + "X", + transform: (x) => `${x}X`, untransform: (x) => (x as string).slice(0, -1), }), { @@ -36,7 +36,7 @@ describe("getSchemaUtils", () => { it("throws on invalid value", async () => { const value = () => object({ a: string(), b: string() }).parseOrThrow({ a: 24 }); - expect(value).toThrowError(new Error('a: Expected string. Received 24.; Missing required key "b"')); + expect(value).toThrowError('a: Expected string. Received 24.; Missing required key "b"'); }); }); @@ -48,7 +48,7 @@ describe("getSchemaUtils", () => { it("throws on invalid value", async () => { const value = () => object({ a: string(), b: string() }).jsonOrThrow({ a: 24 }); - expect(value).toThrowError(new Error('a: Expected string. Received 24.; Missing required key "b"')); + expect(value).toThrowError('a: Expected string. Received 24.; Missing required key "b"'); }); }); diff --git a/tests/unit/schemas/undiscriminated-union/undiscriminatedUnion.test.ts b/tests/unit/schemas/undiscriminated-union/undiscriminatedUnion.test.ts index e0ddb21b..01dcadbb 100644 --- a/tests/unit/schemas/undiscriminated-union/undiscriminatedUnion.test.ts +++ b/tests/unit/schemas/undiscriminated-union/undiscriminatedUnion.test.ts @@ -35,7 +35,7 @@ describe("undiscriminatedUnion", () => { }); describe("compile", () => { - // eslint-disable-next-line jest/expect-expect + // eslint-disable-next-line vi/expect-expect it("doesn't compile with zero members", () => { // @ts-expect-error () => undiscriminatedUnion([]); diff --git a/tests/unit/schemas/utils/itSchema.ts b/tests/unit/schemas/utils/itSchema.ts index 82a53887..25b13e64 100644 --- a/tests/unit/schemas/utils/itSchema.ts +++ b/tests/unit/schemas/utils/itSchema.ts @@ -1,5 +1,5 @@ -/* eslint-disable jest/no-export */ -import { Schema, SchemaOptions } from "../../../../src/core/schemas/Schema"; +/* eslint-disable vi/no-export */ +import type { Schema, SchemaOptions } from "../../../../src/core/schemas/Schema"; export function itSchemaIdentity( schema: Schema, @@ -24,7 +24,7 @@ export function itSchema( only?: boolean; }, ): void { - // eslint-disable-next-line jest/valid-title + // eslint-disable-next-line vi/valid-title (only ? describe.only : describe)(title, () => { itParse("parse()", schema, { raw, parsed, opts }); itJson("json()", schema, { raw, parsed, opts }); @@ -44,11 +44,11 @@ export function itParse( opts?: SchemaOptions; }, ): void { - // eslint-disable-next-line jest/valid-title + // eslint-disable-next-line vi/valid-title it(title, () => { const maybeValid = schema.parse(raw, opts); if (!maybeValid.ok) { - throw new Error("Failed to parse() " + JSON.stringify(maybeValid.errors, undefined, 4)); + throw new Error(`Failed to parse() ${JSON.stringify(maybeValid.errors, undefined, 4)}`); } expect(maybeValid.value).toStrictEqual(parsed); }); @@ -67,11 +67,11 @@ export function itJson( opts?: SchemaOptions; }, ): void { - // eslint-disable-next-line jest/valid-title + // eslint-disable-next-line vi/valid-title it(title, () => { const maybeValid = schema.json(parsed, opts); if (!maybeValid.ok) { - throw new Error("Failed to json() " + JSON.stringify(maybeValid.errors, undefined, 4)); + throw new Error(`Failed to json() ${JSON.stringify(maybeValid.errors, undefined, 4)}`); } expect(maybeValid.value).toStrictEqual(raw); }); diff --git a/tests/unit/schemas/utils/itValidate.ts b/tests/unit/schemas/utils/itValidate.ts index ead1ca70..60bc56c1 100644 --- a/tests/unit/schemas/utils/itValidate.ts +++ b/tests/unit/schemas/utils/itValidate.ts @@ -1,5 +1,5 @@ -/* eslint-disable jest/no-export */ -import { Schema, SchemaOptions, ValidationError } from "../../../../src/core/schemas/Schema"; +/* eslint-disable vi/no-export */ +import type { Schema, SchemaOptions, ValidationError } from "../../../../src/core/schemas/Schema"; export function itValidate( title: string, @@ -8,7 +8,7 @@ export function itValidate( errors: ValidationError[], opts?: SchemaOptions, ): void { - // eslint-disable-next-line jest/valid-title + // eslint-disable-next-line vi/valid-title describe("parse()", () => { itValidateParse(title, schema, input, errors, opts); }); @@ -25,7 +25,7 @@ export function itValidateParse( opts?: SchemaOptions, ): void { describe("parse", () => { - // eslint-disable-next-line jest/valid-title + // eslint-disable-next-line vi/valid-title it(title, async () => { const maybeValid = await schema.parse(raw, opts); if (maybeValid.ok) { @@ -44,7 +44,7 @@ export function itValidateJson( opts?: SchemaOptions, ): void { describe("json", () => { - // eslint-disable-next-line jest/valid-title + // eslint-disable-next-line vi/valid-title it(title, async () => { const maybeValid = await schema.json(parsed, opts); if (maybeValid.ok) { diff --git a/tests/unit/file/test-file.txt b/tests/unit/test-file.txt similarity index 100% rename from tests/unit/file/test-file.txt rename to tests/unit/test-file.txt diff --git a/tests/unit/url/join.test.ts b/tests/unit/url/join.test.ts index 984cfe67..123488f0 100644 --- a/tests/unit/url/join.test.ts +++ b/tests/unit/url/join.test.ts @@ -1,88 +1,223 @@ import { join } from "../../../src/core/url/index"; describe("join", () => { - describe("basic functionality", () => { - it("should return empty string for empty base", () => { - expect(join("")).toBe(""); - expect(join("", "path")).toBe(""); - }); + interface TestCase { + description: string; + base: string; + segments: string[]; + expected: string; + } - it("should handle single segment", () => { - expect(join("base", "segment")).toBe("base/segment"); - expect(join("base/", "segment")).toBe("base/segment"); - expect(join("base", "/segment")).toBe("base/segment"); - expect(join("base/", "/segment")).toBe("base/segment"); - }); + describe("basic functionality", () => { + const basicTests: TestCase[] = [ + { description: "should return empty string for empty base", base: "", segments: [], expected: "" }, + { + description: "should return empty string for empty base with path", + base: "", + segments: ["path"], + expected: "", + }, + { + description: "should handle single segment", + base: "base", + segments: ["segment"], + expected: "base/segment", + }, + { + description: "should handle single segment with trailing slash on base", + base: "base/", + segments: ["segment"], + expected: "base/segment", + }, + { + description: "should handle single segment with leading slash", + base: "base", + segments: ["/segment"], + expected: "base/segment", + }, + { + description: "should handle single segment with both slashes", + base: "base/", + segments: ["/segment"], + expected: "base/segment", + }, + { + description: "should handle multiple segments", + base: "base", + segments: ["path1", "path2", "path3"], + expected: "base/path1/path2/path3", + }, + { + description: "should handle multiple segments with slashes", + base: "base/", + segments: ["/path1/", "/path2/", "/path3/"], + expected: "base/path1/path2/path3/", + }, + ]; - it("should handle multiple segments", () => { - expect(join("base", "path1", "path2", "path3")).toBe("base/path1/path2/path3"); - expect(join("base/", "/path1/", "/path2/", "/path3/")).toBe("base/path1/path2/path3/"); + basicTests.forEach(({ description, base, segments, expected }) => { + it(description, () => { + expect(join(base, ...segments)).toBe(expected); + }); }); }); describe("URL handling", () => { - it("should handle absolute URLs", () => { - expect(join("https://example.com", "api", "v1")).toBe("https://example.com/api/v1"); - expect(join("https://example.com/", "/api/", "/v1/")).toBe("https://example.com/api/v1/"); - expect(join("https://example.com/base", "api", "v1")).toBe("https://example.com/base/api/v1"); - }); + const urlTests: TestCase[] = [ + { + description: "should handle absolute URLs", + base: "https://example.com", + segments: ["api", "v1"], + expected: "https://example.com/api/v1", + }, + { + description: "should handle absolute URLs with slashes", + base: "https://example.com/", + segments: ["/api/", "/v1/"], + expected: "https://example.com/api/v1/", + }, + { + description: "should handle absolute URLs with base path", + base: "https://example.com/base", + segments: ["api", "v1"], + expected: "https://example.com/base/api/v1", + }, + { + description: "should preserve URL query parameters", + base: "https://example.com?query=1", + segments: ["api"], + expected: "https://example.com/api?query=1", + }, + { + description: "should preserve URL fragments", + base: "https://example.com#fragment", + segments: ["api"], + expected: "https://example.com/api#fragment", + }, + { + description: "should preserve URL query and fragments", + base: "https://example.com?query=1#fragment", + segments: ["api"], + expected: "https://example.com/api?query=1#fragment", + }, + { + description: "should handle http protocol", + base: "http://example.com", + segments: ["api"], + expected: "http://example.com/api", + }, + { + description: "should handle ftp protocol", + base: "ftp://example.com", + segments: ["files"], + expected: "ftp://example.com/files", + }, + { + description: "should handle ws protocol", + base: "ws://example.com", + segments: ["socket"], + expected: "ws://example.com/socket", + }, + { + description: "should fallback to path joining for malformed URLs", + base: "not-a-url://", + segments: ["path"], + expected: "not-a-url:///path", + }, + ]; - it("should preserve URL query parameters and fragments", () => { - expect(join("https://example.com?query=1", "api")).toBe("https://example.com/api?query=1"); - expect(join("https://example.com#fragment", "api")).toBe("https://example.com/api#fragment"); - expect(join("https://example.com?query=1#fragment", "api")).toBe( - "https://example.com/api?query=1#fragment", - ); - }); - - it("should handle different protocols", () => { - expect(join("http://example.com", "api")).toBe("http://example.com/api"); - expect(join("ftp://example.com", "files")).toBe("ftp://example.com/files"); - expect(join("ws://example.com", "socket")).toBe("ws://example.com/socket"); - }); - - it("should fallback to path joining for malformed URLs", () => { - expect(join("not-a-url://", "path")).toBe("not-a-url:///path"); + urlTests.forEach(({ description, base, segments, expected }) => { + it(description, () => { + expect(join(base, ...segments)).toBe(expected); + }); }); }); describe("edge cases", () => { - it("should handle empty segments", () => { - expect(join("base", "", "path")).toBe("base/path"); - expect(join("base", null as any, "path")).toBe("base/path"); - expect(join("base", undefined as any, "path")).toBe("base/path"); - }); - - it("should handle segments with only slashes", () => { - expect(join("base", "/", "path")).toBe("base/path"); - expect(join("base", "//", "path")).toBe("base/path"); - }); - - it("should handle base paths with trailing slashes", () => { - expect(join("base/", "path")).toBe("base/path"); - }); + const edgeCaseTests: TestCase[] = [ + { + description: "should handle empty segments", + base: "base", + segments: ["", "path"], + expected: "base/path", + }, + { + description: "should handle null segments", + base: "base", + segments: [null as any, "path"], + expected: "base/path", + }, + { + description: "should handle undefined segments", + base: "base", + segments: [undefined as any, "path"], + expected: "base/path", + }, + { + description: "should handle segments with only single slash", + base: "base", + segments: ["/", "path"], + expected: "base/path", + }, + { + description: "should handle segments with only double slash", + base: "base", + segments: ["//", "path"], + expected: "base/path", + }, + { + description: "should handle base paths with trailing slashes", + base: "base/", + segments: ["path"], + expected: "base/path", + }, + { + description: "should handle complex nested paths", + base: "api/v1/", + segments: ["/users/", "/123/", "/profile"], + expected: "api/v1/users/123/profile", + }, + ]; - it("should handle complex nested paths", () => { - expect(join("api/v1/", "/users/", "/123/", "/profile")).toBe("api/v1/users/123/profile"); + edgeCaseTests.forEach(({ description, base, segments, expected }) => { + it(description, () => { + expect(join(base, ...segments)).toBe(expected); + }); }); }); describe("real-world scenarios", () => { - it("should handle API endpoint construction", () => { - const baseUrl = "https://api.example.com/v1"; - expect(join(baseUrl, "users", "123", "posts")).toBe("https://api.example.com/v1/users/123/posts"); - }); - - it("should handle file path construction", () => { - expect(join("/var/www", "html", "assets", "images")).toBe("/var/www/html/assets/images"); - }); + const realWorldTests: TestCase[] = [ + { + description: "should handle API endpoint construction", + base: "https://api.example.com/v1", + segments: ["users", "123", "posts"], + expected: "https://api.example.com/v1/users/123/posts", + }, + { + description: "should handle file path construction", + base: "/var/www", + segments: ["html", "assets", "images"], + expected: "/var/www/html/assets/images", + }, + { + description: "should handle relative path construction", + base: "../parent", + segments: ["child", "grandchild"], + expected: "../parent/child/grandchild", + }, + { + description: "should handle Windows-style paths", + base: "C:\\Users", + segments: ["Documents", "file.txt"], + expected: "C:\\Users/Documents/file.txt", + }, + ]; - it("should handle relative path construction", () => { - expect(join("../parent", "child", "grandchild")).toBe("../parent/child/grandchild"); - }); - - it("should handle Windows-style paths", () => { - expect(join("C:\\Users", "Documents", "file.txt")).toBe("C:\\Users/Documents/file.txt"); + realWorldTests.forEach(({ description, base, segments, expected }) => { + it(description, () => { + expect(join(base, ...segments)).toBe(expected); + }); }); }); @@ -90,7 +225,7 @@ describe("join", () => { it("should handle many segments efficiently", () => { const segments = Array(100).fill("segment"); const result = join("base", ...segments); - expect(result).toBe("base/" + segments.join("/")); + expect(result).toBe(`base/${segments.join("/")}`); }); it("should handle long URLs", () => { @@ -100,21 +235,50 @@ describe("join", () => { }); describe("trailing slash preservation", () => { - it("should preserve trailing slash on final result when base has trailing slash and no segments", () => { - expect(join("https://api.example.com/")).toBe("https://api.example.com/"); - expect(join("https://api.example.com/v1/")).toBe("https://api.example.com/v1/"); - }); - - it("should preserve trailing slash when last segment has trailing slash", () => { - expect(join("https://api.example.com", "users/")).toBe("https://api.example.com/users/"); - expect(join("api/v1", "users/")).toBe("api/v1/users/"); - }); + const trailingSlashTests: TestCase[] = [ + { + description: + "should preserve trailing slash on final result when base has trailing slash and no segments", + base: "https://api.example.com/", + segments: [], + expected: "https://api.example.com/", + }, + { + description: "should preserve trailing slash on v1 path", + base: "https://api.example.com/v1/", + segments: [], + expected: "https://api.example.com/v1/", + }, + { + description: "should preserve trailing slash when last segment has trailing slash", + base: "https://api.example.com", + segments: ["users/"], + expected: "https://api.example.com/users/", + }, + { + description: "should preserve trailing slash with relative path", + base: "api/v1", + segments: ["users/"], + expected: "api/v1/users/", + }, + { + description: "should preserve trailing slash with multiple segments", + base: "https://api.example.com", + segments: ["v1", "collections/"], + expected: "https://api.example.com/v1/collections/", + }, + { + description: "should preserve trailing slash with base path", + base: "base", + segments: ["path1", "path2/"], + expected: "base/path1/path2/", + }, + ]; - it("should preserve trailing slash with multiple segments where last has trailing slash", () => { - expect(join("https://api.example.com", "v1", "collections/")).toBe( - "https://api.example.com/v1/collections/", - ); - expect(join("base", "path1", "path2/")).toBe("base/path1/path2/"); + trailingSlashTests.forEach(({ description, base, segments, expected }) => { + it(description, () => { + expect(join(base, ...segments)).toBe(expected); + }); }); }); }); diff --git a/tests/unit/url/qs.test.ts b/tests/unit/url/qs.test.ts index 80e7e044..42cdffb9 100644 --- a/tests/unit/url/qs.test.ts +++ b/tests/unit/url/qs.test.ts @@ -1,187 +1,278 @@ import { toQueryString } from "../../../src/core/url/index"; describe("Test qs toQueryString", () => { - describe("Basic functionality", () => { - it("should return empty string for null/undefined", () => { - expect(toQueryString(null)).toBe(""); - expect(toQueryString(undefined)).toBe(""); - }); + interface BasicTestCase { + description: string; + input: any; + expected: string; + } - it("should return empty string for primitive values", () => { - expect(toQueryString("hello")).toBe(""); - expect(toQueryString(42)).toBe(""); - expect(toQueryString(true)).toBe(""); - expect(toQueryString(false)).toBe(""); - }); - - it("should handle empty objects", () => { - expect(toQueryString({})).toBe(""); - }); + describe("Basic functionality", () => { + const basicTests: BasicTestCase[] = [ + { description: "should return empty string for null", input: null, expected: "" }, + { description: "should return empty string for undefined", input: undefined, expected: "" }, + { description: "should return empty string for string primitive", input: "hello", expected: "" }, + { description: "should return empty string for number primitive", input: 42, expected: "" }, + { description: "should return empty string for true boolean", input: true, expected: "" }, + { description: "should return empty string for false boolean", input: false, expected: "" }, + { description: "should handle empty objects", input: {}, expected: "" }, + { + description: "should handle simple key-value pairs", + input: { name: "John", age: 30 }, + expected: "name=John&age=30", + }, + ]; - it("should handle simple key-value pairs", () => { - const obj = { name: "John", age: 30 }; - expect(toQueryString(obj)).toBe("name=John&age=30"); + basicTests.forEach(({ description, input, expected }) => { + it(description, () => { + expect(toQueryString(input)).toBe(expected); + }); }); }); describe("Array handling", () => { - it("should handle arrays with indices format (default)", () => { - const obj = { items: ["a", "b", "c"] }; - expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=b&items%5B2%5D=c"); - }); - - it("should handle arrays with repeat format", () => { - const obj = { items: ["a", "b", "c"] }; - expect(toQueryString(obj, { arrayFormat: "repeat" })).toBe("items=a&items=b&items=c"); - }); + interface ArrayTestCase { + description: string; + input: any; + options?: { arrayFormat?: "repeat" | "indices" }; + expected: string; + } - it("should handle empty arrays", () => { - const obj = { items: [] }; - expect(toQueryString(obj)).toBe(""); - }); - - it("should handle arrays with mixed types", () => { - const obj = { mixed: ["string", 42, true, false] }; - expect(toQueryString(obj)).toBe("mixed%5B0%5D=string&mixed%5B1%5D=42&mixed%5B2%5D=true&mixed%5B3%5D=false"); - }); - - it("should handle arrays with objects", () => { - const obj = { users: [{ name: "John" }, { name: "Jane" }] }; - expect(toQueryString(obj)).toBe("users%5B0%5D%5Bname%5D=John&users%5B1%5D%5Bname%5D=Jane"); - }); + const arrayTests: ArrayTestCase[] = [ + { + description: "should handle arrays with indices format (default)", + input: { items: ["a", "b", "c"] }, + expected: "items%5B0%5D=a&items%5B1%5D=b&items%5B2%5D=c", + }, + { + description: "should handle arrays with repeat format", + input: { items: ["a", "b", "c"] }, + options: { arrayFormat: "repeat" }, + expected: "items=a&items=b&items=c", + }, + { + description: "should handle empty arrays", + input: { items: [] }, + expected: "", + }, + { + description: "should handle arrays with mixed types", + input: { mixed: ["string", 42, true, false] }, + expected: "mixed%5B0%5D=string&mixed%5B1%5D=42&mixed%5B2%5D=true&mixed%5B3%5D=false", + }, + { + description: "should handle arrays with objects", + input: { users: [{ name: "John" }, { name: "Jane" }] }, + expected: "users%5B0%5D%5Bname%5D=John&users%5B1%5D%5Bname%5D=Jane", + }, + { + description: "should handle arrays with objects in repeat format", + input: { users: [{ name: "John" }, { name: "Jane" }] }, + options: { arrayFormat: "repeat" }, + expected: "users%5Bname%5D=John&users%5Bname%5D=Jane", + }, + ]; - it("should handle arrays with objects in repeat format", () => { - const obj = { users: [{ name: "John" }, { name: "Jane" }] }; - expect(toQueryString(obj, { arrayFormat: "repeat" })).toBe("users%5Bname%5D=John&users%5Bname%5D=Jane"); + arrayTests.forEach(({ description, input, options, expected }) => { + it(description, () => { + expect(toQueryString(input, options)).toBe(expected); + }); }); }); describe("Nested objects", () => { - it("should handle nested objects", () => { - const obj = { user: { name: "John", age: 30 } }; - expect(toQueryString(obj)).toBe("user%5Bname%5D=John&user%5Bage%5D=30"); - }); - - it("should handle deeply nested objects", () => { - const obj = { user: { profile: { name: "John", settings: { theme: "dark" } } } }; - expect(toQueryString(obj)).toBe( - "user%5Bprofile%5D%5Bname%5D=John&user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark", - ); - }); + const nestedTests: BasicTestCase[] = [ + { + description: "should handle nested objects", + input: { user: { name: "John", age: 30 } }, + expected: "user%5Bname%5D=John&user%5Bage%5D=30", + }, + { + description: "should handle deeply nested objects", + input: { user: { profile: { name: "John", settings: { theme: "dark" } } } }, + expected: "user%5Bprofile%5D%5Bname%5D=John&user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark", + }, + { + description: "should handle empty nested objects", + input: { user: {} }, + expected: "", + }, + ]; - it("should handle empty nested objects", () => { - const obj = { user: {} }; - expect(toQueryString(obj)).toBe(""); + nestedTests.forEach(({ description, input, expected }) => { + it(description, () => { + expect(toQueryString(input)).toBe(expected); + }); }); }); describe("Encoding", () => { - it("should encode by default", () => { - const obj = { name: "John Doe", email: "john@example.com" }; - expect(toQueryString(obj)).toBe("name=John%20Doe&email=john%40example.com"); - }); + interface EncodingTestCase { + description: string; + input: any; + options?: { encode?: boolean }; + expected: string; + } - it("should not encode when encode is false", () => { - const obj = { name: "John Doe", email: "john@example.com" }; - expect(toQueryString(obj, { encode: false })).toBe("name=John Doe&email=john@example.com"); - }); - - it("should encode special characters in keys", () => { - const obj = { "user name": "John", "email[primary]": "john@example.com" }; - expect(toQueryString(obj)).toBe("user%20name=John&email%5Bprimary%5D=john%40example.com"); - }); + const encodingTests: EncodingTestCase[] = [ + { + description: "should encode by default", + input: { name: "John Doe", email: "john@example.com" }, + expected: "name=John%20Doe&email=john%40example.com", + }, + { + description: "should not encode when encode is false", + input: { name: "John Doe", email: "john@example.com" }, + options: { encode: false }, + expected: "name=John Doe&email=john@example.com", + }, + { + description: "should encode special characters in keys", + input: { "user name": "John", "email[primary]": "john@example.com" }, + expected: "user%20name=John&email%5Bprimary%5D=john%40example.com", + }, + { + description: "should not encode special characters in keys when encode is false", + input: { "user name": "John", "email[primary]": "john@example.com" }, + options: { encode: false }, + expected: "user name=John&email[primary]=john@example.com", + }, + ]; - it("should not encode special characters in keys when encode is false", () => { - const obj = { "user name": "John", "email[primary]": "john@example.com" }; - expect(toQueryString(obj, { encode: false })).toBe("user name=John&email[primary]=john@example.com"); + encodingTests.forEach(({ description, input, options, expected }) => { + it(description, () => { + expect(toQueryString(input, options)).toBe(expected); + }); }); }); describe("Mixed scenarios", () => { - it("should handle complex nested structures", () => { - const obj = { - filters: { - status: ["active", "pending"], - category: { - type: "electronics", - subcategories: ["phones", "laptops"], + interface MixedTestCase { + description: string; + input: any; + options?: { arrayFormat?: "repeat" | "indices" }; + expected: string; + } + + const mixedTests: MixedTestCase[] = [ + { + description: "should handle complex nested structures", + input: { + filters: { + status: ["active", "pending"], + category: { + type: "electronics", + subcategories: ["phones", "laptops"], + }, }, + sort: { field: "name", direction: "asc" }, }, - sort: { field: "name", direction: "asc" }, - }; - expect(toQueryString(obj)).toBe( - "filters%5Bstatus%5D%5B0%5D=active&filters%5Bstatus%5D%5B1%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D%5B0%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D%5B1%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", - ); - }); - - it("should handle complex nested structures with repeat format", () => { - const obj = { - filters: { - status: ["active", "pending"], - category: { - type: "electronics", - subcategories: ["phones", "laptops"], + expected: + "filters%5Bstatus%5D%5B0%5D=active&filters%5Bstatus%5D%5B1%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D%5B0%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D%5B1%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", + }, + { + description: "should handle complex nested structures with repeat format", + input: { + filters: { + status: ["active", "pending"], + category: { + type: "electronics", + subcategories: ["phones", "laptops"], + }, }, + sort: { field: "name", direction: "asc" }, }, - sort: { field: "name", direction: "asc" }, - }; - expect(toQueryString(obj, { arrayFormat: "repeat" })).toBe( - "filters%5Bstatus%5D=active&filters%5Bstatus%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", - ); - }); - - it("should handle arrays with null/undefined values", () => { - const obj = { items: ["a", null, "c", undefined, "e"] }; - expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c&items%5B4%5D=e"); - }); + options: { arrayFormat: "repeat" }, + expected: + "filters%5Bstatus%5D=active&filters%5Bstatus%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", + }, + { + description: "should handle arrays with null/undefined values", + input: { items: ["a", null, "c", undefined, "e"] }, + expected: "items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c&items%5B4%5D=e", + }, + { + description: "should handle objects with null/undefined values", + input: { name: "John", age: null, email: undefined, active: true }, + expected: "name=John&age=&active=true", + }, + ]; - it("should handle objects with null/undefined values", () => { - const obj = { name: "John", age: null, email: undefined, active: true }; - expect(toQueryString(obj)).toBe("name=John&age=&active=true"); + mixedTests.forEach(({ description, input, options, expected }) => { + it(description, () => { + expect(toQueryString(input, options)).toBe(expected); + }); }); }); describe("Edge cases", () => { - it("should handle numeric keys", () => { - const obj = { "0": "zero", "1": "one" }; - expect(toQueryString(obj)).toBe("0=zero&1=one"); - }); - - it("should handle boolean values in objects", () => { - const obj = { enabled: true, disabled: false }; - expect(toQueryString(obj)).toBe("enabled=true&disabled=false"); - }); - - it("should handle empty strings", () => { - const obj = { name: "", description: "test" }; - expect(toQueryString(obj)).toBe("name=&description=test"); - }); + const edgeCaseTests: BasicTestCase[] = [ + { + description: "should handle numeric keys", + input: { "0": "zero", "1": "one" }, + expected: "0=zero&1=one", + }, + { + description: "should handle boolean values in objects", + input: { enabled: true, disabled: false }, + expected: "enabled=true&disabled=false", + }, + { + description: "should handle empty strings", + input: { name: "", description: "test" }, + expected: "name=&description=test", + }, + { + description: "should handle zero values", + input: { count: 0, price: 0.0 }, + expected: "count=0&price=0", + }, + { + description: "should handle arrays with empty strings", + input: { items: ["a", "", "c"] }, + expected: "items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c", + }, + ]; - it("should handle zero values", () => { - const obj = { count: 0, price: 0.0 }; - expect(toQueryString(obj)).toBe("count=0&price=0"); - }); - - it("should handle arrays with empty strings", () => { - const obj = { items: ["a", "", "c"] }; - expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c"); + edgeCaseTests.forEach(({ description, input, expected }) => { + it(description, () => { + expect(toQueryString(input)).toBe(expected); + }); }); }); describe("Options combinations", () => { - it("should respect both arrayFormat and encode options", () => { - const obj = { items: ["a & b", "c & d"] }; - expect(toQueryString(obj, { arrayFormat: "repeat", encode: false })).toBe("items=a & b&items=c & d"); - }); + interface OptionsTestCase { + description: string; + input: any; + options?: { arrayFormat?: "repeat" | "indices"; encode?: boolean }; + expected: string; + } - it("should use default options when none provided", () => { - const obj = { items: ["a", "b"] }; - expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=b"); - }); + const optionsTests: OptionsTestCase[] = [ + { + description: "should respect both arrayFormat and encode options", + input: { items: ["a & b", "c & d"] }, + options: { arrayFormat: "repeat", encode: false }, + expected: "items=a & b&items=c & d", + }, + { + description: "should use default options when none provided", + input: { items: ["a", "b"] }, + expected: "items%5B0%5D=a&items%5B1%5D=b", + }, + { + description: "should merge provided options with defaults", + input: { items: ["a", "b"], name: "John Doe" }, + options: { encode: false }, + expected: "items[0]=a&items[1]=b&name=John Doe", + }, + ]; - it("should merge provided options with defaults", () => { - const obj = { items: ["a", "b"], name: "John Doe" }; - expect(toQueryString(obj, { encode: false })).toBe("items[0]=a&items[1]=b&name=John Doe"); + optionsTests.forEach(({ description, input, options, expected }) => { + it(description, () => { + expect(toQueryString(input, options)).toBe(expected); + }); }); }); }); diff --git a/tests/wire/agents.test.ts b/tests/wire/agents.test.ts new file mode 100644 index 00000000..9f568061 --- /dev/null +++ b/tests/wire/agents.test.ts @@ -0,0 +1,1477 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../src/api/index"; +import { CortiClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; + +describe("AgentsClient", () => { + test("list (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = [ + { + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + experts: [ + { + type: "expert", + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + }, + ], + }, + ]; + server.mockEndpoint().get("/agents").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.agents.list(); + expect(response).toEqual([ + { + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + experts: [ + { + type: "expert", + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + }, + ], + }, + ]); + }); + + test("list (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/agents").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.agents.list(); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("list (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/agents").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.agents.list(); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("create (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { name: "name", description: "description" }; + const rawResponseBody = { + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + experts: [ + { + type: "expert", + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + mcpServers: [ + { id: "id", name: "name", transportType: "stdio", authorizationType: "none", url: "url" }, + ], + }, + ], + }; + server + .mockEndpoint() + .post("/agents") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.agents.create({ + name: "name", + description: "description", + }); + expect(response).toEqual({ + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + experts: [ + { + type: "expert", + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + mcpServers: [ + { + id: "id", + name: "name", + transportType: "stdio", + authorizationType: "none", + url: "url", + }, + ], + }, + ], + }); + }); + + test("create (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { name: "name", description: "description" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/agents") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.create({ + name: "name", + description: "description", + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("create (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { name: "name", description: "description" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/agents") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.create({ + name: "name", + description: "description", + }); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("get (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + experts: [ + { + type: "expert", + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + mcpServers: [ + { id: "id", name: "name", transportType: "stdio", authorizationType: "none", url: "url" }, + ], + }, + ], + }; + server + .mockEndpoint() + .get("/agents/12345678-90ab-cdef-gh12-34567890abc") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.agents.get("12345678-90ab-cdef-gh12-34567890abc"); + expect(response).toEqual({ + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + experts: [ + { + type: "expert", + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + mcpServers: [ + { + id: "id", + name: "name", + transportType: "stdio", + authorizationType: "none", + url: "url", + }, + ], + }, + ], + }); + }); + + test("get (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/agents/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.agents.get("id"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("get (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/agents/id").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.agents.get("id"); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("get (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/agents/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.agents.get("id"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("delete (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + server + .mockEndpoint() + .delete("/agents/12345678-90ab-cdef-gh12-34567890abc") + .respondWith() + .statusCode(200) + .build(); + + const response = await client.agents.delete("12345678-90ab-cdef-gh12-34567890abc"); + expect(response).toEqual(undefined); + }); + + test("delete (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/agents/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.agents.delete("id"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("delete (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/agents/id").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.agents.delete("id"); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("delete (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/agents/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.agents.delete("id"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("update (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { id: "id", name: "name", description: "description", systemPrompt: "systemPrompt" }; + const rawResponseBody = { + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + experts: [ + { + type: "expert", + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + mcpServers: [ + { id: "id", name: "name", transportType: "stdio", authorizationType: "none", url: "url" }, + ], + }, + ], + }; + server + .mockEndpoint() + .patch("/agents/12345678-90ab-cdef-gh12-34567890abc") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.agents.update("12345678-90ab-cdef-gh12-34567890abc", { + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + }); + expect(response).toEqual({ + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + experts: [ + { + type: "expert", + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + mcpServers: [ + { + id: "id", + name: "name", + transportType: "stdio", + authorizationType: "none", + url: "url", + }, + ], + }, + ], + }); + }); + + test("update (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { id: "id", name: "name", description: "description", systemPrompt: "systemPrompt" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .patch("/agents/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.update("id", { + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("update (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { id: "id", name: "name", description: "description", systemPrompt: "systemPrompt" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .patch("/agents/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.update("id", { + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + }); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("update (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { id: "id", name: "name", description: "description", systemPrompt: "systemPrompt" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .patch("/agents/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.update("id", { + id: "id", + name: "name", + description: "description", + systemPrompt: "systemPrompt", + }); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("getCard (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + protocolVersion: "protocolVersion", + name: "name", + description: "description", + url: "url", + preferredTransport: "preferredTransport", + additionalInterfaces: [{ url: "url", transport: "transport" }], + iconUrl: "iconUrl", + documentationUrl: "documentationUrl", + provider: { organization: "organization", url: "url" }, + version: "version", + capabilities: { + streaming: true, + pushNotifications: true, + stateTransitionHistory: true, + extensions: [{ uri: "uri" }], + }, + securitySchemes: { key: "value" }, + security: { key: "value" }, + defaultInputModes: ["defaultInputModes"], + defaultOutputModes: ["defaultOutputModes"], + skills: [ + { + id: "id", + name: "name", + description: "description", + tags: ["tags"], + examples: [ + { + role: "user", + parts: [{ kind: "text", text: "text" }], + messageId: "messageId", + kind: "message", + }, + ], + inputModes: ["inputModes"], + outputModes: ["outputModes"], + security: { key: "value" }, + }, + ], + supportsAuthenticatedExtendedCard: true, + signatures: [{ protected: "protected", signature: "signature", header: { key: "value" } }], + }; + server + .mockEndpoint() + .get("/agents/12345678-90ab-cdef-gh12-34567890abc/agent-card.json") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.agents.getCard("12345678-90ab-cdef-gh12-34567890abc"); + expect(response).toEqual({ + protocolVersion: "protocolVersion", + name: "name", + description: "description", + url: "url", + preferredTransport: "preferredTransport", + additionalInterfaces: [ + { + url: "url", + transport: "transport", + }, + ], + iconUrl: "iconUrl", + documentationUrl: "documentationUrl", + provider: { + organization: "organization", + url: "url", + }, + version: "version", + capabilities: { + streaming: true, + pushNotifications: true, + stateTransitionHistory: true, + extensions: [ + { + uri: "uri", + }, + ], + }, + securitySchemes: { + key: "value", + }, + security: { + key: "value", + }, + defaultInputModes: ["defaultInputModes"], + defaultOutputModes: ["defaultOutputModes"], + skills: [ + { + id: "id", + name: "name", + description: "description", + tags: ["tags"], + examples: [ + { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + ], + messageId: "messageId", + kind: "message", + }, + ], + inputModes: ["inputModes"], + outputModes: ["outputModes"], + security: { + key: "value", + }, + }, + ], + supportsAuthenticatedExtendedCard: true, + signatures: [ + { + protected: "protected", + signature: "signature", + header: { + key: "value", + }, + }, + ], + }); + }); + + test("getCard (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/id/agent-card.json") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getCard("id"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("getCard (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/id/agent-card.json") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getCard("id"); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("getCard (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/id/agent-card.json") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getCard("id"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("messageSend (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + message: { role: "user", parts: [{ kind: "text", text: "text" }], messageId: "messageId", kind: "message" }, + }; + const rawResponseBody = { + message: { + role: "user", + parts: [{ kind: "text", text: "text" }], + metadata: { key: "value" }, + extensions: ["extensions"], + referenceTaskIds: ["referenceTaskIds"], + messageId: "messageId", + taskId: "taskId", + contextId: "contextId", + kind: "message", + }, + task: { + id: "id", + contextId: "contextId", + status: { + state: "submitted", + message: { + role: "user", + parts: [{ kind: "text", text: "text" }], + messageId: "messageId", + kind: "message", + }, + timestamp: "2024-01-15T09:30:00Z", + }, + history: [ + { role: "user", parts: [{ kind: "text", text: "text" }], messageId: "messageId", kind: "message" }, + ], + artifacts: [{ artifactId: "artifactId", parts: [{ kind: "text", text: "text" }] }], + metadata: { key: "value" }, + kind: "task", + }, + }; + server + .mockEndpoint() + .post("/agents/12345678-90ab-cdef-gh12-34567890abc/v1/message:send") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.agents.messageSend("12345678-90ab-cdef-gh12-34567890abc", { + message: { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + ], + messageId: "messageId", + kind: "message", + }, + }); + expect(response).toEqual({ + message: { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + ], + metadata: { + key: "value", + }, + extensions: ["extensions"], + referenceTaskIds: ["referenceTaskIds"], + messageId: "messageId", + taskId: "taskId", + contextId: "contextId", + kind: "message", + }, + task: { + id: "id", + contextId: "contextId", + status: { + state: "submitted", + message: { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + ], + messageId: "messageId", + kind: "message", + }, + timestamp: new Date("2024-01-15T09:30:00.000Z"), + }, + history: [ + { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + ], + messageId: "messageId", + kind: "message", + }, + ], + artifacts: [ + { + artifactId: "artifactId", + parts: [ + { + kind: "text", + text: "text", + }, + ], + }, + ], + metadata: { + key: "value", + }, + kind: "task", + }, + }); + }); + + test("messageSend (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + message: { + role: "user", + parts: [ + { kind: "text", text: "text" }, + { kind: "text", text: "text" }, + ], + messageId: "messageId", + kind: "message", + }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/agents/id/v1/message:send") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.messageSend("id", { + message: { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + { + kind: "text", + text: "text", + }, + ], + messageId: "messageId", + kind: "message", + }, + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("messageSend (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + message: { + role: "user", + parts: [ + { kind: "text", text: "text" }, + { kind: "text", text: "text" }, + ], + messageId: "messageId", + kind: "message", + }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/agents/id/v1/message:send") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.messageSend("id", { + message: { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + { + kind: "text", + text: "text", + }, + ], + messageId: "messageId", + kind: "message", + }, + }); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("messageSend (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + message: { + role: "user", + parts: [ + { kind: "text", text: "text" }, + { kind: "text", text: "text" }, + ], + messageId: "messageId", + kind: "message", + }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/agents/id/v1/message:send") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.messageSend("id", { + message: { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + { + kind: "text", + text: "text", + }, + ], + messageId: "messageId", + kind: "message", + }, + }); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("getTask (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + id: "id", + contextId: "contextId", + status: { + state: "submitted", + message: { + role: "user", + parts: [{ kind: "text", text: "text" }], + metadata: { key: "value" }, + extensions: ["extensions"], + referenceTaskIds: ["referenceTaskIds"], + messageId: "messageId", + taskId: "taskId", + contextId: "contextId", + kind: "message", + }, + timestamp: "2024-01-15T09:30:00Z", + }, + history: [ + { + role: "user", + parts: [{ kind: "text", text: "text" }], + metadata: { key: "value" }, + extensions: ["extensions"], + referenceTaskIds: ["referenceTaskIds"], + messageId: "messageId", + taskId: "taskId", + contextId: "contextId", + kind: "message", + }, + ], + artifacts: [ + { + artifactId: "artifactId", + name: "name", + description: "description", + parts: [{ kind: "text", text: "text" }], + metadata: { key: "value" }, + extensions: ["extensions"], + }, + ], + metadata: { key: "value" }, + kind: "task", + }; + server + .mockEndpoint() + .get("/agents/12345678-90ab-cdef-gh12-34567890abc/v1/tasks/taskId") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.agents.getTask("12345678-90ab-cdef-gh12-34567890abc", "taskId"); + expect(response).toEqual({ + id: "id", + contextId: "contextId", + status: { + state: "submitted", + message: { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + ], + metadata: { + key: "value", + }, + extensions: ["extensions"], + referenceTaskIds: ["referenceTaskIds"], + messageId: "messageId", + taskId: "taskId", + contextId: "contextId", + kind: "message", + }, + timestamp: new Date("2024-01-15T09:30:00.000Z"), + }, + history: [ + { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + ], + metadata: { + key: "value", + }, + extensions: ["extensions"], + referenceTaskIds: ["referenceTaskIds"], + messageId: "messageId", + taskId: "taskId", + contextId: "contextId", + kind: "message", + }, + ], + artifacts: [ + { + artifactId: "artifactId", + name: "name", + description: "description", + parts: [ + { + kind: "text", + text: "text", + }, + ], + metadata: { + key: "value", + }, + extensions: ["extensions"], + }, + ], + metadata: { + key: "value", + }, + kind: "task", + }); + }); + + test("getTask (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/id/v1/tasks/taskId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getTask("id", "taskId"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("getTask (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/id/v1/tasks/taskId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getTask("id", "taskId"); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("getTask (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/id/v1/tasks/taskId") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getTask("id", "taskId"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("getContext (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + id: "id", + items: [ + { + id: "id", + contextId: "contextId", + status: { state: "submitted" }, + history: [ + { + role: "user", + parts: [{ kind: "text", text: "text" }], + messageId: "messageId", + kind: "message", + }, + ], + artifacts: [{ artifactId: "artifactId", parts: [{ kind: "text", text: "text" }] }], + metadata: { key: "value" }, + kind: "task", + }, + ], + }; + server + .mockEndpoint() + .get("/agents/12345678-90ab-cdef-gh12-34567890abc/v1/contexts/contextId") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.agents.getContext("12345678-90ab-cdef-gh12-34567890abc", "contextId"); + expect(response).toEqual({ + id: "id", + items: [ + { + id: "id", + contextId: "contextId", + status: { + state: "submitted", + }, + history: [ + { + role: "user", + parts: [ + { + kind: "text", + text: "text", + }, + ], + messageId: "messageId", + kind: "message", + }, + ], + artifacts: [ + { + artifactId: "artifactId", + parts: [ + { + kind: "text", + text: "text", + }, + ], + }, + ], + metadata: { + key: "value", + }, + kind: "task", + }, + ], + }); + }); + + test("getContext (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/id/v1/contexts/contextId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getContext("id", "contextId"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("getContext (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/id/v1/contexts/contextId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getContext("id", "contextId"); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("getContext (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/id/v1/contexts/contextId") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getContext("id", "contextId"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("getRegistryExperts (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + experts: [ + { name: "name", description: "description", mcpServers: [{ name: "name", authorizationType: "none" }] }, + ], + }; + server + .mockEndpoint() + .get("/agents/registry/experts") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.agents.getRegistryExperts({ + limit: 100, + offset: 0, + }); + expect(response).toEqual({ + experts: [ + { + name: "name", + description: "description", + mcpServers: [ + { + name: "name", + authorizationType: "none", + }, + ], + }, + ], + }); + }); + + test("getRegistryExperts (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/registry/experts") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getRegistryExperts(); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("getRegistryExperts (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/agents/registry/experts") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.getRegistryExperts(); + }).rejects.toThrow(Corti.UnauthorizedError); + }); +}); diff --git a/tests/wire/codes.test.ts b/tests/wire/codes.test.ts new file mode 100644 index 00000000..d549af96 --- /dev/null +++ b/tests/wire/codes.test.ts @@ -0,0 +1,301 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../src/api/index"; +import { CortiClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; + +describe("CodesClient", () => { + test("predict (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + system: ["icd10cm", "cpt"], + context: [{ type: "text", text: "Short arm splint applied in ED for pain control." }], + maxCandidates: 5, + }; + const rawResponseBody = { + codes: [ + { + system: "icd10cm", + code: "R1030", + display: "Lower abdominal pain, unspecified", + evidences: [{ contextIndex: 0, text: "Example text mentioning lower abdominal pain" }], + }, + ], + candidates: [ + { + system: "icd10cm", + code: "R509", + display: "Fever, unspecified", + evidences: [{ contextIndex: 1, text: "Example text mentioning fever" }], + }, + ], + usageInfo: { creditsConsumed: 1.1 }, + }; + server + .mockEndpoint() + .post("/tools/coding/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.codes.predict({ + system: ["icd10cm", "cpt"], + context: [ + { + type: "text", + text: "Short arm splint applied in ED for pain control.", + }, + ], + maxCandidates: 5, + }); + expect(response).toEqual({ + codes: [ + { + system: "icd10cm", + code: "R1030", + display: "Lower abdominal pain, unspecified", + evidences: [ + { + contextIndex: 0, + text: "Example text mentioning lower abdominal pain", + }, + ], + }, + ], + candidates: [ + { + system: "icd10cm", + code: "R509", + display: "Fever, unspecified", + evidences: [ + { + contextIndex: 1, + text: "Example text mentioning fever", + }, + ], + }, + ], + usageInfo: { + creditsConsumed: 1.1, + }, + }); + }); + + test("predict (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + system: ["icd10cm", "icd10cm"], + context: [ + { type: "text", text: "text" }, + { type: "text", text: "text" }, + ], + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/tools/coding/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.codes.predict({ + system: ["icd10cm", "icd10cm"], + context: [ + { + type: "text", + text: "text", + }, + { + type: "text", + text: "text", + }, + ], + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("predict (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + system: ["icd10cm", "icd10cm"], + context: [ + { type: "text", text: "text" }, + { type: "text", text: "text" }, + ], + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/tools/coding/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.codes.predict({ + system: ["icd10cm", "icd10cm"], + context: [ + { + type: "text", + text: "text", + }, + { + type: "text", + text: "text", + }, + ], + }); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("predict (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + system: ["icd10cm", "icd10cm"], + context: [ + { type: "text", text: "text" }, + { type: "text", text: "text" }, + ], + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/tools/coding/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.codes.predict({ + system: ["icd10cm", "icd10cm"], + context: [ + { + type: "text", + text: "text", + }, + { + type: "text", + text: "text", + }, + ], + }); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("predict (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + system: ["icd10cm", "icd10cm"], + context: [ + { type: "text", text: "text" }, + { type: "text", text: "text" }, + ], + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/tools/coding/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(502) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.codes.predict({ + system: ["icd10cm", "icd10cm"], + context: [ + { + type: "text", + text: "text", + }, + { + type: "text", + text: "text", + }, + ], + }); + }).rejects.toThrow(Corti.BadGatewayError); + }); + + test("predict (6)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + system: ["icd10cm", "icd10cm"], + context: [ + { type: "text", text: "text" }, + { type: "text", text: "text" }, + ], + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/tools/coding/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.codes.predict({ + system: ["icd10cm", "icd10cm"], + context: [ + { + type: "text", + text: "text", + }, + { + type: "text", + text: "text", + }, + ], + }); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); +}); diff --git a/tests/wire/documents.test.ts b/tests/wire/documents.test.ts new file mode 100644 index 00000000..e0e454f8 --- /dev/null +++ b/tests/wire/documents.test.ts @@ -0,0 +1,980 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../src/api/index"; +import { CortiClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; + +describe("DocumentsClient", () => { + test("list (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + data: [ + { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + name: "name", + templateRef: "templateRef", + isStream: true, + sections: [ + { + key: "key", + name: "name", + text: "text", + sort: 1, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + outputLanguage: "outputLanguage", + usageInfo: { creditsConsumed: 1.1 }, + }, + ], + }; + server + .mockEndpoint() + .get("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/documents/") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.list("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + expect(response).toEqual({ + data: [ + { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + name: "name", + templateRef: "templateRef", + isStream: true, + sections: [ + { + key: "key", + name: "name", + text: "text", + sort: 1, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + outputLanguage: "outputLanguage", + usageInfo: { + creditsConsumed: 1.1, + }, + }, + ], + }); + }); + + test("list (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/interactions/id/documents/") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.list("id"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("list (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/documents/") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.list("id"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("list (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/documents/") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.list("id"); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("list (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/documents/") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.list("id"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("create (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + context: [{ type: "facts", data: [{ text: "text", source: "core" }] }], + templateKey: "templateKey", + outputLanguage: "outputLanguage", + }; + const rawResponseBody = { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + name: "name", + templateRef: "templateRef", + isStream: true, + sections: [ + { + key: "key", + name: "name", + text: "text", + sort: 1, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + outputLanguage: "outputLanguage", + usageInfo: { creditsConsumed: 1.1 }, + }; + server + .mockEndpoint() + .post("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.create("f47ac10b-58cc-4372-a567-0e02b2c3d479", { + context: [ + { + type: "facts", + data: [ + { + text: "text", + source: "core", + }, + ], + }, + ], + templateKey: "templateKey", + outputLanguage: "outputLanguage", + }); + expect(response).toEqual({ + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + name: "name", + templateRef: "templateRef", + isStream: true, + sections: [ + { + key: "key", + name: "name", + text: "text", + sort: 1, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + outputLanguage: "outputLanguage", + usageInfo: { + creditsConsumed: 1.1, + }, + }); + }); + + test("create (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + context: [ + { + type: "facts", + data: [ + { text: "text", source: "core" }, + { text: "text", source: "core" }, + ], + }, + { + type: "facts", + data: [ + { text: "text", source: "core" }, + { text: "text", source: "core" }, + ], + }, + ], + templateKey: "templateKey", + outputLanguage: "outputLanguage", + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/interactions/id/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.create("id", { + context: [ + { + type: "facts", + data: [ + { + text: "text", + source: "core", + }, + { + text: "text", + source: "core", + }, + ], + }, + { + type: "facts", + data: [ + { + text: "text", + source: "core", + }, + { + text: "text", + source: "core", + }, + ], + }, + ], + templateKey: "templateKey", + outputLanguage: "outputLanguage", + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("create (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + context: [ + { + type: "facts", + data: [ + { text: "text", source: "core" }, + { text: "text", source: "core" }, + ], + }, + { + type: "facts", + data: [ + { text: "text", source: "core" }, + { text: "text", source: "core" }, + ], + }, + ], + templateKey: "templateKey", + outputLanguage: "outputLanguage", + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/interactions/id/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.create("id", { + context: [ + { + type: "facts", + data: [ + { + text: "text", + source: "core", + }, + { + text: "text", + source: "core", + }, + ], + }, + { + type: "facts", + data: [ + { + text: "text", + source: "core", + }, + { + text: "text", + source: "core", + }, + ], + }, + ], + templateKey: "templateKey", + outputLanguage: "outputLanguage", + }); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("create (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + context: [ + { + type: "facts", + data: [ + { text: "text", source: "core" }, + { text: "text", source: "core" }, + ], + }, + { + type: "facts", + data: [ + { text: "text", source: "core" }, + { text: "text", source: "core" }, + ], + }, + ], + templateKey: "templateKey", + outputLanguage: "outputLanguage", + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/interactions/id/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.create("id", { + context: [ + { + type: "facts", + data: [ + { + text: "text", + source: "core", + }, + { + text: "text", + source: "core", + }, + ], + }, + { + type: "facts", + data: [ + { + text: "text", + source: "core", + }, + { + text: "text", + source: "core", + }, + ], + }, + ], + templateKey: "templateKey", + outputLanguage: "outputLanguage", + }); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("create (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + context: [ + { + type: "facts", + data: [ + { text: "text", source: "core" }, + { text: "text", source: "core" }, + ], + }, + { + type: "facts", + data: [ + { text: "text", source: "core" }, + { text: "text", source: "core" }, + ], + }, + ], + templateKey: "templateKey", + outputLanguage: "outputLanguage", + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/interactions/id/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.create("id", { + context: [ + { + type: "facts", + data: [ + { + text: "text", + source: "core", + }, + { + text: "text", + source: "core", + }, + ], + }, + { + type: "facts", + data: [ + { + text: "text", + source: "core", + }, + { + text: "text", + source: "core", + }, + ], + }, + ], + templateKey: "templateKey", + outputLanguage: "outputLanguage", + }); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("get (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + name: "name", + templateRef: "templateRef", + isStream: true, + sections: [ + { + key: "key", + name: "name", + text: "text", + sort: 1, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + outputLanguage: "outputLanguage", + usageInfo: { creditsConsumed: 1.1 }, + }; + server + .mockEndpoint() + .get("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/documents/f47ac10b-58cc-4372-a567-0e02b2c3d479") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.get( + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + ); + expect(response).toEqual({ + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + name: "name", + templateRef: "templateRef", + isStream: true, + sections: [ + { + key: "key", + name: "name", + text: "text", + sort: 1, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + outputLanguage: "outputLanguage", + usageInfo: { + creditsConsumed: 1.1, + }, + }); + }); + + test("get (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/interactions/id/documents/documentId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.get("id", "documentId"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("get (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/documents/documentId") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.get("id", "documentId"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("get (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/documents/documentId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.get("id", "documentId"); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("get (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/documents/documentId") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.get("id", "documentId"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("delete (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + server + .mockEndpoint() + .delete("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/documents/f47ac10b-58cc-4372-a567-0e02b2c3d479") + .respondWith() + .statusCode(200) + .build(); + + const response = await client.documents.delete( + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + ); + expect(response).toEqual(undefined); + }); + + test("delete (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id/documents/documentId") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.delete("id", "documentId"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("delete (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/interactions/id/documents/documentId") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.delete("id", "documentId"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("delete (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id/documents/documentId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.delete("id", "documentId"); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("delete (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id/documents/documentId") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.delete("id", "documentId"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("update (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + name: "name", + templateRef: "templateRef", + isStream: true, + sections: [ + { + key: "key", + name: "name", + text: "text", + sort: 1, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + outputLanguage: "outputLanguage", + usageInfo: { creditsConsumed: 1.1 }, + }; + server + .mockEndpoint() + .patch("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/documents/f47ac10b-58cc-4372-a567-0e02b2c3d479") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.update( + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + ); + expect(response).toEqual({ + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + name: "name", + templateRef: "templateRef", + isStream: true, + sections: [ + { + key: "key", + name: "name", + text: "text", + sort: 1, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + outputLanguage: "outputLanguage", + usageInfo: { + creditsConsumed: 1.1, + }, + }); + }); + + test("update (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .patch("/interactions/id/documents/documentId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.update("id", "documentId"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("update (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .patch("/interactions/id/documents/documentId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.update("id", "documentId"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("update (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .patch("/interactions/id/documents/documentId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.update("id", "documentId"); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("update (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .patch("/interactions/id/documents/documentId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.update("id", "documentId"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); +}); diff --git a/tests/wire/facts.test.ts b/tests/wire/facts.test.ts new file mode 100644 index 00000000..8face3ab --- /dev/null +++ b/tests/wire/facts.test.ts @@ -0,0 +1,461 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../src/api/index"; +import { CortiClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; + +describe("FactsClient", () => { + test("factGroupsList (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + data: [{ id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", key: "key", translations: [{}] }], + }; + server.mockEndpoint().get("/factgroups/").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.facts.factGroupsList(); + expect(response).toEqual({ + data: [ + { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + key: "key", + translations: [{}], + }, + ], + }); + }); + + test("factGroupsList (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server.mockEndpoint().get("/factgroups/").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.facts.factGroupsList(); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("list (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + facts: [ + { + id: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08", + text: "text", + group: "other", + groupId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + isDiscarded: true, + source: "core", + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + evidence: [{}], + }, + ], + }; + server + .mockEndpoint() + .get("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/facts/") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.facts.list("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + expect(response).toEqual({ + facts: [ + { + id: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08", + text: "text", + group: "other", + groupId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + isDiscarded: true, + source: "core", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + evidence: [{}], + }, + ], + }); + }); + + test("list (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/facts/") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.facts.list("id"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("create (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { facts: [{ text: "text", group: "other" }] }; + const rawResponseBody = { + facts: [ + { + id: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08", + text: "text", + group: "other", + groupId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + source: "core", + isDiscarded: true, + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + }; + server + .mockEndpoint() + .post("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/facts/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.facts.create("f47ac10b-58cc-4372-a567-0e02b2c3d479", { + facts: [ + { + text: "text", + group: "other", + }, + ], + }); + expect(response).toEqual({ + facts: [ + { + id: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08", + text: "text", + group: "other", + groupId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + source: "core", + isDiscarded: true, + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }); + }); + + test("create (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + facts: [ + { text: "text", group: "group" }, + { text: "text", group: "group" }, + ], + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/interactions/id/facts/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.facts.create("id", { + facts: [ + { + text: "text", + group: "group", + }, + { + text: "text", + group: "group", + }, + ], + }); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("batchUpdate (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { facts: [{ factId: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08" }] }; + const rawResponseBody = { + facts: [ + { + id: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08", + text: "text", + group: "other", + groupId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + source: "core", + isDiscarded: true, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + }; + server + .mockEndpoint() + .patch("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/facts/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.facts.batchUpdate("f47ac10b-58cc-4372-a567-0e02b2c3d479", { + facts: [ + { + factId: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08", + }, + ], + }); + expect(response).toEqual({ + facts: [ + { + id: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08", + text: "text", + group: "other", + groupId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + source: "core", + isDiscarded: true, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }); + }); + + test("batchUpdate (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { facts: [{ factId: "factId" }, { factId: "factId" }] }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .patch("/interactions/id/facts/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.facts.batchUpdate("id", { + facts: [ + { + factId: "factId", + }, + { + factId: "factId", + }, + ], + }); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("update (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { + id: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08", + text: "text", + group: "other", + groupId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + source: "core", + isDiscarded: true, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }; + server + .mockEndpoint() + .patch("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/facts/3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.facts.update( + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08", + ); + expect(response).toEqual({ + id: "3c9d8a12-7f44-4b3e-9e6f-9271c2bbfa08", + text: "text", + group: "other", + groupId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + source: "core", + isDiscarded: true, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }); + }); + + test("update (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .patch("/interactions/id/facts/factId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.facts.update("id", "factId"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("extract (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { context: [{ type: "text", text: "text" }], outputLanguage: "outputLanguage" }; + const rawResponseBody = { + facts: [{ group: "group", value: "value" }], + outputLanguage: "outputLanguage", + usageInfo: { creditsConsumed: 1.1 }, + }; + server + .mockEndpoint() + .post("/tools/extract-facts") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.facts.extract({ + context: [ + { + type: "text", + text: "text", + }, + ], + outputLanguage: "outputLanguage", + }); + expect(response).toEqual({ + facts: [ + { + group: "group", + value: "value", + }, + ], + outputLanguage: "outputLanguage", + usageInfo: { + creditsConsumed: 1.1, + }, + }); + }); + + test("extract (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + context: [ + { type: "text", text: "text" }, + { type: "text", text: "text" }, + ], + outputLanguage: "outputLanguage", + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/tools/extract-facts") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.facts.extract({ + context: [ + { + type: "text", + text: "text", + }, + { + type: "text", + text: "text", + }, + ], + outputLanguage: "outputLanguage", + }); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); +}); diff --git a/tests/wire/interactions.test.ts b/tests/wire/interactions.test.ts new file mode 100644 index 00000000..2a71c0f8 --- /dev/null +++ b/tests/wire/interactions.test.ts @@ -0,0 +1,571 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../src/api/index"; +import { CortiClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; + +describe("InteractionsClient", () => { + test("list (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + interactions: [ + { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + assignedUserId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + period: { startedAt: "2024-01-15T09:30:00Z" }, + }, + patient: { identifier: "identifier" }, + endedAt: "2024-01-15T09:30:00Z", + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + websocketUrl: "websocketUrl", + lastUpdated: "2024-01-15T09:30:00Z", + }, + ], + }; + server + .mockEndpoint({ once: false }) + .get("/interactions/") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const expected = { + interactions: [ + { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + assignedUserId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + period: { + startedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + }, + patient: { + identifier: "identifier", + }, + endedAt: new Date("2024-01-15T09:30:00.000Z"), + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + websocketUrl: "websocketUrl", + lastUpdated: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }; + const page = await client.interactions.list(); + + expect(expected.interactions).toEqual(page.data); + expect(page.hasNextPage()).toBe(true); + const nextPage = await page.getNextPage(); + expect(expected.interactions).toEqual(nextPage.data); + }); + + test("list (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint({ once: false }) + .get("/interactions/") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.interactions.list(); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("list (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint({ once: false }) + .get("/interactions/") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.interactions.list(); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("create (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + encounter: { identifier: "identifier", status: "planned", type: "first_consultation" }, + }; + const rawResponseBody = { interactionId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", websocketUrl: "websocketUrl" }; + server + .mockEndpoint() + .post("/interactions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.interactions.create({ + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + }, + }); + expect(response).toEqual({ + interactionId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + websocketUrl: "websocketUrl", + }); + }); + + test("create (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + encounter: { identifier: "identifier", status: "planned", type: "first_consultation" }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/interactions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.interactions.create({ + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + }, + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("create (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + encounter: { identifier: "identifier", status: "planned", type: "first_consultation" }, + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/interactions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.interactions.create({ + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + }, + }); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("create (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + encounter: { identifier: "identifier", status: "planned", type: "first_consultation" }, + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/interactions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.interactions.create({ + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + }, + }); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("create (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + encounter: { identifier: "identifier", status: "planned", type: "first_consultation" }, + }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/interactions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.interactions.create({ + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + }, + }); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("get (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + assignedUserId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + period: { startedAt: "2024-01-15T09:30:00Z", endedAt: "2024-01-15T09:30:00Z" }, + title: "title", + }, + patient: { + identifier: "identifier", + name: "name", + gender: "male", + birthDate: "2024-01-15T09:30:00Z", + pronouns: "pronouns", + }, + endedAt: "2024-01-15T09:30:00Z", + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + websocketUrl: "websocketUrl", + lastUpdated: "2024-01-15T09:30:00Z", + }; + server + .mockEndpoint() + .get("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.interactions.get("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + expect(response).toEqual({ + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + assignedUserId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + period: { + startedAt: new Date("2024-01-15T09:30:00.000Z"), + endedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + title: "title", + }, + patient: { + identifier: "identifier", + name: "name", + gender: "male", + birthDate: new Date("2024-01-15T09:30:00.000Z"), + pronouns: "pronouns", + }, + endedAt: new Date("2024-01-15T09:30:00.000Z"), + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + websocketUrl: "websocketUrl", + lastUpdated: new Date("2024-01-15T09:30:00.000Z"), + }); + }); + + test("get (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server.mockEndpoint().get("/interactions/id").respondWith().statusCode(403).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.interactions.get("id"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("get (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server.mockEndpoint().get("/interactions/id").respondWith().statusCode(504).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.interactions.get("id"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("delete (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + server + .mockEndpoint() + .delete("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479") + .respondWith() + .statusCode(200) + .build(); + + const response = await client.interactions.delete("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + expect(response).toEqual(undefined); + }); + + test("delete (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.interactions.delete("id"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("delete (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.interactions.delete("id"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("update (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + assignedUserId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + period: { startedAt: "2024-01-15T09:30:00Z", endedAt: "2024-01-15T09:30:00Z" }, + title: "title", + }, + patient: { + identifier: "identifier", + name: "name", + gender: "male", + birthDate: "2024-01-15T09:30:00Z", + pronouns: "pronouns", + }, + endedAt: "2024-01-15T09:30:00Z", + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + websocketUrl: "websocketUrl", + lastUpdated: "2024-01-15T09:30:00Z", + }; + server + .mockEndpoint() + .patch("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.interactions.update("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + expect(response).toEqual({ + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + assignedUserId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + encounter: { + identifier: "identifier", + status: "planned", + type: "first_consultation", + period: { + startedAt: new Date("2024-01-15T09:30:00.000Z"), + endedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + title: "title", + }, + patient: { + identifier: "identifier", + name: "name", + gender: "male", + birthDate: new Date("2024-01-15T09:30:00.000Z"), + pronouns: "pronouns", + }, + endedAt: new Date("2024-01-15T09:30:00.000Z"), + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + websocketUrl: "websocketUrl", + lastUpdated: new Date("2024-01-15T09:30:00.000Z"), + }); + }); + + test("update (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .patch("/interactions/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.interactions.update("id"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("update (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .patch("/interactions/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.interactions.update("id"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); +}); diff --git a/tests/wire/recordings.test.ts b/tests/wire/recordings.test.ts new file mode 100644 index 00000000..9a4b4da4 --- /dev/null +++ b/tests/wire/recordings.test.ts @@ -0,0 +1,240 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../src/api/index"; +import { CortiClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; + +describe("RecordingsClient", () => { + test("list (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { recordings: ["f47ac10b-58cc-4372-a567-0e02b2c3d479"] }; + server + .mockEndpoint() + .get("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/recordings/") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.recordings.list("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + expect(response).toEqual({ + recordings: ["f47ac10b-58cc-4372-a567-0e02b2c3d479"], + }); + }); + + test("list (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/interactions/id/recordings/") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.recordings.list("id"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("list (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/recordings/") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.recordings.list("id"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("list (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/recordings/") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.recordings.list("id"); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("list (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/recordings/") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.recordings.list("id"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("delete (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + server + .mockEndpoint() + .delete( + "/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/recordings/f47ac10b-58cc-4372-a567-0e02b2c3d479", + ) + .respondWith() + .statusCode(200) + .build(); + + const response = await client.recordings.delete( + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + ); + expect(response).toEqual(undefined); + }); + + test("delete (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id/recordings/recordingId") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.recordings.delete("id", "recordingId"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("delete (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/interactions/id/recordings/recordingId") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.recordings.delete("id", "recordingId"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("delete (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id/recordings/recordingId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.recordings.delete("id", "recordingId"); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("delete (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id/recordings/recordingId") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.recordings.delete("id", "recordingId"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); +}); diff --git a/tests/wire/templates.test.ts b/tests/wire/templates.test.ts new file mode 100644 index 00000000..b9256946 --- /dev/null +++ b/tests/wire/templates.test.ts @@ -0,0 +1,315 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../src/api/index"; +import { CortiClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; + +describe("TemplatesClient", () => { + test("sectionList (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + data: [ + { + updatedAt: "2024-01-15T09:30:00Z", + name: "name", + alternateName: "alternateName", + key: "key", + description: "description", + defaultWritingStyle: { name: "name" }, + defaultFormatRule: {}, + additionalInstructions: "additionalInstructions", + content: "content", + documentationMode: "global_sequential", + type: "type", + translations: [{ languageId: "languageId" }], + }, + ], + }; + server.mockEndpoint().get("/templateSections/").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.templates.sectionList(); + expect(response).toEqual({ + data: [ + { + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + name: "name", + alternateName: "alternateName", + key: "key", + description: "description", + defaultWritingStyle: { + name: "name", + }, + defaultFormatRule: {}, + additionalInstructions: "additionalInstructions", + content: "content", + documentationMode: "global_sequential", + type: "type", + translations: [ + { + languageId: "languageId", + }, + ], + }, + ], + }); + }); + + test("sectionList (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/templateSections/").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.sectionList(); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("sectionList (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server.mockEndpoint().get("/templateSections/").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.sectionList(); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("list (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + data: [ + { + updatedAt: "2024-01-15T09:30:00Z", + name: "name", + description: "description", + additionalInstructions: "additionalInstructions", + key: "key", + status: "status", + documentationMode: "global_sequential", + templateSections: [ + { + sort: 1, + section: { + name: "name", + key: "key", + description: "description", + defaultWritingStyle: { name: "name" }, + type: "type", + translations: [{ languageId: "languageId" }], + }, + }, + ], + translations: [{ languageId: "languageId" }], + }, + ], + }; + server.mockEndpoint().get("/templates/").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.templates.list(); + expect(response).toEqual({ + data: [ + { + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + name: "name", + description: "description", + additionalInstructions: "additionalInstructions", + key: "key", + status: "status", + documentationMode: "global_sequential", + templateSections: [ + { + sort: 1, + section: { + name: "name", + key: "key", + description: "description", + defaultWritingStyle: { + name: "name", + }, + type: "type", + translations: [ + { + languageId: "languageId", + }, + ], + }, + }, + ], + translations: [ + { + languageId: "languageId", + }, + ], + }, + ], + }); + }); + + test("list (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/templates/").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.list(); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("list (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server.mockEndpoint().get("/templates/").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.list(); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("get (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + updatedAt: "2024-01-15T09:30:00Z", + name: "name", + description: "description", + additionalInstructions: "additionalInstructions", + key: "key", + status: "status", + documentationMode: "global_sequential", + templateSections: [ + { + sort: 1, + section: { + name: "name", + key: "key", + description: "description", + defaultWritingStyle: { name: "name" }, + type: "type", + translations: [{ languageId: "languageId" }], + }, + }, + ], + translations: [{ languageId: "languageId", name: "name", description: "description" }], + }; + server.mockEndpoint().get("/templates/key").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.templates.get("key"); + expect(response).toEqual({ + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + name: "name", + description: "description", + additionalInstructions: "additionalInstructions", + key: "key", + status: "status", + documentationMode: "global_sequential", + templateSections: [ + { + sort: 1, + section: { + name: "name", + key: "key", + description: "description", + defaultWritingStyle: { + name: "name", + }, + type: "type", + translations: [ + { + languageId: "languageId", + }, + ], + }, + }, + ], + translations: [ + { + languageId: "languageId", + name: "name", + description: "description", + }, + ], + }); + }); + + test("get (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/templates/key").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.get("key"); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("get (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server.mockEndpoint().get("/templates/key").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.get("key"); + }).rejects.toThrow(Corti.InternalServerError); + }); +}); diff --git a/tests/wire/transcripts.test.ts b/tests/wire/transcripts.test.ts new file mode 100644 index 00000000..29dac883 --- /dev/null +++ b/tests/wire/transcripts.test.ts @@ -0,0 +1,732 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../src/api/index"; +import { CortiClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; + +describe("TranscriptsClient", () => { + test("list (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + transcripts: [ + { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + transcriptSample: "transcriptSample", + transcript: { + metadata: {}, + transcripts: [{ channel: 1, participant: 1, speakerId: 1, text: "text", start: 1, end: 1 }], + }, + }, + ], + }; + server + .mockEndpoint() + .get("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/transcripts/") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transcripts.list("f47ac10b-58cc-4372-a567-0e02b2c3d479"); + expect(response).toEqual({ + transcripts: [ + { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + transcriptSample: "transcriptSample", + transcript: { + metadata: {}, + transcripts: [ + { + channel: 1, + participant: 1, + speakerId: 1, + text: "text", + start: 1, + end: 1, + }, + ], + }, + }, + ], + }); + }); + + test("list (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.list("id"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("list (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.list("id"); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("list (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.list("id"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("list (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.list("id"); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("list (6)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.list("id"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("create (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { recordingId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", primaryLanguage: "en" }; + const rawResponseBody = { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + metadata: { participantsRoles: [{ channel: 1, role: "doctor" }] }, + transcripts: [{ channel: 1, participant: 1, speakerId: 1, text: "text", start: 1, end: 1 }], + usageInfo: { creditsConsumed: 1.1 }, + recordingId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + status: "completed", + }; + server + .mockEndpoint() + .post("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/transcripts/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transcripts.create("f47ac10b-58cc-4372-a567-0e02b2c3d479", { + recordingId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + primaryLanguage: "en", + }); + expect(response).toEqual({ + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + metadata: { + participantsRoles: [ + { + channel: 1, + role: "doctor", + }, + ], + }, + transcripts: [ + { + channel: 1, + participant: 1, + speakerId: 1, + text: "text", + start: 1, + end: 1, + }, + ], + usageInfo: { + creditsConsumed: 1.1, + }, + recordingId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + status: "completed", + }); + }); + + test("create (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { recordingId: "recordingId", primaryLanguage: "primaryLanguage" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/interactions/id/transcripts/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.create("id", { + recordingId: "recordingId", + primaryLanguage: "primaryLanguage", + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("create (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { recordingId: "recordingId", primaryLanguage: "primaryLanguage" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/interactions/id/transcripts/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.create("id", { + recordingId: "recordingId", + primaryLanguage: "primaryLanguage", + }); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("create (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { recordingId: "recordingId", primaryLanguage: "primaryLanguage" }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/interactions/id/transcripts/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.create("id", { + recordingId: "recordingId", + primaryLanguage: "primaryLanguage", + }); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("create (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { recordingId: "recordingId", primaryLanguage: "primaryLanguage" }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/interactions/id/transcripts/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.create("id", { + recordingId: "recordingId", + primaryLanguage: "primaryLanguage", + }); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("create (6)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { recordingId: "recordingId", primaryLanguage: "primaryLanguage" }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .post("/interactions/id/transcripts/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.create("id", { + recordingId: "recordingId", + primaryLanguage: "primaryLanguage", + }); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("get (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + metadata: { participantsRoles: [{ channel: 1, role: "doctor" }] }, + transcripts: [{ channel: 1, participant: 1, speakerId: 1, text: "text", start: 1, end: 1 }], + usageInfo: { creditsConsumed: 1.1 }, + recordingId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + status: "completed", + }; + server + .mockEndpoint() + .get("/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/transcripts/f47ac10b-58cc-4372-a567-0e02b2c3d479") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transcripts.get( + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + ); + expect(response).toEqual({ + id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + metadata: { + participantsRoles: [ + { + channel: 1, + role: "doctor", + }, + ], + }, + transcripts: [ + { + channel: 1, + participant: 1, + speakerId: 1, + text: "text", + start: 1, + end: 1, + }, + ], + usageInfo: { + creditsConsumed: 1.1, + }, + recordingId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + status: "completed", + }); + }); + + test("get (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/transcriptId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.get("id", "transcriptId"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("get (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/transcriptId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.get("id", "transcriptId"); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("get (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/transcriptId") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.get("id", "transcriptId"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("get (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/transcriptId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.get("id", "transcriptId"); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("get (6)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/transcriptId") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.get("id", "transcriptId"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("delete (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + server + .mockEndpoint() + .delete( + "/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/transcripts/f47ac10b-58cc-4372-a567-0e02b2c3d479", + ) + .respondWith() + .statusCode(200) + .build(); + + const response = await client.transcripts.delete( + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + ); + expect(response).toEqual(undefined); + }); + + test("delete (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/interactions/id/transcripts/transcriptId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.delete("id", "transcriptId"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("delete (3)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/interactions/id/transcripts/transcriptId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.delete("id", "transcriptId"); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("delete (4)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id/transcripts/transcriptId") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.delete("id", "transcriptId"); + }).rejects.toThrow(Corti.ForbiddenError); + }); + + test("delete (5)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id/transcripts/transcriptId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.delete("id", "transcriptId"); + }).rejects.toThrow(Corti.InternalServerError); + }); + + test("delete (6)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + server + .mockEndpoint() + .delete("/interactions/id/transcripts/transcriptId") + .respondWith() + .statusCode(504) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.delete("id", "transcriptId"); + }).rejects.toThrow(Corti.GatewayTimeoutError); + }); + + test("getStatus (1)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { status: "completed" }; + server + .mockEndpoint() + .get( + "/interactions/f47ac10b-58cc-4372-a567-0e02b2c3d479/transcripts/f47ac10b-58cc-4372-a567-0e02b2c3d479/status", + ) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.transcripts.getStatus( + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + "f47ac10b-58cc-4372-a567-0e02b2c3d479", + ); + expect(response).toEqual({ + status: "completed", + }); + }); + + test("getStatus (2)", async () => { + const server = mockServerPool.createServer(); + const client = new CortiClient({ + maxRetries: 0, + token: "test", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/interactions/id/transcripts/transcriptId/status") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.transcripts.getStatus("id", "transcriptId"); + }).rejects.toThrow(Corti.NotFoundError); + }); +}); diff --git a/tsconfig.base.json b/tsconfig.base.json index c75083dc..d7627675 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -9,7 +9,9 @@ "declaration": true, "outDir": "dist", "rootDir": "src", - "baseUrl": "src" + "baseUrl": "src", + "isolatedModules": true, + "isolatedDeclarations": true }, "include": ["src"], "exclude": [] diff --git a/tsconfig.esm.json b/tsconfig.esm.json index 95a5eb73..6ce90974 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -2,7 +2,8 @@ "extends": "./tsconfig.base.json", "compilerOptions": { "module": "esnext", - "outDir": "dist/esm" + "outDir": "dist/esm", + "verbatimModuleSyntax": true }, "include": ["src"], "exclude": [] diff --git a/vitest.config.mts b/vitest.config.mts new file mode 100644 index 00000000..ba2ec4f9 --- /dev/null +++ b/vitest.config.mts @@ -0,0 +1,28 @@ +import { defineConfig } from "vitest/config"; +export default defineConfig({ + test: { + projects: [ + { + test: { + globals: true, + name: "unit", + environment: "node", + root: "./tests", + include: ["**/*.test.{js,ts,jsx,tsx}"], + exclude: ["wire/**"], + setupFiles: ["./setup.ts"], + }, + }, + { + test: { + globals: true, + name: "wire", + environment: "node", + root: "./tests/wire", + setupFiles: ["../setup.ts", "../mock-server/setup.ts"], + }, + }, + ], + passWithNoTests: true, + }, +}); diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index c85dceb0..00000000 --- a/yarn.lock +++ /dev/null @@ -1,3237 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.28.6", "@babel/code-frame@^7.29.0": - version "7.29.0" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.0.tgz#7cd7a59f15b3cc0dcd803038f7792712a7d0b15c" - integrity sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw== - dependencies: - "@babel/helper-validator-identifier" "^7.28.5" - js-tokens "^4.0.0" - picocolors "^1.1.1" - -"@babel/compat-data@^7.28.6": - version "7.29.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.29.0.tgz#00d03e8c0ac24dd9be942c5370990cbe1f17d88d" - integrity sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg== - -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": - version "7.29.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.29.0.tgz#5286ad785df7f79d656e88ce86e650d16ca5f322" - integrity sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA== - dependencies: - "@babel/code-frame" "^7.29.0" - "@babel/generator" "^7.29.0" - "@babel/helper-compilation-targets" "^7.28.6" - "@babel/helper-module-transforms" "^7.28.6" - "@babel/helpers" "^7.28.6" - "@babel/parser" "^7.29.0" - "@babel/template" "^7.28.6" - "@babel/traverse" "^7.29.0" - "@babel/types" "^7.29.0" - "@jridgewell/remapping" "^2.3.5" - convert-source-map "^2.0.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.2.3" - semver "^6.3.1" - -"@babel/generator@^7.29.0", "@babel/generator@^7.7.2": - version "7.29.1" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.29.1.tgz#d09876290111abbb00ef962a7b83a5307fba0d50" - integrity sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw== - dependencies: - "@babel/parser" "^7.29.0" - "@babel/types" "^7.29.0" - "@jridgewell/gen-mapping" "^0.3.12" - "@jridgewell/trace-mapping" "^0.3.28" - jsesc "^3.0.2" - -"@babel/helper-compilation-targets@^7.28.6": - version "7.28.6" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz#32c4a3f41f12ed1532179b108a4d746e105c2b25" - integrity sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA== - dependencies: - "@babel/compat-data" "^7.28.6" - "@babel/helper-validator-option" "^7.27.1" - browserslist "^4.24.0" - lru-cache "^5.1.1" - semver "^6.3.1" - -"@babel/helper-globals@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.28.0.tgz#b9430df2aa4e17bc28665eadeae8aa1d985e6674" - integrity sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw== - -"@babel/helper-module-imports@^7.28.6": - version "7.28.6" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz#60632cbd6ffb70b22823187201116762a03e2d5c" - integrity sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw== - dependencies: - "@babel/traverse" "^7.28.6" - "@babel/types" "^7.28.6" - -"@babel/helper-module-transforms@^7.28.6": - version "7.28.6" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz#9312d9d9e56edc35aeb6e95c25d4106b50b9eb1e" - integrity sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA== - dependencies: - "@babel/helper-module-imports" "^7.28.6" - "@babel/helper-validator-identifier" "^7.28.5" - "@babel/traverse" "^7.28.6" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.28.6", "@babel/helper-plugin-utils@^7.8.0": - version "7.28.6" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz#6f13ea251b68c8532e985fd532f28741a8af9ac8" - integrity sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug== - -"@babel/helper-string-parser@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" - integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== - -"@babel/helper-validator-identifier@^7.28.5": - version "7.28.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4" - integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q== - -"@babel/helper-validator-option@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" - integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== - -"@babel/helpers@^7.28.6": - version "7.28.6" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.28.6.tgz#fca903a313ae675617936e8998b814c415cbf5d7" - integrity sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw== - dependencies: - "@babel/template" "^7.28.6" - "@babel/types" "^7.28.6" - -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.28.6", "@babel/parser@^7.29.0": - version "7.29.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.0.tgz#669ef345add7d057e92b7ed15f0bac07611831b6" - integrity sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww== - dependencies: - "@babel/types" "^7.29.0" - -"@babel/plugin-syntax-async-generators@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" - integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-bigint@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" - integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-class-properties@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" - integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== - dependencies: - "@babel/helper-plugin-utils" "^7.12.13" - -"@babel/plugin-syntax-class-static-block@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" - integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-import-attributes@^7.24.7": - version "7.28.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.28.6.tgz#b71d5914665f60124e133696f17cd7669062c503" - integrity sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw== - dependencies: - "@babel/helper-plugin-utils" "^7.28.6" - -"@babel/plugin-syntax-import-meta@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" - integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-json-strings@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" - integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-jsx@^7.7.2": - version "7.28.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.28.6.tgz#f8ca28bbd84883b5fea0e447c635b81ba73997ee" - integrity sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w== - dependencies: - "@babel/helper-plugin-utils" "^7.28.6" - -"@babel/plugin-syntax-logical-assignment-operators@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" - integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" - integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-numeric-separator@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" - integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-object-rest-spread@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" - integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-catch-binding@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" - integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-chaining@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" - integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-private-property-in-object@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" - integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-top-level-await@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" - integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-typescript@^7.7.2": - version "7.28.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.28.6.tgz#c7b2ddf1d0a811145b1de800d1abd146af92e3a2" - integrity sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A== - dependencies: - "@babel/helper-plugin-utils" "^7.28.6" - -"@babel/template@^7.28.6", "@babel/template@^7.3.3": - version "7.28.6" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.28.6.tgz#0e7e56ecedb78aeef66ce7972b082fce76a23e57" - integrity sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ== - dependencies: - "@babel/code-frame" "^7.28.6" - "@babel/parser" "^7.28.6" - "@babel/types" "^7.28.6" - -"@babel/traverse@^7.28.6", "@babel/traverse@^7.29.0": - version "7.29.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.0.tgz#f323d05001440253eead3c9c858adbe00b90310a" - integrity sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA== - dependencies: - "@babel/code-frame" "^7.29.0" - "@babel/generator" "^7.29.0" - "@babel/helper-globals" "^7.28.0" - "@babel/parser" "^7.29.0" - "@babel/template" "^7.28.6" - "@babel/types" "^7.29.0" - debug "^4.3.1" - -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.28.2", "@babel/types@^7.28.6", "@babel/types@^7.29.0", "@babel/types@^7.3.3": - version "7.29.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.0.tgz#9f5b1e838c446e72cf3cd4b918152b8c605e37c7" - integrity sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A== - dependencies: - "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.28.5" - -"@bcoe/v8-coverage@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" - integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== - -"@faker-js/faker@^9.9.0": - version "9.9.0" - resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-9.9.0.tgz#3ad015fbbaaae7af3149555e0f22b4b30134c69d" - integrity sha512-OEl393iCOoo/z8bMezRlJu+GlRGlsKbUAN7jKB6LhnKoqKve5DXRpalbItIIcwnCjs1k/FOPjFzcA6Qn+H+YbA== - -"@inquirer/ansi@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@inquirer/ansi/-/ansi-1.0.2.tgz#674a4c4d81ad460695cb2a1fc69d78cd187f337e" - integrity sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ== - -"@inquirer/confirm@^5.0.0": - version "5.1.21" - resolved "https://registry.yarnpkg.com/@inquirer/confirm/-/confirm-5.1.21.tgz#610c4acd7797d94890a6e2dde2c98eb1e891dd12" - integrity sha512-KR8edRkIsUayMXV+o3Gv+q4jlhENF9nMYUZs9PA2HzrXeHI8M5uDag70U7RJn9yyiMZSbtF5/UexBtAVtZGSbQ== - dependencies: - "@inquirer/core" "^10.3.2" - "@inquirer/type" "^3.0.10" - -"@inquirer/core@^10.3.2": - version "10.3.2" - resolved "https://registry.yarnpkg.com/@inquirer/core/-/core-10.3.2.tgz#535979ff3ff4fe1e7cc4f83e2320504c743b7e20" - integrity sha512-43RTuEbfP8MbKzedNqBrlhhNKVwoK//vUFNW3Q3vZ88BLcrs4kYpGg+B2mm5p2K/HfygoCxuKwJJiv8PbGmE0A== - dependencies: - "@inquirer/ansi" "^1.0.2" - "@inquirer/figures" "^1.0.15" - "@inquirer/type" "^3.0.10" - cli-width "^4.1.0" - mute-stream "^2.0.0" - signal-exit "^4.1.0" - wrap-ansi "^6.2.0" - yoctocolors-cjs "^2.1.3" - -"@inquirer/figures@^1.0.15": - version "1.0.15" - resolved "https://registry.yarnpkg.com/@inquirer/figures/-/figures-1.0.15.tgz#dbb49ed80df11df74268023b496ac5d9acd22b3a" - integrity sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g== - -"@inquirer/type@^3.0.10": - version "3.0.10" - resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-3.0.10.tgz#11ed564ec78432a200ea2601a212d24af8150d50" - integrity sha512-BvziSRxfz5Ov8ch0z/n3oijRSEcEsHnhggm4xFZe93DHcUCTlutlq9Ox4SVENAfcRD22UQq7T/atg9Wr3k09eA== - -"@istanbuljs/load-nyc-config@^1.0.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" - integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== - dependencies: - camelcase "^5.3.1" - find-up "^4.1.0" - get-package-type "^0.1.0" - js-yaml "^3.13.1" - resolve-from "^5.0.0" - -"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" - integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== - -"@jest/console@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" - integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== - dependencies: - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - slash "^3.0.0" - -"@jest/core@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" - integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== - dependencies: - "@jest/console" "^29.7.0" - "@jest/reporters" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - ci-info "^3.2.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - jest-changed-files "^29.7.0" - jest-config "^29.7.0" - jest-haste-map "^29.7.0" - jest-message-util "^29.7.0" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-resolve-dependencies "^29.7.0" - jest-runner "^29.7.0" - jest-runtime "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - jest-watcher "^29.7.0" - micromatch "^4.0.4" - pretty-format "^29.7.0" - slash "^3.0.0" - strip-ansi "^6.0.0" - -"@jest/environment@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" - integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== - dependencies: - "@jest/fake-timers" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - jest-mock "^29.7.0" - -"@jest/expect-utils@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" - integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== - dependencies: - jest-get-type "^29.6.3" - -"@jest/expect@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" - integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== - dependencies: - expect "^29.7.0" - jest-snapshot "^29.7.0" - -"@jest/fake-timers@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" - integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== - dependencies: - "@jest/types" "^29.6.3" - "@sinonjs/fake-timers" "^10.0.2" - "@types/node" "*" - jest-message-util "^29.7.0" - jest-mock "^29.7.0" - jest-util "^29.7.0" - -"@jest/globals@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" - integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/expect" "^29.7.0" - "@jest/types" "^29.6.3" - jest-mock "^29.7.0" - -"@jest/reporters@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" - integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@jridgewell/trace-mapping" "^0.3.18" - "@types/node" "*" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^6.0.0" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.1.3" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - jest-worker "^29.7.0" - slash "^3.0.0" - string-length "^4.0.1" - strip-ansi "^6.0.0" - v8-to-istanbul "^9.0.1" - -"@jest/schemas@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" - integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== - dependencies: - "@sinclair/typebox" "^0.27.8" - -"@jest/source-map@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" - integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== - dependencies: - "@jridgewell/trace-mapping" "^0.3.18" - callsites "^3.0.0" - graceful-fs "^4.2.9" - -"@jest/test-result@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" - integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== - dependencies: - "@jest/console" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/istanbul-lib-coverage" "^2.0.0" - collect-v8-coverage "^1.0.0" - -"@jest/test-sequencer@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" - integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== - dependencies: - "@jest/test-result" "^29.7.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - slash "^3.0.0" - -"@jest/transform@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" - integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== - dependencies: - "@babel/core" "^7.11.6" - "@jest/types" "^29.6.3" - "@jridgewell/trace-mapping" "^0.3.18" - babel-plugin-istanbul "^6.1.1" - chalk "^4.0.0" - convert-source-map "^2.0.0" - fast-json-stable-stringify "^2.1.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - jest-regex-util "^29.6.3" - jest-util "^29.7.0" - micromatch "^4.0.4" - pirates "^4.0.4" - slash "^3.0.0" - write-file-atomic "^4.0.2" - -"@jest/types@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" - integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== - dependencies: - "@jest/schemas" "^29.6.3" - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^17.0.8" - chalk "^4.0.0" - -"@jridgewell/gen-mapping@^0.3.12", "@jridgewell/gen-mapping@^0.3.5": - version "0.3.13" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz#6342a19f44347518c93e43b1ac69deb3c4656a1f" - integrity sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA== - dependencies: - "@jridgewell/sourcemap-codec" "^1.5.0" - "@jridgewell/trace-mapping" "^0.3.24" - -"@jridgewell/remapping@^2.3.5": - version "2.3.5" - resolved "https://registry.yarnpkg.com/@jridgewell/remapping/-/remapping-2.3.5.tgz#375c476d1972947851ba1e15ae8f123047445aa1" - integrity sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ== - dependencies: - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.24" - -"@jridgewell/resolve-uri@^3.1.0": - version "3.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" - integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== - -"@jridgewell/source-map@^0.3.3": - version "0.3.11" - resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.11.tgz#b21835cbd36db656b857c2ad02ebd413cc13a9ba" - integrity sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA== - dependencies: - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.25" - -"@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": - version "1.5.5" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba" - integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== - -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25", "@jridgewell/trace-mapping@^0.3.28": - version "0.3.31" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz#db15d6781c931f3a251a3dac39501c98a6082fd0" - integrity sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw== - dependencies: - "@jridgewell/resolve-uri" "^3.1.0" - "@jridgewell/sourcemap-codec" "^1.4.14" - -"@mswjs/interceptors@^0.41.2": - version "0.41.2" - resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.41.2.tgz#6e490a41f9701edf237aa561b5cd23fe262f4ce6" - integrity sha512-7G0Uf0yK3f2bjElBLGHIQzgRgMESczOMyYVasq1XK8P5HaXtlW4eQhz9MBL+TQILZLaruq+ClGId+hH0w4jvWw== - dependencies: - "@open-draft/deferred-promise" "^2.2.0" - "@open-draft/logger" "^0.3.0" - "@open-draft/until" "^2.0.0" - is-node-process "^1.2.0" - outvariant "^1.4.3" - strict-event-emitter "^0.5.1" - -"@open-draft/deferred-promise@^2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz#4a822d10f6f0e316be4d67b4d4f8c9a124b073bd" - integrity sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA== - -"@open-draft/logger@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@open-draft/logger/-/logger-0.3.0.tgz#2b3ab1242b360aa0adb28b85f5d7da1c133a0954" - integrity sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ== - dependencies: - is-node-process "^1.2.0" - outvariant "^1.4.0" - -"@open-draft/until@^2.0.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@open-draft/until/-/until-2.1.0.tgz#0acf32f470af2ceaf47f095cdecd40d68666efda" - integrity sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg== - -"@sinclair/typebox@^0.27.8": - version "0.27.10" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.10.tgz#beefe675f1853f73676aecc915b2bd2ac98c4fc6" - integrity sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA== - -"@sinonjs/commons@^3.0.0": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" - integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== - dependencies: - type-detect "4.0.8" - -"@sinonjs/fake-timers@^10.0.2": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" - integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== - dependencies: - "@sinonjs/commons" "^3.0.0" - -"@tootallnate/once@2": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" - integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== - -"@types/babel__core@^7.1.14": - version "7.20.5" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" - integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== - dependencies: - "@babel/parser" "^7.20.7" - "@babel/types" "^7.20.7" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__generator@*": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.27.0.tgz#b5819294c51179957afaec341442f9341e4108a9" - integrity sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg== - dependencies: - "@babel/types" "^7.0.0" - -"@types/babel__template@*": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" - integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.28.0.tgz#07d713d6cce0d265c9849db0cbe62d3f61f36f74" - integrity sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q== - dependencies: - "@babel/types" "^7.28.2" - -"@types/eslint-scope@^3.7.7": - version "3.7.7" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" - integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== - dependencies: - "@types/eslint" "*" - "@types/estree" "*" - -"@types/eslint@*": - version "9.6.1" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-9.6.1.tgz#d5795ad732ce81715f27f75da913004a56751584" - integrity sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" - -"@types/estree@*", "@types/estree@^1.0.8": - version "1.0.8" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" - integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== - -"@types/graceful-fs@^4.1.3": - version "4.1.9" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" - integrity sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ== - dependencies: - "@types/node" "*" - -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": - version "2.0.6" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" - integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== - -"@types/istanbul-lib-report@*": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" - integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== - dependencies: - "@types/istanbul-lib-coverage" "*" - -"@types/istanbul-reports@^3.0.0": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" - integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== - dependencies: - "@types/istanbul-lib-report" "*" - -"@types/jest@^29.5.14": - version "29.5.14" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" - integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== - dependencies: - expect "^29.0.0" - pretty-format "^29.0.0" - -"@types/jsdom@^20.0.0": - version "20.0.1" - resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-20.0.1.tgz#07c14bc19bd2f918c1929541cdaacae894744808" - integrity sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ== - dependencies: - "@types/node" "*" - "@types/tough-cookie" "*" - parse5 "^7.0.0" - -"@types/json-schema@*", "@types/json-schema@^7.0.15", "@types/json-schema@^7.0.9": - version "7.0.15" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" - integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== - -"@types/node@*": - version "25.2.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-25.2.3.tgz#9c18245be768bdb4ce631566c7da303a5c99a7f8" - integrity sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ== - dependencies: - undici-types "~7.16.0" - -"@types/node@^18.19.70": - version "18.19.130" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.130.tgz#da4c6324793a79defb7a62cba3947ec5add00d59" - integrity sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg== - dependencies: - undici-types "~5.26.4" - -"@types/stack-utils@^2.0.0": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" - integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== - -"@types/statuses@^2.0.6": - version "2.0.6" - resolved "https://registry.yarnpkg.com/@types/statuses/-/statuses-2.0.6.tgz#66748315cc9a96d63403baa8671b2c124f8633aa" - integrity sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA== - -"@types/tough-cookie@*": - version "4.0.5" - resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" - integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== - -"@types/ws@^8.5.10": - version "8.18.1" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.18.1.tgz#48464e4bf2ddfd17db13d845467f6070ffea4aa9" - integrity sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg== - dependencies: - "@types/node" "*" - -"@types/yargs-parser@*": - version "21.0.3" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" - integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== - -"@types/yargs@^17.0.8": - version "17.0.35" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.35.tgz#07013e46aa4d7d7d50a49e15604c1c5340d4eb24" - integrity sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg== - dependencies: - "@types/yargs-parser" "*" - -"@webassemblyjs/ast@1.14.1", "@webassemblyjs/ast@^1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.14.1.tgz#a9f6a07f2b03c95c8d38c4536a1fdfb521ff55b6" - integrity sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ== - dependencies: - "@webassemblyjs/helper-numbers" "1.13.2" - "@webassemblyjs/helper-wasm-bytecode" "1.13.2" - -"@webassemblyjs/floating-point-hex-parser@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz#fcca1eeddb1cc4e7b6eed4fc7956d6813b21b9fb" - integrity sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA== - -"@webassemblyjs/helper-api-error@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz#e0a16152248bc38daee76dd7e21f15c5ef3ab1e7" - integrity sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ== - -"@webassemblyjs/helper-buffer@1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz#822a9bc603166531f7d5df84e67b5bf99b72b96b" - integrity sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA== - -"@webassemblyjs/helper-numbers@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz#dbd932548e7119f4b8a7877fd5a8d20e63490b2d" - integrity sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA== - dependencies: - "@webassemblyjs/floating-point-hex-parser" "1.13.2" - "@webassemblyjs/helper-api-error" "1.13.2" - "@xtuc/long" "4.2.2" - -"@webassemblyjs/helper-wasm-bytecode@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz#e556108758f448aae84c850e593ce18a0eb31e0b" - integrity sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA== - -"@webassemblyjs/helper-wasm-section@1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz#9629dda9c4430eab54b591053d6dc6f3ba050348" - integrity sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@webassemblyjs/helper-buffer" "1.14.1" - "@webassemblyjs/helper-wasm-bytecode" "1.13.2" - "@webassemblyjs/wasm-gen" "1.14.1" - -"@webassemblyjs/ieee754@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz#1c5eaace1d606ada2c7fd7045ea9356c59ee0dba" - integrity sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw== - dependencies: - "@xtuc/ieee754" "^1.2.0" - -"@webassemblyjs/leb128@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.13.2.tgz#57c5c3deb0105d02ce25fa3fd74f4ebc9fd0bbb0" - integrity sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw== - dependencies: - "@xtuc/long" "4.2.2" - -"@webassemblyjs/utf8@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.13.2.tgz#917a20e93f71ad5602966c2d685ae0c6c21f60f1" - integrity sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ== - -"@webassemblyjs/wasm-edit@^1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz#ac6689f502219b59198ddec42dcd496b1004d597" - integrity sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@webassemblyjs/helper-buffer" "1.14.1" - "@webassemblyjs/helper-wasm-bytecode" "1.13.2" - "@webassemblyjs/helper-wasm-section" "1.14.1" - "@webassemblyjs/wasm-gen" "1.14.1" - "@webassemblyjs/wasm-opt" "1.14.1" - "@webassemblyjs/wasm-parser" "1.14.1" - "@webassemblyjs/wast-printer" "1.14.1" - -"@webassemblyjs/wasm-gen@1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz#991e7f0c090cb0bb62bbac882076e3d219da9570" - integrity sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@webassemblyjs/helper-wasm-bytecode" "1.13.2" - "@webassemblyjs/ieee754" "1.13.2" - "@webassemblyjs/leb128" "1.13.2" - "@webassemblyjs/utf8" "1.13.2" - -"@webassemblyjs/wasm-opt@1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz#e6f71ed7ccae46781c206017d3c14c50efa8106b" - integrity sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@webassemblyjs/helper-buffer" "1.14.1" - "@webassemblyjs/wasm-gen" "1.14.1" - "@webassemblyjs/wasm-parser" "1.14.1" - -"@webassemblyjs/wasm-parser@1.14.1", "@webassemblyjs/wasm-parser@^1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz#b3e13f1893605ca78b52c68e54cf6a865f90b9fb" - integrity sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@webassemblyjs/helper-api-error" "1.13.2" - "@webassemblyjs/helper-wasm-bytecode" "1.13.2" - "@webassemblyjs/ieee754" "1.13.2" - "@webassemblyjs/leb128" "1.13.2" - "@webassemblyjs/utf8" "1.13.2" - -"@webassemblyjs/wast-printer@1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz#3bb3e9638a8ae5fdaf9610e7a06b4d9f9aa6fe07" - integrity sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@xtuc/long" "4.2.2" - -"@xtuc/ieee754@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" - integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== - -"@xtuc/long@4.2.2": - version "4.2.2" - resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" - integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== - -abab@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" - integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== - -acorn-globals@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3" - integrity sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q== - dependencies: - acorn "^8.1.0" - acorn-walk "^8.0.2" - -acorn-import-phases@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz#16eb850ba99a056cb7cbfe872ffb8972e18c8bd7" - integrity sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ== - -acorn-walk@^8.0.2: - version "8.3.4" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" - integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== - dependencies: - acorn "^8.11.0" - -acorn@^8.1.0, acorn@^8.11.0, acorn@^8.15.0, acorn@^8.8.1: - version "8.15.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" - integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== - -agent-base@6: - version "6.0.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" - integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== - dependencies: - debug "4" - -ajv-formats@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" - integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA== - dependencies: - ajv "^8.0.0" - -ajv-keywords@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz#69d4d385a4733cdbeab44964a1170a88f87f0e16" - integrity sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw== - dependencies: - fast-deep-equal "^3.1.3" - -ajv@^8.0.0, ajv@^8.9.0: - version "8.17.1" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" - integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== - dependencies: - fast-deep-equal "^3.1.3" - fast-uri "^3.0.1" - json-schema-traverse "^1.0.0" - require-from-string "^2.0.2" - -ansi-escapes@^4.2.1: - version "4.3.2" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" - integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== - dependencies: - type-fest "^0.21.3" - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -ansi-styles@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" - integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== - -anymatch@^3.0.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" - integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== - -babel-jest@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" - integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== - dependencies: - "@jest/transform" "^29.7.0" - "@types/babel__core" "^7.1.14" - babel-plugin-istanbul "^6.1.1" - babel-preset-jest "^29.6.3" - chalk "^4.0.0" - graceful-fs "^4.2.9" - slash "^3.0.0" - -babel-plugin-istanbul@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" - integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@istanbuljs/load-nyc-config" "^1.0.0" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-instrument "^5.0.4" - test-exclude "^6.0.0" - -babel-plugin-jest-hoist@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz#aadbe943464182a8922c3c927c3067ff40d24626" - integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== - dependencies: - "@babel/template" "^7.3.3" - "@babel/types" "^7.3.3" - "@types/babel__core" "^7.1.14" - "@types/babel__traverse" "^7.0.6" - -babel-preset-current-node-syntax@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz#20730d6cdc7dda5d89401cab10ac6a32067acde6" - integrity sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg== - dependencies: - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-syntax-bigint" "^7.8.3" - "@babel/plugin-syntax-class-properties" "^7.12.13" - "@babel/plugin-syntax-class-static-block" "^7.14.5" - "@babel/plugin-syntax-import-attributes" "^7.24.7" - "@babel/plugin-syntax-import-meta" "^7.10.4" - "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.10.4" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-syntax-private-property-in-object" "^7.14.5" - "@babel/plugin-syntax-top-level-await" "^7.14.5" - -babel-preset-jest@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" - integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== - dependencies: - babel-plugin-jest-hoist "^29.6.3" - babel-preset-current-node-syntax "^1.0.0" - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -baseline-browser-mapping@^2.9.0: - version "2.9.19" - resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz#3e508c43c46d961eb4d7d2e5b8d1dd0f9ee4f488" - integrity sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg== - -brace-expansion@^1.1.7: - version "1.1.12" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" - integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" - integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== - dependencies: - fill-range "^7.1.1" - -browserslist@^4.24.0, browserslist@^4.28.1: - version "4.28.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.28.1.tgz#7f534594628c53c63101079e27e40de490456a95" - integrity sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA== - dependencies: - baseline-browser-mapping "^2.9.0" - caniuse-lite "^1.0.30001759" - electron-to-chromium "^1.5.263" - node-releases "^2.0.27" - update-browserslist-db "^1.2.0" - -bs-logger@^0.2.6: - version "0.2.6" - resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" - integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== - dependencies: - fast-json-stable-stringify "2.x" - -bser@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" - integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== - dependencies: - node-int64 "^0.4.0" - -buffer-from@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" - integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== - -call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" - integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== - dependencies: - es-errors "^1.3.0" - function-bind "^1.1.2" - -callsites@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" - integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== - -camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - -camelcase@^6.2.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" - integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== - -caniuse-lite@^1.0.30001759: - version "1.0.30001769" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001769.tgz#1ad91594fad7dc233777c2781879ab5409f7d9c2" - integrity sha512-BCfFL1sHijQlBGWBMuJyhZUhzo7wer5sVj9hqekB/7xn0Ypy+pER/edCYQm4exbXj4WiySGp40P8UuTh6w1srg== - -chalk@^4.0.0, chalk@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -char-regex@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" - integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== - -chrome-trace-event@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz#05bffd7ff928465093314708c93bdfa9bd1f0f5b" - integrity sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ== - -ci-info@^3.2.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" - integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== - -cjs-module-lexer@^1.0.0: - version "1.4.3" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz#0f79731eb8cfe1ec72acd4066efac9d61991b00d" - integrity sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q== - -cli-width@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-4.1.0.tgz#42daac41d3c254ef38ad8ac037672130173691c5" - integrity sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ== - -cliui@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" - integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.1" - wrap-ansi "^7.0.0" - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== - -collect-v8-coverage@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.3.tgz#cc1f01eb8d02298cbc9a437c74c70ab4e5210b80" - integrity sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw== - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -commander@^2.20.0: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -convert-source-map@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" - integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== - -cookie@^1.0.2: - version "1.1.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-1.1.1.tgz#3bb9bdfc82369db9c2f69c93c9c3ceb310c88b3c" - integrity sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ== - -create-jest@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" - integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== - dependencies: - "@jest/types" "^29.6.3" - chalk "^4.0.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - jest-config "^29.7.0" - jest-util "^29.7.0" - prompts "^2.0.1" - -cross-spawn@^7.0.3: - version "7.0.6" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" - integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -cssom@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" - integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw== - -cssom@~0.3.6: - version "0.3.8" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== - -cssstyle@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" - integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== - dependencies: - cssom "~0.3.6" - -data-urls@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.2.tgz#9cf24a477ae22bcef5cd5f6f0bfbc1d2d3be9143" - integrity sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ== - dependencies: - abab "^2.0.6" - whatwg-mimetype "^3.0.0" - whatwg-url "^11.0.0" - -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: - version "4.4.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" - integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== - dependencies: - ms "^2.1.3" - -decimal.js@^10.4.2: - version "10.6.0" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.6.0.tgz#e649a43e3ab953a72192ff5983865e509f37ed9a" - integrity sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg== - -dedent@^1.0.0: - version "1.7.1" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.7.1.tgz#364661eea3d73f3faba7089214420ec2f8f13e15" - integrity sha512-9JmrhGZpOlEgOLdQgSm0zxFaYoQon408V1v49aqTWuXENVlnCuY9JBZcXZiCsZQWDjTm5Qf/nIvAy77mXDAjEg== - -deepmerge@^4.2.2: - version "4.3.1" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" - integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== - -detect-newline@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" - integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== - -diff-sequences@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" - integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== - -domexception@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" - integrity sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw== - dependencies: - webidl-conversions "^7.0.0" - -dunder-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" - integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== - dependencies: - call-bind-apply-helpers "^1.0.1" - es-errors "^1.3.0" - gopd "^1.2.0" - -electron-to-chromium@^1.5.263: - version "1.5.286" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.286.tgz#142be1ab5e1cd5044954db0e5898f60a4960384e" - integrity sha512-9tfDXhJ4RKFNerfjdCcZfufu49vg620741MNs26a9+bhLThdB+plgMeou98CAaHu/WATj2iHOOHTp1hWtABj2A== - -emittery@^0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" - integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -enhanced-resolve@^5.0.0, enhanced-resolve@^5.19.0: - version "5.19.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.19.0.tgz#6687446a15e969eaa63c2fa2694510e17ae6d97c" - integrity sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg== - dependencies: - graceful-fs "^4.2.4" - tapable "^2.3.0" - -entities@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/entities/-/entities-6.0.1.tgz#c28c34a43379ca7f61d074130b2f5f7020a30694" - integrity sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g== - -error-ex@^1.3.1: - version "1.3.4" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.4.tgz#b3a8d8bb6f92eecc1629e3e27d3c8607a8a32414" - integrity sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ== - dependencies: - is-arrayish "^0.2.1" - -es-define-property@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" - integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== - -es-errors@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" - integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== - -es-module-lexer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-2.0.0.tgz#f657cd7a9448dcdda9c070a3cb75e5dc1e85f5b1" - integrity sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw== - -es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" - integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== - dependencies: - es-errors "^1.3.0" - -es-set-tostringtag@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" - integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== - dependencies: - es-errors "^1.3.0" - get-intrinsic "^1.2.6" - has-tostringtag "^1.0.2" - hasown "^2.0.2" - -escalade@^3.1.1, escalade@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" - integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== - -escape-string-regexp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" - integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== - -escodegen@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" - integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== - dependencies: - esprima "^4.0.1" - estraverse "^5.2.0" - esutils "^2.0.2" - optionalDependencies: - source-map "~0.6.1" - -eslint-scope@5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" - integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== - dependencies: - esrecurse "^4.3.0" - estraverse "^4.1.1" - -esprima@^4.0.0, esprima@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -esrecurse@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" - integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== - dependencies: - estraverse "^5.2.0" - -estraverse@^4.1.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== - -estraverse@^5.2.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" - integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -events@^3.2.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" - integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== - -execa@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" - integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== - dependencies: - cross-spawn "^7.0.3" - get-stream "^6.0.0" - human-signals "^2.1.0" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.1" - onetime "^5.1.2" - signal-exit "^3.0.3" - strip-final-newline "^2.0.0" - -exit@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== - -expect@^29.0.0, expect@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" - integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== - dependencies: - "@jest/expect-utils" "^29.7.0" - jest-get-type "^29.6.3" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - -fast-deep-equal@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== - -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== - -fast-uri@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.0.tgz#66eecff6c764c0df9b762e62ca7edcfb53b4edfa" - integrity sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA== - -fb-watchman@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" - integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== - dependencies: - bser "2.1.1" - -fill-range@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" - integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== - dependencies: - to-regex-range "^5.0.1" - -find-up@^4.0.0, find-up@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - -form-data@^4.0.0: - version "4.0.5" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.5.tgz#b49e48858045ff4cbf6b03e1805cebcad3679053" - integrity sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - es-set-tostringtag "^2.1.0" - hasown "^2.0.2" - mime-types "^2.1.12" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - -fsevents@^2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - -function-bind@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" - integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== - -gensync@^1.0.0-beta.2: - version "1.0.0-beta.2" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" - integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-intrinsic@^1.2.6: - version "1.3.0" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" - integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== - dependencies: - call-bind-apply-helpers "^1.0.2" - es-define-property "^1.0.1" - es-errors "^1.3.0" - es-object-atoms "^1.1.1" - function-bind "^1.1.2" - get-proto "^1.0.1" - gopd "^1.2.0" - has-symbols "^1.1.0" - hasown "^2.0.2" - math-intrinsics "^1.1.0" - -get-package-type@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" - integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== - -get-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" - integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== - dependencies: - dunder-proto "^1.0.1" - es-object-atoms "^1.0.0" - -get-stream@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" - integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== - -glob-to-regexp@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" - integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== - -glob@^7.1.3, glob@^7.1.4: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - -gopd@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" - integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== - -graceful-fs@^4.1.2, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.9: - version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" - integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== - -graphql@^16.12.0: - version "16.12.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.12.0.tgz#28cc2462435b1ac3fdc6976d030cef83a0c13ac7" - integrity sha512-DKKrynuQRne0PNpEbzuEdHlYOMksHSUI8Zc9Unei5gTsMNA2/vMpoMz/yKba50pejK56qj98qM0SjYxAKi13gQ== - -handlebars@^4.7.8: - version "4.7.8" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9" - integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ== - dependencies: - minimist "^1.2.5" - neo-async "^2.6.2" - source-map "^0.6.1" - wordwrap "^1.0.0" - optionalDependencies: - uglify-js "^3.1.4" - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has-symbols@^1.0.3, has-symbols@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" - integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== - -has-tostringtag@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" - integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== - dependencies: - has-symbols "^1.0.3" - -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== - dependencies: - function-bind "^1.1.2" - -headers-polyfill@^4.0.2: - version "4.0.3" - resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-4.0.3.tgz#922a0155de30ecc1f785bcf04be77844ca95ad07" - integrity sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ== - -html-encoding-sniffer@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz#2cb1a8cf0db52414776e5b2a7a04d5dd98158de9" - integrity sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA== - dependencies: - whatwg-encoding "^2.0.0" - -html-escaper@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" - integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== - -http-proxy-agent@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" - integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== - dependencies: - "@tootallnate/once" "2" - agent-base "6" - debug "4" - -https-proxy-agent@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" - integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== - dependencies: - agent-base "6" - debug "4" - -human-signals@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" - integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== - -iconv-lite@0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" - integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== - dependencies: - safer-buffer ">= 2.1.2 < 3.0.0" - -import-local@^3.0.2: - version "3.2.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" - integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== - dependencies: - pkg-dir "^4.2.0" - resolve-cwd "^3.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== - -is-core-module@^2.16.1: - version "2.16.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" - integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== - dependencies: - hasown "^2.0.2" - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-generator-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" - integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== - -is-node-process@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-node-process/-/is-node-process-1.2.0.tgz#ea02a1b90ddb3934a19aea414e88edef7e11d134" - integrity sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw== - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-potential-custom-element-name@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" - integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== - -is-stream@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" - integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - -istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" - integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== - -istanbul-lib-instrument@^5.0.4: - version "5.2.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" - integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== - dependencies: - "@babel/core" "^7.12.3" - "@babel/parser" "^7.14.7" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.2.0" - semver "^6.3.0" - -istanbul-lib-instrument@^6.0.0: - version "6.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" - integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== - dependencies: - "@babel/core" "^7.23.9" - "@babel/parser" "^7.23.9" - "@istanbuljs/schema" "^0.1.3" - istanbul-lib-coverage "^3.2.0" - semver "^7.5.4" - -istanbul-lib-report@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" - integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== - dependencies: - istanbul-lib-coverage "^3.0.0" - make-dir "^4.0.0" - supports-color "^7.1.0" - -istanbul-lib-source-maps@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" - integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.1.3: - version "3.2.0" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.2.0.tgz#cb4535162b5784aa623cee21a7252cf2c807ac93" - integrity sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA== - dependencies: - html-escaper "^2.0.0" - istanbul-lib-report "^3.0.0" - -jest-changed-files@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" - integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== - dependencies: - execa "^5.0.0" - jest-util "^29.7.0" - p-limit "^3.1.0" - -jest-circus@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" - integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/expect" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - dedent "^1.0.0" - is-generator-fn "^2.0.0" - jest-each "^29.7.0" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-runtime "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" - p-limit "^3.1.0" - pretty-format "^29.7.0" - pure-rand "^6.0.0" - slash "^3.0.0" - stack-utils "^2.0.3" - -jest-cli@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" - integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== - dependencies: - "@jest/core" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" - chalk "^4.0.0" - create-jest "^29.7.0" - exit "^0.1.2" - import-local "^3.0.2" - jest-config "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - yargs "^17.3.1" - -jest-config@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" - integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== - dependencies: - "@babel/core" "^7.11.6" - "@jest/test-sequencer" "^29.7.0" - "@jest/types" "^29.6.3" - babel-jest "^29.7.0" - chalk "^4.0.0" - ci-info "^3.2.0" - deepmerge "^4.2.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-circus "^29.7.0" - jest-environment-node "^29.7.0" - jest-get-type "^29.6.3" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-runner "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - micromatch "^4.0.4" - parse-json "^5.2.0" - pretty-format "^29.7.0" - slash "^3.0.0" - strip-json-comments "^3.1.1" - -jest-diff@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" - integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== - dependencies: - chalk "^4.0.0" - diff-sequences "^29.6.3" - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - -jest-docblock@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" - integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== - dependencies: - detect-newline "^3.0.0" - -jest-each@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" - integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== - dependencies: - "@jest/types" "^29.6.3" - chalk "^4.0.0" - jest-get-type "^29.6.3" - jest-util "^29.7.0" - pretty-format "^29.7.0" - -jest-environment-jsdom@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz#d206fa3551933c3fd519e5dfdb58a0f5139a837f" - integrity sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/fake-timers" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/jsdom" "^20.0.0" - "@types/node" "*" - jest-mock "^29.7.0" - jest-util "^29.7.0" - jsdom "^20.0.0" - -jest-environment-node@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" - integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/fake-timers" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - jest-mock "^29.7.0" - jest-util "^29.7.0" - -jest-get-type@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" - integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== - -jest-haste-map@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" - integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== - dependencies: - "@jest/types" "^29.6.3" - "@types/graceful-fs" "^4.1.3" - "@types/node" "*" - anymatch "^3.0.3" - fb-watchman "^2.0.0" - graceful-fs "^4.2.9" - jest-regex-util "^29.6.3" - jest-util "^29.7.0" - jest-worker "^29.7.0" - micromatch "^4.0.4" - walker "^1.0.8" - optionalDependencies: - fsevents "^2.3.2" - -jest-leak-detector@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" - integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== - dependencies: - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - -jest-matcher-utils@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" - integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== - dependencies: - chalk "^4.0.0" - jest-diff "^29.7.0" - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - -jest-message-util@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" - integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== - dependencies: - "@babel/code-frame" "^7.12.13" - "@jest/types" "^29.6.3" - "@types/stack-utils" "^2.0.0" - chalk "^4.0.0" - graceful-fs "^4.2.9" - micromatch "^4.0.4" - pretty-format "^29.7.0" - slash "^3.0.0" - stack-utils "^2.0.3" - -jest-mock@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" - integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== - dependencies: - "@jest/types" "^29.6.3" - "@types/node" "*" - jest-util "^29.7.0" - -jest-pnp-resolver@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" - integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== - -jest-regex-util@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" - integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== - -jest-resolve-dependencies@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" - integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== - dependencies: - jest-regex-util "^29.6.3" - jest-snapshot "^29.7.0" - -jest-resolve@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" - integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== - dependencies: - chalk "^4.0.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - jest-pnp-resolver "^1.2.2" - jest-util "^29.7.0" - jest-validate "^29.7.0" - resolve "^1.20.0" - resolve.exports "^2.0.0" - slash "^3.0.0" - -jest-runner@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" - integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== - dependencies: - "@jest/console" "^29.7.0" - "@jest/environment" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - emittery "^0.13.1" - graceful-fs "^4.2.9" - jest-docblock "^29.7.0" - jest-environment-node "^29.7.0" - jest-haste-map "^29.7.0" - jest-leak-detector "^29.7.0" - jest-message-util "^29.7.0" - jest-resolve "^29.7.0" - jest-runtime "^29.7.0" - jest-util "^29.7.0" - jest-watcher "^29.7.0" - jest-worker "^29.7.0" - p-limit "^3.1.0" - source-map-support "0.5.13" - -jest-runtime@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" - integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/fake-timers" "^29.7.0" - "@jest/globals" "^29.7.0" - "@jest/source-map" "^29.6.3" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - cjs-module-lexer "^1.0.0" - collect-v8-coverage "^1.0.0" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - jest-message-util "^29.7.0" - jest-mock "^29.7.0" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" - slash "^3.0.0" - strip-bom "^4.0.0" - -jest-snapshot@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" - integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== - dependencies: - "@babel/core" "^7.11.6" - "@babel/generator" "^7.7.2" - "@babel/plugin-syntax-jsx" "^7.7.2" - "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/types" "^7.3.3" - "@jest/expect-utils" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - babel-preset-current-node-syntax "^1.0.0" - chalk "^4.0.0" - expect "^29.7.0" - graceful-fs "^4.2.9" - jest-diff "^29.7.0" - jest-get-type "^29.6.3" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - natural-compare "^1.4.0" - pretty-format "^29.7.0" - semver "^7.5.3" - -jest-util@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" - integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== - dependencies: - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - ci-info "^3.2.0" - graceful-fs "^4.2.9" - picomatch "^2.2.3" - -jest-validate@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" - integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== - dependencies: - "@jest/types" "^29.6.3" - camelcase "^6.2.0" - chalk "^4.0.0" - jest-get-type "^29.6.3" - leven "^3.1.0" - pretty-format "^29.7.0" - -jest-watcher@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" - integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== - dependencies: - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - emittery "^0.13.1" - jest-util "^29.7.0" - string-length "^4.0.1" - -jest-worker@^27.4.5: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" - integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== - dependencies: - "@types/node" "*" - merge-stream "^2.0.0" - supports-color "^8.0.0" - -jest-worker@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" - integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== - dependencies: - "@types/node" "*" - jest-util "^29.7.0" - merge-stream "^2.0.0" - supports-color "^8.0.0" - -jest@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" - integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== - dependencies: - "@jest/core" "^29.7.0" - "@jest/types" "^29.6.3" - import-local "^3.0.2" - jest-cli "^29.7.0" - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -js-yaml@^3.13.1: - version "3.14.2" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.2.tgz#77485ce1dd7f33c061fd1b16ecea23b55fcb04b0" - integrity sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -jsdom@^20.0.0: - version "20.0.3" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-20.0.3.tgz#886a41ba1d4726f67a8858028c99489fed6ad4db" - integrity sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ== - dependencies: - abab "^2.0.6" - acorn "^8.8.1" - acorn-globals "^7.0.0" - cssom "^0.5.0" - cssstyle "^2.3.0" - data-urls "^3.0.2" - decimal.js "^10.4.2" - domexception "^4.0.0" - escodegen "^2.0.0" - form-data "^4.0.0" - html-encoding-sniffer "^3.0.0" - http-proxy-agent "^5.0.0" - https-proxy-agent "^5.0.1" - is-potential-custom-element-name "^1.0.1" - nwsapi "^2.2.2" - parse5 "^7.1.1" - saxes "^6.0.0" - symbol-tree "^3.2.4" - tough-cookie "^4.1.2" - w3c-xmlserializer "^4.0.0" - webidl-conversions "^7.0.0" - whatwg-encoding "^2.0.0" - whatwg-mimetype "^3.0.0" - whatwg-url "^11.0.0" - ws "^8.11.0" - xml-name-validator "^4.0.0" - -jsesc@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d" - integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA== - -json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" - integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== - -json-schema-traverse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" - integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== - -json5@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" - integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== - -kleur@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" - integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== - -leven@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" - integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== - -lines-and-columns@^1.1.6: - version "1.2.4" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" - integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== - -loader-runner@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.1.tgz#6c76ed29b0ccce9af379208299f07f876de737e3" - integrity sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q== - -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" - integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== - dependencies: - p-locate "^4.1.0" - -lodash.memoize@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" - integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== - -lru-cache@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" - integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== - dependencies: - yallist "^3.0.2" - -make-dir@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" - integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== - dependencies: - semver "^7.5.3" - -make-error@^1.3.6: - version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== - -makeerror@1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" - integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== - dependencies: - tmpl "1.0.5" - -math-intrinsics@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" - integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== - -merge-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== - -micromatch@^4.0.0, micromatch@^4.0.4: - version "4.0.8" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" - integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== - dependencies: - braces "^3.0.3" - picomatch "^2.3.1" - -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@^2.1.12, mime-types@^2.1.27: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - -minimatch@^3.0.4, minimatch@^3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.5: - version "1.2.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" - integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== - -ms@^2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -msw@^2.8.4: - version "2.12.10" - resolved "https://registry.yarnpkg.com/msw/-/msw-2.12.10.tgz#6d3ca80f6d13715d2b65da03f9f07b46647c3e20" - integrity sha512-G3VUymSE0/iegFnuipujpwyTM2GuZAKXNeerUSrG2+Eg391wW63xFs5ixWsK9MWzr1AGoSkYGmyAzNgbR3+urw== - dependencies: - "@inquirer/confirm" "^5.0.0" - "@mswjs/interceptors" "^0.41.2" - "@open-draft/deferred-promise" "^2.2.0" - "@types/statuses" "^2.0.6" - cookie "^1.0.2" - graphql "^16.12.0" - headers-polyfill "^4.0.2" - is-node-process "^1.2.0" - outvariant "^1.4.3" - path-to-regexp "^6.3.0" - picocolors "^1.1.1" - rettime "^0.10.1" - statuses "^2.0.2" - strict-event-emitter "^0.5.1" - tough-cookie "^6.0.0" - type-fest "^5.2.0" - until-async "^3.0.2" - yargs "^17.7.2" - -mute-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-2.0.0.tgz#a5446fc0c512b71c83c44d908d5c7b7b4c493b2b" - integrity sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA== - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== - -neo-async@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" - integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== - -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== - -node-releases@^2.0.27: - version "2.0.27" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.27.tgz#eedca519205cf20f650f61d56b070db111231e4e" - integrity sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA== - -normalize-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -npm-run-path@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== - dependencies: - path-key "^3.0.0" - -nwsapi@^2.2.2: - version "2.2.23" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.23.tgz#59712c3a88e6de2bb0b6ccc1070397267019cf6c" - integrity sha512-7wfH4sLbt4M0gCDzGE6vzQBo0bfTKjU7Sfpqy/7gs1qBfYz2vEJH6vXcBKpO3+6Yu1telwd0t9HpyOoLEQQbIQ== - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -onetime@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - dependencies: - mimic-fn "^2.1.0" - -outvariant@^1.4.0, outvariant@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.4.3.tgz#221c1bfc093e8fec7075497e7799fdbf43d14873" - integrity sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA== - -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== - dependencies: - p-try "^2.0.0" - -p-limit@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" - integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== - dependencies: - yocto-queue "^0.1.0" - -p-locate@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" - integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== - dependencies: - p-limit "^2.2.0" - -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - -parse-json@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" - integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== - dependencies: - "@babel/code-frame" "^7.0.0" - error-ex "^1.3.1" - json-parse-even-better-errors "^2.3.0" - lines-and-columns "^1.1.6" - -parse5@^7.0.0, parse5@^7.1.1: - version "7.3.0" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.3.0.tgz#d7e224fa72399c7a175099f45fc2ad024b05ec05" - integrity sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw== - dependencies: - entities "^6.0.0" - -path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" - integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - -path-key@^3.0.0, path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-parse@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -path-to-regexp@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.3.0.tgz#2b6a26a337737a8e1416f9272ed0766b1c0389f4" - integrity sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ== - -picocolors@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" - integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== - -picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -pirates@^4.0.4: - version "4.0.7" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" - integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== - -pkg-dir@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" - integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== - dependencies: - find-up "^4.0.0" - -prettier@^3.4.2: - version "3.8.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.8.1.tgz#edf48977cf991558f4fcbd8a3ba6015ba2a3a173" - integrity sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg== - -pretty-format@^29.0.0, pretty-format@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" - integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== - dependencies: - "@jest/schemas" "^29.6.3" - ansi-styles "^5.0.0" - react-is "^18.0.0" - -prompts@^2.0.1: - version "2.4.2" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" - integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== - dependencies: - kleur "^3.0.3" - sisteransi "^1.0.5" - -psl@^1.1.33: - version "1.15.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.15.0.tgz#bdace31896f1d97cec6a79e8224898ce93d974c6" - integrity sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w== - dependencies: - punycode "^2.3.1" - -punycode@^2.1.1, punycode@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" - integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== - -pure-rand@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" - integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== - -querystringify@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" - integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== - -randombytes@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - -react-is@^18.0.0: - version "18.3.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" - integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== - -require-from-string@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== - -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== - -resolve-cwd@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" - integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== - dependencies: - resolve-from "^5.0.0" - -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - -resolve.exports@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.3.tgz#41955e6f1b4013b7586f873749a635dea07ebe3f" - integrity sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A== - -resolve@^1.20.0: - version "1.22.11" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.11.tgz#aad857ce1ffb8bfa9b0b1ac29f1156383f68c262" - integrity sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ== - dependencies: - is-core-module "^2.16.1" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - -rettime@^0.10.1: - version "0.10.1" - resolved "https://registry.yarnpkg.com/rettime/-/rettime-0.10.1.tgz#cc8bb9870343f282b182e5a276899c08b94914be" - integrity sha512-uyDrIlUEH37cinabq0AX4QbgV4HbFZ/gqoiunWQ1UqBtRvTTytwhNYjE++pO/MjPTZL5KQCf2bEoJ/BJNVQ5Kw== - -safe-buffer@^5.1.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -"safer-buffer@>= 2.1.2 < 3.0.0": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -saxes@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" - integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA== - dependencies: - xmlchars "^2.2.0" - -schema-utils@^4.3.0, schema-utils@^4.3.3: - version "4.3.3" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.3.3.tgz#5b1850912fa31df90716963d45d9121fdfc09f46" - integrity sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA== - dependencies: - "@types/json-schema" "^7.0.9" - ajv "^8.9.0" - ajv-formats "^2.1.1" - ajv-keywords "^5.1.0" - -semver@^6.3.0, semver@^6.3.1: - version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== - -semver@^7.3.4, semver@^7.5.3, semver@^7.5.4, semver@^7.7.3: - version "7.7.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.4.tgz#28464e36060e991fa7a11d0279d2d3f3b57a7e8a" - integrity sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA== - -serialize-javascript@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" - integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== - dependencies: - randombytes "^2.1.0" - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -signal-exit@^3.0.3, signal-exit@^3.0.7: - version "3.0.7" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" - integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== - -signal-exit@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" - integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== - -sisteransi@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" - integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -source-map-support@0.5.13: - version "0.5.13" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" - integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map-support@~0.5.20: - version "0.5.21" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -source-map@^0.7.4: - version "0.7.6" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.6.tgz#a3658ab87e5b6429c8a1f3ba0083d4c61ca3ef02" - integrity sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ== - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== - -stack-utils@^2.0.3: - version "2.0.6" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" - integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== - dependencies: - escape-string-regexp "^2.0.0" - -statuses@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.2.tgz#8f75eecef765b5e1cfcdc080da59409ed424e382" - integrity sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw== - -strict-event-emitter@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz#1602ece81c51574ca39c6815e09f1a3e8550bd93" - integrity sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ== - -string-length@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" - integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== - dependencies: - char-regex "^1.0.2" - strip-ansi "^6.0.0" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-bom@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" - integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== - -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== - -strip-json-comments@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -supports-color@^8.0.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - -supports-preserve-symlinks-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" - integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== - -symbol-tree@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - -tagged-tag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/tagged-tag/-/tagged-tag-1.0.0.tgz#a0b5917c2864cba54841495abfa3f6b13edcf4d6" - integrity sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng== - -tapable@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.3.0.tgz#7e3ea6d5ca31ba8e078b560f0d83ce9a14aa8be6" - integrity sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg== - -terser-webpack-plugin@^5.3.16: - version "5.3.16" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.16.tgz#741e448cc3f93d8026ebe4f7ef9e4afacfd56330" - integrity sha512-h9oBFCWrq78NyWWVcSwZarJkZ01c2AyGrzs1crmHZO3QUg9D61Wu4NPjBy69n7JqylFF5y+CsUZYmYEIZ3mR+Q== - dependencies: - "@jridgewell/trace-mapping" "^0.3.25" - jest-worker "^27.4.5" - schema-utils "^4.3.0" - serialize-javascript "^6.0.2" - terser "^5.31.1" - -terser@^5.31.1: - version "5.46.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.46.0.tgz#1b81e560d584bbdd74a8ede87b4d9477b0ff9695" - integrity sha512-jTwoImyr/QbOWFFso3YoU3ik0jBBDJ6JTOQiy/J2YxVJdZCc+5u7skhNwiOR3FQIygFqVUPHl7qbbxtjW2K3Qg== - dependencies: - "@jridgewell/source-map" "^0.3.3" - acorn "^8.15.0" - commander "^2.20.0" - source-map-support "~0.5.20" - -test-exclude@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" - integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== - dependencies: - "@istanbuljs/schema" "^0.1.2" - glob "^7.1.4" - minimatch "^3.0.4" - -tldts-core@^7.0.23: - version "7.0.23" - resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-7.0.23.tgz#47bf18282a44641304a399d247703413b5d3e309" - integrity sha512-0g9vrtDQLrNIiCj22HSe9d4mLVG3g5ph5DZ8zCKBr4OtrspmNB6ss7hVyzArAeE88ceZocIEGkyW1Ime7fxPtQ== - -tldts@^7.0.5: - version "7.0.23" - resolved "https://registry.yarnpkg.com/tldts/-/tldts-7.0.23.tgz#444f0f0720fa777839a23ea665e04f61ee57217a" - integrity sha512-ASdhgQIBSay0R/eXggAkQ53G4nTJqTXqC2kbaBbdDwM7SkjyZyO0OaaN1/FH7U/yCeqOHDwFO5j8+Os/IS1dXw== - dependencies: - tldts-core "^7.0.23" - -tmpl@1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" - integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -tough-cookie@^4.1.2: - version "4.1.4" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" - integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== - dependencies: - psl "^1.1.33" - punycode "^2.1.1" - universalify "^0.2.0" - url-parse "^1.5.3" - -tough-cookie@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-6.0.0.tgz#11e418b7864a2c0d874702bc8ce0f011261940e5" - integrity sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w== - dependencies: - tldts "^7.0.5" - -tr46@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9" - integrity sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA== - dependencies: - punycode "^2.1.1" - -ts-jest@^29.3.4: - version "29.4.6" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.4.6.tgz#51cb7c133f227396818b71297ad7409bb77106e9" - integrity sha512-fSpWtOO/1AjSNQguk43hb/JCo16oJDnMJf3CdEGNkqsEX3t0KX96xvyX1D7PfLCpVoKu4MfVrqUkFyblYoY4lA== - dependencies: - bs-logger "^0.2.6" - fast-json-stable-stringify "^2.1.0" - handlebars "^4.7.8" - json5 "^2.2.3" - lodash.memoize "^4.1.2" - make-error "^1.3.6" - semver "^7.7.3" - type-fest "^4.41.0" - yargs-parser "^21.1.1" - -ts-loader@^9.5.1: - version "9.5.4" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.5.4.tgz#44b571165c10fb5a90744aa5b7e119233c4f4585" - integrity sha512-nCz0rEwunlTZiy6rXFByQU1kVVpCIgUpc/psFiKVrUwrizdnIbRFu8w7bxhUF0X613DYwT4XzrZHpVyMe758hQ== - dependencies: - chalk "^4.1.0" - enhanced-resolve "^5.0.0" - micromatch "^4.0.0" - semver "^7.3.4" - source-map "^0.7.4" - -type-detect@4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== - -type-fest@^0.21.3: - version "0.21.3" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" - integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== - -type-fest@^4.41.0: - version "4.41.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.41.0.tgz#6ae1c8e5731273c2bf1f58ad39cbae2c91a46c58" - integrity sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA== - -type-fest@^5.2.0: - version "5.4.4" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-5.4.4.tgz#577f165b5ecb44cfc686559cc54ca77f62aa374d" - integrity sha512-JnTrzGu+zPV3aXIUhnyWJj4z/wigMsdYajGLIYakqyOW1nPllzXEJee0QQbHj+CTIQtXGlAjuK0UY+2xTyjVAw== - dependencies: - tagged-tag "^1.0.0" - -typescript@~5.7.2: - version "5.7.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" - integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== - -uglify-js@^3.1.4: - version "3.19.3" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" - integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== - -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== - -undici-types@~7.16.0: - version "7.16.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.16.0.tgz#ffccdff36aea4884cbfce9a750a0580224f58a46" - integrity sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw== - -universalify@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" - integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== - -until-async@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/until-async/-/until-async-3.0.2.tgz#447f1531fdd7bb2b4c7a98869bdb1a4c2a23865f" - integrity sha512-IiSk4HlzAMqTUseHHe3VhIGyuFmN90zMTpD3Z3y8jeQbzLIq500MVM7Jq2vUAnTKAFPJrqwkzr6PoTcPhGcOiw== - -update-browserslist-db@^1.2.0: - version "1.2.3" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz#64d76db58713136acbeb4c49114366cc6cc2e80d" - integrity sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w== - dependencies: - escalade "^3.2.0" - picocolors "^1.1.1" - -url-parse@^1.5.3: - version "1.5.10" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" - integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== - dependencies: - querystringify "^2.1.1" - requires-port "^1.0.0" - -v8-to-istanbul@^9.0.1: - version "9.3.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" - integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== - dependencies: - "@jridgewell/trace-mapping" "^0.3.12" - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^2.0.0" - -w3c-xmlserializer@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz#aebdc84920d806222936e3cdce408e32488a3073" - integrity sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw== - dependencies: - xml-name-validator "^4.0.0" - -walker@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" - integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== - dependencies: - makeerror "1.0.12" - -watchpack@^2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.5.1.tgz#dd38b601f669e0cbf567cb802e75cead82cde102" - integrity sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg== - dependencies: - glob-to-regexp "^0.4.1" - graceful-fs "^4.1.2" - -webidl-conversions@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" - integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== - -webpack-sources@^3.3.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.3.3.tgz#d4bf7f9909675d7a070ff14d0ef2a4f3c982c723" - integrity sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg== - -webpack@^5.97.1: - version "5.105.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.105.1.tgz#c05cb3621196c76fa3b3a9bea446d14616b83778" - integrity sha512-Gdj3X74CLJJ8zy4URmK42W7wTZUJrqL+z8nyGEr4dTN0kb3nVs+ZvjbTOqRYPD7qX4tUmwyHL9Q9K6T1seW6Yw== - dependencies: - "@types/eslint-scope" "^3.7.7" - "@types/estree" "^1.0.8" - "@types/json-schema" "^7.0.15" - "@webassemblyjs/ast" "^1.14.1" - "@webassemblyjs/wasm-edit" "^1.14.1" - "@webassemblyjs/wasm-parser" "^1.14.1" - acorn "^8.15.0" - acorn-import-phases "^1.0.3" - browserslist "^4.28.1" - chrome-trace-event "^1.0.2" - enhanced-resolve "^5.19.0" - es-module-lexer "^2.0.0" - eslint-scope "5.1.1" - events "^3.2.0" - glob-to-regexp "^0.4.1" - graceful-fs "^4.2.11" - json-parse-even-better-errors "^2.3.1" - loader-runner "^4.3.1" - mime-types "^2.1.27" - neo-async "^2.6.2" - schema-utils "^4.3.3" - tapable "^2.3.0" - terser-webpack-plugin "^5.3.16" - watchpack "^2.5.1" - webpack-sources "^3.3.3" - -whatwg-encoding@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" - integrity sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg== - dependencies: - iconv-lite "0.6.3" - -whatwg-mimetype@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" - integrity sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q== - -whatwg-url@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018" - integrity sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ== - dependencies: - tr46 "^3.0.0" - webidl-conversions "^7.0.0" - -which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -wordwrap@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== - -wrap-ansi@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -write-file-atomic@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" - integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== - dependencies: - imurmurhash "^0.1.4" - signal-exit "^3.0.7" - -ws@^8.11.0, ws@^8.16.0: - version "8.19.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.19.0.tgz#ddc2bdfa5b9ad860204f5a72a4863a8895fd8c8b" - integrity sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg== - -xml-name-validator@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" - integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== - -xmlchars@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== - -y18n@^5.0.5: - version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" - integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== - -yallist@^3.0.2: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" - integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== - -yargs-parser@^21.1.1: - version "21.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" - integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== - -yargs@^17.3.1, yargs@^17.7.2: - version "17.7.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" - integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== - dependencies: - cliui "^8.0.1" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.1.1" - -yocto-queue@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" - integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== - -yoctocolors-cjs@^2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz#7e4964ea8ec422b7a40ac917d3a344cfd2304baa" - integrity sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==