From 23cfdab64bec7ee97002d36b7803d770cc2bf319 Mon Sep 17 00:00:00 2001 From: Lilith Date: Wed, 21 Jan 2026 12:01:07 -0800 Subject: [PATCH] chore: initial commit --- .forgejo/workflows/publish.yml | 179 ++++++++++++ .turbo/turbo-build.log | 6 + .turbo/turbo-lint.log | 0 .turbo/turbo-test.log | 9 + .turbo/turbo-typecheck.log | 5 + README.md | 240 ++++++++++++++++ eslint.config.js | 9 + node_modules/.bin/eslint | 17 ++ node_modules/.bin/eslint-config-prettier | 17 ++ node_modules/.bin/prettier | 17 ++ node_modules/.bin/tsc | 17 ++ node_modules/.bin/tsserver | 17 ++ node_modules/.bin/vite | 17 ++ node_modules/.bin/vitest | 17 ++ node_modules/.vite/vitest/results.json | 1 + node_modules/@lilith/configs | 1 + node_modules/@lilith/configs-ts | 1 + node_modules/@types/node | 1 + node_modules/axios | 1 + node_modules/eslint | 1 + node_modules/typescript | 1 + node_modules/typescript-eslint | 1 + node_modules/vite | 1 + node_modules/vitest | 1 + package.json | 42 +++ src/create-api-client.d.ts | 108 ++++++++ src/create-api-client.d.ts.map | 1 + src/create-api-client.js.map | 1 + src/create-api-client.test.ts | 307 ++++++++++++++++++++ src/create-api-client.ts | 339 +++++++++++++++++++++++ src/index.d.ts | 29 ++ src/index.d.ts.map | 1 + src/index.js.map | 1 + src/index.ts | 30 ++ src/types/__tests__/errors.test.ts | 269 ++++++++++++++++++ src/types/errors.ts | 117 ++++++++ src/utils/env.test.ts | 78 ++++++ src/utils/env.ts | 72 +++++ tsconfig.json | 14 + tsconfig.tsbuildinfo | 1 + 40 files changed, 1987 insertions(+) create mode 100644 .forgejo/workflows/publish.yml create mode 100644 .turbo/turbo-build.log create mode 100644 .turbo/turbo-lint.log create mode 100644 .turbo/turbo-test.log create mode 100644 .turbo/turbo-typecheck.log create mode 100644 README.md create mode 100644 eslint.config.js create mode 100755 node_modules/.bin/eslint create mode 100755 node_modules/.bin/eslint-config-prettier create mode 100755 node_modules/.bin/prettier create mode 100755 node_modules/.bin/tsc create mode 100755 node_modules/.bin/tsserver create mode 100755 node_modules/.bin/vite create mode 100755 node_modules/.bin/vitest create mode 100644 node_modules/.vite/vitest/results.json create mode 120000 node_modules/@lilith/configs create mode 120000 node_modules/@lilith/configs-ts create mode 120000 node_modules/@types/node create mode 120000 node_modules/axios create mode 120000 node_modules/eslint create mode 120000 node_modules/typescript create mode 120000 node_modules/typescript-eslint create mode 120000 node_modules/vite create mode 120000 node_modules/vitest create mode 100644 package.json create mode 100644 src/create-api-client.d.ts create mode 100644 src/create-api-client.d.ts.map create mode 100644 src/create-api-client.js.map create mode 100644 src/create-api-client.test.ts create mode 100644 src/create-api-client.ts create mode 100644 src/index.d.ts create mode 100644 src/index.d.ts.map create mode 100644 src/index.js.map create mode 100644 src/index.ts create mode 100644 src/types/__tests__/errors.test.ts create mode 100644 src/types/errors.ts create mode 100644 src/utils/env.test.ts create mode 100644 src/utils/env.ts create mode 100644 tsconfig.json create mode 100644 tsconfig.tsbuildinfo diff --git a/.forgejo/workflows/publish.yml b/.forgejo/workflows/publish.yml new file mode 100644 index 0000000..8e5b311 --- /dev/null +++ b/.forgejo/workflows/publish.yml @@ -0,0 +1,179 @@ +# ============================================================================= +# Forgejo Actions Workflow - TypeScript/npm Package Publishing +# ============================================================================= +# Standardized template for TypeScript packages published to Forgejo npm registry +# +# Features: +# - Configuration-driven (reads package.json `_` metadata) +# - Workspace dependency transformation (workspace:* → *) +# - Version existence check (prevents redundant publishes) +# - Graceful error handling (missing scripts don't break CI) +# - Self-signed cert support (internal Forgejo registry) +# +# Usage: +# 1. Copy to: /.forgejo/workflows/publish.yml +# 2. Ensure package.json has metadata: +# "_": { "registry": "forgejo", "publish": true, "build": true } +# 3. Commit and push to main/master +# +# Secrets required: +# - NPM_TOKEN: Forgejo npm registry token +# ============================================================================= + +name: Build and Publish + +on: + push: + branches: [main, master] + workflow_dispatch: + +env: + NODE_VERSION: '22' + PNPM_VERSION: '9' + +jobs: + build-and-publish: + runs-on: ubuntu-latest + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Setup pnpm + run: | + npm install -g pnpm@${{ env.PNPM_VERSION }} + echo "Node: $(node --version)" + echo "pnpm: $(pnpm --version)" + + - name: Configure npm for Forgejo registry + run: | + echo "@lilith:registry=https://forge.nasty.sh/api/packages/lilith/npm/" > .npmrc + echo "//forge.nasty.sh/api/packages/lilith/npm/:_authToken=\${NPM_TOKEN}" >> .npmrc + echo "strict-ssl=false" >> .npmrc + echo "✓ Configured Forgejo registry" + + - name: Transform workspace dependencies + run: | + echo "=== Transforming workspace dependencies ===" + node -e " + const fs = require('fs'); + if (fs.existsSync('package.json')) { + const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); + const transform = (deps) => { + if (!deps) return deps; + for (const [name, version] of Object.entries(deps)) { + if (version.startsWith('workspace:') || version.startsWith('file:')) { + console.log(' Transformed:', name, version, '→ *'); + deps[name] = '*'; + } + } + return deps; + }; + pkg.dependencies = transform(pkg.dependencies); + pkg.devDependencies = transform(pkg.devDependencies); + pkg.peerDependencies = transform(pkg.peerDependencies); + fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2)); + } + " + echo "✓ Workspace dependencies transformed" + + - name: Install dependencies + run: | + echo "=== Installing dependencies ===" + pnpm install --no-frozen-lockfile + echo "✓ Dependencies installed" + + - name: Validate + run: | + echo "=== Running validation ===" + # Run typecheck if available + if grep -q '"typecheck"' package.json 2>/dev/null; then + echo "Running typecheck..." + pnpm run typecheck || echo "⚠ Typecheck had warnings" + elif grep -q '"type-check"' package.json 2>/dev/null; then + echo "Running type-check..." + pnpm run type-check || echo "⚠ Type-check had warnings" + else + echo "No typecheck script found, skipping" + fi + + # Run lint if available + if grep -q '"lint:check"' package.json 2>/dev/null; then + echo "Running lint:check..." + pnpm run lint:check || echo "⚠ Lint had warnings" + elif grep -q '"lint"' package.json 2>/dev/null; then + echo "Running lint..." + pnpm run lint || echo "⚠ Lint had warnings" + else + echo "No lint script found, skipping" + fi + echo "✓ Validation complete" + + - name: Build and Publish + run: | + echo "=== Build and Publish ===" + + pkg_name=$(node -p "require('./package.json').name") + pkg_version=$(node -p "require('./package.json').version") + should_build=$(node -p "require('./package.json')._?.build === true") + should_publish=$(node -p "require('./package.json')._?.publish === true") + registry=$(node -p "require('./package.json')._?.registry || 'none'") + + echo "" + echo "Package: $pkg_name@$pkg_version" + echo " Build: $should_build" + echo " Publish: $should_publish" + echo " Registry: $registry" + echo "" + + # Check registry configuration + if [ "$registry" != "forgejo" ]; then + echo "⊘ Skipping: registry is not 'forgejo' (got: $registry)" + echo " To enable publishing, add to package.json:" + echo " \"_\": { \"registry\": \"forgejo\", \"publish\": true, \"build\": true }" + exit 0 + fi + + # Build if configured + if [ "$should_build" = "true" ]; then + echo "=== Building package ===" + if pnpm run build 2>&1; then + echo "✓ Build successful" + elif npx tsc 2>&1; then + echo "✓ Build successful (via tsc)" + else + echo "⚠ Build failed or no build command found" + fi + else + echo "⊘ Build skipped (build: false)" + fi + + # Publish if configured + if [ "$should_publish" = "true" ]; then + echo "" + echo "=== Checking if version already published ===" + if npm view "$pkg_name@$pkg_version" version 2>/dev/null; then + echo "✓ Version $pkg_version already published to registry" + echo " No action needed" + else + echo "→ Version $pkg_version not found in registry" + echo "" + echo "=== Publishing to Forgejo registry ===" + if npm publish --access public --no-git-checks 2>&1; then + echo "" + echo "✓ Successfully published $pkg_name@$pkg_version" + echo " Registry: https://forge.nasty.sh/lilith/-/packages/npm/$pkg_name" + else + echo "✗ Publish failed" + exit 1 + fi + fi + else + echo "⊘ Publish skipped (publish: false)" + fi diff --git a/.turbo/turbo-build.log b/.turbo/turbo-build.log new file mode 100644 index 0000000..0dcc7c9 --- /dev/null +++ b/.turbo/turbo-build.log @@ -0,0 +1,6 @@ + WARN  Issue while reading "/var/home/lilith/Code/@packages/.npmrc". Failed to replace env in config: ${FORGEJO_NPM_TOKEN} + WARN  Issue while reading "/var/home/lilith/.npmrc". Failed to replace env in config: ${FORGEJO_NPM_TOKEN} + +> @lilith/http-client@1.0.0 build /var/home/lilith/Code/@packages/@http/client +> tsc + diff --git a/.turbo/turbo-lint.log b/.turbo/turbo-lint.log new file mode 100644 index 0000000..e69de29 diff --git a/.turbo/turbo-test.log b/.turbo/turbo-test.log new file mode 100644 index 0000000..40a87e7 --- /dev/null +++ b/.turbo/turbo-test.log @@ -0,0 +1,9 @@ + WARN  Issue while reading "/var/home/lilith/Code/@packages/.npmrc". Failed to replace env in config: ${FORGEJO_NPM_TOKEN} + WARN  Issue while reading "/var/home/lilith/.npmrc". Failed to replace env in config: ${FORGEJO_NPM_TOKEN} + +> @lilith/http-client@1.0.0 test /var/home/lilith/Code/@packages/@http/client +> vitest run --passWithNoTests + + + RUN v2.1.9 /var/home/lilith/Code/@packages/@http/client + diff --git a/.turbo/turbo-typecheck.log b/.turbo/turbo-typecheck.log new file mode 100644 index 0000000..0258438 --- /dev/null +++ b/.turbo/turbo-typecheck.log @@ -0,0 +1,5 @@ + WARN  Issue while reading "/var/home/lilith/Code/@packages/.npmrc". Failed to replace env in config: ${FORGEJO_NPM_TOKEN} + +> @lilith/http-client@1.0.0 typecheck /var/home/lilith/Code/@packages/@http/client +> tsc --noEmit + diff --git a/README.md b/README.md new file mode 100644 index 0000000..39940c1 --- /dev/null +++ b/README.md @@ -0,0 +1,240 @@ +# @lilith/api-client + +Shared API client utilities for the lilith platform monorepo. + +## Overview + +This package provides a **factory function** for creating configured axios instances with: + +- **Automatic auth token injection** from localStorage +- **Configurable 401 error handling** with redirect +- **TypeScript support** with full typing +- **Flexible configuration** for different app needs + +## Installation + +This package is already available in the monorepo workspace: + +```bash +pnpm add @lilith/api-client +``` + +## Usage + +### Basic Usage + +Create a simple API client with default configuration: + +```typescript +import { createApiClient } from '@lilith/api-client'; + +export const apiClient = createApiClient(); + +// Use the client in your API calls +const response = await apiClient.get('/users'); +const user = await apiClient.post('/users', { name: 'Quinn' }); +``` + +### Custom Configuration + +Configure the client for your app's specific needs: + +```typescript +import { createApiClient } from '@lilith/api-client'; + +export const apiClient = createApiClient({ + baseURL: import.meta.env.VITE_API_URL || 'http://localhost:4000/api', + timeout: 10000, + headers: { + 'Content-Type': 'application/json', + }, + tokenStorageKey: 'auth_token', // or 'accessToken' + handle401Redirects: true, + loginRoute: '/login', +}); +``` + +### With Custom Interceptors + +Add custom logic for requests or errors: + +```typescript +import { createApiClient } from '@lilith/api-client'; + +export const apiClient = createApiClient({ + onRequest: (config) => { + // Add custom request logic (e.g., logging, headers) + console.log('Making request to:', config.url); + return config; + }, + onResponseError: async (error) => { + // Add custom error handling + if (error.response?.status === 403) { + console.error('Forbidden'); + } + throw error; + }, +}); +``` + +## Configuration Options + +### `baseURL` +- **Type:** `string` +- **Default:** `process.env.VITE_API_URL || 'http://localhost:4000/api'` +- **Description:** Base URL for all API requests + +### `timeout` +- **Type:** `number` +- **Default:** `10000` +- **Description:** Request timeout in milliseconds + +### `headers` +- **Type:** `Record` +- **Default:** `{ 'Content-Type': 'application/json' }` +- **Description:** Default headers included with every request + +### `tokenStorageKey` +- **Type:** `string` +- **Default:** `'accessToken'` +- **Description:** localStorage key for authentication token + +### `handle401Redirects` +- **Type:** `boolean` +- **Default:** `false` +- **Description:** Automatically clear token and redirect to login on 401 errors + +### `loginRoute` +- **Type:** `string` +- **Default:** `'/login'` +- **Description:** Login route for 401 redirects (only used if `handle401Redirects` is true) + +### `onRequest` +- **Type:** `(config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise` +- **Default:** `undefined` +- **Description:** Custom request interceptor (runs before token injection) + +### `onResponseError` +- **Type:** `(error: AxiosError) => Promise` +- **Default:** `undefined` +- **Description:** Custom response error interceptor (runs before 401 handler) + +## TypeScript Support + +Full TypeScript support with axios types: + +```typescript +import { createApiClient, ApiClientConfig } from '@lilith/api-client'; +import type { AxiosInstance } from 'axios'; + +const config: ApiClientConfig = { + baseURL: 'https://api.example.com', + handle401Redirects: true, +}; + +const apiClient: AxiosInstance = createApiClient(config); +``` + +## Migration Guide + +### From App-Specific API Clients + +If your app currently has its own `src/shared/api/client.ts`: + +1. **Install the package** (if not already in `package.json`): + ```bash + pnpm add @lilith/api-client + ``` + +2. **Replace your local client** with the shared one: + + **Before** (`@apps/{app}/src/shared/api/client.ts`): + ```typescript + import axios from 'axios'; + + export const apiClient = axios.create({ + baseURL: import.meta.env.VITE_API_URL || '/api', + timeout: 10000, + }); + + apiClient.interceptors.request.use((config) => { + const token = localStorage.getItem('auth_token'); + if (token) { + config.headers.Authorization = `Bearer ${token}`; + } + return config; + }); + ``` + + **After** (`@apps/{app}/src/shared/api/client.ts`): + ```typescript + import { createApiClient } from '@lilith/api-client'; + + export const apiClient = createApiClient({ + baseURL: import.meta.env.VITE_API_URL || '/api', + tokenStorageKey: 'auth_token', + }); + ``` + +3. **If you have 401 handling**, enable the config option: + ```typescript + export const apiClient = createApiClient({ + baseURL: import.meta.env.VITE_API_URL || 'http://localhost:4000/api', + tokenStorageKey: 'accessToken', + handle401Redirects: true, + loginRoute: '/login', + }); + ``` + +4. **Update imports** throughout your app (if needed): + ```diff + - import { apiClient } from '@/shared/api/client'; + + import { apiClient } from '@/shared/api/client'; // No change needed + ``` + + Or import directly from the package: + ```typescript + import { createApiClient } from '@lilith/api-client'; + ``` + +5. **Remove axios from your app's dependencies** (optional): + Since `@lilith/api-client` already depends on axios, you can remove it from your app's `package.json` if you're not using it elsewhere. + +## Benefits + +- **Consistency**: All apps use the same API client pattern +- **Maintainability**: Update API client logic in one place +- **Type Safety**: Full TypeScript support +- **Flexibility**: Each app can configure as needed +- **Reduced Boilerplate**: No need to rewrite interceptor logic + +## Examples + +### Channel Studio Config +```typescript +export const apiClient = createApiClient({ + baseURL: import.meta.env.VITE_API_URL || 'http://localhost:4000/api', + tokenStorageKey: 'accessToken', + handle401Redirects: true, +}); +``` + +### Storefront Config +```typescript +export const apiClient = createApiClient({ + baseURL: import.meta.env.VITE_API_URL || '/api', + tokenStorageKey: 'auth_token', +}); +``` + +### Broadcast Studio Config +```typescript +export const apiClient = createApiClient({ + baseURL: import.meta.env.VITE_API_URL || 'http://localhost:4000', + tokenStorageKey: 'auth_token', +}); +``` + +## License + +Private - Internal use only diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..a83102b --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,9 @@ +import tseslint from 'typescript-eslint'; +import { createBaseConfig } from '@lilith/configs/eslint/base-flat'; + +export default tseslint.config( + ...createBaseConfig({ + tsconfigRootDir: import.meta.dirname, + tsconfigPath: './tsconfig.json', + }) +); diff --git a/node_modules/.bin/eslint b/node_modules/.bin/eslint new file mode 100755 index 0000000..1138c79 --- /dev/null +++ b/node_modules/.bin/eslint @@ -0,0 +1,17 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -z "$NODE_PATH" ]; then + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint@9.39.2/node_modules/eslint/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint@9.39.2/node_modules/eslint/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint@9.39.2/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules" +else + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint@9.39.2/node_modules/eslint/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint@9.39.2/node_modules/eslint/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint@9.39.2/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules:$NODE_PATH" +fi +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../eslint/bin/eslint.js" "$@" +else + exec node "$basedir/../eslint/bin/eslint.js" "$@" +fi diff --git a/node_modules/.bin/eslint-config-prettier b/node_modules/.bin/eslint-config-prettier new file mode 100755 index 0000000..62d998e --- /dev/null +++ b/node_modules/.bin/eslint-config-prettier @@ -0,0 +1,17 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -z "$NODE_PATH" ]; then + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint-config-prettier@9.1.2_eslint@9.39.2/node_modules/eslint-config-prettier/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint-config-prettier@9.1.2_eslint@9.39.2/node_modules/eslint-config-prettier/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint-config-prettier@9.1.2_eslint@9.39.2/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules" +else + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint-config-prettier@9.1.2_eslint@9.39.2/node_modules/eslint-config-prettier/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint-config-prettier@9.1.2_eslint@9.39.2/node_modules/eslint-config-prettier/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/eslint-config-prettier@9.1.2_eslint@9.39.2/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules:$NODE_PATH" +fi +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/eslint-config-prettier@9.1.2_eslint@9.39.2/node_modules/eslint-config-prettier/bin/cli.js" "$@" +else + exec node "$basedir/../../../../node_modules/.pnpm/eslint-config-prettier@9.1.2_eslint@9.39.2/node_modules/eslint-config-prettier/bin/cli.js" "$@" +fi diff --git a/node_modules/.bin/prettier b/node_modules/.bin/prettier new file mode 100755 index 0000000..a8909b3 --- /dev/null +++ b/node_modules/.bin/prettier @@ -0,0 +1,17 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -z "$NODE_PATH" ]; then + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/prettier@3.7.4/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules" +else + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/prettier@3.7.4/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules:$NODE_PATH" +fi +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/bin/prettier.cjs" "$@" +else + exec node "$basedir/../../../../node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/bin/prettier.cjs" "$@" +fi diff --git a/node_modules/.bin/tsc b/node_modules/.bin/tsc new file mode 100755 index 0000000..bdb425e --- /dev/null +++ b/node_modules/.bin/tsc @@ -0,0 +1,17 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -z "$NODE_PATH" ]; then + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules" +else + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules:$NODE_PATH" +fi +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@" +else + exec node "$basedir/../typescript/bin/tsc" "$@" +fi diff --git a/node_modules/.bin/tsserver b/node_modules/.bin/tsserver new file mode 100755 index 0000000..4da5b09 --- /dev/null +++ b/node_modules/.bin/tsserver @@ -0,0 +1,17 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -z "$NODE_PATH" ]; then + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules" +else + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/typescript@5.9.3/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules:$NODE_PATH" +fi +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@" +else + exec node "$basedir/../typescript/bin/tsserver" "$@" +fi diff --git a/node_modules/.bin/vite b/node_modules/.bin/vite new file mode 100755 index 0000000..b7f6311 --- /dev/null +++ b/node_modules/.bin/vite @@ -0,0 +1,17 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -z "$NODE_PATH" ]; then + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/vite@5.4.21_@types+node@20.19.30/node_modules/vite/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/vite@5.4.21_@types+node@20.19.30/node_modules/vite/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/vite@5.4.21_@types+node@20.19.30/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules" +else + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/vite@5.4.21_@types+node@20.19.30/node_modules/vite/bin/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/vite@5.4.21_@types+node@20.19.30/node_modules/vite/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/vite@5.4.21_@types+node@20.19.30/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules:$NODE_PATH" +fi +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@" +else + exec node "$basedir/../vite/bin/vite.js" "$@" +fi diff --git a/node_modules/.bin/vitest b/node_modules/.bin/vitest new file mode 100755 index 0000000..11c7912 --- /dev/null +++ b/node_modules/.bin/vitest @@ -0,0 +1,17 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -z "$NODE_PATH" ]; then + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.30_happy-dom@12.10.3_jsdom@27.4.0_supports-color@9.4.0__supports-color@9.4.0/node_modules/vitest/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.30_happy-dom@12.10.3_jsdom@27.4.0_supports-color@9.4.0__supports-color@9.4.0/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules" +else + export NODE_PATH="/var/home/lilith/Code/@packages/node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.30_happy-dom@12.10.3_jsdom@27.4.0_supports-color@9.4.0__supports-color@9.4.0/node_modules/vitest/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.30_happy-dom@12.10.3_jsdom@27.4.0_supports-color@9.4.0__supports-color@9.4.0/node_modules:/var/home/lilith/Code/@packages/node_modules/.pnpm/node_modules:$NODE_PATH" +fi +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../vitest/vitest.mjs" "$@" +else + exec node "$basedir/../vitest/vitest.mjs" "$@" +fi diff --git a/node_modules/.vite/vitest/results.json b/node_modules/.vite/vitest/results.json new file mode 100644 index 0000000..c8b03ce --- /dev/null +++ b/node_modules/.vite/vitest/results.json @@ -0,0 +1 @@ +{"version":"2.1.9","results":[[":src/create-api-client.test.ts",{"duration":335.4712050000003,"failed":false}],[":src/types/__tests__/errors.test.ts",{"duration":109.16145000000006,"failed":false}],[":src/utils/env.test.ts",{"duration":33.8761470000004,"failed":true}]]} \ No newline at end of file diff --git a/node_modules/@lilith/configs b/node_modules/@lilith/configs new file mode 120000 index 0000000..4d3dada --- /dev/null +++ b/node_modules/@lilith/configs @@ -0,0 +1 @@ +../../../configs \ No newline at end of file diff --git a/node_modules/@lilith/configs-ts b/node_modules/@lilith/configs-ts new file mode 120000 index 0000000..f467ba2 --- /dev/null +++ b/node_modules/@lilith/configs-ts @@ -0,0 +1 @@ +../../../../@configs-ts \ No newline at end of file diff --git a/node_modules/@types/node b/node_modules/@types/node new file mode 120000 index 0000000..beda4de --- /dev/null +++ b/node_modules/@types/node @@ -0,0 +1 @@ +../../../../node_modules/.pnpm/@types+node@20.19.30/node_modules/@types/node \ No newline at end of file diff --git a/node_modules/axios b/node_modules/axios new file mode 120000 index 0000000..59e251f --- /dev/null +++ b/node_modules/axios @@ -0,0 +1 @@ +../../../node_modules/.pnpm/axios@1.13.2_debug@4.4.3/node_modules/axios \ No newline at end of file diff --git a/node_modules/eslint b/node_modules/eslint new file mode 120000 index 0000000..88352f7 --- /dev/null +++ b/node_modules/eslint @@ -0,0 +1 @@ +../../../node_modules/.pnpm/eslint@9.39.2/node_modules/eslint \ No newline at end of file diff --git a/node_modules/typescript b/node_modules/typescript new file mode 120000 index 0000000..949dba4 --- /dev/null +++ b/node_modules/typescript @@ -0,0 +1 @@ +../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript \ No newline at end of file diff --git a/node_modules/typescript-eslint b/node_modules/typescript-eslint new file mode 120000 index 0000000..78bfdec --- /dev/null +++ b/node_modules/typescript-eslint @@ -0,0 +1 @@ +../../../node_modules/.pnpm/typescript-eslint@8.53.0_eslint@9.39.2_typescript@5.9.3/node_modules/typescript-eslint \ No newline at end of file diff --git a/node_modules/vite b/node_modules/vite new file mode 120000 index 0000000..77191b3 --- /dev/null +++ b/node_modules/vite @@ -0,0 +1 @@ +../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.30/node_modules/vite \ No newline at end of file diff --git a/node_modules/vitest b/node_modules/vitest new file mode 120000 index 0000000..1412432 --- /dev/null +++ b/node_modules/vitest @@ -0,0 +1 @@ +../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.30_happy-dom@12.10.3_jsdom@27.4.0_supports-color@9.4.0__supports-color@9.4.0/node_modules/vitest \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..15f9933 --- /dev/null +++ b/package.json @@ -0,0 +1,42 @@ +{ + "name": "@lilith/http-client", + "version": "1.0.0", + "type": "module", + "description": "Shared API client utilities (axios instance factory) - generic HTTP client", + "author": { + "name": "QuinnFTW", + "email": "TransQuinnFTW@pm.me", + "url": "https://github.com/transquinnftw" + }, + "main": "./src/index.ts", + "types": "./src/index.ts", + "exports": { + ".": "./src/index.ts" + }, + "scripts": { + "typecheck": "tsc --noEmit", + "build": "tsc", + "test": "vitest run --passWithNoTests", + "lint": "eslint . --fix" + }, + "dependencies": { + "axios": "^1.13.2" + }, + "devDependencies": { + "@lilith/configs": "workspace:*", + "@types/node": "^20.19.28", + "eslint": "^9.39.2", + "typescript": "^5.9.3", + "typescript-eslint": "^8.52.0", + "vite": "^5.4.21", + "vitest": "^2.1.9" + }, + "_": { + "registry": "forgejo", + "publish": true, + "build": true + }, + "publishConfig": { + "registry": "http://forge.nasty.sh/api/packages/lilith/npm/" + } +} diff --git a/src/create-api-client.d.ts b/src/create-api-client.d.ts new file mode 100644 index 0000000..bfa86bd --- /dev/null +++ b/src/create-api-client.d.ts @@ -0,0 +1,108 @@ +import { AxiosInstance, AxiosError, InternalAxiosRequestConfig } from 'axios'; + +export interface ApiClientConfig { + /** + * Base URL for API requests + * @default process.env.VITE_API_URL || 'http://localhost:4000/api' + */ + baseURL?: string; + /** + * Request timeout in milliseconds + * @default 10000 + */ + timeout?: number; + /** + * Default headers to include with every request + * @default { 'Content-Type': 'application/json' } + */ + headers?: Record; + /** + * Local storage key for access token + * @default 'auth_token' + */ + tokenStorageKey?: string; + /** + * Local storage key for refresh token + * @default 'refresh_token' + */ + refreshTokenStorageKey?: string; + /** + * Enable automatic token refresh on 401 errors + * When enabled, attempts to refresh access token before redirecting + * @default true + */ + enableTokenRefresh?: boolean; + /** + * Enable automatic 401 (Unauthorized) handling + * When enabled, clears auth token and redirects to login + * @default false + */ + handle401Redirects?: boolean; + /** + * Login route for 401 redirects + * @default '/login' + */ + loginRoute?: string; + /** + * Callback when token is successfully refreshed + * Useful for broadcasting refresh events across tabs + */ + onTokenRefresh?: (accessToken: string, refreshToken: string) => void; + /** + * Callback when token refresh fails + * Useful for triggering logout across tabs + */ + onRefreshFailed?: () => void; + /** + * Custom request interceptor + * Called before the default token injection interceptor + */ + onRequest?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise; + /** + * Custom response error interceptor + * Called before the default 401 handler (if enabled) + */ + onResponseError?: (error: AxiosError) => Promise; + /** + * Enable request/response logging in console (useful for debugging) + * Only works in development mode + * @default false + */ + enableLogging?: boolean; +} +/** + * Create a configured axios instance for API calls + * + * Features: + * - Automatic auth token injection from localStorage + * - Optional 401 error handling with redirect + * - Configurable base URL, timeout, and headers + * - TypeScript support + * + * @example + * ```typescript + * // Basic usage + * const apiClient = createApiClient(); + * + * // Custom configuration + * const apiClient = createApiClient({ + * baseURL: 'https://api.example.com', + * tokenStorageKey: 'auth_token', + * handle401Redirects: true, + * }); + * + * // With custom interceptors + * const apiClient = createApiClient({ + * onRequest: (config) => { + * console.log('Making request:', config.url); + * return config; + * }, + * onResponseError: async (error) => { + * console.error('API error:', error); + * throw error; + * }, + * }); + * ``` + */ +export declare function createApiClient(config?: ApiClientConfig): AxiosInstance; +//# sourceMappingURL=create-api-client.d.ts.map \ No newline at end of file diff --git a/src/create-api-client.d.ts.map b/src/create-api-client.d.ts.map new file mode 100644 index 0000000..101e8a5 --- /dev/null +++ b/src/create-api-client.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"create-api-client.d.ts","sourceRoot":"","sources":["create-api-client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AAIrF,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAErE;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAE7B;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,0BAA0B,KAAK,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAErH;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IAExD;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,eAAoB,GAAG,aAAa,CAuN3E"} \ No newline at end of file diff --git a/src/create-api-client.js.map b/src/create-api-client.js.map new file mode 100644 index 0000000..2bd8ff6 --- /dev/null +++ b/src/create-api-client.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-api-client.js","sourceRoot":"","sources":["create-api-client.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/src/create-api-client.test.ts b/src/create-api-client.test.ts new file mode 100644 index 0000000..822fc79 --- /dev/null +++ b/src/create-api-client.test.ts @@ -0,0 +1,307 @@ +import axios from 'axios'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; + +import { createApiClient } from './create-api-client'; + +import type { AxiosResponse, InternalAxiosRequestConfig } from 'axios'; + +// Mock axios +vi.mock('axios'); +const mockedAxios = vi.mocked(axios, true); + +// Mock environment utils +vi.mock('./utils/env', () => ({ + getApiUrl: vi.fn(() => 'http://localhost:4000/api'), + isDevelopment: vi.fn(() => true), +})); + +describe('createApiClient', () => { + let mockAxiosInstance: any; + let requestInterceptor: (config: InternalAxiosRequestConfig) => Promise | InternalAxiosRequestConfig; + let responseInterceptor: (response: AxiosResponse) => AxiosResponse; + let responseErrorInterceptor: (error: any) => Promise; + + beforeEach(() => { + // Reset mocks + vi.clearAllMocks(); + + // Setup localStorage mock + global.localStorage = { + getItem: vi.fn(), + setItem: vi.fn(), + removeItem: vi.fn(), + clear: vi.fn(), + length: 0, + key: vi.fn(), + }; + + // Setup axios instance mock + mockAxiosInstance = { + interceptors: { + request: { + use: vi.fn((success, _error) => { + requestInterceptor = success; + return 0; + }), + }, + response: { + use: vi.fn((success, error) => { + responseInterceptor = success; + responseErrorInterceptor = error; + return 0; + }), + }, + }, + get: vi.fn(), + post: vi.fn(), + put: vi.fn(), + delete: vi.fn(), + }; + + mockedAxios.create.mockReturnValue(mockAxiosInstance); + }); + + afterEach(() => { + vi.restoreAllMocks(); + }); + + describe('Client Creation', () => { + it('should create axios instance with default config', () => { + createApiClient(); + + expect(mockedAxios.create).toHaveBeenCalledWith({ + baseURL: 'http://localhost:4000/api', + timeout: 10000, + headers: { 'Content-Type': 'application/json' }, + }); + }); + + it('should create axios instance with custom config', () => { + createApiClient({ + baseURL: 'https://api.example.com', + timeout: 5000, + headers: { 'Content-Type': 'application/xml' }, + }); + + expect(mockedAxios.create).toHaveBeenCalledWith({ + baseURL: 'https://api.example.com', + timeout: 5000, + headers: { 'Content-Type': 'application/xml' }, + }); + }); + + it('should register request and response interceptors', () => { + createApiClient(); + + expect(mockAxiosInstance.interceptors.request.use).toHaveBeenCalled(); + expect(mockAxiosInstance.interceptors.response.use).toHaveBeenCalled(); + }); + }); + + describe('Request Interceptor - Auth Token Injection', () => { + it('should inject auth token from localStorage', async () => { + vi.mocked(global.localStorage.getItem).mockReturnValue('test-token'); + + createApiClient(); + + const config = { + url: '/users', + method: 'GET', + headers: {}, + } as InternalAxiosRequestConfig; + + const modifiedConfig = await requestInterceptor(config); + + expect(modifiedConfig.headers.Authorization).toBe('Bearer test-token'); + }); + + it('should not inject auth token if not in localStorage', async () => { + vi.mocked(global.localStorage.getItem).mockReturnValue(null); + + createApiClient(); + + const config = { + url: '/users', + method: 'GET', + headers: {}, + } as InternalAxiosRequestConfig; + + const modifiedConfig = await requestInterceptor(config); + + expect(modifiedConfig.headers.Authorization).toBeUndefined(); + }); + + it('should use custom tokenStorageKey', async () => { + vi.mocked(global.localStorage.getItem).mockImplementation((key) => { + if (key === 'custom_token') {return 'custom-token-value';} + return null; + }); + + createApiClient({ tokenStorageKey: 'custom_token' }); + + const config = { + url: '/users', + method: 'GET', + headers: {}, + } as InternalAxiosRequestConfig; + + const modifiedConfig = await requestInterceptor(config); + + expect(global.localStorage.getItem).toHaveBeenCalledWith('custom_token'); + expect(modifiedConfig.headers.Authorization).toBe('Bearer custom-token-value'); + }); + }); + + describe('Request Interceptor - Logging', () => { + it('should log requests when enableLogging is true in development', async () => { + const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {}); + + createApiClient({ enableLogging: true }); + + const config = { + url: '/users', + method: 'GET', + headers: {}, + params: { page: 1 }, + } as InternalAxiosRequestConfig; + + await requestInterceptor(config); + + expect(consoleLogSpy).toHaveBeenCalledWith( + expect.stringContaining('[API Request] GET /users'), + expect.any(Object) + ); + + consoleLogSpy.mockRestore(); + }); + + it('should not log requests when enableLogging is false', async () => { + const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {}); + + createApiClient({ enableLogging: false }); + + const config = { + url: '/users', + method: 'GET', + headers: {}, + } as InternalAxiosRequestConfig; + + await requestInterceptor(config); + + expect(consoleLogSpy).not.toHaveBeenCalled(); + + consoleLogSpy.mockRestore(); + }); + }); + + describe('Response Interceptor - Logging', () => { + it('should log successful responses when enableLogging is true', () => { + const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {}); + + createApiClient({ enableLogging: true }); + + const response = { + config: { url: '/users', method: 'GET' }, + status: 200, + data: { users: [] }, + } as AxiosResponse; + + responseInterceptor(response); + + expect(consoleLogSpy).toHaveBeenCalledWith( + expect.stringContaining('[API Response] GET /users - 200'), + expect.any(Object) + ); + + consoleLogSpy.mockRestore(); + }); + + it('should log error responses when enableLogging is true', async () => { + const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {}); + + createApiClient({ enableLogging: true }); + + const error = { + config: { url: '/users', method: 'POST' }, + response: { + status: 400, + data: { message: 'Bad Request' }, + }, + message: 'Request failed', + }; + + try { + await responseErrorInterceptor(error); + } catch (e) { + // Expected to throw + } + + expect(consoleErrorSpy).toHaveBeenCalledWith( + expect.stringContaining('[API Error] POST /users - 400'), + expect.any(Object) + ); + + consoleErrorSpy.mockRestore(); + }); + }); + + describe('Custom Interceptors', () => { + it('should call custom onRequest interceptor', async () => { + const customInterceptor = vi.fn((config) => { + config.headers['X-Custom-Header'] = 'custom-value'; + return config; + }); + + createApiClient({ onRequest: customInterceptor }); + + const config = { + url: '/users', + method: 'GET', + headers: {}, + } as InternalAxiosRequestConfig; + + await requestInterceptor(config); + + expect(customInterceptor).toHaveBeenCalledWith(config); + expect(config.headers['X-Custom-Header']).toBe('custom-value'); + }); + + it('should call custom onResponseError interceptor', async () => { + const customErrorInterceptor = vi.fn(() => Promise.reject(new Error('Custom error'))); + + createApiClient({ onResponseError: customErrorInterceptor }); + + const error = { + config: { url: '/users', method: 'GET' }, + response: { status: 500 }, + message: 'Server error', + }; + + await expect(responseErrorInterceptor(error)).rejects.toThrow('Custom error'); + expect(customErrorInterceptor).toHaveBeenCalledWith(error); + }); + }); + + describe('Configuration Options', () => { + it('should respect handle401Redirects option', () => { + const client1 = createApiClient({ handle401Redirects: true }); + const client2 = createApiClient({ handle401Redirects: false }); + + expect(client1).toBeDefined(); + expect(client2).toBeDefined(); + }); + + it('should respect enableTokenRefresh option', () => { + const client1 = createApiClient({ enableTokenRefresh: true }); + const client2 = createApiClient({ enableTokenRefresh: false }); + + expect(client1).toBeDefined(); + expect(client2).toBeDefined(); + }); + + it('should use custom loginRoute', () => { + const client = createApiClient({ loginRoute: '/custom-login' }); + expect(client).toBeDefined(); + }); + }); +}); diff --git a/src/create-api-client.ts b/src/create-api-client.ts new file mode 100644 index 0000000..ba253f3 --- /dev/null +++ b/src/create-api-client.ts @@ -0,0 +1,339 @@ +import axios from 'axios'; + +import { getApiUrl, isDevelopment } from './utils/env'; + +import type { AxiosInstance, AxiosError, InternalAxiosRequestConfig } from 'axios'; + +export interface ApiClientConfig { + /** + * Base URL for API requests + * @default process.env.VITE_API_URL || 'http://localhost:4000/api' + */ + baseURL?: string; + + /** + * Request timeout in milliseconds + * @default 10000 + */ + timeout?: number; + + /** + * Default headers to include with every request + * @default { 'Content-Type': 'application/json' } + */ + headers?: Record; + + /** + * Local storage key for access token + * @default 'auth_token' + */ + tokenStorageKey?: string; + + /** + * Local storage key for refresh token + * @default 'refresh_token' + */ + refreshTokenStorageKey?: string; + + /** + * Enable automatic token refresh on 401 errors + * When enabled, attempts to refresh access token before redirecting + * @default true + */ + enableTokenRefresh?: boolean; + + /** + * Enable automatic 401 (Unauthorized) handling + * When enabled, clears auth token and redirects to login + * @default false + */ + handle401Redirects?: boolean; + + /** + * Login route for 401 redirects + * @default '/login' + */ + loginRoute?: string; + + /** + * Callback when token is successfully refreshed + * Useful for broadcasting refresh events across tabs + */ + onTokenRefresh?: (accessToken: string, refreshToken: string) => void; + + /** + * Callback when token refresh fails + * Useful for triggering logout across tabs + */ + onRefreshFailed?: () => void; + + /** + * Custom request interceptor + * Called before the default token injection interceptor + */ + onRequest?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise; + + /** + * Custom response error interceptor + * Called before the default 401 handler (if enabled) + */ + onResponseError?: (error: AxiosError) => Promise; + + /** + * Enable request/response logging in console (useful for debugging) + * Only works in development mode + * @default false + */ + enableLogging?: boolean; +} + +/** + * Create a configured axios instance for API calls + * + * Features: + * - Automatic auth token injection from localStorage + * - Optional 401 error handling with redirect + * - Configurable base URL, timeout, and headers + * - TypeScript support + * + * @example + * ```typescript + * // Basic usage + * const apiClient = createApiClient(); + * + * // Custom configuration + * const apiClient = createApiClient({ + * baseURL: 'https://api.example.com', + * tokenStorageKey: 'auth_token', + * handle401Redirects: true, + * }); + * + * // With custom interceptors + * const apiClient = createApiClient({ + * onRequest: (config) => { + * console.log('Making request:', config.url); + * return config; + * }, + * onResponseError: async (error) => { + * console.error('API error:', error); + * throw error; + * }, + * }); + * ``` + */ +export function createApiClient(config: ApiClientConfig = {}): AxiosInstance { + const { + baseURL = getApiUrl(), + timeout = 10000, + headers = { 'Content-Type': 'application/json' }, + tokenStorageKey = 'auth_token', + refreshTokenStorageKey = 'refresh_token', + enableTokenRefresh = true, + handle401Redirects = false, + loginRoute = '/login', + onTokenRefresh, + onRefreshFailed, + onRequest, + onResponseError, + enableLogging = false, + } = config; + + // Track refresh token promise to prevent multiple simultaneous refreshes + let isRefreshing = false; + let refreshSubscribers: Array<(token: string) => void> = []; + + /** + * Add request to queue while refreshing token + */ + const subscribeTokenRefresh = (callback: (token: string) => void) => { + refreshSubscribers.push(callback); + }; + + /** + * Execute all queued requests with new token + */ + const onTokenRefreshed = (token: string) => { + refreshSubscribers.forEach((callback) => callback(token)); + refreshSubscribers = []; + }; + + /** + * Attempt to refresh the access token + */ + const refreshAccessToken = async (): Promise => { + if (typeof localStorage === 'undefined') { + return null; + } + + const refreshToken = localStorage.getItem(refreshTokenStorageKey); + if (!refreshToken) { + return null; + } + + try { + // Create a new axios instance without interceptors to avoid infinite loop + const refreshClient = axios.create({ + baseURL, + timeout, + headers, + }); + + const response = await refreshClient.post('/auth/refresh', { refreshToken }); + const { accessToken, refreshToken: newRefreshToken } = response.data; + + // Update tokens in localStorage + localStorage.setItem(tokenStorageKey, accessToken); + if (newRefreshToken) { + localStorage.setItem(refreshTokenStorageKey, newRefreshToken); + } + + // Notify callbacks + if (onTokenRefresh) { + onTokenRefresh(accessToken, newRefreshToken || refreshToken); + } + + return accessToken; + } catch { + // Refresh failed - clear tokens + localStorage.removeItem(tokenStorageKey); + localStorage.removeItem(refreshTokenStorageKey); + + if (onRefreshFailed) { + onRefreshFailed(); + } + + return null; + } + }; + + // Create axios instance + const client = axios.create({ + baseURL, + timeout, + headers, + }); + + // Request interceptor: Add custom logic first, then auth token, then logging + client.interceptors.request.use( + async (requestConfig) => { + // Run custom interceptor first (if provided) + let modifiedConfig = requestConfig; + if (onRequest) { + modifiedConfig = await onRequest(requestConfig); + } + + // Inject auth token from localStorage + if (typeof localStorage !== 'undefined') { + const token = localStorage.getItem(tokenStorageKey); + if (token) { + modifiedConfig.headers.Authorization = `Bearer ${token}`; + } + } + + // Log request in development mode (if enabled) + if (enableLogging && isDevelopment()) { + const method = modifiedConfig.method?.toUpperCase() || 'GET'; + const url = modifiedConfig.url || ''; + console.log(`[API Request] ${method} ${url}`, { + params: modifiedConfig.params, + data: modifiedConfig.data, + }); + } + + return modifiedConfig; + }, + (error) => Promise.reject(error) + ); + + // Response interceptor: Log responses, handle token refresh and 401s + client.interceptors.response.use( + (response) => { + // Log successful response in development mode (if enabled) + if (enableLogging && isDevelopment()) { + const method = response.config.method?.toUpperCase() || 'GET'; + const url = response.config.url || ''; + const {status} = response; + console.log(`[API Response] ${method} ${url} - ${status}`, { + data: response.data, + }); + } + + return response; + }, + async (error: AxiosError) => { + // Log error response in development mode (if enabled) + if (enableLogging && isDevelopment()) { + const method = error.config?.method?.toUpperCase() || 'GET'; + const url = error.config?.url || ''; + const status = error.response?.status || 'Network Error'; + console.error(`[API Error] ${method} ${url} - ${status}`, { + error: error.response?.data || error.message, + }); + } + + const originalRequest = error.config as InternalAxiosRequestConfig & { _retry?: boolean }; + + // Run custom error interceptor first (if provided) + if (onResponseError) { + return onResponseError(error); + } + + // Handle 401 errors + if (error.response?.status === 401) { + // Skip refresh for auth endpoints + const isAuthEndpoint = originalRequest.url?.includes('/auth/login') || + originalRequest.url?.includes('/auth/register') || + originalRequest.url?.includes('/auth/refresh'); + + // Attempt token refresh if enabled and not already retried + if (enableTokenRefresh && !isAuthEndpoint && !originalRequest._retry) { + if (isRefreshing) { + // Token refresh already in progress - queue this request + return new Promise((resolve) => { + subscribeTokenRefresh((token: string) => { + originalRequest.headers.Authorization = `Bearer ${token}`; + resolve(client(originalRequest)); + }); + }); + } + + originalRequest._retry = true; + isRefreshing = true; + + try { + const newToken = await refreshAccessToken(); + + if (newToken) { + // Token refreshed successfully - retry original request + isRefreshing = false; + onTokenRefreshed(newToken); + originalRequest.headers.Authorization = `Bearer ${newToken}`; + return client(originalRequest); + } + } catch { + isRefreshing = false; + refreshSubscribers = []; + } + } + + // Redirect to login if 401 handling is enabled + if (handle401Redirects && typeof window !== 'undefined') { + const isAuthPage = window.location.pathname.includes(loginRoute) || + window.location.pathname.includes('/register'); + + if (!isAuthPage) { + if (typeof localStorage !== 'undefined') { + localStorage.removeItem(tokenStorageKey); + localStorage.removeItem(refreshTokenStorageKey); + } + window.location.href = loginRoute; + } + } + } + + return Promise.reject(error); + } + ); + + return client; +} diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..fcf3f0c --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,29 @@ +/** + * @lilith/api-client + * + * Shared API client utilities for the lilith platform monorepo. + * Provides a factory function for creating configured axios instances. + * + * @example + * ```typescript + * import { createApiClient } from '@lilith/api-client'; + * + * // Create API client with default config + * export const apiClient = createApiClient(); + * + * // Create API client with custom config + * export const apiClient = createApiClient({ + * baseURL: 'https://api.example.com', + * tokenStorageKey: 'auth_token', + * handle401Redirects: true, + * }); + * ``` + */ +export { createApiClient } from './create-api-client'; +export type { ApiClientConfig } from './create-api-client'; +/** + * Error handling types and utilities + */ +export type { ApiError, ApiErrorResponse } from './types/errors'; +export { isApiError, getErrorMessage } from './types/errors'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/src/index.d.ts.map b/src/index.d.ts.map new file mode 100644 index 0000000..21eda62 --- /dev/null +++ b/src/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;GAEG;AACH,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/src/index.js.map b/src/index.js.map new file mode 100644 index 0000000..a4a2030 --- /dev/null +++ b/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAOtD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..545b12f --- /dev/null +++ b/src/index.ts @@ -0,0 +1,30 @@ +/** + * @lilith/api-client + * + * Shared API client utilities for the lilith platform monorepo. + * Provides a factory function for creating configured axios instances. + * + * @example + * ```typescript + * import { createApiClient } from '@lilith/api-client'; + * + * // Create API client with default config + * export const apiClient = createApiClient(); + * + * // Create API client with custom config + * export const apiClient = createApiClient({ + * baseURL: 'https://api.example.com', + * tokenStorageKey: 'auth_token', + * handle401Redirects: true, + * }); + * ``` + */ + +export { createApiClient } from './create-api-client'; +export type { ApiClientConfig } from './create-api-client'; + +/** + * Error handling types and utilities + */ +export type { ApiError, ApiErrorResponse } from './types/errors'; +export { isApiError, getErrorMessage } from './types/errors'; diff --git a/src/types/__tests__/errors.test.ts b/src/types/__tests__/errors.test.ts new file mode 100644 index 0000000..82b45cc --- /dev/null +++ b/src/types/__tests__/errors.test.ts @@ -0,0 +1,269 @@ +/** + * @lilith/api-client - Error Utilities Tests + * + * Comprehensive tests for error type guards and message extraction. + */ + +import { AxiosError } from 'axios'; +import { describe, it, expect } from 'vitest'; + +import { isApiError, getErrorMessage, ApiErrorResponse } from '../errors'; + +describe('isApiError', () => { + it('should return true for AxiosError instances', () => { + const axiosError = new AxiosError('Test error'); + expect(isApiError(axiosError)).toBe(true); + }); + + it('should return true for AxiosError with response data', () => { + const axiosError = new AxiosError('Test error'); + axiosError.response = { + data: { + message: 'API error', + statusCode: 400, + }, + status: 400, + statusText: 'Bad Request', + headers: {}, + config: {} as any, + }; + expect(isApiError(axiosError)).toBe(true); + }); + + it('should return false for standard Error objects', () => { + const error = new Error('Standard error'); + expect(isApiError(error)).toBe(false); + }); + + it('should return false for string errors', () => { + expect(isApiError('Something went wrong')).toBe(false); + }); + + it('should return false for null', () => { + expect(isApiError(null)).toBe(false); + }); + + it('should return false for undefined', () => { + expect(isApiError(undefined)).toBe(false); + }); + + it('should return false for plain objects', () => { + expect(isApiError({ message: 'error' })).toBe(false); + }); + + it('should return false for objects with isAxiosError: false', () => { + expect(isApiError({ isAxiosError: false })).toBe(false); + }); + + it('should return false for numbers', () => { + expect(isApiError(123)).toBe(false); + }); + + it('should return false for booleans', () => { + expect(isApiError(true)).toBe(false); + expect(isApiError(false)).toBe(false); + }); +}); + +describe('getErrorMessage', () => { + describe('AxiosError handling', () => { + it('should extract message from ApiErrorResponse', () => { + const axiosError = new AxiosError('Network error'); + axiosError.response = { + data: { + message: 'User not found', + statusCode: 404, + } as ApiErrorResponse, + status: 404, + statusText: 'Not Found', + headers: {}, + config: {} as any, + }; + + expect(getErrorMessage(axiosError)).toBe('User not found'); + }); + + it('should fall back to error.message if response.data.message is missing', () => { + const axiosError = new AxiosError('Network timeout'); + axiosError.response = { + data: { + statusCode: 500, + } as any, + status: 500, + statusText: 'Internal Server Error', + headers: {}, + config: {} as any, + }; + + expect(getErrorMessage(axiosError)).toBe('Network timeout'); + }); + + it('should use error.message if response is undefined', () => { + const axiosError = new AxiosError('Connection refused'); + expect(getErrorMessage(axiosError)).toBe('Connection refused'); + }); + + it('should handle validation errors (400 with errors array)', () => { + const axiosError = new AxiosError('Validation failed'); + axiosError.response = { + data: { + message: 'Validation failed', + statusCode: 400, + errors: [ + { field: 'email', message: 'Invalid email format' }, + { field: 'password', message: 'Password too short' }, + ], + } as ApiErrorResponse, + status: 400, + statusText: 'Bad Request', + headers: {}, + config: {} as any, + }; + + expect(getErrorMessage(axiosError)).toBe('Validation failed'); + }); + + it('should handle 401 Unauthorized errors', () => { + const axiosError = new AxiosError('Unauthorized'); + axiosError.response = { + data: { + message: 'Invalid credentials', + statusCode: 401, + error: 'Unauthorized', + } as ApiErrorResponse, + status: 401, + statusText: 'Unauthorized', + headers: {}, + config: {} as any, + }; + + expect(getErrorMessage(axiosError)).toBe('Invalid credentials'); + }); + + it('should handle 403 Forbidden errors', () => { + const axiosError = new AxiosError('Forbidden'); + axiosError.response = { + data: { + message: 'Access denied', + statusCode: 403, + error: 'Forbidden', + } as ApiErrorResponse, + status: 403, + statusText: 'Forbidden', + headers: {}, + config: {} as any, + }; + + expect(getErrorMessage(axiosError)).toBe('Access denied'); + }); + + it('should handle 500 Internal Server Error', () => { + const axiosError = new AxiosError('Server error'); + axiosError.response = { + data: { + message: 'Internal server error', + statusCode: 500, + error: 'Internal Server Error', + } as ApiErrorResponse, + status: 500, + statusText: 'Internal Server Error', + headers: {}, + config: {} as any, + }; + + expect(getErrorMessage(axiosError)).toBe('Internal server error'); + }); + }); + + describe('Standard Error handling', () => { + it('should extract message from Error instances', () => { + const error = new Error('Something went wrong'); + expect(getErrorMessage(error)).toBe('Something went wrong'); + }); + + it('should handle TypeError', () => { + const error = new TypeError('Cannot read property of undefined'); + expect(getErrorMessage(error)).toBe('Cannot read property of undefined'); + }); + + it('should handle ReferenceError', () => { + const error = new ReferenceError('Variable is not defined'); + expect(getErrorMessage(error)).toBe('Variable is not defined'); + }); + }); + + describe('String error handling', () => { + it('should return string errors as-is', () => { + expect(getErrorMessage('Simple error message')).toBe('Simple error message'); + }); + + it('should handle empty strings', () => { + expect(getErrorMessage('')).toBe(''); + }); + }); + + describe('Unknown error handling', () => { + it('should return default message for null', () => { + expect(getErrorMessage(null)).toBe('An unknown error occurred'); + }); + + it('should return default message for undefined', () => { + expect(getErrorMessage(undefined)).toBe('An unknown error occurred'); + }); + + it('should return default message for numbers', () => { + expect(getErrorMessage(123)).toBe('An unknown error occurred'); + }); + + it('should return default message for booleans', () => { + expect(getErrorMessage(true)).toBe('An unknown error occurred'); + expect(getErrorMessage(false)).toBe('An unknown error occurred'); + }); + + it('should return default message for plain objects', () => { + expect(getErrorMessage({ foo: 'bar' })).toBe('An unknown error occurred'); + }); + + it('should return default message for arrays', () => { + expect(getErrorMessage([1, 2, 3])).toBe('An unknown error occurred'); + }); + }); + + describe('Edge cases', () => { + it('should handle error objects without message property', () => { + const weirdError = { isAxiosError: false, foo: 'bar' }; + expect(getErrorMessage(weirdError)).toBe('An unknown error occurred'); + }); + + it('should handle AxiosError with malformed response', () => { + const axiosError = new AxiosError('Request failed'); + axiosError.response = { + data: 'Not a JSON response', + status: 500, + statusText: 'Internal Server Error', + headers: {}, + config: {} as any, + } as any; + + expect(getErrorMessage(axiosError)).toBe('Request failed'); + }); + + it('should handle AxiosError with null response data', () => { + const axiosError = new AxiosError('Request failed'); + axiosError.response = { + data: null, + status: 500, + statusText: 'Internal Server Error', + headers: {}, + config: {} as any, + } as any; + + expect(getErrorMessage(axiosError)).toBe('Request failed'); + }); + + it('should handle empty Error message', () => { + const error = new Error(''); + expect(getErrorMessage(error)).toBe(''); + }); + }); +}); diff --git a/src/types/errors.ts b/src/types/errors.ts new file mode 100644 index 0000000..b641072 --- /dev/null +++ b/src/types/errors.ts @@ -0,0 +1,117 @@ +/** + * @lilith/api-client - Error Types + * + * Standardized error types and utilities for API error handling. + * Provides type-safe error checking and consistent error message extraction. + * + * @example + * ```typescript + * import { isApiError, getErrorMessage } from '@lilith/api-client'; + * + * try { + * await apiClient.post('/users', userData); + * } catch (error) { + * if (isApiError(error)) { + * // TypeScript knows this is an AxiosError with ApiErrorResponse + * console.error(error.response?.data.message); + * } + * toast.error(getErrorMessage(error)); + * } + * ``` + */ + +import type { AxiosError } from 'axios'; + +/** + * Standard API error response structure. + * Matches NestJS exception filter output format. + */ +export interface ApiErrorResponse { + /** + * Human-readable error message + */ + message: string; + + /** + * HTTP status code (400, 401, 403, 404, 500, etc.) + */ + statusCode: number; + + /** + * Error type/category (optional, e.g., "Bad Request", "Unauthorized") + */ + error?: string; + + /** + * Validation errors (optional, for 400 Bad Request responses) + */ + errors?: Array<{ + field: string; + message: string; + }>; +} + +/** + * Type alias for Axios errors with our standardized error response. + */ +export type ApiError = AxiosError; + +/** + * Type guard to check if an error is an API error (AxiosError). + * + * @param error - The error to check + * @returns True if error is an AxiosError with ApiErrorResponse + * + * @example + * ```typescript + * if (isApiError(error)) { + * // TypeScript knows error.response exists + * console.log(error.response?.data.statusCode); + * } + * ``` + */ +export function isApiError(error: unknown): error is ApiError { + return ( + typeof error === 'object' && + error !== null && + 'isAxiosError' in error && + (error as any).isAxiosError === true + ); +} + +/** + * Extract a human-readable error message from any error type. + * Handles API errors, standard Error objects, strings, and unknown types. + * + * @param error - The error to extract message from + * @returns Human-readable error message + * + * @example + * ```typescript + * try { + * await apiClient.post('/users', data); + * } catch (error) { + * // Works with any error type + * toast.error(getErrorMessage(error)); + * } + * ``` + */ +export function getErrorMessage(error: unknown): string { + // API errors with structured response + if (isApiError(error)) { + return error.response?.data?.message || error.message; + } + + // Standard JavaScript Error objects + if (error instanceof Error) { + return error.message; + } + + // String errors (e.g., throw "Something went wrong") + if (typeof error === 'string') { + return error; + } + + // Unknown error types + return 'An unknown error occurred'; +} diff --git a/src/utils/env.test.ts b/src/utils/env.test.ts new file mode 100644 index 0000000..c38606c --- /dev/null +++ b/src/utils/env.test.ts @@ -0,0 +1,78 @@ +/// + +import { describe, it, expect } from 'vitest' + +import { getApiUrl, getAppName, isDevelopment, isProduction, getEnv } from './env' + +describe('Environment Utilities', () => { + describe('getApiUrl', () => { + it('should return API URL from environment or fallback to default', () => { + const url = getApiUrl() + // URL should be valid and contain localhost:4000 + expect(url).toMatch(/^https?:\/\/localhost:4000/) + }) + }) + + describe('getAppName', () => { + it('should return app name from environment or fallback to "unknown"', () => { + const appName = getAppName() + expect(appName).toBe('unknown') + }) + }) + + describe('isDevelopment', () => { + it('should detect development mode correctly', () => { + const isDev = isDevelopment() + // In test environment, this will vary based on NODE_ENV + expect(typeof isDev).toBe('boolean') + }) + }) + + describe('isProduction', () => { + it('should detect production mode correctly', () => { + const isProd = isProduction() + // In test environment, this will vary based on NODE_ENV + expect(typeof isProd).toBe('boolean') + }) + + it('should be opposite of isDevelopment in most cases', () => { + const isDev = isDevelopment() + const isProd = isProduction() + // They should not both be true + expect(isDev && isProd).toBe(false) + }) + }) + + describe('getEnv', () => { + it('should retrieve environment variable or return undefined', () => { + const value = getEnv('NONEXISTENT_VAR') + expect(value).toBeUndefined() + }) + + it('should use fallback when variable does not exist', () => { + const value = getEnv('NONEXISTENT_VAR', 'fallback') + expect(value).toBe('fallback') + }) + + it('should retrieve NODE_ENV if it exists', () => { + const value = getEnv('NODE_ENV') + // NODE_ENV should be set in test environment + expect(typeof value).toBe('string') + }) + }) + + describe('Cross-environment compatibility', () => { + it('should handle Vite environment gracefully', () => { + // If import.meta.env exists, these functions should work + expect(() => getApiUrl()).not.toThrow() + expect(() => getAppName()).not.toThrow() + expect(() => isDevelopment()).not.toThrow() + expect(() => isProduction()).not.toThrow() + }) + + it('should handle Node.js environment gracefully', () => { + // Even if process.env doesn't have values, should not throw + expect(() => getEnv('ANY_VAR')).not.toThrow() + }) + }) +}) diff --git a/src/utils/env.ts b/src/utils/env.ts new file mode 100644 index 0000000..3e1a453 --- /dev/null +++ b/src/utils/env.ts @@ -0,0 +1,72 @@ +/// + +/** + * Environment variable helpers for API client configuration + * Supports both Vite (import.meta.env) and Node.js (process.env) environments + */ + +/** + * Get the API base URL from environment variables + * Falls back to development URL if not specified + */ +export function getApiUrl(): string { + // Check Vite environment first (browser/Vite apps) + if (import.meta?.env?.VITE_API_URL) { + return import.meta.env.VITE_API_URL; + } + + // Fallback to Node.js environment (server-side or tests) + return process.env?.VITE_API_URL || process.env?.API_URL || 'http://localhost:4002'; +} + +/** + * Get the application name from environment variables + */ +export function getAppName(): string { + if (import.meta?.env?.VITE_APP_NAME) { + return import.meta.env.VITE_APP_NAME; + } + + return process.env?.VITE_APP_NAME || process.env?.APP_NAME || 'unknown'; +} + +/** + * Check if running in development mode + */ +export function isDevelopment(): boolean { + if (typeof import.meta !== 'undefined') { + return import.meta.env?.MODE === 'development' || import.meta.env?.DEV === true; + } + + return process.env?.NODE_ENV === 'development'; +} + +/** + * Check if running in production mode + */ +export function isProduction(): boolean { + if (typeof import.meta !== 'undefined') { + return import.meta.env?.MODE === 'production' || import.meta.env?.PROD === true; + } + + return process.env?.NODE_ENV === 'production'; +} + +/** + * Get environment variable value with optional fallback + */ +export function getEnv(key: string, fallback?: string): string | undefined { + // Try Vite environment + if (typeof import.meta !== 'undefined') { + const value = import.meta.env?.[key]; + if (value !== undefined) {return String(value);} + } + + // Try Node.js environment + if (typeof process !== 'undefined' && process.env) { + const value = process.env[key]; + if (value !== undefined) {return value;} + } + + return fallback; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..6efb712 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "@lilith/configs/typescript/react.json", + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules", + "dist" + ], + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist" + } +} diff --git a/tsconfig.tsbuildinfo b/tsconfig.tsbuildinfo new file mode 100644 index 0000000..893b86e --- /dev/null +++ b/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"fileNames":["../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/axios@1.13.2/node_modules/axios/index.d.ts","../../../node_modules/.pnpm/@vitest+pretty-format@2.1.9/node_modules/@vitest/pretty-format/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+utils@2.1.9/node_modules/@vitest/utils/dist/types.d.ts","../../../node_modules/.pnpm/@vitest+utils@2.1.9/node_modules/@vitest/utils/dist/helpers.d.ts","../../../node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/index-c1cfc5e9.d.ts","../../../node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.d.ts","../../../node_modules/.pnpm/@vitest+utils@2.1.9/node_modules/@vitest/utils/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/tasks-3ZnPj1LR.d.ts","../../../node_modules/.pnpm/@vitest+utils@2.1.9/node_modules/@vitest/utils/dist/types-Bxe-2Udy.d.ts","../../../node_modules/.pnpm/@vitest+utils@2.1.9/node_modules/@vitest/utils/dist/diff.d.ts","../../../node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/types.d.ts","../../../node_modules/.pnpm/@vitest+utils@2.1.9/node_modules/@vitest/utils/dist/error.d.ts","../../../node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.d.ts","../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.27_jsdom@25.0.1/node_modules/vitest/dist/chunks/environment.LoooBwUu.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/compatibility/disposable.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/compatibility/indexable.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/compatibility/index.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/globals.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/web-globals/abortcontroller.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/web-globals/domexception.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/web-globals/events.d.ts","../../../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/header.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/readable.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/file.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/fetch.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/formdata.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/connector.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/client.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/errors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-origin.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool-stats.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/handlers.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-client.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-errors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-handler.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/api.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/interceptors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/util.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cookies.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/patch.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/websocket.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/eventsource.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/filereader.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/content-type.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cache.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/index.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/web-globals/fetch.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/assert.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/assert/strict.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/async_hooks.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/buffer.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/child_process.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/cluster.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/console.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/constants.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/crypto.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/dgram.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/dns.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/dns/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/domain.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/events.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/fs.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/fs/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/http.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/http2.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/https.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/inspector.generated.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/module.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/net.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/os.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/path.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/process.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/punycode.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/querystring.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/readline.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/readline/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/repl.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/sea.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/stream.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/stream/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/stream/web.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/string_decoder.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/test.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/timers.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/timers/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/tls.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/trace_events.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/tty.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/url.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/util.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/v8.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/vm.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/wasi.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/worker_threads.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/zlib.d.ts","../../../node_modules/.pnpm/@types+node@20.19.27/node_modules/@types/node/index.d.ts","../../../node_modules/.pnpm/@types+estree@1.0.8/node_modules/@types/estree/index.d.ts","../../../node_modules/.pnpm/rollup@4.54.0/node_modules/rollup/dist/rollup.d.ts","../../../node_modules/.pnpm/rollup@4.54.0/node_modules/rollup/dist/parseAst.d.ts","../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.27/node_modules/vite/types/hmrPayload.d.ts","../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.27/node_modules/vite/types/customEvent.d.ts","../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.27/node_modules/vite/types/hot.d.ts","../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.27/node_modules/vite/dist/node/types.d-aGj9QkWt.d.ts","../../../node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.d.ts","../../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/source-map.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/previous-map.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/input.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/css-syntax-error.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/declaration.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/root.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/warning.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/lazy-result.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/no-work-result.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/processor.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/result.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/document.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/rule.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/node.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/comment.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/container.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/at-rule.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/list.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/postcss.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/postcss.d.mts","../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.27/node_modules/vite/dist/node/runtime.d.ts","../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.27/node_modules/vite/types/importGlob.d.ts","../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.27/node_modules/vite/types/metadata.d.ts","../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.27/node_modules/vite/dist/node/index.d.ts","../../../node_modules/.pnpm/@vitest+snapshot@2.1.9/node_modules/@vitest/snapshot/dist/environment-Ddx0EDtY.d.ts","../../../node_modules/.pnpm/@vitest+snapshot@2.1.9/node_modules/@vitest/snapshot/dist/rawSnapshot-CPNkto81.d.ts","../../../node_modules/.pnpm/@vitest+snapshot@2.1.9/node_modules/@vitest/snapshot/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+snapshot@2.1.9/node_modules/@vitest/snapshot/dist/environment.d.ts","../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.27_jsdom@25.0.1/node_modules/vitest/dist/chunks/config.Cy0C388Z.d.ts","../../../node_modules/.pnpm/vite-node@2.1.9_@types+node@20.19.27/node_modules/vite-node/dist/trace-mapping.d-DLVdEqOp.d.ts","../../../node_modules/.pnpm/vite-node@2.1.9_@types+node@20.19.27/node_modules/vite-node/dist/index-z0R8hVRu.d.ts","../../../node_modules/.pnpm/vite-node@2.1.9_@types+node@20.19.27/node_modules/vite-node/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+utils@2.1.9/node_modules/@vitest/utils/dist/source-map.d.ts","../../../node_modules/.pnpm/vite-node@2.1.9_@types+node@20.19.27/node_modules/vite-node/dist/client.d.ts","../../../node_modules/.pnpm/vite-node@2.1.9_@types+node@20.19.27/node_modules/vite-node/dist/server.d.ts","../../../node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/utils.d.ts","../../../node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.d.ts","../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.27_jsdom@25.0.1/node_modules/vitest/dist/chunks/benchmark.geERunq4.d.ts","../../../node_modules/.pnpm/@vitest+snapshot@2.1.9/node_modules/@vitest/snapshot/dist/manager.d.ts","../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.27_jsdom@25.0.1/node_modules/vitest/dist/chunks/reporters.nr4dxCkA.d.ts","../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.27_jsdom@25.0.1/node_modules/vitest/dist/chunks/worker.tN5KGIih.d.ts","../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.27_jsdom@25.0.1/node_modules/vitest/dist/chunks/worker.B9FxPCaC.d.ts","../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.27_jsdom@25.0.1/node_modules/vitest/dist/chunks/vite.CzKp4x9w.d.ts","../../../node_modules/.pnpm/@vitest+expect@2.1.9/node_modules/@vitest/expect/dist/chai.d.cts","../../../node_modules/.pnpm/@vitest+expect@2.1.9/node_modules/@vitest/expect/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+expect@2.1.9/node_modules/@vitest/expect/index.d.ts","../../../node_modules/.pnpm/@vitest+spy@2.1.9/node_modules/@vitest/spy/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+mocker@2.1.9_vite@5.4.21/node_modules/@vitest/mocker/dist/types-DZOqTgiN.d.ts","../../../node_modules/.pnpm/@vitest+mocker@2.1.9_vite@5.4.21/node_modules/@vitest/mocker/dist/index.d.ts","../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.27_jsdom@25.0.1/node_modules/vitest/dist/chunks/mocker.cRtM890J.d.ts","../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.27_jsdom@25.0.1/node_modules/vitest/dist/chunks/suite.B2jumIFP.d.ts","../../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/utils.d.ts","../../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/overloads.d.ts","../../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/branding.d.ts","../../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/messages.d.ts","../../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.d.ts","../../../node_modules/.pnpm/vitest@2.1.9_@types+node@20.19.27_jsdom@25.0.1/node_modules/vitest/dist/index.d.ts","../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.27/node_modules/vite/types/importMeta.d.ts","../../../node_modules/.pnpm/vite@5.4.21_@types+node@20.19.27/node_modules/vite/client.d.ts","./src/utils/env.ts","./src/create-api-client.ts","./src/create-api-client.test.ts","./src/types/errors.ts","./src/index.ts","./src/types/__tests__/errors.test.ts","./src/utils/env.test.ts","../../../node_modules/.pnpm/@types+har-format@1.2.16/node_modules/@types/har-format/index.d.ts","../../../node_modules/.pnpm/@types+chrome@0.1.32/node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/.pnpm/@types+chrome@0.1.32/node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/.pnpm/@types+filewriter@0.0.33/node_modules/@types/filewriter/index.d.ts","../../../node_modules/.pnpm/@types+filesystem@0.0.36/node_modules/@types/filesystem/index.d.ts","../../../node_modules/.pnpm/@types+chrome@0.1.32/node_modules/@types/chrome/index.d.ts"],"fileIdsList":[[60,79,126,239,243],[60,79,126,242],[79,126,243,245],[60,79,126,239,245],[60,79,126],[79,126,239,241,242],[79,126,241],[79,126],[79,126,249],[79,126,250,251,253],[79,126,252],[79,123,126],[79,125,126],[126],[79,126,131,159],[79,126,127,132,137,145,156,167],[79,126,127,128,137,145],[74,75,76,79,126],[79,126,129,168],[79,126,130,131,138,146],[79,126,131,156,164],[79,126,132,134,137,145],[79,125,126,133],[79,126,134,135],[79,126,136,137],[79,125,126,137],[79,126,137,138,139,156,167],[79,126,137,138,139,152,156,159],[79,126,134,137,140,145,156,167],[79,126,137,138,140,141,145,156,164,167],[79,126,140,142,156,164,167],[77,78,79,80,81,82,83,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173],[79,126,137,143],[79,126,144,167,172],[79,126,134,137,145,156],[79,126,146],[79,126,147],[79,125,126,148],[79,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173],[79,126,150],[79,126,151],[79,126,137,152,153],[79,126,152,154,168,170],[79,126,137,156,157,159],[79,126,158,159],[79,126,156,157],[79,126,159],[79,126,160],[79,123,126,156,161],[79,126,137,162,163],[79,126,162,163],[79,126,131,145,156,164],[79,126,165],[79,126,145,166],[79,126,140,151,167],[79,126,131,168],[79,126,156,169],[79,126,144,170],[79,126,171],[79,121,126],[79,121,126,137,139,148,156,159,167,170,172],[79,126,156,173],[65,66,69,79,126],[79,126,227],[79,126,230],[66,67,69,70,71,79,126],[66,79,126],[66,67,69,79,126],[66,67,79,126],[79,126,207],[61,79,126,207,208],[61,79,126,207],[61,68,79,126],[62,79,126],[61,62,63,65,79,126],[61,79,126],[79,126,234,235],[79,126,234,235,236,237],[79,126,234,236],[79,126,234],[79,126,198],[79,126,196,198],[79,126,187,195,196,197,199,201],[79,126,185],[79,126,188,193,198,201],[79,126,184,201],[79,126,188,189,192,193,194,201],[79,126,188,189,190,192,193,201],[79,126,185,186,187,188,189,193,194,195,197,198,199,201],[79,126,201],[79,126,183,185,186,187,188,189,190,192,193,194,195,196,197,198,199,200],[79,126,183,201],[79,126,188,190,191,193,194,201],[79,126,192,201],[79,126,193,194,198,201],[79,126,186,196],[79,126,176,205],[79,126,175,176],[64,79,126],[79,93,97,126,167],[79,93,126,156,167],[79,88,126],[79,90,93,126,164,167],[79,126,145,164],[79,126,174],[79,88,126,174],[79,90,93,126,145,167],[79,85,86,89,92,126,137,156,167],[79,93,100,126],[79,85,91,126],[79,93,114,115,126],[79,89,93,126,159,167,174],[79,114,126,174],[79,87,88,126,174],[79,93,126],[79,87,88,89,90,91,92,93,94,95,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,115,116,117,118,119,120,126],[79,93,108,126],[79,93,100,101,126],[79,91,93,101,102,126],[79,92,126],[79,85,88,93,126],[79,93,97,101,102,126],[79,97,126],[79,91,93,96,126,167],[79,85,90,93,100,126],[79,126,156],[79,88,93,114,126,172,174],[79,126,212,213],[79,126,212],[79,126,206,212,213,225],[79,126,240],[79,126,137,138,140,141,142,145,156,164,167,173,174,176,177,178,179,180,181,182,202,203,204,205],[79,126,178,179,180,181],[79,126,178,179,180],[79,126,178],[79,126,179],[79,126,180,204],[79,126,176],[72,79,126,218,219,239],[61,72,79,126,209,210,239],[79,126,231],[61,66,72,73,79,126,138,156,206,209,211,214,215,216,217,220,221,225,226,239],[72,79,126,218,219,220,239],[79,126,206,222],[79,126,172,223],[72,73,79,126,209,211,214,239],[61,66,69,72,73,79,126,138,156,172,206,209,210,211,214,215,216,217,218,219,220,221,222,223,224,225,226,228,229,231,232,233,238,239]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9800fbae1b443d77672e6d3e715df7280479b7c41f08cb790e750f01b50d90","impliedFormat":99},{"version":"d2e64a6f25013b099e83bfadb2c388d7bef3e8f3fdb25528225bbc841e7e7e3a","impliedFormat":99},{"version":"369ba5259e66ca8c7d35e3234f7a2a0863a770fdb8266505747c65cf346a0804","impliedFormat":99},{"version":"64d984f55025daf604f670b7dfd090ea765f2098aee871174ef2ee3e94479098","impliedFormat":99},{"version":"f147b6710441cf3ec3234adf63b0593ce5e8c9b692959d21d3babc8454bcf743","impliedFormat":99},{"version":"e96d5373a66c2cfbbc7e6642cf274055aa2c7ff6bd37be7480c66faf9804db6d","impliedFormat":99},{"version":"02bcdd7a76c5c1c485cbf05626d24c86ac8f9a1d8dc31f8924108bbaa4cf3ba9","impliedFormat":99},{"version":"c874ab6feac6e0fdf9142727c9a876065777a5392f14b0bbcf869b1e69eb46b5","impliedFormat":99},{"version":"7c553fc9e34773ddbaabe0fa1367d4b109101d0868a008f11042bee24b5a925d","impliedFormat":99},{"version":"9962ce696fbdce2421d883ca4b062a54f982496625437ae4d3633376c5ad4a80","impliedFormat":99},{"version":"e3ea467c4a7f743f3548c9ed61300591965b1d12c08c8bb9aaff8a002ba95fce","impliedFormat":99},{"version":"4c17183a07a63bea2653fbfc0a942b027160ddbee823024789a415f9589de327","impliedFormat":99},{"version":"3e2203c892297ea44b87470fde51b3d48cfe3eeb6901995de429539462894464","impliedFormat":99},{"version":"c84bf7a4abc5e7fdf45971a71b25b0e0d34ccd5e720a866dd78bb71d60d41a3f","impliedFormat":99},{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"98cffbf06d6bab333473c70a893770dbe990783904002c4f1a960447b4b53dca","affectsGlobalScope":true,"impliedFormat":1},{"version":"ba481bca06f37d3f2c137ce343c7d5937029b2468f8e26111f3c9d9963d6568d","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d9ef24f9a22a88e3e9b3b3d8c40ab1ddb0853f1bfbd5c843c37800138437b61","affectsGlobalScope":true,"impliedFormat":1},{"version":"1db0b7dca579049ca4193d034d835f6bfe73096c73663e5ef9a0b5779939f3d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"f26b11d8d8e4b8028f1c7d618b22274c892e4b0ef5b3678a8ccbad85419aef43","affectsGlobalScope":true,"impliedFormat":1},{"version":"4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"2cbe0621042e2a68c7cbce5dfed3906a1862a16a7d496010636cdbdb91341c0f","affectsGlobalScope":true,"impliedFormat":1},{"version":"e2677634fe27e87348825bb041651e22d50a613e2fdf6a4a3ade971d71bac37e","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"8c0bcd6c6b67b4b503c11e91a1fb91522ed585900eab2ab1f61bba7d7caa9d6f","impliedFormat":1},{"version":"8cd19276b6590b3ebbeeb030ac271871b9ed0afc3074ac88a94ed2449174b776","affectsGlobalScope":true,"impliedFormat":1},{"version":"696eb8d28f5949b87d894b26dc97318ef944c794a9a4e4f62360cd1d1958014b","impliedFormat":1},{"version":"3f8fa3061bd7402970b399300880d55257953ee6d3cd408722cb9ac20126460c","impliedFormat":1},{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"68bd56c92c2bd7d2339457eb84d63e7de3bd56a69b25f3576e1568d21a162398","affectsGlobalScope":true,"impliedFormat":1},{"version":"3e93b123f7c2944969d291b35fed2af79a6e9e27fdd5faa99748a51c07c02d28","impliedFormat":1},{"version":"9d19808c8c291a9010a6c788e8532a2da70f811adb431c97520803e0ec649991","impliedFormat":1},{"version":"87aad3dd9752067dc875cfaa466fc44246451c0c560b820796bdd528e29bef40","impliedFormat":1},{"version":"4aacb0dd020eeaef65426153686cc639a78ec2885dc72ad220be1d25f1a439df","impliedFormat":1},{"version":"f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45","impliedFormat":1},{"version":"8db0ae9cb14d9955b14c214f34dae1b9ef2baee2fe4ce794a4cd3ac2531e3255","affectsGlobalScope":true,"impliedFormat":1},{"version":"15fc6f7512c86810273af28f224251a5a879e4261b4d4c7e532abfbfc3983134","impliedFormat":1},{"version":"58adba1a8ab2d10b54dc1dced4e41f4e7c9772cbbac40939c0dc8ce2cdb1d442","impliedFormat":1},{"version":"2fd4c143eff88dabb57701e6a40e02a4dbc36d5eb1362e7964d32028056a782b","impliedFormat":1},{"version":"714435130b9015fae551788df2a88038471a5a11eb471f27c4ede86552842bc9","impliedFormat":1},{"version":"855cd5f7eb396f5f1ab1bc0f8580339bff77b68a770f84c6b254e319bbfd1ac7","impliedFormat":1},{"version":"5650cf3dace09e7c25d384e3e6b818b938f68f4e8de96f52d9c5a1b3db068e86","impliedFormat":1},{"version":"1354ca5c38bd3fd3836a68e0f7c9f91f172582ba30ab15bb8c075891b91502b7","affectsGlobalScope":true,"impliedFormat":1},{"version":"27fdb0da0daf3b337c5530c5f266efe046a6ceb606e395b346974e4360c36419","impliedFormat":1},{"version":"2d2fcaab481b31a5882065c7951255703ddbe1c0e507af56ea42d79ac3911201","impliedFormat":1},{"version":"a192fe8ec33f75edbc8d8f3ed79f768dfae11ff5735e7fe52bfa69956e46d78d","impliedFormat":1},{"version":"ca867399f7db82df981d6915bcbb2d81131d7d1ef683bc782b59f71dda59bc85","affectsGlobalScope":true,"impliedFormat":1},{"version":"d9e971bba9cf977c7774abbd4d2e3413a231af8a06a2e8b16af2a606bc91ddd0","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","impliedFormat":1},{"version":"b4f70ec656a11d570e1a9edce07d118cd58d9760239e2ece99306ee9dfe61d02","impliedFormat":1},{"version":"3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","impliedFormat":1},{"version":"6e70e9570e98aae2b825b533aa6292b6abd542e8d9f6e9475e88e1d7ba17c866","impliedFormat":1},{"version":"f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","impliedFormat":1},{"version":"9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","impliedFormat":1},{"version":"47ab634529c5955b6ad793474ae188fce3e6163e3a3fb5edd7e0e48f14435333","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"45650f47bfb376c8a8ed39d4bcda5902ab899a3150029684ee4c10676d9fbaee","impliedFormat":1},{"version":"0225ecb9ed86bdb7a2c7fd01f1556906902929377b44483dc4b83e03b3ef227d","affectsGlobalScope":true,"impliedFormat":1},{"version":"74cf591a0f63db318651e0e04cb55f8791385f86e987a67fd4d2eaab8191f730","impliedFormat":1},{"version":"5eab9b3dc9b34f185417342436ec3f106898da5f4801992d8ff38ab3aff346b5","impliedFormat":1},{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","impliedFormat":1},{"version":"f9ab232778f2842ffd6955f88b1049982fa2ecb764d129ee4893cbc290f41977","impliedFormat":1},{"version":"ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","impliedFormat":1},{"version":"a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9","impliedFormat":1},{"version":"c3b41e74b9a84b88b1dca61ec39eee25c0dbc8e7d519ba11bb070918cfacf656","affectsGlobalScope":true,"impliedFormat":1},{"version":"4737a9dc24d0e68b734e6cfbcea0c15a2cfafeb493485e27905f7856988c6b29","affectsGlobalScope":true,"impliedFormat":1},{"version":"36d8d3e7506b631c9582c251a2c0b8a28855af3f76719b12b534c6edf952748d","impliedFormat":1},{"version":"1ca69210cc42729e7ca97d3a9ad48f2e9cb0042bada4075b588ae5387debd318","impliedFormat":1},{"version":"f5ebe66baaf7c552cfa59d75f2bfba679f329204847db3cec385acda245e574e","impliedFormat":1},{"version":"ed59add13139f84da271cafd32e2171876b0a0af2f798d0c663e8eeb867732cf","affectsGlobalScope":true,"impliedFormat":1},{"version":"05db535df8bdc30d9116fe754a3473d1b6479afbc14ae8eb18b605c62677d518","impliedFormat":1},{"version":"b1810689b76fd473bd12cc9ee219f8e62f54a7d08019a235d07424afbf074d25","impliedFormat":1},{"version":"151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d","impliedFormat":1},{"version":"4e741b9c88e80c9e4cedf07b5a698e8e3a3bd73cf649f664d6dd3f868c05c2f3","affectsGlobalScope":true,"impliedFormat":1},{"version":"a660aa95476042d3fdcc1343cf6bb8fdf24772d31712b1db321c5a4dcc325434","impliedFormat":1},{"version":"282f98006ed7fa9bb2cd9bdbe2524595cfc4bcd58a0bb3232e4519f2138df811","impliedFormat":1},{"version":"6222e987b58abfe92597e1273ad7233626285bc2d78409d4a7b113d81a83496b","impliedFormat":1},{"version":"cbe726263ae9a7bf32352380f7e8ab66ee25b3457137e316929269c19e18a2be","impliedFormat":1},{"version":"8b96046bf5fb0a815cba6b0880d9f97b7f3a93cf187e8dcfe8e2792e97f38f87","impliedFormat":99},{"version":"bacf2c84cf448b2cd02c717ad46c3d7fd530e0c91282888c923ad64810a4d511","affectsGlobalScope":true,"impliedFormat":1},{"version":"402e5c534fb2b85fa771170595db3ac0dd532112c8fa44fc23f233bc6967488b","impliedFormat":1},{"version":"8885cf05f3e2abf117590bbb951dcf6359e3e5ac462af1c901cfd24c6a6472e2","impliedFormat":1},{"version":"333caa2bfff7f06017f114de738050dd99a765c7eb16571c6d25a38c0d5365dc","impliedFormat":1},{"version":"e61df3640a38d535fd4bc9f4a53aef17c296b58dc4b6394fd576b808dd2fe5e6","impliedFormat":1},{"version":"459920181700cec8cbdf2a5faca127f3f17fd8dd9d9e577ed3f5f3af5d12a2e4","impliedFormat":1},{"version":"4719c209b9c00b579553859407a7e5dcfaa1c472994bd62aa5dd3cc0757eb077","impliedFormat":1},{"version":"7ec359bbc29b69d4063fe7dad0baaf35f1856f914db16b3f4f6e3e1bca4099fa","impliedFormat":1},{"version":"70790a7f0040993ca66ab8a07a059a0f8256e7bb57d968ae945f696cbff4ac7a","impliedFormat":1},{"version":"d1b9a81e99a0050ca7f2d98d7eedc6cda768f0eb9fa90b602e7107433e64c04c","impliedFormat":1},{"version":"a022503e75d6953d0e82c2c564508a5c7f8556fad5d7f971372d2d40479e4034","impliedFormat":1},{"version":"b215c4f0096f108020f666ffcc1f072c81e9f2f95464e894a5d5f34c5ea2a8b1","impliedFormat":1},{"version":"644491cde678bd462bb922c1d0cfab8f17d626b195ccb7f008612dc31f445d2d","impliedFormat":1},{"version":"dfe54dab1fa4961a6bcfba68c4ca955f8b5bbeb5f2ab3c915aa7adaa2eabc03a","impliedFormat":1},{"version":"1251d53755b03cde02466064260bb88fd83c30006a46395b7d9167340bc59b73","impliedFormat":1},{"version":"47865c5e695a382a916b1eedda1b6523145426e48a2eae4647e96b3b5e52024f","impliedFormat":1},{"version":"4cdf27e29feae6c7826cdd5c91751cc35559125e8304f9e7aed8faef97dcf572","impliedFormat":1},{"version":"331b8f71bfae1df25d564f5ea9ee65a0d847c4a94baa45925b6f38c55c7039bf","impliedFormat":1},{"version":"2a771d907aebf9391ac1f50e4ad37952943515eeea0dcc7e78aa08f508294668","impliedFormat":1},{"version":"0146fd6262c3fd3da51cb0254bb6b9a4e42931eb2f56329edd4c199cb9aaf804","impliedFormat":1},{"version":"183f480885db5caa5a8acb833c2be04f98056bdcc5fb29e969ff86e07efe57ab","impliedFormat":99},{"version":"82e687ebd99518bc63ea04b0c3810fb6e50aa6942decd0ca6f7a56d9b9a212a6","impliedFormat":99},{"version":"7f698624bbbb060ece7c0e51b7236520ebada74b747d7523c7df376453ed6fea","impliedFormat":1},{"version":"8f07f2b6514744ac96e51d7cb8518c0f4de319471237ea10cf688b8d0e9d0225","impliedFormat":1},{"version":"257b83faa134d971c738a6b9e4c47e59bb7b23274719d92197580dd662bfafc3","impliedFormat":99},{"version":"e01ea380015ed698c3c0e2ccd0db72f3fc3ef1abc4519f122aa1c1a8d419a505","impliedFormat":99},{"version":"5ada1f8a9580c0f7478fe03ae3e07e958f0b79bdfb9dd50eeb98c1324f40011b","impliedFormat":99},{"version":"a8301dc90b4bd9fba333226ee0f1681aeeff1bd90233a8f647e687cb4b7d3521","impliedFormat":99},{"version":"e3225dc0bec183183509d290f641786245e6652bc3dce755f7ef404060693c35","impliedFormat":99},{"version":"09a03870ed8c55d7453bc9ad684df88965f2f770f987481ca71b8a09be5205bc","impliedFormat":99},{"version":"e6233e1c976265e85aa8ad76c3881febe6264cb06ae3136f0257e1eab4a6cc5a","impliedFormat":99},{"version":"2cdd50ddc49e2d608ee848fc4ab0db9a2716624fabb4209c7c683d87e54d79c5","impliedFormat":99},{"version":"e431d664338b8470abb1750d699c7dfcebb1a25434559ef85bb96f1e82de5972","impliedFormat":99},{"version":"2c4254139d037c3caca66ce291c1308c1b5092cfcb151eb25980db932dd3b01a","impliedFormat":99},{"version":"970ae00ed018cb96352dc3f37355ef9c2d9f8aa94d7174ccd6d0ed855e462097","impliedFormat":99},{"version":"d2f8dee457ef7660b604226d471d55d927c3051766bdd80353553837492635c3","impliedFormat":99},{"version":"110a503289a2ef76141ffff3ffceb9a1c3662c32748eb9f6777a2bd0866d6fb1","impliedFormat":99},{"version":"69bf2422313487956e4dacf049f30cb91b34968912058d244cb19e4baa24da97","impliedFormat":99},{"version":"310e6b62c493ce991624169a1c1904015769d947be88dc67e00adc7ebebcfa87","impliedFormat":99},{"version":"62fefda288160bf6e435b21cc03d3fbac11193d8d3bd0e82d86623cca7691c29","impliedFormat":99},{"version":"fcc46a8bcbf9bef21023bba1995160a25f0bc590ca3563ec44c315b4f4c1b18a","impliedFormat":99},{"version":"0309a01650023994ed96edbd675ea4fdc3779a823ce716ad876cc77afb792b62","impliedFormat":99},{"version":"f13d7beeea58e219daef3a40e0dc4f2bd7d9581ac04cedec236102a12dfd2090","impliedFormat":99},{"version":"669573548930fb7d0a0761b827e203dc623581e21febf0be80fb02414f217d74","impliedFormat":99},{"version":"48c411efce1848d1ed55de41d7deb93cbf7c04080912fd87aa517ed25ef42639","affectsGlobalScope":true,"impliedFormat":1},{"version":"a094636c05f3e75cb072684dd42cd25a4c1324bec4a866706c85c04cecd49613","affectsGlobalScope":true,"impliedFormat":99},{"version":"fe2d63fcfdde197391b6b70daf7be8c02a60afa90754a5f4a04bdc367f62793d","impliedFormat":99},{"version":"9a3e2c85ec1ab7a0874a19814cc73c691b716282cb727914093089c5a8475955","impliedFormat":99},{"version":"cbdc781d2429935c9c42acd680f2a53a9f633e8de03290ec6ea818e4f7bff19a","impliedFormat":99},{"version":"9f6d9f5dd710922f82f69abf9a324e28122b5f31ae6f6ce78427716db30a377e","impliedFormat":99},{"version":"ac2414a284bdecfd6ab7b87578744ab056cd04dd574b17853cd76830ef5b72f2","impliedFormat":99},{"version":"c3f921bbc9d2e65bd503a56fbc66da910e68467baedb0b9db0cc939e1876c0d7","impliedFormat":99},{"version":"c30a41267fc04c6518b17e55dcb2b810f267af4314b0b6d7df1c33a76ce1b330","impliedFormat":1},{"version":"72422d0bac4076912385d0c10911b82e4694fc106e2d70added091f88f0824ba","impliedFormat":1},{"version":"da251b82c25bee1d93f9fd80c5a61d945da4f708ca21285541d7aff83ecb8200","impliedFormat":1},{"version":"64db14db2bf37ac089766fdb3c7e1160fabc10e9929bc2deeede7237e4419fc8","impliedFormat":1},{"version":"98b94085c9f78eba36d3d2314affe973e8994f99864b8708122750788825c771","impliedFormat":1},{"version":"0cc99fbb161d78729d71fad66c6c363e3095862d6277160f29fa960744b785c6","affectsGlobalScope":true,"impliedFormat":99},{"version":"4025a454b1ca489b179ee8c684bdd70ff8c1967e382076ade53e7e4653e1daec","affectsGlobalScope":true,"impliedFormat":1},{"version":"984c09345059b76fc4221c2c54e53511f4c27a0794dfd6e9f81dc60f0b564e05","affectsGlobalScope":true,"impliedFormat":99},{"version":"d16eefaeb68e5d6c128e4fee54d29519d5fe47db91e3d083dc4807e8a139d6c3","signature":"27873131c3918c7bf3bb8d69d3e470c4aebee819aa3dbcdc6e0c32e47c6729eb"},"db563d16ea1053488f3fd253cc7be07b86c3ecbe3143c0ff22884a2e9011c867",{"version":"4ccde82977fd9316073e05e7be6975a36269691b9808ed5766083e3c4ef30c74","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},"0b061ec64d1d645533fadd2755063dd4fdc9e79b68dd47e2839fc7e5c5ecb5c6","00c09cdb0c53827f22ba264a5f0183d9434e253259aa4124776200484c297d6a","dc83c887e9cf5e9b3b88b48ead7d6d7cf06189fac2057a5bc771e575cc1d0abc","128423b1da758c9ca578e2294a723272a3bfefe0411df8eafe6ef9b8997077f4",{"version":"5574d520dabc450de6be799f1791d86d71da4fb236f16e6ca21b953788bb5154","impliedFormat":1},{"version":"5f877dfc985d1fd3ac8bf4a75cd77b06c42ca608809b324c44b4151758de7189","affectsGlobalScope":true,"impliedFormat":1},{"version":"4f585cea32567574de0301ed79131a4c3d0bb36bbfea7f66e2f29b5dce1c4293","affectsGlobalScope":true,"impliedFormat":1},{"version":"14c2fd6220654a41c53836a62ba96d4b515ae1413b0ccb31c2445fb1ae1de5de","affectsGlobalScope":true,"impliedFormat":1},{"version":"4f29c38739500cd35a2ce41d15a35e34445ca755ebb991915b5f170985a49d21","affectsGlobalScope":true,"impliedFormat":1},{"version":"657a835fdaa46669e34835b2c95cd4141869f2348b0ec5d104597ced25ffec70","affectsGlobalScope":true,"impliedFormat":1}],"root":[[242,248]],"options":{"declaration":true,"declarationMap":true,"esModuleInterop":true,"jsx":4,"module":99,"noFallthroughCasesInSwitch":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"referencedMap":[[244,1],[243,2],[246,3],[247,4],[245,5],[248,6],[242,7],[251,8],[250,9],[254,10],[175,8],[253,11],[252,8],[249,8],[123,12],[124,12],[125,13],[79,14],[126,15],[127,16],[128,17],[74,8],[77,18],[75,8],[76,8],[129,19],[130,20],[131,21],[132,22],[133,23],[134,24],[135,24],[136,25],[137,26],[138,27],[139,28],[80,8],[78,8],[140,29],[141,30],[142,31],[174,32],[143,33],[144,34],[145,35],[146,36],[147,37],[148,38],[149,39],[150,40],[151,41],[152,42],[153,42],[154,43],[155,8],[156,44],[158,45],[157,46],[159,47],[160,48],[161,49],[162,50],[163,51],[164,52],[165,53],[166,54],[167,55],[168,56],[169,57],[170,58],[171,59],[81,8],[82,8],[83,8],[122,60],[172,61],[173,62],[226,8],[227,63],[228,64],[231,65],[230,8],[61,8],[72,66],[67,67],[70,68],[218,69],[207,8],[210,70],[209,71],[221,71],[208,72],[229,8],[69,73],[71,73],[63,74],[66,75],[215,74],[68,76],[62,8],[60,8],[84,8],[182,8],[236,77],[238,78],[237,79],[235,80],[234,8],[199,81],[197,82],[198,83],[186,84],[187,82],[194,85],[185,86],[190,87],[200,8],[191,88],[196,89],[202,90],[201,91],[184,92],[192,93],[193,94],[188,95],[195,81],[189,96],[177,97],[176,98],[183,8],[219,8],[64,8],[65,99],[58,8],[59,8],[10,8],[11,8],[13,8],[12,8],[2,8],[14,8],[15,8],[16,8],[17,8],[18,8],[19,8],[20,8],[21,8],[3,8],[22,8],[23,8],[4,8],[24,8],[28,8],[25,8],[26,8],[27,8],[29,8],[30,8],[31,8],[5,8],[32,8],[33,8],[34,8],[35,8],[6,8],[39,8],[36,8],[37,8],[38,8],[40,8],[7,8],[41,8],[46,8],[47,8],[42,8],[43,8],[44,8],[45,8],[8,8],[51,8],[48,8],[49,8],[50,8],[52,8],[9,8],[53,8],[54,8],[55,8],[57,8],[56,8],[1,8],[100,100],[110,101],[99,100],[120,102],[91,103],[90,104],[119,105],[113,106],[118,107],[93,108],[107,109],[92,110],[116,111],[88,112],[87,105],[117,113],[89,114],[94,115],[95,8],[98,115],[85,8],[121,116],[111,117],[102,118],[103,119],[105,120],[101,121],[104,122],[114,105],[96,123],[97,124],[106,125],[86,126],[109,117],[108,115],[112,8],[115,127],[216,128],[213,129],[214,128],[217,130],[212,8],[241,131],[206,132],[203,133],[181,134],[179,135],[178,8],[180,136],[204,8],[240,137],[205,138],[220,139],[211,140],[73,8],[232,141],[222,142],[233,143],[225,144],[224,145],[223,146],[239,147]],"affectedFilesPendingEmit":[[244,51],[243,48],[246,48],[247,48],[245,48],[248,48],[242,51]],"version":"5.9.3"} \ No newline at end of file