Showing preview only (689K chars total). Download the full file or copy to clipboard to get everything.
Repository: didoo/figma-api
Branch: main
Commit: bf0ce724f21d
Files: 30
Total size: 668.6 KB
Directory structure:
gitextract_gr09jd2o/
├── .github/
│ └── copilot-instructions.md
├── .gitignore
├── .npmignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── jest.config.js
├── lib/
│ ├── api-class.d.ts
│ ├── api-class.js
│ ├── api-endpoints.d.ts
│ ├── api-endpoints.js
│ ├── config.d.ts
│ ├── config.js
│ ├── figma-api.js
│ ├── index.d.ts
│ ├── index.js
│ ├── utils.d.ts
│ └── utils.js
├── package.json
├── src/
│ ├── api-class.ts
│ ├── api-endpoints.ts
│ ├── config.ts
│ ├── index.ts
│ └── utils.ts
├── tests/
│ ├── api-class.test.ts
│ ├── api-endpoints.test.ts
│ ├── config.test.ts
│ ├── index.test.ts
│ └── utils.test.ts
└── tsconfig.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/copilot-instructions.md
================================================
# Copilot Instructions for figma-api
## Project Overview
This is a TypeScript library that provides a thin, fully-typed wrapper around the [Figma REST API](https://www.figma.com/developers/api). The library supports both Node.js and browser environments.
## Key Architecture
- **Source**: TypeScript files in `src/` directory
- **Output**: Compiled JavaScript in `lib/` directory
- **Types**: Uses official `@figma/rest-api-spec` for complete type safety
- **HTTP Client**: Axios v1.12.2 for making API requests
- **Build**: esbuild for fast compilation with multiple targets (Node.js, browser, minified)
- **Testing**: Jest with TypeScript support and comprehensive test coverage
## Core Files
- `src/api-class.ts` - Main API class with authentication and method bindings
- `src/api-endpoints.ts` - Individual endpoint implementations following Figma API structure
- `src/config.ts` - API domain and version constants
- `src/utils.ts` - Utility functions for query parameters and requests
- `src/index.ts` - Main entry point, exports public API
- `tests/` - Jest test suite for all source files
- `jest.config.js` - Jest configuration for TypeScript testing
## Development Guidelines
### Code Style
- Use TypeScript strict mode (already configured)
- Follow existing naming conventions (camelCase for methods, PascalCase for types)
- Import types from `@figma/rest-api-spec` - do NOT create custom types for API responses
- Use arrow functions for endpoint method bindings in `Api` class
- Keep endpoint implementations pure functions that return `this.request()` calls
### API Endpoint Pattern
```typescript
export function getExampleApi(
this: ApiClass,
pathParams: FigmaRestAPI.GetExamplePathParams,
queryParams?: FigmaRestAPI.GetExampleQueryParams
): Promise<FigmaRestAPI.GetExampleResponse> {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/endpoint/${pathParams.id}?${encodedQueryParams}`);
}
```
### Adding New Endpoints
1. Add the endpoint function to `src/api-endpoints.ts` following the pattern above
2. Export the function at the top of the file
3. Add method binding in `src/api-class.ts` using arrow function syntax
4. Group by API category with comments (Files, Comments, Users, etc.)
5. Include the official Figma API documentation link in comments
6. Write comprehensive tests in `tests/api-endpoints.test.ts` for the new endpoint
7. Ensure the new endpoint follows the existing error handling patterns
### Authentication
- Support both Personal Access Tokens and OAuth tokens
- Use the existing authentication helper methods in `Api` class
- Headers are automatically populated by `appendHeaders()` method
### Building & Testing
- Run `npm run build` to compile for all targets (Node.js, browser, minified)
- `npm run build:node` - Build for Node.js environment using esbuild
- `npm run build:browser` - Build for browser as IIFE with global `Figma` object
- `npm run build:browser:min` - Build minified browser version
- Run `npm test` to execute the Jest test suite
- `npm run test:watch` - Run tests in watch mode for development
- `npm run test:coverage` - Generate test coverage reports
- All builds use esbuild for fast compilation and bundling
- Tests are written in TypeScript and located in the `tests/` directory
### Development Workflow
- Use TypeScript strict mode for all development
- Run `npm test` during development to ensure changes don't break existing functionality
- Use `npm run test:watch` for real-time testing during development
- Run builds frequently to catch compilation issues early: `npm run build`
- Use the existing patterns consistently - don't create new patterns
- When in doubt, follow the Figma REST API documentation exactly
- Check `lib/` output after builds to ensure proper compilation
- Write tests for new functionality in the `tests/` directory following existing patterns
### Tool Configuration
- **esbuild** handles all compilation and bundling (replaced TypeScript + Browserify)
- **Jest** configuration in `jest.config.js` with ts-jest preset for TypeScript testing
- TypeScript config in `tsconfig.json` targets ES5 with CommonJS modules
- Test files should be placed in `tests/` directory with `.test.ts` extension
- Coverage reports generated in `coverage/` directory
- Use `@figma/rest-api-spec` types exclusively - never create custom API types
### Version Alignment
- This library stays in sync with official Figma REST API specifications
- Types come from `@figma/rest-api-spec` package - update that package for new API features
- Endpoint URLs and parameters must match official Figma documentation exactly
## Important Notes
- This is version 2.x which is a complete rewrite from 1.x for API alignment
- All endpoint methods use object parameters (pathParams, queryParams, requestBody)
- The library is designed to be a thin wrapper - avoid adding business logic
- Browser and Node.js compatibility is maintained through build process
- Keep the public API surface minimal and focused on REST API exposure
### Security & Dependencies
- Check for vulnerabilities before adding new dependencies: `npm audit`
- Keep dependencies minimal and focused on the library's core purpose
- When adding dependencies, verify they're well-maintained and trusted
- Address security vulnerabilities promptly but carefully to avoid breaking changes
### Error Handling
- API errors should be handled consistently using the existing error patterns
- Preserve error information from the Figma API in responses
- Use TypeScript's strict typing to catch errors at compile time
- Handle network errors gracefully in the request utility functions
### File Management
- Exclude build artifacts from version control (already configured in `.gitignore`)
- Keep the source in `src/` and compiled output in `lib/`
- Place all tests in `tests/` directory with `.test.ts` extension
- Don't commit `node_modules`, `playground`, `coverage/`, or temporary files
- Use `.npmignore` to control what gets published to npm
- Test coverage reports are generated in `coverage/` directory
## When Making Changes
1. Write or update tests first: `npm test` (Test-Driven Development approach)
2. Ensure TypeScript compilation succeeds: `npm run build`
3. Run the full test suite to ensure no regressions: `npm test`
4. Verify all build targets work correctly (Node.js, browser, minified)
5. Check test coverage is maintained: `npm run test:coverage`
6. Check that new endpoints follow the established patterns
7. Update documentation in README.md if adding major new functionality
8. Maintain backward compatibility within major version
9. Run `npm audit` to check for security vulnerabilities
10. Test both Node.js and browser environments when possible
================================================
FILE: .gitignore
================================================
/node_modules
/playground
/.idea
/coverage
================================================
FILE: .npmignore
================================================
playground
src
node_modules
tsconfig.json
================================================
FILE: CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.2.0-beta] - 2026-04-22
### Added
- Added missing `GetFileMeta` endpoint
### Changed
- Widened `@figma/rest-api-spec` dependency range to `>=0.37.0 <1.0.0` (floor bumped from `0.27.0` to `0.37.0`, which is the current latest release,
## [v2.1.4-beta] - 2026-04-22
### Changed
- Expanded OAuth scope support to granular and multi-scope values
### Fixed
- Updated `toQueryParams` utility function to preserve explicit `false`/`0` query values
## [v2.1.3-beta] - 2026-04-22
### Changed
- Updated `minimatch` from `9.0.5` to `9.0.9`
- Updated `picomatch` from `4.0.3` to `4.0.4`
- Bumped `handlebars` from `4.7.8` to `4.7.9`
- Bumped `axios` from `1.13.5` to `1.15.0`
- Bumped `follow-redirects` from `1.15.11` to `1.16.0`
## [v2.1.2-beta] - 2026-02-16
### Changed
- Properly upgraded Axios from `1.12.2` to `1.13.5` (before an issue with dependabot didn't upgrade it in `package.json`)
## [v2.1.1-beta] - 2026-02-13
### Changed
- Upgraded `js-yaml` from `3.14.1` to `3.14.2`
- Upgraded Axios from `1.12.2` to `1.13.5` (note: incorrect upgrade)
- Fixed vulnerabilities singaled by npm
## [v2.1.0-beta] - 2025-10-08
### Added
- Comprehensive Jest testing suite for TypeScript source files
- Copilot instructions for repository development guidance
- Enhanced error handling with custom `ApiError` class
### Changed
- Migrated build system from browserify to esbuild for modern bundling
- Upgraded Axios from v0.27.2 to v1.12.2
- Split build commands into meaningful sub-commands (`build:node`, `build:browser`, `build:browser:min`)
- Updated TypeScript configuration to explicitly include `src` folder
### Fixed
- Package.json dependencies structure - moved `axios` and `@figma/rest-api-spec` to `dependencies`
- Fixed failing tests to work with enhanced ApiError implementation
## [v2.0.2-beta] - 2025-04-16
### Changed
- Dependencies maintenance and security updates
- Bumped `@figma/rest-api-spec` to v0.27.0
- Bumped `@types/node` to v22.14.1
- Bumped `typescript` to v5.8.3
- Bumped `uglifyify` to v5.0.2
### Fixed
- Fixed wrong path for `getPublishedVariablesApi` endpoint
- TypeScript compilation issues resolved
### Security
- Updated multiple dependency versions to address security vulnerabilities
- Bumped elliptic from 6.6.0 to 6.6.1
- Updated sha.js, pbkdf2, cipher-base, and form-data
## [v2.0.1-beta] - 2024-11-06
### Added
- Updated exported endpoints in main library
- Enhanced README documentation
### Changed
- Updated comment documentation
- Renamed readme.md to README.md for consistency
## [v2.0.0-beta] - 2024-11-05
### Added
- **BREAKING CHANGE**: Complete refactoring to align with official Figma REST API specifications
- Integration with `@figma/rest-api-spec` for type safety and API alignment
- All missing endpoints from the official Figma API added
- OAuth authentication improvements following new Figma specifications
- Analytics endpoints support
- Variables endpoints support
- Dev Resources endpoints support
- Enhanced webhooks support (v2 API)
### Changed
- **BREAKING CHANGE**: All endpoint methods now use object parameters (`pathParams`, `queryParams`, `requestBody`)
- **BREAKING CHANGE**: Method signatures completely restructured to match official API
- Library now acts as a thin wrapper around the official Figma REST API
- Package metadata updated to reflect v2.0 changes
- Types now sourced directly from `@figma/rest-api-spec`
### Security
- Updated OAuth token exchange method according to new Figma specifications
---
## Migration Guide: v1.x to v2.x
Version 2.0 represents a complete rewrite of the library to align with the official Figma REST API specifications. Here are the key breaking changes:
### Method Signatures
**Before (v1.x):**
```javascript
api.getFile(fileKey, { version, ids, depth, geometry, plugin_data, branch_data })
```
**After (v2.x):**
```javascript
api.getFile(
{ file_key: fileKey }, // pathParams
{ version, ids, depth, geometry, plugin_data, branch_data } // queryParams
)
```
### Authentication
OAuth authentication has been updated to follow the new Figma specifications. The `oAuthToken` method signature has changed.
### Benefits of v2.x
- Full type safety with official Figma API types
- Complete API coverage with all endpoints
- Future-proof alignment with Figma's specifications
- Better error handling and debugging
For detailed migration instructions, please refer to the [README.md](README.md) file.
---
## [v1.12.0] - 2024-11-05
### Added
- Missing properties in API response types
- Section type support
- New types from Figma REST API documentation
- Component sets support in API responses
### Changed
- Updated dependencies including axios to v0.28.0
- Made `getImageApi` scale parameter optional
### Fixed
- Missing fields in `GetFileResult` type
- Scale and format parameters now properly optional in image API
### Security
- Updated browserify-sign from 4.0.4 to 4.2.3
- Updated elliptic from 6.5.4 to 6.6.0
- Updated follow-redirects from 1.14.8 to 1.15.9
- Updated minimatch from 3.0.4 to 3.1.2
## [v1.11.0] - 2022-10-29
### Added
- Autolayout v4 properties support
- Improved `getFileNodesApi` response type
- Enhanced type definitions for various API responses
### Fixed
- Minor type issues in API definitions
- Updated `file.components` type definition
### Security
- Bumped shell-quote from 1.6.1 to 1.7.3
- Bumped minimist and mkdirp dependencies for security
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2020 Morglod
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
[](https://www.npmjs.com/package/figma-api)
> [!IMPORTANT]
> **Version 2.0 Beta** - This version is a complete rewrite of the library, based on the [Figma REST API specifications](https://github.com/figma/rest-api-spec). Many endpoint methods have been renamed from version 1.x, and all the endpoint methods' arguments now match the [Figma REST API](https://www.figma.com/developers/api) documentation. If you were using the previous version, and intend to use the new one, **you will have to update your code accordingly**. The good news is that from now on they should always remain in sync, so no major disruptions in the future, with the benefit of a full alignment with the official Figma REST API documentation and specifications.
# figma-api
JavaScript client-side implementation of the [Figma REST API](https://www.figma.com/developers/api#intro).
Thin layer on top of the official [Figma REST API specifications](https://github.com/figma/rest-api-spec), fully typed with TypeScript, uses Promises (via [Axios](https://github.com/axios/axios)) & ES6.
Supports both browser & Node.js implementations.
## Install
`npm i figma-api`
or browser version:
`https://raw.githubusercontent.com/didoo/figma-api/master/lib/figma-api.js`
`https://raw.githubusercontent.com/didoo/figma-api/master/lib/figma-api.min.js`
If you have CORS limitation, import the `figma-api[.min].js` file in your codebase via the npm package.
## Usage
In a Node.js script:
```ts
import * as Figma from 'figma-api';
export async function main() {
const api = new Figma.Api({
personalAccessToken: 'my-token',
});
const file = await api.getFile({ file_key: 'my-file-key'});
// ... access file data ...
}
```
In a browser script:
```js
const api = new Figma.Api({ personalAccessToken: 'my-personal-access-token' });
api.getFile({ file_key: 'my-file-key'}).then((file) => {
// access file data
});
```
In this case, the `Figma` object is gloabl and all the API methods are associated with it.
## Api
We have followed the same organisation as the official [Figma API documentation](https://www.figma.com/developers/api) to describe our API methods, so it's easier to find the exact endpoint call you are looking for.
### Authentication
```ts
new Api ({ personalAccessToken, oAuthToken })
```
Creates new Api object with specified `personalAccessToken` or `oAuthToken`. For details about how to get these tokens, [see the documentation](https://www.figma.com/developers/api#authentication)
```ts
function oAuthLink(
client_id: string,
redirect_uri: string,
scope: string | string[],
state: string,
response_type: 'code',
): string;
```
Returns link for OAuth auth flow. `scope` can be a single scope string (for example `file_content:read`) or an array of scope strings for multiple permissions. Users should open this link, allow access and they will be redirected to `redirect_uri?code=<code>`. Then they should use `oAuthToken` method to get an access token.
```ts
function oAuthToken(
client_id: string,
client_secret: string,
redirect_uri: string,
code: string,
grant_type: 'authorization_code',
): Promise<{
access_token: string,
refresh_token: string,
expires_in: number,
}>
```
Returns the access token from oauth code (see `oAuthLink` method).
Other helpers:
- `Api.appendHeaders(headers)` - Populate headers with auth.
- `Api.request(url, opts)` - Make request with auth headers.
### Endpoints
All these endpoints methods receive objects like `pathParams`, `queryParams`, `requestBody`, as arguments, and return a Promise. For details about the shape of these objects refer to the official Figma REST API documentation (see links below).
> [!IMPORTANT]
> Version 2.x differs considerably from version 1.x in that the arguments of the API endpoint methods are _always_ contained in these objects, while before they were passed singularly as values directly to the function.
#### Files
See: https://www.figma.com/developers/api#files-endpoints
- `Api.getFile(pathParams,queryParams)`
- `Api.getFileNodes(pathParams,queryParams)`
- `Api.getImages(pathParams,queryParams)`
- `Api.getImageFills(pathParams)`
#### Comments
See: https://www.figma.com/developers/api#comments-endpoints
- `Api.getComments(pathParams)`
- `Api.postComment(pathParams,requestBody)`
- `Api.deleteComment(pathParams)`
- `Api.getCommentReactions(pathParams,queryParams)`
- `Api.postCommentReaction(pathParams,requestBody)`
- `Api.deleteCommentReactions(pathParams)`
#### Users
See: https://www.figma.com/developers/api#users-endpoints
- `Api.getUserMe()`
#### Version History (File Versions)
See: https://www.figma.com/developers/api#version-history-endpoints
- `Api.getFileVersions(pathParams)`
#### Projects
See: https://www.figma.com/developers/api#projects-endpoints
- `Api.getTeamProjects(pathParams)`
- `Api.getProjectFiles(pathParams,queryParams)`
#### Components and Styles (Library Items)
See: https://www.figma.com/developers/api#library-items-endpoints
- `Api.getTeamComponents(pathParams,queryParams)`
- `Api.getFileComponents(pathParams)`
- `Api.getComponent(pathParams)`
- `Api.getTeamComponentSets(pathParams,queryParams)`
- `Api.getFileComponentSets(pathParams)`
- `Api.getComponentSet(pathParams)`
- `Api.getTeamStyles(pathParams,queryParams)`
- `Api.getFileStyles(pathParams)`
- `Api.getStyle(pathParams)`
#### Webhooks
See: https://www.figma.com/developers/api#webhooks_v2
- `Api.getWebhook(pathParams)`
- `Api.postWebhook(requestBody)`
- `Api.putWebhook(pathParams,requestBody)`
- `Api.deleteWebhook(pathParams)`
- `Api.getTeamWebhooks(pathParams)`
- `Api.getWebhookRequests(pathParams)`
#### Activity Logs
See: https://www.figma.com/developers/api#activity-logs-endpoints
> [!TIP]
> [TODO] Open to contributions if someone is needs to use these endpoints
#### Payments
See: https://www.figma.com/developers/api#payments-endpoints
> [!TIP]
> [TODO] Open to contributions if someone is needs to use these endpoints
#### Variables
> [!NOTE]
> These APIs are available only to full members of Enterprise orgs.
See: https://www.figma.com/developers/api#variables-endpoints
- `Api.getLocalVariables(pathParams)`
- `Api.getPublishedVariables(pathParams)`
- `Api.postVariables(pathParams,requestBody)`
#### Dev Resources
See: https://www.figma.com/developers/api#dev-resources-endpoints
- `Api.getDevResources(pathParams,queryParams)`
- `Api.postDevResources(requestBody)`
- `Api.putDevResources(requestBody)`
- `Api.deleteDevResources(pathParams)`
#### Analytics
See: https://www.figma.com/developers/api#library-analytics-endpoints
- `Api.getLibraryAnalyticsComponentActions(pathParams,queryParams)`
- `Api.getLibraryAnalyticsComponentUsages(pathParams,queryParams)`
- `Api.getLibraryAnalyticsStyleActions(pathParams,queryParams)`
- `Api.getLibraryAnalyticsStyleUsages(pathParams,queryParams)`
- `Api.getLibraryAnalyticsVariableActions(pathParams,queryParams)`
- `Api.getLibraryAnalyticsVariableUsages(pathParams,queryParams)`
## Types
The library is fully typed using the official [Figma REST API specifications](https://github.com/figma/rest-api-spec). You can see those types in the generated file here: https://github.com/figma/rest-api-spec/blob/main/dist/api_types.ts.
Alternatively, you can refer to the official Figma REST API documentation (see links above).
---
## Development
```
git clone https://github.com/didoo/figma-api.git
cd figma-api
git checkout main
npm install
npm run build
```
## Testing
```
npm run test
```
## Release
```
npm version [<newversion> | major | minor | patch]
#if not yet logged in
npm login
npm publish
```
(notice: tags are created automatically after a few minutes from the publishing)
================================================
FILE: jest.config.js
================================================
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/tests'],
testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
transform: {
'^.+\\.ts$': 'ts-jest',
},
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
};
================================================
FILE: lib/api-class.d.ts
================================================
import * as ApiEndpoints from './api-endpoints';
import { ApiRequestMethod } from './utils';
export declare class Api {
personalAccessToken?: string;
oAuthToken?: string;
constructor(params: {
personalAccessToken: string;
} | {
oAuthToken: string;
});
appendHeaders: (headers: {
[x: string]: string;
}) => void;
request: ApiRequestMethod;
getFile: typeof ApiEndpoints.getFileApi;
getFileNodes: typeof ApiEndpoints.getFileNodesApi;
getImages: typeof ApiEndpoints.getImagesApi;
getImageFills: typeof ApiEndpoints.getImageFillsApi;
getComments: typeof ApiEndpoints.getCommentsApi;
postComment: typeof ApiEndpoints.postCommentApi;
deleteComment: typeof ApiEndpoints.deleteCommentApi;
getCommentReactions: typeof ApiEndpoints.getCommentReactionsApi;
postCommentReaction: typeof ApiEndpoints.postCommentReactionApi;
deleteCommentReactions: typeof ApiEndpoints.deleteCommentReactionsApi;
getUserMe: typeof ApiEndpoints.getUserMeApi;
getFileVersions: typeof ApiEndpoints.getFileVersionsApi;
getTeamProjects: typeof ApiEndpoints.getTeamProjectsApi;
getProjectFiles: typeof ApiEndpoints.getProjectFilesApi;
getTeamComponents: typeof ApiEndpoints.getTeamComponentsApi;
getFileComponents: typeof ApiEndpoints.getFileComponentsApi;
getComponent: typeof ApiEndpoints.getComponentApi;
getTeamComponentSets: typeof ApiEndpoints.getTeamComponentSetsApi;
getFileComponentSets: typeof ApiEndpoints.getFileComponentSetsApi;
getComponentSet: typeof ApiEndpoints.getComponentSetApi;
getTeamStyles: typeof ApiEndpoints.getTeamStylesApi;
getFileStyles: typeof ApiEndpoints.getFileStylesApi;
getStyle: typeof ApiEndpoints.getStyleApi;
getWebhook: typeof ApiEndpoints.getWebhookApi;
postWebhook: typeof ApiEndpoints.postWebhookApi;
putWebhook: typeof ApiEndpoints.putWebhookApi;
deleteWebhook: typeof ApiEndpoints.deleteWebhookApi;
getTeamWebhooks: typeof ApiEndpoints.getTeamWebhooksApi;
getWebhookRequests: typeof ApiEndpoints.getWebhookRequestsApi;
getLocalVariables: typeof ApiEndpoints.getLocalVariablesApi;
getPublishedVariables: typeof ApiEndpoints.getPublishedVariablesApi;
postVariables: typeof ApiEndpoints.postVariablesApi;
getDevResources: typeof ApiEndpoints.getDevResourcesApi;
postDevResources: typeof ApiEndpoints.postDevResourcesApi;
putDevResources: typeof ApiEndpoints.putDevResourcesApi;
deleteDevResources: typeof ApiEndpoints.deleteDevResourcesApi;
getLibraryAnalyticsComponentActions: typeof ApiEndpoints.getLibraryAnalyticsComponentActionsApi;
getLibraryAnalyticsComponentUsages: typeof ApiEndpoints.getLibraryAnalyticsComponentUsagesApi;
getLibraryAnalyticsStyleActions: typeof ApiEndpoints.getLibraryAnalyticsStyleActionsApi;
getLibraryAnalyticsStyleUsages: typeof ApiEndpoints.getLibraryAnalyticsStyleUsagesApi;
getLibraryAnalyticsVariableActions: typeof ApiEndpoints.getLibraryAnalyticsVariableActionsApi;
getLibraryAnalyticsVariableUsages: typeof ApiEndpoints.getLibraryAnalyticsVariableUsagesApi;
}
export declare function oAuthLink(client_id: string, redirect_uri: string, scope: 'file_read', state: string, response_type: 'code'): string;
type OAuthTokenResponseData = {
user_id: string;
access_token: string;
refresh_token: string;
expires_in: number;
};
export declare function oAuthToken(client_id: string, client_secret: string, redirect_uri: string, code: string, grant_type: 'authorization_code'): Promise<OAuthTokenResponseData>;
export {};
================================================
FILE: lib/api-class.js
================================================
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Api = void 0;
exports.oAuthLink = oAuthLink;
exports.oAuthToken = oAuthToken;
var ApiEndpoints = __importStar(require("./api-endpoints"));
var utils_1 = require("./utils");
var axios_1 = __importDefault(require("axios"));
var Api = /** @class */ (function () {
function Api(params) {
var _this = this;
this.appendHeaders = function (headers) {
if (_this.personalAccessToken)
headers['X-Figma-Token'] = _this.personalAccessToken;
if (_this.oAuthToken)
headers['Authorization'] = "Bearer ".concat(_this.oAuthToken);
};
this.request = function (url, opts) { return __awaiter(_this, void 0, void 0, function () {
var headers, axiosParams, res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
headers = {};
this.appendHeaders(headers);
axiosParams = __assign(__assign({ url: url }, opts), { headers: headers });
return [4 /*yield*/, (0, axios_1.default)(axiosParams)];
case 1:
res = _a.sent();
if (Math.floor(res.status / 100) !== 2)
throw res.statusText;
return [2 /*return*/, res.data];
}
});
}); };
this.getFile = ApiEndpoints.getFileApi;
this.getFileNodes = ApiEndpoints.getFileNodesApi;
this.getImages = ApiEndpoints.getImagesApi;
this.getImageFills = ApiEndpoints.getImageFillsApi;
this.getComments = ApiEndpoints.getCommentsApi;
this.postComment = ApiEndpoints.postCommentApi;
this.deleteComment = ApiEndpoints.deleteCommentApi;
this.getCommentReactions = ApiEndpoints.getCommentReactionsApi;
this.postCommentReaction = ApiEndpoints.postCommentReactionApi;
this.deleteCommentReactions = ApiEndpoints.deleteCommentReactionsApi;
this.getUserMe = ApiEndpoints.getUserMeApi;
this.getFileVersions = ApiEndpoints.getFileVersionsApi;
this.getTeamProjects = ApiEndpoints.getTeamProjectsApi;
this.getProjectFiles = ApiEndpoints.getProjectFilesApi;
this.getTeamComponents = ApiEndpoints.getTeamComponentsApi;
this.getFileComponents = ApiEndpoints.getFileComponentsApi;
this.getComponent = ApiEndpoints.getComponentApi;
this.getTeamComponentSets = ApiEndpoints.getTeamComponentSetsApi;
this.getFileComponentSets = ApiEndpoints.getFileComponentSetsApi;
this.getComponentSet = ApiEndpoints.getComponentSetApi;
this.getTeamStyles = ApiEndpoints.getTeamStylesApi;
this.getFileStyles = ApiEndpoints.getFileStylesApi;
this.getStyle = ApiEndpoints.getStyleApi;
this.getWebhook = ApiEndpoints.getWebhookApi;
this.postWebhook = ApiEndpoints.postWebhookApi;
this.putWebhook = ApiEndpoints.putWebhookApi;
this.deleteWebhook = ApiEndpoints.deleteWebhookApi;
this.getTeamWebhooks = ApiEndpoints.getTeamWebhooksApi;
this.getWebhookRequests = ApiEndpoints.getWebhookRequestsApi;
this.getLocalVariables = ApiEndpoints.getLocalVariablesApi;
this.getPublishedVariables = ApiEndpoints.getPublishedVariablesApi;
this.postVariables = ApiEndpoints.postVariablesApi;
this.getDevResources = ApiEndpoints.getDevResourcesApi;
this.postDevResources = ApiEndpoints.postDevResourcesApi;
this.putDevResources = ApiEndpoints.putDevResourcesApi;
this.deleteDevResources = ApiEndpoints.deleteDevResourcesApi;
this.getLibraryAnalyticsComponentActions = ApiEndpoints.getLibraryAnalyticsComponentActionsApi;
this.getLibraryAnalyticsComponentUsages = ApiEndpoints.getLibraryAnalyticsComponentUsagesApi;
this.getLibraryAnalyticsStyleActions = ApiEndpoints.getLibraryAnalyticsStyleActionsApi;
this.getLibraryAnalyticsStyleUsages = ApiEndpoints.getLibraryAnalyticsStyleUsagesApi;
this.getLibraryAnalyticsVariableActions = ApiEndpoints.getLibraryAnalyticsVariableActionsApi;
this.getLibraryAnalyticsVariableUsages = ApiEndpoints.getLibraryAnalyticsVariableUsagesApi;
if ('personalAccessToken' in params) {
this.personalAccessToken = params.personalAccessToken;
}
if ('oAuthToken' in params) {
this.oAuthToken = params.oAuthToken;
}
}
return Api;
}());
exports.Api = Api;
// see: https://www.figma.com/developers/api#auth-oauth2
function oAuthLink(client_id, redirect_uri, scope, state, response_type) {
var queryParams = (0, utils_1.toQueryParams)({
client_id: client_id,
redirect_uri: redirect_uri,
scope: scope,
state: state,
response_type: response_type,
});
return "https://www.figma.com/oauth?".concat(queryParams);
}
function oAuthToken(client_id, client_secret, redirect_uri, code, grant_type) {
return __awaiter(this, void 0, void 0, function () {
var headers, queryParams, url, res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
headers = {
'Authorization': "Basic ".concat(Buffer.from("".concat(client_id, ":").concat(client_secret)).toString('base64')),
};
queryParams = (0, utils_1.toQueryParams)({
redirect_uri: redirect_uri,
code: code,
grant_type: grant_type,
});
url = "https://api.figma.com/v1/oauth/token?".concat(queryParams);
return [4 /*yield*/, axios_1.default.post(url, null, { headers: headers })];
case 1:
res = _a.sent();
if (res.status !== 200)
throw res.statusText;
return [2 /*return*/, res.data];
}
});
});
}
================================================
FILE: lib/api-endpoints.d.ts
================================================
import { ApiRequestMethod } from "./utils";
type ApiClass = {
request: ApiRequestMethod;
};
import type * as FigmaRestAPI from '@figma/rest-api-spec';
export declare function getFileApi(this: ApiClass, pathParams: FigmaRestAPI.GetFilePathParams, queryParams?: FigmaRestAPI.GetFileQueryParams): Promise<FigmaRestAPI.GetFileResponse>;
export declare function getFileNodesApi(this: ApiClass, pathParams: FigmaRestAPI.GetFileNodesPathParams, queryParams?: FigmaRestAPI.GetFileNodesQueryParams): Promise<FigmaRestAPI.GetFileNodesResponse>;
export declare function getImagesApi(this: ApiClass, pathParams: FigmaRestAPI.GetImagesPathParams, queryParams?: FigmaRestAPI.GetImagesQueryParams): Promise<FigmaRestAPI.GetImagesResponse>;
export declare function getImageFillsApi(this: ApiClass, pathParams: FigmaRestAPI.GetImageFillsPathParams): Promise<FigmaRestAPI.GetImageFillsResponse>;
export declare function getCommentsApi(this: ApiClass, pathParams: FigmaRestAPI.GetCommentsPathParams): Promise<FigmaRestAPI.GetCommentsResponse>;
export declare function postCommentApi(this: ApiClass, pathParams: FigmaRestAPI.PostCommentPathParams, requestBody?: FigmaRestAPI.PostCommentRequestBody): Promise<FigmaRestAPI.PostCommentResponse>;
export declare function deleteCommentApi(this: ApiClass, pathParams: FigmaRestAPI.DeleteCommentPathParams): Promise<FigmaRestAPI.DeleteCommentResponse>;
export declare function getCommentReactionsApi(this: ApiClass, pathParams: FigmaRestAPI.GetCommentReactionsPathParams, queryParams?: FigmaRestAPI.GetCommentReactionsQueryParams): Promise<FigmaRestAPI.GetCommentsResponse>;
export declare function postCommentReactionApi(this: ApiClass, pathParams: FigmaRestAPI.PostCommentReactionPathParams, requestBody?: FigmaRestAPI.PostCommentReactionRequestBody): Promise<FigmaRestAPI.PostCommentResponse>;
export declare function deleteCommentReactionsApi(this: ApiClass, pathParams: FigmaRestAPI.DeleteCommentReactionPathParams): Promise<FigmaRestAPI.DeleteCommentReactionResponse>;
export declare function getUserMeApi(this: ApiClass): Promise<FigmaRestAPI.User>;
export declare function getFileVersionsApi(this: ApiClass, pathParams: FigmaRestAPI.GetFileVersionsPathParams): Promise<FigmaRestAPI.GetFileVersionsResponse>;
export declare function getTeamProjectsApi(this: ApiClass, pathParams: FigmaRestAPI.GetTeamProjectsPathParams): Promise<FigmaRestAPI.GetTeamProjectsResponse>;
export declare function getProjectFilesApi(this: ApiClass, pathParams: FigmaRestAPI.GetProjectFilesPathParams, queryParams?: FigmaRestAPI.GetProjectFilesQueryParams): Promise<FigmaRestAPI.GetProjectFilesResponse>;
export declare function getTeamComponentsApi(this: ApiClass, pathParams: FigmaRestAPI.GetTeamComponentsPathParams, queryParams?: FigmaRestAPI.GetTeamComponentsQueryParams): Promise<FigmaRestAPI.GetTeamComponentsResponse>;
export declare function getFileComponentsApi(this: ApiClass, pathParams: FigmaRestAPI.GetFileComponentsPathParams): Promise<FigmaRestAPI.GetFileComponentsResponse>;
export declare function getComponentApi(this: ApiClass, pathParams: FigmaRestAPI.GetComponentPathParams): Promise<FigmaRestAPI.GetComponentResponse>;
export declare function getTeamComponentSetsApi(this: ApiClass, pathParams: FigmaRestAPI.GetTeamComponentSetsPathParams, queryParams?: FigmaRestAPI.GetTeamComponentSetsQueryParams): Promise<FigmaRestAPI.GetTeamComponentSetsResponse>;
export declare function getFileComponentSetsApi(this: ApiClass, pathParams: FigmaRestAPI.GetFileComponentSetsPathParams): Promise<FigmaRestAPI.GetFileComponentSetsResponse>;
export declare function getComponentSetApi(this: ApiClass, pathParams: FigmaRestAPI.GetComponentSetPathParams): Promise<FigmaRestAPI.GetComponentSetResponse>;
export declare function getTeamStylesApi(this: ApiClass, pathParams: FigmaRestAPI.GetTeamStylesPathParams, queryParams?: FigmaRestAPI.GetTeamStylesQueryParams): Promise<FigmaRestAPI.GetTeamStylesResponse>;
export declare function getFileStylesApi(this: ApiClass, pathParams: FigmaRestAPI.GetFileStylesPathParams): Promise<FigmaRestAPI.GetFileStylesResponse>;
export declare function getStyleApi(this: ApiClass, pathParams: FigmaRestAPI.GetStylePathParams): Promise<FigmaRestAPI.GetStyleResponse>;
export declare function getWebhookApi(this: ApiClass, pathParams: FigmaRestAPI.GetWebhookPathParams): Promise<FigmaRestAPI.GetWebhookResponse>;
export declare function postWebhookApi(this: ApiClass, requestBody?: FigmaRestAPI.PostWebhookRequestBody): Promise<FigmaRestAPI.PostWebhookResponse>;
export declare function putWebhookApi(this: ApiClass, pathParams: FigmaRestAPI.PutWebhookPathParams, requestBody?: FigmaRestAPI.PutWebhookRequestBody): Promise<FigmaRestAPI.PutWebhookResponse>;
export declare function deleteWebhookApi(this: ApiClass, pathParams: FigmaRestAPI.DeleteWebhookPathParams): Promise<FigmaRestAPI.DeleteWebhookResponse>;
export declare function getTeamWebhooksApi(this: ApiClass, pathParams: FigmaRestAPI.GetTeamWebhooksPathParams): Promise<FigmaRestAPI.GetTeamWebhooksResponse>;
export declare function getWebhookRequestsApi(this: ApiClass, pathParams: FigmaRestAPI.GetWebhookRequestsPathParams): Promise<FigmaRestAPI.GetWebhookRequestsResponse>;
export declare function getLocalVariablesApi(this: ApiClass, pathParams: FigmaRestAPI.GetLocalVariablesPathParams): Promise<FigmaRestAPI.GetLocalVariablesResponse>;
export declare function getPublishedVariablesApi(this: ApiClass, pathParams: FigmaRestAPI.GetPublishedVariablesPathParams): Promise<FigmaRestAPI.GetPublishedVariablesResponse>;
export declare function postVariablesApi(this: ApiClass, pathParams: FigmaRestAPI.PostVariablesPathParams, requestBody?: FigmaRestAPI.PostVariablesRequestBody): Promise<FigmaRestAPI.PostVariablesResponse>;
export declare function getDevResourcesApi(this: ApiClass, pathParams: FigmaRestAPI.GetDevResourcesPathParams, queryParams?: FigmaRestAPI.GetDevResourcesQueryParams): Promise<FigmaRestAPI.GetDevResourcesResponse>;
export declare function postDevResourcesApi(this: ApiClass, requestBody?: FigmaRestAPI.PostDevResourcesRequestBody): Promise<FigmaRestAPI.PostDevResourcesResponse>;
export declare function putDevResourcesApi(this: ApiClass, requestBody?: FigmaRestAPI.PutDevResourcesRequestBody): Promise<FigmaRestAPI.PutDevResourcesResponse>;
export declare function deleteDevResourcesApi(this: ApiClass, pathParams: FigmaRestAPI.DeleteDevResourcePathParams): Promise<FigmaRestAPI.DeleteDevResourceResponse>;
export declare function getLibraryAnalyticsComponentActionsApi(this: ApiClass, pathParams: FigmaRestAPI.GetLibraryAnalyticsComponentActionsPathParams, queryParams?: FigmaRestAPI.GetLibraryAnalyticsComponentActionsQueryParams): Promise<FigmaRestAPI.GetLibraryAnalyticsComponentActionsResponse>;
export declare function getLibraryAnalyticsComponentUsagesApi(this: ApiClass, pathParams: FigmaRestAPI.GetLibraryAnalyticsComponentUsagesPathParams, queryParams?: FigmaRestAPI.GetLibraryAnalyticsComponentUsagesQueryParams): Promise<FigmaRestAPI.GetLibraryAnalyticsComponentUsagesResponse>;
export declare function getLibraryAnalyticsStyleActionsApi(this: ApiClass, pathParams: FigmaRestAPI.GetLibraryAnalyticsStyleActionsPathParams, queryParams?: FigmaRestAPI.GetLibraryAnalyticsStyleActionsQueryParams): Promise<FigmaRestAPI.GetLibraryAnalyticsStyleActionsResponse>;
export declare function getLibraryAnalyticsStyleUsagesApi(this: ApiClass, pathParams: FigmaRestAPI.GetLibraryAnalyticsStyleUsagesPathParams, queryParams?: FigmaRestAPI.GetLibraryAnalyticsStyleUsagesQueryParams): Promise<FigmaRestAPI.GetLibraryAnalyticsStyleUsagesResponse>;
export declare function getLibraryAnalyticsVariableActionsApi(this: ApiClass, pathParams: FigmaRestAPI.GetLibraryAnalyticsVariableActionsPathParams, queryParams?: FigmaRestAPI.GetLibraryAnalyticsVariableActionsQueryParams): Promise<FigmaRestAPI.GetLibraryAnalyticsVariableActionsResponse>;
export declare function getLibraryAnalyticsVariableUsagesApi(this: ApiClass, pathParams: FigmaRestAPI.GetLibraryAnalyticsVariableUsagesPathParams, queryParams?: FigmaRestAPI.GetLibraryAnalyticsVariableUsagesQueryParams): Promise<FigmaRestAPI.GetLibraryAnalyticsVariableUsagesResponse>;
export {};
================================================
FILE: lib/api-endpoints.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFileApi = getFileApi;
exports.getFileNodesApi = getFileNodesApi;
exports.getImagesApi = getImagesApi;
exports.getImageFillsApi = getImageFillsApi;
exports.getCommentsApi = getCommentsApi;
exports.postCommentApi = postCommentApi;
exports.deleteCommentApi = deleteCommentApi;
exports.getCommentReactionsApi = getCommentReactionsApi;
exports.postCommentReactionApi = postCommentReactionApi;
exports.deleteCommentReactionsApi = deleteCommentReactionsApi;
exports.getUserMeApi = getUserMeApi;
exports.getFileVersionsApi = getFileVersionsApi;
exports.getTeamProjectsApi = getTeamProjectsApi;
exports.getProjectFilesApi = getProjectFilesApi;
exports.getTeamComponentsApi = getTeamComponentsApi;
exports.getFileComponentsApi = getFileComponentsApi;
exports.getComponentApi = getComponentApi;
exports.getTeamComponentSetsApi = getTeamComponentSetsApi;
exports.getFileComponentSetsApi = getFileComponentSetsApi;
exports.getComponentSetApi = getComponentSetApi;
exports.getTeamStylesApi = getTeamStylesApi;
exports.getFileStylesApi = getFileStylesApi;
exports.getStyleApi = getStyleApi;
exports.getWebhookApi = getWebhookApi;
exports.postWebhookApi = postWebhookApi;
exports.putWebhookApi = putWebhookApi;
exports.deleteWebhookApi = deleteWebhookApi;
exports.getTeamWebhooksApi = getTeamWebhooksApi;
exports.getWebhookRequestsApi = getWebhookRequestsApi;
exports.getLocalVariablesApi = getLocalVariablesApi;
exports.getPublishedVariablesApi = getPublishedVariablesApi;
exports.postVariablesApi = postVariablesApi;
exports.getDevResourcesApi = getDevResourcesApi;
exports.postDevResourcesApi = postDevResourcesApi;
exports.putDevResourcesApi = putDevResourcesApi;
exports.deleteDevResourcesApi = deleteDevResourcesApi;
exports.getLibraryAnalyticsComponentActionsApi = getLibraryAnalyticsComponentActionsApi;
exports.getLibraryAnalyticsComponentUsagesApi = getLibraryAnalyticsComponentUsagesApi;
exports.getLibraryAnalyticsStyleActionsApi = getLibraryAnalyticsStyleActionsApi;
exports.getLibraryAnalyticsStyleUsagesApi = getLibraryAnalyticsStyleUsagesApi;
exports.getLibraryAnalyticsVariableActionsApi = getLibraryAnalyticsVariableActionsApi;
exports.getLibraryAnalyticsVariableUsagesApi = getLibraryAnalyticsVariableUsagesApi;
var config_1 = require("./config");
var utils_1 = require("./utils");
// FILES
// https://www.figma.com/developers/api#files-endpoints
// -----------------------------------------------------------------
function getFileApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "?").concat(encodedQueryParams));
}
function getFileNodesApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/nodes?").concat(encodedQueryParams));
}
function getImagesApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/images/").concat(pathParams.file_key, "?").concat(encodedQueryParams));
}
function getImageFillsApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/images"));
}
// COMMENTS
// https://www.figma.com/developers/api#comments-endpoints
// -----------------------------------------------------------------
function getCommentsApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/comments"));
}
function postCommentApi(pathParams, requestBody) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/comments"), {
method: 'POST',
data: requestBody,
});
}
function deleteCommentApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/comments/").concat(pathParams.comment_id), {
method: 'DELETE',
data: ''
});
}
function getCommentReactionsApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/comments/").concat(pathParams.comment_id, "/reactions?").concat(encodedQueryParams));
}
function postCommentReactionApi(pathParams, requestBody) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/comments/").concat(pathParams.comment_id, "/reactions"), {
method: 'POST',
data: requestBody,
});
}
function deleteCommentReactionsApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/comments/").concat(pathParams.comment_id, "/reactions"), {
method: 'DELETE',
data: ''
});
}
// USERS
// https://www.figma.com/developers/api#users-endpoints
// -----------------------------------------------------------------
function getUserMeApi() {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/me"));
}
// VERSION HISTORY (FILE VERSIONS)
// https://www.figma.com/developers/api#version-history-endpoints
// -----------------------------------------------------------------
function getFileVersionsApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/versions"));
}
// PROJECTS
// https://www.figma.com/developers/api#projects-endpoints
// -----------------------------------------------------------------
function getTeamProjectsApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/teams/").concat(pathParams.team_id, "/projects"));
}
function getProjectFilesApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/projects/").concat(pathParams.project_id, "/files?").concat(encodedQueryParams));
}
// COMPONENTS AND STYLES (LIBRARY ITEMS)
// https://www.figma.com/developers/api#library-items-endpoints
// -----------------------------------------------------------------
function getTeamComponentsApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/teams/").concat(pathParams.team_id, "/components?").concat(encodedQueryParams));
}
function getFileComponentsApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/components"));
}
function getComponentApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/components/").concat(pathParams.key));
}
function getTeamComponentSetsApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/teams/").concat(pathParams.team_id, "/component_sets?").concat(encodedQueryParams));
}
function getFileComponentSetsApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/component_sets"));
}
function getComponentSetApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/component_sets/").concat(pathParams.key));
}
function getTeamStylesApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/teams/").concat(pathParams.team_id, "/styles?").concat(encodedQueryParams));
}
function getFileStylesApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/styles"));
}
function getStyleApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/styles/").concat(pathParams.key));
}
// WEBHOOKS
// https://www.figma.com/developers/api#webhooks_v2
// -----------------------------------------------------------------
function getWebhookApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER_WEBHOOKS, "/webhooks/").concat(pathParams.webhook_id));
}
function postWebhookApi(requestBody) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER_WEBHOOKS, "/webhooks"), {
method: 'POST',
data: requestBody,
});
}
function putWebhookApi(pathParams, requestBody) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER_WEBHOOKS, "/webhooks/").concat(pathParams.webhook_id), {
method: 'PUT',
data: requestBody,
});
}
function deleteWebhookApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER_WEBHOOKS, "/webhooks/").concat(pathParams.webhook_id, "/"), {
method: 'DELETE',
data: ''
});
}
function getTeamWebhooksApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER_WEBHOOKS, "/teams/").concat(pathParams.team_id, "/webhooks"));
}
function getWebhookRequestsApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER_WEBHOOKS, "/webhooks/").concat(pathParams.webhook_id, "/requests"));
}
// ACTIVITY LOGS
// https://www.figma.com/developers/api#activity-logs-endpoints
// -----------------------------------------------------------------
// TODO - Open to contributions if someone is needs to use these endpoints
// PAYMENTS
// https://www.figma.com/developers/api#payments-endpoints
// -----------------------------------------------------------------
// TODO - Open to contributions if someone is needs to use these endpoints
// VARIABLES
// These APIs are available only to full members of Enterprise orgs.
// https://www.figma.com/developers/api#variables-endpoints
// -----------------------------------------------------------------
function getLocalVariablesApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/variables/local"));
}
function getPublishedVariablesApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/variables/published"));
}
function postVariablesApi(pathParams, requestBody) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/variables"), {
method: 'POST',
data: requestBody,
});
}
// DEV RESOURCES
// https://www.figma.com/developers/api#dev-resources-endpoints
// -----------------------------------------------------------------
function getDevResourcesApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/dev_resources"));
}
function postDevResourcesApi(requestBody) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/dev_resources"), {
method: 'POST',
data: requestBody,
});
}
function putDevResourcesApi(requestBody) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/dev_resources"), {
method: 'PUT',
data: requestBody,
});
}
function deleteDevResourcesApi(pathParams) {
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/files/").concat(pathParams.file_key, "/dev_resources/").concat(pathParams.dev_resource_id), {
method: 'DELETE',
data: ''
});
}
// ANALYTICS
// https://www.figma.com/developers/api#library-analytics-endpoints
// -----------------------------------------------------------------
function getLibraryAnalyticsComponentActionsApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/analytics/libraries/").concat(pathParams.file_key, "/component/actions?").concat(encodedQueryParams));
}
function getLibraryAnalyticsComponentUsagesApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/analytics/libraries/").concat(pathParams.file_key, "/component/usages?").concat(encodedQueryParams));
}
function getLibraryAnalyticsStyleActionsApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/analytics/libraries/").concat(pathParams.file_key, "/style/actions?").concat(encodedQueryParams));
}
function getLibraryAnalyticsStyleUsagesApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/analytics/libraries/").concat(pathParams.file_key, "/style/usages?").concat(encodedQueryParams));
}
function getLibraryAnalyticsVariableActionsApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/analytics/libraries/").concat(pathParams.file_key, "/variable/actions?").concat(encodedQueryParams));
}
function getLibraryAnalyticsVariableUsagesApi(pathParams, queryParams) {
var encodedQueryParams = (0, utils_1.toQueryParams)(queryParams);
return this.request("".concat(config_1.API_DOMAIN, "/").concat(config_1.API_VER, "/analytics/libraries/").concat(pathParams.file_key, "/variable/usages?").concat(encodedQueryParams));
}
================================================
FILE: lib/config.d.ts
================================================
export declare const API_DOMAIN = "https://api.figma.com";
export declare const API_VER = "v1";
export declare const API_VER_WEBHOOKS = "v2";
================================================
FILE: lib/config.js
================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.API_VER_WEBHOOKS = exports.API_VER = exports.API_DOMAIN = void 0;
exports.API_DOMAIN = 'https://api.figma.com';
exports.API_VER = 'v1';
exports.API_VER_WEBHOOKS = 'v2';
================================================
FILE: lib/figma-api.js
================================================
"use strict";
var Figma = (() => {
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all3) => {
for (var name in all3)
__defProp(target, name, { get: all3[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
API_DOMAIN: () => API_DOMAIN,
API_VER: () => API_VER,
API_VER_WEBHOOKS: () => API_VER_WEBHOOKS,
Api: () => Api,
oAuthLink: () => oAuthLink,
oAuthToken: () => oAuthToken
});
// src/config.ts
var API_DOMAIN = "https://api.figma.com";
var API_VER = "v1";
var API_VER_WEBHOOKS = "v2";
// src/utils.ts
function toQueryParams(x) {
if (!x) return "";
return Object.entries(x).map(([k, v]) => (
// Keep explicit false/0 values (e.g. svg_outline_text=false), only omit undefined/null/empty-string.
k && v !== void 0 && v !== null && v !== "" && `${k}=${encodeURIComponent(v)}`
)).filter(Boolean).join("&");
}
var ApiError = class _ApiError extends Error {
constructor(error) {
super(error.message);
this.error = error;
this.name = "ApiError";
if (Error.captureStackTrace) {
Error.captureStackTrace(this, _ApiError);
}
}
};
// src/api-endpoints.ts
function getFileApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}?${encodedQueryParams}`);
}
function getFileNodesApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/nodes?${encodedQueryParams}`);
}
function getFileMetaApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/meta`);
}
function getImagesApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/images/${pathParams.file_key}?${encodedQueryParams}`);
}
function getImageFillsApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/images`);
}
function getCommentsApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/comments`);
}
function postCommentApi(pathParams, requestBody) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/comments`, {
method: "POST",
data: requestBody
});
}
function deleteCommentApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/comments/${pathParams.comment_id}`, {
method: "DELETE",
data: ""
});
}
function getCommentReactionsApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/comments/${pathParams.comment_id}/reactions?${encodedQueryParams}`);
}
function postCommentReactionApi(pathParams, requestBody) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/comments/${pathParams.comment_id}/reactions`, {
method: "POST",
data: requestBody
});
}
function deleteCommentReactionsApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/comments/${pathParams.comment_id}/reactions`, {
method: "DELETE",
data: ""
});
}
function getUserMeApi() {
return this.request(`${API_DOMAIN}/${API_VER}/me`);
}
function getFileVersionsApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/versions`);
}
function getTeamProjectsApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/teams/${pathParams.team_id}/projects`);
}
function getProjectFilesApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/projects/${pathParams.project_id}/files?${encodedQueryParams}`);
}
function getTeamComponentsApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/teams/${pathParams.team_id}/components?${encodedQueryParams}`);
}
function getFileComponentsApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/components`);
}
function getComponentApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/components/${pathParams.key}`);
}
function getTeamComponentSetsApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/teams/${pathParams.team_id}/component_sets?${encodedQueryParams}`);
}
function getFileComponentSetsApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/component_sets`);
}
function getComponentSetApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/component_sets/${pathParams.key}`);
}
function getTeamStylesApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/teams/${pathParams.team_id}/styles?${encodedQueryParams}`);
}
function getFileStylesApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/styles`);
}
function getStyleApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/styles/${pathParams.key}`);
}
function getWebhookApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER_WEBHOOKS}/webhooks/${pathParams.webhook_id}`);
}
function postWebhookApi(requestBody) {
return this.request(`${API_DOMAIN}/${API_VER_WEBHOOKS}/webhooks`, {
method: "POST",
data: requestBody
});
}
function putWebhookApi(pathParams, requestBody) {
return this.request(`${API_DOMAIN}/${API_VER_WEBHOOKS}/webhooks/${pathParams.webhook_id}`, {
method: "PUT",
data: requestBody
});
}
function deleteWebhookApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER_WEBHOOKS}/webhooks/${pathParams.webhook_id}/`, {
method: "DELETE",
data: ""
});
}
function getTeamWebhooksApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER_WEBHOOKS}/teams/${pathParams.team_id}/webhooks`);
}
function getWebhookRequestsApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER_WEBHOOKS}/webhooks/${pathParams.webhook_id}/requests`);
}
function getLocalVariablesApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/variables/local`);
}
function getPublishedVariablesApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/variables/published`);
}
function postVariablesApi(pathParams, requestBody) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/variables`, {
method: "POST",
data: requestBody
});
}
function getDevResourcesApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/dev_resources`);
}
function postDevResourcesApi(requestBody) {
return this.request(`${API_DOMAIN}/${API_VER}/dev_resources`, {
method: "POST",
data: requestBody
});
}
function putDevResourcesApi(requestBody) {
return this.request(`${API_DOMAIN}/${API_VER}/dev_resources`, {
method: "PUT",
data: requestBody
});
}
function deleteDevResourcesApi(pathParams) {
return this.request(`${API_DOMAIN}/${API_VER}/files/${pathParams.file_key}/dev_resources/${pathParams.dev_resource_id}`, {
method: "DELETE",
data: ""
});
}
function getLibraryAnalyticsComponentActionsApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/analytics/libraries/${pathParams.file_key}/component/actions?${encodedQueryParams}`);
}
function getLibraryAnalyticsComponentUsagesApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/analytics/libraries/${pathParams.file_key}/component/usages?${encodedQueryParams}`);
}
function getLibraryAnalyticsStyleActionsApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/analytics/libraries/${pathParams.file_key}/style/actions?${encodedQueryParams}`);
}
function getLibraryAnalyticsStyleUsagesApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/analytics/libraries/${pathParams.file_key}/style/usages?${encodedQueryParams}`);
}
function getLibraryAnalyticsVariableActionsApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/analytics/libraries/${pathParams.file_key}/variable/actions?${encodedQueryParams}`);
}
function getLibraryAnalyticsVariableUsagesApi(pathParams, queryParams) {
const encodedQueryParams = toQueryParams(queryParams);
return this.request(`${API_DOMAIN}/${API_VER}/analytics/libraries/${pathParams.file_key}/variable/usages?${encodedQueryParams}`);
}
// node_modules/axios/lib/helpers/bind.js
function bind(fn, thisArg) {
return function wrap() {
return fn.apply(thisArg, arguments);
};
}
// node_modules/axios/lib/utils.js
var { toString } = Object.prototype;
var { getPrototypeOf } = Object;
var { iterator, toStringTag } = Symbol;
var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
const str = toString.call(thing);
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null));
var kindOfTest = (type) => {
type = type.toLowerCase();
return (thing) => kindOf(thing) === type;
};
var typeOfTest = (type) => (thing) => typeof thing === type;
var { isArray } = Array;
var isUndefined = typeOfTest("undefined");
function isBuffer(val) {
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
}
var isArrayBuffer = kindOfTest("ArrayBuffer");
function isArrayBufferView(val) {
let result;
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
result = ArrayBuffer.isView(val);
} else {
result = val && val.buffer && isArrayBuffer(val.buffer);
}
return result;
}
var isString = typeOfTest("string");
var isFunction = typeOfTest("function");
var isNumber = typeOfTest("number");
var isObject = (thing) => thing !== null && typeof thing === "object";
var isBoolean = (thing) => thing === true || thing === false;
var isPlainObject = (val) => {
if (kindOf(val) !== "object") {
return false;
}
const prototype2 = getPrototypeOf(val);
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
};
var isEmptyObject = (val) => {
if (!isObject(val) || isBuffer(val)) {
return false;
}
try {
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
} catch (e) {
return false;
}
};
var isDate = kindOfTest("Date");
var isFile = kindOfTest("File");
var isReactNativeBlob = (value) => {
return !!(value && typeof value.uri !== "undefined");
};
var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
var isBlob = kindOfTest("Blob");
var isFileList = kindOfTest("FileList");
var isStream = (val) => isObject(val) && isFunction(val.pipe);
function getGlobal() {
if (typeof globalThis !== "undefined") return globalThis;
if (typeof self !== "undefined") return self;
if (typeof window !== "undefined") return window;
if (typeof global !== "undefined") return global;
return {};
}
var G = getGlobal();
var FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
var isFormData = (thing) => {
if (!thing) return false;
if (FormDataCtor && thing instanceof FormDataCtor) return true;
const proto = getPrototypeOf(thing);
if (!proto || proto === Object.prototype) return false;
if (!isFunction(thing.append)) return false;
const kind = kindOf(thing);
return kind === "formdata" || // detect form-data instance
kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]";
};
var isURLSearchParams = kindOfTest("URLSearchParams");
var [isReadableStream, isRequest, isResponse, isHeaders] = [
"ReadableStream",
"Request",
"Response",
"Headers"
].map(kindOfTest);
var trim = (str) => {
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
};
function forEach(obj, fn, { allOwnKeys = false } = {}) {
if (obj === null || typeof obj === "undefined") {
return;
}
let i;
let l;
if (typeof obj !== "object") {
obj = [obj];
}
if (isArray(obj)) {
for (i = 0, l = obj.length; i < l; i++) {
fn.call(null, obj[i], i, obj);
}
} else {
if (isBuffer(obj)) {
return;
}
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
const len = keys.length;
let key;
for (i = 0; i < len; i++) {
key = keys[i];
fn.call(null, obj[key], key, obj);
}
}
}
function findKey(obj, key) {
if (isBuffer(obj)) {
return null;
}
key = key.toLowerCase();
const keys = Object.keys(obj);
let i = keys.length;
let _key;
while (i-- > 0) {
_key = keys[i];
if (key === _key.toLowerCase()) {
return _key;
}
}
return null;
}
var _global = (() => {
if (typeof globalThis !== "undefined") return globalThis;
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
})();
var isContextDefined = (context) => !isUndefined(context) && context !== _global;
function merge() {
const { caseless, skipUndefined } = isContextDefined(this) && this || {};
const result = {};
const assignValue = (val, key) => {
if (key === "__proto__" || key === "constructor" || key === "prototype") {
return;
}
const targetKey = caseless && findKey(result, key) || key;
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
result[targetKey] = merge(result[targetKey], val);
} else if (isPlainObject(val)) {
result[targetKey] = merge({}, val);
} else if (isArray(val)) {
result[targetKey] = val.slice();
} else if (!skipUndefined || !isUndefined(val)) {
result[targetKey] = val;
}
};
for (let i = 0, l = arguments.length; i < l; i++) {
arguments[i] && forEach(arguments[i], assignValue);
}
return result;
}
var extend = (a, b, thisArg, { allOwnKeys } = {}) => {
forEach(
b,
(val, key) => {
if (thisArg && isFunction(val)) {
Object.defineProperty(a, key, {
value: bind(val, thisArg),
writable: true,
enumerable: true,
configurable: true
});
} else {
Object.defineProperty(a, key, {
value: val,
writable: true,
enumerable: true,
configurable: true
});
}
},
{ allOwnKeys }
);
return a;
};
var stripBOM = (content) => {
if (content.charCodeAt(0) === 65279) {
content = content.slice(1);
}
return content;
};
var inherits = (constructor, superConstructor, props, descriptors) => {
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
Object.defineProperty(constructor.prototype, "constructor", {
value: constructor,
writable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(constructor, "super", {
value: superConstructor.prototype
});
props && Object.assign(constructor.prototype, props);
};
var toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
let props;
let i;
let prop;
const merged = {};
destObj = destObj || {};
if (sourceObj == null) return destObj;
do {
props = Object.getOwnPropertyNames(sourceObj);
i = props.length;
while (i-- > 0) {
prop = props[i];
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
destObj[prop] = sourceObj[prop];
merged[prop] = true;
}
}
sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
return destObj;
};
var endsWith = (str, searchString, position) => {
str = String(str);
if (position === void 0 || position > str.length) {
position = str.length;
}
position -= searchString.length;
const lastIndex = str.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
var toArray = (thing) => {
if (!thing) return null;
if (isArray(thing)) return thing;
let i = thing.length;
if (!isNumber(i)) return null;
const arr = new Array(i);
while (i-- > 0) {
arr[i] = thing[i];
}
return arr;
};
var isTypedArray = /* @__PURE__ */ ((TypedArray) => {
return (thing) => {
return TypedArray && thing instanceof TypedArray;
};
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
var forEachEntry = (obj, fn) => {
const generator = obj && obj[iterator];
const _iterator = generator.call(obj);
let result;
while ((result = _iterator.next()) && !result.done) {
const pair = result.value;
fn.call(obj, pair[0], pair[1]);
}
};
var matchAll = (regExp, str) => {
let matches;
const arr = [];
while ((matches = regExp.exec(str)) !== null) {
arr.push(matches);
}
return arr;
};
var isHTMLForm = kindOfTest("HTMLFormElement");
var toCamelCase = (str) => {
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
return p1.toUpperCase() + p2;
});
};
var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
var isRegExp = kindOfTest("RegExp");
var reduceDescriptors = (obj, reducer) => {
const descriptors = Object.getOwnPropertyDescriptors(obj);
const reducedDescriptors = {};
forEach(descriptors, (descriptor, name) => {
let ret;
if ((ret = reducer(descriptor, name, obj)) !== false) {
reducedDescriptors[name] = ret || descriptor;
}
});
Object.defineProperties(obj, reducedDescriptors);
};
var freezeMethods = (obj) => {
reduceDescriptors(obj, (descriptor, name) => {
if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
return false;
}
const value = obj[name];
if (!isFunction(value)) return;
descriptor.enumerable = false;
if ("writable" in descriptor) {
descriptor.writable = false;
return;
}
if (!descriptor.set) {
descriptor.set = () => {
throw Error("Can not rewrite read-only method '" + name + "'");
};
}
});
};
var toObjectSet = (arrayOrString, delimiter) => {
const obj = {};
const define = (arr) => {
arr.forEach((value) => {
obj[value] = true;
});
};
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
return obj;
};
var noop = () => {
};
var toFiniteNumber = (value, defaultValue) => {
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
};
function isSpecCompliantForm(thing) {
return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
}
var toJSONObject = (obj) => {
const stack = new Array(10);
const visit = (source, i) => {
if (isObject(source)) {
if (stack.indexOf(source) >= 0) {
return;
}
if (isBuffer(source)) {
return source;
}
if (!("toJSON" in source)) {
stack[i] = source;
const target = isArray(source) ? [] : {};
forEach(source, (value, key) => {
const reducedValue = visit(value, i + 1);
!isUndefined(reducedValue) && (target[key] = reducedValue);
});
stack[i] = void 0;
return target;
}
}
return source;
};
return visit(obj, 0);
};
var isAsyncFn = kindOfTest("AsyncFunction");
var isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
if (setImmediateSupported) {
return setImmediate;
}
return postMessageSupported ? ((token, callbacks) => {
_global.addEventListener(
"message",
({ source, data }) => {
if (source === _global && data === token) {
callbacks.length && callbacks.shift()();
}
},
false
);
return (cb) => {
callbacks.push(cb);
_global.postMessage(token, "*");
};
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
})(typeof setImmediate === "function", isFunction(_global.postMessage));
var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
var isIterable = (thing) => thing != null && isFunction(thing[iterator]);
var utils_default = {
isArray,
isArrayBuffer,
isBuffer,
isFormData,
isArrayBufferView,
isString,
isNumber,
isBoolean,
isObject,
isPlainObject,
isEmptyObject,
isReadableStream,
isRequest,
isResponse,
isHeaders,
isUndefined,
isDate,
isFile,
isReactNativeBlob,
isReactNative,
isBlob,
isRegExp,
isFunction,
isStream,
isURLSearchParams,
isTypedArray,
isFileList,
forEach,
merge,
extend,
trim,
stripBOM,
inherits,
toFlatObject,
kindOf,
kindOfTest,
endsWith,
toArray,
forEachEntry,
matchAll,
isHTMLForm,
hasOwnProperty,
hasOwnProp: hasOwnProperty,
// an alias to avoid ESLint no-prototype-builtins detection
reduceDescriptors,
freezeMethods,
toObjectSet,
toCamelCase,
noop,
toFiniteNumber,
findKey,
global: _global,
isContextDefined,
isSpecCompliantForm,
toJSONObject,
isAsyncFn,
isThenable,
setImmediate: _setImmediate,
asap,
isIterable
};
// node_modules/axios/lib/core/AxiosError.js
var AxiosError = class _AxiosError extends Error {
static from(error, code, config, request, response, customProps) {
const axiosError = new _AxiosError(error.message, code || error.code, config, request, response);
axiosError.cause = error;
axiosError.name = error.name;
if (error.status != null && axiosError.status == null) {
axiosError.status = error.status;
}
customProps && Object.assign(axiosError, customProps);
return axiosError;
}
/**
* Create an Error with the specified message, config, error code, request and response.
*
* @param {string} message The error message.
* @param {string} [code] The error code (for example, 'ECONNABORTED').
* @param {Object} [config] The config.
* @param {Object} [request] The request.
* @param {Object} [response] The response.
*
* @returns {Error} The created error.
*/
constructor(message, code, config, request, response) {
super(message);
Object.defineProperty(this, "message", {
value: message,
enumerable: true,
writable: true,
configurable: true
});
this.name = "AxiosError";
this.isAxiosError = true;
code && (this.code = code);
config && (this.config = config);
request && (this.request = request);
if (response) {
this.response = response;
this.status = response.status;
}
}
toJSON() {
return {
// Standard
message: this.message,
name: this.name,
// Microsoft
description: this.description,
number: this.number,
// Mozilla
fileName: this.fileName,
lineNumber: this.lineNumber,
columnNumber: this.columnNumber,
stack: this.stack,
// Axios
config: utils_default.toJSONObject(this.config),
code: this.code,
status: this.status
};
}
};
AxiosError.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
AxiosError.ERR_BAD_OPTION = "ERR_BAD_OPTION";
AxiosError.ECONNABORTED = "ECONNABORTED";
AxiosError.ETIMEDOUT = "ETIMEDOUT";
AxiosError.ERR_NETWORK = "ERR_NETWORK";
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
AxiosError.ERR_DEPRECATED = "ERR_DEPRECATED";
AxiosError.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
AxiosError.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
AxiosError.ERR_CANCELED = "ERR_CANCELED";
AxiosError.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
AxiosError.ERR_INVALID_URL = "ERR_INVALID_URL";
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = "ERR_FORM_DATA_DEPTH_EXCEEDED";
var AxiosError_default = AxiosError;
// node_modules/axios/lib/helpers/null.js
var null_default = null;
// node_modules/axios/lib/helpers/toFormData.js
function isVisitable(thing) {
return utils_default.isPlainObject(thing) || utils_default.isArray(thing);
}
function removeBrackets(key) {
return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
}
function renderKey(path, key, dots) {
if (!path) return key;
return path.concat(key).map(function each(token, i) {
token = removeBrackets(token);
return !dots && i ? "[" + token + "]" : token;
}).join(dots ? "." : "");
}
function isFlatArray(arr) {
return utils_default.isArray(arr) && !arr.some(isVisitable);
}
var predicates = utils_default.toFlatObject(utils_default, {}, null, function filter(prop) {
return /^is[A-Z]/.test(prop);
});
function toFormData(obj, formData, options) {
if (!utils_default.isObject(obj)) {
throw new TypeError("target must be an object");
}
formData = formData || new (null_default || FormData)();
options = utils_default.toFlatObject(
options,
{
metaTokens: true,
dots: false,
indexes: false
},
false,
function defined(option, source) {
return !utils_default.isUndefined(source[option]);
}
);
const metaTokens = options.metaTokens;
const visitor = options.visitor || defaultVisitor;
const dots = options.dots;
const indexes = options.indexes;
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
const maxDepth = options.maxDepth === void 0 ? 100 : options.maxDepth;
const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
if (!utils_default.isFunction(visitor)) {
throw new TypeError("visitor must be a function");
}
function convertValue(value) {
if (value === null) return "";
if (utils_default.isDate(value)) {
return value.toISOString();
}
if (utils_default.isBoolean(value)) {
return value.toString();
}
if (!useBlob && utils_default.isBlob(value)) {
throw new AxiosError_default("Blob is not supported. Use a Buffer instead.");
}
if (utils_default.isArrayBuffer(value) || utils_default.isTypedArray(value)) {
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
}
return value;
}
function defaultVisitor(value, key, path) {
let arr = value;
if (utils_default.isReactNative(formData) && utils_default.isReactNativeBlob(value)) {
formData.append(renderKey(path, key, dots), convertValue(value));
return false;
}
if (value && !path && typeof value === "object") {
if (utils_default.endsWith(key, "{}")) {
key = metaTokens ? key : key.slice(0, -2);
value = JSON.stringify(value);
} else if (utils_default.isArray(value) && isFlatArray(value) || (utils_default.isFileList(value) || utils_default.endsWith(key, "[]")) && (arr = utils_default.toArray(value))) {
key = removeBrackets(key);
arr.forEach(function each(el, index) {
!(utils_default.isUndefined(el) || el === null) && formData.append(
// eslint-disable-next-line no-nested-ternary
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
convertValue(el)
);
});
return false;
}
}
if (isVisitable(value)) {
return true;
}
formData.append(renderKey(path, key, dots), convertValue(value));
return false;
}
const stack = [];
const exposedHelpers = Object.assign(predicates, {
defaultVisitor,
convertValue,
isVisitable
});
function build(value, path, depth = 0) {
if (utils_default.isUndefined(value)) return;
if (depth > maxDepth) {
throw new AxiosError_default(
"Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth,
AxiosError_default.ERR_FORM_DATA_DEPTH_EXCEEDED
);
}
if (stack.indexOf(value) !== -1) {
throw Error("Circular reference detected in " + path.join("."));
}
stack.push(value);
utils_default.forEach(value, function each(el, key) {
const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path, exposedHelpers);
if (result === true) {
build(el, path ? path.concat(key) : [key], depth + 1);
}
});
stack.pop();
}
if (!utils_default.isObject(obj)) {
throw new TypeError("data must be an object");
}
build(obj);
return formData;
}
var toFormData_default = toFormData;
// node_modules/axios/lib/helpers/AxiosURLSearchParams.js
function encode(str) {
const charMap = {
"!": "%21",
"'": "%27",
"(": "%28",
")": "%29",
"~": "%7E",
"%20": "+"
};
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
return charMap[match];
});
}
function AxiosURLSearchParams(params, options) {
this._pairs = [];
params && toFormData_default(params, this, options);
}
var prototype = AxiosURLSearchParams.prototype;
prototype.append = function append(name, value) {
this._pairs.push([name, value]);
};
prototype.toString = function toString2(encoder) {
const _encode = encoder ? function(value) {
return encoder.call(this, value, encode);
} : encode;
return this._pairs.map(function each(pair) {
return _encode(pair[0]) + "=" + _encode(pair[1]);
}, "").join("&");
};
var AxiosURLSearchParams_default = AxiosURLSearchParams;
// node_modules/axios/lib/helpers/buildURL.js
function encode2(val) {
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
}
function buildURL(url, params, options) {
if (!params) {
return url;
}
const _encode = options && options.encode || encode2;
const _options = utils_default.isFunction(options) ? {
serialize: options
} : options;
const serializeFn = _options && _options.serialize;
let serializedParams;
if (serializeFn) {
serializedParams = serializeFn(params, _options);
} else {
serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, _options).toString(_encode);
}
if (serializedParams) {
const hashmarkIndex = url.indexOf("#");
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex);
}
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
}
return url;
}
// node_modules/axios/lib/core/InterceptorManager.js
var InterceptorManager = class {
constructor() {
this.handlers = [];
}
/**
* Add a new interceptor to the stack
*
* @param {Function} fulfilled The function to handle `then` for a `Promise`
* @param {Function} rejected The function to handle `reject` for a `Promise`
* @param {Object} options The options for the interceptor, synchronous and runWhen
*
* @return {Number} An ID used to remove interceptor later
*/
use(fulfilled, rejected, options) {
this.handlers.push({
fulfilled,
rejected,
synchronous: options ? options.synchronous : false,
runWhen: options ? options.runWhen : null
});
return this.handlers.length - 1;
}
/**
* Remove an interceptor from the stack
*
* @param {Number} id The ID that was returned by `use`
*
* @returns {void}
*/
eject(id) {
if (this.handlers[id]) {
this.handlers[id] = null;
}
}
/**
* Clear all interceptors from the stack
*
* @returns {void}
*/
clear() {
if (this.handlers) {
this.handlers = [];
}
}
/**
* Iterate over all the registered interceptors
*
* This method is particularly useful for skipping over any
* interceptors that may have become `null` calling `eject`.
*
* @param {Function} fn The function to call for each interceptor
*
* @returns {void}
*/
forEach(fn) {
utils_default.forEach(this.handlers, function forEachHandler(h) {
if (h !== null) {
fn(h);
}
});
}
};
var InterceptorManager_default = InterceptorManager;
// node_modules/axios/lib/defaults/transitional.js
var transitional_default = {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false,
legacyInterceptorReqResOrdering: true
};
// node_modules/axios/lib/platform/browser/classes/URLSearchParams.js
var URLSearchParams_default = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams_default;
// node_modules/axios/lib/platform/browser/classes/FormData.js
var FormData_default = typeof FormData !== "undefined" ? FormData : null;
// node_modules/axios/lib/platform/browser/classes/Blob.js
var Blob_default = typeof Blob !== "undefined" ? Blob : null;
// node_modules/axios/lib/platform/browser/index.js
var browser_default = {
isBrowser: true,
classes: {
URLSearchParams: URLSearchParams_default,
FormData: FormData_default,
Blob: Blob_default
},
protocols: ["http", "https", "file", "blob", "url", "data"]
};
// node_modules/axios/lib/platform/common/utils.js
var utils_exports = {};
__export(utils_exports, {
hasBrowserEnv: () => hasBrowserEnv,
hasStandardBrowserEnv: () => hasStandardBrowserEnv,
hasStandardBrowserWebWorkerEnv: () => hasStandardBrowserWebWorkerEnv,
navigator: () => _navigator,
origin: () => origin
});
var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
var _navigator = typeof navigator === "object" && navigator || void 0;
var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
var hasStandardBrowserWebWorkerEnv = (() => {
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
})();
var origin = hasBrowserEnv && window.location.href || "http://localhost";
// node_modules/axios/lib/platform/index.js
var platform_default = {
...utils_exports,
...browser_default
};
// node_modules/axios/lib/helpers/toURLEncodedForm.js
function toURLEncodedForm(data, options) {
return toFormData_default(data, new platform_default.classes.URLSearchParams(), {
visitor: function(value, key, path, helpers) {
if (platform_default.isNode && utils_default.isBuffer(value)) {
this.append(key, value.toString("base64"));
return false;
}
return helpers.defaultVisitor.apply(this, arguments);
},
...options
});
}
// node_modules/axios/lib/helpers/formDataToJSON.js
function parsePropPath(name) {
return utils_default.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
return match[0] === "[]" ? "" : match[1] || match[0];
});
}
function arrayToObject(arr) {
const obj = {};
const keys = Object.keys(arr);
let i;
const len = keys.length;
let key;
for (i = 0; i < len; i++) {
key = keys[i];
obj[key] = arr[key];
}
return obj;
}
function formDataToJSON(formData) {
function buildPath(path, value, target, index) {
let name = path[index++];
if (name === "__proto__") return true;
const isNumericKey = Number.isFinite(+name);
const isLast = index >= path.length;
name = !name && utils_default.isArray(target) ? target.length : name;
if (isLast) {
if (utils_default.hasOwnProp(target, name)) {
target[name] = utils_default.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
} else {
target[name] = value;
}
return !isNumericKey;
}
if (!target[name] || !utils_default.isObject(target[name])) {
target[name] = [];
}
const result = buildPath(path, value, target[name], index);
if (result && utils_default.isArray(target[name])) {
target[name] = arrayToObject(target[name]);
}
return !isNumericKey;
}
if (utils_default.isFormData(formData) && utils_default.isFunction(formData.entries)) {
const obj = {};
utils_default.forEachEntry(formData, (name, value) => {
buildPath(parsePropPath(name), value, obj, 0);
});
return obj;
}
return null;
}
var formDataToJSON_default = formDataToJSON;
// node_modules/axios/lib/defaults/index.js
var own = (obj, key) => obj != null && utils_default.hasOwnProp(obj, key) ? obj[key] : void 0;
function stringifySafely(rawValue, parser, encoder) {
if (utils_default.isString(rawValue)) {
try {
(parser || JSON.parse)(rawValue);
return utils_default.trim(rawValue);
} catch (e) {
if (e.name !== "SyntaxError") {
throw e;
}
}
}
return (encoder || JSON.stringify)(rawValue);
}
var defaults = {
transitional: transitional_default,
adapter: ["xhr", "http", "fetch"],
transformRequest: [
function transformRequest(data, headers) {
const contentType = headers.getContentType() || "";
const hasJSONContentType = contentType.indexOf("application/json") > -1;
const isObjectPayload = utils_default.isObject(data);
if (isObjectPayload && utils_default.isHTMLForm(data)) {
data = new FormData(data);
}
const isFormData2 = utils_default.isFormData(data);
if (isFormData2) {
return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
}
if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
return data;
}
if (utils_default.isArrayBufferView(data)) {
return data.buffer;
}
if (utils_default.isURLSearchParams(data)) {
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
return data.toString();
}
let isFileList2;
if (isObjectPayload) {
const formSerializer = own(this, "formSerializer");
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
return toURLEncodedForm(data, formSerializer).toString();
}
if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
const env = own(this, "env");
const _FormData = env && env.FormData;
return toFormData_default(
isFileList2 ? { "files[]": data } : data,
_FormData && new _FormData(),
formSerializer
);
}
}
if (isObjectPayload || hasJSONContentType) {
headers.setContentType("application/json", false);
return stringifySafely(data);
}
return data;
}
],
transformResponse: [
function transformResponse(data) {
const transitional2 = own(this, "transitional") || defaults.transitional;
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
const responseType = own(this, "responseType");
const JSONRequested = responseType === "json";
if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
return data;
}
if (data && utils_default.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
const strictJSONParsing = !silentJSONParsing && JSONRequested;
try {
return JSON.parse(data, own(this, "parseReviver"));
} catch (e) {
if (strictJSONParsing) {
if (e.name === "SyntaxError") {
throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, own(this, "response"));
}
throw e;
}
}
}
return data;
}
],
/**
* A timeout in milliseconds to abort a request. If set to 0 (default) a
* timeout is not created.
*/
timeout: 0,
xsrfCookieName: "XSRF-TOKEN",
xsrfHeaderName: "X-XSRF-TOKEN",
maxContentLength: -1,
maxBodyLength: -1,
env: {
FormData: platform_default.classes.FormData,
Blob: platform_default.classes.Blob
},
validateStatus: function validateStatus(status) {
return status >= 200 && status < 300;
},
headers: {
common: {
Accept: "application/json, text/plain, */*",
"Content-Type": void 0
}
}
};
utils_default.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
defaults.headers[method] = {};
});
var defaults_default = defaults;
// node_modules/axios/lib/helpers/parseHeaders.js
var ignoreDuplicateOf = utils_default.toObjectSet([
"age",
"authorization",
"content-length",
"content-type",
"etag",
"expires",
"from",
"host",
"if-modified-since",
"if-unmodified-since",
"last-modified",
"location",
"max-forwards",
"proxy-authorization",
"referer",
"retry-after",
"user-agent"
]);
var parseHeaders_default = (rawHeaders) => {
const parsed = {};
let key;
let val;
let i;
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
i = line.indexOf(":");
key = line.substring(0, i).trim().toLowerCase();
val = line.substring(i + 1).trim();
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
return;
}
if (key === "set-cookie") {
if (parsed[key]) {
parsed[key].push(val);
} else {
parsed[key] = [val];
}
} else {
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
}
});
return parsed;
};
// node_modules/axios/lib/core/AxiosHeaders.js
var $internals = Symbol("internals");
var INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
function trimSPorHTAB(str) {
let start = 0;
let end = str.length;
while (start < end) {
const code = str.charCodeAt(start);
if (code !== 9 && code !== 32) {
break;
}
start += 1;
}
while (end > start) {
const code = str.charCodeAt(end - 1);
if (code !== 9 && code !== 32) {
break;
}
end -= 1;
}
return start === 0 && end === str.length ? str : str.slice(start, end);
}
function normalizeHeader(header) {
return header && String(header).trim().toLowerCase();
}
function sanitizeHeaderValue(str) {
return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ""));
}
function normalizeValue(value) {
if (value === false || value == null) {
return value;
}
return utils_default.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
}
function parseTokens(str) {
const tokens = /* @__PURE__ */ Object.create(null);
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
let match;
while (match = tokensRE.exec(str)) {
tokens[match[1]] = match[2];
}
return tokens;
}
var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
if (utils_default.isFunction(filter2)) {
return filter2.call(this, value, header);
}
if (isHeaderNameFilter) {
value = header;
}
if (!utils_default.isString(value)) return;
if (utils_default.isString(filter2)) {
return value.indexOf(filter2) !== -1;
}
if (utils_default.isRegExp(filter2)) {
return filter2.test(value);
}
}
function formatHeader(header) {
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
return char.toUpperCase() + str;
});
}
function buildAccessors(obj, header) {
const accessorName = utils_default.toCamelCase(" " + header);
["get", "set", "has"].forEach((methodName) => {
Object.defineProperty(obj, methodName + accessorName, {
value: function(arg1, arg2, arg3) {
return this[methodName].call(this, header, arg1, arg2, arg3);
},
configurable: true
});
});
}
var AxiosHeaders = class {
constructor(headers) {
headers && this.set(headers);
}
set(header, valueOrRewrite, rewrite) {
const self2 = this;
function setHeader(_value, _header, _rewrite) {
const lHeader = normalizeHeader(_header);
if (!lHeader) {
throw new Error("header name must be a non-empty string");
}
const key = utils_default.findKey(self2, lHeader);
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
self2[key || _header] = normalizeValue(_value);
}
}
const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
if (utils_default.isPlainObject(header) || header instanceof this.constructor) {
setHeaders(header, valueOrRewrite);
} else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
setHeaders(parseHeaders_default(header), valueOrRewrite);
} else if (utils_default.isObject(header) && utils_default.isIterable(header)) {
let obj = {}, dest, key;
for (const entry of header) {
if (!utils_default.isArray(entry)) {
throw TypeError("Object iterator must return a key-value pair");
}
obj[key = entry[0]] = (dest = obj[key]) ? utils_default.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
}
setHeaders(obj, valueOrRewrite);
} else {
header != null && setHeader(valueOrRewrite, header, rewrite);
}
return this;
}
get(header, parser) {
header = normalizeHeader(header);
if (header) {
const key = utils_default.findKey(this, header);
if (key) {
const value = this[key];
if (!parser) {
return value;
}
if (parser === true) {
return parseTokens(value);
}
if (utils_default.isFunction(parser)) {
return parser.call(this, value, key);
}
if (utils_default.isRegExp(parser)) {
return parser.exec(value);
}
throw new TypeError("parser must be boolean|regexp|function");
}
}
}
has(header, matcher) {
header = normalizeHeader(header);
if (header) {
const key = utils_default.findKey(this, header);
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
}
return false;
}
delete(header, matcher) {
const self2 = this;
let deleted = false;
function deleteHeader(_header) {
_header = normalizeHeader(_header);
if (_header) {
const key = utils_default.findKey(self2, _header);
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
delete self2[key];
deleted = true;
}
}
}
if (utils_default.isArray(header)) {
header.forEach(deleteHeader);
} else {
deleteHeader(header);
}
return deleted;
}
clear(matcher) {
const keys = Object.keys(this);
let i = keys.length;
let deleted = false;
while (i--) {
const key = keys[i];
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
delete this[key];
deleted = true;
}
}
return deleted;
}
normalize(format) {
const self2 = this;
const headers = {};
utils_default.forEach(this, (value, header) => {
const key = utils_default.findKey(headers, header);
if (key) {
self2[key] = normalizeValue(value);
delete self2[header];
return;
}
const normalized = format ? formatHeader(header) : String(header).trim();
if (normalized !== header) {
delete self2[header];
}
self2[normalized] = normalizeValue(value);
headers[normalized] = true;
});
return this;
}
concat(...targets) {
return this.constructor.concat(this, ...targets);
}
toJSON(asStrings) {
const obj = /* @__PURE__ */ Object.create(null);
utils_default.forEach(this, (value, header) => {
value != null && value !== false && (obj[header] = asStrings && utils_default.isArray(value) ? value.join(", ") : value);
});
return obj;
}
[Symbol.iterator]() {
return Object.entries(this.toJSON())[Symbol.iterator]();
}
toString() {
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
}
getSetCookie() {
return this.get("set-cookie") || [];
}
get [Symbol.toStringTag]() {
return "AxiosHeaders";
}
static from(thing) {
return thing instanceof this ? thing : new this(thing);
}
static concat(first, ...targets) {
const computed = new this(first);
targets.forEach((target) => computed.set(target));
return computed;
}
static accessor(header) {
const internals = this[$internals] = this[$internals] = {
accessors: {}
};
const accessors = internals.accessors;
const prototype2 = this.prototype;
function defineAccessor(_header) {
const lHeader = normalizeHeader(_header);
if (!accessors[lHeader]) {
buildAccessors(prototype2, _header);
accessors[lHeader] = true;
}
}
utils_default.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
return this;
}
};
AxiosHeaders.accessor([
"Content-Type",
"Content-Length",
"Accept",
"Accept-Encoding",
"User-Agent",
"Authorization"
]);
utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
let mapped = key[0].toUpperCase() + key.slice(1);
return {
get: () => value,
set(headerValue) {
this[mapped] = headerValue;
}
};
});
utils_default.freezeMethods(AxiosHeaders);
var AxiosHeaders_default = AxiosHeaders;
// node_modules/axios/lib/core/transformData.js
function transformData(fns, response) {
const config = this || defaults_default;
const context = response || config;
const headers = AxiosHeaders_default.from(context.headers);
let data = context.data;
utils_default.forEach(fns, function transform(fn) {
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
});
headers.normalize();
return data;
}
// node_modules/axios/lib/cancel/isCancel.js
function isCancel(value) {
return !!(value && value.__CANCEL__);
}
// node_modules/axios/lib/cancel/CanceledError.js
var CanceledError = class extends AxiosError_default {
/**
* A `CanceledError` is an object that is thrown when an operation is canceled.
*
* @param {string=} message The message.
* @param {Object=} config The config.
* @param {Object=} request The request.
*
* @returns {CanceledError} The created error.
*/
constructor(message, config, request) {
super(message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
this.name = "CanceledError";
this.__CANCEL__ = true;
}
};
var CanceledError_default = CanceledError;
// node_modules/axios/lib/core/settle.js
function settle(resolve, reject, response) {
const validateStatus2 = response.config.validateStatus;
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
resolve(response);
} else {
reject(
new AxiosError_default(
"Request failed with status code " + response.status,
[AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
response.config,
response.request,
response
)
);
}
}
// node_modules/axios/lib/helpers/parseProtocol.js
function parseProtocol(url) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
return match && match[1] || "";
}
// node_modules/axios/lib/helpers/speedometer.js
function speedometer(samplesCount, min) {
samplesCount = samplesCount || 10;
const bytes = new Array(samplesCount);
const timestamps = new Array(samplesCount);
let head = 0;
let tail = 0;
let firstSampleTS;
min = min !== void 0 ? min : 1e3;
return function push(chunkLength) {
const now = Date.now();
const startedAt = timestamps[tail];
if (!firstSampleTS) {
firstSampleTS = now;
}
bytes[head] = chunkLength;
timestamps[head] = now;
let i = tail;
let bytesCount = 0;
while (i !== head) {
bytesCount += bytes[i++];
i = i % samplesCount;
}
head = (head + 1) % samplesCount;
if (head === tail) {
tail = (tail + 1) % samplesCount;
}
if (now - firstSampleTS < min) {
return;
}
const passed = startedAt && now - startedAt;
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
};
}
var speedometer_default = speedometer;
// node_modules/axios/lib/helpers/throttle.js
function throttle(fn, freq) {
let timestamp = 0;
let threshold = 1e3 / freq;
let lastArgs;
let timer;
const invoke = (args, now = Date.now()) => {
timestamp = now;
lastArgs = null;
if (timer) {
clearTimeout(timer);
timer = null;
}
fn(...args);
};
const throttled = (...args) => {
const now = Date.now();
const passed = now - timestamp;
if (passed >= threshold) {
invoke(args, now);
} else {
lastArgs = args;
if (!timer) {
timer = setTimeout(() => {
timer = null;
invoke(lastArgs);
}, threshold - passed);
}
}
};
const flush = () => lastArgs && invoke(lastArgs);
return [throttled, flush];
}
var throttle_default = throttle;
// node_modules/axios/lib/helpers/progressEventReducer.js
var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
let bytesNotified = 0;
const _speedometer = speedometer_default(50, 250);
return throttle_default((e) => {
const rawLoaded = e.loaded;
const total = e.lengthComputable ? e.total : void 0;
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
const progressBytes = Math.max(0, loaded - bytesNotified);
const rate = _speedometer(progressBytes);
bytesNotified = Math.max(bytesNotified, loaded);
const data = {
loaded,
total,
progress: total ? loaded / total : void 0,
bytes: progressBytes,
rate: rate ? rate : void 0,
estimated: rate && total ? (total - loaded) / rate : void 0,
event: e,
lengthComputable: total != null,
[isDownloadStream ? "download" : "upload"]: true
};
listener(data);
}, freq);
};
var progressEventDecorator = (total, throttled) => {
const lengthComputable = total != null;
return [
(loaded) => throttled[0]({
lengthComputable,
total,
loaded
}),
throttled[1]
];
};
var asyncDecorator = (fn) => (...args) => utils_default.asap(() => fn(...args));
// node_modules/axios/lib/helpers/isURLSameOrigin.js
var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
url = new URL(url, platform_default.origin);
return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
})(
new URL(platform_default.origin),
platform_default.navigator && /(msie|trident)/i.test(platform_default.navigator.userAgent)
) : () => true;
// node_modules/axios/lib/helpers/cookies.js
var cookies_default = platform_default.hasStandardBrowserEnv ? (
// Standard browser envs support document.cookie
{
write(name, value, expires, path, domain, secure, sameSite) {
if (typeof document === "undefined") return;
const cookie = [`${name}=${encodeURIComponent(value)}`];
if (utils_default.isNumber(expires)) {
cookie.push(`expires=${new Date(expires).toUTCString()}`);
}
if (utils_default.isString(path)) {
cookie.push(`path=${path}`);
}
if (utils_default.isString(domain)) {
cookie.push(`domain=${domain}`);
}
if (secure === true) {
cookie.push("secure");
}
if (utils_default.isString(sameSite)) {
cookie.push(`SameSite=${sameSite}`);
}
document.cookie = cookie.join("; ");
},
read(name) {
if (typeof document === "undefined") return null;
const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
return match ? decodeURIComponent(match[1]) : null;
},
remove(name) {
this.write(name, "", Date.now() - 864e5, "/");
}
}
) : (
// Non-standard browser env (web workers, react-native) lack needed support.
{
write() {
},
read() {
return null;
},
remove() {
}
}
);
// node_modules/axios/lib/helpers/isAbsoluteURL.js
function isAbsoluteURL(url) {
if (typeof url !== "string") {
return false;
}
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
}
// node_modules/axios/lib/helpers/combineURLs.js
function combineURLs(baseURL, relativeURL) {
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
}
// node_modules/axios/lib/core/buildFullPath.js
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
let isRelativeUrl = !isAbsoluteURL(requestedURL);
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
return combineURLs(baseURL, requestedURL);
}
return requestedURL;
}
// node_modules/axios/lib/core/mergeConfig.js
var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing;
function mergeConfig(config1, config2) {
config2 = config2 || {};
const config = /* @__PURE__ */ Object.create(null);
Object.defineProperty(config, "hasOwnProperty", {
value: Object.prototype.hasOwnProperty,
enumerable: false,
writable: true,
configurable: true
});
function getMergedValue(target, source, prop, caseless) {
if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
return utils_default.merge.call({ caseless }, target, source);
} else if (utils_default.isPlainObject(source)) {
return utils_default.merge({}, source);
} else if (utils_default.isArray(source)) {
return source.slice();
}
return source;
}
function mergeDeepProperties(a, b, prop, caseless) {
if (!utils_default.isUndefined(b)) {
return getMergedValue(a, b, prop, caseless);
} else if (!utils_default.isUndefined(a)) {
return getMergedValue(void 0, a, prop, caseless);
}
}
function valueFromConfig2(a, b) {
if (!utils_default.isUndefined(b)) {
return getMergedValue(void 0, b);
}
}
function defaultToConfig2(a, b) {
if (!utils_default.isUndefined(b)) {
return getMergedValue(void 0, b);
} else if (!utils_default.isUndefined(a)) {
return getMergedValue(void 0, a);
}
}
function mergeDirectKeys(a, b, prop) {
if (utils_default.hasOwnProp(config2, prop)) {
return getMergedValue(a, b);
} else if (utils_default.hasOwnProp(config1, prop)) {
return getMergedValue(void 0, a);
}
}
const mergeMap = {
url: valueFromConfig2,
method: valueFromConfig2,
data: valueFromConfig2,
baseURL: defaultToConfig2,
transformRequest: defaultToConfig2,
transformResponse: defaultToConfig2,
paramsSerializer: defaultToConfig2,
timeout: defaultToConfig2,
timeoutMessage: defaultToConfig2,
withCredentials: defaultToConfig2,
withXSRFToken: defaultToConfig2,
adapter: defaultToConfig2,
responseType: defaultToConfig2,
xsrfCookieName: defaultToConfig2,
xsrfHeaderName: defaultToConfig2,
onUploadProgress: defaultToConfig2,
onDownloadProgress: defaultToConfig2,
decompress: defaultToConfig2,
maxContentLength: defaultToConfig2,
maxBodyLength: defaultToConfig2,
beforeRedirect: defaultToConfig2,
transport: defaultToConfig2,
httpAgent: defaultToConfig2,
httpsAgent: defaultToConfig2,
cancelToken: defaultToConfig2,
socketPath: defaultToConfig2,
allowedSocketPaths: defaultToConfig2,
responseEncoding: defaultToConfig2,
validateStatus: mergeDirectKeys,
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
};
utils_default.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
const merge2 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
const a = utils_default.hasOwnProp(config1, prop) ? config1[prop] : void 0;
const b = utils_default.hasOwnProp(config2, prop) ? config2[prop] : void 0;
const configValue = merge2(a, b, prop);
utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
});
return config;
}
// node_modules/axios/lib/helpers/resolveConfig.js
var resolveConfig_default = (config) => {
const newConfig = mergeConfig({}, config);
const own2 = (key) => utils_default.hasOwnProp(newConfig, key) ? newConfig[key] : void 0;
const data = own2("data");
let withXSRFToken = own2("withXSRFToken");
const xsrfHeaderName = own2("xsrfHeaderName");
const xsrfCookieName = own2("xsrfCookieName");
let headers = own2("headers");
const auth = own2("auth");
const baseURL = own2("baseURL");
const allowAbsoluteUrls = own2("allowAbsoluteUrls");
const url = own2("url");
newConfig.headers = headers = AxiosHeaders_default.from(headers);
newConfig.url = buildURL(
buildFullPath(baseURL, url, allowAbsoluteUrls),
config.params,
config.paramsSerializer
);
if (auth) {
headers.set(
"Authorization",
"Basic " + btoa(
(auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")
)
);
}
if (utils_default.isFormData(data)) {
if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) {
headers.setContentType(void 0);
} else if (utils_default.isFunction(data.getHeaders)) {
const formHeaders = data.getHeaders();
const allowedHeaders = ["content-type", "content-length"];
Object.entries(formHeaders).forEach(([key, val]) => {
if (allowedHeaders.includes(key.toLowerCase())) {
headers.set(key, val);
}
});
}
}
if (platform_default.hasStandardBrowserEnv) {
if (utils_default.isFunction(withXSRFToken)) {
withXSRFToken = withXSRFToken(newConfig);
}
const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin_default(newConfig.url);
if (shouldSendXSRF) {
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies_default.read(xsrfCookieName);
if (xsrfValue) {
headers.set(xsrfHeaderName, xsrfValue);
}
}
}
return newConfig;
};
// node_modules/axios/lib/adapters/xhr.js
var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
var xhr_default = isXHRAdapterSupported && function(config) {
return new Promise(function dispatchXhrRequest(resolve, reject) {
const _config = resolveConfig_default(config);
let requestData = _config.data;
const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
let { responseType, onUploadProgress, onDownloadProgress } = _config;
let onCanceled;
let uploadThrottled, downloadThrottled;
let flushUpload, flushDownload;
function done() {
flushUpload && flushUpload();
flushDownload && flushDownload();
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
}
let request = new XMLHttpRequest();
request.open(_config.method.toUpperCase(), _config.url, true);
request.timeout = _config.timeout;
function onloadend() {
if (!request) {
return;
}
const responseHeaders = AxiosHeaders_default.from(
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
);
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
const response = {
data: responseData,
status: request.status,
statusText: request.statusText,
headers: responseHeaders,
config,
request
};
settle(
function _resolve(value) {
resolve(value);
done();
},
function _reject(err) {
reject(err);
done();
},
response
);
request = null;
}
if ("onloadend" in request) {
request.onloadend = onloadend;
} else {
request.onreadystatechange = function handleLoad() {
if (!request || request.readyState !== 4) {
return;
}
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
return;
}
setTimeout(onloadend);
};
}
request.onabort = function handleAbort() {
if (!request) {
return;
}
reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
request = null;
};
request.onerror = function handleError(event) {
const msg = event && event.message ? event.message : "Network Error";
const err = new AxiosError_default(msg, AxiosError_default.ERR_NETWORK, config, request);
err.event = event || null;
reject(err);
request = null;
};
request.ontimeout = function handleTimeout() {
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
const transitional2 = _config.transitional || transitional_default;
if (_config.timeoutErrorMessage) {
timeoutErrorMessage = _config.timeoutErrorMessage;
}
reject(
new AxiosError_default(
timeoutErrorMessage,
transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
config,
request
)
);
request = null;
};
requestData === void 0 && requestHeaders.setContentType(null);
if ("setRequestHeader" in request) {
utils_default.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
request.setRequestHeader(key, val);
});
}
if (!utils_default.isUndefined(_config.withCredentials)) {
request.withCredentials = !!_config.withCredentials;
}
if (responseType && responseType !== "json") {
request.responseType = _config.responseType;
}
if (onDownloadProgress) {
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
request.addEventListener("progress", downloadThrottled);
}
if (onUploadProgress && request.upload) {
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
request.upload.addEventListener("progress", uploadThrottled);
request.upload.addEventListener("loadend", flushUpload);
}
if (_config.cancelToken || _config.signal) {
onCanceled = (cancel) => {
if (!request) {
return;
}
reject(!cancel || cancel.type ? new CanceledError_default(null, config, request) : cancel);
request.abort();
request = null;
};
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
if (_config.signal) {
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
}
}
const protocol = parseProtocol(_config.url);
if (protocol && platform_default.protocols.indexOf(protocol) === -1) {
reject(
new AxiosError_default(
"Unsupported protocol " + protocol + ":",
AxiosError_default.ERR_BAD_REQUEST,
config
)
);
return;
}
request.send(requestData || null);
});
};
// node_modules/axios/lib/helpers/composeSignals.js
var composeSignals = (signals, timeout) => {
const { length } = signals = signals ? signals.filter(Boolean) : [];
if (timeout || length) {
let controller = new AbortController();
let aborted;
const onabort = function(reason) {
if (!aborted) {
aborted = true;
unsubscribe();
const err = reason instanceof Error ? reason : this.reason;
controller.abort(
err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err)
);
}
};
let timer = timeout && setTimeout(() => {
timer = null;
onabort(new AxiosError_default(`timeout of ${timeout}ms exceeded`, AxiosError_default.ETIMEDOUT));
}, timeout);
const unsubscribe = () => {
if (signals) {
timer && clearTimeout(timer);
timer = null;
signals.forEach((signal2) => {
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
});
signals = null;
}
};
signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
const { signal } = controller;
signal.unsubscribe = () => utils_default.asap(unsubscribe);
return signal;
}
};
var composeSignals_default = composeSignals;
// node_modules/axios/lib/helpers/trackStream.js
var streamChunk = function* (chunk, chunkSize) {
let len = chunk.byteLength;
if (!chunkSize || len < chunkSize) {
yield chunk;
return;
}
let pos = 0;
let end;
while (pos < len) {
end = pos + chunkSize;
yield chunk.slice(pos, end);
pos = end;
}
};
var readBytes = async function* (iterable, chunkSize) {
for await (const chunk of readStream(iterable)) {
yield* streamChunk(chunk, chunkSize);
}
};
var readStream = async function* (stream) {
if (stream[Symbol.asyncIterator]) {
yield* stream;
return;
}
const reader = stream.getReader();
try {
for (; ; ) {
const { done, value } = await reader.read();
if (done) {
break;
}
yield value;
}
} finally {
await reader.cancel();
}
};
var trackStream = (stream, chunkSize, onProgress, onFinish) => {
const iterator2 = readBytes(stream, chunkSize);
let bytes = 0;
let done;
let _onFinish = (e) => {
if (!done) {
done = true;
onFinish && onFinish(e);
}
};
return new ReadableStream(
{
async pull(controller) {
try {
const { done: done2, value } = await iterator2.next();
if (done2) {
_onFinish();
controller.close();
return;
}
let len = value.byteLength;
if (onProgress) {
let loadedBytes = bytes += len;
onProgress(loadedBytes);
}
controller.enqueue(new Uint8Array(value));
} catch (err) {
_onFinish(err);
throw err;
}
},
cancel(reason) {
_onFinish(reason);
return iterator2.return();
}
},
{
highWaterMark: 2
}
);
};
// node_modules/axios/lib/adapters/fetch.js
var DEFAULT_CHUNK_SIZE = 64 * 1024;
var { isFunction: isFunction2 } = utils_default;
var globalFetchAPI = (({ Request, Response }) => ({
Request,
Response
}))(utils_default.global);
var { ReadableStream: ReadableStream2, TextEncoder } = utils_default.global;
var test = (fn, ...args) => {
try {
return !!fn(...args);
} catch (e) {
return false;
}
};
var factory = (env) => {
env = utils_default.merge.call(
{
skipUndefined: true
},
globalFetchAPI,
env
);
const { fetch: envFetch, Request, Response } = env;
const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
const isRequestSupported = isFunction2(Request);
const isResponseSupported = isFunction2(Response);
if (!isFetchSupported) {
return false;
}
const isReadableStreamSupported = isFetchSupported && isFunction2(ReadableStream2);
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
let duplexAccessed = false;
const request = new Request(platform_default.origin, {
body: new ReadableStream2(),
method: "POST",
get duplex() {
duplexAccessed = true;
return "half";
}
});
const hasContentType = request.headers.has("Content-Type");
if (request.body != null) {
request.body.cancel();
}
return duplexAccessed && !hasContentType;
});
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
const resolvers = {
stream: supportsResponseStream && ((res) => res.body)
};
isFetchSupported && (() => {
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
!resolvers[type] && (resolvers[type] = (res, config) => {
let method = res && res[type];
if (method) {
return method.call(res);
}
throw new AxiosError_default(
`Response type '${type}' is not supported`,
AxiosError_default.ERR_NOT_SUPPORT,
config
);
});
});
})();
const getBodyLength = async (body) => {
if (body == null) {
return 0;
}
if (utils_default.isBlob(body)) {
return body.size;
}
if (utils_default.isSpecCompliantForm(body)) {
const _request = new Request(platform_default.origin, {
method: "POST",
body
});
return (await _request.arrayBuffer()).byteLength;
}
if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
return body.byteLength;
}
if (utils_default.isURLSearchParams(body)) {
body = body + "";
}
if (utils_default.isString(body)) {
return (await encodeText(body)).byteLength;
}
};
const resolveBodyLength = async (headers, body) => {
const length = utils_default.toFiniteNumber(headers.getContentLength());
return length == null ? getBodyLength(body) : length;
};
return async (config) => {
let {
url,
method,
data,
signal,
cancelToken,
timeout,
onDownloadProgress,
onUploadProgress,
responseType,
headers,
withCredentials = "same-origin",
fetchOptions
} = resolveConfig_default(config);
let _fetch = envFetch || fetch;
responseType = responseType ? (responseType + "").toLowerCase() : "text";
let composedSignal = composeSignals_default(
[signal, cancelToken && cancelToken.toAbortSignal()],
timeout
);
let request = null;
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
composedSignal.unsubscribe();
});
let requestContentLength;
try {
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
let _request = new Request(url, {
method: "POST",
body: data,
duplex: "half"
});
let contentTypeHeader;
if (utils_default.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
headers.setContentType(contentTypeHeader);
}
if (_request.body) {
const [onProgress, flush] = progressEventDecorator(
requestContentLength,
progressEventReducer(asyncDecorator(onUploadProgress))
);
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
}
}
if (!utils_default.isString(withCredentials)) {
withCredentials = withCredentials ? "include" : "omit";
}
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
if (utils_default.isFormData(data)) {
const contentType = headers.getContentType();
if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
headers.delete("content-type");
}
}
const resolvedOptions = {
...fetchOptions,
signal: composedSignal,
method: method.toUpperCase(),
headers: headers.normalize().toJSON(),
body: data,
duplex: "half",
credentials: isCredentialsSupported ? withCredentials : void 0
};
request = isRequestSupported && new Request(url, resolvedOptions);
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
const options = {};
["status", "statusText", "headers"].forEach((prop) => {
options[prop] = response[prop];
});
const responseContentLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
responseContentLength,
progressEventReducer(asyncDecorator(onDownloadProgress), true)
) || [];
response = new Response(
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
flush && flush();
unsubscribe && unsubscribe();
}),
options
);
}
responseType = responseType || "text";
let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](
response,
config
);
!isStreamResponse && unsubscribe && unsubscribe();
return await new Promise((resolve, reject) => {
settle(resolve, reject, {
data: responseData,
headers: AxiosHeaders_default.from(response.headers),
status: response.status,
statusText: response.statusText,
config,
request
});
});
} catch (err) {
unsubscribe && unsubscribe();
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
throw Object.assign(
new AxiosError_default(
"Network Error",
AxiosError_default.ERR_NETWORK,
config,
request,
err && err.response
),
{
cause: err.cause || err
}
);
}
throw AxiosError_default.from(err, err && err.code, config, request, err && err.response);
}
};
};
var seedCache = /* @__PURE__ */ new Map();
var getFetch = (config) => {
let env = config && config.env || {};
const { fetch: fetch2, Request, Response } = env;
const seeds = [Request, Response, fetch2];
let len = seeds.length, i = len, seed, target, map = seedCache;
while (i--) {
seed = seeds[i];
target = map.get(seed);
target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
map = target;
}
return target;
};
var adapter = getFetch();
// node_modules/axios/lib/adapters/adapters.js
var knownAdapters = {
http: null_default,
xhr: xhr_default,
fetch: {
get: getFetch
}
};
utils_default.forEach(knownAdapters, (fn, value) => {
if (fn) {
try {
Object.defineProperty(fn, "name", { value });
} catch (e) {
}
Object.defineProperty(fn, "adapterName", { value });
}
});
var renderReason = (reason) => `- ${reason}`;
var isResolvedHandle = (adapter2) => utils_default.isFunction(adapter2) || adapter2 === null || adapter2 === false;
function getAdapter(adapters, config) {
adapters = utils_default.isArray(adapters) ? adapters : [adapters];
const { length } = adapters;
let nameOrAdapter;
let adapter2;
const rejectedReasons = {};
for (let i = 0; i < length; i++) {
nameOrAdapter = adapters[i];
let id;
adapter2 = nameOrAdapter;
if (!isResolvedHandle(nameOrAdapter)) {
adapter2 = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
if (adapter2 === void 0) {
throw new AxiosError_default(`Unknown adapter '${id}'`);
}
}
if (adapter2 && (utils_default.isFunction(adapter2) || (adapter2 = adapter2.get(config)))) {
break;
}
rejectedReasons[id || "#" + i] = adapter2;
}
if (!adapter2) {
const reasons = Object.entries(rejectedReasons).map(
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
);
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
throw new AxiosError_default(
`There is no suitable adapter to dispatch the request ` + s,
"ERR_NOT_SUPPORT"
);
}
return adapter2;
}
var adapters_default = {
/**
* Resolve an adapter from a list of adapter names or functions.
* @type {Function}
*/
getAdapter,
/**
* Exposes all known adapters
* @type {Object<string, Function|Object>}
*/
adapters: knownAdapters
};
// node_modules/axios/lib/core/dispatchRequest.js
function throwIfCancellationRequested(config) {
if (config.cancelToken) {
config.cancelToken.throwIfRequested();
}
if (config.signal && config.signal.aborted) {
throw new CanceledError_default(null, config);
}
}
function dispatchRequest(config) {
throwIfCancellationRequested(config);
config.headers = AxiosHeaders_default.from(config.headers);
config.data = transformData.call(config, config.transformRequest);
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
config.headers.setContentType("application/x-www-form-urlencoded", false);
}
const adapter2 = adapters_default.getAdapter(config.adapter || defaults_default.adapter, config);
return adapter2(config).then(
function onAdapterResolution(response) {
throwIfCancellationRequested(config);
response.data = transformData.call(config, config.transformResponse, response);
response.headers = AxiosHeaders_default.from(response.headers);
return response;
},
function onAdapterRejection(reason) {
if (!isCancel(reason)) {
throwIfCancellationRequested(config);
if (reason && reason.response) {
reason.response.data = transformData.call(
config,
config.transformResponse,
reason.response
);
reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
}
}
return Promise.reject(reason);
}
);
}
// node_modules/axios/lib/env/data.js
var VERSION = "1.15.2";
// node_modules/axios/lib/helpers/validator.js
var validators = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
validators[type] = function validator(thing) {
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
};
});
var deprecatedWarnings = {};
validators.transitional = function transitional(validator, version, message) {
function formatMessage(opt, desc) {
return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
}
return (value, opt, opts) => {
if (validator === false) {
throw new AxiosError_default(
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
AxiosError_default.ERR_DEPRECATED
);
}
if (version && !deprecatedWarnings[opt]) {
deprecatedWarnings[opt] = true;
console.warn(
formatMessage(
opt,
" has been deprecated since v" + version + " and will be removed in the near future"
)
);
}
return validator ? validator(value, opt, opts) : true;
};
};
validators.spelling = function spelling(correctSpelling) {
return (value, opt) => {
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
return true;
};
};
function assertOptions(options, schema, allowUnknown) {
if (typeof options !== "object") {
throw new AxiosError_default("options must be an object", AxiosError_default.ERR_BAD_OPTION_VALUE);
}
const keys = Object.keys(options);
let i = keys.length;
while (i-- > 0) {
const opt = keys[i];
const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : void 0;
if (validator) {
const value = options[opt];
const result = value === void 0 || validator(value, opt, options);
if (result !== true) {
throw new AxiosError_default(
"option " + opt + " must be " + result,
AxiosError_default.ERR_BAD_OPTION_VALUE
);
}
continue;
}
if (allowUnknown !== true) {
throw new AxiosError_default("Unknown option " + opt, AxiosError_default.ERR_BAD_OPTION);
}
}
}
var validator_default = {
assertOptions,
validators
};
// node_modules/axios/lib/core/Axios.js
var validators2 = validator_default.validators;
var Axios = class {
constructor(instanceConfig) {
this.defaults = instanceConfig || {};
this.interceptors = {
request: new InterceptorManager_default(),
response: new InterceptorManager_default()
};
}
/**
* Dispatch a request
*
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
* @param {?Object} config
*
* @returns {Promise} The Promise to be fulfilled
*/
async request(configOrUrl, config) {
try {
return await this._request(configOrUrl, config);
} catch (err) {
if (err instanceof Error) {
let dummy = {};
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
const stack = (() => {
if (!dummy.stack) {
return "";
}
const firstNewlineIndex = dummy.stack.indexOf("\n");
return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
})();
try {
if (!err.stack) {
err.stack = stack;
} else if (stack) {
const firstNewlineIndex = stack.indexOf("\n");
const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
err.stack += "\n" + stack;
}
}
} catch (e) {
}
}
throw err;
}
}
_request(configOrUrl, config) {
if (typeof configOrUrl === "string") {
config = config || {};
config.url = configOrUrl;
} else {
config = configOrUrl || {};
}
config = mergeConfig(this.defaults, config);
const { transitional: transitional2, paramsSerializer, headers } = config;
if (transitional2 !== void 0) {
validator_default.assertOptions(
transitional2,
{
silentJSONParsing: validators2.transitional(validators2.boolean),
forcedJSONParsing: validators2.transitional(validators2.boolean),
clarifyTimeoutError: validators2.transitional(validators2.boolean),
legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean)
},
false
);
}
if (paramsSerializer != null) {
if (utils_default.isFunction(paramsSerializer)) {
config.paramsSerializer = {
serialize: paramsSerializer
};
} else {
validator_default.assertOptions(
paramsSerializer,
{
encode: validators2.function,
serialize: validators2.function
},
true
);
}
}
if (config.allowAbsoluteUrls !== void 0) {
} else if (this.defaults.allowAbsoluteUrls !== void 0) {
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
} else {
config.allowAbsoluteUrls = true;
}
validator_default.assertOptions(
config,
{
baseUrl: validators2.spelling("baseURL"),
withXsrfToken: validators2.spelling("withXSRFToken")
},
true
);
config.method = (config.method || this.defaults.method || "get").toLowerCase();
let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
delete headers[method];
});
config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
const requestInterceptorChain = [];
let synchronousRequestInterceptors = true;
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
return;
}
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
const transitional3 = config.transitional || transitional_default;
const legacyInterceptorReqResOrdering = transitional3 && transitional3.legacyInterceptorReqResOrdering;
if (legacyInterceptorReqResOrdering) {
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
} else {
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
}
});
const responseInterceptorChain = [];
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
});
let promise;
let i = 0;
let len;
if (!synchronousRequestInterceptors) {
const chain = [dispatchRequest.bind(this), void 0];
chain.unshift(...requestInterceptorChain);
chain.push(...responseInterceptorChain);
len = chain.length;
promise = Promise.resolve(config);
while (i < len) {
promise = promise.then(chain[i++], chain[i++]);
}
return promise;
}
len = requestInterceptorChain.length;
let newConfig = config;
while (i < len) {
const onFulfilled = requestInterceptorChain[i++];
const onRejected = requestInterceptorChain[i++];
try {
newConfig = onFulfilled(newConfig);
} catch (error) {
onRejected.call(this, error);
break;
}
}
try {
promise = dispatchRequest.call(this, newConfig);
} catch (error) {
return Promise.reject(error);
}
i = 0;
len = responseInterceptorChain.length;
while (i < len) {
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
}
return promise;
}
getUri(config) {
config = mergeConfig(this.defaults, config);
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
return buildURL(fullPath, config.params, config.paramsSerializer);
}
};
utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
Axios.prototype[method] = function(url, config) {
return this.request(
mergeConfig(config || {}, {
method,
url,
data: (config || {}).data
})
);
};
});
utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
function generateHTTPMethod(isForm) {
return function httpMethod(url, data, config) {
return this.request(
mergeConfig(config || {}, {
method,
headers: isForm ? {
"Content-Type": "multipart/form-data"
} : {},
url,
data
})
);
};
}
Axios.prototype[method] = generateHTTPMethod();
Axios.prototype[method + "Form"] = generateHTTPMethod(true);
});
var Axios_default = Axios;
// node_modules/axios/lib/cancel/CancelToken.js
var CancelToken = class _CancelToken {
constructor(executor) {
if (typeof executor !== "function") {
throw new TypeError("executor must be a function.");
}
let resolvePromise;
this.promise = new Promise(function promiseExecutor(resolve) {
resolvePromise = resolve;
});
const token = this;
this.promise.then((cancel) => {
if (!token._listeners) return;
let i = token._listeners.length;
while (i-- > 0) {
token._listeners[i](cancel);
}
token._listeners = null;
});
this.promise.then = (onfulfilled) => {
let _resolve;
const promise = new Promise((resolve) => {
token.subscribe(resolve);
_resolve = resolve;
}).then(onfulfilled);
promise.cancel = function reject() {
token.unsubscribe(_resolve);
};
return promise;
};
executor(function cancel(message, config, request) {
if (token.reason) {
return;
}
token.reason = new CanceledError_default(message, config, request);
resolvePromise(token.reason);
});
}
/**
* Throws a `CanceledError` if cancellation has been requested.
*/
throwIfRequested() {
if (this.reason) {
throw this.reason;
}
}
/**
* Subscribe to the cancel signal
*/
subscribe(listener) {
if (this.reason) {
listener(this.reason);
return;
}
if (this._listeners) {
this._listeners.push(listener);
} else {
this._listeners = [listener];
}
}
/**
* Unsubscribe from the cancel signal
*/
unsubscribe(listener) {
if (!this._listeners) {
return;
}
const index = this._listeners.indexOf(listener);
if (index !== -1) {
this._listeners.splice(index, 1);
}
}
toAbortSignal() {
const controller = new AbortController();
const abort = (err) => {
controller.abort(err);
};
this.subscribe(abort);
controller.signal.unsubscribe = () => this.unsubscribe(abort);
return controller.signal;
}
/**
* Returns an object that contains a new `CancelToken` and a function that, when called,
* cancels the `CancelToken`.
*/
static source() {
let cancel;
const token = new _CancelToken(function executor(c) {
cancel = c;
});
return {
token,
cancel
};
}
};
var CancelToken_default = CancelToken;
// node_modules/axios/lib/helpers/spread.js
function spread(callback) {
return function wrap(arr) {
return callback.apply(null, arr);
};
}
// node_modules/axios/lib/helpers/isAxiosError.js
function isAxiosError(payload) {
return utils_default.isObject(payload) && payload.isAxiosError === true;
}
// node_modules/axios/lib/helpers/HttpStatusCode.js
var HttpStatusCode = {
Continue: 100,
SwitchingProtocols: 101,
Processing: 102,
EarlyHints: 103,
Ok: 200,
Created: 201,
Accepted: 202,
NonAuthoritativeInformation: 203,
NoContent: 204,
ResetContent: 205,
PartialContent: 206,
MultiStatus: 207,
AlreadyReported: 208,
ImUsed: 226,
MultipleChoices: 300,
MovedPermanently: 301,
Found: 302,
SeeOther: 303,
NotModified: 304,
UseProxy: 305,
Unused: 306,
TemporaryRedirect: 307,
PermanentRedirect: 308,
BadRequest: 400,
Unauthorized: 401,
PaymentRequired: 402,
Forbidden: 403,
NotFound: 404,
MethodNotAllowed: 405,
NotAcceptable: 406,
ProxyAuthenticationRequired: 407,
RequestTimeout: 408,
Conflict: 409,
Gone: 410,
LengthRequired: 411,
PreconditionFailed: 412,
PayloadTooLarge: 413,
UriTooLong: 414,
UnsupportedMediaType: 415,
RangeNotSatisfiable: 416,
ExpectationFailed: 417,
ImATeapot: 418,
MisdirectedRequest: 421,
UnprocessableEntity: 422,
Locked: 423,
FailedDependency: 424,
TooEarly: 425,
UpgradeRequired: 426,
PreconditionRequired: 428,
TooManyRequests: 429,
RequestHeaderFieldsTooLarge: 431,
UnavailableForLegalReasons: 451,
InternalServerError: 500,
NotImplemented: 501,
BadGateway: 502,
ServiceUnavailable: 503,
GatewayTimeout: 504,
HttpVersionNotSupported: 505,
VariantAlsoNegotiates: 506,
InsufficientStorage: 507,
LoopDetected: 508,
NotExtended: 510,
NetworkAuthenticationRequired: 511,
WebServerIsDown: 521,
ConnectionTimedOut: 522,
OriginIsUnreachable: 523,
TimeoutOccurred: 524,
SslHandshakeFailed: 525,
InvalidSslCertificate: 526
};
Object.entries(HttpStatusCode).forEach(([key, value]) => {
HttpStatusCode[value] = key;
});
var HttpStatusCode_default = HttpStatusCode;
// node_modules/axios/lib/axios.js
function createInstance(defaultConfig) {
const context = new Axios_default(defaultConfig);
const instance = bind(Axios_default.prototype.request, context);
utils_default.extend(instance, Axios_default.prototype, context, { allOwnKeys: true });
utils_default.extend(instance, context, null, { allOwnKeys: true });
instance.create = function create(instanceConfig) {
return createInstance(mergeConfig(defaultConfig, instanceConfig));
};
return instance;
}
var axios = createInstance(defaults_default);
axios.Axios = Axios_default;
axios.CanceledError = CanceledError_default;
axios.CancelToken = CancelToken_default;
axios.isCancel = isCancel;
axios.VERSION = VERSION;
axios.toFormData = toFormData_default;
axios.AxiosError = AxiosError_default;
axios.Cancel = axios.CanceledError;
axios.all = function all(promises) {
return Promise.all(promises);
};
axios.spread = spread;
axios.isAxiosError = isAxiosError;
axios.mergeConfig = mergeConfig;
axios.AxiosHeaders = AxiosHeaders_default;
axios.formToJSON = (thing) => formDataToJSON_default(utils_default.isHTMLForm(thing) ? new FormData(thing) : thing);
axios.getAdapter = adapters_default.getAdapter;
axios.HttpStatusCode = HttpStatusCode_default;
axios.default = axios;
var axios_default = axios;
// node_modules/axios/index.js
var {
Axios: Axios2,
AxiosError: AxiosError2,
CanceledError: CanceledError2,
isCancel: isCancel2,
CancelToken: CancelToken2,
VERSION: VERSION2,
all: all2,
Cancel,
isAxiosError: isAxiosError2,
spread: spread2,
toFormData: toFormData2,
AxiosHeaders: AxiosHeaders2,
HttpStatusCode: HttpStatusCode2,
formToJSON,
getAdapter: getAdapter2,
mergeConfig: mergeConfig2
} = axios_default;
// src/api-class.ts
var Api = class {
constructor(params) {
this.appendHeaders = (headers) => {
if (this.personalAccessToken) headers["X-Figma-Token"] = this.personalAccessToken;
if (this.oAuthToken) headers["Authorization"] = `Bearer ${this.oAuthToken}`;
};
this.request = (url, opts) => {
const headers = {};
this.appendHeaders(headers);
const axiosParams = {
url,
...opts,
headers
};
return axios_default(axiosParams).then((response) => response.data).catch((error) => {
throw new ApiError(error);
});
};
this.getFile = getFileApi;
this.getFileNodes = getFileNodesApi;
this.getFileMeta = getFileMetaApi;
this.getImages = getImagesApi;
this.getImageFills = getImageFillsApi;
this.getComments = getCommentsApi;
this.postComment = postCommentApi;
this.deleteComment = deleteCommentApi;
this.getCommentReactions = getCommentReactionsApi;
this.postCommentReaction = postCommentReactionApi;
this.deleteCommentReactions = deleteCommentReactionsApi;
this.getUserMe = getUserMeApi;
this.getFileVersions = getFileVersionsApi;
this.getTeamProjects = getTeamProjectsApi;
this.getProjectFiles = getProjectFilesApi;
this.getTeamComponents = getTeamComponentsApi;
this.getFileComponents = getFileComponentsApi;
this.getComponent = getComponentApi;
this.getTeamComponentSets = getTeamComponentSetsApi;
this.getFileComponentSets = getFileComponentSetsApi;
this.getComponentSet = getComponentSetApi;
this.getTeamStyles = getTeamStylesApi;
this.getFileStyles = getFileStylesApi;
this.getStyle = getStyleApi;
this.getWebhook = getWebhookApi;
this.postWebhook = postWebhookApi;
this.putWebhook = putWebhookApi;
this.deleteWebhook = deleteWebhookApi;
this.getTeamWebhooks = getTeamWebhooksApi;
this.getWebhookRequests = getWebhookRequestsApi;
this.getLocalVariables = getLocalVariablesApi;
this.getPublishedVariables = getPublishedVariablesApi;
this.postVariables = postVariablesApi;
this.getDevResources = getDevResourcesApi;
this.postDevResources = postDevResourcesApi;
this.putDevResources = putDevResourcesApi;
this.deleteDevResources = deleteDevResourcesApi;
this.getLibraryAnalyticsComponentActions = getLibraryAnalyticsComponentActionsApi;
this.getLibraryAnalyticsComponentUsages = getLibraryAnalyticsComponentUsagesApi;
this.getLibraryAnalyticsStyleActions = getLibraryAnalyticsStyleActionsApi;
this.getLibraryAnalyticsStyleUsages = getLibraryAnalyticsStyleUsagesApi;
this.getLibraryAnalyticsVariableActions = getLibraryAnalyticsVariableActionsApi;
this.getLibraryAnalyticsVariableUsages = getLibraryAnalyticsVariableUsagesApi;
if ("personalAccessToken" in params) {
this.personalAccessToken = params.personalAccessToken;
}
if ("oAuthToken" in params) {
this.oAuthToken = params.oAuthToken;
}
}
};
function oAuthLink(client_id, redirect_uri, scope, state, response_type) {
const queryParams = toQueryParams({
client_id,
redirect_uri,
scope: Array.isArray(scope) ? scope.join(" ") : scope,
state,
response_type
});
return `https://www.figma.com/oauth?${queryParams}`;
}
async function oAuthToken(client_id, client_secret, redirect_uri, code, grant_type) {
const headers = {
"Authorization": `Basic ${Buffer.from(`${client_id}:${client_secret}`).toString("base64")}`
};
const queryParams = toQueryParams({
redirect_uri,
code,
grant_type
});
const url = `https://api.figma.com/v1/oauth/token?${queryParams}`;
const res = await axios_default.post(url, null, { headers });
if (res.status !== 200) throw new ApiError(res);
return res.data;
}
return __toCommonJS(index_exports);
})();
================================================
FILE: lib/index.d.ts
================================================
export * from './config';
export * from './api-class';
================================================
FILE: lib/index.js
================================================
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all3) => {
for (var name in all3)
__defProp(target, name, { get: all3[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/delayed-stream/lib/delayed_stream.js
var require_delayed_stream = __commonJS({
"node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
var Stream = require("stream").Stream;
var util3 = require("util");
module2.exports = DelayedStream;
function DelayedStream() {
this.source = null;
this.dataSize = 0;
this.maxDataSize = 1024 * 1024;
this.pauseStream = true;
this._maxDataSizeExceeded = false;
this._released = false;
this._bufferedEvents = [];
}
util3.inherits(DelayedStream, Stream);
DelayedStream.create = function(source, options) {
var delayedStream = new this();
options = options || {};
for (var option in options) {
delayedStream[option] = options[option];
}
delayedStream.source = source;
var realEmit = source.emit;
source.emit = function() {
delayedStream._handleEmit(arguments);
return realEmit.apply(source, arguments);
};
source.on("error", function() {
});
if (delayedStream.pauseStream) {
source.pause();
}
return delayedStream;
};
Object.defineProperty(DelayedStream.prototype, "readable", {
configurable: true,
enumerable: true,
get: function() {
return this.source.readable;
}
});
DelayedStream.prototype.setEncoding = function() {
return this.source.setEncoding.apply(this.source, arguments);
};
DelayedStream.prototype.resume = function() {
if (!this._released) {
this.release();
}
this.source.resume();
};
DelayedStream.prototype.pause = function() {
this.source.pause();
};
DelayedStream.prototype.release = function() {
this._released = true;
this._bufferedEvents.forEach(function(args) {
this.emit.apply(this, args);
}.bind(this));
this._bufferedEvents = [];
};
DelayedStream.prototype.pipe = function() {
var r = Stream.prototype.pipe.apply(this, arguments);
this.resume();
return r;
};
DelayedStream.prototype._handleEmit = function(args) {
if (this._released) {
this.emit.apply(this, args);
return;
}
if (args[0] === "data") {
this.dataSize += args[1].length;
this._checkIfMaxDataSizeExceeded();
}
this._bufferedEvents.push(args);
};
DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
if (this._maxDataSizeExceeded) {
return;
}
if (this.dataSize <= this.maxDataSize) {
return;
}
this._maxDataSizeExceeded = true;
var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded.";
this.emit("error", new Error(message));
};
}
});
// node_modules/combined-stream/lib/combined_stream.js
var require_combined_stream = __commonJS({
"node_modules/combined-stream/lib/combined_stream.js"(exports2, module2) {
var util3 = require("util");
var Stream = require("stream").Stream;
var DelayedStream = require_delayed_stream();
module2.exports = CombinedStream;
function CombinedStream() {
this.writable = false;
this.readable = true;
this.dataSize = 0;
this.maxDataSize = 2 * 1024 * 1024;
this.pauseStreams = true;
this._released = false;
this._streams = [];
this._currentStream = null;
this._insideLoop = false;
this._pendingNext = false;
}
util3.inherits(CombinedStream, Stream);
CombinedStream.create = function(options) {
var combinedStream = new this();
options = options || {};
for (var option in options) {
combinedStream[option] = options[option];
}
return combinedStream;
};
CombinedStream.isStreamLike = function(stream4) {
return typeof stream4 !== "function" && typeof stream4 !== "string" && typeof stream4 !== "boolean" && typeof stream4 !== "number" && !Buffer.isBuffer(stream4);
};
CombinedStream.prototype.append = function(stream4) {
var isStreamLike = CombinedStream.isStreamLike(stream4);
if (isStreamLike) {
if (!(stream4 instanceof DelayedStream)) {
var newStream = DelayedStream.create(stream4, {
maxDataSize: Infinity,
pauseStream: this.pauseStreams
});
stream4.on("data", this._checkDataSize.bind(this));
stream4 = newStream;
}
this._handleErrors(stream4);
if (this.pauseStreams) {
stream4.pause();
}
}
this._streams.push(stream4);
return this;
};
CombinedStream.prototype.pipe = function(dest, options) {
Stream.prototype.pipe.call(this, dest, options);
this.resume();
return dest;
};
CombinedStream.prototype._getNext = function() {
this._currentStream = null;
if (this._insideLoop) {
this._pendingNext = true;
return;
}
this._insideLoop = true;
try {
do {
this._pendingNext = false;
this._realGetNext();
} while (this._pendingNext);
} finally {
this._insideLoop = false;
}
};
CombinedStream.prototype._realGetNext = function() {
var stream4 = this._streams.shift();
if (typeof stream4 == "undefined") {
this.end();
return;
}
if (typeof stream4 !== "function") {
this._pipeNext(stream4);
return;
}
var getStream = stream4;
getStream(function(stream5) {
var isStreamLike = CombinedStream.isStreamLike(stream5);
if (isStreamLike) {
stream5.on("data", this._checkDataSize.bind(this));
this._handleErrors(stream5);
}
this._pipeNext(stream5);
}.bind(this));
};
CombinedStream.prototype._pipeNext = function(stream4) {
this._currentStream = stream4;
var isStreamLike = CombinedStream.isStreamLike(stream4);
if (isStreamLike) {
stream4.on("end", this._getNext.bind(this));
stream4.pipe(this, { end: false });
return;
}
var value = stream4;
this.write(value);
this._getNext();
};
CombinedStream.prototype._handleErrors = function(stream4) {
var self2 = this;
stream4.on("error", function(err) {
self2._emitError(err);
});
};
CombinedStream.prototype.write = function(data) {
this.emit("data", data);
};
CombinedStream.prototype.pause = function() {
if (!this.pauseStreams) {
return;
}
if (this.pauseStreams && this._currentStream && typeof this._currentStream.pause == "function") this._currentStream.pause();
this.emit("pause");
};
CombinedStream.prototype.resume = function() {
if (!this._released) {
this._released = true;
this.writable = true;
this._getNext();
}
if (this.pauseStreams && this._currentStream && typeof this._currentStream.resume == "function") this._currentStream.resume();
this.emit("resume");
};
CombinedStream.prototype.end = function() {
this._reset();
this.emit("end");
};
CombinedStream.prototype.destroy = function() {
this._reset();
this.emit("close");
};
CombinedStream.prototype._reset = function() {
this.writable = false;
this._streams = [];
this._currentStream = null;
};
CombinedStream.prototype._checkDataSize = function() {
this._updateDataSize();
if (this.dataSize <= this.maxDataSize) {
return;
}
var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded.";
this._emitError(new Error(message));
};
CombinedStream.prototype._updateDataSize = function() {
this.dataSize = 0;
var self2 = this;
this._streams.forEach(function(stream4) {
if (!stream4.dataSize) {
return;
}
self2.dataSize += stream4.dataSize;
});
if (this._currentStream && this._currentStream.dataSize) {
this.dataSize += this._currentStream.dataSize;
}
};
CombinedStream.prototype._emitError = function(err) {
this._reset();
this.emit("error", err);
};
}
});
// node_modules/mime-db/db.json
var require_db = __commonJS({
"node_modules/mime-db/db.json"(exports2, module2) {
module2.exports = {
"application/1d-interleaved-parityfec": {
source: "iana"
},
"application/3gpdash-qoe-report+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/3gpp-ims+xml": {
source: "iana",
compressible: true
},
"application/3gpphal+json": {
source: "iana",
compressible: true
},
"application/3gpphalforms+json": {
source: "iana",
compressible: true
},
"application/a2l": {
source: "iana"
},
"application/ace+cbor": {
source: "iana"
},
"application/activemessage": {
source: "iana"
},
"application/activity+json": {
source: "iana",
compressible: true
},
"application/alto-costmap+json": {
source: "iana",
compressible: true
},
"application/alto-costmapfilter+json": {
source: "iana",
compressible: true
},
"application/alto-directory+json": {
source: "iana",
compressible: true
},
"application/alto-endpointcost+json": {
source: "iana",
compressible: true
},
"application/alto-endpointcostparams+json": {
source: "iana",
compressible: true
},
"application/alto-endpointprop+json": {
source: "iana",
compressible: true
},
"application/alto-endpointpropparams+json": {
source: "iana",
compressible: true
},
"application/alto-error+json": {
source: "iana",
compressible: true
},
"application/alto-networkmap+json": {
source: "iana",
compressible: true
},
"application/alto-networkmapfilter+json": {
source: "iana",
compressible: true
},
"application/alto-updatestreamcontrol+json": {
source: "iana",
compressible: true
},
"application/alto-updatestreamparams+json": {
source: "iana",
compressible: true
},
"application/aml": {
source: "iana"
},
"application/andrew-inset": {
source: "iana",
extensions: ["ez"]
},
"application/applefile": {
source: "iana"
},
"application/applixware": {
source: "apache",
extensions: ["aw"]
},
"application/at+jwt": {
source: "iana"
},
"application/atf": {
source: "iana"
},
"application/atfx": {
source: "iana"
},
"application/atom+xml": {
source: "iana",
compressible: true,
extensions: ["atom"]
},
"application/atomcat+xml": {
source: "iana",
compressible: true,
extensions: ["atomcat"]
},
"application/atomdeleted+xml": {
source: "iana",
compressible: true,
extensions: ["atomdeleted"]
},
"application/atomicmail": {
source: "iana"
},
"application/atomsvc+xml": {
source: "iana",
compressible: true,
extensions: ["atomsvc"]
},
"application/atsc-dwd+xml": {
source: "iana",
compressible: true,
extensions: ["dwd"]
},
"application/atsc-dynamic-event-message": {
source: "iana"
},
"application/atsc-held+xml": {
source: "iana",
compressible: true,
extensions: ["held"]
},
"application/atsc-rdt+json": {
source: "iana",
compressible: true
},
"application/atsc-rsat+xml": {
source: "iana",
compressible: true,
extensions: ["rsat"]
},
"application/atxml": {
source: "iana"
},
"application/auth-policy+xml": {
source: "iana",
compressible: true
},
"application/bacnet-xdd+zip": {
source: "iana",
compressible: false
},
"application/batch-smtp": {
source: "iana"
},
"application/bdoc": {
compressible: false,
extensions: ["bdoc"]
},
"application/beep+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/calendar+json": {
source: "iana",
compressible: true
},
"application/calendar+xml": {
source: "iana",
compressible: true,
extensions: ["xcs"]
},
"application/call-completion": {
source: "iana"
},
"application/cals-1840": {
source: "iana"
},
"application/captive+json": {
source: "iana",
compressible: true
},
"application/cbor": {
source: "iana"
},
"application/cbor-seq": {
source: "iana"
},
"application/cccex": {
source: "iana"
},
"application/ccmp+xml": {
source: "iana",
compressible: true
},
"application/ccxml+xml": {
source: "iana",
compressible: true,
extensions: ["ccxml"]
},
"application/cdfx+xml": {
source: "iana",
compressible: true,
extensions: ["cdfx"]
},
"application/cdmi-capability": {
source: "iana",
extensions: ["cdmia"]
},
"application/cdmi-container": {
source: "iana",
extensions: ["cdmic"]
},
"application/cdmi-domain": {
source: "iana",
extensions: ["cdmid"]
},
"application/cdmi-object": {
source: "iana",
extensions: ["cdmio"]
},
"application/cdmi-queue": {
source: "iana",
extensions: ["cdmiq"]
},
"application/cdni": {
source: "iana"
},
"application/cea": {
source: "iana"
},
"application/cea-2018+xml": {
source: "iana",
compressible: true
},
"application/cellml+xml": {
source: "iana",
compressible: true
},
"application/cfw": {
source: "iana"
},
"application/city+json": {
source: "iana",
compressible: true
},
"application/clr": {
source: "iana"
},
"application/clue+xml": {
source: "iana",
compressible: true
},
"application/clue_info+xml": {
source: "iana",
compressible: true
},
"application/cms": {
source: "iana"
},
"application/cnrp+xml": {
source: "iana",
compressible: true
},
"application/coap-group+json": {
source: "iana",
compressible: true
},
"application/coap-payload": {
source: "iana"
},
"application/commonground": {
source: "iana"
},
"application/conference-info+xml": {
source: "iana",
compressible: true
},
"application/cose": {
source: "iana"
},
"application/cose-key": {
source: "iana"
},
"application/cose-key-set": {
source: "iana"
},
"application/cpl+xml": {
source: "iana",
compressible: true,
extensions: ["cpl"]
},
"application/csrattrs": {
source: "iana"
},
"application/csta+xml": {
source: "iana",
compressible: true
},
"application/cstadata+xml": {
source: "iana",
compressible: true
},
"application/csvm+json": {
source: "iana",
compressible: true
},
"application/cu-seeme": {
source: "apache",
extensions: ["cu"]
},
"application/cwt": {
source: "iana"
},
"application/cybercash": {
source: "iana"
},
"application/dart": {
compressible: true
},
"application/dash+xml": {
source: "iana",
compressible: true,
extensions: ["mpd"]
},
"application/dash-patch+xml": {
source: "iana",
compressible: true,
extensions: ["mpp"]
},
"application/dashdelta": {
source: "iana"
},
"application/davmount+xml": {
source: "iana",
compressible: true,
extensions: ["davmount"]
},
"application/dca-rft": {
source: "iana"
},
"application/dcd": {
source: "iana"
},
"application/dec-dx": {
source: "iana"
},
"application/dialog-info+xml": {
source: "iana",
compressible: true
},
"application/dicom": {
source: "iana"
},
"application/dicom+json": {
source: "iana",
compressible: true
},
"application/dicom+xml": {
source: "iana",
compressible: true
},
"application/dii": {
source: "iana"
},
"application/dit": {
source: "iana"
},
"application/dns": {
source: "iana"
},
"application/dns+json": {
source: "iana",
compressible: true
},
"application/dns-message": {
source: "iana"
},
"application/docbook+xml": {
source: "apache",
compressible: true,
extensions: ["dbk"]
},
"application/dots+cbor": {
source: "iana"
},
"application/dskpp+xml": {
source: "iana",
compressible: true
},
"application/dssc+der": {
source: "iana",
extensions: ["dssc"]
},
"application/dssc+xml": {
source: "iana",
compressible: true,
extensions: ["xdssc"]
},
"application/dvcs": {
source: "iana"
},
"application/ecmascript": {
source: "iana",
compressible: true,
extensions: ["es", "ecma"]
},
"application/edi-consent": {
source: "iana"
},
"application/edi-x12": {
source: "iana",
compressible: false
},
"application/edifact": {
source: "iana",
compressible: false
},
"application/efi": {
source: "iana"
},
"application/elm+json": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/elm+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.cap+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/emergencycalldata.comment+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.control+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.deviceinfo+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.ecall.msd": {
source: "iana"
},
"application/emergencycalldata.providerinfo+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.serviceinfo+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.subscriberinfo+xml": {
source: "iana",
compressible: true
},
"application/emergencycalldata.veds+xml": {
source: "iana",
compressible: true
},
"application/emma+xml": {
source: "iana",
compressible: true,
extensions: ["emma"]
},
"application/emotionml+xml": {
source: "iana",
compressible: true,
extensions: ["emotionml"]
},
"application/encaprtp": {
source: "iana"
},
"application/epp+xml": {
source: "iana",
compressible: true
},
"application/epub+zip": {
source: "iana",
compressible: false,
extensions: ["epub"]
},
"application/eshop": {
source: "iana"
},
"application/exi": {
source: "iana",
extensions: ["exi"]
},
"application/expect-ct-report+json": {
source: "iana",
compressible: true
},
"application/express": {
source: "iana",
extensions: ["exp"]
},
"application/fastinfoset": {
source: "iana"
},
"application/fastsoap": {
source: "iana"
},
"application/fdt+xml": {
source: "iana",
compressible: true,
extensions: ["fdt"]
},
"application/fhir+json": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/fhir+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/fido.trusted-apps+json": {
compressible: true
},
"application/fits": {
source: "iana"
},
"application/flexfec": {
source: "iana"
},
"application/font-sfnt": {
source: "iana"
},
"application/font-tdpfr": {
source: "iana",
extensions: ["pfr"]
},
"application/font-woff": {
source: "iana",
compressible: false
},
"application/framework-attributes+xml": {
source: "iana",
compressible: true
},
"application/geo+json": {
source: "iana",
compressible: true,
extensions: ["geojson"]
},
"application/geo+json-seq": {
source: "iana"
},
"application/geopackage+sqlite3": {
source: "iana"
},
"application/geoxacml+xml": {
source: "iana",
compressible: true
},
"application/gltf-buffer": {
source: "iana"
},
"application/gml+xml": {
source: "iana",
compressible: true,
extensions: ["gml"]
},
"application/gpx+xml": {
source: "apache",
compressible: true,
extensions: ["gpx"]
},
"application/gxf": {
source: "apache",
extensions: ["gxf"]
},
"application/gzip": {
source: "iana",
compressible: false,
extensions: ["gz"]
},
"application/h224": {
source: "iana"
},
"application/held+xml": {
source: "iana",
compressible: true
},
"application/hjson": {
extensions: ["hjson"]
},
"application/http": {
source: "iana"
},
"application/hyperstudio": {
source: "iana",
extensions: ["stk"]
},
"application/ibe-key-request+xml": {
source: "iana",
compressible: true
},
"application/ibe-pkg-reply+xml": {
source: "iana",
compressible: true
},
"application/ibe-pp-data": {
source: "iana"
},
"application/iges": {
source: "iana"
},
"application/im-iscomposing+xml": {
source: "iana",
charset: "UTF-8",
compressible: true
},
"application/index": {
source: "iana"
},
"application/index.cmd": {
source: "iana"
},
"application/index.obj": {
source: "iana"
},
"application/index.response": {
source: "iana"
},
"application/index.vnd": {
source: "iana"
},
"application/inkml+xml": {
source: "iana",
compressible: true,
extensions: ["ink", "inkml"]
},
"application/iotp": {
source: "iana"
},
"application/ipfix": {
source: "iana",
extensions: ["ipfix"]
},
"application/ipp": {
source: "iana"
},
"application/isup": {
source: "iana"
},
"application/its+xml": {
source: "iana",
compressible: true,
extensions: ["its"]
},
"application/java-archive": {
source: "apache",
compressible: false,
extensions: ["jar", "war", "ear"]
},
"application/java-serialized-object": {
source: "apache",
compressible: false,
extensions: ["ser"]
},
"application/java-vm": {
source: "apache",
compressible: false,
extensions: ["class"]
},
"application/javascript": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["js", "mjs"]
},
"application/jf2feed+json": {
source: "iana",
compressible: true
},
"application/jose": {
source: "iana"
},
"application/jose+json": {
source: "iana",
compressible: true
},
"application/jrd+json": {
source: "iana",
compressible: true
},
"application/jscalendar+json": {
source: "iana",
compressible: true
},
"application/json": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["json", "map"]
},
"application/json-patch+json": {
source: "iana",
compressible: true
},
"application/json-seq": {
source: "iana"
},
"application/json5": {
extensions: ["json5"]
},
"application/jsonml+json": {
source: "apache",
compressible: true,
extensions: ["jsonml"]
},
"application/jwk+json": {
source: "iana",
compressible: true
},
"application/jwk-set+json": {
source: "iana",
compressible: true
},
"application/jwt": {
source: "iana"
},
"application/kpml-request+xml": {
source: "iana",
compressible: true
},
"application/kpml-response+xml": {
source: "iana",
compressible: true
},
"application/ld+json": {
source: "iana",
compressible: true,
extensions: ["jsonld"]
},
"application/lgr+xml": {
source: "iana",
compressible: true,
extensions: ["lgr"]
},
"application/link-format": {
source: "iana"
},
"application/load-control+xml": {
source: "iana",
compressible: true
},
"application/lost+xml": {
source: "iana",
compressible: true,
extensions: ["lostxml"]
},
"application/lostsync+xml": {
source: "iana",
compressible: true
},
"application/lpf+zip": {
source: "iana",
compressible: false
},
"application/lxf": {
source: "iana"
},
"application/mac-binhex40": {
source: "iana",
extensions: ["hqx"]
},
"application/mac-compactpro": {
source: "apache",
extensions: ["cpt"]
},
"application/macwriteii": {
source: "iana"
},
"application/mads+xml": {
source: "iana",
compressible: true,
extensions: ["mads"]
},
"application/manifest+json": {
source: "iana",
charset: "UTF-8",
compressible: true,
extensions: ["webmanifest"]
},
"application/marc": {
source: "iana",
gitextract_gr09jd2o/ ├── .github/ │ └── copilot-instructions.md ├── .gitignore ├── .npmignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── jest.config.js ├── lib/ │ ├── api-class.d.ts │ ├── api-class.js │ ├── api-endpoints.d.ts │ ├── api-endpoints.js │ ├── config.d.ts │ ├── config.js │ ├── figma-api.js │ ├── index.d.ts │ ├── index.js │ ├── utils.d.ts │ └── utils.js ├── package.json ├── src/ │ ├── api-class.ts │ ├── api-endpoints.ts │ ├── config.ts │ ├── index.ts │ └── utils.ts ├── tests/ │ ├── api-class.test.ts │ ├── api-endpoints.test.ts │ ├── config.test.ts │ ├── index.test.ts │ └── utils.test.ts └── tsconfig.json
SYMBOL INDEX (489 symbols across 12 files)
FILE: lib/api-class.d.ts
class Api (line 3) | class Api {
type OAuthTokenResponseData (line 59) | type OAuthTokenResponseData = {
FILE: lib/api-class.js
function adopt (line 47) | function adopt(value) { return value instanceof P ? value : new P(functi...
function fulfilled (line 49) | function fulfilled(value) { try { step(generator.next(value)); } catch (...
function rejected (line 50) | function rejected(value) { try { step(generator["throw"](value)); } catc...
function step (line 51) | function step(result) { result.done ? resolve(result.value) : adopt(resu...
function verb (line 58) | function verb(n) { return function (v) { return step([n, v]); }; }
function step (line 59) | function step(op) {
function Api (line 93) | function Api(params) {
function oAuthLink (line 171) | function oAuthLink(client_id, redirect_uri, scope, state, response_type) {
function oAuthToken (line 181) | function oAuthToken(client_id, client_secret, redirect_uri, code, grant_...
FILE: lib/api-endpoints.d.ts
type ApiClass (line 2) | type ApiClass = {
FILE: lib/api-endpoints.js
function getFileApi (line 50) | function getFileApi(pathParams, queryParams) {
function getFileNodesApi (line 54) | function getFileNodesApi(pathParams, queryParams) {
function getImagesApi (line 58) | function getImagesApi(pathParams, queryParams) {
function getImageFillsApi (line 62) | function getImageFillsApi(pathParams) {
function getCommentsApi (line 68) | function getCommentsApi(pathParams) {
function postCommentApi (line 71) | function postCommentApi(pathParams, requestBody) {
function deleteCommentApi (line 77) | function deleteCommentApi(pathParams) {
function getCommentReactionsApi (line 83) | function getCommentReactionsApi(pathParams, queryParams) {
function postCommentReactionApi (line 87) | function postCommentReactionApi(pathParams, requestBody) {
function deleteCommentReactionsApi (line 93) | function deleteCommentReactionsApi(pathParams) {
function getUserMeApi (line 102) | function getUserMeApi() {
function getFileVersionsApi (line 108) | function getFileVersionsApi(pathParams) {
function getTeamProjectsApi (line 114) | function getTeamProjectsApi(pathParams) {
function getProjectFilesApi (line 117) | function getProjectFilesApi(pathParams, queryParams) {
function getTeamComponentsApi (line 124) | function getTeamComponentsApi(pathParams, queryParams) {
function getFileComponentsApi (line 128) | function getFileComponentsApi(pathParams) {
function getComponentApi (line 131) | function getComponentApi(pathParams) {
function getTeamComponentSetsApi (line 134) | function getTeamComponentSetsApi(pathParams, queryParams) {
function getFileComponentSetsApi (line 138) | function getFileComponentSetsApi(pathParams) {
function getComponentSetApi (line 141) | function getComponentSetApi(pathParams) {
function getTeamStylesApi (line 144) | function getTeamStylesApi(pathParams, queryParams) {
function getFileStylesApi (line 148) | function getFileStylesApi(pathParams) {
function getStyleApi (line 151) | function getStyleApi(pathParams) {
function getWebhookApi (line 157) | function getWebhookApi(pathParams) {
function postWebhookApi (line 160) | function postWebhookApi(requestBody) {
function putWebhookApi (line 166) | function putWebhookApi(pathParams, requestBody) {
function deleteWebhookApi (line 172) | function deleteWebhookApi(pathParams) {
function getTeamWebhooksApi (line 178) | function getTeamWebhooksApi(pathParams) {
function getWebhookRequestsApi (line 181) | function getWebhookRequestsApi(pathParams) {
function getLocalVariablesApi (line 196) | function getLocalVariablesApi(pathParams) {
function getPublishedVariablesApi (line 199) | function getPublishedVariablesApi(pathParams) {
function postVariablesApi (line 202) | function postVariablesApi(pathParams, requestBody) {
function getDevResourcesApi (line 211) | function getDevResourcesApi(pathParams, queryParams) {
function postDevResourcesApi (line 215) | function postDevResourcesApi(requestBody) {
function putDevResourcesApi (line 221) | function putDevResourcesApi(requestBody) {
function deleteDevResourcesApi (line 227) | function deleteDevResourcesApi(pathParams) {
function getLibraryAnalyticsComponentActionsApi (line 236) | function getLibraryAnalyticsComponentActionsApi(pathParams, queryParams) {
function getLibraryAnalyticsComponentUsagesApi (line 240) | function getLibraryAnalyticsComponentUsagesApi(pathParams, queryParams) {
function getLibraryAnalyticsStyleActionsApi (line 244) | function getLibraryAnalyticsStyleActionsApi(pathParams, queryParams) {
function getLibraryAnalyticsStyleUsagesApi (line 248) | function getLibraryAnalyticsStyleUsagesApi(pathParams, queryParams) {
function getLibraryAnalyticsVariableActionsApi (line 252) | function getLibraryAnalyticsVariableActionsApi(pathParams, queryParams) {
function getLibraryAnalyticsVariableUsagesApi (line 256) | function getLibraryAnalyticsVariableUsagesApi(pathParams, queryParams) {
FILE: lib/figma-api.js
function toQueryParams (line 38) | function toQueryParams(x) {
method constructor (line 46) | constructor(error) {
function getFileApi (line 57) | function getFileApi(pathParams, queryParams) {
function getFileNodesApi (line 61) | function getFileNodesApi(pathParams, queryParams) {
function getFileMetaApi (line 65) | function getFileMetaApi(pathParams) {
function getImagesApi (line 68) | function getImagesApi(pathParams, queryParams) {
function getImageFillsApi (line 72) | function getImageFillsApi(pathParams) {
function getCommentsApi (line 75) | function getCommentsApi(pathParams) {
function postCommentApi (line 78) | function postCommentApi(pathParams, requestBody) {
function deleteCommentApi (line 84) | function deleteCommentApi(pathParams) {
function getCommentReactionsApi (line 90) | function getCommentReactionsApi(pathParams, queryParams) {
function postCommentReactionApi (line 94) | function postCommentReactionApi(pathParams, requestBody) {
function deleteCommentReactionsApi (line 100) | function deleteCommentReactionsApi(pathParams) {
function getUserMeApi (line 106) | function getUserMeApi() {
function getFileVersionsApi (line 109) | function getFileVersionsApi(pathParams) {
function getTeamProjectsApi (line 112) | function getTeamProjectsApi(pathParams) {
function getProjectFilesApi (line 115) | function getProjectFilesApi(pathParams, queryParams) {
function getTeamComponentsApi (line 119) | function getTeamComponentsApi(pathParams, queryParams) {
function getFileComponentsApi (line 123) | function getFileComponentsApi(pathParams) {
function getComponentApi (line 126) | function getComponentApi(pathParams) {
function getTeamComponentSetsApi (line 129) | function getTeamComponentSetsApi(pathParams, queryParams) {
function getFileComponentSetsApi (line 133) | function getFileComponentSetsApi(pathParams) {
function getComponentSetApi (line 136) | function getComponentSetApi(pathParams) {
function getTeamStylesApi (line 139) | function getTeamStylesApi(pathParams, queryParams) {
function getFileStylesApi (line 143) | function getFileStylesApi(pathParams) {
function getStyleApi (line 146) | function getStyleApi(pathParams) {
function getWebhookApi (line 149) | function getWebhookApi(pathParams) {
function postWebhookApi (line 152) | function postWebhookApi(requestBody) {
function putWebhookApi (line 158) | function putWebhookApi(pathParams, requestBody) {
function deleteWebhookApi (line 164) | function deleteWebhookApi(pathParams) {
function getTeamWebhooksApi (line 170) | function getTeamWebhooksApi(pathParams) {
function getWebhookRequestsApi (line 173) | function getWebhookRequestsApi(pathParams) {
function getLocalVariablesApi (line 176) | function getLocalVariablesApi(pathParams) {
function getPublishedVariablesApi (line 179) | function getPublishedVariablesApi(pathParams) {
function postVariablesApi (line 182) | function postVariablesApi(pathParams, requestBody) {
function getDevResourcesApi (line 188) | function getDevResourcesApi(pathParams, queryParams) {
function postDevResourcesApi (line 192) | function postDevResourcesApi(requestBody) {
function putDevResourcesApi (line 198) | function putDevResourcesApi(requestBody) {
function deleteDevResourcesApi (line 204) | function deleteDevResourcesApi(pathParams) {
function getLibraryAnalyticsComponentActionsApi (line 210) | function getLibraryAnalyticsComponentActionsApi(pathParams, queryParams) {
function getLibraryAnalyticsComponentUsagesApi (line 214) | function getLibraryAnalyticsComponentUsagesApi(pathParams, queryParams) {
function getLibraryAnalyticsStyleActionsApi (line 218) | function getLibraryAnalyticsStyleActionsApi(pathParams, queryParams) {
function getLibraryAnalyticsStyleUsagesApi (line 222) | function getLibraryAnalyticsStyleUsagesApi(pathParams, queryParams) {
function getLibraryAnalyticsVariableActionsApi (line 226) | function getLibraryAnalyticsVariableActionsApi(pathParams, queryParams) {
function getLibraryAnalyticsVariableUsagesApi (line 230) | function getLibraryAnalyticsVariableUsagesApi(pathParams, queryParams) {
function bind (line 236) | function bind(fn, thisArg) {
function isBuffer (line 257) | function isBuffer(val) {
function isArrayBufferView (line 261) | function isArrayBufferView(val) {
function getGlobal (line 301) | function getGlobal() {
function forEach (line 330) | function forEach(obj, fn, { allOwnKeys = false } = {}) {
function findKey (line 356) | function findKey(obj, key) {
function merge (line 377) | function merge() {
function isSpecCompliantForm (line 559) | function isSpecCompliantForm(thing) {
method from (line 676) | static from(error, code, config, request, response, customProps) {
method constructor (line 697) | constructor(message, code, config, request, response) {
method toJSON (line 715) | toJSON() {
function isVisitable (line 754) | function isVisitable(thing) {
function removeBrackets (line 757) | function removeBrackets(key) {
function renderKey (line 760) | function renderKey(path, key, dots) {
function isFlatArray (line 767) | function isFlatArray(arr) {
function toFormData (line 773) | function toFormData(obj, formData, options) {
function encode (line 879) | function encode(str) {
function AxiosURLSearchParams (line 892) | function AxiosURLSearchParams(params, options) {
function encode2 (line 911) | function encode2(val) {
function buildURL (line 914) | function buildURL(url, params, options) {
method constructor (line 941) | constructor() {
method use (line 953) | use(fulfilled, rejected, options) {
method eject (line 969) | eject(id) {
method clear (line 979) | clear() {
method forEach (line 994) | forEach(fn) {
function toURLEncodedForm (line 1057) | function toURLEncodedForm(data, options) {
function parsePropPath (line 1071) | function parsePropPath(name) {
function arrayToObject (line 1076) | function arrayToObject(arr) {
function formDataToJSON (line 1088) | function formDataToJSON(formData) {
function stringifySafely (line 1125) | function stringifySafely(rawValue, parser, encoder) {
function trimSPorHTAB (line 1288) | function trimSPorHTAB(str) {
function normalizeHeader (line 1307) | function normalizeHeader(header) {
function sanitizeHeaderValue (line 1310) | function sanitizeHeaderValue(str) {
function normalizeValue (line 1313) | function normalizeValue(value) {
function parseTokens (line 1319) | function parseTokens(str) {
function matchHeaderValue (line 1329) | function matchHeaderValue(context, value, header, filter2, isHeaderNameF...
function formatHeader (line 1344) | function formatHeader(header) {
function buildAccessors (line 1349) | function buildAccessors(obj, header) {
method constructor (line 1361) | constructor(headers) {
method set (line 1364) | set(header, valueOrRewrite, rewrite) {
method get (line 1395) | get(header, parser) {
method has (line 1417) | has(header, matcher) {
method delete (line 1425) | delete(header, matcher) {
method clear (line 1445) | clear(matcher) {
method normalize (line 1458) | normalize(format) {
method concat (line 1477) | concat(...targets) {
method toJSON (line 1480) | toJSON(asStrings) {
method [Symbol.iterator] (line 1487) | [Symbol.iterator]() {
method toString (line 1490) | toString() {
method getSetCookie (line 1493) | getSetCookie() {
method [Symbol.toStringTag] (line 1496) | get [Symbol.toStringTag]() {
method from (line 1499) | static from(thing) {
method concat (line 1502) | static concat(first, ...targets) {
method accessor (line 1507) | static accessor(header) {
method set (line 1536) | set(headerValue) {
function transformData (line 1545) | function transformData(fns, response) {
function isCancel (line 1558) | function isCancel(value) {
method constructor (line 1573) | constructor(message, config, request) {
function settle (line 1582) | function settle(resolve, reject, response) {
function parseProtocol (line 1600) | function parseProtocol(url) {
function speedometer (line 1606) | function speedometer(samplesCount, min) {
function throttle (line 1642) | function throttle(fn, freq) {
method write (line 1727) | write(name, value, expires, path, domain, secure, sameSite) {
method read (line 1747) | read(name) {
method remove (line 1752) | remove(name) {
method write (line 1759) | write() {
method read (line 1761) | read() {
method remove (line 1764) | remove() {
function isAbsoluteURL (line 1770) | function isAbsoluteURL(url) {
function combineURLs (line 1778) | function combineURLs(baseURL, relativeURL) {
function buildFullPath (line 1783) | function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
function mergeConfig (line 1793) | function mergeConfig(config1, config2) {
function done (line 1947) | function done() {
function onloadend (line 1956) | function onloadend() {
method pull (line 2166) | async pull(controller) {
method cancel (line 2185) | cancel(reason) {
method duplex (line 2233) | get duplex() {
function getAdapter (line 2447) | function getAdapter(adapters, config) {
function throwIfCancellationRequested (line 2494) | function throwIfCancellationRequested(config) {
function dispatchRequest (line 2502) | function dispatchRequest(config) {
function formatMessage (line 2546) | function formatMessage(opt, desc) {
function assertOptions (line 2574) | function assertOptions(options, schema, allowUnknown) {
method constructor (line 2607) | constructor(instanceConfig) {
method request (line 2622) | async request(configOrUrl, config) {
method _request (line 2653) | _request(configOrUrl, config) {
method getUri (line 2767) | getUri(config) {
function generateHTTPMethod (line 2785) | function generateHTTPMethod(isForm) {
method constructor (line 2806) | constructor(executor) {
method throwIfRequested (line 2845) | throwIfRequested() {
method subscribe (line 2853) | subscribe(listener) {
method unsubscribe (line 2867) | unsubscribe(listener) {
method toAbortSignal (line 2876) | toAbortSignal() {
method source (line 2889) | static source() {
function spread (line 2903) | function spread(callback) {
function isAxiosError (line 2910) | function isAxiosError(payload) {
function createInstance (line 2992) | function createInstance(defaultConfig) {
method constructor (line 3046) | constructor(params) {
function oAuthLink (line 3114) | function oAuthLink(client_id, redirect_uri, scope, state, response_type) {
function oAuthToken (line 3124) | async function oAuthToken(client_id, client_secret, redirect_uri, code, ...
FILE: lib/index.js
method "node_modules/delayed-stream/lib/delayed_stream.js" (line 35) | "node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
method "node_modules/combined-stream/lib/combined_stream.js" (line 126) | "node_modules/combined-stream/lib/combined_stream.js"(exports2, module2) {
method "node_modules/mime-db/db.json" (line 295) | "node_modules/mime-db/db.json"(exports2, module2) {
method "node_modules/mime-db/index.js" (line 8820) | "node_modules/mime-db/index.js"(exports2, module2) {
method "node_modules/mime-types/index.js" (line 8827) | "node_modules/mime-types/index.js"(exports2) {
method "node_modules/asynckit/lib/defer.js" (line 8917) | "node_modules/asynckit/lib/defer.js"(exports2, module2) {
method "node_modules/asynckit/lib/async.js" (line 8932) | "node_modules/asynckit/lib/async.js"(exports2, module2) {
method "node_modules/asynckit/lib/abort.js" (line 8955) | "node_modules/asynckit/lib/abort.js"(exports2, module2) {
method "node_modules/asynckit/lib/iterate.js" (line 8971) | "node_modules/asynckit/lib/iterate.js"(exports2, module2) {
method "node_modules/asynckit/lib/state.js" (line 9004) | "node_modules/asynckit/lib/state.js"(exports2, module2) {
method "node_modules/asynckit/lib/terminator.js" (line 9026) | "node_modules/asynckit/lib/terminator.js"(exports2, module2) {
method "node_modules/asynckit/parallel.js" (line 9043) | "node_modules/asynckit/parallel.js"(exports2, module2) {
method "node_modules/asynckit/serialOrdered.js" (line 9070) | "node_modules/asynckit/serialOrdered.js"(exports2, module2) {
method "node_modules/asynckit/serial.js" (line 9104) | "node_modules/asynckit/serial.js"(exports2, module2) {
method "node_modules/asynckit/index.js" (line 9115) | "node_modules/asynckit/index.js"(exports2, module2) {
method "node_modules/es-object-atoms/index.js" (line 9126) | "node_modules/es-object-atoms/index.js"(exports2, module2) {
method "node_modules/es-errors/index.js" (line 9134) | "node_modules/es-errors/index.js"(exports2, module2) {
method "node_modules/es-errors/eval.js" (line 9142) | "node_modules/es-errors/eval.js"(exports2, module2) {
method "node_modules/es-errors/range.js" (line 9150) | "node_modules/es-errors/range.js"(exports2, module2) {
method "node_modules/es-errors/ref.js" (line 9158) | "node_modules/es-errors/ref.js"(exports2, module2) {
method "node_modules/es-errors/syntax.js" (line 9166) | "node_modules/es-errors/syntax.js"(exports2, module2) {
method "node_modules/es-errors/type.js" (line 9174) | "node_modules/es-errors/type.js"(exports2, module2) {
method "node_modules/es-errors/uri.js" (line 9182) | "node_modules/es-errors/uri.js"(exports2, module2) {
method "node_modules/math-intrinsics/abs.js" (line 9190) | "node_modules/math-intrinsics/abs.js"(exports2, module2) {
method "node_modules/math-intrinsics/floor.js" (line 9198) | "node_modules/math-intrinsics/floor.js"(exports2, module2) {
method "node_modules/math-intrinsics/max.js" (line 9206) | "node_modules/math-intrinsics/max.js"(exports2, module2) {
method "node_modules/math-intrinsics/min.js" (line 9214) | "node_modules/math-intrinsics/min.js"(exports2, module2) {
method "node_modules/math-intrinsics/pow.js" (line 9222) | "node_modules/math-intrinsics/pow.js"(exports2, module2) {
method "node_modules/math-intrinsics/round.js" (line 9230) | "node_modules/math-intrinsics/round.js"(exports2, module2) {
method "node_modules/math-intrinsics/isNaN.js" (line 9238) | "node_modules/math-intrinsics/isNaN.js"(exports2, module2) {
method "node_modules/math-intrinsics/sign.js" (line 9248) | "node_modules/math-intrinsics/sign.js"(exports2, module2) {
method "node_modules/gopd/gOPD.js" (line 9262) | "node_modules/gopd/gOPD.js"(exports2, module2) {
method "node_modules/gopd/index.js" (line 9270) | "node_modules/gopd/index.js"(exports2, module2) {
method "node_modules/es-define-property/index.js" (line 9286) | "node_modules/es-define-property/index.js"(exports2, module2) {
method "node_modules/has-symbols/shams.js" (line 9302) | "node_modules/has-symbols/shams.js"(exports2, module2) {
method "node_modules/has-symbols/index.js" (line 9357) | "node_modules/has-symbols/index.js"(exports2, module2) {
method "node_modules/get-proto/Reflect.getPrototypeOf.js" (line 9381) | "node_modules/get-proto/Reflect.getPrototypeOf.js"(exports2, module2) {
method "node_modules/get-proto/Object.getPrototypeOf.js" (line 9389) | "node_modules/get-proto/Object.getPrototypeOf.js"(exports2, module2) {
method "node_modules/function-bind/implementation.js" (line 9398) | "node_modules/function-bind/implementation.js"(exports2, module2) {
method "node_modules/function-bind/index.js" (line 9474) | "node_modules/function-bind/index.js"(exports2, module2) {
method "node_modules/call-bind-apply-helpers/functionCall.js" (line 9483) | "node_modules/call-bind-apply-helpers/functionCall.js"(exports2, module2) {
method "node_modules/call-bind-apply-helpers/functionApply.js" (line 9491) | "node_modules/call-bind-apply-helpers/functionApply.js"(exports2, module...
method "node_modules/call-bind-apply-helpers/reflectApply.js" (line 9499) | "node_modules/call-bind-apply-helpers/reflectApply.js"(exports2, module2) {
method "node_modules/call-bind-apply-helpers/actualApply.js" (line 9507) | "node_modules/call-bind-apply-helpers/actualApply.js"(exports2, module2) {
method "node_modules/call-bind-apply-helpers/index.js" (line 9519) | "node_modules/call-bind-apply-helpers/index.js"(exports2, module2) {
method "node_modules/dunder-proto/get.js" (line 9536) | "node_modules/dunder-proto/get.js"(exports2, module2) {
method "node_modules/get-proto/index.js" (line 9567) | "node_modules/get-proto/index.js"(exports2, module2) {
method "node_modules/hasown/index.js" (line 9587) | "node_modules/hasown/index.js"(exports2, module2) {
method "node_modules/get-intrinsic/index.js" (line 9598) | "node_modules/get-intrinsic/index.js"(exports2, module2) {
method "node_modules/has-tostringtag/shams.js" (line 9929) | "node_modules/has-tostringtag/shams.js"(exports2, module2) {
method "node_modules/es-set-tostringtag/index.js" (line 9940) | "node_modules/es-set-tostringtag/index.js"(exports2, module2) {
method "node_modules/form-data/lib/populate.js" (line 9972) | "node_modules/form-data/lib/populate.js"(exports2, module2) {
method "node_modules/form-data/lib/form_data.js" (line 9985) | "node_modules/form-data/lib/form_data.js"(exports2, module2) {
method "node_modules/ms/index.js" (line 10304) | "node_modules/ms/index.js"(exports2, module2) {
method "node_modules/debug/src/common.js" (line 10420) | "node_modules/debug/src/common.js"(exports2, module2) {
method "node_modules/debug/src/browser.js" (line 10597) | "node_modules/debug/src/browser.js"(exports2, module2) {
method "node_modules/has-flag/index.js" (line 10767) | "node_modules/has-flag/index.js"(exports2, module2) {
method "node_modules/supports-color/index.js" (line 10780) | "node_modules/supports-color/index.js"(exports2, module2) {
method "node_modules/debug/src/node.js" (line 10882) | "node_modules/debug/src/node.js"(exports2, module2) {
method "node_modules/debug/src/index.js" (line 11056) | "node_modules/debug/src/index.js"(exports2, module2) {
method "node_modules/follow-redirects/debug.js" (line 11067) | "node_modules/follow-redirects/debug.js"(exports2, module2) {
method "node_modules/follow-redirects/index.js" (line 11087) | "node_modules/follow-redirects/index.js"(exports2, module2) {
function toQueryParams (line 11614) | function toQueryParams(x) {
method constructor (line 11622) | constructor(error) {
function getFileApi (line 11633) | function getFileApi(pathParams, queryParams) {
function getFileNodesApi (line 11637) | function getFileNodesApi(pathParams, queryParams) {
function getFileMetaApi (line 11641) | function getFileMetaApi(pathParams) {
function getImagesApi (line 11644) | function getImagesApi(pathParams, queryParams) {
function getImageFillsApi (line 11648) | function getImageFillsApi(pathParams) {
function getCommentsApi (line 11651) | function getCommentsApi(pathParams) {
function postCommentApi (line 11654) | function postCommentApi(pathParams, requestBody) {
function deleteCommentApi (line 11660) | function deleteCommentApi(pathParams) {
function getCommentReactionsApi (line 11666) | function getCommentReactionsApi(pathParams, queryParams) {
function postCommentReactionApi (line 11670) | function postCommentReactionApi(pathParams, requestBody) {
function deleteCommentReactionsApi (line 11676) | function deleteCommentReactionsApi(pathParams) {
function getUserMeApi (line 11682) | function getUserMeApi() {
function getFileVersionsApi (line 11685) | function getFileVersionsApi(pathParams) {
function getTeamProjectsApi (line 11688) | function getTeamProjectsApi(pathParams) {
function getProjectFilesApi (line 11691) | function getProjectFilesApi(pathParams, queryParams) {
function getTeamComponentsApi (line 11695) | function getTeamComponentsApi(pathParams, queryParams) {
function getFileComponentsApi (line 11699) | function getFileComponentsApi(pathParams) {
function getComponentApi (line 11702) | function getComponentApi(pathParams) {
function getTeamComponentSetsApi (line 11705) | function getTeamComponentSetsApi(pathParams, queryParams) {
function getFileComponentSetsApi (line 11709) | function getFileComponentSetsApi(pathParams) {
function getComponentSetApi (line 11712) | function getComponentSetApi(pathParams) {
function getTeamStylesApi (line 11715) | function getTeamStylesApi(pathParams, queryParams) {
function getFileStylesApi (line 11719) | function getFileStylesApi(pathParams) {
function getStyleApi (line 11722) | function getStyleApi(pathParams) {
function getWebhookApi (line 11725) | function getWebhookApi(pathParams) {
function postWebhookApi (line 11728) | function postWebhookApi(requestBody) {
function putWebhookApi (line 11734) | function putWebhookApi(pathParams, requestBody) {
function deleteWebhookApi (line 11740) | function deleteWebhookApi(pathParams) {
function getTeamWebhooksApi (line 11746) | function getTeamWebhooksApi(pathParams) {
function getWebhookRequestsApi (line 11749) | function getWebhookRequestsApi(pathParams) {
function getLocalVariablesApi (line 11752) | function getLocalVariablesApi(pathParams) {
function getPublishedVariablesApi (line 11755) | function getPublishedVariablesApi(pathParams) {
function postVariablesApi (line 11758) | function postVariablesApi(pathParams, requestBody) {
function getDevResourcesApi (line 11764) | function getDevResourcesApi(pathParams, queryParams) {
function postDevResourcesApi (line 11768) | function postDevResourcesApi(requestBody) {
function putDevResourcesApi (line 11774) | function putDevResourcesApi(requestBody) {
function deleteDevResourcesApi (line 11780) | function deleteDevResourcesApi(pathParams) {
function getLibraryAnalyticsComponentActionsApi (line 11786) | function getLibraryAnalyticsComponentActionsApi(pathParams, queryParams) {
function getLibraryAnalyticsComponentUsagesApi (line 11790) | function getLibraryAnalyticsComponentUsagesApi(pathParams, queryParams) {
function getLibraryAnalyticsStyleActionsApi (line 11794) | function getLibraryAnalyticsStyleActionsApi(pathParams, queryParams) {
function getLibraryAnalyticsStyleUsagesApi (line 11798) | function getLibraryAnalyticsStyleUsagesApi(pathParams, queryParams) {
function getLibraryAnalyticsVariableActionsApi (line 11802) | function getLibraryAnalyticsVariableActionsApi(pathParams, queryParams) {
function getLibraryAnalyticsVariableUsagesApi (line 11806) | function getLibraryAnalyticsVariableUsagesApi(pathParams, queryParams) {
function bind (line 11812) | function bind(fn, thisArg) {
function isBuffer (line 11833) | function isBuffer(val) {
function isArrayBufferView (line 11837) | function isArrayBufferView(val) {
function getGlobal (line 11877) | function getGlobal() {
function forEach (line 11906) | function forEach(obj, fn, { allOwnKeys = false } = {}) {
function findKey (line 11932) | function findKey(obj, key) {
function merge (line 11953) | function merge() {
function isSpecCompliantForm (line 12135) | function isSpecCompliantForm(thing) {
method from (line 12252) | static from(error, code, config, request, response, customProps) {
method constructor (line 12273) | constructor(message, code, config, request, response) {
method toJSON (line 12291) | toJSON() {
function isVisitable (line 12331) | function isVisitable(thing) {
function removeBrackets (line 12334) | function removeBrackets(key) {
function renderKey (line 12337) | function renderKey(path, key, dots) {
function isFlatArray (line 12344) | function isFlatArray(arr) {
function toFormData (line 12350) | function toFormData(obj, formData, options) {
function encode (line 12456) | function encode(str) {
function AxiosURLSearchParams (line 12469) | function AxiosURLSearchParams(params, options) {
function encode2 (line 12488) | function encode2(val) {
function buildURL (line 12491) | function buildURL(url2, params, options) {
method constructor (line 12518) | constructor() {
method use (line 12530) | use(fulfilled, rejected, options) {
method eject (line 12546) | eject(id) {
method clear (line 12556) | clear() {
method forEach (line 12571) | forEach(fn) {
function toURLEncodedForm (line 12651) | function toURLEncodedForm(data, options) {
function parsePropPath (line 12665) | function parsePropPath(name) {
function arrayToObject (line 12670) | function arrayToObject(arr) {
function formDataToJSON (line 12682) | function formDataToJSON(formData) {
function stringifySafely (line 12719) | function stringifySafely(rawValue, parser, encoder) {
function trimSPorHTAB (line 12882) | function trimSPorHTAB(str) {
function normalizeHeader (line 12901) | function normalizeHeader(header) {
function sanitizeHeaderValue (line 12904) | function sanitizeHeaderValue(str) {
function normalizeValue (line 12907) | function normalizeValue(value) {
function parseTokens (line 12913) | function parseTokens(str) {
function matchHeaderValue (line 12923) | function matchHeaderValue(context, value, header, filter2, isHeaderNameF...
function formatHeader (line 12938) | function formatHeader(header) {
function buildAccessors (line 12943) | function buildAccessors(obj, header) {
method constructor (line 12955) | constructor(headers) {
method set (line 12958) | set(header, valueOrRewrite, rewrite) {
method get (line 12989) | get(header, parser) {
method has (line 13011) | has(header, matcher) {
method delete (line 13019) | delete(header, matcher) {
method clear (line 13039) | clear(matcher) {
method normalize (line 13052) | normalize(format) {
method concat (line 13071) | concat(...targets) {
method toJSON (line 13074) | toJSON(asStrings) {
method [Symbol.iterator] (line 13081) | [Symbol.iterator]() {
method toString (line 13084) | toString() {
method getSetCookie (line 13087) | getSetCookie() {
method [Symbol.toStringTag] (line 13090) | get [Symbol.toStringTag]() {
method from (line 13093) | static from(thing) {
method concat (line 13096) | static concat(first, ...targets) {
method accessor (line 13101) | static accessor(header) {
method set (line 13130) | set(headerValue) {
function transformData (line 13139) | function transformData(fns, response) {
function isCancel (line 13152) | function isCancel(value) {
method constructor (line 13167) | constructor(message, config, request) {
function settle (line 13176) | function settle(resolve, reject, response) {
function isAbsoluteURL (line 13194) | function isAbsoluteURL(url2) {
function combineURLs (line 13202) | function combineURLs(baseURL, relativeURL) {
function buildFullPath (line 13207) | function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
function parseUrl (line 13224) | function parseUrl(urlString) {
function getProxyForUrl (line 13231) | function getProxyForUrl(url2) {
function shouldProxy (line 13251) | function shouldProxy(hostname, port) {
function getEnv (line 13278) | function getEnv(key) {
function parseProtocol (line 13295) | function parseProtocol(url2) {
function fromDataURI (line 13302) | function fromDataURI(uri, asBlob, options) {
method constructor (line 13336) | constructor(options) {
method _read (line 13375) | _read(size) {
method _transform (line 13382) | _transform(chunk, encoding, callback) {
method constructor (line 13484) | constructor(name, value) {
method encode (line 13500) | async *encode() {
method escapeName (line 13510) | static escapeName(name) {
method __transform (line 13565) | __transform(chunk, encoding, callback) {
method _transform (line 13569) | _transform(chunk, encoding, callback) {
function shouldBypassProxy (line 13669) | function shouldBypassProxy(location) {
function speedometer (line 13708) | function speedometer(samplesCount, min) {
function throttle (line 13744) | function throttle(fn, freq) {
function estimateDataURLDecodedBytes (line 13817) | function estimateDataURLDecodedBytes(url2) {
method constructor (line 13889) | constructor() {
method getSession (line 13892) | getSession(authority, options) {
function dispatchBeforeRedirect (line 13961) | function dispatchBeforeRedirect(options, responseDetails) {
function setProxy (line 13969) | function setProxy(options, configProxy, location) {
method request (line 14039) | request(options, cb) {
function abort (line 14101) | function abort(reason) {
method transform (line 14613) | transform(chunk, _enc, cb) {
method write (line 14656) | write(name, value, expires, path, domain, secure, sameSite) {
method read (line 14676) | read(name) {
method remove (line 14681) | remove(name) {
method write (line 14688) | write() {
method read (line 14690) | read() {
method remove (line 14693) | remove() {
function mergeConfig (line 14700) | function mergeConfig(config1, config2) {
function done (line 14854) | function done() {
function onloadend (line 14863) | function onloadend() {
method pull (line 15073) | async pull(controller) {
method cancel (line 15092) | cancel(reason) {
method duplex (line 15140) | get duplex() {
function getAdapter (line 15354) | function getAdapter(adapters, config) {
function throwIfCancellationRequested (line 15401) | function throwIfCancellationRequested(config) {
function dispatchRequest (line 15409) | function dispatchRequest(config) {
function formatMessage (line 15450) | function formatMessage(opt, desc) {
function assertOptions (line 15478) | function assertOptions(options, schema, allowUnknown) {
method constructor (line 15511) | constructor(instanceConfig) {
method request (line 15526) | async request(configOrUrl, config) {
method _request (line 15557) | _request(configOrUrl, config) {
method getUri (line 15671) | getUri(config) {
function generateHTTPMethod (line 15689) | function generateHTTPMethod(isForm) {
method constructor (line 15710) | constructor(executor) {
method throwIfRequested (line 15749) | throwIfRequested() {
method subscribe (line 15757) | subscribe(listener) {
method unsubscribe (line 15771) | unsubscribe(listener) {
method toAbortSignal (line 15780) | toAbortSignal() {
method source (line 15793) | static source() {
function spread (line 15807) | function spread(callback) {
function isAxiosError (line 15814) | function isAxiosError(payload) {
function createInstance (line 15896) | function createInstance(defaultConfig) {
method constructor (line 15950) | constructor(params) {
function oAuthLink (line 16018) | function oAuthLink(client_id, redirect_uri, scope, state, response_type) {
function oAuthToken (line 16028) | async function oAuthToken(client_id, client_secret, redirect_uri, code, ...
FILE: lib/utils.d.ts
type Disposer (line 3) | type Disposer = () => void;
class ApiError (line 4) | class ApiError extends Error {
type ApiRequestMethod (line 8) | type ApiRequestMethod = <T>(url: string, opts?: {
FILE: lib/utils.js
function __ (line 13) | function __() { this.constructor = d; }
function toQueryParams (line 20) | function toQueryParams(x) {
function ApiError (line 30) | function ApiError(response, message) {
FILE: src/api-class.ts
class Api (line 6) | class Api {
method constructor (line 10) | constructor(params: {
function oAuthLink (line 91) | function oAuthLink(
type OAuthTokenResponseData (line 108) | type OAuthTokenResponseData = {
function oAuthToken (line 115) | async function oAuthToken(
FILE: src/api-endpoints.ts
type ApiClass (line 6) | type ApiClass = {
function getFileApi (line 17) | function getFileApi(
function getFileNodesApi (line 26) | function getFileNodesApi(
function getFileMetaApi (line 35) | function getFileMetaApi(
function getImagesApi (line 42) | function getImagesApi(
function getImageFillsApi (line 51) | function getImageFillsApi(
function getCommentsApi (line 62) | function getCommentsApi(
function postCommentApi (line 69) | function postCommentApi(
function deleteCommentApi (line 80) | function deleteCommentApi(
function getCommentReactionsApi (line 90) | function getCommentReactionsApi(
function postCommentReactionApi (line 99) | function postCommentReactionApi(
function deleteCommentReactionsApi (line 110) | function deleteCommentReactionsApi(
function getUserMeApi (line 125) | function getUserMeApi(
function getFileVersionsApi (line 136) | function getFileVersionsApi(
function getTeamProjectsApi (line 148) | function getTeamProjectsApi(
function getProjectFilesApi (line 155) | function getProjectFilesApi(
function getTeamComponentsApi (line 169) | function getTeamComponentsApi(
function getFileComponentsApi (line 178) | function getFileComponentsApi(
function getComponentApi (line 185) | function getComponentApi(
function getTeamComponentSetsApi (line 192) | function getTeamComponentSetsApi(
function getFileComponentSetsApi (line 201) | function getFileComponentSetsApi(
function getComponentSetApi (line 208) | function getComponentSetApi(
function getTeamStylesApi (line 215) | function getTeamStylesApi(
function getFileStylesApi (line 224) | function getFileStylesApi(
function getStyleApi (line 231) | function getStyleApi(
function getWebhookApi (line 243) | function getWebhookApi(
function postWebhookApi (line 250) | function postWebhookApi(
function putWebhookApi (line 260) | function putWebhookApi(
function deleteWebhookApi (line 271) | function deleteWebhookApi(
function getTeamWebhooksApi (line 281) | function getTeamWebhooksApi(
function getWebhookRequestsApi (line 288) | function getWebhookRequestsApi(
function getLocalVariablesApi (line 315) | function getLocalVariablesApi(
function getPublishedVariablesApi (line 322) | function getPublishedVariablesApi(
function postVariablesApi (line 329) | function postVariablesApi(
function getDevResourcesApi (line 345) | function getDevResourcesApi(
function postDevResourcesApi (line 354) | function postDevResourcesApi(
function putDevResourcesApi (line 364) | function putDevResourcesApi(
function deleteDevResourcesApi (line 374) | function deleteDevResourcesApi(
function getLibraryAnalyticsComponentActionsApi (line 389) | function getLibraryAnalyticsComponentActionsApi(
function getLibraryAnalyticsComponentUsagesApi (line 398) | function getLibraryAnalyticsComponentUsagesApi(
function getLibraryAnalyticsStyleActionsApi (line 407) | function getLibraryAnalyticsStyleActionsApi(
function getLibraryAnalyticsStyleUsagesApi (line 416) | function getLibraryAnalyticsStyleUsagesApi(
function getLibraryAnalyticsVariableActionsApi (line 425) | function getLibraryAnalyticsVariableActionsApi(
function getLibraryAnalyticsVariableUsagesApi (line 434) | function getLibraryAnalyticsVariableUsagesApi(
FILE: src/config.ts
constant API_DOMAIN (line 1) | const API_DOMAIN = 'https://api.figma.com';
constant API_VER (line 2) | const API_VER = 'v1';
constant API_VER_WEBHOOKS (line 3) | const API_VER_WEBHOOKS = 'v2';
FILE: src/utils.ts
function toQueryParams (line 3) | function toQueryParams(x: any): string {
type Disposer (line 11) | type Disposer = () => void;
class ApiError (line 13) | class ApiError extends Error {
method constructor (line 14) | constructor(
type ApiRequestMethod (line 26) | type ApiRequestMethod = <T>(url: string, opts?: { method: AxiosMethod, d...
Condensed preview — 30 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (724K chars).
[
{
"path": ".github/copilot-instructions.md",
"chars": 6792,
"preview": "# Copilot Instructions for figma-api\n\n## Project Overview\n\nThis is a TypeScript library that provides a thin, fully-type"
},
{
"path": ".gitignore",
"chars": 42,
"preview": "/node_modules\n/playground\n/.idea\n/coverage"
},
{
"path": ".npmignore",
"chars": 42,
"preview": "playground\nsrc\nnode_modules\ntsconfig.json\n"
},
{
"path": "CHANGELOG.md",
"chars": 5667,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "LICENSE",
"chars": 1064,
"preview": "MIT License\n\nCopyright (c) 2020 Morglod\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of"
},
{
"path": "README.md",
"chars": 7815,
"preview": "[](https://www.npmjs.com/package/figma-api)\n\n> [!IMPORT"
},
{
"path": "jest.config.js",
"chars": 381,
"preview": "module.exports = {\n preset: 'ts-jest',\n testEnvironment: 'node',\n roots: ['<rootDir>/src', '<rootDir>/tests'],\n test"
},
{
"path": "lib/api-class.d.ts",
"chars": 3594,
"preview": "import * as ApiEndpoints from './api-endpoints';\nimport { ApiRequestMethod } from './utils';\nexport declare class Api {\n"
},
{
"path": "lib/api-class.js",
"chars": 10630,
"preview": "\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n "
},
{
"path": "lib/api-endpoints.d.ts",
"chars": 8163,
"preview": "import { ApiRequestMethod } from \"./utils\";\ntype ApiClass = {\n request: ApiRequestMethod;\n};\nimport type * as FigmaRe"
},
{
"path": "lib/api-endpoints.js",
"chars": 14619,
"preview": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getFileApi = getFileApi;\nexports.ge"
},
{
"path": "lib/config.d.ts",
"chars": 142,
"preview": "export declare const API_DOMAIN = \"https://api.figma.com\";\nexport declare const API_VER = \"v1\";\nexport declare const API"
},
{
"path": "lib/config.js",
"chars": 254,
"preview": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.API_VER_WEBHOOKS = exports.API_VER "
},
{
"path": "lib/figma-api.js",
"chars": 109551,
"preview": "\"use strict\";\nvar Figma = (() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnProper"
},
{
"path": "lib/index.d.ts",
"chars": 55,
"preview": "export * from './config';\nexport * from './api-class';\n"
},
{
"path": "lib/index.js",
"chars": 462731,
"preview": "\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnP"
},
{
"path": "lib/utils.d.ts",
"chars": 447,
"preview": "import { AxiosResponse, Method as AxiosMethod, AxiosRequestConfig } from 'axios';\nexport declare function toQueryParams("
},
{
"path": "lib/utils.js",
"chars": 1696,
"preview": "\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n "
},
{
"path": "package.json",
"chars": 1225,
"preview": "{\n \"name\": \"figma-api\",\n \"version\": \"2.2.0-beta\",\n \"description\": \"Thin typed wrapper around the Figma REST API\",\n \""
},
{
"path": "src/api-class.ts",
"chars": 5248,
"preview": "import * as ApiEndpoints from './api-endpoints';\nimport { ApiError, ApiRequestMethod, toQueryParams } from './utils';\n\ni"
},
{
"path": "src/api-endpoints.ts",
"chars": 16697,
"preview": "import { API_DOMAIN, API_VER, API_VER_WEBHOOKS } from \"./config\";\nimport { ApiRequestMethod, toQueryParams } from \"./uti"
},
{
"path": "src/config.ts",
"chars": 118,
"preview": "export const API_DOMAIN = 'https://api.figma.com';\nexport const API_VER = 'v1';\nexport const API_VER_WEBHOOKS = 'v2';\n"
},
{
"path": "src/index.ts",
"chars": 55,
"preview": "export * from './config';\nexport * from './api-class';\n"
},
{
"path": "src/utils.ts",
"chars": 972,
"preview": "import { AxiosError, Method as AxiosMethod, AxiosRequestConfig } from 'axios';\n\nexport function toQueryParams(x: any): s"
},
{
"path": "tests/api-class.test.ts",
"chars": 8800,
"preview": "import { Api, oAuthLink, oAuthToken } from '../src/api-class';\nimport { ApiError } from '../src/utils';\nimport axios, { "
},
{
"path": "tests/api-endpoints.test.ts",
"chars": 8162,
"preview": "import * as apiEndpoints from '../src/api-endpoints';\nimport { API_DOMAIN, API_VER, API_VER_WEBHOOKS } from '../src/conf"
},
{
"path": "tests/config.test.ts",
"chars": 600,
"preview": "import { API_DOMAIN, API_VER, API_VER_WEBHOOKS } from '../src/config';\n\ndescribe('config', () => {\n test('API_DOMAIN sh"
},
{
"path": "tests/index.test.ts",
"chars": 724,
"preview": "import * as FigmaAPI from '../src/index';\nimport { API_DOMAIN, API_VER, API_VER_WEBHOOKS } from '../src/config';\nimport "
},
{
"path": "tests/utils.test.ts",
"chars": 2882,
"preview": "import { toQueryParams, ApiError } from '../src/utils';\n\ndescribe('utils', () => {\n describe('toQueryParams', () => {\n "
},
{
"path": "tsconfig.json",
"chars": 5430,
"preview": "{\n \"include\": [ \"src/**/*\" ],\n \"exclude\": [ \"./playground\", \"./node_modules\", \"./lib\" ],\n \"compilerOptions\": {\n /*"
}
]
About this extraction
This page contains the full source code of the didoo/figma-api GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 30 files (668.6 KB), approximately 167.8k tokens, and a symbol index with 489 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.