From b9a328bd5d4634c4b3c541dc21c683ed01f5d716 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 30 Apr 2025 17:46:01 -0300 Subject: [PATCH 1/7] pexels init --- .../actions/download-photo/download-photo.mjs | 37 + .../get-photo-details/get-photo-details.mjs | 26 + .../actions/search-photos/search-photos.mjs | 48 + .../@pipedream/platform/.eslintignore | 1 + .../node_modules/@pipedream/platform/LICENSE | 41 + .../@pipedream/platform/README.md | 3 + .../@pipedream/platform/__tests__/$send.js | 342 ++++ .../@pipedream/platform/__tests__/axios.js | 21 + .../@pipedream/platform/dist/axios.d.ts | 10 + .../@pipedream/platform/dist/axios.js | 186 ++ .../@pipedream/platform/dist/constants.d.ts | 2 + .../@pipedream/platform/dist/constants.js | 5 + .../@pipedream/platform/dist/errors.d.ts | 4 + .../@pipedream/platform/dist/errors.js | 11 + .../@pipedream/platform/dist/index.d.ts | 137 ++ .../@pipedream/platform/dist/index.js | 153 ++ .../@pipedream/platform/dist/sql-prop.d.ts | 48 + .../@pipedream/platform/dist/sql-prop.js | 30 + .../@pipedream/platform/dist/sql-proxy.d.ts | 38 + .../@pipedream/platform/dist/sql-proxy.js | 41 + .../@pipedream/platform/dist/sql.d.ts | 1 + .../@pipedream/platform/dist/sql.js | 2 + .../@pipedream/platform/dist/utils.d.ts | 2 + .../@pipedream/platform/dist/utils.js | 47 + .../@pipedream/platform/lib/axios.ts | 204 ++ .../@pipedream/platform/lib/constants.ts | 2 + .../@pipedream/platform/lib/errors.ts | 8 + .../@pipedream/platform/lib/index.ts | 212 +++ .../@pipedream/platform/lib/sql-prop.ts | 61 + .../@pipedream/platform/lib/sql-proxy.ts | 50 + .../@pipedream/platform/lib/sql.ts | 1 + .../@pipedream/platform/lib/utils.ts | 40 + .../@pipedream/platform/package.json | 32 + .../@pipedream/platform/tsconfig.json | 15 + .../pexels/node_modules/io-ts/CHANGELOG.md | 896 +++++++++ .../node_modules/io-ts/Codec/package.json | 6 + .../io-ts/DecodeError/package.json | 6 + .../node_modules/io-ts/Decoder/package.json | 6 + .../node_modules/io-ts/Encoder/package.json | 6 + .../pexels/node_modules/io-ts/Eq/package.json | 6 + .../io-ts/FreeSemigroup/package.json | 6 + .../node_modules/io-ts/Guard/package.json | 6 + .../node_modules/io-ts/Kleisli/package.json | 6 + components/pexels/node_modules/io-ts/LICENSE | 21 + .../io-ts/PathReporter/package.json | 6 + .../pexels/node_modules/io-ts/README.md | 43 + .../node_modules/io-ts/Reporter/package.json | 6 + .../node_modules/io-ts/Schema/package.json | 6 + .../node_modules/io-ts/Schemable/package.json | 6 + .../io-ts/TaskDecoder/package.json | 6 + .../io-ts/ThrowReporter/package.json | 6 + .../node_modules/io-ts/Type/package.json | 6 + .../pexels/node_modules/io-ts/es6/Codec.d.ts | 296 +++ .../pexels/node_modules/io-ts/es6/Codec.js | 284 +++ .../node_modules/io-ts/es6/DecodeError.d.ts | 135 ++ .../node_modules/io-ts/es6/DecodeError.js | 95 + .../node_modules/io-ts/es6/Decoder.d.ts | 331 ++++ .../pexels/node_modules/io-ts/es6/Decoder.js | 477 +++++ .../node_modules/io-ts/es6/Encoder.d.ts | 154 ++ .../pexels/node_modules/io-ts/es6/Encoder.js | 187 ++ .../pexels/node_modules/io-ts/es6/Eq.d.ts | 127 ++ .../pexels/node_modules/io-ts/es6/Eq.js | 195 ++ .../node_modules/io-ts/es6/FreeSemigroup.d.ts | 56 + .../node_modules/io-ts/es6/FreeSemigroup.js | 35 + .../pexels/node_modules/io-ts/es6/Guard.d.ts | 201 ++ .../pexels/node_modules/io-ts/es6/Guard.js | 295 +++ .../node_modules/io-ts/es6/Kleisli.d.ts | 226 +++ .../pexels/node_modules/io-ts/es6/Kleisli.js | 315 ++++ .../node_modules/io-ts/es6/PathReporter.d.ts | 14 + .../node_modules/io-ts/es6/PathReporter.js | 46 + .../node_modules/io-ts/es6/Reporter.d.ts | 10 + .../pexels/node_modules/io-ts/es6/Reporter.js | 1 + .../pexels/node_modules/io-ts/es6/Schema.d.ts | 35 + .../pexels/node_modules/io-ts/es6/Schema.js | 14 + .../node_modules/io-ts/es6/Schemable.d.ts | 254 +++ .../node_modules/io-ts/es6/Schemable.js | 31 + .../node_modules/io-ts/es6/TaskDecoder.d.ts | 349 ++++ .../node_modules/io-ts/es6/TaskDecoder.js | 413 +++++ .../node_modules/io-ts/es6/ThrowReporter.d.ts | 7 + .../node_modules/io-ts/es6/ThrowReporter.js | 18 + .../pexels/node_modules/io-ts/es6/Type.d.ts | 149 ++ .../pexels/node_modules/io-ts/es6/Type.js | 210 +++ .../pexels/node_modules/io-ts/es6/index.d.ts | 1374 ++++++++++++++ .../pexels/node_modules/io-ts/es6/index.js | 1645 ++++++++++++++++ .../pexels/node_modules/io-ts/lib/Codec.d.ts | 296 +++ .../pexels/node_modules/io-ts/lib/Codec.js | 332 ++++ .../node_modules/io-ts/lib/DecodeError.d.ts | 135 ++ .../node_modules/io-ts/lib/DecodeError.js | 129 ++ .../node_modules/io-ts/lib/Decoder.d.ts | 331 ++++ .../pexels/node_modules/io-ts/lib/Decoder.js | 523 ++++++ .../node_modules/io-ts/lib/Encoder.d.ts | 154 ++ .../pexels/node_modules/io-ts/lib/Encoder.js | 202 ++ .../pexels/node_modules/io-ts/lib/Eq.d.ts | 127 ++ .../pexels/node_modules/io-ts/lib/Eq.js | 226 +++ .../node_modules/io-ts/lib/FreeSemigroup.d.ts | 56 + .../node_modules/io-ts/lib/FreeSemigroup.js | 42 + .../pexels/node_modules/io-ts/lib/Guard.d.ts | 201 ++ .../pexels/node_modules/io-ts/lib/Guard.js | 337 ++++ .../node_modules/io-ts/lib/Kleisli.d.ts | 226 +++ .../pexels/node_modules/io-ts/lib/Kleisli.js | 360 ++++ .../node_modules/io-ts/lib/PathReporter.d.ts | 14 + .../node_modules/io-ts/lib/PathReporter.js | 51 + .../node_modules/io-ts/lib/Reporter.d.ts | 10 + .../pexels/node_modules/io-ts/lib/Reporter.js | 2 + .../pexels/node_modules/io-ts/lib/Schema.d.ts | 35 + .../pexels/node_modules/io-ts/lib/Schema.js | 19 + .../node_modules/io-ts/lib/Schemable.d.ts | 254 +++ .../node_modules/io-ts/lib/Schemable.js | 36 + .../node_modules/io-ts/lib/TaskDecoder.d.ts | 349 ++++ .../node_modules/io-ts/lib/TaskDecoder.js | 457 +++++ .../node_modules/io-ts/lib/ThrowReporter.d.ts | 7 + .../node_modules/io-ts/lib/ThrowReporter.js | 21 + .../pexels/node_modules/io-ts/lib/Type.d.ts | 149 ++ .../pexels/node_modules/io-ts/lib/Type.js | 248 +++ .../pexels/node_modules/io-ts/lib/index.d.ts | 1374 ++++++++++++++ .../pexels/node_modules/io-ts/lib/index.js | 1650 +++++++++++++++++ .../pexels/node_modules/io-ts/package.json | 36 + components/pexels/pexels.app.mjs | 234 ++- .../new-curated-photo/new-curated-photo.mjs | 55 + .../new-photo-by-search.mjs | 110 ++ 120 files changed, 19674 insertions(+), 4 deletions(-) create mode 100644 components/pexels/actions/download-photo/download-photo.mjs create mode 100644 components/pexels/actions/get-photo-details/get-photo-details.mjs create mode 100644 components/pexels/actions/search-photos/search-photos.mjs create mode 100644 components/pexels/node_modules/@pipedream/platform/.eslintignore create mode 100644 components/pexels/node_modules/@pipedream/platform/LICENSE create mode 100644 components/pexels/node_modules/@pipedream/platform/README.md create mode 100644 components/pexels/node_modules/@pipedream/platform/__tests__/$send.js create mode 100644 components/pexels/node_modules/@pipedream/platform/__tests__/axios.js create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/axios.d.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/axios.js create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/constants.d.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/constants.js create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/errors.d.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/errors.js create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/index.d.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/index.js create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql-prop.d.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql-prop.js create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.d.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.js create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql.d.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql.js create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/utils.d.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/dist/utils.js create mode 100644 components/pexels/node_modules/@pipedream/platform/lib/axios.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/lib/constants.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/lib/errors.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/lib/index.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/lib/sql-prop.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/lib/sql-proxy.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/lib/sql.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/lib/utils.ts create mode 100644 components/pexels/node_modules/@pipedream/platform/package.json create mode 100644 components/pexels/node_modules/@pipedream/platform/tsconfig.json create mode 100644 components/pexels/node_modules/io-ts/CHANGELOG.md create mode 100644 components/pexels/node_modules/io-ts/Codec/package.json create mode 100644 components/pexels/node_modules/io-ts/DecodeError/package.json create mode 100644 components/pexels/node_modules/io-ts/Decoder/package.json create mode 100644 components/pexels/node_modules/io-ts/Encoder/package.json create mode 100644 components/pexels/node_modules/io-ts/Eq/package.json create mode 100644 components/pexels/node_modules/io-ts/FreeSemigroup/package.json create mode 100644 components/pexels/node_modules/io-ts/Guard/package.json create mode 100644 components/pexels/node_modules/io-ts/Kleisli/package.json create mode 100644 components/pexels/node_modules/io-ts/LICENSE create mode 100644 components/pexels/node_modules/io-ts/PathReporter/package.json create mode 100644 components/pexels/node_modules/io-ts/README.md create mode 100644 components/pexels/node_modules/io-ts/Reporter/package.json create mode 100644 components/pexels/node_modules/io-ts/Schema/package.json create mode 100644 components/pexels/node_modules/io-ts/Schemable/package.json create mode 100644 components/pexels/node_modules/io-ts/TaskDecoder/package.json create mode 100644 components/pexels/node_modules/io-ts/ThrowReporter/package.json create mode 100644 components/pexels/node_modules/io-ts/Type/package.json create mode 100644 components/pexels/node_modules/io-ts/es6/Codec.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/Codec.js create mode 100644 components/pexels/node_modules/io-ts/es6/DecodeError.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/DecodeError.js create mode 100644 components/pexels/node_modules/io-ts/es6/Decoder.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/Decoder.js create mode 100644 components/pexels/node_modules/io-ts/es6/Encoder.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/Encoder.js create mode 100644 components/pexels/node_modules/io-ts/es6/Eq.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/Eq.js create mode 100644 components/pexels/node_modules/io-ts/es6/FreeSemigroup.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/FreeSemigroup.js create mode 100644 components/pexels/node_modules/io-ts/es6/Guard.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/Guard.js create mode 100644 components/pexels/node_modules/io-ts/es6/Kleisli.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/Kleisli.js create mode 100644 components/pexels/node_modules/io-ts/es6/PathReporter.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/PathReporter.js create mode 100644 components/pexels/node_modules/io-ts/es6/Reporter.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/Reporter.js create mode 100644 components/pexels/node_modules/io-ts/es6/Schema.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/Schema.js create mode 100644 components/pexels/node_modules/io-ts/es6/Schemable.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/Schemable.js create mode 100644 components/pexels/node_modules/io-ts/es6/TaskDecoder.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/TaskDecoder.js create mode 100644 components/pexels/node_modules/io-ts/es6/ThrowReporter.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/ThrowReporter.js create mode 100644 components/pexels/node_modules/io-ts/es6/Type.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/Type.js create mode 100644 components/pexels/node_modules/io-ts/es6/index.d.ts create mode 100644 components/pexels/node_modules/io-ts/es6/index.js create mode 100644 components/pexels/node_modules/io-ts/lib/Codec.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/Codec.js create mode 100644 components/pexels/node_modules/io-ts/lib/DecodeError.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/DecodeError.js create mode 100644 components/pexels/node_modules/io-ts/lib/Decoder.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/Decoder.js create mode 100644 components/pexels/node_modules/io-ts/lib/Encoder.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/Encoder.js create mode 100644 components/pexels/node_modules/io-ts/lib/Eq.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/Eq.js create mode 100644 components/pexels/node_modules/io-ts/lib/FreeSemigroup.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/FreeSemigroup.js create mode 100644 components/pexels/node_modules/io-ts/lib/Guard.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/Guard.js create mode 100644 components/pexels/node_modules/io-ts/lib/Kleisli.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/Kleisli.js create mode 100644 components/pexels/node_modules/io-ts/lib/PathReporter.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/PathReporter.js create mode 100644 components/pexels/node_modules/io-ts/lib/Reporter.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/Reporter.js create mode 100644 components/pexels/node_modules/io-ts/lib/Schema.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/Schema.js create mode 100644 components/pexels/node_modules/io-ts/lib/Schemable.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/Schemable.js create mode 100644 components/pexels/node_modules/io-ts/lib/TaskDecoder.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/TaskDecoder.js create mode 100644 components/pexels/node_modules/io-ts/lib/ThrowReporter.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/ThrowReporter.js create mode 100644 components/pexels/node_modules/io-ts/lib/Type.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/Type.js create mode 100644 components/pexels/node_modules/io-ts/lib/index.d.ts create mode 100644 components/pexels/node_modules/io-ts/lib/index.js create mode 100644 components/pexels/node_modules/io-ts/package.json create mode 100644 components/pexels/sources/new-curated-photo/new-curated-photo.mjs create mode 100644 components/pexels/sources/new-photo-by-search/new-photo-by-search.mjs diff --git a/components/pexels/actions/download-photo/download-photo.mjs b/components/pexels/actions/download-photo/download-photo.mjs new file mode 100644 index 0000000000000..7d04cc9ebc7f5 --- /dev/null +++ b/components/pexels/actions/download-photo/download-photo.mjs @@ -0,0 +1,37 @@ +import pexels from "../../pexels.app.mjs"; +import { axios } from "@pipedream/platform"; +import fs from "fs"; + +export default { + key: "pexels-download-photo", + name: "Download Photo", + description: "Download a specific photo by providing its photo ID and optionally choosing the desired size. [See the documentation](https://www.pexels.com/api/documentation/)", + version: "0.0.1", + type: "action", + props: { + pexels, + photoId: { + propDefinition: [ + pexels, + "photoId", + ], + }, + desiredSize: { + propDefinition: [ + pexels, + "desiredSize", + ], + }, + }, + async run({ $ }) { + const filePath = await this.pexels.downloadPhoto({ + photoId: this.photoId, + desiredSize: this.desiredSize, + }); + + $.export("$summary", `Successfully downloaded photo with ID ${this.photoId} to ${filePath}`); + return { + filePath, + }; + }, +}; diff --git a/components/pexels/actions/get-photo-details/get-photo-details.mjs b/components/pexels/actions/get-photo-details/get-photo-details.mjs new file mode 100644 index 0000000000000..6c78cc4f15182 --- /dev/null +++ b/components/pexels/actions/get-photo-details/get-photo-details.mjs @@ -0,0 +1,26 @@ +import pexels from "../../pexels.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "pexels-get-photo-details", + name: "Get Photo Details", + description: "Retrieve detailed information about a specific photo by providing its photo ID. [See the documentation](https://www.pexels.com/api/documentation/)", + version: "0.0.1", + type: "action", + props: { + pexels, + photoId: { + propDefinition: [ + pexels, + "photoId", + ], + }, + }, + async run({ $ }) { + const response = await this.pexels.getPhoto({ + photoId: this.photoId, + }); + $.export("$summary", `Successfully retrieved details for photo ID: ${this.photoId}`); + return response; + }, +}; diff --git a/components/pexels/actions/search-photos/search-photos.mjs b/components/pexels/actions/search-photos/search-photos.mjs new file mode 100644 index 0000000000000..0c3f75cec8fe8 --- /dev/null +++ b/components/pexels/actions/search-photos/search-photos.mjs @@ -0,0 +1,48 @@ +import pexels from "../../pexels.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "pexels-search-photos", + name: "Search Photos", + description: "Search for photos on Pexels using a keyword or phrase. [See the documentation](https://www.pexels.com/api/documentation/)", + version: "0.0.1", + type: "action", + props: { + pexels, + searchQuery: { + propDefinition: [ + pexels, + "searchQuery", + ], + }, + orientation: { + propDefinition: [ + pexels, + "orientation", + ], + }, + size: { + propDefinition: [ + pexels, + "size", + ], + }, + color: { + propDefinition: [ + pexels, + "color", + ], + }, + }, + async run({ $ }) { + const response = await this.pexels.searchPhotos({ + query: this.searchQuery, + orientation: this.orientation, + size: this.size, + color: this.color, + }); + + $.export("$summary", `Successfully retrieved ${response.photos.length} photos for the query "${this.searchQuery}".`); + return response; + }, +}; diff --git a/components/pexels/node_modules/@pipedream/platform/.eslintignore b/components/pexels/node_modules/@pipedream/platform/.eslintignore new file mode 100644 index 0000000000000..849ddff3b7ec9 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/.eslintignore @@ -0,0 +1 @@ +dist/ diff --git a/components/pexels/node_modules/@pipedream/platform/LICENSE b/components/pexels/node_modules/@pipedream/platform/LICENSE new file mode 100644 index 0000000000000..5fc16fc5c8977 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/LICENSE @@ -0,0 +1,41 @@ +Pipedream Source Available License Version 1.0 + +This Pipedream Source Available License Agreement Version 1.0 (this “Agreement”) sets forth the terms on which Pipedream, Inc., a Delaware corporation (“Pipedream”) makes available certain software (the “Software”). By installing, downloading, accessing, using or distributing the Software, you agree to the terms of this Agreement. If you do not agree to such terms, you must not use the Software. If you are receiving the Software on behalf of a legal entity, you represent and warrant that you have the actual authority to agree to the terms and conditions of this Agreement on behalf of such entity. “Licensee” means you, an individual, or the entity on whose behalf you are receiving the Software. + +LICENSE GRANT AND CONDITIONS. + +1.1 License. Subject to the terms and conditions of this Agreement, Pipedream hereby grants to Licensee a non-exclusive, royalty-free, worldwide, non-transferable, non-sublicenseable license during the term of this Agreement to use, prepare modifications and derivative works, distribute (including without limitation in source code or object code form) and reproduce copies of the Software (the “License”). Licensee is not granted the right to, and Licensee shall not, exercise the License for an Excluded Purpose. For purposes of this Agreement, “Excluded Purpose” means any commercial use of the software including, but not limited to, making available any software-as-a-service, platform-as-a-service, infrastructure-as-a-service or other online service that competes with the Software or any other Pipedream products or services. + +1.2 Conditions. In consideration of the License, Licensee’s distribution of the Software is subject to the following conditions: + +a. Licensee must cause any Software modified by Licensee to carry prominent notices stating that Licensee modified the Software. + +b. On each Software copy, Licensee shall reproduce and not remove or alter all Pipedream or third party copyright or other proprietary notices contained in the Software, and Licensee must provide this with each copy: “This software is made available by Pipedream, Inc., under the terms of the Pipedream Source Available License, Version 1.0 located at https://github.com/PipedreamHQ/pipedream/blob/master/LICENSE. By installing, downloading, accessing, using or distributing the Software, you agree to the terms of such License Agreement.” + +1.3 Modifications. Licensee may add its own copyright notices to modifications made by Licensee and may provide additional or different license terms and conditions for use, reproduction, or distribution of Licensee’s modifications. While redistributing the Software or modifications thereof, Licensee may choose to offer, for a fee or free of charge, support, warranty, indemnity, or other obligations. Licensee, and not Pipedream, will be responsible for any such obligations. + +1.4 No Sublicensing. The License does not include the right to sublicense the Software; provided, however, that any recipient to which Licensee provides the Software may exercise the License so long as such recipient agrees to the terms and conditions of this Agreement. + +TERM AND TERMINATION. + +This Agreement will continue unless and until earlier terminated as set forth herein. If Licensee breaches any of its conditions or obligations under this Agreement, this Agreement will terminate automatically and the License will terminate automatically and permanently. + +INTELLECTUAL PROPERTY. + +As between the parties, Pipedream retains all right, title, and interest in the Software, and all intellectual property rights therein. Pipedream hereby reserves all rights not expressly granted to Licensee in this Agreement. Pipedream reserves all rights in its trademarks and service marks, and no licenses thereto are granted by this Agreement. + +DISCLAIMER. + +PIPEDREAM HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE SOFTWARE. + +LIMITATION OF LIABILITY. + +PIPEDREAM WILL NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL, SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW. + +GENERAL. + +6.1 Governing Law. This Agreement will be governed by and interpreted in accordance with the laws of the state of California, without reference to its conflict of laws principles. If Licensee is located outside of the United States, any dispute, controversy or claim arising out of or relating to this Agreement will be referred to and finally determined by arbitration in accordance with the JAMS International Arbitration Rules. The tribunal will consist of one arbitrator. Judgment upon the award rendered by the arbitrator may be entered in any court having jurisdiction thereof. All disputes including arbitrations shall take place in Santa Clara County, California. The language to be used in any such proceedings shall be English. + +6.2. Assignment. Licensee is not authorized to assign its rights under this Agreement to any third party. Pipedream may freely assign its rights under this Agreement to any third party. + +6.3. Other. This Agreement is the entire agreement between the parties regarding the subject matter hereof. No amendment or modification of this Agreement will be valid or binding upon the parties unless made in writing and signed by the duly authorized representatives of both parties. In the event that any provision, including without limitation any condition, of this Agreement is held to be unenforceable, this Agreement and all licenses and rights granted hereunder will immediately terminate. Waiver by Pipedream of a breach of any provision of this Agreement or the failure by Pipedream to exercise any right hereunder will not be construed as a waiver of any subsequent breach of that right or as a waiver of any other right. diff --git a/components/pexels/node_modules/@pipedream/platform/README.md b/components/pexels/node_modules/@pipedream/platform/README.md new file mode 100644 index 0000000000000..28a37af48f59c --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/README.md @@ -0,0 +1,3 @@ +# Pipedream Platform + +See https://pipedream.com/docs/pipedream-axios/ for usage examples. diff --git a/components/pexels/node_modules/@pipedream/platform/__tests__/$send.js b/components/pexels/node_modules/@pipedream/platform/__tests__/$send.js new file mode 100644 index 0000000000000..ebacb4e8838fb --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/__tests__/$send.js @@ -0,0 +1,342 @@ +// purposefully test COMPILED platform.js! (just as lambda_maker would) +const { + $sendConfigRuntimeTypeChecker, HTTP_METHODS, +} = require("../dist"); + +function randString() { + return "" + Math.random(); +} + +function randHttpMethod() { + const idx = Math.floor(Math.random() * HTTP_METHODS.length); + return HTTP_METHODS[idx]; +} + +const emptyConfig = {}; + +// XXX would be nice to generate a lot of these tests automatically... +// - should vary payload type (between string and object) + +describe("$send.email", () => { + const checker = $sendConfigRuntimeTypeChecker.email; + let config; + beforeEach(() => { + config = { + html: randString(), + subject: randString(), + text: randString(), + }; + }); + + it("should pass with empty config", () => { + expect(() => checker(emptyConfig)).not.toThrow(); + }); + + it("should pass with full config", () => { + expect(() => checker(config)).not.toThrow(); + }); + + it.skip("should fail with .__extra", () => { + config.__extra = randString(); + expect(() => checker(config)).toThrow(); + }); +}); + +describe("$send.emit", () => { + const checker = $sendConfigRuntimeTypeChecker.emit; + let config; + beforeEach(() => { + config = { + raw_event: { + key: randString(), + }, + }; + }); + + it("should fail with empty config", () => { + expect(() => checker({})).toThrow(); + }); + + it("should pass with full config", () => { + expect(() => checker(config)).not.toThrow(); + }); + + it.skip("should fail with .__extra", () => { + config.__extra = randString(); + expect(() => checker(config)).toThrow(); + }); +}); + +describe("$send.http", () => { + const checker = $sendConfigRuntimeTypeChecker.http; + let config; + beforeEach(() => { + config = { + method: randHttpMethod(), + url: randString(), + auth: { + password: randString(), + username: randString(), + }, + data: randString(), + headers: { + [randString()]: randString(), + [randString()]: randString(), + }, + params: { + [randString()]: randString(), + [randString()]: randString(), + }, + }; + }); + + it("should fail with empty config", () => { + expect(() => checker({})).toThrow(); + }); + + it("should pass with full config", () => { + expect(() => checker(config)).not.toThrow(); + }); + + it.skip("should fail with .__extra", () => { + config.__extra = randString(); + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .method", () => { + delete config.method; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .url", () => { + delete config.url; + expect(() => checker(config)).toThrow(); + }); + + it("should pass without .auth", () => { + delete config.auth; + expect(() => checker(config)).not.toThrow(); + }); + + it("should fail without .auth.username", () => { + delete config.auth.username; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .auth.password", () => { + delete config.auth.password; + expect(() => checker(config)).toThrow(); + }); + + it.skip("should fail with .auth.__extra", () => { + config.auth.__extra = randString(); + expect(() => checker(config)).toThrow(); + }); + + it("should pass without .data", () => { + delete config.data; + expect(() => checker(config)).not.toThrow(); + }); + + it("should pass with object .data", () => { + config.data = { + [randString()]: randString(), + [randString()]: randString(), + }; + expect(() => checker(config)).not.toThrow(); + }); + + it("should pass without .headers", () => { + delete config.headers; + expect(() => checker(config)).not.toThrow(); + }); + + it("should pass without .params", () => { + delete config.params; + expect(() => checker(config)).not.toThrow(); + }); +}); + +describe("$send.s3", () => { + const checker = $sendConfigRuntimeTypeChecker.s3; + let config; + beforeEach(() => { + config = { + bucket: randString(), + payload: randString(), + prefix: randString(), + }; + }); + + it("should fail with empty config", () => { + expect(() => checker({})).toThrow(); + }); + + it("should pass with full config", () => { + expect(() => checker(config)).not.toThrow(); + }); + + it.skip("should fail with .__extra", () => { + config.__extra = randString(); + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .bucket", () => { + delete config.bucket; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .payload", () => { + delete config.payload; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .prefix", () => { + delete config.prefix; + expect(() => checker(config)).toThrow(); + }); +}); + +describe("$send.sql", () => { + const checker = $sendConfigRuntimeTypeChecker.sql; + let config; + beforeEach(() => { + config = { + payload: randString(), + table: randString(), + }; + }); + + it("should fail with empty config", () => { + expect(() => checker({})).toThrow(); + }); + + it("should pass with full config", () => { + expect(() => checker(config)).not.toThrow(); + }); + + it.skip("should fail with .__extra", () => { + config.__extra = randString(); + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .payload", () => { + delete config.payload; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .table", () => { + delete config.table; + expect(() => checker(config)).toThrow(); + }); +}); + +describe("$send.snowflake", () => { + const checker = $sendConfigRuntimeTypeChecker.snowflake; + let config; + beforeEach(() => { + config = { + account: randString(), + database: randString(), + host: randString(), + payload: randString(), + pipe_name: randString(), + private_key: randString(), + schema: randString(), + stage_name: randString(), + user: randString(), + }; + }); + + it("should fail with empty config", () => { + expect(() => checker({})).toThrow(); + }); + + it("should pass with full config", () => { + expect(() => checker(config)).not.toThrow(); + }); + + it.skip("should fail with .__extra", () => { + config.__extra = randString(); + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .account", () => { + delete config.account; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .database", () => { + delete config.database; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .host", () => { + delete config.host; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .payload", () => { + delete config.payload; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .pipe_name", () => { + delete config.pipe_name; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .private_key", () => { + delete config.private_key; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .schema", () => { + delete config.schema; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .stage_name", () => { + delete config.stage_name; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .user", () => { + delete config.stage_name; + expect(() => checker(config)).toThrow(); + }); +}); + +describe("$send.sse", () => { + const checker = $sendConfigRuntimeTypeChecker.sse; + let config; + beforeEach(() => { + config = { + channel: randString(), + payload: randString(), + }; + }); + + it("should fail with empty config", () => { + expect(() => checker({})).toThrow(); + }); + + it("should pass with full config", () => { + expect(() => checker(config)).not.toThrow(); + }); + + it.skip("should fail with .__extra", () => { + config.__extra = randString(); + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .channel", () => { + delete config.channel; + expect(() => checker(config)).toThrow(); + }); + + it("should fail without .payload", () => { + delete config.payload; + expect(() => checker(config)).toThrow(); + }); +}); diff --git a/components/pexels/node_modules/@pipedream/platform/__tests__/axios.js b/components/pexels/node_modules/@pipedream/platform/__tests__/axios.js new file mode 100644 index 0000000000000..1172548260326 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/__tests__/axios.js @@ -0,0 +1,21 @@ +const { axios } = require("../dist"); + +describe("axios", () => { + it("should fail as expected", async () => { + const step = {}; + await expect(axios(step, { + url: "http://56371f3c71069f63d769d0b7ddeca4ac.x.pipedream.net/this-should-404", + })).rejects.toThrow(); + expect(step.debug).toHaveProperty("config"); + }); + + it("should contain debug", async () => { + const step = {}; + await axios(step, { + url: "https://api.github.com/users/defunkt", + debug: true, + }); + expect(step).toHaveProperty("debug_config"); + expect(step).toHaveProperty("debug_response"); + }); +}); diff --git a/components/pexels/node_modules/@pipedream/platform/dist/axios.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/axios.d.ts new file mode 100644 index 0000000000000..b6c1207240536 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/axios.d.ts @@ -0,0 +1,10 @@ +import { AxiosRequestConfig } from "./index"; +export declare function transformConfigForOauth(config: AxiosRequestConfig): { + method: string; + url: string; +}; +declare function callAxios(step: any, config: AxiosRequestConfig, signConfig?: any): Promise; +declare namespace callAxios { + var create: (config?: AxiosRequestConfig | undefined, signConfig?: any) => import("axios").AxiosInstance; +} +export default callAxios; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/axios.js b/components/pexels/node_modules/@pipedream/platform/dist/axios.js new file mode 100644 index 0000000000000..3b6d1f49a86d4 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/axios.js @@ -0,0 +1,186 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.transformConfigForOauth = void 0; +const axios_1 = require("axios"); +const querystring = require("querystring"); +const utils_1 = require("./utils"); +const errors_1 = require("./errors"); +function cleanObject(o = {}) { + for (const k in o) { + if (typeof o[k] === "undefined") { + delete o[k]; + } + } +} +// remove query params from url and put into config.params +function removeSearchFromUrl(config) { + if (!config.url) + return; + const { url, baseURL, } = config; + const newUrl = new URL((baseURL !== null && baseURL !== void 0 ? baseURL : "") + url); + const queryString = newUrl.search.substr(1); + if (queryString) { + // https://stackoverflow.com/a/8649003/387413 + const urlParams = JSON.parse("{\"" + queryString.replace(/&/g, "\",\"").replace(/=/g, "\":\"") + "\"}", function (key, value) { + return key === "" + ? value + : decodeURIComponent(value); + }); + for (const k in urlParams) { + if (!config.params) + config.params = {}; + if (k in config.params) + continue; // params object > url query params + config.params[k] = urlParams[k]; + } + newUrl.search = ""; + config.url = newUrl.toString(); // if ends with ? should be okay, but could be cleaner + } +} +// https://github.com/ttezel/twit/blob/master/lib/helpers.js#L11 +function oauth1ParamsSerializer(p) { + return querystring.stringify(p) + .replace(/!/g, "%21") + .replace(/'/g, "%27") + .replace(/\(/g, "%28") + .replace(/\)/g, "%29") + .replace(/\*/g, "%2A"); +} +function transformConfigForOauth(config) { + var _a; + const newUrl = axios_1.default.getUri({ + ...config, + paramsSerializer: oauth1ParamsSerializer, + }); + const requestData = { + method: config.method || "get", + url: newUrl, + }; + // the OAuth specification explicitly states that only form-encoded data should be included + let hasContentType = false; + let formEncodedContentType = false; + for (const k in config.headers || {}) { + if (/content-type/i.test(k)) { + hasContentType = true; + formEncodedContentType = ((_a = config.headers) === null || _a === void 0 ? void 0 : _a[k]) === "application/x-www-form-urlencoded"; + break; + } + } + if (config.data && typeof config.data === "object" && formEncodedContentType) { + requestData.data = config.data; + } + else if (typeof config.data === "string" && (!hasContentType || formEncodedContentType)) { + requestData.data = querystring.parse(config.data); + } + config.paramsSerializer = oauth1ParamsSerializer; + return requestData; +} +exports.transformConfigForOauth = transformConfigForOauth; +async function getOauthSignature(config, signConfig) { + const { oauthSignerUri, token, } = signConfig; + const requestData = transformConfigForOauth(config); + const payload = { + requestData, + token, + }; + return (await axios_1.default.post(oauthSignerUri, payload)).data; +} +// XXX warn about mutating config object... or clone? +async function callAxios(step, config, signConfig) { + cleanObject(config.headers); + cleanObject(config.params); + if (typeof config.data === "object") { + cleanObject(config.data); + } + if (config.body != null) { + throw new errors_1.ConfigurationError("unexpected body, use only data instead"); + } + removeSearchFromUrl(config); + // OAuth1 request + if (signConfig) { + const oauthSignature = await getOauthSignature(config, signConfig); + if (!config.headers) + config.headers = {}; + config.headers.Authorization = oauthSignature; + } + try { + if (config.debug) { + stepExport(step, config, "debug_config"); + } + const response = await axios_1.default(config); + if (config.debug) { + stepExport(step, response.data, "debug_response"); + } + return config.returnFullResponse + ? response + : response.data; + } + catch (err) { + if (err.response) { + convertAxiosError(err); + stepExport(step, err.response, "debug"); + } + throw err; + } +} +function stepExport(step, message, key) { + message = utils_1.cloneSafe(message); + if (step) { + if (step.export) { + step.export(key, message); + return; + } + step[key] = message; + } + console.log(`export: ${key} - ${JSON.stringify(message, null, 2)}`); +} +function convertAxiosError(err) { + delete err.response.request; + err.name = `${err.name} - ${err.message}`; + try { + err.message = JSON.stringify(err.response.data); + } + catch (error) { + console.error("Error trying to convert `err.response.data` to string"); + } + return err; +} +function create(config, signConfig) { + const axiosInstance = axios_1.default.create(config); + if (config === null || config === void 0 ? void 0 : config.debug) { + stepExport(this, config, "debug_config"); + } + axiosInstance.interceptors.request.use(async (config) => { + if (signConfig) { + const oauthSignature = await getOauthSignature(config, signConfig); + if (!config.headers) + config.headers = {}; + config.headers.Authorization = oauthSignature; + } + cleanObject(config.headers); + cleanObject(config.params); + if (typeof config.data === "object") { + cleanObject(config.data); + } + removeSearchFromUrl(config); + return config; + }); + axiosInstance.interceptors.response.use((response) => { + const config = response.config; + if (config.debug) { + stepExport(this, response.data, "debug_response"); + } + return config.returnFullResponse + ? response + : response.data; + }, (error) => { + if (error.response) { + convertAxiosError(error); + stepExport(this, error.response, "debug"); + } + throw error; + }); + return axiosInstance; +} +callAxios.create = create; +exports.default = callAxios; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/constants.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/constants.d.ts new file mode 100644 index 0000000000000..4f72a54933d77 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/constants.d.ts @@ -0,0 +1,2 @@ +export declare const DEFAULT_POLLING_SOURCE_TIMER_INTERVAL: number; +export declare const PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID = "fnd4m13k1mjb6djallp1m9kr7o8kslcu"; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/constants.js b/components/pexels/node_modules/@pipedream/platform/dist/constants.js new file mode 100644 index 0000000000000..98a5374e30163 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/constants.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID = exports.DEFAULT_POLLING_SOURCE_TIMER_INTERVAL = void 0; +exports.DEFAULT_POLLING_SOURCE_TIMER_INTERVAL = 60 * 15; +exports.PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID = "fnd4m13k1mjb6djallp1m9kr7o8kslcu"; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/errors.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/errors.d.ts new file mode 100644 index 0000000000000..932c557422a19 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/errors.d.ts @@ -0,0 +1,4 @@ +export declare class ConfigurationError extends Error { + exposeStack: boolean; + constructor(message: string, exposeStack?: boolean); +} diff --git a/components/pexels/node_modules/@pipedream/platform/dist/errors.js b/components/pexels/node_modules/@pipedream/platform/dist/errors.js new file mode 100644 index 0000000000000..4f953aa9ab835 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/errors.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ConfigurationError = void 0; +class ConfigurationError extends Error { + constructor(message, exposeStack = false) { + super(message); + this.name = "ConfigurationError"; + this.exposeStack = exposeStack; + } +} +exports.ConfigurationError = ConfigurationError; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/index.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/index.d.ts new file mode 100644 index 0000000000000..a68f663ae5e1a --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/index.d.ts @@ -0,0 +1,137 @@ +import * as t from "io-ts"; +import axios, { transformConfigForOauth } from "./axios"; +import { AxiosRequestConfig as AxiosConfig } from "axios"; +export { axios, transformConfigForOauth, }; +export { cloneSafe, jsonStringifySafe, } from "./utils"; +export { ConfigurationError, } from "./errors"; +export { default as sqlProp, } from "./sql-prop"; +export type { ColumnSchema, DbInfo, TableInfo, TableMetadata, TableSchema, } from "./sql-prop"; +export { default as sqlProxy, } from "./sql-proxy"; +export { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID, } from "./constants"; +export declare const SendConfigEmail: t.PartialC<{ + html: t.StringC; + subject: t.StringC; + text: t.StringC; +}>; +export declare type SendConfigEmail = t.TypeOf; +export declare const SendConfigEmit_required: t.ExactC>; +export declare const SendConfigEmit_optional: t.PartialC<{ + event: t.ObjectC; +}>; +export declare const SendConfigEmit: t.IntersectionC<[t.ExactC>, t.PartialC<{ + event: t.ObjectC; +}>]>; +export declare type SendConfigEmit = t.TypeOf; +export declare const HTTP_METHODS: string[]; +export declare const SendConfigHTTP: t.IntersectionC<[t.ExactC; + url: t.StringC; +}>>, t.PartialC<{ + auth: t.ExactC>; + data: t.UnionC<[t.StringC, t.ObjectC]>; + headers: t.ObjectC; + params: t.ObjectC; +}>]>; +export declare type SendConfigHTTP = t.TypeOf; +export declare const SendConfigS3: t.ExactC; + prefix: t.StringC; +}>>; +export declare type SendConfigS3 = t.TypeOf; +export declare const SendConfigSQL: t.ExactC; + table: t.StringC; +}>>; +export declare type SendConfigSQL = t.TypeOf; +export declare const SendConfigSnowflake: t.ExactC; + pipe_name: t.StringC; + private_key: t.StringC; + schema: t.StringC; + stage_name: t.StringC; + user: t.StringC; +}>>; +export declare type SendConfigSnowflake = t.TypeOf; +export declare const SendConfigSSE: t.ExactC; +}>>; +export declare type SendConfigSSE = t.TypeOf; +interface SendFunctionsWrapper { + email: (config: SendConfigEmail) => void; + emit: (config: SendConfigEmit) => void; + http: (config: SendConfigHTTP) => void; + s3: (config: SendConfigS3) => void; + sql: (config: SendConfigSQL) => void; + snowflake: (config: SendConfigSnowflake) => void; + sse: (config: SendConfigSSE) => void; +} +export declare const sendTypeMap: { + email: t.PartialC<{ + html: t.StringC; + subject: t.StringC; + text: t.StringC; + }>; + emit: t.IntersectionC<[t.ExactC>, t.PartialC<{ + event: t.ObjectC; + }>]>; + http: t.IntersectionC<[t.ExactC; + url: t.StringC; + }>>, t.PartialC<{ + auth: t.ExactC>; + data: t.UnionC<[t.StringC, t.ObjectC]>; + headers: t.ObjectC; + params: t.ObjectC; + }>]>; + s3: t.ExactC; + prefix: t.StringC; + }>>; + sql: t.ExactC; + table: t.StringC; + }>>; + snowflake: t.ExactC; + pipe_name: t.StringC; + private_key: t.StringC; + schema: t.StringC; + stage_name: t.StringC; + user: t.StringC; + }>>; + sse: t.ExactC; + }>>; +}; +export declare let $event: any; +export declare const END_NEEDLE = "__pd_end"; +export declare function $end(message?: string): void; +export declare let $send: SendFunctionsWrapper; +export declare const $sendConfigRuntimeTypeChecker: {}; +export interface AxiosRequestConfig extends AxiosConfig { + debug?: boolean; + body?: any; + returnFullResponse?: boolean; +} diff --git a/components/pexels/node_modules/@pipedream/platform/dist/index.js b/components/pexels/node_modules/@pipedream/platform/dist/index.js new file mode 100644 index 0000000000000..b34b761357888 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/index.js @@ -0,0 +1,153 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.$sendConfigRuntimeTypeChecker = exports.$send = exports.$end = exports.END_NEEDLE = exports.$event = exports.sendTypeMap = exports.SendConfigSSE = exports.SendConfigSnowflake = exports.SendConfigSQL = exports.SendConfigS3 = exports.SendConfigHTTP = exports.HTTP_METHODS = exports.SendConfigEmit = exports.SendConfigEmit_optional = exports.SendConfigEmit_required = exports.SendConfigEmail = exports.transformConfigForOauth = exports.axios = void 0; +const t = require("io-ts"); +const axios_1 = require("./axios"); +exports.axios = axios_1.default; +Object.defineProperty(exports, "transformConfigForOauth", { enumerable: true, get: function () { return axios_1.transformConfigForOauth; } }); +var utils_1 = require("./utils"); +Object.defineProperty(exports, "cloneSafe", { enumerable: true, get: function () { return utils_1.cloneSafe; } }); +Object.defineProperty(exports, "jsonStringifySafe", { enumerable: true, get: function () { return utils_1.jsonStringifySafe; } }); +var errors_1 = require("./errors"); +Object.defineProperty(exports, "ConfigurationError", { enumerable: true, get: function () { return errors_1.ConfigurationError; } }); +var sql_prop_1 = require("./sql-prop"); +Object.defineProperty(exports, "sqlProp", { enumerable: true, get: function () { return sql_prop_1.default; } }); +var sql_proxy_1 = require("./sql-proxy"); +Object.defineProperty(exports, "sqlProxy", { enumerable: true, get: function () { return sql_proxy_1.default; } }); +var constants_1 = require("./constants"); +Object.defineProperty(exports, "DEFAULT_POLLING_SOURCE_TIMER_INTERVAL", { enumerable: true, get: function () { return constants_1.DEFAULT_POLLING_SOURCE_TIMER_INTERVAL; } }); +Object.defineProperty(exports, "PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID", { enumerable: true, get: function () { return constants_1.PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID; } }); +const SendPayload = t.union([ + t.string, + t.object, +]); +exports.SendConfigEmail = t.partial({ + html: t.string, + subject: t.string, + text: t.string, +}); +exports.SendConfigEmit_required = t.strict({ + raw_event: t.object, +}); +exports.SendConfigEmit_optional = t.partial({ + event: t.object, +}); +exports.SendConfigEmit = t.intersection([ + exports.SendConfigEmit_required, + exports.SendConfigEmit_optional, +]); +// interface SendConfigHTTPKv { +// [key: string]: string; +// } +const SendConfigHTTPKv = t.object; // XXX should be type above +const SendConfigHTTPAuth = t.strict({ + password: t.string, + username: t.string, +}); +// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods +exports.HTTP_METHODS = [ + "GET", + "HEAD", + "POST", + "PUT", + "DELETE", + "CONNECT", + "OPTIONS", + "TRACE", + "PATCH", +]; +// HTTP method must be uppercase (for kotlin in coordinator -- i voted to make it case insensitive, but w.e for now) +const SendConfigHTTPMethod = t.keyof(exports.HTTP_METHODS.reduce((acc, v) => { + acc[v] = null; + return acc; +}, {})); +const SendConfigHTTP_required = t.strict({ + method: SendConfigHTTPMethod, + url: t.string, +}); +const SendConfigHTTP_optional = t.partial({ + auth: SendConfigHTTPAuth, + data: SendPayload, + headers: SendConfigHTTPKv, + params: SendConfigHTTPKv, +}); +exports.SendConfigHTTP = t.intersection([ + SendConfigHTTP_required, + SendConfigHTTP_optional, +]); +exports.SendConfigS3 = t.strict({ + bucket: t.string, + payload: SendPayload, + prefix: t.string, +}); +exports.SendConfigSQL = t.strict({ + payload: SendPayload, + table: t.string, +}); +exports.SendConfigSnowflake = t.strict({ + account: t.string, + database: t.string, + host: t.string, + payload: SendPayload, + pipe_name: t.string, + private_key: t.string, + schema: t.string, + stage_name: t.string, + user: t.string, +}); +exports.SendConfigSSE = t.strict({ + channel: t.string, + payload: SendPayload, +}); +// XXX would be cool to have this and SendFunctionsWrapper be more shared +exports.sendTypeMap = { + email: exports.SendConfigEmail, + emit: exports.SendConfigEmit, + http: exports.SendConfigHTTP, + s3: exports.SendConfigS3, + sql: exports.SendConfigSQL, + snowflake: exports.SendConfigSnowflake, + sse: exports.SendConfigSSE, +}; +exports.END_NEEDLE = "__pd_end"; +// End workflow with optional message. +function $end(message) { + const err = new Error(); + err[exports.END_NEEDLE] = { + message, + ts: new Date().toISOString(), + }; + throw err; +} +exports.$end = $end; +exports.$sendConfigRuntimeTypeChecker = (function () { + const ret = {}; + for (const [sendName, sendConfigType,] of Object.entries(exports.sendTypeMap)) { + ret[sendName] = function (config) { + const result = sendConfigType.decode(config); + if (!result) + throw new Error("io-ts: unexpected decode output"); + if (result._tag === "Left") { + for (const err of result.left) { + if (err.message) { + throw new Error(err.message); + } + else { + const keyChunks = []; + for (const ctx of err.context) { + if (!ctx.key) + continue; + if (!isNaN(+ctx.key)) + continue; + keyChunks.push(ctx.key); + } + throw new Error(`$send.${sendName}: invalid value ${err.value} for ${keyChunks.join(".")}`); + } + } + throw new Error("io-ts: error but could not produce message"); // shouldn't happen... + } + // XXX if result !== config they passed extra fields... but expensive + }; + } + return ret; +})(); diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.d.ts new file mode 100644 index 0000000000000..3d9e5b904b97f --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.d.ts @@ -0,0 +1,48 @@ +import { JsonPrimitive } from "type-fest"; +import { ExecuteQueryArgs } from "./sql"; +export declare type ColumnSchema = { + columnDefault: JsonPrimitive; + dataType: string; + isNullable: boolean; + tableSchema?: string; +}; +export declare type TableMetadata = { + rowCount?: number; +}; +export declare type TableSchema = { + [columnName: string]: ColumnSchema; +}; +export declare type TableInfo = { + metadata: TableMetadata; + schema: TableSchema; +}; +export declare type DbInfo = { + [tableName: string]: TableInfo; +}; +export declare type SqlProp = { + query: string; + params?: string[]; +}; +declare const _default: { + methods: { + /** + * A method that transforms the value of a prop of type `sql` so that it can + * be fed to the `executeQuery` method. + * + * @param sqlProp - The prop of type `sql` + * @returns The arguments to be passed to `executeQuery` + */ + executeQueryAdapter(sqlProp: SqlProp): ExecuteQueryArgs; + /** + * A helper method to get the schema of the database. Used by other features + * (like the `sql` prop) to enrich the code editor and provide the user with + * auto-complete and fields suggestion. + * + * @returns {DbInfo} The schema of the database, which is a + * JSON-serializable object. + * @throws {ConfigurationError} If the method is not implemented. + */ + getSchema(): DbInfo; + }; +}; +export default _default; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.js b/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.js new file mode 100644 index 0000000000000..0d6004e8db76a --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const errors_1 = require("./errors"); +exports.default = { + methods: { + /** + * A method that transforms the value of a prop of type `sql` so that it can + * be fed to the `executeQuery` method. + * + * @param sqlProp - The prop of type `sql` + * @returns The arguments to be passed to `executeQuery` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + executeQueryAdapter(sqlProp) { + throw new errors_1.ConfigurationError("executeQueryAdapter not implemented"); + }, + /** + * A helper method to get the schema of the database. Used by other features + * (like the `sql` prop) to enrich the code editor and provide the user with + * auto-complete and fields suggestion. + * + * @returns {DbInfo} The schema of the database, which is a + * JSON-serializable object. + * @throws {ConfigurationError} If the method is not implemented. + */ + getSchema() { + throw new errors_1.ConfigurationError("getSchema not implemented"); + }, + }, +}; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.d.ts new file mode 100644 index 0000000000000..24888db3e6ce5 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.d.ts @@ -0,0 +1,38 @@ +import { ExecuteQueryArgs } from "./sql"; +export declare type ClientConfiguration = object; +export declare type ProxyArgs = { + query: string; + params?: unknown[]; +}; +export declare type Row = object; +declare const _default: { + methods: { + /** + * A helper method to get the configuration object that's directly fed to + * the DB client constructor. Used by other features (like SQL proxy) to + * initialize their client in an identical way. + * + * @returns The configuration object for the DB client + */ + getClientConfiguration(): ClientConfiguration; + /** + * Executes a query against the database. This method takes care of + * connecting to the database, executing the query, and closing the + * connection. + * + * @param args - The query string or object to be sent to the DB. SQL query. + * @returns The rows returned by the DB as a result of the query. + */ + executeQuery(args: ExecuteQueryArgs): Row[]; + /** + * Adapts the arguments to `executeQuery` so that they can be consumed by + * the SQL proxy (when applicable). Note that this method is not intended to + * be used by the component directly. + * + * @param args - The query string or object to be sent to the DB. + * @returns The adapted query and parameters. + */ + proxyAdapter(args: ExecuteQueryArgs): ProxyArgs; + }; +}; +export default _default; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.js b/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.js new file mode 100644 index 0000000000000..f59b771575033 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const errors_1 = require("./errors"); +exports.default = { + methods: { + /** + * A helper method to get the configuration object that's directly fed to + * the DB client constructor. Used by other features (like SQL proxy) to + * initialize their client in an identical way. + * + * @returns The configuration object for the DB client + */ + getClientConfiguration() { + throw new errors_1.ConfigurationError("getClientConfiguration not implemented"); + }, + /** + * Executes a query against the database. This method takes care of + * connecting to the database, executing the query, and closing the + * connection. + * + * @param args - The query string or object to be sent to the DB. SQL query. + * @returns The rows returned by the DB as a result of the query. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + executeQuery(args) { + throw new errors_1.ConfigurationError("executeQuery not implemented"); + }, + /** + * Adapts the arguments to `executeQuery` so that they can be consumed by + * the SQL proxy (when applicable). Note that this method is not intended to + * be used by the component directly. + * + * @param args - The query string or object to be sent to the DB. + * @returns The adapted query and parameters. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + proxyAdapter(args) { + throw new errors_1.ConfigurationError("proxyAdapter not implemented"); + }, + }, +}; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/sql.d.ts new file mode 100644 index 0000000000000..fe800cb869ac4 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/sql.d.ts @@ -0,0 +1 @@ +export declare type ExecuteQueryArgs = object | string; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql.js b/components/pexels/node_modules/@pipedream/platform/dist/sql.js new file mode 100644 index 0000000000000..c8ad2e549bdc6 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/sql.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/components/pexels/node_modules/@pipedream/platform/dist/utils.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/utils.d.ts new file mode 100644 index 0000000000000..6885d9171eb16 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/utils.d.ts @@ -0,0 +1,2 @@ +export declare function cloneSafe(o: any): any; +export declare function jsonStringifySafe(v: any, set?: Set): string | undefined; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/utils.js b/components/pexels/node_modules/@pipedream/platform/dist/utils.js new file mode 100644 index 0000000000000..c964c3dfcaf8b --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/dist/utils.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.jsonStringifySafe = exports.cloneSafe = void 0; +function cloneSafe(o) { + const str = jsonStringifySafe(o); + return str + ? JSON.parse(str) + : null; +} +exports.cloneSafe = cloneSafe; +// this looks pretty terrible, but on axios return value, +// +// jsonStringifySafe ~1ms +// util.inspect ~2ms +// +// XXX could most likely be improved +function jsonStringifySafe(v, set) { + try { + return JSON.stringify(v); + } + catch (err) { + set = new Set(set || []); + if (set.has(v)) + return; + set.add(v); + if (typeof v === "object") { + const strs = []; + if (Array.isArray(v)) { + for (const el of v) { + const str = jsonStringifySafe(el, set); + if (str) + strs.push(str); + } + return `[${strs.join(",")}]`; + } + for (const k in v) { + const str = jsonStringifySafe(v[k], set); + if (str) { + const kStr = JSON.stringify(k); + strs.push(`${kStr}:${str}`); + } + } + return `{${strs.join(",")}}`; + } + } +} +exports.jsonStringifySafe = jsonStringifySafe; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/axios.ts b/components/pexels/node_modules/@pipedream/platform/lib/axios.ts new file mode 100644 index 0000000000000..e53eaa916ac28 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/lib/axios.ts @@ -0,0 +1,204 @@ +import axios from "axios"; +import { AxiosRequestConfig } from "./index"; +import * as querystring from "querystring"; +import { cloneSafe } from "./utils"; +import { ConfigurationError } from "./errors"; + +function cleanObject(o = {}) { + for (const k in o) { + if (typeof o[k] === "undefined") { + delete o[k]; + } + } +} + +// remove query params from url and put into config.params +function removeSearchFromUrl(config: AxiosRequestConfig) { + if (!config.url) return; + const { + url, baseURL, + } = config; + const newUrl = new URL((baseURL ?? "") + url); + const queryString = newUrl.search.substr(1); + if (queryString) { + // https://stackoverflow.com/a/8649003/387413 + const urlParams = JSON.parse("{\"" + queryString.replace(/&/g, "\",\"").replace(/=/g, "\":\"") + "\"}", function (key, value) { + return key === "" + ? value + : decodeURIComponent(value); + }); + for (const k in urlParams) { + if (!config.params) config.params = {}; + if (k in config.params) continue; // params object > url query params + config.params[k] = urlParams[k]; + } + newUrl.search = ""; + config.url = newUrl.toString(); // if ends with ? should be okay, but could be cleaner + } +} + +// https://github.com/ttezel/twit/blob/master/lib/helpers.js#L11 +function oauth1ParamsSerializer(p: any) { + return querystring.stringify(p) + .replace(/!/g, "%21") + .replace(/'/g, "%27") + .replace(/\(/g, "%28") + .replace(/\)/g, "%29") + .replace(/\*/g, "%2A"); +} + +export function transformConfigForOauth(config: AxiosRequestConfig) { + const newUrl = axios.getUri({ + ...config, + paramsSerializer: oauth1ParamsSerializer, + }); + const requestData = { + method: config.method || "get", + url: newUrl, + }; + // the OAuth specification explicitly states that only form-encoded data should be included + let hasContentType = false; + let formEncodedContentType = false; + for (const k in config.headers || {}) { + if (/content-type/i.test(k)) { + hasContentType = true; + formEncodedContentType = config.headers?.[k] === "application/x-www-form-urlencoded"; + break; + } + } + if (config.data && typeof config.data === "object" && formEncodedContentType) { + (requestData as any).data = config.data; + } else if (typeof config.data === "string" && (!hasContentType || formEncodedContentType)) { + (requestData as any).data = querystring.parse(config.data); + } + config.paramsSerializer = oauth1ParamsSerializer; + return requestData; +} + +async function getOauthSignature(config: AxiosRequestConfig, signConfig: any) { + const { + oauthSignerUri, token, + } = signConfig; + + const requestData = transformConfigForOauth(config); + const payload = { + requestData, + token, + }; + return (await axios.post(oauthSignerUri, payload)).data; +} + +// XXX warn about mutating config object... or clone? +async function callAxios(step: any, config: AxiosRequestConfig, signConfig?: any) { + cleanObject(config.headers); + cleanObject(config.params); + if (typeof config.data === "object") { + cleanObject(config.data); + } + if (config.body != null) { + throw new ConfigurationError("unexpected body, use only data instead"); + } + removeSearchFromUrl(config); + + // OAuth1 request + if (signConfig) { + const oauthSignature = await getOauthSignature(config, signConfig); + if (!config.headers) config.headers = {}; + config.headers.Authorization = oauthSignature; + } + + try { + if (config.debug) { + stepExport(step, config, "debug_config"); + } + const response = await axios(config); + if (config.debug) { + stepExport(step, response.data, "debug_response"); + } + + return config.returnFullResponse + ? response + : response.data; + } catch (err) { + if (err.response) { + convertAxiosError(err); + stepExport(step, err.response, "debug"); + } + throw err; + } +} + +function stepExport(step: any, message: any, key: string) { + message = cloneSafe(message); + + if (step) { + if (step.export) { + step.export(key, message); + return; + } + step[key] = message; + } + + console.log(`export: ${key} - ${JSON.stringify(message, null, 2)}`); +} + +function convertAxiosError(err) { + delete err.response.request; + err.name = `${err.name} - ${err.message}`; + try { + err.message = JSON.stringify(err.response.data); + } + catch (error) { + console.error("Error trying to convert `err.response.data` to string"); + } + return err; +} + +function create(config?: AxiosRequestConfig, signConfig?: any) { + const axiosInstance = axios.create(config); + + if (config?.debug) { + stepExport(this, config, "debug_config"); + } + + axiosInstance.interceptors.request.use(async (config) => { + if (signConfig) { + const oauthSignature = await getOauthSignature(config, signConfig); + if (!config.headers) config.headers = {}; + config.headers.Authorization = oauthSignature; + } + + cleanObject(config.headers); + cleanObject(config.params); + if (typeof config.data === "object") { + cleanObject(config.data); + } + removeSearchFromUrl(config); + + return config; + }); + + axiosInstance.interceptors.response.use((response) => { + const config: AxiosRequestConfig = response.config; + + if (config.debug) { + stepExport(this, response.data, "debug_response"); + } + + return config.returnFullResponse + ? response + : response.data; + }, (error) => { + if (error.response) { + convertAxiosError(error); + stepExport(this, error.response, "debug"); + } + + throw error; + }); + + return axiosInstance; +} + +callAxios.create = create; +export default callAxios; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/constants.ts b/components/pexels/node_modules/@pipedream/platform/lib/constants.ts new file mode 100644 index 0000000000000..e7c681fc2f981 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/lib/constants.ts @@ -0,0 +1,2 @@ +export const DEFAULT_POLLING_SOURCE_TIMER_INTERVAL = 60 * 15; +export const PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID = "fnd4m13k1mjb6djallp1m9kr7o8kslcu"; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/errors.ts b/components/pexels/node_modules/@pipedream/platform/lib/errors.ts new file mode 100644 index 0000000000000..ee17d29dc3a6f --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/lib/errors.ts @@ -0,0 +1,8 @@ +export class ConfigurationError extends Error { + exposeStack: boolean; + constructor(message: string, exposeStack = false) { + super(message); + this.name = "ConfigurationError"; + this.exposeStack = exposeStack; + } +} diff --git a/components/pexels/node_modules/@pipedream/platform/lib/index.ts b/components/pexels/node_modules/@pipedream/platform/lib/index.ts new file mode 100644 index 0000000000000..55fa677cb020d --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/lib/index.ts @@ -0,0 +1,212 @@ +import * as t from "io-ts"; + +import axios, { transformConfigForOauth } from "./axios"; +import { AxiosRequestConfig as AxiosConfig } from "axios"; + +export { + axios, transformConfigForOauth, +}; +export { + cloneSafe, jsonStringifySafe, +} from "./utils"; + +export { + ConfigurationError, +} from "./errors"; + +export { + default as sqlProp, +} from "./sql-prop"; +export type { + ColumnSchema, + DbInfo, + TableInfo, + TableMetadata, + TableSchema, +} from "./sql-prop"; + +export { + default as sqlProxy, +} from "./sql-proxy"; + +export { + DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID, +} from "./constants"; + +const SendPayload = t.union([ + t.string, + t.object, +]); +type SendPayload = t.TypeOf; + +export const SendConfigEmail = t.partial({ + html: t.string, + subject: t.string, + text: t.string, +}); +export type SendConfigEmail = t.TypeOf; + +export const SendConfigEmit_required = t.strict({ + raw_event: t.object, +}); + +export const SendConfigEmit_optional = t.partial({ + event: t.object, +}); +export const SendConfigEmit = t.intersection([ + SendConfigEmit_required, + SendConfigEmit_optional, +]); +export type SendConfigEmit = t.TypeOf; + +// interface SendConfigHTTPKv { +// [key: string]: string; +// } +const SendConfigHTTPKv = t.object; // XXX should be type above +type SendConfigHTTPKv = t.TypeOf; +const SendConfigHTTPAuth = t.strict({ + password: t.string, + username: t.string, +}); +type SendConfigHTTPAuth = t.TypeOf; +// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods +export const HTTP_METHODS = [ + "GET", + "HEAD", + "POST", + "PUT", + "DELETE", + "CONNECT", + "OPTIONS", + "TRACE", + "PATCH", +]; +// HTTP method must be uppercase (for kotlin in coordinator -- i voted to make it case insensitive, but w.e for now) +const SendConfigHTTPMethod = t.keyof(HTTP_METHODS.reduce((acc, v) => { + acc[v] = null; + return acc; +}, {})); +type SendConfigHTTPMethod = t.TypeOf; +const SendConfigHTTP_required = t.strict({ + method: SendConfigHTTPMethod, + url: t.string, +}); +const SendConfigHTTP_optional = t.partial({ + auth: SendConfigHTTPAuth, + data: SendPayload, + headers: SendConfigHTTPKv, + params: SendConfigHTTPKv, +}); +export const SendConfigHTTP = t.intersection([ + SendConfigHTTP_required, + SendConfigHTTP_optional, +]); +// Mimics axios config. (for now) +export type SendConfigHTTP = t.TypeOf; + +export const SendConfigS3 = t.strict({ + bucket: t.string, + payload: SendPayload, + prefix: t.string, +}); +export type SendConfigS3 = t.TypeOf; + +export const SendConfigSQL = t.strict({ + payload: SendPayload, + table: t.string, +}); +export type SendConfigSQL = t.TypeOf; + +export const SendConfigSnowflake = t.strict({ + account: t.string, + database: t.string, + host: t.string, + payload: SendPayload, + pipe_name: t.string, + private_key: t.string, + schema: t.string, + stage_name: t.string, + user: t.string, +}); +export type SendConfigSnowflake = t.TypeOf; + +export const SendConfigSSE = t.strict({ + channel: t.string, + payload: SendPayload, +}); +export type SendConfigSSE = t.TypeOf; + +// optionals so we can use self-invoking function below +interface SendFunctionsWrapper { + email: (config: SendConfigEmail) => void; + emit: (config: SendConfigEmit) => void; + http: (config: SendConfigHTTP) => void; + s3: (config: SendConfigS3) => void; + sql: (config: SendConfigSQL) => void; + snowflake: (config: SendConfigSnowflake) => void; + sse: (config: SendConfigSSE) => void; +} +// XXX would be cool to have this and SendFunctionsWrapper be more shared +export const sendTypeMap = { + email: SendConfigEmail, + emit: SendConfigEmit, + http: SendConfigHTTP, + s3: SendConfigS3, + sql: SendConfigSQL, + snowflake: SendConfigSnowflake, + sse: SendConfigSSE, +}; + +// Event object that persists throughout worfklow with observability after each step. +export let $event: any; + +export const END_NEEDLE = "__pd_end"; +// End workflow with optional message. +export function $end(message?: string): void { + const err = new Error(); + err[END_NEEDLE] = { + message, + ts: new Date().toISOString(), + }; + throw err; +} + +export let $send: SendFunctionsWrapper; + +export const $sendConfigRuntimeTypeChecker = (function () { + const ret = {}; + for (const [ + sendName, + sendConfigType, + ] of Object.entries(sendTypeMap)) { + ret[sendName] = function (config) { + const result = sendConfigType.decode(config); + if (!result) throw new Error("io-ts: unexpected decode output"); + if (result._tag === "Left") { + for (const err of result.left) { + if (err.message) { + throw new Error(err.message); + } else { + const keyChunks: string[] = []; + for (const ctx of err.context) { + if (!ctx.key) continue; + if (!isNaN(+ctx.key)) continue; + keyChunks.push(ctx.key); + } + throw new Error(`$send.${sendName}: invalid value ${err.value} for ${keyChunks.join(".")}`); + } + } + throw new Error("io-ts: error but could not produce message"); // shouldn't happen... + } + // XXX if result !== config they passed extra fields... but expensive + }; + } + return ret; +})(); + +export interface AxiosRequestConfig extends AxiosConfig { + debug?: boolean; + body?: any; + returnFullResponse?: boolean; +} diff --git a/components/pexels/node_modules/@pipedream/platform/lib/sql-prop.ts b/components/pexels/node_modules/@pipedream/platform/lib/sql-prop.ts new file mode 100644 index 0000000000000..d346d651e165f --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/lib/sql-prop.ts @@ -0,0 +1,61 @@ +import { ConfigurationError } from "./errors"; +import { JsonPrimitive } from "type-fest"; +import { ExecuteQueryArgs } from "./sql"; + +export type ColumnSchema = { + columnDefault: JsonPrimitive; + dataType: string; + isNullable: boolean; + tableSchema?: string; +}; + +export type TableMetadata = { + rowCount?: number; +}; + +export type TableSchema = { + [columnName: string]: ColumnSchema; +}; + +export type TableInfo = { + metadata: TableMetadata; + schema: TableSchema; +}; + +export type DbInfo = { + [tableName: string]: TableInfo; +}; + +export type SqlProp = { + query: string; + params?: string[]; +}; + +export default { + methods: { + /** + * A method that transforms the value of a prop of type `sql` so that it can + * be fed to the `executeQuery` method. + * + * @param sqlProp - The prop of type `sql` + * @returns The arguments to be passed to `executeQuery` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + executeQueryAdapter(sqlProp: SqlProp): ExecuteQueryArgs { + throw new ConfigurationError("executeQueryAdapter not implemented"); + }, + + /** + * A helper method to get the schema of the database. Used by other features + * (like the `sql` prop) to enrich the code editor and provide the user with + * auto-complete and fields suggestion. + * + * @returns {DbInfo} The schema of the database, which is a + * JSON-serializable object. + * @throws {ConfigurationError} If the method is not implemented. + */ + getSchema(): DbInfo { + throw new ConfigurationError("getSchema not implemented"); + }, + }, +}; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/sql-proxy.ts b/components/pexels/node_modules/@pipedream/platform/lib/sql-proxy.ts new file mode 100644 index 0000000000000..3a198c793ed8a --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/lib/sql-proxy.ts @@ -0,0 +1,50 @@ +import { ConfigurationError } from "./errors"; +import { ExecuteQueryArgs } from "./sql"; + +export type ClientConfiguration = object; +export type ProxyArgs = { + query: string; + params?: unknown[]; +}; +export type Row = object; + +export default { + methods: { + /** + * A helper method to get the configuration object that's directly fed to + * the DB client constructor. Used by other features (like SQL proxy) to + * initialize their client in an identical way. + * + * @returns The configuration object for the DB client + */ + getClientConfiguration(): ClientConfiguration { + throw new ConfigurationError("getClientConfiguration not implemented"); + }, + + /** + * Executes a query against the database. This method takes care of + * connecting to the database, executing the query, and closing the + * connection. + * + * @param args - The query string or object to be sent to the DB. SQL query. + * @returns The rows returned by the DB as a result of the query. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + executeQuery(args: ExecuteQueryArgs): Row[] { + throw new ConfigurationError("executeQuery not implemented"); + }, + + /** + * Adapts the arguments to `executeQuery` so that they can be consumed by + * the SQL proxy (when applicable). Note that this method is not intended to + * be used by the component directly. + * + * @param args - The query string or object to be sent to the DB. + * @returns The adapted query and parameters. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + proxyAdapter(args: ExecuteQueryArgs): ProxyArgs { + throw new ConfigurationError("proxyAdapter not implemented"); + }, + }, +}; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/sql.ts b/components/pexels/node_modules/@pipedream/platform/lib/sql.ts new file mode 100644 index 0000000000000..1a4fa5386a9af --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/lib/sql.ts @@ -0,0 +1 @@ +export type ExecuteQueryArgs = object | string; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/utils.ts b/components/pexels/node_modules/@pipedream/platform/lib/utils.ts new file mode 100644 index 0000000000000..2b4ad085cdc96 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/lib/utils.ts @@ -0,0 +1,40 @@ +export function cloneSafe(o: any) { + const str = jsonStringifySafe(o); + return str + ? JSON.parse(str) + : null; +} + +// this looks pretty terrible, but on axios return value, +// +// jsonStringifySafe ~1ms +// util.inspect ~2ms +// +// XXX could most likely be improved +export function jsonStringifySafe(v: any, set?: Set) { + try { + return JSON.stringify(v); + } catch (err) { + set = new Set(set || []); + if (set.has(v)) return; + set.add(v); + if (typeof v === "object") { + const strs: Array = []; + if (Array.isArray(v)) { + for (const el of v) { + const str = jsonStringifySafe(el, set); + if (str) strs.push(str); + } + return `[${strs.join(",")}]`; + } + for (const k in v) { + const str = jsonStringifySafe(v[k], set); + if (str) { + const kStr = JSON.stringify(k); + strs.push(`${kStr}:${str}`); + } + } + return `{${strs.join(",")}}`; + } + } +} diff --git a/components/pexels/node_modules/@pipedream/platform/package.json b/components/pexels/node_modules/@pipedream/platform/package.json new file mode 100644 index 0000000000000..efd79a492bb93 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/package.json @@ -0,0 +1,32 @@ +{ + "name": "@pipedream/platform", + "version": "3.0.3", + "description": "Pipedream platform globals (typing and runtime type checking)", + "homepage": "https://pipedream.com", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "author": "Pipedream Team", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/PipedreamHQ/platform.git" + }, + "dependencies": { + "axios": "^1.7.4", + "fp-ts": "^2.0.2", + "io-ts": "^2.0.0", + "querystring": "^0.2.1" + }, + "devDependencies": { + "husky": "^3.0.0", + "jest": "^29.1.2", + "type-fest": "^4.15.0", + "@octokit/core": "^3.6.0", + "typescript": "^3.5.3" + }, + "scripts": { + "prebuild": "rm -rf dist", + "build": "tsc", + "test": "npm run build && jest" + } +} \ No newline at end of file diff --git a/components/pexels/node_modules/@pipedream/platform/tsconfig.json b/components/pexels/node_modules/@pipedream/platform/tsconfig.json new file mode 100644 index 0000000000000..50147a07b15f8 --- /dev/null +++ b/components/pexels/node_modules/@pipedream/platform/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "declaration": true, + "module": "commonjs", + "outDir": "./dist", + "strictNullChecks": true, + "target": "es2018" + }, + "include": [ + "./lib/**/*" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/components/pexels/node_modules/io-ts/CHANGELOG.md b/components/pexels/node_modules/io-ts/CHANGELOG.md new file mode 100644 index 0000000000000..4ee476b8c28b6 --- /dev/null +++ b/components/pexels/node_modules/io-ts/CHANGELOG.md @@ -0,0 +1,896 @@ +# Changelog + +> **Tags:** +> +> - [New Feature] +> - [Bug Fix] +> - [Breaking Change] +> - [Documentation] +> - [Internal] +> - [Polish] +> - [Experimental] +> - [Deprecation] + +**Note**: Gaps between patch versions are faulty/broken releases. +**Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. + +# 2.2.22 + +- **Bug Fix** + - Test for readonly type when optimizing tagged unions, #719 + +# 2.2.21 + +- **Bug Fix** + - Handle `record` keys outside `domain`, #705 (@tgfisher4) + +# 2.2.20 + +- undeprecate `FunctionType`, `FunctionC`, `Function` +- undeprecate `NeverType`, `NeverC`, `never` +- undeprecate `AnyType`, `AnyC`, `any` +- undeprecate `RefinementC`, `refinement`, `Integer` +- add refinement overload to allow custom branding, closes #373 + +# 2.2.19 + +- **Bug Fix** + - allow `Error` to be decoded with `UnknownRecord`, #664 (@mlegenhausen) + +# 2.2.18 + +- **Bug Fix** + - fix `typescript@4.8` errors, closes #656, closes #647 (@gcanti) + +# 2.2.17 + +- **Bug Fix** + - Don't throw a TypeError when trying to decode a sum value that contains a dangerous string, #650 (@thewilkybarkid) + +# 2.2.16 + +Experimental modules require `fp-ts@^2.5.0`. + +- **Experimental** + - `Codec` + - add `readonly` combinator (@gcanti) + - `Encoder` + - add `readonly` combinator (@gcanti) + +# 2.2.15 + +- **Experimental** + - `Schemable` + - (\*) add `readonly` combinator (@gcanti) + - (\*) add `struct` combinator (@gcanti) + - deprecate `type` in favour of `struct` (@gcanti) + - deprecate `fromType` in favour of `fromStruct` (@gcanti) + +(\*) breaking change + +# 2.2.14 + +- **Experimental** + - `Guard` + - relax `UnknownRecord` check, closes #559 (@waynevanson) + +# 2.2.13 + +- **Bug Fix** + - improve internal `mergeAll` function, closes #532 (@gcanti) + +# 2.2.12 + +- **Experimental** + - (\*) make `sum` safer, closes #523 (@gcanti) + +(\*) breaking change + +In case of non-`string` tag values, the respective key must be enclosed in brackets + +```ts +export const MySum: D.Decoder< + unknown, + | { + type: 1 // non-`string` tag value + a: string + } + | { + type: 2 // non-`string` tag value + b: number + } +> = D.sum('type')({ + [1]: D.type({ type: D.literal(1), a: D.string }), + [2]: D.type({ type: D.literal(2), b: D.number }) +}) +``` + +# 2.2.11 + +- **Experimental** + - `Decoder` + - make `toForest` stack-safe, #520 (@safareli) + +# 2.2.10 + +- **Polish** + - expose modules without lib/es6 prefix, #507 (@osdiab) + +# 2.2.9 + +- **Polish** + - remove `Object.freeze` calls, closes #497 (@gcanti) +- **Experimental** + - `DecodeError` + - add `Wrap` member (@gcanti) + - `Decoder` + - add `withMessage` combinator (@gcanti) + - `TaskDecoder` + - add `withMessage` combinator (@gcanti) + +# 2.2.8 + +- **Experimental** + - (\*) remove `KleisliDecoder` module (@gcanti) + - (\*) remove `KleisliTaskDecoder` module (@gcanti) + - (\*) remove `JsonCodec` module (@gcanti) + - (\*) remove `JsonEncoder` module (@gcanti) + - `Codec` + - (\*) make `Codec` more general by adding a `I` type parameter (@gcanti) + - add `fromType` function (@gcanti) + - add `fromPartial` function (@gcanti) + - add `fromArray` function (@gcanti) + - add `fromRecord` function (@gcanti) + - add `fromTuple` function (@gcanti) + - add `fromSum` function (@gcanti) + - add `compose` function (@gcanti) + - `Decoder` + - (\*) make `Decoder` more general by adding a `I` type parameter (@gcanti) + - add `fromRefinement` function (@gcanti) + - change `fromGuard` signature (@gcanti) + - add `fromType` function (@gcanti) + - add `fromPartial` function (@gcanti) + - add `fromArray` function (@gcanti) + - add `fromRecord` function (@gcanti) + - add `fromTuple` function (@gcanti) + - add `fromSum` function (@gcanti) + - add `compose` function (@gcanti) + - add `id` function (@gcanti) + - (\*) rename `functorDecoder` instance to `Functor` (@gcanti) + - (\*) rename `altDecoder` instance to `Alt` (@gcanti) + - (\*) rename and split `schemableDecoder` (@gcanti) + - add `Category` instance (@gcanti) + - add `InputOf` type (@gcanti) + - `TaskDecoder` + - (\*) make `TaskDecoder` more general by adding a `I` type parameter (@gcanti) + - add `fromRefinement` function (@gcanti) + - change `fromDecoder` signature (@gcanti) + - add `fromType` function (@gcanti) + - add `fromPartial` function (@gcanti) + - add `fromArray` function (@gcanti) + - add `fromRecord` function (@gcanti) + - add `fromTuple` function (@gcanti) + - add `fromSum` function (@gcanti) + - add `compose` function (@gcanti) + - add `id` function (@gcanti) + - (\*) rename `functorTaskDecoder` instance to `Functor` (@gcanti) + - (\*) rename `altTaskDecoder` instance to `Alt` (@gcanti) + - (\*) rename and split `schemableTaskDecoder` (@gcanti) + - add `Category` instance (@gcanti) + - add `InputOf` type (@gcanti) + - `Guard` + - (\*) make `Guard` more general by adding a `I` type parameter (@gcanti) + - (\*) rename `schemableGuard` (@gcanti) + - add `InputOf` type (@gcanti) + - add `alt` function (@gcanti) + - add `zero` function (@gcanti) + - add `compose` function (@gcanti) + - add `id` function (@gcanti) + - `Codec` + - (\*) rename `invariantCodec` to `Invariant` (@gcanti) + - `Encoder` + - (\*) rename `contravariantEncoder` to `Contravariant` (@gcanti) + - (\*) rename `categoryEncoder` to `Category` (@gcanti) + - `Eq` + - (\*) rename and split `schemableEq` (@gcanti) + - `Kleisli` + - add `id` (@gcanti) + - rename `type` to `fromType` (@gcanti) + - rename `partial` to `fromPartial` (@gcanti) + - rename `array` to `fromArray` (@gcanti) + - rename `record` to `fromRecord` (@gcanti) + - rename `tuple` to `fromTuple` (@gcanti) + - rename `sum` to `fromSum` (@gcanti) + - `Schemable` + - add `Schemable2C`, `WithUnknownContainers2C`, `WithUnion2C`, `WithRefine2C` (@gcanti) + - `Type` + - (\*) rename and split `schemableType` (@gcanti) + +(\*) breaking change + +# 2.2.7 + +- **Experimental** + - add `DecodeError` module (@gcanti) + - add `FreeSemigroup` module (@gcanti) + - add `TaskDecoder` module (@gcanti) + - add `Kleisli` module (@gcanti) + - add `KleisliDecoder` module (@gcanti) + - add `KleisliTaskDecoder` module (@gcanti) + - (\*) remove `NaN` from `number` instances (@gcanti) + - (\*) remove `Tree` module (@gcanti) + - (\*) make `Json` type immutable (@gcanti) + - `Decoder` + - (\*) remove `never` (@gcanti) + - (\*) make `parse` pipeable and change its `parser` argument (@gcanti) + - (\*) change `DecoderError` (@gcanti) + - (\*) remove `withExpected` in favour of `mapLeftWithInput` (@gcanti) + - `Guard` + - (\*) remove `never` (@gcanti) + - `Schemable` + - (\*) better `literal` signature (@gcanti) + - (\*) better `union` signature (@gcanti) + - (\*) make intersections pipeables (@gcanti) + - (\*) make refinements pipeables (@gcanti) + +(\*) breaking change + +# 2.2.6 + +- **Experimental** + - `Decoder` + - add support for non-`string` tag values to `sum`, closes #481 (@gcanti) + - `intersection` should accumulate all errors (@gcanti) + +# 2.2.5 + +- **Experimental** + - fix type information lost from nested decoder types, #479 (@gcanti) + - `JsonEncoder` + - change `id` signature (@gcanti) + +# 2.2.4 + +- **Polish** + - remove the dependency on the `either` instance as a mean of improving tree shaking (@gcanti) + +# 2.2.3 + +- **Polish** + - use the built-in `Readonly` type in `readonly` combinator, closes #472 (@gcanti) +- **Experimental** + - split instances (@gcanti) + - add `Type` experimental module, #464 (@gcanti) + - restore the `O` type parameter to `Encoder`, #469 (@gcanti) + - add the `O` type parameter to `Codec` (@gcanti) + - add `JsonCodec` experimental module (@gcanti) + - add `JsonEncoder` experimental module (@gcanti) + - `Schemable` + - rename `Schemable` interface to `Schemable1` (@gcanti) + - rename `WithUnion` interface to `WithUnion1` (@gcanti) + - add `Schemable` interface (@gcanti) + - add `WithUnion` interface (@gcanti) + - add `WithRefinement` / `WithRefinement1` interfaces (@gcanti) + - add `WithUnknownContainers` / `WithUnknownContainers1` interfaces (@gcanti) + - move `UnknownArray` and `UnknownRecord` to `WithUnknownContainers` (@gcanti) + - `Schema` + - refactoring with the new `Schemable` interface (@gcanti) + - add `interpreter` function (@gcanti) +- **Internal** + - upgrade to `typescript@3.9.3` (@gcanti) + +# 2.2.2 + +- **Experimental** + - add `Eq` module (@gcanti) + - `Codec` + - add `TypeOf` operator (@gcanti) + - `Decoder` + - add `DecodeError` interface (@gcanti) + - `Encoder` + - add `TypeOf` operator (@gcanti) + - `Guard` + - add `TypeOf` operator (@gcanti) + +# 2.2.1 + +- **Experimental** + - `Decoder` + - collect all errors while decoding, closes #449 (@gcanti) + +# 2.2.0 + +- **Experimental** + - add `Codec`, `Decoder`, `Encoder`, `Guard`, `Schema`, `Schemable`, `Tree` modules (@gcanti) + +# 2.1.3 + +- **Polish** + - remove useless `hasOwnProperty` calls, closes #423 (@gcanti) + +# 2.1.1 + +- **Bug Fix** + - fix `record` domain handling, closes #391 (@gcanti) + +# 2.1.0 + +- **New Feature** + - add `bigint` codec (@mixedCase) + +# 2.0.6 + +- **Bug Fix** + - whitelist `window` in `UnknownRecord`, fix #413 (@gcanti) + +# 2.0.5 + +- **Bug Fix** + - `partial` shouldn't allow arrays, fix #407 (@gcanti) + +# 2.0.4 + +- **Bug Fix** + - remove getters, fix #404 (@gcanti) + +# 2.0.3 + +- **Bug Fix** + - rewrite es6 imports (@gcanti) + +# 2.0.2 + +- **Bug Fix** + - fix #397 (@gcanti) + +# 2.0.1 + +- **Bug Fix** + - fix `getTags` algorithm for mutually recursive codecs, closes #354 (@gcanti) + +# 2.0.0 + +- **Breaking Change** + - upgrade to `fp-ts@2.x` (@gcanti) + - move `fp-ts` to `peerDependencies` (@gcanti) + +# 1.10.4 + +- **Polish** + - remove unneeded internal code (@gcanti) + +# 1.10.3 + +- **Bug Fix** + - revert `1.10.0` compatibility, fix #344 (@gcanti) + +# 1.10.2 + +- **Bug Fix** + - move `fp-ts` back to dependencies (@gcanti) + +# 1.10.1 + +- **Bug Fix** + - handle `strict`, `exact` and `refinement` codecs when optimizing tagged unions, fix #339 (@gcanti) + +# 1.10.0 + +- **New Feature** + - make `io-ts` compatible with both `fp-ts@1.x`, `fp-ts@2.x` (@gcanti) + +# 1.9.0 + +- **New Feature** + - `union` is now able to detect and optimize tagged unions (@gcanti) +- **Deprecation** + - deprecate `taggedUnion` in favour of `union` (@gcanti) + +# 1.8.6 + +output ES modules to better support tree-shaking, closes #326 (@gcanti) + +# 1.8.5 + +- **Bug Fix** + - change how types and output types are retrieved in `IntersectionC` and `TupleC`, fix #315 (@gcanti) + +# 1.8.4 + +- **Polish** + - autobind `decode` method (@gcanti) + +# 1.8.3 + +- **Polish** + - add `stripInternal` flag to `tsconfig.json` (@gcanti) + - handle `NaN` in `PathReporter` (@gcanti) + - throw if union encoding doesn't find a usable codec (@leemhenson) +- **Deprecation** + - deprecate `NeverType` (@gcanti) + - deprecate `FunctionType` (@gcanti) + +# 1.8.2 + +- **Bug Fix** + - align the runtime behavior of `Exact.is` with the type system, fix #288 (@gcanti) + +# 1.8.1 + +- **New Feature** + - add `brand` combinator (@gcanti, @lostintime) + - add `Int` codec (@gcanti) + - `exact` strips additional properties while decoding / encoding (@gcanti) + - un-deprecate `strict` combinator, is now an alias of `exact(type(...))` (@gcanti) +- **Bug Fix** + - fix wrong context keys for tagged unions (@gcanti) +- **Deprecation** + - deprecate `refinement` combinator in favour of `brand` (@gcanti) + - deprecate `Integer` codec in favour of `Int` (@gcanti) + - deprecate `StrictType` class (@gcanti) + - deprecate `StrictC` interface (@gcanti) +- **Polish** + - modify the implementation of `intersection` in order to support combinators that strip additional properties (@gcanti) + - do not validate the codomain of a key of a record if its domain in invalid (@gcanti) + - normalize missing `message` field in `ValidationError` (@gcanti) + - fix name of recursive codec definitions (@gcanti) + - remove unexpected validation path from partial type, closes #195 (@gcanti) + - do not leak taggedUnion implementation when tag validation fails (@gcanti) + - add `actual` value to all context entries (@gcanti) + - `exact` now bails out when the value is not an `UnknownRecord` (@gcanti) + - `tuple` should not leak the implementation (`never` usage) (@gcanti) + - `exact` should not leak the implementation (`never` usage) (@gcanti) + - use `Number.isInteger` in `Integer` implementation (@gcanti) + - use the Flow convention to name `exact` codecs (@gcanti) + +# 1.7.1 + +- **Deprecation** + - deprecate `any` (@gcanti) + - deprecate `object` (@gcanti) + - deprecate `Dictionary` in favour of `UnknownRecord` (@gcanti) + - deprecate `Array` in favour of `UnknownArray` (@gcanti) + - deprecate `dictionary` in favour of `record` (@gcanti) + +# 1.7.0 + +- **New Feature** + - better support for custom messages, closes #148 (@gcanti) + - add optional message field to `ValidationError` + - add `message` argument to `failure` + - `PathReporter` should account for the new field + - add `actual` optional field to `ContextEntry`, closes #194 (@gcanti) +- **Deprecation** + - deprecate `getValidationError` (@gcanti) + - deprecate `getDefaultContext` (@gcanti) + +# 1.6.4 + +- **Bug Fix** + - `getIndexRecord`: getIndexRecord: handle conflicting tags in different positions, ref #263 (@gcanti) +- **Experimental** + - added a warning to the console if a tagged union cannot be created (@gcanti) + - revert `union` optimization, needs more work to make it happen (@gcanti) + +# 1.6.3 + +- **Bug Fix** + - prevent maximum call stack size exceeded when indexing recursive codecs, closes #259 (@gcanti) + +# 1.6.2 + +- **Polish** + - make `isIndexableCodec` more strict (@gcanti) + +# 1.6.1 + +- **Bug Fix** + - `taggedUnion` should handle sub unions / tagged unions correctly, closes #257 (@gcanti) +- **Experimental** + - optimize `union` with the same algorithm used in `taggedUnion` (@gcanti) + +# 1.6.0 + +**Important**. This version requires `typescript@3.2.2+` + +- **New Feature** + - leverage `typescript@3.2.2` (@gcanti) + - `TypeC` + - `PartialC` + - `RecordC` + - `UnionC` + - `ReadonlyC` + - `StrictC` + - `TaggedUnionC` + +# 1.5.3 + +- **Bug Fix** + - missing context info while decoding an intersection, fix #246 (@gcanti) +- **Experimental** + - add intermediary interfaces, closes #165 (@gcanti) + - `NullC` + - `UndefinedC` + - `VoidC` + - `AnyC` + - `UnknownC` + - `NeverC` + - `StringC` + - `NumberC` + - `BooleanC` + - `UnknownArrayC` + - `UnknownRecordC` + - `ObjectC` + - `FunctionC` + - `RefinementC` + - `LiteralC` + - `KeyofC` + - `ArrayC` + - `TypeC` + - `PartialC` + - `RecordC` + - `UnionC` + - `IntersectionC` + - `TupleC` + - `ReadonlyC` + - `ReadonlyArrayC` + - `StrictC` + - `TaggedUnionC` + - `ExactC` +- **Polishs** + - use rest elements in tuple types (`typescript@3.0.1` feature) (@gcanti) + - `union` should handle zero types (@gcanti) + - `intersection` should handle zero / one types (@gcanti) +- **Deprecation** + - deprecate `clean` (@gcanti) + - deprecate `alias` (@gcanti) + - deprecate `PropsOf` type (@gcanti) + - deprecate `Exact` type (@gcanti) + +# 1.5.2 + +- **Deprecation** + - deprecate `Compact` type (@gcanti) + +# 1.5.1 + +- **Polish** + - remove useless module augmentation of `Array` (@gcanti) + +# 1.5.0 + +- **New Feature** + - add `UnknownType`, closes #238 (@gcanti) +- **Deprecation** + - `ThrowReporter` is now deprecated (@gcanti) + +# 1.4.2 + +use `Compact` in `intersection` signatures as a workaround for #234 (@sledorze) + +# 1.4.1 + +- **Polish** + - `Type.prototype.pipe` now allows more types as input, #231 #232 (@sledorze) + +# 1.4.0 + +- **New Feature** + - use `unknown` as `mixed` (@gcanti) + +# 1.3.4 + +- **Bug Fix** + - should emit expected keys while decoding, fix #214 (@gcanti) + +# 1.3.3 + +- **Bug Fix** + - align `TaggedExact` definition with siblings, fix #223 (@gcanti) + +# 1.3.2 + +- **Bug Fix** + - dictionary type should not allow arrays, fix #218 (@gcanti) + +# 1.3.1 + +- **Polish** + - use interface instead of type alias (@gcanti) + - `Context` + - `Errors` + - `Any` + - `Mixed` + +# 1.3.0 + +- **New Feature** + - add `TaggedUnionType` (@gcanti) + +# 1.2.1 + +- **Polish** + - allow recursive types in tagged unions (@gcanti) + +# 1.2.0 + +- **New Feature** + - add `void` runtime type (@gcanti) + +# 1.1.5 + +- **Bug Fix** + - partial combinator should preserve additional properties while encoding, fixes #179 (@gcanti) +- **Polish** + - use `useIdentity` when possible (@gcanti) + +# 1.1.4 + +- **Internal** + - fix broken build with `typescript@2.9.1`, closes #174 (@gcanti) + +# 1.1.3 + +- **Internal** + - upgrade to `typings-checker@2.0.0` (@gcanti) + +# 1.1.2 + +- **Bug Fix** + - fix `alias` implementation (@gcanti) + - handle exact types in `isTagged` (@gcanti) + +# 1.1.1 + +- **Experimental** + - add `clean` / `alias` functions, closes #149 (@gcanti) + - add `exact` combinator (@gcanti) + - the `strict` combinator is deprecated + - remove `optional` combinator (@gcanti) + - it doesn't play well with advanced combinators, see [here](https://github.com/gcanti/io-ts/issues/140) for a discussion + +# 1.0.6 + +- **Bug Fix** + - `taggedUnion` fails to decode when tag values are not string literals, fix #161 (@gcanti) + +# 1.0.5 + +- **Bug Fix** + - workaround for upstream TypeScript bug 14041 (wrong generated declarations) (@gcanti) +- **Internal** + - optimize InterfaceType.encode (@gcanti) + - use definite assignment assertion for phantom fields (@gcanti) + +# 1.0.4 + +- **Bug Fix** + - make `Context` readonly (@gcanti) +- **Internal** + - optimizations, #137 (@gcanti, @sledorze) + +# 1.0.3 + +- **Internal** + - optimizations, #134 (@gcanti, @sledorze) + +# 1.0.2 + +- **Bug Fix** + - fix `OutputOfPartialProps` name (@gcanti) + +# 1.0.1 + +- **Bug Fix** + - fix `AnyType` by extending `Type` (@gcanti) + +# 1.0.0 + +- **Breaking Change** + - upgrade to `fp-ts@1.0.0` + - see https://github.com/gcanti/io-ts/pull/112 (@gcanti) + +# 0.9.8 + +- **New Feature** + - add decode and deprecate top level validate (@gcanti) +- **Internal** + - when checking validations use methods instead of top level functions (@gcanti) + +# 0.9.7 + +- **New Feature** + - add `taggedUnion` combinator (@gcanti, @sledorze) + +# 0.9.6 + +- **New Feature** + - `recursive` combinator + - add support for mutually recursive types, closes #114 (@gcanti) + - make it safer: `RT` now must extend `Type` (@gcanti) + +# 0.9.5 + +- **New Feature** + - add `mixed` type (@gcanti) + - replace `any` with `mixed` in all input type parameters (@gcanti) + ```diff + -export class StringType extends Type { + +export class StringType extends Type { + } + ``` + +# 0.9.4 + +- **Bug Fix** + - strict: should succeed validating an undefined field, closes #106 (@gcanti) + +# 0.9.3 + +- **Bug Fix** + - revert 37c74a5e2038de063a950f9ba8d18b1f132ef450, closes #8 (@gcanti) + +# 0.9.2 + +- **New Feature** + - add `Decoder` / `Encoder` interfaces (@sledorze, @gcanti) +- **Internal** + - perf optimizations (@sledorze, @gcanti) + +# 0.9.1 + +- **Bug Fix** + - make all classes "dumb", fix #95 (@gcanti) + +# 0.9.0 + +- **Breaking Change** + - remove `t.map` and `t.mapWithName` (in general doesn't look serializable, needs more investigation) + - remove `t.prism` (in general doesn't look serializable, needs more investigation) + - change `Type` from interface to class and add `S` type parameter + - remove `t._A` + - add `Type#serialize` + - add `Type#is` (in order to serialize unions and while we're at it, looks useful anyway) + - remove `t.is` (now that there's `Type#is` is misleading) +- **Experimental** + - add Flowtype support (@gcanti) + +# 0.8.2 + +- **New Feature** + - add `object` type, closes #86 (@gcanti) + +# 0.8.1 + +- **New Feature** + - add `strict` combinator, closes #84 (@phiresky, @gcanti) + +# 0.8.0 + +- **Breaking Change** + - upgrade `fp-ts` dependency (@gcanti) + +# 0.7.2 + +- **Bug Fix** + - tag recursive types, fix #80 (@gcanti) + +# 0.7.1 + +- **Bug Fix** + - incorrect compile time type for dictionary, fix #75 (@gcanti) + +# 0.7.0 + +- **Breaking Change** + - upgrade to latest fp-ts (0.5.1) (@gcanti) + +# 0.6.2 + +- **New Feature** + - add aliases for `null` and `interface`, closes #63 (@gcanti) + +# 0.6.1 + +- **Internal** + - handle latest fp-ts (0.4.3) (@gcanti) + +# 0.6.0 + +- **Breaking Change** + - upgrade to latest fp-ts (0.4.0) (@gcanti) +- **Internal** + - allow for infinite unions (@gcanti) + +# 0.5.1 + +- **Bug Fix** + - export and rename `interfaceType` to `_interface`, fix #57 (@gcanti) + +# 0.5.0 + +- **Breaking Change** + - `Type` is now an interface + - types no more own a `is` method, use `t.is` instead + - unions no more own a `fold` method + - `Reporter`, `PathReporter`, `ThrowReporter` are now top level modules + +# 0.4.0 + +- **Breaking Change** + - upgrade to latest `fp-ts` (`io-ts` APIs are not changed though) (@gcanti) + - drop `lib-jsnext` folder + +# 0.3.2 + +- **Bug Fix** + - remove excess overloadings, fix #43 (@gcanti) + +# 0.3.1 + +- **New Feature** + - add mapWithName and Functor instance, fix #37 (@gcanti) + - add prism combinator, fix #41 (@gcanti) + +# 0.3.0 + +This is a breaking change _only_ if you are using fp-ts APIs + +- **Breaking Change** + - upgrade to latest fp-ts v0.2 (@gcanti) + +# 0.2.3 + +- **Internal** + - upgrade to fp-ts v0.1 (@gcanti) + +# 0.2.2 + +- **New Feature** + - add `partial` combinator (makes optional props possible) + - add `readonly` combinator (values are not frozen in production) + - add `readonlyArray` combinator (values are not frozen in production) + - add `never` type +- **Breaking Changes** + - remove `maybe` combinator, can be defined in userland as + ```ts + export function maybe( + type: RT, + name?: string + ): t.UnionType<[RT, typeof t.null], t.TypeOf | null> { + return t.union([type, t.null], name) + } + ``` +- **Polish** + - export `pathReporterFailure` function from default reporters +- **Bug Fix** + - revert pruning excess properties (see https://github.com/gcanti/io-ts/pull/27 for context) + - revert `intersection` combinator accepting only `InterfaceType`s +- **Experimental** + - Pattern matching / catamorphism for unions + +# 0.1.0 + +- **New Feature** + + - add support for jsnext + - add `Integer` type + +- **Breaking Changes** + - `t.Object` type. Renamed to `t.Dictionary`, now accepts arrays so is fully equivalent to `{ [key: string]: any }`. + - `t.instanceOf` combinator. Removed. + - `t.object` combinator. Renamed to `t.interface`. `ObjectType` to `InterfaceType`. Excess properties are now pruned. + - `mapping` combinator. Renamed to `dictionary`. `MappingType` to `DictionaryType`. + - `intersection` combinator. Due to the new excess property pruning in `t.interface` now only accept `InterfaceType`s. + - API `isSuccess` removed, use `either.isRight` instead + - API `isFailure` removed, use `either.isLeft` instead + - API `fromValidation` removed + +# 0.0.2 + +- **Bug Fix** + - reverse overloading definitions for unions, intersections and tuples, fix inference bug + +# 0.0.1 + +Initial release diff --git a/components/pexels/node_modules/io-ts/Codec/package.json b/components/pexels/node_modules/io-ts/Codec/package.json new file mode 100644 index 0000000000000..a4906f104e29d --- /dev/null +++ b/components/pexels/node_modules/io-ts/Codec/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/Codec.js", + "module": "../es6/Codec.js", + "typings": "../lib/Codec.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/DecodeError/package.json b/components/pexels/node_modules/io-ts/DecodeError/package.json new file mode 100644 index 0000000000000..0534abd536415 --- /dev/null +++ b/components/pexels/node_modules/io-ts/DecodeError/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/DecodeError.js", + "module": "../es6/DecodeError.js", + "typings": "../lib/DecodeError.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Decoder/package.json b/components/pexels/node_modules/io-ts/Decoder/package.json new file mode 100644 index 0000000000000..86cfbd599b143 --- /dev/null +++ b/components/pexels/node_modules/io-ts/Decoder/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/Decoder.js", + "module": "../es6/Decoder.js", + "typings": "../lib/Decoder.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Encoder/package.json b/components/pexels/node_modules/io-ts/Encoder/package.json new file mode 100644 index 0000000000000..65cdb0dbd1ee1 --- /dev/null +++ b/components/pexels/node_modules/io-ts/Encoder/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/Encoder.js", + "module": "../es6/Encoder.js", + "typings": "../lib/Encoder.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Eq/package.json b/components/pexels/node_modules/io-ts/Eq/package.json new file mode 100644 index 0000000000000..ac1ff9a0401c4 --- /dev/null +++ b/components/pexels/node_modules/io-ts/Eq/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/Eq.js", + "module": "../es6/Eq.js", + "typings": "../lib/Eq.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/FreeSemigroup/package.json b/components/pexels/node_modules/io-ts/FreeSemigroup/package.json new file mode 100644 index 0000000000000..d4cd028e068bb --- /dev/null +++ b/components/pexels/node_modules/io-ts/FreeSemigroup/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/FreeSemigroup.js", + "module": "../es6/FreeSemigroup.js", + "typings": "../lib/FreeSemigroup.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Guard/package.json b/components/pexels/node_modules/io-ts/Guard/package.json new file mode 100644 index 0000000000000..d9085219ba4ae --- /dev/null +++ b/components/pexels/node_modules/io-ts/Guard/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/Guard.js", + "module": "../es6/Guard.js", + "typings": "../lib/Guard.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Kleisli/package.json b/components/pexels/node_modules/io-ts/Kleisli/package.json new file mode 100644 index 0000000000000..173f511fb4248 --- /dev/null +++ b/components/pexels/node_modules/io-ts/Kleisli/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/Kleisli.js", + "module": "../es6/Kleisli.js", + "typings": "../lib/Kleisli.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/LICENSE b/components/pexels/node_modules/io-ts/LICENSE new file mode 100644 index 0000000000000..658879995e721 --- /dev/null +++ b/components/pexels/node_modules/io-ts/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Giulio Canti + +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/components/pexels/node_modules/io-ts/PathReporter/package.json b/components/pexels/node_modules/io-ts/PathReporter/package.json new file mode 100644 index 0000000000000..5b74c1ba12f75 --- /dev/null +++ b/components/pexels/node_modules/io-ts/PathReporter/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/PathReporter.js", + "module": "../es6/PathReporter.js", + "typings": "../lib/PathReporter.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/README.md b/components/pexels/node_modules/io-ts/README.md new file mode 100644 index 0000000000000..822ef86cda36c --- /dev/null +++ b/components/pexels/node_modules/io-ts/README.md @@ -0,0 +1,43 @@ +[![build status](https://img.shields.io/travis/gcanti/io-ts/master.svg?style=flat-square)](https://travis-ci.org/gcanti/io-ts) +![npm downloads](https://img.shields.io/npm/dm/io-ts.svg) + + + + +- [Installation](#installation) +- [Usage](#usage) + - [Stable features](#stable-features) + - [Experimental features (version `2.2+`)](#experimental-features-version-22) + + + +# Installation + +To install the stable version + +```sh +npm i io-ts fp-ts +``` + +**Note**. [`fp-ts`](https://github.com/gcanti/fp-ts) is a peer dependency for `io-ts` + +# Usage + + +## Stable features + +- [Documentation of the main stable features (`index.ts` module)](index.md) + +## Experimental modules (version `2.2+`) + +Experimental modules (\*) are published in order to get early feedback from the community, see these tracking [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + +The experimental modules are **independent and backward-incompatible** with stable ones. + +- [`Decoder.ts` module](Decoder.md) +- [`Encoder.ts` module](Encoder.md) +- [`Codec.ts` module](Codec.md) +- [`Eq.ts` module](Eq.md) +- [`Schema.ts` module (advanced feature)](Schema.md) + +(\*) A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. diff --git a/components/pexels/node_modules/io-ts/Reporter/package.json b/components/pexels/node_modules/io-ts/Reporter/package.json new file mode 100644 index 0000000000000..171a587b81a33 --- /dev/null +++ b/components/pexels/node_modules/io-ts/Reporter/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/Reporter.js", + "module": "../es6/Reporter.js", + "typings": "../lib/Reporter.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Schema/package.json b/components/pexels/node_modules/io-ts/Schema/package.json new file mode 100644 index 0000000000000..40b30934e55fd --- /dev/null +++ b/components/pexels/node_modules/io-ts/Schema/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/Schema.js", + "module": "../es6/Schema.js", + "typings": "../lib/Schema.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Schemable/package.json b/components/pexels/node_modules/io-ts/Schemable/package.json new file mode 100644 index 0000000000000..0fa0b6bd08699 --- /dev/null +++ b/components/pexels/node_modules/io-ts/Schemable/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/Schemable.js", + "module": "../es6/Schemable.js", + "typings": "../lib/Schemable.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/TaskDecoder/package.json b/components/pexels/node_modules/io-ts/TaskDecoder/package.json new file mode 100644 index 0000000000000..7b3608fecd83e --- /dev/null +++ b/components/pexels/node_modules/io-ts/TaskDecoder/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/TaskDecoder.js", + "module": "../es6/TaskDecoder.js", + "typings": "../lib/TaskDecoder.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/ThrowReporter/package.json b/components/pexels/node_modules/io-ts/ThrowReporter/package.json new file mode 100644 index 0000000000000..b427006875a0c --- /dev/null +++ b/components/pexels/node_modules/io-ts/ThrowReporter/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/ThrowReporter.js", + "module": "../es6/ThrowReporter.js", + "typings": "../lib/ThrowReporter.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Type/package.json b/components/pexels/node_modules/io-ts/Type/package.json new file mode 100644 index 0000000000000..da4d3c4a515c1 --- /dev/null +++ b/components/pexels/node_modules/io-ts/Type/package.json @@ -0,0 +1,6 @@ +{ + "main": "../lib/Type.js", + "module": "../es6/Type.js", + "typings": "../lib/Type.d.ts", + "sideEffects": false +} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/es6/Codec.d.ts b/components/pexels/node_modules/io-ts/es6/Codec.d.ts new file mode 100644 index 0000000000000..3891f5362e7dc --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Codec.d.ts @@ -0,0 +1,296 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.3 + */ +import { Refinement } from 'fp-ts/es6/function' +import { Invariant3 } from 'fp-ts/es6/Invariant' +import * as D from './Decoder' +import * as E from './Encoder' +import * as S from './Schemable' +/** + * Laws: + * + * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` + * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` + * + * @category model + * @since 2.2.3 + */ +export interface Codec extends D.Decoder, E.Encoder {} +/** + * @category constructors + * @since 2.2.3 + */ +export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec +/** + * @category constructors + * @since 2.2.3 + */ +export declare function fromDecoder(decoder: D.Decoder): Codec +/** + * @category constructors + * @since 2.2.3 + */ +export declare function literal], L extends S.Literal = S.Literal>( + ...values: A +): Codec +/** + * @category primitives + * @since 2.2.3 + */ +export declare const string: Codec +/** + * @category primitives + * @since 2.2.3 + */ +export declare const number: Codec +/** + * @category primitives + * @since 2.2.3 + */ +export declare const boolean: Codec +/** + * @category primitives + * @since 2.2.3 + */ +export declare const UnknownArray: Codec, Array> +/** + * @category primitives + * @since 2.2.3 + */ +export declare const UnknownRecord: Codec, Record> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const mapLeftWithInput: ( + f: (i: I, e: D.DecodeError) => D.DecodeError +) => (codec: Codec) => Codec +/** + * @category combinators + * @since 2.2.3 + */ +export declare const refine: ( + refinement: Refinement, + id: string +) => (from: Codec) => Codec +/** + * @category combinators + * @since 2.2.3 + */ +export declare function nullable(or: Codec): Codec +/** + * @category combinators + * @since 2.2.15 + */ +export declare function fromStruct

>>( + properties: P +): Codec< + { + [K in keyof P]: InputOf + }, + { + [K in keyof P]: OutputOf + }, + { + [K in keyof P]: TypeOf + } +> +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +export declare const fromType: typeof fromStruct +/** + * @category combinators + * @since 2.2.15 + */ +export declare function struct

>>( + properties: P +): Codec< + unknown, + { + [K in keyof P]: OutputOf + }, + { + [K in keyof P]: TypeOf + } +> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export declare const type: typeof struct +/** + * @category combinators + * @since 2.2.8 + */ +export declare function fromPartial

>>( + properties: P +): Codec< + Partial<{ + [K in keyof P]: InputOf + }>, + Partial<{ + [K in keyof P]: OutputOf + }>, + Partial<{ + [K in keyof P]: TypeOf + }> +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function partial

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +export declare const fromType:

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> +/** + * @category combinators + * @since 2.2.15 + */ +export declare const struct: (properties: { [K in keyof A]: Decoder }) => Decoder< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export declare const type: (properties: { [K in keyof A]: Decoder }) => Decoder< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromPartial:

>>( + properties: P +) => Decoder< + Partial<{ [K in keyof P]: K.InputOf<'Either', P[K]> }>, + Partial<{ [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> +> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const partial: (properties: { [K in keyof A]: Decoder }) => Decoder< + unknown, + Partial<{ [K_1 in keyof A]: A[K_1] }> +> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromArray: (item: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const array: (item: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromRecord: (codomain: Decoder) => Decoder, Record> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const record: (codomain: Decoder) => Decoder> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromTuple: []>( + ...components: C +) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K_1 in keyof C]: K.TypeOf<'Either', C[K_1]> }> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const tuple: ( + ...components: { [K in keyof A]: Decoder } +) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const union: , ...Array>]>( + ...members: MS +) => Decoder, TypeOf> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const intersect: ( + right: Decoder +) => (left: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromSum: ( + tag: T +) => >>( + members: MS +) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: Decoder> }) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const lazy: (id: string, f: () => Decoder) => Decoder +/** + * @category combinators + * @since 2.2.15 + */ +export declare const readonly: (decoder: Decoder) => Decoder> +/** + * @category Functor + * @since 2.2.7 + */ +export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder +/** + * @category Alt + * @since 2.2.7 + */ +export declare const alt: (that: () => Decoder) => (me: Decoder) => Decoder +/** + * @category Semigroupoid + * @since 2.2.8 + */ +export declare const compose: (to: Decoder) => (from: Decoder) => Decoder +/** + * @category Category + * @since 2.2.8 + */ +export declare const id: () => Decoder +/** + * @category instances + * @since 2.2.7 + */ +export declare const URI = 'io-ts/Decoder' +/** + * @category instances + * @since 2.2.7 + */ +export type URI = typeof URI +declare module 'fp-ts/es6/HKT' { + interface URItoKind2 { + readonly [URI]: Decoder + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Functor: Functor2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Alt: Alt2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Category: Category2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Schemable: S.Schemable2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnknownContainers: S.WithUnknownContainers2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnion: S.WithUnion2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithRefine: S.WithRefine2C +/** + * @since 2.2.8 + */ +export type InputOf = K.InputOf +/** + * @since 2.2.7 + */ +export type TypeOf = K.TypeOf +/** + * @since 2.2.7 + */ +export declare const draw: (e: DecodeError) => string diff --git a/components/pexels/node_modules/io-ts/es6/Decoder.js b/components/pexels/node_modules/io-ts/es6/Decoder.js new file mode 100644 index 0000000000000..a11b261c56a47 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Decoder.js @@ -0,0 +1,477 @@ +import * as E from 'fp-ts/es6/Either'; +import { identity } from 'fp-ts/es6/function'; +import { pipe } from 'fp-ts/es6/pipeable'; +import * as DE from './DecodeError'; +import * as FS from './FreeSemigroup'; +import * as G from './Guard'; +import * as K from './Kleisli'; +// ------------------------------------------------------------------------------------- +// Kleisli config +// ------------------------------------------------------------------------------------- +/** + * @internal + */ +export var SE = +/*#__PURE__*/ +DE.getSemigroup(); +/** + * @internal + */ +export var ap = function (fab, fa) { + return E.isLeft(fab) + ? E.isLeft(fa) + ? E.left(SE.concat(fab.left, fa.left)) + : fab + : E.isLeft(fa) + ? fa + : E.right(fab.right(fa.right)); +}; +var M = { + URI: E.URI, + _E: undefined, + map: function (fa, f) { return pipe(fa, E.map(f)); }, + ap: ap, + of: E.right, + chain: function (ma, f) { return pipe(ma, E.chain(f)); }, + throwError: E.left, + bimap: function (fa, f, g) { return pipe(fa, E.bimap(f, g)); }, + mapLeft: function (fa, f) { return pipe(fa, E.mapLeft(f)); }, + alt: function (me, that) { + if (E.isRight(me)) { + return me; + } + var ea = that(); + return E.isLeft(ea) ? E.left(SE.concat(me.left, ea.left)) : ea; + } +}; +/** + * @category DecodeError + * @since 2.2.7 + */ +export var error = function (actual, message) { return FS.of(DE.leaf(actual, message)); }; +/** + * @category DecodeError + * @since 2.2.7 + */ +export var success = E.right; +/** + * @category DecodeError + * @since 2.2.7 + */ +export var failure = function (actual, message) { + return E.left(error(actual, message)); +}; +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.8 + */ +export var fromRefinement = function (refinement, expected) { + return K.fromRefinement(M)(refinement, function (u) { return error(u, expected); }); +}; +/** + * @category constructors + * @since 2.2.8 + */ +export var fromGuard = function (guard, expected) { + return fromRefinement(guard.is, expected); +}; +/** + * @category constructors + * @since 2.2.7 + */ +export var literal = +/*#__PURE__*/ +K.literal(M)(function (u, values) { return error(u, values.map(function (value) { return JSON.stringify(value); }).join(' | ')); }); +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.7 + */ +export var string = +/*#__PURE__*/ +fromGuard(G.string, 'string'); +/** + * @category primitives + * @since 2.2.7 + */ +export var number = +/*#__PURE__*/ +fromGuard(G.number, 'number'); +/** + * @category primitives + * @since 2.2.7 + */ +export var boolean = +/*#__PURE__*/ +fromGuard(G.boolean, 'boolean'); +/** + * @category primitives + * @since 2.2.7 + */ +export var UnknownArray = +/*#__PURE__*/ +fromGuard(G.UnknownArray, 'Array'); +/** + * @category primitives + * @since 2.2.7 + */ +export var UnknownRecord = +/*#__PURE__*/ +fromGuard(G.UnknownRecord, 'Record'); +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +export var mapLeftWithInput = +/*#__PURE__*/ +K.mapLeftWithInput(M); +/** + * @category combinators + * @since 2.2.9 + */ +export var withMessage = function (message) { + return mapLeftWithInput(function (input, e) { return FS.of(DE.wrap(message(input, e), e)); }); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var refine = function (refinement, id) { return K.refine(M)(refinement, function (a) { return error(a, id); }); }; +/** + * @category combinators + * @since 2.2.7 + */ +export var parse = +/*#__PURE__*/ +K.parse(M); +/** + * @category combinators + * @since 2.2.7 + */ +export var nullable = +/*#__PURE__*/ +K.nullable(M)(function (u, e) { return FS.concat(FS.of(DE.member(0, error(u, 'null'))), FS.of(DE.member(1, e))); }); +/** + * @category combinators + * @since 2.2.15 + */ +export var fromStruct = function (properties) { + return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); +}; +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +export var fromType = fromStruct; +/** + * @category combinators + * @since 2.2.15 + */ +export var struct = function (properties) { return pipe(UnknownRecord, compose(fromStruct(properties))); }; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export var type = struct; +/** + * @category combinators + * @since 2.2.8 + */ +export var fromPartial = function (properties) { + return K.fromPartial(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(properties); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var partial = function (properties) { return pipe(UnknownRecord, compose(fromPartial(properties))); }; +/** + * @category combinators + * @since 2.2.8 + */ +export var fromArray = function (item) { + return K.fromArray(M)(function (i, e) { return FS.of(DE.index(i, DE.optional, e)); })(item); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var array = function (item) { + return pipe(UnknownArray, compose(fromArray(item))); +}; +/** + * @category combinators + * @since 2.2.8 + */ +export var fromRecord = function (codomain) { + return K.fromRecord(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(codomain); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var record = function (codomain) { + return pipe(UnknownRecord, compose(fromRecord(codomain))); +}; +/** + * @category combinators + * @since 2.2.8 + */ +export var fromTuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return K.fromTuple(M)(function (i, e) { return FS.of(DE.index(i, DE.required, e)); }).apply(void 0, components); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var tuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return pipe(UnknownArray, compose(fromTuple.apply(void 0, components))); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var union = +/*#__PURE__*/ +K.union(M)(function (i, e) { return FS.of(DE.member(i, e)); }); +/** + * @category combinators + * @since 2.2.7 + */ +export var intersect = +/*#__PURE__*/ +K.intersect(M); +/** + * @category combinators + * @since 2.2.8 + */ +export var fromSum = function (tag) { + return function (members) { + return K.fromSum(M)(function (tag, value, keys) { + return FS.of(DE.key(tag, DE.required, error(value, keys.length === 0 ? 'never' : keys.map(function (k) { return JSON.stringify(k); }).join(' | ')))); + })(tag)(members); + }; +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var sum = function (tag) { + return function (members) { + return pipe(UnknownRecord, compose(fromSum(tag)(members))); + }; +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var lazy = +/*#__PURE__*/ +K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); +/** + * @category combinators + * @since 2.2.15 + */ +export var readonly = identity; +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- +var map_ = function (fa, f) { return pipe(fa, map(f)); }; +var alt_ = function (me, that) { return pipe(me, alt(that)); }; +var compose_ = function (ab, la) { return pipe(la, compose(ab)); }; +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- +/** + * @category Functor + * @since 2.2.7 + */ +export var map = +/*#__PURE__*/ +K.map(M); +/** + * @category Alt + * @since 2.2.7 + */ +export var alt = +/*#__PURE__*/ +K.alt(M); +/** + * @category Semigroupoid + * @since 2.2.8 + */ +export var compose = +/*#__PURE__*/ +K.compose(M); +/** + * @category Category + * @since 2.2.8 + */ +export var id = +/*#__PURE__*/ +K.id(M); +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.7 + */ +export var URI = 'io-ts/Decoder'; +/** + * @category instances + * @since 2.2.8 + */ +export var Functor = { + URI: URI, + map: map_ +}; +/** + * @category instances + * @since 2.2.8 + */ +export var Alt = { + URI: URI, + map: map_, + alt: alt_ +}; +/** + * @category instances + * @since 2.2.8 + */ +export var Category = { + URI: URI, + compose: compose_, + id: id +}; +/** + * @category instances + * @since 2.2.8 + */ +export var Schemable = { + URI: URI, + literal: literal, + string: string, + number: number, + boolean: boolean, + nullable: nullable, + type: type, + struct: struct, + partial: partial, + record: record, + array: array, + tuple: tuple, + intersect: intersect, + sum: sum, + lazy: lazy, + readonly: readonly +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithUnknownContainers = { + UnknownArray: UnknownArray, + UnknownRecord: UnknownRecord +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithUnion = { + union: union +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithRefine = { + refine: refine +}; +var empty = []; +var make = function (value, forest) { + if (forest === void 0) { forest = empty; } + return ({ + value: value, + forest: forest + }); +}; +var drawTree = function (tree) { return tree.value + drawForest('\n', tree.forest); }; +var drawForest = function (indentation, forest) { + var r = ''; + var len = forest.length; + var tree; + for (var i = 0; i < len; i++) { + tree = forest[i]; + var isLast = i === len - 1; + r += indentation + (isLast ? '└' : '├') + '─ ' + tree.value; + r += drawForest(indentation + (len > 1 && !isLast ? '│ ' : ' '), tree.forest); + } + return r; +}; +var toTree = DE.fold({ + Leaf: function (input, error) { return make("cannot decode ".concat(JSON.stringify(input), ", should be ").concat(error)); }, + Key: function (key, kind, errors) { return make("".concat(kind, " property ").concat(JSON.stringify(key)), toForest(errors)); }, + Index: function (index, kind, errors) { return make("".concat(kind, " index ").concat(index), toForest(errors)); }, + Member: function (index, errors) { return make("member ".concat(index), toForest(errors)); }, + Lazy: function (id, errors) { return make("lazy type ".concat(id), toForest(errors)); }, + Wrap: function (error, errors) { return make(error, toForest(errors)); } +}); +var toForest = function (e) { + var stack = []; + var focus = e; + var res = []; + // eslint-disable-next-line no-constant-condition + while (true) { + switch (focus._tag) { + case 'Of': + { + res.push(toTree(focus.value)); + var tmp = stack.pop(); + if (tmp === undefined) { + return res; + } + else { + focus = tmp; + } + } + break; + case 'Concat': + stack.push(focus.right); + focus = focus.left; + break; + } + } +}; +/** + * @since 2.2.7 + */ +export var draw = function (e) { return toForest(e).map(drawTree).join('\n'); }; +/** + * @internal + */ +export var stringify = +/*#__PURE__*/ +E.fold(draw, function (a) { return JSON.stringify(a, null, 2); }); diff --git a/components/pexels/node_modules/io-ts/es6/Encoder.d.ts b/components/pexels/node_modules/io-ts/es6/Encoder.d.ts new file mode 100644 index 0000000000000..6c2d3231f42c9 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Encoder.d.ts @@ -0,0 +1,154 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.3 + */ +import { Category2 } from 'fp-ts/es6/Category' +import { Contravariant2 } from 'fp-ts/es6/Contravariant' +/** + * @category model + * @since 2.2.3 + */ +export interface Encoder { + readonly encode: (a: A) => O +} +/** + * @category combinators + * @since 2.2.3 + */ +export declare function nullable(or: Encoder): Encoder +/** + * @category combinators + * @since 2.2.15 + */ +export declare function struct

>>( + properties: P +): Encoder< + { + [K in keyof P]: OutputOf + }, + { + [K in keyof P]: TypeOf + } +> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export declare const type: typeof struct +/** + * @category combinators + * @since 2.2.3 + */ +export declare function partial

>>( + properties: P +): Encoder< + Partial<{ + [K in keyof P]: OutputOf + }>, + Partial<{ + [K in keyof P]: TypeOf + }> +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function record(codomain: Encoder): Encoder, Record> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function array(item: Encoder): Encoder, Array> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function tuple>>( + ...components: C +): Encoder< + { + [K in keyof C]: OutputOf + }, + { + [K in keyof C]: TypeOf + } +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const intersect: (right: Encoder) => (left: Encoder) => Encoder +/** + * @category combinators + * @since 2.2.3 + */ +export declare function sum( + tag: T +): >>(members: MS) => Encoder, TypeOf> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function lazy(f: () => Encoder): Encoder +/** + * @category combinators + * @since 2.2.16 + */ +export declare const readonly: (decoder: Encoder) => Encoder> +/** + * @category Contravariant + * @since 2.2.3 + */ +export declare const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder +/** + * @category Semigroupoid + * @since 2.2.3 + */ +export declare const compose: (ea: Encoder) => (ab: Encoder) => Encoder +/** + * @category Category + * @since 2.2.3 + */ +export declare function id(): Encoder +/** + * @category instances + * @since 2.2.3 + */ +export declare const URI = 'io-ts/Encoder' +/** + * @category instances + * @since 2.2.3 + */ +export type URI = typeof URI +declare module 'fp-ts/es6/HKT' { + interface URItoKind2 { + readonly [URI]: Encoder + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Contravariant: Contravariant2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Category: Category2 +/** + * @since 2.2.3 + */ +export type TypeOf = E extends Encoder ? A : never +/** + * @since 2.2.3 + */ +export type OutputOf = E extends Encoder ? O : never diff --git a/components/pexels/node_modules/io-ts/es6/Encoder.js b/components/pexels/node_modules/io-ts/es6/Encoder.js new file mode 100644 index 0000000000000..4f430e14c8117 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Encoder.js @@ -0,0 +1,187 @@ +import { identity } from 'fp-ts/es6/function'; +import { intersect_, memoize } from './Schemable'; +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.3 + */ +export function nullable(or) { + return { + encode: function (a) { return (a === null ? null : or.encode(a)); } + }; +} +/** + * @category combinators + * @since 2.2.15 + */ +export function struct(properties) { + return { + encode: function (a) { + var o = {}; + for (var k in properties) { + o[k] = properties[k].encode(a[k]); + } + return o; + } + }; +} +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export var type = struct; +/** + * @category combinators + * @since 2.2.3 + */ +export function partial(properties) { + return { + encode: function (a) { + var o = {}; + for (var k in properties) { + var v = a[k]; + // don't add missing properties + if (k in a) { + // don't strip undefined properties + o[k] = v === undefined ? undefined : properties[k].encode(v); + } + } + return o; + } + }; +} +/** + * @category combinators + * @since 2.2.3 + */ +export function record(codomain) { + return { + encode: function (r) { + var o = {}; + for (var k in r) { + o[k] = codomain.encode(r[k]); + } + return o; + } + }; +} +/** + * @category combinators + * @since 2.2.3 + */ +export function array(item) { + return { + encode: function (as) { return as.map(item.encode); } + }; +} +/** + * @category combinators + * @since 2.2.3 + */ +export function tuple() { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return { + encode: function (as) { return components.map(function (c, i) { return c.encode(as[i]); }); } + }; +} +/** + * @category combinators + * @since 2.2.3 + */ +export var intersect = function (right) { + return function (left) { return ({ + encode: function (ab) { return intersect_(left.encode(ab), right.encode(ab)); } + }); }; +}; +/** + * @category combinators + * @since 2.2.3 + */ +export function sum(tag) { + return function (members) { + return { + encode: function (a) { return members[a[tag]].encode(a); } + }; + }; +} +/** + * @category combinators + * @since 2.2.3 + */ +export function lazy(f) { + var get = memoize(f); + return { + encode: function (a) { return get().encode(a); } + }; +} +/** + * @category combinators + * @since 2.2.16 + */ +export var readonly = identity; +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- +var contramap_ = function (ea, f) { return ({ + encode: function (b) { return ea.encode(f(b)); } +}); }; +var compose_ = function (ab, ea) { return contramap_(ea, ab.encode); }; +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- +/** + * @category Contravariant + * @since 2.2.3 + */ +export var contramap = function (f) { return function (fa) { + return contramap_(fa, f); +}; }; +/** + * @category Semigroupoid + * @since 2.2.3 + */ +export var compose = function (ea) { return function (ab) { + return compose_(ab, ea); +}; }; +/** + * @category Category + * @since 2.2.3 + */ +export function id() { + return { + encode: identity + }; +} +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.3 + */ +export var URI = 'io-ts/Encoder'; +/** + * @category instances + * @since 2.2.8 + */ +export var Contravariant = { + URI: URI, + contramap: contramap_ +}; +/** + * @category instances + * @since 2.2.8 + */ +export var Category = { + URI: URI, + compose: compose_, + id: id +}; diff --git a/components/pexels/node_modules/io-ts/es6/Eq.d.ts b/components/pexels/node_modules/io-ts/es6/Eq.d.ts new file mode 100644 index 0000000000000..8b7fce725b557 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Eq.d.ts @@ -0,0 +1,127 @@ +import * as E from 'fp-ts/es6/Eq' +import { Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' +import Eq = E.Eq +/** + * @since 2.2.3 + */ +export type URI = E.URI +/** + * @since 2.2.2 + */ +export type TypeOf = E extends Eq ? A : never +/** + * @category primitives + * @since 2.2.2 + */ +export declare const string: Eq +/** + * @category primitives + * @since 2.2.2 + */ +export declare const number: Eq +/** + * @category primitives + * @since 2.2.2 + */ +export declare const boolean: Eq +/** + * @category primitives + * @since 2.2.2 + */ +export declare const UnknownArray: Eq> +/** + * @category primitives + * @since 2.2.2 + */ +export declare const UnknownRecord: Eq> +/** + * @category combinators + * @since 2.2.2 + */ +export declare function nullable(or: Eq): Eq +/** + * @category combinators + * @since 2.2.15 + */ +export declare const struct: (eqs: { + [K in keyof A]: Eq +}) => Eq<{ + [K in keyof A]: A[K] +}> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.2 + * @deprecated + */ +export declare const type: (eqs: { [K in keyof A]: E.Eq }) => E.Eq<{ [K_1 in keyof A]: A[K_1] }> +/** + * @category combinators + * @since 2.2.2 + */ +export declare function partial(properties: { + [K in keyof A]: Eq +}): Eq< + Partial<{ + [K in keyof A]: A[K] + }> +> +/** + * @category combinators + * @since 2.2.2 + */ +export declare const record: (codomain: Eq) => Eq> +/** + * @category combinators + * @since 2.2.2 + */ +export declare const array: (eq: Eq) => Eq> +/** + * @category combinators + * @since 2.2.2 + */ +export declare const tuple: >( + ...components: { + [K in keyof A]: Eq + } +) => Eq +/** + * @category combinators + * @since 2.2.2 + */ +export declare const intersect: (right: E.Eq) => (left: E.Eq) => E.Eq +/** + * @category combinators + * @since 2.2.2 + */ +export declare function sum( + tag: T +): (members: { + [K in keyof A]: Eq> +}) => Eq +/** + * @category combinators + * @since 2.2.2 + */ +export declare function lazy(f: () => Eq): Eq +/** + * @category combinators + * @since 2.2.15 + */ +export declare const readonly: (eq: Eq) => Eq> +/** + * @category instances + * @since 2.2.8 + */ +export declare const Schemable: Schemable1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnknownContainers: WithUnknownContainers1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithRefine: WithRefine1 diff --git a/components/pexels/node_modules/io-ts/es6/Eq.js b/components/pexels/node_modules/io-ts/es6/Eq.js new file mode 100644 index 0000000000000..97f31fa0e84a1 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Eq.js @@ -0,0 +1,195 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.2 + */ +import * as A from 'fp-ts/es6/Array'; +import * as E from 'fp-ts/es6/Eq'; +import { identity } from 'fp-ts/es6/function'; +import * as R from 'fp-ts/es6/Record'; +import { memoize } from './Schemable'; +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.2 + */ +export var string = E.eqString; +/** + * @category primitives + * @since 2.2.2 + */ +export var number = E.eqNumber; +/** + * @category primitives + * @since 2.2.2 + */ +export var boolean = E.eqBoolean; +/** + * @category primitives + * @since 2.2.2 + */ +export var UnknownArray = E.fromEquals(function (x, y) { return x.length === y.length; }); +/** + * @category primitives + * @since 2.2.2 + */ +export var UnknownRecord = E.fromEquals(function (x, y) { + for (var k in x) { + if (!(k in y)) { + return false; + } + } + for (var k in y) { + if (!(k in x)) { + return false; + } + } + return true; +}); +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.2 + */ +export function nullable(or) { + return { + equals: function (x, y) { return (x === null || y === null ? x === y : or.equals(x, y)); } + }; +} +/** + * @category combinators + * @since 2.2.15 + */ +export var struct = E.getStructEq; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.2 + * @deprecated + */ +export var type = struct; +/** + * @category combinators + * @since 2.2.2 + */ +export function partial(properties) { + return { + equals: function (x, y) { + for (var k in properties) { + var xk = x[k]; + var yk = y[k]; + if (!(xk === undefined || yk === undefined ? xk === yk : properties[k].equals(xk, yk))) { + return false; + } + } + return true; + } + }; +} +/** + * @category combinators + * @since 2.2.2 + */ +export var record = R.getEq; +/** + * @category combinators + * @since 2.2.2 + */ +export var array = A.getEq; +/** + * @category combinators + * @since 2.2.2 + */ +export var tuple = E.getTupleEq; +/** + * @category combinators + * @since 2.2.2 + */ +export var intersect = function (right) { + return function (left) { return ({ + equals: function (x, y) { return left.equals(x, y) && right.equals(x, y); } + }); }; +}; +/** + * @category combinators + * @since 2.2.2 + */ +export function sum(tag) { + return function (members) { + return { + equals: function (x, y) { + var vx = x[tag]; + var vy = y[tag]; + if (vx !== vy) { + return false; + } + return members[vx].equals(x, y); + } + }; + }; +} +/** + * @category combinators + * @since 2.2.2 + */ +export function lazy(f) { + var get = memoize(f); + return { + equals: function (x, y) { return get().equals(x, y); } + }; +} +/** + * @category combinators + * @since 2.2.15 + */ +export var readonly = identity; +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.8 + */ +export var Schemable = { + URI: E.URI, + literal: function () { return E.eqStrict; }, + string: string, + number: number, + boolean: boolean, + nullable: nullable, + type: type, + struct: struct, + partial: partial, + record: record, + array: array, + tuple: tuple, + intersect: intersect, + sum: sum, + lazy: function (_, f) { return lazy(f); }, + readonly: readonly +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithUnknownContainers = { + UnknownArray: UnknownArray, + UnknownRecord: UnknownRecord +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithRefine = { + refine: function () { return function (from) { return from; }; } +}; diff --git a/components/pexels/node_modules/io-ts/es6/FreeSemigroup.d.ts b/components/pexels/node_modules/io-ts/es6/FreeSemigroup.d.ts new file mode 100644 index 0000000000000..03d96487dd382 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/FreeSemigroup.d.ts @@ -0,0 +1,56 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Semigroup } from 'fp-ts/es6/Semigroup' +/** + * @category model + * @since 2.2.7 + */ +export interface Of { + readonly _tag: 'Of' + readonly value: A +} +/** + * @category model + * @since 2.2.7 + */ +export interface Concat { + readonly _tag: 'Concat' + readonly left: FreeSemigroup + readonly right: FreeSemigroup +} +/** + * @category model + * @since 2.2.7 + */ +export type FreeSemigroup = Of | Concat +/** + * @category constructors + * @since 2.2.7 + */ +export declare const of: (a: A) => FreeSemigroup +/** + * @category constructors + * @since 2.2.7 + */ +export declare const concat: (left: FreeSemigroup, right: FreeSemigroup) => FreeSemigroup +/** + * @category destructors + * @since 2.2.7 + */ +export declare const fold: ( + onOf: (value: A) => R, + onConcat: (left: FreeSemigroup, right: FreeSemigroup) => R +) => (f: FreeSemigroup) => R +/** + * @category instances + * @since 2.2.7 + */ +export declare function getSemigroup(): Semigroup> diff --git a/components/pexels/node_modules/io-ts/es6/FreeSemigroup.js b/components/pexels/node_modules/io-ts/es6/FreeSemigroup.js new file mode 100644 index 0000000000000..29e69a04cc1d1 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/FreeSemigroup.js @@ -0,0 +1,35 @@ +/** + * @category constructors + * @since 2.2.7 + */ +export var of = function (a) { return ({ _tag: 'Of', value: a }); }; +/** + * @category constructors + * @since 2.2.7 + */ +export var concat = function (left, right) { return ({ + _tag: 'Concat', + left: left, + right: right +}); }; +/** + * @category destructors + * @since 2.2.7 + */ +export var fold = function (onOf, onConcat) { + return function (f) { + switch (f._tag) { + case 'Of': + return onOf(f.value); + case 'Concat': + return onConcat(f.left, f.right); + } + }; +}; +/** + * @category instances + * @since 2.2.7 + */ +export function getSemigroup() { + return { concat: concat }; +} diff --git a/components/pexels/node_modules/io-ts/es6/Guard.d.ts b/components/pexels/node_modules/io-ts/es6/Guard.d.ts new file mode 100644 index 0000000000000..576ba7d4e9a25 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Guard.d.ts @@ -0,0 +1,201 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.0 + */ +import { Refinement } from 'fp-ts/es6/function' +import * as S from './Schemable' +/** + * @category model + * @since 2.2.8 + */ +export interface Guard { + is: (i: I) => i is A +} +/** + * @since 2.2.2 + */ +export type TypeOf = G extends Guard ? A : never +/** + * @since 2.2.8 + */ +export type InputOf = G extends Guard ? I : never +/** + * @category constructors + * @since 2.2.0 + */ +export declare const literal: ( + ...values: A +) => Guard +/** + * @category primitives + * @since 2.2.0 + */ +export declare const string: Guard +/** + * Note: `NaN` is excluded. + * + * @category primitives + * @since 2.2.0 + */ +export declare const number: Guard +/** + * @category primitives + * @since 2.2.0 + */ +export declare const boolean: Guard +/** + * @category primitives + * @since 2.2.0 + */ +export declare const UnknownArray: Guard> +/** + * @category primitives + * @since 2.2.0 + */ +export declare const UnknownRecord: Guard> +/** + * @category combinators + * @since 2.2.0 + */ +export declare const refine: ( + refinement: Refinement +) => (from: Guard) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const nullable: (or: Guard) => Guard +/** + * @category combinators + * @since 2.2.15 + */ +export declare const struct: (properties: { [K in keyof A]: Guard }) => Guard< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.0 + * @deprecated + */ +export declare const type: (properties: { [K in keyof A]: Guard }) => Guard< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * @category combinators + * @since 2.2.0 + */ +export declare const partial: (properties: { [K in keyof A]: Guard }) => Guard< + unknown, + Partial<{ [K_1 in keyof A]: A[K_1] }> +> +/** + * @category combinators + * @since 2.2.0 + */ +export declare const array: (item: Guard) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const record: (codomain: Guard) => Guard> +/** + * @category combinators + * @since 2.2.0 + */ +export declare const tuple: ( + ...components: { [K in keyof A]: Guard } +) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const intersect: (right: Guard) => (left: Guard) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const union: ( + ...members: { [K in keyof A]: Guard } +) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: Guard> }) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const lazy: (f: () => Guard) => Guard +/** + * @category combinators + * @since 2.2.15 + */ +export declare const readonly: (guard: Guard) => Guard> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const alt: (that: () => Guard) => (me: Guard) => Guard +/** + * @category combinators + * @since 2.2.8 + */ +export declare const zero: () => Guard +/** + * @category combinators + * @since 2.2.8 + */ +export declare const compose: (to: Guard) => (from: Guard) => Guard +/** + * @category combinators + * @since 2.2.8 + */ +export declare const id: () => Guard +/** + * @category instances + * @since 2.2.0 + */ +export declare const URI = 'io-ts/Guard' +/** + * @category instances + * @since 2.2.0 + */ +export type URI = typeof URI +declare module 'fp-ts/es6/HKT' { + interface URItoKind { + readonly [URI]: Guard + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Schemable: S.Schemable1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnknownContainers: S.WithUnknownContainers1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnion: S.WithUnion1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithRefine: S.WithRefine1 diff --git a/components/pexels/node_modules/io-ts/es6/Guard.js b/components/pexels/node_modules/io-ts/es6/Guard.js new file mode 100644 index 0000000000000..5cab0392e6bed --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Guard.js @@ -0,0 +1,295 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.0 + */ +import { identity } from 'fp-ts/es6/function'; +import { pipe } from 'fp-ts/es6/pipeable'; +import * as S from './Schemable'; +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.0 + */ +export var literal = function () { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return ({ + is: function (u) { return values.findIndex(function (a) { return a === u; }) !== -1; } + }); +}; +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.0 + */ +export var string = { + is: function (u) { return typeof u === 'string'; } +}; +/** + * Note: `NaN` is excluded. + * + * @category primitives + * @since 2.2.0 + */ +export var number = { + is: function (u) { return typeof u === 'number' && !isNaN(u); } +}; +/** + * @category primitives + * @since 2.2.0 + */ +export var boolean = { + is: function (u) { return typeof u === 'boolean'; } +}; +/** + * @category primitives + * @since 2.2.0 + */ +export var UnknownArray = { + is: Array.isArray +}; +/** + * @category primitives + * @since 2.2.0 + */ +export var UnknownRecord = { + is: function (u) { return u !== null && typeof u === 'object' && !Array.isArray(u); } +}; +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.0 + */ +export var refine = function (refinement) { + return function (from) { return ({ + is: function (i) { return from.is(i) && refinement(i); } + }); }; +}; +/** + * @category combinators + * @since 2.2.0 + */ +export var nullable = function (or) { return ({ + is: function (i) { return i === null || or.is(i); } +}); }; +/** + * @category combinators + * @since 2.2.15 + */ +export var struct = function (properties) { + return pipe(UnknownRecord, refine(function (r) { + for (var k in properties) { + if (!(k in r) || !properties[k].is(r[k])) { + return false; + } + } + return true; + })); +}; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.0 + * @deprecated + */ +export var type = struct; +/** + * @category combinators + * @since 2.2.0 + */ +export var partial = function (properties) { + return pipe(UnknownRecord, refine(function (r) { + for (var k in properties) { + var v = r[k]; + if (v !== undefined && !properties[k].is(v)) { + return false; + } + } + return true; + })); +}; +/** + * @category combinators + * @since 2.2.0 + */ +export var array = function (item) { + return pipe(UnknownArray, refine(function (us) { return us.every(item.is); })); +}; +/** + * @category combinators + * @since 2.2.0 + */ +export var record = function (codomain) { + return pipe(UnknownRecord, refine(function (r) { + for (var k in r) { + if (!codomain.is(r[k])) { + return false; + } + } + return true; + })); +}; +/** + * @category combinators + * @since 2.2.0 + */ +export var tuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return ({ + is: function (u) { return Array.isArray(u) && u.length === components.length && components.every(function (c, i) { return c.is(u[i]); }); } + }); +}; +/** + * @category combinators + * @since 2.2.0 + */ +export var intersect = function (right) { + return function (left) { return ({ + is: function (u) { return left.is(u) && right.is(u); } + }); }; +}; +/** + * @category combinators + * @since 2.2.0 + */ +export var union = function () { + var members = []; + for (var _i = 0; _i < arguments.length; _i++) { + members[_i] = arguments[_i]; + } + return ({ + is: function (u) { return members.some(function (m) { return m.is(u); }); } + }); +}; +/** + * @category combinators + * @since 2.2.0 + */ +export var sum = function (tag) { + return function (members) { + return pipe(UnknownRecord, refine(function (r) { + var v = r[tag]; + if (v in members) { + return members[v].is(r); + } + return false; + })); + }; +}; +/** + * @category combinators + * @since 2.2.0 + */ +export var lazy = function (f) { + var get = S.memoize(f); + return { + is: function (u) { return get().is(u); } + }; +}; +/** + * @category combinators + * @since 2.2.15 + */ +export var readonly = identity; +/** + * @category combinators + * @since 2.2.8 + */ +export var alt = function (that) { + return function (me) { return ({ + is: function (i) { return me.is(i) || that().is(i); } + }); }; +}; +/** + * @category combinators + * @since 2.2.8 + */ +export var zero = function () { return ({ + is: function (_) { return false; } +}); }; +/** + * @category combinators + * @since 2.2.8 + */ +export var compose = function (to) { + return function (from) { return ({ + is: function (i) { return from.is(i) && to.is(i); } + }); }; +}; +/** + * @category combinators + * @since 2.2.8 + */ +export var id = function () { return ({ + is: function (_) { return true; } +}); }; +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.0 + */ +export var URI = 'io-ts/Guard'; +/** + * @category instances + * @since 2.2.8 + */ +export var Schemable = { + URI: URI, + literal: literal, + string: string, + number: number, + boolean: boolean, + nullable: nullable, + type: type, + struct: struct, + partial: partial, + record: record, + array: array, + tuple: tuple, + intersect: intersect, + sum: sum, + lazy: function (_, f) { return lazy(f); }, + readonly: readonly +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithUnknownContainers = { + UnknownArray: UnknownArray, + UnknownRecord: UnknownRecord +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithUnion = { + union: union +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithRefine = { + refine: refine +}; diff --git a/components/pexels/node_modules/io-ts/es6/Kleisli.d.ts b/components/pexels/node_modules/io-ts/es6/Kleisli.d.ts new file mode 100644 index 0000000000000..5b9f63b798b3f --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Kleisli.d.ts @@ -0,0 +1,226 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Alt2C } from 'fp-ts/es6/Alt' +import { Applicative2C } from 'fp-ts/es6/Applicative' +import { Apply2C } from 'fp-ts/es6/Apply' +import { Bifunctor2 } from 'fp-ts/es6/Bifunctor' +import { Lazy, Refinement } from 'fp-ts/es6/function' +import { Functor2C } from 'fp-ts/es6/Functor' +import { Kind2, URIS2 } from 'fp-ts/es6/HKT' +import { Monad2C } from 'fp-ts/es6/Monad' +import { MonadThrow2C } from 'fp-ts/es6/MonadThrow' +import * as S from './Schemable' +/** + * @category model + * @since 2.2.7 + */ +export interface Kleisli { + readonly decode: (i: I) => Kind2 +} +/** + * @category constructors + * @since 2.2.7 + */ +export declare function fromRefinement( + M: MonadThrow2C +): (refinement: Refinement, onError: (i: I) => E) => Kleisli +/** + * @category constructors + * @since 2.2.7 + */ +export declare function literal( + M: MonadThrow2C +): ( + onError: (i: I, values: readonly [S.Literal, ...ReadonlyArray]) => E +) => ], L extends S.Literal = S.Literal>( + ...values: A +) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function mapLeftWithInput( + M: Bifunctor2 +): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function refine( + M: MonadThrow2C & Bifunctor2 +): ( + refinement: (a: A) => a is B, + onError: (a: A) => E +) => (from: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function parse( + M: Monad2C +): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function nullable( + M: Applicative2C & Bifunctor2 +): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.15 + */ +export declare function fromStruct( + M: Applicative2C & Bifunctor2 +): (onPropertyError: (key: string, e: E) => E) =>

>>( + properties: P +) => Kleisli< + M, + { + [K in keyof P]: InputOf + }, + E, + { + [K in keyof P]: TypeOf + } +> +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export declare const fromType: typeof fromStruct +/** + * @category combinators + * @since 2.2.7 + */ +export declare function fromPartial( + M: Applicative2C & Bifunctor2 +): (onPropertyError: (key: string, e: E) => E) =>

>>( + properties: P +) => Kleisli< + M, + Partial<{ + [K in keyof P]: InputOf + }>, + E, + Partial<{ + [K in keyof P]: TypeOf + }> +> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function fromArray( + M: Applicative2C & Bifunctor2 +): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function fromRecord( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => (codomain: Kleisli) => Kleisli, E, Record> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function fromTuple( + M: Applicative2C & Bifunctor2 +): (onIndexError: (index: number, e: E) => E) => >>( + ...components: C +) => Kleisli< + M, + { + [K in keyof C]: InputOf + }, + E, + { + [K in keyof C]: TypeOf + } +> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function union( + M: Alt2C & Bifunctor2 +): ( + onMemberError: (index: number, e: E) => E +) => , ...Array>]>( + ...members: MS +) => Kleisli, E, TypeOf> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function intersect( + M: Apply2C +): (right: Kleisli) => (left: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function fromSum( + M: MonadThrow2C +): ( + onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E +) => ( + tag: T +) => >>( + members: MS +) => Kleisli, E, TypeOf> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function lazy( + M: Bifunctor2 +): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function compose( + M: Monad2C +): (ab: Kleisli) => (ia: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.8 + */ +export declare function id(M: Applicative2C): () => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function map( + F: Functor2C +): (f: (a: A) => B) => (ia: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function alt( + A: Alt2C +): (that: Lazy>) => (me: Kleisli) => Kleisli +/** + * @since 2.2.7 + */ +export type TypeOf = KD extends Kleisli ? A : never +/** + * @since 2.2.7 + */ +export type InputOf = KD extends Kleisli ? I : never diff --git a/components/pexels/node_modules/io-ts/es6/Kleisli.js b/components/pexels/node_modules/io-ts/es6/Kleisli.js new file mode 100644 index 0000000000000..e94ff2a80d10e --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Kleisli.js @@ -0,0 +1,315 @@ +import * as E from 'fp-ts/es6/Either'; +import * as G from './Guard'; +import * as S from './Schemable'; +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.7 + */ +export function fromRefinement(M) { + return function (refinement, onError) { return ({ + decode: function (i) { return (refinement(i) ? M.of(i) : M.throwError(onError(i))); } + }); }; +} +/** + * @category constructors + * @since 2.2.7 + */ +export function literal(M) { + return function (onError) { + return function () { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return ({ + decode: function (i) { return (G.literal.apply(G, values).is(i) ? M.of(i) : M.throwError(onError(i, values))); } + }); + }; + }; +} +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +export function mapLeftWithInput(M) { + return function (f) { return function (decoder) { return ({ + decode: function (i) { return M.mapLeft(decoder.decode(i), function (e) { return f(i, e); }); } + }); }; }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function refine(M) { + return function (refinement, onError) { return function (from) { return compose(M)(fromRefinement(M)(refinement, onError))(from); }; }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function parse(M) { + return function (decode) { return function (from) { return compose(M)({ decode: decode })(from); }; }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function nullable(M) { + return function (onError) { + return function (or) { return ({ + decode: function (i) { + return i === null + ? M.of(null) + : M.bimap(or.decode(i), function (e) { return onError(i, e); }, function (a) { return a; }); + } + }); }; + }; +} +/** + * @category combinators + * @since 2.2.15 + */ +export function fromStruct(M) { + var traverse = traverseRecordWithIndex(M); + return function (onPropertyError) { return function (properties) { return ({ + decode: function (i) { + return traverse(properties, function (key, decoder) { + return M.mapLeft(decoder.decode(i[key]), function (e) { return onPropertyError(key, e); }); + }); + } + }); }; }; +} +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export var fromType = fromStruct; +/** + * @category combinators + * @since 2.2.7 + */ +export function fromPartial(M) { + var traverse = traverseRecordWithIndex(M); + var undefinedProperty = M.of(E.right(undefined)); + var skipProperty = M.of(E.left(undefined)); + return function (onPropertyError) { return function (properties) { return ({ + decode: function (i) { + return M.map(traverse(properties, function (key, decoder) { + var ikey = i[key]; + if (ikey === undefined) { + return key in i + ? // don't strip undefined properties + undefinedProperty + : // don't add missing properties + skipProperty; + } + return M.bimap(decoder.decode(ikey), function (e) { return onPropertyError(key, e); }, function (a) { return E.right(a); }); + }), compactRecord); + } + }); }; }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function fromArray(M) { + var traverse = traverseArrayWithIndex(M); + return function (onItemError) { return function (item) { return ({ + decode: function (is) { return traverse(is, function (index, i) { return M.mapLeft(item.decode(i), function (e) { return onItemError(index, e); }); }); } + }); }; }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function fromRecord(M) { + var traverse = traverseRecordWithIndex(M); + return function (onKeyError) { return function (codomain) { return ({ + decode: function (ir) { return traverse(ir, function (key, i) { return M.mapLeft(codomain.decode(i), function (e) { return onKeyError(key, e); }); }); } + }); }; }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function fromTuple(M) { + var traverse = traverseArrayWithIndex(M); + return function (onIndexError) { + return function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return ({ + decode: function (is) { + return traverse(components, function (index, decoder) { + return M.mapLeft(decoder.decode(is[index]), function (e) { return onIndexError(index, e); }); + }); + } + }); + }; + }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function union(M) { + return function (onMemberError) { + return function () { + var members = []; + for (var _i = 0; _i < arguments.length; _i++) { + members[_i] = arguments[_i]; + } + return ({ + decode: function (i) { + var out = M.mapLeft(members[0].decode(i), function (e) { return onMemberError(0, e); }); + var _loop_1 = function (index) { + out = M.alt(out, function () { return M.mapLeft(members[index].decode(i), function (e) { return onMemberError(index, e); }); }); + }; + for (var index = 1; index < members.length; index++) { + _loop_1(index); + } + return out; + } + }); + }; + }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function intersect(M) { + return function (right) { + return function (left) { return ({ + decode: function (i) { + return M.ap(M.map(left.decode(i), function (a) { return function (b) { return S.intersect_(a, b); }; }), right.decode(i)); + } + }); }; + }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function fromSum(M) { + return function (onTagError) { + return function (tag) { + return function (members) { + var keys = Object.keys(members); + return { + decode: function (ir) { + var v = ir[tag]; + if (Object.prototype.hasOwnProperty.call(members, v)) { + return members[v].decode(ir); + } + return M.throwError(onTagError(tag, v, keys)); + } + }; + }; + }; + }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function lazy(M) { + return function (onError) { + return function (id, f) { + var get = S.memoize(f); + return { + decode: function (u) { return M.mapLeft(get().decode(u), function (e) { return onError(id, e); }); } + }; + }; + }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function compose(M) { + return function (ab) { return function (ia) { return ({ + decode: function (i) { return M.chain(ia.decode(i), ab.decode); } + }); }; }; +} +/** + * @category combinators + * @since 2.2.8 + */ +export function id(M) { + return function () { return ({ + decode: M.of + }); }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function map(F) { + return function (f) { return function (ia) { return ({ + decode: function (i) { return F.map(ia.decode(i), f); } + }); }; }; +} +/** + * @category combinators + * @since 2.2.7 + */ +export function alt(A) { + return function (that) { return function (me) { return ({ + decode: function (i) { return A.alt(me.decode(i), function () { return that().decode(i); }); } + }); }; }; +} +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- +var traverseArrayWithIndex = function (M) { + return function (as, f) { + return as.reduce(function (mbs, a, i) { + return M.ap(M.map(mbs, function (bs) { return function (b) { + bs.push(b); + return bs; + }; }), f(i, a)); + }, M.of([])); + }; +}; +var traverseRecordWithIndex = function (M) { + return function (r, f) { + var ks = Object.keys(r); + if (ks.length === 0) { + return M.of({}); + } + var fr = M.of({}); + var _loop_2 = function (key) { + fr = M.ap(M.map(fr, function (r) { return function (b) { + r[key] = b; + return r; + }; }), f(key, r[key])); + }; + for (var _i = 0, ks_1 = ks; _i < ks_1.length; _i++) { + var key = ks_1[_i]; + _loop_2(key); + } + return fr; + }; +}; +var compactRecord = function (r) { + var out = {}; + for (var k in r) { + var rk = r[k]; + if (E.isRight(rk)) { + out[k] = rk.right; + } + } + return out; +}; diff --git a/components/pexels/node_modules/io-ts/es6/PathReporter.d.ts b/components/pexels/node_modules/io-ts/es6/PathReporter.d.ts new file mode 100644 index 0000000000000..6050a03572bfd --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/PathReporter.d.ts @@ -0,0 +1,14 @@ +import { ValidationError } from '.' +import { Reporter } from './Reporter' +/** + * @since 1.0.0 + */ +export declare function failure(es: Array): Array +/** + * @since 1.0.0 + */ +export declare function success(): Array +/** + * @since 1.0.0 + */ +export declare const PathReporter: Reporter> diff --git a/components/pexels/node_modules/io-ts/es6/PathReporter.js b/components/pexels/node_modules/io-ts/es6/PathReporter.js new file mode 100644 index 0000000000000..b9a7bfd12486f --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/PathReporter.js @@ -0,0 +1,46 @@ +/** + * @since 1.0.0 + */ +import { fold } from 'fp-ts/es6/Either'; +import { getFunctionName } from '.'; +function stringify(v) { + if (typeof v === 'function') { + return getFunctionName(v); + } + if (typeof v === 'number' && !isFinite(v)) { + if (isNaN(v)) { + return 'NaN'; + } + return v > 0 ? 'Infinity' : '-Infinity'; + } + return JSON.stringify(v); +} +function getContextPath(context) { + return context.map(function (_a) { + var key = _a.key, type = _a.type; + return "".concat(key, ": ").concat(type.name); + }).join('/'); +} +function getMessage(e) { + return e.message !== undefined + ? e.message + : "Invalid value ".concat(stringify(e.value), " supplied to ").concat(getContextPath(e.context)); +} +/** + * @since 1.0.0 + */ +export function failure(es) { + return es.map(getMessage); +} +/** + * @since 1.0.0 + */ +export function success() { + return ['No errors!']; +} +/** + * @since 1.0.0 + */ +export var PathReporter = { + report: fold(failure, success) +}; diff --git a/components/pexels/node_modules/io-ts/es6/Reporter.d.ts b/components/pexels/node_modules/io-ts/es6/Reporter.d.ts new file mode 100644 index 0000000000000..fee031a823925 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Reporter.d.ts @@ -0,0 +1,10 @@ +/** + * @since 1.0.0 + */ +import { Validation } from './index' +/** + * @since 1.0.0 + */ +export interface Reporter { + report: (validation: Validation) => A +} diff --git a/components/pexels/node_modules/io-ts/es6/Reporter.js b/components/pexels/node_modules/io-ts/es6/Reporter.js new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Reporter.js @@ -0,0 +1 @@ +export {}; diff --git a/components/pexels/node_modules/io-ts/es6/Schema.d.ts b/components/pexels/node_modules/io-ts/es6/Schema.d.ts new file mode 100644 index 0000000000000..17ff0c1f8bc93 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Schema.d.ts @@ -0,0 +1,35 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.0 + */ +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/es6/HKT' +import { Schemable, Schemable1, Schemable2C } from './Schemable' +/** + * @category model + * @since 2.2.0 + */ +export interface Schema { + (S: Schemable): HKT +} +/** + * @category constructors + * @since 2.2.0 + */ +export declare function make(schema: Schema): Schema +/** + * @since 2.2.0 + */ +export type TypeOf = S extends Schema ? A : never +/** + * @since 2.2.3 + */ +export declare function interpreter( + S: Schemable2C +): (schema: Schema) => Kind2 +export declare function interpreter(S: Schemable1): (schema: Schema) => Kind diff --git a/components/pexels/node_modules/io-ts/es6/Schema.js b/components/pexels/node_modules/io-ts/es6/Schema.js new file mode 100644 index 0000000000000..2e8593e161ef1 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Schema.js @@ -0,0 +1,14 @@ +import { memoize } from './Schemable'; +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.0 + */ +export function make(schema) { + return memoize(schema); +} +export function interpreter(S) { + return function (schema) { return schema(S); }; +} diff --git a/components/pexels/node_modules/io-ts/es6/Schemable.d.ts b/components/pexels/node_modules/io-ts/es6/Schemable.d.ts new file mode 100644 index 0000000000000..63e36b2d7281f --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Schemable.d.ts @@ -0,0 +1,254 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.0 + */ +import { Refinement } from 'fp-ts/es6/function' +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/es6/HKT' +/** + * @since 2.2.0 + */ +export type Literal = string | number | boolean | null +/** + * @since 2.2.3 + */ +export interface Schemable { + readonly URI: S + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => HKT + readonly string: HKT + readonly number: HKT + readonly boolean: HKT + readonly nullable: (or: HKT) => HKT + /** @deprecated */ + readonly type: (properties: { + [K in keyof A]: HKT + }) => HKT< + S, + { + [K in keyof A]: A[K] + } + > + readonly struct: (properties: { + [K in keyof A]: HKT + }) => HKT< + S, + { + [K in keyof A]: A[K] + } + > + readonly partial: (properties: { + [K in keyof A]: HKT + }) => HKT< + S, + Partial<{ + [K in keyof A]: A[K] + }> + > + readonly record: (codomain: HKT) => HKT> + readonly array: (item: HKT) => HKT> + readonly tuple: >( + ...components: { + [K in keyof A]: HKT + } + ) => HKT + readonly intersect: (right: HKT) => (left: HKT) => HKT + readonly sum: ( + tag: T + ) => (members: { + [K in keyof A]: HKT> + }) => HKT + readonly lazy: (id: string, f: () => HKT) => HKT + readonly readonly: (sa: HKT) => HKT> +} +/** + * @since 2.2.3 + */ +export interface Schemable1 { + readonly URI: S + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => Kind + readonly string: Kind + readonly number: Kind + readonly boolean: Kind + readonly nullable: (or: Kind) => Kind + /** @deprecated */ + readonly type: (properties: { + [K in keyof A]: Kind + }) => Kind< + S, + { + [K in keyof A]: A[K] + } + > + readonly struct: (properties: { + [K in keyof A]: Kind + }) => Kind< + S, + { + [K in keyof A]: A[K] + } + > + readonly partial: (properties: { + [K in keyof A]: Kind + }) => Kind< + S, + Partial<{ + [K in keyof A]: A[K] + }> + > + readonly record: (codomain: Kind) => Kind> + readonly array: (item: Kind) => Kind> + readonly tuple: >( + ...components: { + [K in keyof A]: Kind + } + ) => Kind + readonly intersect: (right: Kind) => (left: Kind) => Kind + readonly sum: ( + tag: T + ) => (members: { + [K in keyof A]: Kind> + }) => Kind + readonly lazy: (id: string, f: () => Kind) => Kind + readonly readonly: (sa: Kind) => Kind> +} +/** + * @since 2.2.8 + */ +export interface Schemable2C { + readonly URI: S + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => Kind2 + readonly string: Kind2 + readonly number: Kind2 + readonly boolean: Kind2 + readonly nullable: (or: Kind2) => Kind2 + /** @deprecated */ + readonly type: (properties: { + [K in keyof A]: Kind2 + }) => Kind2< + S, + E, + { + [K in keyof A]: A[K] + } + > + readonly struct: (properties: { + [K in keyof A]: Kind2 + }) => Kind2< + S, + E, + { + [K in keyof A]: A[K] + } + > + readonly partial: (properties: { + [K in keyof A]: Kind2 + }) => Kind2< + S, + E, + Partial<{ + [K in keyof A]: A[K] + }> + > + readonly record: (codomain: Kind2) => Kind2> + readonly array: (item: Kind2) => Kind2> + readonly tuple: >( + ...components: { + [K in keyof A]: Kind2 + } + ) => Kind2 + readonly intersect: (right: Kind2) => (left: Kind2) => Kind2 + readonly sum: ( + tag: T + ) => (members: { + [K in keyof A]: Kind2> + }) => Kind2 + readonly lazy: (id: string, f: () => Kind2) => Kind2 + readonly readonly: (sa: Kind2) => Kind2> +} +/** + * @since 2.2.3 + */ +export interface WithUnknownContainers { + readonly UnknownArray: HKT> + readonly UnknownRecord: HKT> +} +/** + * @since 2.2.3 + */ +export interface WithUnknownContainers1 { + readonly UnknownArray: Kind> + readonly UnknownRecord: Kind> +} +/** + * @since 2.2.8 + */ +export interface WithUnknownContainers2C { + readonly UnknownArray: Kind2> + readonly UnknownRecord: Kind2> +} +/** + * @since 2.2.3 + */ +export interface WithUnion { + readonly union: ]>( + ...members: { + [K in keyof A]: HKT + } + ) => HKT +} +/** + * @since 2.2.3 + */ +export interface WithUnion1 { + readonly union: ]>( + ...members: { + [K in keyof A]: Kind + } + ) => Kind +} +/** + * @since 2.2.8 + */ +export interface WithUnion2C { + readonly union: ]>( + ...members: { + [K in keyof A]: Kind2 + } + ) => Kind2 +} +/** + * @since 2.2.3 + */ +export interface WithRefine { + readonly refine: (refinement: Refinement, id: string) => (from: HKT) => HKT +} +/** + * @since 2.2.3 + */ +export interface WithRefine1 { + readonly refine: (refinement: Refinement, id: string) => (from: Kind) => Kind +} +/** + * @since 2.2.8 + */ +export interface WithRefine2C { + readonly refine: ( + refinement: Refinement, + id: string + ) => (from: Kind2) => Kind2 +} +/** + * @since 2.2.0 + */ +export declare function memoize(f: (a: A) => B): (a: A) => B diff --git a/components/pexels/node_modules/io-ts/es6/Schemable.js b/components/pexels/node_modules/io-ts/es6/Schemable.js new file mode 100644 index 0000000000000..718cd79e90617 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Schemable.js @@ -0,0 +1,31 @@ +/** + * @since 2.2.0 + */ +export function memoize(f) { + var cache = new Map(); + return function (a) { + if (!cache.has(a)) { + var b = f(a); + cache.set(a, b); + return b; + } + return cache.get(a); + }; +} +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- +var typeOf = function (x) { return (x === null ? 'null' : typeof x); }; +/** + * @internal + */ +export var intersect_ = function (a, b) { + if (a !== undefined && b !== undefined) { + var tx = typeOf(a); + var ty = typeOf(b); + if (tx === 'object' || ty === 'object') { + return Object.assign({}, a, b); + } + } + return b; +}; diff --git a/components/pexels/node_modules/io-ts/es6/TaskDecoder.d.ts b/components/pexels/node_modules/io-ts/es6/TaskDecoder.d.ts new file mode 100644 index 0000000000000..a280dd4ede9b9 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/TaskDecoder.d.ts @@ -0,0 +1,349 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Alt2 } from 'fp-ts/es6/Alt' +import { Category2 } from 'fp-ts/es6/Category' +import { Refinement } from 'fp-ts/es6/function' +import { Functor2 } from 'fp-ts/es6/Functor' +import * as TE from 'fp-ts/es6/TaskEither' +import * as D from './Decoder' +import * as G from './Guard' +import * as K from './Kleisli' +import * as S from './Schemable' +/** + * @category model + * @since 2.2.8 + */ +export interface TaskDecoder extends K.Kleisli {} +/** + * @category DecodeError + * @since 2.2.7 + */ +export type DecodeError = D.DecodeError +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const error: (actual: unknown, message: string) => DecodeError +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const success: (a: A) => TE.TaskEither +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const failure: (actual: unknown, message: string) => TE.TaskEither +/** + * @category constructors + * @since 2.2.7 + */ +export declare const fromDecoder: (decoder: D.Decoder) => TaskDecoder +/** + * @category constructors + * @since 2.2.8 + */ +export declare const fromRefinement: ( + refinement: Refinement, + expected: string +) => TaskDecoder +/** + * @category constructors + * @since 2.2.7 + */ +export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder +/** + * @category constructors + * @since 2.2.7 + */ +export declare const literal: ], L extends S.Literal = S.Literal>( + ...values: A +) => TaskDecoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const string: TaskDecoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const number: TaskDecoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const boolean: TaskDecoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const UnknownArray: TaskDecoder> +/** + * @category primitives + * @since 2.2.7 + */ +export declare const UnknownRecord: TaskDecoder> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const mapLeftWithInput: ( + f: (input: I, e: DecodeError) => DecodeError +) => (decoder: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.9 + */ +export declare const withMessage: ( + message: (input: I, e: DecodeError) => string +) => (decoder: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const refine: ( + refinement: Refinement, + id: string +) => (from: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const parse: ( + parser: (a: A) => TE.TaskEither +) => (from: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const nullable: (or: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.15 + */ +export declare const fromStruct:

>>( + properties: P +) => TaskDecoder< + { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, + { [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> } +> +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +export declare const fromType:

>>( + properties: P +) => TaskDecoder< + { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, + { [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> } +> +/** + * @category combinators + * @since 2.2.15 + */ +export declare const struct: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export declare const type: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromPartial:

>>( + properties: P +) => TaskDecoder< + Partial<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }>, + Partial<{ [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> }> +> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const partial: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< + unknown, + Partial<{ [K_1 in keyof A]: A[K_1] }> +> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromArray: (item: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const array: (item: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromRecord: ( + codomain: TaskDecoder +) => TaskDecoder, Record> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const record: (codomain: TaskDecoder) => TaskDecoder> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromTuple: []>( + ...components: C +) => TaskDecoder< + { [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, + { [K_1 in keyof C]: K.TypeOf<'TaskEither', C[K_1]> } +> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const tuple: ( + ...components: { [K in keyof A]: TaskDecoder } +) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const union: , ...Array>]>( + ...members: MS +) => TaskDecoder, TypeOf> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const intersect: ( + right: TaskDecoder +) => (left: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromSum: ( + tag: T +) => >>( + members: MS +) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: TaskDecoder> }) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.15 + */ +export declare const readonly: (decoder: TaskDecoder) => TaskDecoder> +/** + * @category Functor + * @since 2.2.7 + */ +export declare const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder +/** + * @category Alt + * @since 2.2.7 + */ +export declare const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder +/** + * @category Semigroupoid + * @since 2.2.8 + */ +export declare const compose: (to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder +/** + * @category Category + * @since 2.2.8 + */ +export declare const id: () => TaskDecoder +/** + * @category instances + * @since 2.2.7 + */ +export declare const URI = 'io-ts/TaskDecoder' +/** + * @category instances + * @since 2.2.7 + */ +export type URI = typeof URI +declare module 'fp-ts/es6/HKT' { + interface URItoKind2 { + readonly [URI]: TaskDecoder + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Functor: Functor2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Alt: Alt2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Category: Category2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Schemable: S.Schemable2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnknownContainers: S.WithUnknownContainers2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnion: S.WithUnion2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithRefine: S.WithRefine2C +/** + * @since 2.2.7 + */ +export type TypeOf = K.TypeOf +/** + * @since 2.2.8 + */ +export type InputOf = K.InputOf +/** + * @since 2.2.7 + */ +export declare const draw: (e: DecodeError) => string diff --git a/components/pexels/node_modules/io-ts/es6/TaskDecoder.js b/components/pexels/node_modules/io-ts/es6/TaskDecoder.js new file mode 100644 index 0000000000000..c77508649bd7a --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/TaskDecoder.js @@ -0,0 +1,413 @@ +import * as E from 'fp-ts/es6/Either'; +import { identity } from 'fp-ts/es6/function'; +import { pipe } from 'fp-ts/es6/pipeable'; +import * as T from 'fp-ts/es6/Task'; +import * as TE from 'fp-ts/es6/TaskEither'; +import * as DE from './DecodeError'; +import * as D from './Decoder'; +import * as FS from './FreeSemigroup'; +import * as K from './Kleisli'; +// ------------------------------------------------------------------------------------- +// Kleisli config +// ------------------------------------------------------------------------------------- +var M = { + URI: TE.URI, + _E: undefined, + map: function (fa, f) { return pipe(fa, TE.map(f)); }, + ap: function (fab, fa) { + return pipe(pipe(fab, T.map(function (h) { return function (ga) { return D.ap(h, ga); }; })), T.ap(fa)); + }, + of: TE.right, + chain: function (ma, f) { return pipe(ma, TE.chain(f)); }, + throwError: TE.left, + bimap: function (fa, f, g) { return pipe(fa, TE.bimap(f, g)); }, + mapLeft: function (fa, f) { return pipe(fa, TE.mapLeft(f)); }, + alt: function (me, that) { + return pipe(me, T.chain(function (e1) { + return E.isRight(e1) + ? T.of(e1) + : pipe(that(), T.map(function (e2) { return (E.isLeft(e2) ? E.left(D.SE.concat(e1.left, e2.left)) : e2); })); + })); + } +}; +/** + * @category DecodeError + * @since 2.2.7 + */ +export var error = D.error; +/** + * @category DecodeError + * @since 2.2.7 + */ +export var success = TE.right; +/** + * @category DecodeError + * @since 2.2.7 + */ +export var failure = function (actual, message) { + return TE.left(D.error(actual, message)); +}; +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.7 + */ +export var fromDecoder = function (decoder) { return ({ + decode: TE.fromEitherK(decoder.decode) +}); }; +/** + * @category constructors + * @since 2.2.8 + */ +export var fromRefinement = function (refinement, expected) { + return fromDecoder(D.fromRefinement(refinement, expected)); +}; +/** + * @category constructors + * @since 2.2.7 + */ +export var fromGuard = function (guard, expected) { + return fromRefinement(guard.is, expected); +}; +/** + * @category constructors + * @since 2.2.7 + */ +export var literal = +/*#__PURE__*/ +K.literal(M)(function (u, values) { return error(u, values.map(function (value) { return JSON.stringify(value); }).join(' | ')); }); +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.7 + */ +export var string = +/*#__PURE__*/ +fromDecoder(D.string); +/** + * @category primitives + * @since 2.2.7 + */ +export var number = +/*#__PURE__*/ +fromDecoder(D.number); +/** + * @category primitives + * @since 2.2.7 + */ +export var boolean = +/*#__PURE__*/ +fromDecoder(D.boolean); +/** + * @category primitives + * @since 2.2.7 + */ +export var UnknownArray = +/*#__PURE__*/ +fromDecoder(D.UnknownArray); +/** + * @category primitives + * @since 2.2.7 + */ +export var UnknownRecord = +/*#__PURE__*/ +fromDecoder(D.UnknownRecord); +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +export var mapLeftWithInput = +/*#__PURE__*/ +K.mapLeftWithInput(M); +/** + * @category combinators + * @since 2.2.9 + */ +export var withMessage = function (message) { + return mapLeftWithInput(function (input, e) { return FS.of(DE.wrap(message(input, e), e)); }); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var refine = function (refinement, id) { return K.refine(M)(refinement, function (a) { return error(a, id); }); }; +/** + * @category combinators + * @since 2.2.7 + */ +export var parse = +/*#__PURE__*/ +K.parse(M); +/** + * @category combinators + * @since 2.2.7 + */ +export var nullable = +/*#__PURE__*/ +K.nullable(M)(function (u, e) { return FS.concat(FS.of(DE.member(0, error(u, 'null'))), FS.of(DE.member(1, e))); }); +/** + * @category combinators + * @since 2.2.15 + */ +export var fromStruct = function (properties) { + return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); +}; +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +export var fromType = fromStruct; +/** + * @category combinators + * @since 2.2.15 + */ +export var struct = function (properties) { return pipe(UnknownRecord, compose(fromStruct(properties))); }; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export var type = struct; +/** + * @category combinators + * @since 2.2.8 + */ +export var fromPartial = function (properties) { + return K.fromPartial(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(properties); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var partial = function (properties) { return pipe(UnknownRecord, compose(fromPartial(properties))); }; +/** + * @category combinators + * @since 2.2.8 + */ +export var fromArray = function (item) { + return K.fromArray(M)(function (i, e) { return FS.of(DE.index(i, DE.optional, e)); })(item); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var array = function (item) { + return pipe(UnknownArray, compose(fromArray(item))); +}; +/** + * @category combinators + * @since 2.2.8 + */ +export var fromRecord = function (codomain) { + return K.fromRecord(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(codomain); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var record = function (codomain) { + return pipe(UnknownRecord, compose(fromRecord(codomain))); +}; +/** + * @category combinators + * @since 2.2.8 + */ +export var fromTuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return K.fromTuple(M)(function (i, e) { return FS.of(DE.index(i, DE.required, e)); }).apply(void 0, components); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var tuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return pipe(UnknownArray, compose(fromTuple.apply(void 0, components))); +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var union = +/*#__PURE__*/ +K.union(M)(function (i, e) { return FS.of(DE.member(i, e)); }); +/** + * @category combinators + * @since 2.2.7 + */ +export var intersect = +/*#__PURE__*/ +K.intersect(M); +/** + * @category combinators + * @since 2.2.8 + */ +export var fromSum = function (tag) { + return function (members) { + return K.fromSum(M)(function (tag, value, keys) { + return FS.of(DE.key(tag, DE.required, error(value, keys.length === 0 ? 'never' : keys.map(function (k) { return JSON.stringify(k); }).join(' | ')))); + })(tag)(members); + }; +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var sum = function (tag) { + return function (members) { + return pipe(UnknownRecord, compose(fromSum(tag)(members))); + }; +}; +/** + * @category combinators + * @since 2.2.7 + */ +export var lazy = +/*#__PURE__*/ +K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); +/** + * @category combinators + * @since 2.2.15 + */ +export var readonly = identity; +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- +var map_ = function (fa, f) { return pipe(fa, map(f)); }; +var alt_ = function (me, that) { return pipe(me, alt(that)); }; +var compose_ = function (ab, la) { return pipe(la, compose(ab)); }; +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- +/** + * @category Functor + * @since 2.2.7 + */ +export var map = +/*#__PURE__*/ +K.map(M); +/** + * @category Alt + * @since 2.2.7 + */ +export var alt = +/*#__PURE__*/ +K.alt(M); +/** + * @category Semigroupoid + * @since 2.2.8 + */ +export var compose = +/*#__PURE__*/ +K.compose(M); +/** + * @category Category + * @since 2.2.8 + */ +export var id = +/*#__PURE__*/ +K.id(M); +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.7 + */ +export var URI = 'io-ts/TaskDecoder'; +/** + * @category instances + * @since 2.2.8 + */ +export var Functor = { + URI: URI, + map: map_ +}; +/** + * @category instances + * @since 2.2.8 + */ +export var Alt = { + URI: URI, + map: map_, + alt: alt_ +}; +/** + * @category instances + * @since 2.2.8 + */ +export var Category = { + URI: URI, + compose: compose_, + id: id +}; +/** + * @category instances + * @since 2.2.8 + */ +export var Schemable = { + URI: URI, + literal: literal, + string: string, + number: number, + boolean: boolean, + nullable: nullable, + type: type, + struct: struct, + partial: partial, + record: record, + array: array, + tuple: tuple, + intersect: intersect, + sum: sum, + lazy: lazy, + readonly: readonly +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithUnknownContainers = { + UnknownArray: UnknownArray, + UnknownRecord: UnknownRecord +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithUnion = { + union: union +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithRefine = { + refine: refine +}; +/** + * @since 2.2.7 + */ +export var draw = D.draw; +/** + * @internal + */ +export var stringify = TE.fold(function (e) { return T.of(draw(e)); }, function (a) { return T.of(JSON.stringify(a, null, 2)); }); diff --git a/components/pexels/node_modules/io-ts/es6/ThrowReporter.d.ts b/components/pexels/node_modules/io-ts/es6/ThrowReporter.d.ts new file mode 100644 index 0000000000000..d759e80da0b13 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/ThrowReporter.d.ts @@ -0,0 +1,7 @@ +import { Reporter } from './Reporter' +/** + * @category deprecated + * @since 1.0.0 + * @deprecated + */ +export declare const ThrowReporter: Reporter diff --git a/components/pexels/node_modules/io-ts/es6/ThrowReporter.js b/components/pexels/node_modules/io-ts/es6/ThrowReporter.js new file mode 100644 index 0000000000000..8d276a948e0c8 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/ThrowReporter.js @@ -0,0 +1,18 @@ +/** + * @deprecated + * @since 1.0.0 + */ +import { isLeft } from 'fp-ts/es6/Either'; +import { PathReporter } from './PathReporter'; +/** + * @category deprecated + * @since 1.0.0 + * @deprecated + */ +export var ThrowReporter = { + report: function (validation) { + if (isLeft(validation)) { + throw new Error(PathReporter.report(validation).join('\n')); + } + } +}; diff --git a/components/pexels/node_modules/io-ts/es6/Type.d.ts b/components/pexels/node_modules/io-ts/es6/Type.d.ts new file mode 100644 index 0000000000000..83c548bfccded --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Type.d.ts @@ -0,0 +1,149 @@ +import { Refinement } from 'fp-ts/es6/function' +import * as t from './index' +import * as S from './Schemable' +/** + * @category model + * @since 2.2.3 + */ +export interface Type extends t.Type {} +/** + * @category constructors + * @since 2.2.3 + */ +export declare const literal: ( + ...values: A +) => Type +/** + * @category primitives + * @since 2.2.3 + */ +export declare const string: Type +/** + * @category primitives + * @since 2.2.3 + */ +export declare const number: Type +/** + * @category primitives + * @since 2.2.3 + */ +export declare const boolean: Type +/** + * @category primitives + * @since 2.2.3 + */ +export declare const UnknownArray: Type> +/** + * @category primitives + * @since 2.2.3 + */ +export declare const UnknownRecord: Type> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const refine: (refinement: Refinement, id: string) => (from: Type) => Type +/** + * @category combinators + * @since 2.2.3 + */ +export declare const nullable: (or: Type) => Type +/** + * @category combinators + * @since 2.2.15 + */ +export declare const struct: (properties: { [K in keyof A]: Type }) => Type<{ [K_1 in keyof A]: A[K_1] }> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export declare const type: (properties: { [K in keyof A]: Type }) => Type<{ [K_1 in keyof A]: A[K_1] }> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const partial: (properties: { [K in keyof A]: Type }) => Type< + Partial<{ [K_1 in keyof A]: A[K_1] }> +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const record: (codomain: Type) => Type> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const array: (item: Type) => Type +/** + * @category combinators + * @since 2.2.3 + */ +export declare const tuple: (...components: { [K in keyof A]: Type }) => Type +/** + * @category combinators + * @since 2.2.3 + */ +export declare const intersect: (right: Type) => (left: Type) => Type +/** + * @category combinators + * @since 2.2.3 + */ +export declare const lazy: (id: string, f: () => Type) => Type +/** + * @category combinators + * @since 2.2.15 + */ +export declare const readonly: (type: Type) => Type> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const sum: ( + _tag: T +) => (members: { [K in keyof A]: Type> }) => Type +/** + * @category combinators + * @since 2.2.3 + */ +export declare const union: ( + ...members: { [K in keyof A]: Type } +) => Type +/** + * @category instances + * @since 2.2.3 + */ +export declare const URI = 'io-ts/Type' +/** + * @category instances + * @since 2.2.3 + */ +export type URI = typeof URI +declare module 'fp-ts/es6/HKT' { + interface URItoKind { + readonly [URI]: Type + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Schemable: S.Schemable1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnknownContainers: S.WithUnknownContainers1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnion: S.WithUnion1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithRefine: S.WithRefine1 diff --git a/components/pexels/node_modules/io-ts/es6/Type.js b/components/pexels/node_modules/io-ts/es6/Type.js new file mode 100644 index 0000000000000..24e72a3df7224 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Type.js @@ -0,0 +1,210 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.3 + */ +import * as E from 'fp-ts/es6/Either'; +import { identity } from 'fp-ts/es6/function'; +import { pipe } from 'fp-ts/es6/pipeable'; +import * as t from './index'; +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.3 + */ +export var literal = function () { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return t.union(values.map(function (v) { return t.literal(v); })); +}; +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.3 + */ +export var string = t.string; +/** + * @category primitives + * @since 2.2.3 + */ +export var number = new t.Type(t.number.name, t.number.is, function (u, c) { + return pipe(t.number.decode(u), E.chain(function (n) { return (isNaN(n) ? t.failure(u, c) : t.success(n)); })); +}, t.number.encode); +/** + * @category primitives + * @since 2.2.3 + */ +export var boolean = t.boolean; +/** + * @category primitives + * @since 2.2.3 + */ +export var UnknownArray = t.UnknownArray; +/** + * @category primitives + * @since 2.2.3 + */ +export var UnknownRecord = t.UnknownRecord; +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.3 + */ +export var refine = function (refinement, id) { + return function (from) { + // tslint:disable-next-line: deprecation + return (t.refinement(from, refinement, id)); + }; +}; +/** + * @category combinators + * @since 2.2.3 + */ +export var nullable = function (or) { return t.union([t.null, or]); }; +/** + * @category combinators + * @since 2.2.15 + */ +export var struct = function (properties) { + return t.type(properties); +}; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export var type = struct; +/** + * @category combinators + * @since 2.2.3 + */ +export var partial = function (properties) { + return t.partial(properties); +}; +/** + * @category combinators + * @since 2.2.3 + */ +export var record = function (codomain) { return t.record(t.string, codomain); }; +/** + * @category combinators + * @since 2.2.3 + */ +export var array = function (item) { return t.array(item); }; +/** + * @category combinators + * @since 2.2.3 + */ +export var tuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return t.tuple(components); +}; +/** + * @category combinators + * @since 2.2.3 + */ +export var intersect = function (right) { + return function (left) { + return t.intersection([left, right]); + }; +}; +/** + * @category combinators + * @since 2.2.3 + */ +export var lazy = function (id, f) { return t.recursion(id, f); }; +/** + * @category combinators + * @since 2.2.15 + */ +export var readonly = identity; +/** + * @category combinators + * @since 2.2.3 + */ +export var sum = function (_tag) { + return function (members) { + return t.union(Object.values(members)); + }; +}; +/** + * @category combinators + * @since 2.2.3 + */ +export var union = function () { + var members = []; + for (var _i = 0; _i < arguments.length; _i++) { + members[_i] = arguments[_i]; + } + return t.union(members); +}; +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.3 + */ +export var URI = 'io-ts/Type'; +/** + * @category instances + * @since 2.2.8 + */ +export var Schemable = { + URI: URI, + literal: literal, + string: string, + number: number, + boolean: boolean, + nullable: nullable, + type: type, + struct: struct, + partial: partial, + record: record, + array: array, + tuple: tuple, + intersect: intersect, + sum: sum, + lazy: lazy, + readonly: readonly +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithUnknownContainers = { + UnknownArray: UnknownArray, + UnknownRecord: UnknownRecord +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithUnion = { + union: union +}; +/** + * @category instances + * @since 2.2.8 + */ +export var WithRefine = { + refine: refine +}; diff --git a/components/pexels/node_modules/io-ts/es6/index.d.ts b/components/pexels/node_modules/io-ts/es6/index.d.ts new file mode 100644 index 0000000000000..bc25e2aad4d11 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/index.d.ts @@ -0,0 +1,1374 @@ +/** + * @since 1.0.0 + */ +import { Either } from 'fp-ts/es6/Either' +import { Predicate, Refinement } from 'fp-ts/es6/function' +/** + * @category Decode error + * @since 1.0.0 + */ +export interface ContextEntry { + readonly key: string + readonly type: Decoder + /** the input data */ + readonly actual?: unknown +} +/** + * @category Decode error + * @since 1.0.0 + */ +export interface Context extends ReadonlyArray {} +/** + * @category Decode error + * @since 1.0.0 + */ +export interface ValidationError { + /** the offending (sub)value */ + readonly value: unknown + /** where the error originated */ + readonly context: Context + /** optional custom error message */ + readonly message?: string +} +/** + * @category Decode error + * @since 1.0.0 + */ +export interface Errors extends Array {} +/** + * @category Decode error + * @since 1.0.0 + */ +export type Validation = Either +/** + * @category Decode error + * @since 1.0.0 + */ +export declare const failures: (errors: Errors) => Validation +/** + * @category Decode error + * @since 1.0.0 + */ +export declare const failure: (value: unknown, context: Context, message?: string) => Validation +/** + * @category Decode error + * @since 1.0.0 + */ +export declare const success: (value: T) => Validation +/** + * @since 1.0.0 + */ +export type Is = (u: unknown) => u is A +/** + * @since 1.0.0 + */ +export type Validate = (i: I, context: Context) => Validation +/** + * @since 1.0.0 + */ +export type Decode = (i: I) => Validation +/** + * @since 1.0.0 + */ +export type Encode = (a: A) => O +/** + * @since 1.0.0 + */ +export interface Any extends Type {} +/** + * @since 1.0.0 + */ +export interface Mixed extends Type {} +/** + * @category Codec + * @since 1.0.0 + */ +export type TypeOf = C['_A'] +/** + * @category Codec + * @since 1.0.0 + */ +export type InputOf = C['_I'] +/** + * @category Codec + * @since 1.0.0 + */ +export type OutputOf = C['_O'] +/** + * @category Codec + * @since 1.0.0 + */ +export interface Decoder { + readonly name: string + readonly validate: Validate + readonly decode: Decode +} +/** + * @category Codec + * @since 1.0.0 + */ +export interface Encoder { + readonly encode: Encode +} +/** + * @category Codec + * @since 1.0.0 + */ +export declare class Type implements Decoder, Encoder { + /** a unique name for this codec */ + readonly name: string + /** a custom type guard */ + readonly is: Is + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: Validate + /** converts a value of type A to a value of type O */ + readonly encode: Encode + /** + * @since 1.0.0 + */ + readonly _A: A + /** + * @since 1.0.0 + */ + readonly _O: O + /** + * @since 1.0.0 + */ + readonly _I: I + constructor( + /** a unique name for this codec */ + name: string, + /** a custom type guard */ + is: Is, + /** succeeds if a value of type I can be decoded to a value of type A */ + validate: Validate, + /** converts a value of type A to a value of type O */ + encode: Encode + ) + /** + * @since 1.0.0 + */ + pipe(this: Type, ab: Type, name?: string): Type + /** + * @since 1.0.0 + */ + asDecoder(): Decoder + /** + * @since 1.0.0 + */ + asEncoder(): Encoder + /** + * a version of `validate` with a default context + * @since 1.0.0 + */ + decode(i: I): Validation +} +/** + * @since 1.0.0 + */ +export declare const identity: (a: A) => A +/** + * @since 1.0.0 + */ +export declare function getFunctionName(f: Function): string +/** + * @since 1.0.0 + */ +export declare function getContextEntry(key: string, decoder: Decoder): ContextEntry +/** + * @since 1.0.0 + */ +export declare function appendContext(c: Context, key: string, decoder: Decoder, actual?: unknown): Context +/** + * @since 1.0.0 + */ +export interface AnyProps { + [key: string]: Any +} +/** + * @since 1.0.0 + */ +export type TypeOfProps

= { + [K in keyof P]: TypeOf +} +/** + * @since 1.0.0 + */ +export type OutputOfProps

= { + [K in keyof P]: OutputOf +} +/** + * @since 1.0.0 + */ +export interface Props { + [key: string]: Mixed +} +/** + * @since 1.0.0 + */ +export type TypeOfPartialProps

= { + [K in keyof P]?: TypeOf +} +/** + * @since 1.0.0 + */ +export type OutputOfPartialProps

= { + [K in keyof P]?: OutputOf +} +/** + * @since 1.0.0 + */ +export type TypeOfDictionary = { + [K in TypeOf]: TypeOf +} +/** + * @since 1.0.0 + */ +export type OutputOfDictionary = { + [K in OutputOf]: OutputOf +} +/** + * @since 1.1.0 + */ +export interface HasPropsRefinement extends RefinementType {} +/** + * @since 1.1.0 + */ +export interface HasPropsReadonly extends ReadonlyType {} +/** + * @since 1.1.0 + */ +export interface HasPropsIntersection extends IntersectionType, any, any, any> {} +/** + * @since 1.1.0 + */ +export type HasProps = + | HasPropsRefinement + | HasPropsReadonly + | HasPropsIntersection + | InterfaceType + | StrictType + | PartialType +/** + * @since 1.0.0 + */ +export declare class NullType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'NullType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface NullC extends NullType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const nullType: NullC +/** + * @since 1.0.0 + */ +export declare class UndefinedType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'UndefinedType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface UndefinedC extends UndefinedType {} +declare const undefinedType: UndefinedC +/** + * @since 1.2.0 + */ +export declare class VoidType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'VoidType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface VoidC extends VoidType {} +/** + * @category primitives + * @since 1.2.0 + */ +export declare const voidType: VoidC +/** + * @since 1.5.0 + */ +export declare class UnknownType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'UnknownType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface UnknownC extends UnknownType {} +/** + * @category primitives + * @since 1.5.0 + */ +export declare const unknown: UnknownC +/** + * @since 1.0.0 + */ +export declare class StringType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'StringType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface StringC extends StringType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const string: StringC +/** + * @since 1.0.0 + */ +export declare class NumberType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'NumberType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface NumberC extends NumberType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const number: NumberC +/** + * @since 2.1.0 + */ +export declare class BigIntType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'BigIntType' + constructor() +} +/** + * @since 2.1.0 + */ +export interface BigIntC extends BigIntType {} +/** + * @category primitives + * @since 2.1.0 + */ +export declare const bigint: BigIntC +/** + * @since 1.0.0 + */ +export declare class BooleanType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'BooleanType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface BooleanC extends BooleanType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const boolean: BooleanC +/** + * @since 1.0.0 + */ +export declare class AnyArrayType extends Type> { + /** + * @since 1.0.0 + */ + readonly _tag: 'AnyArrayType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface UnknownArrayC extends AnyArrayType {} +/** + * @category primitives + * @since 1.7.1 + */ +export declare const UnknownArray: UnknownArrayC +/** + * @since 1.0.0 + */ +export declare class AnyDictionaryType extends Type<{ + [key: string]: unknown +}> { + /** + * @since 1.0.0 + */ + readonly _tag: 'AnyDictionaryType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface UnknownRecordC extends AnyDictionaryType {} +/** + * @category primitives + * @since 1.7.1 + */ +export declare const UnknownRecord: UnknownRecordC +export { + /** + * @category primitives + * @since 1.0.0 + */ + nullType as null, + /** + * @category primitives + * @since 1.0.0 + */ + undefinedType as undefined, + /** + * @category primitives + * @since 1.0.0 + */ + voidType as void +} +type LiteralValue = string | number | boolean +/** + * @since 1.0.0 + */ +export declare class LiteralType extends Type { + readonly value: V + /** + * @since 1.0.0 + */ + readonly _tag: 'LiteralType' + constructor( + name: string, + is: LiteralType['is'], + validate: LiteralType['validate'], + encode: LiteralType['encode'], + value: V + ) +} +/** + * @since 1.5.3 + */ +export interface LiteralC extends LiteralType {} +/** + * @category constructors + * @since 1.0.0 + */ +export declare function literal(value: V, name?: string): LiteralC +/** + * @since 1.0.0 + */ +export declare class KeyofType< + D extends { + [key: string]: unknown + } +> extends Type { + readonly keys: D + /** + * @since 1.0.0 + */ + readonly _tag: 'KeyofType' + constructor( + name: string, + is: KeyofType['is'], + validate: KeyofType['validate'], + encode: KeyofType['encode'], + keys: D + ) +} +/** + * @since 1.5.3 + */ +export interface KeyofC< + D extends { + [key: string]: unknown + } +> extends KeyofType {} +/** + * @category constructors + * @since 1.0.0 + */ +export declare function keyof< + D extends { + [key: string]: unknown + } +>(keys: D, name?: string): KeyofC +/** + * @since 1.0.0 + */ +export declare class RefinementType extends Type { + readonly type: C + readonly predicate: Predicate + /** + * @since 1.0.0 + */ + readonly _tag: 'RefinementType' + constructor( + name: string, + is: RefinementType['is'], + validate: RefinementType['validate'], + encode: RefinementType['encode'], + type: C, + predicate: Predicate + ) +} +declare const _brand: unique symbol +/** + * @since 1.8.1 + */ +export interface Brand { + readonly [_brand]: B +} +/** + * @since 1.8.1 + */ +export type Branded = A & Brand +/** + * @since 1.8.1 + */ +export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} +/** + * @category combinators + * @since 1.8.1 + */ +export declare function brand< + C extends Any, + N extends string, + B extends { + readonly [K in N]: symbol + } +>(codec: C, predicate: Refinement, Branded, B>>, name: N): BrandC +/** + * @since 1.8.1 + */ +export interface IntBrand { + readonly Int: unique symbol +} +/** + * A branded codec representing an integer + * + * @category primitives + * @since 1.8.1 + */ +export declare const Int: BrandC +/** + * @since 1.8.1 + */ +export type Int = Branded +/** + * @since 1.0.0 + */ +export declare class RecursiveType extends Type { + runDefinition: () => C + /** + * @since 1.0.0 + */ + readonly _tag: 'RecursiveType' + constructor( + name: string, + is: RecursiveType['is'], + validate: RecursiveType['validate'], + encode: RecursiveType['encode'], + runDefinition: () => C + ) + /** + * @since 1.0.0 + */ + readonly type: C +} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function recursion = Type>( + name: string, + definition: (self: C) => C +): RecursiveType +/** + * @since 1.0.0 + */ +export declare class ArrayType extends Type { + readonly type: C + /** + * @since 1.0.0 + */ + readonly _tag: 'ArrayType' + constructor( + name: string, + is: ArrayType['is'], + validate: ArrayType['validate'], + encode: ArrayType['encode'], + type: C + ) +} +/** + * @since 1.5.3 + */ +export interface ArrayC extends ArrayType>, Array>, unknown> {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function array(item: C, name?: string): ArrayC +/** + * @since 1.0.0 + */ +export declare class InterfaceType extends Type { + readonly props: P + /** + * @since 1.0.0 + */ + readonly _tag: 'InterfaceType' + constructor( + name: string, + is: InterfaceType['is'], + validate: InterfaceType['validate'], + encode: InterfaceType['encode'], + props: P + ) +} +/** + * @since 1.5.3 + */ +export interface TypeC

+ extends InterfaceType< + P, + { + [K in keyof P]: TypeOf + }, + { + [K in keyof P]: OutputOf + }, + unknown + > {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function type

(props: P, name?: string): TypeC

+/** + * @since 1.0.0 + */ +export declare class PartialType extends Type { + readonly props: P + /** + * @since 1.0.0 + */ + readonly _tag: 'PartialType' + constructor( + name: string, + is: PartialType['is'], + validate: PartialType['validate'], + encode: PartialType['encode'], + props: P + ) +} +/** + * @since 1.5.3 + */ +export interface PartialC

+ extends PartialType< + P, + { + [K in keyof P]?: TypeOf + }, + { + [K in keyof P]?: OutputOf + }, + unknown + > {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function partial

(props: P, name?: string): PartialC

+/** + * @since 1.0.0 + */ +export declare class DictionaryType extends Type { + readonly domain: D + readonly codomain: C + /** + * @since 1.0.0 + */ + readonly _tag: 'DictionaryType' + constructor( + name: string, + is: DictionaryType['is'], + validate: DictionaryType['validate'], + encode: DictionaryType['encode'], + domain: D, + codomain: C + ) +} +/** + * @since 1.5.3 + */ +export interface RecordC + extends DictionaryType< + D, + C, + { + [K in TypeOf]: TypeOf + }, + { + [K in OutputOf]: OutputOf + }, + unknown + > {} +/** + * @category combinators + * @since 1.7.1 + */ +export declare function record(domain: D, codomain: C, name?: string): RecordC +/** + * @since 1.0.0 + */ +export declare class UnionType, A = any, O = A, I = unknown> extends Type { + readonly types: CS + /** + * @since 1.0.0 + */ + readonly _tag: 'UnionType' + constructor( + name: string, + is: UnionType['is'], + validate: UnionType['validate'], + encode: UnionType['encode'], + types: CS + ) +} +/** + * @since 1.5.3 + */ +export interface UnionC]> + extends UnionType, OutputOf, unknown> {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function union]>(codecs: CS, name?: string): UnionC +/** + * @since 1.0.0 + */ +export declare class IntersectionType, A = any, O = A, I = unknown> extends Type { + readonly types: CS + /** + * @since 1.0.0 + */ + readonly _tag: 'IntersectionType' + constructor( + name: string, + is: IntersectionType['is'], + validate: IntersectionType['validate'], + encode: IntersectionType['encode'], + types: CS + ) +} +/** + * @since 1.5.3 + */ +export interface IntersectionC]> + extends IntersectionType< + CS, + CS extends { + length: 2 + } + ? TypeOf & TypeOf + : CS extends { + length: 3 + } + ? TypeOf & TypeOf & TypeOf + : CS extends { + length: 4 + } + ? TypeOf & TypeOf & TypeOf & TypeOf + : CS extends { + length: 5 + } + ? TypeOf & TypeOf & TypeOf & TypeOf & TypeOf + : unknown, + CS extends { + length: 2 + } + ? OutputOf & OutputOf + : CS extends { + length: 3 + } + ? OutputOf & OutputOf & OutputOf + : CS extends { + length: 4 + } + ? OutputOf & OutputOf & OutputOf & OutputOf + : CS extends { + length: 5 + } + ? OutputOf & OutputOf & OutputOf & OutputOf & OutputOf + : unknown, + unknown + > {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function intersection< + A extends Mixed, + B extends Mixed, + C extends Mixed, + D extends Mixed, + E extends Mixed +>(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> +export declare function intersection( + codecs: [A, B, C, D], + name?: string +): IntersectionC<[A, B, C, D]> +export declare function intersection( + codecs: [A, B, C], + name?: string +): IntersectionC<[A, B, C]> +export declare function intersection( + codecs: [A, B], + name?: string +): IntersectionC<[A, B]> +/** + * @since 1.0.0 + */ +export declare class TupleType, A = any, O = A, I = unknown> extends Type { + readonly types: CS + /** + * @since 1.0.0 + */ + readonly _tag: 'TupleType' + constructor( + name: string, + is: TupleType['is'], + validate: TupleType['validate'], + encode: TupleType['encode'], + types: CS + ) +} +/** + * @since 1.5.3 + */ +export interface TupleC]> + extends TupleType< + CS, + CS extends { + length: 1 + } + ? [TypeOf] + : CS extends { + length: 2 + } + ? [TypeOf, TypeOf] + : CS extends { + length: 3 + } + ? [TypeOf, TypeOf, TypeOf] + : CS extends { + length: 4 + } + ? [TypeOf, TypeOf, TypeOf, TypeOf] + : CS extends { + length: 5 + } + ? [TypeOf, TypeOf, TypeOf, TypeOf, TypeOf] + : unknown, + CS extends { + length: 1 + } + ? [OutputOf] + : CS extends { + length: 2 + } + ? [OutputOf, OutputOf] + : CS extends { + length: 3 + } + ? [OutputOf, OutputOf, OutputOf] + : CS extends { + length: 4 + } + ? [OutputOf, OutputOf, OutputOf, OutputOf] + : CS extends { + length: 5 + } + ? [OutputOf, OutputOf, OutputOf, OutputOf, OutputOf] + : unknown, + unknown + > {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function tuple( + codecs: [A, B, C, D, E], + name?: string +): TupleC<[A, B, C, D, E]> +export declare function tuple( + codecs: [A, B, C, D], + name?: string +): TupleC<[A, B, C, D]> +export declare function tuple( + codecs: [A, B, C], + name?: string +): TupleC<[A, B, C]> +export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> +export declare function tuple(codecs: [A], name?: string): TupleC<[A]> +/** + * @since 1.0.0 + */ +export declare class ReadonlyType extends Type { + readonly type: C + /** + * @since 1.0.0 + */ + readonly _tag: 'ReadonlyType' + constructor( + name: string, + is: ReadonlyType['is'], + validate: ReadonlyType['validate'], + encode: ReadonlyType['encode'], + type: C + ) +} +/** + * @since 1.5.3 + */ +export interface ReadonlyC + extends ReadonlyType>, Readonly>, unknown> {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function readonly(codec: C, name?: string): ReadonlyC +/** + * @since 1.0.0 + */ +export declare class ReadonlyArrayType extends Type { + readonly type: C + /** + * @since 1.0.0 + */ + readonly _tag: 'ReadonlyArrayType' + constructor( + name: string, + is: ReadonlyArrayType['is'], + validate: ReadonlyArrayType['validate'], + encode: ReadonlyArrayType['encode'], + type: C + ) +} +/** + * @since 1.5.3 + */ +export interface ReadonlyArrayC + extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function readonlyArray(item: C, name?: string): ReadonlyArrayC +/** + * Strips additional properties, equivalent to `exact(type(props))`. + * + * @category combinators + * @since 1.0.0 + */ +export declare const strict:

(props: P, name?: string) => ExactC> +/** + * @since 1.1.0 + */ +export declare class ExactType extends Type { + readonly type: C + /** + * @since 1.0.0 + */ + readonly _tag: 'ExactType' + constructor( + name: string, + is: ExactType['is'], + validate: ExactType['validate'], + encode: ExactType['encode'], + type: C + ) +} +/** + * @since 1.5.3 + */ +export interface ExactC extends ExactType, OutputOf, InputOf> {} +/** + * Strips additional properties. + * + * @category combinators + * @since 1.1.0 + */ +export declare function exact(codec: C, name?: string): ExactC +/** + * @since 1.0.0 + */ +export declare class FunctionType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'FunctionType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface FunctionC extends FunctionType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const Function: FunctionC +/** + * @since 1.0.0 + */ +export declare class NeverType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'NeverType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface NeverC extends NeverType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const never: NeverC +/** + * @since 1.0.0 + */ +export declare class AnyType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'AnyType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface AnyC extends AnyType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const any: AnyC +/** + * @since 1.5.3 + */ +export interface RefinementC> extends RefinementType, InputOf> {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function refinement>( + codec: C, + refinement: Refinement, B>, + name?: string +): RefinementC +export declare function refinement( + codec: C, + predicate: Predicate>, + name?: string +): RefinementC +/** + * @category primitives + * @since 1.0.0 + */ +export declare const Integer: RefinementC +/** + * @since 1.3.0 + * @deprecated + */ +export declare class TaggedUnionType< + Tag extends string, + CS extends Array, + A = any, + O = A, + I = unknown +> extends UnionType { + readonly tag: Tag + constructor( + name: string, + is: TaggedUnionType['is'], + validate: TaggedUnionType['validate'], + encode: TaggedUnionType['encode'], + codecs: CS, + tag: Tag + ) +} +/** + * @since 1.5.3 + * @deprecated + */ +export interface TaggedUnionC]> // tslint:disable-next-line: deprecation + extends TaggedUnionType, OutputOf, unknown> {} +/** + * Use `union` instead. + * + * @category combinators + * @since 1.3.0 + * @deprecated + */ +export declare const taggedUnion: ( + tag: Tag, + codecs: CS, + name?: string +) => TaggedUnionC +export { + /** + * Use `UnknownArray` instead. + * + * @category primitives + * @deprecated + * @since 1.0.0 + */ + UnknownArray as Array +} +export { + /** + * Use `type` instead. + * + * @category combinators + * @deprecated + * @since 1.0.0 + */ + type as interface +} +/** + * Use `unknown` instead. + * + * @since 1.0.0 + * @deprecated + */ +export type mixed = unknown +/** + * @since 1.0.0 + * @deprecated + */ +export declare const getValidationError: (value: unknown, context: Context) => ValidationError +/** + * @since 1.0.0 + * @deprecated + */ +export declare const getDefaultContext: (decoder: Decoder) => Context +/** + * Use `UnknownRecord` instead. + * + * @category primitives + * @since 1.0.0 + * @deprecated + */ +export declare const Dictionary: UnknownRecordC +/** + * @since 1.0.0 + * @deprecated + */ +export declare class ObjectType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'ObjectType' + constructor() +} +/** + * @since 1.5.3 + * @deprecated + */ +export interface ObjectC extends ObjectType {} +/** + * Use `UnknownRecord` instead. + * + * @category primitives + * @since 1.0.0 + * @deprecated + */ +export declare const object: ObjectC +/** + * Use `record` instead. + * + * @category combinators + * @since 1.0.0 + * @deprecated + */ +export declare const dictionary: typeof record +/** + * @since 1.4.2 + * @deprecated + */ +export type Compact = { + [K in keyof A]: A[K] +} +/** + * @since 1.0.0 + * @deprecated + */ +export declare class StrictType extends Type { + readonly props: P + /** + * @since 1.0.0 + */ + readonly _tag: 'StrictType' + constructor( + name: string, + is: StrictType['is'], + validate: StrictType['validate'], + encode: StrictType['encode'], + props: P + ) +} +/** + * @since 1.5.3 + * @deprecated + */ +export interface StrictC

// tslint:disable-next-line: deprecation + extends StrictType< + P, + { + [K in keyof P]: TypeOf + }, + { + [K in keyof P]: OutputOf + }, + unknown + > {} +/** + * @since 1.3.0 + * @deprecated + */ +export type TaggedProps = { + [K in Tag]: LiteralType +} +/** + * @since 1.3.0 + * @deprecated + */ +export interface TaggedRefinement extends RefinementType, A, O> {} +/** + * @since 1.3.0 + * @deprecated + */ +export interface TaggedUnion extends UnionType>, A, O> {} +/** + * @since 1.3.0 + * @deprecated + */ +export type TaggedIntersectionArgument = + | [Tagged] + | [Tagged, Mixed] + | [Mixed, Tagged] + | [Tagged, Mixed, Mixed] + | [Mixed, Tagged, Mixed] + | [Mixed, Mixed, Tagged] + | [Tagged, Mixed, Mixed, Mixed] + | [Mixed, Tagged, Mixed, Mixed] + | [Mixed, Mixed, Tagged, Mixed] + | [Mixed, Mixed, Mixed, Tagged] + | [Tagged, Mixed, Mixed, Mixed, Mixed] + | [Mixed, Tagged, Mixed, Mixed, Mixed] + | [Mixed, Mixed, Tagged, Mixed, Mixed] + | [Mixed, Mixed, Mixed, Tagged, Mixed] + | [Mixed, Mixed, Mixed, Mixed, Tagged] +/** + * @since 1.3.0 + * @deprecated + */ +export interface TaggedIntersection // tslint:disable-next-line: deprecation + extends IntersectionType, A, O> {} +/** + * @since 1.3.0 + * @deprecated + */ +export interface TaggedExact extends ExactType, A, O> {} +/** + * @since 1.3.0 + * @deprecated + */ +export type Tagged = + | InterfaceType, A, O> + | StrictType, A, O> + | TaggedRefinement + | TaggedUnion + | TaggedIntersection + | TaggedExact + | RecursiveType +/** + * Drops the codec "kind". + * + * @category combinators + * @since 1.1.0 + * @deprecated + */ +export declare function clean(codec: Type): Type +/** + * @since 1.0.0 + * @deprecated + */ +export type PropsOf< + T extends { + props: any + } +> = T['props'] +/** + * @since 1.1.0 + * @deprecated + */ +export type Exact = T & { + [K in ({ + [K in keyof X]: K + } & { + [K in keyof T]: never + } & { + [key: string]: never + })[keyof X]]?: never +} +/** + * Keeps the codec "kind". + * + * @category combinators + * @since 1.1.0 + * @deprecated + */ +export declare function alias( + codec: PartialType +): () => PartialType +export declare function alias( + codec: StrictType +): () => StrictType +export declare function alias( + codec: InterfaceType +): () => InterfaceType diff --git a/components/pexels/node_modules/io-ts/es6/index.js b/components/pexels/node_modules/io-ts/es6/index.js new file mode 100644 index 0000000000000..a9b3b336acd7f --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/index.js @@ -0,0 +1,1645 @@ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +/** + * @since 1.0.0 + */ +import { isLeft, left, right } from 'fp-ts/es6/Either'; +/** + * @category Decode error + * @since 1.0.0 + */ +export var failures = left; +/** + * @category Decode error + * @since 1.0.0 + */ +export var failure = function (value, context, message) { + return failures([{ value: value, context: context, message: message }]); +}; +/** + * @category Decode error + * @since 1.0.0 + */ +export var success = right; +/** + * @category Codec + * @since 1.0.0 + */ +var Type = /** @class */ (function () { + function Type( + /** a unique name for this codec */ + name, + /** a custom type guard */ + is, + /** succeeds if a value of type I can be decoded to a value of type A */ + validate, + /** converts a value of type A to a value of type O */ + encode) { + this.name = name; + this.is = is; + this.validate = validate; + this.encode = encode; + this.decode = this.decode.bind(this); + } + /** + * @since 1.0.0 + */ + Type.prototype.pipe = function (ab, name) { + var _this = this; + if (name === void 0) { name = "pipe(".concat(this.name, ", ").concat(ab.name, ")"); } + return new Type(name, ab.is, function (i, c) { + var e = _this.validate(i, c); + if (isLeft(e)) { + return e; + } + return ab.validate(e.right, c); + }, this.encode === identity && ab.encode === identity ? identity : function (b) { return _this.encode(ab.encode(b)); }); + }; + /** + * @since 1.0.0 + */ + Type.prototype.asDecoder = function () { + return this; + }; + /** + * @since 1.0.0 + */ + Type.prototype.asEncoder = function () { + return this; + }; + /** + * a version of `validate` with a default context + * @since 1.0.0 + */ + Type.prototype.decode = function (i) { + return this.validate(i, [{ key: '', type: this, actual: i }]); + }; + return Type; +}()); +export { Type }; +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- +/** + * @since 1.0.0 + */ +export var identity = function (a) { return a; }; +/** + * @since 1.0.0 + */ +export function getFunctionName(f) { + return f.displayName || f.name || ""); +} +/** + * @since 1.0.0 + */ +export function getContextEntry(key, decoder) { + return { key: key, type: decoder }; +} +/** + * @since 1.0.0 + */ +export function appendContext(c, key, decoder, actual) { + var len = c.length; + var r = Array(len + 1); + for (var i = 0; i < len; i++) { + r[i] = c[i]; + } + r[len] = { key: key, type: decoder, actual: actual }; + return r; +} +function pushAll(xs, ys) { + var l = ys.length; + for (var i = 0; i < l; i++) { + xs.push(ys[i]); + } +} +var hasOwnProperty = Object.prototype.hasOwnProperty; +function getNameFromProps(props) { + return Object.keys(props) + .map(function (k) { return "".concat(k, ": ").concat(props[k].name); }) + .join(', '); +} +function useIdentity(codecs) { + for (var i = 0; i < codecs.length; i++) { + if (codecs[i].encode !== identity) { + return false; + } + } + return true; +} +function getInterfaceTypeName(props) { + return "{ ".concat(getNameFromProps(props), " }"); +} +function getPartialTypeName(inner) { + return "Partial<".concat(inner, ">"); +} +function enumerableRecord(keys, domain, codomain, name) { + if (name === void 0) { name = "{ [K in ".concat(domain.name, "]: ").concat(codomain.name, " }"); } + var len = keys.length; + var props = {}; + for (var i = 0; i < len; i++) { + props[keys[i]] = codomain; + } + var exactCodec = strict(props, name); + return new DictionaryType(name, function (u) { return exactCodec.is(u); }, exactCodec.validate, exactCodec.encode, domain, codomain); +} +/** + * @internal + */ +export function getDomainKeys(domain) { + var _a; + if (isLiteralC(domain)) { + var literal_1 = domain.value; + if (string.is(literal_1)) { + return _a = {}, _a[literal_1] = null, _a; + } + } + else if (isKeyofC(domain)) { + return domain.keys; + } + else if (isUnionC(domain)) { + var keys = domain.types.map(function (type) { return getDomainKeys(type); }); + return keys.some(undefinedType.is) ? undefined : Object.assign.apply(Object, __spreadArray([{}], keys, false)); + } + return undefined; +} +function stripNonDomainKeys(o, domain) { + var keys = Object.keys(o); + var len = keys.length; + var shouldStrip = false; + var r = {}; + for (var i = 0; i < len; i++) { + var k = keys[i]; + if (domain.is(k)) { + r[k] = o[k]; + } + else { + shouldStrip = true; + } + } + return shouldStrip ? r : o; +} +function nonEnumerableRecord(domain, codomain, name) { + if (name === void 0) { name = "{ [K in ".concat(domain.name, "]: ").concat(codomain.name, " }"); } + return new DictionaryType(name, function (u) { + if (UnknownRecord.is(u)) { + return Object.keys(u).every(function (k) { return !domain.is(k) || codomain.is(u[k]); }); + } + return isAnyC(codomain) && Array.isArray(u); + }, function (u, c) { + if (UnknownRecord.is(u)) { + var a = {}; + var errors = []; + var keys = Object.keys(u); + var len = keys.length; + var changed = false; + for (var i = 0; i < len; i++) { + var k = keys[i]; + var ok = u[k]; + var domainResult = domain.validate(k, appendContext(c, k, domain, k)); + if (isLeft(domainResult)) { + changed = true; + } + else { + var vk = domainResult.right; + changed = changed || vk !== k; + k = vk; + var codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)); + if (isLeft(codomainResult)) { + pushAll(errors, codomainResult.left); + } + else { + var vok = codomainResult.right; + changed = changed || vok !== ok; + a[k] = vok; + } + } + } + return errors.length > 0 ? failures(errors) : success((changed ? a : u)); + } + if (isAnyC(codomain) && Array.isArray(u)) { + return success(u); + } + return failure(u, c); + }, domain.encode === identity && codomain.encode === identity + ? function (a) { return stripNonDomainKeys(a, domain); } + : function (a) { + var s = {}; + var keys = Object.keys(stripNonDomainKeys(a, domain)); + var len = keys.length; + for (var i = 0; i < len; i++) { + var k = keys[i]; + s[String(domain.encode(k))] = codomain.encode(a[k]); + } + return s; + }, domain, codomain); +} +function getUnionName(codecs) { + return '(' + codecs.map(function (type) { return type.name; }).join(' | ') + ')'; +} +/** + * @internal + */ +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +export function mergeAll(base, us) { + var equal = true; + var primitive = true; + var baseIsNotADictionary = !UnknownRecord.is(base); + for (var _i = 0, us_1 = us; _i < us_1.length; _i++) { + var u = us_1[_i]; + if (u !== base) { + equal = false; + } + if (UnknownRecord.is(u)) { + primitive = false; + } + } + if (equal) { + return base; + } + else if (primitive) { + return us[us.length - 1]; + } + var r = {}; + for (var _a = 0, us_2 = us; _a < us_2.length; _a++) { + var u = us_2[_a]; + for (var k in u) { + if (!hasOwnProperty.call(r, k) || baseIsNotADictionary || u[k] !== base[k]) { + r[k] = u[k]; + } + } + } + return r; +} +function getProps(codec) { + switch (codec._tag) { + case 'RefinementType': + case 'ReadonlyType': + return getProps(codec.type); + case 'InterfaceType': + case 'StrictType': + case 'PartialType': + return codec.props; + case 'IntersectionType': + return codec.types.reduce(function (props, type) { return Object.assign(props, getProps(type)); }, {}); + } +} +function stripKeys(o, props) { + var keys = Object.getOwnPropertyNames(o); + var shouldStrip = false; + var r = {}; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (!hasOwnProperty.call(props, key)) { + shouldStrip = true; + } + else { + r[key] = o[key]; + } + } + return shouldStrip ? r : o; +} +function getExactTypeName(codec) { + if (isTypeC(codec)) { + return "{| ".concat(getNameFromProps(codec.props), " |}"); + } + else if (isPartialC(codec)) { + return getPartialTypeName("{| ".concat(getNameFromProps(codec.props), " |}")); + } + return "Exact<".concat(codec.name, ">"); +} +function isNonEmpty(as) { + return as.length > 0; +} +/** + * @internal + */ +export var emptyTags = {}; +function intersect(a, b) { + var r = []; + for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { + var v = a_1[_i]; + if (b.indexOf(v) !== -1) { + r.push(v); + } + } + return r; +} +function mergeTags(a, b) { + if (a === emptyTags) { + return b; + } + if (b === emptyTags) { + return a; + } + var r = Object.assign({}, a); + for (var k in b) { + if (hasOwnProperty.call(a, k)) { + var intersection_1 = intersect(a[k], b[k]); + if (isNonEmpty(intersection_1)) { + r[k] = intersection_1; + } + else { + r = emptyTags; + break; + } + } + else { + r[k] = b[k]; + } + } + return r; +} +function intersectTags(a, b) { + if (a === emptyTags || b === emptyTags) { + return emptyTags; + } + var r = emptyTags; + for (var k in a) { + if (hasOwnProperty.call(b, k)) { + var intersection_2 = intersect(a[k], b[k]); + if (intersection_2.length === 0) { + if (r === emptyTags) { + r = {}; + } + r[k] = a[k].concat(b[k]); + } + } + } + return r; +} +// tslint:disable-next-line: deprecation +function isAnyC(codec) { + return codec._tag === 'AnyType'; +} +function isLiteralC(codec) { + return codec._tag === 'LiteralType'; +} +function isKeyofC(codec) { + return codec._tag === 'KeyofType'; +} +function isTypeC(codec) { + return codec._tag === 'InterfaceType'; +} +function isPartialC(codec) { + return codec._tag === 'PartialType'; +} +// tslint:disable-next-line: deprecation +function isStrictC(codec) { + return codec._tag === 'StrictType'; +} +function isExactC(codec) { + return codec._tag === 'ExactType'; +} +// tslint:disable-next-line: deprecation +function isRefinementC(codec) { + return codec._tag === 'RefinementType'; +} +function isIntersectionC(codec) { + return codec._tag === 'IntersectionType'; +} +function isUnionC(codec) { + return codec._tag === 'UnionType'; +} +function isRecursiveC(codec) { + return codec._tag === 'RecursiveType'; +} +function isReadonlyC(codec) { + return codec._tag === 'ReadonlyType'; +} +var lazyCodecs = []; +/** + * @internal + */ +export function getTags(codec) { + if (lazyCodecs.indexOf(codec) !== -1) { + return emptyTags; + } + if (isTypeC(codec) || isStrictC(codec)) { + var index = emptyTags; + // tslint:disable-next-line: forin + for (var k in codec.props) { + var prop = codec.props[k]; + if (isLiteralC(prop)) { + if (index === emptyTags) { + index = {}; + } + index[k] = [prop.value]; + } + } + return index; + } + else if (isExactC(codec) || isRefinementC(codec) || isReadonlyC(codec)) { + return getTags(codec.type); + } + else if (isIntersectionC(codec)) { + return codec.types.reduce(function (tags, codec) { return mergeTags(tags, getTags(codec)); }, emptyTags); + } + else if (isUnionC(codec)) { + return codec.types.slice(1).reduce(function (tags, codec) { return intersectTags(tags, getTags(codec)); }, getTags(codec.types[0])); + } + else if (isRecursiveC(codec)) { + lazyCodecs.push(codec); + var tags = getTags(codec.type); + lazyCodecs.pop(); + return tags; + } + return emptyTags; +} +/** + * @internal + */ +export function getIndex(codecs) { + var tags = getTags(codecs[0]); + var keys = Object.keys(tags); + var len = codecs.length; + var _loop_1 = function (k) { + var all = tags[k].slice(); + var index = [tags[k]]; + for (var i = 1; i < len; i++) { + var codec = codecs[i]; + var ctags = getTags(codec); + var values = ctags[k]; + // tslint:disable-next-line: strict-type-predicates + if (values === undefined) { + return "continue-keys"; + } + else { + if (values.some(function (v) { return all.indexOf(v) !== -1; })) { + return "continue-keys"; + } + else { + all.push.apply(all, values); + index.push(values); + } + } + } + return { value: [k, index] }; + }; + keys: for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { + var k = keys_1[_i]; + var state_1 = _loop_1(k); + if (typeof state_1 === "object") + return state_1.value; + switch (state_1) { + case "continue-keys": continue keys; + } + } + return undefined; +} +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @since 1.0.0 + */ +var NullType = /** @class */ (function (_super) { + __extends(NullType, _super); + function NullType() { + var _this = _super.call(this, 'null', function (u) { return u === null; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'NullType'; + return _this; + } + return NullType; +}(Type)); +export { NullType }; +/** + * @category primitives + * @since 1.0.0 + */ +export var nullType = new NullType(); +/** + * @since 1.0.0 + */ +var UndefinedType = /** @class */ (function (_super) { + __extends(UndefinedType, _super); + function UndefinedType() { + var _this = _super.call(this, 'undefined', function (u) { return u === void 0; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'UndefinedType'; + return _this; + } + return UndefinedType; +}(Type)); +export { UndefinedType }; +var undefinedType = new UndefinedType(); +/** + * @since 1.2.0 + */ +var VoidType = /** @class */ (function (_super) { + __extends(VoidType, _super); + function VoidType() { + var _this = _super.call(this, 'void', undefinedType.is, undefinedType.validate, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'VoidType'; + return _this; + } + return VoidType; +}(Type)); +export { VoidType }; +/** + * @category primitives + * @since 1.2.0 + */ +export var voidType = new VoidType(); +/** + * @since 1.5.0 + */ +var UnknownType = /** @class */ (function (_super) { + __extends(UnknownType, _super); + function UnknownType() { + var _this = _super.call(this, 'unknown', function (_) { return true; }, success, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'UnknownType'; + return _this; + } + return UnknownType; +}(Type)); +export { UnknownType }; +/** + * @category primitives + * @since 1.5.0 + */ +export var unknown = new UnknownType(); +/** + * @since 1.0.0 + */ +var StringType = /** @class */ (function (_super) { + __extends(StringType, _super); + function StringType() { + var _this = _super.call(this, 'string', function (u) { return typeof u === 'string'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'StringType'; + return _this; + } + return StringType; +}(Type)); +export { StringType }; +/** + * @category primitives + * @since 1.0.0 + */ +export var string = new StringType(); +/** + * @since 1.0.0 + */ +var NumberType = /** @class */ (function (_super) { + __extends(NumberType, _super); + function NumberType() { + var _this = _super.call(this, 'number', function (u) { return typeof u === 'number'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'NumberType'; + return _this; + } + return NumberType; +}(Type)); +export { NumberType }; +/** + * @category primitives + * @since 1.0.0 + */ +export var number = new NumberType(); +/** + * @since 2.1.0 + */ +var BigIntType = /** @class */ (function (_super) { + __extends(BigIntType, _super); + function BigIntType() { + var _this = _super.call(this, 'bigint', + // tslint:disable-next-line: valid-typeof + function (u) { return typeof u === 'bigint'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'BigIntType'; + return _this; + } + return BigIntType; +}(Type)); +export { BigIntType }; +/** + * @category primitives + * @since 2.1.0 + */ +export var bigint = new BigIntType(); +/** + * @since 1.0.0 + */ +var BooleanType = /** @class */ (function (_super) { + __extends(BooleanType, _super); + function BooleanType() { + var _this = _super.call(this, 'boolean', function (u) { return typeof u === 'boolean'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'BooleanType'; + return _this; + } + return BooleanType; +}(Type)); +export { BooleanType }; +/** + * @category primitives + * @since 1.0.0 + */ +export var boolean = new BooleanType(); +/** + * @since 1.0.0 + */ +var AnyArrayType = /** @class */ (function (_super) { + __extends(AnyArrayType, _super); + function AnyArrayType() { + var _this = _super.call(this, 'UnknownArray', Array.isArray, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'AnyArrayType'; + return _this; + } + return AnyArrayType; +}(Type)); +export { AnyArrayType }; +/** + * @category primitives + * @since 1.7.1 + */ +export var UnknownArray = new AnyArrayType(); +/** + * @since 1.0.0 + */ +var AnyDictionaryType = /** @class */ (function (_super) { + __extends(AnyDictionaryType, _super); + function AnyDictionaryType() { + var _this = _super.call(this, 'UnknownRecord', function (u) { return u !== null && typeof u === 'object' && !Array.isArray(u); }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'AnyDictionaryType'; + return _this; + } + return AnyDictionaryType; +}(Type)); +export { AnyDictionaryType }; +/** + * @category primitives + * @since 1.7.1 + */ +export var UnknownRecord = new AnyDictionaryType(); +export { +/** + * @category primitives + * @since 1.0.0 + */ +nullType as null, +/** + * @category primitives + * @since 1.0.0 + */ +undefinedType as undefined, +/** + * @category primitives + * @since 1.0.0 + */ +voidType as void }; +/** + * @since 1.0.0 + */ +var LiteralType = /** @class */ (function (_super) { + __extends(LiteralType, _super); + function LiteralType(name, is, validate, encode, value) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.value = value; + /** + * @since 1.0.0 + */ + _this._tag = 'LiteralType'; + return _this; + } + return LiteralType; +}(Type)); +export { LiteralType }; +/** + * @category constructors + * @since 1.0.0 + */ +export function literal(value, name) { + if (name === void 0) { name = JSON.stringify(value); } + var is = function (u) { return u === value; }; + return new LiteralType(name, is, function (u, c) { return (is(u) ? success(value) : failure(u, c)); }, identity, value); +} +/** + * @since 1.0.0 + */ +var KeyofType = /** @class */ (function (_super) { + __extends(KeyofType, _super); + function KeyofType(name, is, validate, encode, keys) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.keys = keys; + /** + * @since 1.0.0 + */ + _this._tag = 'KeyofType'; + return _this; + } + return KeyofType; +}(Type)); +export { KeyofType }; +/** + * @category constructors + * @since 1.0.0 + */ +export function keyof(keys, name) { + if (name === void 0) { name = Object.keys(keys) + .map(function (k) { return JSON.stringify(k); }) + .join(' | '); } + var is = function (u) { return string.is(u) && hasOwnProperty.call(keys, u); }; + return new KeyofType(name, is, function (u, c) { return (is(u) ? success(u) : failure(u, c)); }, identity, keys); +} +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @since 1.0.0 + */ +var RefinementType = /** @class */ (function (_super) { + __extends(RefinementType, _super); + function RefinementType(name, is, validate, encode, type, predicate) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.type = type; + _this.predicate = predicate; + /** + * @since 1.0.0 + */ + _this._tag = 'RefinementType'; + return _this; + } + return RefinementType; +}(Type)); +export { RefinementType }; +/** + * @category combinators + * @since 1.8.1 + */ +export function brand(codec, predicate, name) { + return refinement(codec, predicate, name); +} +/** + * A branded codec representing an integer + * + * @category primitives + * @since 1.8.1 + */ +export var Int = brand(number, function (n) { return Number.isInteger(n); }, 'Int'); +/** + * @since 1.0.0 + */ +var RecursiveType = /** @class */ (function (_super) { + __extends(RecursiveType, _super); + function RecursiveType(name, is, validate, encode, runDefinition) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.runDefinition = runDefinition; + /** + * @since 1.0.0 + */ + _this._tag = 'RecursiveType'; + return _this; + } + return RecursiveType; +}(Type)); +export { RecursiveType }; +Object.defineProperty(RecursiveType.prototype, 'type', { + get: function () { + return this.runDefinition(); + }, + enumerable: true, + configurable: true +}); +/** + * @category combinators + * @since 1.0.0 + */ +export function recursion(name, definition) { + var cache; + var runDefinition = function () { + if (!cache) { + cache = definition(Self); + cache.name = name; + } + return cache; + }; + var Self = new RecursiveType(name, function (u) { return runDefinition().is(u); }, function (u, c) { return runDefinition().validate(u, c); }, function (a) { return runDefinition().encode(a); }, runDefinition); + return Self; +} +/** + * @since 1.0.0 + */ +var ArrayType = /** @class */ (function (_super) { + __extends(ArrayType, _super); + function ArrayType(name, is, validate, encode, type) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.type = type; + /** + * @since 1.0.0 + */ + _this._tag = 'ArrayType'; + return _this; + } + return ArrayType; +}(Type)); +export { ArrayType }; +/** + * @category combinators + * @since 1.0.0 + */ +export function array(item, name) { + if (name === void 0) { name = "Array<".concat(item.name, ">"); } + return new ArrayType(name, function (u) { return UnknownArray.is(u) && u.every(item.is); }, function (u, c) { + var e = UnknownArray.validate(u, c); + if (isLeft(e)) { + return e; + } + var us = e.right; + var len = us.length; + var as = us; + var errors = []; + for (var i = 0; i < len; i++) { + var ui = us[i]; + var result = item.validate(ui, appendContext(c, String(i), item, ui)); + if (isLeft(result)) { + pushAll(errors, result.left); + } + else { + var ai = result.right; + if (ai !== ui) { + if (as === us) { + as = us.slice(); + } + as[i] = ai; + } + } + } + return errors.length > 0 ? failures(errors) : success(as); + }, item.encode === identity ? identity : function (a) { return a.map(item.encode); }, item); +} +/** + * @since 1.0.0 + */ +var InterfaceType = /** @class */ (function (_super) { + __extends(InterfaceType, _super); + function InterfaceType(name, is, validate, encode, props) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.props = props; + /** + * @since 1.0.0 + */ + _this._tag = 'InterfaceType'; + return _this; + } + return InterfaceType; +}(Type)); +export { InterfaceType }; +/** + * @category combinators + * @since 1.0.0 + */ +export function type(props, name) { + if (name === void 0) { name = getInterfaceTypeName(props); } + var keys = Object.keys(props); + var types = keys.map(function (key) { return props[key]; }); + var len = keys.length; + return new InterfaceType(name, function (u) { + if (UnknownRecord.is(u)) { + for (var i = 0; i < len; i++) { + var k = keys[i]; + var uk = u[k]; + if ((uk === undefined && !hasOwnProperty.call(u, k)) || !types[i].is(uk)) { + return false; + } + } + return true; + } + return false; + }, function (u, c) { + var e = UnknownRecord.validate(u, c); + if (isLeft(e)) { + return e; + } + var o = e.right; + var a = o; + var errors = []; + for (var i = 0; i < len; i++) { + var k = keys[i]; + var ak = a[k]; + var type_1 = types[i]; + var result = type_1.validate(ak, appendContext(c, k, type_1, ak)); + if (isLeft(result)) { + pushAll(errors, result.left); + } + else { + var vak = result.right; + if (vak !== ak || (vak === undefined && !hasOwnProperty.call(a, k))) { + /* istanbul ignore next */ + if (a === o) { + a = __assign({}, o); + } + a[k] = vak; + } + } + } + return errors.length > 0 ? failures(errors) : success(a); + }, useIdentity(types) + ? identity + : function (a) { + var s = __assign({}, a); + for (var i = 0; i < len; i++) { + var k = keys[i]; + var encode = types[i].encode; + if (encode !== identity) { + s[k] = encode(a[k]); + } + } + return s; + }, props); +} +/** + * @since 1.0.0 + */ +var PartialType = /** @class */ (function (_super) { + __extends(PartialType, _super); + function PartialType(name, is, validate, encode, props) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.props = props; + /** + * @since 1.0.0 + */ + _this._tag = 'PartialType'; + return _this; + } + return PartialType; +}(Type)); +export { PartialType }; +/** + * @category combinators + * @since 1.0.0 + */ +export function partial(props, name) { + if (name === void 0) { name = getPartialTypeName(getInterfaceTypeName(props)); } + var keys = Object.keys(props); + var types = keys.map(function (key) { return props[key]; }); + var len = keys.length; + return new PartialType(name, function (u) { + if (UnknownRecord.is(u)) { + for (var i = 0; i < len; i++) { + var k = keys[i]; + var uk = u[k]; + if (uk !== undefined && !props[k].is(uk)) { + return false; + } + } + return true; + } + return false; + }, function (u, c) { + var e = UnknownRecord.validate(u, c); + if (isLeft(e)) { + return e; + } + var o = e.right; + var a = o; + var errors = []; + for (var i = 0; i < len; i++) { + var k = keys[i]; + var ak = a[k]; + var type_2 = props[k]; + var result = type_2.validate(ak, appendContext(c, k, type_2, ak)); + if (isLeft(result)) { + if (ak !== undefined) { + pushAll(errors, result.left); + } + } + else { + var vak = result.right; + if (vak !== ak) { + /* istanbul ignore next */ + if (a === o) { + a = __assign({}, o); + } + a[k] = vak; + } + } + } + return errors.length > 0 ? failures(errors) : success(a); + }, useIdentity(types) + ? identity + : function (a) { + var s = __assign({}, a); + for (var i = 0; i < len; i++) { + var k = keys[i]; + var ak = a[k]; + if (ak !== undefined) { + s[k] = types[i].encode(ak); + } + } + return s; + }, props); +} +/** + * @since 1.0.0 + */ +var DictionaryType = /** @class */ (function (_super) { + __extends(DictionaryType, _super); + function DictionaryType(name, is, validate, encode, domain, codomain) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.domain = domain; + _this.codomain = codomain; + /** + * @since 1.0.0 + */ + _this._tag = 'DictionaryType'; + return _this; + } + return DictionaryType; +}(Type)); +export { DictionaryType }; +/** + * @category combinators + * @since 1.7.1 + */ +export function record(domain, codomain, name) { + var keys = getDomainKeys(domain); + return keys + ? enumerableRecord(Object.keys(keys), domain, codomain, name) + : nonEnumerableRecord(domain, codomain, name); +} +/** + * @since 1.0.0 + */ +var UnionType = /** @class */ (function (_super) { + __extends(UnionType, _super); + function UnionType(name, is, validate, encode, types) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.types = types; + /** + * @since 1.0.0 + */ + _this._tag = 'UnionType'; + return _this; + } + return UnionType; +}(Type)); +export { UnionType }; +/** + * @category combinators + * @since 1.0.0 + */ +export function union(codecs, name) { + if (name === void 0) { name = getUnionName(codecs); } + var index = getIndex(codecs); + if (index !== undefined && codecs.length > 0) { + var tag_1 = index[0], groups_1 = index[1]; + var len_1 = groups_1.length; + var find_1 = function (value) { + for (var i = 0; i < len_1; i++) { + if (groups_1[i].indexOf(value) !== -1) { + return i; + } + } + return undefined; + }; + // tslint:disable-next-line: deprecation + return new TaggedUnionType(name, function (u) { + if (UnknownRecord.is(u)) { + var i = find_1(u[tag_1]); + return i !== undefined ? codecs[i].is(u) : false; + } + return false; + }, function (u, c) { + var e = UnknownRecord.validate(u, c); + if (isLeft(e)) { + return e; + } + var r = e.right; + var i = find_1(r[tag_1]); + if (i === undefined) { + return failure(u, c); + } + var codec = codecs[i]; + return codec.validate(r, appendContext(c, String(i), codec, r)); + }, useIdentity(codecs) + ? identity + : function (a) { + var i = find_1(a[tag_1]); + if (i === undefined) { + // https://github.com/gcanti/io-ts/pull/305 + throw new Error("no codec found to encode value in union codec ".concat(name)); + } + else { + return codecs[i].encode(a); + } + }, codecs, tag_1); + } + else { + return new UnionType(name, function (u) { return codecs.some(function (type) { return type.is(u); }); }, function (u, c) { + var errors = []; + for (var i = 0; i < codecs.length; i++) { + var codec = codecs[i]; + var result = codec.validate(u, appendContext(c, String(i), codec, u)); + if (isLeft(result)) { + pushAll(errors, result.left); + } + else { + return success(result.right); + } + } + return failures(errors); + }, useIdentity(codecs) + ? identity + : function (a) { + for (var _i = 0, codecs_1 = codecs; _i < codecs_1.length; _i++) { + var codec = codecs_1[_i]; + if (codec.is(a)) { + return codec.encode(a); + } + } + // https://github.com/gcanti/io-ts/pull/305 + throw new Error("no codec found to encode value in union type ".concat(name)); + }, codecs); + } +} +/** + * @since 1.0.0 + */ +var IntersectionType = /** @class */ (function (_super) { + __extends(IntersectionType, _super); + function IntersectionType(name, is, validate, encode, types) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.types = types; + /** + * @since 1.0.0 + */ + _this._tag = 'IntersectionType'; + return _this; + } + return IntersectionType; +}(Type)); +export { IntersectionType }; +export function intersection(codecs, name) { + if (name === void 0) { name = "(".concat(codecs.map(function (type) { return type.name; }).join(' & '), ")"); } + var len = codecs.length; + return new IntersectionType(name, function (u) { return codecs.every(function (type) { return type.is(u); }); }, codecs.length === 0 + ? success + : function (u, c) { + var us = []; + var errors = []; + for (var i = 0; i < len; i++) { + var codec = codecs[i]; + var result = codec.validate(u, appendContext(c, String(i), codec, u)); + if (isLeft(result)) { + pushAll(errors, result.left); + } + else { + us.push(result.right); + } + } + return errors.length > 0 ? failures(errors) : success(mergeAll(u, us)); + }, codecs.length === 0 + ? identity + : function (a) { + return mergeAll(a, codecs.map(function (codec) { return codec.encode(a); })); + }, codecs); +} +/** + * @since 1.0.0 + */ +var TupleType = /** @class */ (function (_super) { + __extends(TupleType, _super); + function TupleType(name, is, validate, encode, types) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.types = types; + /** + * @since 1.0.0 + */ + _this._tag = 'TupleType'; + return _this; + } + return TupleType; +}(Type)); +export { TupleType }; +export function tuple(codecs, name) { + if (name === void 0) { name = "[".concat(codecs.map(function (type) { return type.name; }).join(', '), "]"); } + var len = codecs.length; + return new TupleType(name, function (u) { return UnknownArray.is(u) && u.length === len && codecs.every(function (type, i) { return type.is(u[i]); }); }, function (u, c) { + var e = UnknownArray.validate(u, c); + if (isLeft(e)) { + return e; + } + var us = e.right; + var as = us.length > len ? us.slice(0, len) : us; // strip additional components + var errors = []; + for (var i = 0; i < len; i++) { + var a = us[i]; + var type_3 = codecs[i]; + var result = type_3.validate(a, appendContext(c, String(i), type_3, a)); + if (isLeft(result)) { + pushAll(errors, result.left); + } + else { + var va = result.right; + if (va !== a) { + /* istanbul ignore next */ + if (as === us) { + as = us.slice(); + } + as[i] = va; + } + } + } + return errors.length > 0 ? failures(errors) : success(as); + }, useIdentity(codecs) ? identity : function (a) { return codecs.map(function (type, i) { return type.encode(a[i]); }); }, codecs); +} +/** + * @since 1.0.0 + */ +var ReadonlyType = /** @class */ (function (_super) { + __extends(ReadonlyType, _super); + function ReadonlyType(name, is, validate, encode, type) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.type = type; + /** + * @since 1.0.0 + */ + _this._tag = 'ReadonlyType'; + return _this; + } + return ReadonlyType; +}(Type)); +export { ReadonlyType }; +/** + * @category combinators + * @since 1.0.0 + */ +export function readonly(codec, name) { + if (name === void 0) { name = "Readonly<".concat(codec.name, ">"); } + return new ReadonlyType(name, codec.is, codec.validate, codec.encode, codec); +} +/** + * @since 1.0.0 + */ +var ReadonlyArrayType = /** @class */ (function (_super) { + __extends(ReadonlyArrayType, _super); + function ReadonlyArrayType(name, is, validate, encode, type) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.type = type; + /** + * @since 1.0.0 + */ + _this._tag = 'ReadonlyArrayType'; + return _this; + } + return ReadonlyArrayType; +}(Type)); +export { ReadonlyArrayType }; +/** + * @category combinators + * @since 1.0.0 + */ +export function readonlyArray(item, name) { + if (name === void 0) { name = "ReadonlyArray<".concat(item.name, ">"); } + var codec = array(item); + return new ReadonlyArrayType(name, codec.is, codec.validate, codec.encode, item); +} +/** + * Strips additional properties, equivalent to `exact(type(props))`. + * + * @category combinators + * @since 1.0.0 + */ +export var strict = function (props, name) { return exact(type(props), name); }; +/** + * @since 1.1.0 + */ +var ExactType = /** @class */ (function (_super) { + __extends(ExactType, _super); + function ExactType(name, is, validate, encode, type) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.type = type; + /** + * @since 1.0.0 + */ + _this._tag = 'ExactType'; + return _this; + } + return ExactType; +}(Type)); +export { ExactType }; +/** + * Strips additional properties. + * + * @category combinators + * @since 1.1.0 + */ +export function exact(codec, name) { + if (name === void 0) { name = getExactTypeName(codec); } + var props = getProps(codec); + return new ExactType(name, codec.is, function (u, c) { + var e = UnknownRecord.validate(u, c); + if (isLeft(e)) { + return e; + } + var ce = codec.validate(u, c); + if (isLeft(ce)) { + return ce; + } + return right(stripKeys(ce.right, props)); + }, function (a) { return codec.encode(stripKeys(a, props)); }, codec); +} +/** + * @since 1.0.0 + */ +var FunctionType = /** @class */ (function (_super) { + __extends(FunctionType, _super); + function FunctionType() { + var _this = _super.call(this, 'Function', + // tslint:disable-next-line:strict-type-predicates + function (u) { return typeof u === 'function'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'FunctionType'; + return _this; + } + return FunctionType; +}(Type)); +export { FunctionType }; +/** + * @category primitives + * @since 1.0.0 + */ +export var Function = new FunctionType(); +/** + * @since 1.0.0 + */ +var NeverType = /** @class */ (function (_super) { + __extends(NeverType, _super); + function NeverType() { + var _this = _super.call(this, 'never', function (_) { return false; }, function (u, c) { return failure(u, c); }, + /* istanbul ignore next */ + function () { + throw new Error('cannot encode never'); + }) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'NeverType'; + return _this; + } + return NeverType; +}(Type)); +export { NeverType }; +/** + * @category primitives + * @since 1.0.0 + */ +export var never = new NeverType(); +/** + * @since 1.0.0 + */ +var AnyType = /** @class */ (function (_super) { + __extends(AnyType, _super); + function AnyType() { + var _this = _super.call(this, 'any', function (_) { return true; }, success, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'AnyType'; + return _this; + } + return AnyType; +}(Type)); +export { AnyType }; +/** + * @category primitives + * @since 1.0.0 + */ +export var any = new AnyType(); +export function refinement(codec, predicate, name) { + if (name === void 0) { name = "(".concat(codec.name, " | ").concat(getFunctionName(predicate), ")"); } + return new RefinementType(name, function (u) { return codec.is(u) && predicate(u); }, function (i, c) { + var e = codec.validate(i, c); + if (isLeft(e)) { + return e; + } + var a = e.right; + return predicate(a) ? success(a) : failure(a, c); + }, codec.encode, codec, predicate); +} +/** + * @category primitives + * @since 1.0.0 + */ +export var Integer = refinement(number, Number.isInteger, 'Integer'); +// ------------------------------------------------------------------------------------- +// deprecated +// ------------------------------------------------------------------------------------- +/** + * @since 1.3.0 + * @deprecated + */ +var TaggedUnionType = /** @class */ (function (_super) { + __extends(TaggedUnionType, _super); + function TaggedUnionType(name, + // tslint:disable-next-line: deprecation + is, + // tslint:disable-next-line: deprecation + validate, + // tslint:disable-next-line: deprecation + encode, codecs, tag) { + var _this = _super.call(this, name, is, validate, encode, codecs) /* istanbul ignore next */ // <= workaround for https://github.com/Microsoft/TypeScript/issues/13455 + || this; + _this.tag = tag; + return _this; + } + return TaggedUnionType; +}(UnionType)); +export { TaggedUnionType }; +/** + * Use `union` instead. + * + * @category combinators + * @since 1.3.0 + * @deprecated + */ +export var taggedUnion = function (tag, codecs, name +// tslint:disable-next-line: deprecation +) { + if (name === void 0) { name = getUnionName(codecs); } + var U = union(codecs, name); + // tslint:disable-next-line: deprecation + if (U instanceof TaggedUnionType) { + return U; + } + else { + console.warn("[io-ts] Cannot build a tagged union for ".concat(name, ", returning a de-optimized union")); + // tslint:disable-next-line: deprecation + return new TaggedUnionType(name, U.is, U.validate, U.encode, codecs, tag); + } +}; +export { +/** + * Use `UnknownArray` instead. + * + * @category primitives + * @deprecated + * @since 1.0.0 + */ +UnknownArray as Array }; +export { +/** + * Use `type` instead. + * + * @category combinators + * @deprecated + * @since 1.0.0 + */ +type as interface }; +/** + * @since 1.0.0 + * @deprecated + */ +export var getValidationError /* istanbul ignore next */ = function (value, context) { return ({ + value: value, + context: context +}); }; +/** + * @since 1.0.0 + * @deprecated + */ +export var getDefaultContext /* istanbul ignore next */ = function (decoder) { return [ + { key: '', type: decoder } +]; }; +/** + * Use `UnknownRecord` instead. + * + * @category primitives + * @since 1.0.0 + * @deprecated + */ +export var Dictionary = UnknownRecord; +/** + * @since 1.0.0 + * @deprecated + */ +var ObjectType = /** @class */ (function (_super) { + __extends(ObjectType, _super); + function ObjectType() { + var _this = _super.call(this, 'object', function (u) { return u !== null && typeof u === 'object'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'ObjectType'; + return _this; + } + return ObjectType; +}(Type)); +export { ObjectType }; +/** + * Use `UnknownRecord` instead. + * + * @category primitives + * @since 1.0.0 + * @deprecated + */ +// tslint:disable-next-line: deprecation +export var object = new ObjectType(); +/** + * Use `record` instead. + * + * @category combinators + * @since 1.0.0 + * @deprecated + */ +export var dictionary = record; +/** + * @since 1.0.0 + * @deprecated + */ +var StrictType = /** @class */ (function (_super) { + __extends(StrictType, _super); + function StrictType(name, + // tslint:disable-next-line: deprecation + is, + // tslint:disable-next-line: deprecation + validate, + // tslint:disable-next-line: deprecation + encode, props) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.props = props; + /** + * @since 1.0.0 + */ + _this._tag = 'StrictType'; + return _this; + } + return StrictType; +}(Type)); +export { StrictType }; +/** + * Drops the codec "kind". + * + * @category combinators + * @since 1.1.0 + * @deprecated + */ +export function clean(codec) { + return codec; +} +export function alias(codec) { + return function () { return codec; }; +} diff --git a/components/pexels/node_modules/io-ts/lib/Codec.d.ts b/components/pexels/node_modules/io-ts/lib/Codec.d.ts new file mode 100644 index 0000000000000..c6c734474e857 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Codec.d.ts @@ -0,0 +1,296 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.3 + */ +import { Refinement } from 'fp-ts/lib/function' +import { Invariant3 } from 'fp-ts/lib/Invariant' +import * as D from './Decoder' +import * as E from './Encoder' +import * as S from './Schemable' +/** + * Laws: + * + * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` + * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` + * + * @category model + * @since 2.2.3 + */ +export interface Codec extends D.Decoder, E.Encoder {} +/** + * @category constructors + * @since 2.2.3 + */ +export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec +/** + * @category constructors + * @since 2.2.3 + */ +export declare function fromDecoder(decoder: D.Decoder): Codec +/** + * @category constructors + * @since 2.2.3 + */ +export declare function literal], L extends S.Literal = S.Literal>( + ...values: A +): Codec +/** + * @category primitives + * @since 2.2.3 + */ +export declare const string: Codec +/** + * @category primitives + * @since 2.2.3 + */ +export declare const number: Codec +/** + * @category primitives + * @since 2.2.3 + */ +export declare const boolean: Codec +/** + * @category primitives + * @since 2.2.3 + */ +export declare const UnknownArray: Codec, Array> +/** + * @category primitives + * @since 2.2.3 + */ +export declare const UnknownRecord: Codec, Record> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const mapLeftWithInput: ( + f: (i: I, e: D.DecodeError) => D.DecodeError +) => (codec: Codec) => Codec +/** + * @category combinators + * @since 2.2.3 + */ +export declare const refine: ( + refinement: Refinement, + id: string +) => (from: Codec) => Codec +/** + * @category combinators + * @since 2.2.3 + */ +export declare function nullable(or: Codec): Codec +/** + * @category combinators + * @since 2.2.15 + */ +export declare function fromStruct

>>( + properties: P +): Codec< + { + [K in keyof P]: InputOf + }, + { + [K in keyof P]: OutputOf + }, + { + [K in keyof P]: TypeOf + } +> +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +export declare const fromType: typeof fromStruct +/** + * @category combinators + * @since 2.2.15 + */ +export declare function struct

>>( + properties: P +): Codec< + unknown, + { + [K in keyof P]: OutputOf + }, + { + [K in keyof P]: TypeOf + } +> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export declare const type: typeof struct +/** + * @category combinators + * @since 2.2.8 + */ +export declare function fromPartial

>>( + properties: P +): Codec< + Partial<{ + [K in keyof P]: InputOf + }>, + Partial<{ + [K in keyof P]: OutputOf + }>, + Partial<{ + [K in keyof P]: TypeOf + }> +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function partial

>>( + properties: P +): Codec< + unknown, + Partial<{ + [K in keyof P]: OutputOf + }>, + Partial<{ + [K in keyof P]: TypeOf + }> +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function fromArray(item: Codec): Codec, Array, Array> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function array(item: Codec): Codec, Array> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function fromRecord( + codomain: Codec +): Codec, Record, Record> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function record( + codomain: Codec +): Codec, Record> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromTuple: []>( + ...components: C +) => Codec< + { [K in keyof C]: import('./Kleisli').InputOf<'Either', C[K]> }, + { [K_1 in keyof C]: E.OutputOf }, + { [K_2 in keyof C]: E.TypeOf } +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function tuple>>( + ...components: C +): Codec< + unknown, + { + [K in keyof C]: OutputOf + }, + { + [K in keyof C]: TypeOf + } +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const intersect: ( + right: Codec +) => (left: Codec) => Codec +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromSum: ( + tag: T +) => >>( + members: MS +) => Codec, E.OutputOf, E.TypeOf> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function sum( + tag: T +): >>( + members: M +) => Codec, TypeOf> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function lazy(id: string, f: () => Codec): Codec +/** + * @category combinators + * @since 2.2.16 + */ +export declare const readonly: (codec: Codec) => Codec> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const compose: ( + to: Codec +) => (from: Codec) => Codec +/** + * @category Invariant + * @since 2.2.3 + */ +export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec +/** + * @category instances + * @since 2.2.3 + */ +export declare const URI = 'io-ts/Codec' +/** + * @category instances + * @since 2.2.3 + */ +export type URI = typeof URI +declare module 'fp-ts/lib/HKT' { + interface URItoKind3 { + readonly [URI]: Codec + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Invariant: Invariant3 +/** + * @since 2.2.8 + */ +export type InputOf = D.InputOf +/** + * @since 2.2.3 + */ +export type OutputOf = E.OutputOf +/** + * @since 2.2.3 + */ +export type TypeOf = E.TypeOf diff --git a/components/pexels/node_modules/io-ts/lib/Codec.js b/components/pexels/node_modules/io-ts/lib/Codec.js new file mode 100644 index 0000000000000..dae84e8698be6 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Codec.js @@ -0,0 +1,332 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Invariant = exports.URI = exports.imap = exports.compose = exports.readonly = exports.lazy = exports.sum = exports.fromSum = exports.intersect = exports.tuple = exports.fromTuple = exports.record = exports.fromRecord = exports.array = exports.fromArray = exports.partial = exports.fromPartial = exports.type = exports.struct = exports.fromType = exports.fromStruct = exports.nullable = exports.refine = exports.mapLeftWithInput = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = exports.fromDecoder = exports.make = void 0; +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.3 + */ +var function_1 = require("fp-ts/lib/function"); +var pipeable_1 = require("fp-ts/lib/pipeable"); +var D = __importStar(require("./Decoder")); +var E = __importStar(require("./Encoder")); +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.3 + */ +function make(decoder, encoder) { + return { + decode: decoder.decode, + encode: encoder.encode + }; +} +exports.make = make; +/** + * @category constructors + * @since 2.2.3 + */ +function fromDecoder(decoder) { + return { + decode: decoder.decode, + encode: function_1.identity + }; +} +exports.fromDecoder = fromDecoder; +/** + * @category constructors + * @since 2.2.3 + */ +function literal() { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return fromDecoder(D.literal.apply(D, values)); +} +exports.literal = literal; +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.3 + */ +exports.string = +/*#__PURE__*/ +fromDecoder(D.string); +/** + * @category primitives + * @since 2.2.3 + */ +exports.number = +/*#__PURE__*/ +fromDecoder(D.number); +/** + * @category primitives + * @since 2.2.3 + */ +exports.boolean = +/*#__PURE__*/ +fromDecoder(D.boolean); +/** + * @category primitives + * @since 2.2.3 + */ +exports.UnknownArray = +/*#__PURE__*/ +fromDecoder(D.UnknownArray); +/** + * @category primitives + * @since 2.2.3 + */ +exports.UnknownRecord = +/*#__PURE__*/ +fromDecoder(D.UnknownRecord); +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.3 + */ +var mapLeftWithInput = function (f) { + return function (codec) { + return make((0, pipeable_1.pipe)(codec, D.mapLeftWithInput(f)), codec); + }; +}; +exports.mapLeftWithInput = mapLeftWithInput; +/** + * @category combinators + * @since 2.2.3 + */ +var refine = function (refinement, id) { + var refine = D.refine(refinement, id); + return function (from) { return make(refine(from), from); }; +}; +exports.refine = refine; +/** + * @category combinators + * @since 2.2.3 + */ +function nullable(or) { + return make(D.nullable(or), E.nullable(or)); +} +exports.nullable = nullable; +/** + * @category combinators + * @since 2.2.15 + */ +function fromStruct(properties) { + return make(D.fromStruct(properties), E.struct(properties)); +} +exports.fromStruct = fromStruct; +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +exports.fromType = fromStruct; +/** + * @category combinators + * @since 2.2.15 + */ +function struct(properties) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)(fromStruct(properties))); +} +exports.struct = struct; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +exports.type = struct; +/** + * @category combinators + * @since 2.2.8 + */ +function fromPartial(properties) { + return make(D.fromPartial(properties), E.partial(properties)); +} +exports.fromPartial = fromPartial; +/** + * @category combinators + * @since 2.2.3 + */ +function partial(properties) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)(fromPartial(properties))); +} +exports.partial = partial; +/** + * @category combinators + * @since 2.2.3 + */ +function fromArray(item) { + return make(D.fromArray(item), E.array(item)); +} +exports.fromArray = fromArray; +/** + * @category combinators + * @since 2.2.3 + */ +function array(item) { + return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)(fromArray(item))); +} +exports.array = array; +/** + * @category combinators + * @since 2.2.3 + */ +function fromRecord(codomain) { + return make(D.fromRecord(codomain), E.record(codomain)); +} +exports.fromRecord = fromRecord; +/** + * @category combinators + * @since 2.2.3 + */ +function record(codomain) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)(fromRecord(codomain))); +} +exports.record = record; +/** + * @category combinators + * @since 2.2.8 + */ +var fromTuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return make(D.fromTuple.apply(D, components), E.tuple.apply(E, components)); +}; +exports.fromTuple = fromTuple; +/** + * @category combinators + * @since 2.2.3 + */ +function tuple() { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)(exports.fromTuple.apply(void 0, components))); +} +exports.tuple = tuple; +/** + * @category combinators + * @since 2.2.3 + */ +var intersect = function (right) { + var intersectD = D.intersect(right); + var intersectE = E.intersect(right); + return function (left) { return make(intersectD(left), intersectE(left)); }; +}; +exports.intersect = intersect; +/** + * @category combinators + * @since 2.2.8 + */ +var fromSum = function (tag) { + var decoder = D.fromSum(tag); + var encoder = E.sum(tag); + return function (members) { return make(decoder(members), encoder(members)); }; +}; +exports.fromSum = fromSum; +/** + * @category combinators + * @since 2.2.3 + */ +function sum(tag) { + var sum = (0, exports.fromSum)(tag); + return function (members) { return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)(sum(members))); }; +} +exports.sum = sum; +/** + * @category combinators + * @since 2.2.3 + */ +function lazy(id, f) { + return make(D.lazy(id, f), E.lazy(f)); +} +exports.lazy = lazy; +/** + * @category combinators + * @since 2.2.16 + */ +exports.readonly = function_1.identity; +/** + * @category combinators + * @since 2.2.8 + */ +var compose = function (to) { + return function (from) { + return make(D.compose(to)(from), E.compose(from)(to)); + }; +}; +exports.compose = compose; +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- +var imap_ = function (fa, f, g) { return make(D.Functor.map(fa, f), E.Contravariant.contramap(fa, g)); }; +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- +/** + * @category Invariant + * @since 2.2.3 + */ +var imap = function (f, g) { return function (fa) { + return imap_(fa, f, g); +}; }; +exports.imap = imap; +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.3 + */ +exports.URI = 'io-ts/Codec'; +/** + * @category instances + * @since 2.2.8 + */ +exports.Invariant = { + URI: exports.URI, + imap: imap_ +}; diff --git a/components/pexels/node_modules/io-ts/lib/DecodeError.d.ts b/components/pexels/node_modules/io-ts/lib/DecodeError.d.ts new file mode 100644 index 0000000000000..501b7772c26b0 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/DecodeError.d.ts @@ -0,0 +1,135 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Semigroup } from 'fp-ts/lib/Semigroup' +import * as FS from './FreeSemigroup' +/** + * @category model + * @since 2.2.7 + */ +export interface Leaf { + readonly _tag: 'Leaf' + readonly actual: unknown + readonly error: E +} +/** + * @category model + * @since 2.2.7 + */ +export declare const required: 'required' +/** + * @category model + * @since 2.2.7 + */ +export declare const optional: 'optional' +/** + * @category model + * @since 2.2.7 + */ +export type Kind = 'required' | 'optional' +/** + * @category model + * @since 2.2.7 + */ +export interface Key { + readonly _tag: 'Key' + readonly key: string + readonly kind: Kind + readonly errors: FS.FreeSemigroup> +} +/** + * @category model + * @since 2.2.7 + */ +export interface Index { + readonly _tag: 'Index' + readonly index: number + readonly kind: Kind + readonly errors: FS.FreeSemigroup> +} +/** + * @category model + * @since 2.2.7 + */ +export interface Member { + readonly _tag: 'Member' + readonly index: number + readonly errors: FS.FreeSemigroup> +} +/** + * @category model + * @since 2.2.7 + */ +export interface Lazy { + readonly _tag: 'Lazy' + readonly id: string + readonly errors: FS.FreeSemigroup> +} +/** + * @category model + * @since 2.2.9 + */ +export interface Wrap { + readonly _tag: 'Wrap' + readonly error: E + readonly errors: FS.FreeSemigroup> +} +/** + * @category model + * @since 2.2.7 + */ +export type DecodeError = Leaf | Key | Index | Member | Lazy | Wrap +/** + * @category constructors + * @since 2.2.7 + */ +export declare const leaf: (actual: unknown, error: E) => DecodeError +/** + * @category constructors + * @since 2.2.7 + */ +export declare const key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => DecodeError +/** + * @category constructors + * @since 2.2.7 + */ +export declare const index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => DecodeError +/** + * @category constructors + * @since 2.2.7 + */ +export declare const member: (index: number, errors: FS.FreeSemigroup>) => DecodeError +/** + * @category constructors + * @since 2.2.7 + */ +export declare const lazy: (id: string, errors: FS.FreeSemigroup>) => DecodeError +/** + * @category constructors + * @since 2.2.9 + */ +export declare const wrap: (error: E, errors: FS.FreeSemigroup>) => DecodeError +/** + * @category destructors + * @since 2.2.7 + */ +export declare const fold: (patterns: { + Leaf: (input: unknown, error: E) => R + Key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => R + Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R + Member: (index: number, errors: FS.FreeSemigroup>) => R + Lazy: (id: string, errors: FS.FreeSemigroup>) => R + Wrap: (error: E, errors: FS.FreeSemigroup>) => R +}) => (e: DecodeError) => R +/** + * @category instances + * @since 2.2.7 + */ +export declare function getSemigroup(): Semigroup>> diff --git a/components/pexels/node_modules/io-ts/lib/DecodeError.js b/components/pexels/node_modules/io-ts/lib/DecodeError.js new file mode 100644 index 0000000000000..7f89f09eb06d0 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/DecodeError.js @@ -0,0 +1,129 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getSemigroup = exports.fold = exports.wrap = exports.lazy = exports.member = exports.index = exports.key = exports.leaf = exports.optional = exports.required = void 0; +var FS = __importStar(require("./FreeSemigroup")); +/** + * @category model + * @since 2.2.7 + */ +// eslint-disable-next-line @typescript-eslint/prefer-as-const +exports.required = 'required'; +/** + * @category model + * @since 2.2.7 + */ +// eslint-disable-next-line @typescript-eslint/prefer-as-const +exports.optional = 'optional'; +/** + * @category constructors + * @since 2.2.7 + */ +var leaf = function (actual, error) { return ({ _tag: 'Leaf', actual: actual, error: error }); }; +exports.leaf = leaf; +/** + * @category constructors + * @since 2.2.7 + */ +var key = function (key, kind, errors) { return ({ + _tag: 'Key', + key: key, + kind: kind, + errors: errors +}); }; +exports.key = key; +/** + * @category constructors + * @since 2.2.7 + */ +var index = function (index, kind, errors) { return ({ + _tag: 'Index', + index: index, + kind: kind, + errors: errors +}); }; +exports.index = index; +/** + * @category constructors + * @since 2.2.7 + */ +var member = function (index, errors) { return ({ + _tag: 'Member', + index: index, + errors: errors +}); }; +exports.member = member; +/** + * @category constructors + * @since 2.2.7 + */ +var lazy = function (id, errors) { return ({ + _tag: 'Lazy', + id: id, + errors: errors +}); }; +exports.lazy = lazy; +/** + * @category constructors + * @since 2.2.9 + */ +var wrap = function (error, errors) { return ({ + _tag: 'Wrap', + error: error, + errors: errors +}); }; +exports.wrap = wrap; +/** + * @category destructors + * @since 2.2.7 + */ +var fold = function (patterns) { + var f = function (e) { + switch (e._tag) { + case 'Leaf': + return patterns.Leaf(e.actual, e.error); + case 'Key': + return patterns.Key(e.key, e.kind, e.errors); + case 'Index': + return patterns.Index(e.index, e.kind, e.errors); + case 'Member': + return patterns.Member(e.index, e.errors); + case 'Lazy': + return patterns.Lazy(e.id, e.errors); + case 'Wrap': + return patterns.Wrap(e.error, e.errors); + } + }; + return f; +}; +exports.fold = fold; +/** + * @category instances + * @since 2.2.7 + */ +function getSemigroup() { + return FS.getSemigroup(); +} +exports.getSemigroup = getSemigroup; diff --git a/components/pexels/node_modules/io-ts/lib/Decoder.d.ts b/components/pexels/node_modules/io-ts/lib/Decoder.d.ts new file mode 100644 index 0000000000000..1c4e68c0f3c13 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Decoder.d.ts @@ -0,0 +1,331 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Alt2 } from 'fp-ts/lib/Alt' +import { Category2 } from 'fp-ts/lib/Category' +import * as E from 'fp-ts/lib/Either' +import { Refinement } from 'fp-ts/lib/function' +import { Functor2 } from 'fp-ts/lib/Functor' +import * as DE from './DecodeError' +import * as FS from './FreeSemigroup' +import * as G from './Guard' +import * as K from './Kleisli' +import * as S from './Schemable' +/** + * @category model + * @since 2.2.8 + */ +export interface Decoder extends K.Kleisli {} +/** + * @category DecodeError + * @since 2.2.7 + */ +export type DecodeError = FS.FreeSemigroup> +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const error: (actual: unknown, message: string) => DecodeError +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const success: (a: A) => E.Either +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const failure: (actual: unknown, message: string) => E.Either +/** + * @category constructors + * @since 2.2.8 + */ +export declare const fromRefinement: (refinement: Refinement, expected: string) => Decoder +/** + * @category constructors + * @since 2.2.8 + */ +export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder +/** + * @category constructors + * @since 2.2.7 + */ +export declare const literal: ], L extends S.Literal = S.Literal>( + ...values: A +) => Decoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const string: Decoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const number: Decoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const boolean: Decoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const UnknownArray: Decoder> +/** + * @category primitives + * @since 2.2.7 + */ +export declare const UnknownRecord: Decoder> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const mapLeftWithInput: ( + f: (input: I, e: DecodeError) => DecodeError +) => (decoder: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.9 + */ +export declare const withMessage: ( + message: (input: I, e: DecodeError) => string +) => (decoder: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const refine: ( + refinement: Refinement, + id: string +) => (from: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const parse: ( + parser: (a: A) => E.Either +) => (from: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const nullable: (or: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.15 + */ +export declare const fromStruct:

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +export declare const fromType:

>>( + properties: P +) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> +/** + * @category combinators + * @since 2.2.15 + */ +export declare const struct: (properties: { [K in keyof A]: Decoder }) => Decoder< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export declare const type: (properties: { [K in keyof A]: Decoder }) => Decoder< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromPartial:

>>( + properties: P +) => Decoder< + Partial<{ [K in keyof P]: K.InputOf<'Either', P[K]> }>, + Partial<{ [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> +> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const partial: (properties: { [K in keyof A]: Decoder }) => Decoder< + unknown, + Partial<{ [K_1 in keyof A]: A[K_1] }> +> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromArray: (item: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const array: (item: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromRecord: (codomain: Decoder) => Decoder, Record> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const record: (codomain: Decoder) => Decoder> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromTuple: []>( + ...components: C +) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K_1 in keyof C]: K.TypeOf<'Either', C[K_1]> }> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const tuple: ( + ...components: { [K in keyof A]: Decoder } +) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const union: , ...Array>]>( + ...members: MS +) => Decoder, TypeOf> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const intersect: ( + right: Decoder +) => (left: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromSum: ( + tag: T +) => >>( + members: MS +) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: Decoder> }) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const lazy: (id: string, f: () => Decoder) => Decoder +/** + * @category combinators + * @since 2.2.15 + */ +export declare const readonly: (decoder: Decoder) => Decoder> +/** + * @category Functor + * @since 2.2.7 + */ +export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder +/** + * @category Alt + * @since 2.2.7 + */ +export declare const alt: (that: () => Decoder) => (me: Decoder) => Decoder +/** + * @category Semigroupoid + * @since 2.2.8 + */ +export declare const compose: (to: Decoder) => (from: Decoder) => Decoder +/** + * @category Category + * @since 2.2.8 + */ +export declare const id: () => Decoder +/** + * @category instances + * @since 2.2.7 + */ +export declare const URI = 'io-ts/Decoder' +/** + * @category instances + * @since 2.2.7 + */ +export type URI = typeof URI +declare module 'fp-ts/lib/HKT' { + interface URItoKind2 { + readonly [URI]: Decoder + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Functor: Functor2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Alt: Alt2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Category: Category2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Schemable: S.Schemable2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnknownContainers: S.WithUnknownContainers2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnion: S.WithUnion2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithRefine: S.WithRefine2C +/** + * @since 2.2.8 + */ +export type InputOf = K.InputOf +/** + * @since 2.2.7 + */ +export type TypeOf = K.TypeOf +/** + * @since 2.2.7 + */ +export declare const draw: (e: DecodeError) => string diff --git a/components/pexels/node_modules/io-ts/lib/Decoder.js b/components/pexels/node_modules/io-ts/lib/Decoder.js new file mode 100644 index 0000000000000..f44649a3af609 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Decoder.js @@ -0,0 +1,523 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.stringify = exports.draw = exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.Category = exports.Alt = exports.Functor = exports.URI = exports.id = exports.compose = exports.alt = exports.map = exports.readonly = exports.lazy = exports.sum = exports.fromSum = exports.intersect = exports.union = exports.tuple = exports.fromTuple = exports.record = exports.fromRecord = exports.array = exports.fromArray = exports.partial = exports.fromPartial = exports.type = exports.struct = exports.fromType = exports.fromStruct = exports.nullable = exports.parse = exports.refine = exports.withMessage = exports.mapLeftWithInput = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = exports.fromGuard = exports.fromRefinement = exports.failure = exports.success = exports.error = exports.ap = exports.SE = void 0; +var E = __importStar(require("fp-ts/lib/Either")); +var function_1 = require("fp-ts/lib/function"); +var pipeable_1 = require("fp-ts/lib/pipeable"); +var DE = __importStar(require("./DecodeError")); +var FS = __importStar(require("./FreeSemigroup")); +var G = __importStar(require("./Guard")); +var K = __importStar(require("./Kleisli")); +// ------------------------------------------------------------------------------------- +// Kleisli config +// ------------------------------------------------------------------------------------- +/** + * @internal + */ +exports.SE = +/*#__PURE__*/ +DE.getSemigroup(); +/** + * @internal + */ +var ap = function (fab, fa) { + return E.isLeft(fab) + ? E.isLeft(fa) + ? E.left(exports.SE.concat(fab.left, fa.left)) + : fab + : E.isLeft(fa) + ? fa + : E.right(fab.right(fa.right)); +}; +exports.ap = ap; +var M = { + URI: E.URI, + _E: undefined, + map: function (fa, f) { return (0, pipeable_1.pipe)(fa, E.map(f)); }, + ap: exports.ap, + of: E.right, + chain: function (ma, f) { return (0, pipeable_1.pipe)(ma, E.chain(f)); }, + throwError: E.left, + bimap: function (fa, f, g) { return (0, pipeable_1.pipe)(fa, E.bimap(f, g)); }, + mapLeft: function (fa, f) { return (0, pipeable_1.pipe)(fa, E.mapLeft(f)); }, + alt: function (me, that) { + if (E.isRight(me)) { + return me; + } + var ea = that(); + return E.isLeft(ea) ? E.left(exports.SE.concat(me.left, ea.left)) : ea; + } +}; +/** + * @category DecodeError + * @since 2.2.7 + */ +var error = function (actual, message) { return FS.of(DE.leaf(actual, message)); }; +exports.error = error; +/** + * @category DecodeError + * @since 2.2.7 + */ +exports.success = E.right; +/** + * @category DecodeError + * @since 2.2.7 + */ +var failure = function (actual, message) { + return E.left((0, exports.error)(actual, message)); +}; +exports.failure = failure; +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.8 + */ +var fromRefinement = function (refinement, expected) { + return K.fromRefinement(M)(refinement, function (u) { return (0, exports.error)(u, expected); }); +}; +exports.fromRefinement = fromRefinement; +/** + * @category constructors + * @since 2.2.8 + */ +var fromGuard = function (guard, expected) { + return (0, exports.fromRefinement)(guard.is, expected); +}; +exports.fromGuard = fromGuard; +/** + * @category constructors + * @since 2.2.7 + */ +exports.literal = +/*#__PURE__*/ +K.literal(M)(function (u, values) { return (0, exports.error)(u, values.map(function (value) { return JSON.stringify(value); }).join(' | ')); }); +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.7 + */ +exports.string = +/*#__PURE__*/ +(0, exports.fromGuard)(G.string, 'string'); +/** + * @category primitives + * @since 2.2.7 + */ +exports.number = +/*#__PURE__*/ +(0, exports.fromGuard)(G.number, 'number'); +/** + * @category primitives + * @since 2.2.7 + */ +exports.boolean = +/*#__PURE__*/ +(0, exports.fromGuard)(G.boolean, 'boolean'); +/** + * @category primitives + * @since 2.2.7 + */ +exports.UnknownArray = +/*#__PURE__*/ +(0, exports.fromGuard)(G.UnknownArray, 'Array'); +/** + * @category primitives + * @since 2.2.7 + */ +exports.UnknownRecord = +/*#__PURE__*/ +(0, exports.fromGuard)(G.UnknownRecord, 'Record'); +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +exports.mapLeftWithInput = +/*#__PURE__*/ +K.mapLeftWithInput(M); +/** + * @category combinators + * @since 2.2.9 + */ +var withMessage = function (message) { + return (0, exports.mapLeftWithInput)(function (input, e) { return FS.of(DE.wrap(message(input, e), e)); }); +}; +exports.withMessage = withMessage; +/** + * @category combinators + * @since 2.2.7 + */ +var refine = function (refinement, id) { return K.refine(M)(refinement, function (a) { return (0, exports.error)(a, id); }); }; +exports.refine = refine; +/** + * @category combinators + * @since 2.2.7 + */ +exports.parse = +/*#__PURE__*/ +K.parse(M); +/** + * @category combinators + * @since 2.2.7 + */ +exports.nullable = +/*#__PURE__*/ +K.nullable(M)(function (u, e) { return FS.concat(FS.of(DE.member(0, (0, exports.error)(u, 'null'))), FS.of(DE.member(1, e))); }); +/** + * @category combinators + * @since 2.2.15 + */ +var fromStruct = function (properties) { + return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); +}; +exports.fromStruct = fromStruct; +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +exports.fromType = exports.fromStruct; +/** + * @category combinators + * @since 2.2.15 + */ +var struct = function (properties) { return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromStruct)(properties))); }; +exports.struct = struct; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +exports.type = exports.struct; +/** + * @category combinators + * @since 2.2.8 + */ +var fromPartial = function (properties) { + return K.fromPartial(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(properties); +}; +exports.fromPartial = fromPartial; +/** + * @category combinators + * @since 2.2.7 + */ +var partial = function (properties) { return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromPartial)(properties))); }; +exports.partial = partial; +/** + * @category combinators + * @since 2.2.8 + */ +var fromArray = function (item) { + return K.fromArray(M)(function (i, e) { return FS.of(DE.index(i, DE.optional, e)); })(item); +}; +exports.fromArray = fromArray; +/** + * @category combinators + * @since 2.2.7 + */ +var array = function (item) { + return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)((0, exports.fromArray)(item))); +}; +exports.array = array; +/** + * @category combinators + * @since 2.2.8 + */ +var fromRecord = function (codomain) { + return K.fromRecord(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(codomain); +}; +exports.fromRecord = fromRecord; +/** + * @category combinators + * @since 2.2.7 + */ +var record = function (codomain) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromRecord)(codomain))); +}; +exports.record = record; +/** + * @category combinators + * @since 2.2.8 + */ +var fromTuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return K.fromTuple(M)(function (i, e) { return FS.of(DE.index(i, DE.required, e)); }).apply(void 0, components); +}; +exports.fromTuple = fromTuple; +/** + * @category combinators + * @since 2.2.7 + */ +var tuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)(exports.fromTuple.apply(void 0, components))); +}; +exports.tuple = tuple; +/** + * @category combinators + * @since 2.2.7 + */ +exports.union = +/*#__PURE__*/ +K.union(M)(function (i, e) { return FS.of(DE.member(i, e)); }); +/** + * @category combinators + * @since 2.2.7 + */ +exports.intersect = +/*#__PURE__*/ +K.intersect(M); +/** + * @category combinators + * @since 2.2.8 + */ +var fromSum = function (tag) { + return function (members) { + return K.fromSum(M)(function (tag, value, keys) { + return FS.of(DE.key(tag, DE.required, (0, exports.error)(value, keys.length === 0 ? 'never' : keys.map(function (k) { return JSON.stringify(k); }).join(' | ')))); + })(tag)(members); + }; +}; +exports.fromSum = fromSum; +/** + * @category combinators + * @since 2.2.7 + */ +var sum = function (tag) { + return function (members) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromSum)(tag)(members))); + }; +}; +exports.sum = sum; +/** + * @category combinators + * @since 2.2.7 + */ +exports.lazy = +/*#__PURE__*/ +K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); +/** + * @category combinators + * @since 2.2.15 + */ +exports.readonly = function_1.identity; +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- +var map_ = function (fa, f) { return (0, pipeable_1.pipe)(fa, (0, exports.map)(f)); }; +var alt_ = function (me, that) { return (0, pipeable_1.pipe)(me, (0, exports.alt)(that)); }; +var compose_ = function (ab, la) { return (0, pipeable_1.pipe)(la, (0, exports.compose)(ab)); }; +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- +/** + * @category Functor + * @since 2.2.7 + */ +exports.map = +/*#__PURE__*/ +K.map(M); +/** + * @category Alt + * @since 2.2.7 + */ +exports.alt = +/*#__PURE__*/ +K.alt(M); +/** + * @category Semigroupoid + * @since 2.2.8 + */ +exports.compose = +/*#__PURE__*/ +K.compose(M); +/** + * @category Category + * @since 2.2.8 + */ +exports.id = +/*#__PURE__*/ +K.id(M); +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.7 + */ +exports.URI = 'io-ts/Decoder'; +/** + * @category instances + * @since 2.2.8 + */ +exports.Functor = { + URI: exports.URI, + map: map_ +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.Alt = { + URI: exports.URI, + map: map_, + alt: alt_ +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.Category = { + URI: exports.URI, + compose: compose_, + id: exports.id +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.Schemable = { + URI: exports.URI, + literal: exports.literal, + string: exports.string, + number: exports.number, + boolean: exports.boolean, + nullable: exports.nullable, + type: exports.type, + struct: exports.struct, + partial: exports.partial, + record: exports.record, + array: exports.array, + tuple: exports.tuple, + intersect: exports.intersect, + sum: exports.sum, + lazy: exports.lazy, + readonly: exports.readonly +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithUnknownContainers = { + UnknownArray: exports.UnknownArray, + UnknownRecord: exports.UnknownRecord +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithUnion = { + union: exports.union +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithRefine = { + refine: exports.refine +}; +var empty = []; +var make = function (value, forest) { + if (forest === void 0) { forest = empty; } + return ({ + value: value, + forest: forest + }); +}; +var drawTree = function (tree) { return tree.value + drawForest('\n', tree.forest); }; +var drawForest = function (indentation, forest) { + var r = ''; + var len = forest.length; + var tree; + for (var i = 0; i < len; i++) { + tree = forest[i]; + var isLast = i === len - 1; + r += indentation + (isLast ? '└' : '├') + '─ ' + tree.value; + r += drawForest(indentation + (len > 1 && !isLast ? '│ ' : ' '), tree.forest); + } + return r; +}; +var toTree = DE.fold({ + Leaf: function (input, error) { return make("cannot decode ".concat(JSON.stringify(input), ", should be ").concat(error)); }, + Key: function (key, kind, errors) { return make("".concat(kind, " property ").concat(JSON.stringify(key)), toForest(errors)); }, + Index: function (index, kind, errors) { return make("".concat(kind, " index ").concat(index), toForest(errors)); }, + Member: function (index, errors) { return make("member ".concat(index), toForest(errors)); }, + Lazy: function (id, errors) { return make("lazy type ".concat(id), toForest(errors)); }, + Wrap: function (error, errors) { return make(error, toForest(errors)); } +}); +var toForest = function (e) { + var stack = []; + var focus = e; + var res = []; + // eslint-disable-next-line no-constant-condition + while (true) { + switch (focus._tag) { + case 'Of': + { + res.push(toTree(focus.value)); + var tmp = stack.pop(); + if (tmp === undefined) { + return res; + } + else { + focus = tmp; + } + } + break; + case 'Concat': + stack.push(focus.right); + focus = focus.left; + break; + } + } +}; +/** + * @since 2.2.7 + */ +var draw = function (e) { return toForest(e).map(drawTree).join('\n'); }; +exports.draw = draw; +/** + * @internal + */ +exports.stringify = +/*#__PURE__*/ +E.fold(exports.draw, function (a) { return JSON.stringify(a, null, 2); }); diff --git a/components/pexels/node_modules/io-ts/lib/Encoder.d.ts b/components/pexels/node_modules/io-ts/lib/Encoder.d.ts new file mode 100644 index 0000000000000..beef93d6405f7 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Encoder.d.ts @@ -0,0 +1,154 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.3 + */ +import { Category2 } from 'fp-ts/lib/Category' +import { Contravariant2 } from 'fp-ts/lib/Contravariant' +/** + * @category model + * @since 2.2.3 + */ +export interface Encoder { + readonly encode: (a: A) => O +} +/** + * @category combinators + * @since 2.2.3 + */ +export declare function nullable(or: Encoder): Encoder +/** + * @category combinators + * @since 2.2.15 + */ +export declare function struct

>>( + properties: P +): Encoder< + { + [K in keyof P]: OutputOf + }, + { + [K in keyof P]: TypeOf + } +> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export declare const type: typeof struct +/** + * @category combinators + * @since 2.2.3 + */ +export declare function partial

>>( + properties: P +): Encoder< + Partial<{ + [K in keyof P]: OutputOf + }>, + Partial<{ + [K in keyof P]: TypeOf + }> +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function record(codomain: Encoder): Encoder, Record> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function array(item: Encoder): Encoder, Array> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function tuple>>( + ...components: C +): Encoder< + { + [K in keyof C]: OutputOf + }, + { + [K in keyof C]: TypeOf + } +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const intersect: (right: Encoder) => (left: Encoder) => Encoder +/** + * @category combinators + * @since 2.2.3 + */ +export declare function sum( + tag: T +): >>(members: MS) => Encoder, TypeOf> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function lazy(f: () => Encoder): Encoder +/** + * @category combinators + * @since 2.2.16 + */ +export declare const readonly: (decoder: Encoder) => Encoder> +/** + * @category Contravariant + * @since 2.2.3 + */ +export declare const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder +/** + * @category Semigroupoid + * @since 2.2.3 + */ +export declare const compose: (ea: Encoder) => (ab: Encoder) => Encoder +/** + * @category Category + * @since 2.2.3 + */ +export declare function id(): Encoder +/** + * @category instances + * @since 2.2.3 + */ +export declare const URI = 'io-ts/Encoder' +/** + * @category instances + * @since 2.2.3 + */ +export type URI = typeof URI +declare module 'fp-ts/lib/HKT' { + interface URItoKind2 { + readonly [URI]: Encoder + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Contravariant: Contravariant2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Category: Category2 +/** + * @since 2.2.3 + */ +export type TypeOf = E extends Encoder ? A : never +/** + * @since 2.2.3 + */ +export type OutputOf = E extends Encoder ? O : never diff --git a/components/pexels/node_modules/io-ts/lib/Encoder.js b/components/pexels/node_modules/io-ts/lib/Encoder.js new file mode 100644 index 0000000000000..d6fcefae1113c --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Encoder.js @@ -0,0 +1,202 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Category = exports.Contravariant = exports.URI = exports.id = exports.compose = exports.contramap = exports.readonly = exports.lazy = exports.sum = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.struct = exports.nullable = void 0; +var function_1 = require("fp-ts/lib/function"); +var Schemable_1 = require("./Schemable"); +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.3 + */ +function nullable(or) { + return { + encode: function (a) { return (a === null ? null : or.encode(a)); } + }; +} +exports.nullable = nullable; +/** + * @category combinators + * @since 2.2.15 + */ +function struct(properties) { + return { + encode: function (a) { + var o = {}; + for (var k in properties) { + o[k] = properties[k].encode(a[k]); + } + return o; + } + }; +} +exports.struct = struct; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +exports.type = struct; +/** + * @category combinators + * @since 2.2.3 + */ +function partial(properties) { + return { + encode: function (a) { + var o = {}; + for (var k in properties) { + var v = a[k]; + // don't add missing properties + if (k in a) { + // don't strip undefined properties + o[k] = v === undefined ? undefined : properties[k].encode(v); + } + } + return o; + } + }; +} +exports.partial = partial; +/** + * @category combinators + * @since 2.2.3 + */ +function record(codomain) { + return { + encode: function (r) { + var o = {}; + for (var k in r) { + o[k] = codomain.encode(r[k]); + } + return o; + } + }; +} +exports.record = record; +/** + * @category combinators + * @since 2.2.3 + */ +function array(item) { + return { + encode: function (as) { return as.map(item.encode); } + }; +} +exports.array = array; +/** + * @category combinators + * @since 2.2.3 + */ +function tuple() { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return { + encode: function (as) { return components.map(function (c, i) { return c.encode(as[i]); }); } + }; +} +exports.tuple = tuple; +/** + * @category combinators + * @since 2.2.3 + */ +var intersect = function (right) { + return function (left) { return ({ + encode: function (ab) { return (0, Schemable_1.intersect_)(left.encode(ab), right.encode(ab)); } + }); }; +}; +exports.intersect = intersect; +/** + * @category combinators + * @since 2.2.3 + */ +function sum(tag) { + return function (members) { + return { + encode: function (a) { return members[a[tag]].encode(a); } + }; + }; +} +exports.sum = sum; +/** + * @category combinators + * @since 2.2.3 + */ +function lazy(f) { + var get = (0, Schemable_1.memoize)(f); + return { + encode: function (a) { return get().encode(a); } + }; +} +exports.lazy = lazy; +/** + * @category combinators + * @since 2.2.16 + */ +exports.readonly = function_1.identity; +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- +var contramap_ = function (ea, f) { return ({ + encode: function (b) { return ea.encode(f(b)); } +}); }; +var compose_ = function (ab, ea) { return contramap_(ea, ab.encode); }; +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- +/** + * @category Contravariant + * @since 2.2.3 + */ +var contramap = function (f) { return function (fa) { + return contramap_(fa, f); +}; }; +exports.contramap = contramap; +/** + * @category Semigroupoid + * @since 2.2.3 + */ +var compose = function (ea) { return function (ab) { + return compose_(ab, ea); +}; }; +exports.compose = compose; +/** + * @category Category + * @since 2.2.3 + */ +function id() { + return { + encode: function_1.identity + }; +} +exports.id = id; +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.3 + */ +exports.URI = 'io-ts/Encoder'; +/** + * @category instances + * @since 2.2.8 + */ +exports.Contravariant = { + URI: exports.URI, + contramap: contramap_ +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.Category = { + URI: exports.URI, + compose: compose_, + id: id +}; diff --git a/components/pexels/node_modules/io-ts/lib/Eq.d.ts b/components/pexels/node_modules/io-ts/lib/Eq.d.ts new file mode 100644 index 0000000000000..a57e29cefcf36 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Eq.d.ts @@ -0,0 +1,127 @@ +import * as E from 'fp-ts/lib/Eq' +import { Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' +import Eq = E.Eq +/** + * @since 2.2.3 + */ +export type URI = E.URI +/** + * @since 2.2.2 + */ +export type TypeOf = E extends Eq ? A : never +/** + * @category primitives + * @since 2.2.2 + */ +export declare const string: Eq +/** + * @category primitives + * @since 2.2.2 + */ +export declare const number: Eq +/** + * @category primitives + * @since 2.2.2 + */ +export declare const boolean: Eq +/** + * @category primitives + * @since 2.2.2 + */ +export declare const UnknownArray: Eq> +/** + * @category primitives + * @since 2.2.2 + */ +export declare const UnknownRecord: Eq> +/** + * @category combinators + * @since 2.2.2 + */ +export declare function nullable(or: Eq): Eq +/** + * @category combinators + * @since 2.2.15 + */ +export declare const struct: (eqs: { + [K in keyof A]: Eq +}) => Eq<{ + [K in keyof A]: A[K] +}> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.2 + * @deprecated + */ +export declare const type: (eqs: { [K in keyof A]: E.Eq }) => E.Eq<{ [K_1 in keyof A]: A[K_1] }> +/** + * @category combinators + * @since 2.2.2 + */ +export declare function partial(properties: { + [K in keyof A]: Eq +}): Eq< + Partial<{ + [K in keyof A]: A[K] + }> +> +/** + * @category combinators + * @since 2.2.2 + */ +export declare const record: (codomain: Eq) => Eq> +/** + * @category combinators + * @since 2.2.2 + */ +export declare const array: (eq: Eq) => Eq> +/** + * @category combinators + * @since 2.2.2 + */ +export declare const tuple: >( + ...components: { + [K in keyof A]: Eq + } +) => Eq +/** + * @category combinators + * @since 2.2.2 + */ +export declare const intersect: (right: E.Eq) => (left: E.Eq) => E.Eq +/** + * @category combinators + * @since 2.2.2 + */ +export declare function sum( + tag: T +): (members: { + [K in keyof A]: Eq> +}) => Eq +/** + * @category combinators + * @since 2.2.2 + */ +export declare function lazy(f: () => Eq): Eq +/** + * @category combinators + * @since 2.2.15 + */ +export declare const readonly: (eq: Eq) => Eq> +/** + * @category instances + * @since 2.2.8 + */ +export declare const Schemable: Schemable1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnknownContainers: WithUnknownContainers1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithRefine: WithRefine1 diff --git a/components/pexels/node_modules/io-ts/lib/Eq.js b/components/pexels/node_modules/io-ts/lib/Eq.js new file mode 100644 index 0000000000000..857a61b742a5c --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Eq.js @@ -0,0 +1,226 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WithRefine = exports.WithUnknownContainers = exports.Schemable = exports.readonly = exports.lazy = exports.sum = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.struct = exports.nullable = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = void 0; +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.2 + */ +var A = __importStar(require("fp-ts/lib/Array")); +var E = __importStar(require("fp-ts/lib/Eq")); +var function_1 = require("fp-ts/lib/function"); +var R = __importStar(require("fp-ts/lib/Record")); +var Schemable_1 = require("./Schemable"); +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.2 + */ +exports.string = E.eqString; +/** + * @category primitives + * @since 2.2.2 + */ +exports.number = E.eqNumber; +/** + * @category primitives + * @since 2.2.2 + */ +exports.boolean = E.eqBoolean; +/** + * @category primitives + * @since 2.2.2 + */ +exports.UnknownArray = E.fromEquals(function (x, y) { return x.length === y.length; }); +/** + * @category primitives + * @since 2.2.2 + */ +exports.UnknownRecord = E.fromEquals(function (x, y) { + for (var k in x) { + if (!(k in y)) { + return false; + } + } + for (var k in y) { + if (!(k in x)) { + return false; + } + } + return true; +}); +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.2 + */ +function nullable(or) { + return { + equals: function (x, y) { return (x === null || y === null ? x === y : or.equals(x, y)); } + }; +} +exports.nullable = nullable; +/** + * @category combinators + * @since 2.2.15 + */ +exports.struct = E.getStructEq; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.2 + * @deprecated + */ +exports.type = exports.struct; +/** + * @category combinators + * @since 2.2.2 + */ +function partial(properties) { + return { + equals: function (x, y) { + for (var k in properties) { + var xk = x[k]; + var yk = y[k]; + if (!(xk === undefined || yk === undefined ? xk === yk : properties[k].equals(xk, yk))) { + return false; + } + } + return true; + } + }; +} +exports.partial = partial; +/** + * @category combinators + * @since 2.2.2 + */ +exports.record = R.getEq; +/** + * @category combinators + * @since 2.2.2 + */ +exports.array = A.getEq; +/** + * @category combinators + * @since 2.2.2 + */ +exports.tuple = E.getTupleEq; +/** + * @category combinators + * @since 2.2.2 + */ +var intersect = function (right) { + return function (left) { return ({ + equals: function (x, y) { return left.equals(x, y) && right.equals(x, y); } + }); }; +}; +exports.intersect = intersect; +/** + * @category combinators + * @since 2.2.2 + */ +function sum(tag) { + return function (members) { + return { + equals: function (x, y) { + var vx = x[tag]; + var vy = y[tag]; + if (vx !== vy) { + return false; + } + return members[vx].equals(x, y); + } + }; + }; +} +exports.sum = sum; +/** + * @category combinators + * @since 2.2.2 + */ +function lazy(f) { + var get = (0, Schemable_1.memoize)(f); + return { + equals: function (x, y) { return get().equals(x, y); } + }; +} +exports.lazy = lazy; +/** + * @category combinators + * @since 2.2.15 + */ +exports.readonly = function_1.identity; +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.8 + */ +exports.Schemable = { + URI: E.URI, + literal: function () { return E.eqStrict; }, + string: exports.string, + number: exports.number, + boolean: exports.boolean, + nullable: nullable, + type: exports.type, + struct: exports.struct, + partial: partial, + record: exports.record, + array: exports.array, + tuple: exports.tuple, + intersect: exports.intersect, + sum: sum, + lazy: function (_, f) { return lazy(f); }, + readonly: exports.readonly +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithUnknownContainers = { + UnknownArray: exports.UnknownArray, + UnknownRecord: exports.UnknownRecord +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithRefine = { + refine: function () { return function (from) { return from; }; } +}; diff --git a/components/pexels/node_modules/io-ts/lib/FreeSemigroup.d.ts b/components/pexels/node_modules/io-ts/lib/FreeSemigroup.d.ts new file mode 100644 index 0000000000000..4054a4ea6dfc0 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/FreeSemigroup.d.ts @@ -0,0 +1,56 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Semigroup } from 'fp-ts/lib/Semigroup' +/** + * @category model + * @since 2.2.7 + */ +export interface Of { + readonly _tag: 'Of' + readonly value: A +} +/** + * @category model + * @since 2.2.7 + */ +export interface Concat { + readonly _tag: 'Concat' + readonly left: FreeSemigroup + readonly right: FreeSemigroup +} +/** + * @category model + * @since 2.2.7 + */ +export type FreeSemigroup = Of | Concat +/** + * @category constructors + * @since 2.2.7 + */ +export declare const of: (a: A) => FreeSemigroup +/** + * @category constructors + * @since 2.2.7 + */ +export declare const concat: (left: FreeSemigroup, right: FreeSemigroup) => FreeSemigroup +/** + * @category destructors + * @since 2.2.7 + */ +export declare const fold: ( + onOf: (value: A) => R, + onConcat: (left: FreeSemigroup, right: FreeSemigroup) => R +) => (f: FreeSemigroup) => R +/** + * @category instances + * @since 2.2.7 + */ +export declare function getSemigroup(): Semigroup> diff --git a/components/pexels/node_modules/io-ts/lib/FreeSemigroup.js b/components/pexels/node_modules/io-ts/lib/FreeSemigroup.js new file mode 100644 index 0000000000000..03a437c8fc291 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/FreeSemigroup.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getSemigroup = exports.fold = exports.concat = exports.of = void 0; +/** + * @category constructors + * @since 2.2.7 + */ +var of = function (a) { return ({ _tag: 'Of', value: a }); }; +exports.of = of; +/** + * @category constructors + * @since 2.2.7 + */ +var concat = function (left, right) { return ({ + _tag: 'Concat', + left: left, + right: right +}); }; +exports.concat = concat; +/** + * @category destructors + * @since 2.2.7 + */ +var fold = function (onOf, onConcat) { + return function (f) { + switch (f._tag) { + case 'Of': + return onOf(f.value); + case 'Concat': + return onConcat(f.left, f.right); + } + }; +}; +exports.fold = fold; +/** + * @category instances + * @since 2.2.7 + */ +function getSemigroup() { + return { concat: exports.concat }; +} +exports.getSemigroup = getSemigroup; diff --git a/components/pexels/node_modules/io-ts/lib/Guard.d.ts b/components/pexels/node_modules/io-ts/lib/Guard.d.ts new file mode 100644 index 0000000000000..b97e2fb8b11ca --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Guard.d.ts @@ -0,0 +1,201 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.0 + */ +import { Refinement } from 'fp-ts/lib/function' +import * as S from './Schemable' +/** + * @category model + * @since 2.2.8 + */ +export interface Guard { + is: (i: I) => i is A +} +/** + * @since 2.2.2 + */ +export type TypeOf = G extends Guard ? A : never +/** + * @since 2.2.8 + */ +export type InputOf = G extends Guard ? I : never +/** + * @category constructors + * @since 2.2.0 + */ +export declare const literal: ( + ...values: A +) => Guard +/** + * @category primitives + * @since 2.2.0 + */ +export declare const string: Guard +/** + * Note: `NaN` is excluded. + * + * @category primitives + * @since 2.2.0 + */ +export declare const number: Guard +/** + * @category primitives + * @since 2.2.0 + */ +export declare const boolean: Guard +/** + * @category primitives + * @since 2.2.0 + */ +export declare const UnknownArray: Guard> +/** + * @category primitives + * @since 2.2.0 + */ +export declare const UnknownRecord: Guard> +/** + * @category combinators + * @since 2.2.0 + */ +export declare const refine: ( + refinement: Refinement +) => (from: Guard) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const nullable: (or: Guard) => Guard +/** + * @category combinators + * @since 2.2.15 + */ +export declare const struct: (properties: { [K in keyof A]: Guard }) => Guard< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.0 + * @deprecated + */ +export declare const type: (properties: { [K in keyof A]: Guard }) => Guard< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * @category combinators + * @since 2.2.0 + */ +export declare const partial: (properties: { [K in keyof A]: Guard }) => Guard< + unknown, + Partial<{ [K_1 in keyof A]: A[K_1] }> +> +/** + * @category combinators + * @since 2.2.0 + */ +export declare const array: (item: Guard) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const record: (codomain: Guard) => Guard> +/** + * @category combinators + * @since 2.2.0 + */ +export declare const tuple: ( + ...components: { [K in keyof A]: Guard } +) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const intersect: (right: Guard) => (left: Guard) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const union: ( + ...members: { [K in keyof A]: Guard } +) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: Guard> }) => Guard +/** + * @category combinators + * @since 2.2.0 + */ +export declare const lazy: (f: () => Guard) => Guard +/** + * @category combinators + * @since 2.2.15 + */ +export declare const readonly: (guard: Guard) => Guard> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const alt: (that: () => Guard) => (me: Guard) => Guard +/** + * @category combinators + * @since 2.2.8 + */ +export declare const zero: () => Guard +/** + * @category combinators + * @since 2.2.8 + */ +export declare const compose: (to: Guard) => (from: Guard) => Guard +/** + * @category combinators + * @since 2.2.8 + */ +export declare const id: () => Guard +/** + * @category instances + * @since 2.2.0 + */ +export declare const URI = 'io-ts/Guard' +/** + * @category instances + * @since 2.2.0 + */ +export type URI = typeof URI +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly [URI]: Guard + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Schemable: S.Schemable1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnknownContainers: S.WithUnknownContainers1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnion: S.WithUnion1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithRefine: S.WithRefine1 diff --git a/components/pexels/node_modules/io-ts/lib/Guard.js b/components/pexels/node_modules/io-ts/lib/Guard.js new file mode 100644 index 0000000000000..7c41e7596dc43 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Guard.js @@ -0,0 +1,337 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.URI = exports.id = exports.compose = exports.zero = exports.alt = exports.readonly = exports.lazy = exports.sum = exports.union = exports.intersect = exports.tuple = exports.record = exports.array = exports.partial = exports.type = exports.struct = exports.nullable = exports.refine = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = void 0; +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.0 + */ +var function_1 = require("fp-ts/lib/function"); +var pipeable_1 = require("fp-ts/lib/pipeable"); +var S = __importStar(require("./Schemable")); +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.0 + */ +var literal = function () { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return ({ + is: function (u) { return values.findIndex(function (a) { return a === u; }) !== -1; } + }); +}; +exports.literal = literal; +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.0 + */ +exports.string = { + is: function (u) { return typeof u === 'string'; } +}; +/** + * Note: `NaN` is excluded. + * + * @category primitives + * @since 2.2.0 + */ +exports.number = { + is: function (u) { return typeof u === 'number' && !isNaN(u); } +}; +/** + * @category primitives + * @since 2.2.0 + */ +exports.boolean = { + is: function (u) { return typeof u === 'boolean'; } +}; +/** + * @category primitives + * @since 2.2.0 + */ +exports.UnknownArray = { + is: Array.isArray +}; +/** + * @category primitives + * @since 2.2.0 + */ +exports.UnknownRecord = { + is: function (u) { return u !== null && typeof u === 'object' && !Array.isArray(u); } +}; +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.0 + */ +var refine = function (refinement) { + return function (from) { return ({ + is: function (i) { return from.is(i) && refinement(i); } + }); }; +}; +exports.refine = refine; +/** + * @category combinators + * @since 2.2.0 + */ +var nullable = function (or) { return ({ + is: function (i) { return i === null || or.is(i); } +}); }; +exports.nullable = nullable; +/** + * @category combinators + * @since 2.2.15 + */ +var struct = function (properties) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.refine)(function (r) { + for (var k in properties) { + if (!(k in r) || !properties[k].is(r[k])) { + return false; + } + } + return true; + })); +}; +exports.struct = struct; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.0 + * @deprecated + */ +exports.type = exports.struct; +/** + * @category combinators + * @since 2.2.0 + */ +var partial = function (properties) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.refine)(function (r) { + for (var k in properties) { + var v = r[k]; + if (v !== undefined && !properties[k].is(v)) { + return false; + } + } + return true; + })); +}; +exports.partial = partial; +/** + * @category combinators + * @since 2.2.0 + */ +var array = function (item) { + return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.refine)(function (us) { return us.every(item.is); })); +}; +exports.array = array; +/** + * @category combinators + * @since 2.2.0 + */ +var record = function (codomain) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.refine)(function (r) { + for (var k in r) { + if (!codomain.is(r[k])) { + return false; + } + } + return true; + })); +}; +exports.record = record; +/** + * @category combinators + * @since 2.2.0 + */ +var tuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return ({ + is: function (u) { return Array.isArray(u) && u.length === components.length && components.every(function (c, i) { return c.is(u[i]); }); } + }); +}; +exports.tuple = tuple; +/** + * @category combinators + * @since 2.2.0 + */ +var intersect = function (right) { + return function (left) { return ({ + is: function (u) { return left.is(u) && right.is(u); } + }); }; +}; +exports.intersect = intersect; +/** + * @category combinators + * @since 2.2.0 + */ +var union = function () { + var members = []; + for (var _i = 0; _i < arguments.length; _i++) { + members[_i] = arguments[_i]; + } + return ({ + is: function (u) { return members.some(function (m) { return m.is(u); }); } + }); +}; +exports.union = union; +/** + * @category combinators + * @since 2.2.0 + */ +var sum = function (tag) { + return function (members) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.refine)(function (r) { + var v = r[tag]; + if (v in members) { + return members[v].is(r); + } + return false; + })); + }; +}; +exports.sum = sum; +/** + * @category combinators + * @since 2.2.0 + */ +var lazy = function (f) { + var get = S.memoize(f); + return { + is: function (u) { return get().is(u); } + }; +}; +exports.lazy = lazy; +/** + * @category combinators + * @since 2.2.15 + */ +exports.readonly = function_1.identity; +/** + * @category combinators + * @since 2.2.8 + */ +var alt = function (that) { + return function (me) { return ({ + is: function (i) { return me.is(i) || that().is(i); } + }); }; +}; +exports.alt = alt; +/** + * @category combinators + * @since 2.2.8 + */ +var zero = function () { return ({ + is: function (_) { return false; } +}); }; +exports.zero = zero; +/** + * @category combinators + * @since 2.2.8 + */ +var compose = function (to) { + return function (from) { return ({ + is: function (i) { return from.is(i) && to.is(i); } + }); }; +}; +exports.compose = compose; +/** + * @category combinators + * @since 2.2.8 + */ +var id = function () { return ({ + is: function (_) { return true; } +}); }; +exports.id = id; +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.0 + */ +exports.URI = 'io-ts/Guard'; +/** + * @category instances + * @since 2.2.8 + */ +exports.Schemable = { + URI: exports.URI, + literal: exports.literal, + string: exports.string, + number: exports.number, + boolean: exports.boolean, + nullable: exports.nullable, + type: exports.type, + struct: exports.struct, + partial: exports.partial, + record: exports.record, + array: exports.array, + tuple: exports.tuple, + intersect: exports.intersect, + sum: exports.sum, + lazy: function (_, f) { return (0, exports.lazy)(f); }, + readonly: exports.readonly +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithUnknownContainers = { + UnknownArray: exports.UnknownArray, + UnknownRecord: exports.UnknownRecord +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithUnion = { + union: exports.union +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithRefine = { + refine: exports.refine +}; diff --git a/components/pexels/node_modules/io-ts/lib/Kleisli.d.ts b/components/pexels/node_modules/io-ts/lib/Kleisli.d.ts new file mode 100644 index 0000000000000..ada32821a9a47 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Kleisli.d.ts @@ -0,0 +1,226 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Alt2C } from 'fp-ts/lib/Alt' +import { Applicative2C } from 'fp-ts/lib/Applicative' +import { Apply2C } from 'fp-ts/lib/Apply' +import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' +import { Lazy, Refinement } from 'fp-ts/lib/function' +import { Functor2C } from 'fp-ts/lib/Functor' +import { Kind2, URIS2 } from 'fp-ts/lib/HKT' +import { Monad2C } from 'fp-ts/lib/Monad' +import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' +import * as S from './Schemable' +/** + * @category model + * @since 2.2.7 + */ +export interface Kleisli { + readonly decode: (i: I) => Kind2 +} +/** + * @category constructors + * @since 2.2.7 + */ +export declare function fromRefinement( + M: MonadThrow2C +): (refinement: Refinement, onError: (i: I) => E) => Kleisli +/** + * @category constructors + * @since 2.2.7 + */ +export declare function literal( + M: MonadThrow2C +): ( + onError: (i: I, values: readonly [S.Literal, ...ReadonlyArray]) => E +) => ], L extends S.Literal = S.Literal>( + ...values: A +) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function mapLeftWithInput( + M: Bifunctor2 +): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function refine( + M: MonadThrow2C & Bifunctor2 +): ( + refinement: (a: A) => a is B, + onError: (a: A) => E +) => (from: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function parse( + M: Monad2C +): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function nullable( + M: Applicative2C & Bifunctor2 +): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.15 + */ +export declare function fromStruct( + M: Applicative2C & Bifunctor2 +): (onPropertyError: (key: string, e: E) => E) =>

>>( + properties: P +) => Kleisli< + M, + { + [K in keyof P]: InputOf + }, + E, + { + [K in keyof P]: TypeOf + } +> +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export declare const fromType: typeof fromStruct +/** + * @category combinators + * @since 2.2.7 + */ +export declare function fromPartial( + M: Applicative2C & Bifunctor2 +): (onPropertyError: (key: string, e: E) => E) =>

>>( + properties: P +) => Kleisli< + M, + Partial<{ + [K in keyof P]: InputOf + }>, + E, + Partial<{ + [K in keyof P]: TypeOf + }> +> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function fromArray( + M: Applicative2C & Bifunctor2 +): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function fromRecord( + M: Applicative2C & Bifunctor2 +): ( + onKeyError: (key: string, e: E) => E +) => (codomain: Kleisli) => Kleisli, E, Record> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function fromTuple( + M: Applicative2C & Bifunctor2 +): (onIndexError: (index: number, e: E) => E) => >>( + ...components: C +) => Kleisli< + M, + { + [K in keyof C]: InputOf + }, + E, + { + [K in keyof C]: TypeOf + } +> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function union( + M: Alt2C & Bifunctor2 +): ( + onMemberError: (index: number, e: E) => E +) => , ...Array>]>( + ...members: MS +) => Kleisli, E, TypeOf> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function intersect( + M: Apply2C +): (right: Kleisli) => (left: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function fromSum( + M: MonadThrow2C +): ( + onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E +) => ( + tag: T +) => >>( + members: MS +) => Kleisli, E, TypeOf> +/** + * @category combinators + * @since 2.2.7 + */ +export declare function lazy( + M: Bifunctor2 +): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function compose( + M: Monad2C +): (ab: Kleisli) => (ia: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.8 + */ +export declare function id(M: Applicative2C): () => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function map( + F: Functor2C +): (f: (a: A) => B) => (ia: Kleisli) => Kleisli +/** + * @category combinators + * @since 2.2.7 + */ +export declare function alt( + A: Alt2C +): (that: Lazy>) => (me: Kleisli) => Kleisli +/** + * @since 2.2.7 + */ +export type TypeOf = KD extends Kleisli ? A : never +/** + * @since 2.2.7 + */ +export type InputOf = KD extends Kleisli ? I : never diff --git a/components/pexels/node_modules/io-ts/lib/Kleisli.js b/components/pexels/node_modules/io-ts/lib/Kleisli.js new file mode 100644 index 0000000000000..4778a838b18e6 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Kleisli.js @@ -0,0 +1,360 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.alt = exports.map = exports.id = exports.compose = exports.lazy = exports.fromSum = exports.intersect = exports.union = exports.fromTuple = exports.fromRecord = exports.fromArray = exports.fromPartial = exports.fromType = exports.fromStruct = exports.nullable = exports.parse = exports.refine = exports.mapLeftWithInput = exports.literal = exports.fromRefinement = void 0; +var E = __importStar(require("fp-ts/lib/Either")); +var G = __importStar(require("./Guard")); +var S = __importStar(require("./Schemable")); +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.7 + */ +function fromRefinement(M) { + return function (refinement, onError) { return ({ + decode: function (i) { return (refinement(i) ? M.of(i) : M.throwError(onError(i))); } + }); }; +} +exports.fromRefinement = fromRefinement; +/** + * @category constructors + * @since 2.2.7 + */ +function literal(M) { + return function (onError) { + return function () { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return ({ + decode: function (i) { return (G.literal.apply(G, values).is(i) ? M.of(i) : M.throwError(onError(i, values))); } + }); + }; + }; +} +exports.literal = literal; +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +function mapLeftWithInput(M) { + return function (f) { return function (decoder) { return ({ + decode: function (i) { return M.mapLeft(decoder.decode(i), function (e) { return f(i, e); }); } + }); }; }; +} +exports.mapLeftWithInput = mapLeftWithInput; +/** + * @category combinators + * @since 2.2.7 + */ +function refine(M) { + return function (refinement, onError) { return function (from) { return compose(M)(fromRefinement(M)(refinement, onError))(from); }; }; +} +exports.refine = refine; +/** + * @category combinators + * @since 2.2.7 + */ +function parse(M) { + return function (decode) { return function (from) { return compose(M)({ decode: decode })(from); }; }; +} +exports.parse = parse; +/** + * @category combinators + * @since 2.2.7 + */ +function nullable(M) { + return function (onError) { + return function (or) { return ({ + decode: function (i) { + return i === null + ? M.of(null) + : M.bimap(or.decode(i), function (e) { return onError(i, e); }, function (a) { return a; }); + } + }); }; + }; +} +exports.nullable = nullable; +/** + * @category combinators + * @since 2.2.15 + */ +function fromStruct(M) { + var traverse = traverseRecordWithIndex(M); + return function (onPropertyError) { return function (properties) { return ({ + decode: function (i) { + return traverse(properties, function (key, decoder) { + return M.mapLeft(decoder.decode(i[key]), function (e) { return onPropertyError(key, e); }); + }); + } + }); }; }; +} +exports.fromStruct = fromStruct; +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +exports.fromType = fromStruct; +/** + * @category combinators + * @since 2.2.7 + */ +function fromPartial(M) { + var traverse = traverseRecordWithIndex(M); + var undefinedProperty = M.of(E.right(undefined)); + var skipProperty = M.of(E.left(undefined)); + return function (onPropertyError) { return function (properties) { return ({ + decode: function (i) { + return M.map(traverse(properties, function (key, decoder) { + var ikey = i[key]; + if (ikey === undefined) { + return key in i + ? // don't strip undefined properties + undefinedProperty + : // don't add missing properties + skipProperty; + } + return M.bimap(decoder.decode(ikey), function (e) { return onPropertyError(key, e); }, function (a) { return E.right(a); }); + }), compactRecord); + } + }); }; }; +} +exports.fromPartial = fromPartial; +/** + * @category combinators + * @since 2.2.7 + */ +function fromArray(M) { + var traverse = traverseArrayWithIndex(M); + return function (onItemError) { return function (item) { return ({ + decode: function (is) { return traverse(is, function (index, i) { return M.mapLeft(item.decode(i), function (e) { return onItemError(index, e); }); }); } + }); }; }; +} +exports.fromArray = fromArray; +/** + * @category combinators + * @since 2.2.7 + */ +function fromRecord(M) { + var traverse = traverseRecordWithIndex(M); + return function (onKeyError) { return function (codomain) { return ({ + decode: function (ir) { return traverse(ir, function (key, i) { return M.mapLeft(codomain.decode(i), function (e) { return onKeyError(key, e); }); }); } + }); }; }; +} +exports.fromRecord = fromRecord; +/** + * @category combinators + * @since 2.2.7 + */ +function fromTuple(M) { + var traverse = traverseArrayWithIndex(M); + return function (onIndexError) { + return function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return ({ + decode: function (is) { + return traverse(components, function (index, decoder) { + return M.mapLeft(decoder.decode(is[index]), function (e) { return onIndexError(index, e); }); + }); + } + }); + }; + }; +} +exports.fromTuple = fromTuple; +/** + * @category combinators + * @since 2.2.7 + */ +function union(M) { + return function (onMemberError) { + return function () { + var members = []; + for (var _i = 0; _i < arguments.length; _i++) { + members[_i] = arguments[_i]; + } + return ({ + decode: function (i) { + var out = M.mapLeft(members[0].decode(i), function (e) { return onMemberError(0, e); }); + var _loop_1 = function (index) { + out = M.alt(out, function () { return M.mapLeft(members[index].decode(i), function (e) { return onMemberError(index, e); }); }); + }; + for (var index = 1; index < members.length; index++) { + _loop_1(index); + } + return out; + } + }); + }; + }; +} +exports.union = union; +/** + * @category combinators + * @since 2.2.7 + */ +function intersect(M) { + return function (right) { + return function (left) { return ({ + decode: function (i) { + return M.ap(M.map(left.decode(i), function (a) { return function (b) { return S.intersect_(a, b); }; }), right.decode(i)); + } + }); }; + }; +} +exports.intersect = intersect; +/** + * @category combinators + * @since 2.2.7 + */ +function fromSum(M) { + return function (onTagError) { + return function (tag) { + return function (members) { + var keys = Object.keys(members); + return { + decode: function (ir) { + var v = ir[tag]; + if (Object.prototype.hasOwnProperty.call(members, v)) { + return members[v].decode(ir); + } + return M.throwError(onTagError(tag, v, keys)); + } + }; + }; + }; + }; +} +exports.fromSum = fromSum; +/** + * @category combinators + * @since 2.2.7 + */ +function lazy(M) { + return function (onError) { + return function (id, f) { + var get = S.memoize(f); + return { + decode: function (u) { return M.mapLeft(get().decode(u), function (e) { return onError(id, e); }); } + }; + }; + }; +} +exports.lazy = lazy; +/** + * @category combinators + * @since 2.2.7 + */ +function compose(M) { + return function (ab) { return function (ia) { return ({ + decode: function (i) { return M.chain(ia.decode(i), ab.decode); } + }); }; }; +} +exports.compose = compose; +/** + * @category combinators + * @since 2.2.8 + */ +function id(M) { + return function () { return ({ + decode: M.of + }); }; +} +exports.id = id; +/** + * @category combinators + * @since 2.2.7 + */ +function map(F) { + return function (f) { return function (ia) { return ({ + decode: function (i) { return F.map(ia.decode(i), f); } + }); }; }; +} +exports.map = map; +/** + * @category combinators + * @since 2.2.7 + */ +function alt(A) { + return function (that) { return function (me) { return ({ + decode: function (i) { return A.alt(me.decode(i), function () { return that().decode(i); }); } + }); }; }; +} +exports.alt = alt; +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- +var traverseArrayWithIndex = function (M) { + return function (as, f) { + return as.reduce(function (mbs, a, i) { + return M.ap(M.map(mbs, function (bs) { return function (b) { + bs.push(b); + return bs; + }; }), f(i, a)); + }, M.of([])); + }; +}; +var traverseRecordWithIndex = function (M) { + return function (r, f) { + var ks = Object.keys(r); + if (ks.length === 0) { + return M.of({}); + } + var fr = M.of({}); + var _loop_2 = function (key) { + fr = M.ap(M.map(fr, function (r) { return function (b) { + r[key] = b; + return r; + }; }), f(key, r[key])); + }; + for (var _i = 0, ks_1 = ks; _i < ks_1.length; _i++) { + var key = ks_1[_i]; + _loop_2(key); + } + return fr; + }; +}; +var compactRecord = function (r) { + var out = {}; + for (var k in r) { + var rk = r[k]; + if (E.isRight(rk)) { + out[k] = rk.right; + } + } + return out; +}; diff --git a/components/pexels/node_modules/io-ts/lib/PathReporter.d.ts b/components/pexels/node_modules/io-ts/lib/PathReporter.d.ts new file mode 100644 index 0000000000000..6050a03572bfd --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/PathReporter.d.ts @@ -0,0 +1,14 @@ +import { ValidationError } from '.' +import { Reporter } from './Reporter' +/** + * @since 1.0.0 + */ +export declare function failure(es: Array): Array +/** + * @since 1.0.0 + */ +export declare function success(): Array +/** + * @since 1.0.0 + */ +export declare const PathReporter: Reporter> diff --git a/components/pexels/node_modules/io-ts/lib/PathReporter.js b/components/pexels/node_modules/io-ts/lib/PathReporter.js new file mode 100644 index 0000000000000..57af54082b771 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/PathReporter.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PathReporter = exports.success = exports.failure = void 0; +/** + * @since 1.0.0 + */ +var Either_1 = require("fp-ts/lib/Either"); +var _1 = require("."); +function stringify(v) { + if (typeof v === 'function') { + return (0, _1.getFunctionName)(v); + } + if (typeof v === 'number' && !isFinite(v)) { + if (isNaN(v)) { + return 'NaN'; + } + return v > 0 ? 'Infinity' : '-Infinity'; + } + return JSON.stringify(v); +} +function getContextPath(context) { + return context.map(function (_a) { + var key = _a.key, type = _a.type; + return "".concat(key, ": ").concat(type.name); + }).join('/'); +} +function getMessage(e) { + return e.message !== undefined + ? e.message + : "Invalid value ".concat(stringify(e.value), " supplied to ").concat(getContextPath(e.context)); +} +/** + * @since 1.0.0 + */ +function failure(es) { + return es.map(getMessage); +} +exports.failure = failure; +/** + * @since 1.0.0 + */ +function success() { + return ['No errors!']; +} +exports.success = success; +/** + * @since 1.0.0 + */ +exports.PathReporter = { + report: (0, Either_1.fold)(failure, success) +}; diff --git a/components/pexels/node_modules/io-ts/lib/Reporter.d.ts b/components/pexels/node_modules/io-ts/lib/Reporter.d.ts new file mode 100644 index 0000000000000..fee031a823925 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Reporter.d.ts @@ -0,0 +1,10 @@ +/** + * @since 1.0.0 + */ +import { Validation } from './index' +/** + * @since 1.0.0 + */ +export interface Reporter { + report: (validation: Validation) => A +} diff --git a/components/pexels/node_modules/io-ts/lib/Reporter.js b/components/pexels/node_modules/io-ts/lib/Reporter.js new file mode 100644 index 0000000000000..c8ad2e549bdc6 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Reporter.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/components/pexels/node_modules/io-ts/lib/Schema.d.ts b/components/pexels/node_modules/io-ts/lib/Schema.d.ts new file mode 100644 index 0000000000000..71235617ce0b5 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Schema.d.ts @@ -0,0 +1,35 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.0 + */ +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' +import { Schemable, Schemable1, Schemable2C } from './Schemable' +/** + * @category model + * @since 2.2.0 + */ +export interface Schema { + (S: Schemable): HKT +} +/** + * @category constructors + * @since 2.2.0 + */ +export declare function make(schema: Schema): Schema +/** + * @since 2.2.0 + */ +export type TypeOf = S extends Schema ? A : never +/** + * @since 2.2.3 + */ +export declare function interpreter( + S: Schemable2C +): (schema: Schema) => Kind2 +export declare function interpreter(S: Schemable1): (schema: Schema) => Kind diff --git a/components/pexels/node_modules/io-ts/lib/Schema.js b/components/pexels/node_modules/io-ts/lib/Schema.js new file mode 100644 index 0000000000000..98519fc58d6e2 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Schema.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.interpreter = exports.make = void 0; +var Schemable_1 = require("./Schemable"); +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.0 + */ +function make(schema) { + return (0, Schemable_1.memoize)(schema); +} +exports.make = make; +function interpreter(S) { + return function (schema) { return schema(S); }; +} +exports.interpreter = interpreter; diff --git a/components/pexels/node_modules/io-ts/lib/Schemable.d.ts b/components/pexels/node_modules/io-ts/lib/Schemable.d.ts new file mode 100644 index 0000000000000..0d579c33844d0 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Schemable.d.ts @@ -0,0 +1,254 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.0 + */ +import { Refinement } from 'fp-ts/lib/function' +import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' +/** + * @since 2.2.0 + */ +export type Literal = string | number | boolean | null +/** + * @since 2.2.3 + */ +export interface Schemable { + readonly URI: S + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => HKT + readonly string: HKT + readonly number: HKT + readonly boolean: HKT + readonly nullable: (or: HKT) => HKT + /** @deprecated */ + readonly type: (properties: { + [K in keyof A]: HKT + }) => HKT< + S, + { + [K in keyof A]: A[K] + } + > + readonly struct: (properties: { + [K in keyof A]: HKT + }) => HKT< + S, + { + [K in keyof A]: A[K] + } + > + readonly partial: (properties: { + [K in keyof A]: HKT + }) => HKT< + S, + Partial<{ + [K in keyof A]: A[K] + }> + > + readonly record: (codomain: HKT) => HKT> + readonly array: (item: HKT) => HKT> + readonly tuple: >( + ...components: { + [K in keyof A]: HKT + } + ) => HKT + readonly intersect: (right: HKT) => (left: HKT) => HKT + readonly sum: ( + tag: T + ) => (members: { + [K in keyof A]: HKT> + }) => HKT + readonly lazy: (id: string, f: () => HKT) => HKT + readonly readonly: (sa: HKT) => HKT> +} +/** + * @since 2.2.3 + */ +export interface Schemable1 { + readonly URI: S + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => Kind + readonly string: Kind + readonly number: Kind + readonly boolean: Kind + readonly nullable: (or: Kind) => Kind + /** @deprecated */ + readonly type: (properties: { + [K in keyof A]: Kind + }) => Kind< + S, + { + [K in keyof A]: A[K] + } + > + readonly struct: (properties: { + [K in keyof A]: Kind + }) => Kind< + S, + { + [K in keyof A]: A[K] + } + > + readonly partial: (properties: { + [K in keyof A]: Kind + }) => Kind< + S, + Partial<{ + [K in keyof A]: A[K] + }> + > + readonly record: (codomain: Kind) => Kind> + readonly array: (item: Kind) => Kind> + readonly tuple: >( + ...components: { + [K in keyof A]: Kind + } + ) => Kind + readonly intersect: (right: Kind) => (left: Kind) => Kind + readonly sum: ( + tag: T + ) => (members: { + [K in keyof A]: Kind> + }) => Kind + readonly lazy: (id: string, f: () => Kind) => Kind + readonly readonly: (sa: Kind) => Kind> +} +/** + * @since 2.2.8 + */ +export interface Schemable2C { + readonly URI: S + readonly literal: ], L extends Literal = Literal>( + ...values: A + ) => Kind2 + readonly string: Kind2 + readonly number: Kind2 + readonly boolean: Kind2 + readonly nullable: (or: Kind2) => Kind2 + /** @deprecated */ + readonly type: (properties: { + [K in keyof A]: Kind2 + }) => Kind2< + S, + E, + { + [K in keyof A]: A[K] + } + > + readonly struct: (properties: { + [K in keyof A]: Kind2 + }) => Kind2< + S, + E, + { + [K in keyof A]: A[K] + } + > + readonly partial: (properties: { + [K in keyof A]: Kind2 + }) => Kind2< + S, + E, + Partial<{ + [K in keyof A]: A[K] + }> + > + readonly record: (codomain: Kind2) => Kind2> + readonly array: (item: Kind2) => Kind2> + readonly tuple: >( + ...components: { + [K in keyof A]: Kind2 + } + ) => Kind2 + readonly intersect: (right: Kind2) => (left: Kind2) => Kind2 + readonly sum: ( + tag: T + ) => (members: { + [K in keyof A]: Kind2> + }) => Kind2 + readonly lazy: (id: string, f: () => Kind2) => Kind2 + readonly readonly: (sa: Kind2) => Kind2> +} +/** + * @since 2.2.3 + */ +export interface WithUnknownContainers { + readonly UnknownArray: HKT> + readonly UnknownRecord: HKT> +} +/** + * @since 2.2.3 + */ +export interface WithUnknownContainers1 { + readonly UnknownArray: Kind> + readonly UnknownRecord: Kind> +} +/** + * @since 2.2.8 + */ +export interface WithUnknownContainers2C { + readonly UnknownArray: Kind2> + readonly UnknownRecord: Kind2> +} +/** + * @since 2.2.3 + */ +export interface WithUnion { + readonly union: ]>( + ...members: { + [K in keyof A]: HKT + } + ) => HKT +} +/** + * @since 2.2.3 + */ +export interface WithUnion1 { + readonly union: ]>( + ...members: { + [K in keyof A]: Kind + } + ) => Kind +} +/** + * @since 2.2.8 + */ +export interface WithUnion2C { + readonly union: ]>( + ...members: { + [K in keyof A]: Kind2 + } + ) => Kind2 +} +/** + * @since 2.2.3 + */ +export interface WithRefine { + readonly refine: (refinement: Refinement, id: string) => (from: HKT) => HKT +} +/** + * @since 2.2.3 + */ +export interface WithRefine1 { + readonly refine: (refinement: Refinement, id: string) => (from: Kind) => Kind +} +/** + * @since 2.2.8 + */ +export interface WithRefine2C { + readonly refine: ( + refinement: Refinement, + id: string + ) => (from: Kind2) => Kind2 +} +/** + * @since 2.2.0 + */ +export declare function memoize(f: (a: A) => B): (a: A) => B diff --git a/components/pexels/node_modules/io-ts/lib/Schemable.js b/components/pexels/node_modules/io-ts/lib/Schemable.js new file mode 100644 index 0000000000000..793f888adb74e --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Schemable.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.intersect_ = exports.memoize = void 0; +/** + * @since 2.2.0 + */ +function memoize(f) { + var cache = new Map(); + return function (a) { + if (!cache.has(a)) { + var b = f(a); + cache.set(a, b); + return b; + } + return cache.get(a); + }; +} +exports.memoize = memoize; +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- +var typeOf = function (x) { return (x === null ? 'null' : typeof x); }; +/** + * @internal + */ +var intersect_ = function (a, b) { + if (a !== undefined && b !== undefined) { + var tx = typeOf(a); + var ty = typeOf(b); + if (tx === 'object' || ty === 'object') { + return Object.assign({}, a, b); + } + } + return b; +}; +exports.intersect_ = intersect_; diff --git a/components/pexels/node_modules/io-ts/lib/TaskDecoder.d.ts b/components/pexels/node_modules/io-ts/lib/TaskDecoder.d.ts new file mode 100644 index 0000000000000..b6cb727316b3d --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/TaskDecoder.d.ts @@ -0,0 +1,349 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Alt2 } from 'fp-ts/lib/Alt' +import { Category2 } from 'fp-ts/lib/Category' +import { Refinement } from 'fp-ts/lib/function' +import { Functor2 } from 'fp-ts/lib/Functor' +import * as TE from 'fp-ts/lib/TaskEither' +import * as D from './Decoder' +import * as G from './Guard' +import * as K from './Kleisli' +import * as S from './Schemable' +/** + * @category model + * @since 2.2.8 + */ +export interface TaskDecoder extends K.Kleisli {} +/** + * @category DecodeError + * @since 2.2.7 + */ +export type DecodeError = D.DecodeError +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const error: (actual: unknown, message: string) => DecodeError +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const success: (a: A) => TE.TaskEither +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const failure: (actual: unknown, message: string) => TE.TaskEither +/** + * @category constructors + * @since 2.2.7 + */ +export declare const fromDecoder: (decoder: D.Decoder) => TaskDecoder +/** + * @category constructors + * @since 2.2.8 + */ +export declare const fromRefinement: ( + refinement: Refinement, + expected: string +) => TaskDecoder +/** + * @category constructors + * @since 2.2.7 + */ +export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder +/** + * @category constructors + * @since 2.2.7 + */ +export declare const literal: ], L extends S.Literal = S.Literal>( + ...values: A +) => TaskDecoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const string: TaskDecoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const number: TaskDecoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const boolean: TaskDecoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const UnknownArray: TaskDecoder> +/** + * @category primitives + * @since 2.2.7 + */ +export declare const UnknownRecord: TaskDecoder> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const mapLeftWithInput: ( + f: (input: I, e: DecodeError) => DecodeError +) => (decoder: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.9 + */ +export declare const withMessage: ( + message: (input: I, e: DecodeError) => string +) => (decoder: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const refine: ( + refinement: Refinement, + id: string +) => (from: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const parse: ( + parser: (a: A) => TE.TaskEither +) => (from: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const nullable: (or: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.15 + */ +export declare const fromStruct:

>>( + properties: P +) => TaskDecoder< + { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, + { [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> } +> +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +export declare const fromType:

>>( + properties: P +) => TaskDecoder< + { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, + { [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> } +> +/** + * @category combinators + * @since 2.2.15 + */ +export declare const struct: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +export declare const type: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< + unknown, + { [K_1 in keyof A]: A[K_1] } +> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromPartial:

>>( + properties: P +) => TaskDecoder< + Partial<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }>, + Partial<{ [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> }> +> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const partial: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< + unknown, + Partial<{ [K_1 in keyof A]: A[K_1] }> +> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromArray: (item: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const array: (item: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromRecord: ( + codomain: TaskDecoder +) => TaskDecoder, Record> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const record: (codomain: TaskDecoder) => TaskDecoder> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromTuple: []>( + ...components: C +) => TaskDecoder< + { [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, + { [K_1 in keyof C]: K.TypeOf<'TaskEither', C[K_1]> } +> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const tuple: ( + ...components: { [K in keyof A]: TaskDecoder } +) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const union: , ...Array>]>( + ...members: MS +) => TaskDecoder, TypeOf> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const intersect: ( + right: TaskDecoder +) => (left: TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromSum: ( + tag: T +) => >>( + members: MS +) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const sum: ( + tag: T +) => (members: { [K in keyof A]: TaskDecoder> }) => TaskDecoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder +/** + * @category combinators + * @since 2.2.15 + */ +export declare const readonly: (decoder: TaskDecoder) => TaskDecoder> +/** + * @category Functor + * @since 2.2.7 + */ +export declare const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder +/** + * @category Alt + * @since 2.2.7 + */ +export declare const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder +/** + * @category Semigroupoid + * @since 2.2.8 + */ +export declare const compose: (to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder +/** + * @category Category + * @since 2.2.8 + */ +export declare const id: () => TaskDecoder +/** + * @category instances + * @since 2.2.7 + */ +export declare const URI = 'io-ts/TaskDecoder' +/** + * @category instances + * @since 2.2.7 + */ +export type URI = typeof URI +declare module 'fp-ts/lib/HKT' { + interface URItoKind2 { + readonly [URI]: TaskDecoder + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Functor: Functor2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Alt: Alt2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Category: Category2 +/** + * @category instances + * @since 2.2.8 + */ +export declare const Schemable: S.Schemable2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnknownContainers: S.WithUnknownContainers2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnion: S.WithUnion2C +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithRefine: S.WithRefine2C +/** + * @since 2.2.7 + */ +export type TypeOf = K.TypeOf +/** + * @since 2.2.8 + */ +export type InputOf = K.InputOf +/** + * @since 2.2.7 + */ +export declare const draw: (e: DecodeError) => string diff --git a/components/pexels/node_modules/io-ts/lib/TaskDecoder.js b/components/pexels/node_modules/io-ts/lib/TaskDecoder.js new file mode 100644 index 0000000000000..8fb102cd0edc1 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/TaskDecoder.js @@ -0,0 +1,457 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.stringify = exports.draw = exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.Category = exports.Alt = exports.Functor = exports.URI = exports.id = exports.compose = exports.alt = exports.map = exports.readonly = exports.lazy = exports.sum = exports.fromSum = exports.intersect = exports.union = exports.tuple = exports.fromTuple = exports.record = exports.fromRecord = exports.array = exports.fromArray = exports.partial = exports.fromPartial = exports.type = exports.struct = exports.fromType = exports.fromStruct = exports.nullable = exports.parse = exports.refine = exports.withMessage = exports.mapLeftWithInput = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = exports.fromGuard = exports.fromRefinement = exports.fromDecoder = exports.failure = exports.success = exports.error = void 0; +var E = __importStar(require("fp-ts/lib/Either")); +var function_1 = require("fp-ts/lib/function"); +var pipeable_1 = require("fp-ts/lib/pipeable"); +var T = __importStar(require("fp-ts/lib/Task")); +var TE = __importStar(require("fp-ts/lib/TaskEither")); +var DE = __importStar(require("./DecodeError")); +var D = __importStar(require("./Decoder")); +var FS = __importStar(require("./FreeSemigroup")); +var K = __importStar(require("./Kleisli")); +// ------------------------------------------------------------------------------------- +// Kleisli config +// ------------------------------------------------------------------------------------- +var M = { + URI: TE.URI, + _E: undefined, + map: function (fa, f) { return (0, pipeable_1.pipe)(fa, TE.map(f)); }, + ap: function (fab, fa) { + return (0, pipeable_1.pipe)((0, pipeable_1.pipe)(fab, T.map(function (h) { return function (ga) { return D.ap(h, ga); }; })), T.ap(fa)); + }, + of: TE.right, + chain: function (ma, f) { return (0, pipeable_1.pipe)(ma, TE.chain(f)); }, + throwError: TE.left, + bimap: function (fa, f, g) { return (0, pipeable_1.pipe)(fa, TE.bimap(f, g)); }, + mapLeft: function (fa, f) { return (0, pipeable_1.pipe)(fa, TE.mapLeft(f)); }, + alt: function (me, that) { + return (0, pipeable_1.pipe)(me, T.chain(function (e1) { + return E.isRight(e1) + ? T.of(e1) + : (0, pipeable_1.pipe)(that(), T.map(function (e2) { return (E.isLeft(e2) ? E.left(D.SE.concat(e1.left, e2.left)) : e2); })); + })); + } +}; +/** + * @category DecodeError + * @since 2.2.7 + */ +exports.error = D.error; +/** + * @category DecodeError + * @since 2.2.7 + */ +exports.success = TE.right; +/** + * @category DecodeError + * @since 2.2.7 + */ +var failure = function (actual, message) { + return TE.left(D.error(actual, message)); +}; +exports.failure = failure; +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.7 + */ +var fromDecoder = function (decoder) { return ({ + decode: TE.fromEitherK(decoder.decode) +}); }; +exports.fromDecoder = fromDecoder; +/** + * @category constructors + * @since 2.2.8 + */ +var fromRefinement = function (refinement, expected) { + return (0, exports.fromDecoder)(D.fromRefinement(refinement, expected)); +}; +exports.fromRefinement = fromRefinement; +/** + * @category constructors + * @since 2.2.7 + */ +var fromGuard = function (guard, expected) { + return (0, exports.fromRefinement)(guard.is, expected); +}; +exports.fromGuard = fromGuard; +/** + * @category constructors + * @since 2.2.7 + */ +exports.literal = +/*#__PURE__*/ +K.literal(M)(function (u, values) { return (0, exports.error)(u, values.map(function (value) { return JSON.stringify(value); }).join(' | ')); }); +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.7 + */ +exports.string = +/*#__PURE__*/ +(0, exports.fromDecoder)(D.string); +/** + * @category primitives + * @since 2.2.7 + */ +exports.number = +/*#__PURE__*/ +(0, exports.fromDecoder)(D.number); +/** + * @category primitives + * @since 2.2.7 + */ +exports.boolean = +/*#__PURE__*/ +(0, exports.fromDecoder)(D.boolean); +/** + * @category primitives + * @since 2.2.7 + */ +exports.UnknownArray = +/*#__PURE__*/ +(0, exports.fromDecoder)(D.UnknownArray); +/** + * @category primitives + * @since 2.2.7 + */ +exports.UnknownRecord = +/*#__PURE__*/ +(0, exports.fromDecoder)(D.UnknownRecord); +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.7 + */ +exports.mapLeftWithInput = +/*#__PURE__*/ +K.mapLeftWithInput(M); +/** + * @category combinators + * @since 2.2.9 + */ +var withMessage = function (message) { + return (0, exports.mapLeftWithInput)(function (input, e) { return FS.of(DE.wrap(message(input, e), e)); }); +}; +exports.withMessage = withMessage; +/** + * @category combinators + * @since 2.2.7 + */ +var refine = function (refinement, id) { return K.refine(M)(refinement, function (a) { return (0, exports.error)(a, id); }); }; +exports.refine = refine; +/** + * @category combinators + * @since 2.2.7 + */ +exports.parse = +/*#__PURE__*/ +K.parse(M); +/** + * @category combinators + * @since 2.2.7 + */ +exports.nullable = +/*#__PURE__*/ +K.nullable(M)(function (u, e) { return FS.concat(FS.of(DE.member(0, (0, exports.error)(u, 'null'))), FS.of(DE.member(1, e))); }); +/** + * @category combinators + * @since 2.2.15 + */ +var fromStruct = function (properties) { + return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); +}; +exports.fromStruct = fromStruct; +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +exports.fromType = exports.fromStruct; +/** + * @category combinators + * @since 2.2.15 + */ +var struct = function (properties) { return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromStruct)(properties))); }; +exports.struct = struct; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.7 + * @deprecated + */ +exports.type = exports.struct; +/** + * @category combinators + * @since 2.2.8 + */ +var fromPartial = function (properties) { + return K.fromPartial(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(properties); +}; +exports.fromPartial = fromPartial; +/** + * @category combinators + * @since 2.2.7 + */ +var partial = function (properties) { return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromPartial)(properties))); }; +exports.partial = partial; +/** + * @category combinators + * @since 2.2.8 + */ +var fromArray = function (item) { + return K.fromArray(M)(function (i, e) { return FS.of(DE.index(i, DE.optional, e)); })(item); +}; +exports.fromArray = fromArray; +/** + * @category combinators + * @since 2.2.7 + */ +var array = function (item) { + return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)((0, exports.fromArray)(item))); +}; +exports.array = array; +/** + * @category combinators + * @since 2.2.8 + */ +var fromRecord = function (codomain) { + return K.fromRecord(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(codomain); +}; +exports.fromRecord = fromRecord; +/** + * @category combinators + * @since 2.2.7 + */ +var record = function (codomain) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromRecord)(codomain))); +}; +exports.record = record; +/** + * @category combinators + * @since 2.2.8 + */ +var fromTuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return K.fromTuple(M)(function (i, e) { return FS.of(DE.index(i, DE.required, e)); }).apply(void 0, components); +}; +exports.fromTuple = fromTuple; +/** + * @category combinators + * @since 2.2.7 + */ +var tuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)(exports.fromTuple.apply(void 0, components))); +}; +exports.tuple = tuple; +/** + * @category combinators + * @since 2.2.7 + */ +exports.union = +/*#__PURE__*/ +K.union(M)(function (i, e) { return FS.of(DE.member(i, e)); }); +/** + * @category combinators + * @since 2.2.7 + */ +exports.intersect = +/*#__PURE__*/ +K.intersect(M); +/** + * @category combinators + * @since 2.2.8 + */ +var fromSum = function (tag) { + return function (members) { + return K.fromSum(M)(function (tag, value, keys) { + return FS.of(DE.key(tag, DE.required, (0, exports.error)(value, keys.length === 0 ? 'never' : keys.map(function (k) { return JSON.stringify(k); }).join(' | ')))); + })(tag)(members); + }; +}; +exports.fromSum = fromSum; +/** + * @category combinators + * @since 2.2.7 + */ +var sum = function (tag) { + return function (members) { + return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromSum)(tag)(members))); + }; +}; +exports.sum = sum; +/** + * @category combinators + * @since 2.2.7 + */ +exports.lazy = +/*#__PURE__*/ +K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); +/** + * @category combinators + * @since 2.2.15 + */ +exports.readonly = function_1.identity; +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- +var map_ = function (fa, f) { return (0, pipeable_1.pipe)(fa, (0, exports.map)(f)); }; +var alt_ = function (me, that) { return (0, pipeable_1.pipe)(me, (0, exports.alt)(that)); }; +var compose_ = function (ab, la) { return (0, pipeable_1.pipe)(la, (0, exports.compose)(ab)); }; +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- +/** + * @category Functor + * @since 2.2.7 + */ +exports.map = +/*#__PURE__*/ +K.map(M); +/** + * @category Alt + * @since 2.2.7 + */ +exports.alt = +/*#__PURE__*/ +K.alt(M); +/** + * @category Semigroupoid + * @since 2.2.8 + */ +exports.compose = +/*#__PURE__*/ +K.compose(M); +/** + * @category Category + * @since 2.2.8 + */ +exports.id = +/*#__PURE__*/ +K.id(M); +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.7 + */ +exports.URI = 'io-ts/TaskDecoder'; +/** + * @category instances + * @since 2.2.8 + */ +exports.Functor = { + URI: exports.URI, + map: map_ +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.Alt = { + URI: exports.URI, + map: map_, + alt: alt_ +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.Category = { + URI: exports.URI, + compose: compose_, + id: exports.id +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.Schemable = { + URI: exports.URI, + literal: exports.literal, + string: exports.string, + number: exports.number, + boolean: exports.boolean, + nullable: exports.nullable, + type: exports.type, + struct: exports.struct, + partial: exports.partial, + record: exports.record, + array: exports.array, + tuple: exports.tuple, + intersect: exports.intersect, + sum: exports.sum, + lazy: exports.lazy, + readonly: exports.readonly +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithUnknownContainers = { + UnknownArray: exports.UnknownArray, + UnknownRecord: exports.UnknownRecord +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithUnion = { + union: exports.union +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithRefine = { + refine: exports.refine +}; +/** + * @since 2.2.7 + */ +exports.draw = D.draw; +/** + * @internal + */ +exports.stringify = TE.fold(function (e) { return T.of((0, exports.draw)(e)); }, function (a) { return T.of(JSON.stringify(a, null, 2)); }); diff --git a/components/pexels/node_modules/io-ts/lib/ThrowReporter.d.ts b/components/pexels/node_modules/io-ts/lib/ThrowReporter.d.ts new file mode 100644 index 0000000000000..d759e80da0b13 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/ThrowReporter.d.ts @@ -0,0 +1,7 @@ +import { Reporter } from './Reporter' +/** + * @category deprecated + * @since 1.0.0 + * @deprecated + */ +export declare const ThrowReporter: Reporter diff --git a/components/pexels/node_modules/io-ts/lib/ThrowReporter.js b/components/pexels/node_modules/io-ts/lib/ThrowReporter.js new file mode 100644 index 0000000000000..8ff47cae534c3 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/ThrowReporter.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ThrowReporter = void 0; +/** + * @deprecated + * @since 1.0.0 + */ +var Either_1 = require("fp-ts/lib/Either"); +var PathReporter_1 = require("./PathReporter"); +/** + * @category deprecated + * @since 1.0.0 + * @deprecated + */ +exports.ThrowReporter = { + report: function (validation) { + if ((0, Either_1.isLeft)(validation)) { + throw new Error(PathReporter_1.PathReporter.report(validation).join('\n')); + } + } +}; diff --git a/components/pexels/node_modules/io-ts/lib/Type.d.ts b/components/pexels/node_modules/io-ts/lib/Type.d.ts new file mode 100644 index 0000000000000..19617912ba813 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Type.d.ts @@ -0,0 +1,149 @@ +import { Refinement } from 'fp-ts/lib/function' +import * as t from './index' +import * as S from './Schemable' +/** + * @category model + * @since 2.2.3 + */ +export interface Type extends t.Type {} +/** + * @category constructors + * @since 2.2.3 + */ +export declare const literal: ( + ...values: A +) => Type +/** + * @category primitives + * @since 2.2.3 + */ +export declare const string: Type +/** + * @category primitives + * @since 2.2.3 + */ +export declare const number: Type +/** + * @category primitives + * @since 2.2.3 + */ +export declare const boolean: Type +/** + * @category primitives + * @since 2.2.3 + */ +export declare const UnknownArray: Type> +/** + * @category primitives + * @since 2.2.3 + */ +export declare const UnknownRecord: Type> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const refine: (refinement: Refinement, id: string) => (from: Type) => Type +/** + * @category combinators + * @since 2.2.3 + */ +export declare const nullable: (or: Type) => Type +/** + * @category combinators + * @since 2.2.15 + */ +export declare const struct: (properties: { [K in keyof A]: Type }) => Type<{ [K_1 in keyof A]: A[K_1] }> +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export declare const type: (properties: { [K in keyof A]: Type }) => Type<{ [K_1 in keyof A]: A[K_1] }> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const partial: (properties: { [K in keyof A]: Type }) => Type< + Partial<{ [K_1 in keyof A]: A[K_1] }> +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const record: (codomain: Type) => Type> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const array: (item: Type) => Type +/** + * @category combinators + * @since 2.2.3 + */ +export declare const tuple: (...components: { [K in keyof A]: Type }) => Type +/** + * @category combinators + * @since 2.2.3 + */ +export declare const intersect: (right: Type) => (left: Type) => Type +/** + * @category combinators + * @since 2.2.3 + */ +export declare const lazy: (id: string, f: () => Type) => Type +/** + * @category combinators + * @since 2.2.15 + */ +export declare const readonly: (type: Type) => Type> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const sum: ( + _tag: T +) => (members: { [K in keyof A]: Type> }) => Type +/** + * @category combinators + * @since 2.2.3 + */ +export declare const union: ( + ...members: { [K in keyof A]: Type } +) => Type +/** + * @category instances + * @since 2.2.3 + */ +export declare const URI = 'io-ts/Type' +/** + * @category instances + * @since 2.2.3 + */ +export type URI = typeof URI +declare module 'fp-ts/lib/HKT' { + interface URItoKind { + readonly [URI]: Type + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Schemable: S.Schemable1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnknownContainers: S.WithUnknownContainers1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithUnion: S.WithUnion1 +/** + * @category instances + * @since 2.2.8 + */ +export declare const WithRefine: S.WithRefine1 diff --git a/components/pexels/node_modules/io-ts/lib/Type.js b/components/pexels/node_modules/io-ts/lib/Type.js new file mode 100644 index 0000000000000..30ca476d72b02 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/Type.js @@ -0,0 +1,248 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.URI = exports.union = exports.sum = exports.readonly = exports.lazy = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.struct = exports.nullable = exports.refine = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = void 0; +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.3 + */ +var E = __importStar(require("fp-ts/lib/Either")); +var function_1 = require("fp-ts/lib/function"); +var pipeable_1 = require("fp-ts/lib/pipeable"); +var t = __importStar(require("./index")); +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.3 + */ +var literal = function () { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return t.union(values.map(function (v) { return t.literal(v); })); +}; +exports.literal = literal; +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.3 + */ +exports.string = t.string; +/** + * @category primitives + * @since 2.2.3 + */ +exports.number = new t.Type(t.number.name, t.number.is, function (u, c) { + return (0, pipeable_1.pipe)(t.number.decode(u), E.chain(function (n) { return (isNaN(n) ? t.failure(u, c) : t.success(n)); })); +}, t.number.encode); +/** + * @category primitives + * @since 2.2.3 + */ +exports.boolean = t.boolean; +/** + * @category primitives + * @since 2.2.3 + */ +exports.UnknownArray = t.UnknownArray; +/** + * @category primitives + * @since 2.2.3 + */ +exports.UnknownRecord = t.UnknownRecord; +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.3 + */ +var refine = function (refinement, id) { + return function (from) { + // tslint:disable-next-line: deprecation + return (t.refinement(from, refinement, id)); + }; +}; +exports.refine = refine; +/** + * @category combinators + * @since 2.2.3 + */ +var nullable = function (or) { return t.union([t.null, or]); }; +exports.nullable = nullable; +/** + * @category combinators + * @since 2.2.15 + */ +var struct = function (properties) { + return t.type(properties); +}; +exports.struct = struct; +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +exports.type = exports.struct; +/** + * @category combinators + * @since 2.2.3 + */ +var partial = function (properties) { + return t.partial(properties); +}; +exports.partial = partial; +/** + * @category combinators + * @since 2.2.3 + */ +var record = function (codomain) { return t.record(t.string, codomain); }; +exports.record = record; +/** + * @category combinators + * @since 2.2.3 + */ +var array = function (item) { return t.array(item); }; +exports.array = array; +/** + * @category combinators + * @since 2.2.3 + */ +var tuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return t.tuple(components); +}; +exports.tuple = tuple; +/** + * @category combinators + * @since 2.2.3 + */ +var intersect = function (right) { + return function (left) { + return t.intersection([left, right]); + }; +}; +exports.intersect = intersect; +/** + * @category combinators + * @since 2.2.3 + */ +var lazy = function (id, f) { return t.recursion(id, f); }; +exports.lazy = lazy; +/** + * @category combinators + * @since 2.2.15 + */ +exports.readonly = function_1.identity; +/** + * @category combinators + * @since 2.2.3 + */ +var sum = function (_tag) { + return function (members) { + return t.union(Object.values(members)); + }; +}; +exports.sum = sum; +/** + * @category combinators + * @since 2.2.3 + */ +var union = function () { + var members = []; + for (var _i = 0; _i < arguments.length; _i++) { + members[_i] = arguments[_i]; + } + return t.union(members); +}; +exports.union = union; +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.3 + */ +exports.URI = 'io-ts/Type'; +/** + * @category instances + * @since 2.2.8 + */ +exports.Schemable = { + URI: exports.URI, + literal: exports.literal, + string: exports.string, + number: exports.number, + boolean: exports.boolean, + nullable: exports.nullable, + type: exports.type, + struct: exports.struct, + partial: exports.partial, + record: exports.record, + array: exports.array, + tuple: exports.tuple, + intersect: exports.intersect, + sum: exports.sum, + lazy: exports.lazy, + readonly: exports.readonly +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithUnknownContainers = { + UnknownArray: exports.UnknownArray, + UnknownRecord: exports.UnknownRecord +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithUnion = { + union: exports.union +}; +/** + * @category instances + * @since 2.2.8 + */ +exports.WithRefine = { + refine: exports.refine +}; diff --git a/components/pexels/node_modules/io-ts/lib/index.d.ts b/components/pexels/node_modules/io-ts/lib/index.d.ts new file mode 100644 index 0000000000000..24ed1de082b96 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/index.d.ts @@ -0,0 +1,1374 @@ +/** + * @since 1.0.0 + */ +import { Either } from 'fp-ts/lib/Either' +import { Predicate, Refinement } from 'fp-ts/lib/function' +/** + * @category Decode error + * @since 1.0.0 + */ +export interface ContextEntry { + readonly key: string + readonly type: Decoder + /** the input data */ + readonly actual?: unknown +} +/** + * @category Decode error + * @since 1.0.0 + */ +export interface Context extends ReadonlyArray {} +/** + * @category Decode error + * @since 1.0.0 + */ +export interface ValidationError { + /** the offending (sub)value */ + readonly value: unknown + /** where the error originated */ + readonly context: Context + /** optional custom error message */ + readonly message?: string +} +/** + * @category Decode error + * @since 1.0.0 + */ +export interface Errors extends Array {} +/** + * @category Decode error + * @since 1.0.0 + */ +export type Validation = Either +/** + * @category Decode error + * @since 1.0.0 + */ +export declare const failures: (errors: Errors) => Validation +/** + * @category Decode error + * @since 1.0.0 + */ +export declare const failure: (value: unknown, context: Context, message?: string) => Validation +/** + * @category Decode error + * @since 1.0.0 + */ +export declare const success: (value: T) => Validation +/** + * @since 1.0.0 + */ +export type Is = (u: unknown) => u is A +/** + * @since 1.0.0 + */ +export type Validate = (i: I, context: Context) => Validation +/** + * @since 1.0.0 + */ +export type Decode = (i: I) => Validation +/** + * @since 1.0.0 + */ +export type Encode = (a: A) => O +/** + * @since 1.0.0 + */ +export interface Any extends Type {} +/** + * @since 1.0.0 + */ +export interface Mixed extends Type {} +/** + * @category Codec + * @since 1.0.0 + */ +export type TypeOf = C['_A'] +/** + * @category Codec + * @since 1.0.0 + */ +export type InputOf = C['_I'] +/** + * @category Codec + * @since 1.0.0 + */ +export type OutputOf = C['_O'] +/** + * @category Codec + * @since 1.0.0 + */ +export interface Decoder { + readonly name: string + readonly validate: Validate + readonly decode: Decode +} +/** + * @category Codec + * @since 1.0.0 + */ +export interface Encoder { + readonly encode: Encode +} +/** + * @category Codec + * @since 1.0.0 + */ +export declare class Type implements Decoder, Encoder { + /** a unique name for this codec */ + readonly name: string + /** a custom type guard */ + readonly is: Is + /** succeeds if a value of type I can be decoded to a value of type A */ + readonly validate: Validate + /** converts a value of type A to a value of type O */ + readonly encode: Encode + /** + * @since 1.0.0 + */ + readonly _A: A + /** + * @since 1.0.0 + */ + readonly _O: O + /** + * @since 1.0.0 + */ + readonly _I: I + constructor( + /** a unique name for this codec */ + name: string, + /** a custom type guard */ + is: Is, + /** succeeds if a value of type I can be decoded to a value of type A */ + validate: Validate, + /** converts a value of type A to a value of type O */ + encode: Encode + ) + /** + * @since 1.0.0 + */ + pipe(this: Type, ab: Type, name?: string): Type + /** + * @since 1.0.0 + */ + asDecoder(): Decoder + /** + * @since 1.0.0 + */ + asEncoder(): Encoder + /** + * a version of `validate` with a default context + * @since 1.0.0 + */ + decode(i: I): Validation +} +/** + * @since 1.0.0 + */ +export declare const identity: (a: A) => A +/** + * @since 1.0.0 + */ +export declare function getFunctionName(f: Function): string +/** + * @since 1.0.0 + */ +export declare function getContextEntry(key: string, decoder: Decoder): ContextEntry +/** + * @since 1.0.0 + */ +export declare function appendContext(c: Context, key: string, decoder: Decoder, actual?: unknown): Context +/** + * @since 1.0.0 + */ +export interface AnyProps { + [key: string]: Any +} +/** + * @since 1.0.0 + */ +export type TypeOfProps

= { + [K in keyof P]: TypeOf +} +/** + * @since 1.0.0 + */ +export type OutputOfProps

= { + [K in keyof P]: OutputOf +} +/** + * @since 1.0.0 + */ +export interface Props { + [key: string]: Mixed +} +/** + * @since 1.0.0 + */ +export type TypeOfPartialProps

= { + [K in keyof P]?: TypeOf +} +/** + * @since 1.0.0 + */ +export type OutputOfPartialProps

= { + [K in keyof P]?: OutputOf +} +/** + * @since 1.0.0 + */ +export type TypeOfDictionary = { + [K in TypeOf]: TypeOf +} +/** + * @since 1.0.0 + */ +export type OutputOfDictionary = { + [K in OutputOf]: OutputOf +} +/** + * @since 1.1.0 + */ +export interface HasPropsRefinement extends RefinementType {} +/** + * @since 1.1.0 + */ +export interface HasPropsReadonly extends ReadonlyType {} +/** + * @since 1.1.0 + */ +export interface HasPropsIntersection extends IntersectionType, any, any, any> {} +/** + * @since 1.1.0 + */ +export type HasProps = + | HasPropsRefinement + | HasPropsReadonly + | HasPropsIntersection + | InterfaceType + | StrictType + | PartialType +/** + * @since 1.0.0 + */ +export declare class NullType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'NullType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface NullC extends NullType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const nullType: NullC +/** + * @since 1.0.0 + */ +export declare class UndefinedType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'UndefinedType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface UndefinedC extends UndefinedType {} +declare const undefinedType: UndefinedC +/** + * @since 1.2.0 + */ +export declare class VoidType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'VoidType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface VoidC extends VoidType {} +/** + * @category primitives + * @since 1.2.0 + */ +export declare const voidType: VoidC +/** + * @since 1.5.0 + */ +export declare class UnknownType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'UnknownType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface UnknownC extends UnknownType {} +/** + * @category primitives + * @since 1.5.0 + */ +export declare const unknown: UnknownC +/** + * @since 1.0.0 + */ +export declare class StringType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'StringType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface StringC extends StringType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const string: StringC +/** + * @since 1.0.0 + */ +export declare class NumberType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'NumberType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface NumberC extends NumberType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const number: NumberC +/** + * @since 2.1.0 + */ +export declare class BigIntType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'BigIntType' + constructor() +} +/** + * @since 2.1.0 + */ +export interface BigIntC extends BigIntType {} +/** + * @category primitives + * @since 2.1.0 + */ +export declare const bigint: BigIntC +/** + * @since 1.0.0 + */ +export declare class BooleanType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'BooleanType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface BooleanC extends BooleanType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const boolean: BooleanC +/** + * @since 1.0.0 + */ +export declare class AnyArrayType extends Type> { + /** + * @since 1.0.0 + */ + readonly _tag: 'AnyArrayType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface UnknownArrayC extends AnyArrayType {} +/** + * @category primitives + * @since 1.7.1 + */ +export declare const UnknownArray: UnknownArrayC +/** + * @since 1.0.0 + */ +export declare class AnyDictionaryType extends Type<{ + [key: string]: unknown +}> { + /** + * @since 1.0.0 + */ + readonly _tag: 'AnyDictionaryType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface UnknownRecordC extends AnyDictionaryType {} +/** + * @category primitives + * @since 1.7.1 + */ +export declare const UnknownRecord: UnknownRecordC +export { + /** + * @category primitives + * @since 1.0.0 + */ + nullType as null, + /** + * @category primitives + * @since 1.0.0 + */ + undefinedType as undefined, + /** + * @category primitives + * @since 1.0.0 + */ + voidType as void +} +type LiteralValue = string | number | boolean +/** + * @since 1.0.0 + */ +export declare class LiteralType extends Type { + readonly value: V + /** + * @since 1.0.0 + */ + readonly _tag: 'LiteralType' + constructor( + name: string, + is: LiteralType['is'], + validate: LiteralType['validate'], + encode: LiteralType['encode'], + value: V + ) +} +/** + * @since 1.5.3 + */ +export interface LiteralC extends LiteralType {} +/** + * @category constructors + * @since 1.0.0 + */ +export declare function literal(value: V, name?: string): LiteralC +/** + * @since 1.0.0 + */ +export declare class KeyofType< + D extends { + [key: string]: unknown + } +> extends Type { + readonly keys: D + /** + * @since 1.0.0 + */ + readonly _tag: 'KeyofType' + constructor( + name: string, + is: KeyofType['is'], + validate: KeyofType['validate'], + encode: KeyofType['encode'], + keys: D + ) +} +/** + * @since 1.5.3 + */ +export interface KeyofC< + D extends { + [key: string]: unknown + } +> extends KeyofType {} +/** + * @category constructors + * @since 1.0.0 + */ +export declare function keyof< + D extends { + [key: string]: unknown + } +>(keys: D, name?: string): KeyofC +/** + * @since 1.0.0 + */ +export declare class RefinementType extends Type { + readonly type: C + readonly predicate: Predicate + /** + * @since 1.0.0 + */ + readonly _tag: 'RefinementType' + constructor( + name: string, + is: RefinementType['is'], + validate: RefinementType['validate'], + encode: RefinementType['encode'], + type: C, + predicate: Predicate + ) +} +declare const _brand: unique symbol +/** + * @since 1.8.1 + */ +export interface Brand { + readonly [_brand]: B +} +/** + * @since 1.8.1 + */ +export type Branded = A & Brand +/** + * @since 1.8.1 + */ +export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} +/** + * @category combinators + * @since 1.8.1 + */ +export declare function brand< + C extends Any, + N extends string, + B extends { + readonly [K in N]: symbol + } +>(codec: C, predicate: Refinement, Branded, B>>, name: N): BrandC +/** + * @since 1.8.1 + */ +export interface IntBrand { + readonly Int: unique symbol +} +/** + * A branded codec representing an integer + * + * @category primitives + * @since 1.8.1 + */ +export declare const Int: BrandC +/** + * @since 1.8.1 + */ +export type Int = Branded +/** + * @since 1.0.0 + */ +export declare class RecursiveType extends Type { + runDefinition: () => C + /** + * @since 1.0.0 + */ + readonly _tag: 'RecursiveType' + constructor( + name: string, + is: RecursiveType['is'], + validate: RecursiveType['validate'], + encode: RecursiveType['encode'], + runDefinition: () => C + ) + /** + * @since 1.0.0 + */ + readonly type: C +} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function recursion = Type>( + name: string, + definition: (self: C) => C +): RecursiveType +/** + * @since 1.0.0 + */ +export declare class ArrayType extends Type { + readonly type: C + /** + * @since 1.0.0 + */ + readonly _tag: 'ArrayType' + constructor( + name: string, + is: ArrayType['is'], + validate: ArrayType['validate'], + encode: ArrayType['encode'], + type: C + ) +} +/** + * @since 1.5.3 + */ +export interface ArrayC extends ArrayType>, Array>, unknown> {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function array(item: C, name?: string): ArrayC +/** + * @since 1.0.0 + */ +export declare class InterfaceType extends Type { + readonly props: P + /** + * @since 1.0.0 + */ + readonly _tag: 'InterfaceType' + constructor( + name: string, + is: InterfaceType['is'], + validate: InterfaceType['validate'], + encode: InterfaceType['encode'], + props: P + ) +} +/** + * @since 1.5.3 + */ +export interface TypeC

+ extends InterfaceType< + P, + { + [K in keyof P]: TypeOf + }, + { + [K in keyof P]: OutputOf + }, + unknown + > {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function type

(props: P, name?: string): TypeC

+/** + * @since 1.0.0 + */ +export declare class PartialType extends Type { + readonly props: P + /** + * @since 1.0.0 + */ + readonly _tag: 'PartialType' + constructor( + name: string, + is: PartialType['is'], + validate: PartialType['validate'], + encode: PartialType['encode'], + props: P + ) +} +/** + * @since 1.5.3 + */ +export interface PartialC

+ extends PartialType< + P, + { + [K in keyof P]?: TypeOf + }, + { + [K in keyof P]?: OutputOf + }, + unknown + > {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function partial

(props: P, name?: string): PartialC

+/** + * @since 1.0.0 + */ +export declare class DictionaryType extends Type { + readonly domain: D + readonly codomain: C + /** + * @since 1.0.0 + */ + readonly _tag: 'DictionaryType' + constructor( + name: string, + is: DictionaryType['is'], + validate: DictionaryType['validate'], + encode: DictionaryType['encode'], + domain: D, + codomain: C + ) +} +/** + * @since 1.5.3 + */ +export interface RecordC + extends DictionaryType< + D, + C, + { + [K in TypeOf]: TypeOf + }, + { + [K in OutputOf]: OutputOf + }, + unknown + > {} +/** + * @category combinators + * @since 1.7.1 + */ +export declare function record(domain: D, codomain: C, name?: string): RecordC +/** + * @since 1.0.0 + */ +export declare class UnionType, A = any, O = A, I = unknown> extends Type { + readonly types: CS + /** + * @since 1.0.0 + */ + readonly _tag: 'UnionType' + constructor( + name: string, + is: UnionType['is'], + validate: UnionType['validate'], + encode: UnionType['encode'], + types: CS + ) +} +/** + * @since 1.5.3 + */ +export interface UnionC]> + extends UnionType, OutputOf, unknown> {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function union]>(codecs: CS, name?: string): UnionC +/** + * @since 1.0.0 + */ +export declare class IntersectionType, A = any, O = A, I = unknown> extends Type { + readonly types: CS + /** + * @since 1.0.0 + */ + readonly _tag: 'IntersectionType' + constructor( + name: string, + is: IntersectionType['is'], + validate: IntersectionType['validate'], + encode: IntersectionType['encode'], + types: CS + ) +} +/** + * @since 1.5.3 + */ +export interface IntersectionC]> + extends IntersectionType< + CS, + CS extends { + length: 2 + } + ? TypeOf & TypeOf + : CS extends { + length: 3 + } + ? TypeOf & TypeOf & TypeOf + : CS extends { + length: 4 + } + ? TypeOf & TypeOf & TypeOf & TypeOf + : CS extends { + length: 5 + } + ? TypeOf & TypeOf & TypeOf & TypeOf & TypeOf + : unknown, + CS extends { + length: 2 + } + ? OutputOf & OutputOf + : CS extends { + length: 3 + } + ? OutputOf & OutputOf & OutputOf + : CS extends { + length: 4 + } + ? OutputOf & OutputOf & OutputOf & OutputOf + : CS extends { + length: 5 + } + ? OutputOf & OutputOf & OutputOf & OutputOf & OutputOf + : unknown, + unknown + > {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function intersection< + A extends Mixed, + B extends Mixed, + C extends Mixed, + D extends Mixed, + E extends Mixed +>(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> +export declare function intersection( + codecs: [A, B, C, D], + name?: string +): IntersectionC<[A, B, C, D]> +export declare function intersection( + codecs: [A, B, C], + name?: string +): IntersectionC<[A, B, C]> +export declare function intersection( + codecs: [A, B], + name?: string +): IntersectionC<[A, B]> +/** + * @since 1.0.0 + */ +export declare class TupleType, A = any, O = A, I = unknown> extends Type { + readonly types: CS + /** + * @since 1.0.0 + */ + readonly _tag: 'TupleType' + constructor( + name: string, + is: TupleType['is'], + validate: TupleType['validate'], + encode: TupleType['encode'], + types: CS + ) +} +/** + * @since 1.5.3 + */ +export interface TupleC]> + extends TupleType< + CS, + CS extends { + length: 1 + } + ? [TypeOf] + : CS extends { + length: 2 + } + ? [TypeOf, TypeOf] + : CS extends { + length: 3 + } + ? [TypeOf, TypeOf, TypeOf] + : CS extends { + length: 4 + } + ? [TypeOf, TypeOf, TypeOf, TypeOf] + : CS extends { + length: 5 + } + ? [TypeOf, TypeOf, TypeOf, TypeOf, TypeOf] + : unknown, + CS extends { + length: 1 + } + ? [OutputOf] + : CS extends { + length: 2 + } + ? [OutputOf, OutputOf] + : CS extends { + length: 3 + } + ? [OutputOf, OutputOf, OutputOf] + : CS extends { + length: 4 + } + ? [OutputOf, OutputOf, OutputOf, OutputOf] + : CS extends { + length: 5 + } + ? [OutputOf, OutputOf, OutputOf, OutputOf, OutputOf] + : unknown, + unknown + > {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function tuple( + codecs: [A, B, C, D, E], + name?: string +): TupleC<[A, B, C, D, E]> +export declare function tuple( + codecs: [A, B, C, D], + name?: string +): TupleC<[A, B, C, D]> +export declare function tuple( + codecs: [A, B, C], + name?: string +): TupleC<[A, B, C]> +export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> +export declare function tuple(codecs: [A], name?: string): TupleC<[A]> +/** + * @since 1.0.0 + */ +export declare class ReadonlyType extends Type { + readonly type: C + /** + * @since 1.0.0 + */ + readonly _tag: 'ReadonlyType' + constructor( + name: string, + is: ReadonlyType['is'], + validate: ReadonlyType['validate'], + encode: ReadonlyType['encode'], + type: C + ) +} +/** + * @since 1.5.3 + */ +export interface ReadonlyC + extends ReadonlyType>, Readonly>, unknown> {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function readonly(codec: C, name?: string): ReadonlyC +/** + * @since 1.0.0 + */ +export declare class ReadonlyArrayType extends Type { + readonly type: C + /** + * @since 1.0.0 + */ + readonly _tag: 'ReadonlyArrayType' + constructor( + name: string, + is: ReadonlyArrayType['is'], + validate: ReadonlyArrayType['validate'], + encode: ReadonlyArrayType['encode'], + type: C + ) +} +/** + * @since 1.5.3 + */ +export interface ReadonlyArrayC + extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function readonlyArray(item: C, name?: string): ReadonlyArrayC +/** + * Strips additional properties, equivalent to `exact(type(props))`. + * + * @category combinators + * @since 1.0.0 + */ +export declare const strict:

(props: P, name?: string) => ExactC> +/** + * @since 1.1.0 + */ +export declare class ExactType extends Type { + readonly type: C + /** + * @since 1.0.0 + */ + readonly _tag: 'ExactType' + constructor( + name: string, + is: ExactType['is'], + validate: ExactType['validate'], + encode: ExactType['encode'], + type: C + ) +} +/** + * @since 1.5.3 + */ +export interface ExactC extends ExactType, OutputOf, InputOf> {} +/** + * Strips additional properties. + * + * @category combinators + * @since 1.1.0 + */ +export declare function exact(codec: C, name?: string): ExactC +/** + * @since 1.0.0 + */ +export declare class FunctionType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'FunctionType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface FunctionC extends FunctionType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const Function: FunctionC +/** + * @since 1.0.0 + */ +export declare class NeverType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'NeverType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface NeverC extends NeverType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const never: NeverC +/** + * @since 1.0.0 + */ +export declare class AnyType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'AnyType' + constructor() +} +/** + * @since 1.5.3 + */ +export interface AnyC extends AnyType {} +/** + * @category primitives + * @since 1.0.0 + */ +export declare const any: AnyC +/** + * @since 1.5.3 + */ +export interface RefinementC> extends RefinementType, InputOf> {} +/** + * @category combinators + * @since 1.0.0 + */ +export declare function refinement>( + codec: C, + refinement: Refinement, B>, + name?: string +): RefinementC +export declare function refinement( + codec: C, + predicate: Predicate>, + name?: string +): RefinementC +/** + * @category primitives + * @since 1.0.0 + */ +export declare const Integer: RefinementC +/** + * @since 1.3.0 + * @deprecated + */ +export declare class TaggedUnionType< + Tag extends string, + CS extends Array, + A = any, + O = A, + I = unknown +> extends UnionType { + readonly tag: Tag + constructor( + name: string, + is: TaggedUnionType['is'], + validate: TaggedUnionType['validate'], + encode: TaggedUnionType['encode'], + codecs: CS, + tag: Tag + ) +} +/** + * @since 1.5.3 + * @deprecated + */ +export interface TaggedUnionC]> // tslint:disable-next-line: deprecation + extends TaggedUnionType, OutputOf, unknown> {} +/** + * Use `union` instead. + * + * @category combinators + * @since 1.3.0 + * @deprecated + */ +export declare const taggedUnion: ( + tag: Tag, + codecs: CS, + name?: string +) => TaggedUnionC +export { + /** + * Use `UnknownArray` instead. + * + * @category primitives + * @deprecated + * @since 1.0.0 + */ + UnknownArray as Array +} +export { + /** + * Use `type` instead. + * + * @category combinators + * @deprecated + * @since 1.0.0 + */ + type as interface +} +/** + * Use `unknown` instead. + * + * @since 1.0.0 + * @deprecated + */ +export type mixed = unknown +/** + * @since 1.0.0 + * @deprecated + */ +export declare const getValidationError: (value: unknown, context: Context) => ValidationError +/** + * @since 1.0.0 + * @deprecated + */ +export declare const getDefaultContext: (decoder: Decoder) => Context +/** + * Use `UnknownRecord` instead. + * + * @category primitives + * @since 1.0.0 + * @deprecated + */ +export declare const Dictionary: UnknownRecordC +/** + * @since 1.0.0 + * @deprecated + */ +export declare class ObjectType extends Type { + /** + * @since 1.0.0 + */ + readonly _tag: 'ObjectType' + constructor() +} +/** + * @since 1.5.3 + * @deprecated + */ +export interface ObjectC extends ObjectType {} +/** + * Use `UnknownRecord` instead. + * + * @category primitives + * @since 1.0.0 + * @deprecated + */ +export declare const object: ObjectC +/** + * Use `record` instead. + * + * @category combinators + * @since 1.0.0 + * @deprecated + */ +export declare const dictionary: typeof record +/** + * @since 1.4.2 + * @deprecated + */ +export type Compact = { + [K in keyof A]: A[K] +} +/** + * @since 1.0.0 + * @deprecated + */ +export declare class StrictType extends Type { + readonly props: P + /** + * @since 1.0.0 + */ + readonly _tag: 'StrictType' + constructor( + name: string, + is: StrictType['is'], + validate: StrictType['validate'], + encode: StrictType['encode'], + props: P + ) +} +/** + * @since 1.5.3 + * @deprecated + */ +export interface StrictC

// tslint:disable-next-line: deprecation + extends StrictType< + P, + { + [K in keyof P]: TypeOf + }, + { + [K in keyof P]: OutputOf + }, + unknown + > {} +/** + * @since 1.3.0 + * @deprecated + */ +export type TaggedProps = { + [K in Tag]: LiteralType +} +/** + * @since 1.3.0 + * @deprecated + */ +export interface TaggedRefinement extends RefinementType, A, O> {} +/** + * @since 1.3.0 + * @deprecated + */ +export interface TaggedUnion extends UnionType>, A, O> {} +/** + * @since 1.3.0 + * @deprecated + */ +export type TaggedIntersectionArgument = + | [Tagged] + | [Tagged, Mixed] + | [Mixed, Tagged] + | [Tagged, Mixed, Mixed] + | [Mixed, Tagged, Mixed] + | [Mixed, Mixed, Tagged] + | [Tagged, Mixed, Mixed, Mixed] + | [Mixed, Tagged, Mixed, Mixed] + | [Mixed, Mixed, Tagged, Mixed] + | [Mixed, Mixed, Mixed, Tagged] + | [Tagged, Mixed, Mixed, Mixed, Mixed] + | [Mixed, Tagged, Mixed, Mixed, Mixed] + | [Mixed, Mixed, Tagged, Mixed, Mixed] + | [Mixed, Mixed, Mixed, Tagged, Mixed] + | [Mixed, Mixed, Mixed, Mixed, Tagged] +/** + * @since 1.3.0 + * @deprecated + */ +export interface TaggedIntersection // tslint:disable-next-line: deprecation + extends IntersectionType, A, O> {} +/** + * @since 1.3.0 + * @deprecated + */ +export interface TaggedExact extends ExactType, A, O> {} +/** + * @since 1.3.0 + * @deprecated + */ +export type Tagged = + | InterfaceType, A, O> + | StrictType, A, O> + | TaggedRefinement + | TaggedUnion + | TaggedIntersection + | TaggedExact + | RecursiveType +/** + * Drops the codec "kind". + * + * @category combinators + * @since 1.1.0 + * @deprecated + */ +export declare function clean(codec: Type): Type +/** + * @since 1.0.0 + * @deprecated + */ +export type PropsOf< + T extends { + props: any + } +> = T['props'] +/** + * @since 1.1.0 + * @deprecated + */ +export type Exact = T & { + [K in ({ + [K in keyof X]: K + } & { + [K in keyof T]: never + } & { + [key: string]: never + })[keyof X]]?: never +} +/** + * Keeps the codec "kind". + * + * @category combinators + * @since 1.1.0 + * @deprecated + */ +export declare function alias( + codec: PartialType +): () => PartialType +export declare function alias( + codec: StrictType +): () => StrictType +export declare function alias( + codec: InterfaceType +): () => InterfaceType diff --git a/components/pexels/node_modules/io-ts/lib/index.js b/components/pexels/node_modules/io-ts/lib/index.js new file mode 100644 index 0000000000000..9fd87d968cac1 --- /dev/null +++ b/components/pexels/node_modules/io-ts/lib/index.js @@ -0,0 +1,1650 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.partial = exports.PartialType = exports.type = exports.InterfaceType = exports.array = exports.ArrayType = exports.recursion = exports.RecursiveType = exports.Int = exports.brand = exports.RefinementType = exports.keyof = exports.KeyofType = exports.literal = exports.LiteralType = exports.void = exports.undefined = exports.null = exports.UnknownRecord = exports.AnyDictionaryType = exports.UnknownArray = exports.AnyArrayType = exports.boolean = exports.BooleanType = exports.bigint = exports.BigIntType = exports.number = exports.NumberType = exports.string = exports.StringType = exports.unknown = exports.UnknownType = exports.voidType = exports.VoidType = exports.UndefinedType = exports.nullType = exports.NullType = exports.getIndex = exports.getTags = exports.emptyTags = exports.mergeAll = exports.getDomainKeys = exports.appendContext = exports.getContextEntry = exports.getFunctionName = exports.identity = exports.Type = exports.success = exports.failure = exports.failures = void 0; +exports.alias = exports.clean = exports.StrictType = exports.dictionary = exports.object = exports.ObjectType = exports.Dictionary = exports.getDefaultContext = exports.getValidationError = exports.interface = exports.Array = exports.taggedUnion = exports.TaggedUnionType = exports.Integer = exports.refinement = exports.any = exports.AnyType = exports.never = exports.NeverType = exports.Function = exports.FunctionType = exports.exact = exports.ExactType = exports.strict = exports.readonlyArray = exports.ReadonlyArrayType = exports.readonly = exports.ReadonlyType = exports.tuple = exports.TupleType = exports.intersection = exports.IntersectionType = exports.union = exports.UnionType = exports.record = exports.DictionaryType = void 0; +/** + * @since 1.0.0 + */ +var Either_1 = require("fp-ts/lib/Either"); +/** + * @category Decode error + * @since 1.0.0 + */ +exports.failures = Either_1.left; +/** + * @category Decode error + * @since 1.0.0 + */ +var failure = function (value, context, message) { + return (0, exports.failures)([{ value: value, context: context, message: message }]); +}; +exports.failure = failure; +/** + * @category Decode error + * @since 1.0.0 + */ +exports.success = Either_1.right; +/** + * @category Codec + * @since 1.0.0 + */ +var Type = /** @class */ (function () { + function Type( + /** a unique name for this codec */ + name, + /** a custom type guard */ + is, + /** succeeds if a value of type I can be decoded to a value of type A */ + validate, + /** converts a value of type A to a value of type O */ + encode) { + this.name = name; + this.is = is; + this.validate = validate; + this.encode = encode; + this.decode = this.decode.bind(this); + } + /** + * @since 1.0.0 + */ + Type.prototype.pipe = function (ab, name) { + var _this = this; + if (name === void 0) { name = "pipe(".concat(this.name, ", ").concat(ab.name, ")"); } + return new Type(name, ab.is, function (i, c) { + var e = _this.validate(i, c); + if ((0, Either_1.isLeft)(e)) { + return e; + } + return ab.validate(e.right, c); + }, this.encode === exports.identity && ab.encode === exports.identity ? exports.identity : function (b) { return _this.encode(ab.encode(b)); }); + }; + /** + * @since 1.0.0 + */ + Type.prototype.asDecoder = function () { + return this; + }; + /** + * @since 1.0.0 + */ + Type.prototype.asEncoder = function () { + return this; + }; + /** + * a version of `validate` with a default context + * @since 1.0.0 + */ + Type.prototype.decode = function (i) { + return this.validate(i, [{ key: '', type: this, actual: i }]); + }; + return Type; +}()); +exports.Type = Type; +// ------------------------------------------------------------------------------------- +// utils +// ------------------------------------------------------------------------------------- +/** + * @since 1.0.0 + */ +var identity = function (a) { return a; }; +exports.identity = identity; +/** + * @since 1.0.0 + */ +function getFunctionName(f) { + return f.displayName || f.name || ""); +} +exports.getFunctionName = getFunctionName; +/** + * @since 1.0.0 + */ +function getContextEntry(key, decoder) { + return { key: key, type: decoder }; +} +exports.getContextEntry = getContextEntry; +/** + * @since 1.0.0 + */ +function appendContext(c, key, decoder, actual) { + var len = c.length; + var r = Array(len + 1); + for (var i = 0; i < len; i++) { + r[i] = c[i]; + } + r[len] = { key: key, type: decoder, actual: actual }; + return r; +} +exports.appendContext = appendContext; +function pushAll(xs, ys) { + var l = ys.length; + for (var i = 0; i < l; i++) { + xs.push(ys[i]); + } +} +var hasOwnProperty = Object.prototype.hasOwnProperty; +function getNameFromProps(props) { + return Object.keys(props) + .map(function (k) { return "".concat(k, ": ").concat(props[k].name); }) + .join(', '); +} +function useIdentity(codecs) { + for (var i = 0; i < codecs.length; i++) { + if (codecs[i].encode !== exports.identity) { + return false; + } + } + return true; +} +function getInterfaceTypeName(props) { + return "{ ".concat(getNameFromProps(props), " }"); +} +function getPartialTypeName(inner) { + return "Partial<".concat(inner, ">"); +} +function enumerableRecord(keys, domain, codomain, name) { + if (name === void 0) { name = "{ [K in ".concat(domain.name, "]: ").concat(codomain.name, " }"); } + var len = keys.length; + var props = {}; + for (var i = 0; i < len; i++) { + props[keys[i]] = codomain; + } + var exactCodec = (0, exports.strict)(props, name); + return new DictionaryType(name, function (u) { return exactCodec.is(u); }, exactCodec.validate, exactCodec.encode, domain, codomain); +} +/** + * @internal + */ +function getDomainKeys(domain) { + var _a; + if (isLiteralC(domain)) { + var literal_1 = domain.value; + if (exports.string.is(literal_1)) { + return _a = {}, _a[literal_1] = null, _a; + } + } + else if (isKeyofC(domain)) { + return domain.keys; + } + else if (isUnionC(domain)) { + var keys = domain.types.map(function (type) { return getDomainKeys(type); }); + return keys.some(undefinedType.is) ? undefined : Object.assign.apply(Object, __spreadArray([{}], keys, false)); + } + return undefined; +} +exports.getDomainKeys = getDomainKeys; +function stripNonDomainKeys(o, domain) { + var keys = Object.keys(o); + var len = keys.length; + var shouldStrip = false; + var r = {}; + for (var i = 0; i < len; i++) { + var k = keys[i]; + if (domain.is(k)) { + r[k] = o[k]; + } + else { + shouldStrip = true; + } + } + return shouldStrip ? r : o; +} +function nonEnumerableRecord(domain, codomain, name) { + if (name === void 0) { name = "{ [K in ".concat(domain.name, "]: ").concat(codomain.name, " }"); } + return new DictionaryType(name, function (u) { + if (exports.UnknownRecord.is(u)) { + return Object.keys(u).every(function (k) { return !domain.is(k) || codomain.is(u[k]); }); + } + return isAnyC(codomain) && Array.isArray(u); + }, function (u, c) { + if (exports.UnknownRecord.is(u)) { + var a = {}; + var errors = []; + var keys = Object.keys(u); + var len = keys.length; + var changed = false; + for (var i = 0; i < len; i++) { + var k = keys[i]; + var ok = u[k]; + var domainResult = domain.validate(k, appendContext(c, k, domain, k)); + if ((0, Either_1.isLeft)(domainResult)) { + changed = true; + } + else { + var vk = domainResult.right; + changed = changed || vk !== k; + k = vk; + var codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)); + if ((0, Either_1.isLeft)(codomainResult)) { + pushAll(errors, codomainResult.left); + } + else { + var vok = codomainResult.right; + changed = changed || vok !== ok; + a[k] = vok; + } + } + } + return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)((changed ? a : u)); + } + if (isAnyC(codomain) && Array.isArray(u)) { + return (0, exports.success)(u); + } + return (0, exports.failure)(u, c); + }, domain.encode === exports.identity && codomain.encode === exports.identity + ? function (a) { return stripNonDomainKeys(a, domain); } + : function (a) { + var s = {}; + var keys = Object.keys(stripNonDomainKeys(a, domain)); + var len = keys.length; + for (var i = 0; i < len; i++) { + var k = keys[i]; + s[String(domain.encode(k))] = codomain.encode(a[k]); + } + return s; + }, domain, codomain); +} +function getUnionName(codecs) { + return '(' + codecs.map(function (type) { return type.name; }).join(' | ') + ')'; +} +/** + * @internal + */ +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function mergeAll(base, us) { + var equal = true; + var primitive = true; + var baseIsNotADictionary = !exports.UnknownRecord.is(base); + for (var _i = 0, us_1 = us; _i < us_1.length; _i++) { + var u = us_1[_i]; + if (u !== base) { + equal = false; + } + if (exports.UnknownRecord.is(u)) { + primitive = false; + } + } + if (equal) { + return base; + } + else if (primitive) { + return us[us.length - 1]; + } + var r = {}; + for (var _a = 0, us_2 = us; _a < us_2.length; _a++) { + var u = us_2[_a]; + for (var k in u) { + if (!hasOwnProperty.call(r, k) || baseIsNotADictionary || u[k] !== base[k]) { + r[k] = u[k]; + } + } + } + return r; +} +exports.mergeAll = mergeAll; +function getProps(codec) { + switch (codec._tag) { + case 'RefinementType': + case 'ReadonlyType': + return getProps(codec.type); + case 'InterfaceType': + case 'StrictType': + case 'PartialType': + return codec.props; + case 'IntersectionType': + return codec.types.reduce(function (props, type) { return Object.assign(props, getProps(type)); }, {}); + } +} +function stripKeys(o, props) { + var keys = Object.getOwnPropertyNames(o); + var shouldStrip = false; + var r = {}; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (!hasOwnProperty.call(props, key)) { + shouldStrip = true; + } + else { + r[key] = o[key]; + } + } + return shouldStrip ? r : o; +} +function getExactTypeName(codec) { + if (isTypeC(codec)) { + return "{| ".concat(getNameFromProps(codec.props), " |}"); + } + else if (isPartialC(codec)) { + return getPartialTypeName("{| ".concat(getNameFromProps(codec.props), " |}")); + } + return "Exact<".concat(codec.name, ">"); +} +function isNonEmpty(as) { + return as.length > 0; +} +/** + * @internal + */ +exports.emptyTags = {}; +function intersect(a, b) { + var r = []; + for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { + var v = a_1[_i]; + if (b.indexOf(v) !== -1) { + r.push(v); + } + } + return r; +} +function mergeTags(a, b) { + if (a === exports.emptyTags) { + return b; + } + if (b === exports.emptyTags) { + return a; + } + var r = Object.assign({}, a); + for (var k in b) { + if (hasOwnProperty.call(a, k)) { + var intersection_1 = intersect(a[k], b[k]); + if (isNonEmpty(intersection_1)) { + r[k] = intersection_1; + } + else { + r = exports.emptyTags; + break; + } + } + else { + r[k] = b[k]; + } + } + return r; +} +function intersectTags(a, b) { + if (a === exports.emptyTags || b === exports.emptyTags) { + return exports.emptyTags; + } + var r = exports.emptyTags; + for (var k in a) { + if (hasOwnProperty.call(b, k)) { + var intersection_2 = intersect(a[k], b[k]); + if (intersection_2.length === 0) { + if (r === exports.emptyTags) { + r = {}; + } + r[k] = a[k].concat(b[k]); + } + } + } + return r; +} +// tslint:disable-next-line: deprecation +function isAnyC(codec) { + return codec._tag === 'AnyType'; +} +function isLiteralC(codec) { + return codec._tag === 'LiteralType'; +} +function isKeyofC(codec) { + return codec._tag === 'KeyofType'; +} +function isTypeC(codec) { + return codec._tag === 'InterfaceType'; +} +function isPartialC(codec) { + return codec._tag === 'PartialType'; +} +// tslint:disable-next-line: deprecation +function isStrictC(codec) { + return codec._tag === 'StrictType'; +} +function isExactC(codec) { + return codec._tag === 'ExactType'; +} +// tslint:disable-next-line: deprecation +function isRefinementC(codec) { + return codec._tag === 'RefinementType'; +} +function isIntersectionC(codec) { + return codec._tag === 'IntersectionType'; +} +function isUnionC(codec) { + return codec._tag === 'UnionType'; +} +function isRecursiveC(codec) { + return codec._tag === 'RecursiveType'; +} +function isReadonlyC(codec) { + return codec._tag === 'ReadonlyType'; +} +var lazyCodecs = []; +/** + * @internal + */ +function getTags(codec) { + if (lazyCodecs.indexOf(codec) !== -1) { + return exports.emptyTags; + } + if (isTypeC(codec) || isStrictC(codec)) { + var index = exports.emptyTags; + // tslint:disable-next-line: forin + for (var k in codec.props) { + var prop = codec.props[k]; + if (isLiteralC(prop)) { + if (index === exports.emptyTags) { + index = {}; + } + index[k] = [prop.value]; + } + } + return index; + } + else if (isExactC(codec) || isRefinementC(codec) || isReadonlyC(codec)) { + return getTags(codec.type); + } + else if (isIntersectionC(codec)) { + return codec.types.reduce(function (tags, codec) { return mergeTags(tags, getTags(codec)); }, exports.emptyTags); + } + else if (isUnionC(codec)) { + return codec.types.slice(1).reduce(function (tags, codec) { return intersectTags(tags, getTags(codec)); }, getTags(codec.types[0])); + } + else if (isRecursiveC(codec)) { + lazyCodecs.push(codec); + var tags = getTags(codec.type); + lazyCodecs.pop(); + return tags; + } + return exports.emptyTags; +} +exports.getTags = getTags; +/** + * @internal + */ +function getIndex(codecs) { + var tags = getTags(codecs[0]); + var keys = Object.keys(tags); + var len = codecs.length; + var _loop_1 = function (k) { + var all = tags[k].slice(); + var index = [tags[k]]; + for (var i = 1; i < len; i++) { + var codec = codecs[i]; + var ctags = getTags(codec); + var values = ctags[k]; + // tslint:disable-next-line: strict-type-predicates + if (values === undefined) { + return "continue-keys"; + } + else { + if (values.some(function (v) { return all.indexOf(v) !== -1; })) { + return "continue-keys"; + } + else { + all.push.apply(all, values); + index.push(values); + } + } + } + return { value: [k, index] }; + }; + keys: for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { + var k = keys_1[_i]; + var state_1 = _loop_1(k); + if (typeof state_1 === "object") + return state_1.value; + switch (state_1) { + case "continue-keys": continue keys; + } + } + return undefined; +} +exports.getIndex = getIndex; +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @since 1.0.0 + */ +var NullType = /** @class */ (function (_super) { + __extends(NullType, _super); + function NullType() { + var _this = _super.call(this, 'null', function (u) { return u === null; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'NullType'; + return _this; + } + return NullType; +}(Type)); +exports.NullType = NullType; +/** + * @category primitives + * @since 1.0.0 + */ +exports.nullType = new NullType(); +exports.null = exports.nullType; +/** + * @since 1.0.0 + */ +var UndefinedType = /** @class */ (function (_super) { + __extends(UndefinedType, _super); + function UndefinedType() { + var _this = _super.call(this, 'undefined', function (u) { return u === void 0; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'UndefinedType'; + return _this; + } + return UndefinedType; +}(Type)); +exports.UndefinedType = UndefinedType; +var undefinedType = new UndefinedType(); +exports.undefined = undefinedType; +/** + * @since 1.2.0 + */ +var VoidType = /** @class */ (function (_super) { + __extends(VoidType, _super); + function VoidType() { + var _this = _super.call(this, 'void', undefinedType.is, undefinedType.validate, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'VoidType'; + return _this; + } + return VoidType; +}(Type)); +exports.VoidType = VoidType; +/** + * @category primitives + * @since 1.2.0 + */ +exports.voidType = new VoidType(); +exports.void = exports.voidType; +/** + * @since 1.5.0 + */ +var UnknownType = /** @class */ (function (_super) { + __extends(UnknownType, _super); + function UnknownType() { + var _this = _super.call(this, 'unknown', function (_) { return true; }, exports.success, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'UnknownType'; + return _this; + } + return UnknownType; +}(Type)); +exports.UnknownType = UnknownType; +/** + * @category primitives + * @since 1.5.0 + */ +exports.unknown = new UnknownType(); +/** + * @since 1.0.0 + */ +var StringType = /** @class */ (function (_super) { + __extends(StringType, _super); + function StringType() { + var _this = _super.call(this, 'string', function (u) { return typeof u === 'string'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'StringType'; + return _this; + } + return StringType; +}(Type)); +exports.StringType = StringType; +/** + * @category primitives + * @since 1.0.0 + */ +exports.string = new StringType(); +/** + * @since 1.0.0 + */ +var NumberType = /** @class */ (function (_super) { + __extends(NumberType, _super); + function NumberType() { + var _this = _super.call(this, 'number', function (u) { return typeof u === 'number'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'NumberType'; + return _this; + } + return NumberType; +}(Type)); +exports.NumberType = NumberType; +/** + * @category primitives + * @since 1.0.0 + */ +exports.number = new NumberType(); +/** + * @since 2.1.0 + */ +var BigIntType = /** @class */ (function (_super) { + __extends(BigIntType, _super); + function BigIntType() { + var _this = _super.call(this, 'bigint', + // tslint:disable-next-line: valid-typeof + function (u) { return typeof u === 'bigint'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'BigIntType'; + return _this; + } + return BigIntType; +}(Type)); +exports.BigIntType = BigIntType; +/** + * @category primitives + * @since 2.1.0 + */ +exports.bigint = new BigIntType(); +/** + * @since 1.0.0 + */ +var BooleanType = /** @class */ (function (_super) { + __extends(BooleanType, _super); + function BooleanType() { + var _this = _super.call(this, 'boolean', function (u) { return typeof u === 'boolean'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'BooleanType'; + return _this; + } + return BooleanType; +}(Type)); +exports.BooleanType = BooleanType; +/** + * @category primitives + * @since 1.0.0 + */ +exports.boolean = new BooleanType(); +/** + * @since 1.0.0 + */ +var AnyArrayType = /** @class */ (function (_super) { + __extends(AnyArrayType, _super); + function AnyArrayType() { + var _this = _super.call(this, 'UnknownArray', Array.isArray, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'AnyArrayType'; + return _this; + } + return AnyArrayType; +}(Type)); +exports.AnyArrayType = AnyArrayType; +/** + * @category primitives + * @since 1.7.1 + */ +exports.UnknownArray = new AnyArrayType(); +exports.Array = exports.UnknownArray; +/** + * @since 1.0.0 + */ +var AnyDictionaryType = /** @class */ (function (_super) { + __extends(AnyDictionaryType, _super); + function AnyDictionaryType() { + var _this = _super.call(this, 'UnknownRecord', function (u) { return u !== null && typeof u === 'object' && !Array.isArray(u); }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'AnyDictionaryType'; + return _this; + } + return AnyDictionaryType; +}(Type)); +exports.AnyDictionaryType = AnyDictionaryType; +/** + * @category primitives + * @since 1.7.1 + */ +exports.UnknownRecord = new AnyDictionaryType(); +/** + * @since 1.0.0 + */ +var LiteralType = /** @class */ (function (_super) { + __extends(LiteralType, _super); + function LiteralType(name, is, validate, encode, value) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.value = value; + /** + * @since 1.0.0 + */ + _this._tag = 'LiteralType'; + return _this; + } + return LiteralType; +}(Type)); +exports.LiteralType = LiteralType; +/** + * @category constructors + * @since 1.0.0 + */ +function literal(value, name) { + if (name === void 0) { name = JSON.stringify(value); } + var is = function (u) { return u === value; }; + return new LiteralType(name, is, function (u, c) { return (is(u) ? (0, exports.success)(value) : (0, exports.failure)(u, c)); }, exports.identity, value); +} +exports.literal = literal; +/** + * @since 1.0.0 + */ +var KeyofType = /** @class */ (function (_super) { + __extends(KeyofType, _super); + function KeyofType(name, is, validate, encode, keys) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.keys = keys; + /** + * @since 1.0.0 + */ + _this._tag = 'KeyofType'; + return _this; + } + return KeyofType; +}(Type)); +exports.KeyofType = KeyofType; +/** + * @category constructors + * @since 1.0.0 + */ +function keyof(keys, name) { + if (name === void 0) { name = Object.keys(keys) + .map(function (k) { return JSON.stringify(k); }) + .join(' | '); } + var is = function (u) { return exports.string.is(u) && hasOwnProperty.call(keys, u); }; + return new KeyofType(name, is, function (u, c) { return (is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity, keys); +} +exports.keyof = keyof; +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @since 1.0.0 + */ +var RefinementType = /** @class */ (function (_super) { + __extends(RefinementType, _super); + function RefinementType(name, is, validate, encode, type, predicate) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.type = type; + _this.predicate = predicate; + /** + * @since 1.0.0 + */ + _this._tag = 'RefinementType'; + return _this; + } + return RefinementType; +}(Type)); +exports.RefinementType = RefinementType; +/** + * @category combinators + * @since 1.8.1 + */ +function brand(codec, predicate, name) { + return refinement(codec, predicate, name); +} +exports.brand = brand; +/** + * A branded codec representing an integer + * + * @category primitives + * @since 1.8.1 + */ +exports.Int = brand(exports.number, function (n) { return Number.isInteger(n); }, 'Int'); +/** + * @since 1.0.0 + */ +var RecursiveType = /** @class */ (function (_super) { + __extends(RecursiveType, _super); + function RecursiveType(name, is, validate, encode, runDefinition) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.runDefinition = runDefinition; + /** + * @since 1.0.0 + */ + _this._tag = 'RecursiveType'; + return _this; + } + return RecursiveType; +}(Type)); +exports.RecursiveType = RecursiveType; +Object.defineProperty(RecursiveType.prototype, 'type', { + get: function () { + return this.runDefinition(); + }, + enumerable: true, + configurable: true +}); +/** + * @category combinators + * @since 1.0.0 + */ +function recursion(name, definition) { + var cache; + var runDefinition = function () { + if (!cache) { + cache = definition(Self); + cache.name = name; + } + return cache; + }; + var Self = new RecursiveType(name, function (u) { return runDefinition().is(u); }, function (u, c) { return runDefinition().validate(u, c); }, function (a) { return runDefinition().encode(a); }, runDefinition); + return Self; +} +exports.recursion = recursion; +/** + * @since 1.0.0 + */ +var ArrayType = /** @class */ (function (_super) { + __extends(ArrayType, _super); + function ArrayType(name, is, validate, encode, type) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.type = type; + /** + * @since 1.0.0 + */ + _this._tag = 'ArrayType'; + return _this; + } + return ArrayType; +}(Type)); +exports.ArrayType = ArrayType; +/** + * @category combinators + * @since 1.0.0 + */ +function array(item, name) { + if (name === void 0) { name = "Array<".concat(item.name, ">"); } + return new ArrayType(name, function (u) { return exports.UnknownArray.is(u) && u.every(item.is); }, function (u, c) { + var e = exports.UnknownArray.validate(u, c); + if ((0, Either_1.isLeft)(e)) { + return e; + } + var us = e.right; + var len = us.length; + var as = us; + var errors = []; + for (var i = 0; i < len; i++) { + var ui = us[i]; + var result = item.validate(ui, appendContext(c, String(i), item, ui)); + if ((0, Either_1.isLeft)(result)) { + pushAll(errors, result.left); + } + else { + var ai = result.right; + if (ai !== ui) { + if (as === us) { + as = us.slice(); + } + as[i] = ai; + } + } + } + return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)(as); + }, item.encode === exports.identity ? exports.identity : function (a) { return a.map(item.encode); }, item); +} +exports.array = array; +/** + * @since 1.0.0 + */ +var InterfaceType = /** @class */ (function (_super) { + __extends(InterfaceType, _super); + function InterfaceType(name, is, validate, encode, props) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.props = props; + /** + * @since 1.0.0 + */ + _this._tag = 'InterfaceType'; + return _this; + } + return InterfaceType; +}(Type)); +exports.InterfaceType = InterfaceType; +/** + * @category combinators + * @since 1.0.0 + */ +function type(props, name) { + if (name === void 0) { name = getInterfaceTypeName(props); } + var keys = Object.keys(props); + var types = keys.map(function (key) { return props[key]; }); + var len = keys.length; + return new InterfaceType(name, function (u) { + if (exports.UnknownRecord.is(u)) { + for (var i = 0; i < len; i++) { + var k = keys[i]; + var uk = u[k]; + if ((uk === undefined && !hasOwnProperty.call(u, k)) || !types[i].is(uk)) { + return false; + } + } + return true; + } + return false; + }, function (u, c) { + var e = exports.UnknownRecord.validate(u, c); + if ((0, Either_1.isLeft)(e)) { + return e; + } + var o = e.right; + var a = o; + var errors = []; + for (var i = 0; i < len; i++) { + var k = keys[i]; + var ak = a[k]; + var type_1 = types[i]; + var result = type_1.validate(ak, appendContext(c, k, type_1, ak)); + if ((0, Either_1.isLeft)(result)) { + pushAll(errors, result.left); + } + else { + var vak = result.right; + if (vak !== ak || (vak === undefined && !hasOwnProperty.call(a, k))) { + /* istanbul ignore next */ + if (a === o) { + a = __assign({}, o); + } + a[k] = vak; + } + } + } + return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)(a); + }, useIdentity(types) + ? exports.identity + : function (a) { + var s = __assign({}, a); + for (var i = 0; i < len; i++) { + var k = keys[i]; + var encode = types[i].encode; + if (encode !== exports.identity) { + s[k] = encode(a[k]); + } + } + return s; + }, props); +} +exports.type = type; +exports.interface = type; +/** + * @since 1.0.0 + */ +var PartialType = /** @class */ (function (_super) { + __extends(PartialType, _super); + function PartialType(name, is, validate, encode, props) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.props = props; + /** + * @since 1.0.0 + */ + _this._tag = 'PartialType'; + return _this; + } + return PartialType; +}(Type)); +exports.PartialType = PartialType; +/** + * @category combinators + * @since 1.0.0 + */ +function partial(props, name) { + if (name === void 0) { name = getPartialTypeName(getInterfaceTypeName(props)); } + var keys = Object.keys(props); + var types = keys.map(function (key) { return props[key]; }); + var len = keys.length; + return new PartialType(name, function (u) { + if (exports.UnknownRecord.is(u)) { + for (var i = 0; i < len; i++) { + var k = keys[i]; + var uk = u[k]; + if (uk !== undefined && !props[k].is(uk)) { + return false; + } + } + return true; + } + return false; + }, function (u, c) { + var e = exports.UnknownRecord.validate(u, c); + if ((0, Either_1.isLeft)(e)) { + return e; + } + var o = e.right; + var a = o; + var errors = []; + for (var i = 0; i < len; i++) { + var k = keys[i]; + var ak = a[k]; + var type_2 = props[k]; + var result = type_2.validate(ak, appendContext(c, k, type_2, ak)); + if ((0, Either_1.isLeft)(result)) { + if (ak !== undefined) { + pushAll(errors, result.left); + } + } + else { + var vak = result.right; + if (vak !== ak) { + /* istanbul ignore next */ + if (a === o) { + a = __assign({}, o); + } + a[k] = vak; + } + } + } + return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)(a); + }, useIdentity(types) + ? exports.identity + : function (a) { + var s = __assign({}, a); + for (var i = 0; i < len; i++) { + var k = keys[i]; + var ak = a[k]; + if (ak !== undefined) { + s[k] = types[i].encode(ak); + } + } + return s; + }, props); +} +exports.partial = partial; +/** + * @since 1.0.0 + */ +var DictionaryType = /** @class */ (function (_super) { + __extends(DictionaryType, _super); + function DictionaryType(name, is, validate, encode, domain, codomain) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.domain = domain; + _this.codomain = codomain; + /** + * @since 1.0.0 + */ + _this._tag = 'DictionaryType'; + return _this; + } + return DictionaryType; +}(Type)); +exports.DictionaryType = DictionaryType; +/** + * @category combinators + * @since 1.7.1 + */ +function record(domain, codomain, name) { + var keys = getDomainKeys(domain); + return keys + ? enumerableRecord(Object.keys(keys), domain, codomain, name) + : nonEnumerableRecord(domain, codomain, name); +} +exports.record = record; +/** + * @since 1.0.0 + */ +var UnionType = /** @class */ (function (_super) { + __extends(UnionType, _super); + function UnionType(name, is, validate, encode, types) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.types = types; + /** + * @since 1.0.0 + */ + _this._tag = 'UnionType'; + return _this; + } + return UnionType; +}(Type)); +exports.UnionType = UnionType; +/** + * @category combinators + * @since 1.0.0 + */ +function union(codecs, name) { + if (name === void 0) { name = getUnionName(codecs); } + var index = getIndex(codecs); + if (index !== undefined && codecs.length > 0) { + var tag_1 = index[0], groups_1 = index[1]; + var len_1 = groups_1.length; + var find_1 = function (value) { + for (var i = 0; i < len_1; i++) { + if (groups_1[i].indexOf(value) !== -1) { + return i; + } + } + return undefined; + }; + // tslint:disable-next-line: deprecation + return new TaggedUnionType(name, function (u) { + if (exports.UnknownRecord.is(u)) { + var i = find_1(u[tag_1]); + return i !== undefined ? codecs[i].is(u) : false; + } + return false; + }, function (u, c) { + var e = exports.UnknownRecord.validate(u, c); + if ((0, Either_1.isLeft)(e)) { + return e; + } + var r = e.right; + var i = find_1(r[tag_1]); + if (i === undefined) { + return (0, exports.failure)(u, c); + } + var codec = codecs[i]; + return codec.validate(r, appendContext(c, String(i), codec, r)); + }, useIdentity(codecs) + ? exports.identity + : function (a) { + var i = find_1(a[tag_1]); + if (i === undefined) { + // https://github.com/gcanti/io-ts/pull/305 + throw new Error("no codec found to encode value in union codec ".concat(name)); + } + else { + return codecs[i].encode(a); + } + }, codecs, tag_1); + } + else { + return new UnionType(name, function (u) { return codecs.some(function (type) { return type.is(u); }); }, function (u, c) { + var errors = []; + for (var i = 0; i < codecs.length; i++) { + var codec = codecs[i]; + var result = codec.validate(u, appendContext(c, String(i), codec, u)); + if ((0, Either_1.isLeft)(result)) { + pushAll(errors, result.left); + } + else { + return (0, exports.success)(result.right); + } + } + return (0, exports.failures)(errors); + }, useIdentity(codecs) + ? exports.identity + : function (a) { + for (var _i = 0, codecs_1 = codecs; _i < codecs_1.length; _i++) { + var codec = codecs_1[_i]; + if (codec.is(a)) { + return codec.encode(a); + } + } + // https://github.com/gcanti/io-ts/pull/305 + throw new Error("no codec found to encode value in union type ".concat(name)); + }, codecs); + } +} +exports.union = union; +/** + * @since 1.0.0 + */ +var IntersectionType = /** @class */ (function (_super) { + __extends(IntersectionType, _super); + function IntersectionType(name, is, validate, encode, types) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.types = types; + /** + * @since 1.0.0 + */ + _this._tag = 'IntersectionType'; + return _this; + } + return IntersectionType; +}(Type)); +exports.IntersectionType = IntersectionType; +function intersection(codecs, name) { + if (name === void 0) { name = "(".concat(codecs.map(function (type) { return type.name; }).join(' & '), ")"); } + var len = codecs.length; + return new IntersectionType(name, function (u) { return codecs.every(function (type) { return type.is(u); }); }, codecs.length === 0 + ? exports.success + : function (u, c) { + var us = []; + var errors = []; + for (var i = 0; i < len; i++) { + var codec = codecs[i]; + var result = codec.validate(u, appendContext(c, String(i), codec, u)); + if ((0, Either_1.isLeft)(result)) { + pushAll(errors, result.left); + } + else { + us.push(result.right); + } + } + return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)(mergeAll(u, us)); + }, codecs.length === 0 + ? exports.identity + : function (a) { + return mergeAll(a, codecs.map(function (codec) { return codec.encode(a); })); + }, codecs); +} +exports.intersection = intersection; +/** + * @since 1.0.0 + */ +var TupleType = /** @class */ (function (_super) { + __extends(TupleType, _super); + function TupleType(name, is, validate, encode, types) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.types = types; + /** + * @since 1.0.0 + */ + _this._tag = 'TupleType'; + return _this; + } + return TupleType; +}(Type)); +exports.TupleType = TupleType; +function tuple(codecs, name) { + if (name === void 0) { name = "[".concat(codecs.map(function (type) { return type.name; }).join(', '), "]"); } + var len = codecs.length; + return new TupleType(name, function (u) { return exports.UnknownArray.is(u) && u.length === len && codecs.every(function (type, i) { return type.is(u[i]); }); }, function (u, c) { + var e = exports.UnknownArray.validate(u, c); + if ((0, Either_1.isLeft)(e)) { + return e; + } + var us = e.right; + var as = us.length > len ? us.slice(0, len) : us; // strip additional components + var errors = []; + for (var i = 0; i < len; i++) { + var a = us[i]; + var type_3 = codecs[i]; + var result = type_3.validate(a, appendContext(c, String(i), type_3, a)); + if ((0, Either_1.isLeft)(result)) { + pushAll(errors, result.left); + } + else { + var va = result.right; + if (va !== a) { + /* istanbul ignore next */ + if (as === us) { + as = us.slice(); + } + as[i] = va; + } + } + } + return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)(as); + }, useIdentity(codecs) ? exports.identity : function (a) { return codecs.map(function (type, i) { return type.encode(a[i]); }); }, codecs); +} +exports.tuple = tuple; +/** + * @since 1.0.0 + */ +var ReadonlyType = /** @class */ (function (_super) { + __extends(ReadonlyType, _super); + function ReadonlyType(name, is, validate, encode, type) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.type = type; + /** + * @since 1.0.0 + */ + _this._tag = 'ReadonlyType'; + return _this; + } + return ReadonlyType; +}(Type)); +exports.ReadonlyType = ReadonlyType; +/** + * @category combinators + * @since 1.0.0 + */ +function readonly(codec, name) { + if (name === void 0) { name = "Readonly<".concat(codec.name, ">"); } + return new ReadonlyType(name, codec.is, codec.validate, codec.encode, codec); +} +exports.readonly = readonly; +/** + * @since 1.0.0 + */ +var ReadonlyArrayType = /** @class */ (function (_super) { + __extends(ReadonlyArrayType, _super); + function ReadonlyArrayType(name, is, validate, encode, type) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.type = type; + /** + * @since 1.0.0 + */ + _this._tag = 'ReadonlyArrayType'; + return _this; + } + return ReadonlyArrayType; +}(Type)); +exports.ReadonlyArrayType = ReadonlyArrayType; +/** + * @category combinators + * @since 1.0.0 + */ +function readonlyArray(item, name) { + if (name === void 0) { name = "ReadonlyArray<".concat(item.name, ">"); } + var codec = array(item); + return new ReadonlyArrayType(name, codec.is, codec.validate, codec.encode, item); +} +exports.readonlyArray = readonlyArray; +/** + * Strips additional properties, equivalent to `exact(type(props))`. + * + * @category combinators + * @since 1.0.0 + */ +var strict = function (props, name) { return exact(type(props), name); }; +exports.strict = strict; +/** + * @since 1.1.0 + */ +var ExactType = /** @class */ (function (_super) { + __extends(ExactType, _super); + function ExactType(name, is, validate, encode, type) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.type = type; + /** + * @since 1.0.0 + */ + _this._tag = 'ExactType'; + return _this; + } + return ExactType; +}(Type)); +exports.ExactType = ExactType; +/** + * Strips additional properties. + * + * @category combinators + * @since 1.1.0 + */ +function exact(codec, name) { + if (name === void 0) { name = getExactTypeName(codec); } + var props = getProps(codec); + return new ExactType(name, codec.is, function (u, c) { + var e = exports.UnknownRecord.validate(u, c); + if ((0, Either_1.isLeft)(e)) { + return e; + } + var ce = codec.validate(u, c); + if ((0, Either_1.isLeft)(ce)) { + return ce; + } + return (0, Either_1.right)(stripKeys(ce.right, props)); + }, function (a) { return codec.encode(stripKeys(a, props)); }, codec); +} +exports.exact = exact; +/** + * @since 1.0.0 + */ +var FunctionType = /** @class */ (function (_super) { + __extends(FunctionType, _super); + function FunctionType() { + var _this = _super.call(this, 'Function', + // tslint:disable-next-line:strict-type-predicates + function (u) { return typeof u === 'function'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'FunctionType'; + return _this; + } + return FunctionType; +}(Type)); +exports.FunctionType = FunctionType; +/** + * @category primitives + * @since 1.0.0 + */ +exports.Function = new FunctionType(); +/** + * @since 1.0.0 + */ +var NeverType = /** @class */ (function (_super) { + __extends(NeverType, _super); + function NeverType() { + var _this = _super.call(this, 'never', function (_) { return false; }, function (u, c) { return (0, exports.failure)(u, c); }, + /* istanbul ignore next */ + function () { + throw new Error('cannot encode never'); + }) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'NeverType'; + return _this; + } + return NeverType; +}(Type)); +exports.NeverType = NeverType; +/** + * @category primitives + * @since 1.0.0 + */ +exports.never = new NeverType(); +/** + * @since 1.0.0 + */ +var AnyType = /** @class */ (function (_super) { + __extends(AnyType, _super); + function AnyType() { + var _this = _super.call(this, 'any', function (_) { return true; }, exports.success, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'AnyType'; + return _this; + } + return AnyType; +}(Type)); +exports.AnyType = AnyType; +/** + * @category primitives + * @since 1.0.0 + */ +exports.any = new AnyType(); +function refinement(codec, predicate, name) { + if (name === void 0) { name = "(".concat(codec.name, " | ").concat(getFunctionName(predicate), ")"); } + return new RefinementType(name, function (u) { return codec.is(u) && predicate(u); }, function (i, c) { + var e = codec.validate(i, c); + if ((0, Either_1.isLeft)(e)) { + return e; + } + var a = e.right; + return predicate(a) ? (0, exports.success)(a) : (0, exports.failure)(a, c); + }, codec.encode, codec, predicate); +} +exports.refinement = refinement; +/** + * @category primitives + * @since 1.0.0 + */ +exports.Integer = refinement(exports.number, Number.isInteger, 'Integer'); +// ------------------------------------------------------------------------------------- +// deprecated +// ------------------------------------------------------------------------------------- +/** + * @since 1.3.0 + * @deprecated + */ +var TaggedUnionType = /** @class */ (function (_super) { + __extends(TaggedUnionType, _super); + function TaggedUnionType(name, + // tslint:disable-next-line: deprecation + is, + // tslint:disable-next-line: deprecation + validate, + // tslint:disable-next-line: deprecation + encode, codecs, tag) { + var _this = _super.call(this, name, is, validate, encode, codecs) /* istanbul ignore next */ // <= workaround for https://github.com/Microsoft/TypeScript/issues/13455 + || this; + _this.tag = tag; + return _this; + } + return TaggedUnionType; +}(UnionType)); +exports.TaggedUnionType = TaggedUnionType; +/** + * Use `union` instead. + * + * @category combinators + * @since 1.3.0 + * @deprecated + */ +var taggedUnion = function (tag, codecs, name +// tslint:disable-next-line: deprecation +) { + if (name === void 0) { name = getUnionName(codecs); } + var U = union(codecs, name); + // tslint:disable-next-line: deprecation + if (U instanceof TaggedUnionType) { + return U; + } + else { + console.warn("[io-ts] Cannot build a tagged union for ".concat(name, ", returning a de-optimized union")); + // tslint:disable-next-line: deprecation + return new TaggedUnionType(name, U.is, U.validate, U.encode, codecs, tag); + } +}; +exports.taggedUnion = taggedUnion; +/** + * @since 1.0.0 + * @deprecated + */ +var getValidationError /* istanbul ignore next */ = function (value, context) { return ({ + value: value, + context: context +}); }; +exports.getValidationError /* istanbul ignore next */ = getValidationError; +/** + * @since 1.0.0 + * @deprecated + */ +var getDefaultContext /* istanbul ignore next */ = function (decoder) { return [ + { key: '', type: decoder } +]; }; +exports.getDefaultContext /* istanbul ignore next */ = getDefaultContext; +/** + * Use `UnknownRecord` instead. + * + * @category primitives + * @since 1.0.0 + * @deprecated + */ +exports.Dictionary = exports.UnknownRecord; +/** + * @since 1.0.0 + * @deprecated + */ +var ObjectType = /** @class */ (function (_super) { + __extends(ObjectType, _super); + function ObjectType() { + var _this = _super.call(this, 'object', function (u) { return u !== null && typeof u === 'object'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; + /** + * @since 1.0.0 + */ + _this._tag = 'ObjectType'; + return _this; + } + return ObjectType; +}(Type)); +exports.ObjectType = ObjectType; +/** + * Use `UnknownRecord` instead. + * + * @category primitives + * @since 1.0.0 + * @deprecated + */ +// tslint:disable-next-line: deprecation +exports.object = new ObjectType(); +/** + * Use `record` instead. + * + * @category combinators + * @since 1.0.0 + * @deprecated + */ +exports.dictionary = record; +/** + * @since 1.0.0 + * @deprecated + */ +var StrictType = /** @class */ (function (_super) { + __extends(StrictType, _super); + function StrictType(name, + // tslint:disable-next-line: deprecation + is, + // tslint:disable-next-line: deprecation + validate, + // tslint:disable-next-line: deprecation + encode, props) { + var _this = _super.call(this, name, is, validate, encode) || this; + _this.props = props; + /** + * @since 1.0.0 + */ + _this._tag = 'StrictType'; + return _this; + } + return StrictType; +}(Type)); +exports.StrictType = StrictType; +/** + * Drops the codec "kind". + * + * @category combinators + * @since 1.1.0 + * @deprecated + */ +function clean(codec) { + return codec; +} +exports.clean = clean; +function alias(codec) { + return function () { return codec; }; +} +exports.alias = alias; diff --git a/components/pexels/node_modules/io-ts/package.json b/components/pexels/node_modules/io-ts/package.json new file mode 100644 index 0000000000000..1511564505211 --- /dev/null +++ b/components/pexels/node_modules/io-ts/package.json @@ -0,0 +1,36 @@ +{ + "name": "io-ts", + "version": "2.2.22", + "description": "TypeScript runtime type system for IO decoding/encoding", + "main": "lib/index.js", + "module": "es6/index.js", + "typings": "lib/index.d.ts", + "sideEffects": false, + "repository": { + "type": "git", + "url": "https://github.com/gcanti/io-ts.git" + }, + "author": "Giulio Canti ", + "license": "MIT", + "bugs": { + "url": "https://github.com/gcanti/io-ts/issues" + }, + "homepage": "https://github.com/gcanti/io-ts", + "peerDependencies": { + "fp-ts": "^2.5.0" + }, + "tags": [ + "typescript", + "runtime", + "decoder", + "encoder", + "schema" + ], + "keywords": [ + "typescript", + "runtime", + "decoder", + "encoder", + "schema" + ] +} \ No newline at end of file diff --git a/components/pexels/pexels.app.mjs b/components/pexels/pexels.app.mjs index 514b68f9b00b0..bdc6710141aa5 100644 --- a/components/pexels/pexels.app.mjs +++ b/components/pexels/pexels.app.mjs @@ -1,11 +1,237 @@ +import { axios } from "@pipedream/platform"; +import fs from "fs"; + export default { type: "app", app: "pexels", - propDefinitions: {}, + propDefinitions: { + searchQuery: { + type: "string", + label: "Search Query", + description: "A keyword or phrase to search for photos.", + }, + orientation: { + type: "string", + label: "Orientation", + description: "Optional orientation filter for the search.", + optional: true, + options: [ + { + label: "Landscape", + value: "landscape", + }, + { + label: "Portrait", + value: "portrait", + }, + { + label: "Square", + value: "square", + }, + ], + }, + size: { + type: "string", + label: "Size", + description: "Optional size filter for the search.", + optional: true, + options: [ + { + label: "Large", + value: "large", + }, + { + label: "Medium", + value: "medium", + }, + { + label: "Small", + value: "small", + }, + ], + }, + color: { + type: "string", + label: "Color", + description: "Optional color filter for the search.", + optional: true, + options: [ + { + label: "Red", + value: "red", + }, + { + label: "Orange", + value: "orange", + }, + { + label: "Yellow", + value: "yellow", + }, + { + label: "Green", + value: "green", + }, + { + label: "Turquoise", + value: "turquoise", + }, + { + label: "Blue", + value: "blue", + }, + { + label: "Violet", + value: "violet", + }, + { + label: "Pink", + value: "pink", + }, + { + label: "Brown", + value: "brown", + }, + { + label: "Black", + value: "black", + }, + { + label: "Gray", + value: "gray", + }, + { + label: "White", + value: "white", + }, + ], + }, + photoId: { + type: "string", + label: "Photo ID", + description: "The ID of the photo to retrieve or download.", + }, + desiredSize: { + type: "string", + label: "Desired Size", + description: "Optional size for downloading the photo.", + optional: true, + options: [ + { + label: "Original", + value: "original", + }, + { + label: "Large", + value: "large", + }, + { + label: "Medium", + value: "medium", + }, + { + label: "Small", + value: "small", + }, + ], + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.pexels.com/v1"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, method = "GET", path = "/", headers, ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + method, + url: this._baseUrl() + path, + headers: { + ...headers, + Authorization: `Bearer ${this.$auth.api_key}`, + }, + }); }, + async searchPhotos({ + query, orientation, size, color, ...opts + } = {}) { + return this._makeRequest({ + path: "/search", + params: { + query, + orientation, + size, + color, + }, + ...opts, + }); + }, + async getPhoto({ + photoId, ...opts + } = {}) { + return this._makeRequest({ + path: `/photos/${photoId}`, + ...opts, + }); + }, + async downloadPhoto({ + photoId, desiredSize = "original", ...opts + } = {}) { + const photoDetails = await this.getPhoto({ + photoId, + }); + const downloadUrl = desiredSize === "original" + ? photoDetails.src.original + : photoDetails.src[desiredSize]; + const response = await axios(this, { + method: "GET", + url: downloadUrl, + responseType: "stream", + }); + const filePath = `/tmp/photo_${photoId}_${desiredSize}.jpg`; + await new Promise((resolve, reject) => { + const writer = fs.createWriteStream(filePath); + response.data.pipe(writer); + writer.on("finish", resolve); + writer.on("error", reject); + }); + return filePath; + }, + async getCuratedPhotos(opts = {}) { + return this._makeRequest({ + path: "/curated", + ...opts, + }); + }, + async emitNewPhotos({ + searchQuery, orientation, color, ...opts + } = {}) { + const photos = await this.searchPhotos({ + query: searchQuery, + orientation, + color, + ...opts, + }); + for (const photo of photos) { + this.$emit(photo, { + summary: `New photo: ${photo.id}`, + id: photo.id, + }); + } + }, + async emitNewCuratedPhotos() { + const photos = await this.getCuratedPhotos(); + for (const photo of photos) { + this.$emit(photo, { + summary: `New curated photo: ${photo.id}`, + id: photo.id, + }); + } + }, + }, + async events({ $ }) { + await this.emitNewCuratedPhotos(); }, }; diff --git a/components/pexels/sources/new-curated-photo/new-curated-photo.mjs b/components/pexels/sources/new-curated-photo/new-curated-photo.mjs new file mode 100644 index 0000000000000..50174f3742123 --- /dev/null +++ b/components/pexels/sources/new-curated-photo/new-curated-photo.mjs @@ -0,0 +1,55 @@ +import { axios } from "@pipedream/platform"; +import pexels from "../../pexels.app.mjs"; + +export default { + key: "pexels-new-curated-photo", + name: "New Curated Photo", + description: "Emit an event when a new curated photo is added to the Pexels curated collection. [See the documentation](https://www.pexels.com/api/documentation/)", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + pexels, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: 3600, // Poll every hour + }, + }, + }, + hooks: { + async deploy() { + await this.emitNewCuratedPhotos(); + }, + }, + methods: { + _getLastPhotoId() { + return this.db.get("lastPhotoId"); + }, + _setLastPhotoId(photoId) { + this.db.set("lastPhotoId", photoId); + }, + async emitNewCuratedPhotos() { + const photos = await this.pexels.getCuratedPhotos(); + const lastPhotoId = this._getLastPhotoId(); + + for (const photo of photos) { + if (photo.id === lastPhotoId) break; + + this.$emit(photo, { + id: photo.id.toString(), + summary: `New curated photo: ${photo.url}`, + ts: new Date(photo.created_at || Date.now()).getTime(), + }); + } + + if (photos.length > 0) { + this._setLastPhotoId(photos[0].id); + } + }, + }, + async run() { + await this.emitNewCuratedPhotos(); + }, +}; diff --git a/components/pexels/sources/new-photo-by-search/new-photo-by-search.mjs b/components/pexels/sources/new-photo-by-search/new-photo-by-search.mjs new file mode 100644 index 0000000000000..da75decd102fb --- /dev/null +++ b/components/pexels/sources/new-photo-by-search/new-photo-by-search.mjs @@ -0,0 +1,110 @@ +import { + axios, DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, +} from "@pipedream/platform"; +import pexels from "../../pexels.app.mjs"; + +export default { + key: "pexels-new-photo-by-search", + name: "New Photo by Search", + description: "Emit new event when a photo is published that matches a specified search query. [See the documentation](https://www.pexels.com/api/documentation/)", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + pexels, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + searchQuery: { + propDefinition: [ + pexels, + "searchQuery", + ], + }, + orientation: { + propDefinition: [ + pexels, + "orientation", + ], + }, + color: { + propDefinition: [ + pexels, + "color", + ], + }, + }, + methods: { + _getLastPhotoId() { + return this.db.get("lastPhotoId"); + }, + _setLastPhotoId(id) { + this.db.set("lastPhotoId", id); + }, + }, + hooks: { + async deploy() { + const photos = await this.pexels.searchPhotos({ + query: this.searchQuery, + orientation: this.orientation, + color: this.color, + per_page: 50, + }); + + if (!photos || photos.length === 0) { + return; + } + + const orderedPhotos = photos.reverse(); + for (const photo of orderedPhotos.slice(0, 50)) { + this.$emit(photo, { + id: photo.id, + summary: `New photo: ${photo.photographer} - ${photo.src.original}`, + ts: photo.created_at + ? Date.parse(photo.created_at) + : new Date().getTime(), + }); + } + + this._setLastPhotoId(orderedPhotos[0].id); + }, + }, + async run() { + const lastPhotoId = this._getLastPhotoId(); + + const photos = await this.pexels.searchPhotos({ + query: this.searchQuery, + orientation: this.orientation, + color: this.color, + per_page: 50, + }); + + if (!photos || photos.length === 0) { + return; + } + + const newPhotos = []; + for (const photo of photos.reverse()) { + if (photo.id === lastPhotoId) break; + newPhotos.unshift(photo); + } + + for (const photo of newPhotos) { + this.$emit(photo, { + id: photo.id, + summary: `New photo: ${photo.photographer} - ${photo.src.original}`, + ts: photo.created_at + ? Date.parse(photo.created_at) + : new Date().getTime(), + }); + } + + if (newPhotos.length > 0) { + this._setLastPhotoId(newPhotos[0].id); + } + }, +}; From c616b5adc0314bb9544af1f80d3274d759a3a532 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 30 Apr 2025 18:43:46 -0300 Subject: [PATCH 2/7] [Components] pexels #16496 Sources - New Photo By Search - New Curated Photo Actions - Search Photos - Get Photo Details - Download Photo --- common/constants.mjs | 80 + .../actions/download-photo/download-photo.mjs | 44 +- .../get-photo-details/get-photo-details.mjs | 4 +- .../actions/search-photos/search-photos.mjs | 29 +- .../@pipedream/platform/.eslintignore | 1 - .../node_modules/@pipedream/platform/LICENSE | 41 - .../@pipedream/platform/README.md | 3 - .../@pipedream/platform/__tests__/$send.js | 342 ---- .../@pipedream/platform/__tests__/axios.js | 21 - .../@pipedream/platform/dist/axios.d.ts | 10 - .../@pipedream/platform/dist/axios.js | 186 -- .../@pipedream/platform/dist/constants.d.ts | 2 - .../@pipedream/platform/dist/constants.js | 5 - .../@pipedream/platform/dist/errors.d.ts | 4 - .../@pipedream/platform/dist/errors.js | 11 - .../@pipedream/platform/dist/index.d.ts | 137 -- .../@pipedream/platform/dist/index.js | 153 -- .../@pipedream/platform/dist/sql-prop.d.ts | 48 - .../@pipedream/platform/dist/sql-prop.js | 30 - .../@pipedream/platform/dist/sql-proxy.d.ts | 38 - .../@pipedream/platform/dist/sql-proxy.js | 41 - .../@pipedream/platform/dist/sql.d.ts | 1 - .../@pipedream/platform/dist/sql.js | 2 - .../@pipedream/platform/dist/utils.d.ts | 2 - .../@pipedream/platform/dist/utils.js | 47 - .../@pipedream/platform/lib/axios.ts | 204 -- .../@pipedream/platform/lib/constants.ts | 2 - .../@pipedream/platform/lib/errors.ts | 8 - .../@pipedream/platform/lib/index.ts | 212 --- .../@pipedream/platform/lib/sql-prop.ts | 61 - .../@pipedream/platform/lib/sql-proxy.ts | 50 - .../@pipedream/platform/lib/sql.ts | 1 - .../@pipedream/platform/lib/utils.ts | 40 - .../@pipedream/platform/package.json | 32 - .../@pipedream/platform/tsconfig.json | 15 - .../pexels/node_modules/io-ts/CHANGELOG.md | 896 --------- .../node_modules/io-ts/Codec/package.json | 6 - .../io-ts/DecodeError/package.json | 6 - .../node_modules/io-ts/Decoder/package.json | 6 - .../node_modules/io-ts/Encoder/package.json | 6 - .../pexels/node_modules/io-ts/Eq/package.json | 6 - .../io-ts/FreeSemigroup/package.json | 6 - .../node_modules/io-ts/Guard/package.json | 6 - .../node_modules/io-ts/Kleisli/package.json | 6 - components/pexels/node_modules/io-ts/LICENSE | 21 - .../io-ts/PathReporter/package.json | 6 - .../pexels/node_modules/io-ts/README.md | 43 - .../node_modules/io-ts/Reporter/package.json | 6 - .../node_modules/io-ts/Schema/package.json | 6 - .../node_modules/io-ts/Schemable/package.json | 6 - .../io-ts/TaskDecoder/package.json | 6 - .../io-ts/ThrowReporter/package.json | 6 - .../node_modules/io-ts/Type/package.json | 6 - .../pexels/node_modules/io-ts/es6/Codec.d.ts | 296 --- .../pexels/node_modules/io-ts/es6/Codec.js | 284 --- .../node_modules/io-ts/es6/DecodeError.d.ts | 135 -- .../node_modules/io-ts/es6/DecodeError.js | 95 - .../node_modules/io-ts/es6/Decoder.d.ts | 331 ---- .../pexels/node_modules/io-ts/es6/Decoder.js | 477 ----- .../node_modules/io-ts/es6/Encoder.d.ts | 154 -- .../pexels/node_modules/io-ts/es6/Encoder.js | 187 -- .../pexels/node_modules/io-ts/es6/Eq.d.ts | 127 -- .../pexels/node_modules/io-ts/es6/Eq.js | 195 -- .../node_modules/io-ts/es6/FreeSemigroup.d.ts | 56 - .../node_modules/io-ts/es6/FreeSemigroup.js | 35 - .../pexels/node_modules/io-ts/es6/Guard.d.ts | 201 -- .../pexels/node_modules/io-ts/es6/Guard.js | 295 --- .../node_modules/io-ts/es6/Kleisli.d.ts | 226 --- .../pexels/node_modules/io-ts/es6/Kleisli.js | 315 ---- .../node_modules/io-ts/es6/PathReporter.d.ts | 14 - .../node_modules/io-ts/es6/PathReporter.js | 46 - .../node_modules/io-ts/es6/Reporter.d.ts | 10 - .../pexels/node_modules/io-ts/es6/Reporter.js | 1 - .../pexels/node_modules/io-ts/es6/Schema.d.ts | 35 - .../pexels/node_modules/io-ts/es6/Schema.js | 14 - .../node_modules/io-ts/es6/Schemable.d.ts | 254 --- .../node_modules/io-ts/es6/Schemable.js | 31 - .../node_modules/io-ts/es6/TaskDecoder.d.ts | 349 ---- .../node_modules/io-ts/es6/TaskDecoder.js | 413 ----- .../node_modules/io-ts/es6/ThrowReporter.d.ts | 7 - .../node_modules/io-ts/es6/ThrowReporter.js | 18 - .../pexels/node_modules/io-ts/es6/Type.d.ts | 149 -- .../pexels/node_modules/io-ts/es6/Type.js | 210 --- .../pexels/node_modules/io-ts/es6/index.d.ts | 1374 -------------- .../pexels/node_modules/io-ts/es6/index.js | 1645 ---------------- .../pexels/node_modules/io-ts/lib/Codec.d.ts | 296 --- .../pexels/node_modules/io-ts/lib/Codec.js | 332 ---- .../node_modules/io-ts/lib/DecodeError.d.ts | 135 -- .../node_modules/io-ts/lib/DecodeError.js | 129 -- .../node_modules/io-ts/lib/Decoder.d.ts | 331 ---- .../pexels/node_modules/io-ts/lib/Decoder.js | 523 ------ .../node_modules/io-ts/lib/Encoder.d.ts | 154 -- .../pexels/node_modules/io-ts/lib/Encoder.js | 202 -- .../pexels/node_modules/io-ts/lib/Eq.d.ts | 127 -- .../pexels/node_modules/io-ts/lib/Eq.js | 226 --- .../node_modules/io-ts/lib/FreeSemigroup.d.ts | 56 - .../node_modules/io-ts/lib/FreeSemigroup.js | 42 - .../pexels/node_modules/io-ts/lib/Guard.d.ts | 201 -- .../pexels/node_modules/io-ts/lib/Guard.js | 337 ---- .../node_modules/io-ts/lib/Kleisli.d.ts | 226 --- .../pexels/node_modules/io-ts/lib/Kleisli.js | 360 ---- .../node_modules/io-ts/lib/PathReporter.d.ts | 14 - .../node_modules/io-ts/lib/PathReporter.js | 51 - .../node_modules/io-ts/lib/Reporter.d.ts | 10 - .../pexels/node_modules/io-ts/lib/Reporter.js | 2 - .../pexels/node_modules/io-ts/lib/Schema.d.ts | 35 - .../pexels/node_modules/io-ts/lib/Schema.js | 19 - .../node_modules/io-ts/lib/Schemable.d.ts | 254 --- .../node_modules/io-ts/lib/Schemable.js | 36 - .../node_modules/io-ts/lib/TaskDecoder.d.ts | 349 ---- .../node_modules/io-ts/lib/TaskDecoder.js | 457 ----- .../node_modules/io-ts/lib/ThrowReporter.d.ts | 7 - .../node_modules/io-ts/lib/ThrowReporter.js | 21 - .../pexels/node_modules/io-ts/lib/Type.d.ts | 149 -- .../pexels/node_modules/io-ts/lib/Type.js | 248 --- .../pexels/node_modules/io-ts/lib/index.d.ts | 1374 -------------- .../pexels/node_modules/io-ts/lib/index.js | 1650 ----------------- .../pexels/node_modules/io-ts/package.json | 36 - components/pexels/package.json | 4 +- components/pexels/pexels.app.mjs | 225 +-- components/pexels/sources/common/base.mjs | 61 + .../new-curated-photo/new-curated-photo.mjs | 53 +- .../sources/new-curated-photo/test-event.mjs | 22 + .../new-photo-by-search.mjs | 103 +- .../new-photo-by-search/test-event.mjs | 22 + 125 files changed, 329 insertions(+), 19486 deletions(-) create mode 100644 common/constants.mjs delete mode 100644 components/pexels/node_modules/@pipedream/platform/.eslintignore delete mode 100644 components/pexels/node_modules/@pipedream/platform/LICENSE delete mode 100644 components/pexels/node_modules/@pipedream/platform/README.md delete mode 100644 components/pexels/node_modules/@pipedream/platform/__tests__/$send.js delete mode 100644 components/pexels/node_modules/@pipedream/platform/__tests__/axios.js delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/axios.d.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/axios.js delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/constants.d.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/constants.js delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/errors.d.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/errors.js delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/index.d.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/index.js delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql-prop.d.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql-prop.js delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.d.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.js delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql.d.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/sql.js delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/utils.d.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/dist/utils.js delete mode 100644 components/pexels/node_modules/@pipedream/platform/lib/axios.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/lib/constants.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/lib/errors.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/lib/index.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/lib/sql-prop.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/lib/sql-proxy.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/lib/sql.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/lib/utils.ts delete mode 100644 components/pexels/node_modules/@pipedream/platform/package.json delete mode 100644 components/pexels/node_modules/@pipedream/platform/tsconfig.json delete mode 100644 components/pexels/node_modules/io-ts/CHANGELOG.md delete mode 100644 components/pexels/node_modules/io-ts/Codec/package.json delete mode 100644 components/pexels/node_modules/io-ts/DecodeError/package.json delete mode 100644 components/pexels/node_modules/io-ts/Decoder/package.json delete mode 100644 components/pexels/node_modules/io-ts/Encoder/package.json delete mode 100644 components/pexels/node_modules/io-ts/Eq/package.json delete mode 100644 components/pexels/node_modules/io-ts/FreeSemigroup/package.json delete mode 100644 components/pexels/node_modules/io-ts/Guard/package.json delete mode 100644 components/pexels/node_modules/io-ts/Kleisli/package.json delete mode 100644 components/pexels/node_modules/io-ts/LICENSE delete mode 100644 components/pexels/node_modules/io-ts/PathReporter/package.json delete mode 100644 components/pexels/node_modules/io-ts/README.md delete mode 100644 components/pexels/node_modules/io-ts/Reporter/package.json delete mode 100644 components/pexels/node_modules/io-ts/Schema/package.json delete mode 100644 components/pexels/node_modules/io-ts/Schemable/package.json delete mode 100644 components/pexels/node_modules/io-ts/TaskDecoder/package.json delete mode 100644 components/pexels/node_modules/io-ts/ThrowReporter/package.json delete mode 100644 components/pexels/node_modules/io-ts/Type/package.json delete mode 100644 components/pexels/node_modules/io-ts/es6/Codec.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/Codec.js delete mode 100644 components/pexels/node_modules/io-ts/es6/DecodeError.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/DecodeError.js delete mode 100644 components/pexels/node_modules/io-ts/es6/Decoder.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/Decoder.js delete mode 100644 components/pexels/node_modules/io-ts/es6/Encoder.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/Encoder.js delete mode 100644 components/pexels/node_modules/io-ts/es6/Eq.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/Eq.js delete mode 100644 components/pexels/node_modules/io-ts/es6/FreeSemigroup.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/FreeSemigroup.js delete mode 100644 components/pexels/node_modules/io-ts/es6/Guard.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/Guard.js delete mode 100644 components/pexels/node_modules/io-ts/es6/Kleisli.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/Kleisli.js delete mode 100644 components/pexels/node_modules/io-ts/es6/PathReporter.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/PathReporter.js delete mode 100644 components/pexels/node_modules/io-ts/es6/Reporter.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/Reporter.js delete mode 100644 components/pexels/node_modules/io-ts/es6/Schema.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/Schema.js delete mode 100644 components/pexels/node_modules/io-ts/es6/Schemable.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/Schemable.js delete mode 100644 components/pexels/node_modules/io-ts/es6/TaskDecoder.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/TaskDecoder.js delete mode 100644 components/pexels/node_modules/io-ts/es6/ThrowReporter.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/ThrowReporter.js delete mode 100644 components/pexels/node_modules/io-ts/es6/Type.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/Type.js delete mode 100644 components/pexels/node_modules/io-ts/es6/index.d.ts delete mode 100644 components/pexels/node_modules/io-ts/es6/index.js delete mode 100644 components/pexels/node_modules/io-ts/lib/Codec.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/Codec.js delete mode 100644 components/pexels/node_modules/io-ts/lib/DecodeError.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/DecodeError.js delete mode 100644 components/pexels/node_modules/io-ts/lib/Decoder.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/Decoder.js delete mode 100644 components/pexels/node_modules/io-ts/lib/Encoder.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/Encoder.js delete mode 100644 components/pexels/node_modules/io-ts/lib/Eq.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/Eq.js delete mode 100644 components/pexels/node_modules/io-ts/lib/FreeSemigroup.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/FreeSemigroup.js delete mode 100644 components/pexels/node_modules/io-ts/lib/Guard.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/Guard.js delete mode 100644 components/pexels/node_modules/io-ts/lib/Kleisli.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/Kleisli.js delete mode 100644 components/pexels/node_modules/io-ts/lib/PathReporter.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/PathReporter.js delete mode 100644 components/pexels/node_modules/io-ts/lib/Reporter.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/Reporter.js delete mode 100644 components/pexels/node_modules/io-ts/lib/Schema.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/Schema.js delete mode 100644 components/pexels/node_modules/io-ts/lib/Schemable.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/Schemable.js delete mode 100644 components/pexels/node_modules/io-ts/lib/TaskDecoder.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/TaskDecoder.js delete mode 100644 components/pexels/node_modules/io-ts/lib/ThrowReporter.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/ThrowReporter.js delete mode 100644 components/pexels/node_modules/io-ts/lib/Type.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/Type.js delete mode 100644 components/pexels/node_modules/io-ts/lib/index.d.ts delete mode 100644 components/pexels/node_modules/io-ts/lib/index.js delete mode 100644 components/pexels/node_modules/io-ts/package.json create mode 100644 components/pexels/sources/common/base.mjs create mode 100644 components/pexels/sources/new-curated-photo/test-event.mjs create mode 100644 components/pexels/sources/new-photo-by-search/test-event.mjs diff --git a/common/constants.mjs b/common/constants.mjs new file mode 100644 index 0000000000000..ece9f78eef47e --- /dev/null +++ b/common/constants.mjs @@ -0,0 +1,80 @@ +export const ORIENTATION_OPTIONS = [ + { + label: "Landscape", + value: "landscape", + }, + { + label: "Portrait", + value: "portrait", + }, + { + label: "Square", + value: "square", + }, +]; + +export const SIZE_OPTIONS = [ + { + label: "Large (24MP)", + value: "large", + }, + { + label: "Medium (12MP)", + value: "medium", + }, + { + label: "Small (4MP)", + value: "small", + }, +]; + +export const COLOR_OPTIONS = [ + { + label: "Red", + value: "red", + }, + { + label: "Orange", + value: "orange", + }, + { + label: "Yellow", + value: "yellow", + }, + { + label: "Green", + value: "green", + }, + { + label: "Turquoise", + value: "turquoise", + }, + { + label: "Blue", + value: "blue", + }, + { + label: "Violet", + value: "violet", + }, + { + label: "Pink", + value: "pink", + }, + { + label: "Brown", + value: "brown", + }, + { + label: "Black", + value: "black", + }, + { + label: "Gray", + value: "gray", + }, + { + label: "White", + value: "white", + }, +]; diff --git a/components/pexels/actions/download-photo/download-photo.mjs b/components/pexels/actions/download-photo/download-photo.mjs index 7d04cc9ebc7f5..5ab4dbaf1c47f 100644 --- a/components/pexels/actions/download-photo/download-photo.mjs +++ b/components/pexels/actions/download-photo/download-photo.mjs @@ -1,6 +1,8 @@ -import pexels from "../../pexels.app.mjs"; import { axios } from "@pipedream/platform"; import fs from "fs"; +import stream from "stream"; +import { promisify } from "util"; +import pexels from "../../pexels.app.mjs"; export default { key: "pexels-download-photo", @@ -16,22 +18,44 @@ export default { "photoId", ], }, - desiredSize: { - propDefinition: [ - pexels, - "desiredSize", - ], + filePath: { + type: "string", + label: "File Path", + description: "The destination path in [`/tmp`](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory) for the downloaded the file (e.g., `/tmp/myFile.jpg`). Make sure to include the file extension.", + }, + }, + methods: { + getFileStream({ + $, downloadUrl, + }) { + return axios($, { + url: downloadUrl, + responseType: "stream", + }); }, }, async run({ $ }) { - const filePath = await this.pexels.downloadPhoto({ + const response = await this.pexels.getPhoto({ + $, photoId: this.photoId, - desiredSize: this.desiredSize, }); - $.export("$summary", `Successfully downloaded photo with ID ${this.photoId} to ${filePath}`); + const fileStream = await this.getFileStream({ + $, + downloadUrl: response.src.original, + }); + + const pipeline = promisify(stream.pipeline); + const resp = await pipeline( + fileStream, + fs.createWriteStream(this.filePath.includes("/tmp") + ? this.filePath + : `/tmp/${this.filePath}`), + ); + + $.export("$summary", `Successfully downloaded photo with ID ${this.photoId} to ${this.filePath}`); return { - filePath, + resp, }; }, }; diff --git a/components/pexels/actions/get-photo-details/get-photo-details.mjs b/components/pexels/actions/get-photo-details/get-photo-details.mjs index 6c78cc4f15182..46d1fd6913d6b 100644 --- a/components/pexels/actions/get-photo-details/get-photo-details.mjs +++ b/components/pexels/actions/get-photo-details/get-photo-details.mjs @@ -1,10 +1,9 @@ import pexels from "../../pexels.app.mjs"; -import { axios } from "@pipedream/platform"; export default { key: "pexels-get-photo-details", name: "Get Photo Details", - description: "Retrieve detailed information about a specific photo by providing its photo ID. [See the documentation](https://www.pexels.com/api/documentation/)", + description: "Retrieve detailed information about a specific photo by providing its photo ID. [See the documentation](https://www.pexels.com/api/documentation/#photos-show)", version: "0.0.1", type: "action", props: { @@ -18,6 +17,7 @@ export default { }, async run({ $ }) { const response = await this.pexels.getPhoto({ + $, photoId: this.photoId, }); $.export("$summary", `Successfully retrieved details for photo ID: ${this.photoId}`); diff --git a/components/pexels/actions/search-photos/search-photos.mjs b/components/pexels/actions/search-photos/search-photos.mjs index 0c3f75cec8fe8..08372f4a4096f 100644 --- a/components/pexels/actions/search-photos/search-photos.mjs +++ b/components/pexels/actions/search-photos/search-photos.mjs @@ -1,10 +1,9 @@ import pexels from "../../pexels.app.mjs"; -import { axios } from "@pipedream/platform"; export default { key: "pexels-search-photos", name: "Search Photos", - description: "Search for photos on Pexels using a keyword or phrase. [See the documentation](https://www.pexels.com/api/documentation/)", + description: "Search for photos on Pexels using a keyword or phrase. [See the documentation](https://www.pexels.com/api/documentation/#photos-search)", version: "0.0.1", type: "action", props: { @@ -33,13 +32,31 @@ export default { "color", ], }, + page: { + type: "Integer", + label: "Page", + description: "The page number you are requesting", + optional: true, + }, + perPage: { + type: "Integer", + label: "Per Page", + description: "The number of results you are requesting per page", + max: 80, + optional: true, + }, }, async run({ $ }) { const response = await this.pexels.searchPhotos({ - query: this.searchQuery, - orientation: this.orientation, - size: this.size, - color: this.color, + $, + params: { + query: this.searchQuery, + orientation: this.orientation, + size: this.size, + color: this.color, + page: this.page || 1, + per_page: this.perPage || 15, + }, }); $.export("$summary", `Successfully retrieved ${response.photos.length} photos for the query "${this.searchQuery}".`); diff --git a/components/pexels/node_modules/@pipedream/platform/.eslintignore b/components/pexels/node_modules/@pipedream/platform/.eslintignore deleted file mode 100644 index 849ddff3b7ec9..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -dist/ diff --git a/components/pexels/node_modules/@pipedream/platform/LICENSE b/components/pexels/node_modules/@pipedream/platform/LICENSE deleted file mode 100644 index 5fc16fc5c8977..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/LICENSE +++ /dev/null @@ -1,41 +0,0 @@ -Pipedream Source Available License Version 1.0 - -This Pipedream Source Available License Agreement Version 1.0 (this “Agreement”) sets forth the terms on which Pipedream, Inc., a Delaware corporation (“Pipedream”) makes available certain software (the “Software”). By installing, downloading, accessing, using or distributing the Software, you agree to the terms of this Agreement. If you do not agree to such terms, you must not use the Software. If you are receiving the Software on behalf of a legal entity, you represent and warrant that you have the actual authority to agree to the terms and conditions of this Agreement on behalf of such entity. “Licensee” means you, an individual, or the entity on whose behalf you are receiving the Software. - -LICENSE GRANT AND CONDITIONS. - -1.1 License. Subject to the terms and conditions of this Agreement, Pipedream hereby grants to Licensee a non-exclusive, royalty-free, worldwide, non-transferable, non-sublicenseable license during the term of this Agreement to use, prepare modifications and derivative works, distribute (including without limitation in source code or object code form) and reproduce copies of the Software (the “License”). Licensee is not granted the right to, and Licensee shall not, exercise the License for an Excluded Purpose. For purposes of this Agreement, “Excluded Purpose” means any commercial use of the software including, but not limited to, making available any software-as-a-service, platform-as-a-service, infrastructure-as-a-service or other online service that competes with the Software or any other Pipedream products or services. - -1.2 Conditions. In consideration of the License, Licensee’s distribution of the Software is subject to the following conditions: - -a. Licensee must cause any Software modified by Licensee to carry prominent notices stating that Licensee modified the Software. - -b. On each Software copy, Licensee shall reproduce and not remove or alter all Pipedream or third party copyright or other proprietary notices contained in the Software, and Licensee must provide this with each copy: “This software is made available by Pipedream, Inc., under the terms of the Pipedream Source Available License, Version 1.0 located at https://github.com/PipedreamHQ/pipedream/blob/master/LICENSE. By installing, downloading, accessing, using or distributing the Software, you agree to the terms of such License Agreement.” - -1.3 Modifications. Licensee may add its own copyright notices to modifications made by Licensee and may provide additional or different license terms and conditions for use, reproduction, or distribution of Licensee’s modifications. While redistributing the Software or modifications thereof, Licensee may choose to offer, for a fee or free of charge, support, warranty, indemnity, or other obligations. Licensee, and not Pipedream, will be responsible for any such obligations. - -1.4 No Sublicensing. The License does not include the right to sublicense the Software; provided, however, that any recipient to which Licensee provides the Software may exercise the License so long as such recipient agrees to the terms and conditions of this Agreement. - -TERM AND TERMINATION. - -This Agreement will continue unless and until earlier terminated as set forth herein. If Licensee breaches any of its conditions or obligations under this Agreement, this Agreement will terminate automatically and the License will terminate automatically and permanently. - -INTELLECTUAL PROPERTY. - -As between the parties, Pipedream retains all right, title, and interest in the Software, and all intellectual property rights therein. Pipedream hereby reserves all rights not expressly granted to Licensee in this Agreement. Pipedream reserves all rights in its trademarks and service marks, and no licenses thereto are granted by this Agreement. - -DISCLAIMER. - -PIPEDREAM HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE SOFTWARE. - -LIMITATION OF LIABILITY. - -PIPEDREAM WILL NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL, SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW. - -GENERAL. - -6.1 Governing Law. This Agreement will be governed by and interpreted in accordance with the laws of the state of California, without reference to its conflict of laws principles. If Licensee is located outside of the United States, any dispute, controversy or claim arising out of or relating to this Agreement will be referred to and finally determined by arbitration in accordance with the JAMS International Arbitration Rules. The tribunal will consist of one arbitrator. Judgment upon the award rendered by the arbitrator may be entered in any court having jurisdiction thereof. All disputes including arbitrations shall take place in Santa Clara County, California. The language to be used in any such proceedings shall be English. - -6.2. Assignment. Licensee is not authorized to assign its rights under this Agreement to any third party. Pipedream may freely assign its rights under this Agreement to any third party. - -6.3. Other. This Agreement is the entire agreement between the parties regarding the subject matter hereof. No amendment or modification of this Agreement will be valid or binding upon the parties unless made in writing and signed by the duly authorized representatives of both parties. In the event that any provision, including without limitation any condition, of this Agreement is held to be unenforceable, this Agreement and all licenses and rights granted hereunder will immediately terminate. Waiver by Pipedream of a breach of any provision of this Agreement or the failure by Pipedream to exercise any right hereunder will not be construed as a waiver of any subsequent breach of that right or as a waiver of any other right. diff --git a/components/pexels/node_modules/@pipedream/platform/README.md b/components/pexels/node_modules/@pipedream/platform/README.md deleted file mode 100644 index 28a37af48f59c..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Pipedream Platform - -See https://pipedream.com/docs/pipedream-axios/ for usage examples. diff --git a/components/pexels/node_modules/@pipedream/platform/__tests__/$send.js b/components/pexels/node_modules/@pipedream/platform/__tests__/$send.js deleted file mode 100644 index ebacb4e8838fb..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/__tests__/$send.js +++ /dev/null @@ -1,342 +0,0 @@ -// purposefully test COMPILED platform.js! (just as lambda_maker would) -const { - $sendConfigRuntimeTypeChecker, HTTP_METHODS, -} = require("../dist"); - -function randString() { - return "" + Math.random(); -} - -function randHttpMethod() { - const idx = Math.floor(Math.random() * HTTP_METHODS.length); - return HTTP_METHODS[idx]; -} - -const emptyConfig = {}; - -// XXX would be nice to generate a lot of these tests automatically... -// - should vary payload type (between string and object) - -describe("$send.email", () => { - const checker = $sendConfigRuntimeTypeChecker.email; - let config; - beforeEach(() => { - config = { - html: randString(), - subject: randString(), - text: randString(), - }; - }); - - it("should pass with empty config", () => { - expect(() => checker(emptyConfig)).not.toThrow(); - }); - - it("should pass with full config", () => { - expect(() => checker(config)).not.toThrow(); - }); - - it.skip("should fail with .__extra", () => { - config.__extra = randString(); - expect(() => checker(config)).toThrow(); - }); -}); - -describe("$send.emit", () => { - const checker = $sendConfigRuntimeTypeChecker.emit; - let config; - beforeEach(() => { - config = { - raw_event: { - key: randString(), - }, - }; - }); - - it("should fail with empty config", () => { - expect(() => checker({})).toThrow(); - }); - - it("should pass with full config", () => { - expect(() => checker(config)).not.toThrow(); - }); - - it.skip("should fail with .__extra", () => { - config.__extra = randString(); - expect(() => checker(config)).toThrow(); - }); -}); - -describe("$send.http", () => { - const checker = $sendConfigRuntimeTypeChecker.http; - let config; - beforeEach(() => { - config = { - method: randHttpMethod(), - url: randString(), - auth: { - password: randString(), - username: randString(), - }, - data: randString(), - headers: { - [randString()]: randString(), - [randString()]: randString(), - }, - params: { - [randString()]: randString(), - [randString()]: randString(), - }, - }; - }); - - it("should fail with empty config", () => { - expect(() => checker({})).toThrow(); - }); - - it("should pass with full config", () => { - expect(() => checker(config)).not.toThrow(); - }); - - it.skip("should fail with .__extra", () => { - config.__extra = randString(); - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .method", () => { - delete config.method; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .url", () => { - delete config.url; - expect(() => checker(config)).toThrow(); - }); - - it("should pass without .auth", () => { - delete config.auth; - expect(() => checker(config)).not.toThrow(); - }); - - it("should fail without .auth.username", () => { - delete config.auth.username; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .auth.password", () => { - delete config.auth.password; - expect(() => checker(config)).toThrow(); - }); - - it.skip("should fail with .auth.__extra", () => { - config.auth.__extra = randString(); - expect(() => checker(config)).toThrow(); - }); - - it("should pass without .data", () => { - delete config.data; - expect(() => checker(config)).not.toThrow(); - }); - - it("should pass with object .data", () => { - config.data = { - [randString()]: randString(), - [randString()]: randString(), - }; - expect(() => checker(config)).not.toThrow(); - }); - - it("should pass without .headers", () => { - delete config.headers; - expect(() => checker(config)).not.toThrow(); - }); - - it("should pass without .params", () => { - delete config.params; - expect(() => checker(config)).not.toThrow(); - }); -}); - -describe("$send.s3", () => { - const checker = $sendConfigRuntimeTypeChecker.s3; - let config; - beforeEach(() => { - config = { - bucket: randString(), - payload: randString(), - prefix: randString(), - }; - }); - - it("should fail with empty config", () => { - expect(() => checker({})).toThrow(); - }); - - it("should pass with full config", () => { - expect(() => checker(config)).not.toThrow(); - }); - - it.skip("should fail with .__extra", () => { - config.__extra = randString(); - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .bucket", () => { - delete config.bucket; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .payload", () => { - delete config.payload; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .prefix", () => { - delete config.prefix; - expect(() => checker(config)).toThrow(); - }); -}); - -describe("$send.sql", () => { - const checker = $sendConfigRuntimeTypeChecker.sql; - let config; - beforeEach(() => { - config = { - payload: randString(), - table: randString(), - }; - }); - - it("should fail with empty config", () => { - expect(() => checker({})).toThrow(); - }); - - it("should pass with full config", () => { - expect(() => checker(config)).not.toThrow(); - }); - - it.skip("should fail with .__extra", () => { - config.__extra = randString(); - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .payload", () => { - delete config.payload; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .table", () => { - delete config.table; - expect(() => checker(config)).toThrow(); - }); -}); - -describe("$send.snowflake", () => { - const checker = $sendConfigRuntimeTypeChecker.snowflake; - let config; - beforeEach(() => { - config = { - account: randString(), - database: randString(), - host: randString(), - payload: randString(), - pipe_name: randString(), - private_key: randString(), - schema: randString(), - stage_name: randString(), - user: randString(), - }; - }); - - it("should fail with empty config", () => { - expect(() => checker({})).toThrow(); - }); - - it("should pass with full config", () => { - expect(() => checker(config)).not.toThrow(); - }); - - it.skip("should fail with .__extra", () => { - config.__extra = randString(); - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .account", () => { - delete config.account; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .database", () => { - delete config.database; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .host", () => { - delete config.host; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .payload", () => { - delete config.payload; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .pipe_name", () => { - delete config.pipe_name; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .private_key", () => { - delete config.private_key; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .schema", () => { - delete config.schema; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .stage_name", () => { - delete config.stage_name; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .user", () => { - delete config.stage_name; - expect(() => checker(config)).toThrow(); - }); -}); - -describe("$send.sse", () => { - const checker = $sendConfigRuntimeTypeChecker.sse; - let config; - beforeEach(() => { - config = { - channel: randString(), - payload: randString(), - }; - }); - - it("should fail with empty config", () => { - expect(() => checker({})).toThrow(); - }); - - it("should pass with full config", () => { - expect(() => checker(config)).not.toThrow(); - }); - - it.skip("should fail with .__extra", () => { - config.__extra = randString(); - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .channel", () => { - delete config.channel; - expect(() => checker(config)).toThrow(); - }); - - it("should fail without .payload", () => { - delete config.payload; - expect(() => checker(config)).toThrow(); - }); -}); diff --git a/components/pexels/node_modules/@pipedream/platform/__tests__/axios.js b/components/pexels/node_modules/@pipedream/platform/__tests__/axios.js deleted file mode 100644 index 1172548260326..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/__tests__/axios.js +++ /dev/null @@ -1,21 +0,0 @@ -const { axios } = require("../dist"); - -describe("axios", () => { - it("should fail as expected", async () => { - const step = {}; - await expect(axios(step, { - url: "http://56371f3c71069f63d769d0b7ddeca4ac.x.pipedream.net/this-should-404", - })).rejects.toThrow(); - expect(step.debug).toHaveProperty("config"); - }); - - it("should contain debug", async () => { - const step = {}; - await axios(step, { - url: "https://api.github.com/users/defunkt", - debug: true, - }); - expect(step).toHaveProperty("debug_config"); - expect(step).toHaveProperty("debug_response"); - }); -}); diff --git a/components/pexels/node_modules/@pipedream/platform/dist/axios.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/axios.d.ts deleted file mode 100644 index b6c1207240536..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/axios.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { AxiosRequestConfig } from "./index"; -export declare function transformConfigForOauth(config: AxiosRequestConfig): { - method: string; - url: string; -}; -declare function callAxios(step: any, config: AxiosRequestConfig, signConfig?: any): Promise; -declare namespace callAxios { - var create: (config?: AxiosRequestConfig | undefined, signConfig?: any) => import("axios").AxiosInstance; -} -export default callAxios; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/axios.js b/components/pexels/node_modules/@pipedream/platform/dist/axios.js deleted file mode 100644 index 3b6d1f49a86d4..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/axios.js +++ /dev/null @@ -1,186 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.transformConfigForOauth = void 0; -const axios_1 = require("axios"); -const querystring = require("querystring"); -const utils_1 = require("./utils"); -const errors_1 = require("./errors"); -function cleanObject(o = {}) { - for (const k in o) { - if (typeof o[k] === "undefined") { - delete o[k]; - } - } -} -// remove query params from url and put into config.params -function removeSearchFromUrl(config) { - if (!config.url) - return; - const { url, baseURL, } = config; - const newUrl = new URL((baseURL !== null && baseURL !== void 0 ? baseURL : "") + url); - const queryString = newUrl.search.substr(1); - if (queryString) { - // https://stackoverflow.com/a/8649003/387413 - const urlParams = JSON.parse("{\"" + queryString.replace(/&/g, "\",\"").replace(/=/g, "\":\"") + "\"}", function (key, value) { - return key === "" - ? value - : decodeURIComponent(value); - }); - for (const k in urlParams) { - if (!config.params) - config.params = {}; - if (k in config.params) - continue; // params object > url query params - config.params[k] = urlParams[k]; - } - newUrl.search = ""; - config.url = newUrl.toString(); // if ends with ? should be okay, but could be cleaner - } -} -// https://github.com/ttezel/twit/blob/master/lib/helpers.js#L11 -function oauth1ParamsSerializer(p) { - return querystring.stringify(p) - .replace(/!/g, "%21") - .replace(/'/g, "%27") - .replace(/\(/g, "%28") - .replace(/\)/g, "%29") - .replace(/\*/g, "%2A"); -} -function transformConfigForOauth(config) { - var _a; - const newUrl = axios_1.default.getUri({ - ...config, - paramsSerializer: oauth1ParamsSerializer, - }); - const requestData = { - method: config.method || "get", - url: newUrl, - }; - // the OAuth specification explicitly states that only form-encoded data should be included - let hasContentType = false; - let formEncodedContentType = false; - for (const k in config.headers || {}) { - if (/content-type/i.test(k)) { - hasContentType = true; - formEncodedContentType = ((_a = config.headers) === null || _a === void 0 ? void 0 : _a[k]) === "application/x-www-form-urlencoded"; - break; - } - } - if (config.data && typeof config.data === "object" && formEncodedContentType) { - requestData.data = config.data; - } - else if (typeof config.data === "string" && (!hasContentType || formEncodedContentType)) { - requestData.data = querystring.parse(config.data); - } - config.paramsSerializer = oauth1ParamsSerializer; - return requestData; -} -exports.transformConfigForOauth = transformConfigForOauth; -async function getOauthSignature(config, signConfig) { - const { oauthSignerUri, token, } = signConfig; - const requestData = transformConfigForOauth(config); - const payload = { - requestData, - token, - }; - return (await axios_1.default.post(oauthSignerUri, payload)).data; -} -// XXX warn about mutating config object... or clone? -async function callAxios(step, config, signConfig) { - cleanObject(config.headers); - cleanObject(config.params); - if (typeof config.data === "object") { - cleanObject(config.data); - } - if (config.body != null) { - throw new errors_1.ConfigurationError("unexpected body, use only data instead"); - } - removeSearchFromUrl(config); - // OAuth1 request - if (signConfig) { - const oauthSignature = await getOauthSignature(config, signConfig); - if (!config.headers) - config.headers = {}; - config.headers.Authorization = oauthSignature; - } - try { - if (config.debug) { - stepExport(step, config, "debug_config"); - } - const response = await axios_1.default(config); - if (config.debug) { - stepExport(step, response.data, "debug_response"); - } - return config.returnFullResponse - ? response - : response.data; - } - catch (err) { - if (err.response) { - convertAxiosError(err); - stepExport(step, err.response, "debug"); - } - throw err; - } -} -function stepExport(step, message, key) { - message = utils_1.cloneSafe(message); - if (step) { - if (step.export) { - step.export(key, message); - return; - } - step[key] = message; - } - console.log(`export: ${key} - ${JSON.stringify(message, null, 2)}`); -} -function convertAxiosError(err) { - delete err.response.request; - err.name = `${err.name} - ${err.message}`; - try { - err.message = JSON.stringify(err.response.data); - } - catch (error) { - console.error("Error trying to convert `err.response.data` to string"); - } - return err; -} -function create(config, signConfig) { - const axiosInstance = axios_1.default.create(config); - if (config === null || config === void 0 ? void 0 : config.debug) { - stepExport(this, config, "debug_config"); - } - axiosInstance.interceptors.request.use(async (config) => { - if (signConfig) { - const oauthSignature = await getOauthSignature(config, signConfig); - if (!config.headers) - config.headers = {}; - config.headers.Authorization = oauthSignature; - } - cleanObject(config.headers); - cleanObject(config.params); - if (typeof config.data === "object") { - cleanObject(config.data); - } - removeSearchFromUrl(config); - return config; - }); - axiosInstance.interceptors.response.use((response) => { - const config = response.config; - if (config.debug) { - stepExport(this, response.data, "debug_response"); - } - return config.returnFullResponse - ? response - : response.data; - }, (error) => { - if (error.response) { - convertAxiosError(error); - stepExport(this, error.response, "debug"); - } - throw error; - }); - return axiosInstance; -} -callAxios.create = create; -exports.default = callAxios; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/constants.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/constants.d.ts deleted file mode 100644 index 4f72a54933d77..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/constants.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const DEFAULT_POLLING_SOURCE_TIMER_INTERVAL: number; -export declare const PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID = "fnd4m13k1mjb6djallp1m9kr7o8kslcu"; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/constants.js b/components/pexels/node_modules/@pipedream/platform/dist/constants.js deleted file mode 100644 index 98a5374e30163..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/constants.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID = exports.DEFAULT_POLLING_SOURCE_TIMER_INTERVAL = void 0; -exports.DEFAULT_POLLING_SOURCE_TIMER_INTERVAL = 60 * 15; -exports.PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID = "fnd4m13k1mjb6djallp1m9kr7o8kslcu"; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/errors.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/errors.d.ts deleted file mode 100644 index 932c557422a19..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/errors.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare class ConfigurationError extends Error { - exposeStack: boolean; - constructor(message: string, exposeStack?: boolean); -} diff --git a/components/pexels/node_modules/@pipedream/platform/dist/errors.js b/components/pexels/node_modules/@pipedream/platform/dist/errors.js deleted file mode 100644 index 4f953aa9ab835..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/errors.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConfigurationError = void 0; -class ConfigurationError extends Error { - constructor(message, exposeStack = false) { - super(message); - this.name = "ConfigurationError"; - this.exposeStack = exposeStack; - } -} -exports.ConfigurationError = ConfigurationError; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/index.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/index.d.ts deleted file mode 100644 index a68f663ae5e1a..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/index.d.ts +++ /dev/null @@ -1,137 +0,0 @@ -import * as t from "io-ts"; -import axios, { transformConfigForOauth } from "./axios"; -import { AxiosRequestConfig as AxiosConfig } from "axios"; -export { axios, transformConfigForOauth, }; -export { cloneSafe, jsonStringifySafe, } from "./utils"; -export { ConfigurationError, } from "./errors"; -export { default as sqlProp, } from "./sql-prop"; -export type { ColumnSchema, DbInfo, TableInfo, TableMetadata, TableSchema, } from "./sql-prop"; -export { default as sqlProxy, } from "./sql-proxy"; -export { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID, } from "./constants"; -export declare const SendConfigEmail: t.PartialC<{ - html: t.StringC; - subject: t.StringC; - text: t.StringC; -}>; -export declare type SendConfigEmail = t.TypeOf; -export declare const SendConfigEmit_required: t.ExactC>; -export declare const SendConfigEmit_optional: t.PartialC<{ - event: t.ObjectC; -}>; -export declare const SendConfigEmit: t.IntersectionC<[t.ExactC>, t.PartialC<{ - event: t.ObjectC; -}>]>; -export declare type SendConfigEmit = t.TypeOf; -export declare const HTTP_METHODS: string[]; -export declare const SendConfigHTTP: t.IntersectionC<[t.ExactC; - url: t.StringC; -}>>, t.PartialC<{ - auth: t.ExactC>; - data: t.UnionC<[t.StringC, t.ObjectC]>; - headers: t.ObjectC; - params: t.ObjectC; -}>]>; -export declare type SendConfigHTTP = t.TypeOf; -export declare const SendConfigS3: t.ExactC; - prefix: t.StringC; -}>>; -export declare type SendConfigS3 = t.TypeOf; -export declare const SendConfigSQL: t.ExactC; - table: t.StringC; -}>>; -export declare type SendConfigSQL = t.TypeOf; -export declare const SendConfigSnowflake: t.ExactC; - pipe_name: t.StringC; - private_key: t.StringC; - schema: t.StringC; - stage_name: t.StringC; - user: t.StringC; -}>>; -export declare type SendConfigSnowflake = t.TypeOf; -export declare const SendConfigSSE: t.ExactC; -}>>; -export declare type SendConfigSSE = t.TypeOf; -interface SendFunctionsWrapper { - email: (config: SendConfigEmail) => void; - emit: (config: SendConfigEmit) => void; - http: (config: SendConfigHTTP) => void; - s3: (config: SendConfigS3) => void; - sql: (config: SendConfigSQL) => void; - snowflake: (config: SendConfigSnowflake) => void; - sse: (config: SendConfigSSE) => void; -} -export declare const sendTypeMap: { - email: t.PartialC<{ - html: t.StringC; - subject: t.StringC; - text: t.StringC; - }>; - emit: t.IntersectionC<[t.ExactC>, t.PartialC<{ - event: t.ObjectC; - }>]>; - http: t.IntersectionC<[t.ExactC; - url: t.StringC; - }>>, t.PartialC<{ - auth: t.ExactC>; - data: t.UnionC<[t.StringC, t.ObjectC]>; - headers: t.ObjectC; - params: t.ObjectC; - }>]>; - s3: t.ExactC; - prefix: t.StringC; - }>>; - sql: t.ExactC; - table: t.StringC; - }>>; - snowflake: t.ExactC; - pipe_name: t.StringC; - private_key: t.StringC; - schema: t.StringC; - stage_name: t.StringC; - user: t.StringC; - }>>; - sse: t.ExactC; - }>>; -}; -export declare let $event: any; -export declare const END_NEEDLE = "__pd_end"; -export declare function $end(message?: string): void; -export declare let $send: SendFunctionsWrapper; -export declare const $sendConfigRuntimeTypeChecker: {}; -export interface AxiosRequestConfig extends AxiosConfig { - debug?: boolean; - body?: any; - returnFullResponse?: boolean; -} diff --git a/components/pexels/node_modules/@pipedream/platform/dist/index.js b/components/pexels/node_modules/@pipedream/platform/dist/index.js deleted file mode 100644 index b34b761357888..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/index.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.$sendConfigRuntimeTypeChecker = exports.$send = exports.$end = exports.END_NEEDLE = exports.$event = exports.sendTypeMap = exports.SendConfigSSE = exports.SendConfigSnowflake = exports.SendConfigSQL = exports.SendConfigS3 = exports.SendConfigHTTP = exports.HTTP_METHODS = exports.SendConfigEmit = exports.SendConfigEmit_optional = exports.SendConfigEmit_required = exports.SendConfigEmail = exports.transformConfigForOauth = exports.axios = void 0; -const t = require("io-ts"); -const axios_1 = require("./axios"); -exports.axios = axios_1.default; -Object.defineProperty(exports, "transformConfigForOauth", { enumerable: true, get: function () { return axios_1.transformConfigForOauth; } }); -var utils_1 = require("./utils"); -Object.defineProperty(exports, "cloneSafe", { enumerable: true, get: function () { return utils_1.cloneSafe; } }); -Object.defineProperty(exports, "jsonStringifySafe", { enumerable: true, get: function () { return utils_1.jsonStringifySafe; } }); -var errors_1 = require("./errors"); -Object.defineProperty(exports, "ConfigurationError", { enumerable: true, get: function () { return errors_1.ConfigurationError; } }); -var sql_prop_1 = require("./sql-prop"); -Object.defineProperty(exports, "sqlProp", { enumerable: true, get: function () { return sql_prop_1.default; } }); -var sql_proxy_1 = require("./sql-proxy"); -Object.defineProperty(exports, "sqlProxy", { enumerable: true, get: function () { return sql_proxy_1.default; } }); -var constants_1 = require("./constants"); -Object.defineProperty(exports, "DEFAULT_POLLING_SOURCE_TIMER_INTERVAL", { enumerable: true, get: function () { return constants_1.DEFAULT_POLLING_SOURCE_TIMER_INTERVAL; } }); -Object.defineProperty(exports, "PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID", { enumerable: true, get: function () { return constants_1.PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID; } }); -const SendPayload = t.union([ - t.string, - t.object, -]); -exports.SendConfigEmail = t.partial({ - html: t.string, - subject: t.string, - text: t.string, -}); -exports.SendConfigEmit_required = t.strict({ - raw_event: t.object, -}); -exports.SendConfigEmit_optional = t.partial({ - event: t.object, -}); -exports.SendConfigEmit = t.intersection([ - exports.SendConfigEmit_required, - exports.SendConfigEmit_optional, -]); -// interface SendConfigHTTPKv { -// [key: string]: string; -// } -const SendConfigHTTPKv = t.object; // XXX should be type above -const SendConfigHTTPAuth = t.strict({ - password: t.string, - username: t.string, -}); -// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods -exports.HTTP_METHODS = [ - "GET", - "HEAD", - "POST", - "PUT", - "DELETE", - "CONNECT", - "OPTIONS", - "TRACE", - "PATCH", -]; -// HTTP method must be uppercase (for kotlin in coordinator -- i voted to make it case insensitive, but w.e for now) -const SendConfigHTTPMethod = t.keyof(exports.HTTP_METHODS.reduce((acc, v) => { - acc[v] = null; - return acc; -}, {})); -const SendConfigHTTP_required = t.strict({ - method: SendConfigHTTPMethod, - url: t.string, -}); -const SendConfigHTTP_optional = t.partial({ - auth: SendConfigHTTPAuth, - data: SendPayload, - headers: SendConfigHTTPKv, - params: SendConfigHTTPKv, -}); -exports.SendConfigHTTP = t.intersection([ - SendConfigHTTP_required, - SendConfigHTTP_optional, -]); -exports.SendConfigS3 = t.strict({ - bucket: t.string, - payload: SendPayload, - prefix: t.string, -}); -exports.SendConfigSQL = t.strict({ - payload: SendPayload, - table: t.string, -}); -exports.SendConfigSnowflake = t.strict({ - account: t.string, - database: t.string, - host: t.string, - payload: SendPayload, - pipe_name: t.string, - private_key: t.string, - schema: t.string, - stage_name: t.string, - user: t.string, -}); -exports.SendConfigSSE = t.strict({ - channel: t.string, - payload: SendPayload, -}); -// XXX would be cool to have this and SendFunctionsWrapper be more shared -exports.sendTypeMap = { - email: exports.SendConfigEmail, - emit: exports.SendConfigEmit, - http: exports.SendConfigHTTP, - s3: exports.SendConfigS3, - sql: exports.SendConfigSQL, - snowflake: exports.SendConfigSnowflake, - sse: exports.SendConfigSSE, -}; -exports.END_NEEDLE = "__pd_end"; -// End workflow with optional message. -function $end(message) { - const err = new Error(); - err[exports.END_NEEDLE] = { - message, - ts: new Date().toISOString(), - }; - throw err; -} -exports.$end = $end; -exports.$sendConfigRuntimeTypeChecker = (function () { - const ret = {}; - for (const [sendName, sendConfigType,] of Object.entries(exports.sendTypeMap)) { - ret[sendName] = function (config) { - const result = sendConfigType.decode(config); - if (!result) - throw new Error("io-ts: unexpected decode output"); - if (result._tag === "Left") { - for (const err of result.left) { - if (err.message) { - throw new Error(err.message); - } - else { - const keyChunks = []; - for (const ctx of err.context) { - if (!ctx.key) - continue; - if (!isNaN(+ctx.key)) - continue; - keyChunks.push(ctx.key); - } - throw new Error(`$send.${sendName}: invalid value ${err.value} for ${keyChunks.join(".")}`); - } - } - throw new Error("io-ts: error but could not produce message"); // shouldn't happen... - } - // XXX if result !== config they passed extra fields... but expensive - }; - } - return ret; -})(); diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.d.ts deleted file mode 100644 index 3d9e5b904b97f..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { JsonPrimitive } from "type-fest"; -import { ExecuteQueryArgs } from "./sql"; -export declare type ColumnSchema = { - columnDefault: JsonPrimitive; - dataType: string; - isNullable: boolean; - tableSchema?: string; -}; -export declare type TableMetadata = { - rowCount?: number; -}; -export declare type TableSchema = { - [columnName: string]: ColumnSchema; -}; -export declare type TableInfo = { - metadata: TableMetadata; - schema: TableSchema; -}; -export declare type DbInfo = { - [tableName: string]: TableInfo; -}; -export declare type SqlProp = { - query: string; - params?: string[]; -}; -declare const _default: { - methods: { - /** - * A method that transforms the value of a prop of type `sql` so that it can - * be fed to the `executeQuery` method. - * - * @param sqlProp - The prop of type `sql` - * @returns The arguments to be passed to `executeQuery` - */ - executeQueryAdapter(sqlProp: SqlProp): ExecuteQueryArgs; - /** - * A helper method to get the schema of the database. Used by other features - * (like the `sql` prop) to enrich the code editor and provide the user with - * auto-complete and fields suggestion. - * - * @returns {DbInfo} The schema of the database, which is a - * JSON-serializable object. - * @throws {ConfigurationError} If the method is not implemented. - */ - getSchema(): DbInfo; - }; -}; -export default _default; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.js b/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.js deleted file mode 100644 index 0d6004e8db76a..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/sql-prop.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const errors_1 = require("./errors"); -exports.default = { - methods: { - /** - * A method that transforms the value of a prop of type `sql` so that it can - * be fed to the `executeQuery` method. - * - * @param sqlProp - The prop of type `sql` - * @returns The arguments to be passed to `executeQuery` - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - executeQueryAdapter(sqlProp) { - throw new errors_1.ConfigurationError("executeQueryAdapter not implemented"); - }, - /** - * A helper method to get the schema of the database. Used by other features - * (like the `sql` prop) to enrich the code editor and provide the user with - * auto-complete and fields suggestion. - * - * @returns {DbInfo} The schema of the database, which is a - * JSON-serializable object. - * @throws {ConfigurationError} If the method is not implemented. - */ - getSchema() { - throw new errors_1.ConfigurationError("getSchema not implemented"); - }, - }, -}; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.d.ts deleted file mode 100644 index 24888db3e6ce5..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { ExecuteQueryArgs } from "./sql"; -export declare type ClientConfiguration = object; -export declare type ProxyArgs = { - query: string; - params?: unknown[]; -}; -export declare type Row = object; -declare const _default: { - methods: { - /** - * A helper method to get the configuration object that's directly fed to - * the DB client constructor. Used by other features (like SQL proxy) to - * initialize their client in an identical way. - * - * @returns The configuration object for the DB client - */ - getClientConfiguration(): ClientConfiguration; - /** - * Executes a query against the database. This method takes care of - * connecting to the database, executing the query, and closing the - * connection. - * - * @param args - The query string or object to be sent to the DB. SQL query. - * @returns The rows returned by the DB as a result of the query. - */ - executeQuery(args: ExecuteQueryArgs): Row[]; - /** - * Adapts the arguments to `executeQuery` so that they can be consumed by - * the SQL proxy (when applicable). Note that this method is not intended to - * be used by the component directly. - * - * @param args - The query string or object to be sent to the DB. - * @returns The adapted query and parameters. - */ - proxyAdapter(args: ExecuteQueryArgs): ProxyArgs; - }; -}; -export default _default; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.js b/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.js deleted file mode 100644 index f59b771575033..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/sql-proxy.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const errors_1 = require("./errors"); -exports.default = { - methods: { - /** - * A helper method to get the configuration object that's directly fed to - * the DB client constructor. Used by other features (like SQL proxy) to - * initialize their client in an identical way. - * - * @returns The configuration object for the DB client - */ - getClientConfiguration() { - throw new errors_1.ConfigurationError("getClientConfiguration not implemented"); - }, - /** - * Executes a query against the database. This method takes care of - * connecting to the database, executing the query, and closing the - * connection. - * - * @param args - The query string or object to be sent to the DB. SQL query. - * @returns The rows returned by the DB as a result of the query. - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - executeQuery(args) { - throw new errors_1.ConfigurationError("executeQuery not implemented"); - }, - /** - * Adapts the arguments to `executeQuery` so that they can be consumed by - * the SQL proxy (when applicable). Note that this method is not intended to - * be used by the component directly. - * - * @param args - The query string or object to be sent to the DB. - * @returns The adapted query and parameters. - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - proxyAdapter(args) { - throw new errors_1.ConfigurationError("proxyAdapter not implemented"); - }, - }, -}; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/sql.d.ts deleted file mode 100644 index fe800cb869ac4..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/sql.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare type ExecuteQueryArgs = object | string; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/sql.js b/components/pexels/node_modules/@pipedream/platform/dist/sql.js deleted file mode 100644 index c8ad2e549bdc6..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/sql.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/components/pexels/node_modules/@pipedream/platform/dist/utils.d.ts b/components/pexels/node_modules/@pipedream/platform/dist/utils.d.ts deleted file mode 100644 index 6885d9171eb16..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/utils.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function cloneSafe(o: any): any; -export declare function jsonStringifySafe(v: any, set?: Set): string | undefined; diff --git a/components/pexels/node_modules/@pipedream/platform/dist/utils.js b/components/pexels/node_modules/@pipedream/platform/dist/utils.js deleted file mode 100644 index c964c3dfcaf8b..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/dist/utils.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.jsonStringifySafe = exports.cloneSafe = void 0; -function cloneSafe(o) { - const str = jsonStringifySafe(o); - return str - ? JSON.parse(str) - : null; -} -exports.cloneSafe = cloneSafe; -// this looks pretty terrible, but on axios return value, -// -// jsonStringifySafe ~1ms -// util.inspect ~2ms -// -// XXX could most likely be improved -function jsonStringifySafe(v, set) { - try { - return JSON.stringify(v); - } - catch (err) { - set = new Set(set || []); - if (set.has(v)) - return; - set.add(v); - if (typeof v === "object") { - const strs = []; - if (Array.isArray(v)) { - for (const el of v) { - const str = jsonStringifySafe(el, set); - if (str) - strs.push(str); - } - return `[${strs.join(",")}]`; - } - for (const k in v) { - const str = jsonStringifySafe(v[k], set); - if (str) { - const kStr = JSON.stringify(k); - strs.push(`${kStr}:${str}`); - } - } - return `{${strs.join(",")}}`; - } - } -} -exports.jsonStringifySafe = jsonStringifySafe; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/axios.ts b/components/pexels/node_modules/@pipedream/platform/lib/axios.ts deleted file mode 100644 index e53eaa916ac28..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/lib/axios.ts +++ /dev/null @@ -1,204 +0,0 @@ -import axios from "axios"; -import { AxiosRequestConfig } from "./index"; -import * as querystring from "querystring"; -import { cloneSafe } from "./utils"; -import { ConfigurationError } from "./errors"; - -function cleanObject(o = {}) { - for (const k in o) { - if (typeof o[k] === "undefined") { - delete o[k]; - } - } -} - -// remove query params from url and put into config.params -function removeSearchFromUrl(config: AxiosRequestConfig) { - if (!config.url) return; - const { - url, baseURL, - } = config; - const newUrl = new URL((baseURL ?? "") + url); - const queryString = newUrl.search.substr(1); - if (queryString) { - // https://stackoverflow.com/a/8649003/387413 - const urlParams = JSON.parse("{\"" + queryString.replace(/&/g, "\",\"").replace(/=/g, "\":\"") + "\"}", function (key, value) { - return key === "" - ? value - : decodeURIComponent(value); - }); - for (const k in urlParams) { - if (!config.params) config.params = {}; - if (k in config.params) continue; // params object > url query params - config.params[k] = urlParams[k]; - } - newUrl.search = ""; - config.url = newUrl.toString(); // if ends with ? should be okay, but could be cleaner - } -} - -// https://github.com/ttezel/twit/blob/master/lib/helpers.js#L11 -function oauth1ParamsSerializer(p: any) { - return querystring.stringify(p) - .replace(/!/g, "%21") - .replace(/'/g, "%27") - .replace(/\(/g, "%28") - .replace(/\)/g, "%29") - .replace(/\*/g, "%2A"); -} - -export function transformConfigForOauth(config: AxiosRequestConfig) { - const newUrl = axios.getUri({ - ...config, - paramsSerializer: oauth1ParamsSerializer, - }); - const requestData = { - method: config.method || "get", - url: newUrl, - }; - // the OAuth specification explicitly states that only form-encoded data should be included - let hasContentType = false; - let formEncodedContentType = false; - for (const k in config.headers || {}) { - if (/content-type/i.test(k)) { - hasContentType = true; - formEncodedContentType = config.headers?.[k] === "application/x-www-form-urlencoded"; - break; - } - } - if (config.data && typeof config.data === "object" && formEncodedContentType) { - (requestData as any).data = config.data; - } else if (typeof config.data === "string" && (!hasContentType || formEncodedContentType)) { - (requestData as any).data = querystring.parse(config.data); - } - config.paramsSerializer = oauth1ParamsSerializer; - return requestData; -} - -async function getOauthSignature(config: AxiosRequestConfig, signConfig: any) { - const { - oauthSignerUri, token, - } = signConfig; - - const requestData = transformConfigForOauth(config); - const payload = { - requestData, - token, - }; - return (await axios.post(oauthSignerUri, payload)).data; -} - -// XXX warn about mutating config object... or clone? -async function callAxios(step: any, config: AxiosRequestConfig, signConfig?: any) { - cleanObject(config.headers); - cleanObject(config.params); - if (typeof config.data === "object") { - cleanObject(config.data); - } - if (config.body != null) { - throw new ConfigurationError("unexpected body, use only data instead"); - } - removeSearchFromUrl(config); - - // OAuth1 request - if (signConfig) { - const oauthSignature = await getOauthSignature(config, signConfig); - if (!config.headers) config.headers = {}; - config.headers.Authorization = oauthSignature; - } - - try { - if (config.debug) { - stepExport(step, config, "debug_config"); - } - const response = await axios(config); - if (config.debug) { - stepExport(step, response.data, "debug_response"); - } - - return config.returnFullResponse - ? response - : response.data; - } catch (err) { - if (err.response) { - convertAxiosError(err); - stepExport(step, err.response, "debug"); - } - throw err; - } -} - -function stepExport(step: any, message: any, key: string) { - message = cloneSafe(message); - - if (step) { - if (step.export) { - step.export(key, message); - return; - } - step[key] = message; - } - - console.log(`export: ${key} - ${JSON.stringify(message, null, 2)}`); -} - -function convertAxiosError(err) { - delete err.response.request; - err.name = `${err.name} - ${err.message}`; - try { - err.message = JSON.stringify(err.response.data); - } - catch (error) { - console.error("Error trying to convert `err.response.data` to string"); - } - return err; -} - -function create(config?: AxiosRequestConfig, signConfig?: any) { - const axiosInstance = axios.create(config); - - if (config?.debug) { - stepExport(this, config, "debug_config"); - } - - axiosInstance.interceptors.request.use(async (config) => { - if (signConfig) { - const oauthSignature = await getOauthSignature(config, signConfig); - if (!config.headers) config.headers = {}; - config.headers.Authorization = oauthSignature; - } - - cleanObject(config.headers); - cleanObject(config.params); - if (typeof config.data === "object") { - cleanObject(config.data); - } - removeSearchFromUrl(config); - - return config; - }); - - axiosInstance.interceptors.response.use((response) => { - const config: AxiosRequestConfig = response.config; - - if (config.debug) { - stepExport(this, response.data, "debug_response"); - } - - return config.returnFullResponse - ? response - : response.data; - }, (error) => { - if (error.response) { - convertAxiosError(error); - stepExport(this, error.response, "debug"); - } - - throw error; - }); - - return axiosInstance; -} - -callAxios.create = create; -export default callAxios; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/constants.ts b/components/pexels/node_modules/@pipedream/platform/lib/constants.ts deleted file mode 100644 index e7c681fc2f981..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/lib/constants.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const DEFAULT_POLLING_SOURCE_TIMER_INTERVAL = 60 * 15; -export const PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID = "fnd4m13k1mjb6djallp1m9kr7o8kslcu"; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/errors.ts b/components/pexels/node_modules/@pipedream/platform/lib/errors.ts deleted file mode 100644 index ee17d29dc3a6f..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/lib/errors.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class ConfigurationError extends Error { - exposeStack: boolean; - constructor(message: string, exposeStack = false) { - super(message); - this.name = "ConfigurationError"; - this.exposeStack = exposeStack; - } -} diff --git a/components/pexels/node_modules/@pipedream/platform/lib/index.ts b/components/pexels/node_modules/@pipedream/platform/lib/index.ts deleted file mode 100644 index 55fa677cb020d..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/lib/index.ts +++ /dev/null @@ -1,212 +0,0 @@ -import * as t from "io-ts"; - -import axios, { transformConfigForOauth } from "./axios"; -import { AxiosRequestConfig as AxiosConfig } from "axios"; - -export { - axios, transformConfigForOauth, -}; -export { - cloneSafe, jsonStringifySafe, -} from "./utils"; - -export { - ConfigurationError, -} from "./errors"; - -export { - default as sqlProp, -} from "./sql-prop"; -export type { - ColumnSchema, - DbInfo, - TableInfo, - TableMetadata, - TableSchema, -} from "./sql-prop"; - -export { - default as sqlProxy, -} from "./sql-proxy"; - -export { - DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, - PD_OFFICIAL_GMAIL_OAUTH_CLIENT_ID, -} from "./constants"; - -const SendPayload = t.union([ - t.string, - t.object, -]); -type SendPayload = t.TypeOf; - -export const SendConfigEmail = t.partial({ - html: t.string, - subject: t.string, - text: t.string, -}); -export type SendConfigEmail = t.TypeOf; - -export const SendConfigEmit_required = t.strict({ - raw_event: t.object, -}); - -export const SendConfigEmit_optional = t.partial({ - event: t.object, -}); -export const SendConfigEmit = t.intersection([ - SendConfigEmit_required, - SendConfigEmit_optional, -]); -export type SendConfigEmit = t.TypeOf; - -// interface SendConfigHTTPKv { -// [key: string]: string; -// } -const SendConfigHTTPKv = t.object; // XXX should be type above -type SendConfigHTTPKv = t.TypeOf; -const SendConfigHTTPAuth = t.strict({ - password: t.string, - username: t.string, -}); -type SendConfigHTTPAuth = t.TypeOf; -// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods -export const HTTP_METHODS = [ - "GET", - "HEAD", - "POST", - "PUT", - "DELETE", - "CONNECT", - "OPTIONS", - "TRACE", - "PATCH", -]; -// HTTP method must be uppercase (for kotlin in coordinator -- i voted to make it case insensitive, but w.e for now) -const SendConfigHTTPMethod = t.keyof(HTTP_METHODS.reduce((acc, v) => { - acc[v] = null; - return acc; -}, {})); -type SendConfigHTTPMethod = t.TypeOf; -const SendConfigHTTP_required = t.strict({ - method: SendConfigHTTPMethod, - url: t.string, -}); -const SendConfigHTTP_optional = t.partial({ - auth: SendConfigHTTPAuth, - data: SendPayload, - headers: SendConfigHTTPKv, - params: SendConfigHTTPKv, -}); -export const SendConfigHTTP = t.intersection([ - SendConfigHTTP_required, - SendConfigHTTP_optional, -]); -// Mimics axios config. (for now) -export type SendConfigHTTP = t.TypeOf; - -export const SendConfigS3 = t.strict({ - bucket: t.string, - payload: SendPayload, - prefix: t.string, -}); -export type SendConfigS3 = t.TypeOf; - -export const SendConfigSQL = t.strict({ - payload: SendPayload, - table: t.string, -}); -export type SendConfigSQL = t.TypeOf; - -export const SendConfigSnowflake = t.strict({ - account: t.string, - database: t.string, - host: t.string, - payload: SendPayload, - pipe_name: t.string, - private_key: t.string, - schema: t.string, - stage_name: t.string, - user: t.string, -}); -export type SendConfigSnowflake = t.TypeOf; - -export const SendConfigSSE = t.strict({ - channel: t.string, - payload: SendPayload, -}); -export type SendConfigSSE = t.TypeOf; - -// optionals so we can use self-invoking function below -interface SendFunctionsWrapper { - email: (config: SendConfigEmail) => void; - emit: (config: SendConfigEmit) => void; - http: (config: SendConfigHTTP) => void; - s3: (config: SendConfigS3) => void; - sql: (config: SendConfigSQL) => void; - snowflake: (config: SendConfigSnowflake) => void; - sse: (config: SendConfigSSE) => void; -} -// XXX would be cool to have this and SendFunctionsWrapper be more shared -export const sendTypeMap = { - email: SendConfigEmail, - emit: SendConfigEmit, - http: SendConfigHTTP, - s3: SendConfigS3, - sql: SendConfigSQL, - snowflake: SendConfigSnowflake, - sse: SendConfigSSE, -}; - -// Event object that persists throughout worfklow with observability after each step. -export let $event: any; - -export const END_NEEDLE = "__pd_end"; -// End workflow with optional message. -export function $end(message?: string): void { - const err = new Error(); - err[END_NEEDLE] = { - message, - ts: new Date().toISOString(), - }; - throw err; -} - -export let $send: SendFunctionsWrapper; - -export const $sendConfigRuntimeTypeChecker = (function () { - const ret = {}; - for (const [ - sendName, - sendConfigType, - ] of Object.entries(sendTypeMap)) { - ret[sendName] = function (config) { - const result = sendConfigType.decode(config); - if (!result) throw new Error("io-ts: unexpected decode output"); - if (result._tag === "Left") { - for (const err of result.left) { - if (err.message) { - throw new Error(err.message); - } else { - const keyChunks: string[] = []; - for (const ctx of err.context) { - if (!ctx.key) continue; - if (!isNaN(+ctx.key)) continue; - keyChunks.push(ctx.key); - } - throw new Error(`$send.${sendName}: invalid value ${err.value} for ${keyChunks.join(".")}`); - } - } - throw new Error("io-ts: error but could not produce message"); // shouldn't happen... - } - // XXX if result !== config they passed extra fields... but expensive - }; - } - return ret; -})(); - -export interface AxiosRequestConfig extends AxiosConfig { - debug?: boolean; - body?: any; - returnFullResponse?: boolean; -} diff --git a/components/pexels/node_modules/@pipedream/platform/lib/sql-prop.ts b/components/pexels/node_modules/@pipedream/platform/lib/sql-prop.ts deleted file mode 100644 index d346d651e165f..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/lib/sql-prop.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { ConfigurationError } from "./errors"; -import { JsonPrimitive } from "type-fest"; -import { ExecuteQueryArgs } from "./sql"; - -export type ColumnSchema = { - columnDefault: JsonPrimitive; - dataType: string; - isNullable: boolean; - tableSchema?: string; -}; - -export type TableMetadata = { - rowCount?: number; -}; - -export type TableSchema = { - [columnName: string]: ColumnSchema; -}; - -export type TableInfo = { - metadata: TableMetadata; - schema: TableSchema; -}; - -export type DbInfo = { - [tableName: string]: TableInfo; -}; - -export type SqlProp = { - query: string; - params?: string[]; -}; - -export default { - methods: { - /** - * A method that transforms the value of a prop of type `sql` so that it can - * be fed to the `executeQuery` method. - * - * @param sqlProp - The prop of type `sql` - * @returns The arguments to be passed to `executeQuery` - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - executeQueryAdapter(sqlProp: SqlProp): ExecuteQueryArgs { - throw new ConfigurationError("executeQueryAdapter not implemented"); - }, - - /** - * A helper method to get the schema of the database. Used by other features - * (like the `sql` prop) to enrich the code editor and provide the user with - * auto-complete and fields suggestion. - * - * @returns {DbInfo} The schema of the database, which is a - * JSON-serializable object. - * @throws {ConfigurationError} If the method is not implemented. - */ - getSchema(): DbInfo { - throw new ConfigurationError("getSchema not implemented"); - }, - }, -}; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/sql-proxy.ts b/components/pexels/node_modules/@pipedream/platform/lib/sql-proxy.ts deleted file mode 100644 index 3a198c793ed8a..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/lib/sql-proxy.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { ConfigurationError } from "./errors"; -import { ExecuteQueryArgs } from "./sql"; - -export type ClientConfiguration = object; -export type ProxyArgs = { - query: string; - params?: unknown[]; -}; -export type Row = object; - -export default { - methods: { - /** - * A helper method to get the configuration object that's directly fed to - * the DB client constructor. Used by other features (like SQL proxy) to - * initialize their client in an identical way. - * - * @returns The configuration object for the DB client - */ - getClientConfiguration(): ClientConfiguration { - throw new ConfigurationError("getClientConfiguration not implemented"); - }, - - /** - * Executes a query against the database. This method takes care of - * connecting to the database, executing the query, and closing the - * connection. - * - * @param args - The query string or object to be sent to the DB. SQL query. - * @returns The rows returned by the DB as a result of the query. - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - executeQuery(args: ExecuteQueryArgs): Row[] { - throw new ConfigurationError("executeQuery not implemented"); - }, - - /** - * Adapts the arguments to `executeQuery` so that they can be consumed by - * the SQL proxy (when applicable). Note that this method is not intended to - * be used by the component directly. - * - * @param args - The query string or object to be sent to the DB. - * @returns The adapted query and parameters. - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - proxyAdapter(args: ExecuteQueryArgs): ProxyArgs { - throw new ConfigurationError("proxyAdapter not implemented"); - }, - }, -}; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/sql.ts b/components/pexels/node_modules/@pipedream/platform/lib/sql.ts deleted file mode 100644 index 1a4fa5386a9af..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/lib/sql.ts +++ /dev/null @@ -1 +0,0 @@ -export type ExecuteQueryArgs = object | string; diff --git a/components/pexels/node_modules/@pipedream/platform/lib/utils.ts b/components/pexels/node_modules/@pipedream/platform/lib/utils.ts deleted file mode 100644 index 2b4ad085cdc96..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/lib/utils.ts +++ /dev/null @@ -1,40 +0,0 @@ -export function cloneSafe(o: any) { - const str = jsonStringifySafe(o); - return str - ? JSON.parse(str) - : null; -} - -// this looks pretty terrible, but on axios return value, -// -// jsonStringifySafe ~1ms -// util.inspect ~2ms -// -// XXX could most likely be improved -export function jsonStringifySafe(v: any, set?: Set) { - try { - return JSON.stringify(v); - } catch (err) { - set = new Set(set || []); - if (set.has(v)) return; - set.add(v); - if (typeof v === "object") { - const strs: Array = []; - if (Array.isArray(v)) { - for (const el of v) { - const str = jsonStringifySafe(el, set); - if (str) strs.push(str); - } - return `[${strs.join(",")}]`; - } - for (const k in v) { - const str = jsonStringifySafe(v[k], set); - if (str) { - const kStr = JSON.stringify(k); - strs.push(`${kStr}:${str}`); - } - } - return `{${strs.join(",")}}`; - } - } -} diff --git a/components/pexels/node_modules/@pipedream/platform/package.json b/components/pexels/node_modules/@pipedream/platform/package.json deleted file mode 100644 index efd79a492bb93..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@pipedream/platform", - "version": "3.0.3", - "description": "Pipedream platform globals (typing and runtime type checking)", - "homepage": "https://pipedream.com", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "author": "Pipedream Team", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/PipedreamHQ/platform.git" - }, - "dependencies": { - "axios": "^1.7.4", - "fp-ts": "^2.0.2", - "io-ts": "^2.0.0", - "querystring": "^0.2.1" - }, - "devDependencies": { - "husky": "^3.0.0", - "jest": "^29.1.2", - "type-fest": "^4.15.0", - "@octokit/core": "^3.6.0", - "typescript": "^3.5.3" - }, - "scripts": { - "prebuild": "rm -rf dist", - "build": "tsc", - "test": "npm run build && jest" - } -} \ No newline at end of file diff --git a/components/pexels/node_modules/@pipedream/platform/tsconfig.json b/components/pexels/node_modules/@pipedream/platform/tsconfig.json deleted file mode 100644 index 50147a07b15f8..0000000000000 --- a/components/pexels/node_modules/@pipedream/platform/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "declaration": true, - "module": "commonjs", - "outDir": "./dist", - "strictNullChecks": true, - "target": "es2018" - }, - "include": [ - "./lib/**/*" - ], - "exclude": [ - "node_modules" - ] -} diff --git a/components/pexels/node_modules/io-ts/CHANGELOG.md b/components/pexels/node_modules/io-ts/CHANGELOG.md deleted file mode 100644 index 4ee476b8c28b6..0000000000000 --- a/components/pexels/node_modules/io-ts/CHANGELOG.md +++ /dev/null @@ -1,896 +0,0 @@ -# Changelog - -> **Tags:** -> -> - [New Feature] -> - [Bug Fix] -> - [Breaking Change] -> - [Documentation] -> - [Internal] -> - [Polish] -> - [Experimental] -> - [Deprecation] - -**Note**: Gaps between patch versions are faulty/broken releases. -**Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. - -# 2.2.22 - -- **Bug Fix** - - Test for readonly type when optimizing tagged unions, #719 - -# 2.2.21 - -- **Bug Fix** - - Handle `record` keys outside `domain`, #705 (@tgfisher4) - -# 2.2.20 - -- undeprecate `FunctionType`, `FunctionC`, `Function` -- undeprecate `NeverType`, `NeverC`, `never` -- undeprecate `AnyType`, `AnyC`, `any` -- undeprecate `RefinementC`, `refinement`, `Integer` -- add refinement overload to allow custom branding, closes #373 - -# 2.2.19 - -- **Bug Fix** - - allow `Error` to be decoded with `UnknownRecord`, #664 (@mlegenhausen) - -# 2.2.18 - -- **Bug Fix** - - fix `typescript@4.8` errors, closes #656, closes #647 (@gcanti) - -# 2.2.17 - -- **Bug Fix** - - Don't throw a TypeError when trying to decode a sum value that contains a dangerous string, #650 (@thewilkybarkid) - -# 2.2.16 - -Experimental modules require `fp-ts@^2.5.0`. - -- **Experimental** - - `Codec` - - add `readonly` combinator (@gcanti) - - `Encoder` - - add `readonly` combinator (@gcanti) - -# 2.2.15 - -- **Experimental** - - `Schemable` - - (\*) add `readonly` combinator (@gcanti) - - (\*) add `struct` combinator (@gcanti) - - deprecate `type` in favour of `struct` (@gcanti) - - deprecate `fromType` in favour of `fromStruct` (@gcanti) - -(\*) breaking change - -# 2.2.14 - -- **Experimental** - - `Guard` - - relax `UnknownRecord` check, closes #559 (@waynevanson) - -# 2.2.13 - -- **Bug Fix** - - improve internal `mergeAll` function, closes #532 (@gcanti) - -# 2.2.12 - -- **Experimental** - - (\*) make `sum` safer, closes #523 (@gcanti) - -(\*) breaking change - -In case of non-`string` tag values, the respective key must be enclosed in brackets - -```ts -export const MySum: D.Decoder< - unknown, - | { - type: 1 // non-`string` tag value - a: string - } - | { - type: 2 // non-`string` tag value - b: number - } -> = D.sum('type')({ - [1]: D.type({ type: D.literal(1), a: D.string }), - [2]: D.type({ type: D.literal(2), b: D.number }) -}) -``` - -# 2.2.11 - -- **Experimental** - - `Decoder` - - make `toForest` stack-safe, #520 (@safareli) - -# 2.2.10 - -- **Polish** - - expose modules without lib/es6 prefix, #507 (@osdiab) - -# 2.2.9 - -- **Polish** - - remove `Object.freeze` calls, closes #497 (@gcanti) -- **Experimental** - - `DecodeError` - - add `Wrap` member (@gcanti) - - `Decoder` - - add `withMessage` combinator (@gcanti) - - `TaskDecoder` - - add `withMessage` combinator (@gcanti) - -# 2.2.8 - -- **Experimental** - - (\*) remove `KleisliDecoder` module (@gcanti) - - (\*) remove `KleisliTaskDecoder` module (@gcanti) - - (\*) remove `JsonCodec` module (@gcanti) - - (\*) remove `JsonEncoder` module (@gcanti) - - `Codec` - - (\*) make `Codec` more general by adding a `I` type parameter (@gcanti) - - add `fromType` function (@gcanti) - - add `fromPartial` function (@gcanti) - - add `fromArray` function (@gcanti) - - add `fromRecord` function (@gcanti) - - add `fromTuple` function (@gcanti) - - add `fromSum` function (@gcanti) - - add `compose` function (@gcanti) - - `Decoder` - - (\*) make `Decoder` more general by adding a `I` type parameter (@gcanti) - - add `fromRefinement` function (@gcanti) - - change `fromGuard` signature (@gcanti) - - add `fromType` function (@gcanti) - - add `fromPartial` function (@gcanti) - - add `fromArray` function (@gcanti) - - add `fromRecord` function (@gcanti) - - add `fromTuple` function (@gcanti) - - add `fromSum` function (@gcanti) - - add `compose` function (@gcanti) - - add `id` function (@gcanti) - - (\*) rename `functorDecoder` instance to `Functor` (@gcanti) - - (\*) rename `altDecoder` instance to `Alt` (@gcanti) - - (\*) rename and split `schemableDecoder` (@gcanti) - - add `Category` instance (@gcanti) - - add `InputOf` type (@gcanti) - - `TaskDecoder` - - (\*) make `TaskDecoder` more general by adding a `I` type parameter (@gcanti) - - add `fromRefinement` function (@gcanti) - - change `fromDecoder` signature (@gcanti) - - add `fromType` function (@gcanti) - - add `fromPartial` function (@gcanti) - - add `fromArray` function (@gcanti) - - add `fromRecord` function (@gcanti) - - add `fromTuple` function (@gcanti) - - add `fromSum` function (@gcanti) - - add `compose` function (@gcanti) - - add `id` function (@gcanti) - - (\*) rename `functorTaskDecoder` instance to `Functor` (@gcanti) - - (\*) rename `altTaskDecoder` instance to `Alt` (@gcanti) - - (\*) rename and split `schemableTaskDecoder` (@gcanti) - - add `Category` instance (@gcanti) - - add `InputOf` type (@gcanti) - - `Guard` - - (\*) make `Guard` more general by adding a `I` type parameter (@gcanti) - - (\*) rename `schemableGuard` (@gcanti) - - add `InputOf` type (@gcanti) - - add `alt` function (@gcanti) - - add `zero` function (@gcanti) - - add `compose` function (@gcanti) - - add `id` function (@gcanti) - - `Codec` - - (\*) rename `invariantCodec` to `Invariant` (@gcanti) - - `Encoder` - - (\*) rename `contravariantEncoder` to `Contravariant` (@gcanti) - - (\*) rename `categoryEncoder` to `Category` (@gcanti) - - `Eq` - - (\*) rename and split `schemableEq` (@gcanti) - - `Kleisli` - - add `id` (@gcanti) - - rename `type` to `fromType` (@gcanti) - - rename `partial` to `fromPartial` (@gcanti) - - rename `array` to `fromArray` (@gcanti) - - rename `record` to `fromRecord` (@gcanti) - - rename `tuple` to `fromTuple` (@gcanti) - - rename `sum` to `fromSum` (@gcanti) - - `Schemable` - - add `Schemable2C`, `WithUnknownContainers2C`, `WithUnion2C`, `WithRefine2C` (@gcanti) - - `Type` - - (\*) rename and split `schemableType` (@gcanti) - -(\*) breaking change - -# 2.2.7 - -- **Experimental** - - add `DecodeError` module (@gcanti) - - add `FreeSemigroup` module (@gcanti) - - add `TaskDecoder` module (@gcanti) - - add `Kleisli` module (@gcanti) - - add `KleisliDecoder` module (@gcanti) - - add `KleisliTaskDecoder` module (@gcanti) - - (\*) remove `NaN` from `number` instances (@gcanti) - - (\*) remove `Tree` module (@gcanti) - - (\*) make `Json` type immutable (@gcanti) - - `Decoder` - - (\*) remove `never` (@gcanti) - - (\*) make `parse` pipeable and change its `parser` argument (@gcanti) - - (\*) change `DecoderError` (@gcanti) - - (\*) remove `withExpected` in favour of `mapLeftWithInput` (@gcanti) - - `Guard` - - (\*) remove `never` (@gcanti) - - `Schemable` - - (\*) better `literal` signature (@gcanti) - - (\*) better `union` signature (@gcanti) - - (\*) make intersections pipeables (@gcanti) - - (\*) make refinements pipeables (@gcanti) - -(\*) breaking change - -# 2.2.6 - -- **Experimental** - - `Decoder` - - add support for non-`string` tag values to `sum`, closes #481 (@gcanti) - - `intersection` should accumulate all errors (@gcanti) - -# 2.2.5 - -- **Experimental** - - fix type information lost from nested decoder types, #479 (@gcanti) - - `JsonEncoder` - - change `id` signature (@gcanti) - -# 2.2.4 - -- **Polish** - - remove the dependency on the `either` instance as a mean of improving tree shaking (@gcanti) - -# 2.2.3 - -- **Polish** - - use the built-in `Readonly` type in `readonly` combinator, closes #472 (@gcanti) -- **Experimental** - - split instances (@gcanti) - - add `Type` experimental module, #464 (@gcanti) - - restore the `O` type parameter to `Encoder`, #469 (@gcanti) - - add the `O` type parameter to `Codec` (@gcanti) - - add `JsonCodec` experimental module (@gcanti) - - add `JsonEncoder` experimental module (@gcanti) - - `Schemable` - - rename `Schemable` interface to `Schemable1` (@gcanti) - - rename `WithUnion` interface to `WithUnion1` (@gcanti) - - add `Schemable` interface (@gcanti) - - add `WithUnion` interface (@gcanti) - - add `WithRefinement` / `WithRefinement1` interfaces (@gcanti) - - add `WithUnknownContainers` / `WithUnknownContainers1` interfaces (@gcanti) - - move `UnknownArray` and `UnknownRecord` to `WithUnknownContainers` (@gcanti) - - `Schema` - - refactoring with the new `Schemable` interface (@gcanti) - - add `interpreter` function (@gcanti) -- **Internal** - - upgrade to `typescript@3.9.3` (@gcanti) - -# 2.2.2 - -- **Experimental** - - add `Eq` module (@gcanti) - - `Codec` - - add `TypeOf` operator (@gcanti) - - `Decoder` - - add `DecodeError` interface (@gcanti) - - `Encoder` - - add `TypeOf` operator (@gcanti) - - `Guard` - - add `TypeOf` operator (@gcanti) - -# 2.2.1 - -- **Experimental** - - `Decoder` - - collect all errors while decoding, closes #449 (@gcanti) - -# 2.2.0 - -- **Experimental** - - add `Codec`, `Decoder`, `Encoder`, `Guard`, `Schema`, `Schemable`, `Tree` modules (@gcanti) - -# 2.1.3 - -- **Polish** - - remove useless `hasOwnProperty` calls, closes #423 (@gcanti) - -# 2.1.1 - -- **Bug Fix** - - fix `record` domain handling, closes #391 (@gcanti) - -# 2.1.0 - -- **New Feature** - - add `bigint` codec (@mixedCase) - -# 2.0.6 - -- **Bug Fix** - - whitelist `window` in `UnknownRecord`, fix #413 (@gcanti) - -# 2.0.5 - -- **Bug Fix** - - `partial` shouldn't allow arrays, fix #407 (@gcanti) - -# 2.0.4 - -- **Bug Fix** - - remove getters, fix #404 (@gcanti) - -# 2.0.3 - -- **Bug Fix** - - rewrite es6 imports (@gcanti) - -# 2.0.2 - -- **Bug Fix** - - fix #397 (@gcanti) - -# 2.0.1 - -- **Bug Fix** - - fix `getTags` algorithm for mutually recursive codecs, closes #354 (@gcanti) - -# 2.0.0 - -- **Breaking Change** - - upgrade to `fp-ts@2.x` (@gcanti) - - move `fp-ts` to `peerDependencies` (@gcanti) - -# 1.10.4 - -- **Polish** - - remove unneeded internal code (@gcanti) - -# 1.10.3 - -- **Bug Fix** - - revert `1.10.0` compatibility, fix #344 (@gcanti) - -# 1.10.2 - -- **Bug Fix** - - move `fp-ts` back to dependencies (@gcanti) - -# 1.10.1 - -- **Bug Fix** - - handle `strict`, `exact` and `refinement` codecs when optimizing tagged unions, fix #339 (@gcanti) - -# 1.10.0 - -- **New Feature** - - make `io-ts` compatible with both `fp-ts@1.x`, `fp-ts@2.x` (@gcanti) - -# 1.9.0 - -- **New Feature** - - `union` is now able to detect and optimize tagged unions (@gcanti) -- **Deprecation** - - deprecate `taggedUnion` in favour of `union` (@gcanti) - -# 1.8.6 - -output ES modules to better support tree-shaking, closes #326 (@gcanti) - -# 1.8.5 - -- **Bug Fix** - - change how types and output types are retrieved in `IntersectionC` and `TupleC`, fix #315 (@gcanti) - -# 1.8.4 - -- **Polish** - - autobind `decode` method (@gcanti) - -# 1.8.3 - -- **Polish** - - add `stripInternal` flag to `tsconfig.json` (@gcanti) - - handle `NaN` in `PathReporter` (@gcanti) - - throw if union encoding doesn't find a usable codec (@leemhenson) -- **Deprecation** - - deprecate `NeverType` (@gcanti) - - deprecate `FunctionType` (@gcanti) - -# 1.8.2 - -- **Bug Fix** - - align the runtime behavior of `Exact.is` with the type system, fix #288 (@gcanti) - -# 1.8.1 - -- **New Feature** - - add `brand` combinator (@gcanti, @lostintime) - - add `Int` codec (@gcanti) - - `exact` strips additional properties while decoding / encoding (@gcanti) - - un-deprecate `strict` combinator, is now an alias of `exact(type(...))` (@gcanti) -- **Bug Fix** - - fix wrong context keys for tagged unions (@gcanti) -- **Deprecation** - - deprecate `refinement` combinator in favour of `brand` (@gcanti) - - deprecate `Integer` codec in favour of `Int` (@gcanti) - - deprecate `StrictType` class (@gcanti) - - deprecate `StrictC` interface (@gcanti) -- **Polish** - - modify the implementation of `intersection` in order to support combinators that strip additional properties (@gcanti) - - do not validate the codomain of a key of a record if its domain in invalid (@gcanti) - - normalize missing `message` field in `ValidationError` (@gcanti) - - fix name of recursive codec definitions (@gcanti) - - remove unexpected validation path from partial type, closes #195 (@gcanti) - - do not leak taggedUnion implementation when tag validation fails (@gcanti) - - add `actual` value to all context entries (@gcanti) - - `exact` now bails out when the value is not an `UnknownRecord` (@gcanti) - - `tuple` should not leak the implementation (`never` usage) (@gcanti) - - `exact` should not leak the implementation (`never` usage) (@gcanti) - - use `Number.isInteger` in `Integer` implementation (@gcanti) - - use the Flow convention to name `exact` codecs (@gcanti) - -# 1.7.1 - -- **Deprecation** - - deprecate `any` (@gcanti) - - deprecate `object` (@gcanti) - - deprecate `Dictionary` in favour of `UnknownRecord` (@gcanti) - - deprecate `Array` in favour of `UnknownArray` (@gcanti) - - deprecate `dictionary` in favour of `record` (@gcanti) - -# 1.7.0 - -- **New Feature** - - better support for custom messages, closes #148 (@gcanti) - - add optional message field to `ValidationError` - - add `message` argument to `failure` - - `PathReporter` should account for the new field - - add `actual` optional field to `ContextEntry`, closes #194 (@gcanti) -- **Deprecation** - - deprecate `getValidationError` (@gcanti) - - deprecate `getDefaultContext` (@gcanti) - -# 1.6.4 - -- **Bug Fix** - - `getIndexRecord`: getIndexRecord: handle conflicting tags in different positions, ref #263 (@gcanti) -- **Experimental** - - added a warning to the console if a tagged union cannot be created (@gcanti) - - revert `union` optimization, needs more work to make it happen (@gcanti) - -# 1.6.3 - -- **Bug Fix** - - prevent maximum call stack size exceeded when indexing recursive codecs, closes #259 (@gcanti) - -# 1.6.2 - -- **Polish** - - make `isIndexableCodec` more strict (@gcanti) - -# 1.6.1 - -- **Bug Fix** - - `taggedUnion` should handle sub unions / tagged unions correctly, closes #257 (@gcanti) -- **Experimental** - - optimize `union` with the same algorithm used in `taggedUnion` (@gcanti) - -# 1.6.0 - -**Important**. This version requires `typescript@3.2.2+` - -- **New Feature** - - leverage `typescript@3.2.2` (@gcanti) - - `TypeC` - - `PartialC` - - `RecordC` - - `UnionC` - - `ReadonlyC` - - `StrictC` - - `TaggedUnionC` - -# 1.5.3 - -- **Bug Fix** - - missing context info while decoding an intersection, fix #246 (@gcanti) -- **Experimental** - - add intermediary interfaces, closes #165 (@gcanti) - - `NullC` - - `UndefinedC` - - `VoidC` - - `AnyC` - - `UnknownC` - - `NeverC` - - `StringC` - - `NumberC` - - `BooleanC` - - `UnknownArrayC` - - `UnknownRecordC` - - `ObjectC` - - `FunctionC` - - `RefinementC` - - `LiteralC` - - `KeyofC` - - `ArrayC` - - `TypeC` - - `PartialC` - - `RecordC` - - `UnionC` - - `IntersectionC` - - `TupleC` - - `ReadonlyC` - - `ReadonlyArrayC` - - `StrictC` - - `TaggedUnionC` - - `ExactC` -- **Polishs** - - use rest elements in tuple types (`typescript@3.0.1` feature) (@gcanti) - - `union` should handle zero types (@gcanti) - - `intersection` should handle zero / one types (@gcanti) -- **Deprecation** - - deprecate `clean` (@gcanti) - - deprecate `alias` (@gcanti) - - deprecate `PropsOf` type (@gcanti) - - deprecate `Exact` type (@gcanti) - -# 1.5.2 - -- **Deprecation** - - deprecate `Compact` type (@gcanti) - -# 1.5.1 - -- **Polish** - - remove useless module augmentation of `Array` (@gcanti) - -# 1.5.0 - -- **New Feature** - - add `UnknownType`, closes #238 (@gcanti) -- **Deprecation** - - `ThrowReporter` is now deprecated (@gcanti) - -# 1.4.2 - -use `Compact` in `intersection` signatures as a workaround for #234 (@sledorze) - -# 1.4.1 - -- **Polish** - - `Type.prototype.pipe` now allows more types as input, #231 #232 (@sledorze) - -# 1.4.0 - -- **New Feature** - - use `unknown` as `mixed` (@gcanti) - -# 1.3.4 - -- **Bug Fix** - - should emit expected keys while decoding, fix #214 (@gcanti) - -# 1.3.3 - -- **Bug Fix** - - align `TaggedExact` definition with siblings, fix #223 (@gcanti) - -# 1.3.2 - -- **Bug Fix** - - dictionary type should not allow arrays, fix #218 (@gcanti) - -# 1.3.1 - -- **Polish** - - use interface instead of type alias (@gcanti) - - `Context` - - `Errors` - - `Any` - - `Mixed` - -# 1.3.0 - -- **New Feature** - - add `TaggedUnionType` (@gcanti) - -# 1.2.1 - -- **Polish** - - allow recursive types in tagged unions (@gcanti) - -# 1.2.0 - -- **New Feature** - - add `void` runtime type (@gcanti) - -# 1.1.5 - -- **Bug Fix** - - partial combinator should preserve additional properties while encoding, fixes #179 (@gcanti) -- **Polish** - - use `useIdentity` when possible (@gcanti) - -# 1.1.4 - -- **Internal** - - fix broken build with `typescript@2.9.1`, closes #174 (@gcanti) - -# 1.1.3 - -- **Internal** - - upgrade to `typings-checker@2.0.0` (@gcanti) - -# 1.1.2 - -- **Bug Fix** - - fix `alias` implementation (@gcanti) - - handle exact types in `isTagged` (@gcanti) - -# 1.1.1 - -- **Experimental** - - add `clean` / `alias` functions, closes #149 (@gcanti) - - add `exact` combinator (@gcanti) - - the `strict` combinator is deprecated - - remove `optional` combinator (@gcanti) - - it doesn't play well with advanced combinators, see [here](https://github.com/gcanti/io-ts/issues/140) for a discussion - -# 1.0.6 - -- **Bug Fix** - - `taggedUnion` fails to decode when tag values are not string literals, fix #161 (@gcanti) - -# 1.0.5 - -- **Bug Fix** - - workaround for upstream TypeScript bug 14041 (wrong generated declarations) (@gcanti) -- **Internal** - - optimize InterfaceType.encode (@gcanti) - - use definite assignment assertion for phantom fields (@gcanti) - -# 1.0.4 - -- **Bug Fix** - - make `Context` readonly (@gcanti) -- **Internal** - - optimizations, #137 (@gcanti, @sledorze) - -# 1.0.3 - -- **Internal** - - optimizations, #134 (@gcanti, @sledorze) - -# 1.0.2 - -- **Bug Fix** - - fix `OutputOfPartialProps` name (@gcanti) - -# 1.0.1 - -- **Bug Fix** - - fix `AnyType` by extending `Type` (@gcanti) - -# 1.0.0 - -- **Breaking Change** - - upgrade to `fp-ts@1.0.0` - - see https://github.com/gcanti/io-ts/pull/112 (@gcanti) - -# 0.9.8 - -- **New Feature** - - add decode and deprecate top level validate (@gcanti) -- **Internal** - - when checking validations use methods instead of top level functions (@gcanti) - -# 0.9.7 - -- **New Feature** - - add `taggedUnion` combinator (@gcanti, @sledorze) - -# 0.9.6 - -- **New Feature** - - `recursive` combinator - - add support for mutually recursive types, closes #114 (@gcanti) - - make it safer: `RT` now must extend `Type` (@gcanti) - -# 0.9.5 - -- **New Feature** - - add `mixed` type (@gcanti) - - replace `any` with `mixed` in all input type parameters (@gcanti) - ```diff - -export class StringType extends Type { - +export class StringType extends Type { - } - ``` - -# 0.9.4 - -- **Bug Fix** - - strict: should succeed validating an undefined field, closes #106 (@gcanti) - -# 0.9.3 - -- **Bug Fix** - - revert 37c74a5e2038de063a950f9ba8d18b1f132ef450, closes #8 (@gcanti) - -# 0.9.2 - -- **New Feature** - - add `Decoder` / `Encoder` interfaces (@sledorze, @gcanti) -- **Internal** - - perf optimizations (@sledorze, @gcanti) - -# 0.9.1 - -- **Bug Fix** - - make all classes "dumb", fix #95 (@gcanti) - -# 0.9.0 - -- **Breaking Change** - - remove `t.map` and `t.mapWithName` (in general doesn't look serializable, needs more investigation) - - remove `t.prism` (in general doesn't look serializable, needs more investigation) - - change `Type` from interface to class and add `S` type parameter - - remove `t._A` - - add `Type#serialize` - - add `Type#is` (in order to serialize unions and while we're at it, looks useful anyway) - - remove `t.is` (now that there's `Type#is` is misleading) -- **Experimental** - - add Flowtype support (@gcanti) - -# 0.8.2 - -- **New Feature** - - add `object` type, closes #86 (@gcanti) - -# 0.8.1 - -- **New Feature** - - add `strict` combinator, closes #84 (@phiresky, @gcanti) - -# 0.8.0 - -- **Breaking Change** - - upgrade `fp-ts` dependency (@gcanti) - -# 0.7.2 - -- **Bug Fix** - - tag recursive types, fix #80 (@gcanti) - -# 0.7.1 - -- **Bug Fix** - - incorrect compile time type for dictionary, fix #75 (@gcanti) - -# 0.7.0 - -- **Breaking Change** - - upgrade to latest fp-ts (0.5.1) (@gcanti) - -# 0.6.2 - -- **New Feature** - - add aliases for `null` and `interface`, closes #63 (@gcanti) - -# 0.6.1 - -- **Internal** - - handle latest fp-ts (0.4.3) (@gcanti) - -# 0.6.0 - -- **Breaking Change** - - upgrade to latest fp-ts (0.4.0) (@gcanti) -- **Internal** - - allow for infinite unions (@gcanti) - -# 0.5.1 - -- **Bug Fix** - - export and rename `interfaceType` to `_interface`, fix #57 (@gcanti) - -# 0.5.0 - -- **Breaking Change** - - `Type` is now an interface - - types no more own a `is` method, use `t.is` instead - - unions no more own a `fold` method - - `Reporter`, `PathReporter`, `ThrowReporter` are now top level modules - -# 0.4.0 - -- **Breaking Change** - - upgrade to latest `fp-ts` (`io-ts` APIs are not changed though) (@gcanti) - - drop `lib-jsnext` folder - -# 0.3.2 - -- **Bug Fix** - - remove excess overloadings, fix #43 (@gcanti) - -# 0.3.1 - -- **New Feature** - - add mapWithName and Functor instance, fix #37 (@gcanti) - - add prism combinator, fix #41 (@gcanti) - -# 0.3.0 - -This is a breaking change _only_ if you are using fp-ts APIs - -- **Breaking Change** - - upgrade to latest fp-ts v0.2 (@gcanti) - -# 0.2.3 - -- **Internal** - - upgrade to fp-ts v0.1 (@gcanti) - -# 0.2.2 - -- **New Feature** - - add `partial` combinator (makes optional props possible) - - add `readonly` combinator (values are not frozen in production) - - add `readonlyArray` combinator (values are not frozen in production) - - add `never` type -- **Breaking Changes** - - remove `maybe` combinator, can be defined in userland as - ```ts - export function maybe( - type: RT, - name?: string - ): t.UnionType<[RT, typeof t.null], t.TypeOf | null> { - return t.union([type, t.null], name) - } - ``` -- **Polish** - - export `pathReporterFailure` function from default reporters -- **Bug Fix** - - revert pruning excess properties (see https://github.com/gcanti/io-ts/pull/27 for context) - - revert `intersection` combinator accepting only `InterfaceType`s -- **Experimental** - - Pattern matching / catamorphism for unions - -# 0.1.0 - -- **New Feature** - - - add support for jsnext - - add `Integer` type - -- **Breaking Changes** - - `t.Object` type. Renamed to `t.Dictionary`, now accepts arrays so is fully equivalent to `{ [key: string]: any }`. - - `t.instanceOf` combinator. Removed. - - `t.object` combinator. Renamed to `t.interface`. `ObjectType` to `InterfaceType`. Excess properties are now pruned. - - `mapping` combinator. Renamed to `dictionary`. `MappingType` to `DictionaryType`. - - `intersection` combinator. Due to the new excess property pruning in `t.interface` now only accept `InterfaceType`s. - - API `isSuccess` removed, use `either.isRight` instead - - API `isFailure` removed, use `either.isLeft` instead - - API `fromValidation` removed - -# 0.0.2 - -- **Bug Fix** - - reverse overloading definitions for unions, intersections and tuples, fix inference bug - -# 0.0.1 - -Initial release diff --git a/components/pexels/node_modules/io-ts/Codec/package.json b/components/pexels/node_modules/io-ts/Codec/package.json deleted file mode 100644 index a4906f104e29d..0000000000000 --- a/components/pexels/node_modules/io-ts/Codec/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/Codec.js", - "module": "../es6/Codec.js", - "typings": "../lib/Codec.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/DecodeError/package.json b/components/pexels/node_modules/io-ts/DecodeError/package.json deleted file mode 100644 index 0534abd536415..0000000000000 --- a/components/pexels/node_modules/io-ts/DecodeError/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/DecodeError.js", - "module": "../es6/DecodeError.js", - "typings": "../lib/DecodeError.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Decoder/package.json b/components/pexels/node_modules/io-ts/Decoder/package.json deleted file mode 100644 index 86cfbd599b143..0000000000000 --- a/components/pexels/node_modules/io-ts/Decoder/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/Decoder.js", - "module": "../es6/Decoder.js", - "typings": "../lib/Decoder.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Encoder/package.json b/components/pexels/node_modules/io-ts/Encoder/package.json deleted file mode 100644 index 65cdb0dbd1ee1..0000000000000 --- a/components/pexels/node_modules/io-ts/Encoder/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/Encoder.js", - "module": "../es6/Encoder.js", - "typings": "../lib/Encoder.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Eq/package.json b/components/pexels/node_modules/io-ts/Eq/package.json deleted file mode 100644 index ac1ff9a0401c4..0000000000000 --- a/components/pexels/node_modules/io-ts/Eq/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/Eq.js", - "module": "../es6/Eq.js", - "typings": "../lib/Eq.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/FreeSemigroup/package.json b/components/pexels/node_modules/io-ts/FreeSemigroup/package.json deleted file mode 100644 index d4cd028e068bb..0000000000000 --- a/components/pexels/node_modules/io-ts/FreeSemigroup/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/FreeSemigroup.js", - "module": "../es6/FreeSemigroup.js", - "typings": "../lib/FreeSemigroup.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Guard/package.json b/components/pexels/node_modules/io-ts/Guard/package.json deleted file mode 100644 index d9085219ba4ae..0000000000000 --- a/components/pexels/node_modules/io-ts/Guard/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/Guard.js", - "module": "../es6/Guard.js", - "typings": "../lib/Guard.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Kleisli/package.json b/components/pexels/node_modules/io-ts/Kleisli/package.json deleted file mode 100644 index 173f511fb4248..0000000000000 --- a/components/pexels/node_modules/io-ts/Kleisli/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/Kleisli.js", - "module": "../es6/Kleisli.js", - "typings": "../lib/Kleisli.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/LICENSE b/components/pexels/node_modules/io-ts/LICENSE deleted file mode 100644 index 658879995e721..0000000000000 --- a/components/pexels/node_modules/io-ts/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Giulio Canti - -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/components/pexels/node_modules/io-ts/PathReporter/package.json b/components/pexels/node_modules/io-ts/PathReporter/package.json deleted file mode 100644 index 5b74c1ba12f75..0000000000000 --- a/components/pexels/node_modules/io-ts/PathReporter/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/PathReporter.js", - "module": "../es6/PathReporter.js", - "typings": "../lib/PathReporter.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/README.md b/components/pexels/node_modules/io-ts/README.md deleted file mode 100644 index 822ef86cda36c..0000000000000 --- a/components/pexels/node_modules/io-ts/README.md +++ /dev/null @@ -1,43 +0,0 @@ -[![build status](https://img.shields.io/travis/gcanti/io-ts/master.svg?style=flat-square)](https://travis-ci.org/gcanti/io-ts) -![npm downloads](https://img.shields.io/npm/dm/io-ts.svg) - - - - -- [Installation](#installation) -- [Usage](#usage) - - [Stable features](#stable-features) - - [Experimental features (version `2.2+`)](#experimental-features-version-22) - - - -# Installation - -To install the stable version - -```sh -npm i io-ts fp-ts -``` - -**Note**. [`fp-ts`](https://github.com/gcanti/fp-ts) is a peer dependency for `io-ts` - -# Usage - - -## Stable features - -- [Documentation of the main stable features (`index.ts` module)](index.md) - -## Experimental modules (version `2.2+`) - -Experimental modules (\*) are published in order to get early feedback from the community, see these tracking [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - -The experimental modules are **independent and backward-incompatible** with stable ones. - -- [`Decoder.ts` module](Decoder.md) -- [`Encoder.ts` module](Encoder.md) -- [`Codec.ts` module](Codec.md) -- [`Eq.ts` module](Eq.md) -- [`Schema.ts` module (advanced feature)](Schema.md) - -(\*) A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. diff --git a/components/pexels/node_modules/io-ts/Reporter/package.json b/components/pexels/node_modules/io-ts/Reporter/package.json deleted file mode 100644 index 171a587b81a33..0000000000000 --- a/components/pexels/node_modules/io-ts/Reporter/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/Reporter.js", - "module": "../es6/Reporter.js", - "typings": "../lib/Reporter.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Schema/package.json b/components/pexels/node_modules/io-ts/Schema/package.json deleted file mode 100644 index 40b30934e55fd..0000000000000 --- a/components/pexels/node_modules/io-ts/Schema/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/Schema.js", - "module": "../es6/Schema.js", - "typings": "../lib/Schema.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Schemable/package.json b/components/pexels/node_modules/io-ts/Schemable/package.json deleted file mode 100644 index 0fa0b6bd08699..0000000000000 --- a/components/pexels/node_modules/io-ts/Schemable/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/Schemable.js", - "module": "../es6/Schemable.js", - "typings": "../lib/Schemable.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/TaskDecoder/package.json b/components/pexels/node_modules/io-ts/TaskDecoder/package.json deleted file mode 100644 index 7b3608fecd83e..0000000000000 --- a/components/pexels/node_modules/io-ts/TaskDecoder/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/TaskDecoder.js", - "module": "../es6/TaskDecoder.js", - "typings": "../lib/TaskDecoder.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/ThrowReporter/package.json b/components/pexels/node_modules/io-ts/ThrowReporter/package.json deleted file mode 100644 index b427006875a0c..0000000000000 --- a/components/pexels/node_modules/io-ts/ThrowReporter/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/ThrowReporter.js", - "module": "../es6/ThrowReporter.js", - "typings": "../lib/ThrowReporter.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/Type/package.json b/components/pexels/node_modules/io-ts/Type/package.json deleted file mode 100644 index da4d3c4a515c1..0000000000000 --- a/components/pexels/node_modules/io-ts/Type/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "../lib/Type.js", - "module": "../es6/Type.js", - "typings": "../lib/Type.d.ts", - "sideEffects": false -} \ No newline at end of file diff --git a/components/pexels/node_modules/io-ts/es6/Codec.d.ts b/components/pexels/node_modules/io-ts/es6/Codec.d.ts deleted file mode 100644 index 3891f5362e7dc..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Codec.d.ts +++ /dev/null @@ -1,296 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.3 - */ -import { Refinement } from 'fp-ts/es6/function' -import { Invariant3 } from 'fp-ts/es6/Invariant' -import * as D from './Decoder' -import * as E from './Encoder' -import * as S from './Schemable' -/** - * Laws: - * - * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` - * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` - * - * @category model - * @since 2.2.3 - */ -export interface Codec extends D.Decoder, E.Encoder {} -/** - * @category constructors - * @since 2.2.3 - */ -export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec -/** - * @category constructors - * @since 2.2.3 - */ -export declare function fromDecoder(decoder: D.Decoder): Codec -/** - * @category constructors - * @since 2.2.3 - */ -export declare function literal], L extends S.Literal = S.Literal>( - ...values: A -): Codec -/** - * @category primitives - * @since 2.2.3 - */ -export declare const string: Codec -/** - * @category primitives - * @since 2.2.3 - */ -export declare const number: Codec -/** - * @category primitives - * @since 2.2.3 - */ -export declare const boolean: Codec -/** - * @category primitives - * @since 2.2.3 - */ -export declare const UnknownArray: Codec, Array> -/** - * @category primitives - * @since 2.2.3 - */ -export declare const UnknownRecord: Codec, Record> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const mapLeftWithInput: ( - f: (i: I, e: D.DecodeError) => D.DecodeError -) => (codec: Codec) => Codec -/** - * @category combinators - * @since 2.2.3 - */ -export declare const refine: ( - refinement: Refinement, - id: string -) => (from: Codec) => Codec -/** - * @category combinators - * @since 2.2.3 - */ -export declare function nullable(or: Codec): Codec -/** - * @category combinators - * @since 2.2.15 - */ -export declare function fromStruct

>>( - properties: P -): Codec< - { - [K in keyof P]: InputOf - }, - { - [K in keyof P]: OutputOf - }, - { - [K in keyof P]: TypeOf - } -> -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -export declare const fromType: typeof fromStruct -/** - * @category combinators - * @since 2.2.15 - */ -export declare function struct

>>( - properties: P -): Codec< - unknown, - { - [K in keyof P]: OutputOf - }, - { - [K in keyof P]: TypeOf - } -> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -export declare const type: typeof struct -/** - * @category combinators - * @since 2.2.8 - */ -export declare function fromPartial

>>( - properties: P -): Codec< - Partial<{ - [K in keyof P]: InputOf - }>, - Partial<{ - [K in keyof P]: OutputOf - }>, - Partial<{ - [K in keyof P]: TypeOf - }> -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function partial

>>( - properties: P -): Codec< - unknown, - Partial<{ - [K in keyof P]: OutputOf - }>, - Partial<{ - [K in keyof P]: TypeOf - }> -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function fromArray(item: Codec): Codec, Array, Array> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function array(item: Codec): Codec, Array> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function fromRecord( - codomain: Codec -): Codec, Record, Record> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function record( - codomain: Codec -): Codec, Record> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromTuple: []>( - ...components: C -) => Codec< - { [K in keyof C]: import('./Kleisli').InputOf<'Either', C[K]> }, - { [K_1 in keyof C]: E.OutputOf }, - { [K_2 in keyof C]: E.TypeOf } -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function tuple>>( - ...components: C -): Codec< - unknown, - { - [K in keyof C]: OutputOf - }, - { - [K in keyof C]: TypeOf - } -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const intersect: ( - right: Codec -) => (left: Codec) => Codec -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromSum: ( - tag: T -) => >>( - members: MS -) => Codec, E.OutputOf, E.TypeOf> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function sum( - tag: T -): >>( - members: M -) => Codec, TypeOf> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function lazy(id: string, f: () => Codec): Codec -/** - * @category combinators - * @since 2.2.16 - */ -export declare const readonly: (codec: Codec) => Codec> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const compose: ( - to: Codec -) => (from: Codec) => Codec -/** - * @category Invariant - * @since 2.2.3 - */ -export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec -/** - * @category instances - * @since 2.2.3 - */ -export declare const URI = 'io-ts/Codec' -/** - * @category instances - * @since 2.2.3 - */ -export type URI = typeof URI -declare module 'fp-ts/es6/HKT' { - interface URItoKind3 { - readonly [URI]: Codec - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Invariant: Invariant3 -/** - * @since 2.2.8 - */ -export type InputOf = D.InputOf -/** - * @since 2.2.3 - */ -export type OutputOf = E.OutputOf -/** - * @since 2.2.3 - */ -export type TypeOf = E.TypeOf diff --git a/components/pexels/node_modules/io-ts/es6/Codec.js b/components/pexels/node_modules/io-ts/es6/Codec.js deleted file mode 100644 index 7dd7f40fa3501..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Codec.js +++ /dev/null @@ -1,284 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.3 - */ -import { identity } from 'fp-ts/es6/function'; -import { pipe } from 'fp-ts/es6/pipeable'; -import * as D from './Decoder'; -import * as E from './Encoder'; -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.3 - */ -export function make(decoder, encoder) { - return { - decode: decoder.decode, - encode: encoder.encode - }; -} -/** - * @category constructors - * @since 2.2.3 - */ -export function fromDecoder(decoder) { - return { - decode: decoder.decode, - encode: identity - }; -} -/** - * @category constructors - * @since 2.2.3 - */ -export function literal() { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return fromDecoder(D.literal.apply(D, values)); -} -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.3 - */ -export var string = -/*#__PURE__*/ -fromDecoder(D.string); -/** - * @category primitives - * @since 2.2.3 - */ -export var number = -/*#__PURE__*/ -fromDecoder(D.number); -/** - * @category primitives - * @since 2.2.3 - */ -export var boolean = -/*#__PURE__*/ -fromDecoder(D.boolean); -/** - * @category primitives - * @since 2.2.3 - */ -export var UnknownArray = -/*#__PURE__*/ -fromDecoder(D.UnknownArray); -/** - * @category primitives - * @since 2.2.3 - */ -export var UnknownRecord = -/*#__PURE__*/ -fromDecoder(D.UnknownRecord); -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.3 - */ -export var mapLeftWithInput = function (f) { - return function (codec) { - return make(pipe(codec, D.mapLeftWithInput(f)), codec); - }; -}; -/** - * @category combinators - * @since 2.2.3 - */ -export var refine = function (refinement, id) { - var refine = D.refine(refinement, id); - return function (from) { return make(refine(from), from); }; -}; -/** - * @category combinators - * @since 2.2.3 - */ -export function nullable(or) { - return make(D.nullable(or), E.nullable(or)); -} -/** - * @category combinators - * @since 2.2.15 - */ -export function fromStruct(properties) { - return make(D.fromStruct(properties), E.struct(properties)); -} -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -export var fromType = fromStruct; -/** - * @category combinators - * @since 2.2.15 - */ -export function struct(properties) { - return pipe(UnknownRecord, compose(fromStruct(properties))); -} -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -export var type = struct; -/** - * @category combinators - * @since 2.2.8 - */ -export function fromPartial(properties) { - return make(D.fromPartial(properties), E.partial(properties)); -} -/** - * @category combinators - * @since 2.2.3 - */ -export function partial(properties) { - return pipe(UnknownRecord, compose(fromPartial(properties))); -} -/** - * @category combinators - * @since 2.2.3 - */ -export function fromArray(item) { - return make(D.fromArray(item), E.array(item)); -} -/** - * @category combinators - * @since 2.2.3 - */ -export function array(item) { - return pipe(UnknownArray, compose(fromArray(item))); -} -/** - * @category combinators - * @since 2.2.3 - */ -export function fromRecord(codomain) { - return make(D.fromRecord(codomain), E.record(codomain)); -} -/** - * @category combinators - * @since 2.2.3 - */ -export function record(codomain) { - return pipe(UnknownRecord, compose(fromRecord(codomain))); -} -/** - * @category combinators - * @since 2.2.8 - */ -export var fromTuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return make(D.fromTuple.apply(D, components), E.tuple.apply(E, components)); -}; -/** - * @category combinators - * @since 2.2.3 - */ -export function tuple() { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return pipe(UnknownArray, compose(fromTuple.apply(void 0, components))); -} -/** - * @category combinators - * @since 2.2.3 - */ -export var intersect = function (right) { - var intersectD = D.intersect(right); - var intersectE = E.intersect(right); - return function (left) { return make(intersectD(left), intersectE(left)); }; -}; -/** - * @category combinators - * @since 2.2.8 - */ -export var fromSum = function (tag) { - var decoder = D.fromSum(tag); - var encoder = E.sum(tag); - return function (members) { return make(decoder(members), encoder(members)); }; -}; -/** - * @category combinators - * @since 2.2.3 - */ -export function sum(tag) { - var sum = fromSum(tag); - return function (members) { return pipe(UnknownRecord, compose(sum(members))); }; -} -/** - * @category combinators - * @since 2.2.3 - */ -export function lazy(id, f) { - return make(D.lazy(id, f), E.lazy(f)); -} -/** - * @category combinators - * @since 2.2.16 - */ -export var readonly = identity; -/** - * @category combinators - * @since 2.2.8 - */ -export var compose = function (to) { - return function (from) { - return make(D.compose(to)(from), E.compose(from)(to)); - }; -}; -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- -var imap_ = function (fa, f, g) { return make(D.Functor.map(fa, f), E.Contravariant.contramap(fa, g)); }; -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- -/** - * @category Invariant - * @since 2.2.3 - */ -export var imap = function (f, g) { return function (fa) { - return imap_(fa, f, g); -}; }; -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.3 - */ -export var URI = 'io-ts/Codec'; -/** - * @category instances - * @since 2.2.8 - */ -export var Invariant = { - URI: URI, - imap: imap_ -}; diff --git a/components/pexels/node_modules/io-ts/es6/DecodeError.d.ts b/components/pexels/node_modules/io-ts/es6/DecodeError.d.ts deleted file mode 100644 index fda24ed808370..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/DecodeError.d.ts +++ /dev/null @@ -1,135 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Semigroup } from 'fp-ts/es6/Semigroup' -import * as FS from './FreeSemigroup' -/** - * @category model - * @since 2.2.7 - */ -export interface Leaf { - readonly _tag: 'Leaf' - readonly actual: unknown - readonly error: E -} -/** - * @category model - * @since 2.2.7 - */ -export declare const required: 'required' -/** - * @category model - * @since 2.2.7 - */ -export declare const optional: 'optional' -/** - * @category model - * @since 2.2.7 - */ -export type Kind = 'required' | 'optional' -/** - * @category model - * @since 2.2.7 - */ -export interface Key { - readonly _tag: 'Key' - readonly key: string - readonly kind: Kind - readonly errors: FS.FreeSemigroup> -} -/** - * @category model - * @since 2.2.7 - */ -export interface Index { - readonly _tag: 'Index' - readonly index: number - readonly kind: Kind - readonly errors: FS.FreeSemigroup> -} -/** - * @category model - * @since 2.2.7 - */ -export interface Member { - readonly _tag: 'Member' - readonly index: number - readonly errors: FS.FreeSemigroup> -} -/** - * @category model - * @since 2.2.7 - */ -export interface Lazy { - readonly _tag: 'Lazy' - readonly id: string - readonly errors: FS.FreeSemigroup> -} -/** - * @category model - * @since 2.2.9 - */ -export interface Wrap { - readonly _tag: 'Wrap' - readonly error: E - readonly errors: FS.FreeSemigroup> -} -/** - * @category model - * @since 2.2.7 - */ -export type DecodeError = Leaf | Key | Index | Member | Lazy | Wrap -/** - * @category constructors - * @since 2.2.7 - */ -export declare const leaf: (actual: unknown, error: E) => DecodeError -/** - * @category constructors - * @since 2.2.7 - */ -export declare const key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => DecodeError -/** - * @category constructors - * @since 2.2.7 - */ -export declare const index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => DecodeError -/** - * @category constructors - * @since 2.2.7 - */ -export declare const member: (index: number, errors: FS.FreeSemigroup>) => DecodeError -/** - * @category constructors - * @since 2.2.7 - */ -export declare const lazy: (id: string, errors: FS.FreeSemigroup>) => DecodeError -/** - * @category constructors - * @since 2.2.9 - */ -export declare const wrap: (error: E, errors: FS.FreeSemigroup>) => DecodeError -/** - * @category destructors - * @since 2.2.7 - */ -export declare const fold: (patterns: { - Leaf: (input: unknown, error: E) => R - Key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => R - Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R - Member: (index: number, errors: FS.FreeSemigroup>) => R - Lazy: (id: string, errors: FS.FreeSemigroup>) => R - Wrap: (error: E, errors: FS.FreeSemigroup>) => R -}) => (e: DecodeError) => R -/** - * @category instances - * @since 2.2.7 - */ -export declare function getSemigroup(): Semigroup>> diff --git a/components/pexels/node_modules/io-ts/es6/DecodeError.js b/components/pexels/node_modules/io-ts/es6/DecodeError.js deleted file mode 100644 index 81cdbb6efd90f..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/DecodeError.js +++ /dev/null @@ -1,95 +0,0 @@ -import * as FS from './FreeSemigroup'; -/** - * @category model - * @since 2.2.7 - */ -// eslint-disable-next-line @typescript-eslint/prefer-as-const -export var required = 'required'; -/** - * @category model - * @since 2.2.7 - */ -// eslint-disable-next-line @typescript-eslint/prefer-as-const -export var optional = 'optional'; -/** - * @category constructors - * @since 2.2.7 - */ -export var leaf = function (actual, error) { return ({ _tag: 'Leaf', actual: actual, error: error }); }; -/** - * @category constructors - * @since 2.2.7 - */ -export var key = function (key, kind, errors) { return ({ - _tag: 'Key', - key: key, - kind: kind, - errors: errors -}); }; -/** - * @category constructors - * @since 2.2.7 - */ -export var index = function (index, kind, errors) { return ({ - _tag: 'Index', - index: index, - kind: kind, - errors: errors -}); }; -/** - * @category constructors - * @since 2.2.7 - */ -export var member = function (index, errors) { return ({ - _tag: 'Member', - index: index, - errors: errors -}); }; -/** - * @category constructors - * @since 2.2.7 - */ -export var lazy = function (id, errors) { return ({ - _tag: 'Lazy', - id: id, - errors: errors -}); }; -/** - * @category constructors - * @since 2.2.9 - */ -export var wrap = function (error, errors) { return ({ - _tag: 'Wrap', - error: error, - errors: errors -}); }; -/** - * @category destructors - * @since 2.2.7 - */ -export var fold = function (patterns) { - var f = function (e) { - switch (e._tag) { - case 'Leaf': - return patterns.Leaf(e.actual, e.error); - case 'Key': - return patterns.Key(e.key, e.kind, e.errors); - case 'Index': - return patterns.Index(e.index, e.kind, e.errors); - case 'Member': - return patterns.Member(e.index, e.errors); - case 'Lazy': - return patterns.Lazy(e.id, e.errors); - case 'Wrap': - return patterns.Wrap(e.error, e.errors); - } - }; - return f; -}; -/** - * @category instances - * @since 2.2.7 - */ -export function getSemigroup() { - return FS.getSemigroup(); -} diff --git a/components/pexels/node_modules/io-ts/es6/Decoder.d.ts b/components/pexels/node_modules/io-ts/es6/Decoder.d.ts deleted file mode 100644 index 3836c85fc5b7a..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Decoder.d.ts +++ /dev/null @@ -1,331 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Alt2 } from 'fp-ts/es6/Alt' -import { Category2 } from 'fp-ts/es6/Category' -import * as E from 'fp-ts/es6/Either' -import { Refinement } from 'fp-ts/es6/function' -import { Functor2 } from 'fp-ts/es6/Functor' -import * as DE from './DecodeError' -import * as FS from './FreeSemigroup' -import * as G from './Guard' -import * as K from './Kleisli' -import * as S from './Schemable' -/** - * @category model - * @since 2.2.8 - */ -export interface Decoder extends K.Kleisli {} -/** - * @category DecodeError - * @since 2.2.7 - */ -export type DecodeError = FS.FreeSemigroup> -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const error: (actual: unknown, message: string) => DecodeError -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const success: (a: A) => E.Either -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const failure: (actual: unknown, message: string) => E.Either -/** - * @category constructors - * @since 2.2.8 - */ -export declare const fromRefinement: (refinement: Refinement, expected: string) => Decoder -/** - * @category constructors - * @since 2.2.8 - */ -export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder -/** - * @category constructors - * @since 2.2.7 - */ -export declare const literal: ], L extends S.Literal = S.Literal>( - ...values: A -) => Decoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const string: Decoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const number: Decoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const boolean: Decoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const UnknownArray: Decoder> -/** - * @category primitives - * @since 2.2.7 - */ -export declare const UnknownRecord: Decoder> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const mapLeftWithInput: ( - f: (input: I, e: DecodeError) => DecodeError -) => (decoder: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.9 - */ -export declare const withMessage: ( - message: (input: I, e: DecodeError) => string -) => (decoder: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const refine: ( - refinement: Refinement, - id: string -) => (from: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const parse: ( - parser: (a: A) => E.Either -) => (from: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const nullable: (or: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.15 - */ -export declare const fromStruct:

>>( - properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -export declare const fromType:

>>( - properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> -/** - * @category combinators - * @since 2.2.15 - */ -export declare const struct: (properties: { [K in keyof A]: Decoder }) => Decoder< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -export declare const type: (properties: { [K in keyof A]: Decoder }) => Decoder< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromPartial:

>>( - properties: P -) => Decoder< - Partial<{ [K in keyof P]: K.InputOf<'Either', P[K]> }>, - Partial<{ [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> -> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const partial: (properties: { [K in keyof A]: Decoder }) => Decoder< - unknown, - Partial<{ [K_1 in keyof A]: A[K_1] }> -> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromArray: (item: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const array: (item: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromRecord: (codomain: Decoder) => Decoder, Record> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const record: (codomain: Decoder) => Decoder> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromTuple: []>( - ...components: C -) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K_1 in keyof C]: K.TypeOf<'Either', C[K_1]> }> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const tuple: ( - ...components: { [K in keyof A]: Decoder } -) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const union: , ...Array>]>( - ...members: MS -) => Decoder, TypeOf> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const intersect: ( - right: Decoder -) => (left: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromSum: ( - tag: T -) => >>( - members: MS -) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: Decoder> }) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const lazy: (id: string, f: () => Decoder) => Decoder -/** - * @category combinators - * @since 2.2.15 - */ -export declare const readonly: (decoder: Decoder) => Decoder> -/** - * @category Functor - * @since 2.2.7 - */ -export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder -/** - * @category Alt - * @since 2.2.7 - */ -export declare const alt: (that: () => Decoder) => (me: Decoder) => Decoder -/** - * @category Semigroupoid - * @since 2.2.8 - */ -export declare const compose: (to: Decoder) => (from: Decoder) => Decoder -/** - * @category Category - * @since 2.2.8 - */ -export declare const id: () => Decoder -/** - * @category instances - * @since 2.2.7 - */ -export declare const URI = 'io-ts/Decoder' -/** - * @category instances - * @since 2.2.7 - */ -export type URI = typeof URI -declare module 'fp-ts/es6/HKT' { - interface URItoKind2 { - readonly [URI]: Decoder - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Functor: Functor2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Alt: Alt2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Category: Category2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Schemable: S.Schemable2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnknownContainers: S.WithUnknownContainers2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnion: S.WithUnion2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithRefine: S.WithRefine2C -/** - * @since 2.2.8 - */ -export type InputOf = K.InputOf -/** - * @since 2.2.7 - */ -export type TypeOf = K.TypeOf -/** - * @since 2.2.7 - */ -export declare const draw: (e: DecodeError) => string diff --git a/components/pexels/node_modules/io-ts/es6/Decoder.js b/components/pexels/node_modules/io-ts/es6/Decoder.js deleted file mode 100644 index a11b261c56a47..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Decoder.js +++ /dev/null @@ -1,477 +0,0 @@ -import * as E from 'fp-ts/es6/Either'; -import { identity } from 'fp-ts/es6/function'; -import { pipe } from 'fp-ts/es6/pipeable'; -import * as DE from './DecodeError'; -import * as FS from './FreeSemigroup'; -import * as G from './Guard'; -import * as K from './Kleisli'; -// ------------------------------------------------------------------------------------- -// Kleisli config -// ------------------------------------------------------------------------------------- -/** - * @internal - */ -export var SE = -/*#__PURE__*/ -DE.getSemigroup(); -/** - * @internal - */ -export var ap = function (fab, fa) { - return E.isLeft(fab) - ? E.isLeft(fa) - ? E.left(SE.concat(fab.left, fa.left)) - : fab - : E.isLeft(fa) - ? fa - : E.right(fab.right(fa.right)); -}; -var M = { - URI: E.URI, - _E: undefined, - map: function (fa, f) { return pipe(fa, E.map(f)); }, - ap: ap, - of: E.right, - chain: function (ma, f) { return pipe(ma, E.chain(f)); }, - throwError: E.left, - bimap: function (fa, f, g) { return pipe(fa, E.bimap(f, g)); }, - mapLeft: function (fa, f) { return pipe(fa, E.mapLeft(f)); }, - alt: function (me, that) { - if (E.isRight(me)) { - return me; - } - var ea = that(); - return E.isLeft(ea) ? E.left(SE.concat(me.left, ea.left)) : ea; - } -}; -/** - * @category DecodeError - * @since 2.2.7 - */ -export var error = function (actual, message) { return FS.of(DE.leaf(actual, message)); }; -/** - * @category DecodeError - * @since 2.2.7 - */ -export var success = E.right; -/** - * @category DecodeError - * @since 2.2.7 - */ -export var failure = function (actual, message) { - return E.left(error(actual, message)); -}; -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.8 - */ -export var fromRefinement = function (refinement, expected) { - return K.fromRefinement(M)(refinement, function (u) { return error(u, expected); }); -}; -/** - * @category constructors - * @since 2.2.8 - */ -export var fromGuard = function (guard, expected) { - return fromRefinement(guard.is, expected); -}; -/** - * @category constructors - * @since 2.2.7 - */ -export var literal = -/*#__PURE__*/ -K.literal(M)(function (u, values) { return error(u, values.map(function (value) { return JSON.stringify(value); }).join(' | ')); }); -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.7 - */ -export var string = -/*#__PURE__*/ -fromGuard(G.string, 'string'); -/** - * @category primitives - * @since 2.2.7 - */ -export var number = -/*#__PURE__*/ -fromGuard(G.number, 'number'); -/** - * @category primitives - * @since 2.2.7 - */ -export var boolean = -/*#__PURE__*/ -fromGuard(G.boolean, 'boolean'); -/** - * @category primitives - * @since 2.2.7 - */ -export var UnknownArray = -/*#__PURE__*/ -fromGuard(G.UnknownArray, 'Array'); -/** - * @category primitives - * @since 2.2.7 - */ -export var UnknownRecord = -/*#__PURE__*/ -fromGuard(G.UnknownRecord, 'Record'); -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.7 - */ -export var mapLeftWithInput = -/*#__PURE__*/ -K.mapLeftWithInput(M); -/** - * @category combinators - * @since 2.2.9 - */ -export var withMessage = function (message) { - return mapLeftWithInput(function (input, e) { return FS.of(DE.wrap(message(input, e), e)); }); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var refine = function (refinement, id) { return K.refine(M)(refinement, function (a) { return error(a, id); }); }; -/** - * @category combinators - * @since 2.2.7 - */ -export var parse = -/*#__PURE__*/ -K.parse(M); -/** - * @category combinators - * @since 2.2.7 - */ -export var nullable = -/*#__PURE__*/ -K.nullable(M)(function (u, e) { return FS.concat(FS.of(DE.member(0, error(u, 'null'))), FS.of(DE.member(1, e))); }); -/** - * @category combinators - * @since 2.2.15 - */ -export var fromStruct = function (properties) { - return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); -}; -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -export var fromType = fromStruct; -/** - * @category combinators - * @since 2.2.15 - */ -export var struct = function (properties) { return pipe(UnknownRecord, compose(fromStruct(properties))); }; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -export var type = struct; -/** - * @category combinators - * @since 2.2.8 - */ -export var fromPartial = function (properties) { - return K.fromPartial(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(properties); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var partial = function (properties) { return pipe(UnknownRecord, compose(fromPartial(properties))); }; -/** - * @category combinators - * @since 2.2.8 - */ -export var fromArray = function (item) { - return K.fromArray(M)(function (i, e) { return FS.of(DE.index(i, DE.optional, e)); })(item); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var array = function (item) { - return pipe(UnknownArray, compose(fromArray(item))); -}; -/** - * @category combinators - * @since 2.2.8 - */ -export var fromRecord = function (codomain) { - return K.fromRecord(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(codomain); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var record = function (codomain) { - return pipe(UnknownRecord, compose(fromRecord(codomain))); -}; -/** - * @category combinators - * @since 2.2.8 - */ -export var fromTuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return K.fromTuple(M)(function (i, e) { return FS.of(DE.index(i, DE.required, e)); }).apply(void 0, components); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var tuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return pipe(UnknownArray, compose(fromTuple.apply(void 0, components))); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var union = -/*#__PURE__*/ -K.union(M)(function (i, e) { return FS.of(DE.member(i, e)); }); -/** - * @category combinators - * @since 2.2.7 - */ -export var intersect = -/*#__PURE__*/ -K.intersect(M); -/** - * @category combinators - * @since 2.2.8 - */ -export var fromSum = function (tag) { - return function (members) { - return K.fromSum(M)(function (tag, value, keys) { - return FS.of(DE.key(tag, DE.required, error(value, keys.length === 0 ? 'never' : keys.map(function (k) { return JSON.stringify(k); }).join(' | ')))); - })(tag)(members); - }; -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var sum = function (tag) { - return function (members) { - return pipe(UnknownRecord, compose(fromSum(tag)(members))); - }; -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var lazy = -/*#__PURE__*/ -K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); -/** - * @category combinators - * @since 2.2.15 - */ -export var readonly = identity; -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- -var map_ = function (fa, f) { return pipe(fa, map(f)); }; -var alt_ = function (me, that) { return pipe(me, alt(that)); }; -var compose_ = function (ab, la) { return pipe(la, compose(ab)); }; -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- -/** - * @category Functor - * @since 2.2.7 - */ -export var map = -/*#__PURE__*/ -K.map(M); -/** - * @category Alt - * @since 2.2.7 - */ -export var alt = -/*#__PURE__*/ -K.alt(M); -/** - * @category Semigroupoid - * @since 2.2.8 - */ -export var compose = -/*#__PURE__*/ -K.compose(M); -/** - * @category Category - * @since 2.2.8 - */ -export var id = -/*#__PURE__*/ -K.id(M); -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.7 - */ -export var URI = 'io-ts/Decoder'; -/** - * @category instances - * @since 2.2.8 - */ -export var Functor = { - URI: URI, - map: map_ -}; -/** - * @category instances - * @since 2.2.8 - */ -export var Alt = { - URI: URI, - map: map_, - alt: alt_ -}; -/** - * @category instances - * @since 2.2.8 - */ -export var Category = { - URI: URI, - compose: compose_, - id: id -}; -/** - * @category instances - * @since 2.2.8 - */ -export var Schemable = { - URI: URI, - literal: literal, - string: string, - number: number, - boolean: boolean, - nullable: nullable, - type: type, - struct: struct, - partial: partial, - record: record, - array: array, - tuple: tuple, - intersect: intersect, - sum: sum, - lazy: lazy, - readonly: readonly -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithUnknownContainers = { - UnknownArray: UnknownArray, - UnknownRecord: UnknownRecord -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithUnion = { - union: union -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithRefine = { - refine: refine -}; -var empty = []; -var make = function (value, forest) { - if (forest === void 0) { forest = empty; } - return ({ - value: value, - forest: forest - }); -}; -var drawTree = function (tree) { return tree.value + drawForest('\n', tree.forest); }; -var drawForest = function (indentation, forest) { - var r = ''; - var len = forest.length; - var tree; - for (var i = 0; i < len; i++) { - tree = forest[i]; - var isLast = i === len - 1; - r += indentation + (isLast ? '└' : '├') + '─ ' + tree.value; - r += drawForest(indentation + (len > 1 && !isLast ? '│ ' : ' '), tree.forest); - } - return r; -}; -var toTree = DE.fold({ - Leaf: function (input, error) { return make("cannot decode ".concat(JSON.stringify(input), ", should be ").concat(error)); }, - Key: function (key, kind, errors) { return make("".concat(kind, " property ").concat(JSON.stringify(key)), toForest(errors)); }, - Index: function (index, kind, errors) { return make("".concat(kind, " index ").concat(index), toForest(errors)); }, - Member: function (index, errors) { return make("member ".concat(index), toForest(errors)); }, - Lazy: function (id, errors) { return make("lazy type ".concat(id), toForest(errors)); }, - Wrap: function (error, errors) { return make(error, toForest(errors)); } -}); -var toForest = function (e) { - var stack = []; - var focus = e; - var res = []; - // eslint-disable-next-line no-constant-condition - while (true) { - switch (focus._tag) { - case 'Of': - { - res.push(toTree(focus.value)); - var tmp = stack.pop(); - if (tmp === undefined) { - return res; - } - else { - focus = tmp; - } - } - break; - case 'Concat': - stack.push(focus.right); - focus = focus.left; - break; - } - } -}; -/** - * @since 2.2.7 - */ -export var draw = function (e) { return toForest(e).map(drawTree).join('\n'); }; -/** - * @internal - */ -export var stringify = -/*#__PURE__*/ -E.fold(draw, function (a) { return JSON.stringify(a, null, 2); }); diff --git a/components/pexels/node_modules/io-ts/es6/Encoder.d.ts b/components/pexels/node_modules/io-ts/es6/Encoder.d.ts deleted file mode 100644 index 6c2d3231f42c9..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Encoder.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.3 - */ -import { Category2 } from 'fp-ts/es6/Category' -import { Contravariant2 } from 'fp-ts/es6/Contravariant' -/** - * @category model - * @since 2.2.3 - */ -export interface Encoder { - readonly encode: (a: A) => O -} -/** - * @category combinators - * @since 2.2.3 - */ -export declare function nullable(or: Encoder): Encoder -/** - * @category combinators - * @since 2.2.15 - */ -export declare function struct

>>( - properties: P -): Encoder< - { - [K in keyof P]: OutputOf - }, - { - [K in keyof P]: TypeOf - } -> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -export declare const type: typeof struct -/** - * @category combinators - * @since 2.2.3 - */ -export declare function partial

>>( - properties: P -): Encoder< - Partial<{ - [K in keyof P]: OutputOf - }>, - Partial<{ - [K in keyof P]: TypeOf - }> -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function record(codomain: Encoder): Encoder, Record> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function array(item: Encoder): Encoder, Array> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function tuple>>( - ...components: C -): Encoder< - { - [K in keyof C]: OutputOf - }, - { - [K in keyof C]: TypeOf - } -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const intersect: (right: Encoder) => (left: Encoder) => Encoder -/** - * @category combinators - * @since 2.2.3 - */ -export declare function sum( - tag: T -): >>(members: MS) => Encoder, TypeOf> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function lazy(f: () => Encoder): Encoder -/** - * @category combinators - * @since 2.2.16 - */ -export declare const readonly: (decoder: Encoder) => Encoder> -/** - * @category Contravariant - * @since 2.2.3 - */ -export declare const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder -/** - * @category Semigroupoid - * @since 2.2.3 - */ -export declare const compose: (ea: Encoder) => (ab: Encoder) => Encoder -/** - * @category Category - * @since 2.2.3 - */ -export declare function id(): Encoder -/** - * @category instances - * @since 2.2.3 - */ -export declare const URI = 'io-ts/Encoder' -/** - * @category instances - * @since 2.2.3 - */ -export type URI = typeof URI -declare module 'fp-ts/es6/HKT' { - interface URItoKind2 { - readonly [URI]: Encoder - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Contravariant: Contravariant2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Category: Category2 -/** - * @since 2.2.3 - */ -export type TypeOf = E extends Encoder ? A : never -/** - * @since 2.2.3 - */ -export type OutputOf = E extends Encoder ? O : never diff --git a/components/pexels/node_modules/io-ts/es6/Encoder.js b/components/pexels/node_modules/io-ts/es6/Encoder.js deleted file mode 100644 index 4f430e14c8117..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Encoder.js +++ /dev/null @@ -1,187 +0,0 @@ -import { identity } from 'fp-ts/es6/function'; -import { intersect_, memoize } from './Schemable'; -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.3 - */ -export function nullable(or) { - return { - encode: function (a) { return (a === null ? null : or.encode(a)); } - }; -} -/** - * @category combinators - * @since 2.2.15 - */ -export function struct(properties) { - return { - encode: function (a) { - var o = {}; - for (var k in properties) { - o[k] = properties[k].encode(a[k]); - } - return o; - } - }; -} -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -export var type = struct; -/** - * @category combinators - * @since 2.2.3 - */ -export function partial(properties) { - return { - encode: function (a) { - var o = {}; - for (var k in properties) { - var v = a[k]; - // don't add missing properties - if (k in a) { - // don't strip undefined properties - o[k] = v === undefined ? undefined : properties[k].encode(v); - } - } - return o; - } - }; -} -/** - * @category combinators - * @since 2.2.3 - */ -export function record(codomain) { - return { - encode: function (r) { - var o = {}; - for (var k in r) { - o[k] = codomain.encode(r[k]); - } - return o; - } - }; -} -/** - * @category combinators - * @since 2.2.3 - */ -export function array(item) { - return { - encode: function (as) { return as.map(item.encode); } - }; -} -/** - * @category combinators - * @since 2.2.3 - */ -export function tuple() { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return { - encode: function (as) { return components.map(function (c, i) { return c.encode(as[i]); }); } - }; -} -/** - * @category combinators - * @since 2.2.3 - */ -export var intersect = function (right) { - return function (left) { return ({ - encode: function (ab) { return intersect_(left.encode(ab), right.encode(ab)); } - }); }; -}; -/** - * @category combinators - * @since 2.2.3 - */ -export function sum(tag) { - return function (members) { - return { - encode: function (a) { return members[a[tag]].encode(a); } - }; - }; -} -/** - * @category combinators - * @since 2.2.3 - */ -export function lazy(f) { - var get = memoize(f); - return { - encode: function (a) { return get().encode(a); } - }; -} -/** - * @category combinators - * @since 2.2.16 - */ -export var readonly = identity; -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- -var contramap_ = function (ea, f) { return ({ - encode: function (b) { return ea.encode(f(b)); } -}); }; -var compose_ = function (ab, ea) { return contramap_(ea, ab.encode); }; -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- -/** - * @category Contravariant - * @since 2.2.3 - */ -export var contramap = function (f) { return function (fa) { - return contramap_(fa, f); -}; }; -/** - * @category Semigroupoid - * @since 2.2.3 - */ -export var compose = function (ea) { return function (ab) { - return compose_(ab, ea); -}; }; -/** - * @category Category - * @since 2.2.3 - */ -export function id() { - return { - encode: identity - }; -} -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.3 - */ -export var URI = 'io-ts/Encoder'; -/** - * @category instances - * @since 2.2.8 - */ -export var Contravariant = { - URI: URI, - contramap: contramap_ -}; -/** - * @category instances - * @since 2.2.8 - */ -export var Category = { - URI: URI, - compose: compose_, - id: id -}; diff --git a/components/pexels/node_modules/io-ts/es6/Eq.d.ts b/components/pexels/node_modules/io-ts/es6/Eq.d.ts deleted file mode 100644 index 8b7fce725b557..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Eq.d.ts +++ /dev/null @@ -1,127 +0,0 @@ -import * as E from 'fp-ts/es6/Eq' -import { Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' -import Eq = E.Eq -/** - * @since 2.2.3 - */ -export type URI = E.URI -/** - * @since 2.2.2 - */ -export type TypeOf = E extends Eq ? A : never -/** - * @category primitives - * @since 2.2.2 - */ -export declare const string: Eq -/** - * @category primitives - * @since 2.2.2 - */ -export declare const number: Eq -/** - * @category primitives - * @since 2.2.2 - */ -export declare const boolean: Eq -/** - * @category primitives - * @since 2.2.2 - */ -export declare const UnknownArray: Eq> -/** - * @category primitives - * @since 2.2.2 - */ -export declare const UnknownRecord: Eq> -/** - * @category combinators - * @since 2.2.2 - */ -export declare function nullable(or: Eq): Eq -/** - * @category combinators - * @since 2.2.15 - */ -export declare const struct: (eqs: { - [K in keyof A]: Eq -}) => Eq<{ - [K in keyof A]: A[K] -}> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.2 - * @deprecated - */ -export declare const type: (eqs: { [K in keyof A]: E.Eq }) => E.Eq<{ [K_1 in keyof A]: A[K_1] }> -/** - * @category combinators - * @since 2.2.2 - */ -export declare function partial(properties: { - [K in keyof A]: Eq -}): Eq< - Partial<{ - [K in keyof A]: A[K] - }> -> -/** - * @category combinators - * @since 2.2.2 - */ -export declare const record: (codomain: Eq) => Eq> -/** - * @category combinators - * @since 2.2.2 - */ -export declare const array: (eq: Eq) => Eq> -/** - * @category combinators - * @since 2.2.2 - */ -export declare const tuple: >( - ...components: { - [K in keyof A]: Eq - } -) => Eq -/** - * @category combinators - * @since 2.2.2 - */ -export declare const intersect: (right: E.Eq) => (left: E.Eq) => E.Eq -/** - * @category combinators - * @since 2.2.2 - */ -export declare function sum( - tag: T -): (members: { - [K in keyof A]: Eq> -}) => Eq -/** - * @category combinators - * @since 2.2.2 - */ -export declare function lazy(f: () => Eq): Eq -/** - * @category combinators - * @since 2.2.15 - */ -export declare const readonly: (eq: Eq) => Eq> -/** - * @category instances - * @since 2.2.8 - */ -export declare const Schemable: Schemable1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnknownContainers: WithUnknownContainers1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithRefine: WithRefine1 diff --git a/components/pexels/node_modules/io-ts/es6/Eq.js b/components/pexels/node_modules/io-ts/es6/Eq.js deleted file mode 100644 index 97f31fa0e84a1..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Eq.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.2 - */ -import * as A from 'fp-ts/es6/Array'; -import * as E from 'fp-ts/es6/Eq'; -import { identity } from 'fp-ts/es6/function'; -import * as R from 'fp-ts/es6/Record'; -import { memoize } from './Schemable'; -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.2 - */ -export var string = E.eqString; -/** - * @category primitives - * @since 2.2.2 - */ -export var number = E.eqNumber; -/** - * @category primitives - * @since 2.2.2 - */ -export var boolean = E.eqBoolean; -/** - * @category primitives - * @since 2.2.2 - */ -export var UnknownArray = E.fromEquals(function (x, y) { return x.length === y.length; }); -/** - * @category primitives - * @since 2.2.2 - */ -export var UnknownRecord = E.fromEquals(function (x, y) { - for (var k in x) { - if (!(k in y)) { - return false; - } - } - for (var k in y) { - if (!(k in x)) { - return false; - } - } - return true; -}); -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.2 - */ -export function nullable(or) { - return { - equals: function (x, y) { return (x === null || y === null ? x === y : or.equals(x, y)); } - }; -} -/** - * @category combinators - * @since 2.2.15 - */ -export var struct = E.getStructEq; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.2 - * @deprecated - */ -export var type = struct; -/** - * @category combinators - * @since 2.2.2 - */ -export function partial(properties) { - return { - equals: function (x, y) { - for (var k in properties) { - var xk = x[k]; - var yk = y[k]; - if (!(xk === undefined || yk === undefined ? xk === yk : properties[k].equals(xk, yk))) { - return false; - } - } - return true; - } - }; -} -/** - * @category combinators - * @since 2.2.2 - */ -export var record = R.getEq; -/** - * @category combinators - * @since 2.2.2 - */ -export var array = A.getEq; -/** - * @category combinators - * @since 2.2.2 - */ -export var tuple = E.getTupleEq; -/** - * @category combinators - * @since 2.2.2 - */ -export var intersect = function (right) { - return function (left) { return ({ - equals: function (x, y) { return left.equals(x, y) && right.equals(x, y); } - }); }; -}; -/** - * @category combinators - * @since 2.2.2 - */ -export function sum(tag) { - return function (members) { - return { - equals: function (x, y) { - var vx = x[tag]; - var vy = y[tag]; - if (vx !== vy) { - return false; - } - return members[vx].equals(x, y); - } - }; - }; -} -/** - * @category combinators - * @since 2.2.2 - */ -export function lazy(f) { - var get = memoize(f); - return { - equals: function (x, y) { return get().equals(x, y); } - }; -} -/** - * @category combinators - * @since 2.2.15 - */ -export var readonly = identity; -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.8 - */ -export var Schemable = { - URI: E.URI, - literal: function () { return E.eqStrict; }, - string: string, - number: number, - boolean: boolean, - nullable: nullable, - type: type, - struct: struct, - partial: partial, - record: record, - array: array, - tuple: tuple, - intersect: intersect, - sum: sum, - lazy: function (_, f) { return lazy(f); }, - readonly: readonly -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithUnknownContainers = { - UnknownArray: UnknownArray, - UnknownRecord: UnknownRecord -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithRefine = { - refine: function () { return function (from) { return from; }; } -}; diff --git a/components/pexels/node_modules/io-ts/es6/FreeSemigroup.d.ts b/components/pexels/node_modules/io-ts/es6/FreeSemigroup.d.ts deleted file mode 100644 index 03d96487dd382..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/FreeSemigroup.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Semigroup } from 'fp-ts/es6/Semigroup' -/** - * @category model - * @since 2.2.7 - */ -export interface Of { - readonly _tag: 'Of' - readonly value: A -} -/** - * @category model - * @since 2.2.7 - */ -export interface Concat { - readonly _tag: 'Concat' - readonly left: FreeSemigroup - readonly right: FreeSemigroup -} -/** - * @category model - * @since 2.2.7 - */ -export type FreeSemigroup = Of | Concat -/** - * @category constructors - * @since 2.2.7 - */ -export declare const of: (a: A) => FreeSemigroup -/** - * @category constructors - * @since 2.2.7 - */ -export declare const concat: (left: FreeSemigroup, right: FreeSemigroup) => FreeSemigroup -/** - * @category destructors - * @since 2.2.7 - */ -export declare const fold: ( - onOf: (value: A) => R, - onConcat: (left: FreeSemigroup, right: FreeSemigroup) => R -) => (f: FreeSemigroup) => R -/** - * @category instances - * @since 2.2.7 - */ -export declare function getSemigroup(): Semigroup> diff --git a/components/pexels/node_modules/io-ts/es6/FreeSemigroup.js b/components/pexels/node_modules/io-ts/es6/FreeSemigroup.js deleted file mode 100644 index 29e69a04cc1d1..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/FreeSemigroup.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @category constructors - * @since 2.2.7 - */ -export var of = function (a) { return ({ _tag: 'Of', value: a }); }; -/** - * @category constructors - * @since 2.2.7 - */ -export var concat = function (left, right) { return ({ - _tag: 'Concat', - left: left, - right: right -}); }; -/** - * @category destructors - * @since 2.2.7 - */ -export var fold = function (onOf, onConcat) { - return function (f) { - switch (f._tag) { - case 'Of': - return onOf(f.value); - case 'Concat': - return onConcat(f.left, f.right); - } - }; -}; -/** - * @category instances - * @since 2.2.7 - */ -export function getSemigroup() { - return { concat: concat }; -} diff --git a/components/pexels/node_modules/io-ts/es6/Guard.d.ts b/components/pexels/node_modules/io-ts/es6/Guard.d.ts deleted file mode 100644 index 576ba7d4e9a25..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Guard.d.ts +++ /dev/null @@ -1,201 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.0 - */ -import { Refinement } from 'fp-ts/es6/function' -import * as S from './Schemable' -/** - * @category model - * @since 2.2.8 - */ -export interface Guard { - is: (i: I) => i is A -} -/** - * @since 2.2.2 - */ -export type TypeOf = G extends Guard ? A : never -/** - * @since 2.2.8 - */ -export type InputOf = G extends Guard ? I : never -/** - * @category constructors - * @since 2.2.0 - */ -export declare const literal: ( - ...values: A -) => Guard -/** - * @category primitives - * @since 2.2.0 - */ -export declare const string: Guard -/** - * Note: `NaN` is excluded. - * - * @category primitives - * @since 2.2.0 - */ -export declare const number: Guard -/** - * @category primitives - * @since 2.2.0 - */ -export declare const boolean: Guard -/** - * @category primitives - * @since 2.2.0 - */ -export declare const UnknownArray: Guard> -/** - * @category primitives - * @since 2.2.0 - */ -export declare const UnknownRecord: Guard> -/** - * @category combinators - * @since 2.2.0 - */ -export declare const refine: ( - refinement: Refinement -) => (from: Guard) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const nullable: (or: Guard) => Guard -/** - * @category combinators - * @since 2.2.15 - */ -export declare const struct: (properties: { [K in keyof A]: Guard }) => Guard< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.0 - * @deprecated - */ -export declare const type: (properties: { [K in keyof A]: Guard }) => Guard< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * @category combinators - * @since 2.2.0 - */ -export declare const partial: (properties: { [K in keyof A]: Guard }) => Guard< - unknown, - Partial<{ [K_1 in keyof A]: A[K_1] }> -> -/** - * @category combinators - * @since 2.2.0 - */ -export declare const array: (item: Guard) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const record: (codomain: Guard) => Guard> -/** - * @category combinators - * @since 2.2.0 - */ -export declare const tuple: ( - ...components: { [K in keyof A]: Guard } -) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const intersect: (right: Guard) => (left: Guard) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const union: ( - ...members: { [K in keyof A]: Guard } -) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: Guard> }) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const lazy: (f: () => Guard) => Guard -/** - * @category combinators - * @since 2.2.15 - */ -export declare const readonly: (guard: Guard) => Guard> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const alt: (that: () => Guard) => (me: Guard) => Guard -/** - * @category combinators - * @since 2.2.8 - */ -export declare const zero: () => Guard -/** - * @category combinators - * @since 2.2.8 - */ -export declare const compose: (to: Guard) => (from: Guard) => Guard -/** - * @category combinators - * @since 2.2.8 - */ -export declare const id: () => Guard -/** - * @category instances - * @since 2.2.0 - */ -export declare const URI = 'io-ts/Guard' -/** - * @category instances - * @since 2.2.0 - */ -export type URI = typeof URI -declare module 'fp-ts/es6/HKT' { - interface URItoKind { - readonly [URI]: Guard - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Schemable: S.Schemable1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnknownContainers: S.WithUnknownContainers1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnion: S.WithUnion1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithRefine: S.WithRefine1 diff --git a/components/pexels/node_modules/io-ts/es6/Guard.js b/components/pexels/node_modules/io-ts/es6/Guard.js deleted file mode 100644 index 5cab0392e6bed..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Guard.js +++ /dev/null @@ -1,295 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.0 - */ -import { identity } from 'fp-ts/es6/function'; -import { pipe } from 'fp-ts/es6/pipeable'; -import * as S from './Schemable'; -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.0 - */ -export var literal = function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return ({ - is: function (u) { return values.findIndex(function (a) { return a === u; }) !== -1; } - }); -}; -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.0 - */ -export var string = { - is: function (u) { return typeof u === 'string'; } -}; -/** - * Note: `NaN` is excluded. - * - * @category primitives - * @since 2.2.0 - */ -export var number = { - is: function (u) { return typeof u === 'number' && !isNaN(u); } -}; -/** - * @category primitives - * @since 2.2.0 - */ -export var boolean = { - is: function (u) { return typeof u === 'boolean'; } -}; -/** - * @category primitives - * @since 2.2.0 - */ -export var UnknownArray = { - is: Array.isArray -}; -/** - * @category primitives - * @since 2.2.0 - */ -export var UnknownRecord = { - is: function (u) { return u !== null && typeof u === 'object' && !Array.isArray(u); } -}; -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.0 - */ -export var refine = function (refinement) { - return function (from) { return ({ - is: function (i) { return from.is(i) && refinement(i); } - }); }; -}; -/** - * @category combinators - * @since 2.2.0 - */ -export var nullable = function (or) { return ({ - is: function (i) { return i === null || or.is(i); } -}); }; -/** - * @category combinators - * @since 2.2.15 - */ -export var struct = function (properties) { - return pipe(UnknownRecord, refine(function (r) { - for (var k in properties) { - if (!(k in r) || !properties[k].is(r[k])) { - return false; - } - } - return true; - })); -}; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.0 - * @deprecated - */ -export var type = struct; -/** - * @category combinators - * @since 2.2.0 - */ -export var partial = function (properties) { - return pipe(UnknownRecord, refine(function (r) { - for (var k in properties) { - var v = r[k]; - if (v !== undefined && !properties[k].is(v)) { - return false; - } - } - return true; - })); -}; -/** - * @category combinators - * @since 2.2.0 - */ -export var array = function (item) { - return pipe(UnknownArray, refine(function (us) { return us.every(item.is); })); -}; -/** - * @category combinators - * @since 2.2.0 - */ -export var record = function (codomain) { - return pipe(UnknownRecord, refine(function (r) { - for (var k in r) { - if (!codomain.is(r[k])) { - return false; - } - } - return true; - })); -}; -/** - * @category combinators - * @since 2.2.0 - */ -export var tuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return ({ - is: function (u) { return Array.isArray(u) && u.length === components.length && components.every(function (c, i) { return c.is(u[i]); }); } - }); -}; -/** - * @category combinators - * @since 2.2.0 - */ -export var intersect = function (right) { - return function (left) { return ({ - is: function (u) { return left.is(u) && right.is(u); } - }); }; -}; -/** - * @category combinators - * @since 2.2.0 - */ -export var union = function () { - var members = []; - for (var _i = 0; _i < arguments.length; _i++) { - members[_i] = arguments[_i]; - } - return ({ - is: function (u) { return members.some(function (m) { return m.is(u); }); } - }); -}; -/** - * @category combinators - * @since 2.2.0 - */ -export var sum = function (tag) { - return function (members) { - return pipe(UnknownRecord, refine(function (r) { - var v = r[tag]; - if (v in members) { - return members[v].is(r); - } - return false; - })); - }; -}; -/** - * @category combinators - * @since 2.2.0 - */ -export var lazy = function (f) { - var get = S.memoize(f); - return { - is: function (u) { return get().is(u); } - }; -}; -/** - * @category combinators - * @since 2.2.15 - */ -export var readonly = identity; -/** - * @category combinators - * @since 2.2.8 - */ -export var alt = function (that) { - return function (me) { return ({ - is: function (i) { return me.is(i) || that().is(i); } - }); }; -}; -/** - * @category combinators - * @since 2.2.8 - */ -export var zero = function () { return ({ - is: function (_) { return false; } -}); }; -/** - * @category combinators - * @since 2.2.8 - */ -export var compose = function (to) { - return function (from) { return ({ - is: function (i) { return from.is(i) && to.is(i); } - }); }; -}; -/** - * @category combinators - * @since 2.2.8 - */ -export var id = function () { return ({ - is: function (_) { return true; } -}); }; -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.0 - */ -export var URI = 'io-ts/Guard'; -/** - * @category instances - * @since 2.2.8 - */ -export var Schemable = { - URI: URI, - literal: literal, - string: string, - number: number, - boolean: boolean, - nullable: nullable, - type: type, - struct: struct, - partial: partial, - record: record, - array: array, - tuple: tuple, - intersect: intersect, - sum: sum, - lazy: function (_, f) { return lazy(f); }, - readonly: readonly -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithUnknownContainers = { - UnknownArray: UnknownArray, - UnknownRecord: UnknownRecord -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithUnion = { - union: union -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithRefine = { - refine: refine -}; diff --git a/components/pexels/node_modules/io-ts/es6/Kleisli.d.ts b/components/pexels/node_modules/io-ts/es6/Kleisli.d.ts deleted file mode 100644 index 5b9f63b798b3f..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Kleisli.d.ts +++ /dev/null @@ -1,226 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Alt2C } from 'fp-ts/es6/Alt' -import { Applicative2C } from 'fp-ts/es6/Applicative' -import { Apply2C } from 'fp-ts/es6/Apply' -import { Bifunctor2 } from 'fp-ts/es6/Bifunctor' -import { Lazy, Refinement } from 'fp-ts/es6/function' -import { Functor2C } from 'fp-ts/es6/Functor' -import { Kind2, URIS2 } from 'fp-ts/es6/HKT' -import { Monad2C } from 'fp-ts/es6/Monad' -import { MonadThrow2C } from 'fp-ts/es6/MonadThrow' -import * as S from './Schemable' -/** - * @category model - * @since 2.2.7 - */ -export interface Kleisli { - readonly decode: (i: I) => Kind2 -} -/** - * @category constructors - * @since 2.2.7 - */ -export declare function fromRefinement( - M: MonadThrow2C -): (refinement: Refinement, onError: (i: I) => E) => Kleisli -/** - * @category constructors - * @since 2.2.7 - */ -export declare function literal( - M: MonadThrow2C -): ( - onError: (i: I, values: readonly [S.Literal, ...ReadonlyArray]) => E -) => ], L extends S.Literal = S.Literal>( - ...values: A -) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function mapLeftWithInput( - M: Bifunctor2 -): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function refine( - M: MonadThrow2C & Bifunctor2 -): ( - refinement: (a: A) => a is B, - onError: (a: A) => E -) => (from: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function parse( - M: Monad2C -): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function nullable( - M: Applicative2C & Bifunctor2 -): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.15 - */ -export declare function fromStruct( - M: Applicative2C & Bifunctor2 -): (onPropertyError: (key: string, e: E) => E) =>

>>( - properties: P -) => Kleisli< - M, - { - [K in keyof P]: InputOf - }, - E, - { - [K in keyof P]: TypeOf - } -> -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -export declare const fromType: typeof fromStruct -/** - * @category combinators - * @since 2.2.7 - */ -export declare function fromPartial( - M: Applicative2C & Bifunctor2 -): (onPropertyError: (key: string, e: E) => E) =>

>>( - properties: P -) => Kleisli< - M, - Partial<{ - [K in keyof P]: InputOf - }>, - E, - Partial<{ - [K in keyof P]: TypeOf - }> -> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function fromArray( - M: Applicative2C & Bifunctor2 -): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function fromRecord( - M: Applicative2C & Bifunctor2 -): ( - onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli) => Kleisli, E, Record> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function fromTuple( - M: Applicative2C & Bifunctor2 -): (onIndexError: (index: number, e: E) => E) => >>( - ...components: C -) => Kleisli< - M, - { - [K in keyof C]: InputOf - }, - E, - { - [K in keyof C]: TypeOf - } -> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function union( - M: Alt2C & Bifunctor2 -): ( - onMemberError: (index: number, e: E) => E -) => , ...Array>]>( - ...members: MS -) => Kleisli, E, TypeOf> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function intersect( - M: Apply2C -): (right: Kleisli) => (left: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function fromSum( - M: MonadThrow2C -): ( - onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E -) => ( - tag: T -) => >>( - members: MS -) => Kleisli, E, TypeOf> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function lazy( - M: Bifunctor2 -): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function compose( - M: Monad2C -): (ab: Kleisli) => (ia: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.8 - */ -export declare function id(M: Applicative2C): () => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function map( - F: Functor2C -): (f: (a: A) => B) => (ia: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function alt( - A: Alt2C -): (that: Lazy>) => (me: Kleisli) => Kleisli -/** - * @since 2.2.7 - */ -export type TypeOf = KD extends Kleisli ? A : never -/** - * @since 2.2.7 - */ -export type InputOf = KD extends Kleisli ? I : never diff --git a/components/pexels/node_modules/io-ts/es6/Kleisli.js b/components/pexels/node_modules/io-ts/es6/Kleisli.js deleted file mode 100644 index e94ff2a80d10e..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Kleisli.js +++ /dev/null @@ -1,315 +0,0 @@ -import * as E from 'fp-ts/es6/Either'; -import * as G from './Guard'; -import * as S from './Schemable'; -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.7 - */ -export function fromRefinement(M) { - return function (refinement, onError) { return ({ - decode: function (i) { return (refinement(i) ? M.of(i) : M.throwError(onError(i))); } - }); }; -} -/** - * @category constructors - * @since 2.2.7 - */ -export function literal(M) { - return function (onError) { - return function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return ({ - decode: function (i) { return (G.literal.apply(G, values).is(i) ? M.of(i) : M.throwError(onError(i, values))); } - }); - }; - }; -} -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.7 - */ -export function mapLeftWithInput(M) { - return function (f) { return function (decoder) { return ({ - decode: function (i) { return M.mapLeft(decoder.decode(i), function (e) { return f(i, e); }); } - }); }; }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function refine(M) { - return function (refinement, onError) { return function (from) { return compose(M)(fromRefinement(M)(refinement, onError))(from); }; }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function parse(M) { - return function (decode) { return function (from) { return compose(M)({ decode: decode })(from); }; }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function nullable(M) { - return function (onError) { - return function (or) { return ({ - decode: function (i) { - return i === null - ? M.of(null) - : M.bimap(or.decode(i), function (e) { return onError(i, e); }, function (a) { return a; }); - } - }); }; - }; -} -/** - * @category combinators - * @since 2.2.15 - */ -export function fromStruct(M) { - var traverse = traverseRecordWithIndex(M); - return function (onPropertyError) { return function (properties) { return ({ - decode: function (i) { - return traverse(properties, function (key, decoder) { - return M.mapLeft(decoder.decode(i[key]), function (e) { return onPropertyError(key, e); }); - }); - } - }); }; }; -} -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -export var fromType = fromStruct; -/** - * @category combinators - * @since 2.2.7 - */ -export function fromPartial(M) { - var traverse = traverseRecordWithIndex(M); - var undefinedProperty = M.of(E.right(undefined)); - var skipProperty = M.of(E.left(undefined)); - return function (onPropertyError) { return function (properties) { return ({ - decode: function (i) { - return M.map(traverse(properties, function (key, decoder) { - var ikey = i[key]; - if (ikey === undefined) { - return key in i - ? // don't strip undefined properties - undefinedProperty - : // don't add missing properties - skipProperty; - } - return M.bimap(decoder.decode(ikey), function (e) { return onPropertyError(key, e); }, function (a) { return E.right(a); }); - }), compactRecord); - } - }); }; }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function fromArray(M) { - var traverse = traverseArrayWithIndex(M); - return function (onItemError) { return function (item) { return ({ - decode: function (is) { return traverse(is, function (index, i) { return M.mapLeft(item.decode(i), function (e) { return onItemError(index, e); }); }); } - }); }; }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function fromRecord(M) { - var traverse = traverseRecordWithIndex(M); - return function (onKeyError) { return function (codomain) { return ({ - decode: function (ir) { return traverse(ir, function (key, i) { return M.mapLeft(codomain.decode(i), function (e) { return onKeyError(key, e); }); }); } - }); }; }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function fromTuple(M) { - var traverse = traverseArrayWithIndex(M); - return function (onIndexError) { - return function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return ({ - decode: function (is) { - return traverse(components, function (index, decoder) { - return M.mapLeft(decoder.decode(is[index]), function (e) { return onIndexError(index, e); }); - }); - } - }); - }; - }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function union(M) { - return function (onMemberError) { - return function () { - var members = []; - for (var _i = 0; _i < arguments.length; _i++) { - members[_i] = arguments[_i]; - } - return ({ - decode: function (i) { - var out = M.mapLeft(members[0].decode(i), function (e) { return onMemberError(0, e); }); - var _loop_1 = function (index) { - out = M.alt(out, function () { return M.mapLeft(members[index].decode(i), function (e) { return onMemberError(index, e); }); }); - }; - for (var index = 1; index < members.length; index++) { - _loop_1(index); - } - return out; - } - }); - }; - }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function intersect(M) { - return function (right) { - return function (left) { return ({ - decode: function (i) { - return M.ap(M.map(left.decode(i), function (a) { return function (b) { return S.intersect_(a, b); }; }), right.decode(i)); - } - }); }; - }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function fromSum(M) { - return function (onTagError) { - return function (tag) { - return function (members) { - var keys = Object.keys(members); - return { - decode: function (ir) { - var v = ir[tag]; - if (Object.prototype.hasOwnProperty.call(members, v)) { - return members[v].decode(ir); - } - return M.throwError(onTagError(tag, v, keys)); - } - }; - }; - }; - }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function lazy(M) { - return function (onError) { - return function (id, f) { - var get = S.memoize(f); - return { - decode: function (u) { return M.mapLeft(get().decode(u), function (e) { return onError(id, e); }); } - }; - }; - }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function compose(M) { - return function (ab) { return function (ia) { return ({ - decode: function (i) { return M.chain(ia.decode(i), ab.decode); } - }); }; }; -} -/** - * @category combinators - * @since 2.2.8 - */ -export function id(M) { - return function () { return ({ - decode: M.of - }); }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function map(F) { - return function (f) { return function (ia) { return ({ - decode: function (i) { return F.map(ia.decode(i), f); } - }); }; }; -} -/** - * @category combinators - * @since 2.2.7 - */ -export function alt(A) { - return function (that) { return function (me) { return ({ - decode: function (i) { return A.alt(me.decode(i), function () { return that().decode(i); }); } - }); }; }; -} -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- -var traverseArrayWithIndex = function (M) { - return function (as, f) { - return as.reduce(function (mbs, a, i) { - return M.ap(M.map(mbs, function (bs) { return function (b) { - bs.push(b); - return bs; - }; }), f(i, a)); - }, M.of([])); - }; -}; -var traverseRecordWithIndex = function (M) { - return function (r, f) { - var ks = Object.keys(r); - if (ks.length === 0) { - return M.of({}); - } - var fr = M.of({}); - var _loop_2 = function (key) { - fr = M.ap(M.map(fr, function (r) { return function (b) { - r[key] = b; - return r; - }; }), f(key, r[key])); - }; - for (var _i = 0, ks_1 = ks; _i < ks_1.length; _i++) { - var key = ks_1[_i]; - _loop_2(key); - } - return fr; - }; -}; -var compactRecord = function (r) { - var out = {}; - for (var k in r) { - var rk = r[k]; - if (E.isRight(rk)) { - out[k] = rk.right; - } - } - return out; -}; diff --git a/components/pexels/node_modules/io-ts/es6/PathReporter.d.ts b/components/pexels/node_modules/io-ts/es6/PathReporter.d.ts deleted file mode 100644 index 6050a03572bfd..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/PathReporter.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ValidationError } from '.' -import { Reporter } from './Reporter' -/** - * @since 1.0.0 - */ -export declare function failure(es: Array): Array -/** - * @since 1.0.0 - */ -export declare function success(): Array -/** - * @since 1.0.0 - */ -export declare const PathReporter: Reporter> diff --git a/components/pexels/node_modules/io-ts/es6/PathReporter.js b/components/pexels/node_modules/io-ts/es6/PathReporter.js deleted file mode 100644 index b9a7bfd12486f..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/PathReporter.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @since 1.0.0 - */ -import { fold } from 'fp-ts/es6/Either'; -import { getFunctionName } from '.'; -function stringify(v) { - if (typeof v === 'function') { - return getFunctionName(v); - } - if (typeof v === 'number' && !isFinite(v)) { - if (isNaN(v)) { - return 'NaN'; - } - return v > 0 ? 'Infinity' : '-Infinity'; - } - return JSON.stringify(v); -} -function getContextPath(context) { - return context.map(function (_a) { - var key = _a.key, type = _a.type; - return "".concat(key, ": ").concat(type.name); - }).join('/'); -} -function getMessage(e) { - return e.message !== undefined - ? e.message - : "Invalid value ".concat(stringify(e.value), " supplied to ").concat(getContextPath(e.context)); -} -/** - * @since 1.0.0 - */ -export function failure(es) { - return es.map(getMessage); -} -/** - * @since 1.0.0 - */ -export function success() { - return ['No errors!']; -} -/** - * @since 1.0.0 - */ -export var PathReporter = { - report: fold(failure, success) -}; diff --git a/components/pexels/node_modules/io-ts/es6/Reporter.d.ts b/components/pexels/node_modules/io-ts/es6/Reporter.d.ts deleted file mode 100644 index fee031a823925..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Reporter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @since 1.0.0 - */ -import { Validation } from './index' -/** - * @since 1.0.0 - */ -export interface Reporter { - report: (validation: Validation) => A -} diff --git a/components/pexels/node_modules/io-ts/es6/Reporter.js b/components/pexels/node_modules/io-ts/es6/Reporter.js deleted file mode 100644 index cb0ff5c3b541f..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Reporter.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/components/pexels/node_modules/io-ts/es6/Schema.d.ts b/components/pexels/node_modules/io-ts/es6/Schema.d.ts deleted file mode 100644 index 17ff0c1f8bc93..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Schema.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.0 - */ -import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/es6/HKT' -import { Schemable, Schemable1, Schemable2C } from './Schemable' -/** - * @category model - * @since 2.2.0 - */ -export interface Schema { - (S: Schemable): HKT -} -/** - * @category constructors - * @since 2.2.0 - */ -export declare function make(schema: Schema): Schema -/** - * @since 2.2.0 - */ -export type TypeOf = S extends Schema ? A : never -/** - * @since 2.2.3 - */ -export declare function interpreter( - S: Schemable2C -): (schema: Schema) => Kind2 -export declare function interpreter(S: Schemable1): (schema: Schema) => Kind diff --git a/components/pexels/node_modules/io-ts/es6/Schema.js b/components/pexels/node_modules/io-ts/es6/Schema.js deleted file mode 100644 index 2e8593e161ef1..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Schema.js +++ /dev/null @@ -1,14 +0,0 @@ -import { memoize } from './Schemable'; -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.0 - */ -export function make(schema) { - return memoize(schema); -} -export function interpreter(S) { - return function (schema) { return schema(S); }; -} diff --git a/components/pexels/node_modules/io-ts/es6/Schemable.d.ts b/components/pexels/node_modules/io-ts/es6/Schemable.d.ts deleted file mode 100644 index 63e36b2d7281f..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Schemable.d.ts +++ /dev/null @@ -1,254 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.0 - */ -import { Refinement } from 'fp-ts/es6/function' -import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/es6/HKT' -/** - * @since 2.2.0 - */ -export type Literal = string | number | boolean | null -/** - * @since 2.2.3 - */ -export interface Schemable { - readonly URI: S - readonly literal: ], L extends Literal = Literal>( - ...values: A - ) => HKT - readonly string: HKT - readonly number: HKT - readonly boolean: HKT - readonly nullable: (or: HKT) => HKT - /** @deprecated */ - readonly type: (properties: { - [K in keyof A]: HKT - }) => HKT< - S, - { - [K in keyof A]: A[K] - } - > - readonly struct: (properties: { - [K in keyof A]: HKT - }) => HKT< - S, - { - [K in keyof A]: A[K] - } - > - readonly partial: (properties: { - [K in keyof A]: HKT - }) => HKT< - S, - Partial<{ - [K in keyof A]: A[K] - }> - > - readonly record: (codomain: HKT) => HKT> - readonly array: (item: HKT) => HKT> - readonly tuple: >( - ...components: { - [K in keyof A]: HKT - } - ) => HKT - readonly intersect: (right: HKT) => (left: HKT) => HKT - readonly sum: ( - tag: T - ) => (members: { - [K in keyof A]: HKT> - }) => HKT - readonly lazy: (id: string, f: () => HKT) => HKT - readonly readonly: (sa: HKT) => HKT> -} -/** - * @since 2.2.3 - */ -export interface Schemable1 { - readonly URI: S - readonly literal: ], L extends Literal = Literal>( - ...values: A - ) => Kind - readonly string: Kind - readonly number: Kind - readonly boolean: Kind - readonly nullable: (or: Kind) => Kind - /** @deprecated */ - readonly type: (properties: { - [K in keyof A]: Kind - }) => Kind< - S, - { - [K in keyof A]: A[K] - } - > - readonly struct: (properties: { - [K in keyof A]: Kind - }) => Kind< - S, - { - [K in keyof A]: A[K] - } - > - readonly partial: (properties: { - [K in keyof A]: Kind - }) => Kind< - S, - Partial<{ - [K in keyof A]: A[K] - }> - > - readonly record: (codomain: Kind) => Kind> - readonly array: (item: Kind) => Kind> - readonly tuple: >( - ...components: { - [K in keyof A]: Kind - } - ) => Kind - readonly intersect: (right: Kind) => (left: Kind) => Kind - readonly sum: ( - tag: T - ) => (members: { - [K in keyof A]: Kind> - }) => Kind - readonly lazy: (id: string, f: () => Kind) => Kind - readonly readonly: (sa: Kind) => Kind> -} -/** - * @since 2.2.8 - */ -export interface Schemable2C { - readonly URI: S - readonly literal: ], L extends Literal = Literal>( - ...values: A - ) => Kind2 - readonly string: Kind2 - readonly number: Kind2 - readonly boolean: Kind2 - readonly nullable: (or: Kind2) => Kind2 - /** @deprecated */ - readonly type: (properties: { - [K in keyof A]: Kind2 - }) => Kind2< - S, - E, - { - [K in keyof A]: A[K] - } - > - readonly struct: (properties: { - [K in keyof A]: Kind2 - }) => Kind2< - S, - E, - { - [K in keyof A]: A[K] - } - > - readonly partial: (properties: { - [K in keyof A]: Kind2 - }) => Kind2< - S, - E, - Partial<{ - [K in keyof A]: A[K] - }> - > - readonly record: (codomain: Kind2) => Kind2> - readonly array: (item: Kind2) => Kind2> - readonly tuple: >( - ...components: { - [K in keyof A]: Kind2 - } - ) => Kind2 - readonly intersect: (right: Kind2) => (left: Kind2) => Kind2 - readonly sum: ( - tag: T - ) => (members: { - [K in keyof A]: Kind2> - }) => Kind2 - readonly lazy: (id: string, f: () => Kind2) => Kind2 - readonly readonly: (sa: Kind2) => Kind2> -} -/** - * @since 2.2.3 - */ -export interface WithUnknownContainers { - readonly UnknownArray: HKT> - readonly UnknownRecord: HKT> -} -/** - * @since 2.2.3 - */ -export interface WithUnknownContainers1 { - readonly UnknownArray: Kind> - readonly UnknownRecord: Kind> -} -/** - * @since 2.2.8 - */ -export interface WithUnknownContainers2C { - readonly UnknownArray: Kind2> - readonly UnknownRecord: Kind2> -} -/** - * @since 2.2.3 - */ -export interface WithUnion { - readonly union: ]>( - ...members: { - [K in keyof A]: HKT - } - ) => HKT -} -/** - * @since 2.2.3 - */ -export interface WithUnion1 { - readonly union: ]>( - ...members: { - [K in keyof A]: Kind - } - ) => Kind -} -/** - * @since 2.2.8 - */ -export interface WithUnion2C { - readonly union: ]>( - ...members: { - [K in keyof A]: Kind2 - } - ) => Kind2 -} -/** - * @since 2.2.3 - */ -export interface WithRefine { - readonly refine: (refinement: Refinement, id: string) => (from: HKT) => HKT -} -/** - * @since 2.2.3 - */ -export interface WithRefine1 { - readonly refine: (refinement: Refinement, id: string) => (from: Kind) => Kind -} -/** - * @since 2.2.8 - */ -export interface WithRefine2C { - readonly refine: ( - refinement: Refinement, - id: string - ) => (from: Kind2) => Kind2 -} -/** - * @since 2.2.0 - */ -export declare function memoize(f: (a: A) => B): (a: A) => B diff --git a/components/pexels/node_modules/io-ts/es6/Schemable.js b/components/pexels/node_modules/io-ts/es6/Schemable.js deleted file mode 100644 index 718cd79e90617..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Schemable.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @since 2.2.0 - */ -export function memoize(f) { - var cache = new Map(); - return function (a) { - if (!cache.has(a)) { - var b = f(a); - cache.set(a, b); - return b; - } - return cache.get(a); - }; -} -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- -var typeOf = function (x) { return (x === null ? 'null' : typeof x); }; -/** - * @internal - */ -export var intersect_ = function (a, b) { - if (a !== undefined && b !== undefined) { - var tx = typeOf(a); - var ty = typeOf(b); - if (tx === 'object' || ty === 'object') { - return Object.assign({}, a, b); - } - } - return b; -}; diff --git a/components/pexels/node_modules/io-ts/es6/TaskDecoder.d.ts b/components/pexels/node_modules/io-ts/es6/TaskDecoder.d.ts deleted file mode 100644 index a280dd4ede9b9..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/TaskDecoder.d.ts +++ /dev/null @@ -1,349 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Alt2 } from 'fp-ts/es6/Alt' -import { Category2 } from 'fp-ts/es6/Category' -import { Refinement } from 'fp-ts/es6/function' -import { Functor2 } from 'fp-ts/es6/Functor' -import * as TE from 'fp-ts/es6/TaskEither' -import * as D from './Decoder' -import * as G from './Guard' -import * as K from './Kleisli' -import * as S from './Schemable' -/** - * @category model - * @since 2.2.8 - */ -export interface TaskDecoder extends K.Kleisli {} -/** - * @category DecodeError - * @since 2.2.7 - */ -export type DecodeError = D.DecodeError -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const error: (actual: unknown, message: string) => DecodeError -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const success: (a: A) => TE.TaskEither -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const failure: (actual: unknown, message: string) => TE.TaskEither -/** - * @category constructors - * @since 2.2.7 - */ -export declare const fromDecoder: (decoder: D.Decoder) => TaskDecoder -/** - * @category constructors - * @since 2.2.8 - */ -export declare const fromRefinement: ( - refinement: Refinement, - expected: string -) => TaskDecoder -/** - * @category constructors - * @since 2.2.7 - */ -export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder -/** - * @category constructors - * @since 2.2.7 - */ -export declare const literal: ], L extends S.Literal = S.Literal>( - ...values: A -) => TaskDecoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const string: TaskDecoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const number: TaskDecoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const boolean: TaskDecoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const UnknownArray: TaskDecoder> -/** - * @category primitives - * @since 2.2.7 - */ -export declare const UnknownRecord: TaskDecoder> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const mapLeftWithInput: ( - f: (input: I, e: DecodeError) => DecodeError -) => (decoder: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.9 - */ -export declare const withMessage: ( - message: (input: I, e: DecodeError) => string -) => (decoder: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const refine: ( - refinement: Refinement, - id: string -) => (from: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const parse: ( - parser: (a: A) => TE.TaskEither -) => (from: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const nullable: (or: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.15 - */ -export declare const fromStruct:

>>( - properties: P -) => TaskDecoder< - { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, - { [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> } -> -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -export declare const fromType:

>>( - properties: P -) => TaskDecoder< - { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, - { [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> } -> -/** - * @category combinators - * @since 2.2.15 - */ -export declare const struct: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -export declare const type: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromPartial:

>>( - properties: P -) => TaskDecoder< - Partial<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }>, - Partial<{ [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> }> -> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const partial: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< - unknown, - Partial<{ [K_1 in keyof A]: A[K_1] }> -> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromArray: (item: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const array: (item: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromRecord: ( - codomain: TaskDecoder -) => TaskDecoder, Record> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const record: (codomain: TaskDecoder) => TaskDecoder> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromTuple: []>( - ...components: C -) => TaskDecoder< - { [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, - { [K_1 in keyof C]: K.TypeOf<'TaskEither', C[K_1]> } -> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const tuple: ( - ...components: { [K in keyof A]: TaskDecoder } -) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const union: , ...Array>]>( - ...members: MS -) => TaskDecoder, TypeOf> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const intersect: ( - right: TaskDecoder -) => (left: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromSum: ( - tag: T -) => >>( - members: MS -) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: TaskDecoder> }) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.15 - */ -export declare const readonly: (decoder: TaskDecoder) => TaskDecoder> -/** - * @category Functor - * @since 2.2.7 - */ -export declare const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder -/** - * @category Alt - * @since 2.2.7 - */ -export declare const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder -/** - * @category Semigroupoid - * @since 2.2.8 - */ -export declare const compose: (to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder -/** - * @category Category - * @since 2.2.8 - */ -export declare const id: () => TaskDecoder -/** - * @category instances - * @since 2.2.7 - */ -export declare const URI = 'io-ts/TaskDecoder' -/** - * @category instances - * @since 2.2.7 - */ -export type URI = typeof URI -declare module 'fp-ts/es6/HKT' { - interface URItoKind2 { - readonly [URI]: TaskDecoder - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Functor: Functor2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Alt: Alt2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Category: Category2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Schemable: S.Schemable2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnknownContainers: S.WithUnknownContainers2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnion: S.WithUnion2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithRefine: S.WithRefine2C -/** - * @since 2.2.7 - */ -export type TypeOf = K.TypeOf -/** - * @since 2.2.8 - */ -export type InputOf = K.InputOf -/** - * @since 2.2.7 - */ -export declare const draw: (e: DecodeError) => string diff --git a/components/pexels/node_modules/io-ts/es6/TaskDecoder.js b/components/pexels/node_modules/io-ts/es6/TaskDecoder.js deleted file mode 100644 index c77508649bd7a..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/TaskDecoder.js +++ /dev/null @@ -1,413 +0,0 @@ -import * as E from 'fp-ts/es6/Either'; -import { identity } from 'fp-ts/es6/function'; -import { pipe } from 'fp-ts/es6/pipeable'; -import * as T from 'fp-ts/es6/Task'; -import * as TE from 'fp-ts/es6/TaskEither'; -import * as DE from './DecodeError'; -import * as D from './Decoder'; -import * as FS from './FreeSemigroup'; -import * as K from './Kleisli'; -// ------------------------------------------------------------------------------------- -// Kleisli config -// ------------------------------------------------------------------------------------- -var M = { - URI: TE.URI, - _E: undefined, - map: function (fa, f) { return pipe(fa, TE.map(f)); }, - ap: function (fab, fa) { - return pipe(pipe(fab, T.map(function (h) { return function (ga) { return D.ap(h, ga); }; })), T.ap(fa)); - }, - of: TE.right, - chain: function (ma, f) { return pipe(ma, TE.chain(f)); }, - throwError: TE.left, - bimap: function (fa, f, g) { return pipe(fa, TE.bimap(f, g)); }, - mapLeft: function (fa, f) { return pipe(fa, TE.mapLeft(f)); }, - alt: function (me, that) { - return pipe(me, T.chain(function (e1) { - return E.isRight(e1) - ? T.of(e1) - : pipe(that(), T.map(function (e2) { return (E.isLeft(e2) ? E.left(D.SE.concat(e1.left, e2.left)) : e2); })); - })); - } -}; -/** - * @category DecodeError - * @since 2.2.7 - */ -export var error = D.error; -/** - * @category DecodeError - * @since 2.2.7 - */ -export var success = TE.right; -/** - * @category DecodeError - * @since 2.2.7 - */ -export var failure = function (actual, message) { - return TE.left(D.error(actual, message)); -}; -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.7 - */ -export var fromDecoder = function (decoder) { return ({ - decode: TE.fromEitherK(decoder.decode) -}); }; -/** - * @category constructors - * @since 2.2.8 - */ -export var fromRefinement = function (refinement, expected) { - return fromDecoder(D.fromRefinement(refinement, expected)); -}; -/** - * @category constructors - * @since 2.2.7 - */ -export var fromGuard = function (guard, expected) { - return fromRefinement(guard.is, expected); -}; -/** - * @category constructors - * @since 2.2.7 - */ -export var literal = -/*#__PURE__*/ -K.literal(M)(function (u, values) { return error(u, values.map(function (value) { return JSON.stringify(value); }).join(' | ')); }); -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.7 - */ -export var string = -/*#__PURE__*/ -fromDecoder(D.string); -/** - * @category primitives - * @since 2.2.7 - */ -export var number = -/*#__PURE__*/ -fromDecoder(D.number); -/** - * @category primitives - * @since 2.2.7 - */ -export var boolean = -/*#__PURE__*/ -fromDecoder(D.boolean); -/** - * @category primitives - * @since 2.2.7 - */ -export var UnknownArray = -/*#__PURE__*/ -fromDecoder(D.UnknownArray); -/** - * @category primitives - * @since 2.2.7 - */ -export var UnknownRecord = -/*#__PURE__*/ -fromDecoder(D.UnknownRecord); -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.7 - */ -export var mapLeftWithInput = -/*#__PURE__*/ -K.mapLeftWithInput(M); -/** - * @category combinators - * @since 2.2.9 - */ -export var withMessage = function (message) { - return mapLeftWithInput(function (input, e) { return FS.of(DE.wrap(message(input, e), e)); }); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var refine = function (refinement, id) { return K.refine(M)(refinement, function (a) { return error(a, id); }); }; -/** - * @category combinators - * @since 2.2.7 - */ -export var parse = -/*#__PURE__*/ -K.parse(M); -/** - * @category combinators - * @since 2.2.7 - */ -export var nullable = -/*#__PURE__*/ -K.nullable(M)(function (u, e) { return FS.concat(FS.of(DE.member(0, error(u, 'null'))), FS.of(DE.member(1, e))); }); -/** - * @category combinators - * @since 2.2.15 - */ -export var fromStruct = function (properties) { - return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); -}; -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -export var fromType = fromStruct; -/** - * @category combinators - * @since 2.2.15 - */ -export var struct = function (properties) { return pipe(UnknownRecord, compose(fromStruct(properties))); }; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -export var type = struct; -/** - * @category combinators - * @since 2.2.8 - */ -export var fromPartial = function (properties) { - return K.fromPartial(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(properties); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var partial = function (properties) { return pipe(UnknownRecord, compose(fromPartial(properties))); }; -/** - * @category combinators - * @since 2.2.8 - */ -export var fromArray = function (item) { - return K.fromArray(M)(function (i, e) { return FS.of(DE.index(i, DE.optional, e)); })(item); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var array = function (item) { - return pipe(UnknownArray, compose(fromArray(item))); -}; -/** - * @category combinators - * @since 2.2.8 - */ -export var fromRecord = function (codomain) { - return K.fromRecord(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(codomain); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var record = function (codomain) { - return pipe(UnknownRecord, compose(fromRecord(codomain))); -}; -/** - * @category combinators - * @since 2.2.8 - */ -export var fromTuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return K.fromTuple(M)(function (i, e) { return FS.of(DE.index(i, DE.required, e)); }).apply(void 0, components); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var tuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return pipe(UnknownArray, compose(fromTuple.apply(void 0, components))); -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var union = -/*#__PURE__*/ -K.union(M)(function (i, e) { return FS.of(DE.member(i, e)); }); -/** - * @category combinators - * @since 2.2.7 - */ -export var intersect = -/*#__PURE__*/ -K.intersect(M); -/** - * @category combinators - * @since 2.2.8 - */ -export var fromSum = function (tag) { - return function (members) { - return K.fromSum(M)(function (tag, value, keys) { - return FS.of(DE.key(tag, DE.required, error(value, keys.length === 0 ? 'never' : keys.map(function (k) { return JSON.stringify(k); }).join(' | ')))); - })(tag)(members); - }; -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var sum = function (tag) { - return function (members) { - return pipe(UnknownRecord, compose(fromSum(tag)(members))); - }; -}; -/** - * @category combinators - * @since 2.2.7 - */ -export var lazy = -/*#__PURE__*/ -K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); -/** - * @category combinators - * @since 2.2.15 - */ -export var readonly = identity; -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- -var map_ = function (fa, f) { return pipe(fa, map(f)); }; -var alt_ = function (me, that) { return pipe(me, alt(that)); }; -var compose_ = function (ab, la) { return pipe(la, compose(ab)); }; -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- -/** - * @category Functor - * @since 2.2.7 - */ -export var map = -/*#__PURE__*/ -K.map(M); -/** - * @category Alt - * @since 2.2.7 - */ -export var alt = -/*#__PURE__*/ -K.alt(M); -/** - * @category Semigroupoid - * @since 2.2.8 - */ -export var compose = -/*#__PURE__*/ -K.compose(M); -/** - * @category Category - * @since 2.2.8 - */ -export var id = -/*#__PURE__*/ -K.id(M); -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.7 - */ -export var URI = 'io-ts/TaskDecoder'; -/** - * @category instances - * @since 2.2.8 - */ -export var Functor = { - URI: URI, - map: map_ -}; -/** - * @category instances - * @since 2.2.8 - */ -export var Alt = { - URI: URI, - map: map_, - alt: alt_ -}; -/** - * @category instances - * @since 2.2.8 - */ -export var Category = { - URI: URI, - compose: compose_, - id: id -}; -/** - * @category instances - * @since 2.2.8 - */ -export var Schemable = { - URI: URI, - literal: literal, - string: string, - number: number, - boolean: boolean, - nullable: nullable, - type: type, - struct: struct, - partial: partial, - record: record, - array: array, - tuple: tuple, - intersect: intersect, - sum: sum, - lazy: lazy, - readonly: readonly -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithUnknownContainers = { - UnknownArray: UnknownArray, - UnknownRecord: UnknownRecord -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithUnion = { - union: union -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithRefine = { - refine: refine -}; -/** - * @since 2.2.7 - */ -export var draw = D.draw; -/** - * @internal - */ -export var stringify = TE.fold(function (e) { return T.of(draw(e)); }, function (a) { return T.of(JSON.stringify(a, null, 2)); }); diff --git a/components/pexels/node_modules/io-ts/es6/ThrowReporter.d.ts b/components/pexels/node_modules/io-ts/es6/ThrowReporter.d.ts deleted file mode 100644 index d759e80da0b13..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/ThrowReporter.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Reporter } from './Reporter' -/** - * @category deprecated - * @since 1.0.0 - * @deprecated - */ -export declare const ThrowReporter: Reporter diff --git a/components/pexels/node_modules/io-ts/es6/ThrowReporter.js b/components/pexels/node_modules/io-ts/es6/ThrowReporter.js deleted file mode 100644 index 8d276a948e0c8..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/ThrowReporter.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @deprecated - * @since 1.0.0 - */ -import { isLeft } from 'fp-ts/es6/Either'; -import { PathReporter } from './PathReporter'; -/** - * @category deprecated - * @since 1.0.0 - * @deprecated - */ -export var ThrowReporter = { - report: function (validation) { - if (isLeft(validation)) { - throw new Error(PathReporter.report(validation).join('\n')); - } - } -}; diff --git a/components/pexels/node_modules/io-ts/es6/Type.d.ts b/components/pexels/node_modules/io-ts/es6/Type.d.ts deleted file mode 100644 index 83c548bfccded..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Type.d.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { Refinement } from 'fp-ts/es6/function' -import * as t from './index' -import * as S from './Schemable' -/** - * @category model - * @since 2.2.3 - */ -export interface Type extends t.Type {} -/** - * @category constructors - * @since 2.2.3 - */ -export declare const literal: ( - ...values: A -) => Type -/** - * @category primitives - * @since 2.2.3 - */ -export declare const string: Type -/** - * @category primitives - * @since 2.2.3 - */ -export declare const number: Type -/** - * @category primitives - * @since 2.2.3 - */ -export declare const boolean: Type -/** - * @category primitives - * @since 2.2.3 - */ -export declare const UnknownArray: Type> -/** - * @category primitives - * @since 2.2.3 - */ -export declare const UnknownRecord: Type> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const refine: (refinement: Refinement, id: string) => (from: Type) => Type -/** - * @category combinators - * @since 2.2.3 - */ -export declare const nullable: (or: Type) => Type -/** - * @category combinators - * @since 2.2.15 - */ -export declare const struct: (properties: { [K in keyof A]: Type }) => Type<{ [K_1 in keyof A]: A[K_1] }> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -export declare const type: (properties: { [K in keyof A]: Type }) => Type<{ [K_1 in keyof A]: A[K_1] }> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const partial: (properties: { [K in keyof A]: Type }) => Type< - Partial<{ [K_1 in keyof A]: A[K_1] }> -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const record: (codomain: Type) => Type> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const array: (item: Type) => Type -/** - * @category combinators - * @since 2.2.3 - */ -export declare const tuple: (...components: { [K in keyof A]: Type }) => Type -/** - * @category combinators - * @since 2.2.3 - */ -export declare const intersect: (right: Type) => (left: Type) => Type -/** - * @category combinators - * @since 2.2.3 - */ -export declare const lazy: (id: string, f: () => Type) => Type -/** - * @category combinators - * @since 2.2.15 - */ -export declare const readonly: (type: Type) => Type> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const sum: ( - _tag: T -) => (members: { [K in keyof A]: Type> }) => Type -/** - * @category combinators - * @since 2.2.3 - */ -export declare const union: ( - ...members: { [K in keyof A]: Type } -) => Type -/** - * @category instances - * @since 2.2.3 - */ -export declare const URI = 'io-ts/Type' -/** - * @category instances - * @since 2.2.3 - */ -export type URI = typeof URI -declare module 'fp-ts/es6/HKT' { - interface URItoKind { - readonly [URI]: Type - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Schemable: S.Schemable1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnknownContainers: S.WithUnknownContainers1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnion: S.WithUnion1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithRefine: S.WithRefine1 diff --git a/components/pexels/node_modules/io-ts/es6/Type.js b/components/pexels/node_modules/io-ts/es6/Type.js deleted file mode 100644 index 24e72a3df7224..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/Type.js +++ /dev/null @@ -1,210 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.3 - */ -import * as E from 'fp-ts/es6/Either'; -import { identity } from 'fp-ts/es6/function'; -import { pipe } from 'fp-ts/es6/pipeable'; -import * as t from './index'; -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.3 - */ -export var literal = function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return t.union(values.map(function (v) { return t.literal(v); })); -}; -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.3 - */ -export var string = t.string; -/** - * @category primitives - * @since 2.2.3 - */ -export var number = new t.Type(t.number.name, t.number.is, function (u, c) { - return pipe(t.number.decode(u), E.chain(function (n) { return (isNaN(n) ? t.failure(u, c) : t.success(n)); })); -}, t.number.encode); -/** - * @category primitives - * @since 2.2.3 - */ -export var boolean = t.boolean; -/** - * @category primitives - * @since 2.2.3 - */ -export var UnknownArray = t.UnknownArray; -/** - * @category primitives - * @since 2.2.3 - */ -export var UnknownRecord = t.UnknownRecord; -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.3 - */ -export var refine = function (refinement, id) { - return function (from) { - // tslint:disable-next-line: deprecation - return (t.refinement(from, refinement, id)); - }; -}; -/** - * @category combinators - * @since 2.2.3 - */ -export var nullable = function (or) { return t.union([t.null, or]); }; -/** - * @category combinators - * @since 2.2.15 - */ -export var struct = function (properties) { - return t.type(properties); -}; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -export var type = struct; -/** - * @category combinators - * @since 2.2.3 - */ -export var partial = function (properties) { - return t.partial(properties); -}; -/** - * @category combinators - * @since 2.2.3 - */ -export var record = function (codomain) { return t.record(t.string, codomain); }; -/** - * @category combinators - * @since 2.2.3 - */ -export var array = function (item) { return t.array(item); }; -/** - * @category combinators - * @since 2.2.3 - */ -export var tuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return t.tuple(components); -}; -/** - * @category combinators - * @since 2.2.3 - */ -export var intersect = function (right) { - return function (left) { - return t.intersection([left, right]); - }; -}; -/** - * @category combinators - * @since 2.2.3 - */ -export var lazy = function (id, f) { return t.recursion(id, f); }; -/** - * @category combinators - * @since 2.2.15 - */ -export var readonly = identity; -/** - * @category combinators - * @since 2.2.3 - */ -export var sum = function (_tag) { - return function (members) { - return t.union(Object.values(members)); - }; -}; -/** - * @category combinators - * @since 2.2.3 - */ -export var union = function () { - var members = []; - for (var _i = 0; _i < arguments.length; _i++) { - members[_i] = arguments[_i]; - } - return t.union(members); -}; -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.3 - */ -export var URI = 'io-ts/Type'; -/** - * @category instances - * @since 2.2.8 - */ -export var Schemable = { - URI: URI, - literal: literal, - string: string, - number: number, - boolean: boolean, - nullable: nullable, - type: type, - struct: struct, - partial: partial, - record: record, - array: array, - tuple: tuple, - intersect: intersect, - sum: sum, - lazy: lazy, - readonly: readonly -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithUnknownContainers = { - UnknownArray: UnknownArray, - UnknownRecord: UnknownRecord -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithUnion = { - union: union -}; -/** - * @category instances - * @since 2.2.8 - */ -export var WithRefine = { - refine: refine -}; diff --git a/components/pexels/node_modules/io-ts/es6/index.d.ts b/components/pexels/node_modules/io-ts/es6/index.d.ts deleted file mode 100644 index bc25e2aad4d11..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/index.d.ts +++ /dev/null @@ -1,1374 +0,0 @@ -/** - * @since 1.0.0 - */ -import { Either } from 'fp-ts/es6/Either' -import { Predicate, Refinement } from 'fp-ts/es6/function' -/** - * @category Decode error - * @since 1.0.0 - */ -export interface ContextEntry { - readonly key: string - readonly type: Decoder - /** the input data */ - readonly actual?: unknown -} -/** - * @category Decode error - * @since 1.0.0 - */ -export interface Context extends ReadonlyArray {} -/** - * @category Decode error - * @since 1.0.0 - */ -export interface ValidationError { - /** the offending (sub)value */ - readonly value: unknown - /** where the error originated */ - readonly context: Context - /** optional custom error message */ - readonly message?: string -} -/** - * @category Decode error - * @since 1.0.0 - */ -export interface Errors extends Array {} -/** - * @category Decode error - * @since 1.0.0 - */ -export type Validation = Either -/** - * @category Decode error - * @since 1.0.0 - */ -export declare const failures: (errors: Errors) => Validation -/** - * @category Decode error - * @since 1.0.0 - */ -export declare const failure: (value: unknown, context: Context, message?: string) => Validation -/** - * @category Decode error - * @since 1.0.0 - */ -export declare const success: (value: T) => Validation -/** - * @since 1.0.0 - */ -export type Is = (u: unknown) => u is A -/** - * @since 1.0.0 - */ -export type Validate = (i: I, context: Context) => Validation -/** - * @since 1.0.0 - */ -export type Decode = (i: I) => Validation -/** - * @since 1.0.0 - */ -export type Encode = (a: A) => O -/** - * @since 1.0.0 - */ -export interface Any extends Type {} -/** - * @since 1.0.0 - */ -export interface Mixed extends Type {} -/** - * @category Codec - * @since 1.0.0 - */ -export type TypeOf = C['_A'] -/** - * @category Codec - * @since 1.0.0 - */ -export type InputOf = C['_I'] -/** - * @category Codec - * @since 1.0.0 - */ -export type OutputOf = C['_O'] -/** - * @category Codec - * @since 1.0.0 - */ -export interface Decoder { - readonly name: string - readonly validate: Validate - readonly decode: Decode -} -/** - * @category Codec - * @since 1.0.0 - */ -export interface Encoder { - readonly encode: Encode -} -/** - * @category Codec - * @since 1.0.0 - */ -export declare class Type implements Decoder, Encoder { - /** a unique name for this codec */ - readonly name: string - /** a custom type guard */ - readonly is: Is - /** succeeds if a value of type I can be decoded to a value of type A */ - readonly validate: Validate - /** converts a value of type A to a value of type O */ - readonly encode: Encode - /** - * @since 1.0.0 - */ - readonly _A: A - /** - * @since 1.0.0 - */ - readonly _O: O - /** - * @since 1.0.0 - */ - readonly _I: I - constructor( - /** a unique name for this codec */ - name: string, - /** a custom type guard */ - is: Is, - /** succeeds if a value of type I can be decoded to a value of type A */ - validate: Validate, - /** converts a value of type A to a value of type O */ - encode: Encode - ) - /** - * @since 1.0.0 - */ - pipe(this: Type, ab: Type, name?: string): Type - /** - * @since 1.0.0 - */ - asDecoder(): Decoder - /** - * @since 1.0.0 - */ - asEncoder(): Encoder - /** - * a version of `validate` with a default context - * @since 1.0.0 - */ - decode(i: I): Validation -} -/** - * @since 1.0.0 - */ -export declare const identity: (a: A) => A -/** - * @since 1.0.0 - */ -export declare function getFunctionName(f: Function): string -/** - * @since 1.0.0 - */ -export declare function getContextEntry(key: string, decoder: Decoder): ContextEntry -/** - * @since 1.0.0 - */ -export declare function appendContext(c: Context, key: string, decoder: Decoder, actual?: unknown): Context -/** - * @since 1.0.0 - */ -export interface AnyProps { - [key: string]: Any -} -/** - * @since 1.0.0 - */ -export type TypeOfProps

= { - [K in keyof P]: TypeOf -} -/** - * @since 1.0.0 - */ -export type OutputOfProps

= { - [K in keyof P]: OutputOf -} -/** - * @since 1.0.0 - */ -export interface Props { - [key: string]: Mixed -} -/** - * @since 1.0.0 - */ -export type TypeOfPartialProps

= { - [K in keyof P]?: TypeOf -} -/** - * @since 1.0.0 - */ -export type OutputOfPartialProps

= { - [K in keyof P]?: OutputOf -} -/** - * @since 1.0.0 - */ -export type TypeOfDictionary = { - [K in TypeOf]: TypeOf -} -/** - * @since 1.0.0 - */ -export type OutputOfDictionary = { - [K in OutputOf]: OutputOf -} -/** - * @since 1.1.0 - */ -export interface HasPropsRefinement extends RefinementType {} -/** - * @since 1.1.0 - */ -export interface HasPropsReadonly extends ReadonlyType {} -/** - * @since 1.1.0 - */ -export interface HasPropsIntersection extends IntersectionType, any, any, any> {} -/** - * @since 1.1.0 - */ -export type HasProps = - | HasPropsRefinement - | HasPropsReadonly - | HasPropsIntersection - | InterfaceType - | StrictType - | PartialType -/** - * @since 1.0.0 - */ -export declare class NullType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'NullType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface NullC extends NullType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const nullType: NullC -/** - * @since 1.0.0 - */ -export declare class UndefinedType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'UndefinedType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface UndefinedC extends UndefinedType {} -declare const undefinedType: UndefinedC -/** - * @since 1.2.0 - */ -export declare class VoidType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'VoidType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface VoidC extends VoidType {} -/** - * @category primitives - * @since 1.2.0 - */ -export declare const voidType: VoidC -/** - * @since 1.5.0 - */ -export declare class UnknownType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'UnknownType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface UnknownC extends UnknownType {} -/** - * @category primitives - * @since 1.5.0 - */ -export declare const unknown: UnknownC -/** - * @since 1.0.0 - */ -export declare class StringType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'StringType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface StringC extends StringType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const string: StringC -/** - * @since 1.0.0 - */ -export declare class NumberType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'NumberType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface NumberC extends NumberType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const number: NumberC -/** - * @since 2.1.0 - */ -export declare class BigIntType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'BigIntType' - constructor() -} -/** - * @since 2.1.0 - */ -export interface BigIntC extends BigIntType {} -/** - * @category primitives - * @since 2.1.0 - */ -export declare const bigint: BigIntC -/** - * @since 1.0.0 - */ -export declare class BooleanType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'BooleanType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface BooleanC extends BooleanType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const boolean: BooleanC -/** - * @since 1.0.0 - */ -export declare class AnyArrayType extends Type> { - /** - * @since 1.0.0 - */ - readonly _tag: 'AnyArrayType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface UnknownArrayC extends AnyArrayType {} -/** - * @category primitives - * @since 1.7.1 - */ -export declare const UnknownArray: UnknownArrayC -/** - * @since 1.0.0 - */ -export declare class AnyDictionaryType extends Type<{ - [key: string]: unknown -}> { - /** - * @since 1.0.0 - */ - readonly _tag: 'AnyDictionaryType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface UnknownRecordC extends AnyDictionaryType {} -/** - * @category primitives - * @since 1.7.1 - */ -export declare const UnknownRecord: UnknownRecordC -export { - /** - * @category primitives - * @since 1.0.0 - */ - nullType as null, - /** - * @category primitives - * @since 1.0.0 - */ - undefinedType as undefined, - /** - * @category primitives - * @since 1.0.0 - */ - voidType as void -} -type LiteralValue = string | number | boolean -/** - * @since 1.0.0 - */ -export declare class LiteralType extends Type { - readonly value: V - /** - * @since 1.0.0 - */ - readonly _tag: 'LiteralType' - constructor( - name: string, - is: LiteralType['is'], - validate: LiteralType['validate'], - encode: LiteralType['encode'], - value: V - ) -} -/** - * @since 1.5.3 - */ -export interface LiteralC extends LiteralType {} -/** - * @category constructors - * @since 1.0.0 - */ -export declare function literal(value: V, name?: string): LiteralC -/** - * @since 1.0.0 - */ -export declare class KeyofType< - D extends { - [key: string]: unknown - } -> extends Type { - readonly keys: D - /** - * @since 1.0.0 - */ - readonly _tag: 'KeyofType' - constructor( - name: string, - is: KeyofType['is'], - validate: KeyofType['validate'], - encode: KeyofType['encode'], - keys: D - ) -} -/** - * @since 1.5.3 - */ -export interface KeyofC< - D extends { - [key: string]: unknown - } -> extends KeyofType {} -/** - * @category constructors - * @since 1.0.0 - */ -export declare function keyof< - D extends { - [key: string]: unknown - } ->(keys: D, name?: string): KeyofC -/** - * @since 1.0.0 - */ -export declare class RefinementType extends Type { - readonly type: C - readonly predicate: Predicate - /** - * @since 1.0.0 - */ - readonly _tag: 'RefinementType' - constructor( - name: string, - is: RefinementType['is'], - validate: RefinementType['validate'], - encode: RefinementType['encode'], - type: C, - predicate: Predicate - ) -} -declare const _brand: unique symbol -/** - * @since 1.8.1 - */ -export interface Brand { - readonly [_brand]: B -} -/** - * @since 1.8.1 - */ -export type Branded = A & Brand -/** - * @since 1.8.1 - */ -export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} -/** - * @category combinators - * @since 1.8.1 - */ -export declare function brand< - C extends Any, - N extends string, - B extends { - readonly [K in N]: symbol - } ->(codec: C, predicate: Refinement, Branded, B>>, name: N): BrandC -/** - * @since 1.8.1 - */ -export interface IntBrand { - readonly Int: unique symbol -} -/** - * A branded codec representing an integer - * - * @category primitives - * @since 1.8.1 - */ -export declare const Int: BrandC -/** - * @since 1.8.1 - */ -export type Int = Branded -/** - * @since 1.0.0 - */ -export declare class RecursiveType extends Type { - runDefinition: () => C - /** - * @since 1.0.0 - */ - readonly _tag: 'RecursiveType' - constructor( - name: string, - is: RecursiveType['is'], - validate: RecursiveType['validate'], - encode: RecursiveType['encode'], - runDefinition: () => C - ) - /** - * @since 1.0.0 - */ - readonly type: C -} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function recursion = Type>( - name: string, - definition: (self: C) => C -): RecursiveType -/** - * @since 1.0.0 - */ -export declare class ArrayType extends Type { - readonly type: C - /** - * @since 1.0.0 - */ - readonly _tag: 'ArrayType' - constructor( - name: string, - is: ArrayType['is'], - validate: ArrayType['validate'], - encode: ArrayType['encode'], - type: C - ) -} -/** - * @since 1.5.3 - */ -export interface ArrayC extends ArrayType>, Array>, unknown> {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function array(item: C, name?: string): ArrayC -/** - * @since 1.0.0 - */ -export declare class InterfaceType extends Type { - readonly props: P - /** - * @since 1.0.0 - */ - readonly _tag: 'InterfaceType' - constructor( - name: string, - is: InterfaceType['is'], - validate: InterfaceType['validate'], - encode: InterfaceType['encode'], - props: P - ) -} -/** - * @since 1.5.3 - */ -export interface TypeC

- extends InterfaceType< - P, - { - [K in keyof P]: TypeOf - }, - { - [K in keyof P]: OutputOf - }, - unknown - > {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function type

(props: P, name?: string): TypeC

-/** - * @since 1.0.0 - */ -export declare class PartialType extends Type { - readonly props: P - /** - * @since 1.0.0 - */ - readonly _tag: 'PartialType' - constructor( - name: string, - is: PartialType['is'], - validate: PartialType['validate'], - encode: PartialType['encode'], - props: P - ) -} -/** - * @since 1.5.3 - */ -export interface PartialC

- extends PartialType< - P, - { - [K in keyof P]?: TypeOf - }, - { - [K in keyof P]?: OutputOf - }, - unknown - > {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function partial

(props: P, name?: string): PartialC

-/** - * @since 1.0.0 - */ -export declare class DictionaryType extends Type { - readonly domain: D - readonly codomain: C - /** - * @since 1.0.0 - */ - readonly _tag: 'DictionaryType' - constructor( - name: string, - is: DictionaryType['is'], - validate: DictionaryType['validate'], - encode: DictionaryType['encode'], - domain: D, - codomain: C - ) -} -/** - * @since 1.5.3 - */ -export interface RecordC - extends DictionaryType< - D, - C, - { - [K in TypeOf]: TypeOf - }, - { - [K in OutputOf]: OutputOf - }, - unknown - > {} -/** - * @category combinators - * @since 1.7.1 - */ -export declare function record(domain: D, codomain: C, name?: string): RecordC -/** - * @since 1.0.0 - */ -export declare class UnionType, A = any, O = A, I = unknown> extends Type { - readonly types: CS - /** - * @since 1.0.0 - */ - readonly _tag: 'UnionType' - constructor( - name: string, - is: UnionType['is'], - validate: UnionType['validate'], - encode: UnionType['encode'], - types: CS - ) -} -/** - * @since 1.5.3 - */ -export interface UnionC]> - extends UnionType, OutputOf, unknown> {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function union]>(codecs: CS, name?: string): UnionC -/** - * @since 1.0.0 - */ -export declare class IntersectionType, A = any, O = A, I = unknown> extends Type { - readonly types: CS - /** - * @since 1.0.0 - */ - readonly _tag: 'IntersectionType' - constructor( - name: string, - is: IntersectionType['is'], - validate: IntersectionType['validate'], - encode: IntersectionType['encode'], - types: CS - ) -} -/** - * @since 1.5.3 - */ -export interface IntersectionC]> - extends IntersectionType< - CS, - CS extends { - length: 2 - } - ? TypeOf & TypeOf - : CS extends { - length: 3 - } - ? TypeOf & TypeOf & TypeOf - : CS extends { - length: 4 - } - ? TypeOf & TypeOf & TypeOf & TypeOf - : CS extends { - length: 5 - } - ? TypeOf & TypeOf & TypeOf & TypeOf & TypeOf - : unknown, - CS extends { - length: 2 - } - ? OutputOf & OutputOf - : CS extends { - length: 3 - } - ? OutputOf & OutputOf & OutputOf - : CS extends { - length: 4 - } - ? OutputOf & OutputOf & OutputOf & OutputOf - : CS extends { - length: 5 - } - ? OutputOf & OutputOf & OutputOf & OutputOf & OutputOf - : unknown, - unknown - > {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function intersection< - A extends Mixed, - B extends Mixed, - C extends Mixed, - D extends Mixed, - E extends Mixed ->(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> -export declare function intersection( - codecs: [A, B, C, D], - name?: string -): IntersectionC<[A, B, C, D]> -export declare function intersection( - codecs: [A, B, C], - name?: string -): IntersectionC<[A, B, C]> -export declare function intersection( - codecs: [A, B], - name?: string -): IntersectionC<[A, B]> -/** - * @since 1.0.0 - */ -export declare class TupleType, A = any, O = A, I = unknown> extends Type { - readonly types: CS - /** - * @since 1.0.0 - */ - readonly _tag: 'TupleType' - constructor( - name: string, - is: TupleType['is'], - validate: TupleType['validate'], - encode: TupleType['encode'], - types: CS - ) -} -/** - * @since 1.5.3 - */ -export interface TupleC]> - extends TupleType< - CS, - CS extends { - length: 1 - } - ? [TypeOf] - : CS extends { - length: 2 - } - ? [TypeOf, TypeOf] - : CS extends { - length: 3 - } - ? [TypeOf, TypeOf, TypeOf] - : CS extends { - length: 4 - } - ? [TypeOf, TypeOf, TypeOf, TypeOf] - : CS extends { - length: 5 - } - ? [TypeOf, TypeOf, TypeOf, TypeOf, TypeOf] - : unknown, - CS extends { - length: 1 - } - ? [OutputOf] - : CS extends { - length: 2 - } - ? [OutputOf, OutputOf] - : CS extends { - length: 3 - } - ? [OutputOf, OutputOf, OutputOf] - : CS extends { - length: 4 - } - ? [OutputOf, OutputOf, OutputOf, OutputOf] - : CS extends { - length: 5 - } - ? [OutputOf, OutputOf, OutputOf, OutputOf, OutputOf] - : unknown, - unknown - > {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function tuple( - codecs: [A, B, C, D, E], - name?: string -): TupleC<[A, B, C, D, E]> -export declare function tuple( - codecs: [A, B, C, D], - name?: string -): TupleC<[A, B, C, D]> -export declare function tuple( - codecs: [A, B, C], - name?: string -): TupleC<[A, B, C]> -export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> -export declare function tuple(codecs: [A], name?: string): TupleC<[A]> -/** - * @since 1.0.0 - */ -export declare class ReadonlyType extends Type { - readonly type: C - /** - * @since 1.0.0 - */ - readonly _tag: 'ReadonlyType' - constructor( - name: string, - is: ReadonlyType['is'], - validate: ReadonlyType['validate'], - encode: ReadonlyType['encode'], - type: C - ) -} -/** - * @since 1.5.3 - */ -export interface ReadonlyC - extends ReadonlyType>, Readonly>, unknown> {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function readonly(codec: C, name?: string): ReadonlyC -/** - * @since 1.0.0 - */ -export declare class ReadonlyArrayType extends Type { - readonly type: C - /** - * @since 1.0.0 - */ - readonly _tag: 'ReadonlyArrayType' - constructor( - name: string, - is: ReadonlyArrayType['is'], - validate: ReadonlyArrayType['validate'], - encode: ReadonlyArrayType['encode'], - type: C - ) -} -/** - * @since 1.5.3 - */ -export interface ReadonlyArrayC - extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function readonlyArray(item: C, name?: string): ReadonlyArrayC -/** - * Strips additional properties, equivalent to `exact(type(props))`. - * - * @category combinators - * @since 1.0.0 - */ -export declare const strict:

(props: P, name?: string) => ExactC> -/** - * @since 1.1.0 - */ -export declare class ExactType extends Type { - readonly type: C - /** - * @since 1.0.0 - */ - readonly _tag: 'ExactType' - constructor( - name: string, - is: ExactType['is'], - validate: ExactType['validate'], - encode: ExactType['encode'], - type: C - ) -} -/** - * @since 1.5.3 - */ -export interface ExactC extends ExactType, OutputOf, InputOf> {} -/** - * Strips additional properties. - * - * @category combinators - * @since 1.1.0 - */ -export declare function exact(codec: C, name?: string): ExactC -/** - * @since 1.0.0 - */ -export declare class FunctionType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'FunctionType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface FunctionC extends FunctionType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const Function: FunctionC -/** - * @since 1.0.0 - */ -export declare class NeverType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'NeverType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface NeverC extends NeverType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const never: NeverC -/** - * @since 1.0.0 - */ -export declare class AnyType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'AnyType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface AnyC extends AnyType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const any: AnyC -/** - * @since 1.5.3 - */ -export interface RefinementC> extends RefinementType, InputOf> {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function refinement>( - codec: C, - refinement: Refinement, B>, - name?: string -): RefinementC -export declare function refinement( - codec: C, - predicate: Predicate>, - name?: string -): RefinementC -/** - * @category primitives - * @since 1.0.0 - */ -export declare const Integer: RefinementC -/** - * @since 1.3.0 - * @deprecated - */ -export declare class TaggedUnionType< - Tag extends string, - CS extends Array, - A = any, - O = A, - I = unknown -> extends UnionType { - readonly tag: Tag - constructor( - name: string, - is: TaggedUnionType['is'], - validate: TaggedUnionType['validate'], - encode: TaggedUnionType['encode'], - codecs: CS, - tag: Tag - ) -} -/** - * @since 1.5.3 - * @deprecated - */ -export interface TaggedUnionC]> // tslint:disable-next-line: deprecation - extends TaggedUnionType, OutputOf, unknown> {} -/** - * Use `union` instead. - * - * @category combinators - * @since 1.3.0 - * @deprecated - */ -export declare const taggedUnion: ( - tag: Tag, - codecs: CS, - name?: string -) => TaggedUnionC -export { - /** - * Use `UnknownArray` instead. - * - * @category primitives - * @deprecated - * @since 1.0.0 - */ - UnknownArray as Array -} -export { - /** - * Use `type` instead. - * - * @category combinators - * @deprecated - * @since 1.0.0 - */ - type as interface -} -/** - * Use `unknown` instead. - * - * @since 1.0.0 - * @deprecated - */ -export type mixed = unknown -/** - * @since 1.0.0 - * @deprecated - */ -export declare const getValidationError: (value: unknown, context: Context) => ValidationError -/** - * @since 1.0.0 - * @deprecated - */ -export declare const getDefaultContext: (decoder: Decoder) => Context -/** - * Use `UnknownRecord` instead. - * - * @category primitives - * @since 1.0.0 - * @deprecated - */ -export declare const Dictionary: UnknownRecordC -/** - * @since 1.0.0 - * @deprecated - */ -export declare class ObjectType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'ObjectType' - constructor() -} -/** - * @since 1.5.3 - * @deprecated - */ -export interface ObjectC extends ObjectType {} -/** - * Use `UnknownRecord` instead. - * - * @category primitives - * @since 1.0.0 - * @deprecated - */ -export declare const object: ObjectC -/** - * Use `record` instead. - * - * @category combinators - * @since 1.0.0 - * @deprecated - */ -export declare const dictionary: typeof record -/** - * @since 1.4.2 - * @deprecated - */ -export type Compact = { - [K in keyof A]: A[K] -} -/** - * @since 1.0.0 - * @deprecated - */ -export declare class StrictType extends Type { - readonly props: P - /** - * @since 1.0.0 - */ - readonly _tag: 'StrictType' - constructor( - name: string, - is: StrictType['is'], - validate: StrictType['validate'], - encode: StrictType['encode'], - props: P - ) -} -/** - * @since 1.5.3 - * @deprecated - */ -export interface StrictC

// tslint:disable-next-line: deprecation - extends StrictType< - P, - { - [K in keyof P]: TypeOf - }, - { - [K in keyof P]: OutputOf - }, - unknown - > {} -/** - * @since 1.3.0 - * @deprecated - */ -export type TaggedProps = { - [K in Tag]: LiteralType -} -/** - * @since 1.3.0 - * @deprecated - */ -export interface TaggedRefinement extends RefinementType, A, O> {} -/** - * @since 1.3.0 - * @deprecated - */ -export interface TaggedUnion extends UnionType>, A, O> {} -/** - * @since 1.3.0 - * @deprecated - */ -export type TaggedIntersectionArgument = - | [Tagged] - | [Tagged, Mixed] - | [Mixed, Tagged] - | [Tagged, Mixed, Mixed] - | [Mixed, Tagged, Mixed] - | [Mixed, Mixed, Tagged] - | [Tagged, Mixed, Mixed, Mixed] - | [Mixed, Tagged, Mixed, Mixed] - | [Mixed, Mixed, Tagged, Mixed] - | [Mixed, Mixed, Mixed, Tagged] - | [Tagged, Mixed, Mixed, Mixed, Mixed] - | [Mixed, Tagged, Mixed, Mixed, Mixed] - | [Mixed, Mixed, Tagged, Mixed, Mixed] - | [Mixed, Mixed, Mixed, Tagged, Mixed] - | [Mixed, Mixed, Mixed, Mixed, Tagged] -/** - * @since 1.3.0 - * @deprecated - */ -export interface TaggedIntersection // tslint:disable-next-line: deprecation - extends IntersectionType, A, O> {} -/** - * @since 1.3.0 - * @deprecated - */ -export interface TaggedExact extends ExactType, A, O> {} -/** - * @since 1.3.0 - * @deprecated - */ -export type Tagged = - | InterfaceType, A, O> - | StrictType, A, O> - | TaggedRefinement - | TaggedUnion - | TaggedIntersection - | TaggedExact - | RecursiveType -/** - * Drops the codec "kind". - * - * @category combinators - * @since 1.1.0 - * @deprecated - */ -export declare function clean(codec: Type): Type -/** - * @since 1.0.0 - * @deprecated - */ -export type PropsOf< - T extends { - props: any - } -> = T['props'] -/** - * @since 1.1.0 - * @deprecated - */ -export type Exact = T & { - [K in ({ - [K in keyof X]: K - } & { - [K in keyof T]: never - } & { - [key: string]: never - })[keyof X]]?: never -} -/** - * Keeps the codec "kind". - * - * @category combinators - * @since 1.1.0 - * @deprecated - */ -export declare function alias( - codec: PartialType -): () => PartialType -export declare function alias( - codec: StrictType -): () => StrictType -export declare function alias( - codec: InterfaceType -): () => InterfaceType diff --git a/components/pexels/node_modules/io-ts/es6/index.js b/components/pexels/node_modules/io-ts/es6/index.js deleted file mode 100644 index a9b3b336acd7f..0000000000000 --- a/components/pexels/node_modules/io-ts/es6/index.js +++ /dev/null @@ -1,1645 +0,0 @@ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; -/** - * @since 1.0.0 - */ -import { isLeft, left, right } from 'fp-ts/es6/Either'; -/** - * @category Decode error - * @since 1.0.0 - */ -export var failures = left; -/** - * @category Decode error - * @since 1.0.0 - */ -export var failure = function (value, context, message) { - return failures([{ value: value, context: context, message: message }]); -}; -/** - * @category Decode error - * @since 1.0.0 - */ -export var success = right; -/** - * @category Codec - * @since 1.0.0 - */ -var Type = /** @class */ (function () { - function Type( - /** a unique name for this codec */ - name, - /** a custom type guard */ - is, - /** succeeds if a value of type I can be decoded to a value of type A */ - validate, - /** converts a value of type A to a value of type O */ - encode) { - this.name = name; - this.is = is; - this.validate = validate; - this.encode = encode; - this.decode = this.decode.bind(this); - } - /** - * @since 1.0.0 - */ - Type.prototype.pipe = function (ab, name) { - var _this = this; - if (name === void 0) { name = "pipe(".concat(this.name, ", ").concat(ab.name, ")"); } - return new Type(name, ab.is, function (i, c) { - var e = _this.validate(i, c); - if (isLeft(e)) { - return e; - } - return ab.validate(e.right, c); - }, this.encode === identity && ab.encode === identity ? identity : function (b) { return _this.encode(ab.encode(b)); }); - }; - /** - * @since 1.0.0 - */ - Type.prototype.asDecoder = function () { - return this; - }; - /** - * @since 1.0.0 - */ - Type.prototype.asEncoder = function () { - return this; - }; - /** - * a version of `validate` with a default context - * @since 1.0.0 - */ - Type.prototype.decode = function (i) { - return this.validate(i, [{ key: '', type: this, actual: i }]); - }; - return Type; -}()); -export { Type }; -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- -/** - * @since 1.0.0 - */ -export var identity = function (a) { return a; }; -/** - * @since 1.0.0 - */ -export function getFunctionName(f) { - return f.displayName || f.name || ""); -} -/** - * @since 1.0.0 - */ -export function getContextEntry(key, decoder) { - return { key: key, type: decoder }; -} -/** - * @since 1.0.0 - */ -export function appendContext(c, key, decoder, actual) { - var len = c.length; - var r = Array(len + 1); - for (var i = 0; i < len; i++) { - r[i] = c[i]; - } - r[len] = { key: key, type: decoder, actual: actual }; - return r; -} -function pushAll(xs, ys) { - var l = ys.length; - for (var i = 0; i < l; i++) { - xs.push(ys[i]); - } -} -var hasOwnProperty = Object.prototype.hasOwnProperty; -function getNameFromProps(props) { - return Object.keys(props) - .map(function (k) { return "".concat(k, ": ").concat(props[k].name); }) - .join(', '); -} -function useIdentity(codecs) { - for (var i = 0; i < codecs.length; i++) { - if (codecs[i].encode !== identity) { - return false; - } - } - return true; -} -function getInterfaceTypeName(props) { - return "{ ".concat(getNameFromProps(props), " }"); -} -function getPartialTypeName(inner) { - return "Partial<".concat(inner, ">"); -} -function enumerableRecord(keys, domain, codomain, name) { - if (name === void 0) { name = "{ [K in ".concat(domain.name, "]: ").concat(codomain.name, " }"); } - var len = keys.length; - var props = {}; - for (var i = 0; i < len; i++) { - props[keys[i]] = codomain; - } - var exactCodec = strict(props, name); - return new DictionaryType(name, function (u) { return exactCodec.is(u); }, exactCodec.validate, exactCodec.encode, domain, codomain); -} -/** - * @internal - */ -export function getDomainKeys(domain) { - var _a; - if (isLiteralC(domain)) { - var literal_1 = domain.value; - if (string.is(literal_1)) { - return _a = {}, _a[literal_1] = null, _a; - } - } - else if (isKeyofC(domain)) { - return domain.keys; - } - else if (isUnionC(domain)) { - var keys = domain.types.map(function (type) { return getDomainKeys(type); }); - return keys.some(undefinedType.is) ? undefined : Object.assign.apply(Object, __spreadArray([{}], keys, false)); - } - return undefined; -} -function stripNonDomainKeys(o, domain) { - var keys = Object.keys(o); - var len = keys.length; - var shouldStrip = false; - var r = {}; - for (var i = 0; i < len; i++) { - var k = keys[i]; - if (domain.is(k)) { - r[k] = o[k]; - } - else { - shouldStrip = true; - } - } - return shouldStrip ? r : o; -} -function nonEnumerableRecord(domain, codomain, name) { - if (name === void 0) { name = "{ [K in ".concat(domain.name, "]: ").concat(codomain.name, " }"); } - return new DictionaryType(name, function (u) { - if (UnknownRecord.is(u)) { - return Object.keys(u).every(function (k) { return !domain.is(k) || codomain.is(u[k]); }); - } - return isAnyC(codomain) && Array.isArray(u); - }, function (u, c) { - if (UnknownRecord.is(u)) { - var a = {}; - var errors = []; - var keys = Object.keys(u); - var len = keys.length; - var changed = false; - for (var i = 0; i < len; i++) { - var k = keys[i]; - var ok = u[k]; - var domainResult = domain.validate(k, appendContext(c, k, domain, k)); - if (isLeft(domainResult)) { - changed = true; - } - else { - var vk = domainResult.right; - changed = changed || vk !== k; - k = vk; - var codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)); - if (isLeft(codomainResult)) { - pushAll(errors, codomainResult.left); - } - else { - var vok = codomainResult.right; - changed = changed || vok !== ok; - a[k] = vok; - } - } - } - return errors.length > 0 ? failures(errors) : success((changed ? a : u)); - } - if (isAnyC(codomain) && Array.isArray(u)) { - return success(u); - } - return failure(u, c); - }, domain.encode === identity && codomain.encode === identity - ? function (a) { return stripNonDomainKeys(a, domain); } - : function (a) { - var s = {}; - var keys = Object.keys(stripNonDomainKeys(a, domain)); - var len = keys.length; - for (var i = 0; i < len; i++) { - var k = keys[i]; - s[String(domain.encode(k))] = codomain.encode(a[k]); - } - return s; - }, domain, codomain); -} -function getUnionName(codecs) { - return '(' + codecs.map(function (type) { return type.name; }).join(' | ') + ')'; -} -/** - * @internal - */ -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -export function mergeAll(base, us) { - var equal = true; - var primitive = true; - var baseIsNotADictionary = !UnknownRecord.is(base); - for (var _i = 0, us_1 = us; _i < us_1.length; _i++) { - var u = us_1[_i]; - if (u !== base) { - equal = false; - } - if (UnknownRecord.is(u)) { - primitive = false; - } - } - if (equal) { - return base; - } - else if (primitive) { - return us[us.length - 1]; - } - var r = {}; - for (var _a = 0, us_2 = us; _a < us_2.length; _a++) { - var u = us_2[_a]; - for (var k in u) { - if (!hasOwnProperty.call(r, k) || baseIsNotADictionary || u[k] !== base[k]) { - r[k] = u[k]; - } - } - } - return r; -} -function getProps(codec) { - switch (codec._tag) { - case 'RefinementType': - case 'ReadonlyType': - return getProps(codec.type); - case 'InterfaceType': - case 'StrictType': - case 'PartialType': - return codec.props; - case 'IntersectionType': - return codec.types.reduce(function (props, type) { return Object.assign(props, getProps(type)); }, {}); - } -} -function stripKeys(o, props) { - var keys = Object.getOwnPropertyNames(o); - var shouldStrip = false; - var r = {}; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - if (!hasOwnProperty.call(props, key)) { - shouldStrip = true; - } - else { - r[key] = o[key]; - } - } - return shouldStrip ? r : o; -} -function getExactTypeName(codec) { - if (isTypeC(codec)) { - return "{| ".concat(getNameFromProps(codec.props), " |}"); - } - else if (isPartialC(codec)) { - return getPartialTypeName("{| ".concat(getNameFromProps(codec.props), " |}")); - } - return "Exact<".concat(codec.name, ">"); -} -function isNonEmpty(as) { - return as.length > 0; -} -/** - * @internal - */ -export var emptyTags = {}; -function intersect(a, b) { - var r = []; - for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { - var v = a_1[_i]; - if (b.indexOf(v) !== -1) { - r.push(v); - } - } - return r; -} -function mergeTags(a, b) { - if (a === emptyTags) { - return b; - } - if (b === emptyTags) { - return a; - } - var r = Object.assign({}, a); - for (var k in b) { - if (hasOwnProperty.call(a, k)) { - var intersection_1 = intersect(a[k], b[k]); - if (isNonEmpty(intersection_1)) { - r[k] = intersection_1; - } - else { - r = emptyTags; - break; - } - } - else { - r[k] = b[k]; - } - } - return r; -} -function intersectTags(a, b) { - if (a === emptyTags || b === emptyTags) { - return emptyTags; - } - var r = emptyTags; - for (var k in a) { - if (hasOwnProperty.call(b, k)) { - var intersection_2 = intersect(a[k], b[k]); - if (intersection_2.length === 0) { - if (r === emptyTags) { - r = {}; - } - r[k] = a[k].concat(b[k]); - } - } - } - return r; -} -// tslint:disable-next-line: deprecation -function isAnyC(codec) { - return codec._tag === 'AnyType'; -} -function isLiteralC(codec) { - return codec._tag === 'LiteralType'; -} -function isKeyofC(codec) { - return codec._tag === 'KeyofType'; -} -function isTypeC(codec) { - return codec._tag === 'InterfaceType'; -} -function isPartialC(codec) { - return codec._tag === 'PartialType'; -} -// tslint:disable-next-line: deprecation -function isStrictC(codec) { - return codec._tag === 'StrictType'; -} -function isExactC(codec) { - return codec._tag === 'ExactType'; -} -// tslint:disable-next-line: deprecation -function isRefinementC(codec) { - return codec._tag === 'RefinementType'; -} -function isIntersectionC(codec) { - return codec._tag === 'IntersectionType'; -} -function isUnionC(codec) { - return codec._tag === 'UnionType'; -} -function isRecursiveC(codec) { - return codec._tag === 'RecursiveType'; -} -function isReadonlyC(codec) { - return codec._tag === 'ReadonlyType'; -} -var lazyCodecs = []; -/** - * @internal - */ -export function getTags(codec) { - if (lazyCodecs.indexOf(codec) !== -1) { - return emptyTags; - } - if (isTypeC(codec) || isStrictC(codec)) { - var index = emptyTags; - // tslint:disable-next-line: forin - for (var k in codec.props) { - var prop = codec.props[k]; - if (isLiteralC(prop)) { - if (index === emptyTags) { - index = {}; - } - index[k] = [prop.value]; - } - } - return index; - } - else if (isExactC(codec) || isRefinementC(codec) || isReadonlyC(codec)) { - return getTags(codec.type); - } - else if (isIntersectionC(codec)) { - return codec.types.reduce(function (tags, codec) { return mergeTags(tags, getTags(codec)); }, emptyTags); - } - else if (isUnionC(codec)) { - return codec.types.slice(1).reduce(function (tags, codec) { return intersectTags(tags, getTags(codec)); }, getTags(codec.types[0])); - } - else if (isRecursiveC(codec)) { - lazyCodecs.push(codec); - var tags = getTags(codec.type); - lazyCodecs.pop(); - return tags; - } - return emptyTags; -} -/** - * @internal - */ -export function getIndex(codecs) { - var tags = getTags(codecs[0]); - var keys = Object.keys(tags); - var len = codecs.length; - var _loop_1 = function (k) { - var all = tags[k].slice(); - var index = [tags[k]]; - for (var i = 1; i < len; i++) { - var codec = codecs[i]; - var ctags = getTags(codec); - var values = ctags[k]; - // tslint:disable-next-line: strict-type-predicates - if (values === undefined) { - return "continue-keys"; - } - else { - if (values.some(function (v) { return all.indexOf(v) !== -1; })) { - return "continue-keys"; - } - else { - all.push.apply(all, values); - index.push(values); - } - } - } - return { value: [k, index] }; - }; - keys: for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { - var k = keys_1[_i]; - var state_1 = _loop_1(k); - if (typeof state_1 === "object") - return state_1.value; - switch (state_1) { - case "continue-keys": continue keys; - } - } - return undefined; -} -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @since 1.0.0 - */ -var NullType = /** @class */ (function (_super) { - __extends(NullType, _super); - function NullType() { - var _this = _super.call(this, 'null', function (u) { return u === null; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'NullType'; - return _this; - } - return NullType; -}(Type)); -export { NullType }; -/** - * @category primitives - * @since 1.0.0 - */ -export var nullType = new NullType(); -/** - * @since 1.0.0 - */ -var UndefinedType = /** @class */ (function (_super) { - __extends(UndefinedType, _super); - function UndefinedType() { - var _this = _super.call(this, 'undefined', function (u) { return u === void 0; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'UndefinedType'; - return _this; - } - return UndefinedType; -}(Type)); -export { UndefinedType }; -var undefinedType = new UndefinedType(); -/** - * @since 1.2.0 - */ -var VoidType = /** @class */ (function (_super) { - __extends(VoidType, _super); - function VoidType() { - var _this = _super.call(this, 'void', undefinedType.is, undefinedType.validate, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'VoidType'; - return _this; - } - return VoidType; -}(Type)); -export { VoidType }; -/** - * @category primitives - * @since 1.2.0 - */ -export var voidType = new VoidType(); -/** - * @since 1.5.0 - */ -var UnknownType = /** @class */ (function (_super) { - __extends(UnknownType, _super); - function UnknownType() { - var _this = _super.call(this, 'unknown', function (_) { return true; }, success, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'UnknownType'; - return _this; - } - return UnknownType; -}(Type)); -export { UnknownType }; -/** - * @category primitives - * @since 1.5.0 - */ -export var unknown = new UnknownType(); -/** - * @since 1.0.0 - */ -var StringType = /** @class */ (function (_super) { - __extends(StringType, _super); - function StringType() { - var _this = _super.call(this, 'string', function (u) { return typeof u === 'string'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'StringType'; - return _this; - } - return StringType; -}(Type)); -export { StringType }; -/** - * @category primitives - * @since 1.0.0 - */ -export var string = new StringType(); -/** - * @since 1.0.0 - */ -var NumberType = /** @class */ (function (_super) { - __extends(NumberType, _super); - function NumberType() { - var _this = _super.call(this, 'number', function (u) { return typeof u === 'number'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'NumberType'; - return _this; - } - return NumberType; -}(Type)); -export { NumberType }; -/** - * @category primitives - * @since 1.0.0 - */ -export var number = new NumberType(); -/** - * @since 2.1.0 - */ -var BigIntType = /** @class */ (function (_super) { - __extends(BigIntType, _super); - function BigIntType() { - var _this = _super.call(this, 'bigint', - // tslint:disable-next-line: valid-typeof - function (u) { return typeof u === 'bigint'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'BigIntType'; - return _this; - } - return BigIntType; -}(Type)); -export { BigIntType }; -/** - * @category primitives - * @since 2.1.0 - */ -export var bigint = new BigIntType(); -/** - * @since 1.0.0 - */ -var BooleanType = /** @class */ (function (_super) { - __extends(BooleanType, _super); - function BooleanType() { - var _this = _super.call(this, 'boolean', function (u) { return typeof u === 'boolean'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'BooleanType'; - return _this; - } - return BooleanType; -}(Type)); -export { BooleanType }; -/** - * @category primitives - * @since 1.0.0 - */ -export var boolean = new BooleanType(); -/** - * @since 1.0.0 - */ -var AnyArrayType = /** @class */ (function (_super) { - __extends(AnyArrayType, _super); - function AnyArrayType() { - var _this = _super.call(this, 'UnknownArray', Array.isArray, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'AnyArrayType'; - return _this; - } - return AnyArrayType; -}(Type)); -export { AnyArrayType }; -/** - * @category primitives - * @since 1.7.1 - */ -export var UnknownArray = new AnyArrayType(); -/** - * @since 1.0.0 - */ -var AnyDictionaryType = /** @class */ (function (_super) { - __extends(AnyDictionaryType, _super); - function AnyDictionaryType() { - var _this = _super.call(this, 'UnknownRecord', function (u) { return u !== null && typeof u === 'object' && !Array.isArray(u); }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'AnyDictionaryType'; - return _this; - } - return AnyDictionaryType; -}(Type)); -export { AnyDictionaryType }; -/** - * @category primitives - * @since 1.7.1 - */ -export var UnknownRecord = new AnyDictionaryType(); -export { -/** - * @category primitives - * @since 1.0.0 - */ -nullType as null, -/** - * @category primitives - * @since 1.0.0 - */ -undefinedType as undefined, -/** - * @category primitives - * @since 1.0.0 - */ -voidType as void }; -/** - * @since 1.0.0 - */ -var LiteralType = /** @class */ (function (_super) { - __extends(LiteralType, _super); - function LiteralType(name, is, validate, encode, value) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.value = value; - /** - * @since 1.0.0 - */ - _this._tag = 'LiteralType'; - return _this; - } - return LiteralType; -}(Type)); -export { LiteralType }; -/** - * @category constructors - * @since 1.0.0 - */ -export function literal(value, name) { - if (name === void 0) { name = JSON.stringify(value); } - var is = function (u) { return u === value; }; - return new LiteralType(name, is, function (u, c) { return (is(u) ? success(value) : failure(u, c)); }, identity, value); -} -/** - * @since 1.0.0 - */ -var KeyofType = /** @class */ (function (_super) { - __extends(KeyofType, _super); - function KeyofType(name, is, validate, encode, keys) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.keys = keys; - /** - * @since 1.0.0 - */ - _this._tag = 'KeyofType'; - return _this; - } - return KeyofType; -}(Type)); -export { KeyofType }; -/** - * @category constructors - * @since 1.0.0 - */ -export function keyof(keys, name) { - if (name === void 0) { name = Object.keys(keys) - .map(function (k) { return JSON.stringify(k); }) - .join(' | '); } - var is = function (u) { return string.is(u) && hasOwnProperty.call(keys, u); }; - return new KeyofType(name, is, function (u, c) { return (is(u) ? success(u) : failure(u, c)); }, identity, keys); -} -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @since 1.0.0 - */ -var RefinementType = /** @class */ (function (_super) { - __extends(RefinementType, _super); - function RefinementType(name, is, validate, encode, type, predicate) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.type = type; - _this.predicate = predicate; - /** - * @since 1.0.0 - */ - _this._tag = 'RefinementType'; - return _this; - } - return RefinementType; -}(Type)); -export { RefinementType }; -/** - * @category combinators - * @since 1.8.1 - */ -export function brand(codec, predicate, name) { - return refinement(codec, predicate, name); -} -/** - * A branded codec representing an integer - * - * @category primitives - * @since 1.8.1 - */ -export var Int = brand(number, function (n) { return Number.isInteger(n); }, 'Int'); -/** - * @since 1.0.0 - */ -var RecursiveType = /** @class */ (function (_super) { - __extends(RecursiveType, _super); - function RecursiveType(name, is, validate, encode, runDefinition) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.runDefinition = runDefinition; - /** - * @since 1.0.0 - */ - _this._tag = 'RecursiveType'; - return _this; - } - return RecursiveType; -}(Type)); -export { RecursiveType }; -Object.defineProperty(RecursiveType.prototype, 'type', { - get: function () { - return this.runDefinition(); - }, - enumerable: true, - configurable: true -}); -/** - * @category combinators - * @since 1.0.0 - */ -export function recursion(name, definition) { - var cache; - var runDefinition = function () { - if (!cache) { - cache = definition(Self); - cache.name = name; - } - return cache; - }; - var Self = new RecursiveType(name, function (u) { return runDefinition().is(u); }, function (u, c) { return runDefinition().validate(u, c); }, function (a) { return runDefinition().encode(a); }, runDefinition); - return Self; -} -/** - * @since 1.0.0 - */ -var ArrayType = /** @class */ (function (_super) { - __extends(ArrayType, _super); - function ArrayType(name, is, validate, encode, type) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.type = type; - /** - * @since 1.0.0 - */ - _this._tag = 'ArrayType'; - return _this; - } - return ArrayType; -}(Type)); -export { ArrayType }; -/** - * @category combinators - * @since 1.0.0 - */ -export function array(item, name) { - if (name === void 0) { name = "Array<".concat(item.name, ">"); } - return new ArrayType(name, function (u) { return UnknownArray.is(u) && u.every(item.is); }, function (u, c) { - var e = UnknownArray.validate(u, c); - if (isLeft(e)) { - return e; - } - var us = e.right; - var len = us.length; - var as = us; - var errors = []; - for (var i = 0; i < len; i++) { - var ui = us[i]; - var result = item.validate(ui, appendContext(c, String(i), item, ui)); - if (isLeft(result)) { - pushAll(errors, result.left); - } - else { - var ai = result.right; - if (ai !== ui) { - if (as === us) { - as = us.slice(); - } - as[i] = ai; - } - } - } - return errors.length > 0 ? failures(errors) : success(as); - }, item.encode === identity ? identity : function (a) { return a.map(item.encode); }, item); -} -/** - * @since 1.0.0 - */ -var InterfaceType = /** @class */ (function (_super) { - __extends(InterfaceType, _super); - function InterfaceType(name, is, validate, encode, props) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.props = props; - /** - * @since 1.0.0 - */ - _this._tag = 'InterfaceType'; - return _this; - } - return InterfaceType; -}(Type)); -export { InterfaceType }; -/** - * @category combinators - * @since 1.0.0 - */ -export function type(props, name) { - if (name === void 0) { name = getInterfaceTypeName(props); } - var keys = Object.keys(props); - var types = keys.map(function (key) { return props[key]; }); - var len = keys.length; - return new InterfaceType(name, function (u) { - if (UnknownRecord.is(u)) { - for (var i = 0; i < len; i++) { - var k = keys[i]; - var uk = u[k]; - if ((uk === undefined && !hasOwnProperty.call(u, k)) || !types[i].is(uk)) { - return false; - } - } - return true; - } - return false; - }, function (u, c) { - var e = UnknownRecord.validate(u, c); - if (isLeft(e)) { - return e; - } - var o = e.right; - var a = o; - var errors = []; - for (var i = 0; i < len; i++) { - var k = keys[i]; - var ak = a[k]; - var type_1 = types[i]; - var result = type_1.validate(ak, appendContext(c, k, type_1, ak)); - if (isLeft(result)) { - pushAll(errors, result.left); - } - else { - var vak = result.right; - if (vak !== ak || (vak === undefined && !hasOwnProperty.call(a, k))) { - /* istanbul ignore next */ - if (a === o) { - a = __assign({}, o); - } - a[k] = vak; - } - } - } - return errors.length > 0 ? failures(errors) : success(a); - }, useIdentity(types) - ? identity - : function (a) { - var s = __assign({}, a); - for (var i = 0; i < len; i++) { - var k = keys[i]; - var encode = types[i].encode; - if (encode !== identity) { - s[k] = encode(a[k]); - } - } - return s; - }, props); -} -/** - * @since 1.0.0 - */ -var PartialType = /** @class */ (function (_super) { - __extends(PartialType, _super); - function PartialType(name, is, validate, encode, props) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.props = props; - /** - * @since 1.0.0 - */ - _this._tag = 'PartialType'; - return _this; - } - return PartialType; -}(Type)); -export { PartialType }; -/** - * @category combinators - * @since 1.0.0 - */ -export function partial(props, name) { - if (name === void 0) { name = getPartialTypeName(getInterfaceTypeName(props)); } - var keys = Object.keys(props); - var types = keys.map(function (key) { return props[key]; }); - var len = keys.length; - return new PartialType(name, function (u) { - if (UnknownRecord.is(u)) { - for (var i = 0; i < len; i++) { - var k = keys[i]; - var uk = u[k]; - if (uk !== undefined && !props[k].is(uk)) { - return false; - } - } - return true; - } - return false; - }, function (u, c) { - var e = UnknownRecord.validate(u, c); - if (isLeft(e)) { - return e; - } - var o = e.right; - var a = o; - var errors = []; - for (var i = 0; i < len; i++) { - var k = keys[i]; - var ak = a[k]; - var type_2 = props[k]; - var result = type_2.validate(ak, appendContext(c, k, type_2, ak)); - if (isLeft(result)) { - if (ak !== undefined) { - pushAll(errors, result.left); - } - } - else { - var vak = result.right; - if (vak !== ak) { - /* istanbul ignore next */ - if (a === o) { - a = __assign({}, o); - } - a[k] = vak; - } - } - } - return errors.length > 0 ? failures(errors) : success(a); - }, useIdentity(types) - ? identity - : function (a) { - var s = __assign({}, a); - for (var i = 0; i < len; i++) { - var k = keys[i]; - var ak = a[k]; - if (ak !== undefined) { - s[k] = types[i].encode(ak); - } - } - return s; - }, props); -} -/** - * @since 1.0.0 - */ -var DictionaryType = /** @class */ (function (_super) { - __extends(DictionaryType, _super); - function DictionaryType(name, is, validate, encode, domain, codomain) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.domain = domain; - _this.codomain = codomain; - /** - * @since 1.0.0 - */ - _this._tag = 'DictionaryType'; - return _this; - } - return DictionaryType; -}(Type)); -export { DictionaryType }; -/** - * @category combinators - * @since 1.7.1 - */ -export function record(domain, codomain, name) { - var keys = getDomainKeys(domain); - return keys - ? enumerableRecord(Object.keys(keys), domain, codomain, name) - : nonEnumerableRecord(domain, codomain, name); -} -/** - * @since 1.0.0 - */ -var UnionType = /** @class */ (function (_super) { - __extends(UnionType, _super); - function UnionType(name, is, validate, encode, types) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.types = types; - /** - * @since 1.0.0 - */ - _this._tag = 'UnionType'; - return _this; - } - return UnionType; -}(Type)); -export { UnionType }; -/** - * @category combinators - * @since 1.0.0 - */ -export function union(codecs, name) { - if (name === void 0) { name = getUnionName(codecs); } - var index = getIndex(codecs); - if (index !== undefined && codecs.length > 0) { - var tag_1 = index[0], groups_1 = index[1]; - var len_1 = groups_1.length; - var find_1 = function (value) { - for (var i = 0; i < len_1; i++) { - if (groups_1[i].indexOf(value) !== -1) { - return i; - } - } - return undefined; - }; - // tslint:disable-next-line: deprecation - return new TaggedUnionType(name, function (u) { - if (UnknownRecord.is(u)) { - var i = find_1(u[tag_1]); - return i !== undefined ? codecs[i].is(u) : false; - } - return false; - }, function (u, c) { - var e = UnknownRecord.validate(u, c); - if (isLeft(e)) { - return e; - } - var r = e.right; - var i = find_1(r[tag_1]); - if (i === undefined) { - return failure(u, c); - } - var codec = codecs[i]; - return codec.validate(r, appendContext(c, String(i), codec, r)); - }, useIdentity(codecs) - ? identity - : function (a) { - var i = find_1(a[tag_1]); - if (i === undefined) { - // https://github.com/gcanti/io-ts/pull/305 - throw new Error("no codec found to encode value in union codec ".concat(name)); - } - else { - return codecs[i].encode(a); - } - }, codecs, tag_1); - } - else { - return new UnionType(name, function (u) { return codecs.some(function (type) { return type.is(u); }); }, function (u, c) { - var errors = []; - for (var i = 0; i < codecs.length; i++) { - var codec = codecs[i]; - var result = codec.validate(u, appendContext(c, String(i), codec, u)); - if (isLeft(result)) { - pushAll(errors, result.left); - } - else { - return success(result.right); - } - } - return failures(errors); - }, useIdentity(codecs) - ? identity - : function (a) { - for (var _i = 0, codecs_1 = codecs; _i < codecs_1.length; _i++) { - var codec = codecs_1[_i]; - if (codec.is(a)) { - return codec.encode(a); - } - } - // https://github.com/gcanti/io-ts/pull/305 - throw new Error("no codec found to encode value in union type ".concat(name)); - }, codecs); - } -} -/** - * @since 1.0.0 - */ -var IntersectionType = /** @class */ (function (_super) { - __extends(IntersectionType, _super); - function IntersectionType(name, is, validate, encode, types) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.types = types; - /** - * @since 1.0.0 - */ - _this._tag = 'IntersectionType'; - return _this; - } - return IntersectionType; -}(Type)); -export { IntersectionType }; -export function intersection(codecs, name) { - if (name === void 0) { name = "(".concat(codecs.map(function (type) { return type.name; }).join(' & '), ")"); } - var len = codecs.length; - return new IntersectionType(name, function (u) { return codecs.every(function (type) { return type.is(u); }); }, codecs.length === 0 - ? success - : function (u, c) { - var us = []; - var errors = []; - for (var i = 0; i < len; i++) { - var codec = codecs[i]; - var result = codec.validate(u, appendContext(c, String(i), codec, u)); - if (isLeft(result)) { - pushAll(errors, result.left); - } - else { - us.push(result.right); - } - } - return errors.length > 0 ? failures(errors) : success(mergeAll(u, us)); - }, codecs.length === 0 - ? identity - : function (a) { - return mergeAll(a, codecs.map(function (codec) { return codec.encode(a); })); - }, codecs); -} -/** - * @since 1.0.0 - */ -var TupleType = /** @class */ (function (_super) { - __extends(TupleType, _super); - function TupleType(name, is, validate, encode, types) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.types = types; - /** - * @since 1.0.0 - */ - _this._tag = 'TupleType'; - return _this; - } - return TupleType; -}(Type)); -export { TupleType }; -export function tuple(codecs, name) { - if (name === void 0) { name = "[".concat(codecs.map(function (type) { return type.name; }).join(', '), "]"); } - var len = codecs.length; - return new TupleType(name, function (u) { return UnknownArray.is(u) && u.length === len && codecs.every(function (type, i) { return type.is(u[i]); }); }, function (u, c) { - var e = UnknownArray.validate(u, c); - if (isLeft(e)) { - return e; - } - var us = e.right; - var as = us.length > len ? us.slice(0, len) : us; // strip additional components - var errors = []; - for (var i = 0; i < len; i++) { - var a = us[i]; - var type_3 = codecs[i]; - var result = type_3.validate(a, appendContext(c, String(i), type_3, a)); - if (isLeft(result)) { - pushAll(errors, result.left); - } - else { - var va = result.right; - if (va !== a) { - /* istanbul ignore next */ - if (as === us) { - as = us.slice(); - } - as[i] = va; - } - } - } - return errors.length > 0 ? failures(errors) : success(as); - }, useIdentity(codecs) ? identity : function (a) { return codecs.map(function (type, i) { return type.encode(a[i]); }); }, codecs); -} -/** - * @since 1.0.0 - */ -var ReadonlyType = /** @class */ (function (_super) { - __extends(ReadonlyType, _super); - function ReadonlyType(name, is, validate, encode, type) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.type = type; - /** - * @since 1.0.0 - */ - _this._tag = 'ReadonlyType'; - return _this; - } - return ReadonlyType; -}(Type)); -export { ReadonlyType }; -/** - * @category combinators - * @since 1.0.0 - */ -export function readonly(codec, name) { - if (name === void 0) { name = "Readonly<".concat(codec.name, ">"); } - return new ReadonlyType(name, codec.is, codec.validate, codec.encode, codec); -} -/** - * @since 1.0.0 - */ -var ReadonlyArrayType = /** @class */ (function (_super) { - __extends(ReadonlyArrayType, _super); - function ReadonlyArrayType(name, is, validate, encode, type) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.type = type; - /** - * @since 1.0.0 - */ - _this._tag = 'ReadonlyArrayType'; - return _this; - } - return ReadonlyArrayType; -}(Type)); -export { ReadonlyArrayType }; -/** - * @category combinators - * @since 1.0.0 - */ -export function readonlyArray(item, name) { - if (name === void 0) { name = "ReadonlyArray<".concat(item.name, ">"); } - var codec = array(item); - return new ReadonlyArrayType(name, codec.is, codec.validate, codec.encode, item); -} -/** - * Strips additional properties, equivalent to `exact(type(props))`. - * - * @category combinators - * @since 1.0.0 - */ -export var strict = function (props, name) { return exact(type(props), name); }; -/** - * @since 1.1.0 - */ -var ExactType = /** @class */ (function (_super) { - __extends(ExactType, _super); - function ExactType(name, is, validate, encode, type) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.type = type; - /** - * @since 1.0.0 - */ - _this._tag = 'ExactType'; - return _this; - } - return ExactType; -}(Type)); -export { ExactType }; -/** - * Strips additional properties. - * - * @category combinators - * @since 1.1.0 - */ -export function exact(codec, name) { - if (name === void 0) { name = getExactTypeName(codec); } - var props = getProps(codec); - return new ExactType(name, codec.is, function (u, c) { - var e = UnknownRecord.validate(u, c); - if (isLeft(e)) { - return e; - } - var ce = codec.validate(u, c); - if (isLeft(ce)) { - return ce; - } - return right(stripKeys(ce.right, props)); - }, function (a) { return codec.encode(stripKeys(a, props)); }, codec); -} -/** - * @since 1.0.0 - */ -var FunctionType = /** @class */ (function (_super) { - __extends(FunctionType, _super); - function FunctionType() { - var _this = _super.call(this, 'Function', - // tslint:disable-next-line:strict-type-predicates - function (u) { return typeof u === 'function'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'FunctionType'; - return _this; - } - return FunctionType; -}(Type)); -export { FunctionType }; -/** - * @category primitives - * @since 1.0.0 - */ -export var Function = new FunctionType(); -/** - * @since 1.0.0 - */ -var NeverType = /** @class */ (function (_super) { - __extends(NeverType, _super); - function NeverType() { - var _this = _super.call(this, 'never', function (_) { return false; }, function (u, c) { return failure(u, c); }, - /* istanbul ignore next */ - function () { - throw new Error('cannot encode never'); - }) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'NeverType'; - return _this; - } - return NeverType; -}(Type)); -export { NeverType }; -/** - * @category primitives - * @since 1.0.0 - */ -export var never = new NeverType(); -/** - * @since 1.0.0 - */ -var AnyType = /** @class */ (function (_super) { - __extends(AnyType, _super); - function AnyType() { - var _this = _super.call(this, 'any', function (_) { return true; }, success, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'AnyType'; - return _this; - } - return AnyType; -}(Type)); -export { AnyType }; -/** - * @category primitives - * @since 1.0.0 - */ -export var any = new AnyType(); -export function refinement(codec, predicate, name) { - if (name === void 0) { name = "(".concat(codec.name, " | ").concat(getFunctionName(predicate), ")"); } - return new RefinementType(name, function (u) { return codec.is(u) && predicate(u); }, function (i, c) { - var e = codec.validate(i, c); - if (isLeft(e)) { - return e; - } - var a = e.right; - return predicate(a) ? success(a) : failure(a, c); - }, codec.encode, codec, predicate); -} -/** - * @category primitives - * @since 1.0.0 - */ -export var Integer = refinement(number, Number.isInteger, 'Integer'); -// ------------------------------------------------------------------------------------- -// deprecated -// ------------------------------------------------------------------------------------- -/** - * @since 1.3.0 - * @deprecated - */ -var TaggedUnionType = /** @class */ (function (_super) { - __extends(TaggedUnionType, _super); - function TaggedUnionType(name, - // tslint:disable-next-line: deprecation - is, - // tslint:disable-next-line: deprecation - validate, - // tslint:disable-next-line: deprecation - encode, codecs, tag) { - var _this = _super.call(this, name, is, validate, encode, codecs) /* istanbul ignore next */ // <= workaround for https://github.com/Microsoft/TypeScript/issues/13455 - || this; - _this.tag = tag; - return _this; - } - return TaggedUnionType; -}(UnionType)); -export { TaggedUnionType }; -/** - * Use `union` instead. - * - * @category combinators - * @since 1.3.0 - * @deprecated - */ -export var taggedUnion = function (tag, codecs, name -// tslint:disable-next-line: deprecation -) { - if (name === void 0) { name = getUnionName(codecs); } - var U = union(codecs, name); - // tslint:disable-next-line: deprecation - if (U instanceof TaggedUnionType) { - return U; - } - else { - console.warn("[io-ts] Cannot build a tagged union for ".concat(name, ", returning a de-optimized union")); - // tslint:disable-next-line: deprecation - return new TaggedUnionType(name, U.is, U.validate, U.encode, codecs, tag); - } -}; -export { -/** - * Use `UnknownArray` instead. - * - * @category primitives - * @deprecated - * @since 1.0.0 - */ -UnknownArray as Array }; -export { -/** - * Use `type` instead. - * - * @category combinators - * @deprecated - * @since 1.0.0 - */ -type as interface }; -/** - * @since 1.0.0 - * @deprecated - */ -export var getValidationError /* istanbul ignore next */ = function (value, context) { return ({ - value: value, - context: context -}); }; -/** - * @since 1.0.0 - * @deprecated - */ -export var getDefaultContext /* istanbul ignore next */ = function (decoder) { return [ - { key: '', type: decoder } -]; }; -/** - * Use `UnknownRecord` instead. - * - * @category primitives - * @since 1.0.0 - * @deprecated - */ -export var Dictionary = UnknownRecord; -/** - * @since 1.0.0 - * @deprecated - */ -var ObjectType = /** @class */ (function (_super) { - __extends(ObjectType, _super); - function ObjectType() { - var _this = _super.call(this, 'object', function (u) { return u !== null && typeof u === 'object'; }, function (u, c) { return (_this.is(u) ? success(u) : failure(u, c)); }, identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'ObjectType'; - return _this; - } - return ObjectType; -}(Type)); -export { ObjectType }; -/** - * Use `UnknownRecord` instead. - * - * @category primitives - * @since 1.0.0 - * @deprecated - */ -// tslint:disable-next-line: deprecation -export var object = new ObjectType(); -/** - * Use `record` instead. - * - * @category combinators - * @since 1.0.0 - * @deprecated - */ -export var dictionary = record; -/** - * @since 1.0.0 - * @deprecated - */ -var StrictType = /** @class */ (function (_super) { - __extends(StrictType, _super); - function StrictType(name, - // tslint:disable-next-line: deprecation - is, - // tslint:disable-next-line: deprecation - validate, - // tslint:disable-next-line: deprecation - encode, props) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.props = props; - /** - * @since 1.0.0 - */ - _this._tag = 'StrictType'; - return _this; - } - return StrictType; -}(Type)); -export { StrictType }; -/** - * Drops the codec "kind". - * - * @category combinators - * @since 1.1.0 - * @deprecated - */ -export function clean(codec) { - return codec; -} -export function alias(codec) { - return function () { return codec; }; -} diff --git a/components/pexels/node_modules/io-ts/lib/Codec.d.ts b/components/pexels/node_modules/io-ts/lib/Codec.d.ts deleted file mode 100644 index c6c734474e857..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Codec.d.ts +++ /dev/null @@ -1,296 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.3 - */ -import { Refinement } from 'fp-ts/lib/function' -import { Invariant3 } from 'fp-ts/lib/Invariant' -import * as D from './Decoder' -import * as E from './Encoder' -import * as S from './Schemable' -/** - * Laws: - * - * 1. `pipe(codec.decode(u), E.fold(() => u, codec.encode)) = u` for all `u` in `unknown` - * 2. `codec.decode(codec.encode(a)) = E.right(a)` for all `a` in `A` - * - * @category model - * @since 2.2.3 - */ -export interface Codec extends D.Decoder, E.Encoder {} -/** - * @category constructors - * @since 2.2.3 - */ -export declare function make(decoder: D.Decoder, encoder: E.Encoder): Codec -/** - * @category constructors - * @since 2.2.3 - */ -export declare function fromDecoder(decoder: D.Decoder): Codec -/** - * @category constructors - * @since 2.2.3 - */ -export declare function literal], L extends S.Literal = S.Literal>( - ...values: A -): Codec -/** - * @category primitives - * @since 2.2.3 - */ -export declare const string: Codec -/** - * @category primitives - * @since 2.2.3 - */ -export declare const number: Codec -/** - * @category primitives - * @since 2.2.3 - */ -export declare const boolean: Codec -/** - * @category primitives - * @since 2.2.3 - */ -export declare const UnknownArray: Codec, Array> -/** - * @category primitives - * @since 2.2.3 - */ -export declare const UnknownRecord: Codec, Record> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const mapLeftWithInput: ( - f: (i: I, e: D.DecodeError) => D.DecodeError -) => (codec: Codec) => Codec -/** - * @category combinators - * @since 2.2.3 - */ -export declare const refine: ( - refinement: Refinement, - id: string -) => (from: Codec) => Codec -/** - * @category combinators - * @since 2.2.3 - */ -export declare function nullable(or: Codec): Codec -/** - * @category combinators - * @since 2.2.15 - */ -export declare function fromStruct

>>( - properties: P -): Codec< - { - [K in keyof P]: InputOf - }, - { - [K in keyof P]: OutputOf - }, - { - [K in keyof P]: TypeOf - } -> -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -export declare const fromType: typeof fromStruct -/** - * @category combinators - * @since 2.2.15 - */ -export declare function struct

>>( - properties: P -): Codec< - unknown, - { - [K in keyof P]: OutputOf - }, - { - [K in keyof P]: TypeOf - } -> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -export declare const type: typeof struct -/** - * @category combinators - * @since 2.2.8 - */ -export declare function fromPartial

>>( - properties: P -): Codec< - Partial<{ - [K in keyof P]: InputOf - }>, - Partial<{ - [K in keyof P]: OutputOf - }>, - Partial<{ - [K in keyof P]: TypeOf - }> -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function partial

>>( - properties: P -): Codec< - unknown, - Partial<{ - [K in keyof P]: OutputOf - }>, - Partial<{ - [K in keyof P]: TypeOf - }> -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function fromArray(item: Codec): Codec, Array, Array> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function array(item: Codec): Codec, Array> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function fromRecord( - codomain: Codec -): Codec, Record, Record> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function record( - codomain: Codec -): Codec, Record> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromTuple: []>( - ...components: C -) => Codec< - { [K in keyof C]: import('./Kleisli').InputOf<'Either', C[K]> }, - { [K_1 in keyof C]: E.OutputOf }, - { [K_2 in keyof C]: E.TypeOf } -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function tuple>>( - ...components: C -): Codec< - unknown, - { - [K in keyof C]: OutputOf - }, - { - [K in keyof C]: TypeOf - } -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const intersect: ( - right: Codec -) => (left: Codec) => Codec -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromSum: ( - tag: T -) => >>( - members: MS -) => Codec, E.OutputOf, E.TypeOf> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function sum( - tag: T -): >>( - members: M -) => Codec, TypeOf> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function lazy(id: string, f: () => Codec): Codec -/** - * @category combinators - * @since 2.2.16 - */ -export declare const readonly: (codec: Codec) => Codec> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const compose: ( - to: Codec -) => (from: Codec) => Codec -/** - * @category Invariant - * @since 2.2.3 - */ -export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec -/** - * @category instances - * @since 2.2.3 - */ -export declare const URI = 'io-ts/Codec' -/** - * @category instances - * @since 2.2.3 - */ -export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { - interface URItoKind3 { - readonly [URI]: Codec - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Invariant: Invariant3 -/** - * @since 2.2.8 - */ -export type InputOf = D.InputOf -/** - * @since 2.2.3 - */ -export type OutputOf = E.OutputOf -/** - * @since 2.2.3 - */ -export type TypeOf = E.TypeOf diff --git a/components/pexels/node_modules/io-ts/lib/Codec.js b/components/pexels/node_modules/io-ts/lib/Codec.js deleted file mode 100644 index dae84e8698be6..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Codec.js +++ /dev/null @@ -1,332 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Invariant = exports.URI = exports.imap = exports.compose = exports.readonly = exports.lazy = exports.sum = exports.fromSum = exports.intersect = exports.tuple = exports.fromTuple = exports.record = exports.fromRecord = exports.array = exports.fromArray = exports.partial = exports.fromPartial = exports.type = exports.struct = exports.fromType = exports.fromStruct = exports.nullable = exports.refine = exports.mapLeftWithInput = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = exports.fromDecoder = exports.make = void 0; -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.3 - */ -var function_1 = require("fp-ts/lib/function"); -var pipeable_1 = require("fp-ts/lib/pipeable"); -var D = __importStar(require("./Decoder")); -var E = __importStar(require("./Encoder")); -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.3 - */ -function make(decoder, encoder) { - return { - decode: decoder.decode, - encode: encoder.encode - }; -} -exports.make = make; -/** - * @category constructors - * @since 2.2.3 - */ -function fromDecoder(decoder) { - return { - decode: decoder.decode, - encode: function_1.identity - }; -} -exports.fromDecoder = fromDecoder; -/** - * @category constructors - * @since 2.2.3 - */ -function literal() { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return fromDecoder(D.literal.apply(D, values)); -} -exports.literal = literal; -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.3 - */ -exports.string = -/*#__PURE__*/ -fromDecoder(D.string); -/** - * @category primitives - * @since 2.2.3 - */ -exports.number = -/*#__PURE__*/ -fromDecoder(D.number); -/** - * @category primitives - * @since 2.2.3 - */ -exports.boolean = -/*#__PURE__*/ -fromDecoder(D.boolean); -/** - * @category primitives - * @since 2.2.3 - */ -exports.UnknownArray = -/*#__PURE__*/ -fromDecoder(D.UnknownArray); -/** - * @category primitives - * @since 2.2.3 - */ -exports.UnknownRecord = -/*#__PURE__*/ -fromDecoder(D.UnknownRecord); -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.3 - */ -var mapLeftWithInput = function (f) { - return function (codec) { - return make((0, pipeable_1.pipe)(codec, D.mapLeftWithInput(f)), codec); - }; -}; -exports.mapLeftWithInput = mapLeftWithInput; -/** - * @category combinators - * @since 2.2.3 - */ -var refine = function (refinement, id) { - var refine = D.refine(refinement, id); - return function (from) { return make(refine(from), from); }; -}; -exports.refine = refine; -/** - * @category combinators - * @since 2.2.3 - */ -function nullable(or) { - return make(D.nullable(or), E.nullable(or)); -} -exports.nullable = nullable; -/** - * @category combinators - * @since 2.2.15 - */ -function fromStruct(properties) { - return make(D.fromStruct(properties), E.struct(properties)); -} -exports.fromStruct = fromStruct; -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -exports.fromType = fromStruct; -/** - * @category combinators - * @since 2.2.15 - */ -function struct(properties) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)(fromStruct(properties))); -} -exports.struct = struct; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -exports.type = struct; -/** - * @category combinators - * @since 2.2.8 - */ -function fromPartial(properties) { - return make(D.fromPartial(properties), E.partial(properties)); -} -exports.fromPartial = fromPartial; -/** - * @category combinators - * @since 2.2.3 - */ -function partial(properties) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)(fromPartial(properties))); -} -exports.partial = partial; -/** - * @category combinators - * @since 2.2.3 - */ -function fromArray(item) { - return make(D.fromArray(item), E.array(item)); -} -exports.fromArray = fromArray; -/** - * @category combinators - * @since 2.2.3 - */ -function array(item) { - return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)(fromArray(item))); -} -exports.array = array; -/** - * @category combinators - * @since 2.2.3 - */ -function fromRecord(codomain) { - return make(D.fromRecord(codomain), E.record(codomain)); -} -exports.fromRecord = fromRecord; -/** - * @category combinators - * @since 2.2.3 - */ -function record(codomain) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)(fromRecord(codomain))); -} -exports.record = record; -/** - * @category combinators - * @since 2.2.8 - */ -var fromTuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return make(D.fromTuple.apply(D, components), E.tuple.apply(E, components)); -}; -exports.fromTuple = fromTuple; -/** - * @category combinators - * @since 2.2.3 - */ -function tuple() { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)(exports.fromTuple.apply(void 0, components))); -} -exports.tuple = tuple; -/** - * @category combinators - * @since 2.2.3 - */ -var intersect = function (right) { - var intersectD = D.intersect(right); - var intersectE = E.intersect(right); - return function (left) { return make(intersectD(left), intersectE(left)); }; -}; -exports.intersect = intersect; -/** - * @category combinators - * @since 2.2.8 - */ -var fromSum = function (tag) { - var decoder = D.fromSum(tag); - var encoder = E.sum(tag); - return function (members) { return make(decoder(members), encoder(members)); }; -}; -exports.fromSum = fromSum; -/** - * @category combinators - * @since 2.2.3 - */ -function sum(tag) { - var sum = (0, exports.fromSum)(tag); - return function (members) { return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)(sum(members))); }; -} -exports.sum = sum; -/** - * @category combinators - * @since 2.2.3 - */ -function lazy(id, f) { - return make(D.lazy(id, f), E.lazy(f)); -} -exports.lazy = lazy; -/** - * @category combinators - * @since 2.2.16 - */ -exports.readonly = function_1.identity; -/** - * @category combinators - * @since 2.2.8 - */ -var compose = function (to) { - return function (from) { - return make(D.compose(to)(from), E.compose(from)(to)); - }; -}; -exports.compose = compose; -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- -var imap_ = function (fa, f, g) { return make(D.Functor.map(fa, f), E.Contravariant.contramap(fa, g)); }; -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- -/** - * @category Invariant - * @since 2.2.3 - */ -var imap = function (f, g) { return function (fa) { - return imap_(fa, f, g); -}; }; -exports.imap = imap; -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.3 - */ -exports.URI = 'io-ts/Codec'; -/** - * @category instances - * @since 2.2.8 - */ -exports.Invariant = { - URI: exports.URI, - imap: imap_ -}; diff --git a/components/pexels/node_modules/io-ts/lib/DecodeError.d.ts b/components/pexels/node_modules/io-ts/lib/DecodeError.d.ts deleted file mode 100644 index 501b7772c26b0..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/DecodeError.d.ts +++ /dev/null @@ -1,135 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Semigroup } from 'fp-ts/lib/Semigroup' -import * as FS from './FreeSemigroup' -/** - * @category model - * @since 2.2.7 - */ -export interface Leaf { - readonly _tag: 'Leaf' - readonly actual: unknown - readonly error: E -} -/** - * @category model - * @since 2.2.7 - */ -export declare const required: 'required' -/** - * @category model - * @since 2.2.7 - */ -export declare const optional: 'optional' -/** - * @category model - * @since 2.2.7 - */ -export type Kind = 'required' | 'optional' -/** - * @category model - * @since 2.2.7 - */ -export interface Key { - readonly _tag: 'Key' - readonly key: string - readonly kind: Kind - readonly errors: FS.FreeSemigroup> -} -/** - * @category model - * @since 2.2.7 - */ -export interface Index { - readonly _tag: 'Index' - readonly index: number - readonly kind: Kind - readonly errors: FS.FreeSemigroup> -} -/** - * @category model - * @since 2.2.7 - */ -export interface Member { - readonly _tag: 'Member' - readonly index: number - readonly errors: FS.FreeSemigroup> -} -/** - * @category model - * @since 2.2.7 - */ -export interface Lazy { - readonly _tag: 'Lazy' - readonly id: string - readonly errors: FS.FreeSemigroup> -} -/** - * @category model - * @since 2.2.9 - */ -export interface Wrap { - readonly _tag: 'Wrap' - readonly error: E - readonly errors: FS.FreeSemigroup> -} -/** - * @category model - * @since 2.2.7 - */ -export type DecodeError = Leaf | Key | Index | Member | Lazy | Wrap -/** - * @category constructors - * @since 2.2.7 - */ -export declare const leaf: (actual: unknown, error: E) => DecodeError -/** - * @category constructors - * @since 2.2.7 - */ -export declare const key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => DecodeError -/** - * @category constructors - * @since 2.2.7 - */ -export declare const index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => DecodeError -/** - * @category constructors - * @since 2.2.7 - */ -export declare const member: (index: number, errors: FS.FreeSemigroup>) => DecodeError -/** - * @category constructors - * @since 2.2.7 - */ -export declare const lazy: (id: string, errors: FS.FreeSemigroup>) => DecodeError -/** - * @category constructors - * @since 2.2.9 - */ -export declare const wrap: (error: E, errors: FS.FreeSemigroup>) => DecodeError -/** - * @category destructors - * @since 2.2.7 - */ -export declare const fold: (patterns: { - Leaf: (input: unknown, error: E) => R - Key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => R - Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R - Member: (index: number, errors: FS.FreeSemigroup>) => R - Lazy: (id: string, errors: FS.FreeSemigroup>) => R - Wrap: (error: E, errors: FS.FreeSemigroup>) => R -}) => (e: DecodeError) => R -/** - * @category instances - * @since 2.2.7 - */ -export declare function getSemigroup(): Semigroup>> diff --git a/components/pexels/node_modules/io-ts/lib/DecodeError.js b/components/pexels/node_modules/io-ts/lib/DecodeError.js deleted file mode 100644 index 7f89f09eb06d0..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/DecodeError.js +++ /dev/null @@ -1,129 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getSemigroup = exports.fold = exports.wrap = exports.lazy = exports.member = exports.index = exports.key = exports.leaf = exports.optional = exports.required = void 0; -var FS = __importStar(require("./FreeSemigroup")); -/** - * @category model - * @since 2.2.7 - */ -// eslint-disable-next-line @typescript-eslint/prefer-as-const -exports.required = 'required'; -/** - * @category model - * @since 2.2.7 - */ -// eslint-disable-next-line @typescript-eslint/prefer-as-const -exports.optional = 'optional'; -/** - * @category constructors - * @since 2.2.7 - */ -var leaf = function (actual, error) { return ({ _tag: 'Leaf', actual: actual, error: error }); }; -exports.leaf = leaf; -/** - * @category constructors - * @since 2.2.7 - */ -var key = function (key, kind, errors) { return ({ - _tag: 'Key', - key: key, - kind: kind, - errors: errors -}); }; -exports.key = key; -/** - * @category constructors - * @since 2.2.7 - */ -var index = function (index, kind, errors) { return ({ - _tag: 'Index', - index: index, - kind: kind, - errors: errors -}); }; -exports.index = index; -/** - * @category constructors - * @since 2.2.7 - */ -var member = function (index, errors) { return ({ - _tag: 'Member', - index: index, - errors: errors -}); }; -exports.member = member; -/** - * @category constructors - * @since 2.2.7 - */ -var lazy = function (id, errors) { return ({ - _tag: 'Lazy', - id: id, - errors: errors -}); }; -exports.lazy = lazy; -/** - * @category constructors - * @since 2.2.9 - */ -var wrap = function (error, errors) { return ({ - _tag: 'Wrap', - error: error, - errors: errors -}); }; -exports.wrap = wrap; -/** - * @category destructors - * @since 2.2.7 - */ -var fold = function (patterns) { - var f = function (e) { - switch (e._tag) { - case 'Leaf': - return patterns.Leaf(e.actual, e.error); - case 'Key': - return patterns.Key(e.key, e.kind, e.errors); - case 'Index': - return patterns.Index(e.index, e.kind, e.errors); - case 'Member': - return patterns.Member(e.index, e.errors); - case 'Lazy': - return patterns.Lazy(e.id, e.errors); - case 'Wrap': - return patterns.Wrap(e.error, e.errors); - } - }; - return f; -}; -exports.fold = fold; -/** - * @category instances - * @since 2.2.7 - */ -function getSemigroup() { - return FS.getSemigroup(); -} -exports.getSemigroup = getSemigroup; diff --git a/components/pexels/node_modules/io-ts/lib/Decoder.d.ts b/components/pexels/node_modules/io-ts/lib/Decoder.d.ts deleted file mode 100644 index 1c4e68c0f3c13..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Decoder.d.ts +++ /dev/null @@ -1,331 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Alt2 } from 'fp-ts/lib/Alt' -import { Category2 } from 'fp-ts/lib/Category' -import * as E from 'fp-ts/lib/Either' -import { Refinement } from 'fp-ts/lib/function' -import { Functor2 } from 'fp-ts/lib/Functor' -import * as DE from './DecodeError' -import * as FS from './FreeSemigroup' -import * as G from './Guard' -import * as K from './Kleisli' -import * as S from './Schemable' -/** - * @category model - * @since 2.2.8 - */ -export interface Decoder extends K.Kleisli {} -/** - * @category DecodeError - * @since 2.2.7 - */ -export type DecodeError = FS.FreeSemigroup> -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const error: (actual: unknown, message: string) => DecodeError -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const success: (a: A) => E.Either -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const failure: (actual: unknown, message: string) => E.Either -/** - * @category constructors - * @since 2.2.8 - */ -export declare const fromRefinement: (refinement: Refinement, expected: string) => Decoder -/** - * @category constructors - * @since 2.2.8 - */ -export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder -/** - * @category constructors - * @since 2.2.7 - */ -export declare const literal: ], L extends S.Literal = S.Literal>( - ...values: A -) => Decoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const string: Decoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const number: Decoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const boolean: Decoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const UnknownArray: Decoder> -/** - * @category primitives - * @since 2.2.7 - */ -export declare const UnknownRecord: Decoder> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const mapLeftWithInput: ( - f: (input: I, e: DecodeError) => DecodeError -) => (decoder: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.9 - */ -export declare const withMessage: ( - message: (input: I, e: DecodeError) => string -) => (decoder: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const refine: ( - refinement: Refinement, - id: string -) => (from: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const parse: ( - parser: (a: A) => E.Either -) => (from: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const nullable: (or: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.15 - */ -export declare const fromStruct:

>>( - properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -export declare const fromType:

>>( - properties: P -) => Decoder<{ [K in keyof P]: K.InputOf<'Either', P[K]> }, { [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> -/** - * @category combinators - * @since 2.2.15 - */ -export declare const struct: (properties: { [K in keyof A]: Decoder }) => Decoder< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -export declare const type: (properties: { [K in keyof A]: Decoder }) => Decoder< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromPartial:

>>( - properties: P -) => Decoder< - Partial<{ [K in keyof P]: K.InputOf<'Either', P[K]> }>, - Partial<{ [K_1 in keyof P]: K.TypeOf<'Either', P[K_1]> }> -> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const partial: (properties: { [K in keyof A]: Decoder }) => Decoder< - unknown, - Partial<{ [K_1 in keyof A]: A[K_1] }> -> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromArray: (item: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const array: (item: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromRecord: (codomain: Decoder) => Decoder, Record> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const record: (codomain: Decoder) => Decoder> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromTuple: []>( - ...components: C -) => Decoder<{ [K in keyof C]: K.InputOf<'Either', C[K]> }, { [K_1 in keyof C]: K.TypeOf<'Either', C[K_1]> }> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const tuple: ( - ...components: { [K in keyof A]: Decoder } -) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const union: , ...Array>]>( - ...members: MS -) => Decoder, TypeOf> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const intersect: ( - right: Decoder -) => (left: Decoder) => Decoder -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromSum: ( - tag: T -) => >>( - members: MS -) => Decoder, K.TypeOf<'Either', MS[keyof MS]>> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: Decoder> }) => Decoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const lazy: (id: string, f: () => Decoder) => Decoder -/** - * @category combinators - * @since 2.2.15 - */ -export declare const readonly: (decoder: Decoder) => Decoder> -/** - * @category Functor - * @since 2.2.7 - */ -export declare const map: (f: (a: A) => B) => (fa: Decoder) => Decoder -/** - * @category Alt - * @since 2.2.7 - */ -export declare const alt: (that: () => Decoder) => (me: Decoder) => Decoder -/** - * @category Semigroupoid - * @since 2.2.8 - */ -export declare const compose: (to: Decoder) => (from: Decoder) => Decoder -/** - * @category Category - * @since 2.2.8 - */ -export declare const id: () => Decoder -/** - * @category instances - * @since 2.2.7 - */ -export declare const URI = 'io-ts/Decoder' -/** - * @category instances - * @since 2.2.7 - */ -export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { - interface URItoKind2 { - readonly [URI]: Decoder - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Functor: Functor2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Alt: Alt2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Category: Category2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Schemable: S.Schemable2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnknownContainers: S.WithUnknownContainers2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnion: S.WithUnion2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithRefine: S.WithRefine2C -/** - * @since 2.2.8 - */ -export type InputOf = K.InputOf -/** - * @since 2.2.7 - */ -export type TypeOf = K.TypeOf -/** - * @since 2.2.7 - */ -export declare const draw: (e: DecodeError) => string diff --git a/components/pexels/node_modules/io-ts/lib/Decoder.js b/components/pexels/node_modules/io-ts/lib/Decoder.js deleted file mode 100644 index f44649a3af609..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Decoder.js +++ /dev/null @@ -1,523 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.stringify = exports.draw = exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.Category = exports.Alt = exports.Functor = exports.URI = exports.id = exports.compose = exports.alt = exports.map = exports.readonly = exports.lazy = exports.sum = exports.fromSum = exports.intersect = exports.union = exports.tuple = exports.fromTuple = exports.record = exports.fromRecord = exports.array = exports.fromArray = exports.partial = exports.fromPartial = exports.type = exports.struct = exports.fromType = exports.fromStruct = exports.nullable = exports.parse = exports.refine = exports.withMessage = exports.mapLeftWithInput = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = exports.fromGuard = exports.fromRefinement = exports.failure = exports.success = exports.error = exports.ap = exports.SE = void 0; -var E = __importStar(require("fp-ts/lib/Either")); -var function_1 = require("fp-ts/lib/function"); -var pipeable_1 = require("fp-ts/lib/pipeable"); -var DE = __importStar(require("./DecodeError")); -var FS = __importStar(require("./FreeSemigroup")); -var G = __importStar(require("./Guard")); -var K = __importStar(require("./Kleisli")); -// ------------------------------------------------------------------------------------- -// Kleisli config -// ------------------------------------------------------------------------------------- -/** - * @internal - */ -exports.SE = -/*#__PURE__*/ -DE.getSemigroup(); -/** - * @internal - */ -var ap = function (fab, fa) { - return E.isLeft(fab) - ? E.isLeft(fa) - ? E.left(exports.SE.concat(fab.left, fa.left)) - : fab - : E.isLeft(fa) - ? fa - : E.right(fab.right(fa.right)); -}; -exports.ap = ap; -var M = { - URI: E.URI, - _E: undefined, - map: function (fa, f) { return (0, pipeable_1.pipe)(fa, E.map(f)); }, - ap: exports.ap, - of: E.right, - chain: function (ma, f) { return (0, pipeable_1.pipe)(ma, E.chain(f)); }, - throwError: E.left, - bimap: function (fa, f, g) { return (0, pipeable_1.pipe)(fa, E.bimap(f, g)); }, - mapLeft: function (fa, f) { return (0, pipeable_1.pipe)(fa, E.mapLeft(f)); }, - alt: function (me, that) { - if (E.isRight(me)) { - return me; - } - var ea = that(); - return E.isLeft(ea) ? E.left(exports.SE.concat(me.left, ea.left)) : ea; - } -}; -/** - * @category DecodeError - * @since 2.2.7 - */ -var error = function (actual, message) { return FS.of(DE.leaf(actual, message)); }; -exports.error = error; -/** - * @category DecodeError - * @since 2.2.7 - */ -exports.success = E.right; -/** - * @category DecodeError - * @since 2.2.7 - */ -var failure = function (actual, message) { - return E.left((0, exports.error)(actual, message)); -}; -exports.failure = failure; -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.8 - */ -var fromRefinement = function (refinement, expected) { - return K.fromRefinement(M)(refinement, function (u) { return (0, exports.error)(u, expected); }); -}; -exports.fromRefinement = fromRefinement; -/** - * @category constructors - * @since 2.2.8 - */ -var fromGuard = function (guard, expected) { - return (0, exports.fromRefinement)(guard.is, expected); -}; -exports.fromGuard = fromGuard; -/** - * @category constructors - * @since 2.2.7 - */ -exports.literal = -/*#__PURE__*/ -K.literal(M)(function (u, values) { return (0, exports.error)(u, values.map(function (value) { return JSON.stringify(value); }).join(' | ')); }); -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.7 - */ -exports.string = -/*#__PURE__*/ -(0, exports.fromGuard)(G.string, 'string'); -/** - * @category primitives - * @since 2.2.7 - */ -exports.number = -/*#__PURE__*/ -(0, exports.fromGuard)(G.number, 'number'); -/** - * @category primitives - * @since 2.2.7 - */ -exports.boolean = -/*#__PURE__*/ -(0, exports.fromGuard)(G.boolean, 'boolean'); -/** - * @category primitives - * @since 2.2.7 - */ -exports.UnknownArray = -/*#__PURE__*/ -(0, exports.fromGuard)(G.UnknownArray, 'Array'); -/** - * @category primitives - * @since 2.2.7 - */ -exports.UnknownRecord = -/*#__PURE__*/ -(0, exports.fromGuard)(G.UnknownRecord, 'Record'); -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.7 - */ -exports.mapLeftWithInput = -/*#__PURE__*/ -K.mapLeftWithInput(M); -/** - * @category combinators - * @since 2.2.9 - */ -var withMessage = function (message) { - return (0, exports.mapLeftWithInput)(function (input, e) { return FS.of(DE.wrap(message(input, e), e)); }); -}; -exports.withMessage = withMessage; -/** - * @category combinators - * @since 2.2.7 - */ -var refine = function (refinement, id) { return K.refine(M)(refinement, function (a) { return (0, exports.error)(a, id); }); }; -exports.refine = refine; -/** - * @category combinators - * @since 2.2.7 - */ -exports.parse = -/*#__PURE__*/ -K.parse(M); -/** - * @category combinators - * @since 2.2.7 - */ -exports.nullable = -/*#__PURE__*/ -K.nullable(M)(function (u, e) { return FS.concat(FS.of(DE.member(0, (0, exports.error)(u, 'null'))), FS.of(DE.member(1, e))); }); -/** - * @category combinators - * @since 2.2.15 - */ -var fromStruct = function (properties) { - return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); -}; -exports.fromStruct = fromStruct; -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -exports.fromType = exports.fromStruct; -/** - * @category combinators - * @since 2.2.15 - */ -var struct = function (properties) { return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromStruct)(properties))); }; -exports.struct = struct; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -exports.type = exports.struct; -/** - * @category combinators - * @since 2.2.8 - */ -var fromPartial = function (properties) { - return K.fromPartial(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(properties); -}; -exports.fromPartial = fromPartial; -/** - * @category combinators - * @since 2.2.7 - */ -var partial = function (properties) { return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromPartial)(properties))); }; -exports.partial = partial; -/** - * @category combinators - * @since 2.2.8 - */ -var fromArray = function (item) { - return K.fromArray(M)(function (i, e) { return FS.of(DE.index(i, DE.optional, e)); })(item); -}; -exports.fromArray = fromArray; -/** - * @category combinators - * @since 2.2.7 - */ -var array = function (item) { - return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)((0, exports.fromArray)(item))); -}; -exports.array = array; -/** - * @category combinators - * @since 2.2.8 - */ -var fromRecord = function (codomain) { - return K.fromRecord(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(codomain); -}; -exports.fromRecord = fromRecord; -/** - * @category combinators - * @since 2.2.7 - */ -var record = function (codomain) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromRecord)(codomain))); -}; -exports.record = record; -/** - * @category combinators - * @since 2.2.8 - */ -var fromTuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return K.fromTuple(M)(function (i, e) { return FS.of(DE.index(i, DE.required, e)); }).apply(void 0, components); -}; -exports.fromTuple = fromTuple; -/** - * @category combinators - * @since 2.2.7 - */ -var tuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)(exports.fromTuple.apply(void 0, components))); -}; -exports.tuple = tuple; -/** - * @category combinators - * @since 2.2.7 - */ -exports.union = -/*#__PURE__*/ -K.union(M)(function (i, e) { return FS.of(DE.member(i, e)); }); -/** - * @category combinators - * @since 2.2.7 - */ -exports.intersect = -/*#__PURE__*/ -K.intersect(M); -/** - * @category combinators - * @since 2.2.8 - */ -var fromSum = function (tag) { - return function (members) { - return K.fromSum(M)(function (tag, value, keys) { - return FS.of(DE.key(tag, DE.required, (0, exports.error)(value, keys.length === 0 ? 'never' : keys.map(function (k) { return JSON.stringify(k); }).join(' | ')))); - })(tag)(members); - }; -}; -exports.fromSum = fromSum; -/** - * @category combinators - * @since 2.2.7 - */ -var sum = function (tag) { - return function (members) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromSum)(tag)(members))); - }; -}; -exports.sum = sum; -/** - * @category combinators - * @since 2.2.7 - */ -exports.lazy = -/*#__PURE__*/ -K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); -/** - * @category combinators - * @since 2.2.15 - */ -exports.readonly = function_1.identity; -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- -var map_ = function (fa, f) { return (0, pipeable_1.pipe)(fa, (0, exports.map)(f)); }; -var alt_ = function (me, that) { return (0, pipeable_1.pipe)(me, (0, exports.alt)(that)); }; -var compose_ = function (ab, la) { return (0, pipeable_1.pipe)(la, (0, exports.compose)(ab)); }; -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- -/** - * @category Functor - * @since 2.2.7 - */ -exports.map = -/*#__PURE__*/ -K.map(M); -/** - * @category Alt - * @since 2.2.7 - */ -exports.alt = -/*#__PURE__*/ -K.alt(M); -/** - * @category Semigroupoid - * @since 2.2.8 - */ -exports.compose = -/*#__PURE__*/ -K.compose(M); -/** - * @category Category - * @since 2.2.8 - */ -exports.id = -/*#__PURE__*/ -K.id(M); -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.7 - */ -exports.URI = 'io-ts/Decoder'; -/** - * @category instances - * @since 2.2.8 - */ -exports.Functor = { - URI: exports.URI, - map: map_ -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.Alt = { - URI: exports.URI, - map: map_, - alt: alt_ -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.Category = { - URI: exports.URI, - compose: compose_, - id: exports.id -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.Schemable = { - URI: exports.URI, - literal: exports.literal, - string: exports.string, - number: exports.number, - boolean: exports.boolean, - nullable: exports.nullable, - type: exports.type, - struct: exports.struct, - partial: exports.partial, - record: exports.record, - array: exports.array, - tuple: exports.tuple, - intersect: exports.intersect, - sum: exports.sum, - lazy: exports.lazy, - readonly: exports.readonly -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithUnknownContainers = { - UnknownArray: exports.UnknownArray, - UnknownRecord: exports.UnknownRecord -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithUnion = { - union: exports.union -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithRefine = { - refine: exports.refine -}; -var empty = []; -var make = function (value, forest) { - if (forest === void 0) { forest = empty; } - return ({ - value: value, - forest: forest - }); -}; -var drawTree = function (tree) { return tree.value + drawForest('\n', tree.forest); }; -var drawForest = function (indentation, forest) { - var r = ''; - var len = forest.length; - var tree; - for (var i = 0; i < len; i++) { - tree = forest[i]; - var isLast = i === len - 1; - r += indentation + (isLast ? '└' : '├') + '─ ' + tree.value; - r += drawForest(indentation + (len > 1 && !isLast ? '│ ' : ' '), tree.forest); - } - return r; -}; -var toTree = DE.fold({ - Leaf: function (input, error) { return make("cannot decode ".concat(JSON.stringify(input), ", should be ").concat(error)); }, - Key: function (key, kind, errors) { return make("".concat(kind, " property ").concat(JSON.stringify(key)), toForest(errors)); }, - Index: function (index, kind, errors) { return make("".concat(kind, " index ").concat(index), toForest(errors)); }, - Member: function (index, errors) { return make("member ".concat(index), toForest(errors)); }, - Lazy: function (id, errors) { return make("lazy type ".concat(id), toForest(errors)); }, - Wrap: function (error, errors) { return make(error, toForest(errors)); } -}); -var toForest = function (e) { - var stack = []; - var focus = e; - var res = []; - // eslint-disable-next-line no-constant-condition - while (true) { - switch (focus._tag) { - case 'Of': - { - res.push(toTree(focus.value)); - var tmp = stack.pop(); - if (tmp === undefined) { - return res; - } - else { - focus = tmp; - } - } - break; - case 'Concat': - stack.push(focus.right); - focus = focus.left; - break; - } - } -}; -/** - * @since 2.2.7 - */ -var draw = function (e) { return toForest(e).map(drawTree).join('\n'); }; -exports.draw = draw; -/** - * @internal - */ -exports.stringify = -/*#__PURE__*/ -E.fold(exports.draw, function (a) { return JSON.stringify(a, null, 2); }); diff --git a/components/pexels/node_modules/io-ts/lib/Encoder.d.ts b/components/pexels/node_modules/io-ts/lib/Encoder.d.ts deleted file mode 100644 index beef93d6405f7..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Encoder.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.3 - */ -import { Category2 } from 'fp-ts/lib/Category' -import { Contravariant2 } from 'fp-ts/lib/Contravariant' -/** - * @category model - * @since 2.2.3 - */ -export interface Encoder { - readonly encode: (a: A) => O -} -/** - * @category combinators - * @since 2.2.3 - */ -export declare function nullable(or: Encoder): Encoder -/** - * @category combinators - * @since 2.2.15 - */ -export declare function struct

>>( - properties: P -): Encoder< - { - [K in keyof P]: OutputOf - }, - { - [K in keyof P]: TypeOf - } -> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -export declare const type: typeof struct -/** - * @category combinators - * @since 2.2.3 - */ -export declare function partial

>>( - properties: P -): Encoder< - Partial<{ - [K in keyof P]: OutputOf - }>, - Partial<{ - [K in keyof P]: TypeOf - }> -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function record(codomain: Encoder): Encoder, Record> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function array(item: Encoder): Encoder, Array> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function tuple>>( - ...components: C -): Encoder< - { - [K in keyof C]: OutputOf - }, - { - [K in keyof C]: TypeOf - } -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const intersect: (right: Encoder) => (left: Encoder) => Encoder -/** - * @category combinators - * @since 2.2.3 - */ -export declare function sum( - tag: T -): >>(members: MS) => Encoder, TypeOf> -/** - * @category combinators - * @since 2.2.3 - */ -export declare function lazy(f: () => Encoder): Encoder -/** - * @category combinators - * @since 2.2.16 - */ -export declare const readonly: (decoder: Encoder) => Encoder> -/** - * @category Contravariant - * @since 2.2.3 - */ -export declare const contramap: (f: (b: B) => A) => (fa: Encoder) => Encoder -/** - * @category Semigroupoid - * @since 2.2.3 - */ -export declare const compose: (ea: Encoder) => (ab: Encoder) => Encoder -/** - * @category Category - * @since 2.2.3 - */ -export declare function id(): Encoder -/** - * @category instances - * @since 2.2.3 - */ -export declare const URI = 'io-ts/Encoder' -/** - * @category instances - * @since 2.2.3 - */ -export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { - interface URItoKind2 { - readonly [URI]: Encoder - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Contravariant: Contravariant2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Category: Category2 -/** - * @since 2.2.3 - */ -export type TypeOf = E extends Encoder ? A : never -/** - * @since 2.2.3 - */ -export type OutputOf = E extends Encoder ? O : never diff --git a/components/pexels/node_modules/io-ts/lib/Encoder.js b/components/pexels/node_modules/io-ts/lib/Encoder.js deleted file mode 100644 index d6fcefae1113c..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Encoder.js +++ /dev/null @@ -1,202 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Category = exports.Contravariant = exports.URI = exports.id = exports.compose = exports.contramap = exports.readonly = exports.lazy = exports.sum = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.struct = exports.nullable = void 0; -var function_1 = require("fp-ts/lib/function"); -var Schemable_1 = require("./Schemable"); -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.3 - */ -function nullable(or) { - return { - encode: function (a) { return (a === null ? null : or.encode(a)); } - }; -} -exports.nullable = nullable; -/** - * @category combinators - * @since 2.2.15 - */ -function struct(properties) { - return { - encode: function (a) { - var o = {}; - for (var k in properties) { - o[k] = properties[k].encode(a[k]); - } - return o; - } - }; -} -exports.struct = struct; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -exports.type = struct; -/** - * @category combinators - * @since 2.2.3 - */ -function partial(properties) { - return { - encode: function (a) { - var o = {}; - for (var k in properties) { - var v = a[k]; - // don't add missing properties - if (k in a) { - // don't strip undefined properties - o[k] = v === undefined ? undefined : properties[k].encode(v); - } - } - return o; - } - }; -} -exports.partial = partial; -/** - * @category combinators - * @since 2.2.3 - */ -function record(codomain) { - return { - encode: function (r) { - var o = {}; - for (var k in r) { - o[k] = codomain.encode(r[k]); - } - return o; - } - }; -} -exports.record = record; -/** - * @category combinators - * @since 2.2.3 - */ -function array(item) { - return { - encode: function (as) { return as.map(item.encode); } - }; -} -exports.array = array; -/** - * @category combinators - * @since 2.2.3 - */ -function tuple() { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return { - encode: function (as) { return components.map(function (c, i) { return c.encode(as[i]); }); } - }; -} -exports.tuple = tuple; -/** - * @category combinators - * @since 2.2.3 - */ -var intersect = function (right) { - return function (left) { return ({ - encode: function (ab) { return (0, Schemable_1.intersect_)(left.encode(ab), right.encode(ab)); } - }); }; -}; -exports.intersect = intersect; -/** - * @category combinators - * @since 2.2.3 - */ -function sum(tag) { - return function (members) { - return { - encode: function (a) { return members[a[tag]].encode(a); } - }; - }; -} -exports.sum = sum; -/** - * @category combinators - * @since 2.2.3 - */ -function lazy(f) { - var get = (0, Schemable_1.memoize)(f); - return { - encode: function (a) { return get().encode(a); } - }; -} -exports.lazy = lazy; -/** - * @category combinators - * @since 2.2.16 - */ -exports.readonly = function_1.identity; -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- -var contramap_ = function (ea, f) { return ({ - encode: function (b) { return ea.encode(f(b)); } -}); }; -var compose_ = function (ab, ea) { return contramap_(ea, ab.encode); }; -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- -/** - * @category Contravariant - * @since 2.2.3 - */ -var contramap = function (f) { return function (fa) { - return contramap_(fa, f); -}; }; -exports.contramap = contramap; -/** - * @category Semigroupoid - * @since 2.2.3 - */ -var compose = function (ea) { return function (ab) { - return compose_(ab, ea); -}; }; -exports.compose = compose; -/** - * @category Category - * @since 2.2.3 - */ -function id() { - return { - encode: function_1.identity - }; -} -exports.id = id; -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.3 - */ -exports.URI = 'io-ts/Encoder'; -/** - * @category instances - * @since 2.2.8 - */ -exports.Contravariant = { - URI: exports.URI, - contramap: contramap_ -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.Category = { - URI: exports.URI, - compose: compose_, - id: id -}; diff --git a/components/pexels/node_modules/io-ts/lib/Eq.d.ts b/components/pexels/node_modules/io-ts/lib/Eq.d.ts deleted file mode 100644 index a57e29cefcf36..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Eq.d.ts +++ /dev/null @@ -1,127 +0,0 @@ -import * as E from 'fp-ts/lib/Eq' -import { Schemable1, WithRefine1, WithUnknownContainers1 } from './Schemable' -import Eq = E.Eq -/** - * @since 2.2.3 - */ -export type URI = E.URI -/** - * @since 2.2.2 - */ -export type TypeOf = E extends Eq ? A : never -/** - * @category primitives - * @since 2.2.2 - */ -export declare const string: Eq -/** - * @category primitives - * @since 2.2.2 - */ -export declare const number: Eq -/** - * @category primitives - * @since 2.2.2 - */ -export declare const boolean: Eq -/** - * @category primitives - * @since 2.2.2 - */ -export declare const UnknownArray: Eq> -/** - * @category primitives - * @since 2.2.2 - */ -export declare const UnknownRecord: Eq> -/** - * @category combinators - * @since 2.2.2 - */ -export declare function nullable(or: Eq): Eq -/** - * @category combinators - * @since 2.2.15 - */ -export declare const struct: (eqs: { - [K in keyof A]: Eq -}) => Eq<{ - [K in keyof A]: A[K] -}> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.2 - * @deprecated - */ -export declare const type: (eqs: { [K in keyof A]: E.Eq }) => E.Eq<{ [K_1 in keyof A]: A[K_1] }> -/** - * @category combinators - * @since 2.2.2 - */ -export declare function partial(properties: { - [K in keyof A]: Eq -}): Eq< - Partial<{ - [K in keyof A]: A[K] - }> -> -/** - * @category combinators - * @since 2.2.2 - */ -export declare const record: (codomain: Eq) => Eq> -/** - * @category combinators - * @since 2.2.2 - */ -export declare const array: (eq: Eq) => Eq> -/** - * @category combinators - * @since 2.2.2 - */ -export declare const tuple: >( - ...components: { - [K in keyof A]: Eq - } -) => Eq -/** - * @category combinators - * @since 2.2.2 - */ -export declare const intersect: (right: E.Eq) => (left: E.Eq) => E.Eq -/** - * @category combinators - * @since 2.2.2 - */ -export declare function sum( - tag: T -): (members: { - [K in keyof A]: Eq> -}) => Eq -/** - * @category combinators - * @since 2.2.2 - */ -export declare function lazy(f: () => Eq): Eq -/** - * @category combinators - * @since 2.2.15 - */ -export declare const readonly: (eq: Eq) => Eq> -/** - * @category instances - * @since 2.2.8 - */ -export declare const Schemable: Schemable1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnknownContainers: WithUnknownContainers1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithRefine: WithRefine1 diff --git a/components/pexels/node_modules/io-ts/lib/Eq.js b/components/pexels/node_modules/io-ts/lib/Eq.js deleted file mode 100644 index 857a61b742a5c..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Eq.js +++ /dev/null @@ -1,226 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WithRefine = exports.WithUnknownContainers = exports.Schemable = exports.readonly = exports.lazy = exports.sum = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.struct = exports.nullable = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = void 0; -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.2 - */ -var A = __importStar(require("fp-ts/lib/Array")); -var E = __importStar(require("fp-ts/lib/Eq")); -var function_1 = require("fp-ts/lib/function"); -var R = __importStar(require("fp-ts/lib/Record")); -var Schemable_1 = require("./Schemable"); -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.2 - */ -exports.string = E.eqString; -/** - * @category primitives - * @since 2.2.2 - */ -exports.number = E.eqNumber; -/** - * @category primitives - * @since 2.2.2 - */ -exports.boolean = E.eqBoolean; -/** - * @category primitives - * @since 2.2.2 - */ -exports.UnknownArray = E.fromEquals(function (x, y) { return x.length === y.length; }); -/** - * @category primitives - * @since 2.2.2 - */ -exports.UnknownRecord = E.fromEquals(function (x, y) { - for (var k in x) { - if (!(k in y)) { - return false; - } - } - for (var k in y) { - if (!(k in x)) { - return false; - } - } - return true; -}); -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.2 - */ -function nullable(or) { - return { - equals: function (x, y) { return (x === null || y === null ? x === y : or.equals(x, y)); } - }; -} -exports.nullable = nullable; -/** - * @category combinators - * @since 2.2.15 - */ -exports.struct = E.getStructEq; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.2 - * @deprecated - */ -exports.type = exports.struct; -/** - * @category combinators - * @since 2.2.2 - */ -function partial(properties) { - return { - equals: function (x, y) { - for (var k in properties) { - var xk = x[k]; - var yk = y[k]; - if (!(xk === undefined || yk === undefined ? xk === yk : properties[k].equals(xk, yk))) { - return false; - } - } - return true; - } - }; -} -exports.partial = partial; -/** - * @category combinators - * @since 2.2.2 - */ -exports.record = R.getEq; -/** - * @category combinators - * @since 2.2.2 - */ -exports.array = A.getEq; -/** - * @category combinators - * @since 2.2.2 - */ -exports.tuple = E.getTupleEq; -/** - * @category combinators - * @since 2.2.2 - */ -var intersect = function (right) { - return function (left) { return ({ - equals: function (x, y) { return left.equals(x, y) && right.equals(x, y); } - }); }; -}; -exports.intersect = intersect; -/** - * @category combinators - * @since 2.2.2 - */ -function sum(tag) { - return function (members) { - return { - equals: function (x, y) { - var vx = x[tag]; - var vy = y[tag]; - if (vx !== vy) { - return false; - } - return members[vx].equals(x, y); - } - }; - }; -} -exports.sum = sum; -/** - * @category combinators - * @since 2.2.2 - */ -function lazy(f) { - var get = (0, Schemable_1.memoize)(f); - return { - equals: function (x, y) { return get().equals(x, y); } - }; -} -exports.lazy = lazy; -/** - * @category combinators - * @since 2.2.15 - */ -exports.readonly = function_1.identity; -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.8 - */ -exports.Schemable = { - URI: E.URI, - literal: function () { return E.eqStrict; }, - string: exports.string, - number: exports.number, - boolean: exports.boolean, - nullable: nullable, - type: exports.type, - struct: exports.struct, - partial: partial, - record: exports.record, - array: exports.array, - tuple: exports.tuple, - intersect: exports.intersect, - sum: sum, - lazy: function (_, f) { return lazy(f); }, - readonly: exports.readonly -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithUnknownContainers = { - UnknownArray: exports.UnknownArray, - UnknownRecord: exports.UnknownRecord -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithRefine = { - refine: function () { return function (from) { return from; }; } -}; diff --git a/components/pexels/node_modules/io-ts/lib/FreeSemigroup.d.ts b/components/pexels/node_modules/io-ts/lib/FreeSemigroup.d.ts deleted file mode 100644 index 4054a4ea6dfc0..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/FreeSemigroup.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Semigroup } from 'fp-ts/lib/Semigroup' -/** - * @category model - * @since 2.2.7 - */ -export interface Of { - readonly _tag: 'Of' - readonly value: A -} -/** - * @category model - * @since 2.2.7 - */ -export interface Concat { - readonly _tag: 'Concat' - readonly left: FreeSemigroup - readonly right: FreeSemigroup -} -/** - * @category model - * @since 2.2.7 - */ -export type FreeSemigroup = Of | Concat -/** - * @category constructors - * @since 2.2.7 - */ -export declare const of: (a: A) => FreeSemigroup -/** - * @category constructors - * @since 2.2.7 - */ -export declare const concat: (left: FreeSemigroup, right: FreeSemigroup) => FreeSemigroup -/** - * @category destructors - * @since 2.2.7 - */ -export declare const fold: ( - onOf: (value: A) => R, - onConcat: (left: FreeSemigroup, right: FreeSemigroup) => R -) => (f: FreeSemigroup) => R -/** - * @category instances - * @since 2.2.7 - */ -export declare function getSemigroup(): Semigroup> diff --git a/components/pexels/node_modules/io-ts/lib/FreeSemigroup.js b/components/pexels/node_modules/io-ts/lib/FreeSemigroup.js deleted file mode 100644 index 03a437c8fc291..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/FreeSemigroup.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getSemigroup = exports.fold = exports.concat = exports.of = void 0; -/** - * @category constructors - * @since 2.2.7 - */ -var of = function (a) { return ({ _tag: 'Of', value: a }); }; -exports.of = of; -/** - * @category constructors - * @since 2.2.7 - */ -var concat = function (left, right) { return ({ - _tag: 'Concat', - left: left, - right: right -}); }; -exports.concat = concat; -/** - * @category destructors - * @since 2.2.7 - */ -var fold = function (onOf, onConcat) { - return function (f) { - switch (f._tag) { - case 'Of': - return onOf(f.value); - case 'Concat': - return onConcat(f.left, f.right); - } - }; -}; -exports.fold = fold; -/** - * @category instances - * @since 2.2.7 - */ -function getSemigroup() { - return { concat: exports.concat }; -} -exports.getSemigroup = getSemigroup; diff --git a/components/pexels/node_modules/io-ts/lib/Guard.d.ts b/components/pexels/node_modules/io-ts/lib/Guard.d.ts deleted file mode 100644 index b97e2fb8b11ca..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Guard.d.ts +++ /dev/null @@ -1,201 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.0 - */ -import { Refinement } from 'fp-ts/lib/function' -import * as S from './Schemable' -/** - * @category model - * @since 2.2.8 - */ -export interface Guard { - is: (i: I) => i is A -} -/** - * @since 2.2.2 - */ -export type TypeOf = G extends Guard ? A : never -/** - * @since 2.2.8 - */ -export type InputOf = G extends Guard ? I : never -/** - * @category constructors - * @since 2.2.0 - */ -export declare const literal: ( - ...values: A -) => Guard -/** - * @category primitives - * @since 2.2.0 - */ -export declare const string: Guard -/** - * Note: `NaN` is excluded. - * - * @category primitives - * @since 2.2.0 - */ -export declare const number: Guard -/** - * @category primitives - * @since 2.2.0 - */ -export declare const boolean: Guard -/** - * @category primitives - * @since 2.2.0 - */ -export declare const UnknownArray: Guard> -/** - * @category primitives - * @since 2.2.0 - */ -export declare const UnknownRecord: Guard> -/** - * @category combinators - * @since 2.2.0 - */ -export declare const refine: ( - refinement: Refinement -) => (from: Guard) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const nullable: (or: Guard) => Guard -/** - * @category combinators - * @since 2.2.15 - */ -export declare const struct: (properties: { [K in keyof A]: Guard }) => Guard< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.0 - * @deprecated - */ -export declare const type: (properties: { [K in keyof A]: Guard }) => Guard< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * @category combinators - * @since 2.2.0 - */ -export declare const partial: (properties: { [K in keyof A]: Guard }) => Guard< - unknown, - Partial<{ [K_1 in keyof A]: A[K_1] }> -> -/** - * @category combinators - * @since 2.2.0 - */ -export declare const array: (item: Guard) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const record: (codomain: Guard) => Guard> -/** - * @category combinators - * @since 2.2.0 - */ -export declare const tuple: ( - ...components: { [K in keyof A]: Guard } -) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const intersect: (right: Guard) => (left: Guard) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const union: ( - ...members: { [K in keyof A]: Guard } -) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: Guard> }) => Guard -/** - * @category combinators - * @since 2.2.0 - */ -export declare const lazy: (f: () => Guard) => Guard -/** - * @category combinators - * @since 2.2.15 - */ -export declare const readonly: (guard: Guard) => Guard> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const alt: (that: () => Guard) => (me: Guard) => Guard -/** - * @category combinators - * @since 2.2.8 - */ -export declare const zero: () => Guard -/** - * @category combinators - * @since 2.2.8 - */ -export declare const compose: (to: Guard) => (from: Guard) => Guard -/** - * @category combinators - * @since 2.2.8 - */ -export declare const id: () => Guard -/** - * @category instances - * @since 2.2.0 - */ -export declare const URI = 'io-ts/Guard' -/** - * @category instances - * @since 2.2.0 - */ -export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: Guard - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Schemable: S.Schemable1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnknownContainers: S.WithUnknownContainers1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnion: S.WithUnion1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithRefine: S.WithRefine1 diff --git a/components/pexels/node_modules/io-ts/lib/Guard.js b/components/pexels/node_modules/io-ts/lib/Guard.js deleted file mode 100644 index 7c41e7596dc43..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Guard.js +++ /dev/null @@ -1,337 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.URI = exports.id = exports.compose = exports.zero = exports.alt = exports.readonly = exports.lazy = exports.sum = exports.union = exports.intersect = exports.tuple = exports.record = exports.array = exports.partial = exports.type = exports.struct = exports.nullable = exports.refine = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = void 0; -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.0 - */ -var function_1 = require("fp-ts/lib/function"); -var pipeable_1 = require("fp-ts/lib/pipeable"); -var S = __importStar(require("./Schemable")); -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.0 - */ -var literal = function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return ({ - is: function (u) { return values.findIndex(function (a) { return a === u; }) !== -1; } - }); -}; -exports.literal = literal; -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.0 - */ -exports.string = { - is: function (u) { return typeof u === 'string'; } -}; -/** - * Note: `NaN` is excluded. - * - * @category primitives - * @since 2.2.0 - */ -exports.number = { - is: function (u) { return typeof u === 'number' && !isNaN(u); } -}; -/** - * @category primitives - * @since 2.2.0 - */ -exports.boolean = { - is: function (u) { return typeof u === 'boolean'; } -}; -/** - * @category primitives - * @since 2.2.0 - */ -exports.UnknownArray = { - is: Array.isArray -}; -/** - * @category primitives - * @since 2.2.0 - */ -exports.UnknownRecord = { - is: function (u) { return u !== null && typeof u === 'object' && !Array.isArray(u); } -}; -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.0 - */ -var refine = function (refinement) { - return function (from) { return ({ - is: function (i) { return from.is(i) && refinement(i); } - }); }; -}; -exports.refine = refine; -/** - * @category combinators - * @since 2.2.0 - */ -var nullable = function (or) { return ({ - is: function (i) { return i === null || or.is(i); } -}); }; -exports.nullable = nullable; -/** - * @category combinators - * @since 2.2.15 - */ -var struct = function (properties) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.refine)(function (r) { - for (var k in properties) { - if (!(k in r) || !properties[k].is(r[k])) { - return false; - } - } - return true; - })); -}; -exports.struct = struct; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.0 - * @deprecated - */ -exports.type = exports.struct; -/** - * @category combinators - * @since 2.2.0 - */ -var partial = function (properties) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.refine)(function (r) { - for (var k in properties) { - var v = r[k]; - if (v !== undefined && !properties[k].is(v)) { - return false; - } - } - return true; - })); -}; -exports.partial = partial; -/** - * @category combinators - * @since 2.2.0 - */ -var array = function (item) { - return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.refine)(function (us) { return us.every(item.is); })); -}; -exports.array = array; -/** - * @category combinators - * @since 2.2.0 - */ -var record = function (codomain) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.refine)(function (r) { - for (var k in r) { - if (!codomain.is(r[k])) { - return false; - } - } - return true; - })); -}; -exports.record = record; -/** - * @category combinators - * @since 2.2.0 - */ -var tuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return ({ - is: function (u) { return Array.isArray(u) && u.length === components.length && components.every(function (c, i) { return c.is(u[i]); }); } - }); -}; -exports.tuple = tuple; -/** - * @category combinators - * @since 2.2.0 - */ -var intersect = function (right) { - return function (left) { return ({ - is: function (u) { return left.is(u) && right.is(u); } - }); }; -}; -exports.intersect = intersect; -/** - * @category combinators - * @since 2.2.0 - */ -var union = function () { - var members = []; - for (var _i = 0; _i < arguments.length; _i++) { - members[_i] = arguments[_i]; - } - return ({ - is: function (u) { return members.some(function (m) { return m.is(u); }); } - }); -}; -exports.union = union; -/** - * @category combinators - * @since 2.2.0 - */ -var sum = function (tag) { - return function (members) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.refine)(function (r) { - var v = r[tag]; - if (v in members) { - return members[v].is(r); - } - return false; - })); - }; -}; -exports.sum = sum; -/** - * @category combinators - * @since 2.2.0 - */ -var lazy = function (f) { - var get = S.memoize(f); - return { - is: function (u) { return get().is(u); } - }; -}; -exports.lazy = lazy; -/** - * @category combinators - * @since 2.2.15 - */ -exports.readonly = function_1.identity; -/** - * @category combinators - * @since 2.2.8 - */ -var alt = function (that) { - return function (me) { return ({ - is: function (i) { return me.is(i) || that().is(i); } - }); }; -}; -exports.alt = alt; -/** - * @category combinators - * @since 2.2.8 - */ -var zero = function () { return ({ - is: function (_) { return false; } -}); }; -exports.zero = zero; -/** - * @category combinators - * @since 2.2.8 - */ -var compose = function (to) { - return function (from) { return ({ - is: function (i) { return from.is(i) && to.is(i); } - }); }; -}; -exports.compose = compose; -/** - * @category combinators - * @since 2.2.8 - */ -var id = function () { return ({ - is: function (_) { return true; } -}); }; -exports.id = id; -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.0 - */ -exports.URI = 'io-ts/Guard'; -/** - * @category instances - * @since 2.2.8 - */ -exports.Schemable = { - URI: exports.URI, - literal: exports.literal, - string: exports.string, - number: exports.number, - boolean: exports.boolean, - nullable: exports.nullable, - type: exports.type, - struct: exports.struct, - partial: exports.partial, - record: exports.record, - array: exports.array, - tuple: exports.tuple, - intersect: exports.intersect, - sum: exports.sum, - lazy: function (_, f) { return (0, exports.lazy)(f); }, - readonly: exports.readonly -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithUnknownContainers = { - UnknownArray: exports.UnknownArray, - UnknownRecord: exports.UnknownRecord -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithUnion = { - union: exports.union -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithRefine = { - refine: exports.refine -}; diff --git a/components/pexels/node_modules/io-ts/lib/Kleisli.d.ts b/components/pexels/node_modules/io-ts/lib/Kleisli.d.ts deleted file mode 100644 index ada32821a9a47..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Kleisli.d.ts +++ /dev/null @@ -1,226 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Alt2C } from 'fp-ts/lib/Alt' -import { Applicative2C } from 'fp-ts/lib/Applicative' -import { Apply2C } from 'fp-ts/lib/Apply' -import { Bifunctor2 } from 'fp-ts/lib/Bifunctor' -import { Lazy, Refinement } from 'fp-ts/lib/function' -import { Functor2C } from 'fp-ts/lib/Functor' -import { Kind2, URIS2 } from 'fp-ts/lib/HKT' -import { Monad2C } from 'fp-ts/lib/Monad' -import { MonadThrow2C } from 'fp-ts/lib/MonadThrow' -import * as S from './Schemable' -/** - * @category model - * @since 2.2.7 - */ -export interface Kleisli { - readonly decode: (i: I) => Kind2 -} -/** - * @category constructors - * @since 2.2.7 - */ -export declare function fromRefinement( - M: MonadThrow2C -): (refinement: Refinement, onError: (i: I) => E) => Kleisli -/** - * @category constructors - * @since 2.2.7 - */ -export declare function literal( - M: MonadThrow2C -): ( - onError: (i: I, values: readonly [S.Literal, ...ReadonlyArray]) => E -) => ], L extends S.Literal = S.Literal>( - ...values: A -) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function mapLeftWithInput( - M: Bifunctor2 -): (f: (i: I, e: E) => E) => (decoder: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function refine( - M: MonadThrow2C & Bifunctor2 -): ( - refinement: (a: A) => a is B, - onError: (a: A) => E -) => (from: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function parse( - M: Monad2C -): (decode: (a: A) => Kind2) => (from: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function nullable( - M: Applicative2C & Bifunctor2 -): (onError: (i: I, e: E) => E) => (or: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.15 - */ -export declare function fromStruct( - M: Applicative2C & Bifunctor2 -): (onPropertyError: (key: string, e: E) => E) =>

>>( - properties: P -) => Kleisli< - M, - { - [K in keyof P]: InputOf - }, - E, - { - [K in keyof P]: TypeOf - } -> -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -export declare const fromType: typeof fromStruct -/** - * @category combinators - * @since 2.2.7 - */ -export declare function fromPartial( - M: Applicative2C & Bifunctor2 -): (onPropertyError: (key: string, e: E) => E) =>

>>( - properties: P -) => Kleisli< - M, - Partial<{ - [K in keyof P]: InputOf - }>, - E, - Partial<{ - [K in keyof P]: TypeOf - }> -> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function fromArray( - M: Applicative2C & Bifunctor2 -): (onItemError: (index: number, e: E) => E) => (item: Kleisli) => Kleisli, E, Array> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function fromRecord( - M: Applicative2C & Bifunctor2 -): ( - onKeyError: (key: string, e: E) => E -) => (codomain: Kleisli) => Kleisli, E, Record> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function fromTuple( - M: Applicative2C & Bifunctor2 -): (onIndexError: (index: number, e: E) => E) => >>( - ...components: C -) => Kleisli< - M, - { - [K in keyof C]: InputOf - }, - E, - { - [K in keyof C]: TypeOf - } -> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function union( - M: Alt2C & Bifunctor2 -): ( - onMemberError: (index: number, e: E) => E -) => , ...Array>]>( - ...members: MS -) => Kleisli, E, TypeOf> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function intersect( - M: Apply2C -): (right: Kleisli) => (left: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function fromSum( - M: MonadThrow2C -): ( - onTagError: (tag: string, value: unknown, tags: ReadonlyArray) => E -) => ( - tag: T -) => >>( - members: MS -) => Kleisli, E, TypeOf> -/** - * @category combinators - * @since 2.2.7 - */ -export declare function lazy( - M: Bifunctor2 -): (onError: (id: string, e: E) => E) => (id: string, f: () => Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function compose( - M: Monad2C -): (ab: Kleisli) => (ia: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.8 - */ -export declare function id(M: Applicative2C): () => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function map( - F: Functor2C -): (f: (a: A) => B) => (ia: Kleisli) => Kleisli -/** - * @category combinators - * @since 2.2.7 - */ -export declare function alt( - A: Alt2C -): (that: Lazy>) => (me: Kleisli) => Kleisli -/** - * @since 2.2.7 - */ -export type TypeOf = KD extends Kleisli ? A : never -/** - * @since 2.2.7 - */ -export type InputOf = KD extends Kleisli ? I : never diff --git a/components/pexels/node_modules/io-ts/lib/Kleisli.js b/components/pexels/node_modules/io-ts/lib/Kleisli.js deleted file mode 100644 index 4778a838b18e6..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Kleisli.js +++ /dev/null @@ -1,360 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.alt = exports.map = exports.id = exports.compose = exports.lazy = exports.fromSum = exports.intersect = exports.union = exports.fromTuple = exports.fromRecord = exports.fromArray = exports.fromPartial = exports.fromType = exports.fromStruct = exports.nullable = exports.parse = exports.refine = exports.mapLeftWithInput = exports.literal = exports.fromRefinement = void 0; -var E = __importStar(require("fp-ts/lib/Either")); -var G = __importStar(require("./Guard")); -var S = __importStar(require("./Schemable")); -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.7 - */ -function fromRefinement(M) { - return function (refinement, onError) { return ({ - decode: function (i) { return (refinement(i) ? M.of(i) : M.throwError(onError(i))); } - }); }; -} -exports.fromRefinement = fromRefinement; -/** - * @category constructors - * @since 2.2.7 - */ -function literal(M) { - return function (onError) { - return function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return ({ - decode: function (i) { return (G.literal.apply(G, values).is(i) ? M.of(i) : M.throwError(onError(i, values))); } - }); - }; - }; -} -exports.literal = literal; -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.7 - */ -function mapLeftWithInput(M) { - return function (f) { return function (decoder) { return ({ - decode: function (i) { return M.mapLeft(decoder.decode(i), function (e) { return f(i, e); }); } - }); }; }; -} -exports.mapLeftWithInput = mapLeftWithInput; -/** - * @category combinators - * @since 2.2.7 - */ -function refine(M) { - return function (refinement, onError) { return function (from) { return compose(M)(fromRefinement(M)(refinement, onError))(from); }; }; -} -exports.refine = refine; -/** - * @category combinators - * @since 2.2.7 - */ -function parse(M) { - return function (decode) { return function (from) { return compose(M)({ decode: decode })(from); }; }; -} -exports.parse = parse; -/** - * @category combinators - * @since 2.2.7 - */ -function nullable(M) { - return function (onError) { - return function (or) { return ({ - decode: function (i) { - return i === null - ? M.of(null) - : M.bimap(or.decode(i), function (e) { return onError(i, e); }, function (a) { return a; }); - } - }); }; - }; -} -exports.nullable = nullable; -/** - * @category combinators - * @since 2.2.15 - */ -function fromStruct(M) { - var traverse = traverseRecordWithIndex(M); - return function (onPropertyError) { return function (properties) { return ({ - decode: function (i) { - return traverse(properties, function (key, decoder) { - return M.mapLeft(decoder.decode(i[key]), function (e) { return onPropertyError(key, e); }); - }); - } - }); }; }; -} -exports.fromStruct = fromStruct; -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -exports.fromType = fromStruct; -/** - * @category combinators - * @since 2.2.7 - */ -function fromPartial(M) { - var traverse = traverseRecordWithIndex(M); - var undefinedProperty = M.of(E.right(undefined)); - var skipProperty = M.of(E.left(undefined)); - return function (onPropertyError) { return function (properties) { return ({ - decode: function (i) { - return M.map(traverse(properties, function (key, decoder) { - var ikey = i[key]; - if (ikey === undefined) { - return key in i - ? // don't strip undefined properties - undefinedProperty - : // don't add missing properties - skipProperty; - } - return M.bimap(decoder.decode(ikey), function (e) { return onPropertyError(key, e); }, function (a) { return E.right(a); }); - }), compactRecord); - } - }); }; }; -} -exports.fromPartial = fromPartial; -/** - * @category combinators - * @since 2.2.7 - */ -function fromArray(M) { - var traverse = traverseArrayWithIndex(M); - return function (onItemError) { return function (item) { return ({ - decode: function (is) { return traverse(is, function (index, i) { return M.mapLeft(item.decode(i), function (e) { return onItemError(index, e); }); }); } - }); }; }; -} -exports.fromArray = fromArray; -/** - * @category combinators - * @since 2.2.7 - */ -function fromRecord(M) { - var traverse = traverseRecordWithIndex(M); - return function (onKeyError) { return function (codomain) { return ({ - decode: function (ir) { return traverse(ir, function (key, i) { return M.mapLeft(codomain.decode(i), function (e) { return onKeyError(key, e); }); }); } - }); }; }; -} -exports.fromRecord = fromRecord; -/** - * @category combinators - * @since 2.2.7 - */ -function fromTuple(M) { - var traverse = traverseArrayWithIndex(M); - return function (onIndexError) { - return function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return ({ - decode: function (is) { - return traverse(components, function (index, decoder) { - return M.mapLeft(decoder.decode(is[index]), function (e) { return onIndexError(index, e); }); - }); - } - }); - }; - }; -} -exports.fromTuple = fromTuple; -/** - * @category combinators - * @since 2.2.7 - */ -function union(M) { - return function (onMemberError) { - return function () { - var members = []; - for (var _i = 0; _i < arguments.length; _i++) { - members[_i] = arguments[_i]; - } - return ({ - decode: function (i) { - var out = M.mapLeft(members[0].decode(i), function (e) { return onMemberError(0, e); }); - var _loop_1 = function (index) { - out = M.alt(out, function () { return M.mapLeft(members[index].decode(i), function (e) { return onMemberError(index, e); }); }); - }; - for (var index = 1; index < members.length; index++) { - _loop_1(index); - } - return out; - } - }); - }; - }; -} -exports.union = union; -/** - * @category combinators - * @since 2.2.7 - */ -function intersect(M) { - return function (right) { - return function (left) { return ({ - decode: function (i) { - return M.ap(M.map(left.decode(i), function (a) { return function (b) { return S.intersect_(a, b); }; }), right.decode(i)); - } - }); }; - }; -} -exports.intersect = intersect; -/** - * @category combinators - * @since 2.2.7 - */ -function fromSum(M) { - return function (onTagError) { - return function (tag) { - return function (members) { - var keys = Object.keys(members); - return { - decode: function (ir) { - var v = ir[tag]; - if (Object.prototype.hasOwnProperty.call(members, v)) { - return members[v].decode(ir); - } - return M.throwError(onTagError(tag, v, keys)); - } - }; - }; - }; - }; -} -exports.fromSum = fromSum; -/** - * @category combinators - * @since 2.2.7 - */ -function lazy(M) { - return function (onError) { - return function (id, f) { - var get = S.memoize(f); - return { - decode: function (u) { return M.mapLeft(get().decode(u), function (e) { return onError(id, e); }); } - }; - }; - }; -} -exports.lazy = lazy; -/** - * @category combinators - * @since 2.2.7 - */ -function compose(M) { - return function (ab) { return function (ia) { return ({ - decode: function (i) { return M.chain(ia.decode(i), ab.decode); } - }); }; }; -} -exports.compose = compose; -/** - * @category combinators - * @since 2.2.8 - */ -function id(M) { - return function () { return ({ - decode: M.of - }); }; -} -exports.id = id; -/** - * @category combinators - * @since 2.2.7 - */ -function map(F) { - return function (f) { return function (ia) { return ({ - decode: function (i) { return F.map(ia.decode(i), f); } - }); }; }; -} -exports.map = map; -/** - * @category combinators - * @since 2.2.7 - */ -function alt(A) { - return function (that) { return function (me) { return ({ - decode: function (i) { return A.alt(me.decode(i), function () { return that().decode(i); }); } - }); }; }; -} -exports.alt = alt; -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- -var traverseArrayWithIndex = function (M) { - return function (as, f) { - return as.reduce(function (mbs, a, i) { - return M.ap(M.map(mbs, function (bs) { return function (b) { - bs.push(b); - return bs; - }; }), f(i, a)); - }, M.of([])); - }; -}; -var traverseRecordWithIndex = function (M) { - return function (r, f) { - var ks = Object.keys(r); - if (ks.length === 0) { - return M.of({}); - } - var fr = M.of({}); - var _loop_2 = function (key) { - fr = M.ap(M.map(fr, function (r) { return function (b) { - r[key] = b; - return r; - }; }), f(key, r[key])); - }; - for (var _i = 0, ks_1 = ks; _i < ks_1.length; _i++) { - var key = ks_1[_i]; - _loop_2(key); - } - return fr; - }; -}; -var compactRecord = function (r) { - var out = {}; - for (var k in r) { - var rk = r[k]; - if (E.isRight(rk)) { - out[k] = rk.right; - } - } - return out; -}; diff --git a/components/pexels/node_modules/io-ts/lib/PathReporter.d.ts b/components/pexels/node_modules/io-ts/lib/PathReporter.d.ts deleted file mode 100644 index 6050a03572bfd..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/PathReporter.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ValidationError } from '.' -import { Reporter } from './Reporter' -/** - * @since 1.0.0 - */ -export declare function failure(es: Array): Array -/** - * @since 1.0.0 - */ -export declare function success(): Array -/** - * @since 1.0.0 - */ -export declare const PathReporter: Reporter> diff --git a/components/pexels/node_modules/io-ts/lib/PathReporter.js b/components/pexels/node_modules/io-ts/lib/PathReporter.js deleted file mode 100644 index 57af54082b771..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/PathReporter.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PathReporter = exports.success = exports.failure = void 0; -/** - * @since 1.0.0 - */ -var Either_1 = require("fp-ts/lib/Either"); -var _1 = require("."); -function stringify(v) { - if (typeof v === 'function') { - return (0, _1.getFunctionName)(v); - } - if (typeof v === 'number' && !isFinite(v)) { - if (isNaN(v)) { - return 'NaN'; - } - return v > 0 ? 'Infinity' : '-Infinity'; - } - return JSON.stringify(v); -} -function getContextPath(context) { - return context.map(function (_a) { - var key = _a.key, type = _a.type; - return "".concat(key, ": ").concat(type.name); - }).join('/'); -} -function getMessage(e) { - return e.message !== undefined - ? e.message - : "Invalid value ".concat(stringify(e.value), " supplied to ").concat(getContextPath(e.context)); -} -/** - * @since 1.0.0 - */ -function failure(es) { - return es.map(getMessage); -} -exports.failure = failure; -/** - * @since 1.0.0 - */ -function success() { - return ['No errors!']; -} -exports.success = success; -/** - * @since 1.0.0 - */ -exports.PathReporter = { - report: (0, Either_1.fold)(failure, success) -}; diff --git a/components/pexels/node_modules/io-ts/lib/Reporter.d.ts b/components/pexels/node_modules/io-ts/lib/Reporter.d.ts deleted file mode 100644 index fee031a823925..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Reporter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @since 1.0.0 - */ -import { Validation } from './index' -/** - * @since 1.0.0 - */ -export interface Reporter { - report: (validation: Validation) => A -} diff --git a/components/pexels/node_modules/io-ts/lib/Reporter.js b/components/pexels/node_modules/io-ts/lib/Reporter.js deleted file mode 100644 index c8ad2e549bdc6..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Reporter.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/components/pexels/node_modules/io-ts/lib/Schema.d.ts b/components/pexels/node_modules/io-ts/lib/Schema.d.ts deleted file mode 100644 index 71235617ce0b5..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Schema.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.0 - */ -import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' -import { Schemable, Schemable1, Schemable2C } from './Schemable' -/** - * @category model - * @since 2.2.0 - */ -export interface Schema { - (S: Schemable): HKT -} -/** - * @category constructors - * @since 2.2.0 - */ -export declare function make(schema: Schema): Schema -/** - * @since 2.2.0 - */ -export type TypeOf = S extends Schema ? A : never -/** - * @since 2.2.3 - */ -export declare function interpreter( - S: Schemable2C -): (schema: Schema) => Kind2 -export declare function interpreter(S: Schemable1): (schema: Schema) => Kind diff --git a/components/pexels/node_modules/io-ts/lib/Schema.js b/components/pexels/node_modules/io-ts/lib/Schema.js deleted file mode 100644 index 98519fc58d6e2..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Schema.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.interpreter = exports.make = void 0; -var Schemable_1 = require("./Schemable"); -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.0 - */ -function make(schema) { - return (0, Schemable_1.memoize)(schema); -} -exports.make = make; -function interpreter(S) { - return function (schema) { return schema(S); }; -} -exports.interpreter = interpreter; diff --git a/components/pexels/node_modules/io-ts/lib/Schemable.d.ts b/components/pexels/node_modules/io-ts/lib/Schemable.d.ts deleted file mode 100644 index 0d579c33844d0..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Schemable.d.ts +++ /dev/null @@ -1,254 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.0 - */ -import { Refinement } from 'fp-ts/lib/function' -import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/lib/HKT' -/** - * @since 2.2.0 - */ -export type Literal = string | number | boolean | null -/** - * @since 2.2.3 - */ -export interface Schemable { - readonly URI: S - readonly literal: ], L extends Literal = Literal>( - ...values: A - ) => HKT - readonly string: HKT - readonly number: HKT - readonly boolean: HKT - readonly nullable: (or: HKT) => HKT - /** @deprecated */ - readonly type: (properties: { - [K in keyof A]: HKT - }) => HKT< - S, - { - [K in keyof A]: A[K] - } - > - readonly struct: (properties: { - [K in keyof A]: HKT - }) => HKT< - S, - { - [K in keyof A]: A[K] - } - > - readonly partial: (properties: { - [K in keyof A]: HKT - }) => HKT< - S, - Partial<{ - [K in keyof A]: A[K] - }> - > - readonly record: (codomain: HKT) => HKT> - readonly array: (item: HKT) => HKT> - readonly tuple: >( - ...components: { - [K in keyof A]: HKT - } - ) => HKT - readonly intersect: (right: HKT) => (left: HKT) => HKT - readonly sum: ( - tag: T - ) => (members: { - [K in keyof A]: HKT> - }) => HKT - readonly lazy: (id: string, f: () => HKT) => HKT - readonly readonly: (sa: HKT) => HKT> -} -/** - * @since 2.2.3 - */ -export interface Schemable1 { - readonly URI: S - readonly literal: ], L extends Literal = Literal>( - ...values: A - ) => Kind - readonly string: Kind - readonly number: Kind - readonly boolean: Kind - readonly nullable: (or: Kind) => Kind - /** @deprecated */ - readonly type: (properties: { - [K in keyof A]: Kind - }) => Kind< - S, - { - [K in keyof A]: A[K] - } - > - readonly struct: (properties: { - [K in keyof A]: Kind - }) => Kind< - S, - { - [K in keyof A]: A[K] - } - > - readonly partial: (properties: { - [K in keyof A]: Kind - }) => Kind< - S, - Partial<{ - [K in keyof A]: A[K] - }> - > - readonly record: (codomain: Kind) => Kind> - readonly array: (item: Kind) => Kind> - readonly tuple: >( - ...components: { - [K in keyof A]: Kind - } - ) => Kind - readonly intersect: (right: Kind) => (left: Kind) => Kind - readonly sum: ( - tag: T - ) => (members: { - [K in keyof A]: Kind> - }) => Kind - readonly lazy: (id: string, f: () => Kind) => Kind - readonly readonly: (sa: Kind) => Kind> -} -/** - * @since 2.2.8 - */ -export interface Schemable2C { - readonly URI: S - readonly literal: ], L extends Literal = Literal>( - ...values: A - ) => Kind2 - readonly string: Kind2 - readonly number: Kind2 - readonly boolean: Kind2 - readonly nullable: (or: Kind2) => Kind2 - /** @deprecated */ - readonly type: (properties: { - [K in keyof A]: Kind2 - }) => Kind2< - S, - E, - { - [K in keyof A]: A[K] - } - > - readonly struct: (properties: { - [K in keyof A]: Kind2 - }) => Kind2< - S, - E, - { - [K in keyof A]: A[K] - } - > - readonly partial: (properties: { - [K in keyof A]: Kind2 - }) => Kind2< - S, - E, - Partial<{ - [K in keyof A]: A[K] - }> - > - readonly record: (codomain: Kind2) => Kind2> - readonly array: (item: Kind2) => Kind2> - readonly tuple: >( - ...components: { - [K in keyof A]: Kind2 - } - ) => Kind2 - readonly intersect: (right: Kind2) => (left: Kind2) => Kind2 - readonly sum: ( - tag: T - ) => (members: { - [K in keyof A]: Kind2> - }) => Kind2 - readonly lazy: (id: string, f: () => Kind2) => Kind2 - readonly readonly: (sa: Kind2) => Kind2> -} -/** - * @since 2.2.3 - */ -export interface WithUnknownContainers { - readonly UnknownArray: HKT> - readonly UnknownRecord: HKT> -} -/** - * @since 2.2.3 - */ -export interface WithUnknownContainers1 { - readonly UnknownArray: Kind> - readonly UnknownRecord: Kind> -} -/** - * @since 2.2.8 - */ -export interface WithUnknownContainers2C { - readonly UnknownArray: Kind2> - readonly UnknownRecord: Kind2> -} -/** - * @since 2.2.3 - */ -export interface WithUnion { - readonly union: ]>( - ...members: { - [K in keyof A]: HKT - } - ) => HKT -} -/** - * @since 2.2.3 - */ -export interface WithUnion1 { - readonly union: ]>( - ...members: { - [K in keyof A]: Kind - } - ) => Kind -} -/** - * @since 2.2.8 - */ -export interface WithUnion2C { - readonly union: ]>( - ...members: { - [K in keyof A]: Kind2 - } - ) => Kind2 -} -/** - * @since 2.2.3 - */ -export interface WithRefine { - readonly refine: (refinement: Refinement, id: string) => (from: HKT) => HKT -} -/** - * @since 2.2.3 - */ -export interface WithRefine1 { - readonly refine: (refinement: Refinement, id: string) => (from: Kind) => Kind -} -/** - * @since 2.2.8 - */ -export interface WithRefine2C { - readonly refine: ( - refinement: Refinement, - id: string - ) => (from: Kind2) => Kind2 -} -/** - * @since 2.2.0 - */ -export declare function memoize(f: (a: A) => B): (a: A) => B diff --git a/components/pexels/node_modules/io-ts/lib/Schemable.js b/components/pexels/node_modules/io-ts/lib/Schemable.js deleted file mode 100644 index 793f888adb74e..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Schemable.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.intersect_ = exports.memoize = void 0; -/** - * @since 2.2.0 - */ -function memoize(f) { - var cache = new Map(); - return function (a) { - if (!cache.has(a)) { - var b = f(a); - cache.set(a, b); - return b; - } - return cache.get(a); - }; -} -exports.memoize = memoize; -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- -var typeOf = function (x) { return (x === null ? 'null' : typeof x); }; -/** - * @internal - */ -var intersect_ = function (a, b) { - if (a !== undefined && b !== undefined) { - var tx = typeOf(a); - var ty = typeOf(b); - if (tx === 'object' || ty === 'object') { - return Object.assign({}, a, b); - } - } - return b; -}; -exports.intersect_ = intersect_; diff --git a/components/pexels/node_modules/io-ts/lib/TaskDecoder.d.ts b/components/pexels/node_modules/io-ts/lib/TaskDecoder.d.ts deleted file mode 100644 index b6cb727316b3d..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/TaskDecoder.d.ts +++ /dev/null @@ -1,349 +0,0 @@ -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.7 - */ -import { Alt2 } from 'fp-ts/lib/Alt' -import { Category2 } from 'fp-ts/lib/Category' -import { Refinement } from 'fp-ts/lib/function' -import { Functor2 } from 'fp-ts/lib/Functor' -import * as TE from 'fp-ts/lib/TaskEither' -import * as D from './Decoder' -import * as G from './Guard' -import * as K from './Kleisli' -import * as S from './Schemable' -/** - * @category model - * @since 2.2.8 - */ -export interface TaskDecoder extends K.Kleisli {} -/** - * @category DecodeError - * @since 2.2.7 - */ -export type DecodeError = D.DecodeError -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const error: (actual: unknown, message: string) => DecodeError -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const success: (a: A) => TE.TaskEither -/** - * @category DecodeError - * @since 2.2.7 - */ -export declare const failure: (actual: unknown, message: string) => TE.TaskEither -/** - * @category constructors - * @since 2.2.7 - */ -export declare const fromDecoder: (decoder: D.Decoder) => TaskDecoder -/** - * @category constructors - * @since 2.2.8 - */ -export declare const fromRefinement: ( - refinement: Refinement, - expected: string -) => TaskDecoder -/** - * @category constructors - * @since 2.2.7 - */ -export declare const fromGuard: (guard: G.Guard, expected: string) => TaskDecoder -/** - * @category constructors - * @since 2.2.7 - */ -export declare const literal: ], L extends S.Literal = S.Literal>( - ...values: A -) => TaskDecoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const string: TaskDecoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const number: TaskDecoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const boolean: TaskDecoder -/** - * @category primitives - * @since 2.2.7 - */ -export declare const UnknownArray: TaskDecoder> -/** - * @category primitives - * @since 2.2.7 - */ -export declare const UnknownRecord: TaskDecoder> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const mapLeftWithInput: ( - f: (input: I, e: DecodeError) => DecodeError -) => (decoder: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.9 - */ -export declare const withMessage: ( - message: (input: I, e: DecodeError) => string -) => (decoder: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const refine: ( - refinement: Refinement, - id: string -) => (from: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const parse: ( - parser: (a: A) => TE.TaskEither -) => (from: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const nullable: (or: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.15 - */ -export declare const fromStruct:

>>( - properties: P -) => TaskDecoder< - { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, - { [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> } -> -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -export declare const fromType:

>>( - properties: P -) => TaskDecoder< - { [K in keyof P]: K.InputOf<'TaskEither', P[K]> }, - { [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> } -> -/** - * @category combinators - * @since 2.2.15 - */ -export declare const struct: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -export declare const type: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< - unknown, - { [K_1 in keyof A]: A[K_1] } -> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromPartial:

>>( - properties: P -) => TaskDecoder< - Partial<{ [K in keyof P]: K.InputOf<'TaskEither', P[K]> }>, - Partial<{ [K_1 in keyof P]: K.TypeOf<'TaskEither', P[K_1]> }> -> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const partial: (properties: { [K in keyof A]: TaskDecoder }) => TaskDecoder< - unknown, - Partial<{ [K_1 in keyof A]: A[K_1] }> -> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromArray: (item: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const array: (item: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromRecord: ( - codomain: TaskDecoder -) => TaskDecoder, Record> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const record: (codomain: TaskDecoder) => TaskDecoder> -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromTuple: []>( - ...components: C -) => TaskDecoder< - { [K in keyof C]: K.InputOf<'TaskEither', C[K]> }, - { [K_1 in keyof C]: K.TypeOf<'TaskEither', C[K_1]> } -> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const tuple: ( - ...components: { [K in keyof A]: TaskDecoder } -) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const union: , ...Array>]>( - ...members: MS -) => TaskDecoder, TypeOf> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const intersect: ( - right: TaskDecoder -) => (left: TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.8 - */ -export declare const fromSum: ( - tag: T -) => >>( - members: MS -) => TaskDecoder, K.TypeOf<'TaskEither', MS[keyof MS]>> -/** - * @category combinators - * @since 2.2.7 - */ -export declare const sum: ( - tag: T -) => (members: { [K in keyof A]: TaskDecoder> }) => TaskDecoder -/** - * @category combinators - * @since 2.2.7 - */ -export declare const lazy: (id: string, f: () => TaskDecoder) => TaskDecoder -/** - * @category combinators - * @since 2.2.15 - */ -export declare const readonly: (decoder: TaskDecoder) => TaskDecoder> -/** - * @category Functor - * @since 2.2.7 - */ -export declare const map: (f: (a: A) => B) => (fa: TaskDecoder) => TaskDecoder -/** - * @category Alt - * @since 2.2.7 - */ -export declare const alt: (that: () => TaskDecoder) => (me: TaskDecoder) => TaskDecoder -/** - * @category Semigroupoid - * @since 2.2.8 - */ -export declare const compose: (to: TaskDecoder) => (from: TaskDecoder) => TaskDecoder -/** - * @category Category - * @since 2.2.8 - */ -export declare const id: () => TaskDecoder -/** - * @category instances - * @since 2.2.7 - */ -export declare const URI = 'io-ts/TaskDecoder' -/** - * @category instances - * @since 2.2.7 - */ -export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { - interface URItoKind2 { - readonly [URI]: TaskDecoder - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Functor: Functor2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Alt: Alt2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Category: Category2 -/** - * @category instances - * @since 2.2.8 - */ -export declare const Schemable: S.Schemable2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnknownContainers: S.WithUnknownContainers2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnion: S.WithUnion2C -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithRefine: S.WithRefine2C -/** - * @since 2.2.7 - */ -export type TypeOf = K.TypeOf -/** - * @since 2.2.8 - */ -export type InputOf = K.InputOf -/** - * @since 2.2.7 - */ -export declare const draw: (e: DecodeError) => string diff --git a/components/pexels/node_modules/io-ts/lib/TaskDecoder.js b/components/pexels/node_modules/io-ts/lib/TaskDecoder.js deleted file mode 100644 index 8fb102cd0edc1..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/TaskDecoder.js +++ /dev/null @@ -1,457 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.stringify = exports.draw = exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.Category = exports.Alt = exports.Functor = exports.URI = exports.id = exports.compose = exports.alt = exports.map = exports.readonly = exports.lazy = exports.sum = exports.fromSum = exports.intersect = exports.union = exports.tuple = exports.fromTuple = exports.record = exports.fromRecord = exports.array = exports.fromArray = exports.partial = exports.fromPartial = exports.type = exports.struct = exports.fromType = exports.fromStruct = exports.nullable = exports.parse = exports.refine = exports.withMessage = exports.mapLeftWithInput = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = exports.fromGuard = exports.fromRefinement = exports.fromDecoder = exports.failure = exports.success = exports.error = void 0; -var E = __importStar(require("fp-ts/lib/Either")); -var function_1 = require("fp-ts/lib/function"); -var pipeable_1 = require("fp-ts/lib/pipeable"); -var T = __importStar(require("fp-ts/lib/Task")); -var TE = __importStar(require("fp-ts/lib/TaskEither")); -var DE = __importStar(require("./DecodeError")); -var D = __importStar(require("./Decoder")); -var FS = __importStar(require("./FreeSemigroup")); -var K = __importStar(require("./Kleisli")); -// ------------------------------------------------------------------------------------- -// Kleisli config -// ------------------------------------------------------------------------------------- -var M = { - URI: TE.URI, - _E: undefined, - map: function (fa, f) { return (0, pipeable_1.pipe)(fa, TE.map(f)); }, - ap: function (fab, fa) { - return (0, pipeable_1.pipe)((0, pipeable_1.pipe)(fab, T.map(function (h) { return function (ga) { return D.ap(h, ga); }; })), T.ap(fa)); - }, - of: TE.right, - chain: function (ma, f) { return (0, pipeable_1.pipe)(ma, TE.chain(f)); }, - throwError: TE.left, - bimap: function (fa, f, g) { return (0, pipeable_1.pipe)(fa, TE.bimap(f, g)); }, - mapLeft: function (fa, f) { return (0, pipeable_1.pipe)(fa, TE.mapLeft(f)); }, - alt: function (me, that) { - return (0, pipeable_1.pipe)(me, T.chain(function (e1) { - return E.isRight(e1) - ? T.of(e1) - : (0, pipeable_1.pipe)(that(), T.map(function (e2) { return (E.isLeft(e2) ? E.left(D.SE.concat(e1.left, e2.left)) : e2); })); - })); - } -}; -/** - * @category DecodeError - * @since 2.2.7 - */ -exports.error = D.error; -/** - * @category DecodeError - * @since 2.2.7 - */ -exports.success = TE.right; -/** - * @category DecodeError - * @since 2.2.7 - */ -var failure = function (actual, message) { - return TE.left(D.error(actual, message)); -}; -exports.failure = failure; -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.7 - */ -var fromDecoder = function (decoder) { return ({ - decode: TE.fromEitherK(decoder.decode) -}); }; -exports.fromDecoder = fromDecoder; -/** - * @category constructors - * @since 2.2.8 - */ -var fromRefinement = function (refinement, expected) { - return (0, exports.fromDecoder)(D.fromRefinement(refinement, expected)); -}; -exports.fromRefinement = fromRefinement; -/** - * @category constructors - * @since 2.2.7 - */ -var fromGuard = function (guard, expected) { - return (0, exports.fromRefinement)(guard.is, expected); -}; -exports.fromGuard = fromGuard; -/** - * @category constructors - * @since 2.2.7 - */ -exports.literal = -/*#__PURE__*/ -K.literal(M)(function (u, values) { return (0, exports.error)(u, values.map(function (value) { return JSON.stringify(value); }).join(' | ')); }); -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.7 - */ -exports.string = -/*#__PURE__*/ -(0, exports.fromDecoder)(D.string); -/** - * @category primitives - * @since 2.2.7 - */ -exports.number = -/*#__PURE__*/ -(0, exports.fromDecoder)(D.number); -/** - * @category primitives - * @since 2.2.7 - */ -exports.boolean = -/*#__PURE__*/ -(0, exports.fromDecoder)(D.boolean); -/** - * @category primitives - * @since 2.2.7 - */ -exports.UnknownArray = -/*#__PURE__*/ -(0, exports.fromDecoder)(D.UnknownArray); -/** - * @category primitives - * @since 2.2.7 - */ -exports.UnknownRecord = -/*#__PURE__*/ -(0, exports.fromDecoder)(D.UnknownRecord); -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.7 - */ -exports.mapLeftWithInput = -/*#__PURE__*/ -K.mapLeftWithInput(M); -/** - * @category combinators - * @since 2.2.9 - */ -var withMessage = function (message) { - return (0, exports.mapLeftWithInput)(function (input, e) { return FS.of(DE.wrap(message(input, e), e)); }); -}; -exports.withMessage = withMessage; -/** - * @category combinators - * @since 2.2.7 - */ -var refine = function (refinement, id) { return K.refine(M)(refinement, function (a) { return (0, exports.error)(a, id); }); }; -exports.refine = refine; -/** - * @category combinators - * @since 2.2.7 - */ -exports.parse = -/*#__PURE__*/ -K.parse(M); -/** - * @category combinators - * @since 2.2.7 - */ -exports.nullable = -/*#__PURE__*/ -K.nullable(M)(function (u, e) { return FS.concat(FS.of(DE.member(0, (0, exports.error)(u, 'null'))), FS.of(DE.member(1, e))); }); -/** - * @category combinators - * @since 2.2.15 - */ -var fromStruct = function (properties) { - return K.fromStruct(M)(function (k, e) { return FS.of(DE.key(k, DE.required, e)); })(properties); -}; -exports.fromStruct = fromStruct; -/** - * Use `fromStruct` instead. - * - * @category combinators - * @since 2.2.8 - * @deprecated - */ -exports.fromType = exports.fromStruct; -/** - * @category combinators - * @since 2.2.15 - */ -var struct = function (properties) { return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromStruct)(properties))); }; -exports.struct = struct; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.7 - * @deprecated - */ -exports.type = exports.struct; -/** - * @category combinators - * @since 2.2.8 - */ -var fromPartial = function (properties) { - return K.fromPartial(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(properties); -}; -exports.fromPartial = fromPartial; -/** - * @category combinators - * @since 2.2.7 - */ -var partial = function (properties) { return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromPartial)(properties))); }; -exports.partial = partial; -/** - * @category combinators - * @since 2.2.8 - */ -var fromArray = function (item) { - return K.fromArray(M)(function (i, e) { return FS.of(DE.index(i, DE.optional, e)); })(item); -}; -exports.fromArray = fromArray; -/** - * @category combinators - * @since 2.2.7 - */ -var array = function (item) { - return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)((0, exports.fromArray)(item))); -}; -exports.array = array; -/** - * @category combinators - * @since 2.2.8 - */ -var fromRecord = function (codomain) { - return K.fromRecord(M)(function (k, e) { return FS.of(DE.key(k, DE.optional, e)); })(codomain); -}; -exports.fromRecord = fromRecord; -/** - * @category combinators - * @since 2.2.7 - */ -var record = function (codomain) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromRecord)(codomain))); -}; -exports.record = record; -/** - * @category combinators - * @since 2.2.8 - */ -var fromTuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return K.fromTuple(M)(function (i, e) { return FS.of(DE.index(i, DE.required, e)); }).apply(void 0, components); -}; -exports.fromTuple = fromTuple; -/** - * @category combinators - * @since 2.2.7 - */ -var tuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return (0, pipeable_1.pipe)(exports.UnknownArray, (0, exports.compose)(exports.fromTuple.apply(void 0, components))); -}; -exports.tuple = tuple; -/** - * @category combinators - * @since 2.2.7 - */ -exports.union = -/*#__PURE__*/ -K.union(M)(function (i, e) { return FS.of(DE.member(i, e)); }); -/** - * @category combinators - * @since 2.2.7 - */ -exports.intersect = -/*#__PURE__*/ -K.intersect(M); -/** - * @category combinators - * @since 2.2.8 - */ -var fromSum = function (tag) { - return function (members) { - return K.fromSum(M)(function (tag, value, keys) { - return FS.of(DE.key(tag, DE.required, (0, exports.error)(value, keys.length === 0 ? 'never' : keys.map(function (k) { return JSON.stringify(k); }).join(' | ')))); - })(tag)(members); - }; -}; -exports.fromSum = fromSum; -/** - * @category combinators - * @since 2.2.7 - */ -var sum = function (tag) { - return function (members) { - return (0, pipeable_1.pipe)(exports.UnknownRecord, (0, exports.compose)((0, exports.fromSum)(tag)(members))); - }; -}; -exports.sum = sum; -/** - * @category combinators - * @since 2.2.7 - */ -exports.lazy = -/*#__PURE__*/ -K.lazy(M)(function (id, e) { return FS.of(DE.lazy(id, e)); }); -/** - * @category combinators - * @since 2.2.15 - */ -exports.readonly = function_1.identity; -// ------------------------------------------------------------------------------------- -// non-pipeables -// ------------------------------------------------------------------------------------- -var map_ = function (fa, f) { return (0, pipeable_1.pipe)(fa, (0, exports.map)(f)); }; -var alt_ = function (me, that) { return (0, pipeable_1.pipe)(me, (0, exports.alt)(that)); }; -var compose_ = function (ab, la) { return (0, pipeable_1.pipe)(la, (0, exports.compose)(ab)); }; -// ------------------------------------------------------------------------------------- -// pipeables -// ------------------------------------------------------------------------------------- -/** - * @category Functor - * @since 2.2.7 - */ -exports.map = -/*#__PURE__*/ -K.map(M); -/** - * @category Alt - * @since 2.2.7 - */ -exports.alt = -/*#__PURE__*/ -K.alt(M); -/** - * @category Semigroupoid - * @since 2.2.8 - */ -exports.compose = -/*#__PURE__*/ -K.compose(M); -/** - * @category Category - * @since 2.2.8 - */ -exports.id = -/*#__PURE__*/ -K.id(M); -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.7 - */ -exports.URI = 'io-ts/TaskDecoder'; -/** - * @category instances - * @since 2.2.8 - */ -exports.Functor = { - URI: exports.URI, - map: map_ -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.Alt = { - URI: exports.URI, - map: map_, - alt: alt_ -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.Category = { - URI: exports.URI, - compose: compose_, - id: exports.id -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.Schemable = { - URI: exports.URI, - literal: exports.literal, - string: exports.string, - number: exports.number, - boolean: exports.boolean, - nullable: exports.nullable, - type: exports.type, - struct: exports.struct, - partial: exports.partial, - record: exports.record, - array: exports.array, - tuple: exports.tuple, - intersect: exports.intersect, - sum: exports.sum, - lazy: exports.lazy, - readonly: exports.readonly -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithUnknownContainers = { - UnknownArray: exports.UnknownArray, - UnknownRecord: exports.UnknownRecord -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithUnion = { - union: exports.union -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithRefine = { - refine: exports.refine -}; -/** - * @since 2.2.7 - */ -exports.draw = D.draw; -/** - * @internal - */ -exports.stringify = TE.fold(function (e) { return T.of((0, exports.draw)(e)); }, function (a) { return T.of(JSON.stringify(a, null, 2)); }); diff --git a/components/pexels/node_modules/io-ts/lib/ThrowReporter.d.ts b/components/pexels/node_modules/io-ts/lib/ThrowReporter.d.ts deleted file mode 100644 index d759e80da0b13..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/ThrowReporter.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Reporter } from './Reporter' -/** - * @category deprecated - * @since 1.0.0 - * @deprecated - */ -export declare const ThrowReporter: Reporter diff --git a/components/pexels/node_modules/io-ts/lib/ThrowReporter.js b/components/pexels/node_modules/io-ts/lib/ThrowReporter.js deleted file mode 100644 index 8ff47cae534c3..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/ThrowReporter.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ThrowReporter = void 0; -/** - * @deprecated - * @since 1.0.0 - */ -var Either_1 = require("fp-ts/lib/Either"); -var PathReporter_1 = require("./PathReporter"); -/** - * @category deprecated - * @since 1.0.0 - * @deprecated - */ -exports.ThrowReporter = { - report: function (validation) { - if ((0, Either_1.isLeft)(validation)) { - throw new Error(PathReporter_1.PathReporter.report(validation).join('\n')); - } - } -}; diff --git a/components/pexels/node_modules/io-ts/lib/Type.d.ts b/components/pexels/node_modules/io-ts/lib/Type.d.ts deleted file mode 100644 index 19617912ba813..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Type.d.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { Refinement } from 'fp-ts/lib/function' -import * as t from './index' -import * as S from './Schemable' -/** - * @category model - * @since 2.2.3 - */ -export interface Type extends t.Type {} -/** - * @category constructors - * @since 2.2.3 - */ -export declare const literal: ( - ...values: A -) => Type -/** - * @category primitives - * @since 2.2.3 - */ -export declare const string: Type -/** - * @category primitives - * @since 2.2.3 - */ -export declare const number: Type -/** - * @category primitives - * @since 2.2.3 - */ -export declare const boolean: Type -/** - * @category primitives - * @since 2.2.3 - */ -export declare const UnknownArray: Type> -/** - * @category primitives - * @since 2.2.3 - */ -export declare const UnknownRecord: Type> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const refine: (refinement: Refinement, id: string) => (from: Type) => Type -/** - * @category combinators - * @since 2.2.3 - */ -export declare const nullable: (or: Type) => Type -/** - * @category combinators - * @since 2.2.15 - */ -export declare const struct: (properties: { [K in keyof A]: Type }) => Type<{ [K_1 in keyof A]: A[K_1] }> -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -export declare const type: (properties: { [K in keyof A]: Type }) => Type<{ [K_1 in keyof A]: A[K_1] }> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const partial: (properties: { [K in keyof A]: Type }) => Type< - Partial<{ [K_1 in keyof A]: A[K_1] }> -> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const record: (codomain: Type) => Type> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const array: (item: Type) => Type -/** - * @category combinators - * @since 2.2.3 - */ -export declare const tuple: (...components: { [K in keyof A]: Type }) => Type -/** - * @category combinators - * @since 2.2.3 - */ -export declare const intersect: (right: Type) => (left: Type) => Type -/** - * @category combinators - * @since 2.2.3 - */ -export declare const lazy: (id: string, f: () => Type) => Type -/** - * @category combinators - * @since 2.2.15 - */ -export declare const readonly: (type: Type) => Type> -/** - * @category combinators - * @since 2.2.3 - */ -export declare const sum: ( - _tag: T -) => (members: { [K in keyof A]: Type> }) => Type -/** - * @category combinators - * @since 2.2.3 - */ -export declare const union: ( - ...members: { [K in keyof A]: Type } -) => Type -/** - * @category instances - * @since 2.2.3 - */ -export declare const URI = 'io-ts/Type' -/** - * @category instances - * @since 2.2.3 - */ -export type URI = typeof URI -declare module 'fp-ts/lib/HKT' { - interface URItoKind { - readonly [URI]: Type - } -} -/** - * @category instances - * @since 2.2.8 - */ -export declare const Schemable: S.Schemable1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnknownContainers: S.WithUnknownContainers1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithUnion: S.WithUnion1 -/** - * @category instances - * @since 2.2.8 - */ -export declare const WithRefine: S.WithRefine1 diff --git a/components/pexels/node_modules/io-ts/lib/Type.js b/components/pexels/node_modules/io-ts/lib/Type.js deleted file mode 100644 index 30ca476d72b02..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/Type.js +++ /dev/null @@ -1,248 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WithRefine = exports.WithUnion = exports.WithUnknownContainers = exports.Schemable = exports.URI = exports.union = exports.sum = exports.readonly = exports.lazy = exports.intersect = exports.tuple = exports.array = exports.record = exports.partial = exports.type = exports.struct = exports.nullable = exports.refine = exports.UnknownRecord = exports.UnknownArray = exports.boolean = exports.number = exports.string = exports.literal = void 0; -/** - * **This module is experimental** - * - * Experimental features are published in order to get early feedback from the community, see these tracking - * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. - * - * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. - * - * @since 2.2.3 - */ -var E = __importStar(require("fp-ts/lib/Either")); -var function_1 = require("fp-ts/lib/function"); -var pipeable_1 = require("fp-ts/lib/pipeable"); -var t = __importStar(require("./index")); -// ------------------------------------------------------------------------------------- -// constructors -// ------------------------------------------------------------------------------------- -/** - * @category constructors - * @since 2.2.3 - */ -var literal = function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return t.union(values.map(function (v) { return t.literal(v); })); -}; -exports.literal = literal; -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @category primitives - * @since 2.2.3 - */ -exports.string = t.string; -/** - * @category primitives - * @since 2.2.3 - */ -exports.number = new t.Type(t.number.name, t.number.is, function (u, c) { - return (0, pipeable_1.pipe)(t.number.decode(u), E.chain(function (n) { return (isNaN(n) ? t.failure(u, c) : t.success(n)); })); -}, t.number.encode); -/** - * @category primitives - * @since 2.2.3 - */ -exports.boolean = t.boolean; -/** - * @category primitives - * @since 2.2.3 - */ -exports.UnknownArray = t.UnknownArray; -/** - * @category primitives - * @since 2.2.3 - */ -exports.UnknownRecord = t.UnknownRecord; -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @category combinators - * @since 2.2.3 - */ -var refine = function (refinement, id) { - return function (from) { - // tslint:disable-next-line: deprecation - return (t.refinement(from, refinement, id)); - }; -}; -exports.refine = refine; -/** - * @category combinators - * @since 2.2.3 - */ -var nullable = function (or) { return t.union([t.null, or]); }; -exports.nullable = nullable; -/** - * @category combinators - * @since 2.2.15 - */ -var struct = function (properties) { - return t.type(properties); -}; -exports.struct = struct; -/** - * Use `struct` instead. - * - * @category combinators - * @since 2.2.3 - * @deprecated - */ -exports.type = exports.struct; -/** - * @category combinators - * @since 2.2.3 - */ -var partial = function (properties) { - return t.partial(properties); -}; -exports.partial = partial; -/** - * @category combinators - * @since 2.2.3 - */ -var record = function (codomain) { return t.record(t.string, codomain); }; -exports.record = record; -/** - * @category combinators - * @since 2.2.3 - */ -var array = function (item) { return t.array(item); }; -exports.array = array; -/** - * @category combinators - * @since 2.2.3 - */ -var tuple = function () { - var components = []; - for (var _i = 0; _i < arguments.length; _i++) { - components[_i] = arguments[_i]; - } - return t.tuple(components); -}; -exports.tuple = tuple; -/** - * @category combinators - * @since 2.2.3 - */ -var intersect = function (right) { - return function (left) { - return t.intersection([left, right]); - }; -}; -exports.intersect = intersect; -/** - * @category combinators - * @since 2.2.3 - */ -var lazy = function (id, f) { return t.recursion(id, f); }; -exports.lazy = lazy; -/** - * @category combinators - * @since 2.2.15 - */ -exports.readonly = function_1.identity; -/** - * @category combinators - * @since 2.2.3 - */ -var sum = function (_tag) { - return function (members) { - return t.union(Object.values(members)); - }; -}; -exports.sum = sum; -/** - * @category combinators - * @since 2.2.3 - */ -var union = function () { - var members = []; - for (var _i = 0; _i < arguments.length; _i++) { - members[_i] = arguments[_i]; - } - return t.union(members); -}; -exports.union = union; -// ------------------------------------------------------------------------------------- -// instances -// ------------------------------------------------------------------------------------- -/** - * @category instances - * @since 2.2.3 - */ -exports.URI = 'io-ts/Type'; -/** - * @category instances - * @since 2.2.8 - */ -exports.Schemable = { - URI: exports.URI, - literal: exports.literal, - string: exports.string, - number: exports.number, - boolean: exports.boolean, - nullable: exports.nullable, - type: exports.type, - struct: exports.struct, - partial: exports.partial, - record: exports.record, - array: exports.array, - tuple: exports.tuple, - intersect: exports.intersect, - sum: exports.sum, - lazy: exports.lazy, - readonly: exports.readonly -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithUnknownContainers = { - UnknownArray: exports.UnknownArray, - UnknownRecord: exports.UnknownRecord -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithUnion = { - union: exports.union -}; -/** - * @category instances - * @since 2.2.8 - */ -exports.WithRefine = { - refine: exports.refine -}; diff --git a/components/pexels/node_modules/io-ts/lib/index.d.ts b/components/pexels/node_modules/io-ts/lib/index.d.ts deleted file mode 100644 index 24ed1de082b96..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/index.d.ts +++ /dev/null @@ -1,1374 +0,0 @@ -/** - * @since 1.0.0 - */ -import { Either } from 'fp-ts/lib/Either' -import { Predicate, Refinement } from 'fp-ts/lib/function' -/** - * @category Decode error - * @since 1.0.0 - */ -export interface ContextEntry { - readonly key: string - readonly type: Decoder - /** the input data */ - readonly actual?: unknown -} -/** - * @category Decode error - * @since 1.0.0 - */ -export interface Context extends ReadonlyArray {} -/** - * @category Decode error - * @since 1.0.0 - */ -export interface ValidationError { - /** the offending (sub)value */ - readonly value: unknown - /** where the error originated */ - readonly context: Context - /** optional custom error message */ - readonly message?: string -} -/** - * @category Decode error - * @since 1.0.0 - */ -export interface Errors extends Array {} -/** - * @category Decode error - * @since 1.0.0 - */ -export type Validation = Either -/** - * @category Decode error - * @since 1.0.0 - */ -export declare const failures: (errors: Errors) => Validation -/** - * @category Decode error - * @since 1.0.0 - */ -export declare const failure: (value: unknown, context: Context, message?: string) => Validation -/** - * @category Decode error - * @since 1.0.0 - */ -export declare const success: (value: T) => Validation -/** - * @since 1.0.0 - */ -export type Is = (u: unknown) => u is A -/** - * @since 1.0.0 - */ -export type Validate = (i: I, context: Context) => Validation -/** - * @since 1.0.0 - */ -export type Decode = (i: I) => Validation -/** - * @since 1.0.0 - */ -export type Encode = (a: A) => O -/** - * @since 1.0.0 - */ -export interface Any extends Type {} -/** - * @since 1.0.0 - */ -export interface Mixed extends Type {} -/** - * @category Codec - * @since 1.0.0 - */ -export type TypeOf = C['_A'] -/** - * @category Codec - * @since 1.0.0 - */ -export type InputOf = C['_I'] -/** - * @category Codec - * @since 1.0.0 - */ -export type OutputOf = C['_O'] -/** - * @category Codec - * @since 1.0.0 - */ -export interface Decoder { - readonly name: string - readonly validate: Validate - readonly decode: Decode -} -/** - * @category Codec - * @since 1.0.0 - */ -export interface Encoder { - readonly encode: Encode -} -/** - * @category Codec - * @since 1.0.0 - */ -export declare class Type implements Decoder, Encoder { - /** a unique name for this codec */ - readonly name: string - /** a custom type guard */ - readonly is: Is - /** succeeds if a value of type I can be decoded to a value of type A */ - readonly validate: Validate - /** converts a value of type A to a value of type O */ - readonly encode: Encode - /** - * @since 1.0.0 - */ - readonly _A: A - /** - * @since 1.0.0 - */ - readonly _O: O - /** - * @since 1.0.0 - */ - readonly _I: I - constructor( - /** a unique name for this codec */ - name: string, - /** a custom type guard */ - is: Is, - /** succeeds if a value of type I can be decoded to a value of type A */ - validate: Validate, - /** converts a value of type A to a value of type O */ - encode: Encode - ) - /** - * @since 1.0.0 - */ - pipe(this: Type, ab: Type, name?: string): Type - /** - * @since 1.0.0 - */ - asDecoder(): Decoder - /** - * @since 1.0.0 - */ - asEncoder(): Encoder - /** - * a version of `validate` with a default context - * @since 1.0.0 - */ - decode(i: I): Validation -} -/** - * @since 1.0.0 - */ -export declare const identity: (a: A) => A -/** - * @since 1.0.0 - */ -export declare function getFunctionName(f: Function): string -/** - * @since 1.0.0 - */ -export declare function getContextEntry(key: string, decoder: Decoder): ContextEntry -/** - * @since 1.0.0 - */ -export declare function appendContext(c: Context, key: string, decoder: Decoder, actual?: unknown): Context -/** - * @since 1.0.0 - */ -export interface AnyProps { - [key: string]: Any -} -/** - * @since 1.0.0 - */ -export type TypeOfProps

= { - [K in keyof P]: TypeOf -} -/** - * @since 1.0.0 - */ -export type OutputOfProps

= { - [K in keyof P]: OutputOf -} -/** - * @since 1.0.0 - */ -export interface Props { - [key: string]: Mixed -} -/** - * @since 1.0.0 - */ -export type TypeOfPartialProps

= { - [K in keyof P]?: TypeOf -} -/** - * @since 1.0.0 - */ -export type OutputOfPartialProps

= { - [K in keyof P]?: OutputOf -} -/** - * @since 1.0.0 - */ -export type TypeOfDictionary = { - [K in TypeOf]: TypeOf -} -/** - * @since 1.0.0 - */ -export type OutputOfDictionary = { - [K in OutputOf]: OutputOf -} -/** - * @since 1.1.0 - */ -export interface HasPropsRefinement extends RefinementType {} -/** - * @since 1.1.0 - */ -export interface HasPropsReadonly extends ReadonlyType {} -/** - * @since 1.1.0 - */ -export interface HasPropsIntersection extends IntersectionType, any, any, any> {} -/** - * @since 1.1.0 - */ -export type HasProps = - | HasPropsRefinement - | HasPropsReadonly - | HasPropsIntersection - | InterfaceType - | StrictType - | PartialType -/** - * @since 1.0.0 - */ -export declare class NullType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'NullType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface NullC extends NullType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const nullType: NullC -/** - * @since 1.0.0 - */ -export declare class UndefinedType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'UndefinedType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface UndefinedC extends UndefinedType {} -declare const undefinedType: UndefinedC -/** - * @since 1.2.0 - */ -export declare class VoidType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'VoidType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface VoidC extends VoidType {} -/** - * @category primitives - * @since 1.2.0 - */ -export declare const voidType: VoidC -/** - * @since 1.5.0 - */ -export declare class UnknownType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'UnknownType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface UnknownC extends UnknownType {} -/** - * @category primitives - * @since 1.5.0 - */ -export declare const unknown: UnknownC -/** - * @since 1.0.0 - */ -export declare class StringType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'StringType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface StringC extends StringType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const string: StringC -/** - * @since 1.0.0 - */ -export declare class NumberType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'NumberType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface NumberC extends NumberType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const number: NumberC -/** - * @since 2.1.0 - */ -export declare class BigIntType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'BigIntType' - constructor() -} -/** - * @since 2.1.0 - */ -export interface BigIntC extends BigIntType {} -/** - * @category primitives - * @since 2.1.0 - */ -export declare const bigint: BigIntC -/** - * @since 1.0.0 - */ -export declare class BooleanType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'BooleanType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface BooleanC extends BooleanType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const boolean: BooleanC -/** - * @since 1.0.0 - */ -export declare class AnyArrayType extends Type> { - /** - * @since 1.0.0 - */ - readonly _tag: 'AnyArrayType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface UnknownArrayC extends AnyArrayType {} -/** - * @category primitives - * @since 1.7.1 - */ -export declare const UnknownArray: UnknownArrayC -/** - * @since 1.0.0 - */ -export declare class AnyDictionaryType extends Type<{ - [key: string]: unknown -}> { - /** - * @since 1.0.0 - */ - readonly _tag: 'AnyDictionaryType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface UnknownRecordC extends AnyDictionaryType {} -/** - * @category primitives - * @since 1.7.1 - */ -export declare const UnknownRecord: UnknownRecordC -export { - /** - * @category primitives - * @since 1.0.0 - */ - nullType as null, - /** - * @category primitives - * @since 1.0.0 - */ - undefinedType as undefined, - /** - * @category primitives - * @since 1.0.0 - */ - voidType as void -} -type LiteralValue = string | number | boolean -/** - * @since 1.0.0 - */ -export declare class LiteralType extends Type { - readonly value: V - /** - * @since 1.0.0 - */ - readonly _tag: 'LiteralType' - constructor( - name: string, - is: LiteralType['is'], - validate: LiteralType['validate'], - encode: LiteralType['encode'], - value: V - ) -} -/** - * @since 1.5.3 - */ -export interface LiteralC extends LiteralType {} -/** - * @category constructors - * @since 1.0.0 - */ -export declare function literal(value: V, name?: string): LiteralC -/** - * @since 1.0.0 - */ -export declare class KeyofType< - D extends { - [key: string]: unknown - } -> extends Type { - readonly keys: D - /** - * @since 1.0.0 - */ - readonly _tag: 'KeyofType' - constructor( - name: string, - is: KeyofType['is'], - validate: KeyofType['validate'], - encode: KeyofType['encode'], - keys: D - ) -} -/** - * @since 1.5.3 - */ -export interface KeyofC< - D extends { - [key: string]: unknown - } -> extends KeyofType {} -/** - * @category constructors - * @since 1.0.0 - */ -export declare function keyof< - D extends { - [key: string]: unknown - } ->(keys: D, name?: string): KeyofC -/** - * @since 1.0.0 - */ -export declare class RefinementType extends Type { - readonly type: C - readonly predicate: Predicate - /** - * @since 1.0.0 - */ - readonly _tag: 'RefinementType' - constructor( - name: string, - is: RefinementType['is'], - validate: RefinementType['validate'], - encode: RefinementType['encode'], - type: C, - predicate: Predicate - ) -} -declare const _brand: unique symbol -/** - * @since 1.8.1 - */ -export interface Brand { - readonly [_brand]: B -} -/** - * @since 1.8.1 - */ -export type Branded = A & Brand -/** - * @since 1.8.1 - */ -export interface BrandC extends RefinementType, B>, OutputOf, InputOf> {} -/** - * @category combinators - * @since 1.8.1 - */ -export declare function brand< - C extends Any, - N extends string, - B extends { - readonly [K in N]: symbol - } ->(codec: C, predicate: Refinement, Branded, B>>, name: N): BrandC -/** - * @since 1.8.1 - */ -export interface IntBrand { - readonly Int: unique symbol -} -/** - * A branded codec representing an integer - * - * @category primitives - * @since 1.8.1 - */ -export declare const Int: BrandC -/** - * @since 1.8.1 - */ -export type Int = Branded -/** - * @since 1.0.0 - */ -export declare class RecursiveType extends Type { - runDefinition: () => C - /** - * @since 1.0.0 - */ - readonly _tag: 'RecursiveType' - constructor( - name: string, - is: RecursiveType['is'], - validate: RecursiveType['validate'], - encode: RecursiveType['encode'], - runDefinition: () => C - ) - /** - * @since 1.0.0 - */ - readonly type: C -} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function recursion = Type>( - name: string, - definition: (self: C) => C -): RecursiveType -/** - * @since 1.0.0 - */ -export declare class ArrayType extends Type { - readonly type: C - /** - * @since 1.0.0 - */ - readonly _tag: 'ArrayType' - constructor( - name: string, - is: ArrayType['is'], - validate: ArrayType['validate'], - encode: ArrayType['encode'], - type: C - ) -} -/** - * @since 1.5.3 - */ -export interface ArrayC extends ArrayType>, Array>, unknown> {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function array(item: C, name?: string): ArrayC -/** - * @since 1.0.0 - */ -export declare class InterfaceType extends Type { - readonly props: P - /** - * @since 1.0.0 - */ - readonly _tag: 'InterfaceType' - constructor( - name: string, - is: InterfaceType['is'], - validate: InterfaceType['validate'], - encode: InterfaceType['encode'], - props: P - ) -} -/** - * @since 1.5.3 - */ -export interface TypeC

- extends InterfaceType< - P, - { - [K in keyof P]: TypeOf - }, - { - [K in keyof P]: OutputOf - }, - unknown - > {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function type

(props: P, name?: string): TypeC

-/** - * @since 1.0.0 - */ -export declare class PartialType extends Type { - readonly props: P - /** - * @since 1.0.0 - */ - readonly _tag: 'PartialType' - constructor( - name: string, - is: PartialType['is'], - validate: PartialType['validate'], - encode: PartialType['encode'], - props: P - ) -} -/** - * @since 1.5.3 - */ -export interface PartialC

- extends PartialType< - P, - { - [K in keyof P]?: TypeOf - }, - { - [K in keyof P]?: OutputOf - }, - unknown - > {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function partial

(props: P, name?: string): PartialC

-/** - * @since 1.0.0 - */ -export declare class DictionaryType extends Type { - readonly domain: D - readonly codomain: C - /** - * @since 1.0.0 - */ - readonly _tag: 'DictionaryType' - constructor( - name: string, - is: DictionaryType['is'], - validate: DictionaryType['validate'], - encode: DictionaryType['encode'], - domain: D, - codomain: C - ) -} -/** - * @since 1.5.3 - */ -export interface RecordC - extends DictionaryType< - D, - C, - { - [K in TypeOf]: TypeOf - }, - { - [K in OutputOf]: OutputOf - }, - unknown - > {} -/** - * @category combinators - * @since 1.7.1 - */ -export declare function record(domain: D, codomain: C, name?: string): RecordC -/** - * @since 1.0.0 - */ -export declare class UnionType, A = any, O = A, I = unknown> extends Type { - readonly types: CS - /** - * @since 1.0.0 - */ - readonly _tag: 'UnionType' - constructor( - name: string, - is: UnionType['is'], - validate: UnionType['validate'], - encode: UnionType['encode'], - types: CS - ) -} -/** - * @since 1.5.3 - */ -export interface UnionC]> - extends UnionType, OutputOf, unknown> {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function union]>(codecs: CS, name?: string): UnionC -/** - * @since 1.0.0 - */ -export declare class IntersectionType, A = any, O = A, I = unknown> extends Type { - readonly types: CS - /** - * @since 1.0.0 - */ - readonly _tag: 'IntersectionType' - constructor( - name: string, - is: IntersectionType['is'], - validate: IntersectionType['validate'], - encode: IntersectionType['encode'], - types: CS - ) -} -/** - * @since 1.5.3 - */ -export interface IntersectionC]> - extends IntersectionType< - CS, - CS extends { - length: 2 - } - ? TypeOf & TypeOf - : CS extends { - length: 3 - } - ? TypeOf & TypeOf & TypeOf - : CS extends { - length: 4 - } - ? TypeOf & TypeOf & TypeOf & TypeOf - : CS extends { - length: 5 - } - ? TypeOf & TypeOf & TypeOf & TypeOf & TypeOf - : unknown, - CS extends { - length: 2 - } - ? OutputOf & OutputOf - : CS extends { - length: 3 - } - ? OutputOf & OutputOf & OutputOf - : CS extends { - length: 4 - } - ? OutputOf & OutputOf & OutputOf & OutputOf - : CS extends { - length: 5 - } - ? OutputOf & OutputOf & OutputOf & OutputOf & OutputOf - : unknown, - unknown - > {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function intersection< - A extends Mixed, - B extends Mixed, - C extends Mixed, - D extends Mixed, - E extends Mixed ->(codecs: [A, B, C, D, E], name?: string): IntersectionC<[A, B, C, D, E]> -export declare function intersection( - codecs: [A, B, C, D], - name?: string -): IntersectionC<[A, B, C, D]> -export declare function intersection( - codecs: [A, B, C], - name?: string -): IntersectionC<[A, B, C]> -export declare function intersection( - codecs: [A, B], - name?: string -): IntersectionC<[A, B]> -/** - * @since 1.0.0 - */ -export declare class TupleType, A = any, O = A, I = unknown> extends Type { - readonly types: CS - /** - * @since 1.0.0 - */ - readonly _tag: 'TupleType' - constructor( - name: string, - is: TupleType['is'], - validate: TupleType['validate'], - encode: TupleType['encode'], - types: CS - ) -} -/** - * @since 1.5.3 - */ -export interface TupleC]> - extends TupleType< - CS, - CS extends { - length: 1 - } - ? [TypeOf] - : CS extends { - length: 2 - } - ? [TypeOf, TypeOf] - : CS extends { - length: 3 - } - ? [TypeOf, TypeOf, TypeOf] - : CS extends { - length: 4 - } - ? [TypeOf, TypeOf, TypeOf, TypeOf] - : CS extends { - length: 5 - } - ? [TypeOf, TypeOf, TypeOf, TypeOf, TypeOf] - : unknown, - CS extends { - length: 1 - } - ? [OutputOf] - : CS extends { - length: 2 - } - ? [OutputOf, OutputOf] - : CS extends { - length: 3 - } - ? [OutputOf, OutputOf, OutputOf] - : CS extends { - length: 4 - } - ? [OutputOf, OutputOf, OutputOf, OutputOf] - : CS extends { - length: 5 - } - ? [OutputOf, OutputOf, OutputOf, OutputOf, OutputOf] - : unknown, - unknown - > {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function tuple( - codecs: [A, B, C, D, E], - name?: string -): TupleC<[A, B, C, D, E]> -export declare function tuple( - codecs: [A, B, C, D], - name?: string -): TupleC<[A, B, C, D]> -export declare function tuple( - codecs: [A, B, C], - name?: string -): TupleC<[A, B, C]> -export declare function tuple(codecs: [A, B], name?: string): TupleC<[A, B]> -export declare function tuple(codecs: [A], name?: string): TupleC<[A]> -/** - * @since 1.0.0 - */ -export declare class ReadonlyType extends Type { - readonly type: C - /** - * @since 1.0.0 - */ - readonly _tag: 'ReadonlyType' - constructor( - name: string, - is: ReadonlyType['is'], - validate: ReadonlyType['validate'], - encode: ReadonlyType['encode'], - type: C - ) -} -/** - * @since 1.5.3 - */ -export interface ReadonlyC - extends ReadonlyType>, Readonly>, unknown> {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function readonly(codec: C, name?: string): ReadonlyC -/** - * @since 1.0.0 - */ -export declare class ReadonlyArrayType extends Type { - readonly type: C - /** - * @since 1.0.0 - */ - readonly _tag: 'ReadonlyArrayType' - constructor( - name: string, - is: ReadonlyArrayType['is'], - validate: ReadonlyArrayType['validate'], - encode: ReadonlyArrayType['encode'], - type: C - ) -} -/** - * @since 1.5.3 - */ -export interface ReadonlyArrayC - extends ReadonlyArrayType>, ReadonlyArray>, unknown> {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function readonlyArray(item: C, name?: string): ReadonlyArrayC -/** - * Strips additional properties, equivalent to `exact(type(props))`. - * - * @category combinators - * @since 1.0.0 - */ -export declare const strict:

(props: P, name?: string) => ExactC> -/** - * @since 1.1.0 - */ -export declare class ExactType extends Type { - readonly type: C - /** - * @since 1.0.0 - */ - readonly _tag: 'ExactType' - constructor( - name: string, - is: ExactType['is'], - validate: ExactType['validate'], - encode: ExactType['encode'], - type: C - ) -} -/** - * @since 1.5.3 - */ -export interface ExactC extends ExactType, OutputOf, InputOf> {} -/** - * Strips additional properties. - * - * @category combinators - * @since 1.1.0 - */ -export declare function exact(codec: C, name?: string): ExactC -/** - * @since 1.0.0 - */ -export declare class FunctionType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'FunctionType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface FunctionC extends FunctionType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const Function: FunctionC -/** - * @since 1.0.0 - */ -export declare class NeverType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'NeverType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface NeverC extends NeverType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const never: NeverC -/** - * @since 1.0.0 - */ -export declare class AnyType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'AnyType' - constructor() -} -/** - * @since 1.5.3 - */ -export interface AnyC extends AnyType {} -/** - * @category primitives - * @since 1.0.0 - */ -export declare const any: AnyC -/** - * @since 1.5.3 - */ -export interface RefinementC> extends RefinementType, InputOf> {} -/** - * @category combinators - * @since 1.0.0 - */ -export declare function refinement>( - codec: C, - refinement: Refinement, B>, - name?: string -): RefinementC -export declare function refinement( - codec: C, - predicate: Predicate>, - name?: string -): RefinementC -/** - * @category primitives - * @since 1.0.0 - */ -export declare const Integer: RefinementC -/** - * @since 1.3.0 - * @deprecated - */ -export declare class TaggedUnionType< - Tag extends string, - CS extends Array, - A = any, - O = A, - I = unknown -> extends UnionType { - readonly tag: Tag - constructor( - name: string, - is: TaggedUnionType['is'], - validate: TaggedUnionType['validate'], - encode: TaggedUnionType['encode'], - codecs: CS, - tag: Tag - ) -} -/** - * @since 1.5.3 - * @deprecated - */ -export interface TaggedUnionC]> // tslint:disable-next-line: deprecation - extends TaggedUnionType, OutputOf, unknown> {} -/** - * Use `union` instead. - * - * @category combinators - * @since 1.3.0 - * @deprecated - */ -export declare const taggedUnion: ( - tag: Tag, - codecs: CS, - name?: string -) => TaggedUnionC -export { - /** - * Use `UnknownArray` instead. - * - * @category primitives - * @deprecated - * @since 1.0.0 - */ - UnknownArray as Array -} -export { - /** - * Use `type` instead. - * - * @category combinators - * @deprecated - * @since 1.0.0 - */ - type as interface -} -/** - * Use `unknown` instead. - * - * @since 1.0.0 - * @deprecated - */ -export type mixed = unknown -/** - * @since 1.0.0 - * @deprecated - */ -export declare const getValidationError: (value: unknown, context: Context) => ValidationError -/** - * @since 1.0.0 - * @deprecated - */ -export declare const getDefaultContext: (decoder: Decoder) => Context -/** - * Use `UnknownRecord` instead. - * - * @category primitives - * @since 1.0.0 - * @deprecated - */ -export declare const Dictionary: UnknownRecordC -/** - * @since 1.0.0 - * @deprecated - */ -export declare class ObjectType extends Type { - /** - * @since 1.0.0 - */ - readonly _tag: 'ObjectType' - constructor() -} -/** - * @since 1.5.3 - * @deprecated - */ -export interface ObjectC extends ObjectType {} -/** - * Use `UnknownRecord` instead. - * - * @category primitives - * @since 1.0.0 - * @deprecated - */ -export declare const object: ObjectC -/** - * Use `record` instead. - * - * @category combinators - * @since 1.0.0 - * @deprecated - */ -export declare const dictionary: typeof record -/** - * @since 1.4.2 - * @deprecated - */ -export type Compact = { - [K in keyof A]: A[K] -} -/** - * @since 1.0.0 - * @deprecated - */ -export declare class StrictType extends Type { - readonly props: P - /** - * @since 1.0.0 - */ - readonly _tag: 'StrictType' - constructor( - name: string, - is: StrictType['is'], - validate: StrictType['validate'], - encode: StrictType['encode'], - props: P - ) -} -/** - * @since 1.5.3 - * @deprecated - */ -export interface StrictC

// tslint:disable-next-line: deprecation - extends StrictType< - P, - { - [K in keyof P]: TypeOf - }, - { - [K in keyof P]: OutputOf - }, - unknown - > {} -/** - * @since 1.3.0 - * @deprecated - */ -export type TaggedProps = { - [K in Tag]: LiteralType -} -/** - * @since 1.3.0 - * @deprecated - */ -export interface TaggedRefinement extends RefinementType, A, O> {} -/** - * @since 1.3.0 - * @deprecated - */ -export interface TaggedUnion extends UnionType>, A, O> {} -/** - * @since 1.3.0 - * @deprecated - */ -export type TaggedIntersectionArgument = - | [Tagged] - | [Tagged, Mixed] - | [Mixed, Tagged] - | [Tagged, Mixed, Mixed] - | [Mixed, Tagged, Mixed] - | [Mixed, Mixed, Tagged] - | [Tagged, Mixed, Mixed, Mixed] - | [Mixed, Tagged, Mixed, Mixed] - | [Mixed, Mixed, Tagged, Mixed] - | [Mixed, Mixed, Mixed, Tagged] - | [Tagged, Mixed, Mixed, Mixed, Mixed] - | [Mixed, Tagged, Mixed, Mixed, Mixed] - | [Mixed, Mixed, Tagged, Mixed, Mixed] - | [Mixed, Mixed, Mixed, Tagged, Mixed] - | [Mixed, Mixed, Mixed, Mixed, Tagged] -/** - * @since 1.3.0 - * @deprecated - */ -export interface TaggedIntersection // tslint:disable-next-line: deprecation - extends IntersectionType, A, O> {} -/** - * @since 1.3.0 - * @deprecated - */ -export interface TaggedExact extends ExactType, A, O> {} -/** - * @since 1.3.0 - * @deprecated - */ -export type Tagged = - | InterfaceType, A, O> - | StrictType, A, O> - | TaggedRefinement - | TaggedUnion - | TaggedIntersection - | TaggedExact - | RecursiveType -/** - * Drops the codec "kind". - * - * @category combinators - * @since 1.1.0 - * @deprecated - */ -export declare function clean(codec: Type): Type -/** - * @since 1.0.0 - * @deprecated - */ -export type PropsOf< - T extends { - props: any - } -> = T['props'] -/** - * @since 1.1.0 - * @deprecated - */ -export type Exact = T & { - [K in ({ - [K in keyof X]: K - } & { - [K in keyof T]: never - } & { - [key: string]: never - })[keyof X]]?: never -} -/** - * Keeps the codec "kind". - * - * @category combinators - * @since 1.1.0 - * @deprecated - */ -export declare function alias( - codec: PartialType -): () => PartialType -export declare function alias( - codec: StrictType -): () => StrictType -export declare function alias( - codec: InterfaceType -): () => InterfaceType diff --git a/components/pexels/node_modules/io-ts/lib/index.js b/components/pexels/node_modules/io-ts/lib/index.js deleted file mode 100644 index 9fd87d968cac1..0000000000000 --- a/components/pexels/node_modules/io-ts/lib/index.js +++ /dev/null @@ -1,1650 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.partial = exports.PartialType = exports.type = exports.InterfaceType = exports.array = exports.ArrayType = exports.recursion = exports.RecursiveType = exports.Int = exports.brand = exports.RefinementType = exports.keyof = exports.KeyofType = exports.literal = exports.LiteralType = exports.void = exports.undefined = exports.null = exports.UnknownRecord = exports.AnyDictionaryType = exports.UnknownArray = exports.AnyArrayType = exports.boolean = exports.BooleanType = exports.bigint = exports.BigIntType = exports.number = exports.NumberType = exports.string = exports.StringType = exports.unknown = exports.UnknownType = exports.voidType = exports.VoidType = exports.UndefinedType = exports.nullType = exports.NullType = exports.getIndex = exports.getTags = exports.emptyTags = exports.mergeAll = exports.getDomainKeys = exports.appendContext = exports.getContextEntry = exports.getFunctionName = exports.identity = exports.Type = exports.success = exports.failure = exports.failures = void 0; -exports.alias = exports.clean = exports.StrictType = exports.dictionary = exports.object = exports.ObjectType = exports.Dictionary = exports.getDefaultContext = exports.getValidationError = exports.interface = exports.Array = exports.taggedUnion = exports.TaggedUnionType = exports.Integer = exports.refinement = exports.any = exports.AnyType = exports.never = exports.NeverType = exports.Function = exports.FunctionType = exports.exact = exports.ExactType = exports.strict = exports.readonlyArray = exports.ReadonlyArrayType = exports.readonly = exports.ReadonlyType = exports.tuple = exports.TupleType = exports.intersection = exports.IntersectionType = exports.union = exports.UnionType = exports.record = exports.DictionaryType = void 0; -/** - * @since 1.0.0 - */ -var Either_1 = require("fp-ts/lib/Either"); -/** - * @category Decode error - * @since 1.0.0 - */ -exports.failures = Either_1.left; -/** - * @category Decode error - * @since 1.0.0 - */ -var failure = function (value, context, message) { - return (0, exports.failures)([{ value: value, context: context, message: message }]); -}; -exports.failure = failure; -/** - * @category Decode error - * @since 1.0.0 - */ -exports.success = Either_1.right; -/** - * @category Codec - * @since 1.0.0 - */ -var Type = /** @class */ (function () { - function Type( - /** a unique name for this codec */ - name, - /** a custom type guard */ - is, - /** succeeds if a value of type I can be decoded to a value of type A */ - validate, - /** converts a value of type A to a value of type O */ - encode) { - this.name = name; - this.is = is; - this.validate = validate; - this.encode = encode; - this.decode = this.decode.bind(this); - } - /** - * @since 1.0.0 - */ - Type.prototype.pipe = function (ab, name) { - var _this = this; - if (name === void 0) { name = "pipe(".concat(this.name, ", ").concat(ab.name, ")"); } - return new Type(name, ab.is, function (i, c) { - var e = _this.validate(i, c); - if ((0, Either_1.isLeft)(e)) { - return e; - } - return ab.validate(e.right, c); - }, this.encode === exports.identity && ab.encode === exports.identity ? exports.identity : function (b) { return _this.encode(ab.encode(b)); }); - }; - /** - * @since 1.0.0 - */ - Type.prototype.asDecoder = function () { - return this; - }; - /** - * @since 1.0.0 - */ - Type.prototype.asEncoder = function () { - return this; - }; - /** - * a version of `validate` with a default context - * @since 1.0.0 - */ - Type.prototype.decode = function (i) { - return this.validate(i, [{ key: '', type: this, actual: i }]); - }; - return Type; -}()); -exports.Type = Type; -// ------------------------------------------------------------------------------------- -// utils -// ------------------------------------------------------------------------------------- -/** - * @since 1.0.0 - */ -var identity = function (a) { return a; }; -exports.identity = identity; -/** - * @since 1.0.0 - */ -function getFunctionName(f) { - return f.displayName || f.name || ""); -} -exports.getFunctionName = getFunctionName; -/** - * @since 1.0.0 - */ -function getContextEntry(key, decoder) { - return { key: key, type: decoder }; -} -exports.getContextEntry = getContextEntry; -/** - * @since 1.0.0 - */ -function appendContext(c, key, decoder, actual) { - var len = c.length; - var r = Array(len + 1); - for (var i = 0; i < len; i++) { - r[i] = c[i]; - } - r[len] = { key: key, type: decoder, actual: actual }; - return r; -} -exports.appendContext = appendContext; -function pushAll(xs, ys) { - var l = ys.length; - for (var i = 0; i < l; i++) { - xs.push(ys[i]); - } -} -var hasOwnProperty = Object.prototype.hasOwnProperty; -function getNameFromProps(props) { - return Object.keys(props) - .map(function (k) { return "".concat(k, ": ").concat(props[k].name); }) - .join(', '); -} -function useIdentity(codecs) { - for (var i = 0; i < codecs.length; i++) { - if (codecs[i].encode !== exports.identity) { - return false; - } - } - return true; -} -function getInterfaceTypeName(props) { - return "{ ".concat(getNameFromProps(props), " }"); -} -function getPartialTypeName(inner) { - return "Partial<".concat(inner, ">"); -} -function enumerableRecord(keys, domain, codomain, name) { - if (name === void 0) { name = "{ [K in ".concat(domain.name, "]: ").concat(codomain.name, " }"); } - var len = keys.length; - var props = {}; - for (var i = 0; i < len; i++) { - props[keys[i]] = codomain; - } - var exactCodec = (0, exports.strict)(props, name); - return new DictionaryType(name, function (u) { return exactCodec.is(u); }, exactCodec.validate, exactCodec.encode, domain, codomain); -} -/** - * @internal - */ -function getDomainKeys(domain) { - var _a; - if (isLiteralC(domain)) { - var literal_1 = domain.value; - if (exports.string.is(literal_1)) { - return _a = {}, _a[literal_1] = null, _a; - } - } - else if (isKeyofC(domain)) { - return domain.keys; - } - else if (isUnionC(domain)) { - var keys = domain.types.map(function (type) { return getDomainKeys(type); }); - return keys.some(undefinedType.is) ? undefined : Object.assign.apply(Object, __spreadArray([{}], keys, false)); - } - return undefined; -} -exports.getDomainKeys = getDomainKeys; -function stripNonDomainKeys(o, domain) { - var keys = Object.keys(o); - var len = keys.length; - var shouldStrip = false; - var r = {}; - for (var i = 0; i < len; i++) { - var k = keys[i]; - if (domain.is(k)) { - r[k] = o[k]; - } - else { - shouldStrip = true; - } - } - return shouldStrip ? r : o; -} -function nonEnumerableRecord(domain, codomain, name) { - if (name === void 0) { name = "{ [K in ".concat(domain.name, "]: ").concat(codomain.name, " }"); } - return new DictionaryType(name, function (u) { - if (exports.UnknownRecord.is(u)) { - return Object.keys(u).every(function (k) { return !domain.is(k) || codomain.is(u[k]); }); - } - return isAnyC(codomain) && Array.isArray(u); - }, function (u, c) { - if (exports.UnknownRecord.is(u)) { - var a = {}; - var errors = []; - var keys = Object.keys(u); - var len = keys.length; - var changed = false; - for (var i = 0; i < len; i++) { - var k = keys[i]; - var ok = u[k]; - var domainResult = domain.validate(k, appendContext(c, k, domain, k)); - if ((0, Either_1.isLeft)(domainResult)) { - changed = true; - } - else { - var vk = domainResult.right; - changed = changed || vk !== k; - k = vk; - var codomainResult = codomain.validate(ok, appendContext(c, k, codomain, ok)); - if ((0, Either_1.isLeft)(codomainResult)) { - pushAll(errors, codomainResult.left); - } - else { - var vok = codomainResult.right; - changed = changed || vok !== ok; - a[k] = vok; - } - } - } - return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)((changed ? a : u)); - } - if (isAnyC(codomain) && Array.isArray(u)) { - return (0, exports.success)(u); - } - return (0, exports.failure)(u, c); - }, domain.encode === exports.identity && codomain.encode === exports.identity - ? function (a) { return stripNonDomainKeys(a, domain); } - : function (a) { - var s = {}; - var keys = Object.keys(stripNonDomainKeys(a, domain)); - var len = keys.length; - for (var i = 0; i < len; i++) { - var k = keys[i]; - s[String(domain.encode(k))] = codomain.encode(a[k]); - } - return s; - }, domain, codomain); -} -function getUnionName(codecs) { - return '(' + codecs.map(function (type) { return type.name; }).join(' | ') + ')'; -} -/** - * @internal - */ -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -function mergeAll(base, us) { - var equal = true; - var primitive = true; - var baseIsNotADictionary = !exports.UnknownRecord.is(base); - for (var _i = 0, us_1 = us; _i < us_1.length; _i++) { - var u = us_1[_i]; - if (u !== base) { - equal = false; - } - if (exports.UnknownRecord.is(u)) { - primitive = false; - } - } - if (equal) { - return base; - } - else if (primitive) { - return us[us.length - 1]; - } - var r = {}; - for (var _a = 0, us_2 = us; _a < us_2.length; _a++) { - var u = us_2[_a]; - for (var k in u) { - if (!hasOwnProperty.call(r, k) || baseIsNotADictionary || u[k] !== base[k]) { - r[k] = u[k]; - } - } - } - return r; -} -exports.mergeAll = mergeAll; -function getProps(codec) { - switch (codec._tag) { - case 'RefinementType': - case 'ReadonlyType': - return getProps(codec.type); - case 'InterfaceType': - case 'StrictType': - case 'PartialType': - return codec.props; - case 'IntersectionType': - return codec.types.reduce(function (props, type) { return Object.assign(props, getProps(type)); }, {}); - } -} -function stripKeys(o, props) { - var keys = Object.getOwnPropertyNames(o); - var shouldStrip = false; - var r = {}; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - if (!hasOwnProperty.call(props, key)) { - shouldStrip = true; - } - else { - r[key] = o[key]; - } - } - return shouldStrip ? r : o; -} -function getExactTypeName(codec) { - if (isTypeC(codec)) { - return "{| ".concat(getNameFromProps(codec.props), " |}"); - } - else if (isPartialC(codec)) { - return getPartialTypeName("{| ".concat(getNameFromProps(codec.props), " |}")); - } - return "Exact<".concat(codec.name, ">"); -} -function isNonEmpty(as) { - return as.length > 0; -} -/** - * @internal - */ -exports.emptyTags = {}; -function intersect(a, b) { - var r = []; - for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { - var v = a_1[_i]; - if (b.indexOf(v) !== -1) { - r.push(v); - } - } - return r; -} -function mergeTags(a, b) { - if (a === exports.emptyTags) { - return b; - } - if (b === exports.emptyTags) { - return a; - } - var r = Object.assign({}, a); - for (var k in b) { - if (hasOwnProperty.call(a, k)) { - var intersection_1 = intersect(a[k], b[k]); - if (isNonEmpty(intersection_1)) { - r[k] = intersection_1; - } - else { - r = exports.emptyTags; - break; - } - } - else { - r[k] = b[k]; - } - } - return r; -} -function intersectTags(a, b) { - if (a === exports.emptyTags || b === exports.emptyTags) { - return exports.emptyTags; - } - var r = exports.emptyTags; - for (var k in a) { - if (hasOwnProperty.call(b, k)) { - var intersection_2 = intersect(a[k], b[k]); - if (intersection_2.length === 0) { - if (r === exports.emptyTags) { - r = {}; - } - r[k] = a[k].concat(b[k]); - } - } - } - return r; -} -// tslint:disable-next-line: deprecation -function isAnyC(codec) { - return codec._tag === 'AnyType'; -} -function isLiteralC(codec) { - return codec._tag === 'LiteralType'; -} -function isKeyofC(codec) { - return codec._tag === 'KeyofType'; -} -function isTypeC(codec) { - return codec._tag === 'InterfaceType'; -} -function isPartialC(codec) { - return codec._tag === 'PartialType'; -} -// tslint:disable-next-line: deprecation -function isStrictC(codec) { - return codec._tag === 'StrictType'; -} -function isExactC(codec) { - return codec._tag === 'ExactType'; -} -// tslint:disable-next-line: deprecation -function isRefinementC(codec) { - return codec._tag === 'RefinementType'; -} -function isIntersectionC(codec) { - return codec._tag === 'IntersectionType'; -} -function isUnionC(codec) { - return codec._tag === 'UnionType'; -} -function isRecursiveC(codec) { - return codec._tag === 'RecursiveType'; -} -function isReadonlyC(codec) { - return codec._tag === 'ReadonlyType'; -} -var lazyCodecs = []; -/** - * @internal - */ -function getTags(codec) { - if (lazyCodecs.indexOf(codec) !== -1) { - return exports.emptyTags; - } - if (isTypeC(codec) || isStrictC(codec)) { - var index = exports.emptyTags; - // tslint:disable-next-line: forin - for (var k in codec.props) { - var prop = codec.props[k]; - if (isLiteralC(prop)) { - if (index === exports.emptyTags) { - index = {}; - } - index[k] = [prop.value]; - } - } - return index; - } - else if (isExactC(codec) || isRefinementC(codec) || isReadonlyC(codec)) { - return getTags(codec.type); - } - else if (isIntersectionC(codec)) { - return codec.types.reduce(function (tags, codec) { return mergeTags(tags, getTags(codec)); }, exports.emptyTags); - } - else if (isUnionC(codec)) { - return codec.types.slice(1).reduce(function (tags, codec) { return intersectTags(tags, getTags(codec)); }, getTags(codec.types[0])); - } - else if (isRecursiveC(codec)) { - lazyCodecs.push(codec); - var tags = getTags(codec.type); - lazyCodecs.pop(); - return tags; - } - return exports.emptyTags; -} -exports.getTags = getTags; -/** - * @internal - */ -function getIndex(codecs) { - var tags = getTags(codecs[0]); - var keys = Object.keys(tags); - var len = codecs.length; - var _loop_1 = function (k) { - var all = tags[k].slice(); - var index = [tags[k]]; - for (var i = 1; i < len; i++) { - var codec = codecs[i]; - var ctags = getTags(codec); - var values = ctags[k]; - // tslint:disable-next-line: strict-type-predicates - if (values === undefined) { - return "continue-keys"; - } - else { - if (values.some(function (v) { return all.indexOf(v) !== -1; })) { - return "continue-keys"; - } - else { - all.push.apply(all, values); - index.push(values); - } - } - } - return { value: [k, index] }; - }; - keys: for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { - var k = keys_1[_i]; - var state_1 = _loop_1(k); - if (typeof state_1 === "object") - return state_1.value; - switch (state_1) { - case "continue-keys": continue keys; - } - } - return undefined; -} -exports.getIndex = getIndex; -// ------------------------------------------------------------------------------------- -// primitives -// ------------------------------------------------------------------------------------- -/** - * @since 1.0.0 - */ -var NullType = /** @class */ (function (_super) { - __extends(NullType, _super); - function NullType() { - var _this = _super.call(this, 'null', function (u) { return u === null; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'NullType'; - return _this; - } - return NullType; -}(Type)); -exports.NullType = NullType; -/** - * @category primitives - * @since 1.0.0 - */ -exports.nullType = new NullType(); -exports.null = exports.nullType; -/** - * @since 1.0.0 - */ -var UndefinedType = /** @class */ (function (_super) { - __extends(UndefinedType, _super); - function UndefinedType() { - var _this = _super.call(this, 'undefined', function (u) { return u === void 0; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'UndefinedType'; - return _this; - } - return UndefinedType; -}(Type)); -exports.UndefinedType = UndefinedType; -var undefinedType = new UndefinedType(); -exports.undefined = undefinedType; -/** - * @since 1.2.0 - */ -var VoidType = /** @class */ (function (_super) { - __extends(VoidType, _super); - function VoidType() { - var _this = _super.call(this, 'void', undefinedType.is, undefinedType.validate, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'VoidType'; - return _this; - } - return VoidType; -}(Type)); -exports.VoidType = VoidType; -/** - * @category primitives - * @since 1.2.0 - */ -exports.voidType = new VoidType(); -exports.void = exports.voidType; -/** - * @since 1.5.0 - */ -var UnknownType = /** @class */ (function (_super) { - __extends(UnknownType, _super); - function UnknownType() { - var _this = _super.call(this, 'unknown', function (_) { return true; }, exports.success, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'UnknownType'; - return _this; - } - return UnknownType; -}(Type)); -exports.UnknownType = UnknownType; -/** - * @category primitives - * @since 1.5.0 - */ -exports.unknown = new UnknownType(); -/** - * @since 1.0.0 - */ -var StringType = /** @class */ (function (_super) { - __extends(StringType, _super); - function StringType() { - var _this = _super.call(this, 'string', function (u) { return typeof u === 'string'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'StringType'; - return _this; - } - return StringType; -}(Type)); -exports.StringType = StringType; -/** - * @category primitives - * @since 1.0.0 - */ -exports.string = new StringType(); -/** - * @since 1.0.0 - */ -var NumberType = /** @class */ (function (_super) { - __extends(NumberType, _super); - function NumberType() { - var _this = _super.call(this, 'number', function (u) { return typeof u === 'number'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'NumberType'; - return _this; - } - return NumberType; -}(Type)); -exports.NumberType = NumberType; -/** - * @category primitives - * @since 1.0.0 - */ -exports.number = new NumberType(); -/** - * @since 2.1.0 - */ -var BigIntType = /** @class */ (function (_super) { - __extends(BigIntType, _super); - function BigIntType() { - var _this = _super.call(this, 'bigint', - // tslint:disable-next-line: valid-typeof - function (u) { return typeof u === 'bigint'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'BigIntType'; - return _this; - } - return BigIntType; -}(Type)); -exports.BigIntType = BigIntType; -/** - * @category primitives - * @since 2.1.0 - */ -exports.bigint = new BigIntType(); -/** - * @since 1.0.0 - */ -var BooleanType = /** @class */ (function (_super) { - __extends(BooleanType, _super); - function BooleanType() { - var _this = _super.call(this, 'boolean', function (u) { return typeof u === 'boolean'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'BooleanType'; - return _this; - } - return BooleanType; -}(Type)); -exports.BooleanType = BooleanType; -/** - * @category primitives - * @since 1.0.0 - */ -exports.boolean = new BooleanType(); -/** - * @since 1.0.0 - */ -var AnyArrayType = /** @class */ (function (_super) { - __extends(AnyArrayType, _super); - function AnyArrayType() { - var _this = _super.call(this, 'UnknownArray', Array.isArray, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'AnyArrayType'; - return _this; - } - return AnyArrayType; -}(Type)); -exports.AnyArrayType = AnyArrayType; -/** - * @category primitives - * @since 1.7.1 - */ -exports.UnknownArray = new AnyArrayType(); -exports.Array = exports.UnknownArray; -/** - * @since 1.0.0 - */ -var AnyDictionaryType = /** @class */ (function (_super) { - __extends(AnyDictionaryType, _super); - function AnyDictionaryType() { - var _this = _super.call(this, 'UnknownRecord', function (u) { return u !== null && typeof u === 'object' && !Array.isArray(u); }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'AnyDictionaryType'; - return _this; - } - return AnyDictionaryType; -}(Type)); -exports.AnyDictionaryType = AnyDictionaryType; -/** - * @category primitives - * @since 1.7.1 - */ -exports.UnknownRecord = new AnyDictionaryType(); -/** - * @since 1.0.0 - */ -var LiteralType = /** @class */ (function (_super) { - __extends(LiteralType, _super); - function LiteralType(name, is, validate, encode, value) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.value = value; - /** - * @since 1.0.0 - */ - _this._tag = 'LiteralType'; - return _this; - } - return LiteralType; -}(Type)); -exports.LiteralType = LiteralType; -/** - * @category constructors - * @since 1.0.0 - */ -function literal(value, name) { - if (name === void 0) { name = JSON.stringify(value); } - var is = function (u) { return u === value; }; - return new LiteralType(name, is, function (u, c) { return (is(u) ? (0, exports.success)(value) : (0, exports.failure)(u, c)); }, exports.identity, value); -} -exports.literal = literal; -/** - * @since 1.0.0 - */ -var KeyofType = /** @class */ (function (_super) { - __extends(KeyofType, _super); - function KeyofType(name, is, validate, encode, keys) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.keys = keys; - /** - * @since 1.0.0 - */ - _this._tag = 'KeyofType'; - return _this; - } - return KeyofType; -}(Type)); -exports.KeyofType = KeyofType; -/** - * @category constructors - * @since 1.0.0 - */ -function keyof(keys, name) { - if (name === void 0) { name = Object.keys(keys) - .map(function (k) { return JSON.stringify(k); }) - .join(' | '); } - var is = function (u) { return exports.string.is(u) && hasOwnProperty.call(keys, u); }; - return new KeyofType(name, is, function (u, c) { return (is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity, keys); -} -exports.keyof = keyof; -// ------------------------------------------------------------------------------------- -// combinators -// ------------------------------------------------------------------------------------- -/** - * @since 1.0.0 - */ -var RefinementType = /** @class */ (function (_super) { - __extends(RefinementType, _super); - function RefinementType(name, is, validate, encode, type, predicate) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.type = type; - _this.predicate = predicate; - /** - * @since 1.0.0 - */ - _this._tag = 'RefinementType'; - return _this; - } - return RefinementType; -}(Type)); -exports.RefinementType = RefinementType; -/** - * @category combinators - * @since 1.8.1 - */ -function brand(codec, predicate, name) { - return refinement(codec, predicate, name); -} -exports.brand = brand; -/** - * A branded codec representing an integer - * - * @category primitives - * @since 1.8.1 - */ -exports.Int = brand(exports.number, function (n) { return Number.isInteger(n); }, 'Int'); -/** - * @since 1.0.0 - */ -var RecursiveType = /** @class */ (function (_super) { - __extends(RecursiveType, _super); - function RecursiveType(name, is, validate, encode, runDefinition) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.runDefinition = runDefinition; - /** - * @since 1.0.0 - */ - _this._tag = 'RecursiveType'; - return _this; - } - return RecursiveType; -}(Type)); -exports.RecursiveType = RecursiveType; -Object.defineProperty(RecursiveType.prototype, 'type', { - get: function () { - return this.runDefinition(); - }, - enumerable: true, - configurable: true -}); -/** - * @category combinators - * @since 1.0.0 - */ -function recursion(name, definition) { - var cache; - var runDefinition = function () { - if (!cache) { - cache = definition(Self); - cache.name = name; - } - return cache; - }; - var Self = new RecursiveType(name, function (u) { return runDefinition().is(u); }, function (u, c) { return runDefinition().validate(u, c); }, function (a) { return runDefinition().encode(a); }, runDefinition); - return Self; -} -exports.recursion = recursion; -/** - * @since 1.0.0 - */ -var ArrayType = /** @class */ (function (_super) { - __extends(ArrayType, _super); - function ArrayType(name, is, validate, encode, type) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.type = type; - /** - * @since 1.0.0 - */ - _this._tag = 'ArrayType'; - return _this; - } - return ArrayType; -}(Type)); -exports.ArrayType = ArrayType; -/** - * @category combinators - * @since 1.0.0 - */ -function array(item, name) { - if (name === void 0) { name = "Array<".concat(item.name, ">"); } - return new ArrayType(name, function (u) { return exports.UnknownArray.is(u) && u.every(item.is); }, function (u, c) { - var e = exports.UnknownArray.validate(u, c); - if ((0, Either_1.isLeft)(e)) { - return e; - } - var us = e.right; - var len = us.length; - var as = us; - var errors = []; - for (var i = 0; i < len; i++) { - var ui = us[i]; - var result = item.validate(ui, appendContext(c, String(i), item, ui)); - if ((0, Either_1.isLeft)(result)) { - pushAll(errors, result.left); - } - else { - var ai = result.right; - if (ai !== ui) { - if (as === us) { - as = us.slice(); - } - as[i] = ai; - } - } - } - return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)(as); - }, item.encode === exports.identity ? exports.identity : function (a) { return a.map(item.encode); }, item); -} -exports.array = array; -/** - * @since 1.0.0 - */ -var InterfaceType = /** @class */ (function (_super) { - __extends(InterfaceType, _super); - function InterfaceType(name, is, validate, encode, props) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.props = props; - /** - * @since 1.0.0 - */ - _this._tag = 'InterfaceType'; - return _this; - } - return InterfaceType; -}(Type)); -exports.InterfaceType = InterfaceType; -/** - * @category combinators - * @since 1.0.0 - */ -function type(props, name) { - if (name === void 0) { name = getInterfaceTypeName(props); } - var keys = Object.keys(props); - var types = keys.map(function (key) { return props[key]; }); - var len = keys.length; - return new InterfaceType(name, function (u) { - if (exports.UnknownRecord.is(u)) { - for (var i = 0; i < len; i++) { - var k = keys[i]; - var uk = u[k]; - if ((uk === undefined && !hasOwnProperty.call(u, k)) || !types[i].is(uk)) { - return false; - } - } - return true; - } - return false; - }, function (u, c) { - var e = exports.UnknownRecord.validate(u, c); - if ((0, Either_1.isLeft)(e)) { - return e; - } - var o = e.right; - var a = o; - var errors = []; - for (var i = 0; i < len; i++) { - var k = keys[i]; - var ak = a[k]; - var type_1 = types[i]; - var result = type_1.validate(ak, appendContext(c, k, type_1, ak)); - if ((0, Either_1.isLeft)(result)) { - pushAll(errors, result.left); - } - else { - var vak = result.right; - if (vak !== ak || (vak === undefined && !hasOwnProperty.call(a, k))) { - /* istanbul ignore next */ - if (a === o) { - a = __assign({}, o); - } - a[k] = vak; - } - } - } - return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)(a); - }, useIdentity(types) - ? exports.identity - : function (a) { - var s = __assign({}, a); - for (var i = 0; i < len; i++) { - var k = keys[i]; - var encode = types[i].encode; - if (encode !== exports.identity) { - s[k] = encode(a[k]); - } - } - return s; - }, props); -} -exports.type = type; -exports.interface = type; -/** - * @since 1.0.0 - */ -var PartialType = /** @class */ (function (_super) { - __extends(PartialType, _super); - function PartialType(name, is, validate, encode, props) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.props = props; - /** - * @since 1.0.0 - */ - _this._tag = 'PartialType'; - return _this; - } - return PartialType; -}(Type)); -exports.PartialType = PartialType; -/** - * @category combinators - * @since 1.0.0 - */ -function partial(props, name) { - if (name === void 0) { name = getPartialTypeName(getInterfaceTypeName(props)); } - var keys = Object.keys(props); - var types = keys.map(function (key) { return props[key]; }); - var len = keys.length; - return new PartialType(name, function (u) { - if (exports.UnknownRecord.is(u)) { - for (var i = 0; i < len; i++) { - var k = keys[i]; - var uk = u[k]; - if (uk !== undefined && !props[k].is(uk)) { - return false; - } - } - return true; - } - return false; - }, function (u, c) { - var e = exports.UnknownRecord.validate(u, c); - if ((0, Either_1.isLeft)(e)) { - return e; - } - var o = e.right; - var a = o; - var errors = []; - for (var i = 0; i < len; i++) { - var k = keys[i]; - var ak = a[k]; - var type_2 = props[k]; - var result = type_2.validate(ak, appendContext(c, k, type_2, ak)); - if ((0, Either_1.isLeft)(result)) { - if (ak !== undefined) { - pushAll(errors, result.left); - } - } - else { - var vak = result.right; - if (vak !== ak) { - /* istanbul ignore next */ - if (a === o) { - a = __assign({}, o); - } - a[k] = vak; - } - } - } - return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)(a); - }, useIdentity(types) - ? exports.identity - : function (a) { - var s = __assign({}, a); - for (var i = 0; i < len; i++) { - var k = keys[i]; - var ak = a[k]; - if (ak !== undefined) { - s[k] = types[i].encode(ak); - } - } - return s; - }, props); -} -exports.partial = partial; -/** - * @since 1.0.0 - */ -var DictionaryType = /** @class */ (function (_super) { - __extends(DictionaryType, _super); - function DictionaryType(name, is, validate, encode, domain, codomain) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.domain = domain; - _this.codomain = codomain; - /** - * @since 1.0.0 - */ - _this._tag = 'DictionaryType'; - return _this; - } - return DictionaryType; -}(Type)); -exports.DictionaryType = DictionaryType; -/** - * @category combinators - * @since 1.7.1 - */ -function record(domain, codomain, name) { - var keys = getDomainKeys(domain); - return keys - ? enumerableRecord(Object.keys(keys), domain, codomain, name) - : nonEnumerableRecord(domain, codomain, name); -} -exports.record = record; -/** - * @since 1.0.0 - */ -var UnionType = /** @class */ (function (_super) { - __extends(UnionType, _super); - function UnionType(name, is, validate, encode, types) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.types = types; - /** - * @since 1.0.0 - */ - _this._tag = 'UnionType'; - return _this; - } - return UnionType; -}(Type)); -exports.UnionType = UnionType; -/** - * @category combinators - * @since 1.0.0 - */ -function union(codecs, name) { - if (name === void 0) { name = getUnionName(codecs); } - var index = getIndex(codecs); - if (index !== undefined && codecs.length > 0) { - var tag_1 = index[0], groups_1 = index[1]; - var len_1 = groups_1.length; - var find_1 = function (value) { - for (var i = 0; i < len_1; i++) { - if (groups_1[i].indexOf(value) !== -1) { - return i; - } - } - return undefined; - }; - // tslint:disable-next-line: deprecation - return new TaggedUnionType(name, function (u) { - if (exports.UnknownRecord.is(u)) { - var i = find_1(u[tag_1]); - return i !== undefined ? codecs[i].is(u) : false; - } - return false; - }, function (u, c) { - var e = exports.UnknownRecord.validate(u, c); - if ((0, Either_1.isLeft)(e)) { - return e; - } - var r = e.right; - var i = find_1(r[tag_1]); - if (i === undefined) { - return (0, exports.failure)(u, c); - } - var codec = codecs[i]; - return codec.validate(r, appendContext(c, String(i), codec, r)); - }, useIdentity(codecs) - ? exports.identity - : function (a) { - var i = find_1(a[tag_1]); - if (i === undefined) { - // https://github.com/gcanti/io-ts/pull/305 - throw new Error("no codec found to encode value in union codec ".concat(name)); - } - else { - return codecs[i].encode(a); - } - }, codecs, tag_1); - } - else { - return new UnionType(name, function (u) { return codecs.some(function (type) { return type.is(u); }); }, function (u, c) { - var errors = []; - for (var i = 0; i < codecs.length; i++) { - var codec = codecs[i]; - var result = codec.validate(u, appendContext(c, String(i), codec, u)); - if ((0, Either_1.isLeft)(result)) { - pushAll(errors, result.left); - } - else { - return (0, exports.success)(result.right); - } - } - return (0, exports.failures)(errors); - }, useIdentity(codecs) - ? exports.identity - : function (a) { - for (var _i = 0, codecs_1 = codecs; _i < codecs_1.length; _i++) { - var codec = codecs_1[_i]; - if (codec.is(a)) { - return codec.encode(a); - } - } - // https://github.com/gcanti/io-ts/pull/305 - throw new Error("no codec found to encode value in union type ".concat(name)); - }, codecs); - } -} -exports.union = union; -/** - * @since 1.0.0 - */ -var IntersectionType = /** @class */ (function (_super) { - __extends(IntersectionType, _super); - function IntersectionType(name, is, validate, encode, types) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.types = types; - /** - * @since 1.0.0 - */ - _this._tag = 'IntersectionType'; - return _this; - } - return IntersectionType; -}(Type)); -exports.IntersectionType = IntersectionType; -function intersection(codecs, name) { - if (name === void 0) { name = "(".concat(codecs.map(function (type) { return type.name; }).join(' & '), ")"); } - var len = codecs.length; - return new IntersectionType(name, function (u) { return codecs.every(function (type) { return type.is(u); }); }, codecs.length === 0 - ? exports.success - : function (u, c) { - var us = []; - var errors = []; - for (var i = 0; i < len; i++) { - var codec = codecs[i]; - var result = codec.validate(u, appendContext(c, String(i), codec, u)); - if ((0, Either_1.isLeft)(result)) { - pushAll(errors, result.left); - } - else { - us.push(result.right); - } - } - return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)(mergeAll(u, us)); - }, codecs.length === 0 - ? exports.identity - : function (a) { - return mergeAll(a, codecs.map(function (codec) { return codec.encode(a); })); - }, codecs); -} -exports.intersection = intersection; -/** - * @since 1.0.0 - */ -var TupleType = /** @class */ (function (_super) { - __extends(TupleType, _super); - function TupleType(name, is, validate, encode, types) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.types = types; - /** - * @since 1.0.0 - */ - _this._tag = 'TupleType'; - return _this; - } - return TupleType; -}(Type)); -exports.TupleType = TupleType; -function tuple(codecs, name) { - if (name === void 0) { name = "[".concat(codecs.map(function (type) { return type.name; }).join(', '), "]"); } - var len = codecs.length; - return new TupleType(name, function (u) { return exports.UnknownArray.is(u) && u.length === len && codecs.every(function (type, i) { return type.is(u[i]); }); }, function (u, c) { - var e = exports.UnknownArray.validate(u, c); - if ((0, Either_1.isLeft)(e)) { - return e; - } - var us = e.right; - var as = us.length > len ? us.slice(0, len) : us; // strip additional components - var errors = []; - for (var i = 0; i < len; i++) { - var a = us[i]; - var type_3 = codecs[i]; - var result = type_3.validate(a, appendContext(c, String(i), type_3, a)); - if ((0, Either_1.isLeft)(result)) { - pushAll(errors, result.left); - } - else { - var va = result.right; - if (va !== a) { - /* istanbul ignore next */ - if (as === us) { - as = us.slice(); - } - as[i] = va; - } - } - } - return errors.length > 0 ? (0, exports.failures)(errors) : (0, exports.success)(as); - }, useIdentity(codecs) ? exports.identity : function (a) { return codecs.map(function (type, i) { return type.encode(a[i]); }); }, codecs); -} -exports.tuple = tuple; -/** - * @since 1.0.0 - */ -var ReadonlyType = /** @class */ (function (_super) { - __extends(ReadonlyType, _super); - function ReadonlyType(name, is, validate, encode, type) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.type = type; - /** - * @since 1.0.0 - */ - _this._tag = 'ReadonlyType'; - return _this; - } - return ReadonlyType; -}(Type)); -exports.ReadonlyType = ReadonlyType; -/** - * @category combinators - * @since 1.0.0 - */ -function readonly(codec, name) { - if (name === void 0) { name = "Readonly<".concat(codec.name, ">"); } - return new ReadonlyType(name, codec.is, codec.validate, codec.encode, codec); -} -exports.readonly = readonly; -/** - * @since 1.0.0 - */ -var ReadonlyArrayType = /** @class */ (function (_super) { - __extends(ReadonlyArrayType, _super); - function ReadonlyArrayType(name, is, validate, encode, type) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.type = type; - /** - * @since 1.0.0 - */ - _this._tag = 'ReadonlyArrayType'; - return _this; - } - return ReadonlyArrayType; -}(Type)); -exports.ReadonlyArrayType = ReadonlyArrayType; -/** - * @category combinators - * @since 1.0.0 - */ -function readonlyArray(item, name) { - if (name === void 0) { name = "ReadonlyArray<".concat(item.name, ">"); } - var codec = array(item); - return new ReadonlyArrayType(name, codec.is, codec.validate, codec.encode, item); -} -exports.readonlyArray = readonlyArray; -/** - * Strips additional properties, equivalent to `exact(type(props))`. - * - * @category combinators - * @since 1.0.0 - */ -var strict = function (props, name) { return exact(type(props), name); }; -exports.strict = strict; -/** - * @since 1.1.0 - */ -var ExactType = /** @class */ (function (_super) { - __extends(ExactType, _super); - function ExactType(name, is, validate, encode, type) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.type = type; - /** - * @since 1.0.0 - */ - _this._tag = 'ExactType'; - return _this; - } - return ExactType; -}(Type)); -exports.ExactType = ExactType; -/** - * Strips additional properties. - * - * @category combinators - * @since 1.1.0 - */ -function exact(codec, name) { - if (name === void 0) { name = getExactTypeName(codec); } - var props = getProps(codec); - return new ExactType(name, codec.is, function (u, c) { - var e = exports.UnknownRecord.validate(u, c); - if ((0, Either_1.isLeft)(e)) { - return e; - } - var ce = codec.validate(u, c); - if ((0, Either_1.isLeft)(ce)) { - return ce; - } - return (0, Either_1.right)(stripKeys(ce.right, props)); - }, function (a) { return codec.encode(stripKeys(a, props)); }, codec); -} -exports.exact = exact; -/** - * @since 1.0.0 - */ -var FunctionType = /** @class */ (function (_super) { - __extends(FunctionType, _super); - function FunctionType() { - var _this = _super.call(this, 'Function', - // tslint:disable-next-line:strict-type-predicates - function (u) { return typeof u === 'function'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'FunctionType'; - return _this; - } - return FunctionType; -}(Type)); -exports.FunctionType = FunctionType; -/** - * @category primitives - * @since 1.0.0 - */ -exports.Function = new FunctionType(); -/** - * @since 1.0.0 - */ -var NeverType = /** @class */ (function (_super) { - __extends(NeverType, _super); - function NeverType() { - var _this = _super.call(this, 'never', function (_) { return false; }, function (u, c) { return (0, exports.failure)(u, c); }, - /* istanbul ignore next */ - function () { - throw new Error('cannot encode never'); - }) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'NeverType'; - return _this; - } - return NeverType; -}(Type)); -exports.NeverType = NeverType; -/** - * @category primitives - * @since 1.0.0 - */ -exports.never = new NeverType(); -/** - * @since 1.0.0 - */ -var AnyType = /** @class */ (function (_super) { - __extends(AnyType, _super); - function AnyType() { - var _this = _super.call(this, 'any', function (_) { return true; }, exports.success, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'AnyType'; - return _this; - } - return AnyType; -}(Type)); -exports.AnyType = AnyType; -/** - * @category primitives - * @since 1.0.0 - */ -exports.any = new AnyType(); -function refinement(codec, predicate, name) { - if (name === void 0) { name = "(".concat(codec.name, " | ").concat(getFunctionName(predicate), ")"); } - return new RefinementType(name, function (u) { return codec.is(u) && predicate(u); }, function (i, c) { - var e = codec.validate(i, c); - if ((0, Either_1.isLeft)(e)) { - return e; - } - var a = e.right; - return predicate(a) ? (0, exports.success)(a) : (0, exports.failure)(a, c); - }, codec.encode, codec, predicate); -} -exports.refinement = refinement; -/** - * @category primitives - * @since 1.0.0 - */ -exports.Integer = refinement(exports.number, Number.isInteger, 'Integer'); -// ------------------------------------------------------------------------------------- -// deprecated -// ------------------------------------------------------------------------------------- -/** - * @since 1.3.0 - * @deprecated - */ -var TaggedUnionType = /** @class */ (function (_super) { - __extends(TaggedUnionType, _super); - function TaggedUnionType(name, - // tslint:disable-next-line: deprecation - is, - // tslint:disable-next-line: deprecation - validate, - // tslint:disable-next-line: deprecation - encode, codecs, tag) { - var _this = _super.call(this, name, is, validate, encode, codecs) /* istanbul ignore next */ // <= workaround for https://github.com/Microsoft/TypeScript/issues/13455 - || this; - _this.tag = tag; - return _this; - } - return TaggedUnionType; -}(UnionType)); -exports.TaggedUnionType = TaggedUnionType; -/** - * Use `union` instead. - * - * @category combinators - * @since 1.3.0 - * @deprecated - */ -var taggedUnion = function (tag, codecs, name -// tslint:disable-next-line: deprecation -) { - if (name === void 0) { name = getUnionName(codecs); } - var U = union(codecs, name); - // tslint:disable-next-line: deprecation - if (U instanceof TaggedUnionType) { - return U; - } - else { - console.warn("[io-ts] Cannot build a tagged union for ".concat(name, ", returning a de-optimized union")); - // tslint:disable-next-line: deprecation - return new TaggedUnionType(name, U.is, U.validate, U.encode, codecs, tag); - } -}; -exports.taggedUnion = taggedUnion; -/** - * @since 1.0.0 - * @deprecated - */ -var getValidationError /* istanbul ignore next */ = function (value, context) { return ({ - value: value, - context: context -}); }; -exports.getValidationError /* istanbul ignore next */ = getValidationError; -/** - * @since 1.0.0 - * @deprecated - */ -var getDefaultContext /* istanbul ignore next */ = function (decoder) { return [ - { key: '', type: decoder } -]; }; -exports.getDefaultContext /* istanbul ignore next */ = getDefaultContext; -/** - * Use `UnknownRecord` instead. - * - * @category primitives - * @since 1.0.0 - * @deprecated - */ -exports.Dictionary = exports.UnknownRecord; -/** - * @since 1.0.0 - * @deprecated - */ -var ObjectType = /** @class */ (function (_super) { - __extends(ObjectType, _super); - function ObjectType() { - var _this = _super.call(this, 'object', function (u) { return u !== null && typeof u === 'object'; }, function (u, c) { return (_this.is(u) ? (0, exports.success)(u) : (0, exports.failure)(u, c)); }, exports.identity) || this; - /** - * @since 1.0.0 - */ - _this._tag = 'ObjectType'; - return _this; - } - return ObjectType; -}(Type)); -exports.ObjectType = ObjectType; -/** - * Use `UnknownRecord` instead. - * - * @category primitives - * @since 1.0.0 - * @deprecated - */ -// tslint:disable-next-line: deprecation -exports.object = new ObjectType(); -/** - * Use `record` instead. - * - * @category combinators - * @since 1.0.0 - * @deprecated - */ -exports.dictionary = record; -/** - * @since 1.0.0 - * @deprecated - */ -var StrictType = /** @class */ (function (_super) { - __extends(StrictType, _super); - function StrictType(name, - // tslint:disable-next-line: deprecation - is, - // tslint:disable-next-line: deprecation - validate, - // tslint:disable-next-line: deprecation - encode, props) { - var _this = _super.call(this, name, is, validate, encode) || this; - _this.props = props; - /** - * @since 1.0.0 - */ - _this._tag = 'StrictType'; - return _this; - } - return StrictType; -}(Type)); -exports.StrictType = StrictType; -/** - * Drops the codec "kind". - * - * @category combinators - * @since 1.1.0 - * @deprecated - */ -function clean(codec) { - return codec; -} -exports.clean = clean; -function alias(codec) { - return function () { return codec; }; -} -exports.alias = alias; diff --git a/components/pexels/node_modules/io-ts/package.json b/components/pexels/node_modules/io-ts/package.json deleted file mode 100644 index 1511564505211..0000000000000 --- a/components/pexels/node_modules/io-ts/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "io-ts", - "version": "2.2.22", - "description": "TypeScript runtime type system for IO decoding/encoding", - "main": "lib/index.js", - "module": "es6/index.js", - "typings": "lib/index.d.ts", - "sideEffects": false, - "repository": { - "type": "git", - "url": "https://github.com/gcanti/io-ts.git" - }, - "author": "Giulio Canti ", - "license": "MIT", - "bugs": { - "url": "https://github.com/gcanti/io-ts/issues" - }, - "homepage": "https://github.com/gcanti/io-ts", - "peerDependencies": { - "fp-ts": "^2.5.0" - }, - "tags": [ - "typescript", - "runtime", - "decoder", - "encoder", - "schema" - ], - "keywords": [ - "typescript", - "runtime", - "decoder", - "encoder", - "schema" - ] -} \ No newline at end of file diff --git a/components/pexels/package.json b/components/pexels/package.json index 67455c9c44563..6ac40233117ad 100644 --- a/components/pexels/package.json +++ b/components/pexels/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/pexels", - "version": "0.6.0", + "version": "0.1.0", "description": "Pipedream pexels Components", "main": "pexels.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.0" + "@pipedream/platform": "^3.0.3" } } diff --git a/components/pexels/pexels.app.mjs b/components/pexels/pexels.app.mjs index bdc6710141aa5..62092701ec44c 100644 --- a/components/pexels/pexels.app.mjs +++ b/components/pexels/pexels.app.mjs @@ -1,5 +1,9 @@ import { axios } from "@pipedream/platform"; -import fs from "fs"; +import { + COLOR_OPTIONS, + ORIENTATION_OPTIONS, + SIZE_OPTIONS, +} from "../../common/constants.mjs"; export default { type: "app", @@ -8,167 +12,60 @@ export default { searchQuery: { type: "string", label: "Search Query", - description: "A keyword or phrase to search for photos.", + description: "The search query. **Ocean**, **Tigers**, **Pears**, etc.", }, orientation: { type: "string", label: "Orientation", - description: "Optional orientation filter for the search.", + description: "Desired photo orientation.", optional: true, - options: [ - { - label: "Landscape", - value: "landscape", - }, - { - label: "Portrait", - value: "portrait", - }, - { - label: "Square", - value: "square", - }, - ], + options: ORIENTATION_OPTIONS, }, size: { type: "string", label: "Size", - description: "Optional size filter for the search.", + description: "Minimum photo size.", optional: true, - options: [ - { - label: "Large", - value: "large", - }, - { - label: "Medium", - value: "medium", - }, - { - label: "Small", - value: "small", - }, - ], + options: SIZE_OPTIONS, }, color: { type: "string", label: "Color", - description: "Optional color filter for the search.", + description: "Desired photo color. You can set any color listed or any hexidecimal color code (eg. #ffffff)", optional: true, - options: [ - { - label: "Red", - value: "red", - }, - { - label: "Orange", - value: "orange", - }, - { - label: "Yellow", - value: "yellow", - }, - { - label: "Green", - value: "green", - }, - { - label: "Turquoise", - value: "turquoise", - }, - { - label: "Blue", - value: "blue", - }, - { - label: "Violet", - value: "violet", - }, - { - label: "Pink", - value: "pink", - }, - { - label: "Brown", - value: "brown", - }, - { - label: "Black", - value: "black", - }, - { - label: "Gray", - value: "gray", - }, - { - label: "White", - value: "white", - }, - ], + options: COLOR_OPTIONS, }, photoId: { type: "string", label: "Photo ID", description: "The ID of the photo to retrieve or download.", }, - desiredSize: { - type: "string", - label: "Desired Size", - description: "Optional size for downloading the photo.", - optional: true, - options: [ - { - label: "Original", - value: "original", - }, - { - label: "Large", - value: "large", - }, - { - label: "Medium", - value: "medium", - }, - { - label: "Small", - value: "small", - }, - ], - }, }, methods: { _baseUrl() { return "https://api.pexels.com/v1"; }, - async _makeRequest(opts = {}) { - const { - $ = this, method = "GET", path = "/", headers, ...otherOpts - } = opts; + _headers() { + return { + "Authorization": `${this.$auth.api_key}`, + }; + }, + _makeRequest({ + $ = this, path, ...opts + }) { return axios($, { - ...otherOpts, - method, url: this._baseUrl() + path, - headers: { - ...headers, - Authorization: `Bearer ${this.$auth.api_key}`, - }, + headers: this._headers(), + ...opts, }); }, - async searchPhotos({ - query, orientation, size, color, ...opts - } = {}) { + searchPhotos(opts = {}) { return this._makeRequest({ path: "/search", - params: { - query, - orientation, - size, - color, - }, ...opts, }); }, - async getPhoto({ + getPhoto({ photoId, ...opts } = {}) { return this._makeRequest({ @@ -176,62 +73,36 @@ export default { ...opts, }); }, - async downloadPhoto({ - photoId, desiredSize = "original", ...opts - } = {}) { - const photoDetails = await this.getPhoto({ - photoId, - }); - const downloadUrl = desiredSize === "original" - ? photoDetails.src.original - : photoDetails.src[desiredSize]; - const response = await axios(this, { - method: "GET", - url: downloadUrl, - responseType: "stream", - }); - const filePath = `/tmp/photo_${photoId}_${desiredSize}.jpg`; - await new Promise((resolve, reject) => { - const writer = fs.createWriteStream(filePath); - response.data.pipe(writer); - writer.on("finish", resolve); - writer.on("error", reject); - }); - return filePath; - }, - async getCuratedPhotos(opts = {}) { + getCuratedPhotos(opts = {}) { return this._makeRequest({ path: "/curated", ...opts, }); }, - async emitNewPhotos({ - searchQuery, orientation, color, ...opts - } = {}) { - const photos = await this.searchPhotos({ - query: searchQuery, - orientation, - color, - ...opts, - }); - for (const photo of photos) { - this.$emit(photo, { - summary: `New photo: ${photo.id}`, - id: photo.id, - }); - } - }, - async emitNewCuratedPhotos() { - const photos = await this.getCuratedPhotos(); - for (const photo of photos) { - this.$emit(photo, { - summary: `New curated photo: ${photo.id}`, - id: photo.id, + async *paginate({ + fn, params = {}, maxResults = null, ...opts + }) { + let hasMore = false; + let count = 0; + let page = 0; + + do { + params.page = ++page; + const { photos } = await fn({ + params, + ...opts, }); - } + for (const d of photos) { + yield d; + + if (maxResults && ++count === maxResults) { + return count; + } + } + + hasMore = photos.length; + + } while (hasMore); }, }, - async events({ $ }) { - await this.emitNewCuratedPhotos(); - }, }; diff --git a/components/pexels/sources/common/base.mjs b/components/pexels/sources/common/base.mjs new file mode 100644 index 0000000000000..0addac1b812d9 --- /dev/null +++ b/components/pexels/sources/common/base.mjs @@ -0,0 +1,61 @@ +import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; +import pexels from "../../pexels.app.mjs"; + +export default { + props: { + pexels, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + }, + methods: { + _getLastId() { + return this.db.get("lastId") || 0; + }, + _setLastId(lastId) { + this.db.set("lastId", lastId); + }, + getParams() { + return {}; + }, + async emitEvent(maxResults = false) { + const lastId = this._getLastId(); + + const response = this.pexels.paginate({ + fn: this.getFunction(), + params: this.getParams(), + maxResults, + }); + + let responseArray = []; + for await (const item of response) { + if (item.id === lastId) break; + responseArray.push(item); + } + + if (responseArray.length) { + this._setLastId(responseArray[0].id); + } + + for (const item of responseArray.reverse()) { + this.$emit(item, { + id: item.id, + summary: this.getSummary(item), + ts: Date.now(), + }); + } + }, + }, + hooks: { + async deploy() { + await this.emitEvent(25); + }, + }, + async run() { + await this.emitEvent(); + }, +}; diff --git a/components/pexels/sources/new-curated-photo/new-curated-photo.mjs b/components/pexels/sources/new-curated-photo/new-curated-photo.mjs index 50174f3742123..cfbbcdbb5987d 100644 --- a/components/pexels/sources/new-curated-photo/new-curated-photo.mjs +++ b/components/pexels/sources/new-curated-photo/new-curated-photo.mjs @@ -1,55 +1,22 @@ -import { axios } from "@pipedream/platform"; -import pexels from "../../pexels.app.mjs"; +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; export default { + ...common, key: "pexels-new-curated-photo", name: "New Curated Photo", - description: "Emit an event when a new curated photo is added to the Pexels curated collection. [See the documentation](https://www.pexels.com/api/documentation/)", + description: "Emit new event when a new curated photo is added to the Pexels curated collection. [See the documentation](https://www.pexels.com/api/documentation/)", version: "0.0.1", type: "source", dedupe: "unique", - props: { - pexels, - db: "$.service.db", - timer: { - type: "$.interface.timer", - default: { - intervalSeconds: 3600, // Poll every hour - }, - }, - }, - hooks: { - async deploy() { - await this.emitNewCuratedPhotos(); - }, - }, methods: { - _getLastPhotoId() { - return this.db.get("lastPhotoId"); + ...common.methods, + getFunction() { + return this.pexels.getCuratedPhotos; }, - _setLastPhotoId(photoId) { - this.db.set("lastPhotoId", photoId); + getSummary(item) { + return `New curated photo with ID: ${item.id}`; }, - async emitNewCuratedPhotos() { - const photos = await this.pexels.getCuratedPhotos(); - const lastPhotoId = this._getLastPhotoId(); - - for (const photo of photos) { - if (photo.id === lastPhotoId) break; - - this.$emit(photo, { - id: photo.id.toString(), - summary: `New curated photo: ${photo.url}`, - ts: new Date(photo.created_at || Date.now()).getTime(), - }); - } - - if (photos.length > 0) { - this._setLastPhotoId(photos[0].id); - } - }, - }, - async run() { - await this.emitNewCuratedPhotos(); }, + sampleEmit, }; diff --git a/components/pexels/sources/new-curated-photo/test-event.mjs b/components/pexels/sources/new-curated-photo/test-event.mjs new file mode 100644 index 0000000000000..425b8e51c8bcd --- /dev/null +++ b/components/pexels/sources/new-curated-photo/test-event.mjs @@ -0,0 +1,22 @@ +export default { + "id": 2880507, + "width": 4000, + "height": 6000, + "url": "https://www.pexels.com/photo/woman-in-white-long-sleeved-top-and-skirt-standing-on-field-2880507/", + "photographer": "Deden Dicky Ramdhani", + "photographer_url": "https://www.pexels.com/@drdeden88", + "photographer_id": 1378810, + "avg_color": "#7E7F7B", + "src": { + "original": "https://images.pexels.com/photos/2880507/pexels-photo-2880507.jpeg", + "large2x": "https://images.pexels.com/photos/2880507/pexels-photo-2880507.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940", + "large": "https://images.pexels.com/photos/2880507/pexels-photo-2880507.jpeg?auto=compress&cs=tinysrgb&h=650&w=940", + "medium": "https://images.pexels.com/photos/2880507/pexels-photo-2880507.jpeg?auto=compress&cs=tinysrgb&h=350", + "small": "https://images.pexels.com/photos/2880507/pexels-photo-2880507.jpeg?auto=compress&cs=tinysrgb&h=130", + "portrait": "https://images.pexels.com/photos/2880507/pexels-photo-2880507.jpeg?auto=compress&cs=tinysrgb&fit=crop&h=1200&w=800", + "landscape": "https://images.pexels.com/photos/2880507/pexels-photo-2880507.jpeg?auto=compress&cs=tinysrgb&fit=crop&h=627&w=1200", + "tiny": "https://images.pexels.com/photos/2880507/pexels-photo-2880507.jpeg?auto=compress&cs=tinysrgb&dpr=1&fit=crop&h=200&w=280" + }, + "liked": false, + "alt": "Brown Rocks During Golden Hour" +} \ No newline at end of file diff --git a/components/pexels/sources/new-photo-by-search/new-photo-by-search.mjs b/components/pexels/sources/new-photo-by-search/new-photo-by-search.mjs index da75decd102fb..06a3a34205ae5 100644 --- a/components/pexels/sources/new-photo-by-search/new-photo-by-search.mjs +++ b/components/pexels/sources/new-photo-by-search/new-photo-by-search.mjs @@ -1,110 +1,57 @@ -import { - axios, DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, -} from "@pipedream/platform"; -import pexels from "../../pexels.app.mjs"; +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; export default { + ...common, key: "pexels-new-photo-by-search", name: "New Photo by Search", - description: "Emit new event when a photo is published that matches a specified search query. [See the documentation](https://www.pexels.com/api/documentation/)", + description: "Emit new event when a photo is published that matches a specified search query. [See the documentation](https://www.pexels.com/api/documentation/#photos-search)", version: "0.0.1", type: "source", dedupe: "unique", props: { - pexels, - db: "$.service.db", - timer: { - type: "$.interface.timer", - default: { - intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, - }, - }, + ...common.props, searchQuery: { propDefinition: [ - pexels, + common.props.pexels, "searchQuery", ], }, orientation: { propDefinition: [ - pexels, + common.props.pexels, "orientation", ], }, + size: { + propDefinition: [ + common.props.pexels, + "size", + ], + }, color: { propDefinition: [ - pexels, + common.props.pexels, "color", ], }, }, methods: { - _getLastPhotoId() { - return this.db.get("lastPhotoId"); + ...common.methods, + getFunction() { + return this.pexels.searchPhotos; }, - _setLastPhotoId(id) { - this.db.set("lastPhotoId", id); - }, - }, - hooks: { - async deploy() { - const photos = await this.pexels.searchPhotos({ + getParams() { + return { query: this.searchQuery, orientation: this.orientation, + size: this.size, color: this.color, - per_page: 50, - }); - - if (!photos || photos.length === 0) { - return; - } - - const orderedPhotos = photos.reverse(); - for (const photo of orderedPhotos.slice(0, 50)) { - this.$emit(photo, { - id: photo.id, - summary: `New photo: ${photo.photographer} - ${photo.src.original}`, - ts: photo.created_at - ? Date.parse(photo.created_at) - : new Date().getTime(), - }); - } - - this._setLastPhotoId(orderedPhotos[0].id); + }; + }, + getSummary(item) { + return `New photo with ID: ${item.id}`; }, }, - async run() { - const lastPhotoId = this._getLastPhotoId(); - - const photos = await this.pexels.searchPhotos({ - query: this.searchQuery, - orientation: this.orientation, - color: this.color, - per_page: 50, - }); - - if (!photos || photos.length === 0) { - return; - } - - const newPhotos = []; - for (const photo of photos.reverse()) { - if (photo.id === lastPhotoId) break; - newPhotos.unshift(photo); - } - - for (const photo of newPhotos) { - this.$emit(photo, { - id: photo.id, - summary: `New photo: ${photo.photographer} - ${photo.src.original}`, - ts: photo.created_at - ? Date.parse(photo.created_at) - : new Date().getTime(), - }); - } - - if (newPhotos.length > 0) { - this._setLastPhotoId(newPhotos[0].id); - } - }, + sampleEmit, }; diff --git a/components/pexels/sources/new-photo-by-search/test-event.mjs b/components/pexels/sources/new-photo-by-search/test-event.mjs new file mode 100644 index 0000000000000..bb7de09eef0bf --- /dev/null +++ b/components/pexels/sources/new-photo-by-search/test-event.mjs @@ -0,0 +1,22 @@ +export default { + "id": 3573351, + "width": 3066, + "height": 3968, + "url": "https://www.pexels.com/photo/trees-during-day-3573351/", + "photographer": "Lukas Rodriguez", + "photographer_url": "https://www.pexels.com/@lukas-rodriguez-1845331", + "photographer_id": 1845331, + "avg_color": "#374824", + "src": { + "original": "https://images.pexels.com/photos/3573351/pexels-photo-3573351.png", + "large2x": "https://images.pexels.com/photos/3573351/pexels-photo-3573351.png?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940", + "large": "https://images.pexels.com/photos/3573351/pexels-photo-3573351.png?auto=compress&cs=tinysrgb&h=650&w=940", + "medium": "https://images.pexels.com/photos/3573351/pexels-photo-3573351.png?auto=compress&cs=tinysrgb&h=350", + "small": "https://images.pexels.com/photos/3573351/pexels-photo-3573351.png?auto=compress&cs=tinysrgb&h=130", + "portrait": "https://images.pexels.com/photos/3573351/pexels-photo-3573351.png?auto=compress&cs=tinysrgb&fit=crop&h=1200&w=800", + "landscape": "https://images.pexels.com/photos/3573351/pexels-photo-3573351.png?auto=compress&cs=tinysrgb&fit=crop&h=627&w=1200", + "tiny": "https://images.pexels.com/photos/3573351/pexels-photo-3573351.png?auto=compress&cs=tinysrgb&dpr=1&fit=crop&h=200&w=280" + }, + "liked": false, + "alt": "Brown Rocks During Golden Hour" +} \ No newline at end of file From 995c891d42ac8105db3abdd1800da946444e94ba Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 30 Apr 2025 18:53:19 -0300 Subject: [PATCH 3/7] pnpm update --- pnpm-lock.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d5f890e57c6ac..eb9d5604ffe58 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4095,8 +4095,7 @@ importers: specifier: ^1.3.0 version: 1.6.6 - components/emailverify_io: - specifiers: {} + components/emailverify_io: {} components/emelia: {} @@ -9595,7 +9594,7 @@ importers: components/pexels: dependencies: '@pipedream/platform': - specifier: ^3.0.0 + specifier: ^3.0.3 version: 3.0.3 components/phantombuster: @@ -12796,8 +12795,7 @@ importers: specifier: ^1.2.0 version: 1.6.6 - components/swarmnode: - specifiers: {} + components/swarmnode: {} components/swell: dependencies: @@ -34753,6 +34751,8 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) + transitivePeerDependencies: + - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: From c57f3787a6d523e8449bcdb78458dfa72ea34f4d Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 30 Apr 2025 18:59:35 -0300 Subject: [PATCH 4/7] update package.json --- components/pexels/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/pexels/package.json b/components/pexels/package.json index 6ac40233117ad..b6fb19fa9ae84 100644 --- a/components/pexels/package.json +++ b/components/pexels/package.json @@ -13,6 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3" + "@pipedream/platform": "^3.0.3", + "stream": "^0.0.3" } } From 5081f891adc6cca8a505883f419e1867566fc965 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 30 Apr 2025 19:00:37 -0300 Subject: [PATCH 5/7] pnpm update --- pnpm-lock.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eb9d5604ffe58..609d7a1f70e5e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9596,6 +9596,9 @@ importers: '@pipedream/platform': specifier: ^3.0.3 version: 3.0.3 + stream: + specifier: ^0.0.3 + version: 0.0.3 components/phantombuster: dependencies: From 8d28924e3b3e5514e867ede023af9282b6879258 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Mon, 5 May 2025 19:16:57 -0300 Subject: [PATCH 6/7] fix import path --- {common => components/pexels/common}/constants.mjs | 0 components/pexels/pexels.app.mjs | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename {common => components/pexels/common}/constants.mjs (100%) diff --git a/common/constants.mjs b/components/pexels/common/constants.mjs similarity index 100% rename from common/constants.mjs rename to components/pexels/common/constants.mjs diff --git a/components/pexels/pexels.app.mjs b/components/pexels/pexels.app.mjs index 62092701ec44c..a7a464a1bbf7a 100644 --- a/components/pexels/pexels.app.mjs +++ b/components/pexels/pexels.app.mjs @@ -3,7 +3,7 @@ import { COLOR_OPTIONS, ORIENTATION_OPTIONS, SIZE_OPTIONS, -} from "../../common/constants.mjs"; +} from "./common/constants.mjs"; export default { type: "app", From 16559258d10d3b833515aa232cfcf430a98513e8 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Tue, 6 May 2025 08:44:51 -0300 Subject: [PATCH 7/7] fix props types --- components/pexels/actions/search-photos/search-photos.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/pexels/actions/search-photos/search-photos.mjs b/components/pexels/actions/search-photos/search-photos.mjs index 08372f4a4096f..3b8e2aa4729df 100644 --- a/components/pexels/actions/search-photos/search-photos.mjs +++ b/components/pexels/actions/search-photos/search-photos.mjs @@ -33,13 +33,13 @@ export default { ], }, page: { - type: "Integer", + type: "integer", label: "Page", description: "The page number you are requesting", optional: true, }, perPage: { - type: "Integer", + type: "integer", label: "Per Page", description: "The number of results you are requesting per page", max: 80,

>>( + properties: P +): Codec< + unknown, + Partial<{ + [K in keyof P]: OutputOf + }>, + Partial<{ + [K in keyof P]: TypeOf + }> +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function fromArray(item: Codec): Codec, Array, Array> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function array(item: Codec): Codec, Array> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function fromRecord( + codomain: Codec +): Codec, Record, Record> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function record( + codomain: Codec +): Codec, Record> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromTuple: []>( + ...components: C +) => Codec< + { [K in keyof C]: import('./Kleisli').InputOf<'Either', C[K]> }, + { [K_1 in keyof C]: E.OutputOf }, + { [K_2 in keyof C]: E.TypeOf } +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function tuple>>( + ...components: C +): Codec< + unknown, + { + [K in keyof C]: OutputOf + }, + { + [K in keyof C]: TypeOf + } +> +/** + * @category combinators + * @since 2.2.3 + */ +export declare const intersect: ( + right: Codec +) => (left: Codec) => Codec +/** + * @category combinators + * @since 2.2.8 + */ +export declare const fromSum: ( + tag: T +) => >>( + members: MS +) => Codec, E.OutputOf, E.TypeOf> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function sum( + tag: T +): >>( + members: M +) => Codec, TypeOf> +/** + * @category combinators + * @since 2.2.3 + */ +export declare function lazy(id: string, f: () => Codec): Codec +/** + * @category combinators + * @since 2.2.16 + */ +export declare const readonly: (codec: Codec) => Codec> +/** + * @category combinators + * @since 2.2.8 + */ +export declare const compose: ( + to: Codec +) => (from: Codec) => Codec +/** + * @category Invariant + * @since 2.2.3 + */ +export declare const imap: (f: (a: A) => B, g: (b: B) => A) => (fa: Codec) => Codec +/** + * @category instances + * @since 2.2.3 + */ +export declare const URI = 'io-ts/Codec' +/** + * @category instances + * @since 2.2.3 + */ +export type URI = typeof URI +declare module 'fp-ts/es6/HKT' { + interface URItoKind3 { + readonly [URI]: Codec + } +} +/** + * @category instances + * @since 2.2.8 + */ +export declare const Invariant: Invariant3 +/** + * @since 2.2.8 + */ +export type InputOf = D.InputOf +/** + * @since 2.2.3 + */ +export type OutputOf = E.OutputOf +/** + * @since 2.2.3 + */ +export type TypeOf = E.TypeOf diff --git a/components/pexels/node_modules/io-ts/es6/Codec.js b/components/pexels/node_modules/io-ts/es6/Codec.js new file mode 100644 index 0000000000000..7dd7f40fa3501 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Codec.js @@ -0,0 +1,284 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.3 + */ +import { identity } from 'fp-ts/es6/function'; +import { pipe } from 'fp-ts/es6/pipeable'; +import * as D from './Decoder'; +import * as E from './Encoder'; +// ------------------------------------------------------------------------------------- +// constructors +// ------------------------------------------------------------------------------------- +/** + * @category constructors + * @since 2.2.3 + */ +export function make(decoder, encoder) { + return { + decode: decoder.decode, + encode: encoder.encode + }; +} +/** + * @category constructors + * @since 2.2.3 + */ +export function fromDecoder(decoder) { + return { + decode: decoder.decode, + encode: identity + }; +} +/** + * @category constructors + * @since 2.2.3 + */ +export function literal() { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return fromDecoder(D.literal.apply(D, values)); +} +// ------------------------------------------------------------------------------------- +// primitives +// ------------------------------------------------------------------------------------- +/** + * @category primitives + * @since 2.2.3 + */ +export var string = +/*#__PURE__*/ +fromDecoder(D.string); +/** + * @category primitives + * @since 2.2.3 + */ +export var number = +/*#__PURE__*/ +fromDecoder(D.number); +/** + * @category primitives + * @since 2.2.3 + */ +export var boolean = +/*#__PURE__*/ +fromDecoder(D.boolean); +/** + * @category primitives + * @since 2.2.3 + */ +export var UnknownArray = +/*#__PURE__*/ +fromDecoder(D.UnknownArray); +/** + * @category primitives + * @since 2.2.3 + */ +export var UnknownRecord = +/*#__PURE__*/ +fromDecoder(D.UnknownRecord); +// ------------------------------------------------------------------------------------- +// combinators +// ------------------------------------------------------------------------------------- +/** + * @category combinators + * @since 2.2.3 + */ +export var mapLeftWithInput = function (f) { + return function (codec) { + return make(pipe(codec, D.mapLeftWithInput(f)), codec); + }; +}; +/** + * @category combinators + * @since 2.2.3 + */ +export var refine = function (refinement, id) { + var refine = D.refine(refinement, id); + return function (from) { return make(refine(from), from); }; +}; +/** + * @category combinators + * @since 2.2.3 + */ +export function nullable(or) { + return make(D.nullable(or), E.nullable(or)); +} +/** + * @category combinators + * @since 2.2.15 + */ +export function fromStruct(properties) { + return make(D.fromStruct(properties), E.struct(properties)); +} +/** + * Use `fromStruct` instead. + * + * @category combinators + * @since 2.2.8 + * @deprecated + */ +export var fromType = fromStruct; +/** + * @category combinators + * @since 2.2.15 + */ +export function struct(properties) { + return pipe(UnknownRecord, compose(fromStruct(properties))); +} +/** + * Use `struct` instead. + * + * @category combinators + * @since 2.2.3 + * @deprecated + */ +export var type = struct; +/** + * @category combinators + * @since 2.2.8 + */ +export function fromPartial(properties) { + return make(D.fromPartial(properties), E.partial(properties)); +} +/** + * @category combinators + * @since 2.2.3 + */ +export function partial(properties) { + return pipe(UnknownRecord, compose(fromPartial(properties))); +} +/** + * @category combinators + * @since 2.2.3 + */ +export function fromArray(item) { + return make(D.fromArray(item), E.array(item)); +} +/** + * @category combinators + * @since 2.2.3 + */ +export function array(item) { + return pipe(UnknownArray, compose(fromArray(item))); +} +/** + * @category combinators + * @since 2.2.3 + */ +export function fromRecord(codomain) { + return make(D.fromRecord(codomain), E.record(codomain)); +} +/** + * @category combinators + * @since 2.2.3 + */ +export function record(codomain) { + return pipe(UnknownRecord, compose(fromRecord(codomain))); +} +/** + * @category combinators + * @since 2.2.8 + */ +export var fromTuple = function () { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return make(D.fromTuple.apply(D, components), E.tuple.apply(E, components)); +}; +/** + * @category combinators + * @since 2.2.3 + */ +export function tuple() { + var components = []; + for (var _i = 0; _i < arguments.length; _i++) { + components[_i] = arguments[_i]; + } + return pipe(UnknownArray, compose(fromTuple.apply(void 0, components))); +} +/** + * @category combinators + * @since 2.2.3 + */ +export var intersect = function (right) { + var intersectD = D.intersect(right); + var intersectE = E.intersect(right); + return function (left) { return make(intersectD(left), intersectE(left)); }; +}; +/** + * @category combinators + * @since 2.2.8 + */ +export var fromSum = function (tag) { + var decoder = D.fromSum(tag); + var encoder = E.sum(tag); + return function (members) { return make(decoder(members), encoder(members)); }; +}; +/** + * @category combinators + * @since 2.2.3 + */ +export function sum(tag) { + var sum = fromSum(tag); + return function (members) { return pipe(UnknownRecord, compose(sum(members))); }; +} +/** + * @category combinators + * @since 2.2.3 + */ +export function lazy(id, f) { + return make(D.lazy(id, f), E.lazy(f)); +} +/** + * @category combinators + * @since 2.2.16 + */ +export var readonly = identity; +/** + * @category combinators + * @since 2.2.8 + */ +export var compose = function (to) { + return function (from) { + return make(D.compose(to)(from), E.compose(from)(to)); + }; +}; +// ------------------------------------------------------------------------------------- +// non-pipeables +// ------------------------------------------------------------------------------------- +var imap_ = function (fa, f, g) { return make(D.Functor.map(fa, f), E.Contravariant.contramap(fa, g)); }; +// ------------------------------------------------------------------------------------- +// pipeables +// ------------------------------------------------------------------------------------- +/** + * @category Invariant + * @since 2.2.3 + */ +export var imap = function (f, g) { return function (fa) { + return imap_(fa, f, g); +}; }; +// ------------------------------------------------------------------------------------- +// instances +// ------------------------------------------------------------------------------------- +/** + * @category instances + * @since 2.2.3 + */ +export var URI = 'io-ts/Codec'; +/** + * @category instances + * @since 2.2.8 + */ +export var Invariant = { + URI: URI, + imap: imap_ +}; diff --git a/components/pexels/node_modules/io-ts/es6/DecodeError.d.ts b/components/pexels/node_modules/io-ts/es6/DecodeError.d.ts new file mode 100644 index 0000000000000..fda24ed808370 --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/DecodeError.d.ts @@ -0,0 +1,135 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Semigroup } from 'fp-ts/es6/Semigroup' +import * as FS from './FreeSemigroup' +/** + * @category model + * @since 2.2.7 + */ +export interface Leaf { + readonly _tag: 'Leaf' + readonly actual: unknown + readonly error: E +} +/** + * @category model + * @since 2.2.7 + */ +export declare const required: 'required' +/** + * @category model + * @since 2.2.7 + */ +export declare const optional: 'optional' +/** + * @category model + * @since 2.2.7 + */ +export type Kind = 'required' | 'optional' +/** + * @category model + * @since 2.2.7 + */ +export interface Key { + readonly _tag: 'Key' + readonly key: string + readonly kind: Kind + readonly errors: FS.FreeSemigroup> +} +/** + * @category model + * @since 2.2.7 + */ +export interface Index { + readonly _tag: 'Index' + readonly index: number + readonly kind: Kind + readonly errors: FS.FreeSemigroup> +} +/** + * @category model + * @since 2.2.7 + */ +export interface Member { + readonly _tag: 'Member' + readonly index: number + readonly errors: FS.FreeSemigroup> +} +/** + * @category model + * @since 2.2.7 + */ +export interface Lazy { + readonly _tag: 'Lazy' + readonly id: string + readonly errors: FS.FreeSemigroup> +} +/** + * @category model + * @since 2.2.9 + */ +export interface Wrap { + readonly _tag: 'Wrap' + readonly error: E + readonly errors: FS.FreeSemigroup> +} +/** + * @category model + * @since 2.2.7 + */ +export type DecodeError = Leaf | Key | Index | Member | Lazy | Wrap +/** + * @category constructors + * @since 2.2.7 + */ +export declare const leaf: (actual: unknown, error: E) => DecodeError +/** + * @category constructors + * @since 2.2.7 + */ +export declare const key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => DecodeError +/** + * @category constructors + * @since 2.2.7 + */ +export declare const index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => DecodeError +/** + * @category constructors + * @since 2.2.7 + */ +export declare const member: (index: number, errors: FS.FreeSemigroup>) => DecodeError +/** + * @category constructors + * @since 2.2.7 + */ +export declare const lazy: (id: string, errors: FS.FreeSemigroup>) => DecodeError +/** + * @category constructors + * @since 2.2.9 + */ +export declare const wrap: (error: E, errors: FS.FreeSemigroup>) => DecodeError +/** + * @category destructors + * @since 2.2.7 + */ +export declare const fold: (patterns: { + Leaf: (input: unknown, error: E) => R + Key: (key: string, kind: Kind, errors: FS.FreeSemigroup>) => R + Index: (index: number, kind: Kind, errors: FS.FreeSemigroup>) => R + Member: (index: number, errors: FS.FreeSemigroup>) => R + Lazy: (id: string, errors: FS.FreeSemigroup>) => R + Wrap: (error: E, errors: FS.FreeSemigroup>) => R +}) => (e: DecodeError) => R +/** + * @category instances + * @since 2.2.7 + */ +export declare function getSemigroup(): Semigroup>> diff --git a/components/pexels/node_modules/io-ts/es6/DecodeError.js b/components/pexels/node_modules/io-ts/es6/DecodeError.js new file mode 100644 index 0000000000000..81cdbb6efd90f --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/DecodeError.js @@ -0,0 +1,95 @@ +import * as FS from './FreeSemigroup'; +/** + * @category model + * @since 2.2.7 + */ +// eslint-disable-next-line @typescript-eslint/prefer-as-const +export var required = 'required'; +/** + * @category model + * @since 2.2.7 + */ +// eslint-disable-next-line @typescript-eslint/prefer-as-const +export var optional = 'optional'; +/** + * @category constructors + * @since 2.2.7 + */ +export var leaf = function (actual, error) { return ({ _tag: 'Leaf', actual: actual, error: error }); }; +/** + * @category constructors + * @since 2.2.7 + */ +export var key = function (key, kind, errors) { return ({ + _tag: 'Key', + key: key, + kind: kind, + errors: errors +}); }; +/** + * @category constructors + * @since 2.2.7 + */ +export var index = function (index, kind, errors) { return ({ + _tag: 'Index', + index: index, + kind: kind, + errors: errors +}); }; +/** + * @category constructors + * @since 2.2.7 + */ +export var member = function (index, errors) { return ({ + _tag: 'Member', + index: index, + errors: errors +}); }; +/** + * @category constructors + * @since 2.2.7 + */ +export var lazy = function (id, errors) { return ({ + _tag: 'Lazy', + id: id, + errors: errors +}); }; +/** + * @category constructors + * @since 2.2.9 + */ +export var wrap = function (error, errors) { return ({ + _tag: 'Wrap', + error: error, + errors: errors +}); }; +/** + * @category destructors + * @since 2.2.7 + */ +export var fold = function (patterns) { + var f = function (e) { + switch (e._tag) { + case 'Leaf': + return patterns.Leaf(e.actual, e.error); + case 'Key': + return patterns.Key(e.key, e.kind, e.errors); + case 'Index': + return patterns.Index(e.index, e.kind, e.errors); + case 'Member': + return patterns.Member(e.index, e.errors); + case 'Lazy': + return patterns.Lazy(e.id, e.errors); + case 'Wrap': + return patterns.Wrap(e.error, e.errors); + } + }; + return f; +}; +/** + * @category instances + * @since 2.2.7 + */ +export function getSemigroup() { + return FS.getSemigroup(); +} diff --git a/components/pexels/node_modules/io-ts/es6/Decoder.d.ts b/components/pexels/node_modules/io-ts/es6/Decoder.d.ts new file mode 100644 index 0000000000000..3836c85fc5b7a --- /dev/null +++ b/components/pexels/node_modules/io-ts/es6/Decoder.d.ts @@ -0,0 +1,331 @@ +/** + * **This module is experimental** + * + * Experimental features are published in order to get early feedback from the community, see these tracking + * [issues](https://github.com/gcanti/io-ts/issues?q=label%3Av2.2+) for further discussions and enhancements. + * + * A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice. + * + * @since 2.2.7 + */ +import { Alt2 } from 'fp-ts/es6/Alt' +import { Category2 } from 'fp-ts/es6/Category' +import * as E from 'fp-ts/es6/Either' +import { Refinement } from 'fp-ts/es6/function' +import { Functor2 } from 'fp-ts/es6/Functor' +import * as DE from './DecodeError' +import * as FS from './FreeSemigroup' +import * as G from './Guard' +import * as K from './Kleisli' +import * as S from './Schemable' +/** + * @category model + * @since 2.2.8 + */ +export interface Decoder extends K.Kleisli {} +/** + * @category DecodeError + * @since 2.2.7 + */ +export type DecodeError = FS.FreeSemigroup> +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const error: (actual: unknown, message: string) => DecodeError +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const success: (a: A) => E.Either +/** + * @category DecodeError + * @since 2.2.7 + */ +export declare const failure: (actual: unknown, message: string) => E.Either +/** + * @category constructors + * @since 2.2.8 + */ +export declare const fromRefinement: (refinement: Refinement, expected: string) => Decoder +/** + * @category constructors + * @since 2.2.8 + */ +export declare const fromGuard: (guard: G.Guard, expected: string) => Decoder +/** + * @category constructors + * @since 2.2.7 + */ +export declare const literal: ], L extends S.Literal = S.Literal>( + ...values: A +) => Decoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const string: Decoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const number: Decoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const boolean: Decoder +/** + * @category primitives + * @since 2.2.7 + */ +export declare const UnknownArray: Decoder> +/** + * @category primitives + * @since 2.2.7 + */ +export declare const UnknownRecord: Decoder> +/** + * @category combinators + * @since 2.2.7 + */ +export declare const mapLeftWithInput: ( + f: (input: I, e: DecodeError) => DecodeError +) => (decoder: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.9 + */ +export declare const withMessage: ( + message: (input: I, e: DecodeError) => string +) => (decoder: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const refine: ( + refinement: Refinement, + id: string +) => (from: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const parse: ( + parser: (a: A) => E.Either +) => (from: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.7 + */ +export declare const nullable: (or: Decoder) => Decoder +/** + * @category combinators + * @since 2.2.15 + */ +export declare const fromStruct: