diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 153548b..0000000 --- a/.eslintrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint"], - "rules": { - "no-empty": 0 - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "ignorePatterns": ["dist/"] -} diff --git a/.fernignore b/.fernignore new file mode 100644 index 0000000..694283c --- /dev/null +++ b/.fernignore @@ -0,0 +1,2 @@ +# Specify files that shouldn't be modified by Fern +README.md \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e2b82d1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +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 + + - name: Publish to npm + run: | + npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} + npm publish --access public + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index eb36bf4..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: Release -on: - push: - branches: [main] -jobs: - publish: - runs-on: ubuntu-latest - name: Publish to npm - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Install Dependencies - run: npm ci - - - name: Build - run: npm run build - - - name: Publish - uses: JS-DevTools/npm-publish@v1 - with: - token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index be40615..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,37 +0,0 @@ -name: Lint and Test -on: push -jobs: - build: - runs-on: ubuntu-latest - name: "Lint and Test" - steps: - - name: Checkout Code - id: checkout - uses: actions/checkout@v2 - - - name: Install Dependencies - id: install - run: npm ci - - - name: Run Linter - id: lint - run: npm run lint - - - name: Run Tests - id: test - run: npm run test - env: - COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} - - - name: Build - id: build - run: npm run build - - - name: Check that ./dist is up to date - run: | - if [ -z "$(git status --porcelain)" ]; then - echo "./dist is up to date!" - else - echo "./dist is out of date with source code. Run npm run build and check in the changes." - exit 1 - fi diff --git a/.gitignore b/.gitignore index 7bf54a0..1498321 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,13 @@ -.DS_Store node_modules -dev.ts - -# local env files -.env.local -.env.*.local -.env.test -.env - -# Log files -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* - -# Editor directories and files -.idea -.vscode -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? +.DS_Store +/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 index 7ddc04e..e62938d 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,8 @@ -**/.* -.mochaarc.json -test/ +node_modules +src +.gitignore +.github +.fernignore +.prettierrc.yml tsconfig.json -webpack.config.js -node_modules/ -DEV.md \ No newline at end of file +yarn.lock \ No newline at end of file diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 849ddff..0000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -dist/ diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 0967ef4..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 0000000..0c06786 --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1,2 @@ +tabWidth: 4 +printWidth: 120 diff --git a/DEV.md b/DEV.md deleted file mode 100644 index cf18fb8..0000000 --- a/DEV.md +++ /dev/null @@ -1,35 +0,0 @@ -# SDK Local Development Instructions - -### Get Started: - -```bash -npm install -``` - -### Build for production (including generation of `./index.d.ts`) - -```bash -npm run build -``` - -### Run a local dev server (in node) to test. - -```bash -npm run dev -``` - -### Set the following environment variable: - -``` -COHERE_API_KEY=YOUR_KEY -``` - -### Run tests - -```bash -npm run test -``` - -### Publish to npm - -Changes merged to main will automatically be published to npm. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index b56baf3..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 Cohere - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index 976cceb..bdb6776 100644 --- a/README.md +++ b/README.md @@ -1,114 +1,113 @@ -> ⚠️ This repository is not officially maintained so it may not support the latest API features. The only currently supported sdk is [cohere-ai/cohere-python](https://github.com/cohere-ai/cohere-python). Official SDK support for node coming soon! ⚠️ +![](banner.png) -# Welcome to the Cohere AI Node.js SDK. +# Cohere Typescript Library -This package provides functionality developed to simplify interfacing with the [cohere.ai](https://cohere.ai) natural language API. This SDK provides support for both TypeScript and JavaScript Node.js projects. For a full description of the API please visit the [Cohere Docs](https://docs.cohere.ai/). +[![npm shield](https://img.shields.io/npm/v/cohere-ai)](https://www.npmjs.com/package/cohere-ai) +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern) -## Installation - -### Install the package as a dependency. +The Cohere typescript library provides access to the Cohere API from JavaScript/TypeScript. -```bash -npm install cohere-ai -``` +## ✨🪩✨ Announcing Cohere's new Typescript SDK ✨🪩✨ -## Usage +We are very excited to publish this brand new Typescript SDK. We now officially support Typescript and will continuously update this library with all of the latest features in our SDK. Please create issues where you have feedback so that we can continue to improve the developer experience! -### Import the library to your node.js project. +## Documentation -```js -const cohere = require("cohere-ai"); -``` +Cohere documentation and API reference is available [here](https://docs.cohere.com/). -### Initialize the library using the latest version of the API. +## Installation -```js -cohere.init("YOUR_API_KEY"); ``` - -### Call the endpoint function you'd like to hit to interact with the Cohere API. - -```js -cohere.generate("MODEL_NAME", config); +npm i -s cohere-ai ``` -## Endpoints +## Usage + +[![Try it out](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/typescript-example-using-sdk-built-with-fern-az8lrn?file=app.ts&view=editor) -For a full breakdown of endpoints and their config objects please consult the [Cohere Docs](https://docs.cohere.ai/). +```typescript +import { CohereClient } from "cohere-ai"; -| Cohere Endpoint | Function | -| ---------------- | ----------------------- | -| /generate | cohere.generate() | -| /embed | cohere.embed() | -| /classify | cohere.classify() | -| /tokenize | cohere.tokenize() | -| /detokenize | cohere.detokenize() | -| /summarize | cohere.summarize() | -| /detect-language | cohere.detectLanguage() | +const cohere = new CohereClient({ + apiKey: "YOUR_API_KEY", +}); -## Models +const prediction = cohere.generate({ + model: "large", + prompt: "co:here", + max_tokens: 10, +}); -To view an up to date list of available models please consult the [Cohere CLI](https://docs.cohere.ai/command/). To get started try out `large`. +console.log("Received prediction", prediction); +``` -## Responses +## Streaming -All of the endpoint functions will return a response structure. For a detailed breakdown of the response body visit the [Cohere Docs](https://docs.cohere.ai/). +The SDK supports streaming endpoints. To take advantage of this feature for chat, +use `chatStream`. -```js -{ - statusCode: STATUS, - body: RESPONSE_OBJ +```ts +const stream = await cohere.chatStream({ + model: "command", + message: "Tell me a story in 5 parts!", +}); +for await (const chat of stream) { + if (chat.type === "text-generation") { + process.stdout.write(chat.text); + } } ``` -## _Code Examples:_ +## Errors -```js -(async () => { - cohere.init(process.env.COHERE_API_KEY); +When the API returns a non-success status code (4xx or 5xx response), +a subclass of [CohereError](./src/errors/CohereError.ts) will be thrown: - // Hit the `generate` endpoint on the `large` model - const generateResponse = await cohere.generate({ - model: "large", - prompt: "Once upon a time in a magical land called", - max_tokens: 50, - temperature: 1, - }); - - /* - { - statusCode: 200, - body: { - text: "Eldorado, the anointed monarchs of the ancient world and the ruling family were divided into three kingdoms, each of which was ruled by an individual leader." +```typescript +import { CohereError, CohereTimeoutError } from "cohere-ai"; + +try { + await cohere.generate(/* ... */); +} catch (err) { + if (err instanceof CohereTimeoutError) { + console.log("Request timed out", err); + } else if (err instanceof CohereError) { + // catch all errors + console.log(err.statusCode); + console.log(err.message); + console.log(err.body); } - } - */ -})(); +} ``` -### Example error response: +## Retries -```js -// error response from cohere.generate() where api key was not previously provided. -{ - statusCode: 403, - body: { - message: "Whoops! You need to provide an API key before making requests. Try cohere.init(YOUR_KEY)." - } -} +409 Conflict, 429 Rate Limit, and >=500 Internal errors will all be retried twice with exponential bakcoff. +You can use the maxRetries option to configure this behavior: +```typescript +await cohere.detectLanguage(..., { + maxRetries: 0, // disable retries +}); ``` -## TypeScript support +## Timeouts -Import the package as a class. +By default, the SDK has a timeout of 60s. You can use the `timeoutInSeconds` option to configure +this behavior -```ts -import cohere = require("cohere-ai"); +```typescript +await cohere.detectLanguage(..., { + timeoutInSeconds: 10, // timeout after 10 seconds +}); ``` -Require the `cohere` package as usual, and the `./index.d.ts` file will be imported by typescript automatically. +## Beta status + +This SDK is in beta, and while we will try to avoid it, there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your package.json file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version. + +## Contributing -## cohere-node package readme +While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us! -If you'd like to help contribute to the package library itself or modify it locally, please check the development instructions [readme](https://github.com/cohere-ai/cohere-node/blob/main/DEV.md). +On the other hand, contributions to the README are always very welcome! \ No newline at end of file diff --git a/banner.png b/banner.png new file mode 100644 index 0000000..322a84b Binary files /dev/null and b/banner.png differ diff --git a/cohere.ts b/cohere.ts deleted file mode 100644 index 482afeb..0000000 --- a/cohere.ts +++ /dev/null @@ -1,163 +0,0 @@ -import * as models from "./models"; -import API from "./services/api_service"; - -enum ENDPOINT { - GENERATE = "/generate", - EMBED = "/embed", - CLASSIFY = "/classify", - TOKENIZE = "/tokenize", - DETOKENIZE = "/detokenize", - DETECT_LANGUAGE = "/detect-language", - SUMMARIZE = "/summarize", -} - -const COHERE_EMBED_BATCH_SIZE = 5; - -interface CohereService { - init(key: string): void; - generate( - config: models.generateRequest - ): Promise>; - classify( - config: models.classifyRequest - ): Promise>; - tokenize( - config: models.tokenizeRequest - ): Promise>; - detokenize( - config: models.detokenizeRequest - ): Promise>; - embed( - config: models.embedRequest - ): Promise>; - detectLanguage( - config: models.detectLanguageRequest - ): Promise>; -} - -class Cohere implements CohereService { - public init(key: string): void { - API.init(key); - } - - private makeRequest( - endpoint: string, - data: models.cohereParameters - ): Promise> { - return API.post(endpoint, data); - } - - /** Generates realistic text conditioned on a given input. - * See: https://docs.cohere.ai/generate-reference - */ - public generate( - config: models.generateRequest - ): Promise> { - return this.makeRequest(ENDPOINT.GENERATE, config) as Promise< - models.cohereResponse - >; - } - - /** Returns a list of tokens for the specified text. - * See: https://docs.cohere.ai/tokenize-reference - */ - public tokenize({ - text, - }: models.tokenizeRequest): Promise< - models.cohereResponse - > { - return this.makeRequest(ENDPOINT.TOKENIZE, { - text, - }) as Promise>; - } - - /** Returns a string for the specified list of tokens. - * See: https://docs.cohere.ai/detokenize-reference - */ - public detokenize({ - tokens, - }: models.detokenizeRequest): Promise< - models.cohereResponse - > { - return this.makeRequest(ENDPOINT.DETOKENIZE, { - tokens, - }) as Promise>; - } - - /** Returns text embeddings. An embedding is a list of floating point numbers that captures semantic - * information about the text that it represents. - * See: https://docs.cohere.ai/embed-reference - */ - public embed( - config: models.embedRequest - ): Promise> { - const createBatches = (array: string[]) => { - const result = []; - for (const value of array) { - const lastArray = result[result.length - 1]; - if (!lastArray || lastArray.length === COHERE_EMBED_BATCH_SIZE) { - result.push([value]); - } else { - lastArray.push(value); - } - } - return result; - }; - - return Promise.all( - createBatches(config.texts).map( - (texts) => - this.makeRequest(ENDPOINT.EMBED, { - ...config, - texts, - }) as Promise> - ) - ).then((results) => { - let embeddings: number[][] = []; - results.forEach((result) => { - embeddings = embeddings.concat(result.body.embeddings); - }); - - const meta = results[0].body.meta || undefined; - const response: models.cohereResponse = { - statusCode: results[0].statusCode, - body: { - embeddings, - meta, - }, - }; - - return response; - }); - } - - /** - * Classifies text as one of the given labels. Returns a confidence score for each label. - * See: https://docs.cohere.ai/classify-reference - */ - public classify( - config: models.classifyRequest - ): Promise> { - return this.makeRequest(ENDPOINT.CLASSIFY, config) as Promise< - models.cohereResponse - >; - } - - public detectLanguage( - config: models.detectLanguageRequest - ): Promise> { - return this.makeRequest(ENDPOINT.DETECT_LANGUAGE, config) as Promise< - models.cohereResponse - >; - } - - public summarize( - config: models.summarizeRequest - ): Promise> { - return this.makeRequest(ENDPOINT.SUMMARIZE, config) as Promise< - models.cohereResponse - >; - } -} -const cohere = new Cohere(); -export = cohere; diff --git a/dist/cohere.d.ts b/dist/cohere.d.ts deleted file mode 100644 index 3eb52c9..0000000 --- a/dist/cohere.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import * as models from "./models"; -interface CohereService { - init(key: string): void; - generate(config: models.generateRequest): Promise>; - classify(config: models.classifyRequest): Promise>; - tokenize(config: models.tokenizeRequest): Promise>; - detokenize(config: models.detokenizeRequest): Promise>; - embed(config: models.embedRequest): Promise>; - detectLanguage(config: models.detectLanguageRequest): Promise>; -} -declare class Cohere implements CohereService { - init(key: string): void; - private makeRequest; - /** Generates realistic text conditioned on a given input. - * See: https://docs.cohere.ai/generate-reference - */ - generate(config: models.generateRequest): Promise>; - /** Returns a list of tokens for the specified text. - * See: https://docs.cohere.ai/tokenize-reference - */ - tokenize({ text, }: models.tokenizeRequest): Promise>; - /** Returns a string for the specified list of tokens. - * See: https://docs.cohere.ai/detokenize-reference - */ - detokenize({ tokens, }: models.detokenizeRequest): Promise>; - /** Returns text embeddings. An embedding is a list of floating point numbers that captures semantic - * information about the text that it represents. - * See: https://docs.cohere.ai/embed-reference - */ - embed(config: models.embedRequest): Promise>; - /** - * Classifies text as one of the given labels. Returns a confidence score for each label. - * See: https://docs.cohere.ai/classify-reference - */ - classify(config: models.classifyRequest): Promise>; - detectLanguage(config: models.detectLanguageRequest): Promise>; - summarize(config: models.summarizeRequest): Promise>; -} -declare const cohere: Cohere; -export = cohere; diff --git a/dist/cohere.js b/dist/cohere.js deleted file mode 100644 index 6c220fe..0000000 --- a/dist/cohere.js +++ /dev/null @@ -1,324 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["cohere"] = factory(); - else - root["cohere"] = factory(); -})(global, () => { -return /******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ 828: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - - -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -var api_service_1 = __importDefault(__webpack_require__(836)); -var ENDPOINT; -(function (ENDPOINT) { - ENDPOINT["GENERATE"] = "/generate"; - ENDPOINT["EMBED"] = "/embed"; - ENDPOINT["CLASSIFY"] = "/classify"; - ENDPOINT["TOKENIZE"] = "/tokenize"; - ENDPOINT["DETOKENIZE"] = "/detokenize"; - ENDPOINT["DETECT_LANGUAGE"] = "/detect-language"; - ENDPOINT["SUMMARIZE"] = "/summarize"; -})(ENDPOINT || (ENDPOINT = {})); -var COHERE_EMBED_BATCH_SIZE = 5; -var Cohere = /** @class */ (function () { - function Cohere() { - } - Cohere.prototype.init = function (key) { - api_service_1.default.init(key); - }; - Cohere.prototype.makeRequest = function (endpoint, data) { - return api_service_1.default.post(endpoint, data); - }; - /** Generates realistic text conditioned on a given input. - * See: https://docs.cohere.ai/generate-reference - */ - Cohere.prototype.generate = function (config) { - return this.makeRequest(ENDPOINT.GENERATE, config); - }; - /** Returns a list of tokens for the specified text. - * See: https://docs.cohere.ai/tokenize-reference - */ - Cohere.prototype.tokenize = function (_a) { - var text = _a.text; - return this.makeRequest(ENDPOINT.TOKENIZE, { - text: text, - }); - }; - /** Returns a string for the specified list of tokens. - * See: https://docs.cohere.ai/detokenize-reference - */ - Cohere.prototype.detokenize = function (_a) { - var tokens = _a.tokens; - return this.makeRequest(ENDPOINT.DETOKENIZE, { - tokens: tokens, - }); - }; - /** Returns text embeddings. An embedding is a list of floating point numbers that captures semantic - * information about the text that it represents. - * See: https://docs.cohere.ai/embed-reference - */ - Cohere.prototype.embed = function (config) { - var _this = this; - var createBatches = function (array) { - var result = []; - for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { - var value = array_1[_i]; - var lastArray = result[result.length - 1]; - if (!lastArray || lastArray.length === COHERE_EMBED_BATCH_SIZE) { - result.push([value]); - } - else { - lastArray.push(value); - } - } - return result; - }; - return Promise.all(createBatches(config.texts).map(function (texts) { - return _this.makeRequest(ENDPOINT.EMBED, __assign(__assign({}, config), { texts: texts })); - })).then(function (results) { - var embeddings = []; - results.forEach(function (result) { - embeddings = embeddings.concat(result.body.embeddings); - }); - var meta = results[0].body.meta || undefined; - var response = { - statusCode: results[0].statusCode, - body: { - embeddings: embeddings, - meta: meta, - }, - }; - return response; - }); - }; - /** - * Classifies text as one of the given labels. Returns a confidence score for each label. - * See: https://docs.cohere.ai/classify-reference - */ - Cohere.prototype.classify = function (config) { - return this.makeRequest(ENDPOINT.CLASSIFY, config); - }; - Cohere.prototype.detectLanguage = function (config) { - return this.makeRequest(ENDPOINT.DETECT_LANGUAGE, config); - }; - Cohere.prototype.summarize = function (config) { - return this.makeRequest(ENDPOINT.SUMMARIZE, config); - }; - return Cohere; -}()); -var cohere = new Cohere(); -module.exports = cohere; - - -/***/ }), - -/***/ 836: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -var https = __webpack_require__(687); -var error_service_1 = __importDefault(__webpack_require__(959)); -var URL; -(function (URL) { - URL["COHERE_API"] = "api.cohere.ai"; -})(URL || (URL = {})); -var APIImpl = /** @class */ (function () { - function APIImpl() { - this.COHERE_API_KEY = ""; - this.COHERE_VERSION = "1"; - } - APIImpl.prototype.init = function (key) { - this.COHERE_API_KEY = key; - }; - APIImpl.prototype.post = function (endpoint, data) { - return __awaiter(this, void 0, void 0, function () { - var _this = this; - return __generator(this, function (_a) { - return [2 /*return*/, new Promise(function (resolve, reject) { - try { - // workaround for js projects that pass json strings. - data = JSON.parse("".concat(data)); - } - catch (e) { } - var reqData = JSON.stringify(data); - var req = https.request({ - hostname: URL.COHERE_API, - path: "/v".concat(_this.COHERE_VERSION).concat(endpoint), - method: "POST", - headers: { - "Content-Type": "application/json; charset=utf-8", - "Content-Length": Buffer.byteLength(reqData, "utf8"), - Authorization: "Bearer ".concat(_this.COHERE_API_KEY), - "Request-Source": "node-sdk", - }, - timeout: 5000, - }, function (res) { - var data = []; - res.on("data", function (chunk) { return data.push(chunk); }); - res.on("end", function () { - if ("x-api-warning" in res.headers) { - var warnHeader = res.headers["x-api-warning"]; - if (typeof warnHeader === "string") { - console.warn("\x1b[33mWarning: %s\x1b[0m", warnHeader); - } - else { - for (var warning in warnHeader) { - console.warn("\x1b[33mWarning: %s\x1b[0m", warning); - } - } - } - resolve({ - statusCode: res.statusCode, - body: JSON.parse(Buffer.concat(data).toString()), - }); - }); - }); - req.on("error", function (error) { - return reject(error_service_1.default.handleError(error)); - }); - req.write(reqData, "utf8"); - req.end(); - })]; - }); - }); - }; - return APIImpl; -}()); -var API = new APIImpl(); -module.exports = API; - - -/***/ }), - -/***/ 959: -/***/ ((module) => { - - -var errorImpl = /** @class */ (function () { - function errorImpl() { - } - errorImpl.prototype.handleError = function (error) { - var _a, _b, _c; - var status = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) || 500; - var message = ((_c = (_b = error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || error.message; - return { - statusCode: status, - body: { - message: message, - }, - }; - }; - return errorImpl; -}()); -var errors = new errorImpl(); -module.exports = errors; - - -/***/ }), - -/***/ 687: -/***/ ((module) => { - -module.exports = require("https"); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module is referenced by other modules so it can't be inlined -/******/ var __webpack_exports__ = __webpack_require__(828); -/******/ -/******/ return __webpack_exports__; -/******/ })() -; -}); -//# sourceMappingURL=cohere.js.map \ No newline at end of file diff --git a/dist/cohere.js.map b/dist/cohere.js.map deleted file mode 100644 index e27d0a9..0000000 --- a/dist/cohere.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cohere.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;ACVa;AACb;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA,oCAAoC,mBAAO,CAAC,GAAwB;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,4BAA4B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,qBAAqB;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,aAAa,cAAc;AACpG,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;;;;;;;;AClHa;AACb;AACA,4BAA4B,+DAA+D,iBAAiB;AAC5G;AACA,oCAAoC,MAAM,+BAA+B,YAAY;AACrF,mCAAmC,MAAM,mCAAmC,YAAY;AACxF,gCAAgC;AAChC;AACA,KAAK;AACL;AACA;AACA,cAAc,6BAA6B,0BAA0B,cAAc,qBAAqB;AACxG,iBAAiB,oDAAoD,qEAAqE,cAAc;AACxJ,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC,mCAAmC,SAAS;AAC5C,mCAAmC,WAAW,UAAU;AACxD,0CAA0C,cAAc;AACxD;AACA,8GAA8G,OAAO;AACrH,iFAAiF,iBAAiB;AAClG,yDAAyD,gBAAgB,QAAQ;AACjF,+CAA+C,gBAAgB,gBAAgB;AAC/E;AACA,kCAAkC;AAClC;AACA;AACA,UAAU,YAAY,aAAa,SAAS,UAAU;AACtD,oCAAoC,SAAS;AAC7C;AACA;AACA;AACA,6CAA6C;AAC7C;AACA,YAAY,mBAAO,CAAC,GAAO;AAC3B,sCAAsC,mBAAO,CAAC,GAAiB;AAC/D;AACA;AACA;AACA,CAAC,kBAAkB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,yBAAyB;AACzB;AACA,8DAA8D,0BAA0B;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,6BAA6B;AAC7B,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA,qBAAqB;AACrB,aAAa;AACb,SAAS;AACT;AACA;AACA,CAAC;AACD;AACA;;;;;;;;AC7Ga;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,CAAC;AACD;AACA;;;;;;;;AClBA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://cohere/webpack/universalModuleDefinition","webpack://cohere/./cohere.ts","webpack://cohere/./services/api_service.ts","webpack://cohere/./services/error_service.ts","webpack://cohere/external node-commonjs \"https\"","webpack://cohere/webpack/bootstrap","webpack://cohere/webpack/before-startup","webpack://cohere/webpack/startup","webpack://cohere/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"cohere\"] = factory();\n\telse\n\t\troot[\"cohere\"] = factory();\n})(global, () => {\nreturn ","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar api_service_1 = __importDefault(require(\"./services/api_service\"));\nvar ENDPOINT;\n(function (ENDPOINT) {\n ENDPOINT[\"GENERATE\"] = \"/generate\";\n ENDPOINT[\"EMBED\"] = \"/embed\";\n ENDPOINT[\"CLASSIFY\"] = \"/classify\";\n ENDPOINT[\"TOKENIZE\"] = \"/tokenize\";\n ENDPOINT[\"DETOKENIZE\"] = \"/detokenize\";\n ENDPOINT[\"DETECT_LANGUAGE\"] = \"/detect-language\";\n ENDPOINT[\"SUMMARIZE\"] = \"/summarize\";\n})(ENDPOINT || (ENDPOINT = {}));\nvar COHERE_EMBED_BATCH_SIZE = 5;\nvar Cohere = /** @class */ (function () {\n function Cohere() {\n }\n Cohere.prototype.init = function (key) {\n api_service_1.default.init(key);\n };\n Cohere.prototype.makeRequest = function (endpoint, data) {\n return api_service_1.default.post(endpoint, data);\n };\n /** Generates realistic text conditioned on a given input.\n * See: https://docs.cohere.ai/generate-reference\n */\n Cohere.prototype.generate = function (config) {\n return this.makeRequest(ENDPOINT.GENERATE, config);\n };\n /** Returns a list of tokens for the specified text.\n * See: https://docs.cohere.ai/tokenize-reference\n */\n Cohere.prototype.tokenize = function (_a) {\n var text = _a.text;\n return this.makeRequest(ENDPOINT.TOKENIZE, {\n text: text,\n });\n };\n /** Returns a string for the specified list of tokens.\n * See: https://docs.cohere.ai/detokenize-reference\n */\n Cohere.prototype.detokenize = function (_a) {\n var tokens = _a.tokens;\n return this.makeRequest(ENDPOINT.DETOKENIZE, {\n tokens: tokens,\n });\n };\n /** Returns text embeddings. An embedding is a list of floating point numbers that captures semantic\n * information about the text that it represents.\n * See: https://docs.cohere.ai/embed-reference\n */\n Cohere.prototype.embed = function (config) {\n var _this = this;\n var createBatches = function (array) {\n var result = [];\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\n var value = array_1[_i];\n var lastArray = result[result.length - 1];\n if (!lastArray || lastArray.length === COHERE_EMBED_BATCH_SIZE) {\n result.push([value]);\n }\n else {\n lastArray.push(value);\n }\n }\n return result;\n };\n return Promise.all(createBatches(config.texts).map(function (texts) {\n return _this.makeRequest(ENDPOINT.EMBED, __assign(__assign({}, config), { texts: texts }));\n })).then(function (results) {\n var embeddings = [];\n results.forEach(function (result) {\n embeddings = embeddings.concat(result.body.embeddings);\n });\n var meta = results[0].body.meta || undefined;\n var response = {\n statusCode: results[0].statusCode,\n body: {\n embeddings: embeddings,\n meta: meta,\n },\n };\n return response;\n });\n };\n /**\n * Classifies text as one of the given labels. Returns a confidence score for each label.\n * See: https://docs.cohere.ai/classify-reference\n */\n Cohere.prototype.classify = function (config) {\n return this.makeRequest(ENDPOINT.CLASSIFY, config);\n };\n Cohere.prototype.detectLanguage = function (config) {\n return this.makeRequest(ENDPOINT.DETECT_LANGUAGE, config);\n };\n Cohere.prototype.summarize = function (config) {\n return this.makeRequest(ENDPOINT.SUMMARIZE, config);\n };\n return Cohere;\n}());\nvar cohere = new Cohere();\nmodule.exports = cohere;\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar https = require(\"https\");\nvar error_service_1 = __importDefault(require(\"./error_service\"));\nvar URL;\n(function (URL) {\n URL[\"COHERE_API\"] = \"api.cohere.ai\";\n})(URL || (URL = {}));\nvar APIImpl = /** @class */ (function () {\n function APIImpl() {\n this.COHERE_API_KEY = \"\";\n this.COHERE_VERSION = \"1\";\n }\n APIImpl.prototype.init = function (key) {\n this.COHERE_API_KEY = key;\n };\n APIImpl.prototype.post = function (endpoint, data) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve, reject) {\n try {\n // workaround for js projects that pass json strings.\n data = JSON.parse(\"\".concat(data));\n }\n catch (e) { }\n var reqData = JSON.stringify(data);\n var req = https.request({\n hostname: URL.COHERE_API,\n path: \"/v\".concat(_this.COHERE_VERSION).concat(endpoint),\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json; charset=utf-8\",\n \"Content-Length\": Buffer.byteLength(reqData, \"utf8\"),\n Authorization: \"Bearer \".concat(_this.COHERE_API_KEY),\n \"Request-Source\": \"node-sdk\",\n },\n timeout: 5000,\n }, function (res) {\n var data = [];\n res.on(\"data\", function (chunk) { return data.push(chunk); });\n res.on(\"end\", function () {\n if (\"x-api-warning\" in res.headers) {\n var warnHeader = res.headers[\"x-api-warning\"];\n if (typeof warnHeader === \"string\") {\n console.warn(\"\\x1b[33mWarning: %s\\x1b[0m\", warnHeader);\n }\n else {\n for (var warning in warnHeader) {\n console.warn(\"\\x1b[33mWarning: %s\\x1b[0m\", warning);\n }\n }\n }\n resolve({\n statusCode: res.statusCode,\n body: JSON.parse(Buffer.concat(data).toString()),\n });\n });\n });\n req.on(\"error\", function (error) {\n return reject(error_service_1.default.handleError(error));\n });\n req.write(reqData, \"utf8\");\n req.end();\n })];\n });\n });\n };\n return APIImpl;\n}());\nvar API = new APIImpl();\nmodule.exports = API;\n","\"use strict\";\nvar errorImpl = /** @class */ (function () {\n function errorImpl() {\n }\n errorImpl.prototype.handleError = function (error) {\n var _a, _b, _c;\n var status = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) || 500;\n var message = ((_c = (_b = error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || error.message;\n return {\n statusCode: status,\n body: {\n message: message,\n },\n };\n };\n return errorImpl;\n}());\nvar errors = new errorImpl();\nmodule.exports = errors;\n","module.exports = require(\"https\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(828);\n",""],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/models/index.ts b/dist/models/index.ts deleted file mode 100644 index 25dfd98..0000000 --- a/dist/models/index.ts +++ /dev/null @@ -1,275 +0,0 @@ -export interface cohereResponse { - statusCode: number | undefined; - body: T; -} - -/*-- requests --*/ -interface generateBaseRequest { - /** Denotes the model to be used. Defaults to the best performing model */ - model?: string; - /** Represents the prompt or text to be completed. */ - prompt?: string; - /** Denotes the number of tokens to predict per generation. */ - max_tokens?: number; - /** An optional string representing the ID of a custom playground preset. */ - preset?: string; - /** Denotes the maximum number of generations that will be returned. Defaults to 1, max value of 5. */ - num_generations?: number; - /** A non-negative float that tunes the degree of randomness in generation. */ - temperature?: number; - /** If set to a positive integer, it ensures only the top k most likely tokens are considered for generation at each step. */ - k?: number; - /** If set to a probability 0.0 < p < 1.0, it ensures that only the most likely tokens, - * with total probability mass of p, are considered for generation at each step. If both k and - * p are enabled, p acts after k. Max value of 1.0. - */ - p?: number; - /** Can be used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, - * except that this penalty is applied equally to all tokens that have already appeared, regardless - * of their exact frequencies. Max value of 1.0. - */ - presence_penalty?: number; - /** Can be used to reduce repetitiveness of generated tokens. The higher the value, - * the stronger a penalty is applied to previously present tokens, proportional to how many - * times they have already appeared in the prompt or prior generation. Max value of 1.0. - */ - frequency_penalty?: number; - /** The generated text will be cut at the beginning of the earliest occurence of an end sequence. - * The sequence will be excluded from the text. - */ - end_sequences?: string[]; - /** The generated text will be cut at the end of the earliest occurence of a stop sequence. The sequence - * will be included the text. - */ - stop_sequences?: string[]; - /** One of GENERATION|ALL|NONE to specify how and if the token likelihoods are returned with - * the response. If GENERATION is selected, the token likelihoods will only be provided for generated - * text. If ALL is selected, the token likelihoods will be provided both for the prompt and the generated - * text. - */ - return_likelihoods?: "GENERATION" | "ALL" | "NONE"; - - /** Used to prevent the model from generating unwanted tokens or to incentivize it to include desired tokens - * A map of token ids to biases where bias is a float between -10 and +10 - * Negative values will disincentivize that token from appearing while positivse values will encourage them - * Token ids can be obtained from text using the tokenizer - * Note: logit bias may not be supported for all finetune models - */ - logit_bias?: { [token_id: number]: number }; - - /** Specifies how the API will handle inputs longer than the maximum token length. - * Passing START will discard the start of the input and END will discard the end of the input. - * Defaults to NONE, which will return an error if the input is too long. */ - truncate?: "NONE" | "START" | "END"; -} - -interface generateWithPromptRequest extends generateBaseRequest { - prompt: string; - max_tokens: number; -} - -interface generateWithPresetRequest extends generateBaseRequest { - preset: string; -} - -export type generateRequest = - | generateWithPromptRequest - | generateWithPresetRequest; - -export interface embedRequest { - /** Denotes the model to be used. Defaults to the best performing model */ - model?: string; - /** An array of strings for the model to embed. */ - texts: string[]; - /** Specifies how the API will handle inputs longer than the maximum token length. */ - truncate?: "NONE" | "START" | "END"; -} - -interface classifyBaseRequest { - /** Denotes the model to be used. Defaults to the best performing model */ - model?: string; - /** An array of strings that you would like to classify. */ - inputs?: string[]; - /** An array of examples representing examples and the corresponding label. */ - examples?: { text: string; label: string }[]; - /** An optional string representing the ID of a custom playground preset. */ - preset?: string; - /** Specifies how the API will handle inputs longer than the maximum token length. - * Passing START will discard the start of the input and END will discard the end of the input. - * Defaults to NONE, which will return an error if the input is too long. */ - truncate?: "NONE" | "START" | "END"; -} - -interface classifyWithInputsRequest extends classifyBaseRequest { - inputs: string[]; - examples: { text: string; label: string }[]; -} - -interface classifyWithPresetRequest extends classifyBaseRequest { - preset: string; -} - -export type classifyRequest = - | classifyWithInputsRequest - | classifyWithPresetRequest; - -export interface tokenizeRequest { - /** The text to be tokenized */ - text: string; -} - -export interface detokenizeRequest { - /** The list of tokens to be detokenized */ - tokens: number[]; -} - -export interface detectLanguageRequest { - /** Texts to identify the language for */ - texts: string[]; -} - -export enum summaryLength { - SHORT = "SHORT", - MEDIUM = "MEDIUM", - LONG = "LONG", -} - -export enum summaryFormat { - PARAGRAPH = "PARAGRAPH", - BULLET_POINTS = "BULLETS", -} - -export enum summaryExtractiveness { - LOW = "LOW", - MEDIUM = "MEDIUM", - HIGH = "HIGH", -} - -export interface summarizeRequest { - /** Text to summarize */ - text: string; - /** Denotes the summarization model to be used. Defaults to the best performing model */ - model?: string; - /** One of `short`, `medium` or `long`, defaults to `medium`. Indicates the approximate length of the summary.' */ - length?: summaryLength | string; - /** 'One of `paragraph` or `bullets`, defaults to `paragraph`. - * Indicates the style in which the summary will be delivered - in a free form - * paragraph or in bullet points.' - */ - format?: summaryFormat | string; - /** One of `low`, `medium` or `high`, defaults to `low`. Controls how close to the original text the summary is. - * `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness - * summaries will tend to paraphrase more.' - */ - extractiveness?: summaryExtractiveness | string; - /** Ranges from 0 to 5. Controls the randomness of the output. Lower values tend to generate more “predictable” output, - * while higher values tend to generate more “creative” output. The sweet spot is typically between 0 and 1. - */ - temperature?: number; - /** A free-form instruction for modifying how the summaries get generated. Should complete the sentence "Generate a summary _". - * Eg. "focusing on the next steps" or "written by Yoda" - */ - additional_command?: string; -} - -export type cohereParameters = - | generateRequest - | embedRequest - | classifyRequest - | classifyWithPresetRequest - | tokenizeRequest - | detokenizeRequest - | detectLanguageRequest; - -/* -- responses -- */ -export interface generateResponse { - generations: { - text: string; - likelihood?: number; - token_likelihoods?: [ - { - token: string; - likelihood: number; - } - ]; - }[]; - meta?: metaResponse; -} - -export interface tokenizeResponse { - /** An array of integers, representing the token ids for the specified text. */ - tokens: number[]; - /** An array of string representations for each token */ - token_strings: string[]; - meta?: metaResponse; -} - -export interface detokenizeResponse { - /** A string representing the list of tokens. */ - text: string; - meta?: metaResponse; -} - -export interface embedResponse { - /** An array of embeddings, where each embedding is an array of floats. The length of the embeddings - * array will be the same as the length of the original texts array. - */ - embeddings: number[][]; - meta?: metaResponse; -} - -export interface classifyResponse { - classifications: { - /** The input that is being classified. */ - input: string; - /** The predicted label for the input. */ - prediction: string; - /** Confidence score for the predicted label. */ - confidence: number; - /** A map of predictions for each option. */ - labels: { [label: string]: { confidence: number } }; - }[]; - meta?: metaResponse; -} - -export interface detectLanguageResponse { - results: { - /** Code of the language eg. "fr". */ - language_code: string; - /** Name of the language eg. "French". */ - language_name: string; - }[]; - meta?: metaResponse; -} - -export interface summarizeResponse { - id: string; - summary: string; - meta?: metaResponse; -} - -export interface metaResponse { - api_version: APIVersionMeta; - warnings?: string[]; -} - -export interface APIVersionMeta { - version: string; - is_deprecated?: boolean; - is_experimental?: boolean; -} - -export interface error { - /** Text explaining what went wrong. */ - message?: string; -} - -export type responseBody = - | generateResponse - | embedResponse - | classifyResponse - | tokenizeResponse - | detokenizeResponse - | detectLanguageResponse - | summarizeResponse - | error; diff --git a/index.js b/index.js deleted file mode 100644 index 58ab725..0000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./dist/cohere"); diff --git a/models/index.ts b/models/index.ts deleted file mode 100644 index 25dfd98..0000000 --- a/models/index.ts +++ /dev/null @@ -1,275 +0,0 @@ -export interface cohereResponse { - statusCode: number | undefined; - body: T; -} - -/*-- requests --*/ -interface generateBaseRequest { - /** Denotes the model to be used. Defaults to the best performing model */ - model?: string; - /** Represents the prompt or text to be completed. */ - prompt?: string; - /** Denotes the number of tokens to predict per generation. */ - max_tokens?: number; - /** An optional string representing the ID of a custom playground preset. */ - preset?: string; - /** Denotes the maximum number of generations that will be returned. Defaults to 1, max value of 5. */ - num_generations?: number; - /** A non-negative float that tunes the degree of randomness in generation. */ - temperature?: number; - /** If set to a positive integer, it ensures only the top k most likely tokens are considered for generation at each step. */ - k?: number; - /** If set to a probability 0.0 < p < 1.0, it ensures that only the most likely tokens, - * with total probability mass of p, are considered for generation at each step. If both k and - * p are enabled, p acts after k. Max value of 1.0. - */ - p?: number; - /** Can be used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, - * except that this penalty is applied equally to all tokens that have already appeared, regardless - * of their exact frequencies. Max value of 1.0. - */ - presence_penalty?: number; - /** Can be used to reduce repetitiveness of generated tokens. The higher the value, - * the stronger a penalty is applied to previously present tokens, proportional to how many - * times they have already appeared in the prompt or prior generation. Max value of 1.0. - */ - frequency_penalty?: number; - /** The generated text will be cut at the beginning of the earliest occurence of an end sequence. - * The sequence will be excluded from the text. - */ - end_sequences?: string[]; - /** The generated text will be cut at the end of the earliest occurence of a stop sequence. The sequence - * will be included the text. - */ - stop_sequences?: string[]; - /** One of GENERATION|ALL|NONE to specify how and if the token likelihoods are returned with - * the response. If GENERATION is selected, the token likelihoods will only be provided for generated - * text. If ALL is selected, the token likelihoods will be provided both for the prompt and the generated - * text. - */ - return_likelihoods?: "GENERATION" | "ALL" | "NONE"; - - /** Used to prevent the model from generating unwanted tokens or to incentivize it to include desired tokens - * A map of token ids to biases where bias is a float between -10 and +10 - * Negative values will disincentivize that token from appearing while positivse values will encourage them - * Token ids can be obtained from text using the tokenizer - * Note: logit bias may not be supported for all finetune models - */ - logit_bias?: { [token_id: number]: number }; - - /** Specifies how the API will handle inputs longer than the maximum token length. - * Passing START will discard the start of the input and END will discard the end of the input. - * Defaults to NONE, which will return an error if the input is too long. */ - truncate?: "NONE" | "START" | "END"; -} - -interface generateWithPromptRequest extends generateBaseRequest { - prompt: string; - max_tokens: number; -} - -interface generateWithPresetRequest extends generateBaseRequest { - preset: string; -} - -export type generateRequest = - | generateWithPromptRequest - | generateWithPresetRequest; - -export interface embedRequest { - /** Denotes the model to be used. Defaults to the best performing model */ - model?: string; - /** An array of strings for the model to embed. */ - texts: string[]; - /** Specifies how the API will handle inputs longer than the maximum token length. */ - truncate?: "NONE" | "START" | "END"; -} - -interface classifyBaseRequest { - /** Denotes the model to be used. Defaults to the best performing model */ - model?: string; - /** An array of strings that you would like to classify. */ - inputs?: string[]; - /** An array of examples representing examples and the corresponding label. */ - examples?: { text: string; label: string }[]; - /** An optional string representing the ID of a custom playground preset. */ - preset?: string; - /** Specifies how the API will handle inputs longer than the maximum token length. - * Passing START will discard the start of the input and END will discard the end of the input. - * Defaults to NONE, which will return an error if the input is too long. */ - truncate?: "NONE" | "START" | "END"; -} - -interface classifyWithInputsRequest extends classifyBaseRequest { - inputs: string[]; - examples: { text: string; label: string }[]; -} - -interface classifyWithPresetRequest extends classifyBaseRequest { - preset: string; -} - -export type classifyRequest = - | classifyWithInputsRequest - | classifyWithPresetRequest; - -export interface tokenizeRequest { - /** The text to be tokenized */ - text: string; -} - -export interface detokenizeRequest { - /** The list of tokens to be detokenized */ - tokens: number[]; -} - -export interface detectLanguageRequest { - /** Texts to identify the language for */ - texts: string[]; -} - -export enum summaryLength { - SHORT = "SHORT", - MEDIUM = "MEDIUM", - LONG = "LONG", -} - -export enum summaryFormat { - PARAGRAPH = "PARAGRAPH", - BULLET_POINTS = "BULLETS", -} - -export enum summaryExtractiveness { - LOW = "LOW", - MEDIUM = "MEDIUM", - HIGH = "HIGH", -} - -export interface summarizeRequest { - /** Text to summarize */ - text: string; - /** Denotes the summarization model to be used. Defaults to the best performing model */ - model?: string; - /** One of `short`, `medium` or `long`, defaults to `medium`. Indicates the approximate length of the summary.' */ - length?: summaryLength | string; - /** 'One of `paragraph` or `bullets`, defaults to `paragraph`. - * Indicates the style in which the summary will be delivered - in a free form - * paragraph or in bullet points.' - */ - format?: summaryFormat | string; - /** One of `low`, `medium` or `high`, defaults to `low`. Controls how close to the original text the summary is. - * `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness - * summaries will tend to paraphrase more.' - */ - extractiveness?: summaryExtractiveness | string; - /** Ranges from 0 to 5. Controls the randomness of the output. Lower values tend to generate more “predictable” output, - * while higher values tend to generate more “creative” output. The sweet spot is typically between 0 and 1. - */ - temperature?: number; - /** A free-form instruction for modifying how the summaries get generated. Should complete the sentence "Generate a summary _". - * Eg. "focusing on the next steps" or "written by Yoda" - */ - additional_command?: string; -} - -export type cohereParameters = - | generateRequest - | embedRequest - | classifyRequest - | classifyWithPresetRequest - | tokenizeRequest - | detokenizeRequest - | detectLanguageRequest; - -/* -- responses -- */ -export interface generateResponse { - generations: { - text: string; - likelihood?: number; - token_likelihoods?: [ - { - token: string; - likelihood: number; - } - ]; - }[]; - meta?: metaResponse; -} - -export interface tokenizeResponse { - /** An array of integers, representing the token ids for the specified text. */ - tokens: number[]; - /** An array of string representations for each token */ - token_strings: string[]; - meta?: metaResponse; -} - -export interface detokenizeResponse { - /** A string representing the list of tokens. */ - text: string; - meta?: metaResponse; -} - -export interface embedResponse { - /** An array of embeddings, where each embedding is an array of floats. The length of the embeddings - * array will be the same as the length of the original texts array. - */ - embeddings: number[][]; - meta?: metaResponse; -} - -export interface classifyResponse { - classifications: { - /** The input that is being classified. */ - input: string; - /** The predicted label for the input. */ - prediction: string; - /** Confidence score for the predicted label. */ - confidence: number; - /** A map of predictions for each option. */ - labels: { [label: string]: { confidence: number } }; - }[]; - meta?: metaResponse; -} - -export interface detectLanguageResponse { - results: { - /** Code of the language eg. "fr". */ - language_code: string; - /** Name of the language eg. "French". */ - language_name: string; - }[]; - meta?: metaResponse; -} - -export interface summarizeResponse { - id: string; - summary: string; - meta?: metaResponse; -} - -export interface metaResponse { - api_version: APIVersionMeta; - warnings?: string[]; -} - -export interface APIVersionMeta { - version: string; - is_deprecated?: boolean; - is_experimental?: boolean; -} - -export interface error { - /** Text explaining what went wrong. */ - message?: string; -} - -export type responseBody = - | generateResponse - | embedResponse - | classifyResponse - | tokenizeResponse - | detokenizeResponse - | detectLanguageResponse - | summarizeResponse - | error; diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index b5ed330..0000000 --- a/package-lock.json +++ /dev/null @@ -1,4170 +0,0 @@ -{ - "name": "cohere-ai", - "version": "6.1.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "cohere-ai", - "version": "6.1.0", - "license": "MIT", - "devDependencies": { - "@types/chai": "^4.2.18", - "@types/mocha": "^8.2.2", - "@typescript-eslint/eslint-plugin": "^5.53.0", - "@typescript-eslint/parser": "^5.53.0", - "chai": "^4.3.4", - "clean-webpack-plugin": "^4.0.0-alpha.0", - "copy-webpack-plugin": "^8.1.1", - "eslint": "^7.27.0", - "eslint-config-prettier": "^8.5.0", - "eslint-webpack-plugin": "^2.5.4", - "mocha": "^10.0.0", - "nodemon-webpack-plugin": "^4.5.2", - "prettier": "^2.7.1", - "ts-loader": "^9.1.2", - "ts-node": "^10.8.1", - "typescript": "^4.9.5", - "webpack": "^5.37.0", - "webpack-cli": "^4.9.1" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", - "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", - "dev": true, - "dependencies": { - "@babel/highlight": "^7.10.4" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@discoveryjs/json-ext": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", - "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", - "dev": true, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz", - "integrity": "sha512-v3oplH6FYCULtFuCeqyuTd9D2WKO937Dxdq+GmHOLL72TTRriLxz2VLlNfkZRsvj6PKnOPAtuT6dwrs/pA5DvA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.4.0.tgz", - "integrity": "sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==", - "dev": true, - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", - "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", - "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/@eslint/eslintrc/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", - "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", - "dev": true, - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.0", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "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==", - "dev": true - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", - "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", - "dev": true, - "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/source-map": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz", - "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==", - "dev": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", - "dev": true - }, - "node_modules/@types/chai": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", - "dev": true - }, - "node_modules/@types/eslint": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz", - "integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==", - "dev": true, - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "node_modules/@types/eslint-scope": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", - "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", - "dev": true, - "dependencies": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, - "node_modules/@types/estree": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz", - "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==", - "dev": true - }, - "node_modules/@types/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", - "dev": true, - "dependencies": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", - "dev": true - }, - "node_modules/@types/minimatch": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", - "dev": true - }, - "node_modules/@types/mocha": { - "version": "8.2.3", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz", - "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==", - "dev": true - }, - "node_modules/@types/node": { - "version": "18.15.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.3.tgz", - "integrity": "sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==", - "dev": true - }, - "node_modules/@types/nodemon": { - "version": "1.19.2", - "resolved": "https://registry.npmjs.org/@types/nodemon/-/nodemon-1.19.2.tgz", - "integrity": "sha512-4GWiTN3HevkxMIxEQ7OpD3MAHhlVsX2tairCMRmf8oYZxmhHw9+UpQpIdGdJrjsMT2Ty26FtJzUUcP/qM5fR8A==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", - "dev": true - }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.55.0.tgz", - "integrity": "sha512-IZGc50rtbjk+xp5YQoJvmMPmJEYoC53SiKPXyqWfv15XoD2Y5Kju6zN0DwlmaGJp1Iw33JsWJcQ7nw0lGCGjVg==", - "dev": true, - "dependencies": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.55.0", - "@typescript-eslint/type-utils": "5.55.0", - "@typescript-eslint/utils": "5.55.0", - "debug": "^4.3.4", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", - "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^5.0.0", - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.55.0.tgz", - "integrity": "sha512-ppvmeF7hvdhUUZWSd2EEWfzcFkjJzgNQzVST22nzg958CR+sphy8A6K7LXQZd6V75m1VKjp+J4g/PCEfSCmzhw==", - "dev": true, - "dependencies": { - "@typescript-eslint/scope-manager": "5.55.0", - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/typescript-estree": "5.55.0", - "debug": "^4.3.4" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.55.0.tgz", - "integrity": "sha512-OK+cIO1ZGhJYNCL//a3ROpsd83psf4dUJ4j7pdNVzd5DmIk+ffkuUIX2vcZQbEW/IR41DYsfJTB19tpCboxQuw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/visitor-keys": "5.55.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.55.0.tgz", - "integrity": "sha512-ObqxBgHIXj8rBNm0yh8oORFrICcJuZPZTqtAFh0oZQyr5DnAHZWfyw54RwpEEH+fD8suZaI0YxvWu5tYE/WswA==", - "dev": true, - "dependencies": { - "@typescript-eslint/typescript-estree": "5.55.0", - "@typescript-eslint/utils": "5.55.0", - "debug": "^4.3.4", - "tsutils": "^3.21.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "*" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/types": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", - "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.55.0.tgz", - "integrity": "sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/visitor-keys": "5.55.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/utils": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.55.0.tgz", - "integrity": "sha512-FkW+i2pQKcpDC3AY6DU54yl8Lfl14FVGYDgBTyGKB75cCwV3KpkpTMFi9d9j2WAJ4271LR2HeC5SEWF/CZmmfw==", - "dev": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.55.0", - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/typescript-estree": "5.55.0", - "eslint-scope": "^5.1.1", - "semver": "^7.3.7" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", - "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@webassemblyjs/ast": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", - "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", - "dev": true, - "dependencies": { - "@webassemblyjs/helper-numbers": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1" - } - }, - "node_modules/@webassemblyjs/floating-point-hex-parser": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", - "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==", - "dev": true - }, - "node_modules/@webassemblyjs/helper-api-error": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", - "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==", - "dev": true - }, - "node_modules/@webassemblyjs/helper-buffer": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", - "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==", - "dev": true - }, - "node_modules/@webassemblyjs/helper-numbers": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", - "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", - "dev": true, - "dependencies": { - "@webassemblyjs/floating-point-hex-parser": "1.11.1", - "@webassemblyjs/helper-api-error": "1.11.1", - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@webassemblyjs/helper-wasm-bytecode": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", - "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==", - "dev": true - }, - "node_modules/@webassemblyjs/helper-wasm-section": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", - "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", - "dev": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1" - } - }, - "node_modules/@webassemblyjs/ieee754": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", - "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", - "dev": true, - "dependencies": { - "@xtuc/ieee754": "^1.2.0" - } - }, - "node_modules/@webassemblyjs/leb128": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", - "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", - "dev": true, - "dependencies": { - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@webassemblyjs/utf8": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", - "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==", - "dev": true - }, - "node_modules/@webassemblyjs/wasm-edit": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", - "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", - "dev": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/helper-wasm-section": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1", - "@webassemblyjs/wasm-opt": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1", - "@webassemblyjs/wast-printer": "1.11.1" - } - }, - "node_modules/@webassemblyjs/wasm-gen": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", - "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", - "dev": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/ieee754": "1.11.1", - "@webassemblyjs/leb128": "1.11.1", - "@webassemblyjs/utf8": "1.11.1" - } - }, - "node_modules/@webassemblyjs/wasm-opt": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", - "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", - "dev": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-buffer": "1.11.1", - "@webassemblyjs/wasm-gen": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1" - } - }, - "node_modules/@webassemblyjs/wasm-parser": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", - "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", - "dev": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/helper-api-error": "1.11.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.1", - "@webassemblyjs/ieee754": "1.11.1", - "@webassemblyjs/leb128": "1.11.1", - "@webassemblyjs/utf8": "1.11.1" - } - }, - "node_modules/@webassemblyjs/wast-printer": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", - "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", - "dev": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.1", - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@webpack-cli/configtest": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", - "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", - "dev": true, - "peerDependencies": { - "webpack": "4.x.x || 5.x.x", - "webpack-cli": "4.x.x" - } - }, - "node_modules/@webpack-cli/info": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", - "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", - "dev": true, - "dependencies": { - "envinfo": "^7.7.3" - }, - "peerDependencies": { - "webpack-cli": "4.x.x" - } - }, - "node_modules/@webpack-cli/serve": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", - "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", - "dev": true, - "peerDependencies": { - "webpack-cli": "4.x.x" - }, - "peerDependenciesMeta": { - "webpack-dev-server": { - "optional": true - } - } - }, - "node_modules/@xtuc/ieee754": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", - "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "dev": true - }, - "node_modules/@xtuc/long": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", - "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "dev": true - }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true - }, - "node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "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" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", - "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true, - "peerDependencies": { - "ajv": "^6.9.1" - } - }, - "node_modules/ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/arrify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", - "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "node_modules/browserslist": { - "version": "4.21.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", - "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - } - ], - "dependencies": { - "caniuse-lite": "^1.0.30001449", - "electron-to-chromium": "^1.4.284", - "node-releases": "^2.0.8", - "update-browserslist-db": "^1.0.10" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001468", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001468.tgz", - "integrity": "sha512-zgAo8D5kbOyUcRAgSmgyuvBkjrGk5CGYG5TYgFdpQv+ywcyEpo1LOWoG8YmoflGnh+V+UsNuKYedsoYs0hzV5A==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - } - ] - }, - "node_modules/chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", - "dev": true, - "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^4.1.2", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chrome-trace-event": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", - "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", - "dev": true, - "engines": { - "node": ">=6.0" - } - }, - "node_modules/clean-webpack-plugin": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/clean-webpack-plugin/-/clean-webpack-plugin-4.0.0.tgz", - "integrity": "sha512-WuWE1nyTNAyW5T7oNyys2EN0cfP2fdRxhxnIQWiAp0bMabPdHhoGxM8A6YL2GhqwgrPnnaemVE7nv5XJ2Fhh2w==", - "dev": true, - "dependencies": { - "del": "^4.1.1" - }, - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "webpack": ">=4.0.0 <6.0.0" - } - }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/clone-deep": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", - "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", - "dev": true, - "dependencies": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/colorette": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", - "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", - "dev": true - }, - "node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/copy-webpack-plugin": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-8.1.1.tgz", - "integrity": "sha512-rYM2uzRxrLRpcyPqGceRBDpxxUV8vcDqIKxAUKfcnFpcrPxT5+XvhTxv7XLjo5AvEJFPdAE3zCogG2JVahqgSQ==", - "dev": true, - "dependencies": { - "fast-glob": "^3.2.5", - "glob-parent": "^5.1.1", - "globby": "^11.0.3", - "normalize-path": "^3.0.0", - "p-limit": "^3.1.0", - "schema-utils": "^3.0.0", - "serialize-javascript": "^5.0.1" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.1.0" - } - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", - "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/deep-is": { - "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==", - "dev": true - }, - "node_modules/del": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz", - "integrity": "sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==", - "dev": true, - "dependencies": { - "@types/glob": "^7.1.1", - "globby": "^6.1.0", - "is-path-cwd": "^2.0.0", - "is-path-in-cwd": "^2.0.0", - "p-map": "^2.0.0", - "pify": "^4.0.1", - "rimraf": "^2.6.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/del/node_modules/array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==", - "dev": true, - "dependencies": { - "array-uniq": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/del/node_modules/globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw==", - "dev": true, - "dependencies": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/del/node_modules/globby/node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.4.333", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.333.tgz", - "integrity": "sha512-YyE8+GKyGtPEP1/kpvqsdhD6rA/TP1DUFDN4uiU/YI52NzDxmwHkEb3qjId8hLBa5siJvG0sfC3O66501jMruQ==", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/enhanced-resolve": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz", - "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "dependencies": { - "ansi-colors": "^4.1.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/envinfo": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", - "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", - "dev": true, - "bin": { - "envinfo": "dist/cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/es-module-lexer": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", - "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", - "dev": true - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "7.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", - "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", - "dev": true, - "dependencies": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.3", - "@humanwhocodes/config-array": "^0.5.0", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.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": "^5.1.2", - "globals": "^13.6.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "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", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^6.0.9", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-config-prettier": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.7.0.tgz", - "integrity": "sha512-HHVXLSlVUhMSmyW4ZzEuvjpwqamgmlfkutD53cYXLikh4pt/modINRcCIApJ84czDxM4GZInwUrromsDdTImTA==", - "dev": true, - "bin": { - "eslint-config-prettier": "bin/cli.js" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-visitor-keys": { - "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==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/eslint-webpack-plugin": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-2.7.0.tgz", - "integrity": "sha512-bNaVVUvU4srexGhVcayn/F4pJAz19CWBkKoMx7aSQ4wtTbZQCnG5O9LHCE42mM+JSKOUp7n6vd5CIwzj7lOVGA==", - "dev": true, - "dependencies": { - "@types/eslint": "^7.29.0", - "arrify": "^2.0.1", - "jest-worker": "^27.5.1", - "micromatch": "^4.0.5", - "normalize-path": "^3.0.0", - "schema-utils": "^3.1.1" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0", - "webpack": "^4.0.0 || ^5.0.0" - } - }, - "node_modules/eslint/node_modules/eslint-visitor-keys": { - "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==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/espree": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", - "dev": true, - "dependencies": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", - "dev": true, - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "dev": true, - "engines": { - "node": ">=0.8.x" - } - }, - "node_modules/fast-deep-equal": { - "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==", - "dev": true - }, - "node_modules/fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "dev": true, - "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" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-json-stable-stringify": { - "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==", - "dev": true - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "node_modules/fastest-levenshtein": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", - "dev": true, - "engines": { - "node": ">= 4.9.1" - } - }, - "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true, - "bin": { - "flat": "cli.js" - } - }, - "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, - "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flat-cache/node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "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" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true - }, - "node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "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" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", - "dev": true - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true, - "bin": { - "he": "bin/he" - } - }, - "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", - "dev": true - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-local": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", - "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", - "dev": true, - "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", - "dev": true, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "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==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-path-cwd": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", - "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/is-path-in-cwd": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz", - "integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==", - "dev": true, - "dependencies": { - "is-path-inside": "^2.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/is-path-inside": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz", - "integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==", - "dev": true, - "dependencies": { - "path-is-inside": "^1.0.2" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/jest-worker": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", - "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", - "dev": true, - "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, - "node_modules/json-schema-traverse": { - "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==", - "dev": true - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/loader-runner": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", - "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", - "dev": true, - "engines": { - "node": ">=6.11.5" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "node_modules/lodash.truncate": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true - }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.0" - } - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", - "dev": true, - "dependencies": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "nanoid": "3.3.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha.js" - }, - "engines": { - "node": ">= 14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mochajs" - } - }, - "node_modules/mocha/node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/mocha/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/mocha/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/mocha/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/mocha/node_modules/minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/mocha/node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/mocha/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true, - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "node_modules/natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, - "node_modules/node-releases": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", - "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", - "dev": true - }, - "node_modules/nodemon": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz", - "integrity": "sha512-4pv1f2bMDj0Eeg/MhGqxrtveeQ5/G/UVe9iO6uTZzjnRluSA4PVWf8CW99LUPwGB3eNIA7zUFoP77YuI7hOc0A==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.0.4", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "simple-update-notifier": "^1.0.7", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=8.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "node_modules/nodemon-webpack-plugin": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/nodemon-webpack-plugin/-/nodemon-webpack-plugin-4.8.1.tgz", - "integrity": "sha512-i6xTucitBolVAueD4OASt4jL5gNsAFuTuyn+y6O+NXUqHRVrsOFgOau49iLcjCJJaWAEXMVWpTc5Os79mp7IvQ==", - "dev": true, - "dependencies": { - "@types/nodemon": "latest", - "nodemon": "2.0.19" - }, - "engines": { - "node": ">=8.10.0" - }, - "peerDependencies": { - "webpack": "4 || 5" - } - }, - "node_modules/nodemon/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/nodemon/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/nodemon/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/nodemon/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", - "dev": true, - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": "*" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "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" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-map": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", - "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/parent-module": { - "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==", - "dev": true, - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==", - "dev": true - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", - "dev": true, - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pkg-dir": { - "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==", - "dev": true, - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/pkg-dir/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/prettier": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", - "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", - "dev": true, - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true - }, - "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/rechoir": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", - "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", - "dev": true, - "dependencies": { - "resolve": "^1.9.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-cwd": { - "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==", - "dev": true, - "dependencies": { - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve-cwd/node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/schema-utils": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", - "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/serialize-javascript": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", - "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", - "dev": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/shallow-clone": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", - "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", - "dev": true, - "dependencies": { - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/simple-update-notifier": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", - "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", - "dev": true, - "dependencies": { - "semver": "~7.0.0" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/simple-update-notifier/node_modules/semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "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==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/table": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", - "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", - "dev": true, - "dependencies": { - "ajv": "^8.0.1", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/table/node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/table/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/tapable": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", - "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/terser": { - "version": "5.16.6", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.6.tgz", - "integrity": "sha512-IBZ+ZQIA9sMaXmRZCUMDjNH0D5AQQfdn4WUjHL0+1lF4TP1IHRJbrhb6fNaXWikrYQTSkb7SLxkeXAiy1p7mbg==", - "dev": true, - "dependencies": { - "@jridgewell/source-map": "^0.3.2", - "acorn": "^8.5.0", - "commander": "^2.20.0", - "source-map-support": "~0.5.20" - }, - "bin": { - "terser": "bin/terser" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/terser-webpack-plugin": { - "version": "5.3.7", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.7.tgz", - "integrity": "sha512-AfKwIktyP7Cu50xNjXF/6Qb5lBNzYaWpU6YfoX3uZicTx0zTy0stDDCsvjDapKsSDvOeWo5MEq4TmdBy2cNoHw==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.17", - "jest-worker": "^27.4.5", - "schema-utils": "^3.1.1", - "serialize-javascript": "^6.0.1", - "terser": "^5.16.5" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.1.0" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "esbuild": { - "optional": true - }, - "uglify-js": { - "optional": true - } - } - }, - "node_modules/terser-webpack-plugin/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - }, - "node_modules/terser-webpack-plugin/node_modules/serialize-javascript": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", - "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", - "dev": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/terser/node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/touch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", - "dev": true, - "dependencies": { - "nopt": "~1.0.10" - }, - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, - "node_modules/ts-loader": { - "version": "9.4.2", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.2.tgz", - "integrity": "sha512-OmlC4WVmFv5I0PpaxYb+qGeGOdm5giHU7HwDDUjw59emP2UYMHy9fFSDcYgSNoH8sXcj4hGCSEhlDZ9ULeDraA==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" - } - }, - "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/ts-node/node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ts-node/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/type-fest": { - "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==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true - }, - "node_modules/update-browserslist-db": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", - "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - } - ], - "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" - }, - "bin": { - "browserslist-lint": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/v8-compile-cache": { - "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==", - "dev": true - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, - "node_modules/watchpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", - "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", - "dev": true, - "dependencies": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/webpack": { - "version": "5.76.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.2.tgz", - "integrity": "sha512-Th05ggRm23rVzEOlX8y67NkYCHa9nTNcwHPBhdg+lKG+mtiW7XgggjAeeLnADAe7mLjJ6LUNfgHAuRRh+Z6J7w==", - "dev": true, - "dependencies": { - "@types/eslint-scope": "^3.7.3", - "@types/estree": "^0.0.51", - "@webassemblyjs/ast": "1.11.1", - "@webassemblyjs/wasm-edit": "1.11.1", - "@webassemblyjs/wasm-parser": "1.11.1", - "acorn": "^8.7.1", - "acorn-import-assertions": "^1.7.6", - "browserslist": "^4.14.5", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.10.0", - "es-module-lexer": "^0.9.0", - "eslint-scope": "5.1.1", - "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.9", - "json-parse-even-better-errors": "^2.3.1", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^3.1.0", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.1.3", - "watchpack": "^2.4.0", - "webpack-sources": "^3.2.3" - }, - "bin": { - "webpack": "bin/webpack.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependenciesMeta": { - "webpack-cli": { - "optional": true - } - } - }, - "node_modules/webpack-cli": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", - "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", - "dev": true, - "dependencies": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.2.0", - "@webpack-cli/info": "^1.5.0", - "@webpack-cli/serve": "^1.7.0", - "colorette": "^2.0.14", - "commander": "^7.0.0", - "cross-spawn": "^7.0.3", - "fastest-levenshtein": "^1.0.12", - "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", - "webpack-merge": "^5.7.3" - }, - "bin": { - "webpack-cli": "bin/cli.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "4.x.x || 5.x.x" - }, - "peerDependenciesMeta": { - "@webpack-cli/generators": { - "optional": true - }, - "@webpack-cli/migrate": { - "optional": true - }, - "webpack-bundle-analyzer": { - "optional": true - }, - "webpack-dev-server": { - "optional": true - } - } - }, - "node_modules/webpack-cli/node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "dev": true, - "engines": { - "node": ">= 10" - } - }, - "node_modules/webpack-merge": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", - "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", - "dev": true, - "dependencies": { - "clone-deep": "^4.0.1", - "wildcard": "^2.0.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/webpack-sources": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", - "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", - "dev": true, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/webpack/node_modules/@types/estree": { - "version": "0.0.51", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz", - "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", - "dev": true - }, - "node_modules/webpack/node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/webpack/node_modules/acorn-import-assertions": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", - "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", - "dev": true, - "peerDependencies": { - "acorn": "^8" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wildcard": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", - "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", - "dev": true - }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", - "dev": true - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/package.json b/package.json index 6487c88..31c8724 100644 --- a/package.json +++ b/package.json @@ -1,60 +1,25 @@ { - "name": "cohere-ai", - "version": "6.2.2", - "description": "A Node.js SDK with TypeScript support for the Cohere API.", - "homepage": "https://docs.cohere.ai", - "main": "index.js", - "types": "dist/cohere.d.ts", - "typings": "dist/cohere.d.ts", - "scripts": { - "build": "webpack --env production && mv cohere.d.ts dist/cohere.d.ts && rm services/*.d.ts && rm models/*.d.ts", - "dev": "webpack --progress --env development --env nodemon", - "test": "mocha -r ts-node/register test/test.ts", - "lint": "eslint . --ext .ts && prettier --check .", - "lint:fix": "prettier --write ." - }, - "files": [ - "/dist" - ], - "keywords": [ - "sdk", - "cohere", - "cohere.ai", - "javascript", - "node.js", - "typescript", - "sdk", - "api", - "natural", - "language" - ], - "author": "Cohere AI", - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/cohere-ai/cohere-node.git" - }, - "bugs": { - "url": "https://github.com/cohere-ai/cohere-node/issues" - }, - "devDependencies": { - "@types/chai": "^4.2.18", - "@types/mocha": "^8.2.2", - "@typescript-eslint/eslint-plugin": "^5.53.0", - "@typescript-eslint/parser": "^5.53.0", - "chai": "^4.3.4", - "clean-webpack-plugin": "^4.0.0-alpha.0", - "copy-webpack-plugin": "^8.1.1", - "eslint": "^7.27.0", - "eslint-config-prettier": "^8.5.0", - "eslint-webpack-plugin": "^2.5.4", - "mocha": "^10.0.0", - "nodemon-webpack-plugin": "^4.5.2", - "prettier": "^2.7.1", - "ts-loader": "^9.1.2", - "ts-node": "^10.8.1", - "typescript": "^4.9.5", - "webpack": "^5.37.0", - "webpack-cli": "^4.9.1" - } -} + "name": "cohere-ai", + "version": "7.0.0", + "private": false, + "repository": "https://github.com/cohere-ai/cohere-typescript", + "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", + "@types/url-join": "4.0.1", + "axios": "0.27.2", + "@ungap/url-search-params": "0.2.2", + "js-base64": "3.7.2" + }, + "devDependencies": { + "@types/node": "17.0.33", + "prettier": "2.7.1", + "typescript": "4.6.4" + } +} \ No newline at end of file diff --git a/services/api_service.ts b/services/api_service.ts deleted file mode 100644 index 5aed293..0000000 --- a/services/api_service.ts +++ /dev/null @@ -1,81 +0,0 @@ -import https = require("https"); -import { cohereResponse, cohereParameters, responseBody } from "../models"; -import errors from "./error_service"; - -interface APIService { - init(key: string): void; - post( - endpoint: string, - data: cohereParameters - ): Promise>; -} - -enum URL { - COHERE_API = "api.cohere.ai", -} - -class APIImpl implements APIService { - private COHERE_API_KEY = ""; - private COHERE_VERSION = "1"; - - public init(key: string): void { - this.COHERE_API_KEY = key; - } - - public async post( - endpoint: string, - data: cohereParameters - ): Promise> { - return new Promise((resolve, reject) => { - try { - // workaround for js projects that pass json strings. - data = JSON.parse(`${data}`); - } catch (e) {} - const reqData = JSON.stringify(data); - const req = https.request( - { - hostname: URL.COHERE_API, - path: `/v${this.COHERE_VERSION}${endpoint}`, - method: "POST", - headers: { - "Content-Type": "application/json; charset=utf-8", - "Content-Length": Buffer.byteLength(reqData, "utf8"), - Authorization: `Bearer ${this.COHERE_API_KEY}`, - "Request-Source": "node-sdk", - }, - timeout: 5000, - }, - (res) => { - const data: Uint8Array[] = []; - res.on("data", (chunk) => data.push(chunk)); - res.on("end", () => { - if ("x-api-warning" in res.headers) { - const warnHeader = res.headers["x-api-warning"]; - if (typeof warnHeader === "string") { - console.warn("\x1b[33mWarning: %s\x1b[0m", warnHeader); - } else { - for (const warning in warnHeader) { - console.warn("\x1b[33mWarning: %s\x1b[0m", warning); - } - } - } - resolve({ - statusCode: res.statusCode, - body: JSON.parse(Buffer.concat(data).toString()), - }); - }); - } - ); - - req.on("error", (error: Record) => - reject(errors.handleError(error)) - ); - - req.write(reqData, "utf8"); - req.end(); - }); - } -} - -const API = new APIImpl(); -export = API; diff --git a/services/error_service.ts b/services/error_service.ts deleted file mode 100644 index 826ac4c..0000000 --- a/services/error_service.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { cohereResponse, error } from "../models"; -interface cohereError { - response?: { - status?: number; - data?: { - message?: string; - }; - }; - message?: string; -} - -interface errorService { - handleError(error: cohereError): cohereResponse; -} - -class errorImpl implements errorService { - public handleError(error: cohereError): cohereResponse { - const status = error.response?.status || 500; - const message = error.response?.data?.message || error.message; - return { - statusCode: status, - body: { - message: message, - }, - }; - } -} - -const errors = new errorImpl(); -export = errors; diff --git a/src/Client.ts b/src/Client.ts new file mode 100644 index 0000000..425d1b5 --- /dev/null +++ b/src/Client.ts @@ -0,0 +1,559 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "./environments"; +import * as core from "./core"; +import * as Cohere from "./api"; +import * as serializers from "./serialization"; +import urlJoin from "url-join"; +import * as errors from "./errors"; + +export declare namespace CohereClient { + interface Options { + environment?: core.Supplier; + token: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + } +} + +export class CohereClient { + constructor(protected readonly _options: CohereClient.Options) {} + + /** + * This endpoint generates realistic text conditioned on a given input. + * @throws {@link Cohere.BadRequestError} + * @throws {@link Cohere.InternalServerError} + */ + public async generate( + request: Cohere.GenerateRequest, + requestOptions?: CohereClient.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/generate" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.0.0", + }, + contentType: "application/json", + body: await serializers.GenerateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + }); + if (_response.ok) { + return await serializers.Generation.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This endpoint returns text embeddings. An embedding is a list of floating point numbers that captures semantic information about the text that it represents. + * + * Embeddings can be used to create text classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page. + * + * If you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](/docs/semantic-search). + * @throws {@link Cohere.BadRequestError} + * @throws {@link Cohere.InternalServerError} + */ + public async embed( + request: Cohere.EmbedRequest, + requestOptions?: CohereClient.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/embed" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.0.0", + }, + contentType: "application/json", + body: await serializers.EmbedRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + }); + if (_response.ok) { + return await serializers.EmbedResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided `examples` of text + label pairs as a reference. + * Note: [Custom Models](/training-representation-models) trained on classification examples don't require the `examples` parameter to be passed in explicitly. + * @throws {@link Cohere.BadRequestError} + * @throws {@link Cohere.InternalServerError} + */ + public async classify( + request: Cohere.ClassifyRequest, + requestOptions?: CohereClient.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/classify" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.0.0", + }, + contentType: "application/json", + body: await serializers.ClassifyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + }); + if (_response.ok) { + return await serializers.ClassifyResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * The `chat` endpoint allows users to have conversations with a Large Language Model (LLM) from Cohere. Users can send messages as part of a persisted conversation using the `conversation_id` parameter, or they can pass in their own conversation history using the `chat_history` parameter. + * The endpoint features additional parameters such as `connectors` and `documents` that enable conversations enriched by external knowledge. We call this "Retrieval Augmented Generation", or "RAG". + * If you have questions or require support, we're here to help! Reach out to your Cohere partner to enable access to this API. + * + */ + public async chat( + request: Cohere.ChatRequest, + requestOptions?: CohereClient.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/chat" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.0.0", + }, + contentType: "application/json", + body: await serializers.ChatRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + }); + if (_response.ok) { + return await serializers.ChatResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This endpoint splits input text into smaller units called tokens using byte-pair encoding (BPE). To learn more about tokenization and byte pair encoding, see the tokens page. + * @throws {@link Cohere.BadRequestError} + * @throws {@link Cohere.InternalServerError} + */ + public async tokenize( + request: Cohere.TokenizeRequest, + requestOptions?: CohereClient.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/tokenize" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.0.0", + }, + contentType: "application/json", + body: await serializers.TokenizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + }); + if (_response.ok) { + return await serializers.TokenizeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Cohere.BadRequestError(_response.error.body); + case 500: + throw new Cohere.InternalServerError(_response.error.body); + default: + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This endpoint takes tokens using byte-pair encoding and returns their text representation. To learn more about tokenization and byte pair encoding, see the tokens page. + */ + public async detokenize( + request: Cohere.DetokenizeRequest, + requestOptions?: CohereClient.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/detokenize" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.0.0", + }, + contentType: "application/json", + body: await serializers.DetokenizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + }); + if (_response.ok) { + return await serializers.DetokenizeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This endpoint identifies which language each of the provided texts is written in. + */ + public async detectLanguage( + request: Cohere.DetectLanguageRequest, + requestOptions?: CohereClient.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/detect-language" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.0.0", + }, + contentType: "application/json", + body: await serializers.DetectLanguageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + }); + if (_response.ok) { + return await serializers.DetectLanguageResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This endpoint generates a summary in English for a given text. + */ + public async summarize( + request: Cohere.SummarizeRequest, + requestOptions?: CohereClient.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/summarize" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.0.0", + }, + contentType: "application/json", + body: await serializers.SummarizeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + }); + if (_response.ok) { + return await serializers.SummarizeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score. + */ + public async rerank( + request: Cohere.RerankRequest, + requestOptions?: CohereClient.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CohereEnvironment.Production, + "v1/rerank" + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "cohere-ai", + "X-Fern-SDK-Version": "7.0.0", + }, + contentType: "application/json", + body: await serializers.RerankRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + }); + if (_response.ok) { + return await serializers.RerankResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CohereError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CohereTimeoutError(); + case "unknown": + throw new errors.CohereError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader() { + return `Bearer ${await core.Supplier.get(this._options.token)}`; + } +} diff --git a/src/api/client/index.ts b/src/api/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/client/requests/ChatRequest.ts b/src/api/client/requests/ChatRequest.ts new file mode 100644 index 0000000..d6d6973 --- /dev/null +++ b/src/api/client/requests/ChatRequest.ts @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../.."; + +export interface ChatRequest { + /** + * Accepts a string. + * The chat message from the user to the model. + * + */ + message: string; + /** + * Defaults to `command`. + * The identifier of the model, which can be one of the existing Cohere models or the full ID for a [finetuned custom model](/docs/training-custom-models). + * Compatible Cohere models are `command` and `command-light` as well as the experimental `command-nightly` and `command-light-nightly` variants. Read more about [Cohere models](https://docs.cohere.com/docs/models). + * + */ + model?: string; + /** + * Defaults to `false`. + * When `true`, the response will be a JSON stream of events. The final event will contain the complete response, and will have an `event_type` of `"stream-end"`. + * Streaming is beneficial for user interfaces that render the contents of the response piece by piece, as it gets generated. + * + */ + stream?: boolean; + /** + * When specified, the default Cohere preamble will be replaced with the provided one. + * + */ + preambleOverride?: string; + /** + * A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's `message`. + * + */ + chatHistory?: Cohere.ChatMessage[]; + /** + * An alternative to `chat_history`. Previous conversations can be resumed by providing the conversation's identifier. The contents of `message` and the model's response will be stored as part of this conversation. + * If a conversation with this id does not already exist, a new conversation will be created. + * + */ + conversationId?: string; + /** + * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. + * Dictates how the prompt will be constructed. + * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. + * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. + * + */ + promptTruncation?: Cohere.ChatRequestPromptTruncation; + /** + * Currently only accepts `{"id": "web-search"}`. + * When specified, the model's reply will be enriched with information found by quering each of the connectors (RAG). + * + */ + connectors?: Cohere.ChatConnector[]; + /** + * Defaults to `false`. + * When `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated. + * + */ + searchQueriesOnly?: boolean; + /** + * A list of relevant documents that the model can use to enrich its reply (RAG). + * + */ + documents?: Cohere.ChatDocument[]; + /** + * Defaults to `"accurate"`. + * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results or `"fast"` results. + * + */ + citationQuality?: Cohere.ChatRequestCitationQuality; + /** + * Defaults to `0.3` + * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations. + * + */ + temperature?: number; +} diff --git a/src/api/client/requests/ClassifyRequest.ts b/src/api/client/requests/ClassifyRequest.ts new file mode 100644 index 0000000..e39c962 --- /dev/null +++ b/src/api/client/requests/ClassifyRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../.."; + +export interface ClassifyRequest { + /** Represents a list of queries to be classified, each entry must not be empty. The maximum is 96 inputs. */ + inputs: string[]; + /** + * An array of examples to provide context to the model. Each example is a text string and its associated label/class. Each unique label requires at least 2 examples associated with it; the maximum number of examples is 2500, and each example has a maximum length of 512 tokens. The values should be structured as `{text: "...",label: "..."}`. + * Note: [Custom Models](/training-representation-models) trained on classification examples don't require the `examples` parameter to be passed in explicitly. + */ + examples: Cohere.ClassifyRequestExamplesItem[]; + /** The identifier of the model. Currently available models are `embed-multilingual-v2.0`, `embed-english-light-v2.0`, and `embed-english-v2.0` (default). Smaller "light" models are faster, while larger models will perform better. [Custom models](/docs/training-custom-models) can also be supplied with their full ID. */ + model?: string; + /** The ID of a custom playground preset. You can create presets in the [playground](https://dashboard.cohere.ai/playground/classify?model=large). If you use a preset, all other parameters become optional, and any included parameters will override the preset's parameters. */ + preset?: string; + /** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ + truncate?: Cohere.ClassifyRequestTruncate; +} diff --git a/src/api/client/requests/DetectLanguageRequest.ts b/src/api/client/requests/DetectLanguageRequest.ts new file mode 100644 index 0000000..3ccaf55 --- /dev/null +++ b/src/api/client/requests/DetectLanguageRequest.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DetectLanguageRequest { + /** List of strings to run the detection on. */ + texts: string[]; +} diff --git a/src/api/client/requests/DetokenizeRequest.ts b/src/api/client/requests/DetokenizeRequest.ts new file mode 100644 index 0000000..fa20aa9 --- /dev/null +++ b/src/api/client/requests/DetokenizeRequest.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DetokenizeRequest { + /** The list of tokens to be detokenized. */ + tokens: number[]; + /** An optional parameter to provide the model name. This will ensure that the detokenization is done by the tokenizer used by that model. */ + model?: string; +} diff --git a/src/api/client/requests/EmbedRequest.ts b/src/api/client/requests/EmbedRequest.ts new file mode 100644 index 0000000..1a60aa9 --- /dev/null +++ b/src/api/client/requests/EmbedRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../.."; + +export interface EmbedRequest { + /** An array of strings for the model to embed. Maximum number of texts per call is `96`. We recommend reducing the length of each text to be under `512` tokens for optimal quality. */ + texts: string[]; + /** + * The identifier of the model. Smaller "light" models are faster, while larger models will perform better. [Custom models](/docs/training-custom-models) can also be supplied with their full ID. + * + * Available models and corresponding embedding dimensions: + * * `embed-english-v2.0` (default) 4096 + * * `embed-english-light-v2.0` 1024 + * * `embed-multilingual-v2.0` 768 + */ + model?: string; + /** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ + truncate?: Cohere.EmbedRequestTruncate; +} diff --git a/src/api/client/requests/GenerateRequest.ts b/src/api/client/requests/GenerateRequest.ts new file mode 100644 index 0000000..cef54a5 --- /dev/null +++ b/src/api/client/requests/GenerateRequest.ts @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../.."; + +export interface GenerateRequest { + /** + * The input text that serves as the starting point for generating the response. + * Note: The prompt will be pre-processed and modified before reaching the model. + * + */ + prompt: string; + /** + * The identifier of the model to generate with. Currently available models are `command` (default), `command-nightly` (experimental), `command-light`, and `command-light-nightly` (experimental). + * Smaller, "light" models are faster, while larger models will perform better. [Custom models](/docs/training-custom-models) can also be supplied with their full ID. + */ + model?: string; + /** + * The maximum number of generations that will be returned. Defaults to `1`, min value of `1`, max value of `5`. + * + */ + numGenerations?: number; + /** + * When `true`, the response will be a JSON stream of events. Streaming is beneficial for user interfaces that render the contents of the response piece by piece, as it gets generated. + * + * The final event will contain the complete response, and will contain an `is_finished` field set to `true`. The event will also contain a `finish_reason`, which can be one of the following: + * - `COMPLETE` - the model sent back a finished reply + * - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens for its context length + * - `ERROR` - something went wrong when generating the reply + * - `ERROR_TOXIC` - the model generated a reply that was deemed toxic + * + */ + stream?: boolean; + /** + * The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations. + * Defaults to `20`. See [BPE Tokens](/bpe-tokens-wiki) for more details. + * + * Can only be set to `0` if `return_likelihoods` is set to `ALL` to get the likelihood of the prompt. + * + */ + maxTokens?: number; + /** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ + truncate?: Cohere.GenerateRequestTruncate; + /** + * A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations. See [Temperature](/temperature-wiki) for more details. + * Defaults to `0.75`, min value of `0.0`, max value of `5.0`. + * + */ + temperature?: number; + /** + * Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.ai/playground/generate). + * When a preset is specified, the `prompt` parameter becomes optional, and any included parameters will override the preset's parameters. + * + */ + preset?: string; + /** The generated text will be cut at the beginning of the earliest occurence of an end sequence. The sequence will be excluded from the text. */ + endSequences?: string[]; + /** The generated text will be cut at the end of the earliest occurence of a stop sequence. The sequence will be included the text. */ + stopSequences?: string[]; + /** + * Ensures only the top `k` most likely tokens are considered for generation at each step. + * Defaults to `0`, min value of `0`, max value of `500`. + * + */ + k?: number; + /** + * Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`. + * Defaults to `0`. min value of `0.01`, max value of `0.99`. + * + */ + p?: number; + /** + * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.' + * + */ + frequencyPenalty?: number; + /** Defaults to `0.0`, min value of `0.0`, max value of `1.0`. Can be used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies. */ + presencePenalty?: number; + /** + * One of `GENERATION|ALL|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. + * + * If `GENERATION` is selected, the token likelihoods will only be provided for generated text. + * + * If `ALL` is selected, the token likelihoods will be provided both for the prompt and the generated text. + */ + returnLikelihoods?: Cohere.GenerateRequestReturnLikelihoods; + /** + * Used to prevent the model from generating unwanted tokens or to incentivize it to include desired tokens. The format is `{token_id: bias}` where bias is a float between -10 and 10. Tokens can be obtained from text using [Tokenize](/reference/tokenize). + * + * For example, if the value `{'11': -10}` is provided, the model will be very unlikely to include the token 11 (`"\n"`, the newline character) anywhere in the generated text. In contrast `{'11': 10}` will result in generations that nearly only contain that token. Values between -10 and 10 will proportionally affect the likelihood of the token appearing in the generated text. + * + * Note: logit bias may not be supported for all custom models. + */ + logitBias?: Record; +} diff --git a/src/api/client/requests/RerankRequest.ts b/src/api/client/requests/RerankRequest.ts new file mode 100644 index 0000000..799085a --- /dev/null +++ b/src/api/client/requests/RerankRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../.."; + +export interface RerankRequest { + /** The identifier of the model to use, one of : `rerank-english-v2.0`, `rerank-multilingual-v2.0` */ + model?: string; + /** The search query */ + query: string; + /** + * A list of document objects or strings to rerank. + * If a document is provided the text fields is required and all other fields will be preserved in the response. + * The total max chunks (length of documents * max_chunks_per_doc) must be less than 10000. + */ + documents: Cohere.RerankRequestDocumentsItem[]; + /** The number of most relevant documents or indices to return, defaults to the length of the documents */ + topN?: number; + /** + * - If false, returns results without the doc text - the api will return a list of {index, relevance score} where index is inferred from the list passed into the request. + * - If true, returns results with the doc text passed in - the api will return an ordered list of {index, text, relevance score} where index + text refers to the list passed into the request. + */ + returnDocuments?: boolean; + /** The maximum number of chunks to produce internally from a document */ + maxChunksPerDoc?: number; +} diff --git a/src/api/client/requests/SummarizeRequest.ts b/src/api/client/requests/SummarizeRequest.ts new file mode 100644 index 0000000..8d4ea13 --- /dev/null +++ b/src/api/client/requests/SummarizeRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from "../.."; + +export interface SummarizeRequest { + /** The text to generate a summary for. Can be up to 100,000 characters long. Currently the only supported language is English. */ + text: string; + /** One of `short`, `medium`, `long`, or `auto` defaults to `auto`. Indicates the approximate length of the summary. If `auto` is selected, the best option will be picked based on the input text. */ + length?: Cohere.SummarizeRequestLength; + /** One of `paragraph`, `bullets`, or `auto`, defaults to `auto`. Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If `auto` is selected, the best option will be picked based on the input text. */ + format?: Cohere.SummarizeRequestFormat; + /** The identifier of the model to generate the summary with. Currently available models are `command` (default), `command-nightly` (experimental), `command-light`, and `command-light-nightly` (experimental). Smaller, "light" models are faster, while larger models will perform better. */ + model?: Cohere.SummarizeRequestModel; + /** One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. Controls how close to the original text the summary is. `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness summaries will tend to paraphrase more. If `auto` is selected, the best option will be picked based on the input text. */ + extractiveness?: Cohere.SummarizeRequestExtractiveness; + /** Ranges from 0 to 5. Controls the randomness of the output. Lower values tend to generate more “predictable” output, while higher values tend to generate more “creative” output. The sweet spot is typically between 0 and 1. */ + temperature?: number; + /** A free-form instruction for modifying how the summaries get generated. Should complete the sentence "Generate a summary _". Eg. "focusing on the next steps" or "written by Yoda" */ + additionalCommand?: string; +} diff --git a/src/api/client/requests/TokenizeRequest.ts b/src/api/client/requests/TokenizeRequest.ts new file mode 100644 index 0000000..0411de4 --- /dev/null +++ b/src/api/client/requests/TokenizeRequest.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface TokenizeRequest { + /** The string to be tokenized, the minimum text length is 1 character, and the maximum text length is 65536 characters. */ + text: string; + /** An optional parameter to provide the model name. This will ensure that the tokenization uses the tokenizer used by that model. */ + model?: string; +} diff --git a/src/api/client/requests/index.ts b/src/api/client/requests/index.ts new file mode 100644 index 0000000..dc6691f --- /dev/null +++ b/src/api/client/requests/index.ts @@ -0,0 +1,9 @@ +export { GenerateRequest } from "./GenerateRequest"; +export { EmbedRequest } from "./EmbedRequest"; +export { ClassifyRequest } from "./ClassifyRequest"; +export { ChatRequest } from "./ChatRequest"; +export { TokenizeRequest } from "./TokenizeRequest"; +export { DetokenizeRequest } from "./DetokenizeRequest"; +export { DetectLanguageRequest } from "./DetectLanguageRequest"; +export { SummarizeRequest } from "./SummarizeRequest"; +export { RerankRequest } from "./RerankRequest"; diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts new file mode 100644 index 0000000..d53bf5f --- /dev/null +++ b/src/api/errors/BadRequestError.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors"; + +export class BadRequestError extends errors.CohereError { + constructor(body?: unknown) { + super({ + statusCode: 400, + body: body, + }); + Object.setPrototypeOf(this, BadRequestError.prototype); + } +} diff --git a/src/api/errors/InternalServerError.ts b/src/api/errors/InternalServerError.ts new file mode 100644 index 0000000..e52c7fc --- /dev/null +++ b/src/api/errors/InternalServerError.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors"; + +export class InternalServerError extends errors.CohereError { + constructor(body?: unknown) { + super({ + statusCode: 500, + body: body, + }); + Object.setPrototypeOf(this, InternalServerError.prototype); + } +} diff --git a/src/api/errors/index.ts b/src/api/errors/index.ts new file mode 100644 index 0000000..ae53904 --- /dev/null +++ b/src/api/errors/index.ts @@ -0,0 +1,2 @@ +export * from "./BadRequestError"; +export * from "./InternalServerError"; diff --git a/src/api/index.ts b/src/api/index.ts new file mode 100644 index 0000000..9dc8224 --- /dev/null +++ b/src/api/index.ts @@ -0,0 +1,3 @@ +export * from "./types"; +export * from "./errors"; +export * from "./client"; diff --git a/src/api/types/ApiMeta.ts b/src/api/types/ApiMeta.ts new file mode 100644 index 0000000..2f0de32 --- /dev/null +++ b/src/api/types/ApiMeta.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ApiMeta { + apiVersion?: Cohere.ApiMetaApiVersion; + warnings?: string[]; +} diff --git a/src/api/types/ApiMetaApiVersion.ts b/src/api/types/ApiMetaApiVersion.ts new file mode 100644 index 0000000..44f1591 --- /dev/null +++ b/src/api/types/ApiMetaApiVersion.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ApiMetaApiVersion { + version: string; + isDeprecated?: boolean; + isExperimental?: boolean; +} diff --git a/src/api/types/ChatCitation.ts b/src/api/types/ChatCitation.ts new file mode 100644 index 0000000..a1791b2 --- /dev/null +++ b/src/api/types/ChatCitation.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A section of the generated reply which cites external knowledge. + * + */ +export interface ChatCitation { + /** + * The index of text that the citation starts at, counting from zero. For example, a generation of `Hello, world!` with a citation on `world` would have a start value of `7`. This is because the citation starts at `w`, which is the seventh character. + * + */ + start: number; + /** + * The index of text that the citation ends after, counting from zero. For example, a generation of `Hello, world!` with a citation on `world` would have an end value of `11`. This is because the citation ends after `d`, which is the eleventh character. + * + */ + end: number; + /** + * The text of the citation. For example, a generation of `Hello, world!` with a citation of `world` would have a text value of `world`. + * + */ + text: string; + /** + * Identifiers of documents cited by this section of the generated reply. + * + */ + documentIds: string[]; +} diff --git a/src/api/types/ChatCitationGenerationEvent.ts b/src/api/types/ChatCitationGenerationEvent.ts new file mode 100644 index 0000000..13fe719 --- /dev/null +++ b/src/api/types/ChatCitationGenerationEvent.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ChatCitationGenerationEvent extends Cohere.ChatStreamEvent { + /** + * Citations for the generated reply. + * + */ + citations: Cohere.ChatCitation[]; +} diff --git a/src/api/types/ChatConnector.ts b/src/api/types/ChatConnector.ts new file mode 100644 index 0000000..cafe289 --- /dev/null +++ b/src/api/types/ChatConnector.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The connector used for fetching documents. + * + */ +export interface ChatConnector { + /** + * The identifier of the connector. Currently only 'web-search' is supported. + * + */ + id: string; + /** + * Provides the connector with different settings at request time. The key/value pairs of this object are specific to each connector. + * + * The supported options are: + * + * **web-search** + * + * **site** - The web search results will be restricted to this domain (and TLD) when specified. Only a single domain is specified, and subdomains are also accepted. + * Examples: + * * `{"options": {"site": "cohere.com"}}` would restrict the results to all subdomains at cohere.com + * * `{"options": {"site": "txt.cohere.com"}}` would restrict the results to `txt.cohere.com` + * + */ + options?: Record; +} diff --git a/src/api/types/ChatDocument.ts b/src/api/types/ChatDocument.ts new file mode 100644 index 0000000..62d55e7 --- /dev/null +++ b/src/api/types/ChatDocument.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Relevant information that could be used by the model to generate a more accurate reply. + * The contents of each document are generally short (under 300 words), and are passed in the form of a + * dictionary of strings. Some suggested keys are "text", "author", "date". Both the key name and the value will be + * passed to the model. + * + */ +export interface ChatDocument { + /** Unique identifier for this document. */ + id?: string; +} diff --git a/src/api/types/ChatMessage.ts b/src/api/types/ChatMessage.ts new file mode 100644 index 0000000..4444225 --- /dev/null +++ b/src/api/types/ChatMessage.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +/** + * A single message in a chat history. Contains the role of the sender, the text contents of the message, and optionally a username. + * + */ +export interface ChatMessage { + role: Cohere.ChatMessageRole; + message: string; + userName?: string; +} diff --git a/src/api/types/ChatMessageRole.ts b/src/api/types/ChatMessageRole.ts new file mode 100644 index 0000000..e624547 --- /dev/null +++ b/src/api/types/ChatMessageRole.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ChatMessageRole = "CHATBOT" | "USER"; + +export const ChatMessageRole = { + Chatbot: "CHATBOT", + User: "USER", +} as const; diff --git a/src/api/types/ChatRequestCitationQuality.ts b/src/api/types/ChatRequestCitationQuality.ts new file mode 100644 index 0000000..321d604 --- /dev/null +++ b/src/api/types/ChatRequestCitationQuality.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defaults to `"accurate"`. + * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results or `"fast"` results. + * + */ +export type ChatRequestCitationQuality = "fast" | "accurate"; + +export const ChatRequestCitationQuality = { + Fast: "fast", + Accurate: "accurate", +} as const; diff --git a/src/api/types/ChatRequestPromptTruncation.ts b/src/api/types/ChatRequestPromptTruncation.ts new file mode 100644 index 0000000..18f0858 --- /dev/null +++ b/src/api/types/ChatRequestPromptTruncation.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. + * Dictates how the prompt will be constructed. + * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. + * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned. + * + */ +export type ChatRequestPromptTruncation = "OFF" | "AUTO"; + +export const ChatRequestPromptTruncation = { + Off: "OFF", + Auto: "AUTO", +} as const; diff --git a/src/api/types/ChatResponse.ts b/src/api/types/ChatResponse.ts new file mode 100644 index 0000000..dd590fb --- /dev/null +++ b/src/api/types/ChatResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export type ChatResponse = + | Cohere.NonStreamedChatResponse + | Cohere.StreamedChatResponse + | Cohere.SearchQueriesOnlyResponse; diff --git a/src/api/types/ChatSearchQueriesGenerationEvent.ts b/src/api/types/ChatSearchQueriesGenerationEvent.ts new file mode 100644 index 0000000..fbf5450 --- /dev/null +++ b/src/api/types/ChatSearchQueriesGenerationEvent.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ChatSearchQueriesGenerationEvent extends Cohere.ChatStreamEvent { + /** Generated search queries, meant to be used as part of the RAG flow. */ + searchQueries: Cohere.ChatSearchQuery[]; +} diff --git a/src/api/types/ChatSearchQuery.ts b/src/api/types/ChatSearchQuery.ts new file mode 100644 index 0000000..528a92f --- /dev/null +++ b/src/api/types/ChatSearchQuery.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The generated search query. Contains the text of the query and a unique identifier for the query. + * + */ +export interface ChatSearchQuery { + /** + * The text of the search query. + * + */ + text: string; + /** + * Unique identifier for the generated search query. Useful for submitting feedback. + * + */ + generationId: string; +} diff --git a/src/api/types/ChatSearchResult.ts b/src/api/types/ChatSearchResult.ts new file mode 100644 index 0000000..abdbfde --- /dev/null +++ b/src/api/types/ChatSearchResult.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ChatSearchResult { + searchQuery: Cohere.ChatSearchQuery; + /** + * The connector from which this result comes from. + * + */ + connector: Cohere.ChatConnector; + /** + * Identifiers of documents found by this search query. + * + */ + documentIds: string[]; +} diff --git a/src/api/types/ChatSearchResultsEvent.ts b/src/api/types/ChatSearchResultsEvent.ts new file mode 100644 index 0000000..3128659 --- /dev/null +++ b/src/api/types/ChatSearchResultsEvent.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ChatSearchResultsEvent extends Cohere.ChatStreamEvent { + /** + * Conducted searches and the ids of documents retrieved from each of them. + * + */ + searchResults: Cohere.ChatSearchResult[]; + /** + * Documents fetched from searches or provided by the user. + * + */ + documents: Cohere.ChatDocument[]; +} diff --git a/src/api/types/ChatStreamEndEvent.ts b/src/api/types/ChatStreamEndEvent.ts new file mode 100644 index 0000000..6413e46 --- /dev/null +++ b/src/api/types/ChatStreamEndEvent.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ChatStreamEndEvent extends Cohere.ChatStreamEvent { + /** + * - `COMPLETE` - the model sent back a finished reply + * - `ERROR_LIMIT` - the reply was cut off because the model reached the maximum number of tokens for its context length + * - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens specified by the max_tokens parameter + * - `ERROR` - something went wrong when generating the reply + * - `ERROR_TOXIC` - the model generated a reply that was deemed toxic + * + */ + finishReason: Cohere.ChatStreamEndEventFinishReason; + /** + * The consolidated response from the model. Contains the generated reply and all the other information streamed back in the previous events. + * + */ + response: Cohere.ChatStreamEndEventResponse; +} diff --git a/src/api/types/ChatStreamEndEventFinishReason.ts b/src/api/types/ChatStreamEndEventFinishReason.ts new file mode 100644 index 0000000..62a4390 --- /dev/null +++ b/src/api/types/ChatStreamEndEventFinishReason.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * - `COMPLETE` - the model sent back a finished reply + * - `ERROR_LIMIT` - the reply was cut off because the model reached the maximum number of tokens for its context length + * - `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens specified by the max_tokens parameter + * - `ERROR` - something went wrong when generating the reply + * - `ERROR_TOXIC` - the model generated a reply that was deemed toxic + * + */ +export type ChatStreamEndEventFinishReason = "COMPLETE" | "ERROR_LIMIT" | "MAX_TOKENS" | "ERROR" | "ERROR_TOXIC"; + +export const ChatStreamEndEventFinishReason = { + Complete: "COMPLETE", + ErrorLimit: "ERROR_LIMIT", + MaxTokens: "MAX_TOKENS", + Error: "ERROR", + ErrorToxic: "ERROR_TOXIC", +} as const; diff --git a/src/api/types/ChatStreamEndEventResponse.ts b/src/api/types/ChatStreamEndEventResponse.ts new file mode 100644 index 0000000..dd5a740 --- /dev/null +++ b/src/api/types/ChatStreamEndEventResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +/** + * The consolidated response from the model. Contains the generated reply and all the other information streamed back in the previous events. + * + */ +export type ChatStreamEndEventResponse = Cohere.NonStreamedChatResponse | Cohere.SearchQueriesOnlyResponse; diff --git a/src/api/types/ChatStreamEvent.ts b/src/api/types/ChatStreamEvent.ts new file mode 100644 index 0000000..7fb7327 --- /dev/null +++ b/src/api/types/ChatStreamEvent.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ChatStreamEvent {} diff --git a/src/api/types/ChatStreamStartEvent.ts b/src/api/types/ChatStreamStartEvent.ts new file mode 100644 index 0000000..fbb7280 --- /dev/null +++ b/src/api/types/ChatStreamStartEvent.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ChatStreamStartEvent extends Cohere.ChatStreamEvent { + /** + * Unique identifier for the generated reply. Useful for submitting feedback. + * + */ + generationId: string; +} diff --git a/src/api/types/ChatTextGenerationEvent.ts b/src/api/types/ChatTextGenerationEvent.ts new file mode 100644 index 0000000..9e3ca9f --- /dev/null +++ b/src/api/types/ChatTextGenerationEvent.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ChatTextGenerationEvent extends Cohere.ChatStreamEvent { + /** + * The next batch of text generated by the model. + * + */ + text: string; +} diff --git a/src/api/types/ClassifyRequestExamplesItem.ts b/src/api/types/ClassifyRequestExamplesItem.ts new file mode 100644 index 0000000..afc0207 --- /dev/null +++ b/src/api/types/ClassifyRequestExamplesItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ClassifyRequestExamplesItem { + text?: string; + label?: string; +} diff --git a/src/api/types/ClassifyRequestTruncate.ts b/src/api/types/ClassifyRequestTruncate.ts new file mode 100644 index 0000000..8e5e9a1 --- /dev/null +++ b/src/api/types/ClassifyRequestTruncate.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ +export type ClassifyRequestTruncate = "NONE" | "START" | "END"; + +export const ClassifyRequestTruncate = { + None: "NONE", + Start: "START", + End: "END", +} as const; diff --git a/src/api/types/ClassifyResponse.ts b/src/api/types/ClassifyResponse.ts new file mode 100644 index 0000000..4ac7d89 --- /dev/null +++ b/src/api/types/ClassifyResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ClassifyResponse { + id: string; + classifications: Cohere.ClassifyResponseClassificationsItem[]; + meta?: Cohere.ApiMeta; +} diff --git a/src/api/types/ClassifyResponseClassificationsItem.ts b/src/api/types/ClassifyResponseClassificationsItem.ts new file mode 100644 index 0000000..11fd953 --- /dev/null +++ b/src/api/types/ClassifyResponseClassificationsItem.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface ClassifyResponseClassificationsItem { + id: string; + /** The input text that was classified */ + input?: string; + /** The predicted label for the associated query (only filled for single-label models) */ + prediction?: string; + /** An array containing the predicted labels for the associated query */ + predictions: string[]; + /** The confidence score for the top predicted class (only filled for single-label classification) */ + confidence?: number; + /** An array containing the confidence scores of all the predictions in the same order */ + confidences: number[]; + /** A map containing each label and its confidence score according to the classifier. All the confidence scores add up to 1. */ + labels: Record; + /** The type of classification performed */ + classificationType: Cohere.ClassifyResponseClassificationsItemClassificationType; +} diff --git a/src/api/types/ClassifyResponseClassificationsItemClassificationType.ts b/src/api/types/ClassifyResponseClassificationsItemClassificationType.ts new file mode 100644 index 0000000..c588edc --- /dev/null +++ b/src/api/types/ClassifyResponseClassificationsItemClassificationType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of classification performed + */ +export type ClassifyResponseClassificationsItemClassificationType = "single-label" | "multi-label"; + +export const ClassifyResponseClassificationsItemClassificationType = { + SingleLabel: "single-label", + MultiLabel: "multi-label", +} as const; diff --git a/src/api/types/ClassifyResponseClassificationsItemLabelsValue.ts b/src/api/types/ClassifyResponseClassificationsItemLabelsValue.ts new file mode 100644 index 0000000..7d5cfa5 --- /dev/null +++ b/src/api/types/ClassifyResponseClassificationsItemLabelsValue.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ClassifyResponseClassificationsItemLabelsValue { + confidence?: number; +} diff --git a/src/api/types/DetectLanguageResponse.ts b/src/api/types/DetectLanguageResponse.ts new file mode 100644 index 0000000..86d1691 --- /dev/null +++ b/src/api/types/DetectLanguageResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface DetectLanguageResponse { + /** List of languages, one per input text */ + results?: Cohere.DetectLanguageResponseResultsItem[]; + meta?: Cohere.ApiMeta; +} diff --git a/src/api/types/DetectLanguageResponseResultsItem.ts b/src/api/types/DetectLanguageResponseResultsItem.ts new file mode 100644 index 0000000..b69d103 --- /dev/null +++ b/src/api/types/DetectLanguageResponseResultsItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DetectLanguageResponseResultsItem { + languageName?: string; + languageCode?: string; +} diff --git a/src/api/types/DetokenizeResponse.ts b/src/api/types/DetokenizeResponse.ts new file mode 100644 index 0000000..f3a14ec --- /dev/null +++ b/src/api/types/DetokenizeResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface DetokenizeResponse { + /** A string representing the list of tokens. */ + text: string; + meta?: Cohere.ApiMeta; +} diff --git a/src/api/types/EmbedRequestTruncate.ts b/src/api/types/EmbedRequestTruncate.ts new file mode 100644 index 0000000..8786bd6 --- /dev/null +++ b/src/api/types/EmbedRequestTruncate.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ +export type EmbedRequestTruncate = "NONE" | "START" | "END"; + +export const EmbedRequestTruncate = { + None: "NONE", + Start: "START", + End: "END", +} as const; diff --git a/src/api/types/EmbedResponse.ts b/src/api/types/EmbedResponse.ts new file mode 100644 index 0000000..74469c5 --- /dev/null +++ b/src/api/types/EmbedResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface EmbedResponse { + id: string; + /** An array of embeddings, where each embedding is an array of floats. The length of the `embeddings` array will be the same as the length of the original `texts` array. */ + embeddings: number[][]; + /** The text entries for which embeddings were returned. */ + texts: string[]; + meta?: Cohere.ApiMeta; +} diff --git a/src/api/types/FinishReason.ts b/src/api/types/FinishReason.ts new file mode 100644 index 0000000..8313cb7 --- /dev/null +++ b/src/api/types/FinishReason.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type FinishReason = "COMPLETE" | "ERROR" | "ERROR_TOXIC" | "ERROR_LIMIT" | "USER_CANCEL" | "MAX_TOKENS"; + +export const FinishReason = { + Complete: "COMPLETE", + Error: "ERROR", + ErrorToxic: "ERROR_TOXIC", + ErrorLimit: "ERROR_LIMIT", + UserCancel: "USER_CANCEL", + MaxTokens: "MAX_TOKENS", +} as const; diff --git a/src/api/types/GenerateRequestReturnLikelihoods.ts b/src/api/types/GenerateRequestReturnLikelihoods.ts new file mode 100644 index 0000000..aaacd88 --- /dev/null +++ b/src/api/types/GenerateRequestReturnLikelihoods.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * One of `GENERATION|ALL|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. + * + * If `GENERATION` is selected, the token likelihoods will only be provided for generated text. + * + * If `ALL` is selected, the token likelihoods will be provided both for the prompt and the generated text. + */ +export type GenerateRequestReturnLikelihoods = "GENERATION" | "ALL" | "NONE"; + +export const GenerateRequestReturnLikelihoods = { + Generation: "GENERATION", + All: "ALL", + None: "NONE", +} as const; diff --git a/src/api/types/GenerateRequestTruncate.ts b/src/api/types/GenerateRequestTruncate.ts new file mode 100644 index 0000000..7e6654f --- /dev/null +++ b/src/api/types/GenerateRequestTruncate.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. + * + * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. + * + * If `NONE` is selected, when the input exceeds the maximum input token length an error will be returned. + */ +export type GenerateRequestTruncate = "NONE" | "START" | "END"; + +export const GenerateRequestTruncate = { + None: "NONE", + Start: "START", + End: "END", +} as const; diff --git a/src/api/types/Generation.ts b/src/api/types/Generation.ts new file mode 100644 index 0000000..de51102 --- /dev/null +++ b/src/api/types/Generation.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface Generation { + id: string; + /** Prompt used for generations. */ + prompt?: string; + /** List of generated results */ + generations: Cohere.SingleGeneration[]; + meta?: Cohere.ApiMeta; +} diff --git a/src/api/types/GenerationFinalResponse.ts b/src/api/types/GenerationFinalResponse.ts new file mode 100644 index 0000000..ed98265 --- /dev/null +++ b/src/api/types/GenerationFinalResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface GenerationFinalResponse { + isFinished: boolean; + finishReason?: Cohere.FinishReason; + response: Cohere.GenerationFinalResponseResponse; +} diff --git a/src/api/types/GenerationFinalResponseResponse.ts b/src/api/types/GenerationFinalResponseResponse.ts new file mode 100644 index 0000000..26bf537 --- /dev/null +++ b/src/api/types/GenerationFinalResponseResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface GenerationFinalResponseResponse { + id: string; + generations?: Cohere.SingleGenerationInStream; +} diff --git a/src/api/types/GenerationStream.ts b/src/api/types/GenerationStream.ts new file mode 100644 index 0000000..d73d158 --- /dev/null +++ b/src/api/types/GenerationStream.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GenerationStream { + /** A segment of text of the generation. */ + text: string; + /** Refers to the nth generation. Only present when `num_generations` is greater than zero. */ + index?: number; + isFinished: boolean; +} diff --git a/src/api/types/NonStreamedChatResponse.ts b/src/api/types/NonStreamedChatResponse.ts new file mode 100644 index 0000000..f3275a8 --- /dev/null +++ b/src/api/types/NonStreamedChatResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface NonStreamedChatResponse { + /** Contents of the reply generated by the model. */ + text: string; + /** Unique identifier for the generated reply. Useful for submitting feedback. */ + generationId: string; + /** Inline citations for the generated reply. */ + citations?: Cohere.ChatCitation[]; + /** Documents seen by the model when generating the reply. */ + documents?: Cohere.ChatDocument[]; + /** Generated search queries, meant to be used as part of the RAG flow. */ + searchQueries?: Cohere.ChatSearchQuery[]; + /** Documents retrieved from each of the conducted searches. */ + searchResults?: Cohere.ChatSearchResult[]; +} diff --git a/src/api/types/RerankRequestDocumentsItem.ts b/src/api/types/RerankRequestDocumentsItem.ts new file mode 100644 index 0000000..c75f707 --- /dev/null +++ b/src/api/types/RerankRequestDocumentsItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface RerankRequestDocumentsItem { + /** The text of the document to rerank. */ + text: string; +} diff --git a/src/api/types/RerankResponse.ts b/src/api/types/RerankResponse.ts new file mode 100644 index 0000000..412d910 --- /dev/null +++ b/src/api/types/RerankResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface RerankResponse { + id?: string; + /** An ordered list of ranked documents */ + results: Cohere.RerankResponseResultsItem[]; + meta?: Cohere.ApiMeta; +} diff --git a/src/api/types/RerankResponseResultsItem.ts b/src/api/types/RerankResponseResultsItem.ts new file mode 100644 index 0000000..d55985f --- /dev/null +++ b/src/api/types/RerankResponseResultsItem.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface RerankResponseResultsItem { + /** The doc object which was ranked */ + document?: Cohere.RerankResponseResultsItemDocument; + /** The index of the input document */ + index: number; + /** A relevance score assigned to the ranking */ + relevanceScore: number; +} diff --git a/src/api/types/RerankResponseResultsItemDocument.ts b/src/api/types/RerankResponseResultsItemDocument.ts new file mode 100644 index 0000000..261dfaf --- /dev/null +++ b/src/api/types/RerankResponseResultsItemDocument.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The doc object which was ranked + */ +export interface RerankResponseResultsItemDocument { + /** The text of the document to rerank */ + text: string; +} diff --git a/src/api/types/SearchQueriesOnlyResponse.ts b/src/api/types/SearchQueriesOnlyResponse.ts new file mode 100644 index 0000000..e104f41 --- /dev/null +++ b/src/api/types/SearchQueriesOnlyResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface SearchQueriesOnlyResponse { + /** Generated search queries, meant to be used as part of the RAG flow. */ + searchQueries: Cohere.ChatSearchQuery[]; +} diff --git a/src/api/types/SingleGeneration.ts b/src/api/types/SingleGeneration.ts new file mode 100644 index 0000000..8df1569 --- /dev/null +++ b/src/api/types/SingleGeneration.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface SingleGeneration { + id: string; + text: string; + /** Refers to the nth generation. Only present when `num_generations` is greater than zero. */ + index?: number; + likelihood?: number; + /** Only returned if `return_likelihoods` is set to `GENERATION` or `ALL`. The likelihood refers to the average log-likelihood of the entire specified string, which is useful for [evaluating the performance of your model](likelihood-eval), especially if you've created a [custom model](/docs/training-custom-models). Individual token likelihoods provide the log-likelihood of each token. The first token will not have a likelihood. */ + tokenLikelihoods?: Cohere.SingleGenerationTokenLikelihoodsItem[]; +} diff --git a/src/api/types/SingleGenerationInStream.ts b/src/api/types/SingleGenerationInStream.ts new file mode 100644 index 0000000..74a1644 --- /dev/null +++ b/src/api/types/SingleGenerationInStream.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface SingleGenerationInStream { + id: string; + /** Full text of the generation. */ + text: string; + /** Refers to the nth generation. Only present when `num_generations` is greater than zero. */ + index?: number; + finishReason: Cohere.FinishReason; +} diff --git a/src/api/types/SingleGenerationTokenLikelihoodsItem.ts b/src/api/types/SingleGenerationTokenLikelihoodsItem.ts new file mode 100644 index 0000000..533d9d8 --- /dev/null +++ b/src/api/types/SingleGenerationTokenLikelihoodsItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface SingleGenerationTokenLikelihoodsItem { + token: string; + likelihood: number; +} diff --git a/src/api/types/StreamedChatResponse.ts b/src/api/types/StreamedChatResponse.ts new file mode 100644 index 0000000..4f7e0bb --- /dev/null +++ b/src/api/types/StreamedChatResponse.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +/** + * StreamedChatResponse is returned in streaming mode (specified with `stream=True` in the request). + */ +export type StreamedChatResponse = + | Cohere.StreamedChatResponse.StreamStart + | Cohere.StreamedChatResponse.SearchQueriesGeneration + | Cohere.StreamedChatResponse.SearchResults + | Cohere.StreamedChatResponse.TextGeneration + | Cohere.StreamedChatResponse.CitationGeneration + | Cohere.StreamedChatResponse.StreamEnd; + +export declare namespace StreamedChatResponse { + interface StreamStart extends Cohere.ChatStreamStartEvent { + eventType: "stream-start"; + } + + interface SearchQueriesGeneration extends Cohere.ChatSearchQueriesGenerationEvent { + eventType: "search-queries-generation"; + } + + interface SearchResults extends Cohere.ChatSearchResultsEvent { + eventType: "search-results"; + } + + interface TextGeneration extends Cohere.ChatTextGenerationEvent { + eventType: "text-generation"; + } + + interface CitationGeneration extends Cohere.ChatCitationGenerationEvent { + eventType: "citation-generation"; + } + + interface StreamEnd extends Cohere.ChatStreamEndEvent { + eventType: "stream-end"; + } +} diff --git a/src/api/types/StreamedGeneration.ts b/src/api/types/StreamedGeneration.ts new file mode 100644 index 0000000..6c807e8 --- /dev/null +++ b/src/api/types/StreamedGeneration.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +/** + * Response in content type stream when `stream` is `true` in the request parameters. Generation tokens are streamed with the GenerationStream response. The final response is of type GenerationFinalResponse. + */ +export type StreamedGeneration = Cohere.StreamedGenerationItem[]; diff --git a/src/api/types/StreamedGenerationItem.ts b/src/api/types/StreamedGenerationItem.ts new file mode 100644 index 0000000..6ccc484 --- /dev/null +++ b/src/api/types/StreamedGenerationItem.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export type StreamedGenerationItem = Cohere.GenerationStream | Cohere.GenerationFinalResponse; diff --git a/src/api/types/SummarizeRequestExtractiveness.ts b/src/api/types/SummarizeRequestExtractiveness.ts new file mode 100644 index 0000000..d09b35c --- /dev/null +++ b/src/api/types/SummarizeRequestExtractiveness.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. Controls how close to the original text the summary is. `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness summaries will tend to paraphrase more. If `auto` is selected, the best option will be picked based on the input text. + */ +export type SummarizeRequestExtractiveness = "low" | "medium" | "high"; + +export const SummarizeRequestExtractiveness = { + Low: "low", + Medium: "medium", + High: "high", +} as const; diff --git a/src/api/types/SummarizeRequestFormat.ts b/src/api/types/SummarizeRequestFormat.ts new file mode 100644 index 0000000..0f69ec0 --- /dev/null +++ b/src/api/types/SummarizeRequestFormat.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * One of `paragraph`, `bullets`, or `auto`, defaults to `auto`. Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If `auto` is selected, the best option will be picked based on the input text. + */ +export type SummarizeRequestFormat = "paragraph" | "bullets"; + +export const SummarizeRequestFormat = { + Paragraph: "paragraph", + Bullets: "bullets", +} as const; diff --git a/src/api/types/SummarizeRequestLength.ts b/src/api/types/SummarizeRequestLength.ts new file mode 100644 index 0000000..b801f59 --- /dev/null +++ b/src/api/types/SummarizeRequestLength.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * One of `short`, `medium`, `long`, or `auto` defaults to `auto`. Indicates the approximate length of the summary. If `auto` is selected, the best option will be picked based on the input text. + */ +export type SummarizeRequestLength = "short" | "medium" | "long"; + +export const SummarizeRequestLength = { + Short: "short", + Medium: "medium", + Long: "long", +} as const; diff --git a/src/api/types/SummarizeRequestModel.ts b/src/api/types/SummarizeRequestModel.ts new file mode 100644 index 0000000..285db94 --- /dev/null +++ b/src/api/types/SummarizeRequestModel.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The identifier of the model to generate the summary with. Currently available models are `command` (default), `command-nightly` (experimental), `command-light`, and `command-light-nightly` (experimental). Smaller, "light" models are faster, while larger models will perform better. + */ +export type SummarizeRequestModel = "command" | "command-light"; + +export const SummarizeRequestModel = { + Command: "command", + CommandLight: "command-light", +} as const; diff --git a/src/api/types/SummarizeResponse.ts b/src/api/types/SummarizeResponse.ts new file mode 100644 index 0000000..64ad95a --- /dev/null +++ b/src/api/types/SummarizeResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface SummarizeResponse { + /** List of languages, one per input text */ + results?: Cohere.SummarizeResponseResultsItem[]; + meta?: Cohere.ApiMeta; +} diff --git a/src/api/types/SummarizeResponseResultsItem.ts b/src/api/types/SummarizeResponseResultsItem.ts new file mode 100644 index 0000000..5e868a6 --- /dev/null +++ b/src/api/types/SummarizeResponseResultsItem.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface SummarizeResponseResultsItem { + /** Generated ID for the summary */ + id?: string; + /** Generated summary for the text */ + summary?: string; +} diff --git a/src/api/types/TokenizeResponse.ts b/src/api/types/TokenizeResponse.ts new file mode 100644 index 0000000..5374803 --- /dev/null +++ b/src/api/types/TokenizeResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Cohere from ".."; + +export interface TokenizeResponse { + /** An array of tokens, where each token is an integer. */ + tokens: number[]; + tokenStrings: string[]; + meta?: Cohere.ApiMeta; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts new file mode 100644 index 0000000..7eb610f --- /dev/null +++ b/src/api/types/index.ts @@ -0,0 +1,58 @@ +export * from "./GenerateRequestTruncate"; +export * from "./GenerateRequestReturnLikelihoods"; +export * from "./EmbedRequestTruncate"; +export * from "./EmbedResponse"; +export * from "./ClassifyRequestExamplesItem"; +export * from "./ClassifyRequestTruncate"; +export * from "./ClassifyResponse"; +export * from "./ClassifyResponseClassificationsItem"; +export * from "./ClassifyResponseClassificationsItemLabelsValue"; +export * from "./ClassifyResponseClassificationsItemClassificationType"; +export * from "./ChatRequestPromptTruncation"; +export * from "./ChatRequestCitationQuality"; +export * from "./ChatResponse"; +export * from "./TokenizeResponse"; +export * from "./DetokenizeResponse"; +export * from "./DetectLanguageResponse"; +export * from "./DetectLanguageResponseResultsItem"; +export * from "./SummarizeRequestLength"; +export * from "./SummarizeRequestFormat"; +export * from "./SummarizeRequestModel"; +export * from "./SummarizeRequestExtractiveness"; +export * from "./SummarizeResponse"; +export * from "./SummarizeResponseResultsItem"; +export * from "./RerankRequestDocumentsItem"; +export * from "./RerankResponse"; +export * from "./RerankResponseResultsItem"; +export * from "./RerankResponseResultsItemDocument"; +export * from "./SingleGeneration"; +export * from "./SingleGenerationTokenLikelihoodsItem"; +export * from "./ApiMeta"; +export * from "./ApiMetaApiVersion"; +export * from "./Generation"; +export * from "./GenerationStream"; +export * from "./FinishReason"; +export * from "./SingleGenerationInStream"; +export * from "./GenerationFinalResponse"; +export * from "./GenerationFinalResponseResponse"; +export * from "./StreamedGeneration"; +export * from "./StreamedGenerationItem"; +export * from "./ChatMessage"; +export * from "./ChatMessageRole"; +export * from "./ChatConnector"; +export * from "./ChatDocument"; +export * from "./ChatCitation"; +export * from "./ChatSearchQuery"; +export * from "./ChatSearchResult"; +export * from "./NonStreamedChatResponse"; +export * from "./ChatStreamEvent"; +export * from "./ChatStreamStartEvent"; +export * from "./ChatSearchQueriesGenerationEvent"; +export * from "./ChatSearchResultsEvent"; +export * from "./ChatTextGenerationEvent"; +export * from "./ChatCitationGenerationEvent"; +export * from "./SearchQueriesOnlyResponse"; +export * from "./ChatStreamEndEvent"; +export * from "./ChatStreamEndEventFinishReason"; +export * from "./ChatStreamEndEventResponse"; +export * from "./StreamedChatResponse"; diff --git a/src/core/auth/BasicAuth.ts b/src/core/auth/BasicAuth.ts new file mode 100644 index 0000000..146df21 --- /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 0000000..fe987fc --- /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 0000000..ee293b3 --- /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/fetcher/APIResponse.ts b/src/core/fetcher/APIResponse.ts new file mode 100644 index 0000000..ea838f3 --- /dev/null +++ b/src/core/fetcher/APIResponse.ts @@ -0,0 +1,11 @@ +export type APIResponse = SuccessfulResponse | FailedResponse; + +export interface SuccessfulResponse { + ok: true; + body: T; +} + +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 0000000..6af0fb1 --- /dev/null +++ b/src/core/fetcher/Fetcher.ts @@ -0,0 +1,134 @@ +import { default as URLSearchParams } from "@ungap/url-search-params"; +import axios, { AxiosAdapter, AxiosError } from "axios"; +import { APIResponse } from "./APIResponse"; + +export type FetchFunction = (args: Fetcher.Args) => Promise>; + +export declare namespace Fetcher { + export interface Args { + url: string; + method: string; + contentType?: string; + headers?: Record; + queryParameters?: URLSearchParams; + body?: unknown; + timeoutMs?: number; + withCredentials?: boolean; + responseType?: "json" | "blob"; + adapter?: AxiosAdapter; + onUploadProgress?: (event: ProgressEvent) => void; + } + + 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; + } +} + +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; + } + } + } + + try { + const response = await axios({ + url: args.url, + params: args.queryParameters, + method: args.method, + headers, + data: args.body, + validateStatus: () => true, + transformResponse: (response) => response, + timeout: args.timeoutMs, + transitional: { + clarifyTimeoutError: true, + }, + withCredentials: args.withCredentials, + adapter: args.adapter, + onUploadProgress: args.onUploadProgress, + maxBodyLength: Infinity, + maxContentLength: Infinity, + responseType: args.responseType ?? "json", + }); + + let body: unknown; + if (args.responseType === "blob") { + body = response.data; + } else if (response.data != null && response.data.length > 0) { + try { + body = JSON.parse(response.data) ?? undefined; + } catch { + return { + ok: false, + error: { + reason: "non-json", + statusCode: response.status, + rawBody: response.data, + }, + }; + } + } + + if (response.status >= 200 && response.status < 400) { + return { + ok: true, + body: body as R, + }; + } else { + return { + ok: false, + error: { + reason: "status-code", + statusCode: response.status, + body, + }, + }; + } + } catch (error) { + if ((error as AxiosError).code === "ETIMEDOUT") { + return { + ok: false, + error: { + reason: "timeout", + }, + }; + } + + return { + ok: false, + error: { + reason: "unknown", + errorMessage: (error as AxiosError).message, + }, + }; + } +} + +export const fetcher: FetchFunction = fetcherImpl; diff --git a/src/core/fetcher/Supplier.ts b/src/core/fetcher/Supplier.ts new file mode 100644 index 0000000..867c931 --- /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/index.ts b/src/core/fetcher/index.ts new file mode 100644 index 0000000..6becab2 --- /dev/null +++ b/src/core/fetcher/index.ts @@ -0,0 +1,4 @@ +export type { APIResponse } from "./APIResponse"; +export { fetcher } from "./Fetcher"; +export type { Fetcher, FetchFunction } from "./Fetcher"; +export { Supplier } from "./Supplier"; diff --git a/src/core/index.ts b/src/core/index.ts new file mode 100644 index 0000000..e2eb66e --- /dev/null +++ b/src/core/index.ts @@ -0,0 +1,3 @@ +export * from "./fetcher"; +export * from "./auth"; +export * as serialization from "./schemas"; diff --git a/src/core/schemas/Schema.ts b/src/core/schemas/Schema.ts new file mode 100644 index 0000000..3211fa4 --- /dev/null +++ b/src/core/schemas/Schema.ts @@ -0,0 +1,93 @@ +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", + 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 0000000..b70f24b --- /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 0000000..187b290 --- /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 0000000..c1e24d6 --- /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 0000000..fe6faed --- /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 0000000..050cd2c --- /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 0000000..77420fb --- /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 0000000..a665472 --- /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 0000000..e48c016 --- /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 0000000..25f4bcc --- /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 0000000..b333321 --- /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/index.ts b/src/core/schemas/builders/literals/index.ts new file mode 100644 index 0000000..a4cd05c --- /dev/null +++ b/src/core/schemas/builders/literals/index.ts @@ -0,0 +1 @@ +export { stringLiteral } from "./stringLiteral"; diff --git a/src/core/schemas/builders/literals/stringLiteral.ts b/src/core/schemas/builders/literals/stringLiteral.ts new file mode 100644 index 0000000..3939b76 --- /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 0000000..270ea17 --- /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 0000000..c342e72 --- /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 0000000..75b3698 --- /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 0000000..e6db5b5 --- /dev/null +++ b/src/core/schemas/builders/object/index.ts @@ -0,0 +1,17 @@ +export { getObjectUtils, object } from "./object"; +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 0000000..4abadfb --- /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/property.ts b/src/core/schemas/builders/object/property.ts new file mode 100644 index 0000000..d245c4b --- /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 0000000..17cff4f --- /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 0000000..fcaeb04 --- /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 0000000..fad6056 --- /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 0000000..788f941 --- /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 0000000..c268945 --- /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 0000000..949f1f2 --- /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 0000000..4d52495 --- /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 0000000..82e25c5 --- /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 0000000..ac1cd22 --- /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 0000000..eb82cc7 --- /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 0000000..2b89ca0 --- /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 0000000..d056eb4 --- /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 0000000..0c0d379 --- /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 0000000..aa04e05 --- /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 0000000..4160f0a --- /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 0000000..f3310e8 --- /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 0000000..3113bcb --- /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 0000000..75b71cb --- /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 0000000..43e7108 --- /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 0000000..771dc6a --- /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 0000000..55065bc --- /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 0000000..85fc008 --- /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 0000000..6f82c86 --- /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 0000000..ed659be --- /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 0000000..5429d8b --- /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 0000000..9cd354b --- /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 0000000..4111d70 --- /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 0000000..de107cf --- /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 0000000..e122952 --- /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 0000000..2c25a34 --- /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 0000000..438012d --- /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 0000000..db82a72 --- /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 0000000..0186709 --- /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 0000000..99c02c3 --- /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 0000000..f58d6f3 --- /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/environments.ts b/src/environments.ts new file mode 100644 index 0000000..081ded8 --- /dev/null +++ b/src/environments.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export const CohereEnvironment = { + Production: "https://api.cohere.ai", +} as const; + +export type CohereEnvironment = typeof CohereEnvironment.Production; diff --git a/src/errors/CohereError.ts b/src/errors/CohereError.ts new file mode 100644 index 0000000..fba48dc --- /dev/null +++ b/src/errors/CohereError.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export class CohereError 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, CohereError.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/CohereTimeoutError.ts b/src/errors/CohereTimeoutError.ts new file mode 100644 index 0000000..6d1b46e --- /dev/null +++ b/src/errors/CohereTimeoutError.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export class CohereTimeoutError extends Error { + constructor() { + super("Timeout"); + Object.setPrototypeOf(this, CohereTimeoutError.prototype); + } +} diff --git a/src/errors/index.ts b/src/errors/index.ts new file mode 100644 index 0000000..5155e66 --- /dev/null +++ b/src/errors/index.ts @@ -0,0 +1,2 @@ +export { CohereError } from "./CohereError"; +export { CohereTimeoutError } from "./CohereTimeoutError"; diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..063313f --- /dev/null +++ b/src/index.ts @@ -0,0 +1,4 @@ +export * as Cohere from "./api"; +export { CohereClient } from "./Client"; +export { CohereEnvironment } from "./environments"; +export { CohereError, CohereTimeoutError } from "./errors"; diff --git a/src/serialization/client/index.ts b/src/serialization/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/client/requests/ChatRequest.ts b/src/serialization/client/requests/ChatRequest.ts new file mode 100644 index 0000000..2438697 --- /dev/null +++ b/src/serialization/client/requests/ChatRequest.ts @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../.."; +import * as Cohere from "../../../api"; +import * as core from "../../../core"; + +export const ChatRequest: core.serialization.Schema = + core.serialization.object({ + message: core.serialization.string(), + model: core.serialization.string().optional(), + stream: core.serialization.boolean().optional(), + preambleOverride: core.serialization.property("preamble_override", core.serialization.string().optional()), + chatHistory: core.serialization.property( + "chat_history", + core.serialization + .list(core.serialization.lazyObject(async () => (await import("../..")).ChatMessage)) + .optional() + ), + conversationId: core.serialization.property("conversation_id", core.serialization.string().optional()), + promptTruncation: core.serialization.property( + "prompt_truncation", + core.serialization.lazy(async () => (await import("../..")).ChatRequestPromptTruncation).optional() + ), + connectors: core.serialization + .list(core.serialization.lazyObject(async () => (await import("../..")).ChatConnector)) + .optional(), + searchQueriesOnly: core.serialization.property("search_queries_only", core.serialization.boolean().optional()), + documents: core.serialization + .list(core.serialization.lazyObject(async () => (await import("../..")).ChatDocument)) + .optional(), + citationQuality: core.serialization.property( + "citation_quality", + core.serialization.lazy(async () => (await import("../..")).ChatRequestCitationQuality).optional() + ), + temperature: core.serialization.number().optional(), + }); + +export declare namespace ChatRequest { + interface Raw { + message: string; + model?: string | null; + stream?: boolean | null; + preamble_override?: string | null; + chat_history?: serializers.ChatMessage.Raw[] | null; + conversation_id?: string | null; + prompt_truncation?: serializers.ChatRequestPromptTruncation.Raw | null; + connectors?: serializers.ChatConnector.Raw[] | null; + search_queries_only?: boolean | null; + documents?: serializers.ChatDocument.Raw[] | null; + citation_quality?: serializers.ChatRequestCitationQuality.Raw | null; + temperature?: number | null; + } +} diff --git a/src/serialization/client/requests/ClassifyRequest.ts b/src/serialization/client/requests/ClassifyRequest.ts new file mode 100644 index 0000000..e9ca21d --- /dev/null +++ b/src/serialization/client/requests/ClassifyRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../.."; +import * as Cohere from "../../../api"; +import * as core from "../../../core"; + +export const ClassifyRequest: core.serialization.Schema = + core.serialization.object({ + inputs: core.serialization.list(core.serialization.string()), + examples: core.serialization.list( + core.serialization.lazyObject(async () => (await import("../..")).ClassifyRequestExamplesItem) + ), + model: core.serialization.string().optional(), + preset: core.serialization.string().optional(), + truncate: core.serialization.lazy(async () => (await import("../..")).ClassifyRequestTruncate).optional(), + }); + +export declare namespace ClassifyRequest { + interface Raw { + inputs: string[]; + examples: serializers.ClassifyRequestExamplesItem.Raw[]; + model?: string | null; + preset?: string | null; + truncate?: serializers.ClassifyRequestTruncate.Raw | null; + } +} diff --git a/src/serialization/client/requests/DetectLanguageRequest.ts b/src/serialization/client/requests/DetectLanguageRequest.ts new file mode 100644 index 0000000..1c3c280 --- /dev/null +++ b/src/serialization/client/requests/DetectLanguageRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../.."; +import * as Cohere from "../../../api"; +import * as core from "../../../core"; + +export const DetectLanguageRequest: core.serialization.Schema< + serializers.DetectLanguageRequest.Raw, + Cohere.DetectLanguageRequest +> = core.serialization.object({ + texts: core.serialization.list(core.serialization.string()), +}); + +export declare namespace DetectLanguageRequest { + interface Raw { + texts: string[]; + } +} diff --git a/src/serialization/client/requests/DetokenizeRequest.ts b/src/serialization/client/requests/DetokenizeRequest.ts new file mode 100644 index 0000000..5984b7c --- /dev/null +++ b/src/serialization/client/requests/DetokenizeRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../.."; +import * as Cohere from "../../../api"; +import * as core from "../../../core"; + +export const DetokenizeRequest: core.serialization.Schema = + core.serialization.object({ + tokens: core.serialization.list(core.serialization.number()), + model: core.serialization.string().optional(), + }); + +export declare namespace DetokenizeRequest { + interface Raw { + tokens: number[]; + model?: string | null; + } +} diff --git a/src/serialization/client/requests/EmbedRequest.ts b/src/serialization/client/requests/EmbedRequest.ts new file mode 100644 index 0000000..38e6a0b --- /dev/null +++ b/src/serialization/client/requests/EmbedRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../.."; +import * as Cohere from "../../../api"; +import * as core from "../../../core"; + +export const EmbedRequest: core.serialization.Schema = + core.serialization.object({ + texts: core.serialization.list(core.serialization.string()), + model: core.serialization.string().optional(), + truncate: core.serialization.lazy(async () => (await import("../..")).EmbedRequestTruncate).optional(), + }); + +export declare namespace EmbedRequest { + interface Raw { + texts: string[]; + model?: string | null; + truncate?: serializers.EmbedRequestTruncate.Raw | null; + } +} diff --git a/src/serialization/client/requests/GenerateRequest.ts b/src/serialization/client/requests/GenerateRequest.ts new file mode 100644 index 0000000..3f361d0 --- /dev/null +++ b/src/serialization/client/requests/GenerateRequest.ts @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../.."; +import * as Cohere from "../../../api"; +import * as core from "../../../core"; + +export const GenerateRequest: core.serialization.Schema = + core.serialization.object({ + prompt: core.serialization.string(), + model: core.serialization.string().optional(), + numGenerations: core.serialization.property("num_generations", core.serialization.number().optional()), + stream: core.serialization.boolean().optional(), + maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), + truncate: core.serialization.lazy(async () => (await import("../..")).GenerateRequestTruncate).optional(), + temperature: core.serialization.number().optional(), + preset: core.serialization.string().optional(), + endSequences: core.serialization.property( + "end_sequences", + core.serialization.list(core.serialization.string()).optional() + ), + stopSequences: core.serialization.property( + "stop_sequences", + core.serialization.list(core.serialization.string()).optional() + ), + k: core.serialization.number().optional(), + p: core.serialization.number().optional(), + frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), + presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), + returnLikelihoods: core.serialization.property( + "return_likelihoods", + core.serialization.lazy(async () => (await import("../..")).GenerateRequestReturnLikelihoods).optional() + ), + logitBias: core.serialization.property( + "logit_bias", + core.serialization.record(core.serialization.string(), core.serialization.number()).optional() + ), + }); + +export declare namespace GenerateRequest { + interface Raw { + prompt: string; + model?: string | null; + num_generations?: number | null; + stream?: boolean | null; + max_tokens?: number | null; + truncate?: serializers.GenerateRequestTruncate.Raw | null; + temperature?: number | null; + preset?: string | null; + end_sequences?: string[] | null; + stop_sequences?: string[] | null; + k?: number | null; + p?: number | null; + frequency_penalty?: number | null; + presence_penalty?: number | null; + return_likelihoods?: serializers.GenerateRequestReturnLikelihoods.Raw | null; + logit_bias?: Record | null; + } +} diff --git a/src/serialization/client/requests/RerankRequest.ts b/src/serialization/client/requests/RerankRequest.ts new file mode 100644 index 0000000..97f3dea --- /dev/null +++ b/src/serialization/client/requests/RerankRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../.."; +import * as Cohere from "../../../api"; +import * as core from "../../../core"; + +export const RerankRequest: core.serialization.Schema = + core.serialization.object({ + model: core.serialization.string().optional(), + query: core.serialization.string(), + documents: core.serialization.list( + core.serialization.lazyObject(async () => (await import("../..")).RerankRequestDocumentsItem) + ), + topN: core.serialization.property("top_n", core.serialization.number().optional()), + returnDocuments: core.serialization.property("return_documents", core.serialization.boolean().optional()), + maxChunksPerDoc: core.serialization.property("max_chunks_per_doc", core.serialization.number().optional()), + }); + +export declare namespace RerankRequest { + interface Raw { + model?: string | null; + query: string; + documents: serializers.RerankRequestDocumentsItem.Raw[]; + top_n?: number | null; + return_documents?: boolean | null; + max_chunks_per_doc?: number | null; + } +} diff --git a/src/serialization/client/requests/SummarizeRequest.ts b/src/serialization/client/requests/SummarizeRequest.ts new file mode 100644 index 0000000..f73f63f --- /dev/null +++ b/src/serialization/client/requests/SummarizeRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../.."; +import * as Cohere from "../../../api"; +import * as core from "../../../core"; + +export const SummarizeRequest: core.serialization.Schema = + core.serialization.object({ + text: core.serialization.string(), + length: core.serialization.lazy(async () => (await import("../..")).SummarizeRequestLength).optional(), + format: core.serialization.lazy(async () => (await import("../..")).SummarizeRequestFormat).optional(), + model: core.serialization.lazy(async () => (await import("../..")).SummarizeRequestModel).optional(), + extractiveness: core.serialization + .lazy(async () => (await import("../..")).SummarizeRequestExtractiveness) + .optional(), + temperature: core.serialization.number().optional(), + additionalCommand: core.serialization.property("additional_command", core.serialization.string().optional()), + }); + +export declare namespace SummarizeRequest { + interface Raw { + text: string; + length?: serializers.SummarizeRequestLength.Raw | null; + format?: serializers.SummarizeRequestFormat.Raw | null; + model?: serializers.SummarizeRequestModel.Raw | null; + extractiveness?: serializers.SummarizeRequestExtractiveness.Raw | null; + temperature?: number | null; + additional_command?: string | null; + } +} diff --git a/src/serialization/client/requests/TokenizeRequest.ts b/src/serialization/client/requests/TokenizeRequest.ts new file mode 100644 index 0000000..ca1fa76 --- /dev/null +++ b/src/serialization/client/requests/TokenizeRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../.."; +import * as Cohere from "../../../api"; +import * as core from "../../../core"; + +export const TokenizeRequest: core.serialization.Schema = + core.serialization.object({ + text: core.serialization.string(), + model: core.serialization.string().optional(), + }); + +export declare namespace TokenizeRequest { + interface Raw { + text: string; + model?: string | null; + } +} diff --git a/src/serialization/client/requests/index.ts b/src/serialization/client/requests/index.ts new file mode 100644 index 0000000..dc6691f --- /dev/null +++ b/src/serialization/client/requests/index.ts @@ -0,0 +1,9 @@ +export { GenerateRequest } from "./GenerateRequest"; +export { EmbedRequest } from "./EmbedRequest"; +export { ClassifyRequest } from "./ClassifyRequest"; +export { ChatRequest } from "./ChatRequest"; +export { TokenizeRequest } from "./TokenizeRequest"; +export { DetokenizeRequest } from "./DetokenizeRequest"; +export { DetectLanguageRequest } from "./DetectLanguageRequest"; +export { SummarizeRequest } from "./SummarizeRequest"; +export { RerankRequest } from "./RerankRequest"; diff --git a/src/serialization/index.ts b/src/serialization/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/types/ApiMeta.ts b/src/serialization/types/ApiMeta.ts new file mode 100644 index 0000000..44bda46 --- /dev/null +++ b/src/serialization/types/ApiMeta.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ApiMeta: core.serialization.ObjectSchema = + core.serialization.object({ + apiVersion: core.serialization.property( + "api_version", + core.serialization.lazyObject(async () => (await import("..")).ApiMetaApiVersion).optional() + ), + warnings: core.serialization.list(core.serialization.string()).optional(), + }); + +export declare namespace ApiMeta { + interface Raw { + api_version?: serializers.ApiMetaApiVersion.Raw | null; + warnings?: string[] | null; + } +} diff --git a/src/serialization/types/ApiMetaApiVersion.ts b/src/serialization/types/ApiMetaApiVersion.ts new file mode 100644 index 0000000..986e8a1 --- /dev/null +++ b/src/serialization/types/ApiMetaApiVersion.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ApiMetaApiVersion: core.serialization.ObjectSchema< + serializers.ApiMetaApiVersion.Raw, + Cohere.ApiMetaApiVersion +> = core.serialization.object({ + version: core.serialization.string(), + isDeprecated: core.serialization.property("is_deprecated", core.serialization.boolean().optional()), + isExperimental: core.serialization.property("is_experimental", core.serialization.boolean().optional()), +}); + +export declare namespace ApiMetaApiVersion { + interface Raw { + version: string; + is_deprecated?: boolean | null; + is_experimental?: boolean | null; + } +} diff --git a/src/serialization/types/ChatCitation.ts b/src/serialization/types/ChatCitation.ts new file mode 100644 index 0000000..09d1350 --- /dev/null +++ b/src/serialization/types/ChatCitation.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatCitation: core.serialization.ObjectSchema = + core.serialization.object({ + start: core.serialization.number(), + end: core.serialization.number(), + text: core.serialization.string(), + documentIds: core.serialization.property("document_ids", core.serialization.list(core.serialization.string())), + }); + +export declare namespace ChatCitation { + interface Raw { + start: number; + end: number; + text: string; + document_ids: string[]; + } +} diff --git a/src/serialization/types/ChatCitationGenerationEvent.ts b/src/serialization/types/ChatCitationGenerationEvent.ts new file mode 100644 index 0000000..5a83e7c --- /dev/null +++ b/src/serialization/types/ChatCitationGenerationEvent.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatCitationGenerationEvent: core.serialization.ObjectSchema< + serializers.ChatCitationGenerationEvent.Raw, + Cohere.ChatCitationGenerationEvent +> = core.serialization + .object({ + citations: core.serialization.list( + core.serialization.lazyObject(async () => (await import("..")).ChatCitation) + ), + }) + .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + +export declare namespace ChatCitationGenerationEvent { + interface Raw extends serializers.ChatStreamEvent.Raw { + citations: serializers.ChatCitation.Raw[]; + } +} diff --git a/src/serialization/types/ChatConnector.ts b/src/serialization/types/ChatConnector.ts new file mode 100644 index 0000000..3766ab1 --- /dev/null +++ b/src/serialization/types/ChatConnector.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatConnector: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + options: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + }); + +export declare namespace ChatConnector { + interface Raw { + id: string; + options?: Record | null; + } +} diff --git a/src/serialization/types/ChatDocument.ts b/src/serialization/types/ChatDocument.ts new file mode 100644 index 0000000..de1dabc --- /dev/null +++ b/src/serialization/types/ChatDocument.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatDocument: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + }); + +export declare namespace ChatDocument { + interface Raw { + id?: string | null; + } +} diff --git a/src/serialization/types/ChatMessage.ts b/src/serialization/types/ChatMessage.ts new file mode 100644 index 0000000..0c00964 --- /dev/null +++ b/src/serialization/types/ChatMessage.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatMessage: core.serialization.ObjectSchema = + core.serialization.object({ + role: core.serialization.lazy(async () => (await import("..")).ChatMessageRole), + message: core.serialization.string(), + userName: core.serialization.property("user_name", core.serialization.string().optional()), + }); + +export declare namespace ChatMessage { + interface Raw { + role: serializers.ChatMessageRole.Raw; + message: string; + user_name?: string | null; + } +} diff --git a/src/serialization/types/ChatMessageRole.ts b/src/serialization/types/ChatMessageRole.ts new file mode 100644 index 0000000..0913e32 --- /dev/null +++ b/src/serialization/types/ChatMessageRole.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatMessageRole: core.serialization.Schema = + core.serialization.enum_(["CHATBOT", "USER"]); + +export declare namespace ChatMessageRole { + type Raw = "CHATBOT" | "USER"; +} diff --git a/src/serialization/types/ChatRequestCitationQuality.ts b/src/serialization/types/ChatRequestCitationQuality.ts new file mode 100644 index 0000000..f1d95b3 --- /dev/null +++ b/src/serialization/types/ChatRequestCitationQuality.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatRequestCitationQuality: core.serialization.Schema< + serializers.ChatRequestCitationQuality.Raw, + Cohere.ChatRequestCitationQuality +> = core.serialization.enum_(["fast", "accurate"]); + +export declare namespace ChatRequestCitationQuality { + type Raw = "fast" | "accurate"; +} diff --git a/src/serialization/types/ChatRequestPromptTruncation.ts b/src/serialization/types/ChatRequestPromptTruncation.ts new file mode 100644 index 0000000..2ca0e3f --- /dev/null +++ b/src/serialization/types/ChatRequestPromptTruncation.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatRequestPromptTruncation: core.serialization.Schema< + serializers.ChatRequestPromptTruncation.Raw, + Cohere.ChatRequestPromptTruncation +> = core.serialization.enum_(["OFF", "AUTO"]); + +export declare namespace ChatRequestPromptTruncation { + type Raw = "OFF" | "AUTO"; +} diff --git a/src/serialization/types/ChatResponse.ts b/src/serialization/types/ChatResponse.ts new file mode 100644 index 0000000..689f647 --- /dev/null +++ b/src/serialization/types/ChatResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatResponse: core.serialization.Schema = + core.serialization.undiscriminatedUnion([ + core.serialization.lazyObject(async () => (await import("..")).NonStreamedChatResponse), + core.serialization.lazy(async () => (await import("..")).StreamedChatResponse), + core.serialization.lazyObject(async () => (await import("..")).SearchQueriesOnlyResponse), + ]); + +export declare namespace ChatResponse { + type Raw = + | serializers.NonStreamedChatResponse.Raw + | serializers.StreamedChatResponse.Raw + | serializers.SearchQueriesOnlyResponse.Raw; +} diff --git a/src/serialization/types/ChatSearchQueriesGenerationEvent.ts b/src/serialization/types/ChatSearchQueriesGenerationEvent.ts new file mode 100644 index 0000000..7eac14f --- /dev/null +++ b/src/serialization/types/ChatSearchQueriesGenerationEvent.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatSearchQueriesGenerationEvent: core.serialization.ObjectSchema< + serializers.ChatSearchQueriesGenerationEvent.Raw, + Cohere.ChatSearchQueriesGenerationEvent +> = core.serialization + .object({ + searchQueries: core.serialization.property( + "search_queries", + core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).ChatSearchQuery)) + ), + }) + .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + +export declare namespace ChatSearchQueriesGenerationEvent { + interface Raw extends serializers.ChatStreamEvent.Raw { + search_queries: serializers.ChatSearchQuery.Raw[]; + } +} diff --git a/src/serialization/types/ChatSearchQuery.ts b/src/serialization/types/ChatSearchQuery.ts new file mode 100644 index 0000000..3f6fa37 --- /dev/null +++ b/src/serialization/types/ChatSearchQuery.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatSearchQuery: core.serialization.ObjectSchema = + core.serialization.object({ + text: core.serialization.string(), + generationId: core.serialization.property("generation_id", core.serialization.string()), + }); + +export declare namespace ChatSearchQuery { + interface Raw { + text: string; + generation_id: string; + } +} diff --git a/src/serialization/types/ChatSearchResult.ts b/src/serialization/types/ChatSearchResult.ts new file mode 100644 index 0000000..478dbc7 --- /dev/null +++ b/src/serialization/types/ChatSearchResult.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatSearchResult: core.serialization.ObjectSchema< + serializers.ChatSearchResult.Raw, + Cohere.ChatSearchResult +> = core.serialization.object({ + searchQuery: core.serialization.property( + "search_query", + core.serialization.lazyObject(async () => (await import("..")).ChatSearchQuery) + ), + connector: core.serialization.lazyObject(async () => (await import("..")).ChatConnector), + documentIds: core.serialization.property("document_ids", core.serialization.list(core.serialization.string())), +}); + +export declare namespace ChatSearchResult { + interface Raw { + search_query: serializers.ChatSearchQuery.Raw; + connector: serializers.ChatConnector.Raw; + document_ids: string[]; + } +} diff --git a/src/serialization/types/ChatSearchResultsEvent.ts b/src/serialization/types/ChatSearchResultsEvent.ts new file mode 100644 index 0000000..ea97a2b --- /dev/null +++ b/src/serialization/types/ChatSearchResultsEvent.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatSearchResultsEvent: core.serialization.ObjectSchema< + serializers.ChatSearchResultsEvent.Raw, + Cohere.ChatSearchResultsEvent +> = core.serialization + .object({ + searchResults: core.serialization.property( + "search_results", + core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).ChatSearchResult)) + ), + documents: core.serialization.list( + core.serialization.lazyObject(async () => (await import("..")).ChatDocument) + ), + }) + .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + +export declare namespace ChatSearchResultsEvent { + interface Raw extends serializers.ChatStreamEvent.Raw { + search_results: serializers.ChatSearchResult.Raw[]; + documents: serializers.ChatDocument.Raw[]; + } +} diff --git a/src/serialization/types/ChatStreamEndEvent.ts b/src/serialization/types/ChatStreamEndEvent.ts new file mode 100644 index 0000000..9d5876b --- /dev/null +++ b/src/serialization/types/ChatStreamEndEvent.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatStreamEndEvent: core.serialization.ObjectSchema< + serializers.ChatStreamEndEvent.Raw, + Cohere.ChatStreamEndEvent +> = core.serialization + .object({ + finishReason: core.serialization.property( + "finish_reason", + core.serialization.lazy(async () => (await import("..")).ChatStreamEndEventFinishReason) + ), + response: core.serialization.lazy(async () => (await import("..")).ChatStreamEndEventResponse), + }) + .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + +export declare namespace ChatStreamEndEvent { + interface Raw extends serializers.ChatStreamEvent.Raw { + finish_reason: serializers.ChatStreamEndEventFinishReason.Raw; + response: serializers.ChatStreamEndEventResponse.Raw; + } +} diff --git a/src/serialization/types/ChatStreamEndEventFinishReason.ts b/src/serialization/types/ChatStreamEndEventFinishReason.ts new file mode 100644 index 0000000..0f152fb --- /dev/null +++ b/src/serialization/types/ChatStreamEndEventFinishReason.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatStreamEndEventFinishReason: core.serialization.Schema< + serializers.ChatStreamEndEventFinishReason.Raw, + Cohere.ChatStreamEndEventFinishReason +> = core.serialization.enum_(["COMPLETE", "ERROR_LIMIT", "MAX_TOKENS", "ERROR", "ERROR_TOXIC"]); + +export declare namespace ChatStreamEndEventFinishReason { + type Raw = "COMPLETE" | "ERROR_LIMIT" | "MAX_TOKENS" | "ERROR" | "ERROR_TOXIC"; +} diff --git a/src/serialization/types/ChatStreamEndEventResponse.ts b/src/serialization/types/ChatStreamEndEventResponse.ts new file mode 100644 index 0000000..380c023 --- /dev/null +++ b/src/serialization/types/ChatStreamEndEventResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatStreamEndEventResponse: core.serialization.Schema< + serializers.ChatStreamEndEventResponse.Raw, + Cohere.ChatStreamEndEventResponse +> = core.serialization.undiscriminatedUnion([ + core.serialization.lazyObject(async () => (await import("..")).NonStreamedChatResponse), + core.serialization.lazyObject(async () => (await import("..")).SearchQueriesOnlyResponse), +]); + +export declare namespace ChatStreamEndEventResponse { + type Raw = serializers.NonStreamedChatResponse.Raw | serializers.SearchQueriesOnlyResponse.Raw; +} diff --git a/src/serialization/types/ChatStreamEvent.ts b/src/serialization/types/ChatStreamEvent.ts new file mode 100644 index 0000000..2a32b88 --- /dev/null +++ b/src/serialization/types/ChatStreamEvent.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatStreamEvent: core.serialization.ObjectSchema = + core.serialization.object({}); + +export declare namespace ChatStreamEvent { + interface Raw {} +} diff --git a/src/serialization/types/ChatStreamStartEvent.ts b/src/serialization/types/ChatStreamStartEvent.ts new file mode 100644 index 0000000..8aa1d70 --- /dev/null +++ b/src/serialization/types/ChatStreamStartEvent.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatStreamStartEvent: core.serialization.ObjectSchema< + serializers.ChatStreamStartEvent.Raw, + Cohere.ChatStreamStartEvent +> = core.serialization + .object({ + generationId: core.serialization.property("generation_id", core.serialization.string()), + }) + .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + +export declare namespace ChatStreamStartEvent { + interface Raw extends serializers.ChatStreamEvent.Raw { + generation_id: string; + } +} diff --git a/src/serialization/types/ChatTextGenerationEvent.ts b/src/serialization/types/ChatTextGenerationEvent.ts new file mode 100644 index 0000000..2ec854a --- /dev/null +++ b/src/serialization/types/ChatTextGenerationEvent.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ChatTextGenerationEvent: core.serialization.ObjectSchema< + serializers.ChatTextGenerationEvent.Raw, + Cohere.ChatTextGenerationEvent +> = core.serialization + .object({ + text: core.serialization.string(), + }) + .extend(core.serialization.lazyObject(async () => (await import("..")).ChatStreamEvent)); + +export declare namespace ChatTextGenerationEvent { + interface Raw extends serializers.ChatStreamEvent.Raw { + text: string; + } +} diff --git a/src/serialization/types/ClassifyRequestExamplesItem.ts b/src/serialization/types/ClassifyRequestExamplesItem.ts new file mode 100644 index 0000000..283ae94 --- /dev/null +++ b/src/serialization/types/ClassifyRequestExamplesItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ClassifyRequestExamplesItem: core.serialization.ObjectSchema< + serializers.ClassifyRequestExamplesItem.Raw, + Cohere.ClassifyRequestExamplesItem +> = core.serialization.object({ + text: core.serialization.string().optional(), + label: core.serialization.string().optional(), +}); + +export declare namespace ClassifyRequestExamplesItem { + interface Raw { + text?: string | null; + label?: string | null; + } +} diff --git a/src/serialization/types/ClassifyRequestTruncate.ts b/src/serialization/types/ClassifyRequestTruncate.ts new file mode 100644 index 0000000..ccf48a6 --- /dev/null +++ b/src/serialization/types/ClassifyRequestTruncate.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ClassifyRequestTruncate: core.serialization.Schema< + serializers.ClassifyRequestTruncate.Raw, + Cohere.ClassifyRequestTruncate +> = core.serialization.enum_(["NONE", "START", "END"]); + +export declare namespace ClassifyRequestTruncate { + type Raw = "NONE" | "START" | "END"; +} diff --git a/src/serialization/types/ClassifyResponse.ts b/src/serialization/types/ClassifyResponse.ts new file mode 100644 index 0000000..cd752a9 --- /dev/null +++ b/src/serialization/types/ClassifyResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ClassifyResponse: core.serialization.ObjectSchema< + serializers.ClassifyResponse.Raw, + Cohere.ClassifyResponse +> = core.serialization.object({ + id: core.serialization.string(), + classifications: core.serialization.list( + core.serialization.lazyObject(async () => (await import("..")).ClassifyResponseClassificationsItem) + ), + meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), +}); + +export declare namespace ClassifyResponse { + interface Raw { + id: string; + classifications: serializers.ClassifyResponseClassificationsItem.Raw[]; + meta?: serializers.ApiMeta.Raw | null; + } +} diff --git a/src/serialization/types/ClassifyResponseClassificationsItem.ts b/src/serialization/types/ClassifyResponseClassificationsItem.ts new file mode 100644 index 0000000..b78fd25 --- /dev/null +++ b/src/serialization/types/ClassifyResponseClassificationsItem.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ClassifyResponseClassificationsItem: core.serialization.ObjectSchema< + serializers.ClassifyResponseClassificationsItem.Raw, + Cohere.ClassifyResponseClassificationsItem +> = core.serialization.object({ + id: core.serialization.string(), + input: core.serialization.string().optional(), + prediction: core.serialization.string().optional(), + predictions: core.serialization.list(core.serialization.string()), + confidence: core.serialization.number().optional(), + confidences: core.serialization.list(core.serialization.number()), + labels: core.serialization.record( + core.serialization.string(), + core.serialization.lazyObject(async () => (await import("..")).ClassifyResponseClassificationsItemLabelsValue) + ), + classificationType: core.serialization.property( + "classification_type", + core.serialization.lazy(async () => (await import("..")).ClassifyResponseClassificationsItemClassificationType) + ), +}); + +export declare namespace ClassifyResponseClassificationsItem { + interface Raw { + id: string; + input?: string | null; + prediction?: string | null; + predictions: string[]; + confidence?: number | null; + confidences: number[]; + labels: Record; + classification_type: serializers.ClassifyResponseClassificationsItemClassificationType.Raw; + } +} diff --git a/src/serialization/types/ClassifyResponseClassificationsItemClassificationType.ts b/src/serialization/types/ClassifyResponseClassificationsItemClassificationType.ts new file mode 100644 index 0000000..cb57ac7 --- /dev/null +++ b/src/serialization/types/ClassifyResponseClassificationsItemClassificationType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ClassifyResponseClassificationsItemClassificationType: core.serialization.Schema< + serializers.ClassifyResponseClassificationsItemClassificationType.Raw, + Cohere.ClassifyResponseClassificationsItemClassificationType +> = core.serialization.enum_(["single-label", "multi-label"]); + +export declare namespace ClassifyResponseClassificationsItemClassificationType { + type Raw = "single-label" | "multi-label"; +} diff --git a/src/serialization/types/ClassifyResponseClassificationsItemLabelsValue.ts b/src/serialization/types/ClassifyResponseClassificationsItemLabelsValue.ts new file mode 100644 index 0000000..c70f5e9 --- /dev/null +++ b/src/serialization/types/ClassifyResponseClassificationsItemLabelsValue.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const ClassifyResponseClassificationsItemLabelsValue: core.serialization.ObjectSchema< + serializers.ClassifyResponseClassificationsItemLabelsValue.Raw, + Cohere.ClassifyResponseClassificationsItemLabelsValue +> = core.serialization.object({ + confidence: core.serialization.number().optional(), +}); + +export declare namespace ClassifyResponseClassificationsItemLabelsValue { + interface Raw { + confidence?: number | null; + } +} diff --git a/src/serialization/types/DetectLanguageResponse.ts b/src/serialization/types/DetectLanguageResponse.ts new file mode 100644 index 0000000..15e09d4 --- /dev/null +++ b/src/serialization/types/DetectLanguageResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const DetectLanguageResponse: core.serialization.ObjectSchema< + serializers.DetectLanguageResponse.Raw, + Cohere.DetectLanguageResponse +> = core.serialization.object({ + results: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).DetectLanguageResponseResultsItem)) + .optional(), + meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), +}); + +export declare namespace DetectLanguageResponse { + interface Raw { + results?: serializers.DetectLanguageResponseResultsItem.Raw[] | null; + meta?: serializers.ApiMeta.Raw | null; + } +} diff --git a/src/serialization/types/DetectLanguageResponseResultsItem.ts b/src/serialization/types/DetectLanguageResponseResultsItem.ts new file mode 100644 index 0000000..61653bc --- /dev/null +++ b/src/serialization/types/DetectLanguageResponseResultsItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const DetectLanguageResponseResultsItem: core.serialization.ObjectSchema< + serializers.DetectLanguageResponseResultsItem.Raw, + Cohere.DetectLanguageResponseResultsItem +> = core.serialization.object({ + languageName: core.serialization.property("language_name", core.serialization.string().optional()), + languageCode: core.serialization.property("language_code", core.serialization.string().optional()), +}); + +export declare namespace DetectLanguageResponseResultsItem { + interface Raw { + language_name?: string | null; + language_code?: string | null; + } +} diff --git a/src/serialization/types/DetokenizeResponse.ts b/src/serialization/types/DetokenizeResponse.ts new file mode 100644 index 0000000..0aaebc4 --- /dev/null +++ b/src/serialization/types/DetokenizeResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const DetokenizeResponse: core.serialization.ObjectSchema< + serializers.DetokenizeResponse.Raw, + Cohere.DetokenizeResponse +> = core.serialization.object({ + text: core.serialization.string(), + meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), +}); + +export declare namespace DetokenizeResponse { + interface Raw { + text: string; + meta?: serializers.ApiMeta.Raw | null; + } +} diff --git a/src/serialization/types/EmbedRequestTruncate.ts b/src/serialization/types/EmbedRequestTruncate.ts new file mode 100644 index 0000000..05c607b --- /dev/null +++ b/src/serialization/types/EmbedRequestTruncate.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const EmbedRequestTruncate: core.serialization.Schema< + serializers.EmbedRequestTruncate.Raw, + Cohere.EmbedRequestTruncate +> = core.serialization.enum_(["NONE", "START", "END"]); + +export declare namespace EmbedRequestTruncate { + type Raw = "NONE" | "START" | "END"; +} diff --git a/src/serialization/types/EmbedResponse.ts b/src/serialization/types/EmbedResponse.ts new file mode 100644 index 0000000..c7c6d0f --- /dev/null +++ b/src/serialization/types/EmbedResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const EmbedResponse: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + embeddings: core.serialization.list(core.serialization.list(core.serialization.number())), + texts: core.serialization.list(core.serialization.string()), + meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + }); + +export declare namespace EmbedResponse { + interface Raw { + id: string; + embeddings: number[][]; + texts: string[]; + meta?: serializers.ApiMeta.Raw | null; + } +} diff --git a/src/serialization/types/FinishReason.ts b/src/serialization/types/FinishReason.ts new file mode 100644 index 0000000..15dd9e9 --- /dev/null +++ b/src/serialization/types/FinishReason.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const FinishReason: core.serialization.Schema = + core.serialization.enum_(["COMPLETE", "ERROR", "ERROR_TOXIC", "ERROR_LIMIT", "USER_CANCEL", "MAX_TOKENS"]); + +export declare namespace FinishReason { + type Raw = "COMPLETE" | "ERROR" | "ERROR_TOXIC" | "ERROR_LIMIT" | "USER_CANCEL" | "MAX_TOKENS"; +} diff --git a/src/serialization/types/GenerateRequestReturnLikelihoods.ts b/src/serialization/types/GenerateRequestReturnLikelihoods.ts new file mode 100644 index 0000000..f0b2c50 --- /dev/null +++ b/src/serialization/types/GenerateRequestReturnLikelihoods.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerateRequestReturnLikelihoods: core.serialization.Schema< + serializers.GenerateRequestReturnLikelihoods.Raw, + Cohere.GenerateRequestReturnLikelihoods +> = core.serialization.enum_(["GENERATION", "ALL", "NONE"]); + +export declare namespace GenerateRequestReturnLikelihoods { + type Raw = "GENERATION" | "ALL" | "NONE"; +} diff --git a/src/serialization/types/GenerateRequestTruncate.ts b/src/serialization/types/GenerateRequestTruncate.ts new file mode 100644 index 0000000..129c1c0 --- /dev/null +++ b/src/serialization/types/GenerateRequestTruncate.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerateRequestTruncate: core.serialization.Schema< + serializers.GenerateRequestTruncate.Raw, + Cohere.GenerateRequestTruncate +> = core.serialization.enum_(["NONE", "START", "END"]); + +export declare namespace GenerateRequestTruncate { + type Raw = "NONE" | "START" | "END"; +} diff --git a/src/serialization/types/Generation.ts b/src/serialization/types/Generation.ts new file mode 100644 index 0000000..37ca7bf --- /dev/null +++ b/src/serialization/types/Generation.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const Generation: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + prompt: core.serialization.string().optional(), + generations: core.serialization.list( + core.serialization.lazyObject(async () => (await import("..")).SingleGeneration) + ), + meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + }); + +export declare namespace Generation { + interface Raw { + id: string; + prompt?: string | null; + generations: serializers.SingleGeneration.Raw[]; + meta?: serializers.ApiMeta.Raw | null; + } +} diff --git a/src/serialization/types/GenerationFinalResponse.ts b/src/serialization/types/GenerationFinalResponse.ts new file mode 100644 index 0000000..91b7620 --- /dev/null +++ b/src/serialization/types/GenerationFinalResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerationFinalResponse: core.serialization.ObjectSchema< + serializers.GenerationFinalResponse.Raw, + Cohere.GenerationFinalResponse +> = core.serialization.object({ + isFinished: core.serialization.property("is_finished", core.serialization.boolean()), + finishReason: core.serialization.property( + "finish_reason", + core.serialization.lazy(async () => (await import("..")).FinishReason).optional() + ), + response: core.serialization.lazyObject(async () => (await import("..")).GenerationFinalResponseResponse), +}); + +export declare namespace GenerationFinalResponse { + interface Raw { + is_finished: boolean; + finish_reason?: serializers.FinishReason.Raw | null; + response: serializers.GenerationFinalResponseResponse.Raw; + } +} diff --git a/src/serialization/types/GenerationFinalResponseResponse.ts b/src/serialization/types/GenerationFinalResponseResponse.ts new file mode 100644 index 0000000..6b3720b --- /dev/null +++ b/src/serialization/types/GenerationFinalResponseResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerationFinalResponseResponse: core.serialization.ObjectSchema< + serializers.GenerationFinalResponseResponse.Raw, + Cohere.GenerationFinalResponseResponse +> = core.serialization.object({ + id: core.serialization.string(), + generations: core.serialization.lazyObject(async () => (await import("..")).SingleGenerationInStream).optional(), +}); + +export declare namespace GenerationFinalResponseResponse { + interface Raw { + id: string; + generations?: serializers.SingleGenerationInStream.Raw | null; + } +} diff --git a/src/serialization/types/GenerationStream.ts b/src/serialization/types/GenerationStream.ts new file mode 100644 index 0000000..104cba8 --- /dev/null +++ b/src/serialization/types/GenerationStream.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const GenerationStream: core.serialization.ObjectSchema< + serializers.GenerationStream.Raw, + Cohere.GenerationStream +> = core.serialization.object({ + text: core.serialization.string(), + index: core.serialization.number().optional(), + isFinished: core.serialization.property("is_finished", core.serialization.boolean()), +}); + +export declare namespace GenerationStream { + interface Raw { + text: string; + index?: number | null; + is_finished: boolean; + } +} diff --git a/src/serialization/types/NonStreamedChatResponse.ts b/src/serialization/types/NonStreamedChatResponse.ts new file mode 100644 index 0000000..ddc3c6d --- /dev/null +++ b/src/serialization/types/NonStreamedChatResponse.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const NonStreamedChatResponse: core.serialization.ObjectSchema< + serializers.NonStreamedChatResponse.Raw, + Cohere.NonStreamedChatResponse +> = core.serialization.object({ + text: core.serialization.string(), + generationId: core.serialization.property("generation_id", core.serialization.string()), + citations: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).ChatCitation)) + .optional(), + documents: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).ChatDocument)) + .optional(), + searchQueries: core.serialization.property( + "search_queries", + core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).ChatSearchQuery)) + .optional() + ), + searchResults: core.serialization.property( + "search_results", + core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).ChatSearchResult)) + .optional() + ), +}); + +export declare namespace NonStreamedChatResponse { + interface Raw { + text: string; + generation_id: string; + citations?: serializers.ChatCitation.Raw[] | null; + documents?: serializers.ChatDocument.Raw[] | null; + search_queries?: serializers.ChatSearchQuery.Raw[] | null; + search_results?: serializers.ChatSearchResult.Raw[] | null; + } +} diff --git a/src/serialization/types/RerankRequestDocumentsItem.ts b/src/serialization/types/RerankRequestDocumentsItem.ts new file mode 100644 index 0000000..140a7c3 --- /dev/null +++ b/src/serialization/types/RerankRequestDocumentsItem.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const RerankRequestDocumentsItem: core.serialization.ObjectSchema< + serializers.RerankRequestDocumentsItem.Raw, + Cohere.RerankRequestDocumentsItem +> = core.serialization.object({ + text: core.serialization.string(), +}); + +export declare namespace RerankRequestDocumentsItem { + interface Raw { + text: string; + } +} diff --git a/src/serialization/types/RerankResponse.ts b/src/serialization/types/RerankResponse.ts new file mode 100644 index 0000000..b07c30e --- /dev/null +++ b/src/serialization/types/RerankResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const RerankResponse: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + results: core.serialization.list( + core.serialization.lazyObject(async () => (await import("..")).RerankResponseResultsItem) + ), + meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), + }); + +export declare namespace RerankResponse { + interface Raw { + id?: string | null; + results: serializers.RerankResponseResultsItem.Raw[]; + meta?: serializers.ApiMeta.Raw | null; + } +} diff --git a/src/serialization/types/RerankResponseResultsItem.ts b/src/serialization/types/RerankResponseResultsItem.ts new file mode 100644 index 0000000..9a3a25c --- /dev/null +++ b/src/serialization/types/RerankResponseResultsItem.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const RerankResponseResultsItem: core.serialization.ObjectSchema< + serializers.RerankResponseResultsItem.Raw, + Cohere.RerankResponseResultsItem +> = core.serialization.object({ + document: core.serialization + .lazyObject(async () => (await import("..")).RerankResponseResultsItemDocument) + .optional(), + index: core.serialization.number(), + relevanceScore: core.serialization.property("relevance_score", core.serialization.number()), +}); + +export declare namespace RerankResponseResultsItem { + interface Raw { + document?: serializers.RerankResponseResultsItemDocument.Raw | null; + index: number; + relevance_score: number; + } +} diff --git a/src/serialization/types/RerankResponseResultsItemDocument.ts b/src/serialization/types/RerankResponseResultsItemDocument.ts new file mode 100644 index 0000000..961e4bb --- /dev/null +++ b/src/serialization/types/RerankResponseResultsItemDocument.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const RerankResponseResultsItemDocument: core.serialization.ObjectSchema< + serializers.RerankResponseResultsItemDocument.Raw, + Cohere.RerankResponseResultsItemDocument +> = core.serialization.object({ + text: core.serialization.string(), +}); + +export declare namespace RerankResponseResultsItemDocument { + interface Raw { + text: string; + } +} diff --git a/src/serialization/types/SearchQueriesOnlyResponse.ts b/src/serialization/types/SearchQueriesOnlyResponse.ts new file mode 100644 index 0000000..84e3ad9 --- /dev/null +++ b/src/serialization/types/SearchQueriesOnlyResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SearchQueriesOnlyResponse: core.serialization.ObjectSchema< + serializers.SearchQueriesOnlyResponse.Raw, + Cohere.SearchQueriesOnlyResponse +> = core.serialization.object({ + searchQueries: core.serialization.property( + "search_queries", + core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).ChatSearchQuery)) + ), +}); + +export declare namespace SearchQueriesOnlyResponse { + interface Raw { + search_queries: serializers.ChatSearchQuery.Raw[]; + } +} diff --git a/src/serialization/types/SingleGeneration.ts b/src/serialization/types/SingleGeneration.ts new file mode 100644 index 0000000..5d56e62 --- /dev/null +++ b/src/serialization/types/SingleGeneration.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SingleGeneration: core.serialization.ObjectSchema< + serializers.SingleGeneration.Raw, + Cohere.SingleGeneration +> = core.serialization.object({ + id: core.serialization.string(), + text: core.serialization.string(), + index: core.serialization.number().optional(), + likelihood: core.serialization.number().optional(), + tokenLikelihoods: core.serialization.property( + "token_likelihoods", + core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).SingleGenerationTokenLikelihoodsItem)) + .optional() + ), +}); + +export declare namespace SingleGeneration { + interface Raw { + id: string; + text: string; + index?: number | null; + likelihood?: number | null; + token_likelihoods?: serializers.SingleGenerationTokenLikelihoodsItem.Raw[] | null; + } +} diff --git a/src/serialization/types/SingleGenerationInStream.ts b/src/serialization/types/SingleGenerationInStream.ts new file mode 100644 index 0000000..409c965 --- /dev/null +++ b/src/serialization/types/SingleGenerationInStream.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SingleGenerationInStream: core.serialization.ObjectSchema< + serializers.SingleGenerationInStream.Raw, + Cohere.SingleGenerationInStream +> = core.serialization.object({ + id: core.serialization.string(), + text: core.serialization.string(), + index: core.serialization.number().optional(), + finishReason: core.serialization.property( + "finish_reason", + core.serialization.lazy(async () => (await import("..")).FinishReason) + ), +}); + +export declare namespace SingleGenerationInStream { + interface Raw { + id: string; + text: string; + index?: number | null; + finish_reason: serializers.FinishReason.Raw; + } +} diff --git a/src/serialization/types/SingleGenerationTokenLikelihoodsItem.ts b/src/serialization/types/SingleGenerationTokenLikelihoodsItem.ts new file mode 100644 index 0000000..79c922e --- /dev/null +++ b/src/serialization/types/SingleGenerationTokenLikelihoodsItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SingleGenerationTokenLikelihoodsItem: core.serialization.ObjectSchema< + serializers.SingleGenerationTokenLikelihoodsItem.Raw, + Cohere.SingleGenerationTokenLikelihoodsItem +> = core.serialization.object({ + token: core.serialization.string(), + likelihood: core.serialization.number(), +}); + +export declare namespace SingleGenerationTokenLikelihoodsItem { + interface Raw { + token: string; + likelihood: number; + } +} diff --git a/src/serialization/types/StreamedChatResponse.ts b/src/serialization/types/StreamedChatResponse.ts new file mode 100644 index 0000000..ad49b41 --- /dev/null +++ b/src/serialization/types/StreamedChatResponse.ts @@ -0,0 +1,62 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const StreamedChatResponse: core.serialization.Schema< + serializers.StreamedChatResponse.Raw, + Cohere.StreamedChatResponse +> = core.serialization + .union(core.serialization.discriminant("eventType", "event_type"), { + "stream-start": core.serialization.lazyObject(async () => (await import("..")).ChatStreamStartEvent), + "search-queries-generation": core.serialization.lazyObject( + async () => (await import("..")).ChatSearchQueriesGenerationEvent + ), + "search-results": core.serialization.lazyObject(async () => (await import("..")).ChatSearchResultsEvent), + "text-generation": core.serialization.lazyObject(async () => (await import("..")).ChatTextGenerationEvent), + "citation-generation": core.serialization.lazyObject( + async () => (await import("..")).ChatCitationGenerationEvent + ), + "stream-end": core.serialization.lazyObject(async () => (await import("..")).ChatStreamEndEvent), + }) + .transform({ + transform: (value) => value, + untransform: (value) => value, + }); + +export declare namespace StreamedChatResponse { + type Raw = + | StreamedChatResponse.StreamStart + | StreamedChatResponse.SearchQueriesGeneration + | StreamedChatResponse.SearchResults + | StreamedChatResponse.TextGeneration + | StreamedChatResponse.CitationGeneration + | StreamedChatResponse.StreamEnd; + + interface StreamStart extends serializers.ChatStreamStartEvent.Raw { + event_type: "stream-start"; + } + + interface SearchQueriesGeneration extends serializers.ChatSearchQueriesGenerationEvent.Raw { + event_type: "search-queries-generation"; + } + + interface SearchResults extends serializers.ChatSearchResultsEvent.Raw { + event_type: "search-results"; + } + + interface TextGeneration extends serializers.ChatTextGenerationEvent.Raw { + event_type: "text-generation"; + } + + interface CitationGeneration extends serializers.ChatCitationGenerationEvent.Raw { + event_type: "citation-generation"; + } + + interface StreamEnd extends serializers.ChatStreamEndEvent.Raw { + event_type: "stream-end"; + } +} diff --git a/src/serialization/types/StreamedGeneration.ts b/src/serialization/types/StreamedGeneration.ts new file mode 100644 index 0000000..791e3ff --- /dev/null +++ b/src/serialization/types/StreamedGeneration.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const StreamedGeneration: core.serialization.Schema< + serializers.StreamedGeneration.Raw, + Cohere.StreamedGeneration +> = core.serialization.list(core.serialization.lazy(async () => (await import("..")).StreamedGenerationItem)); + +export declare namespace StreamedGeneration { + type Raw = serializers.StreamedGenerationItem.Raw[]; +} diff --git a/src/serialization/types/StreamedGenerationItem.ts b/src/serialization/types/StreamedGenerationItem.ts new file mode 100644 index 0000000..3e49e6d --- /dev/null +++ b/src/serialization/types/StreamedGenerationItem.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const StreamedGenerationItem: core.serialization.Schema< + serializers.StreamedGenerationItem.Raw, + Cohere.StreamedGenerationItem +> = core.serialization.undiscriminatedUnion([ + core.serialization.lazyObject(async () => (await import("..")).GenerationStream), + core.serialization.lazyObject(async () => (await import("..")).GenerationFinalResponse), +]); + +export declare namespace StreamedGenerationItem { + type Raw = serializers.GenerationStream.Raw | serializers.GenerationFinalResponse.Raw; +} diff --git a/src/serialization/types/SummarizeRequestExtractiveness.ts b/src/serialization/types/SummarizeRequestExtractiveness.ts new file mode 100644 index 0000000..abd30eb --- /dev/null +++ b/src/serialization/types/SummarizeRequestExtractiveness.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SummarizeRequestExtractiveness: core.serialization.Schema< + serializers.SummarizeRequestExtractiveness.Raw, + Cohere.SummarizeRequestExtractiveness +> = core.serialization.enum_(["low", "medium", "high"]); + +export declare namespace SummarizeRequestExtractiveness { + type Raw = "low" | "medium" | "high"; +} diff --git a/src/serialization/types/SummarizeRequestFormat.ts b/src/serialization/types/SummarizeRequestFormat.ts new file mode 100644 index 0000000..a42816c --- /dev/null +++ b/src/serialization/types/SummarizeRequestFormat.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SummarizeRequestFormat: core.serialization.Schema< + serializers.SummarizeRequestFormat.Raw, + Cohere.SummarizeRequestFormat +> = core.serialization.enum_(["paragraph", "bullets"]); + +export declare namespace SummarizeRequestFormat { + type Raw = "paragraph" | "bullets"; +} diff --git a/src/serialization/types/SummarizeRequestLength.ts b/src/serialization/types/SummarizeRequestLength.ts new file mode 100644 index 0000000..04498c5 --- /dev/null +++ b/src/serialization/types/SummarizeRequestLength.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SummarizeRequestLength: core.serialization.Schema< + serializers.SummarizeRequestLength.Raw, + Cohere.SummarizeRequestLength +> = core.serialization.enum_(["short", "medium", "long"]); + +export declare namespace SummarizeRequestLength { + type Raw = "short" | "medium" | "long"; +} diff --git a/src/serialization/types/SummarizeRequestModel.ts b/src/serialization/types/SummarizeRequestModel.ts new file mode 100644 index 0000000..35d25ec --- /dev/null +++ b/src/serialization/types/SummarizeRequestModel.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SummarizeRequestModel: core.serialization.Schema< + serializers.SummarizeRequestModel.Raw, + Cohere.SummarizeRequestModel +> = core.serialization.enum_(["command", "command-light"]); + +export declare namespace SummarizeRequestModel { + type Raw = "command" | "command-light"; +} diff --git a/src/serialization/types/SummarizeResponse.ts b/src/serialization/types/SummarizeResponse.ts new file mode 100644 index 0000000..534a090 --- /dev/null +++ b/src/serialization/types/SummarizeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SummarizeResponse: core.serialization.ObjectSchema< + serializers.SummarizeResponse.Raw, + Cohere.SummarizeResponse +> = core.serialization.object({ + results: core.serialization + .list(core.serialization.lazyObject(async () => (await import("..")).SummarizeResponseResultsItem)) + .optional(), + meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), +}); + +export declare namespace SummarizeResponse { + interface Raw { + results?: serializers.SummarizeResponseResultsItem.Raw[] | null; + meta?: serializers.ApiMeta.Raw | null; + } +} diff --git a/src/serialization/types/SummarizeResponseResultsItem.ts b/src/serialization/types/SummarizeResponseResultsItem.ts new file mode 100644 index 0000000..9aa64fc --- /dev/null +++ b/src/serialization/types/SummarizeResponseResultsItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const SummarizeResponseResultsItem: core.serialization.ObjectSchema< + serializers.SummarizeResponseResultsItem.Raw, + Cohere.SummarizeResponseResultsItem +> = core.serialization.object({ + id: core.serialization.string().optional(), + summary: core.serialization.string().optional(), +}); + +export declare namespace SummarizeResponseResultsItem { + interface Raw { + id?: string | null; + summary?: string | null; + } +} diff --git a/src/serialization/types/TokenizeResponse.ts b/src/serialization/types/TokenizeResponse.ts new file mode 100644 index 0000000..b9b8486 --- /dev/null +++ b/src/serialization/types/TokenizeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from ".."; +import * as Cohere from "../../api"; +import * as core from "../../core"; + +export const TokenizeResponse: core.serialization.ObjectSchema< + serializers.TokenizeResponse.Raw, + Cohere.TokenizeResponse +> = core.serialization.object({ + tokens: core.serialization.list(core.serialization.number()), + tokenStrings: core.serialization.property("token_strings", core.serialization.list(core.serialization.string())), + meta: core.serialization.lazyObject(async () => (await import("..")).ApiMeta).optional(), +}); + +export declare namespace TokenizeResponse { + interface Raw { + tokens: number[]; + token_strings: string[]; + meta?: serializers.ApiMeta.Raw | null; + } +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts new file mode 100644 index 0000000..7eb610f --- /dev/null +++ b/src/serialization/types/index.ts @@ -0,0 +1,58 @@ +export * from "./GenerateRequestTruncate"; +export * from "./GenerateRequestReturnLikelihoods"; +export * from "./EmbedRequestTruncate"; +export * from "./EmbedResponse"; +export * from "./ClassifyRequestExamplesItem"; +export * from "./ClassifyRequestTruncate"; +export * from "./ClassifyResponse"; +export * from "./ClassifyResponseClassificationsItem"; +export * from "./ClassifyResponseClassificationsItemLabelsValue"; +export * from "./ClassifyResponseClassificationsItemClassificationType"; +export * from "./ChatRequestPromptTruncation"; +export * from "./ChatRequestCitationQuality"; +export * from "./ChatResponse"; +export * from "./TokenizeResponse"; +export * from "./DetokenizeResponse"; +export * from "./DetectLanguageResponse"; +export * from "./DetectLanguageResponseResultsItem"; +export * from "./SummarizeRequestLength"; +export * from "./SummarizeRequestFormat"; +export * from "./SummarizeRequestModel"; +export * from "./SummarizeRequestExtractiveness"; +export * from "./SummarizeResponse"; +export * from "./SummarizeResponseResultsItem"; +export * from "./RerankRequestDocumentsItem"; +export * from "./RerankResponse"; +export * from "./RerankResponseResultsItem"; +export * from "./RerankResponseResultsItemDocument"; +export * from "./SingleGeneration"; +export * from "./SingleGenerationTokenLikelihoodsItem"; +export * from "./ApiMeta"; +export * from "./ApiMetaApiVersion"; +export * from "./Generation"; +export * from "./GenerationStream"; +export * from "./FinishReason"; +export * from "./SingleGenerationInStream"; +export * from "./GenerationFinalResponse"; +export * from "./GenerationFinalResponseResponse"; +export * from "./StreamedGeneration"; +export * from "./StreamedGenerationItem"; +export * from "./ChatMessage"; +export * from "./ChatMessageRole"; +export * from "./ChatConnector"; +export * from "./ChatDocument"; +export * from "./ChatCitation"; +export * from "./ChatSearchQuery"; +export * from "./ChatSearchResult"; +export * from "./NonStreamedChatResponse"; +export * from "./ChatStreamEvent"; +export * from "./ChatStreamStartEvent"; +export * from "./ChatSearchQueriesGenerationEvent"; +export * from "./ChatSearchResultsEvent"; +export * from "./ChatTextGenerationEvent"; +export * from "./ChatCitationGenerationEvent"; +export * from "./SearchQueriesOnlyResponse"; +export * from "./ChatStreamEndEvent"; +export * from "./ChatStreamEndEventFinishReason"; +export * from "./ChatStreamEndEventResponse"; +export * from "./StreamedChatResponse"; diff --git a/test/classify.ts b/test/classify.ts deleted file mode 100644 index a7c65d5..0000000 --- a/test/classify.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { expect } from "chai"; -import cohere from "../cohere"; -import { cohereResponse, classifyResponse } from "../models/index"; - -const KEY: string = process.env.COHERE_API_KEY || ""; - -describe("The classify endpoint", () => { - let response: cohereResponse; - cohere.init(KEY); - - it("Should should have a statusCode of 200", async () => { - response = await cohere.classify({ - model: "small", - examples: [ - { text: "apple", label: "food" }, - { text: "pizza", label: "food" }, - { text: "hamburger", label: "food" }, - { text: "taco", label: "food" }, - { text: "onion", label: "food" }, - { text: "purple", label: "color" }, - { text: "yellow", label: "color" }, - { text: "red", label: "color" }, - { text: "black", label: "color" }, - { text: "white", label: "color" }, - ], - inputs: ["orange"], - }); - - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); - it("Should contain a body property that contains a classifications property", async () => { - response = await cohere.classify({ - model: "small", - examples: [ - { text: "apple", label: "food" }, - { text: "pizza", label: "food" }, - { text: "hamburger", label: "food" }, - { text: "taco", label: "food" }, - { text: "onion", label: "food" }, - { text: "purple", label: "color" }, - { text: "yellow", label: "color" }, - { text: "red", label: "color" }, - { text: "black", label: "color" }, - { text: "white", label: "color" }, - ], - inputs: ["orange"], - truncate: "NONE", - }); - expect(response).to.have.property("body"); - expect(response.body.classifications).to.be.an("array"); - }); - it("Should contain prediction for food and color", async () => { - response = await cohere.classify({ - model: "small", - examples: [ - { text: "apple", label: "food" }, - { text: "pizza", label: "food" }, - { text: "hamburger", label: "food" }, - { text: "taco", label: "food" }, - { text: "onion", label: "food" }, - { text: "purple", label: "color" }, - { text: "yellow", label: "color" }, - { text: "red", label: "color" }, - { text: "black", label: "color" }, - { text: "white", label: "color" }, - ], - inputs: ["pink", "eggplant", "pasta"], - truncate: "START", - }); - - expect(response.body.classifications[0].prediction).to.equal("color"); // pink - expect(response.body.classifications[1].prediction).to.equal("food"); // eggplant - expect(response.body.classifications[2].prediction).to.equal("food"); // pasta - }); - - it("Should contain labels", async () => { - response = await cohere.classify({ - model: "small", - examples: [ - { text: "apple", label: "food" }, - { text: "pizza", label: "food" }, - { text: "hamburger", label: "food" }, - { text: "taco", label: "food" }, - { text: "onion", label: "food" }, - { text: "purple", label: "color" }, - { text: "yellow", label: "color" }, - { text: "red", label: "color" }, - { text: "black", label: "color" }, - { text: "white", label: "color" }, - ], - inputs: ["brown"], - truncate: "END", - }); - expect(response.body.classifications[0].labels).to.be.an("object"); - expect(response.body.classifications[0].labels["color"]).to.have.property( - "confidence" - ); - expect(Object.keys(response.body.classifications[0].labels)).to.have.length( - 2 - ); - }); - - it("Should classify for all params", async () => { - response = await cohere.classify({ - model: "small", - examples: [ - { text: "apple", label: "food" }, - { text: "pizza", label: "food" }, - { text: "hamburger", label: "food" }, - { text: "taco", label: "food" }, - { text: "onion", label: "food" }, - { text: "purple", label: "color" }, - { text: "yellow", label: "color" }, - { text: "red", label: "color" }, - { text: "black", label: "color" }, - { text: "white", label: "color" }, - ], - inputs: ["blue", "hamburger", "pasta"], - }); - expect(response.body.classifications[0].prediction).to.equal("color"); // blue - expect(response.body.classifications[1].prediction).to.equal("food"); // hamburger - expect(response.body.classifications[2].prediction).to.equal("food"); // pasta - }); - - it("Should should have a statusCode of 200 with a preset", async () => { - response = await cohere.classify({ preset: "SDK-TESTS-PRESET-rfa6h3" }); - - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); - it("Should contain a body property that contains meta information", () => { - expect(response.body).to.have.property("meta"); - expect(response.body.meta).to.have.property("api_version"); - expect(response.body.meta?.api_version).to.have.property("version"); - }); -}).timeout(5000); diff --git a/test/detectlanguage.ts b/test/detectlanguage.ts deleted file mode 100644 index a5bd618..0000000 --- a/test/detectlanguage.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { expect } from "chai"; -import cohere from "../cohere"; -import { cohereResponse, detectLanguageResponse } from "../models/index"; - -const KEY: string = process.env.COHERE_API_KEY || ""; - -describe("The detect-language endpoint", () => { - let response: cohereResponse; - cohere.init(KEY); - before(async () => { - const en = "Hello world"; - const ru = "Здравствуй, Мир"; - response = await cohere.detectLanguage({ texts: [en, ru] }); - }); - it("Should should have a statusCode of 200", () => { - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); - it("Should contain the correct text", () => { - expect(response).to.have.property("body"); - expect(response.body).to.have.property("results"); - expect(response.body.results[0].language_code).to.equal("en"); - expect(response.body.results[1].language_code).to.equal("ru"); - }); - it("Should contain a body property that contains meta information", () => { - expect(response.body).to.have.property("meta"); - expect(response.body.meta).to.have.property("api_version"); - expect(response.body.meta?.api_version).to.have.property("version"); - }); -}); diff --git a/test/detokenize.ts b/test/detokenize.ts deleted file mode 100644 index 0cdfa76..0000000 --- a/test/detokenize.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { expect } from "chai"; -import cohere from "../cohere"; -import { cohereResponse, detokenizeResponse } from "../models/index"; - -const KEY: string = process.env.COHERE_API_KEY || ""; - -describe("The detokenize endpoint", () => { - let response: cohereResponse; - cohere.init(KEY); - before(async () => { - response = await cohere.detokenize({ tokens: [25736, 2552] }); - }); - it("Should should have a statusCode of 200", () => { - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); - it("Should contain the correct text", () => { - expect(response).to.have.property("body"); - expect(response.body).to.have.property("text"); - expect(response.body.text).to.equal("hello world"); - }); - it("Should contain a body property that contains meta information", () => { - expect(response.body).to.have.property("meta"); - expect(response.body.meta).to.have.property("api_version"); - expect(response.body.meta?.api_version).to.have.property("version"); - }); -}); diff --git a/test/embed.ts b/test/embed.ts deleted file mode 100644 index 9fa5627..0000000 --- a/test/embed.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { expect } from "chai"; -import cohere from "../cohere"; -import { cohereResponse, embedResponse } from "../models/index"; - -const KEY: string = process.env.COHERE_API_KEY || ""; - -describe("The embed endpoint", () => { - let response: cohereResponse; - cohere.init(KEY); - const texts = [ - "co:here", - "cohere", - "embed", - "python", - "golang", - "typescript", - "rust?", - "ai", - "nlp", - "neural", - "nets", - ]; - before(async function () { - this.timeout(5000); - response = await cohere.embed({ - texts: texts, - truncate: "NONE", - }); - }); - it("Should should have a statusCode of 200", () => { - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); - it("Should contain a body object that contains an embeddings property", () => { - expect(response).to.have.property("body"); - expect(response.body).to.have.property("embeddings"); - }); - it("Should contain an embeddings array with a length matching the provided amount of embeddings", () => { - expect(response.body.embeddings).to.be.an("array").of.length(texts.length); - }); - it("Should contain an embeddings array containing arrays", () => { - response.body.embeddings.forEach((item: number[]) => { - expect(item).to.be.an("array"); - }); - }); - it("Should contain a body property that contains meta information", () => { - expect(response.body).to.have.property("meta"); - expect(response.body.meta).to.have.property("api_version"); - expect(response.body.meta?.api_version).to.have.property("version"); - }); -}); diff --git a/test/generate.ts b/test/generate.ts deleted file mode 100644 index b5e81dd..0000000 --- a/test/generate.ts +++ /dev/null @@ -1,184 +0,0 @@ -import { expect } from "chai"; -import cohere from "../cohere"; -import { cohereResponse, generateResponse } from "../models/index"; - -const KEY: string = process.env.COHERE_API_KEY || ""; -const TIMEOUT = 5000; -cohere.init(KEY); - -describe("The generate endpoint successfully completes", () => { - let response: cohereResponse; - before(async function () { - this.timeout(TIMEOUT); - response = await cohere.generate({ - model: "medium", - prompt: "hello what is your name. £ symbols sometimes cause problems.", - max_tokens: 20, - temperature: 1, - k: 5, - p: 1, - }); - }); - it("Should should have a statusCode of 200", () => { - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); - it("Should contain a body property that contains a generations array of length one that contains a text property", () => { - expect(response).to.have.property("body"); - expect(response.body).to.have.property("generations"); - expect(response.body.generations).to.have.lengthOf(1); - expect(response.body.generations[0]).to.have.property("text"); - }); - it("Should contain a body property that contains meta information", () => { - expect(response.body).to.have.property("meta"); - expect(response.body.meta).to.have.property("api_version"); - expect(response.body.meta?.api_version).to.have.property("version"); - }); - it("Should contain text property with a string of length > 20", () => { - expect(response.body.generations[0].text).to.have.length.greaterThan(20); - }); -}); - -describe("The generate endpoint successfully completes with multiple generations", () => { - let response: cohereResponse; - before(async function () { - this.timeout(TIMEOUT); - response = await cohere.generate({ - model: "medium", - prompt: "hello what is your name", - max_tokens: 20, - temperature: 1, - k: 5, - num_generations: 2, - p: 1, - }); - }); - it("Should contain a body property that contains a generations array of length two", () => { - expect(response).to.have.property("body"); - expect(response.body).to.have.property("generations"); - expect(response.body.generations).to.have.lengthOf(2); - }); -}); - -describe("The generate endpoint with generation return likelihoods successfully returns a likelihood", () => { - let response: cohereResponse; - before(async function () { - this.timeout(TIMEOUT); - response = await cohere.generate({ - model: "medium", - prompt: "hello what is your name", - max_tokens: 20, - temperature: 1, - k: 5, - p: 1, - return_likelihoods: "GENERATION", - }); - }); - it("Should contain a body property that contains a likelihood", () => { - expect(response.body.generations[0]).to.have.property("likelihood"); - }); -}); - -describe("The generate endpoint with all return likelihoods successfully returns a likelihood", () => { - let response: cohereResponse; - before(async function () { - this.timeout(TIMEOUT); - response = await cohere.generate({ - model: "medium", - prompt: "hello what is your name", - max_tokens: 20, - temperature: 1, - k: 5, - p: 1, - return_likelihoods: "ALL", - }); - }); - it("Should contain a body property that contains a likelihood", () => { - expect(response.body.generations[0]).to.have.property("likelihood"); - }); -}); - -describe("The generate endpoint with no return likelihoods does not return a likelihood", () => { - let response: cohereResponse; - before(async function () { - this.timeout(TIMEOUT); - response = await cohere.generate({ - model: "medium", - prompt: "hello what is your name", - max_tokens: 20, - temperature: 1, - k: 5, - p: 1, - return_likelihoods: "NONE", - }); - }); - it("Should not contain a body property that contains a likelihood", () => { - expect(response.body.generations[0]).to.not.have.property("likelihood"); - }); -}); - -describe("The generate endpoint successfully completes with a preset", () => { - let response: cohereResponse; - before(async function () { - this.timeout(TIMEOUT); - response = await cohere.generate({ - preset: "SDK-TESTS-PRESET-cq2r57", - }); - }); - it("Should should have a statusCode of 200", () => { - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); -}); - -describe("The generate endpoint successfully completes with logit bias ", () => { - let response: cohereResponse; - before(async function () { - this.timeout(TIMEOUT); - response = await cohere.generate({ - model: "medium", - prompt: "hello what is your name", - max_tokens: 20, - logit_bias: { 11: -5.5 }, - }); - }); - it("Should should have a statusCode of 200", () => { - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); -}); - -describe("The generate endpoint fails when text is too long without truncate argument", () => { - let response: cohereResponse; - before(async function () { - this.timeout(TIMEOUT); - response = await cohere.generate({ - model: "medium", - prompt: "hello what is your name ".repeat(10000), - max_tokens: 20, - }); - }); - it("Should should have a statusCode of 400", () => { - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(400); - }); -}); - -describe("The generate endpoint successfully completes with truncate", () => { - let response: cohereResponse; - before(async function () { - this.timeout(TIMEOUT); - response = await cohere.generate({ - model: "medium", - prompt: "hello what is your name ".repeat(10000), - max_tokens: 20, - truncate: "END", - }); - }); - it("Should should have a statusCode of 200", () => { - console.log(response.body); - console.log(response.statusCode); - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); -}); diff --git a/test/summarize.ts b/test/summarize.ts deleted file mode 100644 index 343a23d..0000000 --- a/test/summarize.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { expect } from "chai"; -import cohere from "../cohere"; -import { - cohereResponse, - summarizeResponse, - summaryExtractiveness, - summaryFormat, - summaryLength, -} from "../models/index"; - -const KEY: string = process.env.COHERE_API_KEY || ""; - -describe("The summarize endpoint", () => { - let response: cohereResponse; - cohere.init(KEY); - before(async () => { - response = await cohere.summarize({ - text: "If you want to get classic Angry Birds from Google Play — the version that costs just a buck and isn’t laden with microtransactions — you’d better get it quick. Rovio Classics: Angry Birds, a rebuilt version of the original mobile hit, will be delisted from Google’s app store on Thursday due to “the game’s impact on our wider games portfolio,” developer Rovio announced on Tuesday. Oddly, the App Store version will still be available, though Rovio’s plan is to change the game’s name to Red’s First Flight.\n\nMy guess is that Rovio is delisting this remake of Angry Birds to push people toward its free-to-play games in the series that make money off microtransactions. As a $1 one-time purchase, the Rovio Classics version of the game likely doesn’t make nearly the same amount of money as its other Angry Birds titles do. That $1 price may also be enough to keep players away from other games in the series, which means Rovio might feel like it’s leaving money on the table by still offering Rovio Classics: Angry Birds on Google Play.\n\nThat said, I don’t know why Rovio isn’t just changing the name of the game on Google Play like it is on the App Store. While the change to Red’s First Flight will likely make the game much harder to find unless you know exactly what you’re looking for, it will at least still be there as an option. Rovio didn’t immediately respond to a request for comment.\n\nHere is a transcribed version of Rovio’s full Twitter message about the change, which is a little difficult to read in the tweet:\n\nWe have reviewed the business case of Rovio Classics: Angry Birds, and due to the game’s impact on our wider games portfolio, we have decided that Rovio Classics: Angry Birds will be unlisted from the Google Play Store on Thursday, February 23. Additionally, the game will be renamed to Red’s First Flight in the App Store pending further review. Rovio Classics: Angry Birds will remain playable on devices on which the game has been downloaded, even after it has been unlisted.\n\nWe understand that this is sad news for many fans, as well as the team that has worked hard to make Rovio Classics: Angry Birds a reality. We are extremely grateful to the Angry Birds fans who have shown their love of the brand and this game from the beginning. We hope those fans can continue to bring that passion to our live Angry Birds slingshot games such as Angry Birds 2, Angry Birds Friends, and Angry Birds Journey, where our goal every day is to craft the best possible experience for players.\n\nIf you want to get Rovio Classics: Angry Birds before the changes, you can still buy it as of this writing on Google Play and the App Store. On both app stores, it’s technically listed as Rovio Classics: AB — which, to me, feels like a further attempt from Rovio to bury the game.", - length: summaryLength.MEDIUM, - format: summaryFormat.PARAGRAPH, - extractiveness: summaryExtractiveness.MEDIUM, - }); - }); - it("Should should have a statusCode of 200", () => { - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); - it("Should contain a summary", () => { - expect(response).to.have.property("body"); - expect(response.body).to.have.property("id"); - expect(response.body).to.have.property("summary"); - expect(response.body.summary).to.not.be.empty; - expect(response.body.id).to.not.be.empty; - }); - it("Should contain a body property that contains meta information", () => { - expect(response.body).to.have.property("meta"); - expect(response.body.meta).to.have.property("api_version"); - expect(response.body.meta?.api_version).to.have.property("version"); - }); -}); diff --git a/test/test.ts b/test/test.ts deleted file mode 100644 index d7c997d..0000000 --- a/test/test.ts +++ /dev/null @@ -1,12 +0,0 @@ -function importTest(name: string, path: string) { - describe(name, function () { - require(path); - }); -} - -describe("The `medium` model", () => { - importTest("generate", "./generate.ts"); - importTest("embed", "./embed.ts"); - importTest("classify", "./classify.ts"); - importTest("tokenize", "./tokenize.ts"); -}); diff --git a/test/tokenize.ts b/test/tokenize.ts deleted file mode 100644 index 56cb980..0000000 --- a/test/tokenize.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { expect } from "chai"; -import cohere from "../cohere"; -import { cohereResponse, tokenizeResponse } from "../models/index"; - -const KEY: string = process.env.COHERE_API_KEY || ""; - -describe("The tokenize endpoint", () => { - let response: cohereResponse; - cohere.init(KEY); - before(async () => { - response = await cohere.tokenize({ text: "hello world" }); - }); - it("Should should have a statusCode of 200", () => { - expect(response).to.have.property("statusCode"); - expect(response.statusCode).to.equal(200); - }); - it("Should contain the correct tokens", () => { - expect(response).to.have.property("body"); - expect(response.body).to.have.property("tokens"); - expect(response.body.tokens).to.deep.equal([25736, 2552]); - expect(response.body.token_strings).to.deep.equal(["hello", " world"]); - }); - it("Should contain a body property that contains meta information", () => { - expect(response.body).to.have.property("meta"); - expect(response.body.meta).to.have.property("api_version"); - expect(response.body.meta?.api_version).to.have.property("version"); - }); -}); diff --git a/tsconfig.json b/tsconfig.json index a30b759..e65fa53 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,22 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "strict": true, - "noImplicitAny": true, - "strictNullChecks": true, - "esModuleInterop": true, - "declaration": true, - "moduleResolution": "node", - "removeComments": false, - "lib": ["es5", "es2018"], - "allowJs": true, - "typeRoots": ["node_modules/@types"], - "baseUrl": ".", - "paths": { - "@/*": ["services/*"] - } - }, - "exclude": ["node_modules"], - "include": ["cohere.ts"] -} + "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/webpack.config.js b/webpack.config.js deleted file mode 100644 index 3b258dd..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,65 +0,0 @@ -const CopyPlugin = require("copy-webpack-plugin"); -const { CleanWebpackPlugin } = require("clean-webpack-plugin"); -const NodemonPlugin = require("nodemon-webpack-plugin"); -const ESLintPlugin = require("eslint-webpack-plugin"); -const path = require("path"); - -module.exports = (env = {}) => { - const config = { - mode: env.production ? "production" : "development", - entry: "./cohere.ts", - devtool: "source-map", - target: "node", - resolve: { - extensions: [".tsx", ".ts", ".js"], - alias: { - "@": path.join(__dirname, "src"), - }, - }, - output: { - filename: "cohere.js", - path: path.resolve(__dirname, "dist"), - library: { - name: "cohere", - type: "umd", - }, - }, - optimization: { - minimize: false, - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: "ts-loader", - exclude: /node_modules/, - }, - ], - }, - devServer: { - contentBase: path.join(__dirname, "dist"), - compress: true, - port: 9000, - }, - plugins: [ - new CleanWebpackPlugin(), - new ESLintPlugin({ - extensions: [".tsx", ".ts", ".js"], - }), - new CopyPlugin({ - patterns: [ - { - from: "models/index.ts", - to: "models", - }, - ], - }), - ], - }; - if (env.nodemon) { - config.watch = true; - config.plugins.push(new NodemonPlugin()); - } - - return config; -}; diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..e3d7ca2 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,89 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@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== + +"@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== + +"@ungap/url-search-params@0.2.2": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@ungap/url-search-params/-/url-search-params-0.2.2.tgz#2de3bdec21476a9b70ef11fd7b794752f9afa04c" + integrity sha512-qQsguKXZVKdCixOHX9jqnX/K/1HekPDpGKyEcXHT+zR6EjGA7S4boSuelL4uuPv6YfhN0n8c4UxW+v/Z3gM2iw== + +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@0.27.2: + version "0.27.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" + integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== + dependencies: + follow-redirects "^1.14.9" + form-data "^4.0.0" + +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" + +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== + +follow-redirects@^1.14.9: + version "1.15.3" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a" + integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q== + +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" + +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" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +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== + +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== + +url-join@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" + integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==