From c5a6a46cd062718b800120b7759e0b97fa9626ee Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:43:36 +0000 Subject: [PATCH] SDK regeneration --- .github/workflows/ci.yml | 8 +- package.json | 9 +- reference.md | 5790 +++++++++++++++++ .../resources/accessGroups/client/Client.ts | 10 +- src/api/resources/assets/client/Client.ts | 84 +- .../resources/collections/client/Client.ts | 48 +- .../resources/fields/client/Client.ts | 26 +- .../fields/client/requests/FieldCreate.ts | 2 +- .../resources/items/client/Client.ts | 166 +- .../resources/items/client/requests/index.ts | 1 - .../items/types/ItemsPublishItemResponse.ts | 8 + .../resources/items/types/index.ts | 2 +- src/api/resources/ecommerce/client/Client.ts | 10 +- src/api/resources/forms/client/Client.ts | 54 +- src/api/resources/index.ts | 5 +- src/api/resources/inventory/client/Client.ts | 24 +- .../client/requests/InventoryUpdateRequest.ts | 2 +- src/api/resources/orders/client/Client.ts | 68 +- src/api/resources/pages/client/Client.ts | 73 +- .../client/requests/PagesGetContentRequest.ts | 4 +- .../requests/PagesGetMetadataRequest.ts | 4 +- .../pages/client/requests/PagesListRequest.ts | 4 +- .../requests/UpdatePageSettingsRequest.ts | 9 +- .../pages/resources/scripts/client/Client.ts | 34 +- src/api/resources/products/client/Client.ts | 68 +- src/api/resources/scripts/client/Client.ts | 34 +- src/api/resources/sites/client/Client.ts | 48 +- src/api/resources/sites/index.ts | 1 + .../resources/activityLogs/client/Client.ts | 10 +- .../sites/resources/scripts/client/Client.ts | 44 +- .../sites/types/SitesPublishResponse.ts | 12 + src/api/resources/sites/types/index.ts | 1 + src/api/resources/token/client/Client.ts | 12 +- src/api/resources/users/client/Client.ts | 52 +- src/api/resources/webhooks/client/Client.ts | 46 +- .../requests => types}/BulkCollectionItem.ts | 9 +- .../types/BulkCollectionItemFieldData.ts | 0 src/api/types/ConflictErrorBody.ts | 11 +- src/api/types/DuplicateUserEmail.ts | 11 +- src/api/types/MissingScopes.ts | 11 +- src/api/types/NotEnterprisePlanSite.ts | 11 +- src/api/types/OauthScope.ts | 96 - src/api/types/Page.ts | 6 +- src/api/types/PageDetails.ts | 43 - src/api/types/PageDetailsOpenGraph.ts | 17 - src/api/types/PageDetailsSeo.ts | 13 - src/api/types/UserLimitReached.ts | 11 +- src/api/types/UsersNotEnabled.ts | 11 +- src/api/types/index.ts | 8 +- src/core/fetcher/Fetcher.ts | 205 +- src/core/fetcher/createRequestUrl.ts | 10 + src/core/fetcher/getFetchFn.ts | 25 + src/core/fetcher/getRequestBody.ts | 14 + src/core/fetcher/getResponseBody.ts | 32 + src/core/fetcher/makeRequest.ts | 44 + src/core/fetcher/requestWithRetries.ts | 21 + src/core/fetcher/signals.ts | 38 + .../Node18UniversalStreamWrapper.ts | 256 + .../stream-wrappers/NodePre18StreamWrapper.ts | 106 + .../stream-wrappers/UndiciStreamWrapper.ts | 243 + .../stream-wrappers/chooseStreamWrapper.ts | 33 + src/core/runtime/runtime.ts | 2 + src/core/schemas/Schema.ts | 13 +- src/core/schemas/builders/bigint/bigint.ts | 50 + src/core/schemas/builders/bigint/index.ts | 1 + src/core/schemas/builders/index.ts | 1 + src/core/schemas/builders/lazy/lazy.ts | 14 +- src/core/schemas/builders/lazy/lazyObject.ts | 4 +- src/core/schemas/builders/list/list.ts | 11 +- .../object-like/getObjectLikeUtils.ts | 4 +- src/core/schemas/builders/object/object.ts | 61 +- src/core/schemas/builders/object/types.ts | 4 +- src/core/schemas/builders/record/record.ts | 29 +- .../builders/schema-utils/getSchemaUtils.ts | 26 +- src/core/schemas/builders/set/set.ts | 8 +- .../undiscriminatedUnion.ts | 13 +- src/core/schemas/builders/union/union.ts | 19 +- .../utils/getErrorMessageForIncorrectType.ts | 4 + src/core/schemas/utils/maybeSkipValidation.ts | 9 +- .../resources/items/client/requests/index.ts | 1 - .../items/types/ItemsPublishItemResponse.ts | 22 + .../resources/items/types/index.ts | 2 +- src/serialization/resources/index.ts | 5 +- src/serialization/resources/sites/index.ts | 1 + .../sites/types/SitesPublishResponse.ts | 23 + .../resources/sites/types/index.ts | 1 + .../requests => types}/BulkCollectionItem.ts | 14 +- .../types/BulkCollectionItemFieldData.ts | 10 +- src/serialization/types/ConflictErrorBody.ts | 19 +- src/serialization/types/DuplicateUserEmail.ts | 16 +- src/serialization/types/MissingScopes.ts | 16 +- .../types/NotEnterprisePlanSite.ts | 16 +- src/serialization/types/OauthScope.ts | 59 - src/serialization/types/Page.ts | 8 +- src/serialization/types/PageDetails.ts | 50 - .../types/PageDetailsOpenGraph.ts | 26 - src/serialization/types/PageDetailsSeo.ts | 20 - src/serialization/types/UserLimitReached.ts | 16 +- src/serialization/types/UsersNotEnabled.ts | 16 +- src/serialization/types/index.ts | 8 +- src/version.ts | 1 + tests/unit/auth/BasicAuth.test.ts | 22 + tests/unit/auth/BearerToken.test.ts | 14 + tests/unit/fetcher/Fetcher.test.ts | 25 + tests/unit/fetcher/createRequestUrl.test.ts | 51 + tests/unit/fetcher/getFetchFn.test.ts | 22 + tests/unit/fetcher/getRequestBody.test.ts | 81 + tests/unit/fetcher/getResponseBody.test.ts | 68 + tests/unit/fetcher/makeRequest.test.ts | 58 + tests/unit/fetcher/requestWithRetries.test.ts | 85 + tests/unit/fetcher/signals.test.ts | 69 + .../Node18UniversalStreamWrapper.test.ts | 178 + .../NodePre18StreamWrapper.test.ts | 124 + .../UndiciStreamWrapper.test.ts | 153 + .../chooseStreamWrapper.test.ts | 43 + .../fetcher/stream-wrappers/webpack.test.ts | 35 + tests/unit/zurg/bigint/bigint.test.ts | 24 + tests/unit/zurg/date/date.test.ts | 31 + tests/unit/zurg/enum/enum.test.ts | 30 + tests/unit/zurg/lazy/lazy.test.ts | 57 + tests/unit/zurg/lazy/lazyObject.test.ts | 18 + tests/unit/zurg/lazy/recursive/a.ts | 7 + tests/unit/zurg/lazy/recursive/b.ts | 8 + tests/unit/zurg/list/list.test.ts | 41 + .../unit/zurg/literals/stringLiteral.test.ts | 21 + .../object-like/withParsedProperties.test.ts | 57 + tests/unit/zurg/object/extend.test.ts | 89 + tests/unit/zurg/object/object.test.ts | 255 + .../objectWithoutOptionalProperties.test.ts | 21 + tests/unit/zurg/primitives/any.test.ts | 6 + tests/unit/zurg/primitives/boolean.test.ts | 14 + tests/unit/zurg/primitives/number.test.ts | 14 + tests/unit/zurg/primitives/string.test.ts | 14 + tests/unit/zurg/primitives/unknown.test.ts | 6 + tests/unit/zurg/record/record.test.ts | 34 + .../zurg/schema-utils/getSchemaUtils.test.ts | 83 + tests/unit/zurg/schema.test.ts | 78 + tests/unit/zurg/set/set.test.ts | 48 + tests/unit/zurg/skipValidation.test.ts | 45 + .../undiscriminatedUnion.test.ts | 44 + tests/unit/zurg/union/union.test.ts | 113 + tests/unit/zurg/utils/itSchema.ts | 78 + tests/unit/zurg/utils/itValidate.ts | 56 + yarn.lock | 698 +- 144 files changed, 10572 insertions(+), 1127 deletions(-) create mode 100644 reference.md create mode 100644 src/api/resources/collections/resources/items/types/ItemsPublishItemResponse.ts create mode 100644 src/api/resources/sites/types/SitesPublishResponse.ts create mode 100644 src/api/resources/sites/types/index.ts rename src/api/{resources/collections/resources/items/client/requests => types}/BulkCollectionItem.ts (68%) rename src/api/{resources/collections/resources/items => }/types/BulkCollectionItemFieldData.ts (100%) delete mode 100644 src/api/types/OauthScope.ts delete mode 100644 src/api/types/PageDetails.ts delete mode 100644 src/api/types/PageDetailsOpenGraph.ts delete mode 100644 src/api/types/PageDetailsSeo.ts create mode 100644 src/core/fetcher/createRequestUrl.ts create mode 100644 src/core/fetcher/getFetchFn.ts create mode 100644 src/core/fetcher/getRequestBody.ts create mode 100644 src/core/fetcher/getResponseBody.ts create mode 100644 src/core/fetcher/makeRequest.ts create mode 100644 src/core/fetcher/requestWithRetries.ts create mode 100644 src/core/fetcher/signals.ts create mode 100644 src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts create mode 100644 src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts create mode 100644 src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts create mode 100644 src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts create mode 100644 src/core/schemas/builders/bigint/bigint.ts create mode 100644 src/core/schemas/builders/bigint/index.ts create mode 100644 src/serialization/resources/collections/resources/items/types/ItemsPublishItemResponse.ts create mode 100644 src/serialization/resources/sites/types/SitesPublishResponse.ts create mode 100644 src/serialization/resources/sites/types/index.ts rename src/serialization/{resources/collections/resources/items/client/requests => types}/BulkCollectionItem.ts (69%) rename src/serialization/{resources/collections/resources/items => }/types/BulkCollectionItemFieldData.ts (61%) delete mode 100644 src/serialization/types/OauthScope.ts delete mode 100644 src/serialization/types/PageDetails.ts delete mode 100644 src/serialization/types/PageDetailsOpenGraph.ts delete mode 100644 src/serialization/types/PageDetailsSeo.ts create mode 100644 src/version.ts create mode 100644 tests/unit/auth/BasicAuth.test.ts create mode 100644 tests/unit/auth/BearerToken.test.ts create mode 100644 tests/unit/fetcher/Fetcher.test.ts create mode 100644 tests/unit/fetcher/createRequestUrl.test.ts create mode 100644 tests/unit/fetcher/getFetchFn.test.ts create mode 100644 tests/unit/fetcher/getRequestBody.test.ts create mode 100644 tests/unit/fetcher/getResponseBody.test.ts create mode 100644 tests/unit/fetcher/makeRequest.test.ts create mode 100644 tests/unit/fetcher/requestWithRetries.test.ts create mode 100644 tests/unit/fetcher/signals.test.ts create mode 100644 tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts create mode 100644 tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts create mode 100644 tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts create mode 100644 tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts create mode 100644 tests/unit/fetcher/stream-wrappers/webpack.test.ts create mode 100644 tests/unit/zurg/bigint/bigint.test.ts create mode 100644 tests/unit/zurg/date/date.test.ts create mode 100644 tests/unit/zurg/enum/enum.test.ts create mode 100644 tests/unit/zurg/lazy/lazy.test.ts create mode 100644 tests/unit/zurg/lazy/lazyObject.test.ts create mode 100644 tests/unit/zurg/lazy/recursive/a.ts create mode 100644 tests/unit/zurg/lazy/recursive/b.ts create mode 100644 tests/unit/zurg/list/list.test.ts create mode 100644 tests/unit/zurg/literals/stringLiteral.test.ts create mode 100644 tests/unit/zurg/object-like/withParsedProperties.test.ts create mode 100644 tests/unit/zurg/object/extend.test.ts create mode 100644 tests/unit/zurg/object/object.test.ts create mode 100644 tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts create mode 100644 tests/unit/zurg/primitives/any.test.ts create mode 100644 tests/unit/zurg/primitives/boolean.test.ts create mode 100644 tests/unit/zurg/primitives/number.test.ts create mode 100644 tests/unit/zurg/primitives/string.test.ts create mode 100644 tests/unit/zurg/primitives/unknown.test.ts create mode 100644 tests/unit/zurg/record/record.test.ts create mode 100644 tests/unit/zurg/schema-utils/getSchemaUtils.test.ts create mode 100644 tests/unit/zurg/schema.test.ts create mode 100644 tests/unit/zurg/set/set.test.ts create mode 100644 tests/unit/zurg/skipValidation.test.ts create mode 100644 tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts create mode 100644 tests/unit/zurg/union/union.test.ts create mode 100644 tests/unit/zurg/utils/itSchema.ts create mode 100644 tests/unit/zurg/utils/itValidate.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73509065..1a55fdb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,12 @@ jobs: - name: Publish to npm run: | npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} - npm publish --access public + if [[ ${GITHUB_REF} == *alpha* ]]; then + npm publish --access public --tag alpha + elif [[ ${GITHUB_REF} == *beta* ]]; then + npm publish --access public --tag beta + else + npm publish --access public + fi env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/package.json b/package.json index a6b1ef49..312b6cec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webflow-api", - "version": "2.3.6", + "version": "2.4.0", "private": false, "repository": "https://github.com/webflow/js-webflow-api", "main": "./index.js", @@ -13,16 +13,21 @@ }, "dependencies": { "url-join": "4.0.1", - "form-data": "4.0.0", + "form-data": "^4.0.0", "formdata-node": "^6.0.3", "node-fetch": "2.7.0", "qs": "6.11.2", + "readable-stream": "^4.5.2", "js-base64": "3.7.2" }, "devDependencies": { "@types/url-join": "4.0.1", "@types/qs": "6.9.8", "@types/node-fetch": "2.6.9", + "@types/readable-stream": "^4.0.15", + "fetch-mock-jest": "^1.5.1", + "webpack": "^5.94.0", + "ts-loader": "^9.3.1", "jest": "29.7.0", "@types/jest": "29.5.5", "ts-jest": "29.1.1", diff --git a/reference.md b/reference.md new file mode 100644 index 00000000..8104e058 --- /dev/null +++ b/reference.md @@ -0,0 +1,5790 @@ +# Reference + +## Token + +
client.token.authorizedBy() -> Webflow.AuthorizedUser +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Information about the Authorized User

Required Scope | `authorized_user:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.token.authorizedBy(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Token.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.token.introspect() -> Webflow.Authorization +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Information about the authorization token
Access to this endpoint requires a bearer token from a Data Client App.
+ +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.token.introspect(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Token.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Sites + +
client.sites.list() -> Webflow.Sites +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List of all sites the provided access token is able to access.

Required scope | `sites:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sites.list(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Sites.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.sites.get(siteId) -> Webflow.Site +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a site by site id

Required scope | `sites:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sites.get("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**requestOptions:** `Sites.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.sites.getCustomDomain(siteId) -> Webflow.Domains +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of all custom domains related to site.

Required scope | `sites:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sites.getCustomDomain("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**requestOptions:** `Sites.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.sites.publish(siteId, { ...params }) -> Webflow.SitesPublishResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Publish a site to one more more domains.

Required scope | `sites:write`

📘

Endpoint-specific rate limit

This endpoint has a limit of one successful publish queue per minute.

+ +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sites.publish("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.SitesPublishRequest` + +
+
+ +
+
+ +**requestOptions:** `Sites.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Collections + +
client.collections.list(siteId) -> Webflow.CollectionList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List of all Collections within a Site.

Required scope | `cms:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.list("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**requestOptions:** `Collections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.create(siteId, { ...params }) -> Webflow.Collection +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a Collection for a site.

Required scope | `cms:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.create("580e63e98c9a982ac9b8b741", { + displayName: "Blog Posts", + singularName: "Blog Post", + slug: "posts", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.CollectionsCreateRequest` + +
+
+ +
+
+ +**requestOptions:** `Collections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.get(collectionId) -> Webflow.Collection +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the full details of a collection from its ID.

Required scope | `cms:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.get("580e63fc8c9a982ac9b8b745"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**requestOptions:** `Collections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.deleteCollection(collectionId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a collection using its ID.

Required scope | `cms:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.deleteCollection("580e63fc8c9a982ac9b8b745"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**requestOptions:** `Collections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.delete(collectionId, fieldId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a custom field in a collection. This endpoint does not currently support bulk deletion.

Required scope | `cms:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.delete("580e63fc8c9a982ac9b8b745", "580e63fc8c9a982ac9b8b745"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**fieldId:** `string` — Unique identifier for a Field in a collection + +
+
+ +
+
+ +**requestOptions:** `Collections.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Pages + +
client.pages.list(siteId, { ...params }) -> Webflow.PageList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List of all pages for a site

Required scope | `pages:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.pages.list("580e63e98c9a982ac9b8b741", { + locale: "65427cf400e02b306eaa04a0", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.PagesListRequest` + +
+
+ +
+
+ +**requestOptions:** `Pages.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.pages.getMetadata(pageId, { ...params }) -> Webflow.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get metadata information for a single page

Required scope | `pages:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.pages.getMetadata("63c720f9347c2139b248e552", { + locale: "65427cf400e02b306eaa04a0", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pageId:** `string` — Unique identifier for a Page + +
+
+ +
+
+ +**request:** `Webflow.PagesGetMetadataRequest` + +
+
+ +
+
+ +**requestOptions:** `Pages.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.pages.updatePageSettings(pageId, { ...params }) -> Webflow.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update Page-level metadata, including SEO and Open Graph fields.

Required scope | `pages:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.pages.updatePageSettings("63c720f9347c2139b248e552", { + locale: "65427cf400e02b306eaa04a0", + body: { + id: "6596da6045e56dee495bcbba", + siteId: "6258612d1ee792848f805dcf", + title: "Guide to the Galaxy", + slug: "guide-to-the-galaxy", + parentId: "6419db964a9c435aa3af6251", + collectionId: "6390c49774a71f12831a08e3", + createdOn: "2024-03-11T10:42:00Z", + lastUpdated: "2024-03-11T10:42:42Z", + archived: false, + draft: false, + canBranch: true, + seo: { + title: "The Ultimate Hitchhiker's Guide to the Galaxy", + description: + "Everything you need to know about the galaxy, from avoiding Vogon poetry to the importance of towels.", + }, + openGraph: { + title: "Explore the Cosmos with The Ultimate Guide", + titleCopied: false, + description: "Dive deep into the mysteries of the universe with your guide to everything galactic.", + descriptionCopied: false, + }, + localeId: "653fd9af6a07fc9cfd7a5e57", + publishedPath: "/en-us/guide-to-the-galaxy", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pageId:** `string` — Unique identifier for a Page + +
+
+ +
+
+ +**request:** `Webflow.UpdatePageSettingsRequest` + +
+
+ +
+
+ +**requestOptions:** `Pages.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.pages.getContent(pageId, { ...params }) -> Webflow.Dom +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get static content from a static page.
If you do not provide a Locale ID in your request, the response will return any content that can be localized from the Primary locale

Required scope | `pages:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.pages.getContent("63c720f9347c2139b248e552", { + locale: "65427cf400e02b306eaa04a0", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pageId:** `string` — Unique identifier for a Page + +
+
+ +
+
+ +**request:** `Webflow.PagesGetContentRequest` + +
+
+ +
+
+ +**requestOptions:** `Pages.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.pages.updateStaticContent(pageId, { ...params }) -> Webflow.UpdateStaticContentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This endpoint allows for updating static content on a static page within a secondary locale. It is designed specifically for localized pages and can handle up to 1000 nodes per request. + +

Note:This endpoint is specifically for localized pages. Ensure that the locale specified is a valid secondary locale for the site.

+ +Required scope | `pages:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.pages.updateStaticContent("63c720f9347c2139b248e552", { + locale: "locale", + nodes: [ + { + nodeId: "a245c12d-995b-55ee-5ec7-aa36a6cad623", + text: "

The Hitchhiker's Guide to the Galaxy

", + }, + { + nodeId: "a245c12d-995b-55ee-5ec7-aa36a6cad627", + text: "

Don't Panic!

Always know where your towel is.

", + }, + { + nodeId: "a245c12d-995b-55ee-5ec7-aa36a6cad629", + text: "Marvin, the Paranoid Android", + }, + ], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pageId:** `string` — Unique identifier for a Page + +
+
+ +
+
+ +**request:** `Webflow.DomWrite` + +
+
+ +
+
+ +**requestOptions:** `Pages.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Scripts + +
client.scripts.list(siteId) -> Webflow.RegisteredScriptList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List of scripts registered to a Site.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints. Additionally, Scripts can be remotely hosted, or registered as inline snippets.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.scripts.list("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**requestOptions:** `Scripts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.scripts.registerHosted(siteId, { ...params }) -> Webflow.CustomCodeHostedResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add a script to a Site's Custom Code registry.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints. Additionally, Scripts can be remotely hosted, or registered as inline snippets.
Access to this endpoint requires a bearer token from a Data Client App.


Required scope | `custom_code:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.scripts.registerHosted("580e63e98c9a982ac9b8b741", { + hostedLocation: "hostedLocation", + integrityHash: "integrityHash", + version: "version", + displayName: "displayName", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.CustomCodeHostedRequest` + +
+
+ +
+
+ +**requestOptions:** `Scripts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.scripts.registerInline(siteId, { ...params }) -> Webflow.CustomCodeInlineResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add a script to a Site's Custom Code registry. Inline scripts can be between 1 and 2000 characters.

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

Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.scripts.registerInline("580e63e98c9a982ac9b8b741", { + sourceCode: "alert('hello world');", + version: "0.0.1", + displayName: "Alert", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.CustomCodeInlineRequest` + +
+
+ +
+
+ +**requestOptions:** `Scripts.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Assets + +
client.assets.list(siteId) -> Webflow.Assets +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List assets for a given site

Required scope | `assets:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.assets.list("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**requestOptions:** `Assets.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.assets.create(siteId, { ...params }) -> Webflow.AssetUpload +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new asset entry.

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

Required scope | `assets:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.assets.create("580e63e98c9a982ac9b8b741", { + fileName: "file.png", + fileHash: "3c7d87c9575702bc3b1e991f4d3c638e", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.AssetsCreateRequest` + +
+
+ +
+
+ +**requestOptions:** `Assets.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.assets.get(assetId) -> Webflow.Asset +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get an Asset

Required scope | `assets:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.assets.get("580e63fc8c9a982ac9b8b745"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**assetId:** `string` — Unique identifier for an Asset on a site + +
+
+ +
+
+ +**requestOptions:** `Assets.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.assets.delete(assetId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete an Asset + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.assets.delete("580e63fc8c9a982ac9b8b745"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**assetId:** `string` — Unique identifier for an Asset on a site + +
+
+ +
+
+ +**requestOptions:** `Assets.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.assets.update(assetId, { ...params }) -> Webflow.Asset +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update an Asset

Required scope | `assets:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.assets.update("580e63fc8c9a982ac9b8b745", { + displayName: "bulldoze.png", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**assetId:** `string` — Unique identifier for an Asset on a site + +
+
+ +
+
+ +**request:** `Webflow.AssetsUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `Assets.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.assets.listFolders(siteId) -> Webflow.AssetFolderList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List Asset Folders within a given site

Required scope | `assets:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.assets.listFolders("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**requestOptions:** `Assets.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.assets.createFolder(siteId, { ...params }) -> Webflow.AssetFolder +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create an Asset Folder within a given site

Required scope | `assets:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.assets.createFolder("580e63e98c9a982ac9b8b741", { + displayName: "my asset folder", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.AssetsCreateFolderRequest` + +
+
+ +
+
+ +**requestOptions:** `Assets.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.assets.getFolder(assetFolderId) -> Webflow.AssetFolder +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get details about a specific Asset Folder

Required scope | `assets:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.assets.getFolder("6390c49774a71f0e3c1a08ee"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**assetFolderId:** `string` — Unique identifier for an Asset Folder + +
+
+ +
+
+ +**requestOptions:** `Assets.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Webhooks + +
client.webhooks.list(siteId) -> Webflow.WebhookList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List all App-created Webhooks registered for a given site

Required scope | `sites:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.list("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**requestOptions:** `Webhooks.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.create(siteId, { ...params }) -> Webflow.Webhook +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new Webhook, to be notified when Webflow resources change. Limit of 75 registrations per `triggerType`, per site.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `sites:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.create("580e63e98c9a982ac9b8b741", { + id: "582266e0cd48de0f0e3c6d8b", + triggerType: "form_submission", + url: "https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", + workspaceId: "4f4e46fd476ea8c507000001", + siteId: "562ac0395358780a1f5e6fbd", + lastTriggered: "2023-02-08T23:59:28Z", + createdOn: "2022-11-08T23:59:28Z", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.Webhook` + +
+
+ +
+
+ +**requestOptions:** `Webhooks.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.get(webhookId) -> Webflow.Webhook +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a specific Webhook instance + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.get("580e64008c9a982ac9b8b754"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**webhookId:** `string` — Unique identifier for a Webhook + +
+
+ +
+
+ +**requestOptions:** `Webhooks.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.delete(webhookId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove a Webhook + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.delete("580e64008c9a982ac9b8b754"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**webhookId:** `string` — Unique identifier for a Webhook + +
+
+ +
+
+ +**requestOptions:** `Webhooks.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Forms + +
client.forms.list(siteId, { ...params }) -> Webflow.FormList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List forms for a given site

Required scope | `forms:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.forms.list("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.FormsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Forms.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.forms.get(formId) -> Webflow.Form +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get information about a given form

Required scope | `forms:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.forms.get("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**formId:** `string` — Unique identifier for a Form + +
+
+ +
+
+ +**requestOptions:** `Forms.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.forms.listSubmissions(formId, { ...params }) -> Webflow.FormSubmissionList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List form submissions for a given form

Required scope | `forms:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.forms.listSubmissions("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**formId:** `string` — Unique identifier for a Form + +
+
+ +
+
+ +**request:** `Webflow.FormsListSubmissionsRequest` + +
+
+ +
+
+ +**requestOptions:** `Forms.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.forms.getSubmission(formSubmissionId) -> Webflow.FormSubmission +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get information about a given form submission

Required scope | `forms:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.forms.getSubmission("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**formSubmissionId:** `string` — Unique identifier for a Form Submission + +
+
+ +
+
+ +**requestOptions:** `Forms.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.forms.updateSubmission(formSubmissionId, { ...params }) -> Webflow.FormSubmission +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update hidden fields on a form submission

Required scope | `forms:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.forms.updateSubmission("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**formSubmissionId:** `string` — Unique identifier for a Form Submission + +
+
+ +
+
+ +**request:** `Webflow.FormsUpdateSubmissionRequest` + +
+
+ +
+
+ +**requestOptions:** `Forms.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Users + +
client.users.list(siteId, { ...params }) -> Webflow.UserList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of users for a site

Required scope | `users:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.users.list("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.UsersListRequest` + +
+
+ +
+
+ +**requestOptions:** `Users.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.users.get(siteId, userId) -> Webflow.User +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a User by ID

Required scope | `users:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.users.get("580e63e98c9a982ac9b8b741", "580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**userId:** `string` — Unique identifier for a User + +
+
+ +
+
+ +**requestOptions:** `Users.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.users.delete(siteId, userId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a User by ID

Required scope | `users:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.users.delete("580e63e98c9a982ac9b8b741", "580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**userId:** `string` — Unique identifier for a User + +
+
+ +
+
+ +**requestOptions:** `Users.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.users.update(siteId, userId, { ...params }) -> Webflow.User +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a User by ID

Required scope | `users:write` + + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.users.update("580e63e98c9a982ac9b8b741", "580e63e98c9a982ac9b8b741", { + data: { + name: "Some One", + acceptPrivacy: false, + acceptCommunications: false, + }, + accessGroups: ["webflowers", "platinum", "free-tier"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**userId:** `string` — Unique identifier for a User + +
+
+ +
+
+ +**request:** `Webflow.UsersUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `Users.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.users.invite(siteId, { ...params }) -> Webflow.User +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create and invite a user with an email address. The user will be sent and invite via email, which they will need to accept in order to join paid Access Groups.

Required scope | `users:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.users.invite("580e63e98c9a982ac9b8b741", { + email: "some.one@home.com", + accessGroups: ["webflowers"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.UsersInviteRequest` + +
+
+ +
+
+ +**requestOptions:** `Users.RequestOptions` + +
+
+
+
+ +
+
+
+ +## AccessGroups + +
client.accessGroups.list(siteId, { ...params }) -> Webflow.AccessGroupList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of access groups for a site

Required scope | `users:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.accessGroups.list("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.AccessGroupsListRequest` + +
+
+ +
+
+ +**requestOptions:** `AccessGroups.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Products + +
client.products.list(siteId, { ...params }) -> Webflow.ProductAndSkUsList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve all products for a site. Use `limit` and `offset` to page through all products with subsequent requests. All SKUs for each product will also be fetched and returned. The `limit`, `offset` and `total` values represent Products only and do not include any SKUs. + +Required scope | `ecommerce:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.products.list("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.ProductsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Products.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.products.create(siteId, { ...params }) -> Webflow.ProductAndSkUs +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creating a new Product involves creating both a Product and a SKU, since a Product Item has to have, at minimum, a single SKU. + +In order to create a Product with multiple SKUs - for example a T-shirt in sizes small, medium and large - you'll need to create `sku-properties`. In our T-shirt example, a single `sku-property` would be Color. Within that property, we'll need to list out the various colors a T-shirt could be as an array of `enum` values: `royal-blue`, `crimson-red`, and `forrest-green`. + +Once, you've created a Product and its `sku-properties` with `enum` values, you can create your default SKU, which will automatically be a combination of the first `sku-properties` you've created. In our example, the default SKU will be a Royal Blue T-Shirt, because our first `enum` of our Color `sku-property` is Royal Blue. After you've created your product, you can create additional SKUs using the Create SKU endpoint + +Upon creation, the default product type will be `Advanced`. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. + +Required scope | `ecommerce:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.products.create("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.ProductSkuCreate` + +
+
+ +
+
+ +**requestOptions:** `Products.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.products.get(siteId, productId) -> Webflow.ProductAndSkUs +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a single product by its id. All of its SKUs will also be retrieved. + +Required scope | `ecommerce:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.products.get("580e63e98c9a982ac9b8b741", "580e63fc8c9a982ac9b8b745"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**productId:** `string` — Unique identifier for a Product + +
+
+ +
+
+ +**requestOptions:** `Products.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.products.update(siteId, productId, { ...params }) -> Webflow.Product +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updating an existing Product will set the product type to `Advanced`. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + +Required scope | `ecommerce:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.products.update("580e63e98c9a982ac9b8b741", "580e63fc8c9a982ac9b8b745"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**productId:** `string` — Unique identifier for a Product + +
+
+ +
+
+ +**request:** `Webflow.ProductSkuUpdate` + +
+
+ +
+
+ +**requestOptions:** `Products.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.products.createSku(siteId, productId, { ...params }) -> Webflow.ProductsCreateSkuResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create additional SKUs to cover every variant of your Product. The Default SKU already counts as one of the variants. + +Creating additional SKUs will set the product type to `Advanced` for the product associated with the SKUs. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + +Required scope | `ecommerce:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.products.createSku("580e63e98c9a982ac9b8b741", "580e63fc8c9a982ac9b8b745", { + skus: [{}], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**productId:** `string` — Unique identifier for a Product + +
+
+ +
+
+ +**request:** `Webflow.ProductsCreateSkuRequest` + +
+
+ +
+
+ +**requestOptions:** `Products.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.products.updateSku(siteId, productId, skuId, { ...params }) -> Webflow.Sku +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updating an existing SKU will set the product type to `Advanced` for the product associated with the SKU. The product type is used to determine which Product and SKU fields are shown to users in the `Designer` and the `Editor`. Setting it to `Advanced` ensures that all Product and SKU fields will be shown. The product type can be edited in the `Designer` or the `Editor`. + +Required scope | `ecommerce:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.products.updateSku("580e63e98c9a982ac9b8b741", "580e63fc8c9a982ac9b8b745", "5e8518516e147040726cc415", { + sku: {}, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**productId:** `string` — Unique identifier for a Product + +
+
+ +
+
+ +**skuId:** `string` — Unique identifier for a SKU + +
+
+ +
+
+ +**request:** `Webflow.ProductsUpdateSkuRequest` + +
+
+ +
+
+ +**requestOptions:** `Products.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Orders + +
client.orders.list(siteId, { ...params }) -> Webflow.OrderList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List all orders created for a given site. + +Required scope | `ecommerce:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.list("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.OrdersListRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.get(siteId, orderId) -> Webflow.Order +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a single product by its id. All of its SKUs will also be retrieved. + +Required scope | `ecommerce:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.get("580e63e98c9a982ac9b8b741", "5e8518516e147040726cc415"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**orderId:** `string` — Unique identifier for an Order + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.update(siteId, orderId, { ...params }) -> Webflow.Order +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This API lets you update the fields, `comment`, `shippingProvider`, and/or `shippingTracking` for a given order. All three fields can be updated simultaneously or independently. + +Required scope | `ecommerce:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.update("580e63e98c9a982ac9b8b741", "5e8518516e147040726cc415"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**orderId:** `string` — Unique identifier for an Order + +
+
+ +
+
+ +**request:** `Webflow.OrdersUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.updateFulfill(siteId, orderId, { ...params }) -> Webflow.Order +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an order's status to fulfilled + +Required scope | `ecommerce:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.updateFulfill("580e63e98c9a982ac9b8b741", "5e8518516e147040726cc415"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**orderId:** `string` — Unique identifier for an Order + +
+
+ +
+
+ +**request:** `Webflow.OrdersUpdateFulfillRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.updateUnfulfill(siteId, orderId) -> Webflow.Order +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an order's status to unfulfilled + +Required scope | `ecommerce:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.updateUnfulfill("580e63e98c9a982ac9b8b741", "5e8518516e147040726cc415"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**orderId:** `string` — Unique identifier for an Order + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.refund(siteId, orderId, { ...params }) -> Webflow.Order +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This API will reverse a Stripe charge and refund an order back to a +customer. It will also set the order's status to `refunded`. + +Required scope | `ecommerce:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.refund("580e63e98c9a982ac9b8b741", "5e8518516e147040726cc415"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**orderId:** `string` — Unique identifier for an Order + +
+
+ +
+
+ +**request:** `Webflow.OrdersRefundRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Inventory + +
client.inventory.list(collectionId, itemId) -> Webflow.InventoryItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the current inventory levels for a particular SKU item. + +Required scope | `ecommerce:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.list("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**itemId:** `string` — Unique identifier for an Item + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.update(collectionId, itemId, { ...params }) -> Webflow.InventoryItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the current inventory levels for a particular SKU item. Updates may be given in one or two methods, absolutely or incrementally. Absolute updates are done by setting `quantity` directly. Incremental updates are by specifying the inventory delta in `updateQuantity` which is then added to the `quantity` stored on the server. + +Required scope | `ecommerce:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.update("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754", { + inventoryType: "infinite", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**itemId:** `string` — Unique identifier for an Item + +
+
+ +
+
+ +**request:** `Webflow.InventoryUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Ecommerce + +
client.ecommerce.getSettings(siteId) -> Webflow.EcommerceSettings +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve ecommerce settings for a site. + +Required scope | `ecommerce:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.ecommerce.getSettings("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**requestOptions:** `Ecommerce.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Collections Fields + +
client.collections.fields.create(collectionId, { ...params }) -> Webflow.Field +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a custom field in a collection.

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

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

Required scope | `cms:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.fields.create("580e63fc8c9a982ac9b8b745", { + isRequired: false, + type: "RichText", + displayName: "Post Body", + helpText: "Add the body of your post here", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**request:** `Webflow.collections.FieldCreate` + +
+
+ +
+
+ +**requestOptions:** `Fields.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.fields.update(collectionId, fieldId, { ...params }) -> Webflow.Field +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a custom field in a collection.

Required scope | `cms:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.fields.update("580e63fc8c9a982ac9b8b745", "580e63fc8c9a982ac9b8b745", { + isRequired: false, + displayName: "Post Body", + helpText: "Add the body of your post here", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**fieldId:** `string` — Unique identifier for a Field in a collection + +
+
+ +
+
+ +**request:** `Webflow.collections.FieldUpdate` + +
+
+ +
+
+ +**requestOptions:** `Fields.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Collections Items + +
client.collections.items.listItems(collectionId, { ...params }) -> Webflow.CollectionItemList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List of all Items within a Collection.

Required scope | `CMS:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.listItems("580e63fc8c9a982ac9b8b745"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**request:** `Webflow.collections.ItemsListItemsRequest` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.createItem(collectionId, { ...params }) -> Webflow.CollectionItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ + Create Item in a Collection.

To create items across multiple locales, please use the bulk item endpoint.

Required scope | CMS:write +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.createItem("580e63fc8c9a982ac9b8b745", { + id: "42b720ef280c7a7a3be8cabe", + cmsLocaleId: "653ad57de882f528b32e810e", + lastPublished: "2022-11-29T16:22:43.159Z", + lastUpdated: "2022-11-17T17:19:43.282Z", + createdOn: "2022-11-17T17:11:57.148Z", + isArchived: false, + isDraft: false, + fieldData: { + name: "Pan Galactic Gargle Blaster Recipe", + slug: "pan-galactic-gargle-blaster", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**request:** `Webflow.CollectionItem` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.listItemsLive(collectionId, { ...params }) -> Webflow.CollectionItemList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List of all live Items within a Collection.

Required scope | `CMS:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.listItemsLive("580e63fc8c9a982ac9b8b745"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**request:** `Webflow.collections.ItemsListItemsLiveRequest` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.createItemLive(collectionId, { ...params }) -> Webflow.CollectionItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create live Item in a Collection. This Item will be published to the live site.

To create items across multiple locales, please use this endpoint.

Required scope | `CMS:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.createItemLive("580e63fc8c9a982ac9b8b745", { + id: "42b720ef280c7a7a3be8cabe", + cmsLocaleId: "653ad57de882f528b32e810e", + lastPublished: "2022-11-29T16:22:43.159Z", + lastUpdated: "2022-11-17T17:19:43.282Z", + createdOn: "2022-11-17T17:11:57.148Z", + isArchived: false, + isDraft: false, + fieldData: { + name: "Pan Galactic Gargle Blaster Recipe", + slug: "pan-galactic-gargle-blaster", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**request:** `Webflow.CollectionItem` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.createItemForMultipleLocales(collectionId, { ...params }) -> Webflow.BulkCollectionItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create single Item in a Collection with multiple corresponding locales.

Required scope | `CMS:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.createItemForMultipleLocales("580e63fc8c9a982ac9b8b745", { + id: "580e64008c9a982ac9b8b754", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**request:** `Webflow.BulkCollectionItem` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.getItem(collectionId, itemId, { ...params }) -> Webflow.CollectionItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get details of a selected Collection Item.

Required scope | `CMS:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.getItem("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**itemId:** `string` — Unique identifier for an Item + +
+
+ +
+
+ +**request:** `Webflow.collections.ItemsGetItemRequest` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.deleteItem(collectionId, itemId, { ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete an Item from a Collection. This endpoint does not currently support bulk deletion.

Required scope | `CMS:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.deleteItem("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**itemId:** `string` — Unique identifier for an Item + +
+
+ +
+
+ +**request:** `Webflow.collections.ItemsDeleteItemRequest` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.updateItem(collectionId, itemId, { ...params }) -> Webflow.CollectionItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a selected Item in a Collection.

Required scope | `CMS:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.updateItem("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754", { + id: "42b720ef280c7a7a3be8cabe", + cmsLocaleId: "653ad57de882f528b32e810e", + lastPublished: "2022-11-29T16:22:43.159Z", + lastUpdated: "2022-11-17T17:19:43.282Z", + createdOn: "2022-11-17T17:11:57.148Z", + isArchived: false, + isDraft: false, + fieldData: { + name: "Pan Galactic Gargle Blaster Recipe", + slug: "pan-galactic-gargle-blaster", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**itemId:** `string` — Unique identifier for an Item + +
+
+ +
+
+ +**request:** `Webflow.CollectionItem` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.getItemLive(collectionId, itemId, { ...params }) -> Webflow.CollectionItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get details of a selected Collection live Item.

Required scope | `CMS:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.getItemLive("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**itemId:** `string` — Unique identifier for an Item + +
+
+ +
+
+ +**request:** `Webflow.collections.ItemsGetItemLiveRequest` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.deleteItemLive(collectionId, itemId, { ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove a live item from the site. Removing a published item will unpublish the item from the live site and set it to draft. This endpoint does not currently support bulk deletion.

Required scope | `CMS:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.deleteItemLive("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**itemId:** `string` — Unique identifier for an Item + +
+
+ +
+
+ +**request:** `Webflow.collections.ItemsDeleteItemLiveRequest` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.updateItemLive(collectionId, itemId, { ...params }) -> Webflow.CollectionItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a selected live Item in a Collection. The updates for this Item will be published to the live site.

Required scope | `CMS:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.updateItemLive("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754", { + id: "42b720ef280c7a7a3be8cabe", + cmsLocaleId: "653ad57de882f528b32e810e", + lastPublished: "2022-11-29T16:22:43.159Z", + lastUpdated: "2022-11-17T17:19:43.282Z", + createdOn: "2022-11-17T17:11:57.148Z", + isArchived: false, + isDraft: false, + fieldData: { + name: "Pan Galactic Gargle Blaster Recipe", + slug: "pan-galactic-gargle-blaster", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**itemId:** `string` — Unique identifier for an Item + +
+
+ +
+
+ +**request:** `Webflow.CollectionItem` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.collections.items.publishItem(collectionId, { ...params }) -> Webflow.ItemsPublishItemResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Publish an item or multiple items.

Required scope | `cms:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.collections.items.publishItem("580e63fc8c9a982ac9b8b745", { + itemIds: ["itemIds"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Unique identifier for a Collection + +
+
+ +
+
+ +**request:** `Webflow.collections.ItemsPublishItemRequest` + +
+
+ +
+
+ +**requestOptions:** `Items.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Pages Scripts + +
client.pages.scripts.getCustomCode(pageId) -> Webflow.ScriptApplyList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all registered scripts that have been applied to a specific Page.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.pages.scripts.getCustomCode("63c720f9347c2139b248e552"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pageId:** `string` — Unique identifier for a Page + +
+
+ +
+
+ +**requestOptions:** `Scripts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.pages.scripts.upsertCustomCode(pageId, { ...params }) -> Webflow.ScriptApplyList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add a registered script to a Page.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.pages.scripts.upsertCustomCode("63c720f9347c2139b248e552", { + scripts: [ + { + id: "cms_slider", + location: "header", + version: "1.0.0", + attributes: { + "my-attribute": "some-value", + }, + }, + { + id: "alert", + location: "header", + version: "0.0.1", + }, + ], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pageId:** `string` — Unique identifier for a Page + +
+
+ +
+
+ +**request:** `Webflow.ScriptApplyList` + +
+
+ +
+
+ +**requestOptions:** `Scripts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.pages.scripts.deleteCustomCode(pageId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete the custom code block that an app has created for a page

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.pages.scripts.deleteCustomCode("63c720f9347c2139b248e552"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pageId:** `string` — Unique identifier for a Page + +
+
+ +
+
+ +**requestOptions:** `Scripts.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Sites ActivityLogs + +
client.sites.activityLogs.list(siteId, { ...params }) -> Webflow.SiteActivityLogResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve Activity Logs for a specific Site. Requires Site to be on an Enterprise plan.

Required scope | `site_activity:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sites.activityLogs.list("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.sites.ActivityLogsListRequest` + +
+
+ +
+
+ +**requestOptions:** `ActivityLogs.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Sites Scripts + +
client.sites.scripts.getCustomCode(siteId) -> Webflow.ScriptApplyList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all registered scripts that have been applied to a specific Site.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sites.scripts.getCustomCode("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**requestOptions:** `Scripts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.sites.scripts.upsertCustomCode(siteId, { ...params }) -> Webflow.ScriptApplyList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add a registered script to a Site.

In order to use the Custom Code APIs for Sites and Pages, Custom Code Scripts must first be registered to a Site via the `registered_scripts` endpoints, and then applied to a Site or Page using the appropriate `custom_code` endpoints.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sites.scripts.upsertCustomCode("580e63e98c9a982ac9b8b741", { + scripts: [ + { + id: "cms_slider", + location: "header", + version: "1.0.0", + attributes: { + "my-attribute": "some-value", + }, + }, + { + id: "alert", + location: "header", + version: "0.0.1", + }, + ], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.ScriptApplyList` + +
+
+ +
+
+ +**requestOptions:** `Scripts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.sites.scripts.deleteCustomCode(siteId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete the custom code block that an app created for a Site

Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:write` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sites.scripts.deleteCustomCode("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**requestOptions:** `Scripts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.sites.scripts.listCustomCodeBlocks(siteId, { ...params }) -> Webflow.ListCustomCodeBlocks +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all instances of Custom Code applied to a Site or Pages.
Access to this endpoint requires a bearer token from a Data Client App.
Required scope | `custom_code:read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sites.scripts.listCustomCodeBlocks("580e63e98c9a982ac9b8b741"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**siteId:** `string` — Unique identifier for a Site + +
+
+ +
+
+ +**request:** `Webflow.sites.ScriptsListCustomCodeBlocksRequest` + +
+
+ +
+
+ +**requestOptions:** `Scripts.RequestOptions` + +
+
+
+
+ +
+
+
diff --git a/src/api/resources/accessGroups/client/Client.ts b/src/api/resources/accessGroups/client/Client.ts index 9f302c27..92e5512c 100644 --- a/src/api/resources/accessGroups/client/Client.ts +++ b/src/api/resources/accessGroups/client/Client.ts @@ -43,7 +43,7 @@ export class AccessGroups { * @throws {@link Webflow.InternalServerError} * * @example - * await client.accessGroups.list("site_id") + * await client.accessGroups.list("580e63e98c9a982ac9b8b741") */ public async list( siteId: string, @@ -74,18 +74,20 @@ export class AccessGroups { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AccessGroupList.parseOrThrow(_response.body, { + return serializers.AccessGroupList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -106,7 +108,7 @@ export class AccessGroups { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/assets/client/Client.ts b/src/api/resources/assets/client/Client.ts index c7262cbb..a6a44773 100644 --- a/src/api/resources/assets/client/Client.ts +++ b/src/api/resources/assets/client/Client.ts @@ -41,7 +41,7 @@ export class Assets { * @throws {@link Webflow.InternalServerError} * * @example - * await client.assets.list("site_id") + * await client.assets.list("580e63e98c9a982ac9b8b741") */ public async list(siteId: string, requestOptions?: Assets.RequestOptions): Promise { const _response = await core.fetcher({ @@ -54,17 +54,19 @@ export class Assets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Assets.parseOrThrow(_response.body, { + return serializers.Assets.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -83,7 +85,7 @@ export class Assets { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -130,7 +132,7 @@ export class Assets { * @throws {@link Webflow.InternalServerError} * * @example - * await client.assets.create("site_id", { + * await client.assets.create("580e63e98c9a982ac9b8b741", { * fileName: "file.png", * fileHash: "3c7d87c9575702bc3b1e991f4d3c638e" * }) @@ -150,18 +152,20 @@ export class Assets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.AssetsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.AssetsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AssetUpload.parseOrThrow(_response.body, { + return serializers.AssetUpload.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -180,7 +184,7 @@ export class Assets { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -226,7 +230,7 @@ export class Assets { * @throws {@link Webflow.InternalServerError} * * @example - * await client.assets.get("asset_id") + * await client.assets.get("580e63fc8c9a982ac9b8b745") */ public async get(assetId: string, requestOptions?: Assets.RequestOptions): Promise { const _response = await core.fetcher({ @@ -239,17 +243,19 @@ export class Assets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Asset.parseOrThrow(_response.body, { + return serializers.Asset.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -268,7 +274,7 @@ export class Assets { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -314,7 +320,7 @@ export class Assets { * @throws {@link Webflow.InternalServerError} * * @example - * await client.assets.delete("asset_id") + * await client.assets.delete("580e63fc8c9a982ac9b8b745") */ public async delete(assetId: string, requestOptions?: Assets.RequestOptions): Promise { const _response = await core.fetcher({ @@ -327,11 +333,13 @@ export class Assets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -350,7 +358,7 @@ export class Assets { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -397,7 +405,7 @@ export class Assets { * @throws {@link Webflow.InternalServerError} * * @example - * await client.assets.update("asset_id", { + * await client.assets.update("580e63fc8c9a982ac9b8b745", { * displayName: "bulldoze.png" * }) */ @@ -416,18 +424,20 @@ export class Assets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.AssetsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.AssetsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Asset.parseOrThrow(_response.body, { + return serializers.Asset.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -446,7 +456,7 @@ export class Assets { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -492,7 +502,7 @@ export class Assets { * @throws {@link Webflow.InternalServerError} * * @example - * await client.assets.listFolders("site_id") + * await client.assets.listFolders("580e63e98c9a982ac9b8b741") */ public async listFolders(siteId: string, requestOptions?: Assets.RequestOptions): Promise { const _response = await core.fetcher({ @@ -505,17 +515,19 @@ export class Assets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AssetFolderList.parseOrThrow(_response.body, { + return serializers.AssetFolderList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -534,7 +546,7 @@ export class Assets { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -581,7 +593,7 @@ export class Assets { * @throws {@link Webflow.InternalServerError} * * @example - * await client.assets.createFolder("site_id", { + * await client.assets.createFolder("580e63e98c9a982ac9b8b741", { * displayName: "my asset folder" * }) */ @@ -600,18 +612,20 @@ export class Assets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.AssetsCreateFolderRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.AssetsCreateFolderRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AssetFolder.parseOrThrow(_response.body, { + return serializers.AssetFolder.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -630,7 +644,7 @@ export class Assets { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -676,7 +690,7 @@ export class Assets { * @throws {@link Webflow.InternalServerError} * * @example - * await client.assets.getFolder("asset_folder_id") + * await client.assets.getFolder("6390c49774a71f0e3c1a08ee") */ public async getFolder( assetFolderId: string, @@ -692,17 +706,19 @@ export class Assets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AssetFolder.parseOrThrow(_response.body, { + return serializers.AssetFolder.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -721,7 +737,7 @@ export class Assets { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/collections/client/Client.ts b/src/api/resources/collections/client/Client.ts index 61ff9ba3..da8c159b 100644 --- a/src/api/resources/collections/client/Client.ts +++ b/src/api/resources/collections/client/Client.ts @@ -43,7 +43,7 @@ export class Collections { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.list("site_id") + * await client.collections.list("580e63e98c9a982ac9b8b741") */ public async list(siteId: string, requestOptions?: Collections.RequestOptions): Promise { const _response = await core.fetcher({ @@ -56,17 +56,19 @@ export class Collections { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CollectionList.parseOrThrow(_response.body, { + return serializers.CollectionList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -85,7 +87,7 @@ export class Collections { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -132,7 +134,7 @@ export class Collections { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.create("site_id", { + * await client.collections.create("580e63e98c9a982ac9b8b741", { * displayName: "Blog Posts", * singularName: "Blog Post", * slug: "posts" @@ -153,18 +155,20 @@ export class Collections { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CollectionsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.CollectionsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Collection.parseOrThrow(_response.body, { + return serializers.Collection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -183,7 +187,7 @@ export class Collections { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -229,7 +233,7 @@ export class Collections { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.get("collection_id") + * await client.collections.get("580e63fc8c9a982ac9b8b745") */ public async get(collectionId: string, requestOptions?: Collections.RequestOptions): Promise { const _response = await core.fetcher({ @@ -242,17 +246,19 @@ export class Collections { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Collection.parseOrThrow(_response.body, { + return serializers.Collection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -271,7 +277,7 @@ export class Collections { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -317,7 +323,7 @@ export class Collections { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.deleteCollection("collection_id") + * await client.collections.deleteCollection("580e63fc8c9a982ac9b8b745") */ public async deleteCollection(collectionId: string, requestOptions?: Collections.RequestOptions): Promise { const _response = await core.fetcher({ @@ -330,11 +336,13 @@ export class Collections { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -353,7 +361,7 @@ export class Collections { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -400,7 +408,7 @@ export class Collections { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.delete("collection_id", "field_id") + * await client.collections.delete("580e63fc8c9a982ac9b8b745", "580e63fc8c9a982ac9b8b745") */ public async delete( collectionId: string, @@ -417,11 +425,13 @@ export class Collections { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -440,7 +450,7 @@ export class Collections { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/collections/resources/fields/client/Client.ts b/src/api/resources/collections/resources/fields/client/Client.ts index 4aa9228f..77edc491 100644 --- a/src/api/resources/collections/resources/fields/client/Client.ts +++ b/src/api/resources/collections/resources/fields/client/Client.ts @@ -42,9 +42,9 @@ export class Fields { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.fields.create("collection_id", { + * await client.collections.fields.create("580e63fc8c9a982ac9b8b745", { * isRequired: false, - * type: Webflow.collections.FieldCreateType.RichText, + * type: "RichText", * displayName: "Post Body", * helpText: "Add the body of your post here" * }) @@ -64,18 +64,20 @@ export class Fields { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.collections.FieldCreate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.collections.FieldCreate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Field.parseOrThrow(_response.body, { + return serializers.Field.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -94,7 +96,7 @@ export class Fields { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -142,7 +144,7 @@ export class Fields { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.fields.update("collection_id", "field_id", { + * await client.collections.fields.update("580e63fc8c9a982ac9b8b745", "580e63fc8c9a982ac9b8b745", { * isRequired: false, * displayName: "Post Body", * helpText: "Add the body of your post here" @@ -164,18 +166,20 @@ export class Fields { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.collections.FieldUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.collections.FieldUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Field.parseOrThrow(_response.body, { + return serializers.Field.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -194,7 +198,7 @@ export class Fields { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/collections/resources/fields/client/requests/FieldCreate.ts b/src/api/resources/collections/resources/fields/client/requests/FieldCreate.ts index 3eef21ea..a44b1c12 100644 --- a/src/api/resources/collections/resources/fields/client/requests/FieldCreate.ts +++ b/src/api/resources/collections/resources/fields/client/requests/FieldCreate.ts @@ -8,7 +8,7 @@ import * as Webflow from "../../../../../../index"; * @example * { * isRequired: false, - * type: Webflow.collections.FieldCreateType.RichText, + * type: "RichText", * displayName: "Post Body", * helpText: "Add the body of your post here" * } diff --git a/src/api/resources/collections/resources/items/client/Client.ts b/src/api/resources/collections/resources/items/client/Client.ts index 5e42538e..499cf36d 100644 --- a/src/api/resources/collections/resources/items/client/Client.ts +++ b/src/api/resources/collections/resources/items/client/Client.ts @@ -42,7 +42,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.listItems("collection_id") + * await client.collections.items.listItems("580e63fc8c9a982ac9b8b745") */ public async listItems( collectionId: string, @@ -89,18 +89,20 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CollectionItemList.parseOrThrow(_response.body, { + return serializers.CollectionItemList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -119,7 +121,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -166,7 +168,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.createItem("collection_id", { + * await client.collections.items.createItem("580e63fc8c9a982ac9b8b745", { * id: "42b720ef280c7a7a3be8cabe", * cmsLocaleId: "653ad57de882f528b32e810e", * lastPublished: "2022-11-29T16:22:43.159Z", @@ -184,7 +186,7 @@ export class Items { collectionId: string, request: Webflow.CollectionItem, requestOptions?: Items.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, @@ -195,18 +197,26 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.CollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return; + return serializers.CollectionItem.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); } if (_response.error.reason === "status-code") { @@ -219,7 +229,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -266,7 +276,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.listItemsLive("collection_id") + * await client.collections.items.listItemsLive("580e63fc8c9a982ac9b8b745") */ public async listItemsLive( collectionId: string, @@ -313,18 +323,20 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CollectionItemList.parseOrThrow(_response.body, { + return serializers.CollectionItemList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -343,7 +355,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -390,7 +402,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.createItemLive("collection_id", { + * await client.collections.items.createItemLive("580e63fc8c9a982ac9b8b745", { * id: "42b720ef280c7a7a3be8cabe", * cmsLocaleId: "653ad57de882f528b32e810e", * lastPublished: "2022-11-29T16:22:43.159Z", @@ -408,7 +420,7 @@ export class Items { collectionId: string, request: Webflow.CollectionItem, requestOptions?: Items.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, @@ -419,18 +431,26 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.CollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return; + return serializers.CollectionItem.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); } if (_response.error.reason === "status-code") { @@ -443,7 +463,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -480,7 +500,7 @@ export class Items { * Create single Item in a Collection with multiple corresponding locales.

Required scope | `CMS:write` * * @param {string} collectionId - Unique identifier for a Collection - * @param {Webflow.collections.BulkCollectionItem} request + * @param {Webflow.BulkCollectionItem} request * @param {Items.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Webflow.BadRequestError} @@ -490,15 +510,15 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.createItemForMultipleLocales("collection_id", { + * await client.collections.items.createItemForMultipleLocales("580e63fc8c9a982ac9b8b745", { * id: "580e64008c9a982ac9b8b754" * }) */ public async createItemForMultipleLocales( collectionId: string, - request: Webflow.collections.BulkCollectionItem, + request: Webflow.BulkCollectionItem, requestOptions?: Items.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, @@ -509,20 +529,26 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.collections.BulkCollectionItem.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - }), + requestType: "json", + body: serializers.BulkCollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return; + return serializers.BulkCollectionItem.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); } if (_response.error.reason === "status-code") { @@ -535,7 +561,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -583,7 +609,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.getItem("collection_id", "item_id") + * await client.collections.items.getItem("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754") */ public async getItem( collectionId: string, @@ -607,18 +633,20 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CollectionItem.parseOrThrow(_response.body, { + return serializers.CollectionItem.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -637,7 +665,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -685,7 +713,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.deleteItem("collection_id", "item_id") + * await client.collections.items.deleteItem("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754") */ public async deleteItem( collectionId: string, @@ -709,12 +737,14 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -733,7 +763,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -781,7 +811,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.updateItem("collection_id", "item_id", { + * await client.collections.items.updateItem("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754", { * id: "42b720ef280c7a7a3be8cabe", * cmsLocaleId: "653ad57de882f528b32e810e", * lastPublished: "2022-11-29T16:22:43.159Z", @@ -811,18 +841,20 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.CollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CollectionItem.parseOrThrow(_response.body, { + return serializers.CollectionItem.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -841,7 +873,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -889,7 +921,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.getItemLive("collection_id", "item_id") + * await client.collections.items.getItemLive("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754") */ public async getItemLive( collectionId: string, @@ -913,18 +945,20 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CollectionItem.parseOrThrow(_response.body, { + return serializers.CollectionItem.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -943,7 +977,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -991,7 +1025,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.deleteItemLive("collection_id", "item_id") + * await client.collections.items.deleteItemLive("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754") */ public async deleteItemLive( collectionId: string, @@ -1015,12 +1049,14 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1039,7 +1075,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -1087,7 +1123,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.updateItemLive("collection_id", "item_id", { + * await client.collections.items.updateItemLive("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754", { * id: "42b720ef280c7a7a3be8cabe", * cmsLocaleId: "653ad57de882f528b32e810e", * lastPublished: "2022-11-29T16:22:43.159Z", @@ -1117,18 +1153,20 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.CollectionItem.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CollectionItem.parseOrThrow(_response.body, { + return serializers.CollectionItem.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -1147,7 +1185,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -1194,7 +1232,7 @@ export class Items { * @throws {@link Webflow.InternalServerError} * * @example - * await client.collections.items.publishItem("collection_id", { + * await client.collections.items.publishItem("580e63fc8c9a982ac9b8b745", { * itemIds: ["itemIds"] * }) */ @@ -1202,7 +1240,7 @@ export class Items { collectionId: string, request: Webflow.collections.ItemsPublishItemRequest, requestOptions?: Items.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, @@ -1213,12 +1251,14 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.collections.ItemsPublishItemRequest.jsonOrThrow(request, { + requestType: "json", + body: serializers.collections.ItemsPublishItemRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -1226,7 +1266,13 @@ export class Items { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return; + return serializers.collections.ItemsPublishItemResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); } if (_response.error.reason === "status-code") { @@ -1239,7 +1285,7 @@ export class Items { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/collections/resources/items/client/requests/index.ts b/src/api/resources/collections/resources/items/client/requests/index.ts index 66c715e2..c5e6b062 100644 --- a/src/api/resources/collections/resources/items/client/requests/index.ts +++ b/src/api/resources/collections/resources/items/client/requests/index.ts @@ -1,6 +1,5 @@ export { type ItemsListItemsRequest } from "./ItemsListItemsRequest"; export { type ItemsListItemsLiveRequest } from "./ItemsListItemsLiveRequest"; -export { type BulkCollectionItem } from "./BulkCollectionItem"; export { type ItemsGetItemRequest } from "./ItemsGetItemRequest"; export { type ItemsDeleteItemRequest } from "./ItemsDeleteItemRequest"; export { type ItemsGetItemLiveRequest } from "./ItemsGetItemLiveRequest"; diff --git a/src/api/resources/collections/resources/items/types/ItemsPublishItemResponse.ts b/src/api/resources/collections/resources/items/types/ItemsPublishItemResponse.ts new file mode 100644 index 00000000..94e2b8c1 --- /dev/null +++ b/src/api/resources/collections/resources/items/types/ItemsPublishItemResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ItemsPublishItemResponse { + publishedItemIds?: string[]; + errors?: string[]; +} diff --git a/src/api/resources/collections/resources/items/types/index.ts b/src/api/resources/collections/resources/items/types/index.ts index dcde450b..dce8a6ed 100644 --- a/src/api/resources/collections/resources/items/types/index.ts +++ b/src/api/resources/collections/resources/items/types/index.ts @@ -2,4 +2,4 @@ export * from "./ItemsListItemsRequestSortBy"; export * from "./ItemsListItemsRequestSortOrder"; export * from "./ItemsListItemsLiveRequestSortBy"; export * from "./ItemsListItemsLiveRequestSortOrder"; -export * from "./BulkCollectionItemFieldData"; +export * from "./ItemsPublishItemResponse"; diff --git a/src/api/resources/ecommerce/client/Client.ts b/src/api/resources/ecommerce/client/Client.ts index b0ada75d..3547e3df 100644 --- a/src/api/resources/ecommerce/client/Client.ts +++ b/src/api/resources/ecommerce/client/Client.ts @@ -45,7 +45,7 @@ export class Ecommerce { * @throws {@link Webflow.InternalServerError} * * @example - * await client.ecommerce.getSettings("site_id") + * await client.ecommerce.getSettings("580e63e98c9a982ac9b8b741") */ public async getSettings( siteId: string, @@ -61,17 +61,19 @@ export class Ecommerce { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.EcommerceSettings.parseOrThrow(_response.body, { + return serializers.EcommerceSettings.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -94,7 +96,7 @@ export class Ecommerce { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/forms/client/Client.ts b/src/api/resources/forms/client/Client.ts index 71c06aba..cc254d68 100644 --- a/src/api/resources/forms/client/Client.ts +++ b/src/api/resources/forms/client/Client.ts @@ -44,7 +44,7 @@ export class Forms { * @throws {@link Webflow.InternalServerError} * * @example - * await client.forms.list("site_id") + * await client.forms.list("580e63e98c9a982ac9b8b741") */ public async list( siteId: string, @@ -71,18 +71,20 @@ export class Forms { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.FormList.parseOrThrow(_response.body, { + return serializers.FormList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -105,7 +107,7 @@ export class Forms { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -152,7 +154,7 @@ export class Forms { * @throws {@link Webflow.InternalServerError} * * @example - * await client.forms.get("form_id") + * await client.forms.get("580e63e98c9a982ac9b8b741") */ public async get(formId: string, requestOptions?: Forms.RequestOptions): Promise { const _response = await core.fetcher({ @@ -165,17 +167,19 @@ export class Forms { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Form.parseOrThrow(_response.body, { + return serializers.Form.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -196,7 +200,7 @@ export class Forms { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -244,7 +248,7 @@ export class Forms { * @throws {@link Webflow.InternalServerError} * * @example - * await client.forms.listSubmissions("form_id") + * await client.forms.listSubmissions("580e63e98c9a982ac9b8b741") */ public async listSubmissions( formId: string, @@ -271,18 +275,20 @@ export class Forms { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.FormSubmissionList.parseOrThrow(_response.body, { + return serializers.FormSubmissionList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -303,7 +309,7 @@ export class Forms { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -350,7 +356,7 @@ export class Forms { * @throws {@link Webflow.InternalServerError} * * @example - * await client.forms.getSubmission("form_submission_id") + * await client.forms.getSubmission("580e63e98c9a982ac9b8b741") */ public async getSubmission( formSubmissionId: string, @@ -366,17 +372,19 @@ export class Forms { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.FormSubmission.parseOrThrow(_response.body, { + return serializers.FormSubmission.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -397,7 +405,7 @@ export class Forms { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -446,7 +454,7 @@ export class Forms { * @throws {@link Webflow.InternalServerError} * * @example - * await client.forms.updateSubmission("form_submission_id") + * await client.forms.updateSubmission("580e63e98c9a982ac9b8b741") */ public async updateSubmission( formSubmissionId: string, @@ -463,20 +471,20 @@ export class Forms { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.FormsUpdateSubmissionRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - }), + requestType: "json", + body: serializers.FormsUpdateSubmissionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.FormSubmission.parseOrThrow(_response.body, { + return serializers.FormSubmission.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -499,7 +507,7 @@ export class Forms { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index d1e4bb57..45832f7c 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,4 +1,5 @@ -export * as collections from "./collections"; +export * as sites from "./sites"; +export * from "./sites/types"; export * as pages from "./pages"; export * from "./pages/types"; export * as users from "./users"; @@ -11,8 +12,8 @@ export * as orders from "./orders"; export * from "./orders/types"; export * as inventory from "./inventory"; export * from "./inventory/types"; +export * as collections from "./collections"; export * as token from "./token"; -export * as sites from "./sites"; export * as scripts from "./scripts"; export * as assets from "./assets"; export * as webhooks from "./webhooks"; diff --git a/src/api/resources/inventory/client/Client.ts b/src/api/resources/inventory/client/Client.ts index 7c782d3b..252e6ec0 100644 --- a/src/api/resources/inventory/client/Client.ts +++ b/src/api/resources/inventory/client/Client.ts @@ -46,7 +46,7 @@ export class Inventory { * @throws {@link Webflow.InternalServerError} * * @example - * await client.inventory.list("collection_id", "item_id") + * await client.inventory.list("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754") */ public async list( collectionId: string, @@ -63,17 +63,19 @@ export class Inventory { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.InventoryItem.parseOrThrow(_response.body, { + return serializers.InventoryItem.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -96,7 +98,7 @@ export class Inventory { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -148,8 +150,8 @@ export class Inventory { * @throws {@link Webflow.InternalServerError} * * @example - * await client.inventory.update("collection_id", "item_id", { - * inventoryType: Webflow.InventoryUpdateRequestInventoryType.Infinite + * await client.inventory.update("580e63fc8c9a982ac9b8b745", "580e64008c9a982ac9b8b754", { + * inventoryType: "infinite" * }) */ public async update( @@ -168,18 +170,20 @@ export class Inventory { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.InventoryUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.InventoryUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.InventoryItem.parseOrThrow(_response.body, { + return serializers.InventoryItem.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -202,7 +206,7 @@ export class Inventory { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/inventory/client/requests/InventoryUpdateRequest.ts b/src/api/resources/inventory/client/requests/InventoryUpdateRequest.ts index daf3bd69..6dd3bbee 100644 --- a/src/api/resources/inventory/client/requests/InventoryUpdateRequest.ts +++ b/src/api/resources/inventory/client/requests/InventoryUpdateRequest.ts @@ -7,7 +7,7 @@ import * as Webflow from "../../../../index"; /** * @example * { - * inventoryType: Webflow.InventoryUpdateRequestInventoryType.Infinite + * inventoryType: "infinite" * } */ export interface InventoryUpdateRequest { diff --git a/src/api/resources/orders/client/Client.ts b/src/api/resources/orders/client/Client.ts index 454c9b02..8ea3c07c 100644 --- a/src/api/resources/orders/client/Client.ts +++ b/src/api/resources/orders/client/Client.ts @@ -46,7 +46,7 @@ export class Orders { * @throws {@link Webflow.InternalServerError} * * @example - * await client.orders.list("site_id") + * await client.orders.list("580e63e98c9a982ac9b8b741") */ public async list( siteId: string, @@ -77,18 +77,20 @@ export class Orders { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.OrderList.parseOrThrow(_response.body, { + return serializers.OrderList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -111,7 +113,7 @@ export class Orders { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -162,7 +164,7 @@ export class Orders { * @throws {@link Webflow.InternalServerError} * * @example - * await client.orders.get("site_id", "order_id") + * await client.orders.get("580e63e98c9a982ac9b8b741", "5e8518516e147040726cc415") */ public async get(siteId: string, orderId: string, requestOptions?: Orders.RequestOptions): Promise { const _response = await core.fetcher({ @@ -175,17 +177,19 @@ export class Orders { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Order.parseOrThrow(_response.body, { + return serializers.Order.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -208,7 +212,7 @@ export class Orders { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -260,7 +264,7 @@ export class Orders { * @throws {@link Webflow.InternalServerError} * * @example - * await client.orders.update("site_id", "order_id") + * await client.orders.update("580e63e98c9a982ac9b8b741", "5e8518516e147040726cc415") */ public async update( siteId: string, @@ -278,18 +282,20 @@ export class Orders { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.OrdersUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.OrdersUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Order.parseOrThrow(_response.body, { + return serializers.Order.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -312,7 +318,7 @@ export class Orders { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -364,7 +370,7 @@ export class Orders { * @throws {@link Webflow.InternalServerError} * * @example - * await client.orders.updateFulfill("site_id", "order_id") + * await client.orders.updateFulfill("580e63e98c9a982ac9b8b741", "5e8518516e147040726cc415") */ public async updateFulfill( siteId: string, @@ -382,20 +388,20 @@ export class Orders { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.OrdersUpdateFulfillRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - }), + requestType: "json", + body: serializers.OrdersUpdateFulfillRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Order.parseOrThrow(_response.body, { + return serializers.Order.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -418,7 +424,7 @@ export class Orders { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -469,7 +475,7 @@ export class Orders { * @throws {@link Webflow.InternalServerError} * * @example - * await client.orders.updateUnfulfill("site_id", "order_id") + * await client.orders.updateUnfulfill("580e63e98c9a982ac9b8b741", "5e8518516e147040726cc415") */ public async updateUnfulfill( siteId: string, @@ -486,17 +492,19 @@ export class Orders { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Order.parseOrThrow(_response.body, { + return serializers.Order.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -519,7 +527,7 @@ export class Orders { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -572,7 +580,7 @@ export class Orders { * @throws {@link Webflow.InternalServerError} * * @example - * await client.orders.refund("site_id", "order_id") + * await client.orders.refund("580e63e98c9a982ac9b8b741", "5e8518516e147040726cc415") */ public async refund( siteId: string, @@ -590,18 +598,20 @@ export class Orders { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.OrdersRefundRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.OrdersRefundRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Order.parseOrThrow(_response.body, { + return serializers.Order.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -624,7 +634,7 @@ export class Orders { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/pages/client/Client.ts b/src/api/resources/pages/client/Client.ts index 8a232573..989d9dcc 100644 --- a/src/api/resources/pages/client/Client.ts +++ b/src/api/resources/pages/client/Client.ts @@ -43,7 +43,9 @@ export class Pages { * @throws {@link Webflow.InternalServerError} * * @example - * await client.pages.list("site_id") + * await client.pages.list("580e63e98c9a982ac9b8b741", { + * locale: "65427cf400e02b306eaa04a0" + * }) */ public async list( siteId: string, @@ -74,18 +76,20 @@ export class Pages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.PageList.parseOrThrow(_response.body, { + return serializers.PageList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -104,7 +108,7 @@ export class Pages { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -151,13 +155,15 @@ export class Pages { * @throws {@link Webflow.InternalServerError} * * @example - * await client.pages.getMetadata("page_id") + * await client.pages.getMetadata("63c720f9347c2139b248e552", { + * locale: "65427cf400e02b306eaa04a0" + * }) */ public async getMetadata( pageId: string, request: Webflow.PagesGetMetadataRequest = {}, requestOptions?: Pages.RequestOptions - ): Promise { + ): Promise { const { locale } = request; const _queryParams: Record = {}; if (locale != null) { @@ -174,18 +180,20 @@ export class Pages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.PageDetails.parseOrThrow(_response.body, { + return serializers.Page.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -204,7 +212,7 @@ export class Pages { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -251,7 +259,8 @@ export class Pages { * @throws {@link Webflow.InternalServerError} * * @example - * await client.pages.updatePageSettings("page_id", { + * await client.pages.updatePageSettings("63c720f9347c2139b248e552", { + * locale: "65427cf400e02b306eaa04a0", * body: { * id: "6596da6045e56dee495bcbba", * siteId: "6258612d1ee792848f805dcf", @@ -259,8 +268,8 @@ export class Pages { * slug: "guide-to-the-galaxy", * parentId: "6419db964a9c435aa3af6251", * collectionId: "6390c49774a71f12831a08e3", - * createdOn: new Date("2024-03-11T10:42:00.000Z"), - * lastUpdated: new Date("2024-03-11T10:42:42.000Z"), + * createdOn: "2024-03-11T10:42:00Z", + * lastUpdated: "2024-03-11T10:42:42Z", * archived: false, * draft: false, * canBranch: true, @@ -273,7 +282,9 @@ export class Pages { * titleCopied: false, * description: "Dive deep into the mysteries of the universe with your guide to everything galactic.", * descriptionCopied: false - * } + * }, + * localeId: "653fd9af6a07fc9cfd7a5e57", + * publishedPath: "/en-us/guide-to-the-galaxy" * } * }) */ @@ -281,7 +292,7 @@ export class Pages { pageId: string, request: Webflow.UpdatePageSettingsRequest, requestOptions?: Pages.RequestOptions - ): Promise { + ): Promise { const { locale, body: _body } = request; const _queryParams: Record = {}; if (locale != null) { @@ -298,19 +309,21 @@ export class Pages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, - body: await serializers.Page.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.Page.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.PageDetails.parseOrThrow(_response.body, { + return serializers.Page.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -329,7 +342,7 @@ export class Pages { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -377,7 +390,9 @@ export class Pages { * @throws {@link Webflow.InternalServerError} * * @example - * await client.pages.getContent("page_id") + * await client.pages.getContent("63c720f9347c2139b248e552", { + * locale: "65427cf400e02b306eaa04a0" + * }) */ public async getContent( pageId: string, @@ -408,18 +423,20 @@ export class Pages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Dom.parseOrThrow(_response.body, { + return serializers.Dom.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -440,7 +457,7 @@ export class Pages { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -492,7 +509,7 @@ export class Pages { * @throws {@link Webflow.InternalServerError} * * @example - * await client.pages.updateStaticContent("page_id", { + * await client.pages.updateStaticContent("63c720f9347c2139b248e552", { * locale: "locale", * nodes: [{ * nodeId: "a245c12d-995b-55ee-5ec7-aa36a6cad623", @@ -524,19 +541,21 @@ export class Pages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, - body: await serializers.DomWrite.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.DomWrite.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.UpdateStaticContentResponse.parseOrThrow(_response.body, { + return serializers.UpdateStaticContentResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -557,7 +576,7 @@ export class Pages { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/pages/client/requests/PagesGetContentRequest.ts b/src/api/resources/pages/client/requests/PagesGetContentRequest.ts index e535566d..971e471c 100644 --- a/src/api/resources/pages/client/requests/PagesGetContentRequest.ts +++ b/src/api/resources/pages/client/requests/PagesGetContentRequest.ts @@ -4,7 +4,9 @@ /** * @example - * {} + * { + * locale: "65427cf400e02b306eaa04a0" + * } */ export interface PagesGetContentRequest { /** diff --git a/src/api/resources/pages/client/requests/PagesGetMetadataRequest.ts b/src/api/resources/pages/client/requests/PagesGetMetadataRequest.ts index 14692129..d4a4e72d 100644 --- a/src/api/resources/pages/client/requests/PagesGetMetadataRequest.ts +++ b/src/api/resources/pages/client/requests/PagesGetMetadataRequest.ts @@ -4,7 +4,9 @@ /** * @example - * {} + * { + * locale: "65427cf400e02b306eaa04a0" + * } */ export interface PagesGetMetadataRequest { /** diff --git a/src/api/resources/pages/client/requests/PagesListRequest.ts b/src/api/resources/pages/client/requests/PagesListRequest.ts index 69aa2aa5..b7ba9cf4 100644 --- a/src/api/resources/pages/client/requests/PagesListRequest.ts +++ b/src/api/resources/pages/client/requests/PagesListRequest.ts @@ -4,7 +4,9 @@ /** * @example - * {} + * { + * locale: "65427cf400e02b306eaa04a0" + * } */ export interface PagesListRequest { /** diff --git a/src/api/resources/pages/client/requests/UpdatePageSettingsRequest.ts b/src/api/resources/pages/client/requests/UpdatePageSettingsRequest.ts index e346b771..d66afa13 100644 --- a/src/api/resources/pages/client/requests/UpdatePageSettingsRequest.ts +++ b/src/api/resources/pages/client/requests/UpdatePageSettingsRequest.ts @@ -7,6 +7,7 @@ import * as Webflow from "../../../../index"; /** * @example * { + * locale: "65427cf400e02b306eaa04a0", * body: { * id: "6596da6045e56dee495bcbba", * siteId: "6258612d1ee792848f805dcf", @@ -14,8 +15,8 @@ import * as Webflow from "../../../../index"; * slug: "guide-to-the-galaxy", * parentId: "6419db964a9c435aa3af6251", * collectionId: "6390c49774a71f12831a08e3", - * createdOn: new Date("2024-03-11T10:42:00.000Z"), - * lastUpdated: new Date("2024-03-11T10:42:42.000Z"), + * createdOn: "2024-03-11T10:42:00Z", + * lastUpdated: "2024-03-11T10:42:42Z", * archived: false, * draft: false, * canBranch: true, @@ -28,7 +29,9 @@ import * as Webflow from "../../../../index"; * titleCopied: false, * description: "Dive deep into the mysteries of the universe with your guide to everything galactic.", * descriptionCopied: false - * } + * }, + * localeId: "653fd9af6a07fc9cfd7a5e57", + * publishedPath: "/en-us/guide-to-the-galaxy" * } * } */ diff --git a/src/api/resources/pages/resources/scripts/client/Client.ts b/src/api/resources/pages/resources/scripts/client/Client.ts index 20a0781c..3a2b2e5f 100644 --- a/src/api/resources/pages/resources/scripts/client/Client.ts +++ b/src/api/resources/pages/resources/scripts/client/Client.ts @@ -41,7 +41,7 @@ export class Scripts { * @throws {@link Webflow.InternalServerError} * * @example - * await client.pages.scripts.getCustomCode("page_id") + * await client.pages.scripts.getCustomCode("63c720f9347c2139b248e552") */ public async getCustomCode( pageId: string, @@ -57,17 +57,19 @@ export class Scripts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ScriptApplyList.parseOrThrow(_response.body, { + return serializers.ScriptApplyList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -86,7 +88,7 @@ export class Scripts { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -133,17 +135,17 @@ export class Scripts { * @throws {@link Webflow.InternalServerError} * * @example - * await client.pages.scripts.upsertCustomCode("page_id", { + * await client.pages.scripts.upsertCustomCode("63c720f9347c2139b248e552", { * scripts: [{ * id: "cms_slider", - * location: Webflow.ScriptApplyLocation.Header, + * location: "header", * version: "1.0.0", * attributes: { * "my-attribute": "some-value" * } * }, { * id: "alert", - * location: Webflow.ScriptApplyLocation.Header, + * location: "header", * version: "0.0.1" * }] * }) @@ -163,18 +165,20 @@ export class Scripts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.ScriptApplyList.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.ScriptApplyList.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ScriptApplyList.parseOrThrow(_response.body, { + return serializers.ScriptApplyList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -193,7 +197,7 @@ export class Scripts { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -239,7 +243,7 @@ export class Scripts { * @throws {@link Webflow.InternalServerError} * * @example - * await client.pages.scripts.deleteCustomCode("page_id") + * await client.pages.scripts.deleteCustomCode("63c720f9347c2139b248e552") */ public async deleteCustomCode(pageId: string, requestOptions?: Scripts.RequestOptions): Promise { const _response = await core.fetcher({ @@ -252,11 +256,13 @@ export class Scripts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -275,7 +281,7 @@ export class Scripts { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/products/client/Client.ts b/src/api/resources/products/client/Client.ts index d784f418..52e26526 100644 --- a/src/api/resources/products/client/Client.ts +++ b/src/api/resources/products/client/Client.ts @@ -46,7 +46,7 @@ export class Products { * @throws {@link Webflow.InternalServerError} * * @example - * await client.products.list("site_id") + * await client.products.list("580e63e98c9a982ac9b8b741") */ public async list( siteId: string, @@ -73,18 +73,20 @@ export class Products { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ProductAndSkUsList.parseOrThrow(_response.body, { + return serializers.ProductAndSkUsList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -107,7 +109,7 @@ export class Products { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -164,7 +166,7 @@ export class Products { * @throws {@link Webflow.InternalServerError} * * @example - * await client.products.create("site_id") + * await client.products.create("580e63e98c9a982ac9b8b741") */ public async create( siteId: string, @@ -181,18 +183,20 @@ export class Products { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.ProductSkuCreate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.ProductSkuCreate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ProductAndSkUs.parseOrThrow(_response.body, { + return serializers.ProductAndSkUs.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -215,7 +219,7 @@ export class Products { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -266,7 +270,7 @@ export class Products { * @throws {@link Webflow.InternalServerError} * * @example - * await client.products.get("site_id", "product_id") + * await client.products.get("580e63e98c9a982ac9b8b741", "580e63fc8c9a982ac9b8b745") */ public async get( siteId: string, @@ -283,17 +287,19 @@ export class Products { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ProductAndSkUs.parseOrThrow(_response.body, { + return serializers.ProductAndSkUs.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -316,7 +322,7 @@ export class Products { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -368,7 +374,7 @@ export class Products { * @throws {@link Webflow.InternalServerError} * * @example - * await client.products.update("site_id", "product_id") + * await client.products.update("580e63e98c9a982ac9b8b741", "580e63fc8c9a982ac9b8b745") */ public async update( siteId: string, @@ -386,18 +392,20 @@ export class Products { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.ProductSkuUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.ProductSkuUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Product.parseOrThrow(_response.body, { + return serializers.Product.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -420,7 +428,7 @@ export class Products { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -474,7 +482,7 @@ export class Products { * @throws {@link Webflow.InternalServerError} * * @example - * await client.products.createSku("site_id", "product_id", { + * await client.products.createSku("580e63e98c9a982ac9b8b741", "580e63fc8c9a982ac9b8b745", { * skus: [{}] * }) */ @@ -494,18 +502,20 @@ export class Products { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.ProductsCreateSkuRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.ProductsCreateSkuRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ProductsCreateSkuResponse.parseOrThrow(_response.body, { + return serializers.ProductsCreateSkuResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -528,7 +538,7 @@ export class Products { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -581,7 +591,7 @@ export class Products { * @throws {@link Webflow.InternalServerError} * * @example - * await client.products.updateSku("site_id", "product_id", "sku_id", { + * await client.products.updateSku("580e63e98c9a982ac9b8b741", "580e63fc8c9a982ac9b8b745", "5e8518516e147040726cc415", { * sku: {} * }) */ @@ -604,18 +614,20 @@ export class Products { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.ProductsUpdateSkuRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.ProductsUpdateSkuRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Sku.parseOrThrow(_response.body, { + return serializers.Sku.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -638,7 +650,7 @@ export class Products { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/scripts/client/Client.ts b/src/api/resources/scripts/client/Client.ts index ab04dafe..7c37dbc2 100644 --- a/src/api/resources/scripts/client/Client.ts +++ b/src/api/resources/scripts/client/Client.ts @@ -41,7 +41,7 @@ export class Scripts { * @throws {@link Webflow.InternalServerError} * * @example - * await client.scripts.list("site_id") + * await client.scripts.list("580e63e98c9a982ac9b8b741") */ public async list(siteId: string, requestOptions?: Scripts.RequestOptions): Promise { const _response = await core.fetcher({ @@ -54,17 +54,19 @@ export class Scripts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.RegisteredScriptList.parseOrThrow(_response.body, { + return serializers.RegisteredScriptList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -83,7 +85,7 @@ export class Scripts { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -130,7 +132,7 @@ export class Scripts { * @throws {@link Webflow.InternalServerError} * * @example - * await client.scripts.registerHosted("site_id", { + * await client.scripts.registerHosted("580e63e98c9a982ac9b8b741", { * hostedLocation: "hostedLocation", * integrityHash: "integrityHash", * version: "version", @@ -152,18 +154,20 @@ export class Scripts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CustomCodeHostedRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.CustomCodeHostedRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CustomCodeHostedResponse.parseOrThrow(_response.body, { + return serializers.CustomCodeHostedResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -182,7 +186,7 @@ export class Scripts { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -229,7 +233,7 @@ export class Scripts { * @throws {@link Webflow.InternalServerError} * * @example - * await client.scripts.registerInline("site_id", { + * await client.scripts.registerInline("580e63e98c9a982ac9b8b741", { * sourceCode: "alert('hello world');", * version: "0.0.1", * displayName: "Alert" @@ -250,18 +254,20 @@ export class Scripts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.CustomCodeInlineRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.CustomCodeInlineRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.CustomCodeInlineResponse.parseOrThrow(_response.body, { + return serializers.CustomCodeInlineResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -280,7 +286,7 @@ export class Scripts { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/sites/client/Client.ts b/src/api/resources/sites/client/Client.ts index 8ae993d0..923e6553 100644 --- a/src/api/resources/sites/client/Client.ts +++ b/src/api/resources/sites/client/Client.ts @@ -53,17 +53,19 @@ export class Sites { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Sites.parseOrThrow(_response.body, { + return serializers.Sites.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -80,7 +82,7 @@ export class Sites { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -124,7 +126,7 @@ export class Sites { * @throws {@link Webflow.InternalServerError} * * @example - * await client.sites.get("site_id") + * await client.sites.get("580e63e98c9a982ac9b8b741") */ public async get(siteId: string, requestOptions?: Sites.RequestOptions): Promise { const _response = await core.fetcher({ @@ -137,17 +139,19 @@ export class Sites { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Site.parseOrThrow(_response.body, { + return serializers.Site.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -166,7 +170,7 @@ export class Sites { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -212,7 +216,7 @@ export class Sites { * @throws {@link Webflow.InternalServerError} * * @example - * await client.sites.getCustomDomain("site_id") + * await client.sites.getCustomDomain("580e63e98c9a982ac9b8b741") */ public async getCustomDomain(siteId: string, requestOptions?: Sites.RequestOptions): Promise { const _response = await core.fetcher({ @@ -225,17 +229,19 @@ export class Sites { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Domains.parseOrThrow(_response.body, { + return serializers.Domains.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -254,7 +260,7 @@ export class Sites { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -301,13 +307,13 @@ export class Sites { * @throws {@link Webflow.TooManyRequestsError} * * @example - * await client.sites.publish("site_id") + * await client.sites.publish("580e63e98c9a982ac9b8b741") */ public async publish( siteId: string, request: Webflow.SitesPublishRequest = {}, requestOptions?: Sites.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default, @@ -318,18 +324,26 @@ export class Sites { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.SitesPublishRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.SitesPublishRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return; + return serializers.SitesPublishResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); } if (_response.error.reason === "status-code") { @@ -344,7 +358,7 @@ export class Sites { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/sites/index.ts b/src/api/resources/sites/index.ts index 33a87f10..848e75ab 100644 --- a/src/api/resources/sites/index.ts +++ b/src/api/resources/sites/index.ts @@ -1,2 +1,3 @@ +export * from "./types"; export * from "./client"; export * from "./resources"; diff --git a/src/api/resources/sites/resources/activityLogs/client/Client.ts b/src/api/resources/sites/resources/activityLogs/client/Client.ts index 90d79bd9..935561b8 100644 --- a/src/api/resources/sites/resources/activityLogs/client/Client.ts +++ b/src/api/resources/sites/resources/activityLogs/client/Client.ts @@ -41,7 +41,7 @@ export class ActivityLogs { * @throws {@link Webflow.InternalServerError} * * @example - * await client.sites.activityLogs.list("site_id") + * await client.sites.activityLogs.list("580e63e98c9a982ac9b8b741") */ public async list( siteId: string, @@ -68,18 +68,20 @@ export class ActivityLogs { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.SiteActivityLogResponse.parseOrThrow(_response.body, { + return serializers.SiteActivityLogResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -96,7 +98,7 @@ export class ActivityLogs { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/sites/resources/scripts/client/Client.ts b/src/api/resources/sites/resources/scripts/client/Client.ts index 3150517d..fc44cb3c 100644 --- a/src/api/resources/sites/resources/scripts/client/Client.ts +++ b/src/api/resources/sites/resources/scripts/client/Client.ts @@ -41,7 +41,7 @@ export class Scripts { * @throws {@link Webflow.InternalServerError} * * @example - * await client.sites.scripts.getCustomCode("site_id") + * await client.sites.scripts.getCustomCode("580e63e98c9a982ac9b8b741") */ public async getCustomCode( siteId: string, @@ -57,17 +57,19 @@ export class Scripts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ScriptApplyList.parseOrThrow(_response.body, { + return serializers.ScriptApplyList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -86,7 +88,7 @@ export class Scripts { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -133,17 +135,17 @@ export class Scripts { * @throws {@link Webflow.InternalServerError} * * @example - * await client.sites.scripts.upsertCustomCode("site_id", { + * await client.sites.scripts.upsertCustomCode("580e63e98c9a982ac9b8b741", { * scripts: [{ * id: "cms_slider", - * location: Webflow.ScriptApplyLocation.Header, + * location: "header", * version: "1.0.0", * attributes: { * "my-attribute": "some-value" * } * }, { * id: "alert", - * location: Webflow.ScriptApplyLocation.Header, + * location: "header", * version: "0.0.1" * }] * }) @@ -163,18 +165,20 @@ export class Scripts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.ScriptApplyList.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.ScriptApplyList.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ScriptApplyList.parseOrThrow(_response.body, { + return serializers.ScriptApplyList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -193,7 +197,7 @@ export class Scripts { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -239,7 +243,7 @@ export class Scripts { * @throws {@link Webflow.InternalServerError} * * @example - * await client.sites.scripts.deleteCustomCode("site_id") + * await client.sites.scripts.deleteCustomCode("580e63e98c9a982ac9b8b741") */ public async deleteCustomCode(siteId: string, requestOptions?: Scripts.RequestOptions): Promise { const _response = await core.fetcher({ @@ -252,11 +256,13 @@ export class Scripts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -275,7 +281,7 @@ export class Scripts { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -322,7 +328,7 @@ export class Scripts { * @throws {@link Webflow.InternalServerError} * * @example - * await client.sites.scripts.listCustomCodeBlocks("site_id") + * await client.sites.scripts.listCustomCodeBlocks("580e63e98c9a982ac9b8b741") */ public async listCustomCodeBlocks( siteId: string, @@ -349,18 +355,20 @@ export class Scripts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ListCustomCodeBlocks.parseOrThrow(_response.body, { + return serializers.ListCustomCodeBlocks.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -379,7 +387,7 @@ export class Scripts { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/sites/types/SitesPublishResponse.ts b/src/api/resources/sites/types/SitesPublishResponse.ts new file mode 100644 index 00000000..e427b61a --- /dev/null +++ b/src/api/resources/sites/types/SitesPublishResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Webflow from "../../../index"; + +export interface SitesPublishResponse { + /** Array of domains objects */ + customDomains?: Webflow.Domain[]; + /** Flag for publishing to webflow.io subdomain */ + publishToWebflowSubdomain?: boolean; +} diff --git a/src/api/resources/sites/types/index.ts b/src/api/resources/sites/types/index.ts new file mode 100644 index 00000000..7708da86 --- /dev/null +++ b/src/api/resources/sites/types/index.ts @@ -0,0 +1 @@ +export * from "./SitesPublishResponse"; diff --git a/src/api/resources/token/client/Client.ts b/src/api/resources/token/client/Client.ts index 6343d00c..5c960a2a 100644 --- a/src/api/resources/token/client/Client.ts +++ b/src/api/resources/token/client/Client.ts @@ -50,17 +50,19 @@ export class Token { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AuthorizedUser.parseOrThrow(_response.body, { + return serializers.AuthorizedUser.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -119,17 +121,19 @@ export class Token { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Authorization.parseOrThrow(_response.body, { + return serializers.Authorization.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/users/client/Client.ts b/src/api/resources/users/client/Client.ts index 6b8f1991..5fef9a23 100644 --- a/src/api/resources/users/client/Client.ts +++ b/src/api/resources/users/client/Client.ts @@ -43,7 +43,7 @@ export class Users { * @throws {@link Webflow.InternalServerError} * * @example - * await client.users.list("site_id") + * await client.users.list("580e63e98c9a982ac9b8b741") */ public async list( siteId: string, @@ -74,18 +74,20 @@ export class Users { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.UserList.parseOrThrow(_response.body, { + return serializers.UserList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -106,7 +108,7 @@ export class Users { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -154,7 +156,7 @@ export class Users { * @throws {@link Webflow.InternalServerError} * * @example - * await client.users.get("site_id", "user_id") + * await client.users.get("580e63e98c9a982ac9b8b741", "580e63e98c9a982ac9b8b741") */ public async get(siteId: string, userId: string, requestOptions?: Users.RequestOptions): Promise { const _response = await core.fetcher({ @@ -167,17 +169,19 @@ export class Users { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.User.parseOrThrow(_response.body, { + return serializers.User.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -198,7 +202,7 @@ export class Users { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -246,7 +250,7 @@ export class Users { * @throws {@link Webflow.InternalServerError} * * @example - * await client.users.delete("site_id", "user_id") + * await client.users.delete("580e63e98c9a982ac9b8b741", "580e63e98c9a982ac9b8b741") */ public async delete(siteId: string, userId: string, requestOptions?: Users.RequestOptions): Promise { const _response = await core.fetcher({ @@ -259,11 +263,13 @@ export class Users { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -284,7 +290,7 @@ export class Users { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -335,7 +341,7 @@ export class Users { * @throws {@link Webflow.InternalServerError} * * @example - * await client.users.update("site_id", "user_id", { + * await client.users.update("580e63e98c9a982ac9b8b741", "580e63e98c9a982ac9b8b741", { * data: { * name: "Some One", * acceptPrivacy: false, @@ -360,18 +366,20 @@ export class Users { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.UsersUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.UsersUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.User.parseOrThrow(_response.body, { + return serializers.User.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -392,7 +400,7 @@ export class Users { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -441,7 +449,7 @@ export class Users { * @throws {@link Webflow.InternalServerError} * * @example - * await client.users.invite("site_id", { + * await client.users.invite("580e63e98c9a982ac9b8b741", { * email: "some.one@home.com", * accessGroups: ["webflowers"] * }) @@ -461,18 +469,20 @@ export class Users { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.UsersInviteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.UsersInviteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.User.parseOrThrow(_response.body, { + return serializers.User.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -495,7 +505,7 @@ export class Users { throw new Webflow.ConflictError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/webhooks/client/Client.ts b/src/api/resources/webhooks/client/Client.ts index 7b0124b7..6ff35e84 100644 --- a/src/api/resources/webhooks/client/Client.ts +++ b/src/api/resources/webhooks/client/Client.ts @@ -41,7 +41,7 @@ export class Webhooks { * @throws {@link Webflow.InternalServerError} * * @example - * await client.webhooks.list("site_id") + * await client.webhooks.list("580e63e98c9a982ac9b8b741") */ public async list(siteId: string, requestOptions?: Webhooks.RequestOptions): Promise { const _response = await core.fetcher({ @@ -54,17 +54,19 @@ export class Webhooks { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.WebhookList.parseOrThrow(_response.body, { + return serializers.WebhookList.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -83,7 +85,7 @@ export class Webhooks { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -130,14 +132,14 @@ export class Webhooks { * @throws {@link Webflow.InternalServerError} * * @example - * await client.webhooks.create("site_id", { + * await client.webhooks.create("580e63e98c9a982ac9b8b741", { * id: "582266e0cd48de0f0e3c6d8b", - * triggerType: Webflow.TriggerType.FormSubmission, + * triggerType: "form_submission", * url: "https://webhook.site/7f7f7f7f-7f7f-7f7f-7f7f-7f7f7f7f7f7f", * workspaceId: "4f4e46fd476ea8c507000001", * siteId: "562ac0395358780a1f5e6fbd", - * lastTriggered: new Date("2023-02-08T23:59:28.000Z"), - * createdOn: new Date("2022-11-08T23:59:28.000Z") + * lastTriggered: "2023-02-08T23:59:28Z", + * createdOn: "2022-11-08T23:59:28Z" * }) */ public async create( @@ -155,18 +157,20 @@ export class Webhooks { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.Webhook.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.Webhook.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Webhook.parseOrThrow(_response.body, { + return serializers.Webhook.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -185,7 +189,7 @@ export class Webhooks { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -231,7 +235,7 @@ export class Webhooks { * @throws {@link Webflow.InternalServerError} * * @example - * await client.webhooks.get("webhook_id") + * await client.webhooks.get("580e64008c9a982ac9b8b754") */ public async get(webhookId: string, requestOptions?: Webhooks.RequestOptions): Promise { const _response = await core.fetcher({ @@ -244,17 +248,19 @@ export class Webhooks { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Webhook.parseOrThrow(_response.body, { + return serializers.Webhook.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -273,7 +279,7 @@ export class Webhooks { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -319,7 +325,7 @@ export class Webhooks { * @throws {@link Webflow.InternalServerError} * * @example - * await client.webhooks.delete("webhook_id") + * await client.webhooks.delete("580e64008c9a982ac9b8b754") */ public async delete(webhookId: string, requestOptions?: Webhooks.RequestOptions): Promise { const _response = await core.fetcher({ @@ -332,11 +338,13 @@ export class Webhooks { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "webflow-api", - "X-Fern-SDK-Version": "2.3.6", + "X-Fern-SDK-Version": "2.4.0", + "User-Agent": "webflow-api/2.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -355,7 +363,7 @@ export class Webhooks { throw new Webflow.NotFoundError(_response.error.body); case 429: throw new Webflow.TooManyRequestsError( - await serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { + serializers.TooManyRequestsErrorBody.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/collections/resources/items/client/requests/BulkCollectionItem.ts b/src/api/types/BulkCollectionItem.ts similarity index 68% rename from src/api/resources/collections/resources/items/client/requests/BulkCollectionItem.ts rename to src/api/types/BulkCollectionItem.ts index 5480c922..f2618ee6 100644 --- a/src/api/resources/collections/resources/items/client/requests/BulkCollectionItem.ts +++ b/src/api/types/BulkCollectionItem.ts @@ -2,13 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Webflow from "../../../../../../index"; +import * as Webflow from "../index"; /** - * @example - * { - * id: "580e64008c9a982ac9b8b754" - * } + * The fields that define the schema for a given Item are based on the Collection that Item belongs to. Beyond the user defined fields, there are a handful of additional fields that are automatically created for all items */ export interface BulkCollectionItem { /** Unique identifier for the Item */ @@ -25,5 +22,5 @@ export interface BulkCollectionItem { isArchived?: boolean; /** Boolean determining if the Item is set to draft */ isDraft?: boolean; - fieldData?: Webflow.collections.BulkCollectionItemFieldData; + fieldData?: Webflow.BulkCollectionItemFieldData; } diff --git a/src/api/resources/collections/resources/items/types/BulkCollectionItemFieldData.ts b/src/api/types/BulkCollectionItemFieldData.ts similarity index 100% rename from src/api/resources/collections/resources/items/types/BulkCollectionItemFieldData.ts rename to src/api/types/BulkCollectionItemFieldData.ts diff --git a/src/api/types/ConflictErrorBody.ts b/src/api/types/ConflictErrorBody.ts index 8479eb87..83105915 100644 --- a/src/api/types/ConflictErrorBody.ts +++ b/src/api/types/ConflictErrorBody.ts @@ -4,4 +4,13 @@ import * as Webflow from "../index"; -export type ConflictErrorBody = Webflow.DuplicateUserEmail | Webflow.UserLimitReached; +export interface ConflictErrorBody { + /** Error code */ + code?: "ecommerce_not_enabled"; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/DuplicateUserEmail.ts b/src/api/types/DuplicateUserEmail.ts index 13eacd9b..e714016e 100644 --- a/src/api/types/DuplicateUserEmail.ts +++ b/src/api/types/DuplicateUserEmail.ts @@ -4,4 +4,13 @@ import * as Webflow from "../index"; -export type DuplicateUserEmail = Webflow.Error_; +export interface DuplicateUserEmail { + /** Error code */ + code?: string; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/MissingScopes.ts b/src/api/types/MissingScopes.ts index 246e8df7..121a3a27 100644 --- a/src/api/types/MissingScopes.ts +++ b/src/api/types/MissingScopes.ts @@ -4,4 +4,13 @@ import * as Webflow from "../index"; -export type MissingScopes = Webflow.Error_; +export interface MissingScopes { + /** Error code */ + code?: "missing_scopes"; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/NotEnterprisePlanSite.ts b/src/api/types/NotEnterprisePlanSite.ts index a7e8beb2..23d6c370 100644 --- a/src/api/types/NotEnterprisePlanSite.ts +++ b/src/api/types/NotEnterprisePlanSite.ts @@ -4,4 +4,13 @@ import * as Webflow from "../index"; -export type NotEnterprisePlanSite = Webflow.Error_; +export interface NotEnterprisePlanSite { + /** Error code */ + code?: "missing_scopes"; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/OauthScope.ts b/src/api/types/OauthScope.ts deleted file mode 100644 index 479d394a..00000000 --- a/src/api/types/OauthScope.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export type OauthScope = - /** - * read details about the authorized user */ - | "authorized_user:read" - /** - * read assets on the site */ - | "assets:read" - /** - * write assets on a site */ - | "assets:write" - /** - * read collections and items for a site */ - | "cms:read" - /** - * write to collections and items for a site */ - | "cms:write" - /** - * read custom code on the site */ - | "custom_code:read" - /** - * modify custom code on the site */ - | "custom_code:write" - /** - * read ecommerce data */ - | "ecommerce:read" - /** - * edit ecommerce data */ - | "ecommerce:write" - /** - * read form data */ - | "forms:read" - /** - * write form data */ - | "forms:write" - /** - * read pages on the site */ - | "pages:read" - /** - * write to pages on the site */ - | "pages:write" - /** - * read sites on the site */ - | "sites:read" - /** - * modify pages on the site */ - | "sites:write" - /** - * read users on the site */ - | "users:read" - /** - * read site activity logs */ - | "site_activity:read" - /** - * modify users on the site */ - | "users:write" - /** - * read workspace resource data */ - | "workspace:read" - /** - * write workspace resource data */ - | "workspace:write" - /** - * read site configuration data */ - | "site_config:read" - /** - * write site configuration data */ - | "site_config:write"; - -export const OauthScope = { - AuthorizedUserRead: "authorized_user:read", - AssetsRead: "assets:read", - AssetsWrite: "assets:write", - CmsRead: "cms:read", - CmsWrite: "cms:write", - CustomCodeRead: "custom_code:read", - CustomCodeWrite: "custom_code:write", - EcommerceRead: "ecommerce:read", - EcommerceWrite: "ecommerce:write", - FormsRead: "forms:read", - FormsWrite: "forms:write", - PagesRead: "pages:read", - PagesWrite: "pages:write", - SitesRead: "sites:read", - SitesWrite: "sites:write", - UsersRead: "users:read", - SiteActivityRead: "site_activity:read", - UsersWrite: "users:write", - WorkspaceRead: "workspace:read", - WorkspaceWrite: "workspace:write", - SiteConfigRead: "site_config:read", - SiteConfigWrite: "site_config:write", -} as const; diff --git a/src/api/types/Page.ts b/src/api/types/Page.ts index 9046a42b..6c02a76b 100644 --- a/src/api/types/Page.ts +++ b/src/api/types/Page.ts @@ -9,7 +9,7 @@ import * as Webflow from "../index"; */ export interface Page { /** Unique identifier for the Page */ - id?: string; + id: string; /** Unique identifier for the Site */ siteId?: string; /** Title of the Page */ @@ -36,4 +36,8 @@ export interface Page { seo?: Webflow.PageSeo; /** Open Graph fields for the Page */ openGraph?: Webflow.PageOpenGraph; + /** Unique ID of the page locale */ + localeId?: string; + /** Relative path of the published page URL */ + publishedPath?: string; } diff --git a/src/api/types/PageDetails.ts b/src/api/types/PageDetails.ts deleted file mode 100644 index f675071d..00000000 --- a/src/api/types/PageDetails.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Webflow from "../index"; - -/** - * The Page object - */ -export interface PageDetails { - /** Unique identifier for the Page */ - id?: string; - /** Unique identifier for the Site */ - siteId?: string; - /** Title of the Page */ - title?: string; - /** slug of the Page (derived from title) */ - slug?: string; - /** Identifier of the parent folder */ - parentId?: string; - /** Unique identifier for a linked Collection, value will be null if the Page is not part of a Collection. */ - collectionId?: string; - /** The date the Page was created */ - createdOn?: Date; - /** The date the Page was most recently updated */ - lastUpdated?: Date; - /** Whether the Page has been archived */ - archived?: boolean; - /** Whether the Page is a draft */ - draft?: boolean; - /** Indicates whether the Page supports [Page Branching](https://university.webflow.com/lesson/page-branching) */ - canBranch?: boolean; - /** Indicates whether the Page is restricted by [Memberships Controls](https://university.webflow.com/lesson/webflow-memberships-overview#how-to-manage-page-restrictions) */ - isMembersOnly?: boolean; - /** SEO-related fields for the Page */ - seo?: Webflow.PageDetailsSeo; - /** Open Graph fields for the Page */ - openGraph?: Webflow.PageDetailsOpenGraph; - /** Unique ID of the page locale */ - localeId?: string; - /** Relative path of the published page URL */ - publishedPath?: string; -} diff --git a/src/api/types/PageDetailsOpenGraph.ts b/src/api/types/PageDetailsOpenGraph.ts deleted file mode 100644 index e0b3644d..00000000 --- a/src/api/types/PageDetailsOpenGraph.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Open Graph fields for the Page - */ -export interface PageDetailsOpenGraph { - /** The title supplied to Open Graph annotations */ - title?: string; - /** Indicates the Open Graph title was copied from the SEO title */ - titleCopied?: boolean; - /** The description supplied to Open Graph annotations */ - description?: string; - /** Indicates the Open Graph description was copied from the SEO description */ - descriptionCopied?: boolean; -} diff --git a/src/api/types/PageDetailsSeo.ts b/src/api/types/PageDetailsSeo.ts deleted file mode 100644 index 87b9cb01..00000000 --- a/src/api/types/PageDetailsSeo.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * SEO-related fields for the Page - */ -export interface PageDetailsSeo { - /** The Page title shown in search engine results */ - title?: string; - /** The Page description shown in search engine results */ - description?: string; -} diff --git a/src/api/types/UserLimitReached.ts b/src/api/types/UserLimitReached.ts index 5e03d077..8e614bdd 100644 --- a/src/api/types/UserLimitReached.ts +++ b/src/api/types/UserLimitReached.ts @@ -4,4 +4,13 @@ import * as Webflow from "../index"; -export type UserLimitReached = Webflow.Error_; +export interface UserLimitReached { + /** Error code */ + code?: string; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/UsersNotEnabled.ts b/src/api/types/UsersNotEnabled.ts index 381e7beb..aa1d20a2 100644 --- a/src/api/types/UsersNotEnabled.ts +++ b/src/api/types/UsersNotEnabled.ts @@ -4,4 +4,13 @@ import * as Webflow from "../index"; -export type UsersNotEnabled = Webflow.Error_; +export interface UsersNotEnabled { + /** Error code */ + code?: string; + /** Error message */ + message?: string; + /** Link to more information */ + externalReference?: string; + /** Array of errors */ + details?: Webflow.ErrorDetailsItem[]; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts index ad6ecd4f..26e7ca7e 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,8 +1,8 @@ -export * from "./OauthScope"; export * from "./ForbiddenErrorBody"; export * from "./TooManyRequestsErrorBody"; export * from "./BadRequestErrorBody"; export * from "./ConflictErrorBody"; +export * from "./ErrorDetailsItem"; export * from "./AuthorizedUser"; export * from "./Application"; export * from "./AuthorizationAuthorizationAuthorizedTo"; @@ -21,7 +21,6 @@ export * from "./SiteActivityLogItemUser"; export * from "./SiteActivityLogItem"; export * from "./Pagination"; export * from "./SiteActivityLogResponse"; -export * from "./ErrorDetailsItem"; export * from "./Error_"; export * from "./MissingScopes"; export * from "./NotEnterprisePlanSite"; @@ -34,13 +33,12 @@ export * from "./CollectionItemFieldData"; export * from "./CollectionItem"; export * from "./CollectionItemListPagination"; export * from "./CollectionItemList"; +export * from "./BulkCollectionItemFieldData"; +export * from "./BulkCollectionItem"; export * from "./PageSeo"; export * from "./PageOpenGraph"; export * from "./Page"; export * from "./PageList"; -export * from "./PageDetailsSeo"; -export * from "./PageDetailsOpenGraph"; -export * from "./PageDetails"; export * from "./TextNode"; export * from "./ImageNode"; export * from "./NodeType"; diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index 51065681..d67bc042 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -1,6 +1,10 @@ -import qs from "qs"; -import { RUNTIME } from "../runtime"; import { APIResponse } from "./APIResponse"; +import { createRequestUrl } from "./createRequestUrl"; +import { getFetchFn } from "./getFetchFn"; +import { getRequestBody } from "./getRequestBody"; +import { getResponseBody } from "./getResponseBody"; +import { makeRequest } from "./makeRequest"; +import { requestWithRetries } from "./requestWithRetries"; export type FetchFunction = (args: Fetcher.Args) => Promise>; @@ -16,7 +20,9 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; - responseType?: "json" | "blob" | "streaming" | "text"; + requestType?: "json" | "file" | "bytes"; + responseType?: "json" | "blob" | "sse" | "streaming" | "text"; + duplex?: "half"; } export type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError; @@ -43,11 +49,7 @@ export declare namespace Fetcher { } } -const INITIAL_RETRY_DELAY = 1; -const MAX_RETRY_DELAY = 60; -const DEFAULT_MAX_RETRIES = 2; - -async function fetcherImpl(args: Fetcher.Args): Promise> { +export async function fetcherImpl(args: Fetcher.Args): Promise> { const headers: Record = {}; if (args.body !== undefined && args.contentType != null) { headers["Content-Type"] = args.contentType; @@ -61,118 +63,35 @@ async function fetcherImpl(args: Fetcher.Args): Promise 0 - ? `${args.url}?${qs.stringify(args.queryParameters, { arrayFormat: "repeat" })}` - : args.url; - - let body: BodyInit | undefined = undefined; - const maybeStringifyBody = (body: any) => { - if (body instanceof Uint8Array) { - return body; - } else if (args.contentType === "application/x-www-form-urlencoded" && typeof args.body === "string") { - return args.body; - } else { - return JSON.stringify(body); - } - }; - - if (RUNTIME.type === "node") { - if (args.body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - body = args.body; - } else { - body = maybeStringifyBody(args.body); - } - } else { - if (args.body instanceof (await import("form-data")).default) { - // @ts-expect-error - body = args.body; - } else { - body = maybeStringifyBody(args.body); - } - } - + const url = createRequestUrl(args.url, args.queryParameters); + let requestBody: BodyInit | undefined = await getRequestBody({ + body: args.body, + type: args.requestType === "json" ? "json" : "other", + }); const fetchFn = await getFetchFn(); - const makeRequest = async (): Promise => { - const signals: AbortSignal[] = []; - - // Add timeout signal - let timeoutAbortId: NodeJS.Timeout | undefined = undefined; - if (args.timeoutMs != null) { - const { signal, abortId } = getTimeoutSignal(args.timeoutMs); - timeoutAbortId = abortId; - signals.push(signal); - } - - // Add arbitrary signal - if (args.abortSignal != null) { - signals.push(args.abortSignal); - } - - const response = await fetchFn(url, { - method: args.method, - headers, - body, - signal: anySignal(signals), - credentials: args.withCredentials ? "include" : undefined, - }); - - if (timeoutAbortId != null) { - clearTimeout(timeoutAbortId); - } - - return response; - }; - try { - let response = await makeRequest(); - - for (let i = 0; i < (args.maxRetries ?? DEFAULT_MAX_RETRIES); ++i) { - if ( - response.status === 408 || - response.status === 409 || - response.status === 429 || - response.status >= 500 - ) { - const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(i, 2), MAX_RETRY_DELAY); - await new Promise((resolve) => setTimeout(resolve, delay)); - response = await makeRequest(); - } else { - break; - } - } - - let body: unknown; - if (response.body != null && args.responseType === "blob") { - body = await response.blob(); - } else if (response.body != null && args.responseType === "streaming") { - body = response.body; - } else if (response.body != null && args.responseType === "text") { - body = await response.text(); - } else { - const text = await response.text(); - if (text.length > 0) { - try { - body = JSON.parse(text); - } catch (err) { - return { - ok: false, - error: { - reason: "non-json", - statusCode: response.status, - rawBody: text, - }, - }; - } - } - } + const response = await requestWithRetries( + async () => + makeRequest( + fetchFn, + url, + args.method, + headers, + requestBody, + args.timeoutMs, + args.abortSignal, + args.withCredentials, + args.duplex + ), + args.maxRetries + ); + let responseBody = await getResponseBody(response, args.responseType); if (response.status >= 200 && response.status < 400) { return { ok: true, - body: body as R, + body: responseBody as R, headers: response.headers, }; } else { @@ -181,7 +100,7 @@ async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise controller.abort(TIMEOUT), timeoutMs); - return { signal: controller.signal, abortId }; -} - -/** - * Returns an abort signal that is getting aborted when - * at least one of the specified abort signals is aborted. - * - * Requires at least node.js 18. - */ -function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal { - // Allowing signals to be passed either as array - // of signals or as multiple arguments. - const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args); - - const controller = new AbortController(); - - for (const signal of signals) { - if (signal.aborted) { - // Exiting early if one of the signals - // is already aborted. - controller.abort((signal as any)?.reason); - break; - } - - // Listening for signals and removing the listeners - // when at least one symbol is aborted. - signal.addEventListener("abort", () => controller.abort((signal as any)?.reason), { - signal: controller.signal, - }); - } - - return controller.signal; -} - -/** - * Returns a fetch function based on the runtime - */ -async function getFetchFn(): Promise { - // In Node.js environments, the SDK always uses`node-fetch`. - if (RUNTIME.type === "node") { - return (await import("node-fetch")).default as any; - } - - // Otherwise the SDK uses global fetch if available, - // and falls back to node-fetch. - if (typeof fetch == "function") { - return fetch; - } - - // Defaults to node `node-fetch` if global fetch isn't available - return (await import("node-fetch")).default as any; -} - export const fetcher: FetchFunction = fetcherImpl; diff --git a/src/core/fetcher/createRequestUrl.ts b/src/core/fetcher/createRequestUrl.ts new file mode 100644 index 00000000..9288a99b --- /dev/null +++ b/src/core/fetcher/createRequestUrl.ts @@ -0,0 +1,10 @@ +import qs from "qs"; + +export function createRequestUrl( + baseUrl: string, + queryParameters?: Record +): string { + return Object.keys(queryParameters ?? {}).length > 0 + ? `${baseUrl}?${qs.stringify(queryParameters, { arrayFormat: "repeat" })}` + : baseUrl; +} diff --git a/src/core/fetcher/getFetchFn.ts b/src/core/fetcher/getFetchFn.ts new file mode 100644 index 00000000..9fd9bfc4 --- /dev/null +++ b/src/core/fetcher/getFetchFn.ts @@ -0,0 +1,25 @@ +import { RUNTIME } from "../runtime"; + +/** + * Returns a fetch function based on the runtime + */ +export async function getFetchFn(): Promise { + // In Node.js 18+ environments, use native fetch + if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + return fetch; + } + + // In Node.js 18 or lower environments, the SDK always uses`node-fetch`. + if (RUNTIME.type === "node") { + return (await import("node-fetch")).default as any; + } + + // Otherwise the SDK uses global fetch if available, + // and falls back to node-fetch. + if (typeof fetch == "function") { + return fetch; + } + + // Defaults to node `node-fetch` if global fetch isn't available + return (await import("node-fetch")).default as any; +} diff --git a/src/core/fetcher/getRequestBody.ts b/src/core/fetcher/getRequestBody.ts new file mode 100644 index 00000000..1138414b --- /dev/null +++ b/src/core/fetcher/getRequestBody.ts @@ -0,0 +1,14 @@ +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; + } +} + +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); + } else { + return body as BodyInit; + } +} diff --git a/src/core/fetcher/getResponseBody.ts b/src/core/fetcher/getResponseBody.ts new file mode 100644 index 00000000..a7a9c508 --- /dev/null +++ b/src/core/fetcher/getResponseBody.ts @@ -0,0 +1,32 @@ +import { chooseStreamWrapper } from "./stream-wrappers/chooseStreamWrapper"; + +export async function getResponseBody(response: Response, responseType?: string): Promise { + if (response.body != null && responseType === "blob") { + return await response.blob(); + } else if (response.body != null && responseType === "sse") { + return response.body; + } else if (response.body != null && responseType === "streaming") { + return chooseStreamWrapper(response.body); + } else if (response.body != null && responseType === "text") { + return await response.text(); + } else { + const text = await response.text(); + if (text.length > 0) { + try { + let responseBody = JSON.parse(text); + return responseBody; + } catch (err) { + return { + ok: false, + error: { + reason: "non-json", + statusCode: response.status, + rawBody: text, + }, + }; + } + } else { + return undefined; + } + } +} diff --git a/src/core/fetcher/makeRequest.ts b/src/core/fetcher/makeRequest.ts new file mode 100644 index 00000000..8fb4bace --- /dev/null +++ b/src/core/fetcher/makeRequest.ts @@ -0,0 +1,44 @@ +import { anySignal, getTimeoutSignal } from "./signals"; + +export const makeRequest = async ( + fetchFn: (url: string, init: RequestInit) => Promise, + url: string, + method: string, + headers: Record, + requestBody: BodyInit | undefined, + timeoutMs?: number, + abortSignal?: AbortSignal, + withCredentials?: boolean, + duplex?: "half" +): Promise => { + const signals: AbortSignal[] = []; + + // Add timeout signal + let timeoutAbortId: NodeJS.Timeout | undefined = undefined; + if (timeoutMs != null) { + const { signal, abortId } = getTimeoutSignal(timeoutMs); + timeoutAbortId = abortId; + signals.push(signal); + } + + // Add arbitrary signal + if (abortSignal != null) { + signals.push(abortSignal); + } + let newSignals = anySignal(signals); + const response = await fetchFn(url, { + method: method, + headers, + body: requestBody, + signal: newSignals, + credentials: withCredentials ? "include" : undefined, + // @ts-ignore + duplex, + }); + + if (timeoutAbortId != null) { + clearTimeout(timeoutAbortId); + } + + return response; +}; diff --git a/src/core/fetcher/requestWithRetries.ts b/src/core/fetcher/requestWithRetries.ts new file mode 100644 index 00000000..ff5dc3bb --- /dev/null +++ b/src/core/fetcher/requestWithRetries.ts @@ -0,0 +1,21 @@ +const INITIAL_RETRY_DELAY = 1; +const MAX_RETRY_DELAY = 60; +const DEFAULT_MAX_RETRIES = 2; + +export async function requestWithRetries( + requestFn: () => Promise, + maxRetries: number = DEFAULT_MAX_RETRIES +): Promise { + let response: Response = await requestFn(); + + for (let i = 0; i < maxRetries; ++i) { + if ([408, 409, 429].includes(response.status) || response.status >= 500) { + const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY); + await new Promise((resolve) => setTimeout(resolve, delay)); + response = await requestFn(); + } else { + break; + } + } + return response!; +} diff --git a/src/core/fetcher/signals.ts b/src/core/fetcher/signals.ts new file mode 100644 index 00000000..6c124ff7 --- /dev/null +++ b/src/core/fetcher/signals.ts @@ -0,0 +1,38 @@ +const TIMEOUT = "timeout"; + +export function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abortId: NodeJS.Timeout } { + const controller = new AbortController(); + const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs); + return { signal: controller.signal, abortId }; +} + +/** + * Returns an abort signal that is getting aborted when + * at least one of the specified abort signals is aborted. + * + * Requires at least node.js 18. + */ +export function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal { + // Allowing signals to be passed either as array + // of signals or as multiple arguments. + const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args); + + const controller = new AbortController(); + + for (const signal of signals) { + if (signal.aborted) { + // Exiting early if one of the signals + // is already aborted. + controller.abort((signal as any)?.reason); + break; + } + + // Listening for signals and removing the listeners + // when at least one symbol is aborted. + signal.addEventListener("abort", () => controller.abort((signal as any)?.reason), { + signal: controller.signal, + }); + } + + return controller.signal; +} diff --git a/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts new file mode 100644 index 00000000..4d7b7d52 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts @@ -0,0 +1,256 @@ +import type { Writable } from "readable-stream"; +import { EventCallback, StreamWrapper } from "./chooseStreamWrapper"; + +export class Node18UniversalStreamWrapper + implements + StreamWrapper | Writable | WritableStream, ReadFormat> +{ + private readableStream: ReadableStream; + private reader: ReadableStreamDefaultReader; + private events: Record; + private paused: boolean; + private resumeCallback: ((value?: unknown) => void) | null; + private encoding: string | null; + + constructor(readableStream: ReadableStream) { + this.readableStream = readableStream; + this.reader = this.readableStream.getReader(); + this.events = { + data: [], + end: [], + error: [], + readable: [], + close: [], + pause: [], + resume: [], + }; + this.paused = false; + this.resumeCallback = null; + this.encoding = null; + } + + public on(event: string, callback: EventCallback): void { + this.events[event]?.push(callback); + } + + public off(event: string, callback: EventCallback): void { + this.events[event] = this.events[event]?.filter((cb) => cb !== callback); + } + + public pipe( + dest: Node18UniversalStreamWrapper | Writable | WritableStream + ): Node18UniversalStreamWrapper | Writable | WritableStream { + this.on("data", async (chunk) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._write(chunk); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } else { + dest.write(chunk); + } + }); + + this.on("end", async () => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._end(); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.close(); + } else { + dest.end(); + } + }); + + this.on("error", async (error) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._error(error); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.abort(error); + } else { + dest.destroy(error); + } + }); + + this._startReading(); + + return dest; + } + + public pipeTo( + dest: Node18UniversalStreamWrapper | Writable | WritableStream + ): Node18UniversalStreamWrapper | Writable | WritableStream { + return this.pipe(dest); + } + + public unpipe(dest: Node18UniversalStreamWrapper | Writable | WritableStream): void { + this.off("data", async (chunk) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._write(chunk); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } else { + dest.write(chunk); + } + }); + + this.off("end", async () => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._end(); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.close(); + } else { + dest.end(); + } + }); + + this.off("error", async (error) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._error(error); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.abort(error); + } else { + dest.destroy(error); + } + }); + } + + public destroy(error?: Error): void { + this.reader + .cancel(error) + .then(() => { + this._emit("close"); + }) + .catch((err) => { + this._emit("error", err); + }); + } + + public pause(): void { + this.paused = true; + this._emit("pause"); + } + + public resume(): void { + if (this.paused) { + this.paused = false; + this._emit("resume"); + if (this.resumeCallback) { + this.resumeCallback(); + this.resumeCallback = null; + } + } + } + + public get isPaused(): boolean { + return this.paused; + } + + public async read(): Promise { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + + if (done) { + return undefined; + } + return value; + } + + public setEncoding(encoding: string): void { + this.encoding = encoding; + } + + public async text(): Promise { + const chunks: ReadFormat[] = []; + + while (true) { + const { done, value } = await this.reader.read(); + if (done) { + break; + } + if (value) { + chunks.push(value); + } + } + + const decoder = new TextDecoder(this.encoding || "utf-8"); + return decoder.decode(await new Blob(chunks).arrayBuffer()); + } + + public async json(): Promise { + const text = await this.text(); + return JSON.parse(text); + } + + private _write(chunk: ReadFormat): void { + this._emit("data", chunk); + } + + private _end(): void { + this._emit("end"); + } + + private _error(error: any): void { + this._emit("error", error); + } + + private _emit(event: string, data?: any): void { + if (this.events[event]) { + for (const callback of this.events[event] || []) { + callback(data); + } + } + } + + private async _startReading(): Promise { + try { + this._emit("readable"); + while (true) { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + this._emit("end"); + this._emit("close"); + break; + } + if (value) { + this._emit("data", value); + } + } + } catch (error) { + this._emit("error", error); + } + } + + [Symbol.asyncIterator](): AsyncIterableIterator { + return { + next: async () => { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + return { done: true, value: undefined }; + } + return { done: false, value }; + }, + [Symbol.asyncIterator]() { + return this; + }, + }; + } +} diff --git a/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts new file mode 100644 index 00000000..ba5f7276 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts @@ -0,0 +1,106 @@ +import type { Readable, Writable } from "readable-stream"; +import { EventCallback, StreamWrapper } from "./chooseStreamWrapper"; + +export class NodePre18StreamWrapper implements StreamWrapper { + private readableStream: Readable; + private encoding: string | undefined; + + constructor(readableStream: Readable) { + this.readableStream = readableStream; + } + + public on(event: string, callback: EventCallback): void { + this.readableStream.on(event, callback); + } + + public off(event: string, callback: EventCallback): void { + this.readableStream.off(event, callback); + } + + public pipe(dest: Writable): Writable { + this.readableStream.pipe(dest); + return dest; + } + + public pipeTo(dest: Writable): Writable { + return this.pipe(dest); + } + + public unpipe(dest?: Writable): void { + if (dest) { + this.readableStream.unpipe(dest); + } else { + this.readableStream.unpipe(); + } + } + + public destroy(error?: Error): void { + this.readableStream.destroy(error); + } + + public pause(): void { + this.readableStream.pause(); + } + + public resume(): void { + this.readableStream.resume(); + } + + public get isPaused(): boolean { + return this.readableStream.isPaused(); + } + + public async read(): Promise { + return new Promise((resolve, reject) => { + const chunk = this.readableStream.read(); + if (chunk) { + resolve(chunk); + } else { + this.readableStream.once("readable", () => { + const chunk = this.readableStream.read(); + resolve(chunk); + }); + this.readableStream.once("error", reject); + } + }); + } + + public setEncoding(encoding?: string): void { + this.readableStream.setEncoding(encoding as BufferEncoding); + this.encoding = encoding; + } + + public async text(): Promise { + const chunks: Uint8Array[] = []; + const encoder = new TextEncoder(); + this.readableStream.setEncoding((this.encoding || "utf-8") as BufferEncoding); + + for await (const chunk of this.readableStream) { + chunks.push(encoder.encode(chunk)); + } + + const decoder = new TextDecoder(this.encoding || "utf-8"); + return decoder.decode(Buffer.concat(chunks)); + } + + public async json(): Promise { + const text = await this.text(); + return JSON.parse(text); + } + + public [Symbol.asyncIterator](): AsyncIterableIterator { + const readableStream = this.readableStream; + const iterator = readableStream[Symbol.asyncIterator](); + + // Create and return an async iterator that yields buffers + return { + async next(): Promise> { + const { value, done } = await iterator.next(); + return { value: value as Buffer, done }; + }, + [Symbol.asyncIterator]() { + return this; + }, + }; + } +} diff --git a/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts new file mode 100644 index 00000000..263af009 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts @@ -0,0 +1,243 @@ +import { StreamWrapper } from "./chooseStreamWrapper"; + +type EventCallback = (data?: any) => void; + +export class UndiciStreamWrapper + implements StreamWrapper | WritableStream, ReadFormat> +{ + private readableStream: ReadableStream; + private reader: ReadableStreamDefaultReader; + private events: Record; + private paused: boolean; + private resumeCallback: ((value?: unknown) => void) | null; + private encoding: string | null; + + constructor(readableStream: ReadableStream) { + this.readableStream = readableStream; + this.reader = this.readableStream.getReader(); + this.events = { + data: [], + end: [], + error: [], + readable: [], + close: [], + pause: [], + resume: [], + }; + this.paused = false; + this.resumeCallback = null; + this.encoding = null; + } + + public on(event: string, callback: EventCallback): void { + this.events[event]?.push(callback); + } + + public off(event: string, callback: EventCallback): void { + this.events[event] = this.events[event]?.filter((cb) => cb !== callback); + } + + public pipe( + dest: UndiciStreamWrapper | WritableStream + ): UndiciStreamWrapper | WritableStream { + this.on("data", (chunk) => { + if (dest instanceof UndiciStreamWrapper) { + dest._write(chunk); + } else { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } + }); + + this.on("end", () => { + if (dest instanceof UndiciStreamWrapper) { + dest._end(); + } else { + const writer = dest.getWriter(); + writer.close(); + } + }); + + this.on("error", (error) => { + if (dest instanceof UndiciStreamWrapper) { + dest._error(error); + } else { + const writer = dest.getWriter(); + writer.abort(error); + } + }); + + this._startReading(); + + return dest; + } + + public pipeTo( + dest: UndiciStreamWrapper | WritableStream + ): UndiciStreamWrapper | WritableStream { + return this.pipe(dest); + } + + public unpipe(dest: UndiciStreamWrapper | WritableStream): void { + this.off("data", (chunk) => { + if (dest instanceof UndiciStreamWrapper) { + dest._write(chunk); + } else { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } + }); + + this.off("end", () => { + if (dest instanceof UndiciStreamWrapper) { + dest._end(); + } else { + const writer = dest.getWriter(); + writer.close(); + } + }); + + this.off("error", (error) => { + if (dest instanceof UndiciStreamWrapper) { + dest._error(error); + } else { + const writer = dest.getWriter(); + writer.abort(error); + } + }); + } + + public destroy(error?: Error): void { + this.reader + .cancel(error) + .then(() => { + this._emit("close"); + }) + .catch((err) => { + this._emit("error", err); + }); + } + + public pause(): void { + this.paused = true; + this._emit("pause"); + } + + public resume(): void { + if (this.paused) { + this.paused = false; + this._emit("resume"); + if (this.resumeCallback) { + this.resumeCallback(); + this.resumeCallback = null; + } + } + } + + public get isPaused(): boolean { + return this.paused; + } + + public async read(): Promise { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + return undefined; + } + return value; + } + + public setEncoding(encoding: string): void { + this.encoding = encoding; + } + + public async text(): Promise { + const chunks: BlobPart[] = []; + + while (true) { + const { done, value } = await this.reader.read(); + if (done) { + break; + } + if (value) { + chunks.push(value); + } + } + + const decoder = new TextDecoder(this.encoding || "utf-8"); + return decoder.decode(await new Blob(chunks).arrayBuffer()); + } + + public async json(): Promise { + const text = await this.text(); + return JSON.parse(text); + } + + private _write(chunk: ReadFormat): void { + this._emit("data", chunk); + } + + private _end(): void { + this._emit("end"); + } + + private _error(error: any): void { + this._emit("error", error); + } + + private _emit(event: string, data?: any): void { + if (this.events[event]) { + for (const callback of this.events[event] || []) { + callback(data); + } + } + } + + private async _startReading(): Promise { + try { + this._emit("readable"); + while (true) { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + this._emit("end"); + this._emit("close"); + break; + } + if (value) { + this._emit("data", value); + } + } + } catch (error) { + this._emit("error", error); + } + } + + [Symbol.asyncIterator](): AsyncIterableIterator { + return { + next: async () => { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + return { done: true, value: undefined }; + } + return { done: false, value }; + }, + [Symbol.asyncIterator]() { + return this; + }, + }; + } +} diff --git a/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts new file mode 100644 index 00000000..2abd6b2b --- /dev/null +++ b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts @@ -0,0 +1,33 @@ +import type { Readable } from "readable-stream"; +import { RUNTIME } from "../../runtime"; + +export type EventCallback = (data?: any) => void; + +export interface StreamWrapper { + setEncoding(encoding?: string): void; + on(event: string, callback: EventCallback): void; + off(event: string, callback: EventCallback): void; + pipe(dest: WritableStream): WritableStream; + pipeTo(dest: WritableStream): WritableStream; + unpipe(dest?: WritableStream): void; + destroy(error?: Error): void; + pause(): void; + resume(): void; + get isPaused(): boolean; + read(): Promise; + text(): Promise; + json(): Promise; + [Symbol.asyncIterator](): AsyncIterableIterator; +} + +export async function chooseStreamWrapper(responseBody: any): Promise>> { + if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + return new (await import("./Node18UniversalStreamWrapper")).Node18UniversalStreamWrapper( + responseBody as ReadableStream + ); + } else if (RUNTIME.type !== "node" && typeof fetch === "function") { + return new (await import("./UndiciStreamWrapper")).UndiciStreamWrapper(responseBody as ReadableStream); + } else { + return new (await import("./NodePre18StreamWrapper")).NodePre18StreamWrapper(responseBody as Readable); + } +} diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts index 30fe0779..4d0687e8 100644 --- a/src/core/runtime/runtime.ts +++ b/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/src/core/schemas/Schema.ts b/src/core/schemas/Schema.ts index 870f373b..2a72eace 100644 --- a/src/core/schemas/Schema.ts +++ b/src/core/schemas/Schema.ts @@ -1,5 +1,4 @@ import { SchemaUtils } from "./builders"; -import { MaybePromise } from "./utils/MaybePromise"; export type Schema = BaseSchema & SchemaUtils; @@ -7,12 +6,13 @@ export type inferRaw = S extends Schema ? Raw export type inferParsed = S extends Schema ? Parsed : never; export interface BaseSchema { - parse: (raw: unknown, opts?: SchemaOptions) => MaybePromise>; - json: (parsed: unknown, opts?: SchemaOptions) => MaybePromise>; - getType: () => SchemaType | Promise; + parse: (raw: unknown, opts?: SchemaOptions) => MaybeValid; + json: (parsed: unknown, opts?: SchemaOptions) => MaybeValid; + getType: () => SchemaType | SchemaType; } export const SchemaType = { + BIGINT: "bigint", DATE: "date", ENUM: "enum", LIST: "list", @@ -91,4 +91,9 @@ export interface SchemaOptions { * helpful for zurg's internal debug logging. */ breadcrumbsPrefix?: string[]; + + /** + * whether to send 'null' for optional properties explicitly set to 'undefined'. + */ + omitUndefined?: boolean; } diff --git a/src/core/schemas/builders/bigint/bigint.ts b/src/core/schemas/builders/bigint/bigint.ts new file mode 100644 index 00000000..dc9c742e --- /dev/null +++ b/src/core/schemas/builders/bigint/bigint.ts @@ -0,0 +1,50 @@ +import { BaseSchema, Schema, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; + +export function bigint(): Schema { + const baseSchema: BaseSchema = { + parse: (raw, { breadcrumbsPrefix = [] } = {}) => { + if (typeof raw !== "string") { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(raw, "string"), + }, + ], + }; + } + return { + ok: true, + value: BigInt(raw), + }; + }, + json: (bigint, { breadcrumbsPrefix = [] } = {}) => { + if (typeof bigint === "bigint") { + return { + ok: true, + value: bigint.toString(), + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(bigint, "bigint"), + }, + ], + }; + } + }, + getType: () => SchemaType.BIGINT, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/bigint/index.ts b/src/core/schemas/builders/bigint/index.ts new file mode 100644 index 00000000..e5843043 --- /dev/null +++ b/src/core/schemas/builders/bigint/index.ts @@ -0,0 +1 @@ +export { bigint } from "./bigint"; diff --git a/src/core/schemas/builders/index.ts b/src/core/schemas/builders/index.ts index 050cd2c4..65211f92 100644 --- a/src/core/schemas/builders/index.ts +++ b/src/core/schemas/builders/index.ts @@ -1,3 +1,4 @@ +export * from "./bigint"; export * from "./date"; export * from "./enum"; export * from "./lazy"; diff --git a/src/core/schemas/builders/lazy/lazy.ts b/src/core/schemas/builders/lazy/lazy.ts index a665472d..835c61f8 100644 --- a/src/core/schemas/builders/lazy/lazy.ts +++ b/src/core/schemas/builders/lazy/lazy.ts @@ -1,7 +1,7 @@ import { BaseSchema, Schema } from "../../Schema"; import { getSchemaUtils } from "../schema-utils"; -export type SchemaGetter> = () => SchemaType | Promise; +export type SchemaGetter> = () => SchemaType; export function lazy(getter: SchemaGetter>): Schema { const baseSchema = constructLazyBaseSchema(getter); @@ -15,20 +15,18 @@ export function constructLazyBaseSchema( getter: SchemaGetter> ): BaseSchema { return { - parse: async (raw, opts) => (await getMemoizedSchema(getter)).parse(raw, opts), - json: async (parsed, opts) => (await getMemoizedSchema(getter)).json(parsed, opts), - getType: async () => (await getMemoizedSchema(getter)).getType(), + parse: (raw, opts) => getMemoizedSchema(getter).parse(raw, opts), + json: (parsed, opts) => getMemoizedSchema(getter).json(parsed, opts), + getType: () => getMemoizedSchema(getter).getType(), }; } type MemoizedGetter> = SchemaGetter & { __zurg_memoized?: SchemaType }; -export async function getMemoizedSchema>( - getter: SchemaGetter -): Promise { +export function getMemoizedSchema>(getter: SchemaGetter): SchemaType { const castedGetter = getter as MemoizedGetter; if (castedGetter.__zurg_memoized == null) { - castedGetter.__zurg_memoized = await getter(); + castedGetter.__zurg_memoized = getter(); } return castedGetter.__zurg_memoized; } diff --git a/src/core/schemas/builders/lazy/lazyObject.ts b/src/core/schemas/builders/lazy/lazyObject.ts index e48c0166..38c9e284 100644 --- a/src/core/schemas/builders/lazy/lazyObject.ts +++ b/src/core/schemas/builders/lazy/lazyObject.ts @@ -7,8 +7,8 @@ import { constructLazyBaseSchema, getMemoizedSchema, SchemaGetter } from "./lazy export function lazyObject(getter: SchemaGetter>): ObjectSchema { const baseSchema: BaseObjectSchema = { ...constructLazyBaseSchema(getter), - _getRawProperties: async () => (await getMemoizedSchema(getter))._getRawProperties(), - _getParsedProperties: async () => (await getMemoizedSchema(getter))._getParsedProperties(), + _getRawProperties: () => getMemoizedSchema(getter)._getRawProperties(), + _getParsedProperties: () => getMemoizedSchema(getter)._getParsedProperties(), }; return { diff --git a/src/core/schemas/builders/list/list.ts b/src/core/schemas/builders/list/list.ts index b333321b..e4c5c4a4 100644 --- a/src/core/schemas/builders/list/list.ts +++ b/src/core/schemas/builders/list/list.ts @@ -1,12 +1,11 @@ import { BaseSchema, MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; -import { MaybePromise } from "../../utils/MaybePromise"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; import { getSchemaUtils } from "../schema-utils"; export function list(schema: Schema): Schema { const baseSchema: BaseSchema = { - parse: async (raw, opts) => + parse: (raw, opts) => validateAndTransformArray(raw, (item, index) => schema.parse(item, { ...opts, @@ -29,10 +28,10 @@ export function list(schema: Schema): Schema( +function validateAndTransformArray( value: unknown, - transformItem: (item: Raw, index: number) => MaybePromise> -): Promise> { + transformItem: (item: Raw, index: number) => MaybeValid +): MaybeValid { if (!Array.isArray(value)) { return { ok: false, @@ -45,7 +44,7 @@ async function validateAndTransformArray( }; } - const maybeValidItems = await Promise.all(value.map((item, index) => transformItem(item, index))); + const maybeValidItems = value.map((item, index) => transformItem(item, index)); return maybeValidItems.reduce>( (acc, item) => { diff --git a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts index 270ea170..8331d08d 100644 --- a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts +++ b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts @@ -20,8 +20,8 @@ export function withParsedProperties Properties[K]) } ): ObjectLikeSchema { const objectSchema: BaseSchema = { - parse: async (raw, opts) => { - const parsedObject = await objectLike.parse(raw, opts); + parse: (raw, opts) => { + const parsedObject = objectLike.parse(raw, opts); if (!parsedObject.ok) { return parsedObject; } diff --git a/src/core/schemas/builders/object/object.ts b/src/core/schemas/builders/object/object.ts index 6427678b..e00136d7 100644 --- a/src/core/schemas/builders/object/object.ts +++ b/src/core/schemas/builders/object/object.ts @@ -4,7 +4,6 @@ import { filterObject } from "../../utils/filterObject"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; import { isPlainObject } from "../../utils/isPlainObject"; import { keys } from "../../utils/keys"; -import { MaybePromise } from "../../utils/MaybePromise"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; import { partition } from "../../utils/partition"; import { getObjectLikeUtils } from "../object-like"; @@ -34,15 +33,12 @@ export function object > = { _getRawProperties: () => - Promise.resolve( - Object.entries(schemas).map(([parsedKey, propertySchema]) => - isProperty(propertySchema) ? propertySchema.rawKey : parsedKey - ) as unknown as (keyof inferRawObjectFromPropertySchemas)[] - ), - _getParsedProperties: () => - Promise.resolve(keys(schemas) as unknown as (keyof inferParsedObjectFromPropertySchemas)[]), + Object.entries(schemas).map(([parsedKey, propertySchema]) => + isProperty(propertySchema) ? propertySchema.rawKey : parsedKey + ) as unknown as (keyof inferRawObjectFromPropertySchemas)[], + _getParsedProperties: () => keys(schemas) as unknown as (keyof inferParsedObjectFromPropertySchemas)[], - parse: async (raw, opts) => { + parse: (raw, opts) => { const rawKeyToProperty: Record = {}; const requiredKeys: string[] = []; @@ -85,10 +81,11 @@ export function object { + json: (parsed, opts) => { const requiredKeys: string[] = []; for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { @@ -106,9 +103,7 @@ export function object MaybePromise> } - | undefined => { + ): { transformedKey: string; transform: (propertyValue: unknown) => MaybeValid } | undefined => { const property = schemas[parsedKey as keyof T]; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition @@ -139,6 +134,7 @@ export function object({ +function validateAndTransformObject({ value, requiredKeys, getProperty, @@ -165,11 +161,12 @@ async function validateAndTransformObject({ requiredKeys: string[]; getProperty: ( preTransformedKey: string - ) => { transformedKey: string; transform: (propertyValue: unknown) => MaybePromise> } | undefined; + ) => { transformedKey: string; transform: (propertyValue: unknown) => MaybeValid } | undefined; unrecognizedObjectKeys: "fail" | "passthrough" | "strip" | undefined; skipValidation: boolean | undefined; breadcrumbsPrefix: string[] | undefined; -}): Promise> { + omitUndefined: boolean | undefined; +}): MaybeValid { if (!isPlainObject(value)) { return { ok: false, @@ -192,7 +189,7 @@ async function validateAndTransformObject({ if (property != null) { missingRequiredKeys.delete(preTransformedKey); - const value = await property.transform(preTransformedItemValue); + const value = property.transform(preTransformedItemValue); if (value.ok) { transformed[property.transformedKey] = value.value; } else { @@ -242,25 +239,19 @@ export function getObjectUtils(schema: BaseObjectSchema(extension: ObjectSchema) => { const baseSchema: BaseObjectSchema = { - _getParsedProperties: async () => [ - ...(await schema._getParsedProperties()), - ...(await extension._getParsedProperties()), - ], - _getRawProperties: async () => [ - ...(await schema._getRawProperties()), - ...(await extension._getRawProperties()), - ], - parse: async (raw, opts) => { + _getParsedProperties: () => [...schema._getParsedProperties(), ...extension._getParsedProperties()], + _getRawProperties: () => [...schema._getRawProperties(), ...extension._getRawProperties()], + parse: (raw, opts) => { return validateAndTransformExtendedObject({ - extensionKeys: await extension._getRawProperties(), + extensionKeys: extension._getRawProperties(), value: raw, transformBase: (rawBase) => schema.parse(rawBase, opts), transformExtension: (rawExtension) => extension.parse(rawExtension, opts), }); }, - json: async (parsed, opts) => { + json: (parsed, opts) => { return validateAndTransformExtendedObject({ - extensionKeys: await extension._getParsedProperties(), + extensionKeys: extension._getParsedProperties(), value: parsed, transformBase: (parsedBase) => schema.json(parsedBase, opts), transformExtension: (parsedExtension) => extension.json(parsedExtension, opts), @@ -279,7 +270,7 @@ export function getObjectUtils(schema: BaseObjectSchema({ +function validateAndTransformExtendedObject({ extensionKeys, value, transformBase, @@ -287,16 +278,16 @@ async function validateAndTransformExtendedObject MaybePromise>; - transformExtension: (value: unknown) => MaybePromise>; -}): Promise> { + transformBase: (value: unknown) => MaybeValid; + transformExtension: (value: unknown) => MaybeValid; +}): MaybeValid { const extensionPropertiesSet = new Set(extensionKeys); const [extensionProperties, baseProperties] = partition(keys(value), (key) => extensionPropertiesSet.has(key as keyof PreTransformedExtension) ); - const transformedBase = await transformBase(filterObject(value, baseProperties)); - const transformedExtension = await transformExtension(filterObject(value, extensionProperties)); + const transformedBase = transformBase(filterObject(value, baseProperties)); + const transformedExtension = transformExtension(filterObject(value, extensionProperties)); if (transformedBase.ok && transformedExtension.ok) { return { diff --git a/src/core/schemas/builders/object/types.ts b/src/core/schemas/builders/object/types.ts index 17cff4f8..de9bb407 100644 --- a/src/core/schemas/builders/object/types.ts +++ b/src/core/schemas/builders/object/types.ts @@ -10,8 +10,8 @@ export type ObjectSchema = BaseObjectSchema & SchemaUtils; export interface BaseObjectSchema extends BaseSchema { - _getRawProperties: () => Promise<(keyof Raw)[]>; - _getParsedProperties: () => Promise<(keyof Parsed)[]>; + _getRawProperties: () => (keyof Raw)[]; + _getParsedProperties: () => (keyof Parsed)[]; } export interface ObjectUtils { diff --git a/src/core/schemas/builders/record/record.ts b/src/core/schemas/builders/record/record.ts index ac1cd22a..6683ac36 100644 --- a/src/core/schemas/builders/record/record.ts +++ b/src/core/schemas/builders/record/record.ts @@ -2,7 +2,6 @@ import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; import { entries } from "../../utils/entries"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; import { isPlainObject } from "../../utils/isPlainObject"; -import { MaybePromise } from "../../utils/MaybePromise"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; import { getSchemaUtils } from "../schema-utils"; import { BaseRecordSchema, RecordSchema } from "./types"; @@ -12,10 +11,10 @@ export function record ): RecordSchema { const baseSchema: BaseRecordSchema = { - parse: async (raw, opts) => { + parse: (raw, opts) => { return validateAndTransformRecord({ value: raw, - isKeyNumeric: (await keySchema.getType()) === SchemaType.NUMBER, + isKeyNumeric: keySchema.getType() === SchemaType.NUMBER, transformKey: (key) => keySchema.parse(key, { ...opts, @@ -29,10 +28,10 @@ export function record { + json: (parsed, opts) => { return validateAndTransformRecord({ value: parsed, - isKeyNumeric: (await keySchema.getType()) === SchemaType.NUMBER, + isKeyNumeric: keySchema.getType() === SchemaType.NUMBER, transformKey: (key) => keySchema.json(key, { ...opts, @@ -55,7 +54,7 @@ export function record({ +function validateAndTransformRecord({ value, isKeyNumeric, transformKey, @@ -64,10 +63,10 @@ async function validateAndTransformRecord MaybePromise>; - transformValue: (value: unknown, key: string | number) => MaybePromise>; + transformKey: (key: string | number) => MaybeValid; + transformValue: (value: unknown, key: string | number) => MaybeValid; breadcrumbsPrefix: string[] | undefined; -}): Promise>> { +}): MaybeValid> { if (!isPlainObject(value)) { return { ok: false, @@ -80,14 +79,14 @@ async function validateAndTransformRecord>>>( - async (accPromise, [stringKey, value]) => { + return entries(value).reduce>>( + (accPromise, [stringKey, value]) => { // skip nullish keys if (value == null) { return accPromise; } - const acc = await accPromise; + const acc = accPromise; let key: string | number = stringKey; if (isKeyNumeric) { @@ -96,9 +95,9 @@ async function validateAndTransformRecord }) + { ok: true, value: {} as Record } ); } diff --git a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts index 0c0d379d..79ecad92 100644 --- a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts +++ b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts @@ -5,8 +5,8 @@ import { ParseError } from "./ParseError"; export interface SchemaUtils { optional: () => Schema; transform: (transformer: SchemaTransformer) => Schema; - parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise; - jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise; + parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed; + jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw; } export interface SchemaTransformer { @@ -18,15 +18,15 @@ export function getSchemaUtils(schema: BaseSchema): Sc return { optional: () => optional(schema), transform: (transformer) => transform(schema, transformer), - parseOrThrow: async (raw, opts) => { - const parsed = await schema.parse(raw, opts); + parseOrThrow: (raw, opts) => { + const parsed = schema.parse(raw, opts); if (parsed.ok) { return parsed.value; } throw new ParseError(parsed.errors); }, - jsonOrThrow: async (parsed, opts) => { - const raw = await schema.json(parsed, opts); + jsonOrThrow: (parsed, opts) => { + const raw = schema.json(parsed, opts); if (raw.ok) { return raw.value; } @@ -53,6 +53,12 @@ export function optional( return schema.parse(raw, opts); }, json: (parsed, opts) => { + if (opts?.omitUndefined && parsed === undefined) { + return { + ok: true, + value: undefined, + }; + } if (parsed == null) { return { ok: true, @@ -75,8 +81,8 @@ export function transform( transformer: SchemaTransformer ): Schema { const baseSchema: BaseSchema = { - parse: async (raw, opts) => { - const parsed = await schema.parse(raw, opts); + parse: (raw, opts) => { + const parsed = schema.parse(raw, opts); if (!parsed.ok) { return parsed; } @@ -85,8 +91,8 @@ export function transform( value: transformer.transform(parsed.value), }; }, - json: async (transformed, opts) => { - const parsed = await transformer.untransform(transformed); + json: (transformed, opts) => { + const parsed = transformer.untransform(transformed); return schema.json(parsed, opts); }, getType: () => schema.getType(), diff --git a/src/core/schemas/builders/set/set.ts b/src/core/schemas/builders/set/set.ts index 3113bcba..e9e6bb7e 100644 --- a/src/core/schemas/builders/set/set.ts +++ b/src/core/schemas/builders/set/set.ts @@ -7,8 +7,8 @@ import { getSchemaUtils } from "../schema-utils"; export function set(schema: Schema): Schema> { const listSchema = list(schema); const baseSchema: BaseSchema> = { - parse: async (raw, opts) => { - const parsedList = await listSchema.parse(raw, opts); + parse: (raw, opts) => { + const parsedList = listSchema.parse(raw, opts); if (parsedList.ok) { return { ok: true, @@ -18,7 +18,7 @@ export function set(schema: Schema): Schema { + json: (parsed, opts) => { if (!(parsed instanceof Set)) { return { ok: false, @@ -30,7 +30,7 @@ export function set(schema: Schema): Schema SchemaType.SET, diff --git a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts index 771dc6a7..21ed3df0 100644 --- a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts +++ b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts @@ -1,5 +1,4 @@ import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType, ValidationError } from "../../Schema"; -import { MaybePromise } from "../../utils/MaybePromise"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; import { getSchemaUtils } from "../schema-utils"; import { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema } from "./types"; @@ -11,14 +10,14 @@ export function undiscriminatedUnion, ...Schem inferRawUnidiscriminatedUnionSchema, inferParsedUnidiscriminatedUnionSchema > = { - parse: async (raw, opts) => { + parse: (raw, opts) => { return validateAndTransformUndiscriminatedUnion>( (schema, opts) => schema.parse(raw, opts), schemas, opts ); }, - json: async (parsed, opts) => { + json: (parsed, opts) => { return validateAndTransformUndiscriminatedUnion>( (schema, opts) => schema.json(parsed, opts), schemas, @@ -34,14 +33,14 @@ export function undiscriminatedUnion, ...Schem }; } -async function validateAndTransformUndiscriminatedUnion( - transform: (schema: Schema, opts: SchemaOptions) => MaybePromise>, +function validateAndTransformUndiscriminatedUnion( + transform: (schema: Schema, opts: SchemaOptions) => MaybeValid, schemas: Schema[], opts: SchemaOptions | undefined -): Promise> { +): MaybeValid { const errors: ValidationError[] = []; for (const [index, schema] of schemas.entries()) { - const transformed = await transform(schema, { ...opts, skipValidation: false }); + const transformed = transform(schema, { ...opts, skipValidation: false }); if (transformed.ok) { return transformed; } else { diff --git a/src/core/schemas/builders/union/union.ts b/src/core/schemas/builders/union/union.ts index ed659beb..ab61475a 100644 --- a/src/core/schemas/builders/union/union.ts +++ b/src/core/schemas/builders/union/union.ts @@ -2,7 +2,6 @@ import { BaseSchema, MaybeValid, SchemaType } from "../../Schema"; import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; import { isPlainObject } from "../../utils/isPlainObject"; import { keys } from "../../utils/keys"; -import { MaybePromise } from "../../utils/MaybePromise"; import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; import { enum_ } from "../enum"; import { ObjectSchema } from "../object"; @@ -25,7 +24,7 @@ export function union, U extends Union const discriminantValueSchema = enum_(keys(union) as string[]); const baseSchema: BaseSchema, inferParsedUnion> = { - parse: async (raw, opts) => { + parse: (raw, opts) => { return transformAndValidateUnion({ value: raw, discriminant: rawDiscriminant, @@ -42,7 +41,7 @@ export function union, U extends Union breadcrumbsPrefix: opts?.breadcrumbsPrefix, }); }, - json: async (parsed, opts) => { + json: (parsed, opts) => { return transformAndValidateUnion({ value: parsed, discriminant: parsedDiscriminant, @@ -69,7 +68,7 @@ export function union, U extends Union }; } -async function transformAndValidateUnion< +function transformAndValidateUnion< TransformedDiscriminant extends string, TransformedDiscriminantValue extends string, TransformedAdditionalProperties @@ -86,17 +85,15 @@ async function transformAndValidateUnion< value: unknown; discriminant: string; transformedDiscriminant: TransformedDiscriminant; - transformDiscriminantValue: (discriminantValue: unknown) => MaybePromise>; + transformDiscriminantValue: (discriminantValue: unknown) => MaybeValid; getAdditionalPropertiesSchema: (discriminantValue: string) => ObjectSchema | undefined; allowUnrecognizedUnionMembers: boolean | undefined; transformAdditionalProperties: ( additionalProperties: unknown, additionalPropertiesSchema: ObjectSchema - ) => MaybePromise>; + ) => MaybeValid; breadcrumbsPrefix: string[] | undefined; -}): Promise< - MaybeValid & TransformedAdditionalProperties> -> { +}): MaybeValid & TransformedAdditionalProperties> { if (!isPlainObject(value)) { return { ok: false, @@ -123,7 +120,7 @@ async function transformAndValidateUnion< }; } - const transformedDiscriminantValue = await transformDiscriminantValue(discriminantValue); + const transformedDiscriminantValue = transformDiscriminantValue(discriminantValue); if (!transformedDiscriminantValue.ok) { return { ok: false, @@ -155,7 +152,7 @@ async function transformAndValidateUnion< } } - const transformedAdditionalProperties = await transformAdditionalProperties( + const transformedAdditionalProperties = transformAdditionalProperties( additionalProperties, additionalPropertiesSchema ); diff --git a/src/core/schemas/utils/getErrorMessageForIncorrectType.ts b/src/core/schemas/utils/getErrorMessageForIncorrectType.ts index 438012df..1a5c3102 100644 --- a/src/core/schemas/utils/getErrorMessageForIncorrectType.ts +++ b/src/core/schemas/utils/getErrorMessageForIncorrectType.ts @@ -9,9 +9,13 @@ function getTypeAsString(value: unknown): string { if (value === null) { return "null"; } + if (value instanceof BigInt) { + return "BigInt"; + } switch (typeof value) { case "string": return `"${value}"`; + case "bigint": case "number": case "boolean": case "undefined": diff --git a/src/core/schemas/utils/maybeSkipValidation.ts b/src/core/schemas/utils/maybeSkipValidation.ts index 99c02c32..86c07abf 100644 --- a/src/core/schemas/utils/maybeSkipValidation.ts +++ b/src/core/schemas/utils/maybeSkipValidation.ts @@ -1,5 +1,4 @@ import { BaseSchema, MaybeValid, SchemaOptions } from "../Schema"; -import { MaybePromise } from "./MaybePromise"; export function maybeSkipValidation, Raw, Parsed>(schema: S): S { return { @@ -10,10 +9,10 @@ export function maybeSkipValidation, Raw, Pars } function transformAndMaybeSkipValidation( - transform: (value: unknown, opts?: SchemaOptions) => MaybePromise> -): (value: unknown, opts?: SchemaOptions) => MaybePromise> { - return async (value, opts): Promise> => { - const transformed = await transform(value, opts); + transform: (value: unknown, opts?: SchemaOptions) => MaybeValid +): (value: unknown, opts?: SchemaOptions) => MaybeValid { + return (value, opts): MaybeValid => { + const transformed = transform(value, opts); const { skipValidation = false } = opts ?? {}; if (!transformed.ok && skipValidation) { // eslint-disable-next-line no-console diff --git a/src/serialization/resources/collections/resources/items/client/requests/index.ts b/src/serialization/resources/collections/resources/items/client/requests/index.ts index a28fc03e..a1b783c7 100644 --- a/src/serialization/resources/collections/resources/items/client/requests/index.ts +++ b/src/serialization/resources/collections/resources/items/client/requests/index.ts @@ -1,2 +1 @@ -export { BulkCollectionItem } from "./BulkCollectionItem"; export { ItemsPublishItemRequest } from "./ItemsPublishItemRequest"; diff --git a/src/serialization/resources/collections/resources/items/types/ItemsPublishItemResponse.ts b/src/serialization/resources/collections/resources/items/types/ItemsPublishItemResponse.ts new file mode 100644 index 00000000..70e6cc73 --- /dev/null +++ b/src/serialization/resources/collections/resources/items/types/ItemsPublishItemResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../index"; +import * as Webflow from "../../../../../../api/index"; +import * as core from "../../../../../../core"; + +export const ItemsPublishItemResponse: core.serialization.ObjectSchema< + serializers.collections.ItemsPublishItemResponse.Raw, + Webflow.collections.ItemsPublishItemResponse +> = core.serialization.object({ + publishedItemIds: core.serialization.list(core.serialization.string()).optional(), + errors: core.serialization.list(core.serialization.string()).optional(), +}); + +export declare namespace ItemsPublishItemResponse { + interface Raw { + publishedItemIds?: string[] | null; + errors?: string[] | null; + } +} diff --git a/src/serialization/resources/collections/resources/items/types/index.ts b/src/serialization/resources/collections/resources/items/types/index.ts index dcde450b..dce8a6ed 100644 --- a/src/serialization/resources/collections/resources/items/types/index.ts +++ b/src/serialization/resources/collections/resources/items/types/index.ts @@ -2,4 +2,4 @@ export * from "./ItemsListItemsRequestSortBy"; export * from "./ItemsListItemsRequestSortOrder"; export * from "./ItemsListItemsLiveRequestSortBy"; export * from "./ItemsListItemsLiveRequestSortOrder"; -export * from "./BulkCollectionItemFieldData"; +export * from "./ItemsPublishItemResponse"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index a0e25145..54a413ab 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -1,4 +1,5 @@ -export * as collections from "./collections"; +export * as sites from "./sites"; +export * from "./sites/types"; export * as pages from "./pages"; export * from "./pages/types"; export * as users from "./users"; @@ -11,7 +12,7 @@ export * as orders from "./orders"; export * from "./orders/types"; export * as inventory from "./inventory"; export * from "./inventory/types"; -export * as sites from "./sites"; +export * as collections from "./collections"; export * from "./sites/client/requests"; export * from "./collections/client/requests"; export * from "./pages/client/requests"; diff --git a/src/serialization/resources/sites/index.ts b/src/serialization/resources/sites/index.ts index 5ec76921..c9240f83 100644 --- a/src/serialization/resources/sites/index.ts +++ b/src/serialization/resources/sites/index.ts @@ -1 +1,2 @@ +export * from "./types"; export * from "./client"; diff --git a/src/serialization/resources/sites/types/SitesPublishResponse.ts b/src/serialization/resources/sites/types/SitesPublishResponse.ts new file mode 100644 index 00000000..e51c1c25 --- /dev/null +++ b/src/serialization/resources/sites/types/SitesPublishResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Webflow from "../../../../api/index"; +import * as core from "../../../../core"; +import { Domain } from "../../../types/Domain"; + +export const SitesPublishResponse: core.serialization.ObjectSchema< + serializers.SitesPublishResponse.Raw, + Webflow.SitesPublishResponse +> = core.serialization.object({ + customDomains: core.serialization.list(Domain).optional(), + publishToWebflowSubdomain: core.serialization.boolean().optional(), +}); + +export declare namespace SitesPublishResponse { + interface Raw { + customDomains?: Domain.Raw[] | null; + publishToWebflowSubdomain?: boolean | null; + } +} diff --git a/src/serialization/resources/sites/types/index.ts b/src/serialization/resources/sites/types/index.ts new file mode 100644 index 00000000..7708da86 --- /dev/null +++ b/src/serialization/resources/sites/types/index.ts @@ -0,0 +1 @@ +export * from "./SitesPublishResponse"; diff --git a/src/serialization/resources/collections/resources/items/client/requests/BulkCollectionItem.ts b/src/serialization/types/BulkCollectionItem.ts similarity index 69% rename from src/serialization/resources/collections/resources/items/client/requests/BulkCollectionItem.ts rename to src/serialization/types/BulkCollectionItem.ts index 35a5a271..a164b074 100644 --- a/src/serialization/resources/collections/resources/items/client/requests/BulkCollectionItem.ts +++ b/src/serialization/types/BulkCollectionItem.ts @@ -2,14 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../../../../../index"; -import * as Webflow from "../../../../../../../api/index"; -import * as core from "../../../../../../../core"; -import { BulkCollectionItemFieldData } from "../../types/BulkCollectionItemFieldData"; +import * as serializers from "../index"; +import * as Webflow from "../../api/index"; +import * as core from "../../core"; +import { BulkCollectionItemFieldData } from "./BulkCollectionItemFieldData"; -export const BulkCollectionItem: core.serialization.Schema< - serializers.collections.BulkCollectionItem.Raw, - Webflow.collections.BulkCollectionItem +export const BulkCollectionItem: core.serialization.ObjectSchema< + serializers.BulkCollectionItem.Raw, + Webflow.BulkCollectionItem > = core.serialization.object({ id: core.serialization.string(), cmsLocaleIds: core.serialization.list(core.serialization.string()).optional(), diff --git a/src/serialization/resources/collections/resources/items/types/BulkCollectionItemFieldData.ts b/src/serialization/types/BulkCollectionItemFieldData.ts similarity index 61% rename from src/serialization/resources/collections/resources/items/types/BulkCollectionItemFieldData.ts rename to src/serialization/types/BulkCollectionItemFieldData.ts index 79959c47..c8e08393 100644 --- a/src/serialization/resources/collections/resources/items/types/BulkCollectionItemFieldData.ts +++ b/src/serialization/types/BulkCollectionItemFieldData.ts @@ -2,13 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as serializers from "../../../../../index"; -import * as Webflow from "../../../../../../api/index"; -import * as core from "../../../../../../core"; +import * as serializers from "../index"; +import * as Webflow from "../../api/index"; +import * as core from "../../core"; export const BulkCollectionItemFieldData: core.serialization.ObjectSchema< - serializers.collections.BulkCollectionItemFieldData.Raw, - Webflow.collections.BulkCollectionItemFieldData + serializers.BulkCollectionItemFieldData.Raw, + Webflow.BulkCollectionItemFieldData > = core.serialization.object({ name: core.serialization.string().optional(), slug: core.serialization.string().optional(), diff --git a/src/serialization/types/ConflictErrorBody.ts b/src/serialization/types/ConflictErrorBody.ts index 5aed9236..b5050c4a 100644 --- a/src/serialization/types/ConflictErrorBody.ts +++ b/src/serialization/types/ConflictErrorBody.ts @@ -5,14 +5,23 @@ import * as serializers from "../index"; import * as Webflow from "../../api/index"; import * as core from "../../core"; -import { DuplicateUserEmail } from "./DuplicateUserEmail"; -import { UserLimitReached } from "./UserLimitReached"; +import { ErrorDetailsItem } from "./ErrorDetailsItem"; -export const ConflictErrorBody: core.serialization.Schema< +export const ConflictErrorBody: core.serialization.ObjectSchema< serializers.ConflictErrorBody.Raw, Webflow.ConflictErrorBody -> = core.serialization.undiscriminatedUnion([DuplicateUserEmail, UserLimitReached]); +> = core.serialization.object({ + code: core.serialization.stringLiteral("ecommerce_not_enabled").optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization.list(ErrorDetailsItem).optional(), +}); export declare namespace ConflictErrorBody { - type Raw = DuplicateUserEmail.Raw | UserLimitReached.Raw; + interface Raw { + code?: "ecommerce_not_enabled" | null; + message?: string | null; + externalReference?: string | null; + details?: ErrorDetailsItem.Raw[] | null; + } } diff --git a/src/serialization/types/DuplicateUserEmail.ts b/src/serialization/types/DuplicateUserEmail.ts index 2cd21854..6f083835 100644 --- a/src/serialization/types/DuplicateUserEmail.ts +++ b/src/serialization/types/DuplicateUserEmail.ts @@ -5,13 +5,23 @@ import * as serializers from "../index"; import * as Webflow from "../../api/index"; import * as core from "../../core"; -import { Error_ } from "./Error_"; +import { ErrorDetailsItem } from "./ErrorDetailsItem"; export const DuplicateUserEmail: core.serialization.ObjectSchema< serializers.DuplicateUserEmail.Raw, Webflow.DuplicateUserEmail -> = Error_; +> = core.serialization.object({ + code: core.serialization.string().optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization.list(ErrorDetailsItem).optional(), +}); export declare namespace DuplicateUserEmail { - type Raw = Error_.Raw; + interface Raw { + code?: string | null; + message?: string | null; + externalReference?: string | null; + details?: ErrorDetailsItem.Raw[] | null; + } } diff --git a/src/serialization/types/MissingScopes.ts b/src/serialization/types/MissingScopes.ts index 79ae084b..cb217762 100644 --- a/src/serialization/types/MissingScopes.ts +++ b/src/serialization/types/MissingScopes.ts @@ -5,11 +5,21 @@ import * as serializers from "../index"; import * as Webflow from "../../api/index"; import * as core from "../../core"; -import { Error_ } from "./Error_"; +import { ErrorDetailsItem } from "./ErrorDetailsItem"; export const MissingScopes: core.serialization.ObjectSchema = - Error_; + core.serialization.object({ + code: core.serialization.stringLiteral("missing_scopes").optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization.list(ErrorDetailsItem).optional(), + }); export declare namespace MissingScopes { - type Raw = Error_.Raw; + interface Raw { + code?: "missing_scopes" | null; + message?: string | null; + externalReference?: string | null; + details?: ErrorDetailsItem.Raw[] | null; + } } diff --git a/src/serialization/types/NotEnterprisePlanSite.ts b/src/serialization/types/NotEnterprisePlanSite.ts index f412737f..98d40890 100644 --- a/src/serialization/types/NotEnterprisePlanSite.ts +++ b/src/serialization/types/NotEnterprisePlanSite.ts @@ -5,13 +5,23 @@ import * as serializers from "../index"; import * as Webflow from "../../api/index"; import * as core from "../../core"; -import { Error_ } from "./Error_"; +import { ErrorDetailsItem } from "./ErrorDetailsItem"; export const NotEnterprisePlanSite: core.serialization.ObjectSchema< serializers.NotEnterprisePlanSite.Raw, Webflow.NotEnterprisePlanSite -> = Error_; +> = core.serialization.object({ + code: core.serialization.stringLiteral("missing_scopes").optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization.list(ErrorDetailsItem).optional(), +}); export declare namespace NotEnterprisePlanSite { - type Raw = Error_.Raw; + interface Raw { + code?: "missing_scopes" | null; + message?: string | null; + externalReference?: string | null; + details?: ErrorDetailsItem.Raw[] | null; + } } diff --git a/src/serialization/types/OauthScope.ts b/src/serialization/types/OauthScope.ts deleted file mode 100644 index 3d89a465..00000000 --- a/src/serialization/types/OauthScope.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Webflow from "../../api/index"; -import * as core from "../../core"; - -export const OauthScope: core.serialization.Schema = - core.serialization.enum_([ - "authorized_user:read", - "assets:read", - "assets:write", - "cms:read", - "cms:write", - "custom_code:read", - "custom_code:write", - "ecommerce:read", - "ecommerce:write", - "forms:read", - "forms:write", - "pages:read", - "pages:write", - "sites:read", - "sites:write", - "users:read", - "site_activity:read", - "users:write", - "workspace:read", - "workspace:write", - "site_config:read", - "site_config:write", - ]); - -export declare namespace OauthScope { - type Raw = - | "authorized_user:read" - | "assets:read" - | "assets:write" - | "cms:read" - | "cms:write" - | "custom_code:read" - | "custom_code:write" - | "ecommerce:read" - | "ecommerce:write" - | "forms:read" - | "forms:write" - | "pages:read" - | "pages:write" - | "sites:read" - | "sites:write" - | "users:read" - | "site_activity:read" - | "users:write" - | "workspace:read" - | "workspace:write" - | "site_config:read" - | "site_config:write"; -} diff --git a/src/serialization/types/Page.ts b/src/serialization/types/Page.ts index 2f206f24..0d6d46cd 100644 --- a/src/serialization/types/Page.ts +++ b/src/serialization/types/Page.ts @@ -9,7 +9,7 @@ import { PageSeo } from "./PageSeo"; import { PageOpenGraph } from "./PageOpenGraph"; export const Page: core.serialization.ObjectSchema = core.serialization.object({ - id: core.serialization.string().optional(), + id: core.serialization.string(), siteId: core.serialization.string().optional(), title: core.serialization.string().optional(), slug: core.serialization.string().optional(), @@ -23,11 +23,13 @@ export const Page: core.serialization.ObjectSchema = - core.serialization.object({ - id: core.serialization.string().optional(), - siteId: core.serialization.string().optional(), - title: core.serialization.string().optional(), - slug: core.serialization.string().optional(), - parentId: core.serialization.string().optional(), - collectionId: core.serialization.string().optional(), - createdOn: core.serialization.date().optional(), - lastUpdated: core.serialization.date().optional(), - archived: core.serialization.boolean().optional(), - draft: core.serialization.boolean().optional(), - canBranch: core.serialization.boolean().optional(), - isMembersOnly: core.serialization.boolean().optional(), - seo: PageDetailsSeo.optional(), - openGraph: PageDetailsOpenGraph.optional(), - localeId: core.serialization.string().optional(), - publishedPath: core.serialization.string().optional(), - }); - -export declare namespace PageDetails { - interface Raw { - id?: string | null; - siteId?: string | null; - title?: string | null; - slug?: string | null; - parentId?: string | null; - collectionId?: string | null; - createdOn?: string | null; - lastUpdated?: string | null; - archived?: boolean | null; - draft?: boolean | null; - canBranch?: boolean | null; - isMembersOnly?: boolean | null; - seo?: PageDetailsSeo.Raw | null; - openGraph?: PageDetailsOpenGraph.Raw | null; - localeId?: string | null; - publishedPath?: string | null; - } -} diff --git a/src/serialization/types/PageDetailsOpenGraph.ts b/src/serialization/types/PageDetailsOpenGraph.ts deleted file mode 100644 index 5590ced3..00000000 --- a/src/serialization/types/PageDetailsOpenGraph.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Webflow from "../../api/index"; -import * as core from "../../core"; - -export const PageDetailsOpenGraph: core.serialization.ObjectSchema< - serializers.PageDetailsOpenGraph.Raw, - Webflow.PageDetailsOpenGraph -> = core.serialization.object({ - title: core.serialization.string().optional(), - titleCopied: core.serialization.boolean().optional(), - description: core.serialization.string().optional(), - descriptionCopied: core.serialization.boolean().optional(), -}); - -export declare namespace PageDetailsOpenGraph { - interface Raw { - title?: string | null; - titleCopied?: boolean | null; - description?: string | null; - descriptionCopied?: boolean | null; - } -} diff --git a/src/serialization/types/PageDetailsSeo.ts b/src/serialization/types/PageDetailsSeo.ts deleted file mode 100644 index ddbb15f8..00000000 --- a/src/serialization/types/PageDetailsSeo.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Webflow from "../../api/index"; -import * as core from "../../core"; - -export const PageDetailsSeo: core.serialization.ObjectSchema = - core.serialization.object({ - title: core.serialization.string().optional(), - description: core.serialization.string().optional(), - }); - -export declare namespace PageDetailsSeo { - interface Raw { - title?: string | null; - description?: string | null; - } -} diff --git a/src/serialization/types/UserLimitReached.ts b/src/serialization/types/UserLimitReached.ts index 9d34349f..300be22a 100644 --- a/src/serialization/types/UserLimitReached.ts +++ b/src/serialization/types/UserLimitReached.ts @@ -5,13 +5,23 @@ import * as serializers from "../index"; import * as Webflow from "../../api/index"; import * as core from "../../core"; -import { Error_ } from "./Error_"; +import { ErrorDetailsItem } from "./ErrorDetailsItem"; export const UserLimitReached: core.serialization.ObjectSchema< serializers.UserLimitReached.Raw, Webflow.UserLimitReached -> = Error_; +> = core.serialization.object({ + code: core.serialization.string().optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization.list(ErrorDetailsItem).optional(), +}); export declare namespace UserLimitReached { - type Raw = Error_.Raw; + interface Raw { + code?: string | null; + message?: string | null; + externalReference?: string | null; + details?: ErrorDetailsItem.Raw[] | null; + } } diff --git a/src/serialization/types/UsersNotEnabled.ts b/src/serialization/types/UsersNotEnabled.ts index e5f78910..3de96c22 100644 --- a/src/serialization/types/UsersNotEnabled.ts +++ b/src/serialization/types/UsersNotEnabled.ts @@ -5,13 +5,23 @@ import * as serializers from "../index"; import * as Webflow from "../../api/index"; import * as core from "../../core"; -import { Error_ } from "./Error_"; +import { ErrorDetailsItem } from "./ErrorDetailsItem"; export const UsersNotEnabled: core.serialization.ObjectSchema< serializers.UsersNotEnabled.Raw, Webflow.UsersNotEnabled -> = Error_; +> = core.serialization.object({ + code: core.serialization.string().optional(), + message: core.serialization.string().optional(), + externalReference: core.serialization.string().optional(), + details: core.serialization.list(ErrorDetailsItem).optional(), +}); export declare namespace UsersNotEnabled { - type Raw = Error_.Raw; + interface Raw { + code?: string | null; + message?: string | null; + externalReference?: string | null; + details?: ErrorDetailsItem.Raw[] | null; + } } diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index ad6ecd4f..26e7ca7e 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -1,8 +1,8 @@ -export * from "./OauthScope"; export * from "./ForbiddenErrorBody"; export * from "./TooManyRequestsErrorBody"; export * from "./BadRequestErrorBody"; export * from "./ConflictErrorBody"; +export * from "./ErrorDetailsItem"; export * from "./AuthorizedUser"; export * from "./Application"; export * from "./AuthorizationAuthorizationAuthorizedTo"; @@ -21,7 +21,6 @@ export * from "./SiteActivityLogItemUser"; export * from "./SiteActivityLogItem"; export * from "./Pagination"; export * from "./SiteActivityLogResponse"; -export * from "./ErrorDetailsItem"; export * from "./Error_"; export * from "./MissingScopes"; export * from "./NotEnterprisePlanSite"; @@ -34,13 +33,12 @@ export * from "./CollectionItemFieldData"; export * from "./CollectionItem"; export * from "./CollectionItemListPagination"; export * from "./CollectionItemList"; +export * from "./BulkCollectionItemFieldData"; +export * from "./BulkCollectionItem"; export * from "./PageSeo"; export * from "./PageOpenGraph"; export * from "./Page"; export * from "./PageList"; -export * from "./PageDetailsSeo"; -export * from "./PageDetailsOpenGraph"; -export * from "./PageDetails"; export * from "./TextNode"; export * from "./ImageNode"; export * from "./NodeType"; diff --git a/src/version.ts b/src/version.ts new file mode 100644 index 00000000..da75217e --- /dev/null +++ b/src/version.ts @@ -0,0 +1 @@ +export const SDK_VERSION = "2.4.0"; diff --git a/tests/unit/auth/BasicAuth.test.ts b/tests/unit/auth/BasicAuth.test.ts new file mode 100644 index 00000000..fc35704e --- /dev/null +++ b/tests/unit/auth/BasicAuth.test.ts @@ -0,0 +1,22 @@ +import { BasicAuth } from "../../../src/core/auth/BasicAuth"; + +describe("BasicAuth", () => { + describe("toAuthorizationHeader", () => { + it("correctly converts to header", () => { + expect( + BasicAuth.toAuthorizationHeader({ + username: "username", + password: "password", + }) + ).toBe("Basic dXNlcm5hbWU6cGFzc3dvcmQ="); + }); + }); + describe("fromAuthorizationHeader", () => { + it("correctly parses header", () => { + expect(BasicAuth.fromAuthorizationHeader("Basic dXNlcm5hbWU6cGFzc3dvcmQ=")).toEqual({ + username: "username", + password: "password", + }); + }); + }); +}); diff --git a/tests/unit/auth/BearerToken.test.ts b/tests/unit/auth/BearerToken.test.ts new file mode 100644 index 00000000..7757b87c --- /dev/null +++ b/tests/unit/auth/BearerToken.test.ts @@ -0,0 +1,14 @@ +import { BearerToken } from "../../../src/core/auth/BearerToken"; + +describe("BearerToken", () => { + describe("toAuthorizationHeader", () => { + it("correctly converts to header", () => { + expect(BearerToken.toAuthorizationHeader("my-token")).toBe("Bearer my-token"); + }); + }); + describe("fromAuthorizationHeader", () => { + it("correctly parses header", () => { + expect(BearerToken.fromAuthorizationHeader("Bearer my-token")).toBe("my-token"); + }); + }); +}); diff --git a/tests/unit/fetcher/Fetcher.test.ts b/tests/unit/fetcher/Fetcher.test.ts new file mode 100644 index 00000000..0e14a8c7 --- /dev/null +++ b/tests/unit/fetcher/Fetcher.test.ts @@ -0,0 +1,25 @@ +import fetchMock from "fetch-mock-jest"; +import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; + +describe("Test fetcherImpl", () => { + it("should handle successful request", async () => { + const mockArgs: Fetcher.Args = { + url: "https://httpbin.org/post", + method: "POST", + headers: { "X-Test": "x-test-header" }, + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + }; + + fetchMock.mock("https://httpbin.org/post", 200, { + response: JSON.stringify({ data: "test" }), + }); + + const result = await fetcherImpl(mockArgs); + expect(result.ok).toBe(true); + if (result.ok) { + expect(result.body).toEqual({ data: "test" }); + } + }); +}); diff --git a/tests/unit/fetcher/createRequestUrl.test.ts b/tests/unit/fetcher/createRequestUrl.test.ts new file mode 100644 index 00000000..f2cd24b6 --- /dev/null +++ b/tests/unit/fetcher/createRequestUrl.test.ts @@ -0,0 +1,51 @@ +import { createRequestUrl } from "../../../src/core/fetcher/createRequestUrl"; + +describe("Test createRequestUrl", () => { + it("should return the base URL when no query parameters are provided", () => { + const baseUrl = "https://api.example.com"; + expect(createRequestUrl(baseUrl)).toBe(baseUrl); + }); + + it("should append simple query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { key: "value", another: "param" }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?key=value&another=param"); + }); + + it("should handle array query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { items: ["a", "b", "c"] }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?items=a&items=b&items=c"); + }); + + it("should handle object query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { filter: { name: "John", age: 30 } }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30" + ); + }); + + it("should handle mixed types of query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { + simple: "value", + array: ["x", "y"], + object: { key: "value" }, + }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value" + ); + }); + + it("should handle empty query parameters object", () => { + const baseUrl = "https://api.example.com"; + expect(createRequestUrl(baseUrl, {})).toBe(baseUrl); + }); + + it("should encode special characters in query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { special: "a&b=c d" }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?special=a%26b%3Dc%20d"); + }); +}); diff --git a/tests/unit/fetcher/getFetchFn.test.ts b/tests/unit/fetcher/getFetchFn.test.ts new file mode 100644 index 00000000..9b315ad0 --- /dev/null +++ b/tests/unit/fetcher/getFetchFn.test.ts @@ -0,0 +1,22 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { getFetchFn } from "../../../src/core/fetcher/getFetchFn"; + +describe("Test for getFetchFn", () => { + it("should get node-fetch function", async () => { + if (RUNTIME.type == "node") { + if (RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + expect(await getFetchFn()).toBe(fetch); + } else { + expect(await getFetchFn()).toEqual((await import("node-fetch")).default as any); + } + } + }); + + it("should get fetch function", async () => { + if (RUNTIME.type == "browser") { + const fetchFn = await getFetchFn(); + expect(typeof fetchFn).toBe("function"); + expect(fetchFn.name).toBe("fetch"); + } + }); +}); diff --git a/tests/unit/fetcher/getRequestBody.test.ts b/tests/unit/fetcher/getRequestBody.test.ts new file mode 100644 index 00000000..1b1462c5 --- /dev/null +++ b/tests/unit/fetcher/getRequestBody.test.ts @@ -0,0 +1,81 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { getRequestBody } from "../../../src/core/fetcher/getRequestBody"; + +if (RUNTIME.type === "browser") { + require("jest-fetch-mock").enableMocks(); +} + +describe("Test getRequestBody", () => { + it("should return FormData as is in Node environment", async () => { + if (RUNTIME.type === "node") { + const formData = new (await import("formdata-node")).FormData(); + formData.append("key", "value"); + const result = await getRequestBody({ + body: formData, + type: "file", + }); + expect(result).toBe(formData); + } + }); + + it("should stringify body if not FormData in Node environment", async () => { + if (RUNTIME.type === "node") { + const body = { key: "value" }; + const result = await getRequestBody({ + body, + type: "json", + }); + expect(result).toBe('{"key":"value"}'); + } + }); + + it("should return FormData in browser environment", async () => { + if (RUNTIME.type === "browser") { + const formData = new (await import("form-data")).default(); + formData.append("key", "value"); + const result = await getRequestBody({ + body: formData, + type: "file", + }); + expect(result).toBe(formData); + } + }); + + it("should stringify body if not FormData in browser environment", async () => { + if (RUNTIME.type === "browser") { + const body = { key: "value" }; + const result = await getRequestBody({ + body, + type: "json", + }); + expect(result).toBe('{"key":"value"}'); + } + }); + + it("should return the Uint8Array", async () => { + const input = new Uint8Array([1, 2, 3]); + const result = await getRequestBody({ + body: input, + type: "bytes", + }); + expect(result).toBe(input); + }); + + it("should return the input for content-type 'application/x-www-form-urlencoded'", async () => { + const input = "key=value&another=param"; + const result = await getRequestBody({ + body: input, + type: "other", + }); + expect(result).toBe(input); + }); + + it("should JSON stringify objects", async () => { + const input = { key: "value" }; + const result = await getRequestBody({ + body: input, + type: "json", + }); + expect(result).toBe('{"key":"value"}'); + }); +}); diff --git a/tests/unit/fetcher/getResponseBody.test.ts b/tests/unit/fetcher/getResponseBody.test.ts new file mode 100644 index 00000000..3510779e --- /dev/null +++ b/tests/unit/fetcher/getResponseBody.test.ts @@ -0,0 +1,68 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { getResponseBody } from "../../../src/core/fetcher/getResponseBody"; +import { chooseStreamWrapper } from "../../../src/core/fetcher/stream-wrappers/chooseStreamWrapper"; + +if (RUNTIME.type === "browser") { + require("jest-fetch-mock").enableMocks(); +} + +describe("Test getResponseBody", () => { + it("should handle blob response type", async () => { + const mockBlob = new Blob(["test"], { type: "text/plain" }); + const mockResponse = new Response(mockBlob); + const result = await getResponseBody(mockResponse, "blob"); + // @ts-expect-error + expect(result.constructor.name).toBe("Blob"); + }); + + it("should handle sse response type", async () => { + if (RUNTIME.type === "node") { + const mockStream = new ReadableStream(); + const mockResponse = new Response(mockStream); + const result = await getResponseBody(mockResponse, "sse"); + expect(result).toBe(mockStream); + } + }); + + it("should handle streaming response type", async () => { + if (RUNTIME.type === "node") { + const mockStream = new ReadableStream(); + const mockResponse = new Response(mockStream); + const result = await getResponseBody(mockResponse, "streaming"); + // need to reinstantiate string as a result of locked state in Readable Stream after registration with Response + expect(JSON.stringify(result)).toBe(JSON.stringify(await chooseStreamWrapper(new ReadableStream()))); + } + }); + + it("should handle text response type", async () => { + const mockResponse = new Response("test text"); + const result = await getResponseBody(mockResponse, "text"); + expect(result).toBe("test text"); + }); + + it("should handle JSON response", async () => { + const mockJson = { key: "value" }; + const mockResponse = new Response(JSON.stringify(mockJson)); + const result = await getResponseBody(mockResponse); + expect(result).toEqual(mockJson); + }); + + it("should handle empty response", async () => { + const mockResponse = new Response(""); + const result = await getResponseBody(mockResponse); + expect(result).toBeUndefined(); + }); + + it("should handle non-JSON response", async () => { + const mockResponse = new Response("invalid json"); + const result = await getResponseBody(mockResponse); + expect(result).toEqual({ + ok: false, + error: { + reason: "non-json", + statusCode: 200, + rawBody: "invalid json", + }, + }); + }); +}); diff --git a/tests/unit/fetcher/makeRequest.test.ts b/tests/unit/fetcher/makeRequest.test.ts new file mode 100644 index 00000000..5969d515 --- /dev/null +++ b/tests/unit/fetcher/makeRequest.test.ts @@ -0,0 +1,58 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { makeRequest } from "../../../src/core/fetcher/makeRequest"; + +if (RUNTIME.type === "browser") { + require("jest-fetch-mock").enableMocks(); +} + +describe("Test makeRequest", () => { + const mockPostUrl = "https://httpbin.org/post"; + const mockGetUrl = "https://httpbin.org/get"; + const mockHeaders = { "Content-Type": "application/json" }; + const mockBody = JSON.stringify({ key: "value" }); + + let mockFetch: jest.Mock; + + beforeEach(() => { + mockFetch = jest.fn(); + mockFetch.mockResolvedValue(new Response(JSON.stringify({ test: "successful" }), { status: 200 })); + }); + + it("should handle POST request correctly", async () => { + const response = await makeRequest(mockFetch, mockPostUrl, "POST", mockHeaders, mockBody); + const responseBody = await response.json(); + expect(responseBody).toEqual({ test: "successful" }); + expect(mockFetch).toHaveBeenCalledTimes(1); + const [calledUrl, calledOptions] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe(mockPostUrl); + expect(calledOptions).toEqual( + expect.objectContaining({ + method: "POST", + headers: mockHeaders, + body: mockBody, + credentials: undefined, + }) + ); + expect(calledOptions.signal).toBeDefined(); + expect(calledOptions.signal).toBeInstanceOf(AbortSignal); + }); + + it("should handle GET request correctly", async () => { + const response = await makeRequest(mockFetch, mockGetUrl, "GET", mockHeaders, undefined); + const responseBody = await response.json(); + expect(responseBody).toEqual({ test: "successful" }); + expect(mockFetch).toHaveBeenCalledTimes(1); + const [calledUrl, calledOptions] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe(mockGetUrl); + expect(calledOptions).toEqual( + expect.objectContaining({ + method: "GET", + headers: mockHeaders, + body: undefined, + credentials: undefined, + }) + ); + expect(calledOptions.signal).toBeDefined(); + expect(calledOptions.signal).toBeInstanceOf(AbortSignal); + }); +}); diff --git a/tests/unit/fetcher/requestWithRetries.test.ts b/tests/unit/fetcher/requestWithRetries.test.ts new file mode 100644 index 00000000..b53e0436 --- /dev/null +++ b/tests/unit/fetcher/requestWithRetries.test.ts @@ -0,0 +1,85 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { requestWithRetries } from "../../../src/core/fetcher/requestWithRetries"; + +if (RUNTIME.type === "browser") { + require("jest-fetch-mock").enableMocks(); +} + +describe("Test exponential backoff", () => { + let mockFetch: jest.Mock; + let originalSetTimeout: typeof setTimeout; + + beforeEach(() => { + mockFetch = jest.fn(); + originalSetTimeout = global.setTimeout; + jest.useFakeTimers(); + }); + + afterEach(() => { + jest.useRealTimers(); + global.setTimeout = originalSetTimeout; + }); + + it("should retry on 408, 409, 429, 500+", async () => { + mockFetch + .mockResolvedValueOnce(new Response("", { status: 408 })) + .mockResolvedValueOnce(new Response("", { status: 409 })) + .mockResolvedValueOnce(new Response("", { status: 429 })) + .mockResolvedValueOnce(new Response("", { status: 500 })) + .mockResolvedValueOnce(new Response("", { status: 502 })) + .mockResolvedValueOnce(new Response("", { status: 200 })) + .mockResolvedValueOnce(new Response("", { status: 408 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 10); + + await jest.advanceTimersByTimeAsync(10000); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(6); + expect(response.status).toBe(200); + }); + + it("should retry max 3 times", async () => { + mockFetch + .mockResolvedValueOnce(new Response("", { status: 408 })) + .mockResolvedValueOnce(new Response("", { status: 409 })) + .mockResolvedValueOnce(new Response("", { status: 429 })) + .mockResolvedValueOnce(new Response("", { status: 429 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 3); + + await jest.advanceTimersByTimeAsync(10000); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(4); + expect(response.status).toBe(429); + }); + it("should not retry on 200", async () => { + mockFetch + .mockResolvedValueOnce(new Response("", { status: 200 })) + .mockResolvedValueOnce(new Response("", { status: 409 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 3); + + await jest.advanceTimersByTimeAsync(10000); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(1); + expect(response.status).toBe(200); + }); + + it("should retry with exponential backoff timing", async () => { + mockFetch.mockResolvedValue(new Response("", { status: 500 })); + const maxRetries = 7; + const responsePromise = requestWithRetries(() => mockFetch(), maxRetries); + expect(mockFetch).toHaveBeenCalledTimes(1); + + const delays = [1, 2, 4, 8, 16, 32, 64]; + for (let i = 0; i < delays.length; i++) { + await jest.advanceTimersByTimeAsync(delays[i] as number); + expect(mockFetch).toHaveBeenCalledTimes(Math.min(i + 2, maxRetries + 1)); + } + const response = await responsePromise; + expect(response.status).toBe(500); + }); +}); diff --git a/tests/unit/fetcher/signals.test.ts b/tests/unit/fetcher/signals.test.ts new file mode 100644 index 00000000..9cabfa07 --- /dev/null +++ b/tests/unit/fetcher/signals.test.ts @@ -0,0 +1,69 @@ +import { anySignal, getTimeoutSignal } from "../../../src/core/fetcher/signals"; + +describe("Test getTimeoutSignal", () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + + afterEach(() => { + jest.useRealTimers(); + }); + + it("should return an object with signal and abortId", () => { + const { signal, abortId } = getTimeoutSignal(1000); + + expect(signal).toBeDefined(); + expect(abortId).toBeDefined(); + expect(signal).toBeInstanceOf(AbortSignal); + expect(signal.aborted).toBe(false); + }); + + it("should create a signal that aborts after the specified timeout", () => { + const timeoutMs = 5000; + const { signal } = getTimeoutSignal(timeoutMs); + + expect(signal.aborted).toBe(false); + + jest.advanceTimersByTime(timeoutMs - 1); + expect(signal.aborted).toBe(false); + + jest.advanceTimersByTime(1); + expect(signal.aborted).toBe(true); + }); +}); + +describe("Test anySignal", () => { + it("should return an AbortSignal", () => { + const signal = anySignal(new AbortController().signal); + expect(signal).toBeInstanceOf(AbortSignal); + }); + + it("should abort when any of the input signals is aborted", () => { + const controller1 = new AbortController(); + const controller2 = new AbortController(); + const signal = anySignal(controller1.signal, controller2.signal); + + expect(signal.aborted).toBe(false); + controller1.abort(); + expect(signal.aborted).toBe(true); + }); + + it("should handle an array of signals", () => { + const controller1 = new AbortController(); + const controller2 = new AbortController(); + const signal = anySignal([controller1.signal, controller2.signal]); + + expect(signal.aborted).toBe(false); + controller2.abort(); + expect(signal.aborted).toBe(true); + }); + + it("should abort immediately if one of the input signals is already aborted", () => { + const controller1 = new AbortController(); + const controller2 = new AbortController(); + controller1.abort(); + + const signal = anySignal(controller1.signal, controller2.signal); + expect(signal.aborted).toBe(true); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts new file mode 100644 index 00000000..1dc9be0c --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts @@ -0,0 +1,178 @@ +import { Node18UniversalStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper"; + +describe("Node18UniversalStreamWrapper", () => { + it("should set encoding to utf-8", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const setEncodingSpy = jest.spyOn(stream, "setEncoding"); + + stream.setEncoding("utf-8"); + + expect(setEncodingSpy).toHaveBeenCalledWith("utf-8"); + }); + + it("should register an event listener for readable", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const onSpy = jest.spyOn(stream, "on"); + + stream.on("readable", () => {}); + + expect(onSpy).toHaveBeenCalledWith("readable", expect.any(Function)); + }); + + it("should remove an event listener for data", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const offSpy = jest.spyOn(stream, "off"); + + const fn = () => {}; + stream.on("data", fn); + stream.off("data", fn); + + expect(offSpy).toHaveBeenCalledWith("data", expect.any(Function)); + }); + + it("should write to dest when calling pipe to writable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + const dest = new WritableStream({ + write(chunk) { + expect(chunk).toEqual(new TextEncoder().encode("test")); + }, + }); + + stream.pipe(dest); + }); + + it("should write to dest when calling pipe to node writable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + const dest = new (await import("readable-stream")).Writable({ + write(chunk, encoding, callback) { + expect(chunk.toString()).toEqual("test"); + callback(); + }, + }); + + stream.pipe(dest); + }); + + it("should write nothing when calling pipe and unpipe", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + const buffer: Uint8Array[] = []; + const dest = new WritableStream({ + write(chunk) { + buffer.push(chunk); + }, + }); + + stream.pipe(dest); + stream.unpipe(dest); + expect(buffer).toEqual([]); + }); + + it("should destroy the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const destroySpy = jest.spyOn(stream, "destroy"); + + stream.destroy(); + + expect(destroySpy).toHaveBeenCalled(); + }); + + it("should pause and resume the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const pauseSpy = jest.spyOn(stream, "pause"); + const resumeSpy = jest.spyOn(stream, "resume"); + + expect(stream.isPaused).toBe(false); + stream.pause(); + expect(stream.isPaused).toBe(true); + stream.resume(); + + expect(pauseSpy).toHaveBeenCalled(); + expect(resumeSpy).toHaveBeenCalled(); + }); + + it("should read the stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + + expect(await stream.read()).toEqual(new TextEncoder().encode("test")); + expect(await stream.read()).toEqual(new TextEncoder().encode("test")); + }); + + it("should read the stream as text", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + + const data = await stream.text(); + + expect(data).toEqual("testtest"); + }); + + it("should read the stream as json", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode(JSON.stringify({ test: "test" }))); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + + const data = await stream.json(); + + expect(data).toEqual({ test: "test" }); + }); + + it("should allow use with async iteratable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + let data = ""; + const stream = new Node18UniversalStreamWrapper(rawStream); + for await (const chunk of stream) { + data += new TextDecoder().decode(chunk); + } + + expect(data).toEqual("testtest"); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts new file mode 100644 index 00000000..0c99d3b2 --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts @@ -0,0 +1,124 @@ +import { NodePre18StreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/NodePre18StreamWrapper"; + +describe("NodePre18StreamWrapper", () => { + it("should set encoding to utf-8", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const setEncodingSpy = jest.spyOn(stream, "setEncoding"); + + stream.setEncoding("utf-8"); + + expect(setEncodingSpy).toHaveBeenCalledWith("utf-8"); + }); + + it("should register an event listener for readable", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const onSpy = jest.spyOn(stream, "on"); + + stream.on("readable", () => {}); + + expect(onSpy).toHaveBeenCalledWith("readable", expect.any(Function)); + }); + + it("should remove an event listener for data", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const offSpy = jest.spyOn(stream, "off"); + + const fn = () => {}; + stream.on("data", fn); + stream.off("data", fn); + + expect(offSpy).toHaveBeenCalledWith("data", expect.any(Function)); + }); + + it("should write to dest when calling pipe to node writable stream", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const dest = new (await import("readable-stream")).Writable({ + write(chunk, encoding, callback) { + expect(chunk.toString()).toEqual("test"); + callback(); + }, + }); + + stream.pipe(dest); + }); + + it("should write nothing when calling pipe and unpipe", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const buffer: Uint8Array[] = []; + const dest = new (await import("readable-stream")).Writable({ + write(chunk, encoding, callback) { + buffer.push(chunk); + callback(); + }, + }); + stream.pipe(dest); + stream.unpipe(); + + expect(buffer).toEqual([]); + }); + + it("should destroy the stream", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const destroySpy = jest.spyOn(stream, "destroy"); + + stream.destroy(); + + expect(destroySpy).toHaveBeenCalledWith(); + }); + + it("should pause the stream and resume", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const pauseSpy = jest.spyOn(stream, "pause"); + + stream.pause(); + expect(stream.isPaused).toBe(true); + stream.resume(); + expect(stream.isPaused).toBe(false); + + expect(pauseSpy).toHaveBeenCalledWith(); + }); + + it("should read the stream", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + + expect(await stream.read()).toEqual("test"); + expect(await stream.read()).toEqual("test"); + }); + + it("should read the stream as text", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + + const data = await stream.text(); + + expect(data).toEqual("testtest"); + }); + + it("should read the stream as json", async () => { + const rawStream = (await import("readable-stream")).Readable.from([JSON.stringify({ test: "test" })]); + const stream = new NodePre18StreamWrapper(rawStream); + + const data = await stream.json(); + + expect(data).toEqual({ test: "test" }); + }); + + it("should allow use with async iteratable stream", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + let data = ""; + const stream = new NodePre18StreamWrapper(rawStream); + for await (const chunk of stream) { + data += chunk; + } + + expect(data).toEqual("testtest"); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts new file mode 100644 index 00000000..1d171ce6 --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts @@ -0,0 +1,153 @@ +import { UndiciStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/UndiciStreamWrapper"; + +describe("UndiciStreamWrapper", () => { + it("should set encoding to utf-8", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const setEncodingSpy = jest.spyOn(stream, "setEncoding"); + + stream.setEncoding("utf-8"); + + expect(setEncodingSpy).toHaveBeenCalledWith("utf-8"); + }); + + it("should register an event listener for readable", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const onSpy = jest.spyOn(stream, "on"); + + stream.on("readable", () => {}); + + expect(onSpy).toHaveBeenCalledWith("readable", expect.any(Function)); + }); + + it("should remove an event listener for data", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const offSpy = jest.spyOn(stream, "off"); + + const fn = () => {}; + stream.on("data", fn); + stream.off("data", fn); + + expect(offSpy).toHaveBeenCalledWith("data", expect.any(Function)); + }); + + it("should write to dest when calling pipe to writable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + const dest = new WritableStream({ + write(chunk) { + expect(chunk).toEqual(new TextEncoder().encode("test")); + }, + }); + + stream.pipe(dest); + }); + + it("should write nothing when calling pipe and unpipe", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const buffer: Uint8Array[] = []; + const dest = new WritableStream({ + write(chunk) { + buffer.push(chunk); + }, + }); + stream.pipe(dest); + stream.unpipe(dest); + + expect(buffer).toEqual([]); + }); + + it("should destroy the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const destroySpy = jest.spyOn(stream, "destroy"); + + stream.destroy(); + + expect(destroySpy).toHaveBeenCalled(); + }); + + it("should pause and resume the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const pauseSpy = jest.spyOn(stream, "pause"); + const resumeSpy = jest.spyOn(stream, "resume"); + + expect(stream.isPaused).toBe(false); + stream.pause(); + expect(stream.isPaused).toBe(true); + stream.resume(); + + expect(pauseSpy).toHaveBeenCalled(); + expect(resumeSpy).toHaveBeenCalled(); + }); + + it("should read the stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + + expect(await stream.read()).toEqual(new TextEncoder().encode("test")); + expect(await stream.read()).toEqual(new TextEncoder().encode("test")); + }); + + it("should read the stream as text", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + + const data = await stream.text(); + + expect(data).toEqual("testtest"); + }); + + it("should read the stream as json", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode(JSON.stringify({ test: "test" }))); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + + const data = await stream.json(); + + expect(data).toEqual({ test: "test" }); + }); + + it("should allow use with async iteratable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + let data = ""; + const stream = new UndiciStreamWrapper(rawStream); + for await (const chunk of stream) { + data += new TextDecoder().decode(chunk); + } + + expect(data).toEqual("testtest"); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts new file mode 100644 index 00000000..17cf37a2 --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts @@ -0,0 +1,43 @@ +import { RUNTIME } from "../../../../src/core/runtime"; +import { chooseStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/chooseStreamWrapper"; +import { Node18UniversalStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper"; +import { NodePre18StreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/NodePre18StreamWrapper"; +import { UndiciStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/UndiciStreamWrapper"; + +describe("chooseStreamWrapper", () => { + beforeEach(() => { + RUNTIME.type = "unknown"; + RUNTIME.parsedVersion = 0; + }); + + it('should return a Node18UniversalStreamWrapper when RUNTIME.type is "node" and RUNTIME.parsedVersion is not null and RUNTIME.parsedVersion is greater than or equal to 18', async () => { + const expected = new Node18UniversalStreamWrapper(new ReadableStream()); + RUNTIME.type = "node"; + RUNTIME.parsedVersion = 18; + + const result = await chooseStreamWrapper(new ReadableStream()); + + expect(JSON.stringify(result)).toBe(JSON.stringify(expected)); + }); + + it('should return a NodePre18StreamWrapper when RUNTIME.type is "node" and RUNTIME.parsedVersion is not null and RUNTIME.parsedVersion is less than 18', async () => { + const stream = await import("readable-stream"); + const expected = new NodePre18StreamWrapper(new stream.Readable()); + + RUNTIME.type = "node"; + RUNTIME.parsedVersion = 16; + + const result = await chooseStreamWrapper(new stream.Readable()); + + expect(JSON.stringify(result)).toEqual(JSON.stringify(expected)); + }); + + it('should return a Undici when RUNTIME.type is not "node"', async () => { + const expected = new UndiciStreamWrapper(new ReadableStream()); + RUNTIME.type = "browser"; + + const result = await chooseStreamWrapper(new ReadableStream()); + + expect(JSON.stringify(result)).toEqual(JSON.stringify(expected)); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/webpack.test.ts b/tests/unit/fetcher/stream-wrappers/webpack.test.ts new file mode 100644 index 00000000..2e827291 --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/webpack.test.ts @@ -0,0 +1,35 @@ +import webpack from "webpack"; + +describe("test env compatibility", () => { + test("webpack", () => { + return new Promise((resolve, reject) => { + webpack( + { + mode: "production", + entry: "./src/index.ts", + module: { + rules: [ + { + test: /\.tsx?$/, + use: "ts-loader", + exclude: /node_modules/, + }, + ], + }, + resolve: { + extensions: [".tsx", ".ts", ".js"], + }, + }, + (err, stats) => { + try { + expect(err).toBe(null); + expect(stats?.hasErrors()).toBe(false); + resolve(); + } catch (error) { + reject(error); + } + } + ); + }); + }, 60_000); +}); diff --git a/tests/unit/zurg/bigint/bigint.test.ts b/tests/unit/zurg/bigint/bigint.test.ts new file mode 100644 index 00000000..cf9935a7 --- /dev/null +++ b/tests/unit/zurg/bigint/bigint.test.ts @@ -0,0 +1,24 @@ +import { bigint } from "../../../../src/core/schemas/builders/bigint"; +import { itSchema } from "../utils/itSchema"; +import { itValidateJson, itValidateParse } from "../utils/itValidate"; + +describe("bigint", () => { + itSchema("converts between raw string and parsed bigint", bigint(), { + raw: "123456789012345678901234567890123456789012345678901234567890", + parsed: BigInt("123456789012345678901234567890123456789012345678901234567890"), + }); + + itValidateParse("non-string", bigint(), 42, [ + { + message: "Expected string. Received 42.", + path: [], + }, + ]); + + itValidateJson("non-bigint", bigint(), "hello", [ + { + message: 'Expected bigint. Received "hello".', + path: [], + }, + ]); +}); diff --git a/tests/unit/zurg/date/date.test.ts b/tests/unit/zurg/date/date.test.ts new file mode 100644 index 00000000..2790268a --- /dev/null +++ b/tests/unit/zurg/date/date.test.ts @@ -0,0 +1,31 @@ +import { date } from "../../../../src/core/schemas/builders/date"; +import { itSchema } from "../utils/itSchema"; +import { itValidateJson, itValidateParse } from "../utils/itValidate"; + +describe("date", () => { + itSchema("converts between raw ISO string and parsed Date", date(), { + raw: "2022-09-29T05:41:21.939Z", + parsed: new Date("2022-09-29T05:41:21.939Z"), + }); + + itValidateParse("non-string", date(), 42, [ + { + message: "Expected string. Received 42.", + path: [], + }, + ]); + + itValidateParse("non-ISO", date(), "hello world", [ + { + message: 'Expected ISO 8601 date string. Received "hello world".', + path: [], + }, + ]); + + itValidateJson("non-Date", date(), "hello", [ + { + message: 'Expected Date object. Received "hello".', + path: [], + }, + ]); +}); diff --git a/tests/unit/zurg/enum/enum.test.ts b/tests/unit/zurg/enum/enum.test.ts new file mode 100644 index 00000000..ab0df028 --- /dev/null +++ b/tests/unit/zurg/enum/enum.test.ts @@ -0,0 +1,30 @@ +import { enum_ } from "../../../../src/core/schemas/builders/enum"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("enum", () => { + itSchemaIdentity(enum_(["A", "B", "C"]), "A"); + + itSchemaIdentity(enum_(["A", "B", "C"]), "D" as any, { + opts: { allowUnrecognizedEnumValues: true }, + }); + + itValidate("invalid enum", enum_(["A", "B", "C"]), "D", [ + { + message: 'Expected enum. Received "D".', + path: [], + }, + ]); + + itValidate( + "non-string", + enum_(["A", "B", "C"]), + [], + [ + { + message: "Expected string. Received list.", + path: [], + }, + ] + ); +}); diff --git a/tests/unit/zurg/lazy/lazy.test.ts b/tests/unit/zurg/lazy/lazy.test.ts new file mode 100644 index 00000000..6906bf4c --- /dev/null +++ b/tests/unit/zurg/lazy/lazy.test.ts @@ -0,0 +1,57 @@ +import { Schema } from "../../../../src/core/schemas/Schema"; +import { lazy, list, object, string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("lazy", () => { + it("doesn't run immediately", () => { + let wasRun = false; + lazy(() => { + wasRun = true; + return string(); + }); + expect(wasRun).toBe(false); + }); + + it("only runs first time", async () => { + let count = 0; + const schema = lazy(() => { + count++; + return string(); + }); + await schema.parse("hello"); + await schema.json("world"); + expect(count).toBe(1); + }); + + itSchemaIdentity( + lazy(() => object({})), + { foo: "hello" }, + { + title: "passes opts through", + opts: { unrecognizedObjectKeys: "passthrough" }, + } + ); + + itSchemaIdentity( + lazy(() => object({ foo: string() })), + { foo: "hello" } + ); + + // eslint-disable-next-line jest/expect-expect + it("self-referencial schema doesn't compile", () => { + () => { + // @ts-expect-error + const a = lazy(() => object({ foo: a })); + }; + }); + + // eslint-disable-next-line jest/expect-expect + it("self-referencial compiles with explicit type", () => { + () => { + interface TreeNode { + children: TreeNode[]; + } + const TreeNode: Schema = lazy(() => object({ children: list(TreeNode) })); + }; + }); +}); diff --git a/tests/unit/zurg/lazy/lazyObject.test.ts b/tests/unit/zurg/lazy/lazyObject.test.ts new file mode 100644 index 00000000..8813cc9f --- /dev/null +++ b/tests/unit/zurg/lazy/lazyObject.test.ts @@ -0,0 +1,18 @@ +import { lazyObject, number, object, string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("lazy", () => { + itSchemaIdentity( + lazyObject(() => object({ foo: string() })), + { foo: "hello" } + ); + + itSchemaIdentity( + lazyObject(() => object({ foo: string() })).extend(object({ bar: number() })), + { + foo: "hello", + bar: 42, + }, + { title: "returned schema has object utils" } + ); +}); diff --git a/tests/unit/zurg/lazy/recursive/a.ts b/tests/unit/zurg/lazy/recursive/a.ts new file mode 100644 index 00000000..8b7d5e40 --- /dev/null +++ b/tests/unit/zurg/lazy/recursive/a.ts @@ -0,0 +1,7 @@ +import { object } from "../../../../../src/core/schemas/builders/object"; +import { schemaB } from "./b"; + +// @ts-expect-error +export const schemaA = object({ + b: schemaB, +}); diff --git a/tests/unit/zurg/lazy/recursive/b.ts b/tests/unit/zurg/lazy/recursive/b.ts new file mode 100644 index 00000000..fb219d54 --- /dev/null +++ b/tests/unit/zurg/lazy/recursive/b.ts @@ -0,0 +1,8 @@ +import { object } from "../../../../../src/core/schemas/builders/object"; +import { optional } from "../../../../../src/core/schemas/builders/schema-utils"; +import { schemaA } from "./a"; + +// @ts-expect-error +export const schemaB = object({ + a: optional(schemaA), +}); diff --git a/tests/unit/zurg/list/list.test.ts b/tests/unit/zurg/list/list.test.ts new file mode 100644 index 00000000..424ed642 --- /dev/null +++ b/tests/unit/zurg/list/list.test.ts @@ -0,0 +1,41 @@ +import { list, object, property, string } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("list", () => { + itSchemaIdentity(list(string()), ["hello", "world"], { + title: "functions as identity when item type is primitive", + }); + + itSchema( + "converts objects correctly", + list( + object({ + helloWorld: property("hello_world", string()), + }) + ), + { + raw: [{ hello_world: "123" }], + parsed: [{ helloWorld: "123" }], + } + ); + + itValidate("not a list", list(string()), 42, [ + { + path: [], + message: "Expected list. Received 42.", + }, + ]); + + itValidate( + "invalid item type", + list(string()), + [42], + [ + { + path: ["[0]"], + message: "Expected string. Received 42.", + }, + ] + ); +}); diff --git a/tests/unit/zurg/literals/stringLiteral.test.ts b/tests/unit/zurg/literals/stringLiteral.test.ts new file mode 100644 index 00000000..fa6c8887 --- /dev/null +++ b/tests/unit/zurg/literals/stringLiteral.test.ts @@ -0,0 +1,21 @@ +import { stringLiteral } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("stringLiteral", () => { + itSchemaIdentity(stringLiteral("A"), "A"); + + itValidate("incorrect string", stringLiteral("A"), "B", [ + { + path: [], + message: 'Expected "A". Received "B".', + }, + ]); + + itValidate("non-string", stringLiteral("A"), 42, [ + { + path: [], + message: 'Expected "A". Received 42.', + }, + ]); +}); diff --git a/tests/unit/zurg/object-like/withParsedProperties.test.ts b/tests/unit/zurg/object-like/withParsedProperties.test.ts new file mode 100644 index 00000000..9f5dd0ed --- /dev/null +++ b/tests/unit/zurg/object-like/withParsedProperties.test.ts @@ -0,0 +1,57 @@ +import { object, property, string, stringLiteral } from "../../../../src/core/schemas/builders"; + +describe("withParsedProperties", () => { + it("Added properties included on parsed object", async () => { + const schema = object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }).withParsedProperties({ + printFoo: (parsed) => () => parsed.foo, + printHelloWorld: () => () => "Hello world", + helloWorld: "Hello world", + }); + + const parsed = await schema.parse({ raw_foo: "value of foo", bar: "bar" }); + if (!parsed.ok) { + throw new Error("Failed to parse"); + } + expect(parsed.value.printFoo()).toBe("value of foo"); + expect(parsed.value.printHelloWorld()).toBe("Hello world"); + expect(parsed.value.helloWorld).toBe("Hello world"); + }); + + it("Added property is removed on raw object", async () => { + const schema = object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }).withParsedProperties({ + printFoo: (parsed) => () => parsed.foo, + }); + + const original = { raw_foo: "value of foo", bar: "bar" } as const; + const parsed = await schema.parse(original); + if (!parsed.ok) { + throw new Error("Failed to parse()"); + } + + const raw = await schema.json(parsed.value); + + if (!raw.ok) { + throw new Error("Failed to json()"); + } + + expect(raw.value).toEqual(original); + }); + + describe("compile", () => { + // eslint-disable-next-line jest/expect-expect + it("doesn't compile with non-object schema", () => { + () => + object({ + foo: string(), + }) + // @ts-expect-error + .withParsedProperties(42); + }); + }); +}); diff --git a/tests/unit/zurg/object/extend.test.ts b/tests/unit/zurg/object/extend.test.ts new file mode 100644 index 00000000..54fc8c4e --- /dev/null +++ b/tests/unit/zurg/object/extend.test.ts @@ -0,0 +1,89 @@ +import { boolean, object, property, string, stringLiteral } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; + +describe("extend", () => { + itSchemaIdentity( + object({ + foo: string(), + }).extend( + object({ + bar: stringLiteral("bar"), + }) + ), + { + foo: "", + bar: "bar", + } as const, + { + title: "extended properties are included in schema", + } + ); + + itSchemaIdentity( + object({ + foo: string(), + }) + .extend( + object({ + bar: stringLiteral("bar"), + }) + ) + .extend( + object({ + baz: boolean(), + }) + ), + { + foo: "", + bar: "bar", + baz: true, + } as const, + { + title: "extensions can be extended", + } + ); + + itSchema( + "converts nested object", + object({ + item: object({ + helloWorld: property("hello_world", string()), + }), + }).extend( + object({ + goodbye: property("goodbye_raw", string()), + }) + ), + { + raw: { item: { hello_world: "yo" }, goodbye_raw: "peace" }, + parsed: { item: { helloWorld: "yo" }, goodbye: "peace" }, + } + ); + + itSchema( + "extensions work with raw/parsed property name conversions", + object({ + item: property("item_raw", string()), + }).extend( + object({ + goodbye: property("goodbye_raw", string()), + }) + ), + { + raw: { item_raw: "hi", goodbye_raw: "peace" }, + parsed: { item: "hi", goodbye: "peace" }, + } + ); + + describe("compile", () => { + // eslint-disable-next-line jest/expect-expect + it("doesn't compile with non-object schema", () => { + () => + object({ + foo: string(), + }) + // @ts-expect-error + .extend([]); + }); + }); +}); diff --git a/tests/unit/zurg/object/object.test.ts b/tests/unit/zurg/object/object.test.ts new file mode 100644 index 00000000..0acf0e24 --- /dev/null +++ b/tests/unit/zurg/object/object.test.ts @@ -0,0 +1,255 @@ +import { any, number, object, property, string, stringLiteral, unknown } from "../../../../src/core/schemas/builders"; +import { itJson, itParse, itSchema, itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("object", () => { + itSchemaIdentity( + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + { + foo: "", + bar: "bar", + }, + { + title: "functions as identity when values are primitives and property() isn't used", + } + ); + + itSchema( + "uses raw key from property()", + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { raw_foo: "foo", bar: "bar" }, + parsed: { foo: "foo", bar: "bar" }, + } + ); + + itSchema( + "keys with unknown type can be omitted", + object({ + foo: unknown(), + }), + { + raw: {}, + parsed: {}, + } + ); + + itSchema( + "keys with any type can be omitted", + object({ + foo: any(), + }), + { + raw: {}, + parsed: {}, + } + ); + + describe("unrecognizedObjectKeys", () => { + describe("parse", () => { + itParse( + 'includes unknown values when unrecognizedObjectKeys === "passthrough"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + parsed: { + foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + opts: { + unrecognizedObjectKeys: "passthrough", + }, + } + ); + + itParse( + 'strips unknown values when unrecognizedObjectKeys === "strip"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + parsed: { + foo: "foo", + bar: "bar", + }, + opts: { + unrecognizedObjectKeys: "strip", + }, + } + ); + }); + + describe("json", () => { + itJson( + 'includes unknown values when unrecognizedObjectKeys === "passthrough"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + parsed: { + foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + opts: { + unrecognizedObjectKeys: "passthrough", + }, + } + ); + + itJson( + 'strips unknown values when unrecognizedObjectKeys === "strip"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + }, + parsed: { + foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + opts: { + unrecognizedObjectKeys: "strip", + }, + } + ); + }); + }); + + describe("nullish properties", () => { + itSchema("missing properties are not added", object({ foo: property("raw_foo", string().optional()) }), { + raw: {}, + parsed: {}, + }); + + itSchema("undefined properties are not dropped", object({ foo: property("raw_foo", string().optional()) }), { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + }); + + itSchema("null properties are not dropped", object({ foo: property("raw_foo", string().optional()) }), { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + }); + + describe("extensions", () => { + itSchema( + "undefined properties are not dropped", + object({}).extend(object({ foo: property("raw_foo", string().optional()) })), + { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + } + ); + + describe("parse()", () => { + itParse( + "null properties are not dropped", + object({}).extend(object({ foo: property("raw_foo", string().optional()) })), + { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + } + ); + }); + }); + }); + + itValidate( + "missing property", + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + { foo: "hello" }, + [ + { + path: [], + message: 'Missing required key "bar"', + }, + ] + ); + + itValidate( + "extra property", + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + { foo: "hello", bar: "bar", baz: 42 }, + [ + { + path: ["baz"], + message: 'Unexpected key "baz"', + }, + ] + ); + + itValidate( + "not an object", + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + [], + [ + { + path: [], + message: "Expected object. Received list.", + }, + ] + ); + + itValidate( + "nested validation error", + object({ + foo: object({ + bar: number(), + }), + }), + { foo: { bar: "hello" } }, + [ + { + path: ["foo", "bar"], + message: 'Expected number. Received "hello".', + }, + ] + ); +}); diff --git a/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts b/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts new file mode 100644 index 00000000..d87a65fe --- /dev/null +++ b/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts @@ -0,0 +1,21 @@ +import { objectWithoutOptionalProperties, string, stringLiteral } from "../../../../src/core/schemas/builders"; +import { itSchema } from "../utils/itSchema"; + +describe("objectWithoutOptionalProperties", () => { + itSchema( + "all properties are required", + objectWithoutOptionalProperties({ + foo: string(), + bar: stringLiteral("bar").optional(), + }), + { + raw: { + foo: "hello", + }, + // @ts-expect-error + parsed: { + foo: "hello", + }, + } + ); +}); diff --git a/tests/unit/zurg/primitives/any.test.ts b/tests/unit/zurg/primitives/any.test.ts new file mode 100644 index 00000000..1adbbe2a --- /dev/null +++ b/tests/unit/zurg/primitives/any.test.ts @@ -0,0 +1,6 @@ +import { any } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("any", () => { + itSchemaIdentity(any(), true); +}); diff --git a/tests/unit/zurg/primitives/boolean.test.ts b/tests/unit/zurg/primitives/boolean.test.ts new file mode 100644 index 00000000..897a8295 --- /dev/null +++ b/tests/unit/zurg/primitives/boolean.test.ts @@ -0,0 +1,14 @@ +import { boolean } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("boolean", () => { + itSchemaIdentity(boolean(), true); + + itValidate("non-boolean", boolean(), {}, [ + { + path: [], + message: "Expected boolean. Received object.", + }, + ]); +}); diff --git a/tests/unit/zurg/primitives/number.test.ts b/tests/unit/zurg/primitives/number.test.ts new file mode 100644 index 00000000..2d01415a --- /dev/null +++ b/tests/unit/zurg/primitives/number.test.ts @@ -0,0 +1,14 @@ +import { number } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("number", () => { + itSchemaIdentity(number(), 42); + + itValidate("non-number", number(), "hello", [ + { + path: [], + message: 'Expected number. Received "hello".', + }, + ]); +}); diff --git a/tests/unit/zurg/primitives/string.test.ts b/tests/unit/zurg/primitives/string.test.ts new file mode 100644 index 00000000..57b23687 --- /dev/null +++ b/tests/unit/zurg/primitives/string.test.ts @@ -0,0 +1,14 @@ +import { string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("string", () => { + itSchemaIdentity(string(), "hello"); + + itValidate("non-string", string(), 42, [ + { + path: [], + message: "Expected string. Received 42.", + }, + ]); +}); diff --git a/tests/unit/zurg/primitives/unknown.test.ts b/tests/unit/zurg/primitives/unknown.test.ts new file mode 100644 index 00000000..4d17a7db --- /dev/null +++ b/tests/unit/zurg/primitives/unknown.test.ts @@ -0,0 +1,6 @@ +import { unknown } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("unknown", () => { + itSchemaIdentity(unknown(), true); +}); diff --git a/tests/unit/zurg/record/record.test.ts b/tests/unit/zurg/record/record.test.ts new file mode 100644 index 00000000..7e4ba39c --- /dev/null +++ b/tests/unit/zurg/record/record.test.ts @@ -0,0 +1,34 @@ +import { number, record, string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("record", () => { + itSchemaIdentity(record(string(), string()), { hello: "world" }); + itSchemaIdentity(record(number(), string()), { 42: "world" }); + + itValidate( + "non-record", + record(number(), string()), + [], + [ + { + path: [], + message: "Expected object. Received list.", + }, + ] + ); + + itValidate("invalid key type", record(number(), string()), { hello: "world" }, [ + { + path: ["hello (key)"], + message: 'Expected number. Received "hello".', + }, + ]); + + itValidate("invalid value type", record(string(), number()), { hello: "world" }, [ + { + path: ["hello"], + message: 'Expected number. Received "world".', + }, + ]); +}); diff --git a/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts b/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts new file mode 100644 index 00000000..da10086b --- /dev/null +++ b/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts @@ -0,0 +1,83 @@ +import { object, string } from "../../../../src/core/schemas/builders"; +import { itSchema } from "../utils/itSchema"; + +describe("getSchemaUtils", () => { + describe("optional()", () => { + itSchema("optional fields allow original schema", string().optional(), { + raw: "hello", + parsed: "hello", + }); + + itSchema("optional fields are not required", string().optional(), { + raw: null, + parsed: undefined, + }); + }); + + describe("transform()", () => { + itSchema( + "transorm and untransform run correctly", + string().transform({ + transform: (x) => x + "X", + untransform: (x) => (x as string).slice(0, -1), + }), + { + raw: "hello", + parsed: "helloX", + } + ); + }); + + describe("parseOrThrow()", () => { + it("parses valid value", async () => { + const value = string().parseOrThrow("hello"); + expect(value).toBe("hello"); + }); + + it("throws on invalid value", async () => { + const value = () => object({ a: string(), b: string() }).parseOrThrow({ a: 24 }); + expect(value).toThrowError(new Error('a: Expected string. Received 24.; Missing required key "b"')); + }); + }); + + describe("jsonOrThrow()", () => { + it("serializes valid value", async () => { + const value = string().jsonOrThrow("hello"); + expect(value).toBe("hello"); + }); + + it("throws on invalid value", async () => { + const value = () => object({ a: string(), b: string() }).jsonOrThrow({ a: 24 }); + expect(value).toThrowError(new Error('a: Expected string. Received 24.; Missing required key "b"')); + }); + }); + + describe("omitUndefined", () => { + it("serializes undefined as null", async () => { + const value = object({ + a: string().optional(), + b: string().optional(), + }).jsonOrThrow({ + a: "hello", + b: undefined, + }); + expect(value).toEqual({ a: "hello", b: null }); + }); + + it("omits undefined values", async () => { + const value = object({ + a: string().optional(), + b: string().optional(), + }).jsonOrThrow( + { + a: "hello", + b: undefined, + }, + { + omitUndefined: true, + } + ); + expect(value).toEqual({ a: "hello" }); + }); + }); +}); diff --git a/tests/unit/zurg/schema.test.ts b/tests/unit/zurg/schema.test.ts new file mode 100644 index 00000000..94089a9a --- /dev/null +++ b/tests/unit/zurg/schema.test.ts @@ -0,0 +1,78 @@ +import { + boolean, + discriminant, + list, + number, + object, + string, + stringLiteral, + union, +} from "../../../src/core/schemas/builders"; +import { booleanLiteral } from "../../../src/core/schemas/builders/literals/booleanLiteral"; +import { property } from "../../../src/core/schemas/builders/object/property"; +import { itSchema } from "./utils/itSchema"; + +describe("Schema", () => { + itSchema( + "large nested object", + object({ + a: string(), + b: stringLiteral("b value"), + c: property( + "raw_c", + list( + object({ + animal: union(discriminant("type", "_type"), { + dog: object({ value: boolean() }), + cat: object({ value: property("raw_cat", number()) }), + }), + }) + ) + ), + d: property("raw_d", boolean()), + e: booleanLiteral(true), + }), + { + raw: { + a: "hello", + b: "b value", + raw_c: [ + { + animal: { + _type: "dog", + value: true, + }, + }, + { + animal: { + _type: "cat", + raw_cat: 42, + }, + }, + ], + raw_d: false, + e: true, + }, + parsed: { + a: "hello", + b: "b value", + c: [ + { + animal: { + type: "dog", + value: true, + }, + }, + { + animal: { + type: "cat", + value: 42, + }, + }, + ], + d: false, + e: true, + }, + } + ); +}); diff --git a/tests/unit/zurg/set/set.test.ts b/tests/unit/zurg/set/set.test.ts new file mode 100644 index 00000000..e17f908c --- /dev/null +++ b/tests/unit/zurg/set/set.test.ts @@ -0,0 +1,48 @@ +import { set, string } from "../../../../src/core/schemas/builders"; +import { itSchema } from "../utils/itSchema"; +import { itValidateJson, itValidateParse } from "../utils/itValidate"; + +describe("set", () => { + itSchema("converts between raw list and parsed Set", set(string()), { + raw: ["A", "B"], + parsed: new Set(["A", "B"]), + }); + + itValidateParse("not a list", set(string()), 42, [ + { + path: [], + message: "Expected list. Received 42.", + }, + ]); + + itValidateJson( + "not a Set", + set(string()), + [], + [ + { + path: [], + message: "Expected Set. Received list.", + }, + ] + ); + + itValidateParse( + "invalid item type", + set(string()), + [42], + [ + { + path: ["[0]"], + message: "Expected string. Received 42.", + }, + ] + ); + + itValidateJson("invalid item type", set(string()), new Set([42]), [ + { + path: ["[0]"], + message: "Expected string. Received 42.", + }, + ]); +}); diff --git a/tests/unit/zurg/skipValidation.test.ts b/tests/unit/zurg/skipValidation.test.ts new file mode 100644 index 00000000..5dc88096 --- /dev/null +++ b/tests/unit/zurg/skipValidation.test.ts @@ -0,0 +1,45 @@ +/* eslint-disable no-console */ + +import { boolean, number, object, property, string, undiscriminatedUnion } from "../../../src/core/schemas/builders"; + +describe("skipValidation", () => { + it("allows data that doesn't conform to the schema", async () => { + const warningLogs: string[] = []; + const originalConsoleWarn = console.warn; + console.warn = (...args) => warningLogs.push(args.join(" ")); + + const schema = object({ + camelCase: property("snake_case", string()), + numberProperty: number(), + requiredProperty: boolean(), + anyPrimitive: undiscriminatedUnion([string(), number(), boolean()]), + }); + + const parsed = await schema.parse( + { + snake_case: "hello", + numberProperty: "oops", + anyPrimitive: true, + }, + { + skipValidation: true, + } + ); + + expect(parsed).toEqual({ + ok: true, + value: { + camelCase: "hello", + numberProperty: "oops", + anyPrimitive: true, + }, + }); + + expect(warningLogs).toEqual([ + `Failed to validate. + - numberProperty: Expected number. Received "oops".`, + ]); + + console.warn = originalConsoleWarn; + }); +}); diff --git a/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts b/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts new file mode 100644 index 00000000..0e664333 --- /dev/null +++ b/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts @@ -0,0 +1,44 @@ +import { number, object, property, string, undiscriminatedUnion } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; + +describe("undiscriminatedUnion", () => { + itSchemaIdentity(undiscriminatedUnion([string(), number()]), "hello world"); + + itSchemaIdentity(undiscriminatedUnion([object({ hello: string() }), object({ goodbye: string() })]), { + goodbye: "foo", + }); + + itSchema( + "Correctly transforms", + undiscriminatedUnion([object({ hello: string() }), object({ helloWorld: property("hello_world", string()) })]), + { + raw: { hello_world: "foo " }, + parsed: { helloWorld: "foo " }, + } + ); + + it("Returns errors for all variants", async () => { + const result = await undiscriminatedUnion([string(), number()]).parse(true); + if (result.ok) { + throw new Error("Unexpectedly passed validation"); + } + expect(result.errors).toEqual([ + { + message: "[Variant 0] Expected string. Received true.", + path: [], + }, + { + message: "[Variant 1] Expected number. Received true.", + path: [], + }, + ]); + }); + + describe("compile", () => { + // eslint-disable-next-line jest/expect-expect + it("doesn't compile with zero members", () => { + // @ts-expect-error + () => undiscriminatedUnion([]); + }); + }); +}); diff --git a/tests/unit/zurg/union/union.test.ts b/tests/unit/zurg/union/union.test.ts new file mode 100644 index 00000000..79018460 --- /dev/null +++ b/tests/unit/zurg/union/union.test.ts @@ -0,0 +1,113 @@ +import { boolean, discriminant, number, object, string, union } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("union", () => { + itSchemaIdentity( + union("type", { + lion: object({ + meows: boolean(), + }), + giraffe: object({ + heightInInches: number(), + }), + }), + { type: "lion", meows: true }, + { title: "doesn't transform discriminant when it's a string" } + ); + + itSchema( + "transforms discriminant when it's a discriminant()", + union(discriminant("type", "_type"), { + lion: object({ meows: boolean() }), + giraffe: object({ heightInInches: number() }), + }), + { + raw: { _type: "lion", meows: true }, + parsed: { type: "lion", meows: true }, + } + ); + + describe("allowUnrecognizedUnionMembers", () => { + itSchema( + "transforms discriminant & passes through values when discriminant value is unrecognized", + union(discriminant("type", "_type"), { + lion: object({ meows: boolean() }), + giraffe: object({ heightInInches: number() }), + }), + { + // @ts-expect-error + raw: { _type: "moose", isAMoose: true }, + // @ts-expect-error + parsed: { type: "moose", isAMoose: true }, + opts: { + allowUnrecognizedUnionMembers: true, + }, + } + ); + }); + + describe("withParsedProperties", () => { + it("Added property is included on parsed object", async () => { + const schema = union("type", { + lion: object({}), + tiger: object({ value: string() }), + }).withParsedProperties({ + printType: (parsed) => () => parsed.type, + }); + + const parsed = await schema.parse({ type: "lion" }); + if (!parsed.ok) { + throw new Error("Failed to parse"); + } + expect(parsed.value.printType()).toBe("lion"); + }); + }); + + itValidate( + "non-object", + union("type", { + lion: object({}), + tiger: object({ value: string() }), + }), + [], + [ + { + path: [], + message: "Expected object. Received list.", + }, + ] + ); + + itValidate( + "missing discriminant", + union("type", { + lion: object({}), + tiger: object({ value: string() }), + }), + {}, + [ + { + path: [], + message: 'Missing discriminant ("type")', + }, + ] + ); + + itValidate( + "unrecognized discriminant value", + union("type", { + lion: object({}), + tiger: object({ value: string() }), + }), + { + type: "bear", + }, + [ + { + path: ["type"], + message: 'Expected enum. Received "bear".', + }, + ] + ); +}); diff --git a/tests/unit/zurg/utils/itSchema.ts b/tests/unit/zurg/utils/itSchema.ts new file mode 100644 index 00000000..67b6c928 --- /dev/null +++ b/tests/unit/zurg/utils/itSchema.ts @@ -0,0 +1,78 @@ +/* eslint-disable jest/no-export */ +import { Schema, SchemaOptions } from "../../../../src/core/schemas/Schema"; + +export function itSchemaIdentity( + schema: Schema, + value: T, + { title = "functions as identity", opts }: { title?: string; opts?: SchemaOptions } = {} +): void { + itSchema(title, schema, { raw: value, parsed: value, opts }); +} + +export function itSchema( + title: string, + schema: Schema, + { + raw, + parsed, + opts, + only = false, + }: { + raw: Raw; + parsed: Parsed; + opts?: SchemaOptions; + only?: boolean; + } +): void { + // eslint-disable-next-line jest/valid-title + (only ? describe.only : describe)(title, () => { + itParse("parse()", schema, { raw, parsed, opts }); + itJson("json()", schema, { raw, parsed, opts }); + }); +} + +export function itParse( + title: string, + schema: Schema, + { + raw, + parsed, + opts, + }: { + raw: Raw; + parsed: Parsed; + opts?: SchemaOptions; + } +): void { + // eslint-disable-next-line jest/valid-title + it(title, () => { + const maybeValid = schema.parse(raw, opts); + if (!maybeValid.ok) { + throw new Error("Failed to parse() " + JSON.stringify(maybeValid.errors, undefined, 4)); + } + expect(maybeValid.value).toStrictEqual(parsed); + }); +} + +export function itJson( + title: string, + schema: Schema, + { + raw, + parsed, + opts, + }: { + raw: Raw; + parsed: Parsed; + opts?: SchemaOptions; + } +): void { + // eslint-disable-next-line jest/valid-title + it(title, () => { + const maybeValid = schema.json(parsed, opts); + if (!maybeValid.ok) { + throw new Error("Failed to json() " + JSON.stringify(maybeValid.errors, undefined, 4)); + } + expect(maybeValid.value).toStrictEqual(raw); + }); +} diff --git a/tests/unit/zurg/utils/itValidate.ts b/tests/unit/zurg/utils/itValidate.ts new file mode 100644 index 00000000..75b2c08b --- /dev/null +++ b/tests/unit/zurg/utils/itValidate.ts @@ -0,0 +1,56 @@ +/* eslint-disable jest/no-export */ +import { Schema, SchemaOptions, ValidationError } from "../../../../src/core/schemas/Schema"; + +export function itValidate( + title: string, + schema: Schema, + input: unknown, + errors: ValidationError[], + opts?: SchemaOptions +): void { + // eslint-disable-next-line jest/valid-title + describe("parse()", () => { + itValidateParse(title, schema, input, errors, opts); + }); + describe("json()", () => { + itValidateJson(title, schema, input, errors, opts); + }); +} + +export function itValidateParse( + title: string, + schema: Schema, + raw: unknown, + errors: ValidationError[], + opts?: SchemaOptions +): void { + describe("parse", () => { + // eslint-disable-next-line jest/valid-title + it(title, async () => { + const maybeValid = await schema.parse(raw, opts); + if (maybeValid.ok) { + throw new Error("Value passed validation"); + } + expect(maybeValid.errors).toStrictEqual(errors); + }); + }); +} + +export function itValidateJson( + title: string, + schema: Schema, + parsed: unknown, + errors: ValidationError[], + opts?: SchemaOptions +): void { + describe("json", () => { + // eslint-disable-next-line jest/valid-title + it(title, async () => { + const maybeValid = await schema.json(parsed, opts); + if (maybeValid.ok) { + throw new Error("Value passed validation"); + } + expect(maybeValid.errors).toStrictEqual(errors); + }); + }); +} diff --git a/yarn.lock b/yarn.lock index 2354fe4f..592319de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19,11 +19,11 @@ picocolors "^1.0.0" "@babel/compat-data@^7.25.2": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.2.tgz#e41928bd33475305c586f6acbbb7e3ade7a6f7f5" - integrity sha512-bYcppcpKBvX4znYaPEeFau03bp89ShqNMLs+rmdptMw+heSZh9+z84d2YG+K7cYLbWwzdjtDoW/uqZmPjulClQ== + version "7.25.4" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.4.tgz#7d2a80ce229890edcf4cc259d4d696cb4dae2fcb" + integrity sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ== -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": +"@babel/core@^7.0.0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": version "7.25.2" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.25.2.tgz#ed8eec275118d7613e77a352894cd12ded8eba77" integrity sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA== @@ -44,12 +44,12 @@ json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.25.0", "@babel/generator@^7.7.2": - version "7.25.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.25.0.tgz#f858ddfa984350bc3d3b7f125073c9af6988f18e" - integrity sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw== +"@babel/generator@^7.25.0", "@babel/generator@^7.25.6", "@babel/generator@^7.7.2": + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.25.6.tgz#0df1ad8cb32fe4d2b01d8bf437f153d19342a87c" + integrity sha512-VPC82gr1seXOpkjAAKoLhP50vx4vGNlF4msF64dSFq1P8RfB+QAuJWGHPXXPc8QyfVWwwB/TNNU4+ayZmHNbZw== dependencies: - "@babel/types" "^7.25.0" + "@babel/types" "^7.25.6" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^2.5.1" @@ -83,7 +83,7 @@ "@babel/helper-validator-identifier" "^7.24.7" "@babel/traverse" "^7.25.2" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.24.7", "@babel/helper-plugin-utils@^7.8.0": +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.24.7", "@babel/helper-plugin-utils@^7.24.8", "@babel/helper-plugin-utils@^7.8.0": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz#94ee67e8ec0e5d44ea7baeb51e571bd26af07878" integrity sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg== @@ -112,12 +112,12 @@ integrity sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q== "@babel/helpers@^7.25.0": - version "7.25.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.25.0.tgz#e69beb7841cb93a6505531ede34f34e6a073650a" - integrity sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw== + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.25.6.tgz#57ee60141829ba2e102f30711ffe3afab357cc60" + integrity sha512-Xg0tn4HcfTijTwfDwYlvVCl43V6h4KyVVX2aEm4qdO/PC6L2YvzLHFdmxhoeSA3eslcE6+ZVXHgWwopXYLNq4Q== dependencies: "@babel/template" "^7.25.0" - "@babel/types" "^7.25.0" + "@babel/types" "^7.25.6" "@babel/highlight@^7.24.7": version "7.24.7" @@ -129,12 +129,12 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.25.0", "@babel/parser@^7.25.3": - version "7.25.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.3.tgz#91fb126768d944966263f0657ab222a642b82065" - integrity sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.25.0", "@babel/parser@^7.25.6": + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.6.tgz#85660c5ef388cbbf6e3d2a694ee97a38f18afe2f" + integrity sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q== dependencies: - "@babel/types" "^7.25.2" + "@babel/types" "^7.25.6" "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -165,11 +165,11 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-import-attributes@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.24.7.tgz#b4f9ea95a79e6912480c4b626739f86a076624ca" - integrity sha512-hbX+lKKeUMGihnK8nvKqmXBInriT3GVjzXKFriV3YC6APGxMbP8RZNFwy91+hocLXq90Mta+HshoB31802bb8A== + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.25.6.tgz#6d4c78f042db0e82fd6436cd65fec5dc78ad2bde" + integrity sha512-sXaDXaJN9SNLymBdlWFA+bjzBhFD617ZaFiY13dGt7TVslVvVgA6fkZOP7Ki3IGElC45lwHdOTrCtKZGVAWeLQ== dependencies: - "@babel/helper-plugin-utils" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.8" "@babel/plugin-syntax-import-meta@^7.10.4": version "7.10.4" @@ -249,11 +249,18 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-typescript@^7.7.2": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz#58d458271b4d3b6bb27ee6ac9525acbb259bad1c" - integrity sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA== + version "7.25.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.4.tgz#04db9ce5a9043d9c635e75ae7969a2cd50ca97ff" + integrity sha512-uMOCoHVU52BsSWxPOMVv5qKRdeSlPuImUCB2dlPuBSU+W2/ROE7/Zg8F2Kepbk+8yBa68LlRKxO+xgEVWorsDg== dependencies: - "@babel/helper-plugin-utils" "^7.24.7" + "@babel/helper-plugin-utils" "^7.24.8" + +"@babel/runtime@^7.0.0": + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.6.tgz#9afc3289f7184d8d7f98b099884c26317b9264d2" + integrity sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ== + dependencies: + regenerator-runtime "^0.14.0" "@babel/template@^7.25.0", "@babel/template@^7.3.3": version "7.25.0" @@ -265,22 +272,22 @@ "@babel/types" "^7.25.0" "@babel/traverse@^7.24.7", "@babel/traverse@^7.25.2": - version "7.25.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.3.tgz#f1b901951c83eda2f3e29450ce92743783373490" - integrity sha512-HefgyP1x754oGCsKmV5reSmtV7IXj/kpaE1XYY+D9G5PvKKoFfSbiS4M77MdjuwlZKDIKFCffq9rPU+H/s3ZdQ== + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.6.tgz#04fad980e444f182ecf1520504941940a90fea41" + integrity sha512-9Vrcx5ZW6UwK5tvqsj0nGpp/XzqthkT0dqIc9g1AdtygFToNtTF67XzYS//dm+SAK9cp3B9R4ZO/46p63SCjlQ== dependencies: "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.25.0" - "@babel/parser" "^7.25.3" + "@babel/generator" "^7.25.6" + "@babel/parser" "^7.25.6" "@babel/template" "^7.25.0" - "@babel/types" "^7.25.2" + "@babel/types" "^7.25.6" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.25.0", "@babel/types@^7.25.2", "@babel/types@^7.3.3": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.2.tgz#55fb231f7dc958cd69ea141a4c2997e819646125" - integrity sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.25.0", "@babel/types@^7.25.2", "@babel/types@^7.25.6", "@babel/types@^7.3.3": + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.6.tgz#893942ddb858f32ae7a004ec9d3a76b3463ef8e6" + integrity sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw== dependencies: "@babel/helper-string-parser" "^7.24.8" "@babel/helper-validator-identifier" "^7.24.7" @@ -518,12 +525,20 @@ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== +"@jridgewell/source-map@^0.3.3": + version "0.3.6" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.6.tgz#9d71ca886e32502eb9362c9a74a46787c36df81a" + integrity sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": version "1.5.0" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== @@ -588,6 +603,11 @@ dependencies: "@babel/types" "^7.20.7" +"@types/estree@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" + integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== + "@types/graceful-fs@^4.1.3": version "4.1.9" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" @@ -631,6 +651,11 @@ "@types/tough-cookie" "*" parse5 "^7.0.0" +"@types/json-schema@^7.0.8": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + "@types/node-fetch@2.6.9": version "2.6.9" resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e" @@ -640,9 +665,9 @@ form-data "^4.0.0" "@types/node@*": - version "22.4.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.4.1.tgz#9b595d292c65b94c20923159e2ce947731b6fdce" - integrity sha512-1tbpb9325+gPnKK0dMm+/LMriX0vKxf6RnB0SZUqfyVkQ4fMgUSySqhxE/y8Jvs4NyF1yHzTfG9KlnkIODxPKg== + version "22.5.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.5.tgz#52f939dd0f65fc552a4ad0b392f3c466cc5d7a44" + integrity sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA== dependencies: undici-types "~6.19.2" @@ -656,6 +681,14 @@ resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.8.tgz#f2a7de3c107b89b441e071d5472e6b726b4adf45" integrity sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg== +"@types/readable-stream@^4.0.15": + version "4.0.15" + resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-4.0.15.tgz#e6ec26fe5b02f578c60baf1fa9452e90957d2bfb" + integrity sha512-oAZ3kw+kJFkEqyh7xORZOku1YAKvsFTogRY8kVl4vHpEKiDkfnSA/My8haRE7fvmix5Zyy+1pwzOi7yycGLBJw== + dependencies: + "@types/node" "*" + safe-buffer "~5.1.1" + "@types/stack-utils@^2.0.0": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" @@ -683,11 +716,149 @@ dependencies: "@types/yargs-parser" "*" +"@webassemblyjs/ast@1.12.1", "@webassemblyjs/ast@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.12.1.tgz#bb16a0e8b1914f979f45864c23819cc3e3f0d4bb" + integrity sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg== + dependencies: + "@webassemblyjs/helper-numbers" "1.11.6" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + +"@webassemblyjs/floating-point-hex-parser@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz#dacbcb95aff135c8260f77fa3b4c5fea600a6431" + integrity sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw== + +"@webassemblyjs/helper-api-error@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz#6132f68c4acd59dcd141c44b18cbebbd9f2fa768" + integrity sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q== + +"@webassemblyjs/helper-buffer@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz#6df20d272ea5439bf20ab3492b7fb70e9bfcb3f6" + integrity sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw== + +"@webassemblyjs/helper-numbers@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz#cbce5e7e0c1bd32cf4905ae444ef64cea919f1b5" + integrity sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g== + dependencies: + "@webassemblyjs/floating-point-hex-parser" "1.11.6" + "@webassemblyjs/helper-api-error" "1.11.6" + "@xtuc/long" "4.2.2" + +"@webassemblyjs/helper-wasm-bytecode@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz#bb2ebdb3b83aa26d9baad4c46d4315283acd51e9" + integrity sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA== + +"@webassemblyjs/helper-wasm-section@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz#3da623233ae1a60409b509a52ade9bc22a37f7bf" + integrity sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-buffer" "1.12.1" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/wasm-gen" "1.12.1" + +"@webassemblyjs/ieee754@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz#bb665c91d0b14fffceb0e38298c329af043c6e3a" + integrity sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg== + dependencies: + "@xtuc/ieee754" "^1.2.0" + +"@webassemblyjs/leb128@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.11.6.tgz#70e60e5e82f9ac81118bc25381a0b283893240d7" + integrity sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ== + dependencies: + "@xtuc/long" "4.2.2" + +"@webassemblyjs/utf8@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.11.6.tgz#90f8bc34c561595fe156603be7253cdbcd0fab5a" + integrity sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA== + +"@webassemblyjs/wasm-edit@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz#9f9f3ff52a14c980939be0ef9d5df9ebc678ae3b" + integrity sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-buffer" "1.12.1" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/helper-wasm-section" "1.12.1" + "@webassemblyjs/wasm-gen" "1.12.1" + "@webassemblyjs/wasm-opt" "1.12.1" + "@webassemblyjs/wasm-parser" "1.12.1" + "@webassemblyjs/wast-printer" "1.12.1" + +"@webassemblyjs/wasm-gen@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz#a6520601da1b5700448273666a71ad0a45d78547" + integrity sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/ieee754" "1.11.6" + "@webassemblyjs/leb128" "1.11.6" + "@webassemblyjs/utf8" "1.11.6" + +"@webassemblyjs/wasm-opt@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz#9e6e81475dfcfb62dab574ac2dda38226c232bc5" + integrity sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-buffer" "1.12.1" + "@webassemblyjs/wasm-gen" "1.12.1" + "@webassemblyjs/wasm-parser" "1.12.1" + +"@webassemblyjs/wasm-parser@1.12.1", "@webassemblyjs/wasm-parser@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz#c47acb90e6f083391e3fa61d113650eea1e95937" + integrity sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-api-error" "1.11.6" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/ieee754" "1.11.6" + "@webassemblyjs/leb128" "1.11.6" + "@webassemblyjs/utf8" "1.11.6" + +"@webassemblyjs/wast-printer@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz#bcecf661d7d1abdaf989d8341a4833e33e2b31ac" + integrity sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@xtuc/long" "4.2.2" + +"@xtuc/ieee754@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" + integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== + +"@xtuc/long@4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" + integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== + abab@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + acorn-globals@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3" @@ -696,14 +867,19 @@ acorn-globals@^7.0.0: acorn "^8.1.0" acorn-walk "^8.0.2" +acorn-import-attributes@^1.9.5: + version "1.9.5" + resolved "https://registry.yarnpkg.com/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz#7eb1557b1ba05ef18b5ed0ec67591bfab04688ef" + integrity sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ== + acorn-walk@^8.0.2: - version "8.3.3" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e" - integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw== + version "8.3.4" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" + integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== dependencies: acorn "^8.11.0" -acorn@^8.1.0, acorn@^8.11.0, acorn@^8.8.1: +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.7.1, acorn@^8.8.1, acorn@^8.8.2: version "8.12.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== @@ -715,6 +891,21 @@ agent-base@6: dependencies: debug "4" +ajv-keywords@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" + integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== + +ajv@^6.12.5: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ansi-escapes@^4.2.1: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" @@ -834,6 +1025,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -849,7 +1045,7 @@ braces@^3.0.3: dependencies: fill-range "^7.1.1" -browserslist@^4.23.1: +browserslist@^4.21.10, browserslist@^4.23.1: version "4.23.3" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.3.tgz#debb029d3c93ebc97ffbc8d9cbb03403e227c800" integrity sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA== @@ -878,6 +1074,14 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + call-bind@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" @@ -905,9 +1109,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001646: - version "1.0.30001651" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz#52de59529e8b02b1aedcaaf5c05d9e23c0c28138" - integrity sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg== + version "1.0.30001660" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001660.tgz#31218de3463fabb44d0b7607b652e56edf2e2355" + integrity sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg== chalk@^2.4.2: version "2.4.2" @@ -918,7 +1122,7 @@ chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0: +chalk@^4.0.0, chalk@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -931,15 +1135,20 @@ char-regex@^1.0.2: resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== +chrome-trace-event@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz#05bffd7ff928465093314708c93bdfa9bd1f0f5b" + integrity sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ== + ci-info@^3.2.0: version "3.9.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== cjs-module-lexer@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz#c485341ae8fd999ca4ee5af2d7a1c9ae01e0099c" - integrity sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q== + version "1.4.1" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz#707413784dbb3a72aa11c2f2b042a0bef4004170" + integrity sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA== cliui@^8.0.1: version "8.0.1" @@ -991,6 +1200,11 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" +commander@^2.20.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -1001,6 +1215,11 @@ convert-source-map@^2.0.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== +core-js@^3.0.0: + version "3.38.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.38.1.tgz#aa375b79a286a670388a1a363363d53677c0383e" + integrity sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw== + create-jest@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" @@ -1050,11 +1269,11 @@ data-urls@^3.0.2: whatwg-url "^11.0.0" debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: - version "4.3.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b" - integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg== + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== dependencies: - ms "2.1.2" + ms "^2.1.3" decimal.js@^10.4.2: version "10.4.3" @@ -1103,9 +1322,9 @@ domexception@^4.0.0: webidl-conversions "^7.0.0" electron-to-chromium@^1.5.4: - version "1.5.11" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.11.tgz#258077f1077a1c72f2925cd5b326c470a7f5adef" - integrity sha512-R1CccCDYqndR25CaXFd6hp/u9RaaMcftMkphmvuepXr5b1vfLkRml6aWVeBhXJ7rbevHkKEMJtz8XqPf7ffmew== + version "1.5.23" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.23.tgz#6dabd8f7fec5cbf618b732ff4c42950dcc7a3be5" + integrity sha512-mBhODedOXg4v5QWwl21DjM5amzjmI1zw9EPrPK/5Wx7C8jt33bpZNrC7OhHUG3pxRtbLpr3W2dXT+Ph1SsfRZA== emittery@^0.13.1: version "0.13.1" @@ -1117,6 +1336,14 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +enhanced-resolve@^5.0.0, enhanced-resolve@^5.17.1: + version "5.17.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" + integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== + dependencies: + graceful-fs "^4.2.4" + tapable "^2.2.0" + entities@^4.4.0: version "4.5.0" resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" @@ -1141,10 +1368,15 @@ es-errors@^1.3.0: resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== +es-module-lexer@^1.2.1: + version "1.5.4" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.5.4.tgz#a8efec3a3da991e60efa6b633a7cad6ab8d26b78" + integrity sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== + escalade@^3.1.1, escalade@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" - integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== + version "3.2.0" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" + integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== escape-string-regexp@^1.0.5: version "1.0.5" @@ -1167,11 +1399,31 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" +eslint-scope@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + estraverse@^5.2.0: version "5.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" @@ -1182,6 +1434,16 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + +events@^3.2.0, events@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -1213,7 +1475,12 @@ expect@^29.0.0, expect@^29.7.0: jest-message-util "^29.7.0" jest-util "^29.7.0" -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.1.0: +fast-deep-equal@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== @@ -1225,6 +1492,29 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +fetch-mock-jest@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/fetch-mock-jest/-/fetch-mock-jest-1.5.1.tgz#0e13df990d286d9239e284f12b279ed509bf53cd" + integrity sha512-+utwzP8C+Pax1GSka3nFXILWMY3Er2L+s090FOgqVNrNCPp0fDqgXnAHAJf12PLHi0z4PhcTaZNTz8e7K3fjqQ== + dependencies: + fetch-mock "^9.11.0" + +fetch-mock@^9.11.0: + version "9.11.0" + resolved "https://registry.yarnpkg.com/fetch-mock/-/fetch-mock-9.11.0.tgz#371c6fb7d45584d2ae4a18ee6824e7ad4b637a3f" + integrity sha512-PG1XUv+x7iag5p/iNHD4/jdpxL9FtVSqRMUQhPab4hVDt80T1MH5ehzVrL2IdXO9Q2iBggArFvPqjUbHFuI58Q== + dependencies: + "@babel/core" "^7.0.0" + "@babel/runtime" "^7.0.0" + core-js "^3.0.0" + debug "^4.1.1" + glob-to-regexp "^0.4.0" + is-subset "^0.1.1" + lodash.isequal "^4.5.0" + path-to-regexp "^2.2.1" + querystring "^0.2.0" + whatwg-url "^6.5.0" + fill-range@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" @@ -1240,7 +1530,7 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -form-data@4.0.0, form-data@^4.0.0: +form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== @@ -1300,6 +1590,11 @@ get-stream@^6.0.0: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== +glob-to-regexp@^0.4.0, glob-to-regexp@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== + glob@^7.1.3, glob@^7.1.4: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -1324,7 +1619,7 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" -graceful-fs@^4.2.9: +graceful-fs@^4.1.2, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -1404,6 +1699,11 @@ iconv-lite@0.6.3: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" +ieee754@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + import-local@^3.0.2: version "3.2.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" @@ -1436,9 +1736,9 @@ is-arrayish@^0.2.1: integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== is-core-module@^2.13.0: - version "2.15.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.0.tgz#71c72ec5442ace7e76b306e9d48db361f22699ea" - integrity sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA== + version "2.15.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.1.tgz#a7363a25bee942fefab0de13bf6aa372c82dcc37" + integrity sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ== dependencies: hasown "^2.0.2" @@ -1467,6 +1767,11 @@ is-stream@^2.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== +is-subset@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6" + integrity sha512-6Ybun0IkarhmEqxXCNw/C0bna6Zb/TkfUX9UbwJtK6ObwAVCxmAP308WWTHviM/zAqXk05cdhYsUsZeGQh99iw== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -1877,6 +2182,15 @@ jest-watcher@^29.7.0: jest-util "^29.7.0" string-length "^4.0.1" +jest-worker@^27.4.5: + version "27.5.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" + integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^8.0.0" + jest-worker@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" @@ -1952,11 +2266,16 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== -json-parse-even-better-errors@^2.3.0: +json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" @@ -1977,6 +2296,11 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== +loader-runner@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" + integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== + locate-path@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" @@ -1984,11 +2308,21 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + lodash.memoize@4.x: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -2020,10 +2354,10 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -micromatch@^4.0.4: - version "4.0.7" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" - integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q== +micromatch@^4.0.0, micromatch@^4.0.4: + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== dependencies: braces "^3.0.3" picomatch "^2.3.1" @@ -2033,7 +2367,7 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12: +mime-types@^2.1.12, mime-types@^2.1.27: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -2052,16 +2386,21 @@ minimatch@^3.0.4, minimatch@^3.1.1: dependencies: brace-expansion "^1.1.7" -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +neo-async@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== + node-fetch@2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" @@ -2178,10 +2517,15 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-to-regexp@^2.2.1: + version "2.4.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-2.4.0.tgz#35ce7f333d5616f1c1e1bfe266c3aba2e5b2e704" + integrity sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w== + picocolors@^1.0.0, picocolors@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" - integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== + version "1.1.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59" + integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw== picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" @@ -2214,6 +2558,11 @@ pretty-format@^29.0.0, pretty-format@^29.7.0: ansi-styles "^5.0.0" react-is "^18.0.0" +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + prompts@^2.0.1: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -2227,7 +2576,7 @@ psl@^1.1.33: resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== -punycode@^2.1.1: +punycode@^2.1.0, punycode@^2.1.1: version "2.3.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== @@ -2244,16 +2593,44 @@ qs@6.11.2: dependencies: side-channel "^1.0.4" +querystring@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.1.tgz#40d77615bb09d16902a85c3e38aa8b5ed761c2dd" + integrity sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg== + querystringify@^2.1.1: version "2.2.0" resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + react-is@^18.0.0: version "18.3.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== +readable-stream@^4.5.2: + version "4.5.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.5.2.tgz#9e7fc4c45099baeed934bff6eb97ba6cf2729e09" + integrity sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g== + dependencies: + abort-controller "^3.0.0" + buffer "^6.0.3" + events "^3.3.0" + process "^0.11.10" + string_decoder "^1.3.0" + +regenerator-runtime@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" + integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -2290,6 +2667,16 @@ resolve@^1.20.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +safe-buffer@^5.1.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -2302,16 +2689,32 @@ saxes@^6.0.0: dependencies: xmlchars "^2.2.0" +schema-utils@^3.1.1, schema-utils@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" + integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== + dependencies: + "@types/json-schema" "^7.0.8" + ajv "^6.12.5" + ajv-keywords "^3.5.2" + semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.5.3, semver@^7.5.4: +semver@^7.3.4, semver@^7.5.3, semver@^7.5.4: version "7.6.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== +serialize-javascript@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" + integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== + dependencies: + randombytes "^2.1.0" + set-function-length@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" @@ -2369,11 +2772,24 @@ source-map-support@0.5.13: buffer-from "^1.0.0" source-map "^0.6.0" +source-map-support@~0.5.20: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +source-map@^0.7.4: + version "0.7.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" + integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -2403,6 +2819,13 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string_decoder@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -2456,6 +2879,32 @@ symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== +tapable@^2.1.1, tapable@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" + integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== + +terser-webpack-plugin@^5.3.10: + version "5.3.10" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz#904f4c9193c6fd2a03f693a2150c62a92f40d199" + integrity sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w== + dependencies: + "@jridgewell/trace-mapping" "^0.3.20" + jest-worker "^27.4.5" + schema-utils "^3.1.1" + serialize-javascript "^6.0.1" + terser "^5.26.0" + +terser@^5.26.0: + version "5.32.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.32.0.tgz#ee811c0d2d6b741c1cc34a2bc5bcbfc1b5b1f96c" + integrity sha512-v3Gtw3IzpBJ0ugkxEX8U0W6+TnPKRRCWGh1jC/iM/e3Ki5+qvO1L1EAZ56bZasc64aXHwRHNIQEzm6//i5cemQ== + dependencies: + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" + commander "^2.20.0" + source-map-support "~0.5.20" + test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" @@ -2492,6 +2941,13 @@ tough-cookie@^4.1.2: universalify "^0.2.0" url-parse "^1.5.3" +tr46@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + integrity sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA== + dependencies: + punycode "^2.1.0" + tr46@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9" @@ -2518,6 +2974,17 @@ ts-jest@29.1.1: semver "^7.5.3" yargs-parser "^21.0.1" +ts-loader@^9.3.1: + version "9.5.1" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.5.1.tgz#63d5912a86312f1fbe32cef0859fb8b2193d9b89" + integrity sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg== + dependencies: + chalk "^4.1.0" + enhanced-resolve "^5.0.0" + micromatch "^4.0.0" + semver "^7.3.4" + source-map "^0.7.4" + type-detect@4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" @@ -2551,6 +3018,13 @@ update-browserslist-db@^1.1.0: escalade "^3.1.2" picocolors "^1.0.1" +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + url-join@4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" @@ -2587,16 +3061,63 @@ walker@^1.0.8: dependencies: makeerror "1.0.12" +watchpack@^2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" + integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== + dependencies: + glob-to-regexp "^0.4.1" + graceful-fs "^4.1.2" + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== +webidl-conversions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== + webidl-conversions@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== +webpack-sources@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" + integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== + +webpack@^5.94.0: + version "5.94.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.94.0.tgz#77a6089c716e7ab90c1c67574a28da518a20970f" + integrity sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg== + dependencies: + "@types/estree" "^1.0.5" + "@webassemblyjs/ast" "^1.12.1" + "@webassemblyjs/wasm-edit" "^1.12.1" + "@webassemblyjs/wasm-parser" "^1.12.1" + acorn "^8.7.1" + acorn-import-attributes "^1.9.5" + browserslist "^4.21.10" + chrome-trace-event "^1.0.2" + enhanced-resolve "^5.17.1" + es-module-lexer "^1.2.1" + eslint-scope "5.1.1" + events "^3.2.0" + glob-to-regexp "^0.4.1" + graceful-fs "^4.2.11" + json-parse-even-better-errors "^2.3.1" + loader-runner "^4.2.0" + mime-types "^2.1.27" + neo-async "^2.6.2" + schema-utils "^3.2.0" + tapable "^2.1.1" + terser-webpack-plugin "^5.3.10" + watchpack "^2.4.1" + webpack-sources "^3.2.3" + whatwg-encoding@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" @@ -2625,6 +3146,15 @@ whatwg-url@^5.0.0: tr46 "~0.0.3" webidl-conversions "^3.0.0" +whatwg-url@^6.5.0: + version "6.5.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" + integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"