diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 1b92771e..00000000 --- a/.eslintrc +++ /dev/null @@ -1,31 +0,0 @@ -{ - "env": { - "es2021": true, - "browser": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 12, - "project": "tsconfig.eslint.json" - }, - "plugins": ["@typescript-eslint", "prettier"], - "rules": { - "prefer-const": "error", - "prettier/prettier": "error", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/no-unused-params": "off", - "@typescript-eslint/no-unsafe-argument": "warn", - "@typescript-eslint/no-unsafe-assignment": "warn" - }, - "overrides": [ - { - "env": { "jest": true, "node": true }, - "files": ["tests/**/*.ts"] - } - ] -} diff --git a/.fernignore b/.fernignore new file mode 100644 index 00000000..084a8ebb --- /dev/null +++ b/.fernignore @@ -0,0 +1 @@ +# Specify files that shouldn't be modified by Fern diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..ff4531a3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: ci + +on: [push] + +jobs: + compile: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up node + uses: actions/setup-node@v3 + + - name: Compile + run: yarn && yarn build + + publish: + needs: [ compile ] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up node + uses: actions/setup-node@v3 + + - name: Install dependencies + run: yarn install + + - name: Build + run: yarn build \ No newline at end of file diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml deleted file mode 100644 index 5541e7ef..00000000 --- a/.github/workflows/code-quality.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Code Quality - -on: push - -jobs: - build: - name: TypeScript Build - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node.js - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - name: yarn install - run: yarn install - - - run: yarn build - name: yarn build - - typecheck: - name: TypeScript Typecheck - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node.js - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - name: yarn install - run: yarn install - - - run: yarn typecheck - name: yarn typecheck - - test: - name: Jest CI Tests - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node.js - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - name: yarn install - run: yarn install - - - name: yarn build - run: yarn build - - - run: yarn test:ci - name: yarn test:ci - - prettier: - name: Prettier Formatting - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node.js - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - name: yarn install - run: yarn install - - - run: yarn format:check - name: yarn format:check - - lint: - name: ESLint Linting - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node.js - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - name: yarn install - run: yarn install - - - run: yarn lint - name: yarn lint diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml deleted file mode 100644 index 5f5a4524..00000000 --- a/.github/workflows/npm-publish.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Publish to NPM - -on: - release: - types: [created] - -jobs: - publish-npm: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: https://registry.npmjs.org/ - - run: | - yarn install - yarn test - yarn publish - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml deleted file mode 100644 index 0ba47a64..00000000 --- a/.github/workflows/semgrep.yml +++ /dev/null @@ -1,24 +0,0 @@ -on: - workflow_dispatch: {} - pull_request: {} - push: - branches: - - main - - master - paths: - - .github/workflows/semgrep.yml - schedule: - # random HH:MM to avoid a load spike on GitHub Actions at 00:00 - - cron: 34 11 * * * -name: Semgrep -jobs: - semgrep: - name: semgrep/ci - runs-on: ubuntu-20.04 - env: - SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} - container: - image: returntocorp/semgrep - steps: - - uses: actions/checkout@v3 - - run: semgrep ci diff --git a/.gitignore b/.gitignore index d88e57b6..1498321f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,63 +1,13 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test -.env.production - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* - -temp +node_modules .DS_Store - -# Compiled files -dist/ \ No newline at end of file +/dist +/Client.d.ts +/Client.js +/environments.d.ts +/environments.js +/index.d.ts +/index.js +/api +/core +/errors +/serialization \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..e62938dd --- /dev/null +++ b/.npmignore @@ -0,0 +1,8 @@ +node_modules +src +.gitignore +.github +.fernignore +.prettierrc.yml +tsconfig.json +yarn.lock \ No newline at end of file diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 9814b5e5..00000000 --- a/.prettierignore +++ /dev/null @@ -1,5 +0,0 @@ -dist -temp -*.json -coverage -.DS_Store diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 1f2718fe..00000000 --- a/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "semi": true, - "useTabs": false, - "printWidth": 100, - "trailingComma": "all" -} diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 00000000..0c06786b --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1,2 @@ +tabWidth: 4 +printWidth: 120 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0c219616..00000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 2016 Webflow, Inc - -Permission is hereby granted, free of charge, to any person ob- -taining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restric- -tion, including without limitation the rights to use, copy, modi- -fy, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is fur- -nished 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 NONIN- -FRINGEMENT. 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. diff --git a/README.md b/README.md deleted file mode 100644 index d37a5eaa..00000000 --- a/README.md +++ /dev/null @@ -1,332 +0,0 @@ -# Webflow Data API SDK - -## Installation - -Using npm: - -```shell -$ npm install webflow-api -``` - -Using yarn - -```shell -$ yarn add webflow-api -``` - -## Usage - -The constructor takes in a few optional parameters to initialize the API client - -- `token` - the access token to use -- `headers` - additional headers to add to the request -- `version` - the version of the API you wish to use - -```javascript -const Webflow = require("webflow-api"); - -// initialize the client with the access token -const webflow = new Webflow({ token: "[ACCESS TOKEN]" }); - -// fully loaded -const webflow = new Webflow({ - token: "[ACCESS TOKEN]", - version: "1.0.0", - headers: { - "User-Agent": "My Webflow App / 1.0", - }, -}); -``` - -## Transitioning to API v2 - -We're actively working on a new version of the SDK that will fully support API v2. In the meantime, to make use of API v2 with our SDK, there are some important changes you need to be aware of: - -### Setting Up For API v2 - -When initializing your client, it's crucial to set the `beta` flag to true in the client options. This ensures you're targeting the API v2 endpoints. - -```javascript -const webflow = new Webflow({ beta: true, ...otherOptions }); -``` - -Please note, when the beta flag is set, several built-in methods will not be available. These methods include, but are not limited to, info, authenticatedUser, sites, site, etc. Attempting to use these will throw an error. - -### Calling API v2 Endpoints - -To interact with API v2, you'll need to move away from using built-in methods, and instead use the provided HTTP methods directly. - -For instance, where you previously used `sites()`: - -```javascript -// get the first site -const [site] = await webflow.sites(); -``` - -For API v2, you will need to use direct HTTP methods: - -```javascript -// get the first site -const sites = await webflow.get("/sites"); -const site = sites[0]; -``` - -We understand that this is a shift in how you interact with the SDK, but rest assured, our upcoming SDK version will streamline this process and offer a more integrated experience with API v2. - -## Basic Usage - -### Chaining Calls - -You can retrieve child resources by chaining calls on the parent object. - -```javascript -// get the first site -const [site] = await webflow.sites(); - -// get the first collection in the site -const [collection] = await site.collections(); - -// get the first item in the collection -const [item] = await collection.items(); - -// get one item from the collection -const item = await collection.items({ itemId: "[ITEM ID]" }); -``` - -### Pagination - -To paginate results, pass in the `limit` and `offset` options. - -```javascript -// Get the first page of results -const page1 = await collection.items({ limit: 20 }); - -// Get the second page of results -const page2 = await collection.items({ limit: 20, offset: 20 }); -``` - -### Rate Limit - -Check rate limit status on each call by checking the `_meta` property. - -```javascript -// make an api call -const site = await webflow.site({ siteId: "[SITE ID]" }); - -// check rate limit -const { rateLimit } = site._meta; // { limit: 60, remaining: 56 } -``` - -### Update Token - -If you need to update the access token, you can set the `token` property at any time. - -```javascript -// token is unset -const webflow = new Webflow(); - -// set token -webflow.token = "[ACCESS TOKEN]"; - -// remove the token -webflow.clearToken(); -``` - -### Calling APIs Directly - -All Webflow API endpoints can be called directly using the `get`, `post`, `put`, and `delete` methods. - -```javascript -// call the sites endpoint directly -const sites = await webflow.get("/sites"); - -// post to an endpoint directly -const result = await webflow.post("/sites/[SITE ID]/publish", { - domains: ["hello-webflow.com"], -}); -``` - -## OAuth - -To implement OAuth, you'll need a Webflow App registered and a webserver running, that is publicly facing. - -### Authorize - -The first step in OAuth is to generate an authorization url to redirect the user to. - -```javascript -// Get the authorization url to redirect users to -const url = webflow.authorizeUrl({ - client_id: "[CLIENT ID]", - state: "1234567890", // optional - redirect_uri: "https://my.server.com/oauth/callback", // optional -}); - -// redirect user from your server route -res.redirect(url); -``` - -### Using the scopes Parameter with v2 API - -The v2 API introduces the concept of 'scopes', providing more control over app permissions. Instead of using the scope parameter as a single string, you can define multiple permissions using the scopes array: - -```javascript -const url = webflow.authorizeUrl({ - client_id: "[CLIENT ID]", - redirect_uri: "https://my.server.com/oauth/callback", - scopes: ["read:sites", "write:items", "read:users"], -}); -``` - -For more information and a detailed list of available scopes, refer to our Scopes Guide. - -### Access Token - -Once a user has authorized their Webflow resource(s), Webflow will redirect back to your server with a `code`. Use this to get an access token. - -```javascript -const auth = await webflow.accessToken({ - client_id, - client_secret, - code, - redirect_uri, // optional - required if used in the authorize step -}); - -// you now have the user's access token to make API requests with -const userWF = new Webflow({ token: auth.access_token }); - -// pull information for the user -const authenticatedUser = await userWF.authenticatedUser(); -``` - -### Revoke Token - -If the user decides to disconnect from your server, you should call revoke token to remove the authorization. - -```javascript -const result = await webflow.revokeToken({ - client_id, - client_secret, - access_token, -}); - -// ensure it went through -result.didRevoke === true; -``` - -## Examples - -### Sites - -Get all sites available or lookup by site id. - -```javascript -// List all sites -const sites = await webflow.sites(); - -// Get a single site -const site = await webflow.site({ siteId: "[SITE ID]" }); -``` - -### Collections - -Get all collections available for a site or lookup by collection id. - -```javascript -// Get a site's collection from the site -const collections = await site.collections(); - -// Get a site's collection by passing in a site id -const collections = await webflow.collections({ siteId: "[SITE ID]" }); - -// Get a single collection -const collection = await webflow.collection({ collectionId: "[COLLECTION ID]" }); -``` - -### Collection Items - -Get all collection items available for a collection or lookup by item id. - -```javascript -// Get the items from a collection -const items = await collection.items(); - -// Get a subset of items -const items = await collection.items({ limit: 10, offset: 2 }); - -// Get a single item -const item = await webflow.item({ collectionId: "[COLLECTION ID]", itemId: "[ITEM ID]" }); -``` - -### Update an Item - -```javascript -// Set the fields to update -const fields = { - name: "New Name", - _archived: false, - _draft: false, - slug: "new-name", -}; - -// call update -const updatedItem = await webflow.updateItem({ - collectionId: "[COLLECTION ID]", - itemId: "[ITEM ID]", - fields, -}); -``` - -### Memberships - -```javascript -// Get a site's users from the site -const users = await site.users(); - -// Get a site's users with a site id -const users = await webflow.users({ - siteId: "[SITE ID]", -}); - -// Get a single user -const user = await site.user({ - siteId: "[SITE ID]", - userId: "[USER ID]", -}); - -// Get a site's access groups -const accessGroups = await site.accessGroups(); - -// Get a site's access groups with a site id -const accessGroups = await webflow.accessGroups({ - siteId: "[SITE ID]", -}); -``` - -### Webhooks - -```javascript -// get webhooks for a site -const webhooks = await site.webhooks(); - -// create a webhook -const webhook = await site.createWebhook({ - triggerType: "form_submission", - url: "https://webhook.site", -}); -``` - -### Authenticated User - -```javascript -// pull information for the authenticated user -const authenticatedUser = await webflow.authenticatedUser(); -``` - -## Contributing - -Contributions are welcome - feel free to open an issue or pull request. - -## License - -The MIT license - see `LICENSE`. diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index e3b5924e..00000000 --- a/jest.config.js +++ /dev/null @@ -1,17 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - // A preset that is used as a base for Jest's configuration - preset: "ts-jest", - - // The test environment that will be used for testing - testEnvironment: "node", - - // A map from regular expressions to paths to transformers - transform: { "^.+\\.ts?$": "ts-jest" }, - - // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - transformIgnorePatterns: ["/node_modules/"], - - // Automatically clear mock calls, instances, contexts and results before every test - clearMocks: true, -}; diff --git a/package.json b/package.json index 1b87dc1a..90002f8f 100644 --- a/package.json +++ b/package.json @@ -1,53 +1,28 @@ { - "name": "webflow-api", - "description": "Webflow's official Node.js SDK for Data APIs", - "version": "1.3.1", - "types": "dist/index.d.ts", - "main": "dist/index.js", - "contributors": [ - "Rodney Urquhart (https://github.com/rodneyu215)", - "John Agan (https://github.com/johnagan)" - ], - "repository": { - "url": "https://github.com/webflow/js-webflow-api.git", - "type": "git" - }, - "license": "MIT", - "files": [ - "dist", - "src", - "LICENSE", - "yarn.lock" - ], - "scripts": { - "test": "yarn build && jest", - "build": "yarn clean && tsc", - "lint": "eslint src --ext .ts", - "test:snapshot": "yarn test --updateSnapshot", - "test:coverage": "yarn test --collectCoverage", - "test:ci": "yarn test --ci --coverage --forceExit", - "format": "prettier --write .", - "format:check": "prettier --check .", - "prepublish": "yarn build", - "watch": "tsc --watch", - "clean": "rm -rf dist", - "typecheck": "tsc --noEmit" - }, - "devDependencies": { - "@types/jest": "^29.2.3", - "@types/node": "^18.11.9", - "@typescript-eslint/eslint-plugin": "^5.42.0", - "@typescript-eslint/parser": "^5.42.0", - "axios-mock-adapter": "^1.21.2", - "eslint": "^8.12.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.2.1", - "jest": "^29.2.2", - "prettier": "^2.7.1", - "ts-jest": "^29.0.3", - "typescript": "^4.8.4" - }, - "dependencies": { - "axios": "^1.1.3" - } -} + "name": "", + "version": "0.0.3", + "private": false, + "repository": "https://github.com/webflow/js-webflow-api", + "main": "./index.js", + "types": "./index.d.ts", + "scripts": { + "format": "prettier --write 'src/**/*.ts'", + "build": "tsc", + "prepack": "cp -rv dist/. ." + }, + "dependencies": { + "url-join": "4.0.1", + "form-data": "4.0.0", + "node-fetch": "2.7.0", + "qs": "6.11.2", + "js-base64": "3.7.2" + }, + "devDependencies": { + "@types/url-join": "4.0.1", + "@types/qs": "6.9.8", + "@types/node-fetch": "2.6.9", + "@types/node": "17.0.33", + "prettier": "2.7.1", + "typescript": "4.6.4" + } +} \ No newline at end of file diff --git a/src/Client.ts b/src/Client.ts new file mode 100644 index 00000000..bf57e34f --- /dev/null +++ b/src/Client.ts @@ -0,0 +1,120 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "./environments"; +import * as core from "./core"; +import { Token } from "./api/resources/token/client/Client"; +import { Sites } from "./api/resources/sites/client/Client"; +import { Collections } from "./api/resources/collections/client/Client"; +import { Pages } from "./api/resources/pages/client/Client"; +import { Scripts } from "./api/resources/scripts/client/Client"; +import { Webhooks } from "./api/resources/webhooks/client/Client"; +import { Assets } from "./api/resources/assets/client/Client"; +import { Forms } from "./api/resources/forms/client/Client"; +import { Users } from "./api/resources/users/client/Client"; +import { AccessGroups } from "./api/resources/accessGroups/client/Client"; +import { Products } from "./api/resources/products/client/Client"; +import { Orders } from "./api/resources/orders/client/Client"; +import { Inventory } from "./api/resources/inventory/client/Client"; +import { Ecommerce } from "./api/resources/ecommerce/client/Client"; + +export declare namespace WebflowClient { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class WebflowClient { + constructor(protected readonly _options: WebflowClient.Options) {} + + protected _token: Token | undefined; + + public get token(): Token { + return (this._token ??= new Token(this._options)); + } + + protected _sites: Sites | undefined; + + public get sites(): Sites { + return (this._sites ??= new Sites(this._options)); + } + + protected _collections: Collections | undefined; + + public get collections(): Collections { + return (this._collections ??= new Collections(this._options)); + } + + protected _pages: Pages | undefined; + + public get pages(): Pages { + return (this._pages ??= new Pages(this._options)); + } + + protected _scripts: Scripts | undefined; + + public get scripts(): Scripts { + return (this._scripts ??= new Scripts(this._options)); + } + + protected _webhooks: Webhooks | undefined; + + public get webhooks(): Webhooks { + return (this._webhooks ??= new Webhooks(this._options)); + } + + protected _assets: Assets | undefined; + + public get assets(): Assets { + return (this._assets ??= new Assets(this._options)); + } + + protected _forms: Forms | undefined; + + public get forms(): Forms { + return (this._forms ??= new Forms(this._options)); + } + + protected _users: Users | undefined; + + public get users(): Users { + return (this._users ??= new Users(this._options)); + } + + protected _accessGroups: AccessGroups | undefined; + + public get accessGroups(): AccessGroups { + return (this._accessGroups ??= new AccessGroups(this._options)); + } + + protected _products: Products | undefined; + + public get products(): Products { + return (this._products ??= new Products(this._options)); + } + + protected _orders: Orders | undefined; + + public get orders(): Orders { + return (this._orders ??= new Orders(this._options)); + } + + protected _inventory: Inventory | undefined; + + public get inventory(): Inventory { + return (this._inventory ??= new Inventory(this._options)); + } + + protected _ecommerce: Ecommerce | undefined; + + public get ecommerce(): Ecommerce { + return (this._ecommerce ??= new Ecommerce(this._options)); + } +} diff --git a/src/api/collection.ts b/src/api/collection.ts deleted file mode 100644 index 00409194..00000000 --- a/src/api/collection.ts +++ /dev/null @@ -1,154 +0,0 @@ -import { AxiosInstance } from "axios"; -import { requireArgs, WebflowRecord } from "../core"; -import { Item } from "."; - -/************************************************************** - * Types - **************************************************************/ -export type CollectionFieldType = - | "Bool" - | "Color" - | "Date" - | "ExtFileRef" - | "Set" - | "ImageRef" - | "Set" - | "ItemRef" - | "ItemRefSet" - | "Link" - | "Number" - | "Option" - | "PlainText" - | "RichText" - | "Video" - | "User" - | string; - -export type CollectionField = { - id: string; - type: CollectionFieldType; - slug: string; - name: string; - required: boolean; - editable: boolean; - // TODO: add a better type - validations?: Record; -}; - -/************************************************************** - * Interfaces - **************************************************************/ -export interface ICollection { - _id: string; - lastUpdated: string; - createdOn: string; - name: string; - slug: string; - singularName: string; - fields: CollectionField[]; -} - -/************************************************************** - * Class - **************************************************************/ -export class Collection extends WebflowRecord implements ICollection { - fields: CollectionField[]; - singularName: string; - lastUpdated: string; - createdOn: string; - _id: string; - name: string; - slug: string; - - /************************************************************** - * Static Methods - **************************************************************/ - - /** - * Get a list of Collections - * @param params The params for the request - * @param params.siteId The site ID - * @param client The Axios client instance - * @returns A list of Collections - */ - static list({ siteId }: { siteId: string }, client: AxiosInstance) { - requireArgs({ siteId }); - const path = `/sites/${siteId}/collections`; - return client.get(path); - } - - /** - * Get a single Collection - * @param params The params for the request - * @param params.collectionId The collection ID - * @param client The Axios client instance - * @returns A single Collection - */ - static getOne({ collectionId }: { collectionId: string }, client: AxiosInstance) { - requireArgs({ collectionId }); - const path = `/collections/${collectionId}`; - return client.get(path); - } - - /************************************************************** - * Instance Methods - **************************************************************/ - - /** - * Get a single Item - * @param params The params for the request - * @param params.itemId The Item ID - * @returns A single Item - */ - async item({ itemId }: { itemId: string }) { - const res = await Item.getOne({ itemId, collectionId: this._id }, this.client); - const [item] = res.data.items.map((data) => new Item(this.client, { ...res, data })); - return item; - } - - /** - * Get a list of Items - * @param params The params for the request - * @param params.limit The number of items to return (optional) - * @param params.offset The number of items to skip (optional) - * @returns A list of Items - */ - async items({ limit, offset }: { limit?: number; offset?: number } = {}) { - const res = await Item.list({ collectionId: this._id, limit, offset }, this.client); - return res.data.items.map((data) => new Item(this.client, { ...res, data })); - } - - /** - * Remove a single Item - * @param params The params for the request - * @param params.itemId The Item ID - * @returns The result from the removal - */ - async removeItem({ itemId }: { itemId: string }) { - const res = await Item.remove({ itemId, collectionId: this._id }, this.client); - return res.data; - } - - /** - * Create a new Item - * @param fields The Item fields to create - * @returns The created Item - */ - async createItem(fields: object) { - const res = await Item.create({ collectionId: this._id, fields }, this.client); - return new Item(this.client, res); - } - - /** - * Update a single Item - * @param params The params for the request - * @param params.itemId The Item ID - * @param params.fields The fields to update - * @returns The updated Item - */ - async updateItem({ itemId, fields }: { itemId: string; fields: object }) { - const params = { itemId, collectionId: this._id, fields }; - const res = await Item.update(params, this.client); - return new Item(this.client, res); - } -} diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts new file mode 100644 index 00000000..2f01d54e --- /dev/null +++ b/src/api/errors/BadRequestError.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors"; + +export class BadRequestError extends errors.WebflowError { + constructor(body?: unknown) { + super({ + message: "BadRequestError", + statusCode: 400, + body: body, + }); + Object.setPrototypeOf(this, BadRequestError.prototype); + } +} diff --git a/src/api/errors/ConflictError.ts b/src/api/errors/ConflictError.ts new file mode 100644 index 00000000..2cb6445c --- /dev/null +++ b/src/api/errors/ConflictError.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors"; + +export class ConflictError extends errors.WebflowError { + constructor(body?: unknown) { + super({ + message: "ConflictError", + statusCode: 409, + body: body, + }); + Object.setPrototypeOf(this, ConflictError.prototype); + } +} diff --git a/src/api/errors/ForbiddenError.ts b/src/api/errors/ForbiddenError.ts new file mode 100644 index 00000000..2ffdaf7b --- /dev/null +++ b/src/api/errors/ForbiddenError.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors"; + +export class ForbiddenError extends errors.WebflowError { + constructor(body?: unknown) { + super({ + message: "ForbiddenError", + statusCode: 403, + body: body, + }); + Object.setPrototypeOf(this, ForbiddenError.prototype); + } +} diff --git a/src/api/errors/InternalServerError.ts b/src/api/errors/InternalServerError.ts new file mode 100644 index 00000000..db9aa435 --- /dev/null +++ b/src/api/errors/InternalServerError.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors"; + +export class InternalServerError extends errors.WebflowError { + constructor(body?: unknown) { + super({ + message: "InternalServerError", + statusCode: 500, + body: body, + }); + Object.setPrototypeOf(this, InternalServerError.prototype); + } +} diff --git a/src/api/errors/NotFoundError.ts b/src/api/errors/NotFoundError.ts new file mode 100644 index 00000000..b271f39c --- /dev/null +++ b/src/api/errors/NotFoundError.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors"; + +export class NotFoundError extends errors.WebflowError { + constructor(body?: unknown) { + super({ + message: "NotFoundError", + statusCode: 404, + body: body, + }); + Object.setPrototypeOf(this, NotFoundError.prototype); + } +} diff --git a/src/api/errors/TooManyRequestsError.ts b/src/api/errors/TooManyRequestsError.ts new file mode 100644 index 00000000..c507d248 --- /dev/null +++ b/src/api/errors/TooManyRequestsError.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors"; + +export class TooManyRequestsError extends errors.WebflowError { + constructor(body?: unknown) { + super({ + message: "TooManyRequestsError", + statusCode: 429, + body: body, + }); + Object.setPrototypeOf(this, TooManyRequestsError.prototype); + } +} diff --git a/src/api/errors/UnauthorizedError.ts b/src/api/errors/UnauthorizedError.ts new file mode 100644 index 00000000..1dd6524a --- /dev/null +++ b/src/api/errors/UnauthorizedError.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors"; + +export class UnauthorizedError extends errors.WebflowError { + constructor(body?: unknown) { + super({ + message: "UnauthorizedError", + statusCode: 401, + body: body, + }); + Object.setPrototypeOf(this, UnauthorizedError.prototype); + } +} diff --git a/src/api/errors/index.ts b/src/api/errors/index.ts new file mode 100644 index 00000000..afae7f17 --- /dev/null +++ b/src/api/errors/index.ts @@ -0,0 +1,7 @@ +export * from "./BadRequestError"; +export * from "./UnauthorizedError"; +export * from "./ForbiddenError"; +export * from "./NotFoundError"; +export * from "./ConflictError"; +export * from "./TooManyRequestsError"; +export * from "./InternalServerError"; diff --git a/src/api/index.ts b/src/api/index.ts index 4923fd37..30060724 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,7 +1,3 @@ -export * from "./collection"; -export * from "./user"; -export * from "./webhook"; -export * from "./item"; -export * from "./site"; -export * from "./oauth"; -export * from "./meta"; +export * from "./resources"; +export * from "./types"; +export * from "./errors"; diff --git a/src/api/item.ts b/src/api/item.ts deleted file mode 100644 index ce4bcac7..00000000 --- a/src/api/item.ts +++ /dev/null @@ -1,272 +0,0 @@ -import { AxiosInstance } from "axios"; -import { PaginatedData, requireArgs, WebflowRecord } from "../core"; - -/************************************************************** - * Interfaces - **************************************************************/ -export interface IItem { - _archived: boolean; - _draft: boolean; - _id: string; - _cid: string; - name: string; - slug: string; - "updated-on": string; - "created-on": string; - "updated-by": string; - "created-by": string; - "published-on"?: string | null; - "published-by"?: string | null; -} - -export interface IItemDelete { - deleted: number; -} - -export interface IPublishItems { - publishedItemIds: string[]; - errors: string[]; -} - -export interface IDeletedItems { - deletedItemIds: string[]; - errors: string[]; -} - -/************************************************************** - * Types - **************************************************************/ -export type PaginatedItems = PaginatedData & { - items: IItem[]; -}; - -/************************************************************** - * Class - **************************************************************/ - -export class Item extends WebflowRecord implements IItem { - "published-on"?: string | null; - "published-by"?: string | null; - "updated-on": string; - "created-on": string; - "updated-by": string; - "created-by": string; - _archived: boolean; - _draft: boolean; - _cid: string; - name: string; - slug: string; - _id: string; - - /************************************************************** - * Static Methods - **************************************************************/ - - /** - * Get a single Item - * @param params The params for the request - * @param params.collectionId The Collection ID - * @param params.itemId The Item ID - * @param client The Axios client instance - * @returns A single Item - */ - static getOne( - { collectionId, itemId }: { collectionId: string; itemId: string }, - client: AxiosInstance, - ) { - requireArgs({ collectionId, itemId }); - const path = `/collections/${collectionId}/items/${itemId}`; - // The API returns a paginated list with one record :( - return client.get(path); - } - - /** - * Get a list of Items - * @param params The params for the request - * @param params.collectionId The Collection ID - * @param params.limit The number of items to return (optional) - * @param params.offset The number of items to skip (optional) - * @param client The Axios client instance - * @returns A list of Items - */ - static list( - { collectionId, limit, offset }: { collectionId: string; limit?: number; offset?: number }, - client: AxiosInstance, - ) { - requireArgs({ collectionId }); - const params = { limit, offset }; - const path = `/collections/${collectionId}/items`; - return client.get(path, { params }); - } - - /** - * Create a new Item - * @param params The params for the request - * @param params.collectionId The Collection ID - * @param params.fields The Item fields to create - * @param client The Axios client instance - * @returns The created Item - */ - static create( - { collectionId, fields }: { fields: any; collectionId: string }, - client: AxiosInstance, - ) { - requireArgs({ collectionId }); - const path = `/collections/${collectionId}/items`; - return client.post(path, { fields }); - } - - /** - * Update a single Item - * @param params The params for the request - * @param params.collectionId The Collection ID - * @param params.itemId The Item ID - * @param params.fields The fields to update - * @param client The Axios client instance - * @returns The updated Item - */ - static update( - { - collectionId, - itemId, - fields, - }: { - fields: any; - itemId: string; - collectionId: string; - }, - client: AxiosInstance, - ) { - requireArgs({ collectionId, itemId }); - const path = `/collections/${collectionId}/items/${itemId}`; - return client.put(path, { fields }); - } - - /** - * Patch a single Item - * @param params The params for the request - * @param params.collectionId The Collection ID - * @param params.itemId The Item ID - * @param params.fields The fields to patch - * @param client The Axios client instance - * @returns The patched Item - */ - static patch( - { - collectionId, - itemId, - fields, - }: { - fields: any; - itemId: string; - collectionId: string; - }, - client: AxiosInstance, - ) { - requireArgs({ collectionId, itemId }); - const path = `/collections/${collectionId}/items/${itemId}`; - return client.patch(path, { fields }); - } - - /** - * Remove a single Item - * @param params The params for the request - * @param params.collectionId The Collection ID - * @param params.itemId The Item ID - * @param client The Axios client instance - * @returns The result from the removal - */ - static remove( - { - collectionId, - itemId, - }: { - itemId: string; - collectionId: string; - }, - client: AxiosInstance, - ) { - requireArgs({ collectionId, itemId }); - const path = `/collections/${collectionId}/items/${itemId}`; - return client.delete(path); - } - - /** - * Unpublish a list of Items - * @param params The params for the request - * @param params.collectionId The Collection ID - * @param params.live Unpublish from the live site - * @param client The Axios client instance - * @returns The result of the unpublish - */ - static unpublish( - { - collectionId, - itemIds, - live = false, - }: { - live?: boolean; - itemIds: string[]; - collectionId: string; - }, - client: AxiosInstance, - ) { - requireArgs({ collectionId, itemIds }); - const params = { live }; - const data = { itemIds }; - const url = `/collections/${collectionId}/items`; - const _params = { method: "DELETE", url, data, params }; - - // DELETE spec doesn't support body in delete - // RFC-9110 https://tools.ietf.org/html/rfc9110 - return client.request(_params); - } - - /** - * Publishes a list of Items - * @param params The request parameters - * @param params.collectionId The Collection ID - * @param params.itemIds The list of Item IDs to publish - * @param params.live Publish to live site - * @param client The Axios client instance - * @returns The result of the publish - */ - static publish( - { - itemIds, - live = false, - collectionId, - }: { live?: boolean; itemIds: string[]; collectionId: string }, - client: AxiosInstance, - ) { - requireArgs({ collectionId, itemIds }); - const params = { live }; - const path = `/collections/${collectionId}/items/publish`; - return client.put(path, { itemIds }, { params }); - } - - /************************************************************** - * Instance Methods - **************************************************************/ - - /** - * Update a single Item - * @param fields The fields to update - * @returns The updated Item - */ - async update({ ...fields }) { - const params = { collectionId: this._cid, itemId: this._id, fields }; - const res = await Item.update(params, this.client); - return new Item(this.client, res); - } - - /** - * Remove a single Item - * @returns The result from the removal - */ - async remove() { - const params = { collectionId: this._cid, itemId: this._id }; - const res = await Item.remove(params, this.client); - return res.data; - } -} diff --git a/src/api/meta.ts b/src/api/meta.ts deleted file mode 100644 index 845bc3d1..00000000 --- a/src/api/meta.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { AxiosInstance } from "axios"; - -/************************************************************** - * Types - **************************************************************/ -export type InfoApplication = { - description: string; - ownerType: string; - homepage: string; - owner: string; - name: string; - _id: string; -}; - -/************************************************************** - * Interfaces - **************************************************************/ -export interface IAuthenticatedUser { - user: { - firstName: string; - lastName: string; - email: string; - _id: string; - }; -} - -export interface IAuthenticationInfo { - application: InfoApplication; - workspaces: string[]; - rateLimit: number; - createdOn: string; - grantType: string; - lastUsed: string; - sites: string[]; - users: string[]; - orgs: string[]; - status: string; - _id: string; -} - -/************************************************************** - * Class - **************************************************************/ -export class Meta { - /** - * Get the authentication info for the current token - * @param client The Axios client instance - * @returns The authentication info - */ - static info(client: AxiosInstance) { - return client.get("/info"); - } - - /** - * Get the authenticated user - * @param client The Axios client instance - * @returns The authenticated user - */ - static user(client: AxiosInstance) { - return client.get("/user"); - } -} diff --git a/src/api/oauth.ts b/src/api/oauth.ts deleted file mode 100644 index 722565ea..00000000 --- a/src/api/oauth.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { AxiosInstance } from "axios"; -import { requireArgs, SupportedScope } from "../core"; - -/************************************************************** - * Interfaces - **************************************************************/ -export interface IAuthorizeUrlParams { - state?: string; - scope?: string; - scopes?: SupportedScope[]; - client_id: string; - redirect_uri?: string; - response_type?: string; -} - -export interface IRevokeTokenParams { - client_secret: string; - access_token: string; - client_id: string; -} - -export interface IAccessTokenParams { - code: string; - client_id: string; - grant_type?: string; - client_secret: string; - redirect_uri?: string; -} - -export interface IAccessToken { - token_type: string; - access_token: string; -} - -export interface IRevokeToken { - didRevoke: boolean; -} - -/************************************************************** - * Class - **************************************************************/ - -export class OAuth { - /** - * Get the URL to authorize a user - * @param params The params for the request - * @param params.client_id The OAuth client ID - * @param params.scope The scope (optional) - * @param params.state The state (optional) - * @param params.redirect_uri The redirect URI (optional) - * @param params.response_type The response type (default: code) - * @param client The Axios client instance - * @returns The URL to authorize a user - */ - static authorizeUrl( - { response_type = "code", redirect_uri, client_id, state, scope, scopes }: IAuthorizeUrlParams, - client: AxiosInstance, - ) { - requireArgs({ client_id }); - - if (scope && scopes) { - throw new Error("Please provide either 'scope' or 'scopes', but not both."); - } - - const params = { response_type, client_id }; - if (redirect_uri) params["redirect_uri"] = redirect_uri; - if (state) params["state"] = state; - if (scope) params["scope"] = scope; - if (scopes && scopes.length > 0) params["scope"] = scopes.join("+"); - - const url = "/oauth/authorize"; - const baseURL = client.defaults.baseURL.replace("api.", ""); - return client.getUri({ baseURL, url, method: "GET", params }); - } - - /** - * Get an access token - * @param params The params for the request - * @param params.code The OAuth code - * @param params.client_id The OAuth client ID - * @param params.client_secret The OAuth client secret - * @param params.redirect_uri The redirect URI (optional) - * @param params.grant_type The grant type (default: "authorization_code") - * @param client The Axios client instance - * @returns An access token - */ - static accessToken( - { - grant_type = "authorization_code", - client_secret, - redirect_uri, - client_id, - code, - }: IAccessTokenParams, - client: AxiosInstance, - ) { - requireArgs({ client_id, client_secret, code }); - - const path = "/oauth/access_token"; - const data = { client_secret, redirect_uri, grant_type, client_id, code }; - return client.post(path, data); - } - - /** - * Revoke an access token - * @param params The params for the request - * @param params.client_id The OAuth client ID - * @param params.client_secret The OAuth client secret - * @param params.access_token The OAuth access token - * @param client The Axios client instance - * @returns The result of the revoke - */ - static revokeToken( - { client_secret, access_token, client_id }: IRevokeTokenParams, - client: AxiosInstance, - ) { - requireArgs({ client_id, client_secret, access_token }); - - const path = "/oauth/revoke_authorization"; - const data = { client_secret, access_token, client_id }; - return client.post(path, data); - } -} diff --git a/src/api/resources/accessGroups/client/Client.ts b/src/api/resources/accessGroups/client/Client.ts new file mode 100644 index 00000000..0dec82ba --- /dev/null +++ b/src/api/resources/accessGroups/client/Client.ts @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace AccessGroups { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class AccessGroups { + constructor(protected readonly _options: AccessGroups.Options) {} + + /** + * Get a list of access groups for a site

Required scope | `users:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.accessGroups.list("site-id", { + * sort: Webflow.AccessGroupsListRequestSort.CreatedOnAscending + * }) + */ + public async list( + siteId: string, + request: Webflow.AccessGroupsListRequest = {}, + requestOptions?: AccessGroups.RequestOptions + ): Promise { + const { offset, limit, sort } = request; + const _queryParams: Record = {}; + if (offset != null) { + _queryParams["offset"] = offset.toString(); + } + + if (limit != null) { + _queryParams["limit"] = limit.toString(); + } + + if (sort != null) { + _queryParams["sort"] = sort; + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/accessgroups` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.AccessGroupList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/accessGroups/client/index.ts b/src/api/resources/accessGroups/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/accessGroups/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/accessGroups/client/requests/AccessGroupsListRequest.ts b/src/api/resources/accessGroups/client/requests/AccessGroupsListRequest.ts new file mode 100644 index 00000000..015ba6fe --- /dev/null +++ b/src/api/resources/accessGroups/client/requests/AccessGroupsListRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../.."; + +/** + * @example + * { + * sort: Webflow.AccessGroupsListRequestSort.CreatedOnAscending + * } + */ +export interface AccessGroupsListRequest { + /** + * Offset used for pagination if the results have more than limit records + */ + offset?: number; + /** + * Maximum number of records to be returned (max limit: 100) + */ + limit?: number; + /** + * Sort string to use when ordering access groups + * Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`) + */ + sort?: Webflow.AccessGroupsListRequestSort; +} diff --git a/src/api/resources/accessGroups/client/requests/index.ts b/src/api/resources/accessGroups/client/requests/index.ts new file mode 100644 index 00000000..3e580385 --- /dev/null +++ b/src/api/resources/accessGroups/client/requests/index.ts @@ -0,0 +1 @@ +export { AccessGroupsListRequest } from "./AccessGroupsListRequest"; diff --git a/src/api/resources/accessGroups/index.ts b/src/api/resources/accessGroups/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/accessGroups/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/accessGroups/types/AccessGroupsListRequestSort.ts b/src/api/resources/accessGroups/types/AccessGroupsListRequestSort.ts new file mode 100644 index 00000000..65c33f46 --- /dev/null +++ b/src/api/resources/accessGroups/types/AccessGroupsListRequestSort.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type AccessGroupsListRequestSort = + /** + * Sorts users in ascending order based on their created date */ + | "CreatedOn" + /** + * Sorts users in descending order based on their created date */ + | "-CreatedOn"; + +export const AccessGroupsListRequestSort = { + CreatedOnAscending: "CreatedOn", + CreatedOnDescending: "-CreatedOn", +} as const; diff --git a/src/api/resources/accessGroups/types/index.ts b/src/api/resources/accessGroups/types/index.ts new file mode 100644 index 00000000..5b80efb0 --- /dev/null +++ b/src/api/resources/accessGroups/types/index.ts @@ -0,0 +1 @@ +export * from "./AccessGroupsListRequestSort"; diff --git a/src/api/resources/assets/client/Client.ts b/src/api/resources/assets/client/Client.ts new file mode 100644 index 00000000..13ec257a --- /dev/null +++ b/src/api/resources/assets/client/Client.ts @@ -0,0 +1,555 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace Assets { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Assets { + constructor(protected readonly _options: Assets.Options) {} + + /** + * List assets for a given site

Required scope | `assets:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.assets.list("site-id") + */ + public async list(siteId: string, requestOptions?: Assets.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/assets` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.assets.list.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a new asset entry.

This endpoint generates a response with the following information: `uploadUrl` and `uploadDetails`. You can use these two properties to [upload the file to Amazon s3 by making a POST](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html) request to the `uploadUrl` with the `uploadDetails` object as your header information in the request.

Required scope | `assets:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.assets.create("site-id", { + * fileName: "file.png", + * fileHash: "3c7d87c9575702bc3b1e991f4d3c638e", + * parentFolder: "6436b1ce5281cace05b65aea" + * }) + */ + public async create( + siteId: string, + request: Webflow.AssetsCreateRequest, + requestOptions?: Assets.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/assets` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.AssetsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.AssetUpload.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get an Asset

Required scope | `assets:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.assets.get("asset-id") + */ + public async get(assetId: string, requestOptions?: Assets.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `assets/${assetId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Asset.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete an Asset + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.assets.delete("asset-id") + */ + public async delete(assetId: string, requestOptions?: Assets.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `assets/${assetId}` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * List Asset Folders within a given site

Required scope | `assets:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.assets.listFolders("site-id") + */ + public async listFolders(siteId: string, requestOptions?: Assets.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/asset_folders` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.AssetFolderList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create an Asset Folder within a given site

Required scope | `assets:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.assets.createFolder("site-id", { + * displayName: "my asset folder", + * parentFolder: "6390c49774a71f99f21a08eb" + * }) + */ + public async createFolder( + siteId: string, + request: Webflow.AssetsCreateFolderRequest, + requestOptions?: Assets.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/asset_folders` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.AssetsCreateFolderRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.AssetFolder.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get details about a specific Asset Folder

Required scope | `assets:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.assets.getFolder("asset-folder-id") + */ + public async getFolder( + assetFolderId: string, + requestOptions?: Assets.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `asset_folders/${assetFolderId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.AssetFolder.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/assets/client/index.ts b/src/api/resources/assets/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/assets/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/assets/client/requests/AssetsCreateFolderRequest.ts b/src/api/resources/assets/client/requests/AssetsCreateFolderRequest.ts new file mode 100644 index 00000000..32f5c0b3 --- /dev/null +++ b/src/api/resources/assets/client/requests/AssetsCreateFolderRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * displayName: "my asset folder", + * parentFolder: "6390c49774a71f99f21a08eb" + * } + */ +export interface AssetsCreateFolderRequest { + /** A human readable name for the Asset Folder */ + displayName: string; + /** An (optional) pointer to a parent Asset Folder (or null for root) */ + parentFolder?: string; +} diff --git a/src/api/resources/assets/client/requests/AssetsCreateRequest.ts b/src/api/resources/assets/client/requests/AssetsCreateRequest.ts new file mode 100644 index 00000000..4a947efa --- /dev/null +++ b/src/api/resources/assets/client/requests/AssetsCreateRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * fileName: "file.png", + * fileHash: "3c7d87c9575702bc3b1e991f4d3c638e", + * parentFolder: "6436b1ce5281cace05b65aea" + * } + */ +export interface AssetsCreateRequest { + /** file name including file extension */ + fileName: string; + /** MD5 hash of the file */ + fileHash: string; + /** id of the Asset folder (optional) */ + parentFolder?: string; +} diff --git a/src/api/resources/assets/client/requests/index.ts b/src/api/resources/assets/client/requests/index.ts new file mode 100644 index 00000000..1fd1f947 --- /dev/null +++ b/src/api/resources/assets/client/requests/index.ts @@ -0,0 +1,2 @@ +export { AssetsCreateRequest } from "./AssetsCreateRequest"; +export { AssetsCreateFolderRequest } from "./AssetsCreateFolderRequest"; diff --git a/src/api/resources/assets/index.ts b/src/api/resources/assets/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/assets/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/collections/client/Client.ts b/src/api/resources/collections/client/Client.ts new file mode 100644 index 00000000..52a9fc25 --- /dev/null +++ b/src/api/resources/collections/client/Client.ts @@ -0,0 +1,403 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; +import { Fields } from "../resources/fields/client/Client"; +import { Items } from "../resources/items/client/Client"; + +export declare namespace Collections { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Collections { + constructor(protected readonly _options: Collections.Options) {} + + /** + * List of all Collections within a Site.

Required scope | `cms:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.collections.list("site-id") + */ + public async list(siteId: string, requestOptions?: Collections.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/collections` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.CollectionList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a Collection for a site.

Required scope | `cms:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + */ + public async create( + siteId: string, + request: Webflow.CollectionsCreateRequest, + requestOptions?: Collections.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/collections` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.CollectionsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Collection.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get the full details of a collection from its ID.

Required scope | `cms:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.collections.get("collection-id") + */ + public async get(collectionId: string, requestOptions?: Collections.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Collection.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete a collection using its ID.

Required scope | `cms:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.collections.deleteCollection("collection-id") + */ + public async deleteCollection(collectionId: string, requestOptions?: Collections.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete a custom field in a collection. This endpoint does not currently support bulk deletion.

Required scope | `cms:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.collections.delete("collection-id", "field-id") + */ + public async delete( + collectionId: string, + fieldId: string, + requestOptions?: Collections.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/fields/${fieldId}` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected _fields: Fields | undefined; + + public get fields(): Fields { + return (this._fields ??= new Fields(this._options)); + } + + protected _items: Items | undefined; + + public get items(): Items { + return (this._items ??= new Items(this._options)); + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/collections/client/index.ts b/src/api/resources/collections/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/collections/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/collections/client/requests/CollectionsCreateRequest.ts b/src/api/resources/collections/client/requests/CollectionsCreateRequest.ts new file mode 100644 index 00000000..0efe9fff --- /dev/null +++ b/src/api/resources/collections/client/requests/CollectionsCreateRequest.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CollectionsCreateRequest { + /** Name of the collection. Each collection name must be distinct. */ + displayName: string; + /** Singular name of each item. */ + singularName: string; + /** Part of a URL that identifier */ + slug?: string; +} diff --git a/src/api/resources/collections/client/requests/index.ts b/src/api/resources/collections/client/requests/index.ts new file mode 100644 index 00000000..1694555b --- /dev/null +++ b/src/api/resources/collections/client/requests/index.ts @@ -0,0 +1 @@ +export { CollectionsCreateRequest } from "./CollectionsCreateRequest"; diff --git a/src/api/resources/collections/index.ts b/src/api/resources/collections/index.ts new file mode 100644 index 00000000..4ce0f390 --- /dev/null +++ b/src/api/resources/collections/index.ts @@ -0,0 +1,2 @@ +export * from "./resources"; +export * from "./client"; diff --git a/src/api/resources/collections/resources/fields/client/Client.ts b/src/api/resources/collections/resources/fields/client/Client.ts new file mode 100644 index 00000000..a0f8ac73 --- /dev/null +++ b/src/api/resources/collections/resources/fields/client/Client.ts @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Webflow from "../../../../.."; +import * as serializers from "../../../../../../serialization"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors"; + +export declare namespace Fields { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Fields { + constructor(protected readonly _options: Fields.Options) {} + + /** + * Create a custom field in a collection.

Slugs must be all lowercase letters without spaces. If you pass a string with uppercase letters and/or spaces to the "Slug" property, Webflow will convert the slug to lowercase and replace spaces with "-."

Only some field types can be created through the API. This endpoint does not currently support bulk creation.

Required scope | `cms:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + */ + public async create( + collectionId: string, + request: Webflow.Field, + requestOptions?: Fields.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/fields` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.Field.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Field.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update a custom field in a collection.

Required scope | `cms:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + */ + public async update( + collectionId: string, + fieldId: string, + request: Webflow.collections.FieldUpdate = {}, + requestOptions?: Fields.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/fields/${fieldId}` + ), + method: "PATCH", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.collections.FieldUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Field.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/collections/resources/fields/client/index.ts b/src/api/resources/collections/resources/fields/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/collections/resources/fields/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/collections/resources/fields/client/requests/FieldUpdate.ts b/src/api/resources/collections/resources/fields/client/requests/FieldUpdate.ts new file mode 100644 index 00000000..3a782b2c --- /dev/null +++ b/src/api/resources/collections/resources/fields/client/requests/FieldUpdate.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface FieldUpdate { + /** Define whether a field is required in a collection */ + isRequired?: boolean; + /** The name of a field */ + displayName?: string; + /** Additional text to help anyone filling out this field */ + helpText?: string; +} diff --git a/src/api/resources/collections/resources/fields/client/requests/index.ts b/src/api/resources/collections/resources/fields/client/requests/index.ts new file mode 100644 index 00000000..6eda1252 --- /dev/null +++ b/src/api/resources/collections/resources/fields/client/requests/index.ts @@ -0,0 +1 @@ +export { FieldUpdate } from "./FieldUpdate"; diff --git a/src/api/resources/collections/resources/fields/index.ts b/src/api/resources/collections/resources/fields/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/collections/resources/fields/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/collections/resources/index.ts b/src/api/resources/collections/resources/index.ts new file mode 100644 index 00000000..2452d24a --- /dev/null +++ b/src/api/resources/collections/resources/index.ts @@ -0,0 +1,5 @@ +export * as items from "./items"; +export * from "./items/types"; +export * as fields from "./fields"; +export * from "./fields/client/requests"; +export * from "./items/client/requests"; diff --git a/src/api/resources/collections/resources/items/client/Client.ts b/src/api/resources/collections/resources/items/client/Client.ts new file mode 100644 index 00000000..3a2c4177 --- /dev/null +++ b/src/api/resources/collections/resources/items/client/Client.ts @@ -0,0 +1,509 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Webflow from "../../../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization"; +import * as errors from "../../../../../../errors"; + +export declare namespace Items { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Items { + constructor(protected readonly _options: Items.Options) {} + + /** + * List of all Items within a Collection.

Required scope | `cms:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.collections.items.listItems("collection-id", {}) + */ + public async listItems( + collectionId: string, + request: Webflow.collections.ItemsListItemsRequest = {}, + requestOptions?: Items.RequestOptions + ): Promise { + const { offset, limit } = request; + const _queryParams: Record = {}; + if (offset != null) { + _queryParams["offset"] = offset.toString(); + } + + if (limit != null) { + _queryParams["limit"] = limit.toString(); + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/items` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.CollectionItemList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create Item in a Collection.

Required scope | `cms:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.collections.items.createItem("collection-id", { + * id: "580e64008c9a982ac9b8b754", + * lastPublished: "2023-03-17T18:47:35.560Z", + * lastUpdated: "2023-03-17T18:47:35.560Z", + * createdOn: "2023-03-17T18:47:35.560Z" + * }) + */ + public async createItem( + collectionId: string, + request: Webflow.CollectionItem, + requestOptions?: Items.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/items` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.CollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get details of a selected Collection Item.

Required scope | `cms:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.collections.items.getItem("collection-id", "item-id") + */ + public async getItem( + collectionId: string, + itemId: string, + requestOptions?: Items.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/items/${itemId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.CollectionItem.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete an Item from a Collection. This endpoint does not currently support bulk deletion.

Required scope | `cms:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.collections.items.deleteItem("collection-id", "item-id") + */ + public async deleteItem( + collectionId: string, + itemId: string, + requestOptions?: Items.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/items/${itemId}` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update a selected Item in a Collection.

Required scope | `cms:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.collections.items.updateItem("collection-id", "item-id", { + * id: "580e64008c9a982ac9b8b754", + * lastPublished: "2023-03-17T18:47:35.560Z", + * lastUpdated: "2023-03-17T18:47:35.560Z", + * createdOn: "2023-03-17T18:47:35.560Z" + * }) + */ + public async updateItem( + collectionId: string, + itemId: string, + request: Webflow.CollectionItem, + requestOptions?: Items.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/items/${itemId}` + ), + method: "PATCH", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.CollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.CollectionItem.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Publish an item or multiple items.

Required scope | `cms:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.collections.items.publishItem("collection-id", { + * itemIds: [] + * }) + */ + public async publishItem( + collectionId: string, + request: Webflow.collections.ItemsPublishItemRequest, + requestOptions?: Items.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/items/publish` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.collections.ItemsPublishItemRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.collections.ItemsPublishItemResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/collections/resources/items/client/index.ts b/src/api/resources/collections/resources/items/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/collections/resources/items/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/collections/resources/items/client/requests/ItemsListItemsRequest.ts b/src/api/resources/collections/resources/items/client/requests/ItemsListItemsRequest.ts new file mode 100644 index 00000000..1537f261 --- /dev/null +++ b/src/api/resources/collections/resources/items/client/requests/ItemsListItemsRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface ItemsListItemsRequest { + /** + * Offset used for pagination if the results have more than limit records + */ + offset?: number; + /** + * Maximum number of records to be returned (max limit: 100) + */ + limit?: number; +} diff --git a/src/api/resources/collections/resources/items/client/requests/ItemsPublishItemRequest.ts b/src/api/resources/collections/resources/items/client/requests/ItemsPublishItemRequest.ts new file mode 100644 index 00000000..9aab2611 --- /dev/null +++ b/src/api/resources/collections/resources/items/client/requests/ItemsPublishItemRequest.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * itemIds: [] + * } + */ +export interface ItemsPublishItemRequest { + itemIds: string[]; +} diff --git a/src/api/resources/collections/resources/items/client/requests/index.ts b/src/api/resources/collections/resources/items/client/requests/index.ts new file mode 100644 index 00000000..36d6bc56 --- /dev/null +++ b/src/api/resources/collections/resources/items/client/requests/index.ts @@ -0,0 +1,2 @@ +export { ItemsListItemsRequest } from "./ItemsListItemsRequest"; +export { ItemsPublishItemRequest } from "./ItemsPublishItemRequest"; diff --git a/src/api/resources/collections/resources/items/index.ts b/src/api/resources/collections/resources/items/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/collections/resources/items/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/collections/resources/items/types/ItemsPublishItemResponse.ts b/src/api/resources/collections/resources/items/types/ItemsPublishItemResponse.ts new file mode 100644 index 00000000..94e2b8c1 --- /dev/null +++ b/src/api/resources/collections/resources/items/types/ItemsPublishItemResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ItemsPublishItemResponse { + publishedItemIds?: string[]; + errors?: string[]; +} diff --git a/src/api/resources/collections/resources/items/types/index.ts b/src/api/resources/collections/resources/items/types/index.ts new file mode 100644 index 00000000..3bd3eea7 --- /dev/null +++ b/src/api/resources/collections/resources/items/types/index.ts @@ -0,0 +1 @@ +export * from "./ItemsPublishItemResponse"; diff --git a/src/api/resources/ecommerce/client/Client.ts b/src/api/resources/ecommerce/client/Client.ts new file mode 100644 index 00000000..9617aca6 --- /dev/null +++ b/src/api/resources/ecommerce/client/Client.ts @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace Ecommerce { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Ecommerce { + constructor(protected readonly _options: Ecommerce.Options) {} + + /** + * Retrieve ecommerce settings for a site. + * + * Required scope | `ecommerce:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.ecommerce.getSettings("site-id") + */ + public async getSettings( + siteId: string, + requestOptions?: Ecommerce.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/ecommerce/settings` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.EcommerceSettings.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/ecommerce/client/index.ts b/src/api/resources/ecommerce/client/index.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/src/api/resources/ecommerce/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/ecommerce/index.ts b/src/api/resources/ecommerce/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/ecommerce/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/forms/client/Client.ts b/src/api/resources/forms/client/Client.ts new file mode 100644 index 00000000..f0182644 --- /dev/null +++ b/src/api/resources/forms/client/Client.ts @@ -0,0 +1,429 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace Forms { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Forms { + constructor(protected readonly _options: Forms.Options) {} + + /** + * List forms for a given site

Required scope | `forms:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.forms.list("site-id") + */ + public async list(siteId: string, requestOptions?: Forms.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/forms` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.FormList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get information about a given form

Required scope | `forms:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.forms.get("form-id") + */ + public async get(formId: string, requestOptions?: Forms.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `forms/${formId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Form.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * List form submissions for a given form

Required scope | `forms:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.forms.listSubmissions("form-id") + */ + public async listSubmissions( + formId: string, + requestOptions?: Forms.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `forms/${formId}/submissions` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.FormSubmissionList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get information about a given form submission

Required scope | `forms:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.forms.getSubmission("form-submission-id") + */ + public async getSubmission( + formSubmissionId: string, + requestOptions?: Forms.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `form_submissions/${formSubmissionId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.FormSubmission.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update hidden fields on a form submission

Required scope | `forms:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.forms.updateSubmission("form-submission-id", {}) + */ + public async updateSubmission( + formSubmissionId: string, + request: Webflow.FormsUpdateSubmissionRequest = {}, + requestOptions?: Forms.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `form_submissions/${formSubmissionId}` + ), + method: "PATCH", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.FormsUpdateSubmissionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.FormSubmission.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/forms/client/index.ts b/src/api/resources/forms/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/forms/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/forms/client/requests/FormsUpdateSubmissionRequest.ts b/src/api/resources/forms/client/requests/FormsUpdateSubmissionRequest.ts new file mode 100644 index 00000000..d0c8dfb4 --- /dev/null +++ b/src/api/resources/forms/client/requests/FormsUpdateSubmissionRequest.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface FormsUpdateSubmissionRequest { + /** An existing **hidden field** defined on the form schema, and the corresponding value to set */ + formSubmissionData?: Record; +} diff --git a/src/api/resources/forms/client/requests/index.ts b/src/api/resources/forms/client/requests/index.ts new file mode 100644 index 00000000..71e69650 --- /dev/null +++ b/src/api/resources/forms/client/requests/index.ts @@ -0,0 +1 @@ +export { FormsUpdateSubmissionRequest } from "./FormsUpdateSubmissionRequest"; diff --git a/src/api/resources/forms/index.ts b/src/api/resources/forms/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/forms/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts new file mode 100644 index 00000000..3c2d1ab5 --- /dev/null +++ b/src/api/resources/index.ts @@ -0,0 +1,30 @@ +export * as collections from "./collections"; +export * as users from "./users"; +export * from "./users/types"; +export * as accessGroups from "./accessGroups"; +export * from "./accessGroups/types"; +export * as products from "./products"; +export * from "./products/types"; +export * as orders from "./orders"; +export * from "./orders/types"; +export * as inventory from "./inventory"; +export * from "./inventory/types"; +export * as token from "./token"; +export * as sites from "./sites"; +export * as pages from "./pages"; +export * as scripts from "./scripts"; +export * as webhooks from "./webhooks"; +export * as assets from "./assets"; +export * as forms from "./forms"; +export * as ecommerce from "./ecommerce"; +export * from "./sites/client/requests"; +export * from "./collections/client/requests"; +export * from "./scripts/client/requests"; +export * from "./webhooks/client/requests"; +export * from "./assets/client/requests"; +export * from "./forms/client/requests"; +export * from "./users/client/requests"; +export * from "./accessGroups/client/requests"; +export * from "./products/client/requests"; +export * from "./orders/client/requests"; +export * from "./inventory/client/requests"; diff --git a/src/api/resources/inventory/client/Client.ts b/src/api/resources/inventory/client/Client.ts new file mode 100644 index 00000000..c71baf46 --- /dev/null +++ b/src/api/resources/inventory/client/Client.ts @@ -0,0 +1,206 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace Inventory { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Inventory { + constructor(protected readonly _options: Inventory.Options) {} + + /** + * List the current inventory levels for a particular SKU item. + * + * Required scope | `ecommerce:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.inventory.list("collection-id", "item-id") + */ + public async list( + collectionId: string, + itemId: string, + requestOptions?: Inventory.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/items/${itemId}/inventory` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.InventoryItem.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates the current inventory levels for a particular SKU item. Updates may be given in one or two methods, absolutely or incrementally. Absolute updates are done by setting `quantity` directly. Incremental updates are by specifying the inventory delta in `updateQuantity` which is then added to the `quantity` stored on the server. + * + * Required scope | `ecommerce:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.inventory.update("collection-id", "item-id", { + * inventoryType: Webflow.InventoryUpdateRequestInventoryType.Infinite, + * updateQuantity: 1, + * quantity: 100 + * }) + */ + public async update( + collectionId: string, + itemId: string, + request: Webflow.InventoryUpdateRequest, + requestOptions?: Inventory.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `collections/${collectionId}/items/${itemId}/inventory` + ), + method: "PATCH", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.InventoryUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.InventoryItem.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/inventory/client/index.ts b/src/api/resources/inventory/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/inventory/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/inventory/client/requests/InventoryUpdateRequest.ts b/src/api/resources/inventory/client/requests/InventoryUpdateRequest.ts new file mode 100644 index 00000000..b466d5ec --- /dev/null +++ b/src/api/resources/inventory/client/requests/InventoryUpdateRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../.."; + +/** + * @example + * { + * inventoryType: Webflow.InventoryUpdateRequestInventoryType.Infinite, + * updateQuantity: 1, + * quantity: 100 + * } + */ +export interface InventoryUpdateRequest { + /** infinite or finite */ + inventoryType: Webflow.InventoryUpdateRequestInventoryType; + /** Adds this quantity to currently store quantity. Can be negative. */ + updateQuantity?: number; + /** Immediately sets quantity to this value. */ + quantity?: number; +} diff --git a/src/api/resources/inventory/client/requests/index.ts b/src/api/resources/inventory/client/requests/index.ts new file mode 100644 index 00000000..db74c38a --- /dev/null +++ b/src/api/resources/inventory/client/requests/index.ts @@ -0,0 +1 @@ +export { InventoryUpdateRequest } from "./InventoryUpdateRequest"; diff --git a/src/api/resources/inventory/index.ts b/src/api/resources/inventory/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/inventory/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/inventory/types/InventoryUpdateRequestInventoryType.ts b/src/api/resources/inventory/types/InventoryUpdateRequestInventoryType.ts new file mode 100644 index 00000000..ebe1ced2 --- /dev/null +++ b/src/api/resources/inventory/types/InventoryUpdateRequestInventoryType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * infinite or finite + */ +export type InventoryUpdateRequestInventoryType = "infinite" | "finite"; + +export const InventoryUpdateRequestInventoryType = { + Infinite: "infinite", + Finite: "finite", +} as const; diff --git a/src/api/resources/inventory/types/index.ts b/src/api/resources/inventory/types/index.ts new file mode 100644 index 00000000..2e2a1559 --- /dev/null +++ b/src/api/resources/inventory/types/index.ts @@ -0,0 +1 @@ +export * from "./InventoryUpdateRequestInventoryType"; diff --git a/src/api/resources/orders/client/Client.ts b/src/api/resources/orders/client/Client.ts new file mode 100644 index 00000000..e0fb493b --- /dev/null +++ b/src/api/resources/orders/client/Client.ts @@ -0,0 +1,569 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace Orders { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Orders { + constructor(protected readonly _options: Orders.Options) {} + + /** + * List all orders created for a given site. + * + * Required scope | `ecommerce:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.orders.list("site-id", { + * status: Webflow.OrdersListRequestStatus.Pending + * }) + */ + public async list( + siteId: string, + request: Webflow.OrdersListRequest = {}, + requestOptions?: Orders.RequestOptions + ): Promise { + const { status, offset, limit } = request; + const _queryParams: Record = {}; + if (status != null) { + _queryParams["status"] = status; + } + + if (offset != null) { + _queryParams["offset"] = offset.toString(); + } + + if (limit != null) { + _queryParams["limit"] = limit.toString(); + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/orders` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.OrderList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieve a single product by its id. All of its SKUs will also be retrieved. + * + * Required scope | `ecommerce:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.orders.get("site-id", "order-id") + */ + public async get(siteId: string, orderId: string, requestOptions?: Orders.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/orders/${orderId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Order.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This API lets you update the fields, `comment`, `shippingProvider`, and/or `shippingTracking` for a given order. All three fields can be updated simultaneously or independently. + * + * Required scope | `ecommerce:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.orders.update("site-id", "order-id", { + * comment: "Example comment to myself", + * shippingProvider: "Shipping Company, Co.", + * shippingTracking: "tr00000000001", + * shippingTrackingUrl: "https://www.shippingcompany.com/tracking/tr00000000001" + * }) + */ + public async update( + siteId: string, + orderId: string, + request: Webflow.OrdersUpdateRequest = {}, + requestOptions?: Orders.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/orders/${orderId}` + ), + method: "PATCH", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.OrdersUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Order.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates an order's status to fulfilled + * + * Required scope | `ecommerce:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.orders.updateFulfill("site-id", "order-id", {}) + */ + public async updateFulfill( + siteId: string, + orderId: string, + request: Webflow.OrdersUpdateFulfillRequest = {}, + requestOptions?: Orders.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/orders/${orderId}/fulfill` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.OrdersUpdateFulfillRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Order.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates an order's status to unfulfilled + * + * Required scope | `ecommerce:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.orders.updateUnfulfill("site-id", "order-id") + */ + public async updateUnfulfill( + siteId: string, + orderId: string, + requestOptions?: Orders.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/orders/${orderId}/unfulfill` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Order.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This API will reverse a Stripe charge and refund an order back to a + * customer. It will also set the order's status to `refunded`. + * + * Required scope | `ecommerce:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.orders.refund("site-id", "order-id", { + * reason: Webflow.OrdersRefundRequestReason.Duplicate + * }) + */ + public async refund( + siteId: string, + orderId: string, + request: Webflow.OrdersRefundRequest = {}, + requestOptions?: Orders.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/orders/${orderId}/refund` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.OrdersRefundRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Order.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/orders/client/index.ts b/src/api/resources/orders/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/orders/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/orders/client/requests/OrdersListRequest.ts b/src/api/resources/orders/client/requests/OrdersListRequest.ts new file mode 100644 index 00000000..8ed2eefd --- /dev/null +++ b/src/api/resources/orders/client/requests/OrdersListRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../.."; + +/** + * @example + * { + * status: Webflow.OrdersListRequestStatus.Pending + * } + */ +export interface OrdersListRequest { + /** + * Filter the orders by status + */ + status?: Webflow.OrdersListRequestStatus; + /** + * Offset used for pagination if the results have more than limit records + */ + offset?: number; + /** + * Maximum number of records to be returned (max limit: 100) + */ + limit?: number; +} diff --git a/src/api/resources/orders/client/requests/OrdersRefundRequest.ts b/src/api/resources/orders/client/requests/OrdersRefundRequest.ts new file mode 100644 index 00000000..6e417ba8 --- /dev/null +++ b/src/api/resources/orders/client/requests/OrdersRefundRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../.."; + +/** + * @example + * { + * reason: Webflow.OrdersRefundRequestReason.Duplicate + * } + */ +export interface OrdersRefundRequest { + /** The reason for the refund */ + reason?: Webflow.OrdersRefundRequestReason; +} diff --git a/src/api/resources/orders/client/requests/OrdersUpdateFulfillRequest.ts b/src/api/resources/orders/client/requests/OrdersUpdateFulfillRequest.ts new file mode 100644 index 00000000..45c67a6f --- /dev/null +++ b/src/api/resources/orders/client/requests/OrdersUpdateFulfillRequest.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface OrdersUpdateFulfillRequest { + /** Whether or not the Order Fulfilled email should be sent */ + sendOrderFulfilledEmail?: boolean; +} diff --git a/src/api/resources/orders/client/requests/OrdersUpdateRequest.ts b/src/api/resources/orders/client/requests/OrdersUpdateRequest.ts new file mode 100644 index 00000000..93592346 --- /dev/null +++ b/src/api/resources/orders/client/requests/OrdersUpdateRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * comment: "Example comment to myself", + * shippingProvider: "Shipping Company, Co.", + * shippingTracking: "tr00000000001", + * shippingTrackingUrl: "https://www.shippingcompany.com/tracking/tr00000000001" + * } + */ +export interface OrdersUpdateRequest { + /** Arbitrary data for your records */ + comment?: string; + /** Company or method used to ship order */ + shippingProvider?: string; + /** Tracking number for order shipment */ + shippingTracking?: string; + /** URL to track order shipment */ + shippingTrackingUrl?: string; +} diff --git a/src/api/resources/orders/client/requests/index.ts b/src/api/resources/orders/client/requests/index.ts new file mode 100644 index 00000000..231ec900 --- /dev/null +++ b/src/api/resources/orders/client/requests/index.ts @@ -0,0 +1,4 @@ +export { OrdersListRequest } from "./OrdersListRequest"; +export { OrdersUpdateRequest } from "./OrdersUpdateRequest"; +export { OrdersUpdateFulfillRequest } from "./OrdersUpdateFulfillRequest"; +export { OrdersRefundRequest } from "./OrdersRefundRequest"; diff --git a/src/api/resources/orders/index.ts b/src/api/resources/orders/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/orders/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/orders/types/OrdersListRequestStatus.ts b/src/api/resources/orders/types/OrdersListRequestStatus.ts new file mode 100644 index 00000000..fd41c99d --- /dev/null +++ b/src/api/resources/orders/types/OrdersListRequestStatus.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type OrdersListRequestStatus = + | "pending" + | "refunded" + | "dispute-lost" + | "fulfilled" + | "disputed" + | "unfulfilled"; + +export const OrdersListRequestStatus = { + Pending: "pending", + Refunded: "refunded", + DisputeLost: "dispute-lost", + Fulfilled: "fulfilled", + Disputed: "disputed", + Unfulfilled: "unfulfilled", +} as const; diff --git a/src/api/resources/orders/types/OrdersRefundRequestReason.ts b/src/api/resources/orders/types/OrdersRefundRequestReason.ts new file mode 100644 index 00000000..ddf92f04 --- /dev/null +++ b/src/api/resources/orders/types/OrdersRefundRequestReason.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The reason for the refund + */ +export type OrdersRefundRequestReason = "duplicate" | "fraudulent" | "requested"; + +export const OrdersRefundRequestReason = { + Duplicate: "duplicate", + Fraudulent: "fraudulent", + Requested: "requested", +} as const; diff --git a/src/api/resources/orders/types/index.ts b/src/api/resources/orders/types/index.ts new file mode 100644 index 00000000..59a55534 --- /dev/null +++ b/src/api/resources/orders/types/index.ts @@ -0,0 +1,2 @@ +export * from "./OrdersListRequestStatus"; +export * from "./OrdersRefundRequestReason"; diff --git a/src/api/resources/pages/client/Client.ts b/src/api/resources/pages/client/Client.ts new file mode 100644 index 00000000..34f31bfc --- /dev/null +++ b/src/api/resources/pages/client/Client.ts @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; +import { Scripts } from "../resources/scripts/client/Client"; + +export declare namespace Pages { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Pages { + constructor(protected readonly _options: Pages.Options) {} + + /** + * List of all pages for a site

Required scope | `pages:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.pages.list("site-id") + */ + public async list(siteId: string, requestOptions?: Pages.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/pages` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.PageList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get metadata information for a single page

Required scope | `pages:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.pages.getMetadata("page-id") + */ + public async getMetadata(pageId: string, requestOptions?: Pages.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `pages/${pageId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Page.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected _scripts: Scripts | undefined; + + public get scripts(): Scripts { + return (this._scripts ??= new Scripts(this._options)); + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/pages/client/index.ts b/src/api/resources/pages/client/index.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/src/api/resources/pages/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/pages/index.ts b/src/api/resources/pages/index.ts new file mode 100644 index 00000000..33a87f10 --- /dev/null +++ b/src/api/resources/pages/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/pages/resources/index.ts b/src/api/resources/pages/resources/index.ts new file mode 100644 index 00000000..a09a64ce --- /dev/null +++ b/src/api/resources/pages/resources/index.ts @@ -0,0 +1 @@ +export * as scripts from "./scripts"; diff --git a/src/api/resources/pages/resources/scripts/client/Client.ts b/src/api/resources/pages/resources/scripts/client/Client.ts new file mode 100644 index 00000000..b1b0d885 --- /dev/null +++ b/src/api/resources/pages/resources/scripts/client/Client.ts @@ -0,0 +1,251 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Webflow from "../../../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization"; +import * as errors from "../../../../../../errors"; + +export declare namespace Scripts { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Scripts { + constructor(protected readonly _options: Scripts.Options) {} + + /** + * Get all registered scripts that have been applied to a specific Page.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.

Required scope | `custom_code:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.pages.scripts.getCustomCode("page-id") + */ + public async getCustomCode( + pageId: string, + requestOptions?: Scripts.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `pages/${pageId}/custom_code` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.ScriptApplyList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Add a registered script to a Page.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.

Required scope | `custom_code:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.pages.scripts.upsertCustomCode("page-id", {}) + */ + public async upsertCustomCode( + pageId: string, + request: Webflow.ScriptApplyList, + requestOptions?: Scripts.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `pages/${pageId}/custom_code` + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.ScriptApplyList.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.ScriptApplyList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete the custom code block that an app has created for a page

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.

Required scope | `custom_code:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.pages.scripts.deleteCustomCode("page-id") + */ + public async deleteCustomCode(pageId: string, requestOptions?: Scripts.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `pages/${pageId}/custom_code` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/pages/resources/scripts/client/index.ts b/src/api/resources/pages/resources/scripts/client/index.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/src/api/resources/pages/resources/scripts/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/pages/resources/scripts/index.ts b/src/api/resources/pages/resources/scripts/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/pages/resources/scripts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/products/client/Client.ts b/src/api/resources/products/client/Client.ts new file mode 100644 index 00000000..24fd24ad --- /dev/null +++ b/src/api/resources/products/client/Client.ts @@ -0,0 +1,663 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace Products { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Products { + constructor(protected readonly _options: Products.Options) {} + + /** + * Retrieve all products for a site. Use `limit` and `offset` to page through all products with subsequent requests. All SKUs for each product will also be fetched and returned. The `limit`, `offset` and `total` values represent Products only and do not include any SKUs. + * + * Required scope | `ecommerce:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.products.list("site-id", {}) + */ + public async list( + siteId: string, + request: Webflow.ProductsListRequest = {}, + requestOptions?: Products.RequestOptions + ): Promise { + const { offset, limit } = request; + const _queryParams: Record = {}; + if (offset != null) { + _queryParams["offset"] = offset.toString(); + } + + if (limit != null) { + _queryParams["limit"] = limit.toString(); + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/products` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.ProductAndSkUsList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Adding a new Product involves creating both a Product Item and a SKU Item, since a Product Item has to have, at minimum, a SKU Item. + * + * To create a new Product with multiple SKUs, you must: + * + * - Create the Product and Default SKU using this endpoint, making sure to add `sku-properties` in the product data. + * - You can't add `sku-values` to the SKU yet, since there are no enum IDs created yet. When this endpoint returns, it will have IDs filled in for the `sku-properties` enums. + * - With those IDs, update the default SKU with valid `sku-values` and create any additional SKUs (if needed), with valid `sku-values`. + * - You can also create the Product without `sku-properties` and add them in later. + * - If you add any `sku` properties, the default SKU will default to the first value of each option. + * + * Upon creation, the default product type will be `Advanced`. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + * + * Required scope | `ecommerce:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.products.create("site-id", { + * publishStatus: Webflow.PublishStatus.Staging, + * product: { + * id: "580e63fc8c9a982ac9b8b745", + * lastPublished: new Date("2023-03-17T18:47:35.560Z"), + * lastUpdated: new Date("2023-03-17T18:47:35.560Z"), + * createdOn: new Date("2023-03-17T18:47:35.560Z"), + * isArchived: false, + * isDraft: false, + * fieldData: { + * name: "My new item", + * slug: "my-new-item", + * skuProperties: [{ + * id: "ff42fee0113744f693a764e3431a9cc2", + * name: "Color", + * enum: [{ + * id: "64a74715c456e36762fc39a1", + * name: "Royal Blue", + * slug: "royal-blue" + * }] + * }] + * } + * }, + * sku: { + * id: "580e63fc8c9a982ac9b8b745", + * lastPublished: new Date("2023-03-17T18:47:35.560Z"), + * lastUpdated: new Date("2023-03-17T18:47:35.560Z"), + * createdOn: new Date("2023-03-17T18:47:35.560Z"), + * fieldData: { + * name: "My new item", + * slug: "my-new-item", + * price: { + * value: 100, + * unit: "USD" + * } + * } + * } + * }) + */ + public async create( + siteId: string, + request: Webflow.ProductsCreateRequest, + requestOptions?: Products.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/products` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.ProductsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.ProductAndSkUs.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieve a single product by its id. All of its SKUs will also be retrieved. + * + * Required scope | `ecommerce:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.products.get("site-id", "product-id") + */ + public async get( + siteId: string, + productId: string, + requestOptions?: Products.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/products/${productId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.ProductAndSkUs.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updating an existing Product will set the product type to `Advanced`. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + * + * Required scope | `ecommerce:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.products.update("site-id", "product-id", { + * publishStatus: Webflow.PublishStatus.Staging, + * product: { + * id: "580e63fc8c9a982ac9b8b745", + * lastPublished: new Date("2023-03-17T18:47:35.560Z"), + * lastUpdated: new Date("2023-03-17T18:47:35.560Z"), + * createdOn: new Date("2023-03-17T18:47:35.560Z"), + * isArchived: false, + * isDraft: false, + * fieldData: { + * name: "My new item", + * slug: "my-new-item", + * skuProperties: [{ + * id: "ff42fee0113744f693a764e3431a9cc2", + * name: "Color", + * enum: [{ + * id: "64a74715c456e36762fc39a1", + * name: "Royal Blue", + * slug: "royal-blue" + * }] + * }] + * } + * } + * }) + */ + public async update( + siteId: string, + productId: string, + request: Webflow.ProductsUpdateRequest, + requestOptions?: Products.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/products/${productId}` + ), + method: "PATCH", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.ProductsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Product.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create additional SKUs to cover every variant of your Product. The Default SKU already counts as one of the variants. + * + * Creating additional SKUs will set the product type to `Advanced` for the product associated with the SKUs. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + * + * Required scope | `ecommerce:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.products.createSku("site-id", "product-id", { + * publishStatus: Webflow.PublishStatus.Staging, + * skus: [{ + * id: "580e63fc8c9a982ac9b8b745", + * lastPublished: new Date("2023-03-17T18:47:35.560Z"), + * lastUpdated: new Date("2023-03-17T18:47:35.560Z"), + * createdOn: new Date("2023-03-17T18:47:35.560Z"), + * fieldData: { + * name: "My new item", + * slug: "my-new-item", + * price: { + * value: 100, + * unit: "USD" + * } + * } + * }] + * }) + */ + public async createSku( + siteId: string, + productId: string, + request: Webflow.ProductsCreateSkuRequest, + requestOptions?: Products.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/products/${productId}/skus` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.ProductsCreateSkuRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.ProductsCreateSkuResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updating an existing SKU will set the product type to `Advanced` for the product associated with the SKU. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + * + * Required scope | `ecommerce:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.products.updateSku("site-id", "product-id", "sku-id", { + * publishStatus: Webflow.PublishStatus.Staging, + * sku: { + * id: "580e63fc8c9a982ac9b8b745", + * lastPublished: new Date("2023-03-17T18:47:35.560Z"), + * lastUpdated: new Date("2023-03-17T18:47:35.560Z"), + * createdOn: new Date("2023-03-17T18:47:35.560Z"), + * fieldData: { + * name: "My new item", + * slug: "my-new-item", + * price: { + * value: 100, + * unit: "USD" + * } + * } + * } + * }) + */ + public async updateSku( + siteId: string, + productId: string, + skuId: string, + request: Webflow.ProductsUpdateSkuRequest, + requestOptions?: Products.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/products/${productId}/skus/${skuId}` + ), + method: "PATCH", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.ProductsUpdateSkuRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Sku.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/products/client/index.ts b/src/api/resources/products/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/products/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/products/client/requests/ProductsCreateRequest.ts b/src/api/resources/products/client/requests/ProductsCreateRequest.ts new file mode 100644 index 00000000..2d44852c --- /dev/null +++ b/src/api/resources/products/client/requests/ProductsCreateRequest.ts @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../.."; + +/** + * @example + * { + * publishStatus: Webflow.PublishStatus.Staging, + * product: { + * id: "580e63fc8c9a982ac9b8b745", + * lastPublished: new Date("2023-03-17T18:47:35.560Z"), + * lastUpdated: new Date("2023-03-17T18:47:35.560Z"), + * createdOn: new Date("2023-03-17T18:47:35.560Z"), + * isArchived: false, + * isDraft: false, + * fieldData: { + * name: "My new item", + * slug: "my-new-item", + * skuProperties: [{ + * id: "ff42fee0113744f693a764e3431a9cc2", + * name: "Color", + * enum: [{ + * id: "64a74715c456e36762fc39a1", + * name: "Royal Blue", + * slug: "royal-blue" + * }] + * }] + * } + * }, + * sku: { + * id: "580e63fc8c9a982ac9b8b745", + * lastPublished: new Date("2023-03-17T18:47:35.560Z"), + * lastUpdated: new Date("2023-03-17T18:47:35.560Z"), + * createdOn: new Date("2023-03-17T18:47:35.560Z"), + * fieldData: { + * name: "My new item", + * slug: "my-new-item", + * price: { + * value: 100, + * unit: "USD" + * } + * } + * } + * } + */ +export interface ProductsCreateRequest { + publishStatus?: Webflow.PublishStatus; + product: Webflow.Product; + sku: Webflow.Sku; +} diff --git a/src/api/resources/products/client/requests/ProductsCreateSkuRequest.ts b/src/api/resources/products/client/requests/ProductsCreateSkuRequest.ts new file mode 100644 index 00000000..6fd49023 --- /dev/null +++ b/src/api/resources/products/client/requests/ProductsCreateSkuRequest.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../.."; + +/** + * @example + * { + * publishStatus: Webflow.PublishStatus.Staging, + * skus: [{ + * id: "580e63fc8c9a982ac9b8b745", + * lastPublished: new Date("2023-03-17T18:47:35.560Z"), + * lastUpdated: new Date("2023-03-17T18:47:35.560Z"), + * createdOn: new Date("2023-03-17T18:47:35.560Z"), + * fieldData: { + * name: "My new item", + * slug: "my-new-item", + * price: { + * value: 100, + * unit: "USD" + * } + * } + * }] + * } + */ +export interface ProductsCreateSkuRequest { + publishStatus?: Webflow.PublishStatus; + /** An array of the SKU data your are adding */ + skus: Webflow.Sku[]; +} diff --git a/src/api/resources/products/client/requests/ProductsListRequest.ts b/src/api/resources/products/client/requests/ProductsListRequest.ts new file mode 100644 index 00000000..f29738c4 --- /dev/null +++ b/src/api/resources/products/client/requests/ProductsListRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface ProductsListRequest { + /** + * Offset used for pagination if the results have more than limit records + */ + offset?: number; + /** + * Maximum number of records to be returned (max limit: 100) + */ + limit?: number; +} diff --git a/src/api/resources/products/client/requests/ProductsUpdateRequest.ts b/src/api/resources/products/client/requests/ProductsUpdateRequest.ts new file mode 100644 index 00000000..aa405ddc --- /dev/null +++ b/src/api/resources/products/client/requests/ProductsUpdateRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../.."; + +/** + * @example + * { + * publishStatus: Webflow.PublishStatus.Staging, + * product: { + * id: "580e63fc8c9a982ac9b8b745", + * lastPublished: new Date("2023-03-17T18:47:35.560Z"), + * lastUpdated: new Date("2023-03-17T18:47:35.560Z"), + * createdOn: new Date("2023-03-17T18:47:35.560Z"), + * isArchived: false, + * isDraft: false, + * fieldData: { + * name: "My new item", + * slug: "my-new-item", + * skuProperties: [{ + * id: "ff42fee0113744f693a764e3431a9cc2", + * name: "Color", + * enum: [{ + * id: "64a74715c456e36762fc39a1", + * name: "Royal Blue", + * slug: "royal-blue" + * }] + * }] + * } + * } + * } + */ +export interface ProductsUpdateRequest { + publishStatus?: Webflow.PublishStatus; + product: Webflow.Product; +} diff --git a/src/api/resources/products/client/requests/ProductsUpdateSkuRequest.ts b/src/api/resources/products/client/requests/ProductsUpdateSkuRequest.ts new file mode 100644 index 00000000..dd1b0240 --- /dev/null +++ b/src/api/resources/products/client/requests/ProductsUpdateSkuRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../.."; + +/** + * @example + * { + * publishStatus: Webflow.PublishStatus.Staging, + * sku: { + * id: "580e63fc8c9a982ac9b8b745", + * lastPublished: new Date("2023-03-17T18:47:35.560Z"), + * lastUpdated: new Date("2023-03-17T18:47:35.560Z"), + * createdOn: new Date("2023-03-17T18:47:35.560Z"), + * fieldData: { + * name: "My new item", + * slug: "my-new-item", + * price: { + * value: 100, + * unit: "USD" + * } + * } + * } + * } + */ +export interface ProductsUpdateSkuRequest { + publishStatus?: Webflow.PublishStatus; + sku: Webflow.Sku; +} diff --git a/src/api/resources/products/client/requests/index.ts b/src/api/resources/products/client/requests/index.ts new file mode 100644 index 00000000..6d9f8757 --- /dev/null +++ b/src/api/resources/products/client/requests/index.ts @@ -0,0 +1,5 @@ +export { ProductsListRequest } from "./ProductsListRequest"; +export { ProductsCreateRequest } from "./ProductsCreateRequest"; +export { ProductsUpdateRequest } from "./ProductsUpdateRequest"; +export { ProductsCreateSkuRequest } from "./ProductsCreateSkuRequest"; +export { ProductsUpdateSkuRequest } from "./ProductsUpdateSkuRequest"; diff --git a/src/api/resources/products/index.ts b/src/api/resources/products/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/products/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/products/types/ProductsCreateSkuResponse.ts b/src/api/resources/products/types/ProductsCreateSkuResponse.ts new file mode 100644 index 00000000..8c87dde2 --- /dev/null +++ b/src/api/resources/products/types/ProductsCreateSkuResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../.."; + +export interface ProductsCreateSkuResponse { + skus?: Webflow.Sku[]; +} diff --git a/src/api/resources/products/types/index.ts b/src/api/resources/products/types/index.ts new file mode 100644 index 00000000..e286df49 --- /dev/null +++ b/src/api/resources/products/types/index.ts @@ -0,0 +1 @@ +export * from "./ProductsCreateSkuResponse"; diff --git a/src/api/resources/scripts/client/Client.ts b/src/api/resources/scripts/client/Client.ts new file mode 100644 index 00000000..53937cce --- /dev/null +++ b/src/api/resources/scripts/client/Client.ts @@ -0,0 +1,253 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace Scripts { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Scripts { + constructor(protected readonly _options: Scripts.Options) {} + + /** + * List of scripts registered to a Site.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints. Additionally, Scripts can be remotely hosted, or registered as inline snippets.

Required scope | `custom_code:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.scripts.list("site-id") + */ + public async list(siteId: string, requestOptions?: Scripts.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/registered_scripts` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.RegisteredScriptList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Add a script to a Site's Custom Code registry.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints. Additionally, Scripts can be remotely hosted, or registered as inline snippets.

Required scope | `custom_code:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + */ + public async registerHosted( + siteId: string, + request: Webflow.CustomCodeHostedRequest, + requestOptions?: Scripts.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/registered_scripts/hosted` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.CustomCodeHostedRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.CustomCodeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Add a script to a Site's Custom Code registry. Inline scripts can be between 1 and 2000 characters.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.

Required scope | `custom_code:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + */ + public async registerInline( + siteId: string, + request: Webflow.CustomCodeInlineRequest, + requestOptions?: Scripts.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/registered_scripts/inline` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.CustomCodeInlineRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.CustomCodeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/scripts/client/index.ts b/src/api/resources/scripts/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/scripts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/scripts/client/requests/CustomCodeHostedRequest.ts b/src/api/resources/scripts/client/requests/CustomCodeHostedRequest.ts new file mode 100644 index 00000000..441823cd --- /dev/null +++ b/src/api/resources/scripts/client/requests/CustomCodeHostedRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CustomCodeHostedRequest { + /** URI for an externally hosted script location */ + hostedLocation: string; + /** Sub-Resource Integrity Hash */ + integrityHash: string; + /** Define whether the script can be copied on site duplication and transfer */ + canCopy?: boolean; + /** A Semantic Version (SemVer) string, denoting the version of the script */ + version: string; + /** User-facing name for the script */ + displayName: string; +} diff --git a/src/api/resources/scripts/client/requests/CustomCodeInlineRequest.ts b/src/api/resources/scripts/client/requests/CustomCodeInlineRequest.ts new file mode 100644 index 00000000..6f78bc08 --- /dev/null +++ b/src/api/resources/scripts/client/requests/CustomCodeInlineRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CustomCodeInlineRequest { + /** The code to be added to the site (to be hosted by Webflow). */ + sourceCode: string; + /** Sub-Resource Integrity Hash. Only required for externally hosted scripts (passed via hostedLocation) */ + integrityHash?: string; + /** Define whether the script can be copied on site duplication and transfer */ + canCopy?: boolean; + /** A Semantic Version (SemVer) string, denoting the version of the script */ + version: string; + /** User-facing name for the script */ + displayName: string; +} diff --git a/src/api/resources/scripts/client/requests/index.ts b/src/api/resources/scripts/client/requests/index.ts new file mode 100644 index 00000000..5990c996 --- /dev/null +++ b/src/api/resources/scripts/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CustomCodeHostedRequest } from "./CustomCodeHostedRequest"; +export { CustomCodeInlineRequest } from "./CustomCodeInlineRequest"; diff --git a/src/api/resources/scripts/index.ts b/src/api/resources/scripts/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/scripts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/sites/client/Client.ts b/src/api/resources/sites/client/Client.ts new file mode 100644 index 00000000..2d1e3251 --- /dev/null +++ b/src/api/resources/sites/client/Client.ts @@ -0,0 +1,330 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; +import { Scripts } from "../resources/scripts/client/Client"; + +export declare namespace Sites { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Sites { + constructor(protected readonly _options: Sites.Options) {} + + /** + * List of all sites the provided access token is able to access.

Required scope | `sites:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.sites.list() + */ + public async list(requestOptions?: Sites.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + "sites" + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Sites.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a site by site id

Required scope | `sites:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.sites.get("site-id") + */ + public async get(siteId: string, requestOptions?: Sites.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Site.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a list of all custom domains related to site.

Required scope | `sites:read` + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.sites.getCustomDomain("site-id") + */ + public async getCustomDomain(siteId: string, requestOptions?: Sites.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/custom_domains` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Domain.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Publish a site to one more more domains.

Required scope | `sites:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * + * @example + * await webflow.sites.publish("site-id", { + * publishToWebflowSubdomain: false + * }) + */ + public async publish( + siteId: string, + request: Webflow.SitesPublishRequest = {}, + requestOptions?: Sites.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/publish` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.SitesPublishRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected _scripts: Scripts | undefined; + + public get scripts(): Scripts { + return (this._scripts ??= new Scripts(this._options)); + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/sites/client/index.ts b/src/api/resources/sites/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/sites/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/sites/client/requests/SitesPublishRequest.ts b/src/api/resources/sites/client/requests/SitesPublishRequest.ts new file mode 100644 index 00000000..a6aea5c2 --- /dev/null +++ b/src/api/resources/sites/client/requests/SitesPublishRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * publishToWebflowSubdomain: false + * } + */ +export interface SitesPublishRequest { + /** Array of Custom Domain ids to publish */ + customDomains?: string[]; + /** Choice of whether to publish to the default Webflow Subdomain */ + publishToWebflowSubdomain?: boolean; +} diff --git a/src/api/resources/sites/client/requests/index.ts b/src/api/resources/sites/client/requests/index.ts new file mode 100644 index 00000000..dddc2657 --- /dev/null +++ b/src/api/resources/sites/client/requests/index.ts @@ -0,0 +1 @@ +export { SitesPublishRequest } from "./SitesPublishRequest"; diff --git a/src/api/resources/sites/index.ts b/src/api/resources/sites/index.ts new file mode 100644 index 00000000..33a87f10 --- /dev/null +++ b/src/api/resources/sites/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/sites/resources/index.ts b/src/api/resources/sites/resources/index.ts new file mode 100644 index 00000000..da4c0814 --- /dev/null +++ b/src/api/resources/sites/resources/index.ts @@ -0,0 +1,2 @@ +export * as scripts from "./scripts"; +export * from "./scripts/client/requests"; diff --git a/src/api/resources/sites/resources/scripts/client/Client.ts b/src/api/resources/sites/resources/scripts/client/Client.ts new file mode 100644 index 00000000..da8d28bc --- /dev/null +++ b/src/api/resources/sites/resources/scripts/client/Client.ts @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Webflow from "../../../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization"; +import * as errors from "../../../../../../errors"; + +export declare namespace Scripts { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Scripts { + constructor(protected readonly _options: Scripts.Options) {} + + /** + * Get all registered scripts that have been applied to a specific Site. Required scope | `custom_code:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.sites.scripts.getCustomCode("site-id") + */ + public async getCustomCode( + siteId: string, + requestOptions?: Scripts.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/custom_code` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.ScriptApplyList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Add a registered script to a Site.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.

Required scope | `custom_code:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.sites.scripts.upsertCustomCode("site-id", {}) + */ + public async upsertCustomCode( + siteId: string, + request: Webflow.ScriptApplyList, + requestOptions?: Scripts.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/custom_code` + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.ScriptApplyList.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.ScriptApplyList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete the custom code block that an app created for a Site + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.sites.scripts.deleteCustomCode("site-id") + */ + public async deleteCustomCode(siteId: string, requestOptions?: Scripts.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/custom_code` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get all instances of Custom Code applied to a Site or Pages. Required scope | `custom_code:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.sites.scripts.listCustomCodeBlocks("site-id", {}) + */ + public async listCustomCodeBlocks( + siteId: string, + request: Webflow.sites.ScriptsListCustomCodeBlocksRequest = {}, + requestOptions?: Scripts.RequestOptions + ): Promise { + const { offset, limit } = request; + const _queryParams: Record = {}; + if (offset != null) { + _queryParams["offset"] = offset.toString(); + } + + if (limit != null) { + _queryParams["limit"] = limit.toString(); + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/custom_code/blocks` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.ListCustomCodeBlocks.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/sites/resources/scripts/client/index.ts b/src/api/resources/sites/resources/scripts/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/sites/resources/scripts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/sites/resources/scripts/client/requests/ScriptsListCustomCodeBlocksRequest.ts b/src/api/resources/sites/resources/scripts/client/requests/ScriptsListCustomCodeBlocksRequest.ts new file mode 100644 index 00000000..696f9805 --- /dev/null +++ b/src/api/resources/sites/resources/scripts/client/requests/ScriptsListCustomCodeBlocksRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface ScriptsListCustomCodeBlocksRequest { + /** + * Offset used for pagination if the results have more than limit records + */ + offset?: number; + /** + * Maximum number of records to be returned (max limit: 100) + */ + limit?: number; +} diff --git a/src/api/resources/sites/resources/scripts/client/requests/index.ts b/src/api/resources/sites/resources/scripts/client/requests/index.ts new file mode 100644 index 00000000..e87ec77a --- /dev/null +++ b/src/api/resources/sites/resources/scripts/client/requests/index.ts @@ -0,0 +1 @@ +export { ScriptsListCustomCodeBlocksRequest } from "./ScriptsListCustomCodeBlocksRequest"; diff --git a/src/api/resources/sites/resources/scripts/index.ts b/src/api/resources/sites/resources/scripts/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/sites/resources/scripts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/token/client/Client.ts b/src/api/resources/token/client/Client.ts new file mode 100644 index 00000000..911595f0 --- /dev/null +++ b/src/api/resources/token/client/Client.ts @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace Token { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Token { + constructor(protected readonly _options: Token.Options) {} + + /** + * Information about the Authorized User

Required Scope | `authorized_user:read` + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * + * @example + * await webflow.token.authorizedBy() + */ + public async authorizedBy(requestOptions?: Token.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + "token/authorized_by" + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.AuthorizedUser.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Information about the authorization token + * @throws {@link Webflow.UnauthorizedError} + * + * @example + * await webflow.token.introspect() + */ + public async introspect(requestOptions?: Token.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + "token/introspect" + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Authorization.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/token/client/index.ts b/src/api/resources/token/client/index.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/src/api/resources/token/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/token/index.ts b/src/api/resources/token/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/token/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/users/client/Client.ts b/src/api/resources/users/client/Client.ts new file mode 100644 index 00000000..2d60cb12 --- /dev/null +++ b/src/api/resources/users/client/Client.ts @@ -0,0 +1,453 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace Users { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Users { + constructor(protected readonly _options: Users.Options) {} + + /** + * Get a list of users for a site

Required scope | `users:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.users.list("site-id", { + * sort: Webflow.UsersListRequestSort.CreatedOnAscending + * }) + */ + public async list( + siteId: string, + request: Webflow.UsersListRequest = {}, + requestOptions?: Users.RequestOptions + ): Promise { + const { offset, limit, sort } = request; + const _queryParams: Record = {}; + if (offset != null) { + _queryParams["offset"] = offset.toString(); + } + + if (limit != null) { + _queryParams["limit"] = limit.toString(); + } + + if (sort != null) { + _queryParams["sort"] = sort; + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/users` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.UserList.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a User by ID

Required scope | `users:read` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.users.get("site-id", "user-id") + */ + public async get(siteId: string, userId: string, requestOptions?: Users.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/users/${userId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.User.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete a User by ID

Required scope | `users:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.users.delete("site-id", "user-id") + */ + public async delete(siteId: string, userId: string, requestOptions?: Users.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/users/${userId}` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update a User by ID

Required scope | `users:write` + * + * + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.users.update("site-id", "user-id", { + * id: "6287ec36a841b25637c663df", + * lastUpdated: new Date("2016-10-24T19:41:29.156Z"), + * invitedOn: new Date("2016-10-24T19:41:29.156Z"), + * createdOn: new Date("2016-10-24T19:41:29.156Z"), + * lastLogin: new Date("2016-10-24T19:41:29.156Z"), + * status: Webflow.UserStatus.Invited, + * accessGroups: [{ + * type: Webflow.UserAccessGroupsItemType.Admin + * }] + * }) + */ + public async update( + siteId: string, + userId: string, + request: Webflow.User, + requestOptions?: Users.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/users/${userId}` + ), + method: "PATCH", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.User.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.User.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create and invite a user with an email address. The user will be sent and invite via email, which they will need to accept in order to join paid Access Groups.

Required scope | `users:write` + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.ForbiddenError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.ConflictError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.users.invite("site-id", { + * email: "some.one@home.com" + * }) + */ + public async invite( + siteId: string, + request: Webflow.UsersInviteRequest, + requestOptions?: Users.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/users/invite` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.UsersInviteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.User.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 403: + throw new Webflow.ForbiddenError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 409: + throw new Webflow.ConflictError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/users/client/index.ts b/src/api/resources/users/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/users/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/users/client/requests/UsersInviteRequest.ts b/src/api/resources/users/client/requests/UsersInviteRequest.ts new file mode 100644 index 00000000..660e4fe7 --- /dev/null +++ b/src/api/resources/users/client/requests/UsersInviteRequest.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * email: "some.one@home.com" + * } + */ +export interface UsersInviteRequest { + /** Email address of user to send invite to */ + email: string; + /** + * An array of access group slugs. Access groups are assigned to the user as type `admin` and the user remains in the group until removed. + * + */ + accessGroups?: string[]; +} diff --git a/src/api/resources/users/client/requests/UsersListRequest.ts b/src/api/resources/users/client/requests/UsersListRequest.ts new file mode 100644 index 00000000..57fc585f --- /dev/null +++ b/src/api/resources/users/client/requests/UsersListRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../.."; + +/** + * @example + * { + * sort: Webflow.UsersListRequestSort.CreatedOnAscending + * } + */ +export interface UsersListRequest { + /** + * Offset used for pagination if the results have more than limit records + */ + offset?: number; + /** + * Maximum number of records to be returned (max limit: 100) + */ + limit?: number; + /** + * Sort string to use when ordering users + * + * Example(`CreatedOn`, `Email`, `Status`, `LastLogin`, `UpdatedOn`). + * + * Can be prefixed with a `-` to reverse the sort (ex. `-CreatedOn`) + */ + sort?: Webflow.UsersListRequestSort; +} diff --git a/src/api/resources/users/client/requests/index.ts b/src/api/resources/users/client/requests/index.ts new file mode 100644 index 00000000..7041335e --- /dev/null +++ b/src/api/resources/users/client/requests/index.ts @@ -0,0 +1,2 @@ +export { UsersListRequest } from "./UsersListRequest"; +export { UsersInviteRequest } from "./UsersInviteRequest"; diff --git a/src/api/resources/users/index.ts b/src/api/resources/users/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/users/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/users/types/UsersListRequestSort.ts b/src/api/resources/users/types/UsersListRequestSort.ts new file mode 100644 index 00000000..097fa533 --- /dev/null +++ b/src/api/resources/users/types/UsersListRequestSort.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type UsersListRequestSort = + /** + * Sorts users in ascending order based on their created date */ + | "CreatedOn" + /** + * Sorts users in descending order based on their created date */ + | "-CreatedOn" + /** + * Sorts users in ascending order based on their email */ + | "Email" + /** + * Sorts users in descending order based on their email */ + | "-Email" + /** + * Sorts users in ascending order based on their status */ + | "Status" + /** + * Sorts users in descending order based on their status */ + | "-Status" + /** + * Sorts users in ascending order based on their last login date */ + | "LastLogin" + /** + * Sorts users in descending order based on their last login date */ + | "-LastLogin" + /** + * Sorts users in ascending order based on their update date */ + | "UpdatedOn" + /** + * Sorts users in descending order based on their update date */ + | "-UpdatedOn"; + +export const UsersListRequestSort = { + CreatedOnAscending: "CreatedOn", + CreatedOnDescending: "-CreatedOn", + EmailAscending: "Email", + EmailDescending: "-Email", + StatusAscending: "Status", + StatusDescending: "-Status", + LastLoginAscending: "LastLogin", + LastLoginDescending: "-LastLogin", + UpdatedOnAscending: "UpdatedOn", + UpdatedOnDescending: "-UpdatedOn", +} as const; diff --git a/src/api/resources/users/types/index.ts b/src/api/resources/users/types/index.ts new file mode 100644 index 00000000..06eb1302 --- /dev/null +++ b/src/api/resources/users/types/index.ts @@ -0,0 +1 @@ +export * from "./UsersListRequestSort"; diff --git a/src/api/resources/webhooks/client/Client.ts b/src/api/resources/webhooks/client/Client.ts new file mode 100644 index 00000000..f656b512 --- /dev/null +++ b/src/api/resources/webhooks/client/Client.ts @@ -0,0 +1,324 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Webflow from "../../.."; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization"; +import * as errors from "../../../../errors"; + +export declare namespace Webhooks { + interface Options { + environment?: core.Supplier; + accessToken: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Webhooks { + constructor(protected readonly _options: Webhooks.Options) {} + + /** + * List all App-created Webhooks registered for a given site + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.webhooks.list("site-id") + */ + public async list(siteId: string, requestOptions?: Webhooks.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/webhooks` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.webhooks.list.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a new Webhook, to be notified when Webflow resources change. Limit of 75 registrations per `triggerType`, per site. + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.webhooks.create("site-id", { + * triggerType: Webflow.TriggerType.FormSubmission, + * url: "https://api.mydomain.com/webhook" + * }) + */ + public async create( + siteId: string, + request: Webflow.WebhooksCreateRequest, + requestOptions?: Webhooks.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `sites/${siteId}/webhooks` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + body: await serializers.WebhooksCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Webhook.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a specific Webhook instance + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.webhooks.get("webhook-id") + */ + public async get(webhookId: string, requestOptions?: Webhooks.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `webhooks/${webhookId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return await serializers.Webhook.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Remove a Webhook + * @throws {@link Webflow.BadRequestError} + * @throws {@link Webflow.UnauthorizedError} + * @throws {@link Webflow.NotFoundError} + * @throws {@link Webflow.TooManyRequestsError} + * @throws {@link Webflow.InternalServerError} + * + * @example + * await webflow.webhooks.delete("webhook-id") + */ + public async delete(webhookId: string, requestOptions?: Webhooks.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, + `webhooks/${webhookId}` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "", + "X-Fern-SDK-Version": "0.0.3", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Webflow.BadRequestError(_response.error.body); + case 401: + throw new Webflow.UnauthorizedError(_response.error.body); + case 404: + throw new Webflow.NotFoundError(_response.error.body); + case 429: + throw new Webflow.TooManyRequestsError(_response.error.body); + case 500: + throw new Webflow.InternalServerError(_response.error.body); + default: + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.WebflowError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.WebflowTimeoutError(); + case "unknown": + throw new errors.WebflowError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.accessToken)}`; + } +} diff --git a/src/api/resources/webhooks/client/index.ts b/src/api/resources/webhooks/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/webhooks/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/webhooks/client/requests/WebhooksCreateRequest.ts b/src/api/resources/webhooks/client/requests/WebhooksCreateRequest.ts new file mode 100644 index 00000000..d426606f --- /dev/null +++ b/src/api/resources/webhooks/client/requests/WebhooksCreateRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../.."; + +/** + * @example + * { + * triggerType: Webflow.TriggerType.FormSubmission, + * url: "https://api.mydomain.com/webhook" + * } + */ +export interface WebhooksCreateRequest { + triggerType: Webflow.TriggerType; + /** + * The server URI that Webflow will call when your Webhook is triggered + * + */ + url: string; + /** + * Filter for selecting which events you want Webhooks to be triggered for. + * ** Only available for `form_submission` trigger types. ** + * + */ + filter?: Record; +} diff --git a/src/api/resources/webhooks/client/requests/index.ts b/src/api/resources/webhooks/client/requests/index.ts new file mode 100644 index 00000000..f7f7b70d --- /dev/null +++ b/src/api/resources/webhooks/client/requests/index.ts @@ -0,0 +1 @@ +export { WebhooksCreateRequest } from "./WebhooksCreateRequest"; diff --git a/src/api/resources/webhooks/index.ts b/src/api/resources/webhooks/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/webhooks/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/site.ts b/src/api/site.ts deleted file mode 100644 index 3245ccda..00000000 --- a/src/api/site.ts +++ /dev/null @@ -1,192 +0,0 @@ -import { AxiosInstance } from "axios"; -import { Webhook, Collection, WebhookFilter } from "."; -import { requireArgs, WebflowRecord } from "../core"; - -/************************************************************** - * Interfaces - *************************************************************/ -export interface IDomain { - _id: string; - name: string; -} - -export interface ISite { - lastPublished: string; - previewUrl: string; - createdOn: string; - shortName: string; - timezone: string; - database: string; - name: string; - _id: string; -} - -export interface IPublishSite { - queued: boolean; -} - -/************************************************************** - * Class - **************************************************************/ - -export class Site extends WebflowRecord implements ISite { - lastPublished: string; - previewUrl: string; - createdOn: string; - shortName: string; - timezone: string; - database: string; - name: string; - _id: string; - - /** - * Get a list of Sites - * @param client The Axios client instance - * @returns a list of Sites - */ - static list(client: AxiosInstance) { - const path = "/sites"; - return client.get(path); - } - - /** - * Get a single Site - * @param params The params for the request - * @param params.siteId The site ID - * @param params.params The query string parameters (optional) - * @param client The Axios client instance - * @returns A single Site - */ - static getOne({ siteId }: { siteId: string }, client: AxiosInstance) { - requireArgs({ siteId }); - const path = `/sites/${siteId}`; - return client.get(path); - } - - /** - * Publish a site - * @param params The params for the request - * @param params.siteId The site ID - * @param params.domains The domains to publish to - * @param client The Axios client instance - * @returns The publish result - */ - static publish( - { siteId, domains }: { siteId: string; domains: string[] }, - client: AxiosInstance, - ) { - requireArgs({ siteId, domains }); - const path = `/sites/${siteId}/publish`; - return client.post(path, { domains }); - } - - /** - * Get a list of domains for a site - * @param params The params for the request - * @param params.siteId The site ID - * @param client The Axios client instance - * @returns A list of domains - */ - static domains({ siteId }: { siteId: string }, client: AxiosInstance) { - requireArgs({ siteId }); - const path = `/sites/${siteId}/domains`; - return client.get(path); - } - - /************************************************************** - * Instance Methods - **************************************************************/ - - /** - * Get a list of domains for a site - * @returns A list of domains - */ - async domains() { - const res = await Site.domains({ siteId: this._id }, this.client); - return res.data; - } - - /** - * Publish a site - * @param domains The domains to publish to - * @returns The publish result - */ - async publishSite(domains: string[]) { - const res = await Site.publish({ siteId: this._id, domains }, this.client); - return res.data; - } - - /** - * Get a single Collection - * @param params The params for the request - * @param params.collectionId The collection ID - * @returns A single Collection - */ - async collection({ collectionId }: { collectionId: string }) { - const res = await Collection.getOne({ collectionId }, this.client); - return new Collection(this.client, res); - } - - /** - * Get a list of Collections - * @returns A list of Collections - */ - async collections() { - const res = await Collection.list({ siteId: this._id }, this.client); - return res.data.map((data) => new Collection(this.client, { ...res, data })); - } - - /** - * Get a single Webhook - * @param params The params for the request - * @param params.webhookId The webhook ID - * @returns A single Webhook - */ - async webhook({ webhookId }: { webhookId: string }) { - const res = await Webhook.getOne({ siteId: this._id, webhookId }, this.client); - return new Webhook(this.client, res); - } - - /** - * Get a list of Webhooks - * @returns A list of Webhooks - */ - async webhooks() { - const res = await Webhook.list({ siteId: this._id }, this.client); - return res.data.map((data) => new Webhook(this.client, { ...res, data })); - } - - /** - * Remove a Webhook - * @param params The query string parameters (optional) - * @param params.webhookId The Webhook ID - * @returns The result of the removal - */ - async removeWebhook({ webhookId }: { webhookId: string }) { - const res = await Webhook.remove({ siteId: this._id, webhookId }, this.client); - return res.data; - } - - /** - * Create a new Webhook - * @param params The params for the request - * @param params.url The URL to send the webhook to - * @param params.triggerType The event to trigger the webhook - * @param params.filter The filter to apply to the webhook (optional: form_submission only) - * @returns The created webhook - */ - async createWebhook({ - triggerType, - filter, - url, - }: { - url: string; - siteId: string; - triggerType: string; - filter?: WebhookFilter; - }) { - const _params = { url, siteId: this._id, triggerType, filter }; - const res = await Webhook.create(_params, this.client); - return new Webhook(this.client, res); - } -} diff --git a/src/api/types/AccessGroup.ts b/src/api/types/AccessGroup.ts new file mode 100644 index 00000000..d94688bc --- /dev/null +++ b/src/api/types/AccessGroup.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface AccessGroup { + /** Unique identifier for the Access Group */ + id?: string; + /** Name of the the Access Group */ + name?: string; + /** Shortened unique identifier based on name, optimized for its use in the user’s JWT */ + shortId?: string; + /** Shortened unique identifier based on name, optimized for human readability and public API use */ + slug?: string; + /** The date the Access Group was created */ + createdOn?: Date; +} diff --git a/src/api/types/AccessGroupList.ts b/src/api/types/AccessGroupList.ts new file mode 100644 index 00000000..a803702b --- /dev/null +++ b/src/api/types/AccessGroupList.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The list access groups results + */ +export interface AccessGroupList { + /** Number of access groups returned */ + count?: number; + /** The limit specified in the request */ + limit?: number; + /** The offset specified for pagination */ + offset?: number; + /** Total number of access groups in the collection */ + total?: number; + /** List of Site Access Groups */ + accessGroups?: Webflow.AccessGroup[]; +} diff --git a/src/api/types/Application.ts b/src/api/types/Application.ts new file mode 100644 index 00000000..18c66866 --- /dev/null +++ b/src/api/types/Application.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface Application { + /** Unique identifier for the Application */ + id?: string; + /** Application description provided by the developer */ + description?: string; + /** Application homepage URL provided by the developer */ + homepage?: string; + /** Application name provided by the developer */ + displayName?: string; +} diff --git a/src/api/types/Asset.ts b/src/api/types/Asset.ts new file mode 100644 index 00000000..520f455f --- /dev/null +++ b/src/api/types/Asset.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface Asset { + /** Unique identifier for this asset */ + id?: string; + /** File format type */ + contentType?: string; + /** size in bytes */ + size?: number; + /** Unique identifier for the site that hosts this asset */ + siteId?: string; + /** Link to the asset */ + hostedUrl?: string; + /** Original file name at the time of upload */ + originalFileName?: string; + /** Display name of the asset */ + displayName?: string; + /** Date the asset metadata was last updated */ + lastUpdated?: Date; + /** Date the asset metadata was created */ + createdOn?: Date; + variants?: Webflow.AssetVariant[]; +} diff --git a/src/api/types/AssetFolder.ts b/src/api/types/AssetFolder.ts new file mode 100644 index 00000000..4765b4ad --- /dev/null +++ b/src/api/types/AssetFolder.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface AssetFolder { + /** User visible name for the Asset Folder */ + displayName?: string; + /** Unique identifier for the Asset Folder */ + id?: string; + /** Pointer to parent Asset Folder (or null if root) */ + parentFolder?: string; + /** Array of Asset instances in the folder */ + assets?: string[]; + /** The unique id of the site the Asset Folder belongs to */ + siteId?: string; + /** Date that the Asset Folder was created on */ + createdOn?: Date; + /** Date that the Asset Folder was last updated on */ + lastUpdated?: Date; +} diff --git a/src/api/types/AssetFolderList.ts b/src/api/types/AssetFolderList.ts new file mode 100644 index 00000000..c9f1239e --- /dev/null +++ b/src/api/types/AssetFolderList.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The Asset Folders object + */ +export interface AssetFolderList { + pagination?: Webflow.Pagination; + pages?: Webflow.AssetFolder[]; +} diff --git a/src/api/types/AssetUpload.ts b/src/api/types/AssetUpload.ts new file mode 100644 index 00000000..0b71b50b --- /dev/null +++ b/src/api/types/AssetUpload.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface AssetUpload { + /** Metadata for uploading the asset binary */ + uploadDetails?: Webflow.AssetUploadUploadDetails; + id?: string; + contentType?: string; + /** Parent folder for the asset */ + parentFolder?: string; + /** Represents the link to the asset */ + hostedUrl?: string; + uploadUrl?: string; + /** S3 link to the asset */ + assetUrl?: string; + /** Original file name when uploaded. If not specified at time of upload, it may be extracted from the raw file name */ + originalFileName?: string; + /** Date the asset metadata was last updated */ + lastUpdated?: Date; + /** Date the asset metadata was created */ + createdOn?: Date; +} diff --git a/src/api/types/AssetUploadUploadDetails.ts b/src/api/types/AssetUploadUploadDetails.ts new file mode 100644 index 00000000..99d4b6d3 --- /dev/null +++ b/src/api/types/AssetUploadUploadDetails.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Metadata for uploading the asset binary + */ +export interface AssetUploadUploadDetails { + acl?: string; + bucket?: string; + key?: string; + policy?: string; + xAmzAlgorithm?: string; + xAmzCredential?: string; + xAmzDate?: string; + /** (optional) Temporary security token obtained when authenticated through AWS STS */ + xAmzSecurityToken?: string; + xAmzSignature?: string; + successActionStatus?: string; + contentType?: string; + cacheControl?: string; +} diff --git a/src/api/types/AssetVariant.ts b/src/api/types/AssetVariant.ts new file mode 100644 index 00000000..05adb4e6 --- /dev/null +++ b/src/api/types/AssetVariant.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface AssetVariant { + hostedUrl?: string; + originalFileName?: string; + displayName?: string; + format?: string; + /** Width in pixels */ + width?: number; + /** Height in pixels */ + height?: number; + /** Value between 0 and 100 representing the image quality */ + quality?: number; + /** Any associated validation errors */ + error?: string; +} diff --git a/src/api/types/Assets.ts b/src/api/types/Assets.ts new file mode 100644 index 00000000..6a447dd2 --- /dev/null +++ b/src/api/types/Assets.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface Assets { + assets?: Webflow.Asset[]; +} diff --git a/src/api/types/Authorization.ts b/src/api/types/Authorization.ts new file mode 100644 index 00000000..0be0b006 --- /dev/null +++ b/src/api/types/Authorization.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface Authorization { + /** The Authorization object */ + authorization?: Webflow.AuthorizationAuthorization; + application?: Webflow.Application; +} diff --git a/src/api/types/AuthorizationAuthorization.ts b/src/api/types/AuthorizationAuthorization.ts new file mode 100644 index 00000000..1701585f --- /dev/null +++ b/src/api/types/AuthorizationAuthorization.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The Authorization object + */ +export interface AuthorizationAuthorization { + /** The unique id of the Authorization instance */ + id?: string; + /** The date the Authorization was created */ + createdOn?: Date; + /** The date the Authorization was last used */ + lastUsed?: Date; + /** The grant type of the Authorization */ + grantType?: string; + /** The default rate limit for the Authorization (requests/min) */ + rateLimit?: number; + /** Comma separted list of OAuth scopes corresponding to the Authorization */ + scope?: string; + authorizedTo?: Webflow.AuthorizationAuthorizationAuthorizedTo; +} diff --git a/src/api/types/AuthorizationAuthorizationAuthorizedTo.ts b/src/api/types/AuthorizationAuthorizationAuthorizedTo.ts new file mode 100644 index 00000000..0e34e40c --- /dev/null +++ b/src/api/types/AuthorizationAuthorizationAuthorizedTo.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface AuthorizationAuthorizationAuthorizedTo { + /** Array of Sites this app is authorized to */ + siteIds?: unknown[]; + /** Array of Workspaces this app is authorized to */ + workspaceIds?: unknown[]; + /** Array of Users this app is authorized to */ + userIds?: unknown[]; +} diff --git a/src/api/types/AuthorizedUser.ts b/src/api/types/AuthorizedUser.ts new file mode 100644 index 00000000..de8672df --- /dev/null +++ b/src/api/types/AuthorizedUser.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface AuthorizedUser { + /** The unique id of the user */ + id?: string; + /** The user's email address */ + email?: string; + /** The user's first name */ + firstName?: string; + /** The user's last name */ + lastName?: string; +} diff --git a/src/api/types/Collection.ts b/src/api/types/Collection.ts new file mode 100644 index 00000000..caace598 --- /dev/null +++ b/src/api/types/Collection.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A collection object + */ +export interface Collection { + /** Unique identifier for a Collection */ + id: string; + /** Name given to the Collection */ + displayName?: string; + /** The name of one Item in Collection (e.g. ”Blog Post” if the Collection is called “Blog Posts”) */ + singularName?: string; + /** Slug of Collection in Site URL structure */ + slug?: string; + /** The date the collection was created */ + createdOn?: Date; + /** The date the collection was last updated */ + lastUpdated?: Date; + /** The list of fields in the Collection */ + fields: Record; +} diff --git a/src/api/types/CollectionItem.ts b/src/api/types/CollectionItem.ts new file mode 100644 index 00000000..a763a155 --- /dev/null +++ b/src/api/types/CollectionItem.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The fields that define the schema for a given Item are based on the Collection that Item belongs to. Beyond the user defined fields, there are a handful of additional fields that are automatically created for all items + */ +export interface CollectionItem { + /** Unique identifier for the Item */ + id: string; + /** The date the item was last published */ + lastPublished?: string; + /** The date the item was last updated */ + lastUpdated?: string; + /** The date the item was created */ + createdOn?: string; + /** Boolean determining if the Item is set to archived */ + isArchived?: boolean; + /** Boolean determining if the Item is set to draft */ + isDraft?: boolean; + fieldData?: Webflow.CollectionItemFieldData; +} diff --git a/src/api/types/CollectionItemFieldData.ts b/src/api/types/CollectionItemFieldData.ts new file mode 100644 index 00000000..f36d849f --- /dev/null +++ b/src/api/types/CollectionItemFieldData.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CollectionItemFieldData { + /** Name of the Item */ + name?: string; + /** URL structure of the Item in your site. Note: Updates to an item slug will break all links referencing the old slug. */ + slug?: string; +} diff --git a/src/api/types/CollectionItemList.ts b/src/api/types/CollectionItemList.ts new file mode 100644 index 00000000..fe40b73c --- /dev/null +++ b/src/api/types/CollectionItemList.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * Results from collection items list + */ +export interface CollectionItemList { + /** List of Items within the collection */ + items?: Webflow.CollectionItem[]; + pagination?: Webflow.CollectionItemListPagination; +} diff --git a/src/api/types/CollectionItemListPagination.ts b/src/api/types/CollectionItemListPagination.ts new file mode 100644 index 00000000..f3631d75 --- /dev/null +++ b/src/api/types/CollectionItemListPagination.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CollectionItemListPagination { + /** The limit specified in the request */ + limit?: number; + /** The offset specified for pagination */ + offset?: number; + /** Total number of items in the collection */ + total?: number; +} diff --git a/src/api/types/CollectionItemRemoved.ts b/src/api/types/CollectionItemRemoved.ts new file mode 100644 index 00000000..6ad08102 --- /dev/null +++ b/src/api/types/CollectionItemRemoved.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CollectionItemRemoved { + /** The number of items deleted */ + deleted?: number; + /** The id of the collection item that was deleted */ + itemId?: string; +} diff --git a/src/api/types/CollectionList.ts b/src/api/types/CollectionList.ts new file mode 100644 index 00000000..977deaf6 --- /dev/null +++ b/src/api/types/CollectionList.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface CollectionList { + /** An array of Collections */ + collections?: Webflow.CollectionListArrayItem[]; +} diff --git a/src/api/types/CollectionListArrayItem.ts b/src/api/types/CollectionListArrayItem.ts new file mode 100644 index 00000000..2c3ae253 --- /dev/null +++ b/src/api/types/CollectionListArrayItem.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A collection object + */ +export interface CollectionListArrayItem { + /** Unique identifier for a Collection */ + id: string; + /** Name given to the Collection */ + displayName?: string; + /** The name of one Item in Collection (e.g. ”Blog Post” if the Collection is called “Blog Posts”) */ + singularName?: string; + /** Slug of Collection in Site URL structure */ + slug?: string; + /** The date the collection was created */ + createdOn?: Date; + /** The date the collection was last updated */ + lastUpdated?: Date; +} diff --git a/src/api/types/CustomCodeBlock.ts b/src/api/types/CustomCodeBlock.ts new file mode 100644 index 00000000..a66e6c11 --- /dev/null +++ b/src/api/types/CustomCodeBlock.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * A specific instance of Custom Code applied to a Site or Page + */ +export interface CustomCodeBlock { + /** The Site id where the custom code was applied */ + siteId?: string; + /** The Page id (if applied at Page-level) */ + pageId?: string; + /** Whether the Custom Code script is applied at the Site-level or Page-level */ + type?: Webflow.CustomCodeBlockType; + scripts?: Webflow.ScriptApply[]; + /** The date the Block was created */ + createdOn?: Date; + /** The date the Block was most recently updated */ + lastUpdated?: Date; +} diff --git a/src/api/types/CustomCodeBlockType.ts b/src/api/types/CustomCodeBlockType.ts new file mode 100644 index 00000000..4664679d --- /dev/null +++ b/src/api/types/CustomCodeBlockType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Whether the Custom Code script is applied at the Site-level or Page-level + */ +export type CustomCodeBlockType = "page" | "site"; + +export const CustomCodeBlockType = { + Page: "page", + Site: "site", +} as const; diff --git a/src/api/types/CustomCodeResponse.ts b/src/api/types/CustomCodeResponse.ts new file mode 100644 index 00000000..30f55a40 --- /dev/null +++ b/src/api/types/CustomCodeResponse.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Registered custom code for application + */ +export interface CustomCodeResponse { + /** Human readable id, derived from the user-specified display name */ + id?: string; + /** Timestamp when the script version was created */ + createdOn?: string; + /** Timestamp when the script version was last updated */ + lastUpdated?: string; + /** URI for an externally hosted script location */ + hostedLocation?: string; + /** Sub-Resource Integrity Hash. Only required for externally hosted scripts (passed via hostedLocation) */ + integrityHash?: string; + /** Define whether the script can be copied on site duplication and transfer */ + canCopy?: boolean; + /** A Semantic Version (SemVer) string, denoting the version of the script */ + version?: string; + /** User-facing name for the script */ + displayName?: string; +} diff --git a/src/api/types/Domain.ts b/src/api/types/Domain.ts new file mode 100644 index 00000000..64c69d4a --- /dev/null +++ b/src/api/types/Domain.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface Domain { + /** Unique identifier for the Domain */ + id: string; + /** The registered Domain name */ + url?: string; +} diff --git a/src/api/types/DuplicateUserEmail.ts b/src/api/types/DuplicateUserEmail.ts new file mode 100644 index 00000000..db5c3c95 --- /dev/null +++ b/src/api/types/DuplicateUserEmail.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface DuplicateUserEmail { + code?: "duplicate_user_email"; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/EcommerceSettings.ts b/src/api/types/EcommerceSettings.ts new file mode 100644 index 00000000..fa755860 --- /dev/null +++ b/src/api/types/EcommerceSettings.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Ecommerce settings for a Webflow Site + */ +export interface EcommerceSettings { + /** The identifier of the Site */ + siteId?: string; + /** Date that the Site was created on */ + createdOn?: Date; + /** The three-letter ISO currency code for the Site */ + defaultCurrency?: string; +} diff --git a/src/api/types/ErrorDetailsItem.ts b/src/api/types/ErrorDetailsItem.ts new file mode 100644 index 00000000..d02087ac --- /dev/null +++ b/src/api/types/ErrorDetailsItem.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ErrorDetailsItem = string | Record; diff --git a/src/api/types/Error_.ts b/src/api/types/Error_.ts new file mode 100644 index 00000000..8a7cbf51 --- /dev/null +++ b/src/api/types/Error_.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface Error_ { + /** Error code */ + code?: string; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/Field.ts b/src/api/types/Field.ts new file mode 100644 index 00000000..0e78a45a --- /dev/null +++ b/src/api/types/Field.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The details of a field in a collection + */ +export interface Field { + /** Unique identifier for a Field */ + id: string; + /** define whether a field is required in a collection */ + isRequired: boolean; + /** Define whether the field is editable */ + isEditable?: boolean; + /** Choose these appropriate field type for your collection data */ + type: Webflow.FieldType; + /** Slug of Field in Site URL structure. Slugs should be all lowercase with no spaces. Any spaces will be converted to "-." */ + slug?: string; + /** The name of a field */ + displayName: string; + /** Additional text to help anyone filling out this field */ + helpText?: string; +} diff --git a/src/api/types/FieldType.ts b/src/api/types/FieldType.ts new file mode 100644 index 00000000..93fafa12 --- /dev/null +++ b/src/api/types/FieldType.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Choose these appropriate field type for your collection data + */ +export type FieldType = + | "PlainText" + | "RichText" + | "Image" + | "MultiImage" + | "Video" + | "Link" + | "Email" + | "Phone" + | "Number" + | "DateTime" + | "Boolean" + | "Color" + | "ExtFileRef"; + +export const FieldType = { + PlainText: "PlainText", + RichText: "RichText", + Image: "Image", + MultiImage: "MultiImage", + Video: "Video", + Link: "Link", + Email: "Email", + Phone: "Phone", + Number: "Number", + DateTime: "DateTime", + Boolean: "Boolean", + Color: "Color", + ExtFileRef: "ExtFileRef", +} as const; diff --git a/src/api/types/Fields.ts b/src/api/types/Fields.ts new file mode 100644 index 00000000..54d14dcd --- /dev/null +++ b/src/api/types/Fields.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The list of fields in the Collection + */ +export type Fields = Webflow.Field[]; diff --git a/src/api/types/Form.ts b/src/api/types/Form.ts new file mode 100644 index 00000000..ea0ba0e4 --- /dev/null +++ b/src/api/types/Form.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface Form { + /** The unique id for the Form */ + id?: string; + /** The Form name displayed on the site */ + displayName?: string; + /** The unique id of the Site the Form belongs to */ + siteId?: string; + /** The unique id corresponding to the site's Domain name */ + siteDomainId?: string; + /** The unique id for the Page on which the Form is placed */ + pageId?: string; + /** The user-visible name of the Page where the Form is placed */ + pageName?: string; + /** The unique id of the Workspace the Site belongs to */ + workspaceId?: string; + /** Date that the Form was created on */ + createdOn?: Date; + /** Date that the Form was last updated on */ + lastUpdated?: Date; + fields?: Webflow.FormField[]; + responseSettings?: Webflow.FormResponseSettings; +} diff --git a/src/api/types/FormField.ts b/src/api/types/FormField.ts new file mode 100644 index 00000000..49df5144 --- /dev/null +++ b/src/api/types/FormField.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export type FormField = Record; diff --git a/src/api/types/FormFieldValue.ts b/src/api/types/FormFieldValue.ts new file mode 100644 index 00000000..232ee518 --- /dev/null +++ b/src/api/types/FormFieldValue.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface FormFieldValue { + /** The field name displayed on the site */ + displayName?: string; + /** The field type */ + type?: Webflow.FormFieldValueType; + /** The placeholder text for the field */ + placeholder?: string; + /** Whether the field is visible to the user */ + userVisible?: boolean; +} diff --git a/src/api/types/FormFieldValueType.ts b/src/api/types/FormFieldValueType.ts new file mode 100644 index 00000000..6bfb83be --- /dev/null +++ b/src/api/types/FormFieldValueType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The field type + */ +export type FormFieldValueType = "Plain" | "Email" | "Password" | "Phone" | "Number"; + +export const FormFieldValueType = { + Plain: "Plain", + Email: "Email", + Password: "Password", + Phone: "Phone", + Number: "Number", +} as const; diff --git a/src/api/types/FormList.ts b/src/api/types/FormList.ts new file mode 100644 index 00000000..a6829925 --- /dev/null +++ b/src/api/types/FormList.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface FormList { + forms?: Webflow.Form[]; + pagination?: Webflow.Pagination; +} diff --git a/src/api/types/FormResponseSettings.ts b/src/api/types/FormResponseSettings.ts new file mode 100644 index 00000000..604122e7 --- /dev/null +++ b/src/api/types/FormResponseSettings.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface FormResponseSettings { + /** Whether to send an email confirmation to the user */ + sendEmailConfirmation?: boolean; + /** The url or path to redirect the user to after form submission */ + redirectUrl?: string; + /** The HTTP request method to use for the redirectUrl (eg. POST or GET) */ + redirectMethod?: string; + /** The action to take after form submission */ + redirectAction?: string; +} diff --git a/src/api/types/FormSubmission.ts b/src/api/types/FormSubmission.ts new file mode 100644 index 00000000..159cf192 --- /dev/null +++ b/src/api/types/FormSubmission.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface FormSubmission { + /** The unique id of the Form submission */ + id?: string; + /** The Form name displayed on the site */ + displayName?: string; + /** The unique id of the Site the Form belongs to */ + siteId?: string; + /** The unique id of the Workspace the Site belongs to */ + workspaceId?: string; + /** Date that the Form was submitted on */ + dateSubmitted?: Date; + /** The data submitted in the Form */ + formResponse?: Record; +} diff --git a/src/api/types/FormSubmissionList.ts b/src/api/types/FormSubmissionList.ts new file mode 100644 index 00000000..b718bbb4 --- /dev/null +++ b/src/api/types/FormSubmissionList.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface FormSubmissionList { + submissions?: Webflow.FormSubmission[]; + pagination?: Webflow.Pagination; +} diff --git a/src/api/types/FormSubmissionTrigger.ts b/src/api/types/FormSubmissionTrigger.ts new file mode 100644 index 00000000..35dfc234 --- /dev/null +++ b/src/api/types/FormSubmissionTrigger.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface FormSubmissionTrigger { + /** The type of event that triggered the request */ + triggerType?: string; + /** The payload of data sent from Webflow */ + payload?: Webflow.FormSubmissionTriggerPayload; +} diff --git a/src/api/types/FormSubmissionTriggerPayload.ts b/src/api/types/FormSubmissionTriggerPayload.ts new file mode 100644 index 00000000..eb05a4a6 --- /dev/null +++ b/src/api/types/FormSubmissionTriggerPayload.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The payload of data sent from Webflow + */ +export interface FormSubmissionTriggerPayload { + /** The name of the form */ + name?: string; + /** The id of the site that the form was submitted from */ + siteId?: string; + /** The data submitted in the form */ + data?: Record; + /** The timestamp the form was submitted */ + submittedAt?: string; + /** The id of the form submission */ + formId?: string; +} diff --git a/src/api/types/InvalidDomain.ts b/src/api/types/InvalidDomain.ts new file mode 100644 index 00000000..4da2028b --- /dev/null +++ b/src/api/types/InvalidDomain.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type InvalidDomain = unknown; diff --git a/src/api/types/InventoryItem.ts b/src/api/types/InventoryItem.ts new file mode 100644 index 00000000..e0873159 --- /dev/null +++ b/src/api/types/InventoryItem.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The availabile inventory for an item + */ +export interface InventoryItem { + /** Unique identifier for a SKU item */ + id?: string; + /** Total quantity of items remaining in inventory (if inventoryType is finite) */ + quantity?: number; + /** infinite or finite */ + inventoryType?: Webflow.InventoryItemInventoryType; +} diff --git a/src/api/types/InventoryItemInventoryType.ts b/src/api/types/InventoryItemInventoryType.ts new file mode 100644 index 00000000..1828edeb --- /dev/null +++ b/src/api/types/InventoryItemInventoryType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * infinite or finite + */ +export type InventoryItemInventoryType = "infinite" | "finite"; + +export const InventoryItemInventoryType = { + Infinite: "infinite", + Finite: "finite", +} as const; diff --git a/src/api/types/ListCustomCodeBlocks.ts b/src/api/types/ListCustomCodeBlocks.ts new file mode 100644 index 00000000..178af727 --- /dev/null +++ b/src/api/types/ListCustomCodeBlocks.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * Custom Code Blocks corresponding to where scripts were applied + */ +export interface ListCustomCodeBlocks { + blocks?: Webflow.CustomCodeBlock[]; + pagination?: Webflow.Pagination; +} diff --git a/src/api/types/MissingScopes.ts b/src/api/types/MissingScopes.ts new file mode 100644 index 00000000..a75a5c3c --- /dev/null +++ b/src/api/types/MissingScopes.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface MissingScopes { + code?: "missing_scopes"; + type?: string; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/NoDomains.ts b/src/api/types/NoDomains.ts new file mode 100644 index 00000000..d00b6e30 --- /dev/null +++ b/src/api/types/NoDomains.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type NoDomains = unknown; diff --git a/src/api/types/OauthScope.ts b/src/api/types/OauthScope.ts new file mode 100644 index 00000000..607e22b4 --- /dev/null +++ b/src/api/types/OauthScope.ts @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type OauthScope = + /** + * read details about the authorized user */ + | "authorized_user:read" + /** + * read pages on the site */ + | "read:pages" + /** + * read sites on the site */ + | "sites:read" + /** + * modify pages on the site */ + | "sites:write" + /** + * read custom code on the site */ + | "custom_code:read" + /** + * modify custom code on the site */ + | "custom_code:write" + /** + * delete custom code on the site */ + | "custom_code:delete" + /** + * read users on the site */ + | "users:read" + /** + * modify users on the site */ + | "users:write" + /** + * read ecommerce data */ + | "ecommerce:read" + /** + * edit ecommerce data */ + | "ecommerce:write"; + +export const OauthScope = { + AuthorizedUserRead: "authorized_user:read", + ReadPages: "read:pages", + SitesRead: "sites:read", + SitesWrite: "sites:write", + CustomCodeRead: "custom_code:read", + CustomCodeWrite: "custom_code:write", + CustomCodeDelete: "custom_code:delete", + UsersRead: "users:read", + UsersWrite: "users:write", + EcommerceRead: "ecommerce:read", + EcommerceWrite: "ecommerce:write", +} as const; diff --git a/src/api/types/Order.ts b/src/api/types/Order.ts new file mode 100644 index 00000000..3a653ccb --- /dev/null +++ b/src/api/types/Order.ts @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface Order { + /** The order id. Will usually be 6 hex characters, but can also be 9 hex characters if the site has a very large number of Orders. Randomly assigned. */ + orderId?: string; + /** The status of the Order */ + status?: Webflow.OrderStatus; + /** A comment string for this Order editable by API user (not used by Webflow). */ + comment?: string; + /** A comment that the customer left when making their Order */ + orderComment?: string; + /** The ISO8601 timestamp that an Order was placed. */ + acceptedOn?: Date; + /** If an Order was marked as 'fulfilled', then this is the ISO8601 timestamp when that happened. */ + fulfilledOn?: Date; + /** If an Order was refunded, this is the ISO8601 of when that happened. */ + refundedOn?: Date; + /** If an Order was disputed by the customer, then this key will be set with the ISO8601 timestamp that Stripe notifies Webflow. Null if not disputed. */ + disputedOn?: Date; + /** If an Order was disputed by the customer, then this key will be set with the ISO8601 timestamp of the last time that we got an update. Null if not disputed. */ + disputeUpdatedOn?: Date; + /** If an order was disputed by the customer, then this key will be set with the [dispute's status](https://stripe.com/docs/api#dispute_object-status). */ + disputeLastStatus?: Webflow.OrderDisputeLastStatus; + /** The total paid by the customer */ + customerPaid?: Webflow.OrderPrice; + /** The net amount after application fees */ + netAmount?: Webflow.OrderPrice; + /** The application fee assessed by the platform */ + applicationFee?: Webflow.OrderPrice; + /** All addresses provided by the customer during the ordering flow. */ + allAddresses?: Webflow.OrderAddress[]; + /** The shipping address */ + shippingAddress?: Webflow.OrderAddress; + /** The billing address */ + billingAddress?: Webflow.OrderAddress; + /** A string editable by the API user to note the shipping provider used (not used by Webflow). */ + shippingProvider?: string; + /** A string editable by the API user to note the shipping tracking number for the order (not used by Webflow). */ + shippingTracking?: string; + shippingTrackingUrl?: string; + /** An object with the keys `fullName` and `email`. */ + customerInfo?: Webflow.OrderCustomerInfo; + /** An array of all things that the Customer purchased. */ + purchasedItems?: Webflow.OrderPurchasedItem[]; + /** The sum of all 'count' fields in 'purchasedItems'. */ + purchasedItemsCount?: number; + stripeDetails?: Webflow.StripeDetails; + stripeCard?: Webflow.StripeCard; + paypalDetails?: Webflow.PaypalDetails; + /** An array of additional inputs for custom order data gathering. Each object in the array represents an input with a name, and a textInput, textArea, or checkbox value. */ + customData?: Record[]; + metadata?: Webflow.OrderMetadata; + /** A boolean indicating whether the customer has been deleted from the site. */ + isCustomerDeleted?: boolean; + /** A boolean indicating whether the order contains one or more purchased items that require shipping. */ + isShippingRequired?: boolean; + /** A boolean indicating whether the order contains one or more purchased items that are downloadable. */ + hasDownloads?: boolean; + /** A string indicating the payment processor used for this order. */ + paymentProcessor?: string; + /** An object describing various pricing totals */ + totals?: Webflow.OrderTotals; + /** An array of downloadable file objects. */ + downloadFiles?: Webflow.OrderDownloadFilesItem[]; +} diff --git a/src/api/types/OrderAddress.ts b/src/api/types/OrderAddress.ts new file mode 100644 index 00000000..7db71625 --- /dev/null +++ b/src/api/types/OrderAddress.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * A customer address + */ +export interface OrderAddress { + /** The type of the order address (billing or shipping) */ + type?: Webflow.OrderAddressType; + /** Japan-only address format */ + japanType?: Webflow.OrderAddressJapanType; + /** Display name on the address */ + addressee?: string; + /** The first line of the address */ + line1?: string; + /** The second line of the address */ + line2?: string; + /** The city of the address. */ + city?: string; + /** The state or province of the address */ + state?: string; + /** The country of the address */ + country?: string; + /** The postal code of the address */ + postalCode?: string; +} diff --git a/src/api/types/OrderAddressJapanType.ts b/src/api/types/OrderAddressJapanType.ts new file mode 100644 index 00000000..8c495bab --- /dev/null +++ b/src/api/types/OrderAddressJapanType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Japan-only address format + */ +export type OrderAddressJapanType = "kana" | "kanji"; + +export const OrderAddressJapanType = { + Kana: "kana", + Kanji: "kanji", +} as const; diff --git a/src/api/types/OrderAddressType.ts b/src/api/types/OrderAddressType.ts new file mode 100644 index 00000000..46679b43 --- /dev/null +++ b/src/api/types/OrderAddressType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of the order address (billing or shipping) + */ +export type OrderAddressType = "shipping" | "billing"; + +export const OrderAddressType = { + Shipping: "shipping", + Billing: "billing", +} as const; diff --git a/src/api/types/OrderCustomerInfo.ts b/src/api/types/OrderCustomerInfo.ts new file mode 100644 index 00000000..f774e405 --- /dev/null +++ b/src/api/types/OrderCustomerInfo.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An object with the keys `fullName` and `email`. + */ +export interface OrderCustomerInfo { + /** The full name of the Customer */ + fullName?: string; + /** The Customer's email address */ + email?: string; +} diff --git a/src/api/types/OrderDisputeLastStatus.ts b/src/api/types/OrderDisputeLastStatus.ts new file mode 100644 index 00000000..224da645 --- /dev/null +++ b/src/api/types/OrderDisputeLastStatus.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * If an order was disputed by the customer, then this key will be set with the [dispute's status](https://stripe.com/docs/api#dispute_object-status). + */ +export type OrderDisputeLastStatus = + | "warning_needs_response" + | "warning_under_review" + | "warning_closed" + | "needs_response" + | "under_review" + | "charge_refunded" + | "won" + | "lost"; + +export const OrderDisputeLastStatus = { + WarningNeedsResponse: "warning_needs_response", + WarningUnderReview: "warning_under_review", + WarningClosed: "warning_closed", + NeedsResponse: "needs_response", + UnderReview: "under_review", + ChargeRefunded: "charge_refunded", + Won: "won", + Lost: "lost", +} as const; diff --git a/src/api/types/OrderDownloadFilesItem.ts b/src/api/types/OrderDownloadFilesItem.ts new file mode 100644 index 00000000..13774268 --- /dev/null +++ b/src/api/types/OrderDownloadFilesItem.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface OrderDownloadFilesItem { + /** The unique identifier for the downloadable file */ + id?: string; + /** The user-facing name for the downloadable file */ + name?: string; + /** The hosted location for the downloadable file */ + url?: string; +} diff --git a/src/api/types/OrderList.ts b/src/api/types/OrderList.ts new file mode 100644 index 00000000..d1647b7c --- /dev/null +++ b/src/api/types/OrderList.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * Results from order list + */ +export interface OrderList { + /** List of orders */ + items?: Webflow.Order[]; + pagination?: Webflow.Pagination; +} diff --git a/src/api/types/OrderMetadata.ts b/src/api/types/OrderMetadata.ts new file mode 100644 index 00000000..4e99ed3b --- /dev/null +++ b/src/api/types/OrderMetadata.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface OrderMetadata { + isBuyNow?: boolean; +} diff --git a/src/api/types/OrderPrice.ts b/src/api/types/OrderPrice.ts new file mode 100644 index 00000000..287163d4 --- /dev/null +++ b/src/api/types/OrderPrice.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface OrderPrice { + /** The three-letter ISO currency code */ + unit?: string; + /** The numeric value in the base unit of the currency */ + value?: string; + /** The user-facing string representation of the amount */ + string?: string; +} diff --git a/src/api/types/OrderPurchasedItem.ts b/src/api/types/OrderPurchasedItem.ts new file mode 100644 index 00000000..987c67e8 --- /dev/null +++ b/src/api/types/OrderPurchasedItem.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * An Item that was purchased + */ +export interface OrderPurchasedItem { + /** Number of Item purchased. */ + count?: number; + /** The total for the row */ + rowTotal?: Webflow.OrderPrice; + /** The unique identifier for the Product */ + productId?: string; + /** User-facing name of the Product */ + productName?: string; + /** Slug for the Product */ + productSlug?: string; + /** Identifier for the Product Variant (SKU) */ + variantId?: string; + /** User-facing name of the Product Variant (SKU) */ + variantName?: string; + /** Slug for the Product Variant (SKU) */ + variantSlug?: string; + variantImage?: Webflow.OrderPurchasedItemVariantImage; + /** The price corresponding to the variant */ + variantPrice?: Webflow.OrderPrice; + /** The physical weight of the variant if provided, or null */ + weight?: number; + /** The physical width of the variant if provided, or null */ + width?: number; + /** The physical height of the variant if provided, or null */ + height?: number; + /** The physical length of the variant if provided, or null */ + length?: number; +} diff --git a/src/api/types/OrderPurchasedItemVariantImage.ts b/src/api/types/OrderPurchasedItemVariantImage.ts new file mode 100644 index 00000000..d08f72c2 --- /dev/null +++ b/src/api/types/OrderPurchasedItemVariantImage.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface OrderPurchasedItemVariantImage { + /** The hosted location for the Variant's image */ + url?: string; + file?: Webflow.OrderPurchasedItemVariantImageFile; +} diff --git a/src/api/types/OrderPurchasedItemVariantImageFile.ts b/src/api/types/OrderPurchasedItemVariantImageFile.ts new file mode 100644 index 00000000..3058583b --- /dev/null +++ b/src/api/types/OrderPurchasedItemVariantImageFile.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface OrderPurchasedItemVariantImageFile { + /** The image size in bytes */ + size?: number; + /** the original name of the image */ + originalFileName?: string; + /** The creation timestamp of the image */ + createdOn?: Date; + /** The MIME type of the image */ + contentType?: string; + /** The image width in pixels */ + width?: number; + /** The image height in pixels */ + height?: number; + /** Variants of the supplied image */ + variants?: Webflow.OrderPurchasedItemVariantImageFileVariantsItem[]; +} diff --git a/src/api/types/OrderPurchasedItemVariantImageFileVariantsItem.ts b/src/api/types/OrderPurchasedItemVariantImageFileVariantsItem.ts new file mode 100644 index 00000000..0c288fe3 --- /dev/null +++ b/src/api/types/OrderPurchasedItemVariantImageFileVariantsItem.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface OrderPurchasedItemVariantImageFileVariantsItem { + /** The hosted location for the Variant's image */ + url?: string; + originalFileName?: string; + /** The image size in bytes */ + size?: number; + /** The image width in pixels */ + width?: number; + /** The image height in pixels */ + height?: number; +} diff --git a/src/api/types/OrderStatus.ts b/src/api/types/OrderStatus.ts new file mode 100644 index 00000000..d37dc5ca --- /dev/null +++ b/src/api/types/OrderStatus.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The status of the Order + */ +export type OrderStatus = "pending" | "unfulfilled" | "fulfilled" | "disputed" | "dispute-lost" | "refunded"; + +export const OrderStatus = { + Pending: "pending", + Unfulfilled: "unfulfilled", + Fulfilled: "fulfilled", + Disputed: "disputed", + DisputeLost: "dispute-lost", + Refunded: "refunded", +} as const; diff --git a/src/api/types/OrderTotals.ts b/src/api/types/OrderTotals.ts new file mode 100644 index 00000000..07361b94 --- /dev/null +++ b/src/api/types/OrderTotals.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * An object describing various pricing totals + */ +export interface OrderTotals { + /** The subtotal price */ + subtotal?: Webflow.OrderPrice; + /** An array of extra items, includes discounts, shipping, and taxes. */ + extras?: Webflow.OrderTotalsExtrasItem[]; + /** The total price */ + total?: Webflow.OrderPrice; +} diff --git a/src/api/types/OrderTotalsExtrasItem.ts b/src/api/types/OrderTotalsExtrasItem.ts new file mode 100644 index 00000000..20eefe25 --- /dev/null +++ b/src/api/types/OrderTotalsExtrasItem.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * Extra order items, includes discounts, shipping, and taxes. + */ +export interface OrderTotalsExtrasItem { + /** The type of extra item this is. */ + type?: Webflow.OrderTotalsExtrasItemType; + /** A human-readable (but English) name for this extra charge. */ + name?: string; + /** A human-readable (but English) description of this extra charge. */ + description?: string; + /** The price for the item */ + price?: Webflow.OrderPrice; +} diff --git a/src/api/types/OrderTotalsExtrasItemType.ts b/src/api/types/OrderTotalsExtrasItemType.ts new file mode 100644 index 00000000..2bb17a94 --- /dev/null +++ b/src/api/types/OrderTotalsExtrasItemType.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of extra item this is. + */ +export type OrderTotalsExtrasItemType = "discount" | "discount-shipping" | "shipping" | "tax"; + +export const OrderTotalsExtrasItemType = { + Discount: "discount", + DiscountShipping: "discount-shipping", + Shipping: "shipping", + Tax: "tax", +} as const; diff --git a/src/api/types/Page.ts b/src/api/types/Page.ts new file mode 100644 index 00000000..99c3f978 --- /dev/null +++ b/src/api/types/Page.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The Page object + */ +export interface Page { + /** Unique identifier for the Page */ + id?: string; + /** Unique identifier for the Site */ + siteId?: string; + /** Title of the Page */ + title?: string; + /** slug of the Page (derived from title) */ + slug?: string; + /** Identifier of the parent folder */ + parentId?: string; + /** Unique identifier for a linked Collection, value will be null if the Page is not part of a Collection. */ + collectionId?: string; + /** The date the Page was created */ + createdOn?: Date; + /** The date the Page was most recently updated */ + lastUpdated?: Date; + /** Whether the Page has been archived */ + archived?: boolean; + /** Whether the Page is a draft */ + draft?: boolean; + /** Indicates whether the Page supports [Page Branching](https://university.webflow.com/lesson/page-branching) */ + canBranch?: boolean; + /** Indicates whether the Page is restricted by [Memberships Controls](https://university.webflow.com/lesson/webflow-memberships-overview#how-to-manage-page-restrictions) */ + isMembersOnly?: boolean; + /** SEO-related fields for the Page */ + seo?: Webflow.PageSeo; + /** Open Graph fields for the Page */ + openGraph?: Webflow.PageOpenGraph; +} diff --git a/src/api/types/PageCreatedWebhook.ts b/src/api/types/PageCreatedWebhook.ts new file mode 100644 index 00000000..fc6d4cfc --- /dev/null +++ b/src/api/types/PageCreatedWebhook.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The Webhook payload for when a Page is created + */ +export interface PageCreatedWebhook { + siteId?: string; + pageId?: string; + pageTitle?: string; + createdAt?: Date; +} diff --git a/src/api/types/PageDeletedWebhook.ts b/src/api/types/PageDeletedWebhook.ts new file mode 100644 index 00000000..2603ec1e --- /dev/null +++ b/src/api/types/PageDeletedWebhook.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The Webhook payload for when a Page is deleted + */ +export interface PageDeletedWebhook { + siteId?: string; + pageId?: string; + pageTitle?: string; + deletedAt?: Date; +} diff --git a/src/api/types/PageList.ts b/src/api/types/PageList.ts new file mode 100644 index 00000000..1c57cabf --- /dev/null +++ b/src/api/types/PageList.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The Page object + */ +export interface PageList { + pages?: Webflow.Page[]; + pagination?: Webflow.Pagination; +} diff --git a/src/api/types/PageMetadataUpdatedWebhook.ts b/src/api/types/PageMetadataUpdatedWebhook.ts new file mode 100644 index 00000000..1e8e644a --- /dev/null +++ b/src/api/types/PageMetadataUpdatedWebhook.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The Webhook payload for when a Page's metadata is updated + */ +export interface PageMetadataUpdatedWebhook { + siteId?: string; + pageId?: string; + pageTitle?: string; + lastUpdated?: Date; +} diff --git a/src/api/types/PageOpenGraph.ts b/src/api/types/PageOpenGraph.ts new file mode 100644 index 00000000..f288a304 --- /dev/null +++ b/src/api/types/PageOpenGraph.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Open Graph fields for the Page + */ +export interface PageOpenGraph { + /** The title supplied to Open Graph annotations */ + title?: string; + /** Indicates the Open Graph title was copied from the SEO title */ + titleCopied?: boolean; + /** The description supplied to Open Graph annotations */ + description?: string; + /** Indicates the Open Graph description was copied from the SEO description */ + descriptionCopied?: boolean; +} diff --git a/src/api/types/PageSeo.ts b/src/api/types/PageSeo.ts new file mode 100644 index 00000000..42e5879b --- /dev/null +++ b/src/api/types/PageSeo.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * SEO-related fields for the Page + */ +export interface PageSeo { + /** The Page title shown in search engine results */ + title?: string; + /** The Page description shown in search engine results */ + description?: string; +} diff --git a/src/api/types/PageSeoGraphData.ts b/src/api/types/PageSeoGraphData.ts new file mode 100644 index 00000000..67d71638 --- /dev/null +++ b/src/api/types/PageSeoGraphData.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The SEO and/or OpenGraph information to include in the page's details + */ +export interface PageSeoGraphData { + seo?: Webflow.PageSeoGraphDataSeo; + openGraph?: Webflow.PageSeoGraphDataOpenGraph; +} diff --git a/src/api/types/PageSeoGraphDataOpenGraph.ts b/src/api/types/PageSeoGraphDataOpenGraph.ts new file mode 100644 index 00000000..215e105a --- /dev/null +++ b/src/api/types/PageSeoGraphDataOpenGraph.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PageSeoGraphDataOpenGraph { + title?: string; + description?: string; +} diff --git a/src/api/types/PageSeoGraphDataSeo.ts b/src/api/types/PageSeoGraphDataSeo.ts new file mode 100644 index 00000000..0d20c6f1 --- /dev/null +++ b/src/api/types/PageSeoGraphDataSeo.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PageSeoGraphDataSeo { + title?: string; + description?: string; +} diff --git a/src/api/types/Pagination.ts b/src/api/types/Pagination.ts new file mode 100644 index 00000000..1ee7cd06 --- /dev/null +++ b/src/api/types/Pagination.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Pagination object + */ +export interface Pagination { + /** The limit used for pagination */ + limit?: number; + /** The offset used for pagination */ + offset?: number; + /** The total number of records */ + total?: number; +} diff --git a/src/api/types/PaypalDetails.ts b/src/api/types/PaypalDetails.ts new file mode 100644 index 00000000..522ef66a --- /dev/null +++ b/src/api/types/PaypalDetails.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaypalDetails { + /** PayPal order identifier */ + orderId?: string; + /** PayPal payer identifier */ + payerId?: string; + /** PayPal capture identifier */ + captureId?: string; + /** PayPal refund identifier */ + refundId?: string; + /** PayPal-issued reason for the refund */ + refundReason?: string; + /** PayPal dispute identifier */ + disputeId?: string; +} diff --git a/src/api/types/Product.ts b/src/api/types/Product.ts new file mode 100644 index 00000000..95e3ebcd --- /dev/null +++ b/src/api/types/Product.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The Product object + */ +export interface Product { + /** Unique identifier for the Product */ + id?: string; + /** The date the Product was last published */ + lastPublished?: Date; + /** The date the Product was last updated */ + lastUpdated?: Date; + /** The date the Product was created */ + createdOn?: Date; + /** Boolean determining if the Product is set to archived */ + isArchived?: boolean; + /** Boolean determining if the Product is set to draft */ + isDraft?: boolean; + fieldData?: Webflow.ProductFieldData; +} diff --git a/src/api/types/ProductAndSkUs.ts b/src/api/types/ProductAndSkUs.ts new file mode 100644 index 00000000..1eb1d965 --- /dev/null +++ b/src/api/types/ProductAndSkUs.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * A product and its SKUs. + */ +export interface ProductAndSkUs { + product?: Webflow.Product; + skus?: Webflow.Sku[]; +} diff --git a/src/api/types/ProductAndSkUsList.ts b/src/api/types/ProductAndSkUsList.ts new file mode 100644 index 00000000..ed1b7417 --- /dev/null +++ b/src/api/types/ProductAndSkUsList.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * Results from product list + */ +export interface ProductAndSkUsList { + /** List of Item objects within the Collection. Contains product and skus keys for each Item */ + items?: Webflow.ProductAndSkUs[]; + pagination?: Webflow.Pagination; +} diff --git a/src/api/types/ProductFieldData.ts b/src/api/types/ProductFieldData.ts new file mode 100644 index 00000000..a8aac632 --- /dev/null +++ b/src/api/types/ProductFieldData.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface ProductFieldData { + /** Name of the Product */ + name?: string; + /** URL structure of the Product in your site. */ + slug?: string; + /** Variant/Options types to include in SKUs */ + skuProperties?: Webflow.SkuPropertyList[]; +} diff --git a/src/api/types/PublishStatus.ts b/src/api/types/PublishStatus.ts new file mode 100644 index 00000000..e699101b --- /dev/null +++ b/src/api/types/PublishStatus.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Publish target + */ +export type PublishStatus = "staging" | "live"; + +export const PublishStatus = { + Staging: "staging", + Live: "live", +} as const; diff --git a/src/api/types/PublishedItems.ts b/src/api/types/PublishedItems.ts new file mode 100644 index 00000000..08317f1e --- /dev/null +++ b/src/api/types/PublishedItems.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A list of items published + */ +export interface PublishedItems { + /** Array of published item ids */ + publishedItemIds?: string[]; + /** Array of errors */ + errors?: string[]; +} diff --git a/src/api/types/PublishedSite.ts b/src/api/types/PublishedSite.ts new file mode 100644 index 00000000..d7504deb --- /dev/null +++ b/src/api/types/PublishedSite.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PublishedSite { + /** Indicates if the site has been queued for publish */ + queued: boolean; +} diff --git a/src/api/types/RegisteredScriptList.ts b/src/api/types/RegisteredScriptList.ts new file mode 100644 index 00000000..43989d86 --- /dev/null +++ b/src/api/types/RegisteredScriptList.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface RegisteredScriptList { + registeredScripts?: Webflow.CustomCodeResponse[]; +} diff --git a/src/api/types/RemovedItems.ts b/src/api/types/RemovedItems.ts new file mode 100644 index 00000000..4929ebba --- /dev/null +++ b/src/api/types/RemovedItems.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A list of items removed + */ +export interface RemovedItems { + /** Array of deleted item ids */ + deletedItemIds?: string[]; + /** Array of errors */ + errors?: string[]; +} diff --git a/src/api/types/ScriptApply.ts b/src/api/types/ScriptApply.ts new file mode 100644 index 00000000..c2944123 --- /dev/null +++ b/src/api/types/ScriptApply.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface ScriptApply { + /** Id of the registered custom code script */ + id: string; + /** Location of the script, either in the header or footer of the published site */ + location: Webflow.ScriptApplyLocation; + /** Semantic Version String for the registered script _e.g. 0.0.1_ */ + version: string; + /** Developer-specified key/value pairs to be applied as attributes to the script */ + attributes?: Record; +} diff --git a/src/api/types/ScriptApplyList.ts b/src/api/types/ScriptApplyList.ts new file mode 100644 index 00000000..52df5695 --- /dev/null +++ b/src/api/types/ScriptApplyList.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface ScriptApplyList { + scripts?: Webflow.ScriptApply[]; + /** Date when the Site's scripts were last updated */ + lastUpdated?: string; + /** Date when the Site's scripts were created */ + createdOn?: string; +} diff --git a/src/api/types/ScriptApplyLocation.ts b/src/api/types/ScriptApplyLocation.ts new file mode 100644 index 00000000..327a4b78 --- /dev/null +++ b/src/api/types/ScriptApplyLocation.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Location of the script, either in the header or footer of the published site + */ +export type ScriptApplyLocation = "header" | "footer"; + +export const ScriptApplyLocation = { + Header: "header", + Footer: "footer", +} as const; diff --git a/src/api/types/Site.ts b/src/api/types/Site.ts new file mode 100644 index 00000000..1db7dffd --- /dev/null +++ b/src/api/types/Site.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface Site { + /** Unique identifier for the Site */ + id: string; + /** Unique identifier for the Workspace */ + workspaceId?: string; + /** Date the Site was created */ + createdOn?: Date; + /** Name given to Site */ + displayName?: string; + /** Slugified version of name */ + shortName?: string; + /** Date the Site was last published */ + lastPublished?: Date; + /** Date the Site was last updated */ + lastUpdated?: Date; + /** URL of a generated image for the given Site */ + previewUrl?: string; + /** Site timezone set under Site Settings */ + timeZone?: string; + customDomains?: Webflow.Domain[]; +} diff --git a/src/api/types/SiteActivityLogItem.ts b/src/api/types/SiteActivityLogItem.ts new file mode 100644 index 00000000..550a0ce0 --- /dev/null +++ b/src/api/types/SiteActivityLogItem.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface SiteActivityLogItem { + id?: string; + createdOn?: Date; + lastUpdated?: Date; + event?: string; + resourceOperation?: Webflow.SiteActivityLogItemResourceOperation; + user?: string; + resourceId?: string; + resourceName?: string; + newValue?: string; + previousValue?: string; + payload?: Record; +} diff --git a/src/api/types/SiteActivityLogItemResourceOperation.ts b/src/api/types/SiteActivityLogItemResourceOperation.ts new file mode 100644 index 00000000..77ebc3c3 --- /dev/null +++ b/src/api/types/SiteActivityLogItemResourceOperation.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type SiteActivityLogItemResourceOperation = "CREATED" | "MODIFIED" | "PUBLISHED" | "UNPUBLISHED" | "DELETED"; + +export const SiteActivityLogItemResourceOperation = { + Created: "CREATED", + Modified: "MODIFIED", + Published: "PUBLISHED", + Unpublished: "UNPUBLISHED", + Deleted: "DELETED", +} as const; diff --git a/src/api/types/SiteActivityLogResponse.ts b/src/api/types/SiteActivityLogResponse.ts new file mode 100644 index 00000000..a2ef3f97 --- /dev/null +++ b/src/api/types/SiteActivityLogResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface SiteActivityLogResponse { + items?: Webflow.SiteActivityLogItem[]; + pagination?: Webflow.Pagination; +} diff --git a/src/api/types/SitePublish.ts b/src/api/types/SitePublish.ts new file mode 100644 index 00000000..18a4eec2 --- /dev/null +++ b/src/api/types/SitePublish.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface SitePublish { + /** The payload of data sent from Webflow */ + payload?: Webflow.SitePublishPayload; +} diff --git a/src/api/types/SitePublishPayload.ts b/src/api/types/SitePublishPayload.ts new file mode 100644 index 00000000..12b5aa41 --- /dev/null +++ b/src/api/types/SitePublishPayload.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The payload of data sent from Webflow + */ +export interface SitePublishPayload { + /** The site id that was published */ + site?: string; + /** The timestamp of the publish event */ + publishTime?: Date; + /** The domains that were published */ + domains?: string[]; + /** The name and id of the user who published the site */ + publishedBy?: Record; +} diff --git a/src/api/types/Sites.ts b/src/api/types/Sites.ts new file mode 100644 index 00000000..5620b5c6 --- /dev/null +++ b/src/api/types/Sites.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface Sites { + sites?: Webflow.Site[]; +} diff --git a/src/api/types/Sku.ts b/src/api/types/Sku.ts new file mode 100644 index 00000000..5ba71dff --- /dev/null +++ b/src/api/types/Sku.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The SKU object + */ +export interface Sku { + /** Unique identifier for the Product */ + id?: string; + /** The date the Product was last published */ + lastPublished?: Date; + /** The date the Product was last updated */ + lastUpdated?: Date; + /** The date the Product was created */ + createdOn?: Date; + fieldData?: Webflow.SkuFieldData; +} diff --git a/src/api/types/SkuFieldData.ts b/src/api/types/SkuFieldData.ts new file mode 100644 index 00000000..0128150a --- /dev/null +++ b/src/api/types/SkuFieldData.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface SkuFieldData { + /** Name of the Product */ + name?: string; + /** URL structure of the Product in your site. */ + slug?: string; + /** price of SKU */ + price?: Webflow.SkuFieldDataPrice; + skuValues?: Webflow.SkuValueList; +} diff --git a/src/api/types/SkuFieldDataPrice.ts b/src/api/types/SkuFieldDataPrice.ts new file mode 100644 index 00000000..3266db3a --- /dev/null +++ b/src/api/types/SkuFieldDataPrice.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * price of SKU + */ +export interface SkuFieldDataPrice { + /** Price of SKU */ + value?: number; + /** Currency of Item */ + unit?: string; +} diff --git a/src/api/types/SkuPropertyList.ts b/src/api/types/SkuPropertyList.ts new file mode 100644 index 00000000..8aa1d0ad --- /dev/null +++ b/src/api/types/SkuPropertyList.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * A variant/option type for a SKU + */ +export interface SkuPropertyList { + /** Unique identifier for a collection of Product options/Variants */ + id?: string; + /** Name of the collection of Product options/Variants */ + name?: string; + /** The individual Product variants/Options that are contained within the collection */ + enum?: Webflow.SkuPropertyListEnumItem[]; +} diff --git a/src/api/types/SkuPropertyListEnumItem.ts b/src/api/types/SkuPropertyListEnumItem.ts new file mode 100644 index 00000000..b4843f2b --- /dev/null +++ b/src/api/types/SkuPropertyListEnumItem.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enumerated Product variants/Options for the SKU + */ +export interface SkuPropertyListEnumItem { + /** Unique identifier for a Product variant/Option */ + id?: string; + /** Name of the Product variant/Option */ + name?: string; + /** Slug for the Product variant/Option in the Site URL structure */ + slug?: string; +} diff --git a/src/api/types/SkuValueList.ts b/src/api/types/SkuValueList.ts new file mode 100644 index 00000000..a090b5d2 --- /dev/null +++ b/src/api/types/SkuValueList.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A dictionary that maps a SKU property to a SKU value. The key of the dictionary is the SKU property ID, and the value is the SKU value ID. + */ +export type SkuValueList = Record; diff --git a/src/api/types/StripeCard.ts b/src/api/types/StripeCard.ts new file mode 100644 index 00000000..07c88284 --- /dev/null +++ b/src/api/types/StripeCard.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * Details on the card used to fulfill this order, if this order was finalized with Stripe. + */ +export interface StripeCard { + /** The last 4 digits on the card as a string */ + last4?: string; + /** The card's brand (ie. credit card network) */ + brand?: Webflow.StripeCardBrand; + /** The name on the card. */ + ownerName?: string; + /** The card's expiration date. */ + expires?: Webflow.StripeCardExpires; +} diff --git a/src/api/types/StripeCardBrand.ts b/src/api/types/StripeCardBrand.ts new file mode 100644 index 00000000..7a333f7a --- /dev/null +++ b/src/api/types/StripeCardBrand.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The card's brand (ie. credit card network) + */ +export type StripeCardBrand = + | "Visa" + | "American Express" + | "MasterCard" + | "Discover" + | "JCB" + | "Diners Club" + | "Unknown"; + +export const StripeCardBrand = { + Visa: "Visa", + AmericanExpress: "American Express", + MasterCard: "MasterCard", + Discover: "Discover", + Jcb: "JCB", + DinersClub: "Diners Club", + Unknown: "Unknown", +} as const; diff --git a/src/api/types/StripeCardExpires.ts b/src/api/types/StripeCardExpires.ts new file mode 100644 index 00000000..219a0924 --- /dev/null +++ b/src/api/types/StripeCardExpires.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The card's expiration date. + */ +export interface StripeCardExpires { + /** Year that the card expires */ + year?: number; + /** Month that the card expires */ + month?: number; +} diff --git a/src/api/types/StripeDetails.ts b/src/api/types/StripeDetails.ts new file mode 100644 index 00000000..f0e4f937 --- /dev/null +++ b/src/api/types/StripeDetails.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An object with various Stripe IDs, useful for linking into the stripe dashboard. + */ +export interface StripeDetails { + /** Stripe-generated identifier for the Subscription */ + subscriptionId?: string; + /** Stripe-generated identifier for the PaymentMethod used */ + paymentMethod?: string; + /** Stripe-generated identifier for the PaymentIntent, or null */ + paymentIntentId?: string; + /** Stripe-generated customer identifier, or null */ + customerId?: string; + /** Stripe-generated charge identifier, or null */ + chargeId?: string; + /** Stripe-generated dispute identifier, or null */ + disputeId?: string; + /** Stripe-generated refund identifier, or null */ + refundId?: string; + /** Stripe-generated refund reason, or null */ + refundReason?: string; +} diff --git a/src/api/types/TriggerType.ts b/src/api/types/TriggerType.ts new file mode 100644 index 00000000..771c4e92 --- /dev/null +++ b/src/api/types/TriggerType.ts @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * - `form_submission` - Sends the [form_submission](#form_submission) event + * - `site_publish` - Sends a [site_publish](#site_publish) event + * - `page_created` - Send the [page_created](#page_created) event + * - `page_metadata_updated` - Sends the [page_metadata_updated](#page_metadata_updated) event + * - `page_deleted` - Sends the [page_deleted](#page_deleted) event + * - `ecomm_new_order` - Sends the new [ecomm_new_order](#ecomm_new_order) event + * - `ecomm_order_changed` - Sends the [ecomm_order_changed](#ecomm_order_changed) event + * - `ecomm_inventory_changed` - Sends the [ecomm_inventory_changed](#ecomm_inventory_changed) event + * - `user_account_added` - Sends the [user_account_added](#user_account_added) event + * - `user_account_updated` - Sends the [user_account_updated](#user_account_updated) event + * - `user_account_deleted` - Sends the [user_account_deleted](#user_account_deleted) event + * - `collection_item_created` - Sends the [collection_item_created](#collection_item_created) event + * - `collection_item_changed` - Sends the [collection_item_changed](#collection_item_changed) event + * - `collection_item_deleted` - Sends the [collection_item_deleted](#collection_item_deleted) event + * - `collection_item_unpublished` - Sends the [collection_item_unpublished](#collection_item_unpublished) event + */ +export type TriggerType = + | "form_submission" + | "site_publish" + | "page_created" + | "page_metadata_updated" + | "page_deleted" + | "ecomm_new_order" + | "ecomm_order_changed" + | "ecomm_inventory_changed" + | "user_account_added" + | "user_account_updated" + | "user_account_deleted" + | "collection_item_created" + | "collection_item_changed" + | "collection_item_deleted" + | "collection_item_unpublished"; + +export const TriggerType = { + FormSubmission: "form_submission", + SitePublish: "site_publish", + PageCreated: "page_created", + PageMetadataUpdated: "page_metadata_updated", + PageDeleted: "page_deleted", + EcommNewOrder: "ecomm_new_order", + EcommOrderChanged: "ecomm_order_changed", + EcommInventoryChanged: "ecomm_inventory_changed", + UserAccountAdded: "user_account_added", + UserAccountUpdated: "user_account_updated", + UserAccountDeleted: "user_account_deleted", + CollectionItemCreated: "collection_item_created", + CollectionItemChanged: "collection_item_changed", + CollectionItemDeleted: "collection_item_deleted", + CollectionItemUnpublished: "collection_item_unpublished", +} as const; diff --git a/src/api/types/User.ts b/src/api/types/User.ts new file mode 100644 index 00000000..8933e298 --- /dev/null +++ b/src/api/types/User.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The fields that define the schema for a given Item are based on the Collection that Item belongs to. Beyond the user defined fields, there are a handful of additional fields that are automatically created for all items + */ +export interface User { + /** Unique identifier for the User */ + id?: string; + /** Shows whether the user has verified their email address */ + isEmailVerified?: boolean; + /** The timestamp the user was updated */ + lastUpdated?: Date; + /** The timestamp the user was invited */ + invitedOn?: Date; + /** The timestamp the user was created */ + createdOn?: Date; + /** The timestamp the user was logged in */ + lastLogin?: Date; + /** The status of the user */ + status?: Webflow.UserStatus; + /** Access groups the user belongs to */ + accessGroups?: Webflow.UserAccessGroupsItem[]; + data?: Webflow.UserData; +} diff --git a/src/api/types/UserAccessGroupsItem.ts b/src/api/types/UserAccessGroupsItem.ts new file mode 100644 index 00000000..57516a4c --- /dev/null +++ b/src/api/types/UserAccessGroupsItem.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * Access group slugs and types + */ +export interface UserAccessGroupsItem { + /** Access group identifier for APIs */ + slug?: string; + /** + * The type of access group based on how it was assigned to the user. + * + * - `admin` - Assigned to the user via API or in the designer + * - `ecommerce` - Assigned to the user via an ecommerce purchase + */ + type?: Webflow.UserAccessGroupsItemType; +} diff --git a/src/api/types/UserAccessGroupsItemType.ts b/src/api/types/UserAccessGroupsItemType.ts new file mode 100644 index 00000000..0057bea9 --- /dev/null +++ b/src/api/types/UserAccessGroupsItemType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of access group based on how it was assigned to the user. + * + * - `admin` - Assigned to the user via API or in the designer + * - `ecommerce` - Assigned to the user via an ecommerce purchase + */ +export type UserAccessGroupsItemType = "admin" | "ecommerce"; + +export const UserAccessGroupsItemType = { + Admin: "admin", + Ecommerce: "ecommerce", +} as const; diff --git a/src/api/types/UserData.ts b/src/api/types/UserData.ts new file mode 100644 index 00000000..ff309365 --- /dev/null +++ b/src/api/types/UserData.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * An object containing the User's basic info and custom fields + */ +export interface UserData { + data?: Webflow.UserDataData; +} diff --git a/src/api/types/UserDataData.ts b/src/api/types/UserDataData.ts new file mode 100644 index 00000000..ad23a6ca --- /dev/null +++ b/src/api/types/UserDataData.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface UserDataData { + /** The name of the user */ + name?: string; + /** The email address of the user */ + email?: string; + /** Boolean indicating if the user has accepted the privacy policy */ + acceptPrivacy?: boolean; + /** Boolean indicating if the user has accepted to receive communications */ + acceptCommunications?: boolean; + /** Custom user attributes */ + additionalProperties?: string; +} diff --git a/src/api/types/UserLimitReached.ts b/src/api/types/UserLimitReached.ts new file mode 100644 index 00000000..712f0a4a --- /dev/null +++ b/src/api/types/UserLimitReached.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface UserLimitReached { + code?: "user_limit_reached"; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/UserList.ts b/src/api/types/UserList.ts new file mode 100644 index 00000000..e11fd979 --- /dev/null +++ b/src/api/types/UserList.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +/** + * The list users results + */ +export interface UserList { + /** Number of users returned */ + count?: number; + /** The limit specified in the request */ + limit?: number; + /** The offset specified for pagination */ + offset?: number; + /** Total number of users in the collection */ + total?: number; + /** List of Users for a Site */ + users?: Webflow.User[]; +} diff --git a/src/api/types/UserStatus.ts b/src/api/types/UserStatus.ts new file mode 100644 index 00000000..ccf9ae40 --- /dev/null +++ b/src/api/types/UserStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The status of the user + */ +export type UserStatus = "invited" | "verified" | "unverified"; + +export const UserStatus = { + Invited: "invited", + Verified: "verified", + Unverified: "unverified", +} as const; diff --git a/src/api/types/UserWebhookPayload.ts b/src/api/types/UserWebhookPayload.ts new file mode 100644 index 00000000..c63d4cab --- /dev/null +++ b/src/api/types/UserWebhookPayload.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface UserWebhookPayload { + /** The type of event that triggered the request */ + triggerType?: Webflow.UserWebhookPayloadTriggerType; + payload?: Webflow.User; +} diff --git a/src/api/types/UserWebhookPayloadTriggerType.ts b/src/api/types/UserWebhookPayloadTriggerType.ts new file mode 100644 index 00000000..8c315409 --- /dev/null +++ b/src/api/types/UserWebhookPayloadTriggerType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of event that triggered the request + */ +export type UserWebhookPayloadTriggerType = "user_account_added" | "user_account_updated" | "user_account_deleted"; + +export const UserWebhookPayloadTriggerType = { + UserAccountAdded: "user_account_added", + UserAccountUpdated: "user_account_updated", + UserAccountDeleted: "user_account_deleted", +} as const; diff --git a/src/api/types/UsersNotEnabled.ts b/src/api/types/UsersNotEnabled.ts new file mode 100644 index 00000000..8f1d9a3b --- /dev/null +++ b/src/api/types/UsersNotEnabled.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface UsersNotEnabled { + code?: "users_not_enabled"; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/Webhook.ts b/src/api/types/Webhook.ts new file mode 100644 index 00000000..45f57482 --- /dev/null +++ b/src/api/types/Webhook.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface Webhook { + /** Unique identifier for the Webhook registration */ + id?: string; + /** Unique identifier for the Workspace the Webhook is registered in */ + workspaceId?: string; + /** Unique identifier for the Site the Webhook is registered in */ + siteId?: string; + triggerType?: Webflow.TriggerType; + /** Filter for selecting which events you want Webhooks to be sent for. Only supported for form_submission trigger types. */ + filter?: Record; + /** Date the Webhook instance was last triggered */ + lastTriggered?: Date; + /** Date the Webhook registration was created */ + createdOn?: Date; + /** URL to send the Webhook payload to */ + url?: string; +} diff --git a/src/api/types/WebhookList.ts b/src/api/types/WebhookList.ts new file mode 100644 index 00000000..5a9549d9 --- /dev/null +++ b/src/api/types/WebhookList.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from ".."; + +export interface WebhookList { + pagination?: Webflow.Pagination; + webhooks?: Webflow.Webhook[]; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts new file mode 100644 index 00000000..29b5c8ca --- /dev/null +++ b/src/api/types/index.ts @@ -0,0 +1,123 @@ +export * from "./OauthScope"; +export * from "./AuthorizedUser"; +export * from "./AuthorizationAuthorizationAuthorizedTo"; +export * from "./AuthorizationAuthorization"; +export * from "./Authorization"; +export * from "./Pagination"; +export * from "./PublishStatus"; +export * from "./CustomCodeResponse"; +export * from "./RegisteredScriptList"; +export * from "./ScriptApplyList"; +export * from "./ScriptApplyLocation"; +export * from "./ScriptApply"; +export * from "./ListCustomCodeBlocks"; +export * from "./CustomCodeBlockType"; +export * from "./CustomCodeBlock"; +export * from "./PageList"; +export * from "./PageSeo"; +export * from "./PageOpenGraph"; +export * from "./Page"; +export * from "./PageCreatedWebhook"; +export * from "./PageMetadataUpdatedWebhook"; +export * from "./PageDeletedWebhook"; +export * from "./PageSeoGraphDataSeo"; +export * from "./PageSeoGraphDataOpenGraph"; +export * from "./PageSeoGraphData"; +export * from "./CollectionList"; +export * from "./CollectionListArrayItem"; +export * from "./Collection"; +export * from "./Fields"; +export * from "./FieldType"; +export * from "./Field"; +export * from "./CollectionItemFieldData"; +export * from "./CollectionItem"; +export * from "./CollectionItemListPagination"; +export * from "./CollectionItemList"; +export * from "./Webhook"; +export * from "./WebhookList"; +export * from "./TriggerType"; +export * from "./CollectionItemRemoved"; +export * from "./Sites"; +export * from "./Site"; +export * from "./Domain"; +export * from "./SitePublishPayload"; +export * from "./SitePublish"; +export * from "./SiteActivityLogResponse"; +export * from "./SiteActivityLogItemResourceOperation"; +export * from "./SiteActivityLogItem"; +export * from "./Assets"; +export * from "./Asset"; +export * from "./AssetVariant"; +export * from "./AssetUploadUploadDetails"; +export * from "./AssetUpload"; +export * from "./AssetFolder"; +export * from "./AssetFolderList"; +export * from "./FormFieldValueType"; +export * from "./FormFieldValue"; +export * from "./FormField"; +export * from "./FormResponseSettings"; +export * from "./Form"; +export * from "./FormList"; +export * from "./FormSubmission"; +export * from "./FormSubmissionList"; +export * from "./FormSubmissionTriggerPayload"; +export * from "./FormSubmissionTrigger"; +export * from "./Application"; +export * from "./PublishedSite"; +export * from "./PublishedItems"; +export * from "./RemovedItems"; +export * from "./UserStatus"; +export * from "./UserAccessGroupsItemType"; +export * from "./UserAccessGroupsItem"; +export * from "./User"; +export * from "./UserDataData"; +export * from "./UserData"; +export * from "./UserList"; +export * from "./UserWebhookPayloadTriggerType"; +export * from "./UserWebhookPayload"; +export * from "./AccessGroup"; +export * from "./AccessGroupList"; +export * from "./ErrorDetailsItem"; +export * from "./UsersNotEnabled"; +export * from "./DuplicateUserEmail"; +export * from "./UserLimitReached"; +export * from "./MissingScopes"; +export * from "./ProductFieldData"; +export * from "./Product"; +export * from "./SkuFieldDataPrice"; +export * from "./SkuFieldData"; +export * from "./Sku"; +export * from "./ProductAndSkUs"; +export * from "./ProductAndSkUsList"; +export * from "./SkuPropertyListEnumItem"; +export * from "./SkuPropertyList"; +export * from "./SkuValueList"; +export * from "./OrderStatus"; +export * from "./OrderDisputeLastStatus"; +export * from "./OrderCustomerInfo"; +export * from "./OrderMetadata"; +export * from "./OrderTotalsExtrasItemType"; +export * from "./OrderTotalsExtrasItem"; +export * from "./OrderTotals"; +export * from "./OrderDownloadFilesItem"; +export * from "./Order"; +export * from "./OrderList"; +export * from "./OrderPrice"; +export * from "./OrderAddressType"; +export * from "./OrderAddressJapanType"; +export * from "./OrderAddress"; +export * from "./OrderPurchasedItemVariantImageFileVariantsItem"; +export * from "./OrderPurchasedItemVariantImageFile"; +export * from "./OrderPurchasedItemVariantImage"; +export * from "./OrderPurchasedItem"; +export * from "./StripeDetails"; +export * from "./StripeCardBrand"; +export * from "./StripeCardExpires"; +export * from "./StripeCard"; +export * from "./PaypalDetails"; +export * from "./InventoryItemInventoryType"; +export * from "./InventoryItem"; +export * from "./EcommerceSettings"; +export * from "./Error_"; +export * from "./InvalidDomain"; +export * from "./NoDomains"; diff --git a/src/api/user.ts b/src/api/user.ts deleted file mode 100644 index df4d77e5..00000000 --- a/src/api/user.ts +++ /dev/null @@ -1,192 +0,0 @@ -import { AxiosInstance } from "axios"; -import { PaginatedData, requireArgs, WebflowRecord } from "../core"; - -/************************************************************** - * Interfaces - **************************************************************/ -export interface IUser { - emailVerified: boolean; - lastUpdated?: string; - createdOn: string; - _id: string; - data: any; -} - -export interface IAcessGroup { - _id: string; - name: string; - shortId: string; - slug: string; - createdOn: string; -} - -export interface IUserDelete { - deleted: number; -} - -/************************************************************** - * Types - **************************************************************/ -export type PaginatedUsers = PaginatedData & { - users: IUser[]; -}; - -export type PaginatedAccessGroups = PaginatedData & { - accessGroups: IAcessGroup[]; -}; - -export type UserIdParam = { siteId: string; userId: string }; - -/************************************************************** - * Class - **************************************************************/ - -export class User extends WebflowRecord implements IUser { - emailVerified: boolean; - lastUpdated?: string; - createdOn: string; - siteId: string; - _id: string; - data: any; - - /************************************************************** - * Static Methods - **************************************************************/ - - /** - * Get a list of Users - * @param params The params for the request - * @param params.siteId The site ID - * @param params.limit The number of items to return (optional) - * @param params.offset The number of items to skip (optional) - * @param client The Axios client instance - * @returns A list of Users - */ - static list( - { siteId, limit, offset }: { siteId: string; limit?: number; offset?: number }, - client: AxiosInstance, - ) { - requireArgs({ siteId }); - const params = { limit, offset }; - const path = `/sites/${siteId}/users`; - return client.get(path, { params }); - } - - /** - * Get a single User - * @param params The params for the request - * @param params.siteId The site ID - * @param params.userId The user ID - * @param client The Axios client instance - * @returns A single User - */ - static getOne({ siteId, userId }: { siteId: string; userId: string }, client: AxiosInstance) { - requireArgs({ siteId, userId }); - const path = `/sites/${siteId}/users/${userId}`; - return client.get(path); - } - - /** - * Update a User - * @param params The params for the request - * @param params.siteId The site ID - * @param params.userId The user ID - * @param params.data The data to update - * @param client The Axios client instance - * @returns The updated User - */ - static update( - { - siteId, - userId, - data, - }: { - data: object; - siteId: string; - userId: string; - }, - client: AxiosInstance, - ) { - requireArgs({ siteId, userId }); - const path = `/sites/${siteId}/users/${userId}`; - return client.patch(path, data); - } - - /** - * Invite a User to a site - * @param params The params for the request - * @param params.siteId The site ID - * @param params.email The email address of the user to invite - * @param client The Axios client instance - * @returns The newly created User - */ - static async invite({ siteId, email }: { siteId: string; email: string }, client: AxiosInstance) { - requireArgs({ siteId, email }); - const path = `/sites/${siteId}/users/invite`; - return client.post(path, { email }); - } - - /** - * Remove a User - * @param params The params for the request - * @param params.siteId The site ID - * @param params.userId The user ID - * @param client The Axios client instance - * @returns The result of the remove - */ - static remove({ siteId, userId }: { siteId: string; userId: string }, client: AxiosInstance) { - requireArgs({ siteId, userId }); - const path = `/sites/${siteId}/users/${userId}`; - return client.delete(path); - } - - /** - * Get a list of User Access Groups - * @param params The params for the request - * @param params.siteId The site ID - * @param params.limit The number of items to return (optional) - * @param params.offset The number of items to skip (optional) - * @param params.sort The sort order of the groups (optional) - * @param client The Axios client instance - * @returns A list of Access Groups - */ - static accessGroups( - { - siteId, - limit, - offset, - sort, - }: { siteId: string; limit?: number; offset?: number; sort?: string }, - client: AxiosInstance, - ) { - requireArgs({ siteId }); - const params = { limit, offset, sort }; - const path = `/sites/${siteId}/accessgroups`; - return client.get(path, { params }); - } - - /************************************************************** - * Instance Methods - **************************************************************/ - - /** - * Update a User - * @param data The data to update - * @returns The updated User - */ - async update(data: any) { - const params = { siteId: this.siteId, userId: this._id, data }; - const res = await User.update(params, this.client); - return new User(this.client, res); - } - - /** - * Remove a User - * @returns The result of the remove - */ - async remove() { - const params = { siteId: this.siteId, userId: this._id }; - const res = await User.remove(params, this.client); - return res.data; - } -} diff --git a/src/api/webhook.ts b/src/api/webhook.ts deleted file mode 100644 index 7af10f04..00000000 --- a/src/api/webhook.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { AxiosInstance } from "axios"; -import { requireArgs, WebflowRecord } from "../core"; - -/************************************************************** - * Types - **************************************************************/ -export type TriggerType = - | "form_submission" - | "site_publish" - | "ecomm_new_order" - | "ecomm_order_changed" - | "ecomm_inventory_changed" - | "collection_item_created" - | "collection_item_changed" - | "collection_item_deleted" - | string; - -export type WebhookFilter = { - name: string; -}; - -/************************************************************** - * Interfaces - **************************************************************/ -export interface IWebhook { - triggerType: TriggerType; - triggerId: string; - createdOn: string; - lastUsed?: string; - site: string; - _id: string; - filter?: { - name: string; - }; -} - -export interface IRemoveResult { - deleted: number; -} - -/************************************************************** - * Class - **************************************************************/ -export class Webhook extends WebflowRecord implements IWebhook { - filter?: { name: string }; - triggerType: string; - triggerId: string; - createdOn: string; - lastUsed?: string; - site: string; - _id: string; - - /************************************************************** - * Static Methods - **************************************************************/ - - /** - * Get a list of Webhooks - * @param params The params for the request - * @param params.siteId The site ID - * @param client The Axios client instance - * @returns A list of Webhooks - */ - static list({ siteId }: { siteId: string }, client: AxiosInstance) { - requireArgs({ siteId }); - const path = `/sites/${siteId}/webhooks`; - return client.get(path); - } - - /** - * Get a single Webhook - * @param params The params for the request - * @param params.siteId The site ID - * @param params.webhookId The webhook ID - * @param client The Axios client instance - * @returns A single Webhook - */ - static getOne( - { siteId, webhookId }: { siteId: string; webhookId: string }, - client: AxiosInstance, - ) { - requireArgs({ siteId, webhookId }); - const path = `/sites/${siteId}/webhooks/${webhookId}`; - return client.get(path); - } - - /** - * Create a new Webhook - * @param params The params for the request - * @param params.siteId The site ID - * @param params.url The URL to send the webhook to - * @param params.triggerType The event to trigger the webhook - * @param params.filter The filter to apply to the webhook (optional: form_submission only) - * @param params.params The query string parameters (optional) - * @param client The Axios client instance - * @returns The created webhook - */ - static create( - { - triggerType, - siteId, - filter, - url, - }: { - url: string; - siteId: string; - filter?: WebhookFilter; - triggerType: TriggerType; - }, - client: AxiosInstance, - ) { - requireArgs({ siteId, triggerType, url }); - const path = `/sites/${siteId}/webhooks`; - const data = { triggerType, url, filter }; - return client.post(path, data); - } - - /** - * Remove a Webhook - * @param params The query string parameters (optional) - * @param params.webhookId The Webhook ID - * @param params.siteId The Site ID - * @param client The Axios client instance - * @returns The result of the removal - */ - static remove( - { siteId, webhookId }: { siteId: string; webhookId: string }, - client: AxiosInstance, - ) { - requireArgs({ siteId, webhookId }); - const path = `/sites/${siteId}/webhooks/${webhookId}`; - return client.delete(path); - } - - /************************************************************** - * Instance Methods - **************************************************************/ - - /** - * Remove a Webhook - * @returns The result of the removal - */ - async remove() { - const params = { siteId: this.site, webhookId: this._id }; - const res = await Webhook.remove(params, this.client); - return res.data; - } -} diff --git a/src/core/auth/BasicAuth.ts b/src/core/auth/BasicAuth.ts new file mode 100644 index 00000000..146df215 --- /dev/null +++ b/src/core/auth/BasicAuth.ts @@ -0,0 +1,31 @@ +import { Base64 } from "js-base64"; + +export interface BasicAuth { + username: string; + password: string; +} + +const BASIC_AUTH_HEADER_PREFIX = /^Basic /i; + +export const BasicAuth = { + toAuthorizationHeader: (basicAuth: BasicAuth | undefined): string | undefined => { + if (basicAuth == null) { + return undefined; + } + const token = Base64.encode(`${basicAuth.username}:${basicAuth.password}`); + return `Basic ${token}`; + }, + fromAuthorizationHeader: (header: string): BasicAuth => { + const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, ""); + const decoded = Base64.decode(credentials); + const [username, password] = decoded.split(":", 2); + + if (username == null || password == null) { + throw new Error("Invalid basic auth"); + } + return { + username, + password, + }; + }, +}; diff --git a/src/core/auth/BearerToken.ts b/src/core/auth/BearerToken.ts new file mode 100644 index 00000000..fe987fc9 --- /dev/null +++ b/src/core/auth/BearerToken.ts @@ -0,0 +1,15 @@ +export type BearerToken = string; + +const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i; + +export const BearerToken = { + toAuthorizationHeader: (token: BearerToken | undefined): string | undefined => { + if (token == null) { + return undefined; + } + return `Bearer ${token}`; + }, + fromAuthorizationHeader: (header: string): BearerToken => { + return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim() as BearerToken; + }, +}; diff --git a/src/core/auth/index.ts b/src/core/auth/index.ts new file mode 100644 index 00000000..ee293b34 --- /dev/null +++ b/src/core/auth/index.ts @@ -0,0 +1,2 @@ +export { BasicAuth } from "./BasicAuth"; +export { BearerToken } from "./BearerToken"; diff --git a/src/core/error.ts b/src/core/error.ts deleted file mode 100644 index cdd8dd34..00000000 --- a/src/core/error.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { AxiosResponse } from "axios"; - -export interface IRequestError { - msg: string; - code: number; - name: string; - path: string; - err: string; -} - -export class RequestError extends Error implements IRequestError { - msg: string; - code: number; - name: string; - path: string; - err: string; - - constructor(error: IRequestError) { - super(error.err ? error.err : "Unknown error occurred"); - Object.assign(this, error); - } -} - -export class ArgumentError extends Error { - constructor(name: string) { - super(`Argument '${name}' is required but was not present`); - } -} - -export function requireArgs(args: object) { - for (const key in args) { - if (!args[key]) throw new ArgumentError(key); - } -} - -// throw an error if Webflow error -export function ErrorInterceptor(res: AxiosResponse) { - if (res.data.err) throw new RequestError(res.data); - return res; -} diff --git a/src/core/fetcher/APIResponse.ts b/src/core/fetcher/APIResponse.ts new file mode 100644 index 00000000..3664d09e --- /dev/null +++ b/src/core/fetcher/APIResponse.ts @@ -0,0 +1,12 @@ +export type APIResponse = SuccessfulResponse | FailedResponse; + +export interface SuccessfulResponse { + ok: true; + body: T; + headers?: Record; +} + +export interface FailedResponse { + ok: false; + error: T; +} diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts new file mode 100644 index 00000000..e25819af --- /dev/null +++ b/src/core/fetcher/Fetcher.ts @@ -0,0 +1,181 @@ +import { default as FormData } from "form-data"; +import qs from "qs"; +import { APIResponse } from "./APIResponse"; + +if (typeof window === "undefined") { + global.fetch = require("node-fetch"); +} + +export type FetchFunction = (args: Fetcher.Args) => Promise>; + +export declare namespace Fetcher { + export interface Args { + url: string; + method: string; + contentType?: string; + headers?: Record; + queryParameters?: Record; + body?: unknown; + timeoutMs?: number; + maxRetries?: number; + withCredentials?: boolean; + responseType?: "json" | "blob" | "streaming"; + } + + export type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError; + + export interface FailedStatusCodeError { + reason: "status-code"; + statusCode: number; + body: unknown; + } + + export interface NonJsonError { + reason: "non-json"; + statusCode: number; + rawBody: string; + } + + export interface TimeoutError { + reason: "timeout"; + } + + export interface UnknownError { + reason: "unknown"; + errorMessage: string; + } +} + +const INITIAL_RETRY_DELAY = 1; +const MAX_RETRY_DELAY = 60; +const DEFAULT_MAX_RETRIES = 2; + +async function fetcherImpl(args: Fetcher.Args): Promise> { + const headers: Record = {}; + if (args.body !== undefined && args.contentType != null) { + headers["Content-Type"] = args.contentType; + } + + if (args.headers != null) { + for (const [key, value] of Object.entries(args.headers)) { + if (value != null) { + headers[key] = value; + } + } + } + + const url = + Object.keys(args.queryParameters ?? {}).length > 0 + ? `${args.url}?${qs.stringify(args.queryParameters, { arrayFormat: "repeat" })}` + : args.url; + + let body: BodyInit | undefined = undefined; + if (args.body instanceof FormData) { + // @ts-expect-error + body = args.body; + } else { + body = JSON.stringify(args.body); + } + + const makeRequest = async (): Promise => { + const controller = new AbortController(); + let abortId = undefined; + if (args.timeoutMs != null) { + abortId = setTimeout(() => controller.abort(), args.timeoutMs); + } + const response = await fetch(url, { + method: args.method, + headers, + body, + signal: controller.signal, + credentials: args.withCredentials ? "same-origin" : undefined, + }); + if (abortId != null) { + clearTimeout(abortId); + } + return response; + }; + + try { + let response = await makeRequest(); + + for (let i = 0; i < (args.maxRetries ?? DEFAULT_MAX_RETRIES); ++i) { + if ( + response.status === 408 || + response.status === 409 || + response.status === 429 || + response.status >= 500 + ) { + const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(i, 2), MAX_RETRY_DELAY); + await new Promise((resolve) => setTimeout(resolve, delay)); + response = await makeRequest(); + } else { + break; + } + } + + let body: unknown; + if (response.body != null && args.responseType === "blob") { + body = await response.blob(); + } else if (response.body != null && args.responseType === "streaming") { + body = response.body; + } else if (response.body != null) { + try { + body = await response.json(); + } catch (err) { + return { + ok: false, + error: { + reason: "non-json", + statusCode: response.status, + rawBody: await response.text(), + }, + }; + } + } + + if (response.status >= 200 && response.status < 400) { + return { + ok: true, + body: body as R, + headers: response.headers, + }; + } else { + return { + ok: false, + error: { + reason: "status-code", + statusCode: response.status, + body, + }, + }; + } + } catch (error) { + if (error instanceof Error && error.name === "AbortError") { + return { + ok: false, + error: { + reason: "timeout", + }, + }; + } else if (error instanceof Error) { + return { + ok: false, + error: { + reason: "unknown", + errorMessage: error.message, + }, + }; + } + + return { + ok: false, + error: { + reason: "unknown", + errorMessage: JSON.stringify(error), + }, + }; + } +} + +export const fetcher: FetchFunction = fetcherImpl; diff --git a/src/core/fetcher/Supplier.ts b/src/core/fetcher/Supplier.ts new file mode 100644 index 00000000..867c931c --- /dev/null +++ b/src/core/fetcher/Supplier.ts @@ -0,0 +1,11 @@ +export type Supplier = T | Promise | (() => T | Promise); + +export const Supplier = { + get: async (supplier: Supplier): Promise => { + if (typeof supplier === "function") { + return (supplier as () => T)(); + } else { + return supplier; + } + }, +}; diff --git a/src/core/fetcher/getHeader.ts b/src/core/fetcher/getHeader.ts new file mode 100644 index 00000000..50f922b0 --- /dev/null +++ b/src/core/fetcher/getHeader.ts @@ -0,0 +1,8 @@ +export function getHeader(headers: Record, header: string): string | undefined { + for (const [headerKey, headerValue] of Object.entries(headers)) { + if (headerKey.toLowerCase() === header.toLowerCase()) { + return headerValue; + } + } + return undefined; +} diff --git a/src/core/fetcher/index.ts b/src/core/fetcher/index.ts new file mode 100644 index 00000000..2d658ca4 --- /dev/null +++ b/src/core/fetcher/index.ts @@ -0,0 +1,5 @@ +export type { APIResponse } from "./APIResponse"; +export { fetcher } from "./Fetcher"; +export type { Fetcher, FetchFunction } from "./Fetcher"; +export { getHeader } from "./getHeader"; +export { Supplier } from "./Supplier"; diff --git a/src/core/index.ts b/src/core/index.ts index b1134f29..e2eb66e8 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,3 +1,3 @@ -export * from "./error"; -export * from "./response"; -export * from "./webflow"; +export * from "./fetcher"; +export * from "./auth"; +export * as serialization from "./schemas"; diff --git a/src/core/response.ts b/src/core/response.ts deleted file mode 100644 index 456062d4..00000000 --- a/src/core/response.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { AxiosInstance, AxiosResponse } from "axios"; - -/************************************************************** - * Types - **************************************************************/ -export type PaginationFilter = { limit?: number; offset?: number }; - -export type WebflowHeaders = Record; - -/************************************************************** - * Interfaces - ************************************************************* */ -export interface PaginatedData { - count: number; - limit: number; - offset: number; - total: number; -} - -export class MetaResponse { - rateLimit: { - limit: number; - remaining: number; - }; - - constructor(public response: AxiosResponse) { - this.rateLimit = { - limit: parseInt(response.headers["x-ratelimit-limit"], 10), - remaining: parseInt(response.headers["x-ratelimit-remaining"], 10), - }; - } -} - -export class WebflowRecord { - response: AxiosResponse; - _meta: MetaResponse; - client: AxiosInstance; - - constructor(client: AxiosInstance, response: AxiosResponse, record?: T, ...args: any[]) { - Object.assign(this, record || response.data, ...args); // Copy the record data - - // dynamically add client and response to object - // without serializing during toString() - Object.defineProperties(this, { - client: { get: () => client }, - response: { get: () => response }, - _meta: { get: () => new MetaResponse(response) }, // legacy support - }); - } -} diff --git a/src/core/schemas/Schema.ts b/src/core/schemas/Schema.ts new file mode 100644 index 00000000..870f373b --- /dev/null +++ b/src/core/schemas/Schema.ts @@ -0,0 +1,94 @@ +import { SchemaUtils } from "./builders"; +import { MaybePromise } from "./utils/MaybePromise"; + +export type Schema = BaseSchema & SchemaUtils; + +export type inferRaw = S extends Schema ? Raw : never; +export type inferParsed = S extends Schema ? Parsed : never; + +export interface BaseSchema { + parse: (raw: unknown, opts?: SchemaOptions) => MaybePromise>; + json: (parsed: unknown, opts?: SchemaOptions) => MaybePromise>; + getType: () => SchemaType | Promise; +} + +export const SchemaType = { + DATE: "date", + ENUM: "enum", + LIST: "list", + STRING_LITERAL: "stringLiteral", + BOOLEAN_LITERAL: "booleanLiteral", + OBJECT: "object", + ANY: "any", + BOOLEAN: "boolean", + NUMBER: "number", + STRING: "string", + UNKNOWN: "unknown", + RECORD: "record", + SET: "set", + UNION: "union", + UNDISCRIMINATED_UNION: "undiscriminatedUnion", + OPTIONAL: "optional", +} as const; +export type SchemaType = typeof SchemaType[keyof typeof SchemaType]; + +export type MaybeValid = Valid | Invalid; + +export interface Valid { + ok: true; + value: T; +} + +export interface Invalid { + ok: false; + errors: ValidationError[]; +} + +export interface ValidationError { + path: string[]; + message: string; +} + +export interface SchemaOptions { + /** + * how to handle unrecognized keys in objects + * + * @default "fail" + */ + unrecognizedObjectKeys?: "fail" | "passthrough" | "strip"; + + /** + * whether to fail when an unrecognized discriminant value is + * encountered in a union + * + * @default false + */ + allowUnrecognizedUnionMembers?: boolean; + + /** + * whether to fail when an unrecognized enum value is encountered + * + * @default false + */ + allowUnrecognizedEnumValues?: boolean; + + /** + * whether to allow data that doesn't conform to the schema. + * invalid data is passed through without transformation. + * + * when this is enabled, .parse() and .json() will always + * return `ok: true`. `.parseOrThrow()` and `.jsonOrThrow()` + * will never fail. + * + * @default false + */ + skipValidation?: boolean; + + /** + * each validation failure contains a "path" property, which is + * the breadcrumbs to the offending node in the JSON. you can supply + * a prefix that is prepended to all the errors' paths. this can be + * helpful for zurg's internal debug logging. + */ + breadcrumbsPrefix?: string[]; +} diff --git a/src/core/schemas/builders/date/date.ts b/src/core/schemas/builders/date/date.ts new file mode 100644 index 00000000..b70f24b0 --- /dev/null +++ b/src/core/schemas/builders/date/date.ts @@ -0,0 +1,65 @@ +import { BaseSchema, Schema, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; + +// https://stackoverflow.com/questions/12756159/regex-and-iso8601-formatted-datetime +const ISO_8601_REGEX = + /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; + +export function date(): Schema { + const baseSchema: BaseSchema = { + parse: (raw, { breadcrumbsPrefix = [] } = {}) => { + if (typeof raw !== "string") { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(raw, "string"), + }, + ], + }; + } + if (!ISO_8601_REGEX.test(raw)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(raw, "ISO 8601 date string"), + }, + ], + }; + } + return { + ok: true, + value: new Date(raw), + }; + }, + json: (date, { breadcrumbsPrefix = [] } = {}) => { + if (date instanceof Date) { + return { + ok: true, + value: date.toISOString(), + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(date, "Date object"), + }, + ], + }; + } + }, + getType: () => SchemaType.DATE, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/date/index.ts b/src/core/schemas/builders/date/index.ts new file mode 100644 index 00000000..187b2904 --- /dev/null +++ b/src/core/schemas/builders/date/index.ts @@ -0,0 +1 @@ +export { date } from "./date"; diff --git a/src/core/schemas/builders/enum/enum.ts b/src/core/schemas/builders/enum/enum.ts new file mode 100644 index 00000000..c1e24d69 --- /dev/null +++ b/src/core/schemas/builders/enum/enum.ts @@ -0,0 +1,43 @@ +import { Schema, SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export function enum_(values: E): Schema { + const validValues = new Set(values); + + const schemaCreator = createIdentitySchemaCreator( + SchemaType.ENUM, + (value, { allowUnrecognizedEnumValues, breadcrumbsPrefix = [] } = {}) => { + if (typeof value !== "string") { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "string"), + }, + ], + }; + } + + if (!validValues.has(value) && !allowUnrecognizedEnumValues) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "enum"), + }, + ], + }; + } + + return { + ok: true, + value: value as U, + }; + } + ); + + return schemaCreator(); +} diff --git a/src/core/schemas/builders/enum/index.ts b/src/core/schemas/builders/enum/index.ts new file mode 100644 index 00000000..fe6faed9 --- /dev/null +++ b/src/core/schemas/builders/enum/index.ts @@ -0,0 +1 @@ +export { enum_ } from "./enum"; diff --git a/src/core/schemas/builders/index.ts b/src/core/schemas/builders/index.ts new file mode 100644 index 00000000..050cd2c4 --- /dev/null +++ b/src/core/schemas/builders/index.ts @@ -0,0 +1,13 @@ +export * from "./date"; +export * from "./enum"; +export * from "./lazy"; +export * from "./list"; +export * from "./literals"; +export * from "./object"; +export * from "./object-like"; +export * from "./primitives"; +export * from "./record"; +export * from "./schema-utils"; +export * from "./set"; +export * from "./undiscriminated-union"; +export * from "./union"; diff --git a/src/core/schemas/builders/lazy/index.ts b/src/core/schemas/builders/lazy/index.ts new file mode 100644 index 00000000..77420fb0 --- /dev/null +++ b/src/core/schemas/builders/lazy/index.ts @@ -0,0 +1,3 @@ +export { lazy } from "./lazy"; +export type { SchemaGetter } from "./lazy"; +export { lazyObject } from "./lazyObject"; diff --git a/src/core/schemas/builders/lazy/lazy.ts b/src/core/schemas/builders/lazy/lazy.ts new file mode 100644 index 00000000..a665472d --- /dev/null +++ b/src/core/schemas/builders/lazy/lazy.ts @@ -0,0 +1,34 @@ +import { BaseSchema, Schema } from "../../Schema"; +import { getSchemaUtils } from "../schema-utils"; + +export type SchemaGetter> = () => SchemaType | Promise; + +export function lazy(getter: SchemaGetter>): Schema { + const baseSchema = constructLazyBaseSchema(getter); + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} + +export function constructLazyBaseSchema( + getter: SchemaGetter> +): BaseSchema { + return { + parse: async (raw, opts) => (await getMemoizedSchema(getter)).parse(raw, opts), + json: async (parsed, opts) => (await getMemoizedSchema(getter)).json(parsed, opts), + getType: async () => (await getMemoizedSchema(getter)).getType(), + }; +} + +type MemoizedGetter> = SchemaGetter & { __zurg_memoized?: SchemaType }; + +export async function getMemoizedSchema>( + getter: SchemaGetter +): Promise { + const castedGetter = getter as MemoizedGetter; + if (castedGetter.__zurg_memoized == null) { + castedGetter.__zurg_memoized = await getter(); + } + return castedGetter.__zurg_memoized; +} diff --git a/src/core/schemas/builders/lazy/lazyObject.ts b/src/core/schemas/builders/lazy/lazyObject.ts new file mode 100644 index 00000000..e48c0166 --- /dev/null +++ b/src/core/schemas/builders/lazy/lazyObject.ts @@ -0,0 +1,20 @@ +import { getObjectUtils } from "../object"; +import { getObjectLikeUtils } from "../object-like"; +import { BaseObjectSchema, ObjectSchema } from "../object/types"; +import { getSchemaUtils } from "../schema-utils"; +import { constructLazyBaseSchema, getMemoizedSchema, SchemaGetter } from "./lazy"; + +export function lazyObject(getter: SchemaGetter>): ObjectSchema { + const baseSchema: BaseObjectSchema = { + ...constructLazyBaseSchema(getter), + _getRawProperties: async () => (await getMemoizedSchema(getter))._getRawProperties(), + _getParsedProperties: async () => (await getMemoizedSchema(getter))._getParsedProperties(), + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + ...getObjectUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/list/index.ts b/src/core/schemas/builders/list/index.ts new file mode 100644 index 00000000..25f4bcc1 --- /dev/null +++ b/src/core/schemas/builders/list/index.ts @@ -0,0 +1 @@ +export { list } from "./list"; diff --git a/src/core/schemas/builders/list/list.ts b/src/core/schemas/builders/list/list.ts new file mode 100644 index 00000000..b333321b --- /dev/null +++ b/src/core/schemas/builders/list/list.ts @@ -0,0 +1,74 @@ +import { BaseSchema, MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { MaybePromise } from "../../utils/MaybePromise"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; + +export function list(schema: Schema): Schema { + const baseSchema: BaseSchema = { + parse: async (raw, opts) => + validateAndTransformArray(raw, (item, index) => + schema.parse(item, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`], + }) + ), + json: (parsed, opts) => + validateAndTransformArray(parsed, (item, index) => + schema.json(item, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`], + }) + ), + getType: () => SchemaType.LIST, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} + +async function validateAndTransformArray( + value: unknown, + transformItem: (item: Raw, index: number) => MaybePromise> +): Promise> { + if (!Array.isArray(value)) { + return { + ok: false, + errors: [ + { + message: getErrorMessageForIncorrectType(value, "list"), + path: [], + }, + ], + }; + } + + const maybeValidItems = await Promise.all(value.map((item, index) => transformItem(item, index))); + + return maybeValidItems.reduce>( + (acc, item) => { + if (acc.ok && item.ok) { + return { + ok: true, + value: [...acc.value, item.value], + }; + } + + const errors: ValidationError[] = []; + if (!acc.ok) { + errors.push(...acc.errors); + } + if (!item.ok) { + errors.push(...item.errors); + } + + return { + ok: false, + errors, + }; + }, + { ok: true, value: [] } + ); +} diff --git a/src/core/schemas/builders/literals/booleanLiteral.ts b/src/core/schemas/builders/literals/booleanLiteral.ts new file mode 100644 index 00000000..a83d22cd --- /dev/null +++ b/src/core/schemas/builders/literals/booleanLiteral.ts @@ -0,0 +1,29 @@ +import { Schema, SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export function booleanLiteral(literal: V): Schema { + const schemaCreator = createIdentitySchemaCreator( + SchemaType.BOOLEAN_LITERAL, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (value === literal) { + return { + ok: true, + value: literal, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, `${literal.toString()}`), + }, + ], + }; + } + } + ); + + return schemaCreator(); +} diff --git a/src/core/schemas/builders/literals/index.ts b/src/core/schemas/builders/literals/index.ts new file mode 100644 index 00000000..d2bf08fc --- /dev/null +++ b/src/core/schemas/builders/literals/index.ts @@ -0,0 +1,2 @@ +export { stringLiteral } from "./stringLiteral"; +export { booleanLiteral } from "./booleanLiteral"; diff --git a/src/core/schemas/builders/literals/stringLiteral.ts b/src/core/schemas/builders/literals/stringLiteral.ts new file mode 100644 index 00000000..3939b76b --- /dev/null +++ b/src/core/schemas/builders/literals/stringLiteral.ts @@ -0,0 +1,29 @@ +import { Schema, SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export function stringLiteral(literal: V): Schema { + const schemaCreator = createIdentitySchemaCreator( + SchemaType.STRING_LITERAL, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (value === literal) { + return { + ok: true, + value: literal, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, `"${literal}"`), + }, + ], + }; + } + } + ); + + return schemaCreator(); +} diff --git a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts new file mode 100644 index 00000000..270ea170 --- /dev/null +++ b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts @@ -0,0 +1,79 @@ +import { BaseSchema } from "../../Schema"; +import { filterObject } from "../../utils/filterObject"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { getSchemaUtils } from "../schema-utils"; +import { ObjectLikeSchema, ObjectLikeUtils } from "./types"; + +export function getObjectLikeUtils(schema: BaseSchema): ObjectLikeUtils { + return { + withParsedProperties: (properties) => withParsedProperties(schema, properties), + }; +} + +/** + * object-like utils are defined in one file to resolve issues with circular imports + */ + +export function withParsedProperties( + objectLike: BaseSchema, + properties: { [K in keyof Properties]: Properties[K] | ((parsed: ParsedObjectShape) => Properties[K]) } +): ObjectLikeSchema { + const objectSchema: BaseSchema = { + parse: async (raw, opts) => { + const parsedObject = await objectLike.parse(raw, opts); + if (!parsedObject.ok) { + return parsedObject; + } + + const additionalProperties = Object.entries(properties).reduce>( + (processed, [key, value]) => { + return { + ...processed, + [key]: typeof value === "function" ? value(parsedObject.value) : value, + }; + }, + {} + ); + + return { + ok: true, + value: { + ...parsedObject.value, + ...(additionalProperties as Properties), + }, + }; + }, + + json: (parsed, opts) => { + if (!isPlainObject(parsed)) { + return { + ok: false, + errors: [ + { + path: opts?.breadcrumbsPrefix ?? [], + message: getErrorMessageForIncorrectType(parsed, "object"), + }, + ], + }; + } + + // strip out added properties + const addedPropertyKeys = new Set(Object.keys(properties)); + const parsedWithoutAddedProperties = filterObject( + parsed, + Object.keys(parsed).filter((key) => !addedPropertyKeys.has(key)) + ); + + return objectLike.json(parsedWithoutAddedProperties as ParsedObjectShape, opts); + }, + + getType: () => objectLike.getType(), + }; + + return { + ...objectSchema, + ...getSchemaUtils(objectSchema), + ...getObjectLikeUtils(objectSchema), + }; +} diff --git a/src/core/schemas/builders/object-like/index.ts b/src/core/schemas/builders/object-like/index.ts new file mode 100644 index 00000000..c342e72c --- /dev/null +++ b/src/core/schemas/builders/object-like/index.ts @@ -0,0 +1,2 @@ +export { getObjectLikeUtils, withParsedProperties } from "./getObjectLikeUtils"; +export type { ObjectLikeSchema, ObjectLikeUtils } from "./types"; diff --git a/src/core/schemas/builders/object-like/types.ts b/src/core/schemas/builders/object-like/types.ts new file mode 100644 index 00000000..75b36987 --- /dev/null +++ b/src/core/schemas/builders/object-like/types.ts @@ -0,0 +1,11 @@ +import { BaseSchema, Schema } from "../../Schema"; + +export type ObjectLikeSchema = Schema & + BaseSchema & + ObjectLikeUtils; + +export interface ObjectLikeUtils { + withParsedProperties: >(properties: { + [K in keyof T]: T[K] | ((parsed: Parsed) => T[K]); + }) => ObjectLikeSchema; +} diff --git a/src/core/schemas/builders/object/index.ts b/src/core/schemas/builders/object/index.ts new file mode 100644 index 00000000..e3f4388d --- /dev/null +++ b/src/core/schemas/builders/object/index.ts @@ -0,0 +1,22 @@ +export { getObjectUtils, object } from "./object"; +export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties"; +export type { + inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas, + inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas, +} from "./objectWithoutOptionalProperties"; +export { isProperty, property } from "./property"; +export type { Property } from "./property"; +export type { + BaseObjectSchema, + inferObjectSchemaFromPropertySchemas, + inferParsedObject, + inferParsedObjectFromPropertySchemas, + inferParsedPropertySchema, + inferRawKey, + inferRawObject, + inferRawObjectFromPropertySchemas, + inferRawPropertySchema, + ObjectSchema, + ObjectUtils, + PropertySchemas, +} from "./types"; diff --git a/src/core/schemas/builders/object/object.ts b/src/core/schemas/builders/object/object.ts new file mode 100644 index 00000000..4abadfb3 --- /dev/null +++ b/src/core/schemas/builders/object/object.ts @@ -0,0 +1,333 @@ +import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; +import { entries } from "../../utils/entries"; +import { filterObject } from "../../utils/filterObject"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { keys } from "../../utils/keys"; +import { MaybePromise } from "../../utils/MaybePromise"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { partition } from "../../utils/partition"; +import { getObjectLikeUtils } from "../object-like"; +import { getSchemaUtils } from "../schema-utils"; +import { isProperty } from "./property"; +import { + BaseObjectSchema, + inferObjectSchemaFromPropertySchemas, + inferParsedObjectFromPropertySchemas, + inferRawObjectFromPropertySchemas, + ObjectSchema, + ObjectUtils, + PropertySchemas, +} from "./types"; + +interface ObjectPropertyWithRawKey { + rawKey: string; + parsedKey: string; + valueSchema: Schema; +} + +export function object>( + schemas: T +): inferObjectSchemaFromPropertySchemas { + const baseSchema: BaseObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectFromPropertySchemas + > = { + _getRawProperties: () => + Promise.resolve( + Object.entries(schemas).map(([parsedKey, propertySchema]) => + isProperty(propertySchema) ? propertySchema.rawKey : parsedKey + ) as unknown as (keyof inferRawObjectFromPropertySchemas)[] + ), + _getParsedProperties: () => + Promise.resolve(keys(schemas) as unknown as (keyof inferParsedObjectFromPropertySchemas)[]), + + parse: async (raw, opts) => { + const rawKeyToProperty: Record = {}; + const requiredKeys: string[] = []; + + for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { + const rawKey = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey; + const valueSchema: Schema = isProperty(schemaOrObjectProperty) + ? schemaOrObjectProperty.valueSchema + : schemaOrObjectProperty; + + const property: ObjectPropertyWithRawKey = { + rawKey, + parsedKey: parsedKey as string, + valueSchema, + }; + + rawKeyToProperty[rawKey] = property; + + if (await isSchemaRequired(valueSchema)) { + requiredKeys.push(rawKey); + } + } + + return validateAndTransformObject({ + value: raw, + requiredKeys, + getProperty: (rawKey) => { + const property = rawKeyToProperty[rawKey]; + if (property == null) { + return undefined; + } + return { + transformedKey: property.parsedKey, + transform: (propertyValue) => + property.valueSchema.parse(propertyValue, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), rawKey], + }), + }; + }, + unrecognizedObjectKeys: opts?.unrecognizedObjectKeys, + skipValidation: opts?.skipValidation, + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + + json: async (parsed, opts) => { + const requiredKeys: string[] = []; + + for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { + const valueSchema: Schema = isProperty(schemaOrObjectProperty) + ? schemaOrObjectProperty.valueSchema + : schemaOrObjectProperty; + + if (await isSchemaRequired(valueSchema)) { + requiredKeys.push(parsedKey as string); + } + } + + return validateAndTransformObject({ + value: parsed, + requiredKeys, + getProperty: ( + parsedKey + ): + | { transformedKey: string; transform: (propertyValue: unknown) => MaybePromise> } + | undefined => { + const property = schemas[parsedKey as keyof T]; + + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (property == null) { + return undefined; + } + + if (isProperty(property)) { + return { + transformedKey: property.rawKey, + transform: (propertyValue) => + property.valueSchema.json(propertyValue, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedKey], + }), + }; + } else { + return { + transformedKey: parsedKey, + transform: (propertyValue) => + property.json(propertyValue, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedKey], + }), + }; + } + }, + unrecognizedObjectKeys: opts?.unrecognizedObjectKeys, + skipValidation: opts?.skipValidation, + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + + getType: () => SchemaType.OBJECT, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + ...getObjectUtils(baseSchema), + }; +} + +async function validateAndTransformObject({ + value, + requiredKeys, + getProperty, + unrecognizedObjectKeys = "fail", + skipValidation = false, + breadcrumbsPrefix = [], +}: { + value: unknown; + requiredKeys: string[]; + getProperty: ( + preTransformedKey: string + ) => { transformedKey: string; transform: (propertyValue: unknown) => MaybePromise> } | undefined; + unrecognizedObjectKeys: "fail" | "passthrough" | "strip" | undefined; + skipValidation: boolean | undefined; + breadcrumbsPrefix: string[] | undefined; +}): Promise> { + if (!isPlainObject(value)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "object"), + }, + ], + }; + } + + const missingRequiredKeys = new Set(requiredKeys); + const errors: ValidationError[] = []; + const transformed: Record = {}; + + for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) { + const property = getProperty(preTransformedKey); + + if (property != null) { + missingRequiredKeys.delete(preTransformedKey); + + const value = await property.transform(preTransformedItemValue); + if (value.ok) { + transformed[property.transformedKey] = value.value; + } else { + transformed[preTransformedKey] = preTransformedItemValue; + errors.push(...value.errors); + } + } else { + switch (unrecognizedObjectKeys) { + case "fail": + errors.push({ + path: [...breadcrumbsPrefix, preTransformedKey], + message: `Unexpected key "${preTransformedKey}"`, + }); + break; + case "strip": + break; + case "passthrough": + transformed[preTransformedKey] = preTransformedItemValue; + break; + } + } + } + + errors.push( + ...requiredKeys + .filter((key) => missingRequiredKeys.has(key)) + .map((key) => ({ + path: breadcrumbsPrefix, + message: `Missing required key "${key}"`, + })) + ); + + if (errors.length === 0 || skipValidation) { + return { + ok: true, + value: transformed as Transformed, + }; + } else { + return { + ok: false, + errors, + }; + } +} + +export function getObjectUtils(schema: BaseObjectSchema): ObjectUtils { + return { + extend: (extension: ObjectSchema) => { + const baseSchema: BaseObjectSchema = { + _getParsedProperties: async () => [ + ...(await schema._getParsedProperties()), + ...(await extension._getParsedProperties()), + ], + _getRawProperties: async () => [ + ...(await schema._getRawProperties()), + ...(await extension._getRawProperties()), + ], + parse: async (raw, opts) => { + return validateAndTransformExtendedObject({ + extensionKeys: await extension._getRawProperties(), + value: raw, + transformBase: (rawBase) => schema.parse(rawBase, opts), + transformExtension: (rawExtension) => extension.parse(rawExtension, opts), + }); + }, + json: async (parsed, opts) => { + return validateAndTransformExtendedObject({ + extensionKeys: await extension._getParsedProperties(), + value: parsed, + transformBase: (parsedBase) => schema.json(parsedBase, opts), + transformExtension: (parsedExtension) => extension.json(parsedExtension, opts), + }); + }, + getType: () => SchemaType.OBJECT, + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + ...getObjectUtils(baseSchema), + }; + }, + }; +} + +async function validateAndTransformExtendedObject({ + extensionKeys, + value, + transformBase, + transformExtension, +}: { + extensionKeys: (keyof PreTransformedExtension)[]; + value: unknown; + transformBase: (value: unknown) => MaybePromise>; + transformExtension: (value: unknown) => MaybePromise>; +}): Promise> { + const extensionPropertiesSet = new Set(extensionKeys); + const [extensionProperties, baseProperties] = partition(keys(value), (key) => + extensionPropertiesSet.has(key as keyof PreTransformedExtension) + ); + + const transformedBase = await transformBase(filterObject(value, baseProperties)); + const transformedExtension = await transformExtension(filterObject(value, extensionProperties)); + + if (transformedBase.ok && transformedExtension.ok) { + return { + ok: true, + value: { + ...transformedBase.value, + ...transformedExtension.value, + }, + }; + } else { + return { + ok: false, + errors: [ + ...(transformedBase.ok ? [] : transformedBase.errors), + ...(transformedExtension.ok ? [] : transformedExtension.errors), + ], + }; + } +} + +async function isSchemaRequired(schema: Schema): Promise { + return !(await isSchemaOptional(schema)); +} + +async function isSchemaOptional(schema: Schema): Promise { + switch (await schema.getType()) { + case SchemaType.ANY: + case SchemaType.UNKNOWN: + case SchemaType.OPTIONAL: + return true; + default: + return false; + } +} diff --git a/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts new file mode 100644 index 00000000..a0951f48 --- /dev/null +++ b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts @@ -0,0 +1,18 @@ +import { object } from "./object"; +import { inferParsedPropertySchema, inferRawObjectFromPropertySchemas, ObjectSchema, PropertySchemas } from "./types"; + +export function objectWithoutOptionalProperties>( + schemas: T +): inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas { + return object(schemas) as unknown as inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas; +} + +export type inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas> = + ObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas + >; + +export type inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas> = { + [K in keyof T]: inferParsedPropertySchema; +}; diff --git a/src/core/schemas/builders/object/property.ts b/src/core/schemas/builders/object/property.ts new file mode 100644 index 00000000..d245c4b1 --- /dev/null +++ b/src/core/schemas/builders/object/property.ts @@ -0,0 +1,23 @@ +import { Schema } from "../../Schema"; + +export function property( + rawKey: RawKey, + valueSchema: Schema +): Property { + return { + rawKey, + valueSchema, + isProperty: true, + }; +} + +export interface Property { + rawKey: RawKey; + valueSchema: Schema; + isProperty: true; +} + +export function isProperty>(maybeProperty: unknown): maybeProperty is O { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + return (maybeProperty as O).isProperty; +} diff --git a/src/core/schemas/builders/object/types.ts b/src/core/schemas/builders/object/types.ts new file mode 100644 index 00000000..17cff4f8 --- /dev/null +++ b/src/core/schemas/builders/object/types.ts @@ -0,0 +1,72 @@ +import { BaseSchema, inferParsed, inferRaw, Schema } from "../../Schema"; +import { addQuestionMarksToNullableProperties } from "../../utils/addQuestionMarksToNullableProperties"; +import { ObjectLikeUtils } from "../object-like"; +import { SchemaUtils } from "../schema-utils"; +import { Property } from "./property"; + +export type ObjectSchema = BaseObjectSchema & + ObjectLikeUtils & + ObjectUtils & + SchemaUtils; + +export interface BaseObjectSchema extends BaseSchema { + _getRawProperties: () => Promise<(keyof Raw)[]>; + _getParsedProperties: () => Promise<(keyof Parsed)[]>; +} + +export interface ObjectUtils { + extend: ( + schemas: ObjectSchema + ) => ObjectSchema; +} + +export type inferRawObject> = O extends ObjectSchema ? Raw : never; + +export type inferParsedObject> = O extends ObjectSchema + ? Parsed + : never; + +export type inferObjectSchemaFromPropertySchemas> = ObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectFromPropertySchemas +>; + +export type inferRawObjectFromPropertySchemas> = + addQuestionMarksToNullableProperties<{ + [ParsedKey in keyof T as inferRawKey]: inferRawPropertySchema; + }>; + +export type inferParsedObjectFromPropertySchemas> = + addQuestionMarksToNullableProperties<{ + [K in keyof T]: inferParsedPropertySchema; + }>; + +export type PropertySchemas = Record< + ParsedKeys, + Property | Schema +>; + +export type inferRawPropertySchema

| Schema> = P extends Property< + any, + infer Raw, + any +> + ? Raw + : P extends Schema + ? inferRaw

+ : never; + +export type inferParsedPropertySchema

| Schema> = P extends Property< + any, + any, + infer Parsed +> + ? Parsed + : P extends Schema + ? inferParsed

+ : never; + +export type inferRawKey< + ParsedKey extends string | number | symbol, + P extends Property | Schema +> = P extends Property ? Raw : ParsedKey; diff --git a/src/core/schemas/builders/primitives/any.ts b/src/core/schemas/builders/primitives/any.ts new file mode 100644 index 00000000..fcaeb042 --- /dev/null +++ b/src/core/schemas/builders/primitives/any.ts @@ -0,0 +1,4 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; + +export const any = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ ok: true, value })); diff --git a/src/core/schemas/builders/primitives/boolean.ts b/src/core/schemas/builders/primitives/boolean.ts new file mode 100644 index 00000000..fad60562 --- /dev/null +++ b/src/core/schemas/builders/primitives/boolean.ts @@ -0,0 +1,25 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export const boolean = createIdentitySchemaCreator( + SchemaType.BOOLEAN, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (typeof value === "boolean") { + return { + ok: true, + value, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "boolean"), + }, + ], + }; + } + } +); diff --git a/src/core/schemas/builders/primitives/index.ts b/src/core/schemas/builders/primitives/index.ts new file mode 100644 index 00000000..788f9416 --- /dev/null +++ b/src/core/schemas/builders/primitives/index.ts @@ -0,0 +1,5 @@ +export { any } from "./any"; +export { boolean } from "./boolean"; +export { number } from "./number"; +export { string } from "./string"; +export { unknown } from "./unknown"; diff --git a/src/core/schemas/builders/primitives/number.ts b/src/core/schemas/builders/primitives/number.ts new file mode 100644 index 00000000..c2689456 --- /dev/null +++ b/src/core/schemas/builders/primitives/number.ts @@ -0,0 +1,25 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export const number = createIdentitySchemaCreator( + SchemaType.NUMBER, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (typeof value === "number") { + return { + ok: true, + value, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "number"), + }, + ], + }; + } + } +); diff --git a/src/core/schemas/builders/primitives/string.ts b/src/core/schemas/builders/primitives/string.ts new file mode 100644 index 00000000..949f1f2a --- /dev/null +++ b/src/core/schemas/builders/primitives/string.ts @@ -0,0 +1,25 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export const string = createIdentitySchemaCreator( + SchemaType.STRING, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (typeof value === "string") { + return { + ok: true, + value, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "string"), + }, + ], + }; + } + } +); diff --git a/src/core/schemas/builders/primitives/unknown.ts b/src/core/schemas/builders/primitives/unknown.ts new file mode 100644 index 00000000..4d524957 --- /dev/null +++ b/src/core/schemas/builders/primitives/unknown.ts @@ -0,0 +1,4 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; + +export const unknown = createIdentitySchemaCreator(SchemaType.UNKNOWN, (value) => ({ ok: true, value })); diff --git a/src/core/schemas/builders/record/index.ts b/src/core/schemas/builders/record/index.ts new file mode 100644 index 00000000..82e25c5c --- /dev/null +++ b/src/core/schemas/builders/record/index.ts @@ -0,0 +1,2 @@ +export { record } from "./record"; +export type { BaseRecordSchema, RecordSchema } from "./types"; diff --git a/src/core/schemas/builders/record/record.ts b/src/core/schemas/builders/record/record.ts new file mode 100644 index 00000000..ac1cd22a --- /dev/null +++ b/src/core/schemas/builders/record/record.ts @@ -0,0 +1,131 @@ +import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; +import { entries } from "../../utils/entries"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { MaybePromise } from "../../utils/MaybePromise"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; +import { BaseRecordSchema, RecordSchema } from "./types"; + +export function record( + keySchema: Schema, + valueSchema: Schema +): RecordSchema { + const baseSchema: BaseRecordSchema = { + parse: async (raw, opts) => { + return validateAndTransformRecord({ + value: raw, + isKeyNumeric: (await keySchema.getType()) === SchemaType.NUMBER, + transformKey: (key) => + keySchema.parse(key, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`], + }), + transformValue: (value, key) => + valueSchema.parse(value, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`], + }), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + json: async (parsed, opts) => { + return validateAndTransformRecord({ + value: parsed, + isKeyNumeric: (await keySchema.getType()) === SchemaType.NUMBER, + transformKey: (key) => + keySchema.json(key, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`], + }), + transformValue: (value, key) => + valueSchema.json(value, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`], + }), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + getType: () => SchemaType.RECORD, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} + +async function validateAndTransformRecord({ + value, + isKeyNumeric, + transformKey, + transformValue, + breadcrumbsPrefix = [], +}: { + value: unknown; + isKeyNumeric: boolean; + transformKey: (key: string | number) => MaybePromise>; + transformValue: (value: unknown, key: string | number) => MaybePromise>; + breadcrumbsPrefix: string[] | undefined; +}): Promise>> { + if (!isPlainObject(value)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "object"), + }, + ], + }; + } + + return entries(value).reduce>>>( + async (accPromise, [stringKey, value]) => { + // skip nullish keys + if (value == null) { + return accPromise; + } + + const acc = await accPromise; + + let key: string | number = stringKey; + if (isKeyNumeric) { + const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN; + if (!isNaN(numberKey)) { + key = numberKey; + } + } + const transformedKey = await transformKey(key); + + const transformedValue = await transformValue(value, key); + + if (acc.ok && transformedKey.ok && transformedValue.ok) { + return { + ok: true, + value: { + ...acc.value, + [transformedKey.value]: transformedValue.value, + }, + }; + } + + const errors: ValidationError[] = []; + if (!acc.ok) { + errors.push(...acc.errors); + } + if (!transformedKey.ok) { + errors.push(...transformedKey.errors); + } + if (!transformedValue.ok) { + errors.push(...transformedValue.errors); + } + + return { + ok: false, + errors, + }; + }, + Promise.resolve({ ok: true, value: {} as Record }) + ); +} diff --git a/src/core/schemas/builders/record/types.ts b/src/core/schemas/builders/record/types.ts new file mode 100644 index 00000000..eb82cc7f --- /dev/null +++ b/src/core/schemas/builders/record/types.ts @@ -0,0 +1,17 @@ +import { BaseSchema } from "../../Schema"; +import { SchemaUtils } from "../schema-utils"; + +export type RecordSchema< + RawKey extends string | number, + RawValue, + ParsedKey extends string | number, + ParsedValue +> = BaseRecordSchema & + SchemaUtils, Record>; + +export type BaseRecordSchema< + RawKey extends string | number, + RawValue, + ParsedKey extends string | number, + ParsedValue +> = BaseSchema, Record>; diff --git a/src/core/schemas/builders/schema-utils/JsonError.ts b/src/core/schemas/builders/schema-utils/JsonError.ts new file mode 100644 index 00000000..2b89ca0e --- /dev/null +++ b/src/core/schemas/builders/schema-utils/JsonError.ts @@ -0,0 +1,9 @@ +import { ValidationError } from "../../Schema"; +import { stringifyValidationError } from "./stringifyValidationErrors"; + +export class JsonError extends Error { + constructor(public readonly errors: ValidationError[]) { + super(errors.map(stringifyValidationError).join("; ")); + Object.setPrototypeOf(this, JsonError.prototype); + } +} diff --git a/src/core/schemas/builders/schema-utils/ParseError.ts b/src/core/schemas/builders/schema-utils/ParseError.ts new file mode 100644 index 00000000..d056eb45 --- /dev/null +++ b/src/core/schemas/builders/schema-utils/ParseError.ts @@ -0,0 +1,9 @@ +import { ValidationError } from "../../Schema"; +import { stringifyValidationError } from "./stringifyValidationErrors"; + +export class ParseError extends Error { + constructor(public readonly errors: ValidationError[]) { + super(errors.map(stringifyValidationError).join("; ")); + Object.setPrototypeOf(this, ParseError.prototype); + } +} diff --git a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts new file mode 100644 index 00000000..0c0d379d --- /dev/null +++ b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts @@ -0,0 +1,99 @@ +import { BaseSchema, Schema, SchemaOptions, SchemaType } from "../../Schema"; +import { JsonError } from "./JsonError"; +import { ParseError } from "./ParseError"; + +export interface SchemaUtils { + optional: () => Schema; + transform: (transformer: SchemaTransformer) => Schema; + parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise; + jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise; +} + +export interface SchemaTransformer { + transform: (parsed: Parsed) => Transformed; + untransform: (transformed: any) => Parsed; +} + +export function getSchemaUtils(schema: BaseSchema): SchemaUtils { + return { + optional: () => optional(schema), + transform: (transformer) => transform(schema, transformer), + parseOrThrow: async (raw, opts) => { + const parsed = await schema.parse(raw, opts); + if (parsed.ok) { + return parsed.value; + } + throw new ParseError(parsed.errors); + }, + jsonOrThrow: async (parsed, opts) => { + const raw = await schema.json(parsed, opts); + if (raw.ok) { + return raw.value; + } + throw new JsonError(raw.errors); + }, + }; +} + +/** + * schema utils are defined in one file to resolve issues with circular imports + */ + +export function optional( + schema: BaseSchema +): Schema { + const baseSchema: BaseSchema = { + parse: (raw, opts) => { + if (raw == null) { + return { + ok: true, + value: undefined, + }; + } + return schema.parse(raw, opts); + }, + json: (parsed, opts) => { + if (parsed == null) { + return { + ok: true, + value: null, + }; + } + return schema.json(parsed, opts); + }, + getType: () => SchemaType.OPTIONAL, + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} + +export function transform( + schema: BaseSchema, + transformer: SchemaTransformer +): Schema { + const baseSchema: BaseSchema = { + parse: async (raw, opts) => { + const parsed = await schema.parse(raw, opts); + if (!parsed.ok) { + return parsed; + } + return { + ok: true, + value: transformer.transform(parsed.value), + }; + }, + json: async (transformed, opts) => { + const parsed = await transformer.untransform(transformed); + return schema.json(parsed, opts); + }, + getType: () => schema.getType(), + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/schema-utils/index.ts b/src/core/schemas/builders/schema-utils/index.ts new file mode 100644 index 00000000..aa04e051 --- /dev/null +++ b/src/core/schemas/builders/schema-utils/index.ts @@ -0,0 +1,4 @@ +export { getSchemaUtils, optional, transform } from "./getSchemaUtils"; +export type { SchemaUtils } from "./getSchemaUtils"; +export { JsonError } from "./JsonError"; +export { ParseError } from "./ParseError"; diff --git a/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts b/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts new file mode 100644 index 00000000..4160f0a2 --- /dev/null +++ b/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts @@ -0,0 +1,8 @@ +import { ValidationError } from "../../Schema"; + +export function stringifyValidationError(error: ValidationError): string { + if (error.path.length === 0) { + return error.message; + } + return `${error.path.join(" -> ")}: ${error.message}`; +} diff --git a/src/core/schemas/builders/set/index.ts b/src/core/schemas/builders/set/index.ts new file mode 100644 index 00000000..f3310e8b --- /dev/null +++ b/src/core/schemas/builders/set/index.ts @@ -0,0 +1 @@ +export { set } from "./set"; diff --git a/src/core/schemas/builders/set/set.ts b/src/core/schemas/builders/set/set.ts new file mode 100644 index 00000000..3113bcba --- /dev/null +++ b/src/core/schemas/builders/set/set.ts @@ -0,0 +1,43 @@ +import { BaseSchema, Schema, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { list } from "../list"; +import { getSchemaUtils } from "../schema-utils"; + +export function set(schema: Schema): Schema> { + const listSchema = list(schema); + const baseSchema: BaseSchema> = { + parse: async (raw, opts) => { + const parsedList = await listSchema.parse(raw, opts); + if (parsedList.ok) { + return { + ok: true, + value: new Set(parsedList.value), + }; + } else { + return parsedList; + } + }, + json: async (parsed, opts) => { + if (!(parsed instanceof Set)) { + return { + ok: false, + errors: [ + { + path: opts?.breadcrumbsPrefix ?? [], + message: getErrorMessageForIncorrectType(parsed, "Set"), + }, + ], + }; + } + const jsonList = await listSchema.json([...parsed], opts); + return jsonList; + }, + getType: () => SchemaType.SET, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/undiscriminated-union/index.ts b/src/core/schemas/builders/undiscriminated-union/index.ts new file mode 100644 index 00000000..75b71cb3 --- /dev/null +++ b/src/core/schemas/builders/undiscriminated-union/index.ts @@ -0,0 +1,6 @@ +export type { + inferParsedUnidiscriminatedUnionSchema, + inferRawUnidiscriminatedUnionSchema, + UndiscriminatedUnionSchema, +} from "./types"; +export { undiscriminatedUnion } from "./undiscriminatedUnion"; diff --git a/src/core/schemas/builders/undiscriminated-union/types.ts b/src/core/schemas/builders/undiscriminated-union/types.ts new file mode 100644 index 00000000..43e7108a --- /dev/null +++ b/src/core/schemas/builders/undiscriminated-union/types.ts @@ -0,0 +1,10 @@ +import { inferParsed, inferRaw, Schema } from "../../Schema"; + +export type UndiscriminatedUnionSchema = Schema< + inferRawUnidiscriminatedUnionSchema, + inferParsedUnidiscriminatedUnionSchema +>; + +export type inferRawUnidiscriminatedUnionSchema = inferRaw; + +export type inferParsedUnidiscriminatedUnionSchema = inferParsed; diff --git a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts new file mode 100644 index 00000000..771dc6a7 --- /dev/null +++ b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts @@ -0,0 +1,61 @@ +import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType, ValidationError } from "../../Schema"; +import { MaybePromise } from "../../utils/MaybePromise"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; +import { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema } from "./types"; + +export function undiscriminatedUnion, ...Schema[]]>( + schemas: Schemas +): Schema, inferParsedUnidiscriminatedUnionSchema> { + const baseSchema: BaseSchema< + inferRawUnidiscriminatedUnionSchema, + inferParsedUnidiscriminatedUnionSchema + > = { + parse: async (raw, opts) => { + return validateAndTransformUndiscriminatedUnion>( + (schema, opts) => schema.parse(raw, opts), + schemas, + opts + ); + }, + json: async (parsed, opts) => { + return validateAndTransformUndiscriminatedUnion>( + (schema, opts) => schema.json(parsed, opts), + schemas, + opts + ); + }, + getType: () => SchemaType.UNDISCRIMINATED_UNION, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} + +async function validateAndTransformUndiscriminatedUnion( + transform: (schema: Schema, opts: SchemaOptions) => MaybePromise>, + schemas: Schema[], + opts: SchemaOptions | undefined +): Promise> { + const errors: ValidationError[] = []; + for (const [index, schema] of schemas.entries()) { + const transformed = await transform(schema, { ...opts, skipValidation: false }); + if (transformed.ok) { + return transformed; + } else { + for (const error of transformed.errors) { + errors.push({ + path: error.path, + message: `[Variant ${index}] ${error.message}`, + }); + } + } + } + + return { + ok: false, + errors, + }; +} diff --git a/src/core/schemas/builders/union/discriminant.ts b/src/core/schemas/builders/union/discriminant.ts new file mode 100644 index 00000000..55065bc8 --- /dev/null +++ b/src/core/schemas/builders/union/discriminant.ts @@ -0,0 +1,14 @@ +export function discriminant( + parsedDiscriminant: ParsedDiscriminant, + rawDiscriminant: RawDiscriminant +): Discriminant { + return { + parsedDiscriminant, + rawDiscriminant, + }; +} + +export interface Discriminant { + parsedDiscriminant: ParsedDiscriminant; + rawDiscriminant: RawDiscriminant; +} diff --git a/src/core/schemas/builders/union/index.ts b/src/core/schemas/builders/union/index.ts new file mode 100644 index 00000000..85fc008a --- /dev/null +++ b/src/core/schemas/builders/union/index.ts @@ -0,0 +1,10 @@ +export { discriminant } from "./discriminant"; +export type { Discriminant } from "./discriminant"; +export type { + inferParsedDiscriminant, + inferParsedUnion, + inferRawDiscriminant, + inferRawUnion, + UnionSubtypes, +} from "./types"; +export { union } from "./union"; diff --git a/src/core/schemas/builders/union/types.ts b/src/core/schemas/builders/union/types.ts new file mode 100644 index 00000000..6f82c868 --- /dev/null +++ b/src/core/schemas/builders/union/types.ts @@ -0,0 +1,26 @@ +import { inferParsedObject, inferRawObject, ObjectSchema } from "../object"; +import { Discriminant } from "./discriminant"; + +export type UnionSubtypes = { + [K in DiscriminantValues]: ObjectSchema; +}; + +export type inferRawUnion, U extends UnionSubtypes> = { + [K in keyof U]: Record, K> & inferRawObject; +}[keyof U]; + +export type inferParsedUnion, U extends UnionSubtypes> = { + [K in keyof U]: Record, K> & inferParsedObject; +}[keyof U]; + +export type inferRawDiscriminant> = D extends string + ? D + : D extends Discriminant + ? Raw + : never; + +export type inferParsedDiscriminant> = D extends string + ? D + : D extends Discriminant + ? Parsed + : never; diff --git a/src/core/schemas/builders/union/union.ts b/src/core/schemas/builders/union/union.ts new file mode 100644 index 00000000..ed659beb --- /dev/null +++ b/src/core/schemas/builders/union/union.ts @@ -0,0 +1,173 @@ +import { BaseSchema, MaybeValid, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { keys } from "../../utils/keys"; +import { MaybePromise } from "../../utils/MaybePromise"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { enum_ } from "../enum"; +import { ObjectSchema } from "../object"; +import { getObjectLikeUtils, ObjectLikeSchema } from "../object-like"; +import { getSchemaUtils } from "../schema-utils"; +import { Discriminant } from "./discriminant"; +import { inferParsedDiscriminant, inferParsedUnion, inferRawDiscriminant, inferRawUnion, UnionSubtypes } from "./types"; + +export function union, U extends UnionSubtypes>( + discriminant: D, + union: U +): ObjectLikeSchema, inferParsedUnion> { + const rawDiscriminant = + typeof discriminant === "string" ? discriminant : (discriminant.rawDiscriminant as inferRawDiscriminant); + const parsedDiscriminant = + typeof discriminant === "string" + ? discriminant + : (discriminant.parsedDiscriminant as inferParsedDiscriminant); + + const discriminantValueSchema = enum_(keys(union) as string[]); + + const baseSchema: BaseSchema, inferParsedUnion> = { + parse: async (raw, opts) => { + return transformAndValidateUnion({ + value: raw, + discriminant: rawDiscriminant, + transformedDiscriminant: parsedDiscriminant, + transformDiscriminantValue: (discriminantValue) => + discriminantValueSchema.parse(discriminantValue, { + allowUnrecognizedEnumValues: opts?.allowUnrecognizedUnionMembers, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), rawDiscriminant], + }), + getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue], + allowUnrecognizedUnionMembers: opts?.allowUnrecognizedUnionMembers, + transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => + additionalPropertiesSchema.parse(additionalProperties, opts), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + json: async (parsed, opts) => { + return transformAndValidateUnion({ + value: parsed, + discriminant: parsedDiscriminant, + transformedDiscriminant: rawDiscriminant, + transformDiscriminantValue: (discriminantValue) => + discriminantValueSchema.json(discriminantValue, { + allowUnrecognizedEnumValues: opts?.allowUnrecognizedUnionMembers, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedDiscriminant], + }), + getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue], + allowUnrecognizedUnionMembers: opts?.allowUnrecognizedUnionMembers, + transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => + additionalPropertiesSchema.json(additionalProperties, opts), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + getType: () => SchemaType.UNION, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + }; +} + +async function transformAndValidateUnion< + TransformedDiscriminant extends string, + TransformedDiscriminantValue extends string, + TransformedAdditionalProperties +>({ + value, + discriminant, + transformedDiscriminant, + transformDiscriminantValue, + getAdditionalPropertiesSchema, + allowUnrecognizedUnionMembers = false, + transformAdditionalProperties, + breadcrumbsPrefix = [], +}: { + value: unknown; + discriminant: string; + transformedDiscriminant: TransformedDiscriminant; + transformDiscriminantValue: (discriminantValue: unknown) => MaybePromise>; + getAdditionalPropertiesSchema: (discriminantValue: string) => ObjectSchema | undefined; + allowUnrecognizedUnionMembers: boolean | undefined; + transformAdditionalProperties: ( + additionalProperties: unknown, + additionalPropertiesSchema: ObjectSchema + ) => MaybePromise>; + breadcrumbsPrefix: string[] | undefined; +}): Promise< + MaybeValid & TransformedAdditionalProperties> +> { + if (!isPlainObject(value)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "object"), + }, + ], + }; + } + + const { [discriminant]: discriminantValue, ...additionalProperties } = value; + + if (discriminantValue == null) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: `Missing discriminant ("${discriminant}")`, + }, + ], + }; + } + + const transformedDiscriminantValue = await transformDiscriminantValue(discriminantValue); + if (!transformedDiscriminantValue.ok) { + return { + ok: false, + errors: transformedDiscriminantValue.errors, + }; + } + + const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value); + + if (additionalPropertiesSchema == null) { + if (allowUnrecognizedUnionMembers) { + return { + ok: true, + value: { + [transformedDiscriminant]: transformedDiscriminantValue.value, + ...additionalProperties, + } as Record & TransformedAdditionalProperties, + }; + } else { + return { + ok: false, + errors: [ + { + path: [...breadcrumbsPrefix, discriminant], + message: "Unexpected discriminant value", + }, + ], + }; + } + } + + const transformedAdditionalProperties = await transformAdditionalProperties( + additionalProperties, + additionalPropertiesSchema + ); + if (!transformedAdditionalProperties.ok) { + return transformedAdditionalProperties; + } + + return { + ok: true, + value: { + [transformedDiscriminant]: discriminantValue, + ...transformedAdditionalProperties.value, + } as Record & TransformedAdditionalProperties, + }; +} diff --git a/src/core/schemas/index.ts b/src/core/schemas/index.ts new file mode 100644 index 00000000..5429d8b4 --- /dev/null +++ b/src/core/schemas/index.ts @@ -0,0 +1,2 @@ +export * from "./builders"; +export type { inferParsed, inferRaw, Schema, SchemaOptions } from "./Schema"; diff --git a/src/core/schemas/utils/MaybePromise.ts b/src/core/schemas/utils/MaybePromise.ts new file mode 100644 index 00000000..9cd354b3 --- /dev/null +++ b/src/core/schemas/utils/MaybePromise.ts @@ -0,0 +1 @@ +export type MaybePromise = T | Promise; diff --git a/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts b/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts new file mode 100644 index 00000000..4111d703 --- /dev/null +++ b/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts @@ -0,0 +1,15 @@ +export type addQuestionMarksToNullableProperties = { + [K in OptionalKeys]?: T[K]; +} & Pick>; + +export type OptionalKeys = { + [K in keyof T]-?: undefined extends T[K] + ? K + : null extends T[K] + ? K + : 1 extends (any extends T[K] ? 0 : 1) + ? never + : K; +}[keyof T]; + +export type RequiredKeys = Exclude>; diff --git a/src/core/schemas/utils/createIdentitySchemaCreator.ts b/src/core/schemas/utils/createIdentitySchemaCreator.ts new file mode 100644 index 00000000..de107cf5 --- /dev/null +++ b/src/core/schemas/utils/createIdentitySchemaCreator.ts @@ -0,0 +1,21 @@ +import { getSchemaUtils } from "../builders/schema-utils"; +import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType } from "../Schema"; +import { maybeSkipValidation } from "./maybeSkipValidation"; + +export function createIdentitySchemaCreator( + schemaType: SchemaType, + validate: (value: unknown, opts?: SchemaOptions) => MaybeValid +): () => Schema { + return () => { + const baseSchema: BaseSchema = { + parse: validate, + json: validate, + getType: () => schemaType, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; + }; +} diff --git a/src/core/schemas/utils/entries.ts b/src/core/schemas/utils/entries.ts new file mode 100644 index 00000000..e1229521 --- /dev/null +++ b/src/core/schemas/utils/entries.ts @@ -0,0 +1,3 @@ +export function entries(object: T): [keyof T, T[keyof T]][] { + return Object.entries(object) as [keyof T, T[keyof T]][]; +} diff --git a/src/core/schemas/utils/filterObject.ts b/src/core/schemas/utils/filterObject.ts new file mode 100644 index 00000000..2c25a345 --- /dev/null +++ b/src/core/schemas/utils/filterObject.ts @@ -0,0 +1,10 @@ +export function filterObject(obj: T, keysToInclude: K[]): Pick { + const keysToIncludeSet = new Set(keysToInclude); + return Object.entries(obj).reduce((acc, [key, value]) => { + if (keysToIncludeSet.has(key as K)) { + acc[key as K] = value; + } + return acc; + // eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter + }, {} as Pick); +} diff --git a/src/core/schemas/utils/getErrorMessageForIncorrectType.ts b/src/core/schemas/utils/getErrorMessageForIncorrectType.ts new file mode 100644 index 00000000..438012df --- /dev/null +++ b/src/core/schemas/utils/getErrorMessageForIncorrectType.ts @@ -0,0 +1,21 @@ +export function getErrorMessageForIncorrectType(value: unknown, expectedType: string): string { + return `Expected ${expectedType}. Received ${getTypeAsString(value)}.`; +} + +function getTypeAsString(value: unknown): string { + if (Array.isArray(value)) { + return "list"; + } + if (value === null) { + return "null"; + } + switch (typeof value) { + case "string": + return `"${value}"`; + case "number": + case "boolean": + case "undefined": + return `${value}`; + } + return typeof value; +} diff --git a/src/core/schemas/utils/isPlainObject.ts b/src/core/schemas/utils/isPlainObject.ts new file mode 100644 index 00000000..db82a722 --- /dev/null +++ b/src/core/schemas/utils/isPlainObject.ts @@ -0,0 +1,17 @@ +// borrowed from https://github.com/lodash/lodash/blob/master/isPlainObject.js +export function isPlainObject(value: unknown): value is Record { + if (typeof value !== "object" || value === null) { + return false; + } + + if (Object.getPrototypeOf(value) === null) { + return true; + } + + let proto = value; + while (Object.getPrototypeOf(proto) !== null) { + proto = Object.getPrototypeOf(proto); + } + + return Object.getPrototypeOf(value) === proto; +} diff --git a/src/core/schemas/utils/keys.ts b/src/core/schemas/utils/keys.ts new file mode 100644 index 00000000..01867098 --- /dev/null +++ b/src/core/schemas/utils/keys.ts @@ -0,0 +1,3 @@ +export function keys(object: T): (keyof T)[] { + return Object.keys(object) as (keyof T)[]; +} diff --git a/src/core/schemas/utils/maybeSkipValidation.ts b/src/core/schemas/utils/maybeSkipValidation.ts new file mode 100644 index 00000000..99c02c32 --- /dev/null +++ b/src/core/schemas/utils/maybeSkipValidation.ts @@ -0,0 +1,39 @@ +import { BaseSchema, MaybeValid, SchemaOptions } from "../Schema"; +import { MaybePromise } from "./MaybePromise"; + +export function maybeSkipValidation, Raw, Parsed>(schema: S): S { + return { + ...schema, + json: transformAndMaybeSkipValidation(schema.json), + parse: transformAndMaybeSkipValidation(schema.parse), + }; +} + +function transformAndMaybeSkipValidation( + transform: (value: unknown, opts?: SchemaOptions) => MaybePromise> +): (value: unknown, opts?: SchemaOptions) => MaybePromise> { + return async (value, opts): Promise> => { + const transformed = await transform(value, opts); + const { skipValidation = false } = opts ?? {}; + if (!transformed.ok && skipValidation) { + // eslint-disable-next-line no-console + console.warn( + [ + "Failed to validate.", + ...transformed.errors.map( + (error) => + " - " + + (error.path.length > 0 ? `${error.path.join(".")}: ${error.message}` : error.message) + ), + ].join("\n") + ); + + return { + ok: true, + value: value as T, + }; + } else { + return transformed; + } + }; +} diff --git a/src/core/schemas/utils/partition.ts b/src/core/schemas/utils/partition.ts new file mode 100644 index 00000000..f58d6f3d --- /dev/null +++ b/src/core/schemas/utils/partition.ts @@ -0,0 +1,12 @@ +export function partition(items: readonly T[], predicate: (item: T) => boolean): [T[], T[]] { + const trueItems: T[] = [], + falseItems: T[] = []; + for (const item of items) { + if (predicate(item)) { + trueItems.push(item); + } else { + falseItems.push(item); + } + } + return [trueItems, falseItems]; +} diff --git a/src/core/webflow.ts b/src/core/webflow.ts deleted file mode 100644 index 2d741830..00000000 --- a/src/core/webflow.ts +++ /dev/null @@ -1,631 +0,0 @@ -import axios, { AxiosInstance, AxiosRequestConfig } from "axios"; -import { PaginationFilter, ErrorInterceptor } from "../core"; -import { - Collection, - IAccessTokenParams, - IAuthorizeUrlParams, - IRevokeTokenParams, - User, - Meta, - OAuth, - Site, - Webhook, - WebhookFilter, - Item, -} from "../api"; - -export const DEFAULT_HOST = "webflow.com"; -export const USER_AGENT = "Webflow Javascript SDK / 1.0"; - -export interface Options { - host?: string; - token?: string; - version?: string; - headers?: Record; - beta?: boolean; -} - -type MethodNames = - | "info" - | "authenticatedUser" - | "sites" - | "site" - | "publishSite" - | "domains" - | "collections" - | "collection" - | "items" - | "item" - | "createItem" - | "updateItem" - | "patchItem" - | "removeItem" - | "deleteItems" - | "publishItems"; - -export const SCOPES_ARRAY = [ - "assets:read", - "assets:write", - "authorized_user:read", - "cms:read", - "cms:write", - "custom_code:read", - "custom_code:write", - "forms:read", - "forms:write", - "pages:read", - "pages:write", - "sites:read", - "sites:write", - "users:read", - "users:write", - "ecommerce:read", - "ecommerce:write", -] as const; - -export type SupportedScope = typeof SCOPES_ARRAY[number]; - -type ParamValueType = string | number | boolean | null | undefined; - -/************************************************************** - * Class - **************************************************************/ -export class Webflow { - private client: AxiosInstance; - constructor(public options: Options = {}) { - this.client = axios.create(this.config); - this.client.interceptors.response.use(ErrorInterceptor); - - if (this.options.beta) { - this.removeNonBetaMethods(); - } - } - - private removeNonBetaMethods() { - const methodsToRemove: MethodNames[] = [ - "info", - "authenticatedUser", - "sites", - "site", - "publishSite", - "domains", - "collections", - "collection", - "items", - "item", - "createItem", - "updateItem", - "patchItem", - "removeItem", - "deleteItems", - "publishItems", - ]; - - methodsToRemove.forEach((method) => { - Object.defineProperty(this, method, { - value: function (): never { - throw new Error( - `The method '${method}()' is not available in beta mode. Please disable the beta option to use this method.`, - ); - }, - enumerable: false, - configurable: true, - }); - }); - } - - // Set the Authentication token - set token(value: string) { - this.options.token = value; - } - - // clear the Authorization header - clearToken() { - delete this.options.token; - } - - // The Axios configuration - get config() { - const { host = DEFAULT_HOST, token, version, headers, beta = false } = this.options; - const effectiveHost = beta ? "webflow.com/beta" : host; - - const config: AxiosRequestConfig = { - baseURL: `https://api.${effectiveHost}/`, - headers: { - "Content-Type": "application/json", - "User-Agent": USER_AGENT, - ...headers, - }, - }; - - // Add the version to the headers if passed in - if (version) config.headers["Accept-Version"] = version; - - // Add the Authorization header if a token is set - if (token) config.headers.Authorization = `Bearer ${token}`; - - config.paramsSerializer = { - serialize: (params: Record): string => { - if (typeof params !== "object" || params === null) { - return ""; - } - - const parts: string[] = []; - - for (const key in params) { - const value = params[key]; - if (value === undefined) continue; - - const safeValue = - typeof value === "string" || typeof value === "number" ? value : String(value); - - if (key === "scope") { - parts.push(`${key}=${safeValue}`); - } else { - parts.push(`${key}=${encodeURIComponent(safeValue)}`); - } - } - - return parts.join("&"); - }, - }; - - return config; - } - - /************************************************************** - * HTTP Methods - **************************************************************/ - - /** - * Send a GET request to the Webflow API - * @param path The path to the endpoint - * @param params The query parameters (optional) - * @returns The response from the Webflow API - */ - get(path: string, params?: Record) { - return this.client.get(path, { params }); - } - /** - * Send a DELETE request to the Webflow API - * @param path The path to the endpoint - * @param params The query parameters (optional) - * @returns The response from the Webflow API - */ - delete(path: string, params?: Record) { - return this.client.delete(path, { params }); - } - /** - * Send a POST request to create a new Collection - * @param path The path to the endpoint - * @param data The data to send - * @param params The query parameters (optional) - * @returns The response from the Webflow API - */ - post(path: string, data: any, params?: Record) { - return this.client.post(path, data, { params }); - } - /** - * Send a PUT request to create a new Collection - * @param path The path to the endpoint - * @param data The data to send - * @param params The query parameters (optional) - * @returns The response from the Webflow API - */ - put(path: string, data: any, params?: Record) { - return this.client.put(path, data, { params }); - } - /** - * Send a PATCH request to create a new Collection - * @param path The path to the endpoint - * @param data The data to send - * @param params The query parameters (optional) - * @returns The response from the Webflow API - */ - patch(path: string, data: any, params?: Record) { - return this.client.patch(path, data, { params }); - } - - /************************************************************** - * OAuth Endpoints - **************************************************************/ - - /** - * Create an OAuth Authorization url - * @param params The OAuth information - * @param params.state The state parameter (optional) - * @param params.scope The scope parameter (optional) - * @param params.client_id The client_id parameter (optional) - * @param params.redirect_uri The redirect_uri parameter (optional) - * @param params.response_type The response_type parameter (default: "code") - * @returns The url to redirect to - */ - authorizeUrl(params: IAuthorizeUrlParams) { - return OAuth.authorizeUrl(params, this.client); - } - /** - * Create an OAuth Access Token - * @param params The OAuth information - * @param params.code The code parameter - * @param params.client_id The client_id parameter - * @param params.client_secret The client_secret parameter - * @param params.redirect_uri The redirect_uri parameter (optional) - * @param params.grant_type The grant_type parameter (default: "authorization_code") - * @returns The access token - */ - async accessToken(params: IAccessTokenParams) { - const res = await OAuth.accessToken(params, this.client); - return res.data; - } - /** - * Revoke an OAuth Access Token - * @param params The access token information - * @param params.access_token The access token - * @param params.client_id The client_id parameter - * @param params.client_secret The client_secret parameter - * @returns The result of the revoked token - */ - async revokeToken(params: IRevokeTokenParams) { - const res = await OAuth.revokeToken(params, this.client); - return res.data; - } - - /************************************************************** - * Meta Endpoints - **************************************************************/ - - /** - * Get the current authorization information - * @returns The authorization information - */ - async info() { - const res = await Meta.info(this.client); - return res.data; - } - /** - * Get the current authenticated user - * @returns The current authenticated user - */ - async authenticatedUser() { - const res = await Meta.user(this.client); - return res.data; - } - - /************************************************************** - * Site Endpoints - **************************************************************/ - - /** - * Get a list of Sites available - * @returns A list of Sites - */ - async sites() { - const res = await Site.list(this.client); - return res.data.map((data) => new Site(this.client, { ...res, data })); - } - /** - * Get a single Site - * @param params The Site information - * @param params.siteId The Site ID - * @returns The Site - */ - async site({ siteId }: { siteId: string }) { - const res = await Site.getOne({ siteId }, this.client); - return new Site(this.client, res); - } - /** - * Publish a Site - * @param params The Site information - * @param params.siteId The Site ID - * @param params.domain The domains to publish - * @returns The result of the publish - */ - async publishSite({ siteId, domains }: { siteId: string } & { domains: string[] }) { - const res = await Site.publish({ siteId, domains }, this.client); - return res.data; - } - /** - * Get a list of Domains for a Site - * @param params The Site information - * @param params.siteId The Site ID - * @returns A list of Domains - */ - async domains({ siteId }: { siteId: string }) { - const res = await Site.domains({ siteId }, this.client); - return res.data; - } - - /************************************************************** - * Collection Endpoints - **************************************************************/ - - /** - * Get a list of Collections - * @param params The Site information - * @param params.siteId The Site ID - * @returns A list of Collections - */ - async collections({ siteId }: { siteId: string }) { - const res = await Collection.list({ siteId }, this.client); - return res.data.map((data) => new Collection(this.client, { ...res, data })); - } - /** - * Get a single Collection - * @param params The Collection information - * @param params.collectionId The Collection ID - * @returns A single Collection - */ - async collection({ collectionId }: { collectionId: string }) { - const res = await Collection.getOne({ collectionId }, this.client); - return new Collection(this.client, res); - } - - /************************************************************** - * Item Endpoints - **************************************************************/ - - /** - * Get a list of Collection Items - * @param params The Collection information - * @param params.collectionId The Collection ID - * @param params.limit The number of items to return - * @param params.offset The number of items to skip - * @returns A list of Items - */ - async items({ collectionId, limit, offset }: { collectionId: string } & PaginationFilter) { - const res = await Item.list({ collectionId, limit, offset }, this.client); - return res.data.items.map((data) => new Item(this.client, { ...res, data })); - } - /** - * Get a single Collection Item - * @param params The Item information - * @param params.collectionId The Collection ID - * @param params.itemId The Item ID - * @returns A single Collection Item - */ - async item({ itemId, collectionId }: { itemId: string; collectionId: string }) { - const res = await Item.getOne({ itemId, collectionId }, this.client); - const [item] = res.data.items.map((data) => new Item(this.client, { ...res, data })); - return item; - } - /** - * Create a new Collection Item - * @param params The Item information - * @param params.collectionId The Collection ID - * @returns The created Collection Item - */ - async createItem({ collectionId, fields }: { collectionId: string; fields: any }) { - const res = await Item.create({ collectionId, fields }, this.client); - return new Item(this.client, res); - } - /** - * Update a Collection Item - * @param params The Item information - * @param params.collectionId The Collection ID - * @param params.itemId The Item ID - * @param query The query parameters (optional) - * @returns The updated Collection Item - */ - async updateItem({ collectionId, itemId, ...fields }: { itemId: string; collectionId: string }) { - const _params = { collectionId, itemId, fields }; - const res = await Item.update(_params, this.client); - return new Item(this.client, res); - } - /** - * Patch a Collection Item - * @param params The Item information - * @param params.collectionId The Collection ID - * @param params.itemId The Item ID - * @returns The patched Collection Item - */ - async patchItem({ collectionId, itemId, ...fields }: { collectionId: string; itemId: string }) { - const _params = { collectionId, itemId, fields }; - const res = await Item.patch(_params, this.client); - return new Item(this.client, res); - } - /** - * Delete a Collection Item - * @param params The Item information - * @param params.collectionId The Collection ID - * @param params.itemId The Item ID - * @returns The deleted Collection Item result - */ - async removeItem({ collectionId, itemId }: { itemId: string; collectionId: string }) { - const res = await Item.remove({ collectionId, itemId }, this.client); - return res.data; - } - /** - * Unpublish a Collection Item - * @param params The Item information - * @param params.collectionId The Collection ID - * @param params.itemId The Item ID - * @param params.live Update the live version - * @returns The unpublished Collection Item result - */ - async deleteItems({ - collectionId, - itemIds, - live, - }: { - collectionId: string; - itemIds: string[]; - live?: boolean; - }) { - const res = await Item.unpublish({ collectionId, itemIds, live }, this.client); - return res.data; - } - /** - * Publish a Collection Item - * @param params The Item information - * @param params.collectionId The Collection ID - * @param params.itemId The Item ID - * @param params.live Update the live version - * @returns The Published Collection Item result - */ - async publishItems({ - collectionId, - itemIds, - live, - }: { - collectionId: string; - itemIds: string[]; - live?: boolean; - }) { - const res = await Item.publish({ collectionId, itemIds, live }, this.client); - return res.data; - } - - /************************************************************** - * Membership Endpoints - **************************************************************/ - - /** - * Get a list of User accounts - * @param params The Site information - * @param params.siteId The Site ID - * @param pageParams The pagination information (optional) - * @returns A list of User accounts - */ - async users({ siteId }: { siteId: string }, pageParams?: PaginationFilter) { - const res = await User.list({ siteId, ...pageParams }, this.client); - return res.data.users.map((data) => new User(this.client, { ...res, data })); - } - - /** - * Get a single User account - * @param param The Site and User information - * @param param.siteId The Site ID - * @param param.userId The User ID - * @returns The User information - */ - async user({ siteId, userId }: { siteId: string; userId: string }) { - const res = await User.getOne({ siteId, userId }, this.client); - return new User(this.client, res, res.data, { siteId }); - } - - /** - * Update a User account - * @param params The Site and User information - * @param params.siteId The Site ID - * @param params.userId The User ID - * @returns The updated User - */ - async updateUser({ siteId, userId, ...data }: { siteId: string; userId: string; data: any }) { - const _params = { siteId, userId, data }; - const res = await User.update(_params, this.client); - return new User(this.client, res, res.data, { siteId }); - } - - /** - * Invite a User to a Site - * @param params The Site and User information - * @param params.siteId The Site ID - * @param params.email The User's email address - * @returns The created User account - */ - async inviteUser({ siteId, email }: { siteId: string; email: string }) { - const res = await User.invite({ siteId, email }, this.client); - return new User(this.client, res, res.data, { siteId }); - } - - /** - * Remove a user from a Site - * @param params The Site and User information - * @param params.siteId The Site ID - * @param params.userId The User ID - * @returns The result from the remove request - */ - async removeUser({ siteId, userId }: { siteId: string; userId: string }) { - const res = await User.remove({ siteId, userId }, this.client); - return res.data; - } - - /** - * Get a list of User Access Groups - * @param params The params for the request - * @param params.siteId The site ID - * @param params.limit The number of items to return (optional) - * @param params.offset The number of items to skip (optional) - * @param params.sort The sort order of the groups (optional) - * @returns A list of Access Groups - */ - async accessGroups({ - siteId, - limit, - offset, - sort, - }: { - siteId: string; - limit?: number; - offset?: number; - sort?: string; - }) { - const params = { siteId, limit, offset, sort }; - const res = await User.accessGroups(params, this.client); - return res.data; - } - - /************************************************************** - * Webhook Endpoints - **************************************************************/ - - /** - * Get a list of webhooks for a Site - * @param params The site information to get the Webhooks from - * @param params.siteId The Site ID - * @returns A list of Webhooks - */ - async webhooks({ siteId }: { siteId: string }) { - const res = await Webhook.list({ siteId }, this.client); - return res.data.map((data) => new Webhook(this.client, { ...res, data })); - } - - /** - * Get a single Webhook - * @param params The Webhook and Site information - * @param params.siteId The Site Id - * @param params.webhookId The Webhook Id - * @returns The Webhook - */ - async webhook({ siteId, webhookId }: { siteId: string; webhookId: string }) { - const res = await Webhook.getOne({ siteId, webhookId }, this.client); - return new Webhook(this.client, res); - } - - /** - * Remove a Webhook - * @param params The Webhook and Site information - * @param params.siteId The Site Id - * @param params.webhookId The Webhook Id - * @returns the result from the remove request - */ - async removeWebhook({ siteId, webhookId }: { siteId: string; webhookId: string }) { - const res = await Webhook.remove({ siteId, webhookId }, this.client); - return res.data; - } - - /** - * Create a Webhook - * @param params The params to create a webhooks - * @param params.siteId The Site Id - * @param params.url The Url the Webhook should call on events - * @param params.triggerType The type of event that should trigger the Webhook - * @param params.filter The filter to apply to the Webhook (form_submission only) - * @returns The created webhook - */ - async createWebhook({ - url, - siteId, - triggerType, - filter, - }: { - url: string; - siteId: string; - triggerType: string; - filter?: WebhookFilter; - }) { - const _params = { url, siteId, triggerType, filter }; - const res = await Webhook.create(_params, this.client); - return new Webhook(this.client, res); - } -} diff --git a/src/environments.ts b/src/environments.ts new file mode 100644 index 00000000..fcea4017 --- /dev/null +++ b/src/environments.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export const WebflowEnvironment = { + Default: "https://api.webflow.com/v2", +} as const; + +export type WebflowEnvironment = typeof WebflowEnvironment.Default; diff --git a/src/errors/WebflowError.ts b/src/errors/WebflowError.ts new file mode 100644 index 00000000..5618fd2b --- /dev/null +++ b/src/errors/WebflowError.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export class WebflowError extends Error { + readonly statusCode?: number; + readonly body?: unknown; + + constructor({ message, statusCode, body }: { message?: string; statusCode?: number; body?: unknown }) { + super(buildMessage({ message, statusCode, body })); + Object.setPrototypeOf(this, WebflowError.prototype); + if (statusCode != null) { + this.statusCode = statusCode; + } + + if (body !== undefined) { + this.body = body; + } + } +} + +function buildMessage({ + message, + statusCode, + body, +}: { + message: string | undefined; + statusCode: number | undefined; + body: unknown | undefined; +}): string { + let lines: string[] = []; + if (message != null) { + lines.push(message); + } + + if (statusCode != null) { + lines.push(`Status code: ${statusCode.toString()}`); + } + + if (body != null) { + lines.push(`Body: ${JSON.stringify(body, undefined, 2)}`); + } + + return lines.join("\n"); +} diff --git a/src/errors/WebflowTimeoutError.ts b/src/errors/WebflowTimeoutError.ts new file mode 100644 index 00000000..7e16b05e --- /dev/null +++ b/src/errors/WebflowTimeoutError.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export class WebflowTimeoutError extends Error { + constructor() { + super("Timeout"); + Object.setPrototypeOf(this, WebflowTimeoutError.prototype); + } +} diff --git a/src/errors/index.ts b/src/errors/index.ts new file mode 100644 index 00000000..0ce35763 --- /dev/null +++ b/src/errors/index.ts @@ -0,0 +1,2 @@ +export { WebflowError } from "./WebflowError"; +export { WebflowTimeoutError } from "./WebflowTimeoutError"; diff --git a/src/index.ts b/src/index.ts index c63c2300..2fb7df71 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ -import { Webflow } from "./core"; - -export = Webflow; +export * as Webflow from "./api"; +export { WebflowClient } from "./Client"; +export { WebflowEnvironment } from "./environments"; +export { WebflowError, WebflowTimeoutError } from "./errors"; diff --git a/src/serialization/index.ts b/src/serialization/index.ts new file mode 100644 index 00000000..3e15e290 --- /dev/null +++ b/src/serialization/index.ts @@ -0,0 +1,2 @@ +export * from "./resources"; +export * from "./types"; diff --git a/src/serialization/resources/accessGroups/index.ts b/src/serialization/resources/accessGroups/index.ts new file mode 100644 index 00000000..eea524d6 --- /dev/null +++ b/src/serialization/resources/accessGroups/index.ts @@ -0,0 +1 @@ +export * from "./types"; diff --git a/src/serialization/resources/accessGroups/types/AccessGroupsListRequestSort.ts b/src/serialization/resources/accessGroups/types/AccessGroupsListRequestSort.ts new file mode 100644 index 00000000..95fd0990 --- /dev/null +++ b/src/serialization/resources/accessGroups/types/AccessGroupsListRequestSort.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Webflow from "../../../../api"; +import * as core from "../../../../core"; + +export const AccessGroupsListRequestSort: core.serialization.Schema< + serializers.AccessGroupsListRequestSort.Raw, + Webflow.AccessGroupsListRequestSort +> = core.serialization.enum_(["CreatedOn", "-CreatedOn"]); + +export declare namespace AccessGroupsListRequestSort { + type Raw = "CreatedOn" | "-CreatedOn"; +} diff --git a/src/serialization/resources/accessGroups/types/index.ts b/src/serialization/resources/accessGroups/types/index.ts new file mode 100644 index 00000000..5b80efb0 --- /dev/null +++ b/src/serialization/resources/accessGroups/types/index.ts @@ -0,0 +1 @@ +export * from "./AccessGroupsListRequestSort"; diff --git a/src/serialization/resources/assets/client/index.ts b/src/serialization/resources/assets/client/index.ts new file mode 100644 index 00000000..257d03e9 --- /dev/null +++ b/src/serialization/resources/assets/client/index.ts @@ -0,0 +1,2 @@ +export * as list from "./list"; +export * from "./requests"; diff --git a/src/serialization/resources/assets/client/list.ts b/src/serialization/resources/assets/client/list.ts new file mode 100644 index 00000000..15b796c7 --- /dev/null +++ b/src/serialization/resources/assets/client/list.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Webflow from "../../../../api"; +import * as core from "../../../../core"; + +export const Response: core.serialization.Schema = + core.serialization.list(core.serialization.lazyObject(async () => (await import("../../..")).Asset)); + +export declare namespace Response { + type Raw = serializers.Asset.Raw[]; +} diff --git a/src/serialization/resources/assets/client/requests/AssetsCreateFolderRequest.ts b/src/serialization/resources/assets/client/requests/AssetsCreateFolderRequest.ts new file mode 100644 index 00000000..b40dcf77 --- /dev/null +++ b/src/serialization/resources/assets/client/requests/AssetsCreateFolderRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const AssetsCreateFolderRequest: core.serialization.Schema< + serializers.AssetsCreateFolderRequest.Raw, + Webflow.AssetsCreateFolderRequest +> = core.serialization.object({ + displayName: core.serialization.string(), + parentFolder: core.serialization.string().optional(), +}); + +export declare namespace AssetsCreateFolderRequest { + interface Raw { + displayName: string; + parentFolder?: string | null; + } +} diff --git a/src/serialization/resources/assets/client/requests/AssetsCreateRequest.ts b/src/serialization/resources/assets/client/requests/AssetsCreateRequest.ts new file mode 100644 index 00000000..b1ed7531 --- /dev/null +++ b/src/serialization/resources/assets/client/requests/AssetsCreateRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const AssetsCreateRequest: core.serialization.Schema< + serializers.AssetsCreateRequest.Raw, + Webflow.AssetsCreateRequest +> = core.serialization.object({ + fileName: core.serialization.string(), + fileHash: core.serialization.string(), + parentFolder: core.serialization.string().optional(), +}); + +export declare namespace AssetsCreateRequest { + interface Raw { + fileName: string; + fileHash: string; + parentFolder?: string | null; + } +} diff --git a/src/serialization/resources/assets/client/requests/index.ts b/src/serialization/resources/assets/client/requests/index.ts new file mode 100644 index 00000000..1fd1f947 --- /dev/null +++ b/src/serialization/resources/assets/client/requests/index.ts @@ -0,0 +1,2 @@ +export { AssetsCreateRequest } from "./AssetsCreateRequest"; +export { AssetsCreateFolderRequest } from "./AssetsCreateFolderRequest"; diff --git a/src/serialization/resources/assets/index.ts b/src/serialization/resources/assets/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/serialization/resources/assets/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/collections/client/index.ts b/src/serialization/resources/collections/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/collections/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/collections/client/requests/CollectionsCreateRequest.ts b/src/serialization/resources/collections/client/requests/CollectionsCreateRequest.ts new file mode 100644 index 00000000..bc720c96 --- /dev/null +++ b/src/serialization/resources/collections/client/requests/CollectionsCreateRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const CollectionsCreateRequest: core.serialization.Schema< + serializers.CollectionsCreateRequest.Raw, + Webflow.CollectionsCreateRequest +> = core.serialization.object({ + displayName: core.serialization.string(), + singularName: core.serialization.string(), + slug: core.serialization.string().optional(), +}); + +export declare namespace CollectionsCreateRequest { + interface Raw { + displayName: string; + singularName: string; + slug?: string | null; + } +} diff --git a/src/serialization/resources/collections/client/requests/index.ts b/src/serialization/resources/collections/client/requests/index.ts new file mode 100644 index 00000000..1694555b --- /dev/null +++ b/src/serialization/resources/collections/client/requests/index.ts @@ -0,0 +1 @@ +export { CollectionsCreateRequest } from "./CollectionsCreateRequest"; diff --git a/src/serialization/resources/collections/index.ts b/src/serialization/resources/collections/index.ts new file mode 100644 index 00000000..4ce0f390 --- /dev/null +++ b/src/serialization/resources/collections/index.ts @@ -0,0 +1,2 @@ +export * from "./resources"; +export * from "./client"; diff --git a/src/serialization/resources/collections/resources/fields/client/index.ts b/src/serialization/resources/collections/resources/fields/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/collections/resources/fields/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/collections/resources/fields/client/requests/FieldUpdate.ts b/src/serialization/resources/collections/resources/fields/client/requests/FieldUpdate.ts new file mode 100644 index 00000000..4b639fc3 --- /dev/null +++ b/src/serialization/resources/collections/resources/fields/client/requests/FieldUpdate.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../.."; +import * as Webflow from "../../../../../../../api"; +import * as core from "../../../../../../../core"; + +export const FieldUpdate: core.serialization.Schema< + serializers.collections.FieldUpdate.Raw, + Webflow.collections.FieldUpdate +> = core.serialization.object({ + isRequired: core.serialization.boolean().optional(), + displayName: core.serialization.string().optional(), + helpText: core.serialization.string().optional(), +}); + +export declare namespace FieldUpdate { + interface Raw { + isRequired?: boolean | null; + displayName?: string | null; + helpText?: string | null; + } +} diff --git a/src/serialization/resources/collections/resources/fields/client/requests/index.ts b/src/serialization/resources/collections/resources/fields/client/requests/index.ts new file mode 100644 index 00000000..6eda1252 --- /dev/null +++ b/src/serialization/resources/collections/resources/fields/client/requests/index.ts @@ -0,0 +1 @@ +export { FieldUpdate } from "./FieldUpdate"; diff --git a/src/serialization/resources/collections/resources/fields/index.ts b/src/serialization/resources/collections/resources/fields/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/serialization/resources/collections/resources/fields/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/collections/resources/index.ts b/src/serialization/resources/collections/resources/index.ts new file mode 100644 index 00000000..2452d24a --- /dev/null +++ b/src/serialization/resources/collections/resources/index.ts @@ -0,0 +1,5 @@ +export * as items from "./items"; +export * from "./items/types"; +export * as fields from "./fields"; +export * from "./fields/client/requests"; +export * from "./items/client/requests"; diff --git a/src/serialization/resources/collections/resources/items/client/index.ts b/src/serialization/resources/collections/resources/items/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/collections/resources/items/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/collections/resources/items/client/requests/ItemsPublishItemRequest.ts b/src/serialization/resources/collections/resources/items/client/requests/ItemsPublishItemRequest.ts new file mode 100644 index 00000000..b1d1329b --- /dev/null +++ b/src/serialization/resources/collections/resources/items/client/requests/ItemsPublishItemRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../.."; +import * as Webflow from "../../../../../../../api"; +import * as core from "../../../../../../../core"; + +export const ItemsPublishItemRequest: core.serialization.Schema< + serializers.collections.ItemsPublishItemRequest.Raw, + Webflow.collections.ItemsPublishItemRequest +> = core.serialization.object({ + itemIds: core.serialization.list(core.serialization.string()), +}); + +export declare namespace ItemsPublishItemRequest { + interface Raw { + itemIds: string[]; + } +} diff --git a/src/serialization/resources/collections/resources/items/client/requests/index.ts b/src/serialization/resources/collections/resources/items/client/requests/index.ts new file mode 100644 index 00000000..a1b783c7 --- /dev/null +++ b/src/serialization/resources/collections/resources/items/client/requests/index.ts @@ -0,0 +1 @@ +export { ItemsPublishItemRequest } from "./ItemsPublishItemRequest"; diff --git a/src/serialization/resources/collections/resources/items/index.ts b/src/serialization/resources/collections/resources/items/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/serialization/resources/collections/resources/items/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/collections/resources/items/types/ItemsPublishItemResponse.ts b/src/serialization/resources/collections/resources/items/types/ItemsPublishItemResponse.ts new file mode 100644 index 00000000..b001914c --- /dev/null +++ b/src/serialization/resources/collections/resources/items/types/ItemsPublishItemResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../.."; +import * as Webflow from "../../../../../../api"; +import * as core from "../../../../../../core"; + +export const ItemsPublishItemResponse: core.serialization.ObjectSchema< + serializers.collections.ItemsPublishItemResponse.Raw, + Webflow.collections.ItemsPublishItemResponse +> = core.serialization.object({ + publishedItemIds: core.serialization.list(core.serialization.string()).optional(), + errors: core.serialization.list(core.serialization.string()).optional(), +}); + +export declare namespace ItemsPublishItemResponse { + interface Raw { + publishedItemIds?: string[] | null; + errors?: string[] | null; + } +} diff --git a/src/serialization/resources/collections/resources/items/types/index.ts b/src/serialization/resources/collections/resources/items/types/index.ts new file mode 100644 index 00000000..3bd3eea7 --- /dev/null +++ b/src/serialization/resources/collections/resources/items/types/index.ts @@ -0,0 +1 @@ +export * from "./ItemsPublishItemResponse"; diff --git a/src/serialization/resources/forms/client/index.ts b/src/serialization/resources/forms/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/forms/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/forms/client/requests/FormsUpdateSubmissionRequest.ts b/src/serialization/resources/forms/client/requests/FormsUpdateSubmissionRequest.ts new file mode 100644 index 00000000..480a0b81 --- /dev/null +++ b/src/serialization/resources/forms/client/requests/FormsUpdateSubmissionRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const FormsUpdateSubmissionRequest: core.serialization.Schema< + serializers.FormsUpdateSubmissionRequest.Raw, + Webflow.FormsUpdateSubmissionRequest +> = core.serialization.object({ + formSubmissionData: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), +}); + +export declare namespace FormsUpdateSubmissionRequest { + interface Raw { + formSubmissionData?: Record | null; + } +} diff --git a/src/serialization/resources/forms/client/requests/index.ts b/src/serialization/resources/forms/client/requests/index.ts new file mode 100644 index 00000000..71e69650 --- /dev/null +++ b/src/serialization/resources/forms/client/requests/index.ts @@ -0,0 +1 @@ +export { FormsUpdateSubmissionRequest } from "./FormsUpdateSubmissionRequest"; diff --git a/src/serialization/resources/forms/index.ts b/src/serialization/resources/forms/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/serialization/resources/forms/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts new file mode 100644 index 00000000..cf283290 --- /dev/null +++ b/src/serialization/resources/index.ts @@ -0,0 +1,26 @@ +export * as collections from "./collections"; +export * as users from "./users"; +export * from "./users/types"; +export * as accessGroups from "./accessGroups"; +export * from "./accessGroups/types"; +export * as products from "./products"; +export * from "./products/types"; +export * as orders from "./orders"; +export * from "./orders/types"; +export * as inventory from "./inventory"; +export * from "./inventory/types"; +export * as webhooks from "./webhooks"; +export * as assets from "./assets"; +export * as sites from "./sites"; +export * from "./sites/client/requests"; +export * from "./collections/client/requests"; +export * as scripts from "./scripts"; +export * from "./scripts/client/requests"; +export * from "./webhooks/client/requests"; +export * from "./assets/client/requests"; +export * as forms from "./forms"; +export * from "./forms/client/requests"; +export * from "./users/client/requests"; +export * from "./products/client/requests"; +export * from "./orders/client/requests"; +export * from "./inventory/client/requests"; diff --git a/src/serialization/resources/inventory/client/index.ts b/src/serialization/resources/inventory/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/inventory/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/inventory/client/requests/InventoryUpdateRequest.ts b/src/serialization/resources/inventory/client/requests/InventoryUpdateRequest.ts new file mode 100644 index 00000000..7353bd55 --- /dev/null +++ b/src/serialization/resources/inventory/client/requests/InventoryUpdateRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const InventoryUpdateRequest: core.serialization.Schema< + serializers.InventoryUpdateRequest.Raw, + Webflow.InventoryUpdateRequest +> = core.serialization.object({ + inventoryType: core.serialization.lazy( + async () => (await import("../../../..")).InventoryUpdateRequestInventoryType + ), + updateQuantity: core.serialization.number().optional(), + quantity: core.serialization.number().optional(), +}); + +export declare namespace InventoryUpdateRequest { + interface Raw { + inventoryType: serializers.InventoryUpdateRequestInventoryType.Raw; + updateQuantity?: number | null; + quantity?: number | null; + } +} diff --git a/src/serialization/resources/inventory/client/requests/index.ts b/src/serialization/resources/inventory/client/requests/index.ts new file mode 100644 index 00000000..db74c38a --- /dev/null +++ b/src/serialization/resources/inventory/client/requests/index.ts @@ -0,0 +1 @@ +export { InventoryUpdateRequest } from "./InventoryUpdateRequest"; diff --git a/src/serialization/resources/inventory/index.ts b/src/serialization/resources/inventory/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/serialization/resources/inventory/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/inventory/types/InventoryUpdateRequestInventoryType.ts b/src/serialization/resources/inventory/types/InventoryUpdateRequestInventoryType.ts new file mode 100644 index 00000000..9f103ddc --- /dev/null +++ b/src/serialization/resources/inventory/types/InventoryUpdateRequestInventoryType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Webflow from "../../../../api"; +import * as core from "../../../../core"; + +export const InventoryUpdateRequestInventoryType: core.serialization.Schema< + serializers.InventoryUpdateRequestInventoryType.Raw, + Webflow.InventoryUpdateRequestInventoryType +> = core.serialization.enum_(["infinite", "finite"]); + +export declare namespace InventoryUpdateRequestInventoryType { + type Raw = "infinite" | "finite"; +} diff --git a/src/serialization/resources/inventory/types/index.ts b/src/serialization/resources/inventory/types/index.ts new file mode 100644 index 00000000..2e2a1559 --- /dev/null +++ b/src/serialization/resources/inventory/types/index.ts @@ -0,0 +1 @@ +export * from "./InventoryUpdateRequestInventoryType"; diff --git a/src/serialization/resources/orders/client/index.ts b/src/serialization/resources/orders/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/orders/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/orders/client/requests/OrdersRefundRequest.ts b/src/serialization/resources/orders/client/requests/OrdersRefundRequest.ts new file mode 100644 index 00000000..8ceaad1e --- /dev/null +++ b/src/serialization/resources/orders/client/requests/OrdersRefundRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const OrdersRefundRequest: core.serialization.Schema< + serializers.OrdersRefundRequest.Raw, + Webflow.OrdersRefundRequest +> = core.serialization.object({ + reason: core.serialization.lazy(async () => (await import("../../../..")).OrdersRefundRequestReason).optional(), +}); + +export declare namespace OrdersRefundRequest { + interface Raw { + reason?: serializers.OrdersRefundRequestReason.Raw | null; + } +} diff --git a/src/serialization/resources/orders/client/requests/OrdersUpdateFulfillRequest.ts b/src/serialization/resources/orders/client/requests/OrdersUpdateFulfillRequest.ts new file mode 100644 index 00000000..8067b48e --- /dev/null +++ b/src/serialization/resources/orders/client/requests/OrdersUpdateFulfillRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const OrdersUpdateFulfillRequest: core.serialization.Schema< + serializers.OrdersUpdateFulfillRequest.Raw, + Webflow.OrdersUpdateFulfillRequest +> = core.serialization.object({ + sendOrderFulfilledEmail: core.serialization.boolean().optional(), +}); + +export declare namespace OrdersUpdateFulfillRequest { + interface Raw { + sendOrderFulfilledEmail?: boolean | null; + } +} diff --git a/src/serialization/resources/orders/client/requests/OrdersUpdateRequest.ts b/src/serialization/resources/orders/client/requests/OrdersUpdateRequest.ts new file mode 100644 index 00000000..cdcd9818 --- /dev/null +++ b/src/serialization/resources/orders/client/requests/OrdersUpdateRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const OrdersUpdateRequest: core.serialization.Schema< + serializers.OrdersUpdateRequest.Raw, + Webflow.OrdersUpdateRequest +> = core.serialization.object({ + comment: core.serialization.string().optional(), + shippingProvider: core.serialization.string().optional(), + shippingTracking: core.serialization.string().optional(), + shippingTrackingUrl: core.serialization.property("shippingTrackingURL", core.serialization.string().optional()), +}); + +export declare namespace OrdersUpdateRequest { + interface Raw { + comment?: string | null; + shippingProvider?: string | null; + shippingTracking?: string | null; + shippingTrackingURL?: string | null; + } +} diff --git a/src/serialization/resources/orders/client/requests/index.ts b/src/serialization/resources/orders/client/requests/index.ts new file mode 100644 index 00000000..18ba18f8 --- /dev/null +++ b/src/serialization/resources/orders/client/requests/index.ts @@ -0,0 +1,3 @@ +export { OrdersUpdateRequest } from "./OrdersUpdateRequest"; +export { OrdersUpdateFulfillRequest } from "./OrdersUpdateFulfillRequest"; +export { OrdersRefundRequest } from "./OrdersRefundRequest"; diff --git a/src/serialization/resources/orders/index.ts b/src/serialization/resources/orders/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/serialization/resources/orders/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/orders/types/OrdersListRequestStatus.ts b/src/serialization/resources/orders/types/OrdersListRequestStatus.ts new file mode 100644 index 00000000..3f79e1f1 --- /dev/null +++ b/src/serialization/resources/orders/types/OrdersListRequestStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Webflow from "../../../../api"; +import * as core from "../../../../core"; + +export const OrdersListRequestStatus: core.serialization.Schema< + serializers.OrdersListRequestStatus.Raw, + Webflow.OrdersListRequestStatus +> = core.serialization.enum_(["pending", "refunded", "dispute-lost", "fulfilled", "disputed", "unfulfilled"]); + +export declare namespace OrdersListRequestStatus { + type Raw = "pending" | "refunded" | "dispute-lost" | "fulfilled" | "disputed" | "unfulfilled"; +} diff --git a/src/serialization/resources/orders/types/OrdersRefundRequestReason.ts b/src/serialization/resources/orders/types/OrdersRefundRequestReason.ts new file mode 100644 index 00000000..b3f84766 --- /dev/null +++ b/src/serialization/resources/orders/types/OrdersRefundRequestReason.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Webflow from "../../../../api"; +import * as core from "../../../../core"; + +export const OrdersRefundRequestReason: core.serialization.Schema< + serializers.OrdersRefundRequestReason.Raw, + Webflow.OrdersRefundRequestReason +> = core.serialization.enum_(["duplicate", "fraudulent", "requested"]); + +export declare namespace OrdersRefundRequestReason { + type Raw = "duplicate" | "fraudulent" | "requested"; +} diff --git a/src/serialization/resources/orders/types/index.ts b/src/serialization/resources/orders/types/index.ts new file mode 100644 index 00000000..59a55534 --- /dev/null +++ b/src/serialization/resources/orders/types/index.ts @@ -0,0 +1,2 @@ +export * from "./OrdersListRequestStatus"; +export * from "./OrdersRefundRequestReason"; diff --git a/src/serialization/resources/products/client/index.ts b/src/serialization/resources/products/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/products/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/products/client/requests/ProductsCreateRequest.ts b/src/serialization/resources/products/client/requests/ProductsCreateRequest.ts new file mode 100644 index 00000000..93c328f9 --- /dev/null +++ b/src/serialization/resources/products/client/requests/ProductsCreateRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const ProductsCreateRequest: core.serialization.Schema< + serializers.ProductsCreateRequest.Raw, + Webflow.ProductsCreateRequest +> = core.serialization.object({ + publishStatus: core.serialization.lazy(async () => (await import("../../../..")).PublishStatus).optional(), + product: core.serialization.lazyObject(async () => (await import("../../../..")).Product), + sku: core.serialization.lazyObject(async () => (await import("../../../..")).Sku), +}); + +export declare namespace ProductsCreateRequest { + interface Raw { + publishStatus?: serializers.PublishStatus.Raw | null; + product: serializers.Product.Raw; + sku: serializers.Sku.Raw; + } +} diff --git a/src/serialization/resources/products/client/requests/ProductsCreateSkuRequest.ts b/src/serialization/resources/products/client/requests/ProductsCreateSkuRequest.ts new file mode 100644 index 00000000..8c62f170 --- /dev/null +++ b/src/serialization/resources/products/client/requests/ProductsCreateSkuRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const ProductsCreateSkuRequest: core.serialization.Schema< + serializers.ProductsCreateSkuRequest.Raw, + Webflow.ProductsCreateSkuRequest +> = core.serialization.object({ + publishStatus: core.serialization.lazy(async () => (await import("../../../..")).PublishStatus).optional(), + skus: core.serialization.list(core.serialization.lazyObject(async () => (await import("../../../..")).Sku)), +}); + +export declare namespace ProductsCreateSkuRequest { + interface Raw { + publishStatus?: serializers.PublishStatus.Raw | null; + skus: serializers.Sku.Raw[]; + } +} diff --git a/src/serialization/resources/products/client/requests/ProductsUpdateRequest.ts b/src/serialization/resources/products/client/requests/ProductsUpdateRequest.ts new file mode 100644 index 00000000..6566f8a9 --- /dev/null +++ b/src/serialization/resources/products/client/requests/ProductsUpdateRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const ProductsUpdateRequest: core.serialization.Schema< + serializers.ProductsUpdateRequest.Raw, + Webflow.ProductsUpdateRequest +> = core.serialization.object({ + publishStatus: core.serialization.lazy(async () => (await import("../../../..")).PublishStatus).optional(), + product: core.serialization.lazyObject(async () => (await import("../../../..")).Product), +}); + +export declare namespace ProductsUpdateRequest { + interface Raw { + publishStatus?: serializers.PublishStatus.Raw | null; + product: serializers.Product.Raw; + } +} diff --git a/src/serialization/resources/products/client/requests/ProductsUpdateSkuRequest.ts b/src/serialization/resources/products/client/requests/ProductsUpdateSkuRequest.ts new file mode 100644 index 00000000..044eef76 --- /dev/null +++ b/src/serialization/resources/products/client/requests/ProductsUpdateSkuRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const ProductsUpdateSkuRequest: core.serialization.Schema< + serializers.ProductsUpdateSkuRequest.Raw, + Webflow.ProductsUpdateSkuRequest +> = core.serialization.object({ + publishStatus: core.serialization.lazy(async () => (await import("../../../..")).PublishStatus).optional(), + sku: core.serialization.lazyObject(async () => (await import("../../../..")).Sku), +}); + +export declare namespace ProductsUpdateSkuRequest { + interface Raw { + publishStatus?: serializers.PublishStatus.Raw | null; + sku: serializers.Sku.Raw; + } +} diff --git a/src/serialization/resources/products/client/requests/index.ts b/src/serialization/resources/products/client/requests/index.ts new file mode 100644 index 00000000..190942ae --- /dev/null +++ b/src/serialization/resources/products/client/requests/index.ts @@ -0,0 +1,4 @@ +export { ProductsCreateRequest } from "./ProductsCreateRequest"; +export { ProductsUpdateRequest } from "./ProductsUpdateRequest"; +export { ProductsCreateSkuRequest } from "./ProductsCreateSkuRequest"; +export { ProductsUpdateSkuRequest } from "./ProductsUpdateSkuRequest"; diff --git a/src/serialization/resources/products/index.ts b/src/serialization/resources/products/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/serialization/resources/products/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/products/types/ProductsCreateSkuResponse.ts b/src/serialization/resources/products/types/ProductsCreateSkuResponse.ts new file mode 100644 index 00000000..68687de8 --- /dev/null +++ b/src/serialization/resources/products/types/ProductsCreateSkuResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Webflow from "../../../../api"; +import * as core from "../../../../core"; + +export const ProductsCreateSkuResponse: core.serialization.ObjectSchema< + serializers.ProductsCreateSkuResponse.Raw, + Webflow.ProductsCreateSkuResponse +> = core.serialization.object({ + skus: core.serialization.list(core.serialization.lazyObject(async () => (await import("../../..")).Sku)).optional(), +}); + +export declare namespace ProductsCreateSkuResponse { + interface Raw { + skus?: serializers.Sku.Raw[] | null; + } +} diff --git a/src/serialization/resources/products/types/index.ts b/src/serialization/resources/products/types/index.ts new file mode 100644 index 00000000..e286df49 --- /dev/null +++ b/src/serialization/resources/products/types/index.ts @@ -0,0 +1 @@ +export * from "./ProductsCreateSkuResponse"; diff --git a/src/serialization/resources/scripts/client/index.ts b/src/serialization/resources/scripts/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/scripts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/scripts/client/requests/CustomCodeHostedRequest.ts b/src/serialization/resources/scripts/client/requests/CustomCodeHostedRequest.ts new file mode 100644 index 00000000..a45e7d59 --- /dev/null +++ b/src/serialization/resources/scripts/client/requests/CustomCodeHostedRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const CustomCodeHostedRequest: core.serialization.Schema< + serializers.CustomCodeHostedRequest.Raw, + Webflow.CustomCodeHostedRequest +> = core.serialization.object({ + hostedLocation: core.serialization.string(), + integrityHash: core.serialization.string(), + canCopy: core.serialization.boolean().optional(), + version: core.serialization.string(), + displayName: core.serialization.string(), +}); + +export declare namespace CustomCodeHostedRequest { + interface Raw { + hostedLocation: string; + integrityHash: string; + canCopy?: boolean | null; + version: string; + displayName: string; + } +} diff --git a/src/serialization/resources/scripts/client/requests/CustomCodeInlineRequest.ts b/src/serialization/resources/scripts/client/requests/CustomCodeInlineRequest.ts new file mode 100644 index 00000000..444d9fdb --- /dev/null +++ b/src/serialization/resources/scripts/client/requests/CustomCodeInlineRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const CustomCodeInlineRequest: core.serialization.Schema< + serializers.CustomCodeInlineRequest.Raw, + Webflow.CustomCodeInlineRequest +> = core.serialization.object({ + sourceCode: core.serialization.string(), + integrityHash: core.serialization.string().optional(), + canCopy: core.serialization.boolean().optional(), + version: core.serialization.string(), + displayName: core.serialization.string(), +}); + +export declare namespace CustomCodeInlineRequest { + interface Raw { + sourceCode: string; + integrityHash?: string | null; + canCopy?: boolean | null; + version: string; + displayName: string; + } +} diff --git a/src/serialization/resources/scripts/client/requests/index.ts b/src/serialization/resources/scripts/client/requests/index.ts new file mode 100644 index 00000000..5990c996 --- /dev/null +++ b/src/serialization/resources/scripts/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CustomCodeHostedRequest } from "./CustomCodeHostedRequest"; +export { CustomCodeInlineRequest } from "./CustomCodeInlineRequest"; diff --git a/src/serialization/resources/scripts/index.ts b/src/serialization/resources/scripts/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/serialization/resources/scripts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/sites/client/index.ts b/src/serialization/resources/sites/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/sites/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/sites/client/requests/SitesPublishRequest.ts b/src/serialization/resources/sites/client/requests/SitesPublishRequest.ts new file mode 100644 index 00000000..8bee87ea --- /dev/null +++ b/src/serialization/resources/sites/client/requests/SitesPublishRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const SitesPublishRequest: core.serialization.Schema< + serializers.SitesPublishRequest.Raw, + Webflow.SitesPublishRequest +> = core.serialization.object({ + customDomains: core.serialization.list(core.serialization.string()).optional(), + publishToWebflowSubdomain: core.serialization.boolean().optional(), +}); + +export declare namespace SitesPublishRequest { + interface Raw { + customDomains?: string[] | null; + publishToWebflowSubdomain?: boolean | null; + } +} diff --git a/src/serialization/resources/sites/client/requests/index.ts b/src/serialization/resources/sites/client/requests/index.ts new file mode 100644 index 00000000..dddc2657 --- /dev/null +++ b/src/serialization/resources/sites/client/requests/index.ts @@ -0,0 +1 @@ +export { SitesPublishRequest } from "./SitesPublishRequest"; diff --git a/src/serialization/resources/sites/index.ts b/src/serialization/resources/sites/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/serialization/resources/sites/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/users/client/index.ts b/src/serialization/resources/users/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/users/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/users/client/requests/UsersInviteRequest.ts b/src/serialization/resources/users/client/requests/UsersInviteRequest.ts new file mode 100644 index 00000000..d429a532 --- /dev/null +++ b/src/serialization/resources/users/client/requests/UsersInviteRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const UsersInviteRequest: core.serialization.Schema< + serializers.UsersInviteRequest.Raw, + Webflow.UsersInviteRequest +> = core.serialization.object({ + email: core.serialization.string(), + accessGroups: core.serialization.list(core.serialization.string()).optional(), +}); + +export declare namespace UsersInviteRequest { + interface Raw { + email: string; + accessGroups?: string[] | null; + } +} diff --git a/src/serialization/resources/users/client/requests/index.ts b/src/serialization/resources/users/client/requests/index.ts new file mode 100644 index 00000000..ecf14c3f --- /dev/null +++ b/src/serialization/resources/users/client/requests/index.ts @@ -0,0 +1 @@ +export { UsersInviteRequest } from "./UsersInviteRequest"; diff --git a/src/serialization/resources/users/index.ts b/src/serialization/resources/users/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/serialization/resources/users/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/users/types/UsersListRequestSort.ts b/src/serialization/resources/users/types/UsersListRequestSort.ts new file mode 100644 index 00000000..16f658b2 --- /dev/null +++ b/src/serialization/resources/users/types/UsersListRequestSort.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Webflow from "../../../../api"; +import * as core from "../../../../core"; + +export const UsersListRequestSort: core.serialization.Schema< + serializers.UsersListRequestSort.Raw, + Webflow.UsersListRequestSort +> = core.serialization.enum_([ + "CreatedOn", + "-CreatedOn", + "Email", + "-Email", + "Status", + "-Status", + "LastLogin", + "-LastLogin", + "UpdatedOn", + "-UpdatedOn", +]); + +export declare namespace UsersListRequestSort { + type Raw = + | "CreatedOn" + | "-CreatedOn" + | "Email" + | "-Email" + | "Status" + | "-Status" + | "LastLogin" + | "-LastLogin" + | "UpdatedOn" + | "-UpdatedOn"; +} diff --git a/src/serialization/resources/users/types/index.ts b/src/serialization/resources/users/types/index.ts new file mode 100644 index 00000000..06eb1302 --- /dev/null +++ b/src/serialization/resources/users/types/index.ts @@ -0,0 +1 @@ +export * from "./UsersListRequestSort"; diff --git a/src/serialization/resources/webhooks/client/index.ts b/src/serialization/resources/webhooks/client/index.ts new file mode 100644 index 00000000..257d03e9 --- /dev/null +++ b/src/serialization/resources/webhooks/client/index.ts @@ -0,0 +1,2 @@ +export * as list from "./list"; +export * from "./requests"; diff --git a/src/serialization/resources/webhooks/client/list.ts b/src/serialization/resources/webhooks/client/list.ts new file mode 100644 index 00000000..829fffed --- /dev/null +++ b/src/serialization/resources/webhooks/client/list.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../.."; +import * as Webflow from "../../../../api"; +import * as core from "../../../../core"; + +export const Response: core.serialization.Schema = + core.serialization.list(core.serialization.lazyObject(async () => (await import("../../..")).Webhook)); + +export declare namespace Response { + type Raw = serializers.Webhook.Raw[]; +} diff --git a/src/serialization/resources/webhooks/client/requests/WebhooksCreateRequest.ts b/src/serialization/resources/webhooks/client/requests/WebhooksCreateRequest.ts new file mode 100644 index 00000000..9997f894 --- /dev/null +++ b/src/serialization/resources/webhooks/client/requests/WebhooksCreateRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../.."; +import * as Webflow from "../../../../../api"; +import * as core from "../../../../../core"; + +export const WebhooksCreateRequest: core.serialization.Schema< + serializers.WebhooksCreateRequest.Raw, + Webflow.WebhooksCreateRequest +> = core.serialization.object({ + triggerType: core.serialization.lazy(async () => (await import("../../../..")).TriggerType), + url: core.serialization.string(), + filter: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), +}); + +export declare namespace WebhooksCreateRequest { + interface Raw { + triggerType: serializers.TriggerType.Raw; + url: string; + filter?: Record | null; + } +} diff --git a/src/serialization/resources/webhooks/client/requests/index.ts b/src/serialization/resources/webhooks/client/requests/index.ts new file mode 100644 index 00000000..f7f7b70d --- /dev/null +++ b/src/serialization/resources/webhooks/client/requests/index.ts @@ -0,0 +1 @@ +export { WebhooksCreateRequest } from "./WebhooksCreateRequest"; diff --git a/src/serialization/resources/webhooks/index.ts b/src/serialization/resources/webhooks/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/serialization/resources/webhooks/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/types/AccessGroup.ts b/src/serialization/types/AccessGroup.ts new file mode 100644 index 00000000..e67d7450 --- /dev/null +++ b/src/serialization/types/AccessGroup.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const AccessGroup: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.property("_id", core.serialization.string().optional()), + name: core.serialization.string().optional(), + shortId: core.serialization.string().optional(), + slug: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + }); + +export declare namespace AccessGroup { + interface Raw { + _id?: string | null; + name?: string | null; + shortId?: string | null; + slug?: string | null; + createdOn?: string | null; + } +} diff --git a/src/serialization/types/AccessGroupList.ts b/src/serialization/types/AccessGroupList.ts new file mode 100644 index 00000000..5c6aecac --- /dev/null +++ b/src/serialization/types/AccessGroupList.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const AccessGroupList: core.serialization.ObjectSchema< + serializers.AccessGroupList.Raw, + Webflow.AccessGroupList +> = core.serialization.object({ + count: core.serialization.number().optional(), + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + total: core.serialization.number().optional(), + accessGroups: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).AccessGroup)) + .optional(), +}); + +export declare namespace AccessGroupList { + interface Raw { + count?: number | null; + limit?: number | null; + offset?: number | null; + total?: number | null; + accessGroups?: serializers.AccessGroup.Raw[] | null; + } +} diff --git a/src/serialization/types/Application.ts b/src/serialization/types/Application.ts new file mode 100644 index 00000000..e89de288 --- /dev/null +++ b/src/serialization/types/Application.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Application: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + description: core.serialization.string().optional(), + homepage: core.serialization.string().optional(), + displayName: core.serialization.string().optional(), + }); + +export declare namespace Application { + interface Raw { + id?: string | null; + description?: string | null; + homepage?: string | null; + displayName?: string | null; + } +} diff --git a/src/serialization/types/Asset.ts b/src/serialization/types/Asset.ts new file mode 100644 index 00000000..e9afdecf --- /dev/null +++ b/src/serialization/types/Asset.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Asset: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + contentType: core.serialization.string().optional(), + size: core.serialization.number().optional(), + siteId: core.serialization.string().optional(), + hostedUrl: core.serialization.string().optional(), + originalFileName: core.serialization.string().optional(), + displayName: core.serialization.string().optional(), + lastUpdated: core.serialization.date().optional(), + createdOn: core.serialization.date().optional(), + variants: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).AssetVariant)) + .optional(), +}); + +export declare namespace Asset { + interface Raw { + id?: string | null; + contentType?: string | null; + size?: number | null; + siteId?: string | null; + hostedUrl?: string | null; + originalFileName?: string | null; + displayName?: string | null; + lastUpdated?: string | null; + createdOn?: string | null; + variants?: serializers.AssetVariant.Raw[] | null; + } +} diff --git a/src/serialization/types/AssetFolder.ts b/src/serialization/types/AssetFolder.ts new file mode 100644 index 00000000..c924b9e5 --- /dev/null +++ b/src/serialization/types/AssetFolder.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const AssetFolder: core.serialization.ObjectSchema = + core.serialization.object({ + displayName: core.serialization.string().optional(), + id: core.serialization.string().optional(), + parentFolder: core.serialization.string().optional(), + assets: core.serialization.list(core.serialization.string()).optional(), + siteId: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + lastUpdated: core.serialization.date().optional(), + }); + +export declare namespace AssetFolder { + interface Raw { + displayName?: string | null; + id?: string | null; + parentFolder?: string | null; + assets?: string[] | null; + siteId?: string | null; + createdOn?: string | null; + lastUpdated?: string | null; + } +} diff --git a/src/serialization/types/AssetFolderList.ts b/src/serialization/types/AssetFolderList.ts new file mode 100644 index 00000000..e2fe6298 --- /dev/null +++ b/src/serialization/types/AssetFolderList.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const AssetFolderList: core.serialization.ObjectSchema< + serializers.AssetFolderList.Raw, + Webflow.AssetFolderList +> = core.serialization.object({ + pagination: core.serialization.lazyObject(async () => (await import("..")).Pagination).optional(), + pages: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).AssetFolder)) + .optional(), +}); + +export declare namespace AssetFolderList { + interface Raw { + pagination?: serializers.Pagination.Raw | null; + pages?: serializers.AssetFolder.Raw[] | null; + } +} diff --git a/src/serialization/types/AssetUpload.ts b/src/serialization/types/AssetUpload.ts new file mode 100644 index 00000000..c56170df --- /dev/null +++ b/src/serialization/types/AssetUpload.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const AssetUpload: core.serialization.ObjectSchema = + core.serialization.object({ + uploadDetails: core.serialization + .lazyObject(async () => (await import("..")).AssetUploadUploadDetails) + .optional(), + id: core.serialization.string().optional(), + contentType: core.serialization.string().optional(), + parentFolder: core.serialization.string().optional(), + hostedUrl: core.serialization.string().optional(), + uploadUrl: core.serialization.string().optional(), + assetUrl: core.serialization.string().optional(), + originalFileName: core.serialization.string().optional(), + lastUpdated: core.serialization.date().optional(), + createdOn: core.serialization.date().optional(), + }); + +export declare namespace AssetUpload { + interface Raw { + uploadDetails?: serializers.AssetUploadUploadDetails.Raw | null; + id?: string | null; + contentType?: string | null; + parentFolder?: string | null; + hostedUrl?: string | null; + uploadUrl?: string | null; + assetUrl?: string | null; + originalFileName?: string | null; + lastUpdated?: string | null; + createdOn?: string | null; + } +} diff --git a/src/serialization/types/AssetUploadUploadDetails.ts b/src/serialization/types/AssetUploadUploadDetails.ts new file mode 100644 index 00000000..4b1c2358 --- /dev/null +++ b/src/serialization/types/AssetUploadUploadDetails.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const AssetUploadUploadDetails: core.serialization.ObjectSchema< + serializers.AssetUploadUploadDetails.Raw, + Webflow.AssetUploadUploadDetails +> = core.serialization.object({ + acl: core.serialization.string().optional(), + bucket: core.serialization.string().optional(), + key: core.serialization.string().optional(), + policy: core.serialization.property("Policy", core.serialization.string().optional()), + xAmzAlgorithm: core.serialization.property("X-Amz-Algorithm", core.serialization.string().optional()), + xAmzCredential: core.serialization.property("X-Amz-Credential", core.serialization.string().optional()), + xAmzDate: core.serialization.property("X-Amz-Date", core.serialization.string().optional()), + xAmzSecurityToken: core.serialization.property("X-Amz-Security-Token", core.serialization.string().optional()), + xAmzSignature: core.serialization.property("X-Amz-Signature", core.serialization.string().optional()), + successActionStatus: core.serialization.property("success_action_status", core.serialization.string().optional()), + contentType: core.serialization.property("content-type", core.serialization.string().optional()), + cacheControl: core.serialization.property("Cache-Control", core.serialization.string().optional()), +}); + +export declare namespace AssetUploadUploadDetails { + interface Raw { + acl?: string | null; + bucket?: string | null; + key?: string | null; + Policy?: string | null; + "X-Amz-Algorithm"?: string | null; + "X-Amz-Credential"?: string | null; + "X-Amz-Date"?: string | null; + "X-Amz-Security-Token"?: string | null; + "X-Amz-Signature"?: string | null; + success_action_status?: string | null; + "content-type"?: string | null; + "Cache-Control"?: string | null; + } +} diff --git a/src/serialization/types/AssetVariant.ts b/src/serialization/types/AssetVariant.ts new file mode 100644 index 00000000..d81ea0f2 --- /dev/null +++ b/src/serialization/types/AssetVariant.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const AssetVariant: core.serialization.ObjectSchema = + core.serialization.object({ + hostedUrl: core.serialization.string().optional(), + originalFileName: core.serialization.string().optional(), + displayName: core.serialization.string().optional(), + format: core.serialization.string().optional(), + width: core.serialization.number().optional(), + height: core.serialization.number().optional(), + quality: core.serialization.number().optional(), + error: core.serialization.string().optional(), + }); + +export declare namespace AssetVariant { + interface Raw { + hostedUrl?: string | null; + originalFileName?: string | null; + displayName?: string | null; + format?: string | null; + width?: number | null; + height?: number | null; + quality?: number | null; + error?: string | null; + } +} diff --git a/src/serialization/types/Assets.ts b/src/serialization/types/Assets.ts new file mode 100644 index 00000000..90301010 --- /dev/null +++ b/src/serialization/types/Assets.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Assets: core.serialization.ObjectSchema = + core.serialization.object({ + assets: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).Asset)) + .optional(), + }); + +export declare namespace Assets { + interface Raw { + assets?: serializers.Asset.Raw[] | null; + } +} diff --git a/src/serialization/types/Authorization.ts b/src/serialization/types/Authorization.ts new file mode 100644 index 00000000..2812a785 --- /dev/null +++ b/src/serialization/types/Authorization.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Authorization: core.serialization.ObjectSchema = + core.serialization.object({ + authorization: core.serialization + .lazyObject(async () => (await import("..")).AuthorizationAuthorization) + .optional(), + application: core.serialization.lazyObject(async () => (await import("..")).Application).optional(), + }); + +export declare namespace Authorization { + interface Raw { + authorization?: serializers.AuthorizationAuthorization.Raw | null; + application?: serializers.Application.Raw | null; + } +} diff --git a/src/serialization/types/AuthorizationAuthorization.ts b/src/serialization/types/AuthorizationAuthorization.ts new file mode 100644 index 00000000..7c275827 --- /dev/null +++ b/src/serialization/types/AuthorizationAuthorization.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const AuthorizationAuthorization: core.serialization.ObjectSchema< + serializers.AuthorizationAuthorization.Raw, + Webflow.AuthorizationAuthorization +> = core.serialization.object({ + id: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + lastUsed: core.serialization.date().optional(), + grantType: core.serialization.string().optional(), + rateLimit: core.serialization.number().optional(), + scope: core.serialization.string().optional(), + authorizedTo: core.serialization + .lazyObject(async () => (await import("..")).AuthorizationAuthorizationAuthorizedTo) + .optional(), +}); + +export declare namespace AuthorizationAuthorization { + interface Raw { + id?: string | null; + createdOn?: string | null; + lastUsed?: string | null; + grantType?: string | null; + rateLimit?: number | null; + scope?: string | null; + authorizedTo?: serializers.AuthorizationAuthorizationAuthorizedTo.Raw | null; + } +} diff --git a/src/serialization/types/AuthorizationAuthorizationAuthorizedTo.ts b/src/serialization/types/AuthorizationAuthorizationAuthorizedTo.ts new file mode 100644 index 00000000..40ab2667 --- /dev/null +++ b/src/serialization/types/AuthorizationAuthorizationAuthorizedTo.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const AuthorizationAuthorizationAuthorizedTo: core.serialization.ObjectSchema< + serializers.AuthorizationAuthorizationAuthorizedTo.Raw, + Webflow.AuthorizationAuthorizationAuthorizedTo +> = core.serialization.object({ + siteIds: core.serialization.list(core.serialization.unknown()).optional(), + workspaceIds: core.serialization.list(core.serialization.unknown()).optional(), + userIds: core.serialization.list(core.serialization.unknown()).optional(), +}); + +export declare namespace AuthorizationAuthorizationAuthorizedTo { + interface Raw { + siteIds?: unknown[] | null; + workspaceIds?: unknown[] | null; + userIds?: unknown[] | null; + } +} diff --git a/src/serialization/types/AuthorizedUser.ts b/src/serialization/types/AuthorizedUser.ts new file mode 100644 index 00000000..56bd6201 --- /dev/null +++ b/src/serialization/types/AuthorizedUser.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const AuthorizedUser: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + email: core.serialization.string().optional(), + firstName: core.serialization.string().optional(), + lastName: core.serialization.string().optional(), + }); + +export declare namespace AuthorizedUser { + interface Raw { + id?: string | null; + email?: string | null; + firstName?: string | null; + lastName?: string | null; + } +} diff --git a/src/serialization/types/Collection.ts b/src/serialization/types/Collection.ts new file mode 100644 index 00000000..fa3bd9de --- /dev/null +++ b/src/serialization/types/Collection.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Collection: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + displayName: core.serialization.string().optional(), + singularName: core.serialization.string().optional(), + slug: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + lastUpdated: core.serialization.date().optional(), + fields: core.serialization.record(core.serialization.string(), core.serialization.unknown()), + }); + +export declare namespace Collection { + interface Raw { + id: string; + displayName?: string | null; + singularName?: string | null; + slug?: string | null; + createdOn?: string | null; + lastUpdated?: string | null; + fields: Record; + } +} diff --git a/src/serialization/types/CollectionItem.ts b/src/serialization/types/CollectionItem.ts new file mode 100644 index 00000000..4555309e --- /dev/null +++ b/src/serialization/types/CollectionItem.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const CollectionItem: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + lastPublished: core.serialization.string().optional(), + lastUpdated: core.serialization.string().optional(), + createdOn: core.serialization.string().optional(), + isArchived: core.serialization.boolean().optional(), + isDraft: core.serialization.boolean().optional(), + fieldData: core.serialization.lazyObject(async () => (await import("..")).CollectionItemFieldData).optional(), + }); + +export declare namespace CollectionItem { + interface Raw { + id: string; + lastPublished?: string | null; + lastUpdated?: string | null; + createdOn?: string | null; + isArchived?: boolean | null; + isDraft?: boolean | null; + fieldData?: serializers.CollectionItemFieldData.Raw | null; + } +} diff --git a/src/serialization/types/CollectionItemFieldData.ts b/src/serialization/types/CollectionItemFieldData.ts new file mode 100644 index 00000000..1035a674 --- /dev/null +++ b/src/serialization/types/CollectionItemFieldData.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const CollectionItemFieldData: core.serialization.ObjectSchema< + serializers.CollectionItemFieldData.Raw, + Webflow.CollectionItemFieldData +> = core.serialization.object({ + name: core.serialization.string().optional(), + slug: core.serialization.string().optional(), +}); + +export declare namespace CollectionItemFieldData { + interface Raw { + name?: string | null; + slug?: string | null; + } +} diff --git a/src/serialization/types/CollectionItemList.ts b/src/serialization/types/CollectionItemList.ts new file mode 100644 index 00000000..d6d7536a --- /dev/null +++ b/src/serialization/types/CollectionItemList.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const CollectionItemList: core.serialization.ObjectSchema< + serializers.CollectionItemList.Raw, + Webflow.CollectionItemList +> = core.serialization.object({ + items: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).CollectionItem)) + .optional(), + pagination: core.serialization.lazyObject(async () => (await import("..")).CollectionItemListPagination).optional(), +}); + +export declare namespace CollectionItemList { + interface Raw { + items?: serializers.CollectionItem.Raw[] | null; + pagination?: serializers.CollectionItemListPagination.Raw | null; + } +} diff --git a/src/serialization/types/CollectionItemListPagination.ts b/src/serialization/types/CollectionItemListPagination.ts new file mode 100644 index 00000000..01450834 --- /dev/null +++ b/src/serialization/types/CollectionItemListPagination.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const CollectionItemListPagination: core.serialization.ObjectSchema< + serializers.CollectionItemListPagination.Raw, + Webflow.CollectionItemListPagination +> = core.serialization.object({ + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + total: core.serialization.number().optional(), +}); + +export declare namespace CollectionItemListPagination { + interface Raw { + limit?: number | null; + offset?: number | null; + total?: number | null; + } +} diff --git a/src/serialization/types/CollectionItemRemoved.ts b/src/serialization/types/CollectionItemRemoved.ts new file mode 100644 index 00000000..9cd31c1d --- /dev/null +++ b/src/serialization/types/CollectionItemRemoved.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const CollectionItemRemoved: core.serialization.ObjectSchema< + serializers.CollectionItemRemoved.Raw, + Webflow.CollectionItemRemoved +> = core.serialization.object({ + deleted: core.serialization.number().optional(), + itemId: core.serialization.string().optional(), +}); + +export declare namespace CollectionItemRemoved { + interface Raw { + deleted?: number | null; + itemId?: string | null; + } +} diff --git a/src/serialization/types/CollectionList.ts b/src/serialization/types/CollectionList.ts new file mode 100644 index 00000000..09fcdecc --- /dev/null +++ b/src/serialization/types/CollectionList.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const CollectionList: core.serialization.ObjectSchema = + core.serialization.object({ + collections: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).CollectionListArrayItem)) + .optional(), + }); + +export declare namespace CollectionList { + interface Raw { + collections?: serializers.CollectionListArrayItem.Raw[] | null; + } +} diff --git a/src/serialization/types/CollectionListArrayItem.ts b/src/serialization/types/CollectionListArrayItem.ts new file mode 100644 index 00000000..de8fa372 --- /dev/null +++ b/src/serialization/types/CollectionListArrayItem.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const CollectionListArrayItem: core.serialization.ObjectSchema< + serializers.CollectionListArrayItem.Raw, + Webflow.CollectionListArrayItem +> = core.serialization.object({ + id: core.serialization.string(), + displayName: core.serialization.string().optional(), + singularName: core.serialization.string().optional(), + slug: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + lastUpdated: core.serialization.date().optional(), +}); + +export declare namespace CollectionListArrayItem { + interface Raw { + id: string; + displayName?: string | null; + singularName?: string | null; + slug?: string | null; + createdOn?: string | null; + lastUpdated?: string | null; + } +} diff --git a/src/serialization/types/CustomCodeBlock.ts b/src/serialization/types/CustomCodeBlock.ts new file mode 100644 index 00000000..33140316 --- /dev/null +++ b/src/serialization/types/CustomCodeBlock.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const CustomCodeBlock: core.serialization.ObjectSchema< + serializers.CustomCodeBlock.Raw, + Webflow.CustomCodeBlock +> = core.serialization.object({ + siteId: core.serialization.string().optional(), + pageId: core.serialization.string().optional(), + type: core.serialization.lazy(async () => (await import("..")).CustomCodeBlockType).optional(), + scripts: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).ScriptApply)) + .optional(), + createdOn: core.serialization.date().optional(), + lastUpdated: core.serialization.date().optional(), +}); + +export declare namespace CustomCodeBlock { + interface Raw { + siteId?: string | null; + pageId?: string | null; + type?: serializers.CustomCodeBlockType.Raw | null; + scripts?: serializers.ScriptApply.Raw[] | null; + createdOn?: string | null; + lastUpdated?: string | null; + } +} diff --git a/src/serialization/types/CustomCodeBlockType.ts b/src/serialization/types/CustomCodeBlockType.ts new file mode 100644 index 00000000..10c879e6 --- /dev/null +++ b/src/serialization/types/CustomCodeBlockType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const CustomCodeBlockType: core.serialization.Schema< + serializers.CustomCodeBlockType.Raw, + Webflow.CustomCodeBlockType +> = core.serialization.enum_(["page", "site"]); + +export declare namespace CustomCodeBlockType { + type Raw = "page" | "site"; +} diff --git a/src/serialization/types/CustomCodeResponse.ts b/src/serialization/types/CustomCodeResponse.ts new file mode 100644 index 00000000..fca55636 --- /dev/null +++ b/src/serialization/types/CustomCodeResponse.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const CustomCodeResponse: core.serialization.ObjectSchema< + serializers.CustomCodeResponse.Raw, + Webflow.CustomCodeResponse +> = core.serialization.object({ + id: core.serialization.string().optional(), + createdOn: core.serialization.string().optional(), + lastUpdated: core.serialization.string().optional(), + hostedLocation: core.serialization.string().optional(), + integrityHash: core.serialization.string().optional(), + canCopy: core.serialization.boolean().optional(), + version: core.serialization.string().optional(), + displayName: core.serialization.string().optional(), +}); + +export declare namespace CustomCodeResponse { + interface Raw { + id?: string | null; + createdOn?: string | null; + lastUpdated?: string | null; + hostedLocation?: string | null; + integrityHash?: string | null; + canCopy?: boolean | null; + version?: string | null; + displayName?: string | null; + } +} diff --git a/src/serialization/types/Domain.ts b/src/serialization/types/Domain.ts new file mode 100644 index 00000000..02c50754 --- /dev/null +++ b/src/serialization/types/Domain.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Domain: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + url: core.serialization.string().optional(), + }); + +export declare namespace Domain { + interface Raw { + id: string; + url?: string | null; + } +} diff --git a/src/serialization/types/DuplicateUserEmail.ts b/src/serialization/types/DuplicateUserEmail.ts new file mode 100644 index 00000000..ca8d28ff --- /dev/null +++ b/src/serialization/types/DuplicateUserEmail.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const DuplicateUserEmail: core.serialization.ObjectSchema< + serializers.DuplicateUserEmail.Raw, + Webflow.DuplicateUserEmail +> = core.serialization.object({ + code: core.serialization.stringLiteral("duplicate_user_email").optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization + .list(core.serialization.lazy(async () => (await import("..")).ErrorDetailsItem)) + .optional(), +}); + +export declare namespace DuplicateUserEmail { + interface Raw { + code?: "duplicate_user_email" | null; + message?: string | null; + externalReference?: string | null; + details?: serializers.ErrorDetailsItem.Raw[] | null; + } +} diff --git a/src/serialization/types/EcommerceSettings.ts b/src/serialization/types/EcommerceSettings.ts new file mode 100644 index 00000000..336174ba --- /dev/null +++ b/src/serialization/types/EcommerceSettings.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const EcommerceSettings: core.serialization.ObjectSchema< + serializers.EcommerceSettings.Raw, + Webflow.EcommerceSettings +> = core.serialization.object({ + siteId: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + defaultCurrency: core.serialization.string().optional(), +}); + +export declare namespace EcommerceSettings { + interface Raw { + siteId?: string | null; + createdOn?: string | null; + defaultCurrency?: string | null; + } +} diff --git a/src/serialization/types/ErrorDetailsItem.ts b/src/serialization/types/ErrorDetailsItem.ts new file mode 100644 index 00000000..e1f2ede6 --- /dev/null +++ b/src/serialization/types/ErrorDetailsItem.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const ErrorDetailsItem: core.serialization.Schema = + core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.record(core.serialization.string(), core.serialization.unknown()), + ]); + +export declare namespace ErrorDetailsItem { + type Raw = string | Record; +} diff --git a/src/serialization/types/Error_.ts b/src/serialization/types/Error_.ts new file mode 100644 index 00000000..77c2654c --- /dev/null +++ b/src/serialization/types/Error_.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Error_: core.serialization.ObjectSchema = + core.serialization.object({ + code: core.serialization.string().optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization + .list(core.serialization.lazy(async () => (await import("..")).ErrorDetailsItem)) + .optional(), + }); + +export declare namespace Error_ { + interface Raw { + code?: string | null; + message?: string | null; + externalReference?: string | null; + details?: serializers.ErrorDetailsItem.Raw[] | null; + } +} diff --git a/src/serialization/types/Field.ts b/src/serialization/types/Field.ts new file mode 100644 index 00000000..9a68b0a5 --- /dev/null +++ b/src/serialization/types/Field.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Field: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string(), + isRequired: core.serialization.boolean(), + isEditable: core.serialization.boolean().optional(), + type: core.serialization.lazy(async () => (await import("..")).FieldType), + slug: core.serialization.string().optional(), + displayName: core.serialization.string(), + helpText: core.serialization.string().optional(), +}); + +export declare namespace Field { + interface Raw { + id: string; + isRequired: boolean; + isEditable?: boolean | null; + type: serializers.FieldType.Raw; + slug?: string | null; + displayName: string; + helpText?: string | null; + } +} diff --git a/src/serialization/types/FieldType.ts b/src/serialization/types/FieldType.ts new file mode 100644 index 00000000..86c3489f --- /dev/null +++ b/src/serialization/types/FieldType.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const FieldType: core.serialization.Schema = + core.serialization.enum_([ + "PlainText", + "RichText", + "Image", + "MultiImage", + "Video", + "Link", + "Email", + "Phone", + "Number", + "DateTime", + "Boolean", + "Color", + "ExtFileRef", + ]); + +export declare namespace FieldType { + type Raw = + | "PlainText" + | "RichText" + | "Image" + | "MultiImage" + | "Video" + | "Link" + | "Email" + | "Phone" + | "Number" + | "DateTime" + | "Boolean" + | "Color" + | "ExtFileRef"; +} diff --git a/src/serialization/types/Fields.ts b/src/serialization/types/Fields.ts new file mode 100644 index 00000000..e9458718 --- /dev/null +++ b/src/serialization/types/Fields.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Fields: core.serialization.Schema = core.serialization.list( + core.serialization.lazyObject(async () => (await import("..")).Field) +); + +export declare namespace Fields { + type Raw = serializers.Field.Raw[]; +} diff --git a/src/serialization/types/Form.ts b/src/serialization/types/Form.ts new file mode 100644 index 00000000..7048f817 --- /dev/null +++ b/src/serialization/types/Form.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Form: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + displayName: core.serialization.string().optional(), + siteId: core.serialization.string().optional(), + siteDomainId: core.serialization.string().optional(), + pageId: core.serialization.string().optional(), + pageName: core.serialization.string().optional(), + workspaceId: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + lastUpdated: core.serialization.date().optional(), + fields: core.serialization.list(core.serialization.lazy(async () => (await import("..")).FormField)).optional(), + responseSettings: core.serialization.lazyObject(async () => (await import("..")).FormResponseSettings).optional(), +}); + +export declare namespace Form { + interface Raw { + id?: string | null; + displayName?: string | null; + siteId?: string | null; + siteDomainId?: string | null; + pageId?: string | null; + pageName?: string | null; + workspaceId?: string | null; + createdOn?: string | null; + lastUpdated?: string | null; + fields?: serializers.FormField.Raw[] | null; + responseSettings?: serializers.FormResponseSettings.Raw | null; + } +} diff --git a/src/serialization/types/FormField.ts b/src/serialization/types/FormField.ts new file mode 100644 index 00000000..d301092d --- /dev/null +++ b/src/serialization/types/FormField.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const FormField: core.serialization.Schema = + core.serialization.record( + core.serialization.string(), + core.serialization.lazyObject(async () => (await import("..")).FormFieldValue) + ); + +export declare namespace FormField { + type Raw = Record; +} diff --git a/src/serialization/types/FormFieldValue.ts b/src/serialization/types/FormFieldValue.ts new file mode 100644 index 00000000..7ce308f5 --- /dev/null +++ b/src/serialization/types/FormFieldValue.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const FormFieldValue: core.serialization.ObjectSchema = + core.serialization.object({ + displayName: core.serialization.string().optional(), + type: core.serialization.lazy(async () => (await import("..")).FormFieldValueType).optional(), + placeholder: core.serialization.string().optional(), + userVisible: core.serialization.boolean().optional(), + }); + +export declare namespace FormFieldValue { + interface Raw { + displayName?: string | null; + type?: serializers.FormFieldValueType.Raw | null; + placeholder?: string | null; + userVisible?: boolean | null; + } +} diff --git a/src/serialization/types/FormFieldValueType.ts b/src/serialization/types/FormFieldValueType.ts new file mode 100644 index 00000000..3d323510 --- /dev/null +++ b/src/serialization/types/FormFieldValueType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const FormFieldValueType: core.serialization.Schema< + serializers.FormFieldValueType.Raw, + Webflow.FormFieldValueType +> = core.serialization.enum_(["Plain", "Email", "Password", "Phone", "Number"]); + +export declare namespace FormFieldValueType { + type Raw = "Plain" | "Email" | "Password" | "Phone" | "Number"; +} diff --git a/src/serialization/types/FormList.ts b/src/serialization/types/FormList.ts new file mode 100644 index 00000000..3c545f09 --- /dev/null +++ b/src/serialization/types/FormList.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const FormList: core.serialization.ObjectSchema = + core.serialization.object({ + forms: core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).Form)).optional(), + pagination: core.serialization.lazyObject(async () => (await import("..")).Pagination).optional(), + }); + +export declare namespace FormList { + interface Raw { + forms?: serializers.Form.Raw[] | null; + pagination?: serializers.Pagination.Raw | null; + } +} diff --git a/src/serialization/types/FormResponseSettings.ts b/src/serialization/types/FormResponseSettings.ts new file mode 100644 index 00000000..4fd53e43 --- /dev/null +++ b/src/serialization/types/FormResponseSettings.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const FormResponseSettings: core.serialization.ObjectSchema< + serializers.FormResponseSettings.Raw, + Webflow.FormResponseSettings +> = core.serialization.object({ + sendEmailConfirmation: core.serialization.boolean().optional(), + redirectUrl: core.serialization.string().optional(), + redirectMethod: core.serialization.string().optional(), + redirectAction: core.serialization.string().optional(), +}); + +export declare namespace FormResponseSettings { + interface Raw { + sendEmailConfirmation?: boolean | null; + redirectUrl?: string | null; + redirectMethod?: string | null; + redirectAction?: string | null; + } +} diff --git a/src/serialization/types/FormSubmission.ts b/src/serialization/types/FormSubmission.ts new file mode 100644 index 00000000..be6b0220 --- /dev/null +++ b/src/serialization/types/FormSubmission.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const FormSubmission: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + displayName: core.serialization.string().optional(), + siteId: core.serialization.string().optional(), + workspaceId: core.serialization.string().optional(), + dateSubmitted: core.serialization.date().optional(), + formResponse: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + }); + +export declare namespace FormSubmission { + interface Raw { + id?: string | null; + displayName?: string | null; + siteId?: string | null; + workspaceId?: string | null; + dateSubmitted?: string | null; + formResponse?: Record | null; + } +} diff --git a/src/serialization/types/FormSubmissionList.ts b/src/serialization/types/FormSubmissionList.ts new file mode 100644 index 00000000..e685bb0d --- /dev/null +++ b/src/serialization/types/FormSubmissionList.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const FormSubmissionList: core.serialization.ObjectSchema< + serializers.FormSubmissionList.Raw, + Webflow.FormSubmissionList +> = core.serialization.object({ + submissions: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).FormSubmission)) + .optional(), + pagination: core.serialization.lazyObject(async () => (await import("..")).Pagination).optional(), +}); + +export declare namespace FormSubmissionList { + interface Raw { + submissions?: serializers.FormSubmission.Raw[] | null; + pagination?: serializers.Pagination.Raw | null; + } +} diff --git a/src/serialization/types/FormSubmissionTrigger.ts b/src/serialization/types/FormSubmissionTrigger.ts new file mode 100644 index 00000000..3f92fe9e --- /dev/null +++ b/src/serialization/types/FormSubmissionTrigger.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const FormSubmissionTrigger: core.serialization.ObjectSchema< + serializers.FormSubmissionTrigger.Raw, + Webflow.FormSubmissionTrigger +> = core.serialization.object({ + triggerType: core.serialization.string().optional(), + payload: core.serialization.lazyObject(async () => (await import("..")).FormSubmissionTriggerPayload).optional(), +}); + +export declare namespace FormSubmissionTrigger { + interface Raw { + triggerType?: string | null; + payload?: serializers.FormSubmissionTriggerPayload.Raw | null; + } +} diff --git a/src/serialization/types/FormSubmissionTriggerPayload.ts b/src/serialization/types/FormSubmissionTriggerPayload.ts new file mode 100644 index 00000000..4d5d9f64 --- /dev/null +++ b/src/serialization/types/FormSubmissionTriggerPayload.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const FormSubmissionTriggerPayload: core.serialization.ObjectSchema< + serializers.FormSubmissionTriggerPayload.Raw, + Webflow.FormSubmissionTriggerPayload +> = core.serialization.object({ + name: core.serialization.string().optional(), + siteId: core.serialization.string().optional(), + data: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + submittedAt: core.serialization.string().optional(), + formId: core.serialization.string().optional(), +}); + +export declare namespace FormSubmissionTriggerPayload { + interface Raw { + name?: string | null; + siteId?: string | null; + data?: Record | null; + submittedAt?: string | null; + formId?: string | null; + } +} diff --git a/src/serialization/types/InvalidDomain.ts b/src/serialization/types/InvalidDomain.ts new file mode 100644 index 00000000..1a4cb74e --- /dev/null +++ b/src/serialization/types/InvalidDomain.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const InvalidDomain: core.serialization.Schema = + core.serialization.unknown(); + +export declare namespace InvalidDomain { + type Raw = unknown; +} diff --git a/src/serialization/types/InventoryItem.ts b/src/serialization/types/InventoryItem.ts new file mode 100644 index 00000000..eddcb99c --- /dev/null +++ b/src/serialization/types/InventoryItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const InventoryItem: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + quantity: core.serialization.number().optional(), + inventoryType: core.serialization.lazy(async () => (await import("..")).InventoryItemInventoryType).optional(), + }); + +export declare namespace InventoryItem { + interface Raw { + id?: string | null; + quantity?: number | null; + inventoryType?: serializers.InventoryItemInventoryType.Raw | null; + } +} diff --git a/src/serialization/types/InventoryItemInventoryType.ts b/src/serialization/types/InventoryItemInventoryType.ts new file mode 100644 index 00000000..39d032dc --- /dev/null +++ b/src/serialization/types/InventoryItemInventoryType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const InventoryItemInventoryType: core.serialization.Schema< + serializers.InventoryItemInventoryType.Raw, + Webflow.InventoryItemInventoryType +> = core.serialization.enum_(["infinite", "finite"]); + +export declare namespace InventoryItemInventoryType { + type Raw = "infinite" | "finite"; +} diff --git a/src/serialization/types/ListCustomCodeBlocks.ts b/src/serialization/types/ListCustomCodeBlocks.ts new file mode 100644 index 00000000..ddbe482c --- /dev/null +++ b/src/serialization/types/ListCustomCodeBlocks.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const ListCustomCodeBlocks: core.serialization.ObjectSchema< + serializers.ListCustomCodeBlocks.Raw, + Webflow.ListCustomCodeBlocks +> = core.serialization.object({ + blocks: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).CustomCodeBlock)) + .optional(), + pagination: core.serialization.lazyObject(async () => (await import("..")).Pagination).optional(), +}); + +export declare namespace ListCustomCodeBlocks { + interface Raw { + blocks?: serializers.CustomCodeBlock.Raw[] | null; + pagination?: serializers.Pagination.Raw | null; + } +} diff --git a/src/serialization/types/MissingScopes.ts b/src/serialization/types/MissingScopes.ts new file mode 100644 index 00000000..de4a383c --- /dev/null +++ b/src/serialization/types/MissingScopes.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const MissingScopes: core.serialization.ObjectSchema = + core.serialization.object({ + code: core.serialization.stringLiteral("missing_scopes").optional(), + type: core.serialization.string().optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization + .list(core.serialization.lazy(async () => (await import("..")).ErrorDetailsItem)) + .optional(), + }); + +export declare namespace MissingScopes { + interface Raw { + code?: "missing_scopes" | null; + type?: string | null; + message?: string | null; + externalReference?: string | null; + details?: serializers.ErrorDetailsItem.Raw[] | null; + } +} diff --git a/src/serialization/types/NoDomains.ts b/src/serialization/types/NoDomains.ts new file mode 100644 index 00000000..9dd8a51d --- /dev/null +++ b/src/serialization/types/NoDomains.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const NoDomains: core.serialization.Schema = + core.serialization.unknown(); + +export declare namespace NoDomains { + type Raw = unknown; +} diff --git a/src/serialization/types/OauthScope.ts b/src/serialization/types/OauthScope.ts new file mode 100644 index 00000000..0369f2b6 --- /dev/null +++ b/src/serialization/types/OauthScope.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OauthScope: core.serialization.Schema = + core.serialization.enum_([ + "authorized_user:read", + "read:pages", + "sites:read", + "sites:write", + "custom_code:read", + "custom_code:write", + "custom_code:delete", + "users:read", + "users:write", + "ecommerce:read", + "ecommerce:write", + ]); + +export declare namespace OauthScope { + type Raw = + | "authorized_user:read" + | "read:pages" + | "sites:read" + | "sites:write" + | "custom_code:read" + | "custom_code:write" + | "custom_code:delete" + | "users:read" + | "users:write" + | "ecommerce:read" + | "ecommerce:write"; +} diff --git a/src/serialization/types/Order.ts b/src/serialization/types/Order.ts new file mode 100644 index 00000000..d83cef0a --- /dev/null +++ b/src/serialization/types/Order.ts @@ -0,0 +1,89 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Order: core.serialization.ObjectSchema = core.serialization.object({ + orderId: core.serialization.string().optional(), + status: core.serialization.lazy(async () => (await import("..")).OrderStatus).optional(), + comment: core.serialization.string().optional(), + orderComment: core.serialization.string().optional(), + acceptedOn: core.serialization.date().optional(), + fulfilledOn: core.serialization.date().optional(), + refundedOn: core.serialization.date().optional(), + disputedOn: core.serialization.date().optional(), + disputeUpdatedOn: core.serialization.date().optional(), + disputeLastStatus: core.serialization.lazy(async () => (await import("..")).OrderDisputeLastStatus).optional(), + customerPaid: core.serialization.lazyObject(async () => (await import("..")).OrderPrice).optional(), + netAmount: core.serialization.lazyObject(async () => (await import("..")).OrderPrice).optional(), + applicationFee: core.serialization.lazyObject(async () => (await import("..")).OrderPrice).optional(), + allAddresses: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).OrderAddress)) + .optional(), + shippingAddress: core.serialization.lazyObject(async () => (await import("..")).OrderAddress).optional(), + billingAddress: core.serialization.lazyObject(async () => (await import("..")).OrderAddress).optional(), + shippingProvider: core.serialization.string().optional(), + shippingTracking: core.serialization.string().optional(), + shippingTrackingUrl: core.serialization.property("shippingTrackingURL", core.serialization.string().optional()), + customerInfo: core.serialization.lazyObject(async () => (await import("..")).OrderCustomerInfo).optional(), + purchasedItems: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).OrderPurchasedItem)) + .optional(), + purchasedItemsCount: core.serialization.number().optional(), + stripeDetails: core.serialization.lazyObject(async () => (await import("..")).StripeDetails).optional(), + stripeCard: core.serialization.lazyObject(async () => (await import("..")).StripeCard).optional(), + paypalDetails: core.serialization.lazyObject(async () => (await import("..")).PaypalDetails).optional(), + customData: core.serialization + .list(core.serialization.record(core.serialization.string(), core.serialization.unknown())) + .optional(), + metadata: core.serialization.lazyObject(async () => (await import("..")).OrderMetadata).optional(), + isCustomerDeleted: core.serialization.boolean().optional(), + isShippingRequired: core.serialization.boolean().optional(), + hasDownloads: core.serialization.boolean().optional(), + paymentProcessor: core.serialization.string().optional(), + totals: core.serialization.lazyObject(async () => (await import("..")).OrderTotals).optional(), + downloadFiles: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).OrderDownloadFilesItem)) + .optional(), +}); + +export declare namespace Order { + interface Raw { + orderId?: string | null; + status?: serializers.OrderStatus.Raw | null; + comment?: string | null; + orderComment?: string | null; + acceptedOn?: string | null; + fulfilledOn?: string | null; + refundedOn?: string | null; + disputedOn?: string | null; + disputeUpdatedOn?: string | null; + disputeLastStatus?: serializers.OrderDisputeLastStatus.Raw | null; + customerPaid?: serializers.OrderPrice.Raw | null; + netAmount?: serializers.OrderPrice.Raw | null; + applicationFee?: serializers.OrderPrice.Raw | null; + allAddresses?: serializers.OrderAddress.Raw[] | null; + shippingAddress?: serializers.OrderAddress.Raw | null; + billingAddress?: serializers.OrderAddress.Raw | null; + shippingProvider?: string | null; + shippingTracking?: string | null; + shippingTrackingURL?: string | null; + customerInfo?: serializers.OrderCustomerInfo.Raw | null; + purchasedItems?: serializers.OrderPurchasedItem.Raw[] | null; + purchasedItemsCount?: number | null; + stripeDetails?: serializers.StripeDetails.Raw | null; + stripeCard?: serializers.StripeCard.Raw | null; + paypalDetails?: serializers.PaypalDetails.Raw | null; + customData?: Record[] | null; + metadata?: serializers.OrderMetadata.Raw | null; + isCustomerDeleted?: boolean | null; + isShippingRequired?: boolean | null; + hasDownloads?: boolean | null; + paymentProcessor?: string | null; + totals?: serializers.OrderTotals.Raw | null; + downloadFiles?: serializers.OrderDownloadFilesItem.Raw[] | null; + } +} diff --git a/src/serialization/types/OrderAddress.ts b/src/serialization/types/OrderAddress.ts new file mode 100644 index 00000000..aa15bd57 --- /dev/null +++ b/src/serialization/types/OrderAddress.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderAddress: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.lazy(async () => (await import("..")).OrderAddressType).optional(), + japanType: core.serialization.lazy(async () => (await import("..")).OrderAddressJapanType).optional(), + addressee: core.serialization.string().optional(), + line1: core.serialization.string().optional(), + line2: core.serialization.string().optional(), + city: core.serialization.string().optional(), + state: core.serialization.string().optional(), + country: core.serialization.string().optional(), + postalCode: core.serialization.string().optional(), + }); + +export declare namespace OrderAddress { + interface Raw { + type?: serializers.OrderAddressType.Raw | null; + japanType?: serializers.OrderAddressJapanType.Raw | null; + addressee?: string | null; + line1?: string | null; + line2?: string | null; + city?: string | null; + state?: string | null; + country?: string | null; + postalCode?: string | null; + } +} diff --git a/src/serialization/types/OrderAddressJapanType.ts b/src/serialization/types/OrderAddressJapanType.ts new file mode 100644 index 00000000..34f55b84 --- /dev/null +++ b/src/serialization/types/OrderAddressJapanType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderAddressJapanType: core.serialization.Schema< + serializers.OrderAddressJapanType.Raw, + Webflow.OrderAddressJapanType +> = core.serialization.enum_(["kana", "kanji"]); + +export declare namespace OrderAddressJapanType { + type Raw = "kana" | "kanji"; +} diff --git a/src/serialization/types/OrderAddressType.ts b/src/serialization/types/OrderAddressType.ts new file mode 100644 index 00000000..f5c2c850 --- /dev/null +++ b/src/serialization/types/OrderAddressType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderAddressType: core.serialization.Schema = + core.serialization.enum_(["shipping", "billing"]); + +export declare namespace OrderAddressType { + type Raw = "shipping" | "billing"; +} diff --git a/src/serialization/types/OrderCustomerInfo.ts b/src/serialization/types/OrderCustomerInfo.ts new file mode 100644 index 00000000..f5660af4 --- /dev/null +++ b/src/serialization/types/OrderCustomerInfo.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderCustomerInfo: core.serialization.ObjectSchema< + serializers.OrderCustomerInfo.Raw, + Webflow.OrderCustomerInfo +> = core.serialization.object({ + fullName: core.serialization.string().optional(), + email: core.serialization.string().optional(), +}); + +export declare namespace OrderCustomerInfo { + interface Raw { + fullName?: string | null; + email?: string | null; + } +} diff --git a/src/serialization/types/OrderDisputeLastStatus.ts b/src/serialization/types/OrderDisputeLastStatus.ts new file mode 100644 index 00000000..3adff23d --- /dev/null +++ b/src/serialization/types/OrderDisputeLastStatus.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderDisputeLastStatus: core.serialization.Schema< + serializers.OrderDisputeLastStatus.Raw, + Webflow.OrderDisputeLastStatus +> = core.serialization.enum_([ + "warning_needs_response", + "warning_under_review", + "warning_closed", + "needs_response", + "under_review", + "charge_refunded", + "won", + "lost", +]); + +export declare namespace OrderDisputeLastStatus { + type Raw = + | "warning_needs_response" + | "warning_under_review" + | "warning_closed" + | "needs_response" + | "under_review" + | "charge_refunded" + | "won" + | "lost"; +} diff --git a/src/serialization/types/OrderDownloadFilesItem.ts b/src/serialization/types/OrderDownloadFilesItem.ts new file mode 100644 index 00000000..d24659ad --- /dev/null +++ b/src/serialization/types/OrderDownloadFilesItem.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderDownloadFilesItem: core.serialization.ObjectSchema< + serializers.OrderDownloadFilesItem.Raw, + Webflow.OrderDownloadFilesItem +> = core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string().optional(), + url: core.serialization.string().optional(), +}); + +export declare namespace OrderDownloadFilesItem { + interface Raw { + id?: string | null; + name?: string | null; + url?: string | null; + } +} diff --git a/src/serialization/types/OrderList.ts b/src/serialization/types/OrderList.ts new file mode 100644 index 00000000..1a10c8c5 --- /dev/null +++ b/src/serialization/types/OrderList.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderList: core.serialization.ObjectSchema = + core.serialization.object({ + items: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).Order)) + .optional(), + pagination: core.serialization.lazyObject(async () => (await import("..")).Pagination).optional(), + }); + +export declare namespace OrderList { + interface Raw { + items?: serializers.Order.Raw[] | null; + pagination?: serializers.Pagination.Raw | null; + } +} diff --git a/src/serialization/types/OrderMetadata.ts b/src/serialization/types/OrderMetadata.ts new file mode 100644 index 00000000..ada1bfb9 --- /dev/null +++ b/src/serialization/types/OrderMetadata.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderMetadata: core.serialization.ObjectSchema = + core.serialization.object({ + isBuyNow: core.serialization.boolean().optional(), + }); + +export declare namespace OrderMetadata { + interface Raw { + isBuyNow?: boolean | null; + } +} diff --git a/src/serialization/types/OrderPrice.ts b/src/serialization/types/OrderPrice.ts new file mode 100644 index 00000000..bf0d4d5b --- /dev/null +++ b/src/serialization/types/OrderPrice.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderPrice: core.serialization.ObjectSchema = + core.serialization.object({ + unit: core.serialization.string().optional(), + value: core.serialization.string().optional(), + string: core.serialization.string().optional(), + }); + +export declare namespace OrderPrice { + interface Raw { + unit?: string | null; + value?: string | null; + string?: string | null; + } +} diff --git a/src/serialization/types/OrderPurchasedItem.ts b/src/serialization/types/OrderPurchasedItem.ts new file mode 100644 index 00000000..2e2f85f2 --- /dev/null +++ b/src/serialization/types/OrderPurchasedItem.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderPurchasedItem: core.serialization.ObjectSchema< + serializers.OrderPurchasedItem.Raw, + Webflow.OrderPurchasedItem +> = core.serialization.object({ + count: core.serialization.number().optional(), + rowTotal: core.serialization.lazyObject(async () => (await import("..")).OrderPrice).optional(), + productId: core.serialization.string().optional(), + productName: core.serialization.string().optional(), + productSlug: core.serialization.string().optional(), + variantId: core.serialization.string().optional(), + variantName: core.serialization.string().optional(), + variantSlug: core.serialization.string().optional(), + variantImage: core.serialization + .lazyObject(async () => (await import("..")).OrderPurchasedItemVariantImage) + .optional(), + variantPrice: core.serialization.lazyObject(async () => (await import("..")).OrderPrice).optional(), + weight: core.serialization.number().optional(), + width: core.serialization.number().optional(), + height: core.serialization.number().optional(), + length: core.serialization.number().optional(), +}); + +export declare namespace OrderPurchasedItem { + interface Raw { + count?: number | null; + rowTotal?: serializers.OrderPrice.Raw | null; + productId?: string | null; + productName?: string | null; + productSlug?: string | null; + variantId?: string | null; + variantName?: string | null; + variantSlug?: string | null; + variantImage?: serializers.OrderPurchasedItemVariantImage.Raw | null; + variantPrice?: serializers.OrderPrice.Raw | null; + weight?: number | null; + width?: number | null; + height?: number | null; + length?: number | null; + } +} diff --git a/src/serialization/types/OrderPurchasedItemVariantImage.ts b/src/serialization/types/OrderPurchasedItemVariantImage.ts new file mode 100644 index 00000000..89ea01dc --- /dev/null +++ b/src/serialization/types/OrderPurchasedItemVariantImage.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderPurchasedItemVariantImage: core.serialization.ObjectSchema< + serializers.OrderPurchasedItemVariantImage.Raw, + Webflow.OrderPurchasedItemVariantImage +> = core.serialization.object({ + url: core.serialization.string().optional(), + file: core.serialization.lazyObject(async () => (await import("..")).OrderPurchasedItemVariantImageFile).optional(), +}); + +export declare namespace OrderPurchasedItemVariantImage { + interface Raw { + url?: string | null; + file?: serializers.OrderPurchasedItemVariantImageFile.Raw | null; + } +} diff --git a/src/serialization/types/OrderPurchasedItemVariantImageFile.ts b/src/serialization/types/OrderPurchasedItemVariantImageFile.ts new file mode 100644 index 00000000..d2d687ff --- /dev/null +++ b/src/serialization/types/OrderPurchasedItemVariantImageFile.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderPurchasedItemVariantImageFile: core.serialization.ObjectSchema< + serializers.OrderPurchasedItemVariantImageFile.Raw, + Webflow.OrderPurchasedItemVariantImageFile +> = core.serialization.object({ + size: core.serialization.number().optional(), + originalFileName: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + contentType: core.serialization.string().optional(), + width: core.serialization.number().optional(), + height: core.serialization.number().optional(), + variants: core.serialization + .list( + core.serialization.lazyObject( + async () => (await import("..")).OrderPurchasedItemVariantImageFileVariantsItem + ) + ) + .optional(), +}); + +export declare namespace OrderPurchasedItemVariantImageFile { + interface Raw { + size?: number | null; + originalFileName?: string | null; + createdOn?: string | null; + contentType?: string | null; + width?: number | null; + height?: number | null; + variants?: serializers.OrderPurchasedItemVariantImageFileVariantsItem.Raw[] | null; + } +} diff --git a/src/serialization/types/OrderPurchasedItemVariantImageFileVariantsItem.ts b/src/serialization/types/OrderPurchasedItemVariantImageFileVariantsItem.ts new file mode 100644 index 00000000..33b4b2b9 --- /dev/null +++ b/src/serialization/types/OrderPurchasedItemVariantImageFileVariantsItem.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderPurchasedItemVariantImageFileVariantsItem: core.serialization.ObjectSchema< + serializers.OrderPurchasedItemVariantImageFileVariantsItem.Raw, + Webflow.OrderPurchasedItemVariantImageFileVariantsItem +> = core.serialization.object({ + url: core.serialization.string().optional(), + originalFileName: core.serialization.string().optional(), + size: core.serialization.number().optional(), + width: core.serialization.number().optional(), + height: core.serialization.number().optional(), +}); + +export declare namespace OrderPurchasedItemVariantImageFileVariantsItem { + interface Raw { + url?: string | null; + originalFileName?: string | null; + size?: number | null; + width?: number | null; + height?: number | null; + } +} diff --git a/src/serialization/types/OrderStatus.ts b/src/serialization/types/OrderStatus.ts new file mode 100644 index 00000000..c4aa99fb --- /dev/null +++ b/src/serialization/types/OrderStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderStatus: core.serialization.Schema = + core.serialization.enum_(["pending", "unfulfilled", "fulfilled", "disputed", "dispute-lost", "refunded"]); + +export declare namespace OrderStatus { + type Raw = "pending" | "unfulfilled" | "fulfilled" | "disputed" | "dispute-lost" | "refunded"; +} diff --git a/src/serialization/types/OrderTotals.ts b/src/serialization/types/OrderTotals.ts new file mode 100644 index 00000000..88e52c1c --- /dev/null +++ b/src/serialization/types/OrderTotals.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderTotals: core.serialization.ObjectSchema = + core.serialization.object({ + subtotal: core.serialization.lazyObject(async () => (await import("..")).OrderPrice).optional(), + extras: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).OrderTotalsExtrasItem)) + .optional(), + total: core.serialization.lazyObject(async () => (await import("..")).OrderPrice).optional(), + }); + +export declare namespace OrderTotals { + interface Raw { + subtotal?: serializers.OrderPrice.Raw | null; + extras?: serializers.OrderTotalsExtrasItem.Raw[] | null; + total?: serializers.OrderPrice.Raw | null; + } +} diff --git a/src/serialization/types/OrderTotalsExtrasItem.ts b/src/serialization/types/OrderTotalsExtrasItem.ts new file mode 100644 index 00000000..da01dc7e --- /dev/null +++ b/src/serialization/types/OrderTotalsExtrasItem.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderTotalsExtrasItem: core.serialization.ObjectSchema< + serializers.OrderTotalsExtrasItem.Raw, + Webflow.OrderTotalsExtrasItem +> = core.serialization.object({ + type: core.serialization.lazy(async () => (await import("..")).OrderTotalsExtrasItemType).optional(), + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + price: core.serialization.lazyObject(async () => (await import("..")).OrderPrice).optional(), +}); + +export declare namespace OrderTotalsExtrasItem { + interface Raw { + type?: serializers.OrderTotalsExtrasItemType.Raw | null; + name?: string | null; + description?: string | null; + price?: serializers.OrderPrice.Raw | null; + } +} diff --git a/src/serialization/types/OrderTotalsExtrasItemType.ts b/src/serialization/types/OrderTotalsExtrasItemType.ts new file mode 100644 index 00000000..a598b05d --- /dev/null +++ b/src/serialization/types/OrderTotalsExtrasItemType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const OrderTotalsExtrasItemType: core.serialization.Schema< + serializers.OrderTotalsExtrasItemType.Raw, + Webflow.OrderTotalsExtrasItemType +> = core.serialization.enum_(["discount", "discount-shipping", "shipping", "tax"]); + +export declare namespace OrderTotalsExtrasItemType { + type Raw = "discount" | "discount-shipping" | "shipping" | "tax"; +} diff --git a/src/serialization/types/Page.ts b/src/serialization/types/Page.ts new file mode 100644 index 00000000..66506f5d --- /dev/null +++ b/src/serialization/types/Page.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Page: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + siteId: core.serialization.string().optional(), + title: core.serialization.string().optional(), + slug: core.serialization.string().optional(), + parentId: core.serialization.string().optional(), + collectionId: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + lastUpdated: core.serialization.date().optional(), + archived: core.serialization.boolean().optional(), + draft: core.serialization.boolean().optional(), + canBranch: core.serialization.boolean().optional(), + isMembersOnly: core.serialization.boolean().optional(), + seo: core.serialization.lazyObject(async () => (await import("..")).PageSeo).optional(), + openGraph: core.serialization.lazyObject(async () => (await import("..")).PageOpenGraph).optional(), +}); + +export declare namespace Page { + interface Raw { + id?: string | null; + siteId?: string | null; + title?: string | null; + slug?: string | null; + parentId?: string | null; + collectionId?: string | null; + createdOn?: string | null; + lastUpdated?: string | null; + archived?: boolean | null; + draft?: boolean | null; + canBranch?: boolean | null; + isMembersOnly?: boolean | null; + seo?: serializers.PageSeo.Raw | null; + openGraph?: serializers.PageOpenGraph.Raw | null; + } +} diff --git a/src/serialization/types/PageCreatedWebhook.ts b/src/serialization/types/PageCreatedWebhook.ts new file mode 100644 index 00000000..cc834acc --- /dev/null +++ b/src/serialization/types/PageCreatedWebhook.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PageCreatedWebhook: core.serialization.ObjectSchema< + serializers.PageCreatedWebhook.Raw, + Webflow.PageCreatedWebhook +> = core.serialization.object({ + siteId: core.serialization.string().optional(), + pageId: core.serialization.string().optional(), + pageTitle: core.serialization.string().optional(), + createdAt: core.serialization.date().optional(), +}); + +export declare namespace PageCreatedWebhook { + interface Raw { + siteId?: string | null; + pageId?: string | null; + pageTitle?: string | null; + createdAt?: string | null; + } +} diff --git a/src/serialization/types/PageDeletedWebhook.ts b/src/serialization/types/PageDeletedWebhook.ts new file mode 100644 index 00000000..b6aa2d3a --- /dev/null +++ b/src/serialization/types/PageDeletedWebhook.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PageDeletedWebhook: core.serialization.ObjectSchema< + serializers.PageDeletedWebhook.Raw, + Webflow.PageDeletedWebhook +> = core.serialization.object({ + siteId: core.serialization.string().optional(), + pageId: core.serialization.string().optional(), + pageTitle: core.serialization.string().optional(), + deletedAt: core.serialization.date().optional(), +}); + +export declare namespace PageDeletedWebhook { + interface Raw { + siteId?: string | null; + pageId?: string | null; + pageTitle?: string | null; + deletedAt?: string | null; + } +} diff --git a/src/serialization/types/PageList.ts b/src/serialization/types/PageList.ts new file mode 100644 index 00000000..1f2fa6bf --- /dev/null +++ b/src/serialization/types/PageList.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PageList: core.serialization.ObjectSchema = + core.serialization.object({ + pages: core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).Page)).optional(), + pagination: core.serialization.lazyObject(async () => (await import("..")).Pagination).optional(), + }); + +export declare namespace PageList { + interface Raw { + pages?: serializers.Page.Raw[] | null; + pagination?: serializers.Pagination.Raw | null; + } +} diff --git a/src/serialization/types/PageMetadataUpdatedWebhook.ts b/src/serialization/types/PageMetadataUpdatedWebhook.ts new file mode 100644 index 00000000..625b7316 --- /dev/null +++ b/src/serialization/types/PageMetadataUpdatedWebhook.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PageMetadataUpdatedWebhook: core.serialization.ObjectSchema< + serializers.PageMetadataUpdatedWebhook.Raw, + Webflow.PageMetadataUpdatedWebhook +> = core.serialization.object({ + siteId: core.serialization.string().optional(), + pageId: core.serialization.string().optional(), + pageTitle: core.serialization.string().optional(), + lastUpdated: core.serialization.date().optional(), +}); + +export declare namespace PageMetadataUpdatedWebhook { + interface Raw { + siteId?: string | null; + pageId?: string | null; + pageTitle?: string | null; + lastUpdated?: string | null; + } +} diff --git a/src/serialization/types/PageOpenGraph.ts b/src/serialization/types/PageOpenGraph.ts new file mode 100644 index 00000000..f69fc50c --- /dev/null +++ b/src/serialization/types/PageOpenGraph.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PageOpenGraph: core.serialization.ObjectSchema = + core.serialization.object({ + title: core.serialization.string().optional(), + titleCopied: core.serialization.boolean().optional(), + description: core.serialization.string().optional(), + descriptionCopied: core.serialization.boolean().optional(), + }); + +export declare namespace PageOpenGraph { + interface Raw { + title?: string | null; + titleCopied?: boolean | null; + description?: string | null; + descriptionCopied?: boolean | null; + } +} diff --git a/src/serialization/types/PageSeo.ts b/src/serialization/types/PageSeo.ts new file mode 100644 index 00000000..7034c873 --- /dev/null +++ b/src/serialization/types/PageSeo.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PageSeo: core.serialization.ObjectSchema = + core.serialization.object({ + title: core.serialization.string().optional(), + description: core.serialization.string().optional(), + }); + +export declare namespace PageSeo { + interface Raw { + title?: string | null; + description?: string | null; + } +} diff --git a/src/serialization/types/PageSeoGraphData.ts b/src/serialization/types/PageSeoGraphData.ts new file mode 100644 index 00000000..1bdcb740 --- /dev/null +++ b/src/serialization/types/PageSeoGraphData.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PageSeoGraphData: core.serialization.ObjectSchema< + serializers.PageSeoGraphData.Raw, + Webflow.PageSeoGraphData +> = core.serialization.object({ + seo: core.serialization.lazyObject(async () => (await import("..")).PageSeoGraphDataSeo).optional(), + openGraph: core.serialization.lazyObject(async () => (await import("..")).PageSeoGraphDataOpenGraph).optional(), +}); + +export declare namespace PageSeoGraphData { + interface Raw { + seo?: serializers.PageSeoGraphDataSeo.Raw | null; + openGraph?: serializers.PageSeoGraphDataOpenGraph.Raw | null; + } +} diff --git a/src/serialization/types/PageSeoGraphDataOpenGraph.ts b/src/serialization/types/PageSeoGraphDataOpenGraph.ts new file mode 100644 index 00000000..4bcd3e73 --- /dev/null +++ b/src/serialization/types/PageSeoGraphDataOpenGraph.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PageSeoGraphDataOpenGraph: core.serialization.ObjectSchema< + serializers.PageSeoGraphDataOpenGraph.Raw, + Webflow.PageSeoGraphDataOpenGraph +> = core.serialization.object({ + title: core.serialization.string().optional(), + description: core.serialization.string().optional(), +}); + +export declare namespace PageSeoGraphDataOpenGraph { + interface Raw { + title?: string | null; + description?: string | null; + } +} diff --git a/src/serialization/types/PageSeoGraphDataSeo.ts b/src/serialization/types/PageSeoGraphDataSeo.ts new file mode 100644 index 00000000..a47ba2cb --- /dev/null +++ b/src/serialization/types/PageSeoGraphDataSeo.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PageSeoGraphDataSeo: core.serialization.ObjectSchema< + serializers.PageSeoGraphDataSeo.Raw, + Webflow.PageSeoGraphDataSeo +> = core.serialization.object({ + title: core.serialization.string().optional(), + description: core.serialization.string().optional(), +}); + +export declare namespace PageSeoGraphDataSeo { + interface Raw { + title?: string | null; + description?: string | null; + } +} diff --git a/src/serialization/types/Pagination.ts b/src/serialization/types/Pagination.ts new file mode 100644 index 00000000..869237de --- /dev/null +++ b/src/serialization/types/Pagination.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Pagination: core.serialization.ObjectSchema = + core.serialization.object({ + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + total: core.serialization.number().optional(), + }); + +export declare namespace Pagination { + interface Raw { + limit?: number | null; + offset?: number | null; + total?: number | null; + } +} diff --git a/src/serialization/types/PaypalDetails.ts b/src/serialization/types/PaypalDetails.ts new file mode 100644 index 00000000..07358799 --- /dev/null +++ b/src/serialization/types/PaypalDetails.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PaypalDetails: core.serialization.ObjectSchema = + core.serialization.object({ + orderId: core.serialization.string().optional(), + payerId: core.serialization.string().optional(), + captureId: core.serialization.string().optional(), + refundId: core.serialization.string().optional(), + refundReason: core.serialization.string().optional(), + disputeId: core.serialization.string().optional(), + }); + +export declare namespace PaypalDetails { + interface Raw { + orderId?: string | null; + payerId?: string | null; + captureId?: string | null; + refundId?: string | null; + refundReason?: string | null; + disputeId?: string | null; + } +} diff --git a/src/serialization/types/Product.ts b/src/serialization/types/Product.ts new file mode 100644 index 00000000..69c62466 --- /dev/null +++ b/src/serialization/types/Product.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Product: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + lastPublished: core.serialization.date().optional(), + lastUpdated: core.serialization.date().optional(), + createdOn: core.serialization.date().optional(), + isArchived: core.serialization.boolean().optional(), + isDraft: core.serialization.boolean().optional(), + fieldData: core.serialization.lazyObject(async () => (await import("..")).ProductFieldData).optional(), + }); + +export declare namespace Product { + interface Raw { + id?: string | null; + lastPublished?: string | null; + lastUpdated?: string | null; + createdOn?: string | null; + isArchived?: boolean | null; + isDraft?: boolean | null; + fieldData?: serializers.ProductFieldData.Raw | null; + } +} diff --git a/src/serialization/types/ProductAndSkUs.ts b/src/serialization/types/ProductAndSkUs.ts new file mode 100644 index 00000000..f642a0fb --- /dev/null +++ b/src/serialization/types/ProductAndSkUs.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const ProductAndSkUs: core.serialization.ObjectSchema = + core.serialization.object({ + product: core.serialization.lazyObject(async () => (await import("..")).Product).optional(), + skus: core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).Sku)).optional(), + }); + +export declare namespace ProductAndSkUs { + interface Raw { + product?: serializers.Product.Raw | null; + skus?: serializers.Sku.Raw[] | null; + } +} diff --git a/src/serialization/types/ProductAndSkUsList.ts b/src/serialization/types/ProductAndSkUsList.ts new file mode 100644 index 00000000..53978790 --- /dev/null +++ b/src/serialization/types/ProductAndSkUsList.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const ProductAndSkUsList: core.serialization.ObjectSchema< + serializers.ProductAndSkUsList.Raw, + Webflow.ProductAndSkUsList +> = core.serialization.object({ + items: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).ProductAndSkUs)) + .optional(), + pagination: core.serialization.lazyObject(async () => (await import("..")).Pagination).optional(), +}); + +export declare namespace ProductAndSkUsList { + interface Raw { + items?: serializers.ProductAndSkUs.Raw[] | null; + pagination?: serializers.Pagination.Raw | null; + } +} diff --git a/src/serialization/types/ProductFieldData.ts b/src/serialization/types/ProductFieldData.ts new file mode 100644 index 00000000..70146ecd --- /dev/null +++ b/src/serialization/types/ProductFieldData.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const ProductFieldData: core.serialization.ObjectSchema< + serializers.ProductFieldData.Raw, + Webflow.ProductFieldData +> = core.serialization.object({ + name: core.serialization.string().optional(), + slug: core.serialization.string().optional(), + skuProperties: core.serialization.property( + "sku-properties", + core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).SkuPropertyList)) + .optional() + ), +}); + +export declare namespace ProductFieldData { + interface Raw { + name?: string | null; + slug?: string | null; + "sku-properties"?: serializers.SkuPropertyList.Raw[] | null; + } +} diff --git a/src/serialization/types/PublishStatus.ts b/src/serialization/types/PublishStatus.ts new file mode 100644 index 00000000..0a41203d --- /dev/null +++ b/src/serialization/types/PublishStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PublishStatus: core.serialization.Schema = + core.serialization.enum_(["staging", "live"]); + +export declare namespace PublishStatus { + type Raw = "staging" | "live"; +} diff --git a/src/serialization/types/PublishedItems.ts b/src/serialization/types/PublishedItems.ts new file mode 100644 index 00000000..1b8de915 --- /dev/null +++ b/src/serialization/types/PublishedItems.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PublishedItems: core.serialization.ObjectSchema = + core.serialization.object({ + publishedItemIds: core.serialization.list(core.serialization.string()).optional(), + errors: core.serialization.list(core.serialization.string()).optional(), + }); + +export declare namespace PublishedItems { + interface Raw { + publishedItemIds?: string[] | null; + errors?: string[] | null; + } +} diff --git a/src/serialization/types/PublishedSite.ts b/src/serialization/types/PublishedSite.ts new file mode 100644 index 00000000..155f8cae --- /dev/null +++ b/src/serialization/types/PublishedSite.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const PublishedSite: core.serialization.ObjectSchema = + core.serialization.object({ + queued: core.serialization.boolean(), + }); + +export declare namespace PublishedSite { + interface Raw { + queued: boolean; + } +} diff --git a/src/serialization/types/RegisteredScriptList.ts b/src/serialization/types/RegisteredScriptList.ts new file mode 100644 index 00000000..10e3baaa --- /dev/null +++ b/src/serialization/types/RegisteredScriptList.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const RegisteredScriptList: core.serialization.ObjectSchema< + serializers.RegisteredScriptList.Raw, + Webflow.RegisteredScriptList +> = core.serialization.object({ + registeredScripts: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).CustomCodeResponse)) + .optional(), +}); + +export declare namespace RegisteredScriptList { + interface Raw { + registeredScripts?: serializers.CustomCodeResponse.Raw[] | null; + } +} diff --git a/src/serialization/types/RemovedItems.ts b/src/serialization/types/RemovedItems.ts new file mode 100644 index 00000000..485633f8 --- /dev/null +++ b/src/serialization/types/RemovedItems.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const RemovedItems: core.serialization.ObjectSchema = + core.serialization.object({ + deletedItemIds: core.serialization.list(core.serialization.string()).optional(), + errors: core.serialization.list(core.serialization.string()).optional(), + }); + +export declare namespace RemovedItems { + interface Raw { + deletedItemIds?: string[] | null; + errors?: string[] | null; + } +} diff --git a/src/serialization/types/ScriptApply.ts b/src/serialization/types/ScriptApply.ts new file mode 100644 index 00000000..81009011 --- /dev/null +++ b/src/serialization/types/ScriptApply.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const ScriptApply: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + location: core.serialization.lazy(async () => (await import("..")).ScriptApplyLocation), + version: core.serialization.string(), + attributes: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + }); + +export declare namespace ScriptApply { + interface Raw { + id: string; + location: serializers.ScriptApplyLocation.Raw; + version: string; + attributes?: Record | null; + } +} diff --git a/src/serialization/types/ScriptApplyList.ts b/src/serialization/types/ScriptApplyList.ts new file mode 100644 index 00000000..c5304b6b --- /dev/null +++ b/src/serialization/types/ScriptApplyList.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const ScriptApplyList: core.serialization.ObjectSchema< + serializers.ScriptApplyList.Raw, + Webflow.ScriptApplyList +> = core.serialization.object({ + scripts: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).ScriptApply)) + .optional(), + lastUpdated: core.serialization.string().optional(), + createdOn: core.serialization.string().optional(), +}); + +export declare namespace ScriptApplyList { + interface Raw { + scripts?: serializers.ScriptApply.Raw[] | null; + lastUpdated?: string | null; + createdOn?: string | null; + } +} diff --git a/src/serialization/types/ScriptApplyLocation.ts b/src/serialization/types/ScriptApplyLocation.ts new file mode 100644 index 00000000..554dc7fb --- /dev/null +++ b/src/serialization/types/ScriptApplyLocation.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const ScriptApplyLocation: core.serialization.Schema< + serializers.ScriptApplyLocation.Raw, + Webflow.ScriptApplyLocation +> = core.serialization.enum_(["header", "footer"]); + +export declare namespace ScriptApplyLocation { + type Raw = "header" | "footer"; +} diff --git a/src/serialization/types/Site.ts b/src/serialization/types/Site.ts new file mode 100644 index 00000000..88ac8d16 --- /dev/null +++ b/src/serialization/types/Site.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Site: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string(), + workspaceId: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + displayName: core.serialization.string().optional(), + shortName: core.serialization.string().optional(), + lastPublished: core.serialization.date().optional(), + lastUpdated: core.serialization.date().optional(), + previewUrl: core.serialization.string().optional(), + timeZone: core.serialization.string().optional(), + customDomains: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).Domain)) + .optional(), +}); + +export declare namespace Site { + interface Raw { + id: string; + workspaceId?: string | null; + createdOn?: string | null; + displayName?: string | null; + shortName?: string | null; + lastPublished?: string | null; + lastUpdated?: string | null; + previewUrl?: string | null; + timeZone?: string | null; + customDomains?: serializers.Domain.Raw[] | null; + } +} diff --git a/src/serialization/types/SiteActivityLogItem.ts b/src/serialization/types/SiteActivityLogItem.ts new file mode 100644 index 00000000..13c4d5b5 --- /dev/null +++ b/src/serialization/types/SiteActivityLogItem.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const SiteActivityLogItem: core.serialization.ObjectSchema< + serializers.SiteActivityLogItem.Raw, + Webflow.SiteActivityLogItem +> = core.serialization.object({ + id: core.serialization.string().optional(), + createdOn: core.serialization.date().optional(), + lastUpdated: core.serialization.date().optional(), + event: core.serialization.string().optional(), + resourceOperation: core.serialization + .lazy(async () => (await import("..")).SiteActivityLogItemResourceOperation) + .optional(), + user: core.serialization.string().optional(), + resourceId: core.serialization.string().optional(), + resourceName: core.serialization.string().optional(), + newValue: core.serialization.string().optional(), + previousValue: core.serialization.string().optional(), + payload: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), +}); + +export declare namespace SiteActivityLogItem { + interface Raw { + id?: string | null; + createdOn?: string | null; + lastUpdated?: string | null; + event?: string | null; + resourceOperation?: serializers.SiteActivityLogItemResourceOperation.Raw | null; + user?: string | null; + resourceId?: string | null; + resourceName?: string | null; + newValue?: string | null; + previousValue?: string | null; + payload?: Record | null; + } +} diff --git a/src/serialization/types/SiteActivityLogItemResourceOperation.ts b/src/serialization/types/SiteActivityLogItemResourceOperation.ts new file mode 100644 index 00000000..4d6dc3c3 --- /dev/null +++ b/src/serialization/types/SiteActivityLogItemResourceOperation.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const SiteActivityLogItemResourceOperation: core.serialization.Schema< + serializers.SiteActivityLogItemResourceOperation.Raw, + Webflow.SiteActivityLogItemResourceOperation +> = core.serialization.enum_(["CREATED", "MODIFIED", "PUBLISHED", "UNPUBLISHED", "DELETED"]); + +export declare namespace SiteActivityLogItemResourceOperation { + type Raw = "CREATED" | "MODIFIED" | "PUBLISHED" | "UNPUBLISHED" | "DELETED"; +} diff --git a/src/serialization/types/SiteActivityLogResponse.ts b/src/serialization/types/SiteActivityLogResponse.ts new file mode 100644 index 00000000..38efee69 --- /dev/null +++ b/src/serialization/types/SiteActivityLogResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const SiteActivityLogResponse: core.serialization.ObjectSchema< + serializers.SiteActivityLogResponse.Raw, + Webflow.SiteActivityLogResponse +> = core.serialization.object({ + items: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).SiteActivityLogItem)) + .optional(), + pagination: core.serialization.lazyObject(async () => (await import("..")).Pagination).optional(), +}); + +export declare namespace SiteActivityLogResponse { + interface Raw { + items?: serializers.SiteActivityLogItem.Raw[] | null; + pagination?: serializers.Pagination.Raw | null; + } +} diff --git a/src/serialization/types/SitePublish.ts b/src/serialization/types/SitePublish.ts new file mode 100644 index 00000000..ff25c1f4 --- /dev/null +++ b/src/serialization/types/SitePublish.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const SitePublish: core.serialization.ObjectSchema = + core.serialization.object({ + payload: core.serialization.lazyObject(async () => (await import("..")).SitePublishPayload).optional(), + }); + +export declare namespace SitePublish { + interface Raw { + payload?: serializers.SitePublishPayload.Raw | null; + } +} diff --git a/src/serialization/types/SitePublishPayload.ts b/src/serialization/types/SitePublishPayload.ts new file mode 100644 index 00000000..20415fac --- /dev/null +++ b/src/serialization/types/SitePublishPayload.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const SitePublishPayload: core.serialization.ObjectSchema< + serializers.SitePublishPayload.Raw, + Webflow.SitePublishPayload +> = core.serialization.object({ + site: core.serialization.string().optional(), + publishTime: core.serialization.date().optional(), + domains: core.serialization.list(core.serialization.string()).optional(), + publishedBy: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), +}); + +export declare namespace SitePublishPayload { + interface Raw { + site?: string | null; + publishTime?: string | null; + domains?: string[] | null; + publishedBy?: Record | null; + } +} diff --git a/src/serialization/types/Sites.ts b/src/serialization/types/Sites.ts new file mode 100644 index 00000000..1addf834 --- /dev/null +++ b/src/serialization/types/Sites.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Sites: core.serialization.ObjectSchema = core.serialization.object({ + sites: core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).Site)).optional(), +}); + +export declare namespace Sites { + interface Raw { + sites?: serializers.Site.Raw[] | null; + } +} diff --git a/src/serialization/types/Sku.ts b/src/serialization/types/Sku.ts new file mode 100644 index 00000000..bd95f811 --- /dev/null +++ b/src/serialization/types/Sku.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Sku: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + lastPublished: core.serialization.date().optional(), + lastUpdated: core.serialization.date().optional(), + createdOn: core.serialization.date().optional(), + fieldData: core.serialization.lazyObject(async () => (await import("..")).SkuFieldData).optional(), +}); + +export declare namespace Sku { + interface Raw { + id?: string | null; + lastPublished?: string | null; + lastUpdated?: string | null; + createdOn?: string | null; + fieldData?: serializers.SkuFieldData.Raw | null; + } +} diff --git a/src/serialization/types/SkuFieldData.ts b/src/serialization/types/SkuFieldData.ts new file mode 100644 index 00000000..597872e1 --- /dev/null +++ b/src/serialization/types/SkuFieldData.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const SkuFieldData: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optional(), + slug: core.serialization.string().optional(), + price: core.serialization.lazyObject(async () => (await import("..")).SkuFieldDataPrice).optional(), + skuValues: core.serialization.property( + "sku-values", + core.serialization.lazy(async () => (await import("..")).SkuValueList).optional() + ), + }); + +export declare namespace SkuFieldData { + interface Raw { + name?: string | null; + slug?: string | null; + price?: serializers.SkuFieldDataPrice.Raw | null; + "sku-values"?: serializers.SkuValueList.Raw | null; + } +} diff --git a/src/serialization/types/SkuFieldDataPrice.ts b/src/serialization/types/SkuFieldDataPrice.ts new file mode 100644 index 00000000..364cad9e --- /dev/null +++ b/src/serialization/types/SkuFieldDataPrice.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const SkuFieldDataPrice: core.serialization.ObjectSchema< + serializers.SkuFieldDataPrice.Raw, + Webflow.SkuFieldDataPrice +> = core.serialization.object({ + value: core.serialization.number().optional(), + unit: core.serialization.string().optional(), +}); + +export declare namespace SkuFieldDataPrice { + interface Raw { + value?: number | null; + unit?: string | null; + } +} diff --git a/src/serialization/types/SkuPropertyList.ts b/src/serialization/types/SkuPropertyList.ts new file mode 100644 index 00000000..6f6c673c --- /dev/null +++ b/src/serialization/types/SkuPropertyList.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const SkuPropertyList: core.serialization.ObjectSchema< + serializers.SkuPropertyList.Raw, + Webflow.SkuPropertyList +> = core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string().optional(), + enum: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).SkuPropertyListEnumItem)) + .optional(), +}); + +export declare namespace SkuPropertyList { + interface Raw { + id?: string | null; + name?: string | null; + enum?: serializers.SkuPropertyListEnumItem.Raw[] | null; + } +} diff --git a/src/serialization/types/SkuPropertyListEnumItem.ts b/src/serialization/types/SkuPropertyListEnumItem.ts new file mode 100644 index 00000000..0ffbfeca --- /dev/null +++ b/src/serialization/types/SkuPropertyListEnumItem.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const SkuPropertyListEnumItem: core.serialization.ObjectSchema< + serializers.SkuPropertyListEnumItem.Raw, + Webflow.SkuPropertyListEnumItem +> = core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string().optional(), + slug: core.serialization.string().optional(), +}); + +export declare namespace SkuPropertyListEnumItem { + interface Raw { + id?: string | null; + name?: string | null; + slug?: string | null; + } +} diff --git a/src/serialization/types/SkuValueList.ts b/src/serialization/types/SkuValueList.ts new file mode 100644 index 00000000..ce9d8ec7 --- /dev/null +++ b/src/serialization/types/SkuValueList.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const SkuValueList: core.serialization.Schema = + core.serialization.record(core.serialization.string(), core.serialization.string()); + +export declare namespace SkuValueList { + type Raw = Record; +} diff --git a/src/serialization/types/StripeCard.ts b/src/serialization/types/StripeCard.ts new file mode 100644 index 00000000..437bfbc1 --- /dev/null +++ b/src/serialization/types/StripeCard.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const StripeCard: core.serialization.ObjectSchema = + core.serialization.object({ + last4: core.serialization.string().optional(), + brand: core.serialization.lazy(async () => (await import("..")).StripeCardBrand).optional(), + ownerName: core.serialization.string().optional(), + expires: core.serialization.lazyObject(async () => (await import("..")).StripeCardExpires).optional(), + }); + +export declare namespace StripeCard { + interface Raw { + last4?: string | null; + brand?: serializers.StripeCardBrand.Raw | null; + ownerName?: string | null; + expires?: serializers.StripeCardExpires.Raw | null; + } +} diff --git a/src/serialization/types/StripeCardBrand.ts b/src/serialization/types/StripeCardBrand.ts new file mode 100644 index 00000000..3c2f6fe1 --- /dev/null +++ b/src/serialization/types/StripeCardBrand.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const StripeCardBrand: core.serialization.Schema = + core.serialization.enum_(["Visa", "American Express", "MasterCard", "Discover", "JCB", "Diners Club", "Unknown"]); + +export declare namespace StripeCardBrand { + type Raw = "Visa" | "American Express" | "MasterCard" | "Discover" | "JCB" | "Diners Club" | "Unknown"; +} diff --git a/src/serialization/types/StripeCardExpires.ts b/src/serialization/types/StripeCardExpires.ts new file mode 100644 index 00000000..fb840bf1 --- /dev/null +++ b/src/serialization/types/StripeCardExpires.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const StripeCardExpires: core.serialization.ObjectSchema< + serializers.StripeCardExpires.Raw, + Webflow.StripeCardExpires +> = core.serialization.object({ + year: core.serialization.number().optional(), + month: core.serialization.number().optional(), +}); + +export declare namespace StripeCardExpires { + interface Raw { + year?: number | null; + month?: number | null; + } +} diff --git a/src/serialization/types/StripeDetails.ts b/src/serialization/types/StripeDetails.ts new file mode 100644 index 00000000..ac1b2b13 --- /dev/null +++ b/src/serialization/types/StripeDetails.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const StripeDetails: core.serialization.ObjectSchema = + core.serialization.object({ + subscriptionId: core.serialization.string().optional(), + paymentMethod: core.serialization.string().optional(), + paymentIntentId: core.serialization.string().optional(), + customerId: core.serialization.string().optional(), + chargeId: core.serialization.string().optional(), + disputeId: core.serialization.string().optional(), + refundId: core.serialization.string().optional(), + refundReason: core.serialization.string().optional(), + }); + +export declare namespace StripeDetails { + interface Raw { + subscriptionId?: string | null; + paymentMethod?: string | null; + paymentIntentId?: string | null; + customerId?: string | null; + chargeId?: string | null; + disputeId?: string | null; + refundId?: string | null; + refundReason?: string | null; + } +} diff --git a/src/serialization/types/TriggerType.ts b/src/serialization/types/TriggerType.ts new file mode 100644 index 00000000..f8c4c083 --- /dev/null +++ b/src/serialization/types/TriggerType.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const TriggerType: core.serialization.Schema = + core.serialization.enum_([ + "form_submission", + "site_publish", + "page_created", + "page_metadata_updated", + "page_deleted", + "ecomm_new_order", + "ecomm_order_changed", + "ecomm_inventory_changed", + "user_account_added", + "user_account_updated", + "user_account_deleted", + "collection_item_created", + "collection_item_changed", + "collection_item_deleted", + "collection_item_unpublished", + ]); + +export declare namespace TriggerType { + type Raw = + | "form_submission" + | "site_publish" + | "page_created" + | "page_metadata_updated" + | "page_deleted" + | "ecomm_new_order" + | "ecomm_order_changed" + | "ecomm_inventory_changed" + | "user_account_added" + | "user_account_updated" + | "user_account_deleted" + | "collection_item_created" + | "collection_item_changed" + | "collection_item_deleted" + | "collection_item_unpublished"; +} diff --git a/src/serialization/types/User.ts b/src/serialization/types/User.ts new file mode 100644 index 00000000..d85ac414 --- /dev/null +++ b/src/serialization/types/User.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const User: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + isEmailVerified: core.serialization.boolean().optional(), + lastUpdated: core.serialization.date().optional(), + invitedOn: core.serialization.date().optional(), + createdOn: core.serialization.date().optional(), + lastLogin: core.serialization.date().optional(), + status: core.serialization.lazy(async () => (await import("..")).UserStatus).optional(), + accessGroups: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).UserAccessGroupsItem)) + .optional(), + data: core.serialization.lazyObject(async () => (await import("..")).UserData).optional(), +}); + +export declare namespace User { + interface Raw { + id?: string | null; + isEmailVerified?: boolean | null; + lastUpdated?: string | null; + invitedOn?: string | null; + createdOn?: string | null; + lastLogin?: string | null; + status?: serializers.UserStatus.Raw | null; + accessGroups?: serializers.UserAccessGroupsItem.Raw[] | null; + data?: serializers.UserData.Raw | null; + } +} diff --git a/src/serialization/types/UserAccessGroupsItem.ts b/src/serialization/types/UserAccessGroupsItem.ts new file mode 100644 index 00000000..b613e032 --- /dev/null +++ b/src/serialization/types/UserAccessGroupsItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const UserAccessGroupsItem: core.serialization.ObjectSchema< + serializers.UserAccessGroupsItem.Raw, + Webflow.UserAccessGroupsItem +> = core.serialization.object({ + slug: core.serialization.string().optional(), + type: core.serialization.lazy(async () => (await import("..")).UserAccessGroupsItemType).optional(), +}); + +export declare namespace UserAccessGroupsItem { + interface Raw { + slug?: string | null; + type?: serializers.UserAccessGroupsItemType.Raw | null; + } +} diff --git a/src/serialization/types/UserAccessGroupsItemType.ts b/src/serialization/types/UserAccessGroupsItemType.ts new file mode 100644 index 00000000..9417dff1 --- /dev/null +++ b/src/serialization/types/UserAccessGroupsItemType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const UserAccessGroupsItemType: core.serialization.Schema< + serializers.UserAccessGroupsItemType.Raw, + Webflow.UserAccessGroupsItemType +> = core.serialization.enum_(["admin", "ecommerce"]); + +export declare namespace UserAccessGroupsItemType { + type Raw = "admin" | "ecommerce"; +} diff --git a/src/serialization/types/UserData.ts b/src/serialization/types/UserData.ts new file mode 100644 index 00000000..bc5ff2c7 --- /dev/null +++ b/src/serialization/types/UserData.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const UserData: core.serialization.ObjectSchema = + core.serialization.object({ + data: core.serialization.lazyObject(async () => (await import("..")).UserDataData).optional(), + }); + +export declare namespace UserData { + interface Raw { + data?: serializers.UserDataData.Raw | null; + } +} diff --git a/src/serialization/types/UserDataData.ts b/src/serialization/types/UserDataData.ts new file mode 100644 index 00000000..d0e285d5 --- /dev/null +++ b/src/serialization/types/UserDataData.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const UserDataData: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optional(), + email: core.serialization.string().optional(), + acceptPrivacy: core.serialization.property("accept-privacy", core.serialization.boolean().optional()), + acceptCommunications: core.serialization.property( + "accept-communications", + core.serialization.boolean().optional() + ), + additionalProperties: core.serialization.string().optional(), + }); + +export declare namespace UserDataData { + interface Raw { + name?: string | null; + email?: string | null; + "accept-privacy"?: boolean | null; + "accept-communications"?: boolean | null; + additionalProperties?: string | null; + } +} diff --git a/src/serialization/types/UserLimitReached.ts b/src/serialization/types/UserLimitReached.ts new file mode 100644 index 00000000..1d5dc438 --- /dev/null +++ b/src/serialization/types/UserLimitReached.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const UserLimitReached: core.serialization.ObjectSchema< + serializers.UserLimitReached.Raw, + Webflow.UserLimitReached +> = core.serialization.object({ + code: core.serialization.stringLiteral("user_limit_reached").optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization + .list(core.serialization.lazy(async () => (await import("..")).ErrorDetailsItem)) + .optional(), +}); + +export declare namespace UserLimitReached { + interface Raw { + code?: "user_limit_reached" | null; + message?: string | null; + externalReference?: string | null; + details?: serializers.ErrorDetailsItem.Raw[] | null; + } +} diff --git a/src/serialization/types/UserList.ts b/src/serialization/types/UserList.ts new file mode 100644 index 00000000..bd6e4871 --- /dev/null +++ b/src/serialization/types/UserList.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const UserList: core.serialization.ObjectSchema = + core.serialization.object({ + count: core.serialization.number().optional(), + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + total: core.serialization.number().optional(), + users: core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).User)).optional(), + }); + +export declare namespace UserList { + interface Raw { + count?: number | null; + limit?: number | null; + offset?: number | null; + total?: number | null; + users?: serializers.User.Raw[] | null; + } +} diff --git a/src/serialization/types/UserStatus.ts b/src/serialization/types/UserStatus.ts new file mode 100644 index 00000000..e0dc72ab --- /dev/null +++ b/src/serialization/types/UserStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const UserStatus: core.serialization.Schema = + core.serialization.enum_(["invited", "verified", "unverified"]); + +export declare namespace UserStatus { + type Raw = "invited" | "verified" | "unverified"; +} diff --git a/src/serialization/types/UserWebhookPayload.ts b/src/serialization/types/UserWebhookPayload.ts new file mode 100644 index 00000000..5dfb56b8 --- /dev/null +++ b/src/serialization/types/UserWebhookPayload.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const UserWebhookPayload: core.serialization.ObjectSchema< + serializers.UserWebhookPayload.Raw, + Webflow.UserWebhookPayload +> = core.serialization.object({ + triggerType: core.serialization.lazy(async () => (await import("..")).UserWebhookPayloadTriggerType).optional(), + payload: core.serialization.lazyObject(async () => (await import("..")).User).optional(), +}); + +export declare namespace UserWebhookPayload { + interface Raw { + triggerType?: serializers.UserWebhookPayloadTriggerType.Raw | null; + payload?: serializers.User.Raw | null; + } +} diff --git a/src/serialization/types/UserWebhookPayloadTriggerType.ts b/src/serialization/types/UserWebhookPayloadTriggerType.ts new file mode 100644 index 00000000..5dda9d94 --- /dev/null +++ b/src/serialization/types/UserWebhookPayloadTriggerType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const UserWebhookPayloadTriggerType: core.serialization.Schema< + serializers.UserWebhookPayloadTriggerType.Raw, + Webflow.UserWebhookPayloadTriggerType +> = core.serialization.enum_(["user_account_added", "user_account_updated", "user_account_deleted"]); + +export declare namespace UserWebhookPayloadTriggerType { + type Raw = "user_account_added" | "user_account_updated" | "user_account_deleted"; +} diff --git a/src/serialization/types/UsersNotEnabled.ts b/src/serialization/types/UsersNotEnabled.ts new file mode 100644 index 00000000..2356011c --- /dev/null +++ b/src/serialization/types/UsersNotEnabled.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const UsersNotEnabled: core.serialization.ObjectSchema< + serializers.UsersNotEnabled.Raw, + Webflow.UsersNotEnabled +> = core.serialization.object({ + code: core.serialization.stringLiteral("users_not_enabled").optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization + .list(core.serialization.lazy(async () => (await import("..")).ErrorDetailsItem)) + .optional(), +}); + +export declare namespace UsersNotEnabled { + interface Raw { + code?: "users_not_enabled" | null; + message?: string | null; + externalReference?: string | null; + details?: serializers.ErrorDetailsItem.Raw[] | null; + } +} diff --git a/src/serialization/types/Webhook.ts b/src/serialization/types/Webhook.ts new file mode 100644 index 00000000..0d7985ea --- /dev/null +++ b/src/serialization/types/Webhook.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const Webhook: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + workspaceId: core.serialization.string().optional(), + siteId: core.serialization.string().optional(), + triggerType: core.serialization.lazy(async () => (await import("..")).TriggerType).optional(), + filter: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + lastTriggered: core.serialization.date().optional(), + createdOn: core.serialization.date().optional(), + url: core.serialization.string().optional(), + }); + +export declare namespace Webhook { + interface Raw { + id?: string | null; + workspaceId?: string | null; + siteId?: string | null; + triggerType?: serializers.TriggerType.Raw | null; + filter?: Record | null; + lastTriggered?: string | null; + createdOn?: string | null; + url?: string | null; + } +} diff --git a/src/serialization/types/WebhookList.ts b/src/serialization/types/WebhookList.ts new file mode 100644 index 00000000..759bec12 --- /dev/null +++ b/src/serialization/types/WebhookList.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Webflow from "../../api"; +import * as core from "../../core"; + +export const WebhookList: core.serialization.ObjectSchema = + core.serialization.object({ + pagination: core.serialization.lazyObject(async () => (await import("..")).Pagination).optional(), + webhooks: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).Webhook)) + .optional(), + }); + +export declare namespace WebhookList { + interface Raw { + pagination?: serializers.Pagination.Raw | null; + webhooks?: serializers.Webhook.Raw[] | null; + } +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts new file mode 100644 index 00000000..29b5c8ca --- /dev/null +++ b/src/serialization/types/index.ts @@ -0,0 +1,123 @@ +export * from "./OauthScope"; +export * from "./AuthorizedUser"; +export * from "./AuthorizationAuthorizationAuthorizedTo"; +export * from "./AuthorizationAuthorization"; +export * from "./Authorization"; +export * from "./Pagination"; +export * from "./PublishStatus"; +export * from "./CustomCodeResponse"; +export * from "./RegisteredScriptList"; +export * from "./ScriptApplyList"; +export * from "./ScriptApplyLocation"; +export * from "./ScriptApply"; +export * from "./ListCustomCodeBlocks"; +export * from "./CustomCodeBlockType"; +export * from "./CustomCodeBlock"; +export * from "./PageList"; +export * from "./PageSeo"; +export * from "./PageOpenGraph"; +export * from "./Page"; +export * from "./PageCreatedWebhook"; +export * from "./PageMetadataUpdatedWebhook"; +export * from "./PageDeletedWebhook"; +export * from "./PageSeoGraphDataSeo"; +export * from "./PageSeoGraphDataOpenGraph"; +export * from "./PageSeoGraphData"; +export * from "./CollectionList"; +export * from "./CollectionListArrayItem"; +export * from "./Collection"; +export * from "./Fields"; +export * from "./FieldType"; +export * from "./Field"; +export * from "./CollectionItemFieldData"; +export * from "./CollectionItem"; +export * from "./CollectionItemListPagination"; +export * from "./CollectionItemList"; +export * from "./Webhook"; +export * from "./WebhookList"; +export * from "./TriggerType"; +export * from "./CollectionItemRemoved"; +export * from "./Sites"; +export * from "./Site"; +export * from "./Domain"; +export * from "./SitePublishPayload"; +export * from "./SitePublish"; +export * from "./SiteActivityLogResponse"; +export * from "./SiteActivityLogItemResourceOperation"; +export * from "./SiteActivityLogItem"; +export * from "./Assets"; +export * from "./Asset"; +export * from "./AssetVariant"; +export * from "./AssetUploadUploadDetails"; +export * from "./AssetUpload"; +export * from "./AssetFolder"; +export * from "./AssetFolderList"; +export * from "./FormFieldValueType"; +export * from "./FormFieldValue"; +export * from "./FormField"; +export * from "./FormResponseSettings"; +export * from "./Form"; +export * from "./FormList"; +export * from "./FormSubmission"; +export * from "./FormSubmissionList"; +export * from "./FormSubmissionTriggerPayload"; +export * from "./FormSubmissionTrigger"; +export * from "./Application"; +export * from "./PublishedSite"; +export * from "./PublishedItems"; +export * from "./RemovedItems"; +export * from "./UserStatus"; +export * from "./UserAccessGroupsItemType"; +export * from "./UserAccessGroupsItem"; +export * from "./User"; +export * from "./UserDataData"; +export * from "./UserData"; +export * from "./UserList"; +export * from "./UserWebhookPayloadTriggerType"; +export * from "./UserWebhookPayload"; +export * from "./AccessGroup"; +export * from "./AccessGroupList"; +export * from "./ErrorDetailsItem"; +export * from "./UsersNotEnabled"; +export * from "./DuplicateUserEmail"; +export * from "./UserLimitReached"; +export * from "./MissingScopes"; +export * from "./ProductFieldData"; +export * from "./Product"; +export * from "./SkuFieldDataPrice"; +export * from "./SkuFieldData"; +export * from "./Sku"; +export * from "./ProductAndSkUs"; +export * from "./ProductAndSkUsList"; +export * from "./SkuPropertyListEnumItem"; +export * from "./SkuPropertyList"; +export * from "./SkuValueList"; +export * from "./OrderStatus"; +export * from "./OrderDisputeLastStatus"; +export * from "./OrderCustomerInfo"; +export * from "./OrderMetadata"; +export * from "./OrderTotalsExtrasItemType"; +export * from "./OrderTotalsExtrasItem"; +export * from "./OrderTotals"; +export * from "./OrderDownloadFilesItem"; +export * from "./Order"; +export * from "./OrderList"; +export * from "./OrderPrice"; +export * from "./OrderAddressType"; +export * from "./OrderAddressJapanType"; +export * from "./OrderAddress"; +export * from "./OrderPurchasedItemVariantImageFileVariantsItem"; +export * from "./OrderPurchasedItemVariantImageFile"; +export * from "./OrderPurchasedItemVariantImage"; +export * from "./OrderPurchasedItem"; +export * from "./StripeDetails"; +export * from "./StripeCardBrand"; +export * from "./StripeCardExpires"; +export * from "./StripeCard"; +export * from "./PaypalDetails"; +export * from "./InventoryItemInventoryType"; +export * from "./InventoryItem"; +export * from "./EcommerceSettings"; +export * from "./Error_"; +export * from "./InvalidDomain"; +export * from "./NoDomains"; diff --git a/tests/api/collection.test.ts b/tests/api/collection.test.ts deleted file mode 100644 index 38e7a347..00000000 --- a/tests/api/collection.test.ts +++ /dev/null @@ -1,147 +0,0 @@ -import MockAdapter from "axios-mock-adapter"; -import axios from "axios"; -import { ItemFixture, CollectionFixture } from "../fixtures"; -import { Collection, Item } from "../../src/api"; - -describe("Collection", () => { - const mock = new MockAdapter(axios); - const client = axios.create(); - - describe("Static Methods", () => { - it("should respond with a list of site collections", async () => { - const { parameters, response } = CollectionFixture.list; - const { siteId } = parameters; - const path = `/sites/${siteId}/collections`; - - mock.onGet(path).reply(200, response); - const { data } = await Collection.list(parameters, client); - - expect(data).toBeDefined(); - expect(data.length).toBe(response.length); - expect(data[0]).toMatchObject(response[0]); - }); - - it("should respond with a single site collection", async () => { - const { parameters, response } = CollectionFixture.getOne; - const { collectionId } = parameters; - const path = `/collections/${collectionId}`; - - mock.onGet(path).reply(200, response); - const { data } = await Collection.getOne(parameters, client); - - expect(data).toBeDefined(); - expect(data._id).toBe(response._id); - }); - }); - - describe("Instance Methods", () => { - const res = { data: {}, status: 200, statusText: "", headers: {}, config: {} }; - const collection = new Collection(client, res, CollectionFixture.getOne.response); - - it("should respond with a list of items", async () => { - const { parameters, response } = ItemFixture.list; - const { collectionId } = parameters; - - const path = `/collections/${collectionId}/items`; - mock.onGet(path).reply(200, response); - const spy = jest.spyOn(Item, "list"); - - const result = await collection.items(); - - const _params = { params: undefined, collectionId }; - expect(spy).toBeCalledWith(_params, client); - - expect(result).toBeDefined(); - expect(result.length).toBe(response.items.length); - - expect(result[0]._id).toBe(response.items[0]._id); - - // item wrapper functions - expect(typeof result[0].update).toBe("function"); - expect(typeof result[0].remove).toBe("function"); - }); - - it("should respond with a single item", async () => { - const { parameters, response } = ItemFixture.getOne; - const { collectionId, itemId } = parameters; - - const path = `/collections/${collectionId}/items/${itemId}`; - mock.onGet(path).reply(200, response); - const spy = jest.spyOn(Item, "getOne"); - - const result = await collection.item({ itemId }); - - const _params = { params: undefined, collectionId, itemId }; - expect(spy).toBeCalledWith(_params, client); - - expect(result).toBeDefined(); - expect(result._id).toBe(response.items[0]._id); - - // item wrapper functions - expect(typeof result.update).toBe("function"); - expect(typeof result.remove).toBe("function"); - }); - - it("should create an item", async () => { - const { parameters, response } = ItemFixture.create; - const { collectionId, fields } = parameters; - - const path = `/collections/${collectionId}/items`; - mock.onPost(path).reply(200, response); - const spy = jest.spyOn(Item, "create"); - - const result = await collection.createItem(fields); - - const _params = { params: undefined, collectionId, fields }; - expect(spy).toBeCalledWith(_params, client); - - expect(result).toBeDefined(); - expect(result._id).toBe(response._id); - - // item wrapper functions - expect(typeof result.update).toBe("function"); - expect(typeof result.remove).toBe("function"); - }); - - it("should update an item", async () => { - const { parameters, response } = ItemFixture.update; - const { collectionId, itemId, fields } = parameters; - - const path = `/collections/${collectionId}/items/${itemId}`; - mock.onPut(path).reply(200, response); - const spy = jest.spyOn(Item, "update"); - - const result = await collection.updateItem({ - itemId, - fields, - }); - - const _params = { params: undefined, collectionId, itemId, fields }; - expect(spy).toBeCalledWith(_params, client); - - expect(result).toBeDefined(); - expect(result._id).toBe(response._id); - - // item wrapper functions - expect(typeof result.update).toBe("function"); - expect(typeof result.remove).toBe("function"); - }); - - it("should remove an item", async () => { - const { parameters, response } = ItemFixture.remove; - const { collectionId, itemId } = parameters; - - const path = `/collections/${collectionId}/items/${itemId}`; - mock.onDelete(path).reply(200, response); - const spy = jest.spyOn(Item, "remove"); - - const result = await collection.removeItem({ itemId }); - - const _params = { params: undefined, collectionId, itemId }; - expect(spy).toBeCalledWith(_params, client); - - expect(result).toBeDefined(); - expect(result.deleted).toBe(response.deleted); - }); - }); -}); diff --git a/tests/api/item.test.ts b/tests/api/item.test.ts deleted file mode 100644 index a0a09301..00000000 --- a/tests/api/item.test.ts +++ /dev/null @@ -1,180 +0,0 @@ -import MockAdapter from "axios-mock-adapter"; -import axios from "axios"; -import { ItemFixture } from "../fixtures"; -import { Item } from "../../src/api"; - -describe("Items", () => { - const mock = new MockAdapter(axios); - const client = axios.create(); - - describe("Static Methods", () => { - it("should respond with a list of items", async () => { - const { parameters, response } = ItemFixture.list; - const { collectionId } = parameters; - const path = `/collections/${collectionId}/items`; - - mock.onGet(path).reply(200, response); - const { data } = await Item.list(parameters, client); - - expect(data).toBeDefined(); - expect(data.items.length).toBe(response.items.length); - expect(data.items[0]).toMatchObject(response.items[0]); - }); - - it("should respond with a single item", async () => { - const { parameters, response } = ItemFixture.getOne; - const { collectionId, itemId } = parameters; - const path = `/collections/${collectionId}/items/${itemId}`; - - mock.onGet(path).reply(200, response); - const { data } = await Item.getOne(parameters, client); - - expect(data).toBeDefined(); - expect(data.items[0]._id).toBe(response.items[0]._id); - }); - - it("should create an item", async () => { - const { parameters, response } = ItemFixture.create; - const { collectionId } = parameters; - - const path = `/collections/${collectionId}/items`; - - mock.onPost(path).reply(200, response); - const { data } = await Item.create(parameters, client); - - expect(data).toBeDefined(); - expect(data._id).toBe(response._id); - }); - - it("should update an item", async () => { - const { parameters, response } = ItemFixture.update; - const { collectionId, itemId } = parameters; - const path = `/collections/${collectionId}/items/${itemId}`; - - mock.onPut(path).reply(200, response); - const { data } = await Item.update(parameters, client); - - expect(data).toBeDefined(); - expect(data._id).toBe(response._id); - }); - - it("should patch an item", async () => { - const { parameters, response } = ItemFixture.update; - const { collectionId, itemId } = parameters; - const path = `/collections/${collectionId}/items/${itemId}`; - - mock.onPatch(path).reply(200, response); - const { data } = await Item.patch(parameters, client); - - expect(data).toBeDefined(); - expect(data._id).toBe(response._id); - }); - - it("should remove an item", async () => { - const { parameters, response } = ItemFixture.remove; - const { collectionId, itemId } = parameters; - const path = `/collections/${collectionId}/items/${itemId}`; - - mock.onDelete(path).reply(200, response); - const { data } = await Item.remove(parameters, client); - - expect(data).toBeDefined(); - expect(data.deleted).toBe(response.deleted); - }); - - it("should unpublish multiple items", async () => { - const { parameters, response } = ItemFixture.unpublish; - const { collectionId, itemIds } = parameters; - const path = `/collections/${collectionId}/items`; - - mock.onDelete(path).reply(200, response); - const { data } = await Item.unpublish(parameters, client); - - expect(data).toBeDefined(); - expect(data.deletedItemIds.length).toBe(itemIds.length); - expect(data.deletedItemIds[0]).toBe(itemIds[0]); - }); - - it("should live unpublish multiple items", async () => { - const { parameters, response } = ItemFixture.unpublish; - const { collectionId, itemIds } = parameters; - const path = `/collections/${collectionId}/items?live=true`; - - mock.onDelete(path).reply(200, response); - const { data } = await Item.unpublish(parameters, client); - - expect(data).toBeDefined(); - expect(data.deletedItemIds.length).toBe(itemIds.length); - expect(data.deletedItemIds[0]).toBe(itemIds[0]); - }); - - it("should publish multiple items", async () => { - const { parameters, response } = ItemFixture.publish; - const { collectionId, itemIds } = parameters; - const path = `/collections/${collectionId}/items/publish`; - - mock.onPut(path).reply(200, response); - const { data } = await Item.publish(parameters, client); - - expect(data).toBeDefined(); - expect(data.publishedItemIds.length).toBe(itemIds.length); - expect(data.publishedItemIds[0]).toBe(itemIds[0]); - }); - - it("should live publish multiple items", async () => { - const { parameters, response } = ItemFixture.publish; - const { collectionId, itemIds } = parameters; - const path = `/collections/${collectionId}/items/publish?live=true`; - - mock.onPut(path).reply(200, response); - const { data } = await Item.publish(parameters, client); - - expect(data).toBeDefined(); - expect(data.publishedItemIds.length).toBe(itemIds.length); - expect(data.publishedItemIds[0]).toBe(itemIds[0]); - }); - }); - - describe("Instance Methods", () => { - const res = { data: {}, status: 200, statusText: "", headers: {}, config: {} }; - const item = new Item(client, res, ItemFixture.getOne.response.items[0]); - - it("should update an item", async () => { - const { parameters, response } = ItemFixture.update; - const { collectionId, itemId, fields } = parameters; - - const path = `/collections/${collectionId}/items/${itemId}`; - mock.onPut(path).reply(200, response); - const spy = jest.spyOn(Item, "update"); - - const result = await item.update(fields); - - const _params = { params: undefined, collectionId, itemId, fields }; - expect(spy).toBeCalledWith(_params, client); - - expect(result).toBeDefined(); - expect(result._id).toBe(response._id); - - // item wrapper functions - expect(typeof result.update).toBe("function"); - expect(typeof result.remove).toBe("function"); - }); - - it("should remove an item", async () => { - const { parameters, response } = ItemFixture.remove; - const { collectionId, itemId } = parameters; - - const path = `/collections/${collectionId}/items/${itemId}`; - mock.onDelete(path).reply(200, response); - const spy = jest.spyOn(Item, "remove"); - - const result = await item.remove(); - - const _params = { params: undefined, collectionId, itemId }; - expect(spy).toBeCalledWith(_params, client); - - expect(result).toBeDefined(); - expect(result.deleted).toBe(response.deleted); - }); - }); -}); diff --git a/tests/api/meta.test.ts b/tests/api/meta.test.ts deleted file mode 100644 index 185c6790..00000000 --- a/tests/api/meta.test.ts +++ /dev/null @@ -1,38 +0,0 @@ -import MockAdapter from "axios-mock-adapter"; -import axios from "axios"; -import { MetaFixture } from "../fixtures"; -import { Meta } from "../../src/api"; - -describe("Meta", () => { - const mock = new MockAdapter(axios); - const client = axios.create(); - - it("should get info", async () => { - const { response } = MetaFixture.info; - const path = `/info`; - - mock.onGet(path).reply(200, response); - const { data } = await Meta.info(client); - - expect(data).toBeDefined(); - expect(data.users).toEqual(response.users); - expect(data.sites).toEqual(response.sites); - expect(data.workspaces).toEqual(response.workspaces); - expect(data.application).toEqual(response.application); - }); - - it("should get info about the user", async () => { - const { response } = MetaFixture.installer; - - const path = `/user`; - mock.onGet(path).reply(200, response); - const { data } = await Meta.user(client); - - expect(data).toBeDefined(); - expect(data.user).toBeDefined(); - expect(data.user._id).toEqual(response.user._id); - expect(data.user.email).toEqual(response.user.email); - expect(data.user.firstName).toEqual(response.user.firstName); - expect(data.user.lastName).toEqual(response.user.lastName); - }); -}); diff --git a/tests/api/oauth.test.ts b/tests/api/oauth.test.ts deleted file mode 100644 index 879a4a98..00000000 --- a/tests/api/oauth.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import MockAdapter from "axios-mock-adapter"; -import axios from "axios"; -import { OAuthFixture } from "../fixtures"; -import { OAuth } from "../../src/api"; - -describe("OAuth", () => { - const mock = new MockAdapter(axios); - const client = axios.create(); - - it("should generate an authorization url", () => { - const { parameters } = OAuthFixture.authorize; - const { client_id, state, response_type } = parameters; - - const baseURL = "https://api.test.com"; - const instance = axios.create({ baseURL }); - const url = OAuth.authorizeUrl({ client_id, state }, instance); - const query = new URLSearchParams({ response_type, client_id, state }); - - expect(url).toBeDefined(); - expect(url).toBe(`${baseURL.replace("api.", "")}/oauth/authorize?${query.toString()}`); - }); - - it("should generate an access token", async () => { - const { parameters, response } = OAuthFixture.access_token; - const path = `/oauth/access_token`; - - mock.onPost(path).reply(200, response); - const { data } = await OAuth.accessToken(parameters, client); - - expect(data).toBeDefined(); - expect(data.access_token).toBe(response.access_token); - }); - - it("should revoke an access token", async () => { - const { parameters, response } = OAuthFixture.revoke_token; - const path = `/oauth/revoke_authorization`; - - mock.onPost(path).reply(200, response); - const { data } = await OAuth.revokeToken(parameters, client); - - expect(data).toBeDefined(); - expect(data.didRevoke).toBe(true); - }); -}); diff --git a/tests/api/site.test.ts b/tests/api/site.test.ts deleted file mode 100644 index a5c7ebc5..00000000 --- a/tests/api/site.test.ts +++ /dev/null @@ -1,202 +0,0 @@ -import MockAdapter from "axios-mock-adapter"; -import axios from "axios"; -import { CollectionFixture, SiteFixture, WebhookFixture } from "../fixtures"; -import { Site, Collection, Webhook } from "../../src/api"; - -describe("Sites", () => { - const mock = new MockAdapter(axios); - const client = axios.create(); - describe("Static Methods", () => { - it("should respond with a list of sites", async () => { - const { response } = SiteFixture.list; - const path = "/sites"; - - mock.onGet(path).reply(200, response); - const { data } = await Site.list(client); - - expect(data).toBeDefined(); - expect(data.length).toBe(response.length); - expect(data[0]).toMatchObject(response[0]); - }); - - it("should respond with a single site", async () => { - const { parameters, response } = SiteFixture.getOne; - const { siteId } = parameters; - const path = `/sites/${siteId}`; - - mock.onGet(path).reply(200, response); - const { data } = await Site.getOne(parameters, client); - - expect(data).toBeDefined(); - expect(data._id).toBe(siteId); - }); - - it("should respond with a list of domains", async () => { - const { parameters, response } = SiteFixture.domains; - const { siteId } = parameters; - const path = `/sites/${siteId}/domains`; - - mock.onGet(path).reply(200, response); - const { data } = await Site.domains(parameters, client); - - expect(data).toBeDefined(); - expect(data.length).toBe(response.length); - expect(data[0]).toMatchObject(response[0]); - }); - - it("should publish a site", async () => { - const { parameters, response } = SiteFixture.publish; - const { siteId } = parameters; - const path = `/sites/${siteId}/publish`; - - mock.onPost(path).reply(200, response); - const { data } = await Site.publish(parameters, client); - - expect(data).toBeDefined(); - expect(data.queued).toBe(true); - }); - }); - - describe("Instance Methods", () => { - const res = { data: {}, status: 200, statusText: "", headers: {}, config: {} }; - const site = new Site(client, res, SiteFixture.getOne.response); - - it("should respond with a list of collections", async () => { - const { parameters, response } = CollectionFixture.list; - const { siteId } = parameters; - - const path = `/sites/${siteId}/collections`; - mock.onGet(path).reply(200, response); - const spy = jest.spyOn(Collection, "list"); - - const result = await site.collections(); - - expect(spy).toHaveBeenCalledWith({ siteId }, client); - - expect(result).toBeDefined(); - expect(result.length).toBe(response.length); - - const [first] = result; - expect(first._id).toBe(response[0]._id); - - // collection wrapper functions - expect(typeof first.item).toBe("function"); - expect(typeof first.items).toBe("function"); - expect(typeof first.removeItem).toBe("function"); - expect(typeof first.createItem).toBe("function"); - expect(typeof first.updateItem).toBe("function"); - }); - - it("should respond with a list of webhooks", async () => { - const { parameters, response } = WebhookFixture.list; - const { siteId } = parameters; - - const path = `/sites/${siteId}/webhooks`; - mock.onGet(path).reply(200, response); - const spy = jest.spyOn(Webhook, "list"); - - const result = await site.webhooks(); - - expect(spy).toHaveBeenCalledWith({ siteId }, client); - - expect(result).toBeDefined(); - expect(result.length).toBe(response.length); - - const [first] = result; - expect(first._id).toBe(response[0]._id); - - // webhook wrapper functions - expect(typeof first.remove).toBe("function"); - }); - - it("should respond with a single webhook", async () => { - const { parameters, response } = WebhookFixture.getOne; - const { siteId, webhookId } = parameters; - - const path = `/sites/${siteId}/webhooks/${webhookId}`; - mock.onGet(path).reply(200, response); - const spy = jest.spyOn(Webhook, "getOne"); - - const result = await site.webhook({ webhookId }); - - expect(spy).toHaveBeenCalledWith({ siteId, webhookId }, client); - - expect(result).toBeDefined(); - expect(result._id).toBe(response._id); - - // webhook wrapper functions - expect(typeof result.remove).toBe("function"); - }); - - it("should create a webhook", async () => { - const { parameters, response } = WebhookFixture.create; - const { siteId } = parameters; - - const path = `/sites/${siteId}/webhooks`; - const spy = jest.spyOn(Webhook, "create"); - mock.onPost(path).reply(200, response); - - const result = await site.createWebhook(parameters); - - expect(spy).toHaveBeenCalledWith(parameters, client); - - expect(result).toBeDefined(); - expect(result._id).toBe(response._id); - - // webhook wrapper functions - expect(typeof result.remove).toBe("function"); - }); - - it("should remove a webhook", async () => { - const { parameters, response } = WebhookFixture.delete; - const { siteId, webhookId } = parameters; - - const path = `/sites/${siteId}/webhooks/${webhookId}`; - const spy = jest.spyOn(Webhook, "remove"); - mock.onDelete(path).reply(200, response); - - const result = await site.removeWebhook(parameters); - - expect(spy).toHaveBeenCalledWith(parameters, client); - - expect(result).toBeDefined(); - expect(result.deleted).toEqual(response.deleted); - }); - - it("should respond with a list of domains", async () => { - const { parameters, response } = SiteFixture.domains; - const { siteId } = parameters; - - const path = `/sites/${siteId}/domains`; - const spy = jest.spyOn(Site, "domains"); - mock.onGet(path).reply(200, response); - - const result = await site.domains(); - - expect(spy).toHaveBeenCalledWith(parameters, client); - - expect(result).toBeDefined(); - expect(result.length).toBe(response.length); - - const [first] = result; - expect(first._id).toBe(response[0]._id); - expect(first.name).toBe(response[0].name); - }); - - it("should publish a site", async () => { - const { parameters, response } = SiteFixture.publish; - const { siteId, domains } = parameters; - - const path = `/sites/${siteId}/publish`; - const spy = jest.spyOn(Site, "publish"); - mock.onPost(path).reply(200, response); - - const result = await site.publishSite(domains); - - expect(spy).toHaveBeenCalledWith(parameters, client); - - expect(result).toBeDefined(); - expect(result.queued).toBe(true); - }); - }); -}); diff --git a/tests/api/user.test.ts b/tests/api/user.test.ts deleted file mode 100644 index 489bc9a8..00000000 --- a/tests/api/user.test.ts +++ /dev/null @@ -1,139 +0,0 @@ -import MockAdapter from "axios-mock-adapter"; -import axios from "axios"; -import { UserFixture } from "../fixtures"; -import { User } from "../../src/api"; - -describe("Users", () => { - const mock = new MockAdapter(axios); - const client = axios.create(); - - describe("Static Methods", () => { - it("should respond with a list of users", async () => { - const { response, parameters } = UserFixture.list; - const { siteId } = parameters; - const path = `/sites/${siteId}/users`; - - mock.onGet(path).reply(200, response); - const { data } = await User.list(parameters, client); - - expect(data).toBeDefined(); - expect(data.users.length).toBe(response.users.length); - expect(data.users[0]).toMatchObject(response.users[0]); - }); - - it("should respond with a single user", async () => { - const { response, parameters } = UserFixture.getOne; - const { siteId, userId } = parameters; - const path = `/sites/${siteId}/users/${userId}`; - - mock.onGet(path).reply(200, response); - const { data } = await User.getOne(parameters, client); - - expect(data).toBeDefined(); - expect(data._id).toBe(response._id); - }); - - it("should invite a user", async () => { - const { response, parameters } = UserFixture.invite; - const { siteId } = parameters; - const path = `/sites/${siteId}/users/invite`; - - mock.onPost(path).reply(200, response); - const { data } = await User.invite(parameters, client); - - expect(data).toBeDefined(); - expect(data.data).toBeDefined(); - expect(data._id).toBe(response._id); - expect(data.data).toMatchObject(response.data); - }); - - it("should update a user", async () => { - const { response, parameters } = UserFixture.update; - const { siteId, userId } = parameters; - const path = `/sites/${siteId}/users/${userId}`; - - mock.onPatch(path).reply(200, response); - const { data } = await User.update(parameters, client); - - expect(data).toBeDefined(); - expect(data._id).toBe(response._id); - expect(data.data).toBeDefined(); - expect(data.data).toMatchObject(response.data); - }); - - it("should remove a user", async () => { - const { response, parameters } = UserFixture.delete; - const { siteId, userId } = parameters; - const path = `/sites/${siteId}/users/${userId}`; - - mock.onDelete(path).reply(200, response); - const { data } = await User.remove(parameters, client); - - expect(data).toBeDefined(); - expect(data.deleted).toBe(response.deleted); - }); - - it("should respond with a list of access groups", async () => { - const { response, parameters } = UserFixture.accessGroups; - const { siteId } = parameters; - const path = `/sites/${siteId}/accessgroups`; - - mock.onGet(path).reply(200, response); - const { data } = await User.accessGroups(parameters, client); - - expect(data).toBeDefined(); - expect(data.accessGroups.length).toBe(response.accessGroups.length); - expect(data.accessGroups[0]).toMatchObject(response.accessGroups[0]); - }); - }); - - describe("Instance Methods", () => { - const { parameters, response } = UserFixture.getOne; - const res = { - data: {}, - status: 200, - statusText: "", - headers: {}, - config: {}, - }; - const user = new User(client, res, response, { siteId: parameters.siteId }); - - it("should update a user", async () => { - const { response, parameters } = UserFixture.update; - const { siteId, userId, data } = parameters; - - const path = `/sites/${siteId}/users/${userId}`; - mock.onPatch(path).reply(200, response); - const spy = jest.spyOn(User, "update"); - - const result = await user.update(data); - - const _params = { data, siteId, userId }; - expect(spy).toHaveBeenCalledWith(_params, client); - - expect(result).toBeDefined(); - expect(result._id).toBe(response._id); - - expect(result.data).toBeDefined(); - - // user wrapper functions - expect(typeof result.update).toBe("function"); - expect(typeof result.remove).toBe("function"); - }); - - it("should remove a user", async () => { - const { response, parameters } = UserFixture.delete; - const { siteId, userId } = parameters; - - const path = `/sites/${siteId}/users/${userId}`; - mock.onDelete(path).reply(200, response); - const spy = jest.spyOn(User, "remove"); - - const result = await user.remove(); - - expect(spy).toHaveBeenCalledWith({ siteId, userId }, client); - - expect(result).toBeDefined(); - }); - }); -}); diff --git a/tests/api/webhook.test.ts b/tests/api/webhook.test.ts deleted file mode 100644 index b04aa6f5..00000000 --- a/tests/api/webhook.test.ts +++ /dev/null @@ -1,82 +0,0 @@ -import MockAdapter from "axios-mock-adapter"; -import axios from "axios"; -import { WebhookFixture } from "../fixtures"; -import { Webhook } from "../../src/api"; - -describe("Webhooks", () => { - const mock = new MockAdapter(axios); - const client = axios.create(); - - describe("Static Methods", () => { - it("should respond with a list of webhooks", async () => { - const { parameters, response } = WebhookFixture.list; - const { siteId } = parameters; - const path = `/sites/${siteId}/webhooks`; - - mock.onGet(path).reply(200, response); - const { data } = await Webhook.list(parameters, client); - - expect(data).toBeDefined(); - expect(data.length).toEqual(response.length); - expect(data[0]).toEqual(response[0]); - }); - - it("should respond with a single webhook", async () => { - const { parameters, response } = WebhookFixture.getOne; - const { siteId, webhookId } = parameters; - - const path = `/sites/${siteId}/webhooks/${webhookId}`; - mock.onGet(path).reply(200, response); - const { data } = await Webhook.getOne(parameters, client); - - expect(data).toBeDefined(); - expect(data._id).toBe(response._id); - }); - - it("should create a webhook", async () => { - const { parameters, response } = WebhookFixture.create; - const { siteId } = parameters; - - const path = `/sites/${siteId}/webhooks`; - mock.onPost(path).reply(200, response); - const { data } = await Webhook.create(parameters, client); - - expect(data).toBeDefined(); - expect(data._id).toBe(response._id); - }); - - it("should remove a webhook", async () => { - const { parameters, response } = WebhookFixture.delete; - const { siteId, webhookId } = parameters; - - const path = `/sites/${siteId}/webhooks/${webhookId}`; - mock.onDelete(path).reply(200, response); - const { data } = await Webhook.remove(parameters, client); - - expect(data).toBeDefined(); - expect(data.deleted).toEqual(response.deleted); - }); - }); - - describe("Instance Methods", () => { - const res = { data: {}, status: 200, statusText: "", headers: {}, config: {} }; - const webhook = new Webhook(client, res, WebhookFixture.getOne.response); - - it("should remove a webhook", async () => { - const { parameters, response } = WebhookFixture.delete; - const { siteId, webhookId } = parameters; - - const path = `/sites/${siteId}/webhooks/${webhookId}`; - mock.onDelete(path).reply(200, response); - const spy = jest.spyOn(Webhook, "remove"); - - const result = await webhook.remove(); - - const _params = { siteId, webhookId, params: undefined }; - expect(spy).toBeCalledWith(_params, client); - - expect(result).toBeDefined(); - expect(result.deleted).toBe(response.deleted); - }); - }); -}); diff --git a/tests/core/error.test.ts b/tests/core/error.test.ts deleted file mode 100644 index 6cc114c0..00000000 --- a/tests/core/error.test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ArgumentError, requireArgs } from "../../src/core/error"; -import MockAdapter from "axios-mock-adapter"; -import axios from "axios"; - -describe("Error", () => { - const mock = new MockAdapter(axios); - - it("should throw an ArgumentError", () => { - expect(() => { - throw new ArgumentError("name"); - }).toThrow("Argument 'name' is required but was not present"); - }); - - it("should throw an ArgumentError for required args", () => { - expect(() => { - requireArgs({ name: undefined }); - }).toThrow("Argument 'name' is required but was not present"); - }); -}); diff --git a/tests/core/response.test.ts b/tests/core/response.test.ts deleted file mode 100644 index 52b68d69..00000000 --- a/tests/core/response.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import axios, { AxiosResponse } from "axios"; -import { WebflowRecord, MetaResponse } from "../../src/core/response"; - -describe("Response", () => { - const client = axios.create(); - const response: AxiosResponse = { - status: 200, - statusText: "OK", - headers: { - "x-ratelimit-limit": "100", - "x-ratelimit-remaining": "99", - }, - config: {}, - data: {}, - }; - - it("should create a MetaResponse", () => { - const meta = new MetaResponse(response); - expect(meta.rateLimit.limit).toBe(100); - expect(meta.rateLimit.remaining).toBe(99); - }); - - it("should create a WebflowRecord", () => { - const record = new WebflowRecord(client, response, { id: "123" }); - - // confirm client - expect(record.client).toBe(client); - - // confirm response - expect(record.response).toBe(response); - - // confirm meta records - expect(record._meta.rateLimit.limit).toBe(100); - expect(record._meta.rateLimit.remaining).toBe(99); - }); -}); diff --git a/tests/core/webflow.test.ts b/tests/core/webflow.test.ts deleted file mode 100644 index 5cabd4a5..00000000 --- a/tests/core/webflow.test.ts +++ /dev/null @@ -1,540 +0,0 @@ -import axios from "axios"; -import MockAdapter from "axios-mock-adapter"; -import { Webflow, RequestError, SupportedScope } from "../../src/core"; -import { - MetaFixture, - SiteFixture, - ItemFixture, - WebhookFixture, - CollectionFixture, - OAuthFixture, - UserFixture, -} from "../fixtures"; - -describe("Webflow", () => { - const options = { host: "test.com", token: "test" }; - const mock = new MockAdapter(axios); - const webflow = new Webflow(options); - - afterEach(() => { - mock.resetHistory(); - }); - - describe("Instance", () => { - it("should create a new instance of Webflow", () => { - expect(() => new Webflow()).not.toThrowError(); - }); - - it("should create a new instance of Webflow with options", () => { - const options = { token: "token", host: "test.com" }; - const instance = new Webflow(options); - expect(instance.options).toEqual(options); - }); - }); - - describe("Helpers", () => { - it("should set the host", async () => { - mock.onGet("/").reply(200, {}); - await webflow.get("/"); - - expect(mock.history.get[0].baseURL).toBe(`https://api.${options.host}/`); - }); - - it("should set the authorization token", async () => { - mock.onGet("/", "", { Authorization: `Bearer ${options.token}` }).reply(200, {}); - await webflow.get("/"); - }); - }); - - describe("HTTP Methods", () => { - it("should call GET", async () => { - const query = { test: true }; - mock.onGet("/").reply(200, {}); - await webflow.get("/", query); - expect(mock.history.get.length).toBe(1); - expect(mock.history.get[0].params).toMatchObject(query); - }); - it("should call DELETE", async () => { - const query = { test: true }; - mock.onDelete("/").reply(200, {}); - await webflow.delete("/", query); - expect(mock.history.delete.length).toBe(1); - expect(mock.history.delete[0].params).toMatchObject(query); - }); - it("should call POST", async () => { - const query = { test: true }; - mock.onPost("/").reply(200, { body: true }); - await webflow.post("/", { body: true }, query); - expect(mock.history.post.length).toBe(1); - expect(mock.history.post[0].params).toMatchObject(query); - }); - it("should call PUT", async () => { - const query = { test: true }; - mock.onPut("/").reply(200, { body: true }); - await webflow.put("/", { body: true }, query); - expect(mock.history.put.length).toBe(1); - expect(mock.history.put[0].params).toMatchObject(query); - }); - it("should call PATCH", async () => { - const query = { test: true }; - mock.onPatch("/").reply(200, { body: true }); - await webflow.patch("/", { body: true }, query); - expect(mock.history.patch.length).toBe(1); - expect(mock.history.patch[0].params).toMatchObject(query); - }); - it("should throw a RequestError when Webflow returns a 200 with error", async () => { - mock.onGet("/").reply(200, { - msg: "msg", - code: 400, - name: "name", - path: "path", - err: "err", - }); - - await expect(webflow.get("/")).rejects.toThrowError(RequestError); - }); - }); - - describe("API Calls", () => { - describe("OAuth", () => { - it("should generate an authorization url", () => { - const { parameters } = OAuthFixture.authorize; - const { client_id, state, response_type } = parameters; - - const url = webflow.authorizeUrl({ client_id, state }); - const query = new URLSearchParams({ response_type, client_id, state }); - - expect(url).toBeDefined(); - expect(url).toBe(`https://${options.host}/oauth/authorize?${query.toString()}`); - }); - - it("should generate an authorization url with valid scopes", () => { - const { parameters } = OAuthFixture.authorize; - const { client_id, state, response_type } = parameters; - const scopes: SupportedScope[] = ["assets:read", "cms:write"]; - - const url = webflow.authorizeUrl({ client_id, state, scopes }); - const queryParts = [ - `response_type=${response_type}`, - `client_id=${client_id}`, - `state=${state}`, - `scope=${scopes.join("+")}`, - ]; - const query = queryParts.join("&"); - - expect(url).toBeDefined(); - expect(url).toBe(`https://${options.host}/oauth/authorize?${query}`); - }); - - it("should generate an access token", async () => { - const { parameters, response, path } = OAuthFixture.access_token; - - mock.onPost(path, parameters).reply(200, response); - const result = await webflow.accessToken(parameters); - - expect(result).toBeDefined(); - expect(result.access_token).toBe(response.access_token); - }); - - it("should revoke an access token", async () => { - const { parameters, response, path } = OAuthFixture.revoke_token; - - mock.onPost(path, parameters).reply(200, response); - const result = await webflow.revokeToken(parameters); - - expect(result).toBeDefined(); - expect(result.didRevoke).toBe(true); - }); - }); - - describe("Meta", () => { - it("should get info", async () => { - const { response } = MetaFixture.info; - const path = `/info`; - - mock.onGet(path).reply(200, response); - const result = await webflow.info(); - - expect(result).toBeDefined(); - expect(result.users).toEqual(response.users); - expect(result.sites).toEqual(response.sites); - expect(result.workspaces).toEqual(response.workspaces); - expect(result.application).toEqual(response.application); - }); - - it("should get info about the user", async () => { - const { response } = MetaFixture.installer; - - const path = `/user`; - mock.onGet(path).reply(200, response); - const result = await webflow.authenticatedUser(); - - expect(result).toBeDefined(); - expect(result.user._id).toEqual(response.user._id); - expect(result.user.email).toEqual(response.user.email); - expect(result.user.firstName).toEqual(response.user.firstName); - expect(result.user.lastName).toEqual(response.user.lastName); - }); - }); - - describe("Sites", () => { - it("should respond with a list of sites", async () => { - const { response } = SiteFixture.list; - const path = "/sites"; - - mock.onGet(path).reply(200, response); - const sites = await webflow.sites(); - - expect(sites).toBeDefined(); - expect(sites.length).toBe(response.length); - expect(sites[0]._id).toBe(response[0]._id); - }); - - it("should respond with a single site", async () => { - const { parameters, response } = SiteFixture.getOne; - const { siteId } = parameters; - const path = `/sites/${siteId}`; - - mock.onGet(path).reply(200, response); - const site = await webflow.site(parameters); - - expect(site).toBeDefined(); - expect(site._id).toBe(siteId); - }); - - it("should respond with a list of domains", async () => { - const { parameters, response } = SiteFixture.domains; - const { siteId } = parameters; - const path = `/sites/${siteId}/domains`; - - mock.onGet(path).reply(200, response); - const domains = await webflow.domains(parameters); - - expect(domains).toBeDefined(); - expect(domains.length).toBe(response.length); - expect(domains[0]).toMatchObject(response[0]); - }); - - it("should publish a site", async () => { - const { parameters, response } = SiteFixture.publish; - const { siteId, domains } = parameters; - const path = `/sites/${siteId}/publish`; - - mock.onPost(path, { domains }).reply(200, response); - const result = await webflow.publishSite(parameters); - - expect(result).toBeDefined(); - expect(result.queued).toBe(true); - }); - }); - - describe("Collections", () => { - it("should respond with a list of site collections", async () => { - const { parameters, response } = CollectionFixture.list; - const { siteId } = parameters; - const path = `/sites/${siteId}/collections`; - - mock.onGet(path).reply(200, response); - const collections = await webflow.collections(parameters); - - expect(collections).toBeDefined(); - expect(collections.length).toBe(response.length); - expect(collections[0]._id).toBe(response[0]._id); - }); - - it("should respond with a single site collection", async () => { - const { parameters, response } = CollectionFixture.getOne; - const { collectionId } = parameters; - const path = `/collections/${collectionId}`; - - mock.onGet(path).reply(200, response); - const collection = await webflow.collection(parameters); - - expect(collection).toBeDefined(); - expect(collection._id).toBe(response._id); - }); - }); - - describe("Items", () => { - it("should respond with a list of items", async () => { - const { parameters, response } = ItemFixture.list; - const { collectionId } = parameters; - const path = `/collections/${collectionId}/items`; - - mock.onGet(path).reply(200, response); - const items = await webflow.items(parameters); - - expect(items).toBeDefined(); - expect(items.length).toBe(response.items.length); - expect(items[0]._id).toBe(response.items[0]._id); - }); - - it("should respond with a list of paginated items", async () => { - const { parameters, response } = ItemFixture.list; - const { collectionId } = parameters; - - const limit = 2; - const offset = 2; - const path = `/collections/${collectionId}/items`; - - mock.onGet(path, { params: { limit, offset } }).reply(200, response); - const items = await webflow.items({ ...parameters, limit, offset }); - - expect(items).toBeDefined(); - expect(items.length).toBe(response.items.length); - expect(items[0]._id).toBe(response.items[0]._id); - }); - - it("should respond with a single item", async () => { - const { parameters, response } = ItemFixture.getOne; - const { collectionId, itemId } = parameters; - const path = `/collections/${collectionId}/items/${itemId}`; - - mock.onGet(path).reply(200, response); - const item = await webflow.item(parameters); - - expect(item).toBeDefined(); - expect(item._id).toBe(response.items[0]._id); - }); - - it("should create an item", async () => { - const { parameters, response } = ItemFixture.create; - const { collectionId, fields } = parameters; - - const path = `/collections/${collectionId}/items`; - - mock.onPost(path, { fields }).reply(200, response); - const item = await webflow.createItem(parameters); - - expect(item).toBeDefined(); - expect(item._id).toBe(response._id); - }); - - it("should update an item", async () => { - const { parameters, response } = ItemFixture.update; - const { collectionId, itemId } = parameters; - const path = `/collections/${collectionId}/items/${itemId}`; - - mock.onPut(path).reply(200, response); - const item = await webflow.updateItem(parameters); - - expect(item).toBeDefined(); - expect(item._id).toBe(response._id); - }); - - it("should patch an item", async () => { - const { parameters, response } = ItemFixture.update; - const { collectionId, itemId } = parameters; - const path = `/collections/${collectionId}/items/${itemId}`; - - mock.onPatch(path).reply(200, response); - const item = await webflow.patchItem(parameters); - - expect(item).toBeDefined(); - expect(item._id).toBe(response._id); - }); - - it("should remove an item", async () => { - const { parameters, response } = ItemFixture.remove; - const { collectionId, itemId } = parameters; - const path = `/collections/${collectionId}/items/${itemId}`; - - mock.onDelete(path).reply(200, response); - const item = await webflow.removeItem(parameters); - - expect(item).toBeDefined(); - expect(item.deleted).toBe(response.deleted); - }); - - it("should unpublish multiple items", async () => { - const { parameters, response } = ItemFixture.unpublish; - const { collectionId, itemIds } = parameters; - const path = `/collections/${collectionId}/items`; - - mock.onDelete(path).reply(200, response); - const result = await webflow.deleteItems(parameters); - - expect(result).toBeDefined(); - expect(result.deletedItemIds.length).toBe(itemIds.length); - expect(result.deletedItemIds[0]).toBe(itemIds[0]); - }); - - it("should live unpublish multiple items", async () => { - const { parameters, response } = ItemFixture.unpublish; - const { collectionId, itemIds } = parameters; - const path = `/collections/${collectionId}/items`; - - const { live } = parameters; - mock.onDelete(path, { params: { live } }).reply(200, response); - const result = await webflow.deleteItems(parameters); - - expect(result).toBeDefined(); - expect(result.deletedItemIds.length).toBe(itemIds.length); - expect(result.deletedItemIds[0]).toBe(itemIds[0]); - }); - - it("should publish multiple items", async () => { - const { parameters, response } = ItemFixture.publish; - const { collectionId, itemIds } = parameters; - - const { live } = parameters; - const path = `/collections/${collectionId}/items/publish`; - - mock.onPut(path, { itemIds }).reply(200, response); - const result = await webflow.publishItems(parameters); - expect(mock.history.put[0].params).toMatchObject({ live }); - - expect(result).toBeDefined(); - expect(result.publishedItemIds.length).toBe(itemIds.length); - expect(result.publishedItemIds[0]).toBe(itemIds[0]); - }); - - it("should live publish multiple items", async () => { - const { parameters, response } = ItemFixture.publish; - const { collectionId, itemIds } = parameters; - - const { live } = parameters; - const path = `/collections/${collectionId}/items/publish`; - - mock.onPut(path, { itemIds }).reply(200, response); - const result = await webflow.publishItems(parameters); - expect(mock.history.put[0].params).toMatchObject({ live }); - - expect(result).toBeDefined(); - expect(result.publishedItemIds.length).toBe(itemIds.length); - expect(result.publishedItemIds[0]).toBe(itemIds[0]); - }); - }); - - describe("Memberships", () => { - it("should respond with a list of users", async () => { - const { response, parameters } = UserFixture.list; - const { siteId } = parameters; - const path = `/sites/${siteId}/users`; - - mock.onGet(path).reply(200, response); - const users = await webflow.users(parameters); - - expect(users).toBeDefined(); - expect(users.length).toBe(response.users.length); - expect(users[0]).toMatchObject(response.users[0]); - }); - - it("should respond with a single user", async () => { - const { response, parameters } = UserFixture.getOne; - const { siteId, userId } = parameters; - const path = `/sites/${siteId}/users/${userId}`; - - mock.onGet(path).reply(200, response); - const user = await webflow.user(parameters); - - expect(user).toBeDefined(); - expect(user._id).toBe(response._id); - }); - - it("should invite a user", async () => { - const { response, parameters } = UserFixture.invite; - const { siteId, email } = parameters; - const path = `/sites/${siteId}/users/invite`; - - mock.onPost(path, { email }).reply(200, response); - const user = await webflow.inviteUser(parameters); - - expect(user).toBeDefined(); - expect(user.data).toBeDefined(); - expect(user._id).toBe(response._id); - expect(user.data).toMatchObject(response.data); - }); - - it("should update a user", async () => { - const { response, parameters } = UserFixture.update; - const { siteId, userId } = parameters; - const path = `/sites/${siteId}/users/${userId}`; - - mock.onPatch(path).reply(200, response); - const user = await webflow.updateUser(parameters); - - expect(user).toBeDefined(); - expect(user._id).toBe(response._id); - expect(user.data).toBeDefined(); - expect(user.data).toMatchObject(response.data); - }); - - it("should remove a user", async () => { - const { response, parameters } = UserFixture.delete; - const { siteId, userId } = parameters; - const path = `/sites/${siteId}/users/${userId}`; - - mock.onDelete(path).reply(200, response); - const result = await webflow.removeUser(parameters); - - expect(result).toBeDefined(); - expect(result.deleted).toBe(response.deleted); - }); - - it("should respond with a list of access groups", async () => { - const { response, parameters } = UserFixture.accessGroups; - const { siteId } = parameters; - const path = `/sites/${siteId}/accessgroups`; - - mock.onGet(path).reply(200, response); - const result = await webflow.accessGroups(parameters); - - expect(result).toBeDefined(); - expect(result.accessGroups.length).toBe(response.accessGroups.length); - expect(result.accessGroups[0]).toMatchObject(response.accessGroups[0]); - }); - }); - - describe("Webhooks", () => { - it("should respond with a list of webhooks", async () => { - const { parameters, response } = WebhookFixture.list; - const { siteId } = parameters; - const path = `/sites/${siteId}/webhooks`; - - mock.onGet(path).reply(200, response); - const webhooks = await webflow.webhooks(parameters); - - expect(webhooks).toBeDefined(); - expect(webhooks.length).toEqual(response.length); - expect(webhooks[0]).toMatchObject(response[0]); - }); - - it("should respond with a single webhook", async () => { - const { parameters, response } = WebhookFixture.getOne; - const { siteId, webhookId } = parameters; - - const path = `/sites/${siteId}/webhooks/${webhookId}`; - mock.onGet(path).reply(200, response); - const webhook = await webflow.webhook(parameters); - - expect(webhook).toBeDefined(); - expect(webhook._id).toBe(response._id); - }); - - it("should create a webhook", async () => { - const { parameters, response } = WebhookFixture.create; - const { siteId, triggerType, url } = parameters; - - const path = `/sites/${siteId}/webhooks`; - mock.onPost(path, { triggerType, url }).reply(200, response); - const webhook = await webflow.createWebhook(parameters); - - expect(webhook).toBeDefined(); - expect(webhook._id).toBe(response._id); - }); - - it("should remove a webhook", async () => { - const { parameters, response } = WebhookFixture.delete; - const { siteId, webhookId } = parameters; - - const path = `/sites/${siteId}/webhooks/${webhookId}`; - mock.onDelete(path).reply(200, response); - const result = await webflow.removeWebhook(parameters); - - expect(result).toBeDefined(); - expect(result.deleted).toEqual(response.deleted); - }); - }); - }); -}); diff --git a/tests/fixtures/collection.fixture.ts b/tests/fixtures/collection.fixture.ts deleted file mode 100644 index 9d06630a..00000000 --- a/tests/fixtures/collection.fixture.ts +++ /dev/null @@ -1,374 +0,0 @@ -export const CollectionFixture = { - list: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - }, - response: [ - { - _id: "580e63fc8c9a982ac9b8b745", - lastUpdated: "2016-10-24T19:42:38.929Z", - createdOn: "2016-10-24T19:41:48.349Z", - name: "Blog Posts", - slug: "post", - singularName: "Blog Post", - }, - { - _id: "580e64088c9a982ac9b8b766", - lastUpdated: "2016-10-24T19:42:00.799Z", - createdOn: "2016-10-24T19:42:00.777Z", - name: "Authors", - slug: "author", - singularName: "Author", - }, - ], - }, - getOne: { - parameters: { - collectionId: "580e63fc8c9a982ac9b8b745", - }, - response: { - _id: "580e63fc8c9a982ac9b8b745", - lastUpdated: "2016-10-24T19:42:38.929Z", - createdOn: "2016-10-24T19:41:48.349Z", - name: "Blog Posts", - slug: "post", - singularName: "Blog Post", - fields: [ - { - id: "7f62a9781291109b9e428fb47239fd35", - editable: true, - required: false, - type: "RichText", - slug: "post-body", - name: "Post Body", - }, - { - validations: { - singleLine: false, - }, - id: "ac4ffead755a78c710c44042f528b073", - helpText: "A summary of the blog post that appears on blog post grid", - editable: true, - required: false, - type: "PlainText", - slug: "post-summary", - name: "Post Summary", - }, - { - id: "ba1cfbdaa6b38b8e95e9b5063da8a5bd", - editable: true, - required: false, - type: "ImageRef", - slug: "main-image", - name: "Main Image", - }, - { - id: "a8c6ea29b08cc5b5ef966908fa1deae2", - helpText: "Smaller version of main image that is used on blog post grid", - editable: true, - required: false, - type: "ImageRef", - slug: "thumbnail-image", - name: "Thumbnail image", - }, - { - id: "87e79a644a6fb5729940ec24e0012f01", - editable: true, - required: false, - type: "Set", - innerType: "ImageRef", - slug: "picture-gallery", - name: "Picture Gallery", - }, - { - id: "1e54974d97181032d3206ea021668e5f", - editable: true, - required: false, - type: "Bool", - slug: "featured", - name: "Featured?", - }, - { - id: "648463cbc042ab079c2b99430a398ae5", - editable: true, - required: false, - type: "Color", - slug: "color", - name: "Color", - }, - { - validations: { - collectionId: "580e64088c9a982ac9b8b766", - }, - id: "ea9067c48edee510de71fe503fa2fb51", - editable: true, - required: false, - type: "ItemRef", - slug: "author", - name: "Author", - }, - { - validations: { - maxLength: 256, - }, - id: "60c0667e27b6d5a6daedec3a641265f6", - editable: true, - required: true, - type: "PlainText", - slug: "name", - name: "Name", - }, - { - validations: { - messages: { - maxLength: "Must be less than 256 characters", - pattern: "Must be alphanumerical and not contain any spaces or special characters", - }, - pattern: {}, - maxLength: 256, - }, - id: "8f0c953df91d10b767d66e1d7d00d631", - unique: true, - editable: true, - required: true, - type: "PlainText", - slug: "slug", - name: "Slug", - }, - { - default: false, - id: "e4e92e700d70faffac6fa82ff2bfaece", - editable: true, - required: true, - type: "Bool", - slug: "_archived", - name: "Archived", - }, - { - default: false, - id: "f2675b2ac4fcef746b24d4a320887ef8", - editable: true, - required: true, - type: "Bool", - slug: "_draft", - name: "Draft", - }, - { - id: "0913a35d92208bdf8fbf3ed1e39b771e", - editable: false, - required: false, - type: "Date", - slug: "created-on", - name: "Created On", - }, - { - id: "3de04889465fe6d718e47b152ef5bb4d", - editable: false, - required: false, - type: "Date", - slug: "updated-on", - name: "Updated On", - }, - { - id: "2a3cd866d5dbb294896130b233218626", - editable: false, - required: false, - type: "Date", - slug: "published-on", - name: "Published On", - }, - { - id: "62c18561b9e89517751c6d8712d48f91", - editable: false, - required: false, - type: "User", - slug: "created-by", - name: "Created By", - }, - { - id: "50918093b4e4d4eca1e83c25bcdc06a4", - editable: false, - required: false, - type: "User", - slug: "updated-by", - name: "Updated By", - }, - { - id: "5c4587f18b32ef245daeaadfcba7860b", - editable: false, - required: false, - type: "User", - slug: "published-by", - name: "Published By", - }, - { - id: "7f62a9781291109b9e428fb47239fd35", - editable: true, - required: false, - type: "RichText", - slug: "post-body", - name: "Post Body", - }, - { - validations: { - singleLine: false, - }, - id: "ac4ffead755a78c710c44042f528b073", - helpText: "A summary of the blog post that appears on blog post grid", - editable: true, - required: false, - type: "PlainText", - slug: "post-summary", - name: "Post Summary", - }, - { - id: "ba1cfbdaa6b38b8e95e9b5063da8a5bd", - editable: true, - required: false, - type: "ImageRef", - slug: "main-image", - name: "Main Image", - }, - { - id: "a8c6ea29b08cc5b5ef966908fa1deae2", - helpText: "Smaller version of main image that is used on blog post grid", - editable: true, - required: false, - type: "ImageRef", - slug: "thumbnail-image", - name: "Thumbnail image", - }, - { - id: "87e79a644a6fb5729940ec24e0012f01", - editable: true, - required: false, - type: "Set", - innerType: "ImageRef", - slug: "picture-gallery", - name: "Picture Gallery", - }, - { - id: "1e54974d97181032d3206ea021668e5f", - editable: true, - required: false, - type: "Bool", - slug: "featured", - name: "Featured?", - }, - { - id: "648463cbc042ab079c2b99430a398ae5", - editable: true, - required: false, - type: "Color", - slug: "color", - name: "Color", - }, - { - validations: { - collectionId: "580e64088c9a982ac9b8b766", - }, - id: "ea9067c48edee510de71fe503fa2fb51", - editable: true, - required: false, - type: "ItemRef", - slug: "author", - name: "Author", - }, - { - validations: { - maxLength: 256, - }, - id: "60c0667e27b6d5a6daedec3a641265f6", - editable: true, - required: true, - type: "PlainText", - slug: "name", - name: "Name", - }, - { - validations: { - messages: { - maxLength: "Must be less than 256 characters", - pattern: "Must be alphanumerical and not contain any spaces or special characters", - }, - pattern: {}, - maxLength: 256, - }, - id: "8f0c953df91d10b767d66e1d7d00d631", - unique: true, - editable: true, - required: true, - type: "PlainText", - slug: "slug", - name: "Slug", - }, - { - default: false, - id: "e4e92e700d70faffac6fa82ff2bfaece", - editable: true, - required: true, - type: "Bool", - slug: "_archived", - name: "Archived", - }, - { - default: false, - id: "f2675b2ac4fcef746b24d4a320887ef8", - editable: true, - required: true, - type: "Bool", - slug: "_draft", - name: "Draft", - }, - { - id: "0913a35d92208bdf8fbf3ed1e39b771e", - editable: false, - required: false, - type: "Date", - slug: "created-on", - name: "Created On", - }, - { - id: "3de04889465fe6d718e47b152ef5bb4d", - editable: false, - required: false, - type: "Date", - slug: "updated-on", - name: "Updated On", - }, - { - id: "2a3cd866d5dbb294896130b233218626", - editable: false, - required: false, - type: "Date", - slug: "published-on", - name: "Published On", - }, - { - id: "62c18561b9e89517751c6d8712d48f91", - editable: false, - required: false, - type: "User", - slug: "created-by", - name: "Created By", - }, - { - id: "50918093b4e4d4eca1e83c25bcdc06a4", - editable: false, - required: false, - type: "User", - slug: "updated-by", - name: "Updated By", - }, - { - id: "5c4587f18b32ef245daeaadfcba7860b", - editable: false, - required: false, - type: "User", - slug: "published-by", - name: "Published By", - }, - ], - }, - }, -}; diff --git a/tests/fixtures/index.ts b/tests/fixtures/index.ts deleted file mode 100644 index 5223fc75..00000000 --- a/tests/fixtures/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from "./collection.fixture"; -export * from "./webhook.fixture"; -export * from "./oauth.fixture"; -export * from "./meta.fixture"; -export * from "./site.fixture"; -export * from "./item.fixture"; -export * from "./user.fixture"; diff --git a/tests/fixtures/item.fixture.ts b/tests/fixtures/item.fixture.ts deleted file mode 100644 index cd1be19c..00000000 --- a/tests/fixtures/item.fixture.ts +++ /dev/null @@ -1,193 +0,0 @@ -export const ItemFixture = { - list: { - parameters: { - collectionId: "580e63fc8c9a982ac9b8b745", - }, - response: { - items: [ - { - _archived: false, - _draft: false, - color: "#a98080", - name: "Exciting blog post title", - "post-body": "

Blog post contents...

", - "post-summary": "Summary of exciting blog post", - "main-image": { - fileId: "580e63fe8c9a982ac9b8b749", - url: "https://d1otoma47x30pg.cloudfront.net/580e63fc8c9a982ac9b8b744/580e63fe8c9a982ac9b8b749_1477338110257-image20.jpg", - }, - slug: "exciting-post", - author: "580e640c8c9a982ac9b8b778", - "updated-on": "2016-11-15T22:45:32.647Z", - "updated-by": "Person_5660c5338e9d3b0bee3b86aa", - "created-on": "2016-11-15T22:45:32.647Z", - "created-by": "Person_5660c5338e9d3b0bee3b86aa", - "published-on": null, - "published-by": null, - _cid: "580e63fc8c9a982ac9b8b745", - _id: "582b900cba19143b2bb8a759", - }, - ], - count: 1, - limit: 1, - offset: 0, - total: 5, - }, - }, - getOne: { - parameters: { - collectionId: "580e63fc8c9a982ac9b8b745", - itemId: "582b900cba19143b2bb8a759", - }, - response: { - items: [ - { - _archived: false, - _draft: false, - color: "#a98080", - name: "Exciting blog post title", - "post-body": "

Blog post contents...

", - "post-summary": "Summary of exciting blog post", - "main-image": { - fileId: "580e63fe8c9a982ac9b8b749", - url: "https://d1otoma47x30pg.cloudfront.net/580e63fc8c9a982ac9b8b744/580e63fe8c9a982ac9b8b749_1477338110257-image20.jpg", - }, - slug: "exciting-post", - author: "580e640c8c9a982ac9b8b778", - "updated-on": "2016-11-15T22:45:32.647Z", - "updated-by": "Person_5660c5338e9d3b0bee3b86aa", - "created-on": "2016-11-15T22:45:32.647Z", - "created-by": "Person_5660c5338e9d3b0bee3b86aa", - "published-on": null, - "published-by": null, - _cid: "580e63fc8c9a982ac9b8b745", - _id: "582b900cba19143b2bb8a759", - }, - ], - count: 1, - limit: 1, - offset: 0, - total: 5, - }, - }, - update: { - parameters: { - collectionId: "580e63fc8c9a982ac9b8b745", - itemId: "582b900cba19143b2bb8a759", - fields: { - _archived: false, - _draft: false, - color: "#a98080", - name: "Exciting blog post title", - "post-body": "

Blog post contents...

", - "post-summary": "Summary of exciting blog post", - "main-image": { - fileId: "580e63fe8c9a982ac9b8b749", - url: "https://d1otoma47x30pg.cloudfront.net/580e63fc8c9a982ac9b8b744/580e63fe8c9a982ac9b8b749_1477338110257-image20.jpg", - }, - slug: "exciting-post", - }, - }, - response: { - _archived: false, - _draft: false, - color: "#a98080", - name: "Exciting blog post title", - "post-body": "

Blog post contents...

", - "post-summary": "Summary of exciting blog post", - "main-image": { - fileId: "580e63fe8c9a982ac9b8b749", - url: "https://d1otoma47x30pg.cloudfront.net/580e63fc8c9a982ac9b8b744/580e63fe8c9a982ac9b8b749_1477338110257-image20.jpg", - }, - slug: "exciting-post", - author: "580e640c8c9a982ac9b8b778", - "updated-on": "2016-11-15T22:45:32.647Z", - "updated-by": "Person_5660c5338e9d3b0bee3b86aa", - "created-on": "2016-11-15T22:45:32.647Z", - "created-by": "Person_5660c5338e9d3b0bee3b86aa", - "published-on": null, - "published-by": null, - _cid: "580e63fc8c9a982ac9b8b745", - _id: "582b900cba19143b2bb8a759", - }, - }, - create: { - parameters: { - collectionId: "580e63fc8c9a982ac9b8b745", - fields: { - _archived: false, - _draft: false, - color: "#a98080", - name: "Exciting blog post title", - "post-body": "

Blog post contents...

", - "post-summary": "Summary of exciting blog post", - "main-image": { - fileId: "580e63fe8c9a982ac9b8b749", - url: "https://d1otoma47x30pg.cloudfront.net/580e63fc8c9a982ac9b8b744/580e63fe8c9a982ac9b8b749_1477338110257-image20.jpg", - }, - slug: "exciting-post", - }, - }, - response: { - _archived: false, - _draft: false, - color: "#a98080", - name: "Exciting blog post title", - "post-body": "

Blog post contents...

", - "post-summary": "Summary of exciting blog post", - "main-image": { - fileId: "580e63fe8c9a982ac9b8b749", - url: "https://d1otoma47x30pg.cloudfront.net/580e63fc8c9a982ac9b8b744/580e63fe8c9a982ac9b8b749_1477338110257-image20.jpg", - }, - slug: "exciting-post", - author: "580e640c8c9a982ac9b8b778", - "updated-on": "2016-11-15T22:45:32.647Z", - "updated-by": "Person_5660c5338e9d3b0bee3b86aa", - "created-on": "2016-11-15T22:45:32.647Z", - "created-by": "Person_5660c5338e9d3b0bee3b86aa", - "published-on": null, - "published-by": null, - _cid: "580e63fc8c9a982ac9b8b745", - _id: "582b900cba19143b2bb8a759", - }, - }, - publish: { - parameters: { - live: true, - collectionId: "580e63fc8c9a982ac9b8b745", - itemIds: ["62aa37923cf7a9de1ca4469c", "62aa37923cf7a9de1ca44697", "62aa37923cf7a9de1ca44696"], - }, - response: { - publishedItemIds: [ - "62aa37923cf7a9de1ca4469c", - "62aa37923cf7a9de1ca44697", - "62aa37923cf7a9de1ca44696", - ], - errors: [], - }, - }, - unpublish: { - parameters: { - live: true, - collectionId: "580e63fc8c9a982ac9b8b745", - itemIds: ["62aa37923cf7a9de1ca4469c", "62aa37923cf7a9de1ca44697", "62aa37923cf7a9de1ca44696"], - }, - response: { - deletedItemIds: [ - "62aa37923cf7a9de1ca4469c", - "62aa37923cf7a9de1ca44697", - "62aa37923cf7a9de1ca44696", - ], - errors: [], - }, - }, - remove: { - parameters: { - collectionId: "580e63fc8c9a982ac9b8b745", - itemId: "582b900cba19143b2bb8a759", - }, - response: { - deleted: 1, - }, - }, -}; diff --git a/tests/fixtures/meta.fixture.ts b/tests/fixtures/meta.fixture.ts deleted file mode 100644 index c4139fd7..00000000 --- a/tests/fixtures/meta.fixture.ts +++ /dev/null @@ -1,34 +0,0 @@ -export const MetaFixture = { - installer: { - response: { - user: { - _id: "545bbecb7bdd6769632504a7", - email: "some@email.com", - firstName: "Some", - lastName: "One", - }, - }, - }, - info: { - response: { - _id: "55818d58616600637b9a5786", - createdOn: "2016-10-03T23:12:00.755Z", - grantType: "authorization_code", - lastUsed: "2016-10-10T21:41:12.736Z", - sites: ["62f3b1f7eafac55d0c64ef91"], - orgs: ["551ad253f0a9c0686f71ed08"], - workspaces: [], - users: ["545bbecb7bdd6769632504a7"], - rateLimit: 60, - status: "confirmed", - application: { - _id: "55131cd036c09f7d07883dfc", - description: "OAuth Testing Application", - homepage: "https://webflow.com", - name: "Test App", - owner: "545bbecb7bdd6769632504a7", - ownerType: "Person", - }, - }, - }, -}; diff --git a/tests/fixtures/oauth.fixture.ts b/tests/fixtures/oauth.fixture.ts deleted file mode 100644 index a1c610cc..00000000 --- a/tests/fixtures/oauth.fixture.ts +++ /dev/null @@ -1,38 +0,0 @@ -export const OAuthFixture = { - authorize: { - parameters: { - client_id: "6287ec36a841b25637c663de", - redirect_uri: "https://www.webflowers.com", - response_type: "code", - state: "1234567890", - }, - response: { - code: "6287ec36a841b25637c663de", - }, - }, - access_token: { - path: "/oauth/access_token", - parameters: { - client_id: "6287ec36a841b25637c663de", - client_secret: "6287ec36a841b25637c663de", - code: "6287ec36a841b25637c663de", - grant_type: "authorization_code", - redirect_uri: "https://www.webflowers.com", - }, - response: { - access_token: "6287ec36a841b25637c663de", - token_type: "bearer", - }, - }, - revoke_token: { - path: "/oauth/revoke_authorization", - parameters: { - client_id: "6287ec36a841b25637c663de", - client_secret: "6287ec36a841b25637c663de", - access_token: "6287ec36a841b25637c663de", - }, - response: { - didRevoke: true, - }, - }, -}; diff --git a/tests/fixtures/site.fixture.ts b/tests/fixtures/site.fixture.ts deleted file mode 100644 index b6ed8a25..00000000 --- a/tests/fixtures/site.fixture.ts +++ /dev/null @@ -1,78 +0,0 @@ -export const SiteFixture = { - list: { - response: [ - { - _id: "580e63e98c9a982ac9b8b741", - createdOn: "2016-10-24T19:41:29.156Z", - name: "api_docs_sample_json", - shortName: "api-docs-sample-json", - lastPublished: "2016-10-24T23:06:51.251Z", - previewUrl: - "https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241603.png", - timezone: "America/Los_Angeles", - database: "580e63fc8c9a982ac9b8b744", - }, - { - _id: "580ff8c3ba3e45ba9fe588bb", - createdOn: "2016-10-26T00:28:54.191Z", - name: "Copy of api_docs_sample_json", - shortName: "api-docs-sample-json-086c6538f9b0583762", - lastPublished: null, - previewUrl: - "https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241603.png", - timezone: "America/Los_Angeles", - database: "580ff8c3ba3e45ba9fe588bf", - }, - { - _id: "580ff8d7ba3e45ba9fe588e9", - createdOn: "2016-10-26T00:29:13.634Z", - name: "Copy of api_docs_sample_json", - shortName: "api-docs-sample-json-ce077aa6c5cd3e0177", - lastPublished: null, - previewUrl: - "https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241603.png", - timezone: "America/Los_Angeles", - database: "580ff8d7ba3e45ba9fe588ed", - }, - ], - }, - getOne: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - }, - response: { - _id: "580e63e98c9a982ac9b8b741", - createdOn: "2016-10-24T19:41:29.156Z", - name: "api_docs_sample_json", - shortName: "api-docs-sample-json", - lastPublished: "2016-10-24T19:43:17.271Z", - previewUrl: "https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241243.png", - timezone: "America/Los_Angeles", - database: "580e63fc8c9a982ac9b8b744", - }, - }, - domains: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - }, - response: [ - { - _id: "589a331aa51e760df7ccb89d", - name: "test-api-domain.com", - }, - { - _id: "589a331aa51e760df7ccb89e", - name: "www.test-api-domain.com", - }, - ], - }, - publish: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - domains: ["test-api-domain.com"], - }, - response: { - queued: true, - }, - }, -}; diff --git a/tests/fixtures/user.fixture.ts b/tests/fixtures/user.fixture.ts deleted file mode 100644 index b50fe856..00000000 --- a/tests/fixtures/user.fixture.ts +++ /dev/null @@ -1,175 +0,0 @@ -export const UserFixture = { - getOne: { - parameters: { - userId: "6287ec36a841b25637c663df", - siteId: "580e63e98c9a982ac9b8b741", - }, - response: { - _id: "6287ec36a841b25637c663df", - createdOn: "2022-05-20T13:46:12.093Z", - updatedOn: "2022-05-20T13:46:12.093Z", - emailVerified: true, - status: "verified", - data: { - "accept-privacy": false, - "accept-communications": false, - email: "Some.One@home.com", - name: "Some One", - }, - }, - }, - list: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - }, - response: { - users: [ - { - _id: "6287ec36a841b25637c663df", - createdOn: "2022-05-20T13:46:12.093Z", - updatedOn: "2022-05-20T13:46:12.093Z", - emailVerified: false, - status: "unverified", - data: { - "accept-privacy": false, - "accept-communications": false, - email: "Person.One@home.com", - name: "Person One", - }, - }, - { - _id: "6287ec36a841b25637c663f0", - createdOn: "2022-05-19T05:32:04.581Z", - updatedOn: "2022-05-19T05:32:04.581Z", - emailVerified: false, - status: "unverified", - data: { - "accept-privacy": false, - "accept-communications": false, - email: "Person.Two@home.com", - name: "Person Two", - }, - }, - { - _id: "6287ec36a841b25637c663d9", - createdOn: "2022-05-17T03:34:06.720Z", - updatedOn: "2022-05-17T03:34:06.720Z", - emailVerified: true, - status: "verified", - data: { - "accept-privacy": false, - "accept-communications": false, - email: "Person.Three@home.com", - name: "Person Three", - }, - }, - { - _id: "6287ec37a841b25637c6641b", - createdOn: "2022-05-15T03:46:09.748Z", - updatedOn: "2022-05-15T03:46:09.748Z", - emailVerified: false, - status: "unverified", - data: { - "accept-privacy": false, - "accept-communications": false, - email: "Person.Four@home.com", - name: "Person Four", - }, - }, - { - _id: "6287ec37a841b25637c66449", - createdOn: "2022-05-15T02:55:38.786Z", - updatedOn: "2022-05-15T02:55:38.786Z", - emailVerified: true, - status: "verified", - data: { - "accept-privacy": false, - "accept-communications": false, - email: "Person.Five@home.com", - name: "Person Five", - }, - }, - ], - count: 5, - limit: 5, - offset: 0, - total: 201, - }, - }, - invite: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - email: "some.one@home.com", - }, - response: { - _id: "6287ec36a841b25637c663df", - createdOn: "2022-05-20T13:46:12.093Z", - updatedOn: "2022-05-20T13:46:12.093Z", - emailVerified: true, - status: "verified", - data: { - "accept-privacy": false, - "accept-communications": false, - email: "some.one@home.com", - name: "Some One", - }, - }, - }, - update: { - parameters: { - userId: "6287ec36a841b25637c663df", - siteId: "580e63e98c9a982ac9b8b741", - data: { - status: "verified", - data: { - "accept-privacy": false, - "accept-communications": false, - email: "Some.One@home.com", - name: "Some One", - }, - }, - }, - response: { - _id: "6287ec36a841b25637c663df", - createdOn: "2022-05-20T13:46:12.093Z", - updatedOn: "2022-05-20T13:46:12.093Z", - emailVerified: true, - status: "verified", - data: { - "accept-privacy": false, - "accept-communications": false, - email: "Some.One@home.com", - name: "Some One", - }, - }, - }, - delete: { - parameters: { - userId: "6287ec36a841b25637c663df", - siteId: "580e63e98c9a982ac9b8b741", - }, - response: { - deleted: 1, - }, - }, - accessGroups: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - }, - response: { - accessGroups: [ - { - _id: "62be58d404be8a6cc900c081", - name: "Webflowers", - shortId: "jo", - slug: "webflowers", - createdOn: "2022-08-01T19:41:48.349Z", - }, - ], - count: 1, - limit: 10, - offset: 0, - total: 1, - }, - }, -}; diff --git a/tests/fixtures/webhook.fixture.ts b/tests/fixtures/webhook.fixture.ts deleted file mode 100644 index 2f158b9c..00000000 --- a/tests/fixtures/webhook.fixture.ts +++ /dev/null @@ -1,69 +0,0 @@ -export const WebhookFixture = { - getOne: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - webhookId: "582266e0cd48de0f0e3c6d8b", - }, - response: { - _id: "582266e0cd48de0f0e3c6d8b", - triggerType: "form_submission", - triggerId: "580e63e98c9a982ac9b8b741", - site: "580e63e98c9a982ac9b8b741", - createdOn: "2016-11-08T23:59:28.572Z", - }, - }, - list: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - }, - response: [ - { - _id: "57ca0a9e418c504a6e1acbb6", - triggerType: "form_submission", - triggerId: "580e63e98c9a982ac9b8b741", - site: "580e63e98c9a982ac9b8b741", - lastUsed: "2016-09-06T21:12:22.148Z", - createdOn: "2016-09-02T23:26:22.241Z", - }, - { - _id: "578d85cce0c47cd2865f4cf2", - triggerType: "form_submission", - triggerId: "580e63e98c9a982ac9b8b741", - site: "580e63e98c9a982ac9b8b741", - lastUsed: "2016-09-06T21:12:22.142Z", - createdOn: "2016-07-19T01:43:40.585Z", - }, - { - _id: "578d85cce0c47cd2865f4cf3", - triggerType: "form_submission", - triggerId: "580e63e98c9a982ac9b8b741", - site: "580e63e98c9a982ac9b8b741", - lastUsed: "2016-09-06T21:12:22.192Z", - createdOn: "2016-07-19T01:43:40.605Z", - }, - ], - }, - create: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - triggerType: "form_submission", - url: "https://example.com", - }, - response: { - _id: "582266e0cd48de0f0e3c6d8b", - triggerType: "form_submission", - triggerId: "580e63e98c9a982ac9b8b741", - site: "580e63e98c9a982ac9b8b741", - createdOn: "2016-11-08T23:59:28.572Z", - }, - }, - delete: { - parameters: { - siteId: "580e63e98c9a982ac9b8b741", - webhookId: "582266e0cd48de0f0e3c6d8b", - }, - response: { - deleted: 1, - }, - }, -}; diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json deleted file mode 100644 index eef55205..00000000 --- a/tsconfig.eslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "types": ["jest"] - }, - "include": ["src", "tests"] -} diff --git a/tsconfig.json b/tsconfig.json index ee0b463f..e65fa534 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,14 +1,20 @@ { - "compilerOptions": { - "lib": ["es6", "dom"], - "module": "CommonJS", - "target": "es2020", - "outDir": "dist", - "moduleResolution": "Node", - "esModuleInterop": true, - "declaration": true, - "baseUrl": "src", - "experimentalDecorators": true - }, - "include": ["src"] -} + "compilerOptions": { + "extendedDiagnostics": true, + "strict": true, + "target": "ES6", + "module": "CommonJS", + "moduleResolution": "node", + "esModuleInterop": true, + "skipLibCheck": true, + "declaration": true, + "noUnusedParameters": true, + "outDir": "dist", + "rootDir": "src", + "baseUrl": "src" + }, + "include": [ + "src" + ], + "exclude": [] +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 8e837ef0..e504656b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,2236 +2,130 @@ # yarn lockfile v1 -"@ampproject/remapping@^2.1.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" - integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w== +"@types/node-fetch@2.6.9": + version "2.6.9" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e" + integrity sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA== dependencies: - "@jridgewell/gen-mapping" "^0.1.0" - "@jridgewell/trace-mapping" "^0.3.9" - -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" - integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== - dependencies: - "@babel/highlight" "^7.18.6" - -"@babel/compat-data@^7.20.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.0.tgz#9b61938c5f688212c7b9ae363a819df7d29d4093" - integrity sha512-Gt9jszFJYq7qzXVK4slhc6NzJXnOVmRECWcVjF/T23rNXD9NtWQ0W3qxdg+p9wWIB+VQw3GYV/U2Ha9bRTfs4w== - -"@babel/core@^7.11.6", "@babel/core@^7.12.3": - version "7.19.6" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.6.tgz#7122ae4f5c5a37c0946c066149abd8e75f81540f" - integrity sha512-D2Ue4KHpc6Ys2+AxpIx1BZ8+UegLLLE2p3KJEuJRKmokHOtl49jQ5ny1773KsGLZs8MQvBidAF6yWUJxRqtKtg== - dependencies: - "@ampproject/remapping" "^2.1.0" - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.19.6" - "@babel/helper-compilation-targets" "^7.19.3" - "@babel/helper-module-transforms" "^7.19.6" - "@babel/helpers" "^7.19.4" - "@babel/parser" "^7.19.6" - "@babel/template" "^7.18.10" - "@babel/traverse" "^7.19.6" - "@babel/types" "^7.19.4" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.2.1" - semver "^6.3.0" - -"@babel/generator@^7.19.6", "@babel/generator@^7.20.0", "@babel/generator@^7.7.2": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.0.tgz#0bfc5379e0efb05ca6092091261fcdf7ec36249d" - integrity sha512-GUPcXxWibClgmYJuIwC2Bc2Lg+8b9VjaJ+HlNdACEVt+Wlr1eoU1OPZjZRm7Hzl0gaTsUZNQfeihvZJhG7oc3w== - dependencies: - "@babel/types" "^7.20.0" - "@jridgewell/gen-mapping" "^0.3.2" - jsesc "^2.5.1" - -"@babel/helper-compilation-targets@^7.19.3": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz#6bf5374d424e1b3922822f1d9bdaa43b1a139d0a" - integrity sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ== - dependencies: - "@babel/compat-data" "^7.20.0" - "@babel/helper-validator-option" "^7.18.6" - browserslist "^4.21.3" - semver "^6.3.0" - -"@babel/helper-environment-visitor@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" - integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== - -"@babel/helper-function-name@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c" - integrity sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w== - dependencies: - "@babel/template" "^7.18.10" - "@babel/types" "^7.19.0" - -"@babel/helper-hoist-variables@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" - integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q== - dependencies: - "@babel/types" "^7.18.6" - -"@babel/helper-module-imports@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz#1e3ebdbbd08aad1437b428c50204db13c5a3ca6e" - integrity sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA== - dependencies: - "@babel/types" "^7.18.6" - -"@babel/helper-module-transforms@^7.19.6": - version "7.19.6" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.19.6.tgz#6c52cc3ac63b70952d33ee987cbee1c9368b533f" - integrity sha512-fCmcfQo/KYr/VXXDIyd3CBGZ6AFhPFy1TfSEJ+PilGVlQT6jcbqtHAM4C1EciRqMza7/TpOUZliuSH+U6HAhJw== - dependencies: - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-simple-access" "^7.19.4" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/helper-validator-identifier" "^7.19.1" - "@babel/template" "^7.18.10" - "@babel/traverse" "^7.19.6" - "@babel/types" "^7.19.4" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.8.0": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz" - integrity sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA== - -"@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz#4796bb14961521f0f8715990bee2fb6e51ce21bf" - integrity sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw== - -"@babel/helper-simple-access@^7.19.4": - version "7.19.4" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.19.4.tgz#be553f4951ac6352df2567f7daa19a0ee15668e7" - integrity sha512-f9Xq6WqBFqaDfbCzn2w85hwklswz5qsKlh7f08w4Y9yhJHpnNC0QemtSkK5YyOY8kPGvyiwdzZksGUhnGdaUIg== - dependencies: - "@babel/types" "^7.19.4" - -"@babel/helper-split-export-declaration@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075" - integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA== - dependencies: - "@babel/types" "^7.18.6" - -"@babel/helper-string-parser@^7.19.4": - version "7.19.4" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" - integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== - -"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": - version "7.19.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" - integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== - -"@babel/helper-validator-option@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8" - integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== - -"@babel/helpers@^7.19.4": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.0.tgz#27c8ffa8cc32a2ed3762fba48886e7654dbcf77f" - integrity sha512-aGMjYraN0zosCEthoGLdqot1oRsmxVTQRHadsUPz5QM44Zej2PYRz7XiDE7GqnkZnNtLbOuxqoZw42vkU7+XEQ== - dependencies: - "@babel/template" "^7.18.10" - "@babel/traverse" "^7.20.0" - "@babel/types" "^7.20.0" - -"@babel/highlight@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" - integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== - dependencies: - "@babel/helper-validator-identifier" "^7.18.6" - chalk "^2.0.0" - js-tokens "^4.0.0" - -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.19.6", "@babel/parser@^7.20.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.0.tgz#b26133c888da4d79b0d3edcf42677bcadc783046" - integrity sha512-G9VgAhEaICnz8iiJeGJQyVl6J2nTjbW0xeisva0PK6XcKsga7BIaqm4ZF8Rg1Wbaqmy6znspNqhPaPkyukujzg== - -"@babel/plugin-syntax-async-generators@^7.8.4": - version "7.8.4" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz" - integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-bigint@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" - integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-class-properties@^7.8.3": - version "7.12.13" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz" - integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== - dependencies: - "@babel/helper-plugin-utils" "^7.12.13" - -"@babel/plugin-syntax-import-meta@^7.8.3": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" - integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-json-strings@^7.8.3": - version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz" - integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-jsx@^7.7.2": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz#a8feef63b010150abd97f1649ec296e849943ca0" - integrity sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - -"@babel/plugin-syntax-logical-assignment-operators@^7.8.3": - version "7.10.4" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz" - integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": - version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz" - integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-numeric-separator@^7.8.3": - version "7.10.4" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz" - integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-object-rest-spread@^7.8.3": - version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz" - integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-catch-binding@^7.8.3": - version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz" - integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-chaining@^7.8.3": - version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz" - integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-top-level-await@^7.8.3": - version "7.14.5" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz" - integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-typescript@^7.7.2": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz#4e9a0cfc769c85689b77a2e642d24e9f697fc8c7" - integrity sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ== - dependencies: - "@babel/helper-plugin-utils" "^7.19.0" - -"@babel/template@^7.18.10", "@babel/template@^7.3.3": - version "7.18.10" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.18.10.tgz#6f9134835970d1dbf0835c0d100c9f38de0c5e71" - integrity sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA== - dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/parser" "^7.18.10" - "@babel/types" "^7.18.10" - -"@babel/traverse@^7.19.6", "@babel/traverse@^7.20.0", "@babel/traverse@^7.7.2": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.0.tgz#538c4c6ce6255f5666eba02252a7b59fc2d5ed98" - integrity sha512-5+cAXQNARgjRUK0JWu2UBwja4JLSO/rBMPJzpsKb+oBF5xlUuCfljQepS4XypBQoiigL0VQjTZy6WiONtUdScQ== - dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.0" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.19.0" - "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.20.0" - "@babel/types" "^7.20.0" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.19.0", "@babel/types@^7.19.4", "@babel/types@^7.20.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.0.tgz#52c94cf8a7e24e89d2a194c25c35b17a64871479" - integrity sha512-Jlgt3H0TajCW164wkTOTzHkZb075tMQMULzrLUoUeKmO7eFL96GgDxf7/Axhc5CAuKE3KFyVW1p6ysKsi2oXAg== - dependencies: - "@babel/helper-string-parser" "^7.19.4" - "@babel/helper-validator-identifier" "^7.19.1" - to-fast-properties "^2.0.0" - -"@bcoe/v8-coverage@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" - integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== - -"@eslint/eslintrc@^1.2.1": - version "1.2.1" - resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.1.tgz" - integrity sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ== - dependencies: - ajv "^6.12.4" - debug "^4.3.2" - espree "^9.3.1" - globals "^13.9.0" - ignore "^5.2.0" - import-fresh "^3.2.1" - js-yaml "^4.1.0" - minimatch "^3.0.4" - strip-json-comments "^3.1.1" - -"@humanwhocodes/config-array@^0.9.2": - version "0.9.5" - resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz" - integrity sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw== - dependencies: - "@humanwhocodes/object-schema" "^1.2.1" - debug "^4.1.1" - minimatch "^3.0.4" - -"@humanwhocodes/object-schema@^1.2.1": - version "1.2.1" - resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz" - integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== - -"@istanbuljs/load-nyc-config@^1.0.0": - version "1.1.0" - resolved "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz" - integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== - dependencies: - camelcase "^5.3.1" - find-up "^4.1.0" - get-package-type "^0.1.0" - js-yaml "^3.13.1" - resolve-from "^5.0.0" - -"@istanbuljs/schema@^0.1.2": - version "0.1.3" - resolved "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz" - integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== - -"@jest/console@^29.2.1": - version "29.2.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.2.1.tgz#5f2c62dcdd5ce66e94b6d6729e021758bceea090" - integrity sha512-MF8Adcw+WPLZGBiNxn76DOuczG3BhODTcMlDCA4+cFi41OkaY/lyI0XUUhi73F88Y+7IHoGmD80pN5CtxQUdSw== - dependencies: - "@jest/types" "^29.2.1" - "@types/node" "*" - chalk "^4.0.0" - jest-message-util "^29.2.1" - jest-util "^29.2.1" - slash "^3.0.0" - -"@jest/core@^29.2.2": - version "29.2.2" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.2.2.tgz#207aa8973d9de8769f9518732bc5f781efc3ffa7" - integrity sha512-susVl8o2KYLcZhhkvSB+b7xX575CX3TmSvxfeDjpRko7KmT89rHkXj6XkDkNpSeFMBzIENw5qIchO9HC9Sem+A== - dependencies: - "@jest/console" "^29.2.1" - "@jest/reporters" "^29.2.2" - "@jest/test-result" "^29.2.1" - "@jest/transform" "^29.2.2" - "@jest/types" "^29.2.1" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - ci-info "^3.2.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - jest-changed-files "^29.2.0" - jest-config "^29.2.2" - jest-haste-map "^29.2.1" - jest-message-util "^29.2.1" - jest-regex-util "^29.2.0" - jest-resolve "^29.2.2" - jest-resolve-dependencies "^29.2.2" - jest-runner "^29.2.2" - jest-runtime "^29.2.2" - jest-snapshot "^29.2.2" - jest-util "^29.2.1" - jest-validate "^29.2.2" - jest-watcher "^29.2.2" - micromatch "^4.0.4" - pretty-format "^29.2.1" - slash "^3.0.0" - strip-ansi "^6.0.0" - -"@jest/environment@^29.2.2": - version "29.2.2" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.2.2.tgz#481e729048d42e87d04842c38aa4d09c507f53b0" - integrity sha512-OWn+Vhu0I1yxuGBJEFFekMYc8aGBGrY4rt47SOh/IFaI+D7ZHCk7pKRiSoZ2/Ml7b0Ony3ydmEHRx/tEOC7H1A== - dependencies: - "@jest/fake-timers" "^29.2.2" - "@jest/types" "^29.2.1" - "@types/node" "*" - jest-mock "^29.2.2" - -"@jest/expect-utils@^29.2.2": - version "29.2.2" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.2.2.tgz#460a5b5a3caf84d4feb2668677393dd66ff98665" - integrity sha512-vwnVmrVhTmGgQzyvcpze08br91OL61t9O0lJMDyb6Y/D8EKQ9V7rGUb/p7PDt0GPzK0zFYqXWFo4EO2legXmkg== - dependencies: - jest-get-type "^29.2.0" - -"@jest/expect@^29.2.2": - version "29.2.2" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.2.2.tgz#81edbd33afbde7795ca07ff6b4753d15205032e4" - integrity sha512-zwblIZnrIVt8z/SiEeJ7Q9wKKuB+/GS4yZe9zw7gMqfGf4C5hBLGrVyxu1SzDbVSqyMSlprKl3WL1r80cBNkgg== - dependencies: - expect "^29.2.2" - jest-snapshot "^29.2.2" - -"@jest/fake-timers@^29.2.2": - version "29.2.2" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.2.2.tgz#d8332e6e3cfa99cde4bc87d04a17d6b699deb340" - integrity sha512-nqaW3y2aSyZDl7zQ7t1XogsxeavNpH6kkdq+EpXncIDvAkjvFD7hmhcIs1nWloengEWUoWqkqSA6MSbf9w6DgA== - dependencies: - "@jest/types" "^29.2.1" - "@sinonjs/fake-timers" "^9.1.2" - "@types/node" "*" - jest-message-util "^29.2.1" - jest-mock "^29.2.2" - jest-util "^29.2.1" - -"@jest/globals@^29.2.2": - version "29.2.2" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.2.2.tgz#205ff1e795aa774301c2c0ba0be182558471b845" - integrity sha512-/nt+5YMh65kYcfBhj38B3Hm0Trk4IsuMXNDGKE/swp36yydBWfz3OXkLqkSvoAtPW8IJMSJDFCbTM2oj5SNprw== - dependencies: - "@jest/environment" "^29.2.2" - "@jest/expect" "^29.2.2" - "@jest/types" "^29.2.1" - jest-mock "^29.2.2" - -"@jest/reporters@^29.2.2": - version "29.2.2" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.2.2.tgz#69b395f79c3a97ce969ce05ccf1a482e5d6de290" - integrity sha512-AzjL2rl2zJC0njIzcooBvjA4sJjvdoq98sDuuNs4aNugtLPSQ+91nysGKRF0uY1to5k0MdGMdOBggUsPqvBcpA== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^29.2.1" - "@jest/test-result" "^29.2.1" - "@jest/transform" "^29.2.2" - "@jest/types" "^29.2.1" - "@jridgewell/trace-mapping" "^0.3.15" - "@types/node" "*" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^5.1.0" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.1.3" - jest-message-util "^29.2.1" - jest-util "^29.2.1" - jest-worker "^29.2.1" - slash "^3.0.0" - string-length "^4.0.1" - strip-ansi "^6.0.0" - v8-to-istanbul "^9.0.1" - -"@jest/schemas@^29.0.0": - version "29.0.0" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.0.0.tgz#5f47f5994dd4ef067fb7b4188ceac45f77fe952a" - integrity sha512-3Ab5HgYIIAnS0HjqJHQYZS+zXc4tUmTmBH3z83ajI6afXp8X3ZtdLX+nXx+I7LNkJD7uN9LAVhgnjDgZa2z0kA== - dependencies: - "@sinclair/typebox" "^0.24.1" - -"@jest/source-map@^29.2.0": - version "29.2.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.2.0.tgz#ab3420c46d42508dcc3dc1c6deee0b613c235744" - integrity sha512-1NX9/7zzI0nqa6+kgpSdKPK+WU1p+SJk3TloWZf5MzPbxri9UEeXX5bWZAPCzbQcyuAzubcdUHA7hcNznmRqWQ== - dependencies: - "@jridgewell/trace-mapping" "^0.3.15" - callsites "^3.0.0" - graceful-fs "^4.2.9" - -"@jest/test-result@^29.2.1": - version "29.2.1" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.2.1.tgz#f42dbf7b9ae465d0a93eee6131473b8bb3bd2edb" - integrity sha512-lS4+H+VkhbX6z64tZP7PAUwPqhwj3kbuEHcaLuaBuB+riyaX7oa1txe0tXgrFj5hRWvZKvqO7LZDlNWeJ7VTPA== - dependencies: - "@jest/console" "^29.2.1" - "@jest/types" "^29.2.1" - "@types/istanbul-lib-coverage" "^2.0.0" - collect-v8-coverage "^1.0.0" - -"@jest/test-sequencer@^29.2.2": - version "29.2.2" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.2.2.tgz#4ac7487b237e517a1f55e7866fb5553f6e0168b9" - integrity sha512-Cuc1znc1pl4v9REgmmLf0jBd3Y65UXJpioGYtMr/JNpQEIGEzkmHhy6W6DLbSsXeUA13TDzymPv0ZGZ9jH3eIw== - dependencies: - "@jest/test-result" "^29.2.1" - graceful-fs "^4.2.9" - jest-haste-map "^29.2.1" - slash "^3.0.0" - -"@jest/transform@^29.2.2": - version "29.2.2" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.2.2.tgz#dfc03fc092b31ffea0c55917728e75bfcf8b5de6" - integrity sha512-aPe6rrletyuEIt2axxgdtxljmzH8O/nrov4byy6pDw9S8inIrTV+2PnjyP/oFHMSynzGxJ2s6OHowBNMXp/Jzg== - dependencies: - "@babel/core" "^7.11.6" - "@jest/types" "^29.2.1" - "@jridgewell/trace-mapping" "^0.3.15" - babel-plugin-istanbul "^6.1.1" - chalk "^4.0.0" - convert-source-map "^1.4.0" - fast-json-stable-stringify "^2.1.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.2.1" - jest-regex-util "^29.2.0" - jest-util "^29.2.1" - micromatch "^4.0.4" - pirates "^4.0.4" - slash "^3.0.0" - write-file-atomic "^4.0.1" - -"@jest/types@^29.2.1": - version "29.2.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.2.1.tgz#ec9c683094d4eb754e41e2119d8bdaef01cf6da0" - integrity sha512-O/QNDQODLnINEPAI0cl9U6zUIDXEWXt6IC1o2N2QENuos7hlGUIthlKyV4p6ki3TvXFX071blj8HUhgLGquPjw== - dependencies: - "@jest/schemas" "^29.0.0" - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^17.0.8" - chalk "^4.0.0" - -"@jridgewell/gen-mapping@^0.1.0": - version "0.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996" - integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w== - dependencies: - "@jridgewell/set-array" "^1.0.0" - "@jridgewell/sourcemap-codec" "^1.4.10" - -"@jridgewell/gen-mapping@^0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" - integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== - dependencies: - "@jridgewell/set-array" "^1.0.1" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/resolve-uri@3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" - integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== - -"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" - integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== - -"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10": - version "1.4.14" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" - integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== - -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.15", "@jridgewell/trace-mapping@^0.3.9": - version "0.3.17" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" - integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== - dependencies: - "@jridgewell/resolve-uri" "3.1.0" - "@jridgewell/sourcemap-codec" "1.4.14" - -"@nodelib/fs.scandir@2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" - integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== - dependencies: - "@nodelib/fs.stat" "2.0.5" - run-parallel "^1.1.9" - -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" - integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== - -"@nodelib/fs.walk@^1.2.3": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" - integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== - dependencies: - "@nodelib/fs.scandir" "2.1.5" - fastq "^1.6.0" - -"@sinclair/typebox@^0.24.1": - version "0.24.51" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.51.tgz#645f33fe4e02defe26f2f5c0410e1c094eac7f5f" - integrity sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA== - -"@sinonjs/commons@^1.7.0": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" - integrity sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ== - dependencies: - type-detect "4.0.8" - -"@sinonjs/fake-timers@^9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz#4eaab737fab77332ab132d396a3c0d364bd0ea8c" - integrity sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw== - dependencies: - "@sinonjs/commons" "^1.7.0" - -"@types/babel__core@^7.1.14": - version "7.1.19" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.19.tgz#7b497495b7d1b4812bdb9d02804d0576f43ee460" - integrity sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__generator@*": - version "7.6.4" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7" - integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== - dependencies: - "@babel/types" "^7.0.0" - -"@types/babel__template@*": - version "7.4.1" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" - integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.18.2" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.2.tgz#235bf339d17185bdec25e024ca19cce257cc7309" - integrity sha512-FcFaxOr2V5KZCviw1TnutEMVUVsGt4D2hP1TAfXZAMKuHYW3xQhe3jTxNPWutgCJ3/X1c5yX8ZoGVEItxKbwBg== - dependencies: - "@babel/types" "^7.3.0" - -"@types/graceful-fs@^4.1.3": - version "4.1.5" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" - integrity sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw== - dependencies: - "@types/node" "*" - -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" - integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== - -"@types/istanbul-lib-report@*": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" - integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== - dependencies: - "@types/istanbul-lib-coverage" "*" - -"@types/istanbul-reports@^3.0.0": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" - integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== - dependencies: - "@types/istanbul-lib-report" "*" - -"@types/jest@^29.2.3": - version "29.2.3" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.2.3.tgz#f5fd88e43e5a9e4221ca361e23790d48fcf0a211" - integrity sha512-6XwoEbmatfyoCjWRX7z0fKMmgYKe9+/HrviJ5k0X/tjJWHGAezZOfYaxqQKuzG/TvQyr+ktjm4jgbk0s4/oF2w== - dependencies: - expect "^29.0.0" - pretty-format "^29.0.0" - -"@types/json-schema@^7.0.9": - version "7.0.11" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" - integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== - -"@types/node@*": - version "18.11.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.7.tgz#8ccef136f240770c1379d50100796a6952f01f94" - integrity sha512-LhFTglglr63mNXUSRYD8A+ZAIu5sFqNJ4Y2fPuY7UlrySJH87rRRlhtVmMHplmfk5WkoJGmDjE9oiTfyX94CpQ== - -"@types/node@^18.11.9": - version "18.11.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4" - integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg== - -"@types/prettier@^2.1.5": - version "2.7.1" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.1.tgz#dfd20e2dc35f027cdd6c1908e80a5ddc7499670e" - integrity sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow== - -"@types/semver@^7.3.12": - version "7.3.13" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" - integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== - -"@types/stack-utils@^2.0.0": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" - integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== - -"@types/yargs-parser@*": - version "21.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" - integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== - -"@types/yargs@^17.0.8": - version "17.0.13" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.13.tgz#34cced675ca1b1d51fcf4d34c3c6f0fa142a5c76" - integrity sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg== - dependencies: - "@types/yargs-parser" "*" - -"@typescript-eslint/eslint-plugin@^5.42.0": - version "5.42.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.42.0.tgz#36a8c0c379870127059889a9cc7e05c260d2aaa5" - integrity sha512-5TJh2AgL6+wpL8H/GTSjNb4WrjKoR2rqvFxR/DDTqYNk6uXn8BJMEcncLSpMbf/XV1aS0jAjYwn98uvVCiAywQ== - dependencies: - "@typescript-eslint/scope-manager" "5.42.0" - "@typescript-eslint/type-utils" "5.42.0" - "@typescript-eslint/utils" "5.42.0" - debug "^4.3.4" - ignore "^5.2.0" - natural-compare-lite "^1.4.0" - regexpp "^3.2.0" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/parser@^5.42.0": - version "5.42.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.42.0.tgz#be0ffbe279e1320e3d15e2ef0ad19262f59e9240" - integrity sha512-Ixh9qrOTDRctFg3yIwrLkgf33AHyEIn6lhyf5cCfwwiGtkWhNpVKlEZApi3inGQR/barWnY7qY8FbGKBO7p3JA== - dependencies: - "@typescript-eslint/scope-manager" "5.42.0" - "@typescript-eslint/types" "5.42.0" - "@typescript-eslint/typescript-estree" "5.42.0" - debug "^4.3.4" - -"@typescript-eslint/scope-manager@5.42.0": - version "5.42.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.42.0.tgz#e1f2bb26d3b2a508421ee2e3ceea5396b192f5ef" - integrity sha512-l5/3IBHLH0Bv04y+H+zlcLiEMEMjWGaCX6WyHE5Uk2YkSGAMlgdUPsT/ywTSKgu9D1dmmKMYgYZijObfA39Wow== - dependencies: - "@typescript-eslint/types" "5.42.0" - "@typescript-eslint/visitor-keys" "5.42.0" - -"@typescript-eslint/type-utils@5.42.0": - version "5.42.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.42.0.tgz#4206d7192d4fe903ddf99d09b41d4ac31b0b7dca" - integrity sha512-HW14TXC45dFVZxnVW8rnUGnvYyRC0E/vxXShFCthcC9VhVTmjqOmtqj6H5rm9Zxv+ORxKA/1aLGD7vmlLsdlOg== - dependencies: - "@typescript-eslint/typescript-estree" "5.42.0" - "@typescript-eslint/utils" "5.42.0" - debug "^4.3.4" - tsutils "^3.21.0" - -"@typescript-eslint/types@5.42.0": - version "5.42.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.42.0.tgz#5aeff9b5eced48f27d5b8139339bf1ef805bad7a" - integrity sha512-t4lzO9ZOAUcHY6bXQYRuu+3SSYdD9TS8ooApZft4WARt4/f2Cj/YpvbTe8A4GuhT4bNW72goDMOy7SW71mZwGw== - -"@typescript-eslint/typescript-estree@5.42.0": - version "5.42.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.42.0.tgz#2592d24bb5f89bf54a63384ff3494870f95b3fd8" - integrity sha512-2O3vSq794x3kZGtV7i4SCWZWCwjEtkWfVqX4m5fbUBomOsEOyd6OAD1qU2lbvV5S8tgy/luJnOYluNyYVeOTTg== - dependencies: - "@typescript-eslint/types" "5.42.0" - "@typescript-eslint/visitor-keys" "5.42.0" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/utils@5.42.0": - version "5.42.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.42.0.tgz#f06bd43b9a9a06ed8f29600273240e84a53f2f15" - integrity sha512-JZ++3+h1vbeG1NUECXQZE3hg0kias9kOtcQr3+JVQ3whnjvKuMyktJAAIj6743OeNPnGBmjj7KEmiDL7qsdnCQ== - dependencies: - "@types/json-schema" "^7.0.9" - "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.42.0" - "@typescript-eslint/types" "5.42.0" - "@typescript-eslint/typescript-estree" "5.42.0" - eslint-scope "^5.1.1" - eslint-utils "^3.0.0" - semver "^7.3.7" - -"@typescript-eslint/visitor-keys@5.42.0": - version "5.42.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.42.0.tgz#ee8d62d486f41cfe646632fab790fbf0c1db5bb0" - integrity sha512-QHbu5Hf/2lOEOwy+IUw0GoSCuAzByTAWWrOTKzTzsotiUnWFpuKnXcAhC9YztAf2EElQ0VvIK+pHJUPkM0q7jg== - dependencies: - "@typescript-eslint/types" "5.42.0" - eslint-visitor-keys "^3.3.0" - -acorn-jsx@^5.3.1: - version "5.3.2" - resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" - integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== - -acorn@^8.7.0: - version "8.7.0" - resolved "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz" - integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== - -ajv@^6.10.0, ajv@^6.12.4: - version "6.12.6" - resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" - integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== - dependencies: - fast-deep-equal "^3.1.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ansi-escapes@^4.2.1: - version "4.3.2" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" - integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== - dependencies: - type-fest "^0.21.3" - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -ansi-styles@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" - integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== - -anymatch@^3.0.3: - version "3.1.2" - resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz" - integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -array-union@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" - integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== - -axios-mock-adapter@^1.21.2: - version "1.21.2" - resolved "https://registry.yarnpkg.com/axios-mock-adapter/-/axios-mock-adapter-1.21.2.tgz#87a48f80aa89bb1ab1ad630fa467975e30aa4721" - integrity sha512-jzyNxU3JzB2XVhplZboUcF0YDs7xuExzoRSHXPHr+UQajaGmcTqvkkUADgkVI2WkGlpZ1zZlMVdcTMU0ejV8zQ== - dependencies: - fast-deep-equal "^3.1.3" - is-buffer "^2.0.5" - -axios@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.1.3.tgz#8274250dada2edf53814ed7db644b9c2866c1e35" - integrity sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA== - dependencies: - follow-redirects "^1.15.0" - form-data "^4.0.0" - proxy-from-env "^1.1.0" - -babel-jest@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.2.2.tgz#2c15abd8c2081293c9c3f4f80a4ed1d51542fee5" - integrity sha512-kkq2QSDIuvpgfoac3WZ1OOcHsQQDU5xYk2Ql7tLdJ8BVAYbefEXal+NfS45Y5LVZA7cxC8KYcQMObpCt1J025w== - dependencies: - "@jest/transform" "^29.2.2" - "@types/babel__core" "^7.1.14" - babel-plugin-istanbul "^6.1.1" - babel-preset-jest "^29.2.0" - chalk "^4.0.0" - graceful-fs "^4.2.9" - slash "^3.0.0" - -babel-plugin-istanbul@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" - integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@istanbuljs/load-nyc-config" "^1.0.0" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-instrument "^5.0.4" - test-exclude "^6.0.0" - -babel-plugin-jest-hoist@^29.2.0: - version "29.2.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.2.0.tgz#23ee99c37390a98cfddf3ef4a78674180d823094" - integrity sha512-TnspP2WNiR3GLfCsUNHqeXw0RoQ2f9U5hQ5L3XFpwuO8htQmSrhh8qsB6vi5Yi8+kuynN1yjDjQsPfkebmB6ZA== - dependencies: - "@babel/template" "^7.3.3" - "@babel/types" "^7.3.3" - "@types/babel__core" "^7.1.14" - "@types/babel__traverse" "^7.0.6" - -babel-preset-current-node-syntax@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" - integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== - dependencies: - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-syntax-bigint" "^7.8.3" - "@babel/plugin-syntax-class-properties" "^7.8.3" - "@babel/plugin-syntax-import-meta" "^7.8.3" - "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.8.3" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-syntax-top-level-await" "^7.8.3" - -babel-preset-jest@^29.2.0: - version "29.2.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.2.0.tgz#3048bea3a1af222e3505e4a767a974c95a7620dc" - integrity sha512-z9JmMJppMxNv8N7fNRHvhMg9cvIkMxQBXgFkane3yKVEvEOP+kB50lk8DFRvF9PGqbyXxlmebKWhuDORO8RgdA== - dependencies: - babel-plugin-jest-hoist "^29.2.0" - babel-preset-current-node-syntax "^1.0.0" - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@^3.0.2: - version "3.0.2" - resolved "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== - dependencies: - fill-range "^7.0.1" - -browserslist@^4.21.3: - version "4.21.4" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987" - integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw== - dependencies: - caniuse-lite "^1.0.30001400" - electron-to-chromium "^1.4.251" - node-releases "^2.0.6" - update-browserslist-db "^1.0.9" - -bs-logger@0.x: - version "0.2.6" - resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" - integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== - dependencies: - fast-json-stable-stringify "2.x" - -bser@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" - integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== - dependencies: - node-int64 "^0.4.0" - -buffer-from@^1.0.0: - version "1.1.2" - resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" - integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== - -callsites@^3.0.0: - version "3.1.0" - resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" - integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== - -camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - -camelcase@^6.2.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" - integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== - -caniuse-lite@^1.0.30001400: - version "1.0.30001427" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001427.tgz#d3a749f74be7ae0671fbec3a4eea18576e8ad646" - integrity sha512-lfXQ73oB9c8DP5Suxaszm+Ta2sr/4tf8+381GkIm1MLj/YdLf+rEDyDSRCzeltuyTVGm+/s18gdZ0q+Wmp8VsQ== - -chalk@^2.0.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^4.0.0: - version "4.1.2" - resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -char-regex@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" - integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== - -ci-info@^3.2.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.5.0.tgz#bfac2a29263de4c829d806b1ab478e35091e171f" - integrity sha512-yH4RezKOGlOhxkmhbeNuC4eYZKAUsEaGtBuBzDDP1eFUKiccDWzBABxBfOx31IDwDIXMTxWuwAxUGModvkbuVw== - -cjs-module-lexer@^1.0.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" - integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== - -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== - -collect-v8-coverage@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59" - integrity sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg== - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" - integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== - -cross-spawn@^7.0.2, cross-spawn@^7.0.3: - version "7.0.3" - resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" - integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: - version "4.3.4" - resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -dedent@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" - integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== - -deep-is@^0.1.3: - version "0.1.4" - resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" - integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== - -deepmerge@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" - integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== - -detect-newline@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" - integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== - -diff-sequences@^29.2.0: - version "29.2.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.2.0.tgz#4c55b5b40706c7b5d2c5c75999a50c56d214e8f6" - integrity sha512-413SY5JpYeSBZxmenGEmCVQ8mCgtFJF0w9PROdaS6z987XC2Pd2GOKqOITLtMftmyFZqgtCOb/QA7/Z3ZXfzIw== - -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - -doctrine@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" - integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== - dependencies: - esutils "^2.0.2" - -electron-to-chromium@^1.4.251: - version "1.4.284" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592" - integrity sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA== - -emittery@^0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" - integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -error-ex@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== - dependencies: - is-arrayish "^0.2.1" - -escalade@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" - integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== - -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== - -escape-string-regexp@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" - integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== - -escape-string-regexp@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - -eslint-config-prettier@^8.5.0: - version "8.5.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz#5a81680ec934beca02c7b1a61cf8ca34b66feab1" - integrity sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q== - -eslint-plugin-prettier@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b" - integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ== - dependencies: - prettier-linter-helpers "^1.0.0" - -eslint-scope@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" - integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== - dependencies: - esrecurse "^4.3.0" - estraverse "^4.1.1" - -eslint-scope@^7.1.1: - version "7.1.1" - resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz" - integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== - dependencies: - esrecurse "^4.3.0" - estraverse "^5.2.0" - -eslint-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz" - integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== - dependencies: - eslint-visitor-keys "^2.0.0" - -eslint-visitor-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz" - integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== - -eslint-visitor-keys@^3.3.0: - version "3.3.0" - resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz" - integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== - -eslint@^8.12.0: - version "8.12.0" - resolved "https://registry.npmjs.org/eslint/-/eslint-8.12.0.tgz" - integrity sha512-it1oBL9alZg1S8UycLm5YDMAkIhtH6FtAzuZs6YvoGVldWjbS08BkAdb/ymP9LlAyq8koANu32U7Ib/w+UNh8Q== - dependencies: - "@eslint/eslintrc" "^1.2.1" - "@humanwhocodes/config-array" "^0.9.2" - ajv "^6.10.0" - chalk "^4.0.0" - cross-spawn "^7.0.2" - debug "^4.3.2" - doctrine "^3.0.0" - escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-utils "^3.0.0" - eslint-visitor-keys "^3.3.0" - espree "^9.3.1" - esquery "^1.4.0" - esutils "^2.0.2" - fast-deep-equal "^3.1.3" - file-entry-cache "^6.0.1" - functional-red-black-tree "^1.0.1" - glob-parent "^6.0.1" - globals "^13.6.0" - ignore "^5.2.0" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - is-glob "^4.0.0" - js-yaml "^4.1.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.4.1" - lodash.merge "^4.6.2" - minimatch "^3.0.4" - natural-compare "^1.4.0" - optionator "^0.9.1" - regexpp "^3.2.0" - strip-ansi "^6.0.1" - strip-json-comments "^3.1.0" - text-table "^0.2.0" - v8-compile-cache "^2.0.3" - -espree@^9.3.1: - version "9.3.1" - resolved "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz" - integrity sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ== - dependencies: - acorn "^8.7.0" - acorn-jsx "^5.3.1" - eslint-visitor-keys "^3.3.0" - -esprima@^4.0.0: - version "4.0.1" - resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -esquery@^1.4.0: - version "1.4.0" - resolved "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz" - integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== - dependencies: - estraverse "^5.1.0" - -esrecurse@^4.3.0: - version "4.3.0" - resolved "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz" - integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== - dependencies: - estraverse "^5.2.0" - -estraverse@^4.1.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== - -estraverse@^5.1.0, estraverse@^5.2.0: - version "5.3.0" - resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" - integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -execa@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" - integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== - dependencies: - cross-spawn "^7.0.3" - get-stream "^6.0.0" - human-signals "^2.1.0" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.1" - onetime "^5.1.2" - signal-exit "^3.0.3" - strip-final-newline "^2.0.0" - -exit@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== - -expect@^29.0.0, expect@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/expect/-/expect-29.2.2.tgz#ba2dd0d7e818727710324a6e7f13dd0e6d086106" - integrity sha512-hE09QerxZ5wXiOhqkXy5d2G9ar+EqOyifnCXCpMNu+vZ6DG9TJ6CO2c2kPDSLqERTTWrO7OZj8EkYHQqSd78Yw== - dependencies: - "@jest/expect-utils" "^29.2.2" - jest-get-type "^29.2.0" - jest-matcher-utils "^29.2.2" - jest-message-util "^29.2.1" - jest-util "^29.2.1" - -fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: - version "3.1.3" - resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== - -fast-diff@^1.1.2: - version "1.2.0" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" - integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== - -fast-glob@^3.2.9: - version "3.2.12" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" - integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== - -fast-levenshtein@^2.0.6: - version "2.0.6" - resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" - integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= - -fastq@^1.6.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" - integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== - dependencies: - reusify "^1.0.4" - -fb-watchman@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" - integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== - dependencies: - bser "2.1.1" - -file-entry-cache@^6.0.1: - version "6.0.1" - resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz" - integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== - dependencies: - flat-cache "^3.0.4" - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== - dependencies: - to-regex-range "^5.0.1" - -find-up@^4.0.0, find-up@^4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - -flat-cache@^3.0.4: - version "3.0.4" - resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz" - integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== - dependencies: - flatted "^3.1.0" - rimraf "^3.0.2" - -flatted@^3.1.0: - version "3.2.5" - resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz" - integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== - -follow-redirects@^1.15.0: - version "1.15.2" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" - integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== - -form-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - -fsevents@^2.3.2: - version "2.3.2" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== - -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz" - integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= - -gensync@^1.0.0-beta.2: - version "1.0.0-beta.2" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" - integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-package-type@^0.1.0: - version "0.1.0" - resolved "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz" - integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== - -get-stream@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" - integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== - -glob-parent@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - -glob-parent@^6.0.1: - version "6.0.2" - resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" - integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== - dependencies: - is-glob "^4.0.3" - -glob@^7.1.3, glob@^7.1.4: - version "7.1.7" - resolved "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz" - integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - -globals@^13.6.0, globals@^13.9.0: - version "13.13.0" - resolved "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz" - integrity sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A== - dependencies: - type-fest "^0.20.2" - -globby@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" - slash "^3.0.0" - -graceful-fs@^4.2.9: - version "4.2.10" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" - integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has@^1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/has/-/has-1.0.3.tgz" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== - dependencies: - function-bind "^1.1.1" - -html-escaper@^2.0.0: - version "2.0.2" - resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" - integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== - -human-signals@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" - integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== - -ignore@^5.2.0: - version "5.2.0" - resolved "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz" - integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== - -import-fresh@^3.0.0, import-fresh@^3.2.1: - version "3.3.0" - resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz" - integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== - dependencies: - parent-module "^1.0.0" - resolve-from "^4.0.0" - -import-local@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" - integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== - dependencies: - pkg-dir "^4.2.0" - resolve-cwd "^3.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" - integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== - -is-buffer@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" - integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== - -is-core-module@^2.2.0: - version "2.8.1" - resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz" - integrity sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA== - dependencies: - has "^1.0.3" - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-generator-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" - integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== - -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: - version "4.0.3" - resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-stream@^2.0.0: - version "2.0.1" - resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz" - integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= - -istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: - version "3.2.0" - resolved "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz" - integrity sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw== - -istanbul-lib-instrument@^5.0.4, istanbul-lib-instrument@^5.1.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" - integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== - dependencies: - "@babel/core" "^7.12.3" - "@babel/parser" "^7.14.7" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.2.0" - semver "^6.3.0" - -istanbul-lib-report@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz" - integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== - dependencies: - istanbul-lib-coverage "^3.0.0" - make-dir "^3.0.0" - supports-color "^7.1.0" - -istanbul-lib-source-maps@^4.0.0: - version "4.0.1" - resolved "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz" - integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.1.3: - version "3.1.5" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.5.tgz#cc9a6ab25cb25659810e4785ed9d9fb742578bae" - integrity sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w== - dependencies: - html-escaper "^2.0.0" - istanbul-lib-report "^3.0.0" - -jest-changed-files@^29.2.0: - version "29.2.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.2.0.tgz#b6598daa9803ea6a4dce7968e20ab380ddbee289" - integrity sha512-qPVmLLyBmvF5HJrY7krDisx6Voi8DmlV3GZYX0aFNbaQsZeoz1hfxcCMbqDGuQCxU1dJy9eYc2xscE8QrCCYaA== - dependencies: - execa "^5.0.0" - p-limit "^3.1.0" - -jest-circus@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.2.2.tgz#1dc4d35fd49bf5e64d3cc505fb2db396237a6dfa" - integrity sha512-upSdWxx+Mh4DV7oueuZndJ1NVdgtTsqM4YgywHEx05UMH5nxxA2Qu9T9T9XVuR021XxqSoaKvSmmpAbjwwwxMw== - dependencies: - "@jest/environment" "^29.2.2" - "@jest/expect" "^29.2.2" - "@jest/test-result" "^29.2.1" - "@jest/types" "^29.2.1" "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - dedent "^0.7.0" - is-generator-fn "^2.0.0" - jest-each "^29.2.1" - jest-matcher-utils "^29.2.2" - jest-message-util "^29.2.1" - jest-runtime "^29.2.2" - jest-snapshot "^29.2.2" - jest-util "^29.2.1" - p-limit "^3.1.0" - pretty-format "^29.2.1" - slash "^3.0.0" - stack-utils "^2.0.3" + form-data "^4.0.0" -jest-cli@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.2.2.tgz#feaf0aa57d327e80d4f2f18d5f8cd2e77cac5371" - integrity sha512-R45ygnnb2CQOfd8rTPFR+/fls0d+1zXS6JPYTBBrnLPrhr58SSuPTiA5Tplv8/PXpz4zXR/AYNxmwIj6J6nrvg== +"@types/node@*": + version "20.10.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.5.tgz#47ad460b514096b7ed63a1dae26fad0914ed3ab2" + integrity sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw== dependencies: - "@jest/core" "^29.2.2" - "@jest/test-result" "^29.2.1" - "@jest/types" "^29.2.1" - chalk "^4.0.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - import-local "^3.0.2" - jest-config "^29.2.2" - jest-util "^29.2.1" - jest-validate "^29.2.2" - prompts "^2.0.1" - yargs "^17.3.1" + undici-types "~5.26.4" -jest-config@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.2.2.tgz#bf98623a46454d644630c1f0de8bba3f495c2d59" - integrity sha512-Q0JX54a5g1lP63keRfKR8EuC7n7wwny2HoTRDb8cx78IwQOiaYUVZAdjViY3WcTxpR02rPUpvNVmZ1fkIlZPcw== - dependencies: - "@babel/core" "^7.11.6" - "@jest/test-sequencer" "^29.2.2" - "@jest/types" "^29.2.1" - babel-jest "^29.2.2" - chalk "^4.0.0" - ci-info "^3.2.0" - deepmerge "^4.2.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-circus "^29.2.2" - jest-environment-node "^29.2.2" - jest-get-type "^29.2.0" - jest-regex-util "^29.2.0" - jest-resolve "^29.2.2" - jest-runner "^29.2.2" - jest-util "^29.2.1" - jest-validate "^29.2.2" - micromatch "^4.0.4" - parse-json "^5.2.0" - pretty-format "^29.2.1" - slash "^3.0.0" - strip-json-comments "^3.1.1" +"@types/node@17.0.33": + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.33.tgz#3c1879b276dc63e73030bb91165e62a4509cd506" + integrity sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ== -jest-diff@^29.2.1: - version "29.2.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.2.1.tgz#027e42f5a18b693fb2e88f81b0ccab533c08faee" - integrity sha512-gfh/SMNlQmP3MOUgdzxPOd4XETDJifADpT937fN1iUGz+9DgOu2eUPHH25JDkLVcLwwqxv3GzVyK4VBUr9fjfA== - dependencies: - chalk "^4.0.0" - diff-sequences "^29.2.0" - jest-get-type "^29.2.0" - pretty-format "^29.2.1" +"@types/qs@6.9.8": + version "6.9.8" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.8.tgz#f2a7de3c107b89b441e071d5472e6b726b4adf45" + integrity sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg== -jest-docblock@^29.2.0: - version "29.2.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.2.0.tgz#307203e20b637d97cee04809efc1d43afc641e82" - integrity sha512-bkxUsxTgWQGbXV5IENmfiIuqZhJcyvF7tU4zJ/7ioTutdz4ToB5Yx6JOFBpgI+TphRY4lhOyCWGNH/QFQh5T6A== - dependencies: - detect-newline "^3.0.0" +"@types/url-join@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/url-join/-/url-join-4.0.1.tgz#4989c97f969464647a8586c7252d97b449cdc045" + integrity sha512-wDXw9LEEUHyV+7UWy7U315nrJGJ7p1BzaCxDpEoLr789Dk1WDVMMlf3iBfbG2F8NdWnYyFbtTxUn2ZNbm1Q4LQ== -jest-each@^29.2.1: - version "29.2.1" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.2.1.tgz#6b0a88ee85c2ba27b571a6010c2e0c674f5c9b29" - integrity sha512-sGP86H/CpWHMyK3qGIGFCgP6mt+o5tu9qG4+tobl0LNdgny0aitLXs9/EBacLy3Bwqy+v4uXClqJgASJWcruYw== - dependencies: - "@jest/types" "^29.2.1" - chalk "^4.0.0" - jest-get-type "^29.2.0" - jest-util "^29.2.1" - pretty-format "^29.2.1" +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== -jest-environment-node@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.2.2.tgz#a64b272773870c3a947cd338c25fd34938390bc2" - integrity sha512-B7qDxQjkIakQf+YyrqV5dICNs7tlCO55WJ4OMSXsqz1lpI/0PmeuXdx2F7eU8rnPbRkUR/fItSSUh0jvE2y/tw== +call-bind@^1.0.0: + version "1.0.5" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513" + integrity sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ== dependencies: - "@jest/environment" "^29.2.2" - "@jest/fake-timers" "^29.2.2" - "@jest/types" "^29.2.1" - "@types/node" "*" - jest-mock "^29.2.2" - jest-util "^29.2.1" - -jest-get-type@^29.2.0: - version "29.2.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.2.0.tgz#726646f927ef61d583a3b3adb1ab13f3a5036408" - integrity sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA== + function-bind "^1.1.2" + get-intrinsic "^1.2.1" + set-function-length "^1.1.1" -jest-haste-map@^29.2.1: - version "29.2.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.2.1.tgz#f803fec57f8075e6c55fb5cd551f99a72471c699" - integrity sha512-wF460rAFmYc6ARcCFNw4MbGYQjYkvjovb9GBT+W10Um8q5nHq98jD6fHZMDMO3tA56S8XnmNkM8GcA8diSZfnA== +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: - "@jest/types" "^29.2.1" - "@types/graceful-fs" "^4.1.3" - "@types/node" "*" - anymatch "^3.0.3" - fb-watchman "^2.0.0" - graceful-fs "^4.2.9" - jest-regex-util "^29.2.0" - jest-util "^29.2.1" - jest-worker "^29.2.1" - micromatch "^4.0.4" - walker "^1.0.8" - optionalDependencies: - fsevents "^2.3.2" + delayed-stream "~1.0.0" -jest-leak-detector@^29.2.1: - version "29.2.1" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.2.1.tgz#ec551686b7d512ec875616c2c3534298b1ffe2fc" - integrity sha512-1YvSqYoiurxKOJtySc+CGVmw/e1v4yNY27BjWTVzp0aTduQeA7pdieLiW05wTYG/twlKOp2xS/pWuikQEmklug== +define-data-property@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" + integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ== dependencies: - jest-get-type "^29.2.0" - pretty-format "^29.2.1" + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" -jest-matcher-utils@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.2.2.tgz#9202f8e8d3a54733266784ce7763e9a08688269c" - integrity sha512-4DkJ1sDPT+UX2MR7Y3od6KtvRi9Im1ZGLGgdLFLm4lPexbTaCgJW5NN3IOXlQHF7NSHY/VHhflQ+WoKtD/vyCw== - dependencies: - chalk "^4.0.0" - jest-diff "^29.2.1" - jest-get-type "^29.2.0" - pretty-format "^29.2.1" +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -jest-message-util@^29.2.1: - version "29.2.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.2.1.tgz#3a51357fbbe0cc34236f17a90d772746cf8d9193" - integrity sha512-Dx5nEjw9V8C1/Yj10S/8ivA8F439VS8vTq1L7hEgwHFn9ovSKNpYW/kwNh7UglaEgXO42XxzKJB+2x0nSglFVw== +form-data@4.0.0, form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== dependencies: - "@babel/code-frame" "^7.12.13" - "@jest/types" "^29.2.1" - "@types/stack-utils" "^2.0.0" - chalk "^4.0.0" - graceful-fs "^4.2.9" - micromatch "^4.0.4" - pretty-format "^29.2.1" - slash "^3.0.0" - stack-utils "^2.0.3" + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" -jest-mock@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.2.2.tgz#9045618b3f9d27074bbcf2d55bdca6a5e2e8bca7" - integrity sha512-1leySQxNAnivvbcx0sCB37itu8f4OX2S/+gxLAV4Z62shT4r4dTG9tACDywUAEZoLSr36aYUTsVp3WKwWt4PMQ== - dependencies: - "@jest/types" "^29.2.1" - "@types/node" "*" - jest-util "^29.2.1" +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== -jest-pnp-resolver@^1.2.2: +get-intrinsic@^1.0.2, get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2: version "1.2.2" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" - integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== - -jest-regex-util@^29.2.0: - version "29.2.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.2.0.tgz#82ef3b587e8c303357728d0322d48bbfd2971f7b" - integrity sha512-6yXn0kg2JXzH30cr2NlThF+70iuO/3irbaB4mh5WyqNIvLLP+B6sFdluO1/1RJmslyh/f9osnefECflHvTbwVA== - -jest-resolve-dependencies@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.2.2.tgz#1f444766f37a25f1490b5137408b6ff746a05d64" - integrity sha512-wWOmgbkbIC2NmFsq8Lb+3EkHuW5oZfctffTGvwsA4JcJ1IRk8b2tg+hz44f0lngvRTeHvp3Kyix9ACgudHH9aQ== - dependencies: - jest-regex-util "^29.2.0" - jest-snapshot "^29.2.2" - -jest-resolve@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.2.2.tgz#ad6436053b0638b41e12bbddde2b66e1397b35b5" - integrity sha512-3gaLpiC3kr14rJR3w7vWh0CBX2QAhfpfiQTwrFPvVrcHe5VUBtIXaR004aWE/X9B2CFrITOQAp5gxLONGrk6GA== - dependencies: - chalk "^4.0.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.2.1" - jest-pnp-resolver "^1.2.2" - jest-util "^29.2.1" - jest-validate "^29.2.2" - resolve "^1.20.0" - resolve.exports "^1.1.0" - slash "^3.0.0" - -jest-runner@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.2.2.tgz#6b5302ed15eba8bf05e6b14d40f1e8d469564da3" - integrity sha512-1CpUxXDrbsfy9Hr9/1zCUUhT813kGGK//58HeIw/t8fa/DmkecEwZSWlb1N/xDKXg3uCFHQp1GCvlSClfImMxg== - dependencies: - "@jest/console" "^29.2.1" - "@jest/environment" "^29.2.2" - "@jest/test-result" "^29.2.1" - "@jest/transform" "^29.2.2" - "@jest/types" "^29.2.1" - "@types/node" "*" - chalk "^4.0.0" - emittery "^0.13.1" - graceful-fs "^4.2.9" - jest-docblock "^29.2.0" - jest-environment-node "^29.2.2" - jest-haste-map "^29.2.1" - jest-leak-detector "^29.2.1" - jest-message-util "^29.2.1" - jest-resolve "^29.2.2" - jest-runtime "^29.2.2" - jest-util "^29.2.1" - jest-watcher "^29.2.2" - jest-worker "^29.2.1" - p-limit "^3.1.0" - source-map-support "0.5.13" - -jest-runtime@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.2.2.tgz#4068ee82423769a481460efd21d45a8efaa5c179" - integrity sha512-TpR1V6zRdLynckKDIQaY41od4o0xWL+KOPUCZvJK2bu5P1UXhjobt5nJ2ICNeIxgyj9NGkO0aWgDqYPVhDNKjA== - dependencies: - "@jest/environment" "^29.2.2" - "@jest/fake-timers" "^29.2.2" - "@jest/globals" "^29.2.2" - "@jest/source-map" "^29.2.0" - "@jest/test-result" "^29.2.1" - "@jest/transform" "^29.2.2" - "@jest/types" "^29.2.1" - "@types/node" "*" - chalk "^4.0.0" - cjs-module-lexer "^1.0.0" - collect-v8-coverage "^1.0.0" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-haste-map "^29.2.1" - jest-message-util "^29.2.1" - jest-mock "^29.2.2" - jest-regex-util "^29.2.0" - jest-resolve "^29.2.2" - jest-snapshot "^29.2.2" - jest-util "^29.2.1" - slash "^3.0.0" - strip-bom "^4.0.0" - -jest-snapshot@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.2.2.tgz#1016ce60297b77382386bad561107174604690c2" - integrity sha512-GfKJrpZ5SMqhli3NJ+mOspDqtZfJBryGA8RIBxF+G+WbDoC7HCqKaeAss4Z/Sab6bAW11ffasx8/vGsj83jyjA== - dependencies: - "@babel/core" "^7.11.6" - "@babel/generator" "^7.7.2" - "@babel/plugin-syntax-jsx" "^7.7.2" - "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/traverse" "^7.7.2" - "@babel/types" "^7.3.3" - "@jest/expect-utils" "^29.2.2" - "@jest/transform" "^29.2.2" - "@jest/types" "^29.2.1" - "@types/babel__traverse" "^7.0.6" - "@types/prettier" "^2.1.5" - babel-preset-current-node-syntax "^1.0.0" - chalk "^4.0.0" - expect "^29.2.2" - graceful-fs "^4.2.9" - jest-diff "^29.2.1" - jest-get-type "^29.2.0" - jest-haste-map "^29.2.1" - jest-matcher-utils "^29.2.2" - jest-message-util "^29.2.1" - jest-util "^29.2.1" - natural-compare "^1.4.0" - pretty-format "^29.2.1" - semver "^7.3.5" - -jest-util@^29.0.0, jest-util@^29.2.1: - version "29.2.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.2.1.tgz#f26872ba0dc8cbefaba32c34f98935f6cf5fc747" - integrity sha512-P5VWDj25r7kj7kl4pN2rG/RN2c1TLfYYYZYULnS/35nFDjBai+hBeo3MDrYZS7p6IoY3YHZnt2vq4L6mKnLk0g== - dependencies: - "@jest/types" "^29.2.1" - "@types/node" "*" - chalk "^4.0.0" - ci-info "^3.2.0" - graceful-fs "^4.2.9" - picomatch "^2.2.3" - -jest-validate@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.2.2.tgz#e43ce1931292dfc052562a11bc681af3805eadce" - integrity sha512-eJXATaKaSnOuxNfs8CLHgdABFgUrd0TtWS8QckiJ4L/QVDF4KVbZFBBOwCBZHOS0Rc5fOxqngXeGXE3nGQkpQA== - dependencies: - "@jest/types" "^29.2.1" - camelcase "^6.2.0" - chalk "^4.0.0" - jest-get-type "^29.2.0" - leven "^3.1.0" - pretty-format "^29.2.1" - -jest-watcher@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.2.2.tgz#7093d4ea8177e0a0da87681a9e7b09a258b9daf7" - integrity sha512-j2otfqh7mOvMgN2WlJ0n7gIx9XCMWntheYGlBK7+5g3b1Su13/UAK7pdKGyd4kDlrLwtH2QPvRv5oNIxWvsJ1w== + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b" + integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA== dependencies: - "@jest/test-result" "^29.2.1" - "@jest/types" "^29.2.1" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - emittery "^0.13.1" - jest-util "^29.2.1" - string-length "^4.0.1" - -jest-worker@^29.2.1: - version "29.2.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.2.1.tgz#8ba68255438252e1674f990f0180c54dfa26a3b1" - integrity sha512-ROHTZ+oj7sBrgtv46zZ84uWky71AoYi0vEV9CdEtc1FQunsoAGe5HbQmW76nI5QWdvECVPrSi1MCVUmizSavMg== - dependencies: - "@types/node" "*" - jest-util "^29.2.1" - merge-stream "^2.0.0" - supports-color "^8.0.0" - -jest@^29.2.2: - version "29.2.2" - resolved "https://registry.yarnpkg.com/jest/-/jest-29.2.2.tgz#24da83cbbce514718acd698926b7679109630476" - integrity sha512-r+0zCN9kUqoON6IjDdjbrsWobXM/09Nd45kIPRD8kloaRh1z5ZCMdVsgLXGxmlL7UpAJsvCYOQNO+NjvG/gqiQ== - dependencies: - "@jest/core" "^29.2.2" - "@jest/types" "^29.2.1" - import-local "^3.0.2" - jest-cli "^29.2.2" - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" -js-yaml@^3.13.1: - version "3.14.1" - resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz" - integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" - -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== - -json-parse-even-better-errors@^2.3.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" - integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" - integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== - -json-stable-stringify-without-jsonify@^1.0.1: +gopd@^1.0.1: version "1.0.1" - resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" - integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= - -json5@^2.2.1: - version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" - integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== - -kleur@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" - integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== - -leven@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" - integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== - -levn@^0.4.1: - version "0.4.1" - resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz" - integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== - dependencies: - prelude-ls "^1.2.1" - type-check "~0.4.0" - -lines-and-columns@^1.1.6: - version "1.2.4" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" - integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== - -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz" - integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== - dependencies: - p-locate "^4.1.0" - -lodash.memoize@4.x: - version "4.1.2" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" - integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== - -lodash.merge@^4.6.2: - version "4.6.2" - resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz" - integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== - -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== dependencies: - yallist "^4.0.0" + get-intrinsic "^1.1.3" -make-dir@^3.0.0: - version "3.1.0" - resolved "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz" - integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== +has-property-descriptors@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" + integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== dependencies: - semver "^6.0.0" + get-intrinsic "^1.2.2" -make-error@1.x: - version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== +has-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== -makeerror@1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" - integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== - dependencies: - tmpl "1.0.5" +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== -merge-stream@^2.0.0: +hasown@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== - -merge2@^1.3.0, merge2@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" - integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== - -micromatch@^4.0.4: - version "4.0.5" - resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" + integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== dependencies: - braces "^3.0.2" - picomatch "^2.3.1" + function-bind "^1.1.2" + +js-base64@3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.2.tgz#816d11d81a8aff241603d19ce5761e13e41d7745" + integrity sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ== mime-db@1.52.0: version "1.52.0" @@ -2245,596 +139,78 @@ mime-types@^2.1.12: dependencies: mime-db "1.52.0" -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - -minimatch@^3.0.4: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -natural-compare-lite@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" - integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" - integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= - -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== - -node-releases@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" - integrity sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg== - -normalize-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -npm-run-path@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== - dependencies: - path-key "^3.0.0" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -onetime@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - dependencies: - mimic-fn "^2.1.0" - -optionator@^0.9.1: - version "0.9.1" - resolved "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz" - integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== - dependencies: - deep-is "^0.1.3" - fast-levenshtein "^2.0.6" - levn "^0.4.1" - prelude-ls "^1.2.1" - type-check "^0.4.0" - word-wrap "^1.2.3" - -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== - dependencies: - p-try "^2.0.0" - -p-limit@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" - integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== - dependencies: - yocto-queue "^0.1.0" - -p-locate@^4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz" - integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== - dependencies: - p-limit "^2.2.0" - -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - -parent-module@^1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" - integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== - dependencies: - callsites "^3.0.0" - -parse-json@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" - integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== - dependencies: - "@babel/code-frame" "^7.0.0" - error-ex "^1.3.1" - json-parse-even-better-errors "^2.3.0" - lines-and-columns "^1.1.6" - -path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" - integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - -path-key@^3.0.0, path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-parse@^1.0.6: - version "1.0.7" - resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== - -picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -pirates@^4.0.4: - version "4.0.5" - resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz" - integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ== - -pkg-dir@^4.2.0: - version "4.2.0" - resolved "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz" - integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== +node-fetch@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: - find-up "^4.0.0" - -prelude-ls@^1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" - integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + whatwg-url "^5.0.0" -prettier-linter-helpers@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" - integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== - dependencies: - fast-diff "^1.1.2" +object-inspect@^1.9.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" + integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== -prettier@^2.7.1: +prettier@2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== -pretty-format@^29.0.0, pretty-format@^29.2.1: - version "29.2.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.2.1.tgz#86e7748fe8bbc96a6a4e04fa99172630907a9611" - integrity sha512-Y41Sa4aLCtKAXvwuIpTvcFBkyeYp2gdFWzXGA+ZNES3VwURIB165XO/z7CjETwzCCS53MjW/rLMyyqEnTtaOfA== +qs@6.11.2: + version "6.11.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" + integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== dependencies: - "@jest/schemas" "^29.0.0" - ansi-styles "^5.0.0" - react-is "^18.0.0" + side-channel "^1.0.4" -prompts@^2.0.1: - version "2.4.2" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" - integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== - dependencies: - kleur "^3.0.3" - sisteransi "^1.0.5" - -proxy-from-env@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" - integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== - -punycode@^2.1.0: - version "2.1.1" - resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== - -queue-microtask@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" - integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== - -react-is@^18.0.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" - integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== - -regexpp@^3.2.0: - version "3.2.0" - resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz" - integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" - integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= - -resolve-cwd@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz" - integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== - dependencies: - resolve-from "^5.0.0" - -resolve-from@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" - integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== - -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - -resolve.exports@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.0.tgz#5ce842b94b05146c0e03076985d1d0e7e48c90c9" - integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== - -resolve@^1.20.0: - version "1.20.0" - resolved "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz" - integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== +set-function-length@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed" + integrity sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ== dependencies: - is-core-module "^2.2.0" - path-parse "^1.0.6" + define-data-property "^1.1.1" + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" -reusify@^1.0.4: +side-channel@^1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" - integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== - -rimraf@^3.0.2: - version "3.0.2" - resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" - integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== - dependencies: - glob "^7.1.3" - -run-parallel@^1.1.9: - version "1.2.0" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" - integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== - dependencies: - queue-microtask "^1.2.2" - -semver@7.x, semver@^7.3.5, semver@^7.3.7: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== - dependencies: - lru-cache "^6.0.0" - -semver@^6.0.0, semver@^6.3.0: - version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -signal-exit@^3.0.3, signal-exit@^3.0.7: - version "3.0.7" - resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz" - integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== - -sisteransi@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" - integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -source-map-support@0.5.13: - version "0.5.13" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" - integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" -source-map@^0.6.0, source-map@^0.6.1: - version "0.6.1" - resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" - integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= - -stack-utils@^2.0.3: - version "2.0.5" - resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz" - integrity sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA== - dependencies: - escape-string-regexp "^2.0.0" - -string-length@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" - integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== - dependencies: - char-regex "^1.0.2" - strip-ansi "^6.0.0" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-bom@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz" - integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== - -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== - -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: - version "3.1.1" - resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -supports-color@^8.0.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - -test-exclude@^6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz" - integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== - dependencies: - "@istanbuljs/schema" "^0.1.2" - glob "^7.1.4" - minimatch "^3.0.4" - -text-table@^0.2.0: - version "0.2.0" - resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" - integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= - -tmpl@1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" - integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -ts-jest@^29.0.3: - version "29.0.3" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.0.3.tgz#63ea93c5401ab73595440733cefdba31fcf9cb77" - integrity sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ== - dependencies: - bs-logger "0.x" - fast-json-stable-stringify "2.x" - jest-util "^29.0.0" - json5 "^2.2.1" - lodash.memoize "4.x" - make-error "1.x" - semver "7.x" - yargs-parser "^21.0.1" - -tslib@^1.8.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" - integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== +typescript@4.6.4: + version "4.6.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" + integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== -tsutils@^3.21.0: - version "3.21.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" - integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== - dependencies: - tslib "^1.8.1" - -type-check@^0.4.0, type-check@~0.4.0: - version "0.4.0" - resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz" - integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== - dependencies: - prelude-ls "^1.2.1" - -type-detect@4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== - -type-fest@^0.20.2: - version "0.20.2" - resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" - integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== - -type-fest@^0.21.3: - version "0.21.3" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" - integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== - -typescript@^4.8.4: - version "4.8.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" - integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== - -update-browserslist-db@^1.0.9: - version "1.0.10" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz#0f54b876545726f17d00cd9a2561e6dade943ff3" - integrity sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ== - dependencies: - escalade "^3.1.1" - picocolors "^1.0.0" - -uri-js@^4.2.2: - version "4.4.1" - resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz" - integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== - dependencies: - punycode "^2.1.0" - -v8-compile-cache@^2.0.3: - version "2.3.0" - resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz" - integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== - -v8-to-istanbul@^9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz#b6f994b0b5d4ef255e17a0d17dc444a9f5132fa4" - integrity sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w== - dependencies: - "@jridgewell/trace-mapping" "^0.3.12" - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" - -walker@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" - integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== - dependencies: - makeerror "1.0.12" - -which@^2.0.1: - version "2.0.2" - resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -word-wrap@^1.2.3: - version "1.2.4" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.4.tgz#cb4b50ec9aca570abd1f52f33cd45b6c61739a9f" - integrity sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA== - -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -write-file-atomic@^4.0.1: +url-join@4.0.1: version "4.0.1" - resolved "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.1.tgz" - integrity sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ== - dependencies: - imurmurhash "^0.1.4" - signal-exit "^3.0.7" - -y18n@^5.0.5: - version "5.0.8" - resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" - integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== - -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" + integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA== -yargs-parser@^21.0.0: - version "21.0.1" - resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz" - integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg== - -yargs-parser@^21.0.1: - version "21.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" - integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== -yargs@^17.3.1: - version "17.4.0" - resolved "https://registry.npmjs.org/yargs/-/yargs-17.4.0.tgz" - integrity sha512-WJudfrk81yWFSOkZYpAZx4Nt7V4xp7S/uJkX0CnxovMCt1wCE8LNftPpNuF9X/u9gN5nsD7ycYtRcDf2pL3UiA== +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.0.0" - -yocto-queue@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" - integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + tr46 "~0.0.3" + webidl-conversions "^3.0.0"